Skip to content

Commit 1f073b6

Browse files
petschkithet
authored andcommitted
breaking: Upgrade Pattern to ES6 based Patternslib.
1 parent 8ffd3a4 commit 1f073b6

12 files changed

+607
-597
lines changed

bundle-config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import registry from "@patternslib/patternslib/src/core/registry";
2+
import "./src/leaflet";
3+
4+
registry.init();

index.html

Lines changed: 3 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -1,184 +1,6 @@
11
<!DOCTYPE HTML>
22
<html>
3-
<head>
4-
<meta http-equiv="content-type" content="text/html; charset=utf-8">
5-
<title>pat-leaflet demo</title>
6-
<link rel="stylesheet" href="bower_components/leaflet/dist/leaflet.css"/>
7-
<link rel="stylesheet" href="bower_components/Leaflet.fullscreen/dist/leaflet.fullscreen.css"/>
8-
<link rel="stylesheet" href="bower_components/L.GeoSearch/src/css/l.geosearch.css"/>
9-
<link rel="stylesheet" href="bower_components/leaflet.markercluster/dist/MarkerCluster.Default.css"/>
10-
<link rel="stylesheet" href="bower_components/leaflet.markercluster/dist/MarkerCluster.css"/>
11-
<link rel="stylesheet" href="bower_components/Leaflet.awesome-markers/dist/leaflet.awesome-markers.css"/>
12-
<link rel="stylesheet" href="bower_components/leaflet.locatecontrol/dist/L.Control.Locate.css"/>
13-
<link rel="stylesheet" href="bower_components/font-awesome/css/fontawesome.css"/>
14-
<link rel="stylesheet" href="bower_components/Leaflet-MiniMap/dist/Control.MiniMap.min.css"/>
15-
<link rel="stylesheet" href="bower_components/Leaflet.SimpleMarkers/lib/Control.SimpleMarkers.css"/>
16-
<link rel="stylesheet" href="src/pat-leaflet.css"/>
17-
<script data-main="main" src="bower_components/requirejs/require.js"></script>
18-
19-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/themes/prism.min.css"/>
20-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/plugins/unescaped-markup/prism-unescaped-markup.min.css"/>
21-
22-
</head>
23-
<body role="document">
24-
25-
<h1>pat-leaflet demo - minimal</h1>
26-
<div id="map1" class="pat-leaflet" data-pat-leaflet='
27-
{
28-
"fullscreencontrol": false,
29-
"locatecontrol": false,
30-
"zoomcontrol": false,
31-
"map_layers": [{"title": "Map", "id": "OpenStreetMap.Mapnik"}]
32-
}'></div>
33-
34-
<h2>Code</h2>
35-
<pre class="language-markup"><code><!--
36-
<div id="map1" class="pat-leaflet" data-pat-leaflet='
37-
{
38-
"fullscreencontrol": false,
39-
"locatecontrol": false,
40-
"zoomcontrol": false,
41-
"map_layers": [{"title": "Map", "id": "OpenStreetMap.Mapnik"}]
42-
}'></div>
43-
--></code></pre>
44-
45-
<h1>pat-leaflet demo - full</h1>
46-
<div id="map2" class="pat-leaflet"
47-
data-pat-leaflet='{
48-
"fullscreencontrol": true,
49-
"locatecontrol": true,
50-
"zoomcontrol": true,
51-
"minimap": true,
52-
"geosearch": true,
53-
"geosearch_provider": "google",
54-
"addmarker": true,
55-
"maxClusterRadius": 80
56-
}'
57-
data-geojson='{
58-
"type": "FeatureCollection",
59-
"features": [
60-
{
61-
"type": "Feature",
62-
"id": 1,
63-
"properties": {
64-
"popup": "reverse - copenhagen international poetry festival (dnk), copenhagen, denmark",
65-
"editable": true,
66-
"latinput": "#latinput",
67-
"lnginput": "#lnginput"
68-
},
69-
"geometry": {
70-
"type": "Point",
71-
"coordinates": [
72-
12.55568,
73-
55.69078
74-
]
75-
}
76-
},
77-
{
78-
"type": "Feature",
79-
"id": 2,
80-
"properties": {
81-
"popup": "hoergeREDE (aut), graz, austria",
82-
"color": "purple",
83-
"extraClasses": "pat-leaflet-marker--hoergerede-graz"
84-
},
85-
"geometry": {
86-
"type": "Point",
87-
"coordinates": [
88-
15.4382918,
89-
47.0708101
90-
]
91-
}
92-
},
93-
{
94-
"type": "Feature",
95-
"id": 3,
96-
"properties": {
97-
"popup": "sarajevo days of poetry (bih), sarajevo, bosnia"
98-
},
99-
"geometry": {
100-
"type": "Point",
101-
"coordinates": [
102-
18.3886134,
103-
43.8514981
104-
]
105-
}
106-
}
107-
]}'></div>
108-
<input type="text" name="latitude" value="55.69078" id="latinput"/>
109-
<input type="text" name="longitude" value="12.55568" id="lnginput"/>
110-
111-
<h2>Code</h2>
112-
<pre class="language-markup"><code><!--
113-
<div id="map2" class="pat-leaflet"
114-
data-pat-leaflet='{
115-
"fullscreencontrol": true,
116-
"locatecontrol": true,
117-
"zoomcontrol": true,
118-
"minimap": true,
119-
"geosearch": true,
120-
"geosearch_provider": "google",
121-
"addmarker": true,
122-
"maxClusterRadius": 80
123-
}'
124-
data-geojson='{
125-
"type": "FeatureCollection",
126-
"features": [
127-
{
128-
"type": "Feature",
129-
"id": 1,
130-
"properties": {
131-
"popup": "reverse - copenhagen international poetry festival (dnk), copenhagen, denmark",
132-
"editable": true,
133-
"latinput": "#latinput",
134-
"lnginput": "#lnginput"
135-
},
136-
"geometry": {
137-
"type": "Point",
138-
"coordinates": [
139-
12.55568,
140-
55.69078
141-
]
142-
}
143-
},
144-
{
145-
"type": "Feature",
146-
"id": 2,
147-
"properties": {
148-
"popup": "hoergeREDE (aut), graz, austria",
149-
"color": "purple",
150-
"extraClasses": "pat-leaflet-marker--hoergerede-graz"
151-
},
152-
"geometry": {
153-
"type": "Point",
154-
"coordinates": [
155-
15.4382918,
156-
47.0708101
157-
]
158-
}
159-
},
160-
{
161-
"type": "Feature",
162-
"id": 3,
163-
"properties": {
164-
"popup": "sarajevo days of poetry (bih), sarajevo, bosnia"
165-
},
166-
"geometry": {
167-
"type": "Point",
168-
"coordinates": [
169-
18.3886134,
170-
43.8514981
171-
]
172-
}
173-
}
174-
]}'></div>
175-
<input type="text" name="latitude" value="55.69078" id="latinput"/>
176-
<input type="text" name="longitude" value="12.55568" id="lnginput"/>
177-
178-
--></code></pre>
179-
180-
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/prism.min.js"></script>
181-
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.5.1/plugins/unescaped-markup/prism-unescaped-markup.min.js"></script>
182-
183-
</body>
3+
<head>
4+
<meta http-equiv="refresh" content="0; url=./src" />
5+
</head>
1846
</html>

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Webpack entry point for module federation.
2+
import "@patternslib/patternslib/webpack/module_federation";
3+
// The next import needs to be kept with brackets, otherwise we get this error:
4+
// "Shared module is not available for eager consumption."
5+
import("./bundle-config");

