@versatiles/svelte 0.1.1 → 0.1.2

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.
@@ -1,86 +1,114 @@
1
1
  <!-- AutoComplete.svelte -->
2
- <script generics="T">import { isDarkMode } from "../utils/style.js";
3
- import { createEventDispatcher, onMount } from "svelte";
4
- const dispatch = createEventDispatcher();
5
- export let placeholder = "";
6
- export let minChar = 0;
7
- export let maxItems = 10;
8
- export let items;
9
- let inputElement;
10
- let autocompleteElement;
11
- let isOpen = false;
12
- let results = [];
13
- let selectedIndex = 0;
14
- let inputText = "";
15
- const regExpEscape = (s) => s.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&");
16
- if (inputText.length >= minChar) {
17
- const r = filterResults();
18
- if (r.length > 0) {
19
- const { key, value } = r[0];
20
- inputText = key;
21
- setTimeout(() => dispatch("change", JSON.parse(JSON.stringify(value))), 0);
22
- } else {
23
- inputText = "";
24
- }
25
- }
26
- export function setInputText(text) {
27
- console.log(text);
28
- inputText = text;
29
- results = filterResults();
30
- close(0);
31
- }
32
- function onChange() {
33
- if (inputText.length >= minChar) {
34
- results = filterResults();
35
- selectedIndex = 0;
36
- isOpen = true;
37
- } else {
38
- isOpen = false;
39
- }
40
- }
41
- function onFocus() {
42
- inputElement.setSelectionRange(0, 1e3);
43
- }
44
- function filterResults() {
45
- const searchText = inputText.trim();
46
- const searchTextUpper = searchText.toUpperCase();
47
- const searchReg = RegExp(regExpEscape(searchText), "i");
48
- return items.filter((item) => item.key.toUpperCase().includes(searchTextUpper)).slice(0, maxItems).map((item) => ({
49
- ...item,
50
- _label: item.key.replace(searchReg, "<span>$&</span>")
51
- }));
52
- }
53
- function onKeyDown(event) {
54
- switch (event.key) {
55
- case "ArrowDown":
56
- if (selectedIndex < results.length - 1) selectedIndex += 1;
57
- break;
58
- case "ArrowUp":
59
- if (selectedIndex > 0) selectedIndex -= 1;
60
- break;
61
- case "Enter":
62
- event.preventDefault();
63
- close(selectedIndex);
64
- break;
65
- case "Escape":
66
- event.preventDefault();
67
- close();
68
- break;
69
- }
70
- }
71
- function close(index = -1) {
72
- isOpen = false;
73
- if (index > -1 && results[index]) {
74
- const { key, value } = results[index];
75
- inputText = key;
76
- dispatch("change", JSON.parse(JSON.stringify(value)));
77
- }
78
- }
79
- onMount(() => {
80
- const darkMode = isDarkMode(autocompleteElement);
81
- autocompleteElement.style.setProperty("--bg-color", darkMode ? "#000" : "#fff");
82
- autocompleteElement.style.setProperty("--fg-color", darkMode ? "#fff" : "#000");
83
- });
2
+ <script lang="ts" generics="T">
3
+ import { isDarkMode } from '../utils/style.js';
4
+ /* eslint svelte/no-at-html-tags: off */
5
+
6
+ import { createEventDispatcher, onMount } from 'svelte';
7
+ const dispatch = createEventDispatcher();
8
+
9
+ type Item = { key: string; value: T };
10
+ type ResultItem = Item & { _label: string };
11
+
12
+ // Component properties
13
+ export let placeholder: string = '';
14
+ export let minChar: number = 0;
15
+ export let maxItems: number = 10;
16
+
17
+ // Reactive variables
18
+ export let items: Item[];
19
+
20
+ let inputElement: HTMLInputElement; // Reference to DOM element
21
+ let autocompleteElement: HTMLDivElement; // Reference to DOM element
22
+ let isOpen = false;
23
+ let results: ResultItem[] = [];
24
+ let selectedIndex = 0;
25
+ let inputText: string = '';
26
+
27
+ // Escape special characters in search string for use in regex
28
+ const regExpEscape = (s: string) => s.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
29
+
30
+ if (inputText.length >= minChar) {
31
+ const r = filterResults();
32
+ if (r.length > 0) {
33
+ const { key, value } = r[0];
34
+ inputText = key;
35
+ setTimeout(() => dispatch('change', JSON.parse(JSON.stringify(value))), 0);
36
+ } else {
37
+ inputText = '';
38
+ }
39
+ }
40
+
41
+ export function setInputText(text: string) {
42
+ console.log(text);
43
+ inputText = text;
44
+ results = filterResults();
45
+ close(0);
46
+ }
47
+
48
+ // Handle input change
49
+ function onChange() {
50
+ if (inputText.length >= minChar) {
51
+ results = filterResults();
52
+ selectedIndex = 0;
53
+ isOpen = true;
54
+ } else {
55
+ isOpen = false;
56
+ }
57
+ }
58
+
59
+ function onFocus() {
60
+ inputElement.setSelectionRange(0, 1000);
61
+ }
62
+
63
+ // Filter results based on search query
64
+ function filterResults(): ResultItem[] {
65
+ const searchText = inputText.trim();
66
+ const searchTextUpper = searchText.toUpperCase();
67
+ const searchReg = RegExp(regExpEscape(searchText), 'i');
68
+ return items
69
+ .filter((item) => item.key.toUpperCase().includes(searchTextUpper))
70
+ .slice(0, maxItems)
71
+ .map((item) => ({
72
+ ...item,
73
+ _label: item.key.replace(searchReg, '<span>$&</span>')
74
+ }));
75
+ }
76
+
77
+ // Handle keyboard navigation
78
+ function onKeyDown(event: KeyboardEvent) {
79
+ switch (event.key) {
80
+ case 'ArrowDown':
81
+ if (selectedIndex < results.length - 1) selectedIndex += 1;
82
+ break;
83
+ case 'ArrowUp':
84
+ if (selectedIndex > 0) selectedIndex -= 1;
85
+ break;
86
+ case 'Enter':
87
+ event.preventDefault();
88
+ close(selectedIndex);
89
+ break;
90
+ case 'Escape':
91
+ event.preventDefault();
92
+ close();
93
+ break;
94
+ }
95
+ }
96
+
97
+ // Close the autocomplete and select an item
98
+ function close(index = -1) {
99
+ isOpen = false;
100
+ if (index > -1 && results[index]) {
101
+ const { key, value } = results[index];
102
+ inputText = key;
103
+ dispatch('change', JSON.parse(JSON.stringify(value)));
104
+ }
105
+ }
106
+
107
+ onMount(() => {
108
+ const darkMode = isDarkMode(autocompleteElement);
109
+ autocompleteElement.style.setProperty('--bg-color', darkMode ? '#000' : '#fff');
110
+ autocompleteElement.style.setProperty('--fg-color', darkMode ? '#fff' : '#000');
111
+ });
84
112
  </script>
