Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Svelte 5 runes, snippets, callbacks #214

Merged
merged 50 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
d72c52d
breaking: require Svelte 5 and migrate to runes (#213)
benmccann Nov 8, 2024
e6aa17a
regen lockfile
dimfeld Nov 8, 2024
75f2c84
use commonjs for tailwind config to appease Node 20
dimfeld Nov 9, 2024
402674d
Upgrade to modern eslint config
dimfeld Nov 9, 2024
60daeb4
Naive convert of `run` to `$effect`
dimfeld Nov 9, 2024
76fa08f
Fix map bind
dimfeld Nov 9, 2024
9f4e081
Simpler effect in draw page
dimfeld Nov 9, 2024
1ad8f39
Other small improvements
dimfeld Nov 9, 2024
cb1ab39
fix undefined at start
dimfeld Nov 9, 2024
b286fc5
switch events to svelte 5 style
dimfeld Nov 9, 2024
fa11769
change nulls to undefined and improve type safety
dimfeld Nov 10, 2024
79565f0
update lockfile
dimfeld Nov 11, 2024
4104504
add types for snippet arguments
dimfeld Nov 11, 2024
45bb649
WIP update map context to use runes
dimfeld Nov 12, 2024
a2f41ce
move all files to new context methods
dimfeld Nov 14, 2024
1f190bf
update export map
dimfeld Nov 14, 2024
2c66bb0
1 more fix
dimfeld Nov 14, 2024
a6c5f26
Make Popup data a generic
dimfeld Nov 14, 2024
3037f1d
Fix remaining type errors in DeckGlLayer and example
dimfeld Nov 14, 2024
543ee0a
placekitten is gone so switch to placedog
dimfeld Nov 14, 2024
495347f
Make it possible to destructure `MapContext` and still use `eventTopM…
dimfeld Nov 14, 2024
d353fad
Update ClusterPopup for new context method
dimfeld Nov 14, 2024
9036285
WIP adding more feature generics
dimfeld Nov 14, 2024
8fa7dbf
disable "double click on zoom" when showing popup on double click
dimfeld Nov 14, 2024
96e7e14
Use separate import for Snippet type instead of inline, easier to read
dimfeld Nov 14, 2024
5e53e44
Refactor generics and type definitions; remove redundant styles.
dimfeld Nov 15, 2024
0fa6874
svelte-check passes
dimfeld Nov 15, 2024
0485a6a
changesets
dimfeld Nov 15, 2024
eadb5a4
Update to deck.gl v9
dimfeld Nov 15, 2024
dc39ef5
Update repository to https url
dimfeld Nov 15, 2024
95077b4
type fixes
dimfeld Nov 15, 2024
3222e68
generic feature type for Marker
dimfeld Nov 15, 2024
87e8bbd
simpler syntax
dimfeld Nov 15, 2024
857a427
remove unused import
dimfeld Nov 15, 2024
e602e33
Rename mapContext to getMapContext
dimfeld Nov 15, 2024
3e5c275
remove some unnecessary `undefined`
dimfeld Nov 15, 2024
801ad80
wrap mapContext in a $derived
dimfeld Nov 15, 2024
77b6f3a
Use `loaded` passed from the map context instead of `map.loaded()`
dimfeld Nov 15, 2024
1218f48
undo rename which was just a test of LLM-based rename
dimfeld Nov 16, 2024
13cb335
v1.0.0-next.1
dimfeld Nov 16, 2024
1ce9000
Update `husky` command for new version
dimfeld Nov 17, 2024
9608528
Show test comment on the page
dimfeld Nov 17, 2024
9752db5
Fix deckgl layer teardown
dimfeld Nov 17, 2024
fee5a66
Fix infinite effect loop in JoinedData.svelte
dimfeld Nov 17, 2024
b4492ea
remove unneeded reactivity force from svelte 4
dimfeld Nov 17, 2024
f08ebd7
Show entire file in code samples
dimfeld Nov 17, 2024
20eaf48
v1.0.0-next.2
dimfeld Nov 17, 2024
7c7f65f
Fix effect loop in Terrain.svelte
dimfeld Nov 18, 2024
842c48b
Clean up unused props in example files
dimfeld Nov 18, 2024
e0536c8
v1.0.0-next.3
dimfeld Nov 18, 2024
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
42 changes: 0 additions & 42 deletions .eslintrc.cjs

This file was deleted.

20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# svelte-maplibre

## 1.0.0

### Major Changes

- [#214](https://github.com/dimfeld/svelte-maplibre/pull/214) [`eadb5a4`](https://github.com/dimfeld/svelte-maplibre/commit/eadb5a4fa3ef301d503f6b7533b0483ec70c368d) Thanks [@dimfeld](https://github.com/dimfeld)! - Update to deck.gl v9

- [#214](https://github.com/dimfeld/svelte-maplibre/pull/214) [`0485a6a`](https://github.com/dimfeld/svelte-maplibre/commit/0485a6a56a7eb78dc8f2d838902236a022793755) Thanks [@dimfeld](https://github.com/dimfeld)! - Remove `map` attribute from events. It was already present as `target`

- [#214](https://github.com/dimfeld/svelte-maplibre/pull/214) [`0485a6a`](https://github.com/dimfeld/svelte-maplibre/commit/0485a6a56a7eb78dc8f2d838902236a022793755) Thanks [@dimfeld](https://github.com/dimfeld)! - Upgrade internal code to Svelte 5 runes

- [#214](https://github.com/dimfeld/svelte-maplibre/pull/214) [`0485a6a`](https://github.com/dimfeld/svelte-maplibre/commit/0485a6a56a7eb78dc8f2d838902236a022793755) Thanks [@dimfeld](https://github.com/dimfeld)! - Internal: Change context structure used to pass info down the component hierarchy

- [#214](https://github.com/dimfeld/svelte-maplibre/pull/214) [`0485a6a`](https://github.com/dimfeld/svelte-maplibre/commit/0485a6a56a7eb78dc8f2d838902236a022793755) Thanks [@dimfeld](https://github.com/dimfeld)! - Use `undefined` instead of `null` in many places. This improves ergonomics with Svelte component props.

### Minor Changes

- [#214](https://github.com/dimfeld/svelte-maplibre/pull/214) [`0485a6a`](https://github.com/dimfeld/svelte-maplibre/commit/0485a6a56a7eb78dc8f2d838902236a022793755) Thanks [@dimfeld](https://github.com/dimfeld)! - Add generics for Features on many components to permit better type safety

- [#214](https://github.com/dimfeld/svelte-maplibre/pull/214) [`0485a6a`](https://github.com/dimfeld/svelte-maplibre/commit/0485a6a56a7eb78dc8f2d838902236a022793755) Thanks [@dimfeld](https://github.com/dimfeld)! - Only add event handlers to the map when something is actually listening

## 0.9.14

### Patch Changes
Expand Down
50 changes: 50 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import js from '@eslint/js';
import ts from 'typescript-eslint';
dimfeld marked this conversation as resolved.
Show resolved Hide resolved
import svelte from 'eslint-plugin-svelte';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

export function createConfig(withSvelte = false) {
return [
js.configs.recommended,
...ts.configs.recommended,
...(withSvelte ? svelte.configs['flat/recommended'] : []),
prettier,
...(withSvelte ? svelte.configs['flat/prettier'] : []),
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'prefer-const': 'off',
},
},

withSvelte
? {
files: ['**/*.svelte'],
languageOptions: {
parserOptions: {
parser: ts.parser,
},
},
rules: {
// This ends up duplicating the svelte warnings in the editor
'svelte/valid-compile': 'off',
},
}
: null,

{
ignores: ['**/build/', '**/.svelte-kit/', '**/dist/', '**/playwright-report/'],
},
].filter((x) => x != null);
}

/** @type {import('eslint').Linter.Config[]} */
export default createConfig(false);
67 changes: 34 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "svelte-maplibre",
"version": "0.9.14",
"version": "1.0.0-next.3",
"description": "Svelte bindings for MapLibre",
"author": {
"name": "Daniel Imfeld",
"url": "https://imfeld.dev"
},
"repository": {
"type": "git",
"url": "git://github.com/dimfeld/svelte-maplibre.git"
"url": "https://github.com/dimfeld/svelte-maplibre"
},
"homepage": "https://svelte-maplibre.imfeld.dev",
"license": "MIT",
Expand All @@ -26,7 +25,7 @@
"build": "vite build && npm run package",
"preview": "vite preview",
"package": "svelte-kit sync && svelte-package && publint",
"prepare": "husky install && npm run package",
"prepare": "husky && npm run package",
"test": "playwright test",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
Expand All @@ -50,9 +49,9 @@
"svelte": "./dist/*.svelte",
"default": "./dist/*.svelte"
},
"./context.js": {
"types": "./dist/context.d.ts",
"default": "./dist/context.js"
"./context.svelte.js": {
"types": "./dist/context.svelte.d.ts",
"default": "./dist/context.svelte.js"
},
"./expressions.js": {
"types": "./dist/expressions.d.ts",
Expand All @@ -78,59 +77,61 @@
"d3-geo": "^3.1.0",
"dequal": "^2.0.3",
"just-compare": "^2.3.0",
"just-flush": "^2.3.0",
"maplibre-gl": "^4.0.0",
"pmtiles": "^3.0.3"
},
"peerDependencies": {
"@deck.gl/core": "^8.8.0",
"@deck.gl/layers": "^8.8.0",
"@deck.gl/mapbox": "^8.8.0",
"svelte": "^3.54.0 || ^4.0.0 || ^5.0.0"
"@deck.gl/core": "^9",
"@deck.gl/layers": "^9",
"@deck.gl/mapbox": "^9",
"svelte": "^5.0.0"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.8",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.9",
"@deck.gl/core": "~8.8.0",
"@deck.gl/layers": "~8.8.0",
"@deck.gl/mapbox": "~8.8.0",
"@deck.gl/core": "~9.0.35",
"@deck.gl/layers": "~9.0.35",
"@deck.gl/mapbox": "~9.0.35",
"@mapbox/mapbox-gl-draw": "^1.4.3",
"@playwright/test": "^1.48.2",
"@skeletonlabs/skeleton": "^2.10.3",
"@skeletonlabs/tw-plugin": "^0.4.0",
"@sveltejs/adapter-vercel": "^5.4.6",
"@sveltejs/kit": "^2.7.4",
"@sveltejs/kit": "^2.8.1",
"@sveltejs/package": "^2.3.7",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"@types/d3-color": "^3.1.3",
"@types/d3-geo": "^3.1.0",
"@types/geojson": "^7946.0.14",
"@types/mapbox__mapbox-gl-draw": "^1.4.8",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@types/node": "^22.9.0",
"@typescript-eslint/eslint-plugin": "^8.14.0",
"@typescript-eslint/parser": "^8.14.0",
"autoprefixer": "^10.4.20",
"d3-color": "^3.1.0",
"dedent": "^1.5.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.10.0",
"dedent": "^1.5.3",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.46.0",
"highlight.js": "^11.7.0",
"globals": "^15.12.0",
"highlight.js": "^11.10.0",
"highlightjs-svelte": "^1.0.6",
"husky": "^8.0.3",
"husky": "^9.1.6",
"just-clamp": "^4.2.0",
"lint-staged": "^14.0.1",
"postcss": "^8.4.14",
"lint-staged": "^15.2.10",
"postcss": "^8.4.49",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.7",
"prettier-plugin-tailwindcss": "^0.5.14",
"prettier-plugin-svelte": "^3.2.8",
"prettier-plugin-tailwindcss": "^0.6.8",
"publint": "^0.2.12",
"svelte": "^5.1.13",
"svelte-check": "^4.0.5",
"tailwindcss": "^3.4.14",
"svelte": "^5.2.0",
"svelte-check": "^4.0.7",
"tailwindcss": "^3.4.15",
"tslib": "^2.8.1",
"typescript": "^5.6.3",
"vite": "^5.4.10",
"vitest": "^2.1.4"
"typescript-eslint": "^8.14.0",
"vite": "^5.4.11",
"vitest": "^2.1.5"
},
"peerDependenciesMeta": {
"@deck.gl/core": {
Expand Down
Loading