package.json

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,53 @@
11
{
2-
"name": "pat-leaflet",
3-
"description": "Patternslib Leaflet integration",
4-
"version": "1.3.0",
5-
"dependencies": {},
6-
"devDependencies": {
7-
"bower": "latest",
8-
"requirejs": "",
9-
"http-server": "",
10-
"grunt": "",
11-
"grunt-contrib-concat": "",
12-
"grunt-contrib-uglify": "",
13-
"grunt-contrib-copy": "",
14-
"grunt-sed": ""
15-
},
16-
"repository": {
17-
"type": "git",
18-
"url": "https://github.com/collective/plone.formwidget.geolocation"
19-
},
20-
"keywords": [
21-
"patternslib",
22-
"pattern",
23-
"leaflet",
24-
"map",
25-
"geo"
26-
],
27-
"license": "BSD-3-Clause"
2+
"name": "@patternslib/pat-leaflet",
3+
"version": "2.0.0",
4+
"description": "Patternslib Leaflet integration",
5+
"license": "MIT",
6+
"main": "./src/leaflet.js",
7+
"dependencies": {
8+
"@patternslib/patternslib": "*",
9+
"fontawesome-free": "^1.0.4",
10+
"jquery": "^3.6.1",
11+
"leaflet-geosearch": "^3.6.1",
12+
"leaflet-minimap": "^3.6.1",
13+
"leaflet-providers": "^1.13.0",
14+
"leaflet-sleep": "^0.5.2",
15+
"leaflet.awesome-markers": "^2.0.5",
16+
"leaflet.fullscreen": "^2.4.0",
17+
"leaflet.locatecontrol": "^0.76.1",
18+
"leaflet.markercluster": "^1.5.3",
19+
"leaflet.simplemarkers": "git+https://github.com/jdomingu/Leaflet.SimpleMarkers.git",
20+
"leaflet": "^1.9.1"
21+
},
22+
"devDependencies": {
23+
"@patternslib/dev": "^2.7.1"
24+
},
25+
"scripts": {
26+
"start": "NODE_ENV=development webpack serve --config webpack.config.js",
27+
"watch": "NODE_ENV=development webpack --config webpack.config.js --watch",
28+
"build": "NODE_ENV=production webpack --config webpack.config.js",
29+
"build:dev": "NODE_ENV=development webpack --config webpack.config.js",
30+
"build:stats": "NODE_ENV=production webpack --config webpack.config.js --json > stats.json",
31+
"test": "jest"
32+
},
33+
"browserslist": [
34+
">0.2%",
35+
"ie >= 11",
36+
"not dead"
37+
],
38+
"homepage": "https://github.com/patternslib/pat-leaflet",
39+
"repository": {
40+
"type": "git",
41+
"url": "https://github.com/patternslib/pat-leaflet.git"
42+
},
43+
"keywords": [
44+
"patternslib",
45+
"pattern",
46+
"leaflet",
47+
"map",
48+
"geo"
49+
],
50+
"publishConfig": {
51+
"access": "public"
52+
}
2853
}