85
113
 
86
114
  <svelte:window on:click={() => close()} />
@@ -1,4 +1,3 @@
1
- import { SvelteComponent } from "svelte";
2
1
  declare class __sveltets_Render<T> {
3
2
  props(): {
4
3
  placeholder?: string;
@@ -16,11 +15,20 @@ declare class __sveltets_Render<T> {
16
15
  [evt: string]: CustomEvent<any>;
17
16
  };
18
17
  slots(): {};
18
+ bindings(): string;
19
+ exports(): {
20
+ setInputText: (text: string) => void;
21
+ };
19
22
  }
20
- export type AutoCompleteProps<T> = ReturnType<__sveltets_Render<T>['props']>;
21
- export type AutoCompleteEvents<T> = ReturnType<__sveltets_Render<T>['events']>;
22
- export type AutoCompleteSlots<T> = ReturnType<__sveltets_Render<T>['slots']>;
23
- export default class AutoComplete<T> extends SvelteComponent<AutoCompleteProps<T>, AutoCompleteEvents<T>, AutoCompleteSlots<T>> {
24
- get setInputText(): (text: string) => void;
23
+ interface $$IsomorphicComponent {
24
+ new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
25
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
26
+ } & ReturnType<__sveltets_Render<T>['exports']>;
27
+ <T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {
28
+ $$events?: ReturnType<__sveltets_Render<T>['events']>;
29
+ }): ReturnType<__sveltets_Render<T>['exports']>;
30
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
25
31
  }
