poe-svelte-ui-lib 1.7.3 → 1.7.5

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.
@@ -5,7 +5,7 @@
5
5
  import { onDestroy, onMount } from "svelte"
6
6
  import { fade } from "svelte/transition"
7
7
  import { twMerge } from "tailwind-merge"
8
- import { MapLibre, NavigationControl, ScaleControl, GeolocateControl, FullScreenControl, Marker, Popup, CustomControl } from "./mapWrapper"
8
+ import { MapLibre, Marker, Popup, CustomControl } from "./mapWrapper"
9
9
 
10
10
  let { id = crypto.randomUUID(), label = { name: "", class: "" }, data = $bindable(), markerIcon }: IMapProps = $props()
11
11
 
@@ -106,11 +106,6 @@
106
106
  zoom={1.5}
107
107
  center={{ lat: 30, lng: 0 }}
108
108
  >
109
- <NavigationControl />
110
- <ScaleControl />
111
- <GeolocateControl />
112
- <FullScreenControl />
113
-
114
109
  <CustomControl position="top-left">
115
110
  <div class="flex items-center gap-2 px-2 py-1 text-black">
116
111
  <label for="timeout" class="text-sm font-medium">{$t("constructor.props.map.timeout")}</label>
@@ -1,8 +1,4 @@
1
1
  export { default as MapLibre } from "./MapLibre.svelte";
2
- export { default as NavigationControl } from "./controls/NavigationControl.svelte";
3
- export { default as ScaleControl } from "./controls/ScaleControl.svelte";
4
- export { default as GeolocateControl } from "./controls/GeolocateControl.svelte";
5
- export { default as FullScreenControl } from "./controls/FullScreenControl.svelte";
6
2
  export { default as Marker } from "./Marker.svelte";
7
3
  export { default as Popup } from "./Popup.svelte";
8
4
  export { default as CustomControl } from "./controls/CustomControl.svelte";
@@ -1,8 +1,4 @@
1
1
  export { default as MapLibre } from "./MapLibre.svelte";
2
- export { default as NavigationControl } from "./controls/NavigationControl.svelte";
3
- export { default as ScaleControl } from "./controls/ScaleControl.svelte";
4
- export { default as GeolocateControl } from "./controls/GeolocateControl.svelte";
5
- export { default as FullScreenControl } from "./controls/FullScreenControl.svelte";
6
2
  export { default as Marker } from "./Marker.svelte";
7
3
  export { default as Popup } from "./Popup.svelte";
8
4
  export { default as CustomControl } from "./controls/CustomControl.svelte";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-svelte-ui-lib",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,37 +0,0 @@