src/documentation.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# pat-leaflet
2+
3+
## Description
4+
5+
Implements `Leaflet.js` with various options.
6+
7+
## Documentation
8+
9+
A more detailed documentation on how to use it goes here.
10+
11+
### Options reference
12+
13+
| Property | Default Value | Values | Type | Description |
14+
| -------------- | ------------- | ------ | ----------------- | ----------------------------- |
15+
| example_option | [1, 2, 3] | | Array of integers | Example configuration option. |

src/index.html

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>leaflet demo</title>
6+
<script src="/bundle.min.js"></script>
7+
</head>
8+
<body>
9+
10+
<h2>pat-leaflet demo - minimal</h2>
11+
<div id="map1" style="height:400px" class="pat-leaflet" data-pat-leaflet='
12+
{
13+
"fullscreencontrol": false,
14+
"locatecontrol": false,
15+
"zoomcontrol": true,
16+
"geosearch": true,
17+
"latitude": 47.33325135,
18+
"longitude": 9.645877746692685
19+
}'></div>
20+
21+
<h2>pat-leaflet demo - full</h2>
22+
<div id="map2" style="height:400px" class="pat-leaflet"
23+
data-pat-leaflet='{
24+
"fullscreencontrol": true,
25+
"locatecontrol": true,
26+
"zoomcontrol": true,
27+
"minimap": true,
28+
"geosearch": true,
29+
"geosearch_provider": "nominatim",
30+
"addmarker": true,
31+
"maxClusterRadius": 80
32+
}'
33+
data-geojson='{
34+
"type": "FeatureCollection",
35+
"features": [
36+
{
37+
"type": "Feature",
38+
"id": 1,
39+
"properties": {
40+
"popup": "reverse - copenhagen international poetry festival (dnk), copenhagen, denmark",
41+
"editable": true,
42+
"latinput": "#latinput",
43+
"lnginput": "#lnginput"
44+
},
45+
"geometry": {
46+
"type": "Point",
47+
"coordinates": [
48+
12.55568,
49+
55.69078
50+
]
51+
}
52+
},
53+
{
54+
"type": "Feature",
55+
"id": 2,
56+
"properties": {
57+
"popup": "hoergeREDE (aut), graz, austria",
58+
"color": "purple",
59+
"extraClasses": "pat-leaflet-marker--hoergerede-graz"
60+
},
61+
"geometry": {
62+
"type": "Point",
63+
"coordinates": [
64+
15.4382918,
65+
47.0708101
66+
]
67+
}
68+
},
69+
{
70+
"type": "Feature",
71+
"id": 3,
72+
"properties": {
73+
"popup": "sarajevo days of poetry (bih), sarajevo, bosnia"
74+
},
75+
"geometry": {
76+
"type": "Point",
77+
"coordinates": [
78+
18.3886134,
79+
43.8514981
80+
]
81+
}
82+
}
83+
]}'></div>
84+
<input type="text" name="latitude" value="55.69078" id="latinput"/>
85+
<input type="text" name="longitude" value="12.55568" id="lnginput"/>
86+
87+
</body>
88+
</html>

0 commit comments

Comments
 (0)