26
- export {};
32
+ declare const AutoComplete: $$IsomorphicComponent;
33
+ type AutoComplete<T> = InstanceType<typeof AutoComplete<T>>;
34
+ export default AutoComplete;
@@ -1,110 +1,128 @@
1
1
  <!-- BBoxMap.svelte -->
2
- <script>import { onMount } from "svelte";
3
- import "maplibre-gl/dist/maplibre-gl.css";
4
- import { dragBBox, getBBoxDrag, loadBBoxes, getBBoxGeometry, getCursor } from "./BBoxMap.js";
5
- import AutoComplete from "../AutoComplete.svelte";
6
- import { getCountry } from "../../utils/location.js";
7
- import BasicMap from "../BasicMap/BasicMap.svelte";
8
- import { isDarkMode } from "../../utils/style.js";
9
- let bboxes = void 0;
10
- let mapContainer;
11
- let autoComplete = void 0;
12
- const worldBBox = [-180, -85, 180, 85];
13
- const startTime = Date.now();
14
- export let selectedBBox = worldBBox;
15
- let map;
16
- onMount(async () => {
17
- bboxes = await loadBBoxes();
18
- start();
19
- });
20
- function handleMapReady(event) {
21
- map = event.detail.map;
22
- map.setPadding({ top: 31 + 5, right: 5, bottom: 5, left: 5 });
23
- const canvas = map.getCanvasContainer();
24
- const bboxColor = isDarkMode(mapContainer) ? "#FFFFFF" : "#000000";
25
- map.on("load", () => {
26
- map.addSource("bbox", { type: "geojson", data: getBBoxGeometry(selectedBBox) });
27
- map.addLayer({
28
- id: "bbox-line",
29
- type: "line",
30
- source: "bbox",
31
- filter: ["==", "$type", "LineString"],
32
- layout: { "line-cap": "round", "line-join": "round" },
33
- paint: { "line-color": bboxColor, "line-width": 0.5 }
34
- });
35
- map.addLayer({
36
- id: "bbox-fill",
37
- type: "fill",
38
- source: "bbox",
39
- filter: ["==", "$type", "Polygon"],
40
- paint: { "fill-color": bboxColor, "fill-opacity": 0.2 }
41
- });
42
- });
43
- function getDrag(point) {
44
- const { x: x0, y: y1 } = map.project([selectedBBox[0], selectedBBox[1]]);
45
- const { x: x1, y: y0 } = map.project([selectedBBox[2], selectedBBox[3]]);
46
- return getBBoxDrag(point, [x0, y0, x1, y1]);
47
- }
48
- let lastDrag = false;
49
- let dragging = false;
50
- map.on("mousemove", (e) => {
51
- if (dragging) {
52
- if (e.originalEvent.buttons % 2) {
53
- const { drag, bbox } = dragBBox(selectedBBox, lastDrag, e.lngLat);
54
- lastDrag = drag;
55
- selectedBBox = bbox;
56
- redrawBBox();
57
- e.preventDefault();
58
- } else {
59
- dragging = false;
60
- }
61
- } else {
62
- const drag = getDrag(e.point);
63
- if (drag !== lastDrag) {
64
- lastDrag = drag;
65
- canvas.style.cursor = getCursor(drag) || "grab";
66
- }
67
- }
68
- });
69
- map.on("mousedown", (e) => {
70
- if (e.originalEvent.buttons % 2) {
71
- const drag = getDrag(e.point);
72
- lastDrag = drag;
73
- if (drag) {
74
- dragging = true;
75
- e.preventDefault();
76
- }
77
- }
78
- });
79
- map.on("mouseup", () => dragging = false);
80
- start();
81
- }
82
- function start() {
83
- if (!bboxes) return;
84
- if (!map) return;
85
- if (!autoComplete) return;
86
- autoComplete.setInputText(getCountry());
87
- }
88
- function redrawBBox() {
89
- const bboxSource = map.getSource("bbox");
90
- bboxSource.setData(getBBoxGeometry(selectedBBox));
91
- }
92
- function flyTo(bbox) {
93
- selectedBBox = bbox ?? worldBBox;
94
- if (map) {
95
- if (map.getSource("bbox")) redrawBBox();
96
- const transform = map.cameraForBounds(selectedBBox);
97
- if (transform == null) return;
98
- transform.zoom = transform.zoom ?? 0 - 0.5;
99
- transform.bearing = 0;
100
- transform.pitch = 0;
101
- if (Date.now() - startTime < 1e3) {
102
- map.jumpTo(transform);
103
- } else {
104
- map.flyTo({ ...transform, essential: true, speed: 5 });
105
- }
106
- }
107
- }
2
+ <script lang="ts">
3
+ import type { CameraOptions, Point, Map as MaplibreMapType, GeoJSONSource } from 'maplibre-gl';
4
+ import type { BBox, BBoxDrag } from './BBoxMap.js';
5
+ import { onMount } from 'svelte';
6
+ import 'maplibre-gl/dist/maplibre-gl.css';
7
+ import { dragBBox, getBBoxDrag, loadBBoxes, getBBoxGeometry, getCursor } from './BBoxMap.js';
8
+ import AutoComplete from '../AutoComplete.svelte';
9
+ import { getCountry } from '../../utils/location.js';
10
+ import BasicMap from '../BasicMap/BasicMap.svelte';
11
+ import { isDarkMode } from '../../utils/style.js';
12
+
13
+ let bboxes: { key: string; value: BBox }[] | undefined = undefined;
14
+ let mapContainer: HTMLDivElement;
15
+ let autoComplete: AutoComplete<BBox> | undefined = undefined;
16
+ const worldBBox: BBox = [-180, -85, 180, 85];
17
+ const startTime = Date.now();
18
+ export let selectedBBox: BBox = worldBBox;
19
+ let map: MaplibreMapType; // Declare map instance at the top level
20
+
21
+ onMount(async () => {
22
+ bboxes = await loadBBoxes();
23
+ start();
24
+ });
25
+
26
+ function handleMapReady(event: CustomEvent) {
27
+ map = event.detail.map;
28
+ map.setPadding({ top: 31 + 5, right: 5, bottom: 5, left: 5 });
29
+
30
+ const canvas = map.getCanvasContainer();
31
+ const bboxColor = isDarkMode(mapContainer) ? '#FFFFFF' : '#000000';
32
+
33
+ map.on('load', () => {
34
+ map.addSource('bbox', { type: 'geojson', data: getBBoxGeometry(selectedBBox) });
35
+ map.addLayer({
36
+ id: 'bbox-line',
37
+ type: 'line',
38
+ source: 'bbox',
39
+ filter: ['==', '$type', 'LineString'],
40
+ layout: { 'line-cap': 'round', 'line-join': 'round' },
41
+ paint: { 'line-color': bboxColor, 'line-width': 0.5 }
42
+ });
43
+ map.addLayer({
44
+ id: 'bbox-fill',
45
+ type: 'fill',
46
+ source: 'bbox',
47
+ filter: ['==', '$type', 'Polygon'],
48
+ paint: { 'fill-color': bboxColor, 'fill-opacity': 0.2 }
49
+ });
50
+ });
51
+
52
+ function getDrag(point: Point): BBoxDrag {
53
+ const { x: x0, y: y1 } = map.project([selectedBBox[0], selectedBBox[1]]);
54
+ const { x: x1, y: y0 } = map.project([selectedBBox[2], selectedBBox[3]]);
55
+ return getBBoxDrag(point, [x0, y0, x1, y1]);
56
+ }
57
+
58
+ let lastDrag: BBoxDrag = false;
59
+ let dragging = false;
60
+ map.on('mousemove', (e) => {
61
+ if (dragging) {
62
+ if (e.originalEvent.buttons % 2) {
63
+ const { drag, bbox } = dragBBox(selectedBBox, lastDrag, e.lngLat);
64
+ lastDrag = drag;
65
+ selectedBBox = bbox;
66
+ redrawBBox();
67
+ e.preventDefault();
68
+ } else {
69
+ dragging = false;
70
+ }
71
+ } else {
72
+ const drag = getDrag(e.point);
73
+ if (drag !== lastDrag) {
74
+ lastDrag = drag;
75
+ canvas.style.cursor = getCursor(drag) || 'grab';
76
+ }
77
+ }
78
+ });
79
+
80
+ map.on('mousedown', (e) => {
81
+ if (e.originalEvent.buttons % 2) {
82
+ const drag = getDrag(e.point);
83
+ lastDrag = drag;
84
+ if (drag) {
85
+ dragging = true;
86
+ e.preventDefault();
87
+ }
88
+ }
89
+ });
90
+
91
+ map.on('mouseup', () => (dragging = false));
92
+
93
+ start();
94
+ }
95
+
96
+ function start() {
97
+ if (!bboxes) return;
98
+ if (!map) return;
99
+ if (!autoComplete) return;
100
+ autoComplete.setInputText(getCountry()); // Initial search text
101
+ }
102
+
103
+ function redrawBBox() {
104
+ const bboxSource = map.getSource('bbox') as GeoJSONSource;
105
+ bboxSource.setData(getBBoxGeometry(selectedBBox));
106
+ }
107
+
108
+ function flyTo(bbox: BBox) {
109
+ selectedBBox = bbox ?? worldBBox;
110
+ if (map) {
111
+ if (map.getSource('bbox')) redrawBBox();
112
+
113
+ const transform = map.cameraForBounds(selectedBBox) as CameraOptions;
114
+ if (transform == null) return;
115
+ transform.zoom = transform.zoom ?? 0 - 0.5;
116
+ transform.bearing = 0;
117
+ transform.pitch = 0;
118
+
119
+ if (Date.now() - startTime < 1000) {
120
+ map.jumpTo(transform);
121
+ } else {
122
+ map.flyTo({ ...transform, essential: true, speed: 5 });
123
+ }
124
+ }
125
+ }
108
126
  </script>