1
- <script lang="ts">
2
- // https://maplibre.org/maplibre-gl-js/docs/API/classes/FullscreenControl/
3
-
4
- import { onDestroy } from 'svelte';
5
- import maplibregl from 'maplibre-gl';
6
- import { getMapContext } from '../contexts.svelte.js';
7
- import { resetEventListener } from '../utils.js';
8
- import type { Listener, Event } from '../types.js';
9
-
10
- interface Props extends maplibregl.FullscreenControlOptions {
11
- position?: maplibregl.ControlPosition;
12
- // Events
13
- // https://maplibre.org/maplibre-gl-js/docs/API/classes/FullscreenControl/#events
14
- onfullscreenstart?: Listener<Event<maplibregl.FullscreenControl>>;
15
- onfullscreenend?: Listener<Event<maplibregl.FullscreenControl>>;
16
- }
17
- let { position, onfullscreenstart, onfullscreenend, ...options }: Props = $props();
18
-
19
- const mapCtx = getMapContext();
20
- if (!mapCtx.map) throw new Error('Map instance is not initialized.');
21
-
22
- let control: maplibregl.FullscreenControl | null = null;
23
- $effect(() => {
24
- control && mapCtx.map?.removeControl(control);
25
- control = new maplibregl.FullscreenControl(options);
26
- mapCtx.map?.addControl(control, position);
27
- });
28
-
29
- $effect(() => resetEventListener(control, 'fullscreenstart', onfullscreenstart));
30
- $effect(() => resetEventListener(control, 'fullscreenend', onfullscreenend));
31
-
32
- onDestroy(() => {
33
- if (control) {
34
- mapCtx.map?.removeControl(control);
35
- }
36
- });
37
- </script>
@@ -1,10 +0,0 @@
1
- import maplibregl from 'maplibre-gl';
2
- import type { Listener, Event } from '../types.js';
3
- interface Props extends maplibregl.FullscreenControlOptions {
4
- position?: maplibregl.ControlPosition;
5
- onfullscreenstart?: Listener<Event<maplibregl.FullscreenControl>>;
6
- onfullscreenend?: Listener<Event<maplibregl.FullscreenControl>>;
7
- }
8
- declare const FullScreenControl: import("svelte").Component<Props, {}, "">;
9
- type FullScreenControl = ReturnType<typeof FullScreenControl>;
10
- export default FullScreenControl;
@@ -1,79 +0,0 @@
1
- <script lang="ts">
2
- // https://maplibre.org/maplibre-gl-js/docs/API/classes/GeolocateControl/
3
-
4
- import { onDestroy, untrack } from 'svelte';
5
- import maplibregl from 'maplibre-gl';
6
- import { getMapContext } from '../contexts.svelte.js';
7
- import { resetEventListener } from '../utils.js';
8
- import type { Listener, Event } from '../types.js';
9
-
10
- type GeolocateEvent = Event<maplibregl.GeolocateControl> & object;
11
-
12
- interface Props extends maplibregl.GeolocateControlOptions {
13
- // Position on the map where the control placed
14
- position?: maplibregl.ControlPosition;
15
- // Automatically call trigger() to start locating the user
16
- autoTrigger?: boolean;
17
- control?: maplibregl.GeolocateControl;
18
- // Events
19
- // https://maplibre.org/maplibre-gl-js/docs/API/classes/GeolocateControl/#events
20
- ontrackuserlocationend?: Listener<GeolocateEvent>;
21
- ontrackuserlocationstart?: Listener<GeolocateEvent>;
22
- onuserlocationlostfocus?: Listener<GeolocateEvent>;
23
- onuserlocationfocus?: Listener<GeolocateEvent>;
24
- ongeolocate?: Listener<GeolocateEvent & GeolocationPosition>;
25
- onerror?: Listener<GeolocateEvent & GeolocationPositionError>;
26
- onoutofmaxbounds?: Listener<GeolocateEvent & GeolocationPosition>;
27
- }
28
- let {
29
- position,
30
- control = $bindable(),
31
- autoTrigger = false,
32
- ontrackuserlocationend,
33
- ontrackuserlocationstart,
34
- onuserlocationlostfocus,
35
- onuserlocationfocus,
36
- ongeolocate,
37
- onerror,
38
- onoutofmaxbounds,
39
- ...options
40
- }: Props = $props();
41
-
42
- const mapCtx = getMapContext();
43
- if (!mapCtx.map) throw new Error('Map instance is not initialized.');
44
-
45
- $effect(() => {
46
- untrack(() => control && mapCtx.map?.removeControl(control));
47
- control = new maplibregl.GeolocateControl(options);
48
- mapCtx.map?.addControl(
49
- untrack(() => control!),
50
- position
51
- );
52
- });
53
-
54
- $effect(() => {
55
- if (autoTrigger) {
56
- if (mapCtx.map?.loaded()) {
57
- control?.trigger();
58
- } else {
59
- mapCtx.map?.once('load', () => {
60
- control?.trigger();
61
- });
62
- }
63
- }
64
- });
65
-
66
- $effect(() => resetEventListener(control, 'trackuserlocationstart', ontrackuserlocationstart));
67
- $effect(() => resetEventListener(control, 'trackuserlocationend', ontrackuserlocationend));
68
- $effect(() => resetEventListener(control, 'userlocationlostfocus', onuserlocationlostfocus));
69
- $effect(() => resetEventListener(control, 'userlocationfocus', onuserlocationfocus));
70
- $effect(() => resetEventListener(control, 'geolocate', ongeolocate));
71
- $effect(() => resetEventListener(control, 'error', onerror));
72
- $effect(() => resetEventListener(control, 'outofmaxbounds', onoutofmaxbounds));
73
-
74
- onDestroy(() => {
75
- if (control) {
76
- mapCtx.map?.removeControl(control);
77
- }
78
- });
79
- </script>
@@ -1,18 +0,0 @@
1
- import maplibregl from 'maplibre-gl';
2
- import type { Listener, Event } from '../types.js';
3
- type GeolocateEvent = Event<maplibregl.GeolocateControl> & object;
4
- interface Props extends maplibregl.GeolocateControlOptions {
5
- position?: maplibregl.ControlPosition;
6
- autoTrigger?: boolean;
7
- control?: maplibregl.GeolocateControl;
8
- ontrackuserlocationend?: Listener<GeolocateEvent>;
9
- ontrackuserlocationstart?: Listener<GeolocateEvent>;
10
- onuserlocationlostfocus?: Listener<GeolocateEvent>;
11
- onuserlocationfocus?: Listener<GeolocateEvent>;
12
- ongeolocate?: Listener<GeolocateEvent & GeolocationPosition>;
13
- onerror?: Listener<GeolocateEvent & GeolocationPositionError>;
14
- onoutofmaxbounds?: Listener<GeolocateEvent & GeolocationPosition>;
15
- }
16
- declare const GeolocateControl: import("svelte").Component<Props, {}, "control">;
17
- type GeolocateControl = ReturnType<typeof GeolocateControl>;
18
- export default GeolocateControl;
@@ -1,28 +0,0 @@
1
- <script lang="ts">
2
- // https://maplibre.org/maplibre-gl-js/docs/API/classes/NavigationControl/
3
-
4
- import { onDestroy } from 'svelte';
5
- import maplibregl from 'maplibre-gl';
6
- import { getMapContext } from '../contexts.svelte.js';
7
-
8
- interface Props extends maplibregl.NavigationControlOptions {
9
- position?: maplibregl.ControlPosition;
10
- }
11
- let { position, ...options }: Props = $props();
12
-
13
- const mapCtx = getMapContext();
14
- if (!mapCtx.map) throw new Error('Map instance is not initialized.');
15
-
16
- let control: maplibregl.NavigationControl | null = null;
17
- $effect(() => {
18
- control && mapCtx.map?.removeControl(control);
19
- control = new maplibregl.NavigationControl($state.snapshot(options));
20
- mapCtx.map?.addControl(control, position);
21
- });
22
-
23
- onDestroy(() => {
24
- if (control) {
25
- mapCtx.map?.removeControl(control);
26
- }
27
- });
28
- </script>
@@ -1,7 +0,0 @@
1
- import maplibregl from 'maplibre-gl';
2
- interface Props extends maplibregl.NavigationControlOptions {
3
- position?: maplibregl.ControlPosition;
4
- }
5
- declare const NavigationControl: import("svelte").Component<Props, {}, "">;
6
- type NavigationControl = ReturnType<typeof NavigationControl>;
7
- export default NavigationControl;
@@ -1,28 +0,0 @@
1
- <script lang="ts">
2
- // https://maplibre.org/maplibre-gl-js/docs/API/classes/ScaleControl/
3
-
4
- import { onDestroy } from 'svelte';
5
- import maplibregl from 'maplibre-gl';
6
- import { getMapContext } from '../contexts.svelte.js';
7
-
8
- interface Props extends maplibregl.ScaleControlOptions {
9
- position?: maplibregl.ControlPosition;
10
- }
11
- let { position, ...options }: Props = $props();
12
-
13
- const mapCtx = getMapContext();
14
- if (!mapCtx.map) throw new Error('Map instance is not initialized.');
15
-
16
- let control: maplibregl.ScaleControl | null = null;
17
- $effect(() => {
18
- control && mapCtx.map?.removeControl(control);
19
- control = new maplibregl.ScaleControl($state.snapshot(options));
20
- mapCtx.map?.addControl(control, position);
21
- });
22
-
23
- onDestroy(() => {
24
- if (control) {
25
- mapCtx.map?.removeControl(control);
26
- }
27
- });
28
- </script>
@@ -1,7 +0,0 @@
1
- import maplibregl from 'maplibre-gl';
2
- interface Props extends maplibregl.ScaleControlOptions {
3
- position?: maplibregl.ControlPosition;
4
- }
5
- declare const ScaleControl: import("svelte").Component<Props, {}, "">;
6
- type ScaleControl = ReturnType<typeof ScaleControl>;
7
- export default ScaleControl;