@versatiles/svelte 2.1.7 → 2.1.8

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.
@@ -34,19 +34,6 @@
34
34
  // Escape special characters in search string for use in regex
35
35
  const regExpEscape = (s: string) => s.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
36
36
 
37
- $effect(() => {
38
- if (inputText.length >= minChar) {
39
- const r = filterResults();
40
- if (r.length > 0) {
41
- const { key, value } = r[0];
42
- inputText = key;
43
- change(JSON.parse(JSON.stringify(value)));
44
- } else {
45
- inputText = '';
46
- }
47
- }
48
- });
49
-
50
37
  // Handle input change
51
38
  function onChange() {
52
39
  if (inputText.length >= minChar) {
@@ -7,7 +7,13 @@
7
7
  import { loadBBoxes } from './BBoxMap.js';
8
8
  import { BBoxDrawer, isSameBBox, type BBox } from './lib/bbox_drawer.js';
9
9
 
10
- let { selectedBBox = $bindable() }: { selectedBBox?: BBox } = $props();
10
+ let {
11
+ selectedBBox = $bindable(),
12
+ onMapLoad
13
+ }: {
14
+ selectedBBox?: BBox;
15
+ onMapLoad?: (map: MaplibreMapType, maplibre: typeof import('maplibre-gl')) => void;
16
+ } = $props();
11
17
 
12
18
  const startTime = Date.now();
13
19
  let bboxDrawer: BBoxDrawer | undefined;
@@ -95,7 +101,7 @@
95
101
  />
96
102
  </div>
97
103
  {/if}
98
- <BasicMap {onMapInit}></BasicMap>
104
+ <BasicMap {onMapInit} {onMapLoad}></BasicMap>
99
105
  </div>
100
106
 
101
107
  <style>
@@ -1,6 +1,8 @@
1
+ import type { Map as MaplibreMapType } from 'maplibre-gl';
1
2
  import { type BBox } from './lib/bbox_drawer.js';
2
3
  type $$ComponentProps = {
3
4
  selectedBBox?: BBox;
5
+ onMapLoad?: (map: MaplibreMapType, maplibre: typeof import('maplibre-gl')) => void;
4
6
  };
5
7
  declare const BBoxMap: import("svelte").Component<$$ComponentProps, {}, "selectedBBox">;
6
8
  type BBoxMap = ReturnType<typeof BBoxMap>;
@@ -64,7 +64,6 @@
64
64
  if (!map!.loaded()) return;
65
65
  triggeredMapReady = true;
66
66
  if (onMapLoad) onMapLoad(map!, maplibre);
67
- setTimeout(() => console.log('map_ready'), 100);
68
67
  }
69
68
  }
70
69
  </script>
@@ -3,6 +3,12 @@
3
3
  import BasicMap from '../BasicMap/BasicMap.svelte';
4
4
  let map: MaplibreMapType;
5
5
 
6
+ let {
7
+ onMapLoad
8
+ }: {
9
+ onMapLoad?: (map: MaplibreMapType, maplibre: typeof import('maplibre-gl')) => void;
10
+ } = $props();
11
+
6
12
  function onMapInit(_map: MaplibreMapType) {
7
13
  map = _map;
8
14
  map.on('load', async () => {
@@ -66,7 +72,7 @@
66
72
  </script>
67
73
 
68
74
  <div class="container">
69
- <BasicMap {onMapInit}></BasicMap>
75
+ <BasicMap {onMapInit} {onMapLoad}></BasicMap>
70
76
  </div>
71
77
 
72
78
  <style>
@@ -1,18 +1,7 @@
1
- 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> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const LocatorMap: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {}, {}, string>;
17
- type LocatorMap = InstanceType<typeof LocatorMap>;
1
+ import type { Map as MaplibreMapType } from 'maplibre-gl';
2
+ type $$ComponentProps = {
3
+ onMapLoad?: (map: MaplibreMapType, maplibre: typeof import('maplibre-gl')) => void;
4
+ };
5
+ declare const LocatorMap: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type LocatorMap = ReturnType<typeof LocatorMap>;
18
7
  export default LocatorMap;
@@ -7,6 +7,12 @@
7
7
  import { GeometryManagerInteractive } from './lib/geometry_manager_interactive.js';
8
8
  import { StateReader } from './lib/state/reader.js';
9
9
 
10
+ let {
11
+ onMapLoad
12
+ }: {
13
+ onMapLoad?: (map: MaplibreMapType, maplibre: typeof import('maplibre-gl')) => void;
14
+ } = $props();
15
+
10
16
  let showSidebar = $state(false);
11
17
  let geometryManager: GeometryManager | GeometryManagerInteractive | undefined = $state();
12
18
 
@@ -52,6 +58,7 @@
52
58
  <div class="container">
53
59
  <BasicMap
54
60
  {onMapInit}
61
+ {onMapLoad}
55
62
  emptyStyle={true}
56
63
  mapOptions={{ attributionControl: false }}
57
64
  styleOptions={{ darkMode: false }}
@@ -1,3 +1,7 @@
1
- declare const MapEditor: import("svelte").Component<Record<string, never>, {}, "">;
1
+ import type { Map as MaplibreMapType } from 'maplibre-gl';
2
+ type $$ComponentProps = {
3
+ onMapLoad?: (map: MaplibreMapType, maplibre: typeof import('maplibre-gl')) => void;
4
+ };
5
+ declare const MapEditor: import("svelte").Component<$$ComponentProps, {}, "">;
2
6
  type MapEditor = ReturnType<typeof MapEditor>;
3
7
  export default MapEditor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versatiles/svelte",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "build": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json && vite build && npm run package",