109
127
 
110
128
  <div class="container">
@@ -1,20 +1,22 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { BBox } from './BBoxMap.js';
3
2
  import 'maplibre-gl/dist/maplibre-gl.css';
4
- declare const __propDef: {
5
- props: {
6
- selectedBBox?: BBox;
3
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
4
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
5
+ $$bindings?: Bindings;
6
+ } & Exports;
7
+ (internal: unknown, props: Props & {
8
+ $$events?: Events;
9
+ $$slots?: Slots;
10
+ }): Exports & {
11
+ $set?: any;
12
+ $on?: any;
7
13
  };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {};
12
- exports?: {} | undefined;
13
- bindings?: string | undefined;
14
- };
15
- export type BBoxMapProps = typeof __propDef.props;
16
- export type BBoxMapEvents = typeof __propDef.events;
17
- export type BBoxMapSlots = typeof __propDef.slots;
18
- export default class BBoxMap extends SvelteComponent<BBoxMapProps, BBoxMapEvents, BBoxMapSlots> {
14
+ z_$$bindings?: Bindings;
19
15
  }
20
- export {};
16
+ declare const BBoxMap: $$__sveltets_2_IsomorphicComponent<{
17
+ selectedBBox?: BBox;
18
+ }, {
19
+ [evt: string]: CustomEvent<any>;
20
+ }, {}, {}, string>;
21
+ type BBoxMap = InstanceType<typeof BBoxMap>;
22
+ export default BBoxMap;
@@ -1,29 +1,41 @@
1
1
  <!-- BasicMap.svelte -->
