Skip to content

Commit 91a4fa0

Browse files
authored
chore: upgrade sveltekit to v2 and maplibre to v4 (#386)
1 parent 03cbb48 commit 91a4fa0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2632
-3514
lines changed

.changeset/grumpy-bats-appear.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@watergis/maplibre-gl-tour": patch
3+
---
4+
5+
chore: update dependencies

.changeset/swift-donkeys-invite.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
"@watergis/svelte-collapsible-panel": major
3+
"@watergis/svelte-maplibre-attribute-popup": major
4+
"@watergis/svelte-maplibre-attribute-table": major
5+
"@watergis/svelte-maplibre-style-switcher": major
6+
"@watergis/svelte-maplibre-valhalla": major
7+
"@watergis/svelte-maplibre-measure": major
8+
"@watergis/maplibre-center-icon": major
9+
"@watergis/svelte-maplibre-export": major
10+
"@watergis/svelte-maplibre-legend": major
11+
"@watergis/svelte-maplibre-search": major
12+
"@watergis/svelte-maplibre-share": major
13+
"@watergis/svelte-maplibre-menu": major
14+
---
15+
16+
feat: upgrade sveltekit to v2, upgrade maplibre to v4

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
},
2222
"homepage": "https://github.com/watergis/svelte-maplibre-components#readme",
2323
"devDependencies": {
24-
"@changesets/cli": "^2.26.2",
25-
"lefthook": "^1.4.7",
26-
"turbo": "^1.10.12"
24+
"@changesets/cli": "^2.27.1",
25+
"lefthook": "^1.6.7",
26+
"turbo": "^1.12.5"
2727
},
2828
"packageManager": "pnpm@8.15.2",
2929
"engines": {

packages/attribute-popup/package.json

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"build": "svelte-kit sync && svelte-package",
1515
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
1616
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
17-
"lint": "prettier --plugin-search-dir . --check . && eslint .",
18-
"format": "prettier --plugin-search-dir . --write ."
17+
"lint": "prettier --check . && eslint .",
18+
"format": "prettier --write ."
1919
},
2020
"repository": {
2121
"type": "git",
@@ -36,27 +36,28 @@
3636
"homepage": "https://github.com/watergis/svelte-maplibre-components/tree/main/packages/attribute-popup#readme",
3737
"devDependencies": {
3838
"@arkweid/lefthook": "^0.7.7",
39-
"@sveltejs/adapter-auto": "^2.1.0",
40-
"@sveltejs/kit": "^1.22.3",
41-
"@sveltejs/package": "^2.2.0",
42-
"@typescript-eslint/eslint-plugin": "^6.2.0",
43-
"@typescript-eslint/parser": "^6.2.0",
44-
"eslint": "^8.46.0",
45-
"eslint-config-prettier": "^9.0.0",
46-
"eslint-plugin-svelte": "^2.32.4",
47-
"prettier": "^3.0.0",
48-
"prettier-plugin-svelte": "^3.0.3",
49-
"sass": "^1.64.1",
50-
"svelte": "^4.1.1",
51-
"svelte-check": "^3.4.6",
52-
"svelte-preprocess": "^5.0.4",
53-
"tslib": "^2.6.1",
54-
"typescript": "^5.1.6",
55-
"vite": "^4.4.7"
39+
"@sveltejs/adapter-auto": "^3.1.1",
40+
"@sveltejs/kit": "^2.5.4",
41+
"@sveltejs/package": "^2.3.0",
42+
"@sveltejs/vite-plugin-svelte": "^3.0.2",
43+
"@typescript-eslint/eslint-plugin": "^7.2.0",
44+
"@typescript-eslint/parser": "^7.2.0",
45+
"eslint": "^8.57.0",
46+
"eslint-config-prettier": "^9.1.0",
47+
"eslint-plugin-svelte": "^2.35.1",
48+
"prettier": "^3.2.5",
49+
"prettier-plugin-svelte": "^3.2.2",
50+
"sass": "^1.72.0",
51+
"svelte": "^4.2.12",
52+
"svelte-check": "^3.6.7",
53+
"svelte-preprocess": "^5.1.3",
54+
"tslib": "^2.6.2",
55+
"typescript": "^5.4.2",
56+
"vite": "^5.1.6"
5657
},
5758
"type": "module",
5859
"dependencies": {
59-
"maplibre-gl": "^3.2.1"
60+
"maplibre-gl": "^4.1.0"
6061
},
6162
"peerDependencies": {
6263
"svelte": "^4.0.0"

packages/attribute-popup/src/routes/+page.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/attribute-popup/vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ const config: UserConfig = {
88
alias: {
99
$example: resolve('./src/example')
1010
}
11+
},
12+
ssr: {
13+
noExternal: ['maplibre-gl']
1114
}
1215
};
1316

packages/attribute-table/package.json

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"prepublishOnly": "npm run package",
1111
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
1212
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
13-
"lint": "prettier --plugin-search-dir . --check . && eslint .",
14-
"format": "prettier --plugin-search-dir . --write ."
13+
"lint": "prettier --check . && eslint .",
14+
"format": "prettier --write ."
1515
},
1616
"repository": {
1717
"type": "git",
@@ -44,31 +44,33 @@
4444
"svelte": "^4.0.0"
4545
},
4646
"devDependencies": {
47-
"@sveltejs/adapter-auto": "^2.1.0",
48-
"@sveltejs/kit": "^1.22.3",
49-
"@sveltejs/package": "^2.2.0",
50-
"@typescript-eslint/eslint-plugin": "^6.2.0",
51-
"@typescript-eslint/parser": "^6.2.0",
47+
"@sveltejs/adapter-auto": "^3.1.1",
48+
"@sveltejs/kit": "^2.5.4",
49+
"@sveltejs/package": "^2.3.0",
50+
"@sveltejs/vite-plugin-svelte": "^3.0.2",
51+
"@typescript-eslint/eslint-plugin": "^7.2.0",
52+
"@typescript-eslint/parser": "^7.2.0",
5253
"bulma": "^0.9.4",
53-
"eslint": "^8.46.0",
54-
"eslint-config-prettier": "^9.0.0",
55-
"eslint-plugin-svelte": "^2.32.4",
56-
"prettier": "^3.0.0",
57-
"prettier-plugin-svelte": "^3.0.3",
58-
"publint": "^0.2.0",
59-
"sass": "^1.64.1",
60-
"svelte": "^4.1.1",
61-
"svelte-check": "^3.4.6",
62-
"tslib": "^2.6.1",
63-
"typescript": "^5.1.6",
64-
"vite": "^4.4.7"
54+
"eslint": "^8.57.0",
55+
"eslint-config-prettier": "^9.1.0",
56+
"eslint-plugin-svelte": "^2.35.1",
57+
"pmtiles": "^3.0.5",
58+
"prettier": "^3.2.5",
59+
"prettier-plugin-svelte": "^3.2.2",
60+
"publint": "^0.2.7",
61+
"sass": "^1.72.0",
62+
"svelte": "^4.2.12",
63+
"svelte-check": "^3.6.7",
64+
"tslib": "^2.6.2",
65+
"typescript": "^5.4.2",
66+
"vite": "^5.1.6"
6567
},
6668
"svelte": "./dist/index.js",
6769
"types": "./dist/index.d.ts",
6870
"type": "module",
6971
"dependencies": {
70-
"@vincjo/datatables": "^1.12.2",
72+
"@vincjo/datatables": "^1.14.5",
7173
"@watergis/svelte-maplibre-menu": "workspace:^",
72-
"maplibre-gl": "^3.2.1"
74+
"maplibre-gl": "^4.1.0"
7375
}
7476
}

