@versatiles/svelte 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BBoxMap/BBoxMap.svelte +23 -12
- package/dist/components/BBoxMap/lib/bbox.d.ts +1 -1
- package/dist/components/BBoxMap/lib/bbox.js +19 -17
- package/dist/components/BasicMap/BasicMap.svelte +22 -9
- package/dist/components/BasicMap/BasicMap.svelte.d.ts +2 -1
- package/dist/components/MapEditor/MapEditor.svelte +51 -20
- package/dist/components/MapEditor/components/Dialog.svelte +92 -0
- package/dist/components/MapEditor/components/Dialog.svelte.d.ts +17 -0
- package/dist/components/MapEditor/components/DialogFile.svelte +112 -0
- package/dist/components/MapEditor/components/DialogFile.svelte.d.ts +6 -0
- package/dist/components/MapEditor/components/DialogShare.svelte +216 -0
- package/dist/components/MapEditor/components/DialogShare.svelte.d.ts +10 -0
- package/dist/components/MapEditor/components/Editor.svelte +6 -14
- package/dist/components/MapEditor/components/EditorFill.svelte +3 -3
- package/dist/components/MapEditor/components/EditorStroke.svelte +3 -3
- package/dist/components/MapEditor/components/EditorSymbol.svelte +9 -9
- package/dist/components/MapEditor/components/InputRow.svelte +2 -3
- package/dist/components/MapEditor/components/PanelFile.svelte +73 -0
- package/dist/components/MapEditor/components/PanelFile.svelte.d.ts +7 -0
- package/dist/components/MapEditor/components/PanelSymbolSelector.svelte +82 -0
- package/dist/components/MapEditor/components/PanelSymbolSelector.svelte.d.ts +8 -0
- package/dist/components/MapEditor/components/Sidebar.svelte +51 -98
- package/dist/components/MapEditor/components/Sidebar.svelte.d.ts +3 -3
- package/dist/components/MapEditor/components/SidebarPanel.svelte +13 -5
- package/dist/components/MapEditor/lib/element/abstract.d.ts +8 -4
- package/dist/components/MapEditor/lib/element/abstract.js +10 -1
- package/dist/components/MapEditor/lib/element/abstract_path.d.ts +3 -2
- package/dist/components/MapEditor/lib/element/abstract_path.js +6 -3
- package/dist/components/MapEditor/lib/element/circle.d.ts +25 -0
- package/dist/components/MapEditor/lib/element/circle.js +118 -0
- package/dist/components/MapEditor/lib/element/line.d.ts +2 -2
- package/dist/components/MapEditor/lib/element/line.js +1 -1
- package/dist/components/MapEditor/lib/element/marker.d.ts +4 -3
- package/dist/components/MapEditor/lib/element/marker.js +2 -2
- package/dist/components/MapEditor/lib/element/polygon.d.ts +2 -2
- package/dist/components/MapEditor/lib/element/polygon.js +2 -2
- package/dist/components/MapEditor/lib/element/types.d.ts +2 -3
- package/dist/components/MapEditor/lib/geometry_manager.d.ts +12 -29
- package/dist/components/MapEditor/lib/geometry_manager.js +44 -160
- package/dist/components/MapEditor/lib/geometry_manager_interactive.d.ts +33 -0
- package/dist/components/MapEditor/lib/geometry_manager_interactive.js +102 -0
- package/dist/components/MapEditor/lib/map_layer/abstract.d.ts +2 -1
- package/dist/components/MapEditor/lib/map_layer/abstract.js +25 -22
- package/dist/components/MapEditor/lib/map_layer/fill.js +2 -4
- package/dist/components/MapEditor/lib/map_layer/line.js +1 -1
- package/dist/components/MapEditor/lib/map_layer/symbol.js +1 -1
- package/dist/components/MapEditor/lib/selection.d.ts +11 -0
- package/dist/components/MapEditor/lib/selection.js +70 -0
- package/dist/components/MapEditor/lib/state/constants.js +5 -6
- package/dist/components/MapEditor/lib/state/history.d.ts +14 -0
- package/dist/components/MapEditor/lib/state/history.js +53 -0
- package/dist/components/MapEditor/lib/state/manager.d.ts +7 -10
- package/dist/components/MapEditor/lib/state/manager.js +19 -54
- package/dist/components/MapEditor/lib/state/reader.d.ts +6 -4
- package/dist/components/MapEditor/lib/state/reader.js +70 -18
- package/dist/components/MapEditor/lib/state/types.d.ts +19 -2
- package/dist/components/MapEditor/lib/state/utils.d.ts +2 -0
- package/dist/components/MapEditor/lib/state/utils.js +12 -0
- package/dist/components/MapEditor/lib/state/writer.d.ts +6 -4
- package/dist/components/MapEditor/lib/state/writer.js +59 -19
- package/dist/components/MapEditor/lib/symbols.d.ts +1 -1
- package/dist/components/MapEditor/lib/symbols.js +47 -28
- package/dist/components/MapEditor/lib/utils/event_handler.d.ts +10 -0
- package/dist/components/MapEditor/lib/utils/event_handler.js +39 -0
- package/dist/components/MapEditor/lib/utils/geometry.d.ts +12 -0
- package/dist/components/MapEditor/lib/utils/geometry.js +87 -0
- package/dist/components/MapEditor/lib/utils/types.d.ts +2 -0
- package/dist/components/MapEditor/lib/utils/types.js +1 -0
- package/dist/components/MapEditor/style/button.scss +115 -0
- package/dist/components/MapEditor/style/index.scss +3 -0
- package/dist/components/MapEditor/style/layout.scss +20 -0
- package/dist/components/MapEditor/style/other.scss +10 -0
- package/dist/utils/location.d.ts +1 -0
- package/dist/utils/location.js +181 -0
- package/dist/utils/map_style.d.ts +2 -2
- package/dist/utils/map_style.js +2 -2
- package/package.json +29 -29
- package/dist/components/MapEditor/components/SymbolSelector.svelte +0 -110
- package/dist/components/MapEditor/components/SymbolSelector.svelte.d.ts +0 -8
- package/dist/components/MapEditor/lib/utils.d.ts +0 -6
- package/dist/components/MapEditor/lib/utils.js +0 -23
- /package/dist/components/MapEditor/lib/{geocoder.d.ts → utils/geocoder.d.ts} +0 -0
- /package/dist/components/MapEditor/lib/{geocoder.js → utils/geocoder.js} +0 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@versatiles/svelte",
|
3
|
-
"version": "2.0
|
3
|
+
"version": "2.1.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"scripts": {
|
6
6
|
"build": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json && vite build && npm run package",
|
@@ -13,12 +13,12 @@
|
|
13
13
|
"prepack": "npm run build",
|
14
14
|
"prepublishOnly": "npm run package",
|
15
15
|
"preview": "vite preview",
|
16
|
-
"screenshots": "npx tsx ./scripts/screenshots.ts",
|
17
16
|
"release": "vrt release-npm",
|
18
|
-
"
|
19
|
-
"test-unit": "vitest run",
|
17
|
+
"screenshots": "npx tsx ./scripts/screenshots.ts",
|
20
18
|
"test-coverage": "vitest run --coverage",
|
21
|
-
"test": "
|
19
|
+
"test-playwright": "./scripts/test_playwright.sh",
|
20
|
+
"test-unit": "vitest run",
|
21
|
+
"test": "npm run test-unit && npm run test-playwright",
|
22
22
|
"upgrade": "vrt deps-upgrade"
|
23
23
|
},
|
24
24
|
"exports": {
|
@@ -36,45 +36,45 @@
|
|
36
36
|
"!dist/BBoxMap/helpers/*"
|
37
37
|
],
|
38
38
|
"peerDependencies": {
|
39
|
-
"sass-embedded": "^1.
|
40
|
-
"svelte": "^5.
|
39
|
+
"sass-embedded": "^1.89.2",
|
40
|
+
"svelte": "^5.28.6"
|
41
41
|
},
|
42
42
|
"devDependencies": {
|
43
|
-
"@playwright/test": "^1.
|
43
|
+
"@playwright/test": "^1.53.2",
|
44
44
|
"@sveltejs/adapter-static": "^3.0.8",
|
45
|
-
"@sveltejs/kit": "^2.
|
46
|
-
"@sveltejs/package": "^2.3.
|
47
|
-
"@sveltejs/vite-plugin-svelte": "^5.0
|
45
|
+
"@sveltejs/kit": "^2.22.2",
|
46
|
+
"@sveltejs/package": "^2.3.12",
|
47
|
+
"@sveltejs/vite-plugin-svelte": "^5.1.0",
|
48
48
|
"@turf/turf": "^7.2.0",
|
49
49
|
"@types/eslint": "^9.6.1",
|
50
|
-
"@types/node": "^22.
|
50
|
+
"@types/node": "^22.15.34",
|
51
51
|
"@versatiles/release-tool": "^2.4.2",
|
52
|
-
"@vitest/coverage-v8": "^3.
|
52
|
+
"@vitest/coverage-v8": "^3.2.4",
|
53
53
|
"cookie": "^1.0.2",
|
54
|
-
"eslint": "^9.
|
55
|
-
"eslint-config-prettier": "^10.1.
|
56
|
-
"eslint-plugin-svelte": "^3.
|
54
|
+
"eslint": "^9.30.0",
|
55
|
+
"eslint-config-prettier": "^10.1.5",
|
56
|
+
"eslint-plugin-svelte": "^3.10.1",
|
57
57
|
"geojson": "^0.5.0",
|
58
|
-
"globals": "^16.
|
59
|
-
"happy-dom": "^17.
|
60
|
-
"prettier": "^3.
|
61
|
-
"prettier-plugin-svelte": "^3.
|
58
|
+
"globals": "^16.3.0",
|
59
|
+
"happy-dom": "^17.6.3",
|
60
|
+
"prettier": "^3.6.2",
|
61
|
+
"prettier-plugin-svelte": "^3.4.0",
|
62
62
|
"publint": "^0.3.12",
|
63
|
-
"sass": "^1.
|
64
|
-
"svelte": "^5.
|
65
|
-
"svelte-check": "^4.
|
63
|
+
"sass": "^1.89.2",
|
64
|
+
"svelte": "^5.34.9",
|
65
|
+
"svelte-check": "^4.2.2",
|
66
66
|
"svelte-preprocess": "^6.0.3",
|
67
|
-
"tsx": "^4.
|
67
|
+
"tsx": "^4.20.3",
|
68
68
|
"typescript": "^5.8.3",
|
69
|
-
"typescript-eslint": "^8.
|
70
|
-
"vite": "^6.
|
71
|
-
"vitest": "^3.1.
|
69
|
+
"typescript-eslint": "^8.35.1",
|
70
|
+
"vite": "^6.3.5",
|
71
|
+
"vitest": "^3.1.3"
|
72
72
|
},
|
73
73
|
"svelte": "./dist/index.js",
|
74
74
|
"types": "./dist/index.d.ts",
|
75
75
|
"type": "module",
|
76
76
|
"dependencies": {
|
77
|
-
"@versatiles/style": "^5.
|
78
|
-
"maplibre-gl": "^5.
|
77
|
+
"@versatiles/style": "^5.7.0",
|
78
|
+
"maplibre-gl": "^5.6.0"
|
79
79
|
}
|
80
80
|
}
|
@@ -1,110 +0,0 @@
|
|
1
|
-
<script lang="ts">
|
2
|
-
import type { Action } from 'svelte/action';
|
3
|
-
import type { SymbolLibrary } from '../lib/symbols.js';
|
4
|
-
|
5
|
-
let {
|
6
|
-
symbolIndex = $bindable(),
|
7
|
-
symbolLibrary
|
8
|
-
}: { symbolIndex: number; symbolLibrary: SymbolLibrary } = $props();
|
9
|
-
|
10
|
-
const drawIconHalo: Action<HTMLCanvasElement, number> = (canvas, index) =>
|
11
|
-
symbolLibrary.drawSymbol(canvas, index, true);
|
12
|
-
|
13
|
-
const drawIcon: Action<HTMLCanvasElement, number> = (canvas, index) =>
|
14
|
-
symbolLibrary.drawSymbol(canvas, index);
|
15
|
-
|
16
|
-
let dialog: HTMLDialogElement | null = null;
|
17
|
-
</script>
|
18
|
-
|
19
|
-
<button
|
20
|
-
onclick={() => dialog?.showModal()}
|
21
|
-
style="text-align: left; white-space: nowrap; overflow: hidden; padding: 1px"
|
22
|
-
>
|
23
|
-
{#key symbolIndex}
|
24
|
-
<canvas
|
25
|
-
width="40"
|
26
|
-
height="40"
|
27
|
-
use:drawIcon={symbolIndex}
|
28
|
-
style="width:20px;height:20px;vertical-align:middle"
|
29
|
-
></canvas>
|
30
|
-
{/key}
|
31
|
-
{#if symbolIndex !== undefined}
|
32
|
-
{symbolLibrary.getSymbol(symbolIndex)?.name}
|
33
|
-
{:else}
|
34
|
-
Select Symbol
|
35
|
-
{/if}
|
36
|
-
</button>
|
37
|
-
|
38
|
-
<dialog class="modal" bind:this={dialog}>
|
39
|
-
<button class="close" onclick={() => dialog?.close()}>✕</button>
|
40
|
-
<div class="inner">
|
41
|
-
{#each symbolLibrary.asList() as symbol (symbol.index)}
|
42
|
-
<button class="icon" onclick={() => (symbolIndex = symbol.index)}
|
43
|
-
><canvas width="64" height="64" use:drawIconHalo={symbol.index}></canvas><br
|
44
|
-
/>{symbol.name}</button
|
45
|
-
>
|
46
|
-
{/each}
|
47
|
-
</div>
|
48
|
-
</dialog>
|
49
|
-
|
50
|
-
<style>
|
51
|
-
.modal {
|
52
|
-
width: min(500px, 100vw);
|
53
|
-
height: min(500px, 100vh);
|
54
|
-
background-color: rgba(255, 255, 255, 0.5);
|
55
|
-
backdrop-filter: blur(20px) brightness(0.85);
|
56
|
-
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
|
57
|
-
z-index: 10000;
|
58
|
-
border: 0.5px solid rgba(0, 0, 0, 0.5);
|
59
|
-
border-radius: 10px;
|
60
|
-
box-sizing: border-box;
|
61
|
-
padding: 20px;
|
62
|
-
|
63
|
-
.inner {
|
64
|
-
width: 100%;
|
65
|
-
height: 100%;
|
66
|
-
overflow-y: scroll;
|
67
|
-
display: grid;
|
68
|
-
grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
|
69
|
-
row-gap: 10px;
|
70
|
-
column-gap: 0px;
|
71
|
-
justify-items: center;
|
72
|
-
|
73
|
-
.icon {
|
74
|
-
width: 48px;
|
75
|
-
height: 48px;
|
76
|
-
cursor: pointer;
|
77
|
-
border: none;
|
78
|
-
font-size: 0.6em;
|
79
|
-
background: none;
|
80
|
-
line-height: 1em;
|
81
|
-
text-align: center;
|
82
|
-
padding: 0;
|
83
|
-
|
84
|
-
&:hover {
|
85
|
-
background-color: rgba(0, 0, 0, 0.1);
|
86
|
-
}
|
87
|
-
|
88
|
-
canvas {
|
89
|
-
display: inline-block;
|
90
|
-
width: 32px;
|
91
|
-
height: 32px;
|
92
|
-
}
|
93
|
-
}
|
94
|
-
}
|
95
|
-
|
96
|
-
.close {
|
97
|
-
position: absolute;
|
98
|
-
top: 0px;
|
99
|
-
right: 0px;
|
100
|
-
font-size: 20px;
|
101
|
-
cursor: pointer;
|
102
|
-
background: none;
|
103
|
-
border: none;
|
104
|
-
width: 25px;
|
105
|
-
height: 25px;
|
106
|
-
text-align: center;
|
107
|
-
padding: 0;
|
108
|
-
}
|
109
|
-
}
|
110
|
-
</style>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import type { SymbolLibrary } from '../lib/symbols.js';
|
2
|
-
type $$ComponentProps = {
|
3
|
-
symbolIndex: number;
|
4
|
-
symbolLibrary: SymbolLibrary;
|
5
|
-
};
|
6
|
-
declare const SymbolSelector: import("svelte").Component<$$ComponentProps, {}, "symbolIndex">;
|
7
|
-
type SymbolSelector = ReturnType<typeof SymbolSelector>;
|
8
|
-
export default SymbolSelector;
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import type { ElementPoint } from './element/types.js';
|
2
|
-
import type { StateStyle } from './state/types.js';
|
3
|
-
export declare function getMiddlePoint(p0: ElementPoint, p1: ElementPoint): ElementPoint;
|
4
|
-
export declare function lat2mercator(lat: number): number;
|
5
|
-
export declare function mercator2lat(y: number): number;
|
6
|
-
export declare function removeDefaultFields(value: StateStyle, def: StateStyle): Partial<StateStyle> | undefined;
|
@@ -1,23 +0,0 @@
|
|
1
|
-
export function getMiddlePoint(p0, p1) {
|
2
|
-
const y0 = lat2mercator(p0[1]);
|
3
|
-
const y1 = lat2mercator(p1[1]);
|
4
|
-
return [(p0[0] + p1[0]) / 2, mercator2lat((y0 + y1) / 2)];
|
5
|
-
}
|
6
|
-
export function lat2mercator(lat) {
|
7
|
-
return Math.log(Math.tan(Math.PI / 4 + (lat * Math.PI) / 360));
|
8
|
-
}
|
9
|
-
export function mercator2lat(y) {
|
10
|
-
return ((2 * Math.atan(Math.exp(y)) - Math.PI / 2) * 180) / Math.PI;
|
11
|
-
}
|
12
|
-
export function removeDefaultFields(value, def) {
|
13
|
-
const entries = Object.entries(value).filter(([k, v]) => {
|
14
|
-
if (v === undefined)
|
15
|
-
return false;
|
16
|
-
if (v === def[k])
|
17
|
-
return false;
|
18
|
-
return true;
|
19
|
-
});
|
20
|
-
if (entries.length === 0)
|
21
|
-
return undefined;
|
22
|
-
return Object.fromEntries(entries);
|
23
|
-
}
|
File without changes
|
File without changes
|