2
- <script>import { onMount, createEventDispatcher } from "svelte";
3
- import "maplibre-gl/dist/maplibre-gl.css";
4
- import { getMapStyle, isDarkMode } from "../../utils/style.js";
5
- export let style = "position:absolute; left:0px; top:0px; width:100%; height:100%;";
6
- export let container = void 0;
7
- export let map = void 0;
8
- export let styleOptions = {};
9
- export let mapOptions = {};
10
- const dispatch = createEventDispatcher();
11
- onMount(async () => {
12
- let MaplibreMap = (await import("maplibre-gl")).Map;
13
- if (!container) throw Error();
14
- const darkMode = isDarkMode(container);
15
- container.style.setProperty("--bg-color", darkMode ? "#000" : "#fff");
16
- container.style.setProperty("--fg-color", darkMode ? "#fff" : "#000");
17
- map = new MaplibreMap({
18
- container,
19
- style: getMapStyle(darkMode, styleOptions),
20
- renderWorldCopies: false,
21
- dragRotate: false,
22
- attributionControl: { compact: false },
23
- ...mapOptions
24
- });
25
- dispatch("mapReady", { map });
26
- });
2
+ <script lang="ts">
3
+ import type { Map as MaplibreMapType, MapOptions } from 'maplibre-gl';
4
+ import { onMount, createEventDispatcher } from 'svelte';
5
+ import 'maplibre-gl/dist/maplibre-gl.css';
6
+ import { getMapStyle, isDarkMode } from '../../utils/style.js';
7
+ import type { ColorfulOptions } from '@versatiles/style';
8
+
9
+ // Props
10
+ export let style: string = 'position:absolute; left:0px; top:0px; width:100%; height:100%;';
11
+ export let container: HTMLDivElement | undefined = undefined;
12
+ export let map: MaplibreMapType | undefined = undefined;
13
+ export let styleOptions: ColorfulOptions = {};
14
+ export let mapOptions: Partial<MapOptions> = {};
15
+
16
+ // Create the event dispatcher
17
+ const dispatch = createEventDispatcher();
18
+
19
+ onMount(async (): Promise<void> => {
20
+ let MaplibreMap: typeof MaplibreMapType = (await import('maplibre-gl')).Map;
21
+
22
+ if (!container) throw Error();
23
+
24
+ const darkMode = isDarkMode(container);
25
+ container.style.setProperty('--bg-color', darkMode ? '#000' : '#fff');
26
+ container.style.setProperty('--fg-color', darkMode ? '#fff' : '#000');
27
+
28
+ map = new MaplibreMap({
29
+ container,
30
+ style: getMapStyle(darkMode, styleOptions),
31
+ renderWorldCopies: false,
32
+ dragRotate: false,
33
+ attributionControl: { compact: false },
34
+ ...mapOptions
35
+ });
36
+
37
+ dispatch('mapReady', { map });
38
+ });
27
39
  </script>