packages/attribute-table/src/example/Map.svelte

Lines changed: 0 additions & 36 deletions
This file was deleted.

packages/attribute-table/src/lib/AttributeTable.svelte

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,12 @@
170170
});
171171
} else if (type === 'linestring') {
172172
const coordinates = geometry.coordinates;
173-
const bounds = coordinates.reduce(function (bounds, coord) {
174-
return bounds.extend(coord);
175-
}, new LngLatBounds(coordinates[0], coordinates[0]));
173+
const bounds = coordinates.reduce(
174+
function (bounds, coord) {
175+
return bounds.extend(coord);
176+
},
177+
new LngLatBounds(coordinates[0], coordinates[0])
178+
);
176179
177180
if (!isPan) {
178181
map.fitBounds(bounds, {
@@ -190,9 +193,12 @@
190193
}
191194
} else if (type === 'polygon') {
192195
const coordinates = geometry.coordinates[0];
193-
const bounds = coordinates.reduce(function (bounds, coord) {
194-
return bounds.extend(coord);
195-
}, new LngLatBounds(coordinates[0], coordinates[0]));
196+
const bounds = coordinates.reduce(
197+
function (bounds, coord) {
198+
return bounds.extend(coord);
199+
},
200+
new LngLatBounds(coordinates[0], coordinates[0])
201+
);
196202
197203
if (!isPan) {
198204
map.fitBounds(bounds, {
@@ -233,7 +239,7 @@
233239
on:click={handleReload}
234240
disabled={selectedSourceLayerId && !mapChanged}
235241
>
236-
<i class="fa-solid fa-rotate"></i>
242+
<i class="fa-solid fa-rotate"></i>
237243
</button>
238244
</header>
239245

@@ -273,15 +279,15 @@
273279
zoomToFeature(feature);
274280
}}
275281
>
276-
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
282+
<i class="fa-solid fa-magnifying-glass fa-lg"></i>
277283
</button>
278284
<button
279285
class="operation-button"
280286
on:click={() => {
281287
zoomToFeature(feature, true);
282288
}}
283289
>
284-
<i class="fa-solid fa-up-down-left-right fa-lg"></i>
290+
<i class="fa-solid fa-up-down-left-right fa-lg"></i>
285291
</button>
286292
</div>
287293
</td>
Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,46 @@
11
<script lang="ts">
2-
import Map from '$example/Map.svelte';
2+
import AttributeTableControl from '$lib';
3+
import { addProtocol, Map, NavigationControl } from 'maplibre-gl';
4+
import { Protocol } from 'pmtiles';
5+
import { onMount } from 'svelte';
6+
7+
let mapContainer: HTMLDivElement;
8+
let map: Map;
9+
10+
onMount(() => {
11+
const protocol = new Protocol();
12+
addProtocol('pmtiles', protocol.tile);
13+
map = new Map({
14+
container: mapContainer,
15+
style: 'https://narwassco.github.io/mapbox-stylefiles/unvt/style.json',
16+
hash: true
17+
});
18+
19+
map.addControl(new NavigationControl(), 'top-right');
20+
});
321
</script>
422

523
<sveltekit:head>
624
<title>Svelte maplibre attribute table example</title>
25+
26+
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" />
27+
<link
28+
rel="stylesheet"
29+
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
30+
/>
731
</sveltekit:head>
832

9-
<Map />
33+
<AttributeTableControl bind:map position="top-right" rowsPerPage={50} minZoom={14}>
34+
<div class="map" bind:this={mapContainer} />
35+
</AttributeTableControl>
36+
37+
<style>
38+
.map {
39+
position: absolute;
40+
top: 0;
41+
bottom: 0;
42+
width: 100%;
43+
height: 100%;
44+
z-index: 1;
45+
}
46+
</style>

packages/attribute-table/src/routes/+page.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/attribute-table/svelte.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import adapter from '@sveltejs/adapter-auto';
2-
import { vitePreprocess } from '@sveltejs/kit/vite';
2+
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
33

44
/** @type {import('@sveltejs/kit').Config} */
55
const config = {

packages/attribute-table/vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ const config: UserConfig = {
1414
// Allow serving files from one level up to the project root
1515
allow: ['..']
1616
}
17+
},
18+
ssr: {
19+
noExternal: ['maplibre-gl']
1720
}
1821
};
1922

packages/center/package.json

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"build": "svelte-kit sync && svelte-package",
1515
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
1616
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
17-
"lint": "prettier --plugin-search-dir . --check . && eslint .",
18-
"format": "prettier --plugin-search-dir . --write ."
17+
"lint": "prettier --check . && eslint .",
18+
"format": "prettier --write ."
1919
},
2020
"repository": {
2121
"type": "git",
@@ -34,26 +34,28 @@
3434
},
3535
"homepage": "https://github.com/watergis/svelte-maplibre-components/tree/main/packages/center#readme",
3636
"devDependencies": {
37-
"@sveltejs/adapter-auto": "^2.1.0",
38-
"@sveltejs/kit": "^1.22.3",
39-
"@sveltejs/package": "^2.2.0",
40-
"@typescript-eslint/eslint-plugin": "^6.2.0",
41-
"@typescript-eslint/parser": "^6.2.0",
42-
"eslint": "^8.46.0",
43-
"eslint-config-prettier": "^9.0.0",
44-
"eslint-plugin-svelte": "^2.32.4",
45-
"prettier": "^3.0.0",
46-
"prettier-plugin-svelte": "^3.0.3",
47-
"svelte": "^4.1.1",
48-
"svelte-check": "^3.4.6",
49-
"svelte-preprocess": "^5.0.4",
50-
"tslib": "^2.6.1",
51-
"typescript": "^5.1.6",
52-
"vite": "^4.4.7"
37+
"@sveltejs/adapter-auto": "^3.1.1",
38+
"@sveltejs/kit": "^2.5.4",
39+
"@sveltejs/package": "^2.3.0",
40+
"@sveltejs/vite-plugin-svelte": "^3.0.2",
41+
"@typescript-eslint/eslint-plugin": "^7.2.0",
42+
"@typescript-eslint/parser": "^7.2.0",
43+
"eslint": "^8.57.0",
44+
"eslint-config-prettier": "^9.1.0",
45+
"eslint-plugin-svelte": "^2.35.1",
46+
"pmtiles": "^3.0.5",
47+
"prettier": "^3.2.5",
48+
"prettier-plugin-svelte": "^3.2.2",
49+
"svelte": "^4.2.12",
50+
"svelte-check": "^3.6.7",
51+
"svelte-preprocess": "^5.1.3",
52+
"tslib": "^2.6.2",
53+
"typescript": "^5.4.2",
54+
"vite": "^5.1.6"
5355
},
5456
"type": "module",
5557
"dependencies": {
56-
"maplibre-gl": "^3.2.1"
58+
"maplibre-gl": "^4.1.0"
5759
},
5860
"peerDependencies": {
5961
"svelte": "^4.0.0"

0 commit comments

Comments
 (0)