Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '22'
cache: 'yarn'
- run: |
make install
Expand Down
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

9 changes: 3 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
-include .env
export

YARN ?= npx yarn

.PHONY: install
stamp-yarn install:
npx yarn install
# Install pre commit hook
npx yarn husky install
touch stamp-yarn
yarn.lock install:
$(YARN) install


# Unlink any linked dependencies before building a bundle.
Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@patternslib/dev/eslint.config.js");
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE HTML>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=./src" />
</head>
<head>
<meta http-equiv="refresh" content="0; url=./src" />
</head>
</html>
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
"license": "MIT",
"main": "./src/leaflet.js",
"dependencies": {
"@patternslib/patternslib": ">=9.9.16",
"@patternslib/patternslib": ">=9.10.3",
"fontawesome-free": "^1.0.4",
"jquery": "^3.7.1",
"leaflet": "^1.9.4",
"leaflet-geosearch": "^4.0.0",
"leaflet-geosearch": "^4.2.0",
"leaflet-minimap": "^3.6.1",
"leaflet-providers": "^2.0.0",
"leaflet-sleep": "^0.5.2",
"leaflet.awesome-markers": "^2.0.5",
"leaflet.fullscreen": "^3.0.2",
"leaflet.locatecontrol": "^0.81.1",
"leaflet.fullscreen": "^4.0.0",
"leaflet.locatecontrol": "^0.84.2",
"leaflet.markercluster": "^1.5.3",
"leaflet.simplemarkers": "git+https://github.com/jdomingu/Leaflet.SimpleMarkers.git"
},
"devDependencies": {
"@patternslib/dev": "^3.6.1"
"@patternslib/dev": "^3.8.1"
},
"scripts": {
"start": "NODE_ENV=development webpack serve --config webpack.config.js",
Expand Down
57 changes: 32 additions & 25 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>leaflet demo</title>
<script src="https://cdn.jsdelivr.net/npm/@patternslib/[email protected]/dist/bundle.min.js"></script>
<script src="/remote.min.js"></script>
</head>
<body>

<h2>pat-leaflet demo - minimal</h2>
<section class="pat-clone-code">
<div id="map1" style="height:400px" class="pat-leaflet" data-pat-leaflet='
<head>
<meta charset="utf-8" />
<title>leaflet demo</title>
<script src="https://cdn.jsdelivr.net/npm/@patternslib/[email protected]/dist/bundle.min.js"></script>
<script src="/remote.min.js"></script>
</head>
<body>
<h2>pat-leaflet demo - minimal</h2>
<section class="pat-clone-code">
<div
id="map1"
style="height: 400px"
class="pat-leaflet"
data-pat-leaflet='
{
"fullscreencontrol": false,
"locatecontrol": false,
"zoomcontrol": true,
"geosearch": true,
"latitude": 47.33325135,
"longitude": 9.645877746692685
}'></div>
</section>
}'
></div>
</section>

<h2>pat-leaflet demo - full</h2>
<section class="pat-clone-code">
<div id="map2" style="height:400px" class="pat-leaflet"
data-pat-leaflet='{
<h2>pat-leaflet demo - full</h2>
<section class="pat-clone-code">
<div
id="map2"
style="height: 400px"
class="pat-leaflet"
data-pat-leaflet='{
"fullscreencontrol": true,
"locatecontrol": true,
"zoomcontrol": true,
Expand All @@ -35,7 +42,7 @@ <h2>pat-leaflet demo - full</h2>
"maxClusterRadius": 80,
"useCluster": true
}'
data-geojson='{
data-geojson='{
"type": "FeatureCollection",
"features": [
{
Expand Down Expand Up @@ -85,10 +92,10 @@ <h2>pat-leaflet demo - full</h2>
]
}
}
]}'></div>
<input type="text" name="latitude" value="55.69078" id="latinput"/>
<input type="text" name="longitude" value="12.55568" id="lnginput"/>
</section>

</body>
]}'
></div>
<input type="text" name="latitude" value="55.69078" id="latinput" />
<input type="text" name="longitude" value="12.55568" id="lnginput" />
</section>
</body>
</html>
18 changes: 9 additions & 9 deletions src/leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class Pattern extends BasePattern {
// build layers object with tileLayer instances
baseLayers[layer.title] = this.L.tileLayer.provider(
layer.id,
layer.options
layer.options,
);
}
if (options.map_layers.length > 1) {
Expand All @@ -150,17 +150,17 @@ class Pattern extends BasePattern {
response = await fetch(options.geojson_ajaxurl);
const data = await response.json();
this.init_geojson(map, data);
} catch (e) {
} catch {
log.info(
`Could not load geojson data from url ${options.geojson_ajaxurl}`
`Could not load geojson data from url ${options.geojson_ajaxurl}`,
);
return;
}
} else if (this.el.dataset.geojson) {
try {
// inject inline geoJSON data object
this.init_geojson(map, JSON.parse(this.el.dataset.geojson));
} catch (e) {
} catch {
log.info("Could not parse geojson data.");
return;
}
Expand Down Expand Up @@ -198,7 +198,7 @@ class Pattern extends BasePattern {
e.marker.setIcon(this.create_marker("red"));
this.bind_popup(
{ properties: { editable: true, popup: e.location.label } },
e.marker
e.marker,
);
this.marker_cluster.addLayer(e.marker);
}
Expand Down Expand Up @@ -229,9 +229,9 @@ class Pattern extends BasePattern {
const minimap = new this.L.Control.MiniMap(
this.L.tileLayer.provider(
options.default_map_layer.id,
options.default_map_layer.options
options.default_map_layer.options,
),
{ toggleDisplay: true, mapOptions: { sleep: false } }
{ toggleDisplay: true, mapOptions: { sleep: false } },
);
map.addControl(minimap);
}
Expand Down Expand Up @@ -290,7 +290,7 @@ class Pattern extends BasePattern {
// fit bounds
bounds = this.marker_cluster.getBounds();
map.fitBounds(bounds, this.fitBoundsOptions);
}
},
);
}
if (input_lng) {
Expand All @@ -309,7 +309,7 @@ class Pattern extends BasePattern {
// fit bounds
bounds = this.marker_cluster.getBounds();
map.fitBounds(bounds, this.fitBoundsOptions);
}
},
);
}
return marker;
Expand Down
2 changes: 1 addition & 1 deletion src/leaflet.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe("pat-leaflet", () => {
},
],
}),
})
}),
);

document.body.innerHTML = `<div class="pat-leaflet" data-pat-leaflet='{
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = () => {
...package_json_patternslib.dependencies,
...package_json.dependencies,
},
})
}),
);

if (process.env.NODE_ENV === "development") {
Expand Down
Loading