28
40
 
29
41
  <div class="map" {style} bind:this={container}></div>
@@ -1,27 +1,29 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { Map as MaplibreMapType, MapOptions } from 'maplibre-gl';
3
2
  import 'maplibre-gl/dist/maplibre-gl.css';
4
3
  import type { ColorfulOptions } from '@versatiles/style';
5
- declare const __propDef: {
6
- props: {
7
- style?: string;
8
- container?: HTMLDivElement | undefined;
9
- map?: MaplibreMapType | undefined;
10
- styleOptions?: ColorfulOptions;
11
- mapOptions?: Partial<MapOptions>;
4
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
5
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
6
+ $$bindings?: Bindings;
7
+ } & Exports;
8
+ (internal: unknown, props: Props & {
9
+ $$events?: Events;
10
+ $$slots?: Slots;
11
+ }): Exports & {
12
+ $set?: any;
13
+ $on?: any;
12
14
  };
13
- events: {
14
- mapReady: CustomEvent<any>;
15
- } & {
16
- [evt: string]: CustomEvent<any>;
17
- };
18
- slots: {};
19
- exports?: {} | undefined;
20
- bindings?: string | undefined;
21
- };
22
- export type BasicMapProps = typeof __propDef.props;
23
- export type BasicMapEvents = typeof __propDef.events;
24
- export type BasicMapSlots = typeof __propDef.slots;
25
- export default class BasicMap extends SvelteComponent<BasicMapProps, BasicMapEvents, BasicMapSlots> {
15
+ z_$$bindings?: Bindings;
26
16
  }
27
- export {};
17
+ declare const BasicMap: $$__sveltets_2_IsomorphicComponent<{
18
+ style?: string;
19
+ container?: HTMLDivElement | undefined;
20
+ map?: MaplibreMapType | undefined;
21
+ styleOptions?: ColorfulOptions;
22
+ mapOptions?: Partial<MapOptions>;
23
+ }, {
24
+ mapReady: CustomEvent<any>;
25
+ } & {
26
+ [evt: string]: CustomEvent<any>;
27
+ }, {}, {}, string>;
28
+ type BasicMap = InstanceType<typeof BasicMap>;
29
+ export default BasicMap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versatiles/svelte",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "scripts": {
5
5
  "build": "vite build && npm run package",
6
6
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
@@ -17,7 +17,7 @@
17
17
  "test:integration": "playwright test",
18
18
  "test:unit": "vitest run",
19
19
  "test": "npm run test:integration && npm run test:unit",
20
- "upgrade": "npm-check-updates -u && rm -f package-lock.json; rm -rf node_modules; npm i && npm update"
20
+ "upgrade": "npm-check-updates -u && rm -f package-lock.json; rm -rf node_modules; npm update --save && npm install"
21
21
  },
22
22
  "exports": {
23
23
  ".": {
@@ -33,35 +33,37 @@
33
33
  "!dist/BBoxMap/helpers/*"
34
34
  ],
35
35
  "peerDependencies": {
36
- "svelte": "^4.0.0"
36
+ "svelte": "^5.0.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@playwright/test": "^1.47.2",
39
+ "@playwright/test": "^1.48.1",
40
40
  "@sveltejs/adapter-auto": "^3.2.5",
41
- "@sveltejs/kit": "^2.5.28",
41
+ "@sveltejs/kit": "^2.7.2",
42
42
  "@sveltejs/package": "^2.3.5",
43
- "@sveltejs/vite-plugin-svelte": "^3.1.2",
43
+ "@sveltejs/vite-plugin-svelte": "^4.0.0",
44
44
  "@turf/turf": "^7.1.0",
45
45
  "@types/eslint": "^9.6.1",
46
- "@types/node": "^22.5.5",
46
+ "@types/node": "^22.7.7",
47
47
  "@types/split2": "^4.2.3",
48
48
  "@versatiles/release-tool": "^1.2.6",
49
- "eslint": "^9.11.0",
49
+ "cookie": "^1.0.1",
50
+ "eslint": "^9.13.0",
50
51
  "eslint-config-prettier": "^9.1.0",
51
- "eslint-plugin-svelte": "^2.44.0",
52
+ "eslint-plugin-svelte": "^2.45.1",
52
53
  "geojson": "^0.5.0",
53
- "globals": "^15.9.0",
54
+ "globals": "^15.11.0",
55
+ "npm-check-updates": "^17.1.4",
54
56
  "prettier": "^3.3.3",
55
- "prettier-plugin-svelte": "^3.2.6",
57
+ "prettier-plugin-svelte": "^3.2.7",
56
58
  "publint": "^0.2.11",
57
59
  "split2": "^4.2.0",
58
- "svelte": "^4.2.19",
59
- "svelte-check": "^4.0.2",
60
+ "svelte": "^5.0.3",
61
+ "svelte-check": "^4.0.5",
60
62
  "tsx": "^4.19.1",
61
- "typescript": "^5.6.2",
62
- "typescript-eslint": "^8.6.0",
63
- "vite": "^5.4.7",
64
- "vitest": "^2.1.1"
63
+ "typescript": "^5.6.3",
64
+ "typescript-eslint": "^8.10.0",
65
+ "vite": "^5.4.9",
66
+ "vitest": "^2.1.3"
65
67
  },
66
68
  "svelte": "./dist/index.js",
67
69
  "types": "./dist/index.d.ts",