@nuxt/scripts 2.0.0-beta.6 → 2.0.0-beta.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.
Files changed (67) hide show
  1. package/dist/devtools-client/200.html +1 -1
  2. package/dist/devtools-client/404.html +1 -1
  3. package/dist/devtools-client/_nuxt/{Bagqfgzu.js → BBRrg_AT.js} +3 -3
  4. package/dist/devtools-client/_nuxt/{CP6K2Qm6.js → BI6wdYky.js} +1 -1
  5. package/dist/devtools-client/_nuxt/{CWci3Eb_.js → BckE5qrE.js} +1 -1
  6. package/dist/devtools-client/_nuxt/{D_hceTm9.js → Cs0md1ml.js} +1 -1
  7. package/dist/devtools-client/_nuxt/{DZ6h2v9A.js → DN3hUMR_.js} +1 -1
  8. package/dist/devtools-client/_nuxt/{DXDqMNFL.js → DXEYGql4.js} +1 -1
  9. package/dist/devtools-client/_nuxt/{utTTwIIR.js → Divy0_cA.js} +3 -3
  10. package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
  11. package/dist/devtools-client/_nuxt/builds/meta/afe20d38-a0b8-4d9f-be82-37b90ecac717.json +1 -0
  12. package/dist/devtools-client/_nuxt/error-404.BJ1JSMYb.css +1 -0
  13. package/dist/devtools-client/_nuxt/error-500.BBf0uW5X.css +1 -0
  14. package/dist/devtools-client/docs/index.html +1 -1
  15. package/dist/devtools-client/first-party/index.html +1 -1
  16. package/dist/devtools-client/index.html +1 -1
  17. package/dist/devtools-client/registry/index.html +1 -1
  18. package/dist/module.d.mts +1 -0
  19. package/dist/module.d.ts +1 -0
  20. package/dist/module.json +1 -1
  21. package/dist/module.mjs +4 -1
  22. package/dist/registry.mjs +24 -1
  23. package/dist/runtime/components/Leaflet/ScriptLeafletMap.d.vue.ts +5 -5
  24. package/dist/runtime/components/Leaflet/ScriptLeafletMap.vue.d.ts +5 -5
  25. package/dist/runtime/components/MapLibre/ScriptMapLibreAttributionControl.d.vue.ts +7 -0
  26. package/dist/runtime/components/MapLibre/ScriptMapLibreAttributionControl.vue +42 -0
  27. package/dist/runtime/components/MapLibre/ScriptMapLibreAttributionControl.vue.d.ts +7 -0
  28. package/dist/runtime/components/MapLibre/ScriptMapLibreFullscreenControl.d.vue.ts +13 -0
  29. package/dist/runtime/components/MapLibre/ScriptMapLibreFullscreenControl.vue +27 -0
  30. package/dist/runtime/components/MapLibre/ScriptMapLibreFullscreenControl.vue.d.ts +13 -0
  31. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.d.vue.ts +26 -35
  32. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue +233 -15
  33. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue.d.ts +26 -35
  34. package/dist/runtime/components/MapLibre/ScriptMapLibreGeolocateControl.d.vue.ts +25 -0
  35. package/dist/runtime/components/MapLibre/ScriptMapLibreGeolocateControl.vue +49 -0
  36. package/dist/runtime/components/MapLibre/ScriptMapLibreGeolocateControl.vue.d.ts +25 -0
  37. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.d.vue.ts +22 -86
  38. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue +23 -2
  39. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue.d.ts +22 -86
  40. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.d.vue.ts +3 -12
  41. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.vue.d.ts +3 -12
  42. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.d.vue.ts +3 -8
  43. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue +1 -4
  44. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue.d.ts +3 -8
  45. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.d.vue.ts +3 -10
  46. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.vue.d.ts +3 -10
  47. package/dist/runtime/components/MapLibre/ScriptMapLibreScaleControl.d.vue.ts +7 -0
  48. package/dist/runtime/components/MapLibre/ScriptMapLibreScaleControl.vue +25 -0
  49. package/dist/runtime/components/MapLibre/ScriptMapLibreScaleControl.vue.d.ts +7 -0
  50. package/dist/runtime/components/MapLibre/types.d.ts +275 -0
  51. package/dist/runtime/components/MapLibre/types.js +0 -0
  52. package/dist/runtime/components/MapLibre/useMapLibreResource.d.ts +8 -1
  53. package/dist/runtime/components/MapLibre/useMapLibreResource.js +9 -2
  54. package/dist/runtime/registry/pulse-analytics.d.ts +32 -0
  55. package/dist/runtime/registry/pulse-analytics.js +80 -0
  56. package/dist/runtime/registry/schemas.d.ts +42 -0
  57. package/dist/runtime/registry/schemas.js +42 -0
  58. package/dist/runtime/registry/tawk-to.d.ts +126 -0
  59. package/dist/runtime/registry/tawk-to.js +147 -0
  60. package/dist/runtime/types.d.ts +6 -1
  61. package/dist/stats.mjs +81 -0
  62. package/dist/types-source.mjs +312 -4
  63. package/dist/types.d.mts +2 -0
  64. package/package.json +10 -10
  65. package/dist/devtools-client/_nuxt/builds/meta/8bf6d5ed-9af4-4b18-be50-90e3f19066d5.json +0 -1
  66. package/dist/devtools-client/_nuxt/error-404.Bn3cR6N7.css +0 -1
  67. package/dist/devtools-client/_nuxt/error-500.ClHmgt9z.css +0 -1
@@ -25,7 +25,7 @@ const props = defineProps({
25
25
  interactive: { type: Boolean, required: false, default: true },
26
26
  rootAttrs: { type: Object, required: false }
27
27
  });
28
- const emit = defineEmits(["ready", "error", "click", "move", "moveend", "zoom", "zoomend", "rotate", "rotateend", "pitch", "pitchend", "update:center", "update:zoom", "update:bearing", "update:pitch"]);
28
+ const emit = defineEmits(["ready", "error", "load", "styleload", "click", "move", "moveend", "zoom", "zoomend", "rotate", "rotateend", "pitch", "pitchend", "update:center", "update:zoom", "update:bearing", "update:pitch"]);
29
29
  const slots = defineSlots();
30
30
  const rootEl = useTemplateRef("rootEl");
31
31
  const mapEl = useTemplateRef("mapEl");
@@ -48,13 +48,24 @@ onError((error) => {
48
48
  loadError.value = error ?? new Error("MapLibre failed to load");
49
49
  emit("error", loadError.value);
50
50
  });
51
- const exposed = { maplibre, map, load };
51
+ function fitBounds(bounds, options) {
52
+ map.value?.fitBounds(bounds, options);
53
+ }
54
+ function easeTo(options) {
55
+ map.value?.easeTo(options);
56
+ }
57
+ function flyTo(options) {
58
+ map.value?.flyTo(options);
59
+ }
60
+ const exposed = { maplibre, map, load, fitBounds, easeTo, flyTo };
52
61
  defineExpose(exposed);
53
62
  provide(MAPLIBRE_MAP_INJECTION_KEY, {
54
63
  maplibre,
55
64
  map
56
65
  });
57
66
  function bindMapEvents(instance) {
67
+ instance.on("load", (event) => emit("load", event));
68
+ instance.on("style.load", (event) => emit("styleload", event));
58
69
  instance.on("click", (event) => emit("click", event));
59
70
  instance.on("move", (event) => emit("move", event));
60
71
  instance.on("moveend", (event) => {
@@ -82,6 +93,15 @@ function bindMapEvents(instance) {
82
93
  emit("error", error);
83
94
  });
84
95
  }
96
+ function configureCanvasAccessibility(instance) {
97
+ const canvas = instance.getCanvas();
98
+ canvas.removeAttribute("role");
99
+ if (props.interactive && instance.keyboard.isEnabled())
100
+ return;
101
+ canvas.setAttribute("tabindex", "-1");
102
+ canvas.setAttribute("aria-hidden", "true");
103
+ canvas.removeAttribute("aria-label");
104
+ }
85
105
  onMounted(() => {
86
106
  onLoaded((instance) => {
87
107
  if (isUnmounted || !mapEl.value)
@@ -99,6 +119,7 @@ onMounted(() => {
99
119
  pitch: props.pitch,
100
120
  interactive: props.interactive
101
121
  });
122
+ configureCanvasAccessibility(mapInstance);
102
123
  bindMapEvents(mapInstance);
103
124
  map.value = mapInstance;
104
125
  mapInstance.once("load", () => {
@@ -1,119 +1,55 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- import type { HTMLAttributes, ReservedProps, ShallowRef } from 'vue';
3
- import type { ElementScriptTrigger } from '#nuxt-scripts/types';
2
+ import type { ScriptMapLibreMapExpose, ScriptMapLibreMapProps, ScriptMapLibreMapSlots } from './types.js';
3
+ export type { ScriptMapLibreMapEmits, ScriptMapLibreMapExpose, ScriptMapLibreMapProps, ScriptMapLibreMapSlots, } from './types.js';
4
4
  export { MAPLIBRE_MAP_INJECTION_KEY } from './useMapLibreResource.js';
5
- export interface ScriptMapLibreMapProps {
6
- /**
7
- * Defines when the MapLibre script loads.
8
- * @default 'visible'
9
- */
10
- trigger?: ElementScriptTrigger;
11
- /** MapLibre style URL or inline style specification. */
12
- mapStyle: string | MapLibre.StyleSpecification;
13
- /** Initial and reactively controlled map center. */
14
- center: MapLibre.LngLatLike;
15
- /** Initial and reactively controlled zoom level. @default 12 */
16
- zoom?: number;
17
- /** Initial and reactively controlled bearing in degrees. @default 0 */
18
- bearing?: number;
19
- /** Initial and reactively controlled pitch in degrees. @default 0 */
20
- pitch?: number;
21
- /** Options passed to `new maplibregl.Map()`. Dedicated props take precedence. */
22
- options?: Omit<MapLibre.MapOptions, 'container'>;
23
- /** Inject MapLibre's stylesheet when the script begins loading. @default true */
24
- injectStyles?: boolean;
25
- /** Custom MapLibre stylesheet URL. */
26
- stylesheetUrl?: string;
27
- /** Worker URL passed to `maplibregl.setWorkerUrl()`. */
28
- workerUrl?: string;
29
- /** Width reserved before the map loads. @default 640 */
30
- width?: number | string;
31
- /** Height reserved before the map loads. @default 400 */
32
- height?: number | string;
33
- /** Accessible name for an interactive map. @default 'Interactive map' */
34
- ariaLabel?: string;
35
- /** Disable map input and remove it from the accessibility tree when decorative. @default true */
36
- interactive?: boolean;
37
- /** Attributes applied to the outer layout container. */
38
- rootAttrs?: HTMLAttributes & ReservedProps & Record<string, unknown>;
39
- }
40
- export interface ScriptMapLibreMapExpose {
41
- maplibre: ShallowRef<typeof MapLibre | undefined>;
42
- map: ShallowRef<MapLibre.Map | undefined>;
43
- load: () => Promise<unknown> | unknown;
44
- }
45
- export interface ScriptMapLibreMapEmits {
46
- 'ready': [payload: ScriptMapLibreMapExpose];
47
- 'error': [error: Error];
48
- 'click': [event: MapLibre.MapEventType['click']];
49
- 'move': [event: MapLibre.MapEventType['move']];
50
- 'moveend': [event: MapLibre.MapEventType['moveend']];
51
- 'zoom': [event: MapLibre.MapEventType['zoom']];
52
- 'zoomend': [event: MapLibre.MapEventType['zoomend']];
53
- 'rotate': [event: MapLibre.MapEventType['rotate']];
54
- 'rotateend': [event: MapLibre.MapEventType['rotateend']];
55
- 'pitch': [event: MapLibre.MapEventType['pitch']];
56
- 'pitchend': [event: MapLibre.MapEventType['pitchend']];
57
- 'update:center': [center: MapLibre.LngLat];
58
- 'update:zoom': [zoom: number];
59
- 'update:bearing': [bearing: number];
60
- 'update:pitch': [pitch: number];
61
- }
62
- export interface ScriptMapLibreMapSlots {
63
- default?: () => any;
64
- loading?: () => any;
65
- awaitingLoad?: () => any;
66
- error?: (props: {
67
- error: Error;
68
- }) => any;
69
- placeholder?: () => any;
70
- /** Text or links that expose the canvas map's essential information to assistive technology. */
71
- description?: () => any;
72
- }
73
5
  declare const _default: typeof __VLS_export;
74
6
  export default _default;
75
7
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ScriptMapLibreMapProps, ScriptMapLibreMapExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
76
8
  error: (error: Error) => any;
77
9
  ready: (payload: ScriptMapLibreMapExpose) => any;
10
+ load: (event: MapLibre.MapLibreEvent<unknown>) => any;
78
11
  click: (event: MapLibre.MapMouseEvent) => any;
79
- move: (event: MapLibre.MapMovementEvent) => any;
80
12
  zoom: (event: MapLibre.MapMovementEvent) => any;
81
- rotate: (event: MapLibre.MapMovementEvent) => any;
82
- zoomend: (event: MapLibre.MapMovementEvent) => any;
13
+ pitch: (event: MapLibre.MapMovementEvent) => any;
14
+ move: (event: MapLibre.MapMovementEvent) => any;
83
15
  moveend: (event: MapLibre.MapMovementEvent) => any;
84
- "update:center": (center: MapLibre.LngLat) => any;
85
- "update:zoom": (zoom: number) => any;
16
+ zoomend: (event: MapLibre.MapMovementEvent) => any;
17
+ rotate: (event: MapLibre.MapMovementEvent) => any;
86
18
  rotateend: (event: MapLibre.MapMovementEvent) => any;
87
- pitch: (event: MapLibre.MapMovementEvent) => any;
88
19
  pitchend: (event: MapLibre.MapMovementEvent) => any;
20
+ "update:center": (center: MapLibre.LngLat) => any;
21
+ "update:zoom": (zoom: number) => any;
22
+ styleload: (event: MapLibre.MapStyleLoadEvent) => any;
89
23
  "update:bearing": (bearing: number) => any;
90
24
  "update:pitch": (pitch: number) => any;
91
25
  }, string, import("vue").PublicProps, Readonly<ScriptMapLibreMapProps> & Readonly<{
92
26
  onError?: ((error: Error) => any) | undefined;
93
27
  onReady?: ((payload: ScriptMapLibreMapExpose) => any) | undefined;
28
+ onLoad?: ((event: MapLibre.MapLibreEvent<unknown>) => any) | undefined;
94
29
  onClick?: ((event: MapLibre.MapMouseEvent) => any) | undefined;
95
- onMove?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
96
30
  onZoom?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
97
- onRotate?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
98
- onZoomend?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
31
+ onPitch?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
32
+ onMove?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
99
33
  onMoveend?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
100
- "onUpdate:center"?: ((center: MapLibre.LngLat) => any) | undefined;
101
- "onUpdate:zoom"?: ((zoom: number) => any) | undefined;
34
+ onZoomend?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
35
+ onRotate?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
102
36
  onRotateend?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
103
- onPitch?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
104
37
  onPitchend?: ((event: MapLibre.MapMovementEvent) => any) | undefined;
38
+ "onUpdate:center"?: ((center: MapLibre.LngLat) => any) | undefined;
39
+ "onUpdate:zoom"?: ((zoom: number) => any) | undefined;
40
+ onStyleload?: ((event: MapLibre.MapStyleLoadEvent) => any) | undefined;
105
41
  "onUpdate:bearing"?: ((bearing: number) => any) | undefined;
106
42
  "onUpdate:pitch"?: ((pitch: number) => any) | undefined;
107
43
  }>, {
108
- trigger: ElementScriptTrigger;
44
+ trigger: import("../../types.js").ElementScriptTrigger;
109
45
  injectStyles: boolean;
110
46
  width: number | string;
111
47
  height: number | string;
112
- zoom: number;
113
- ariaLabel: string;
114
48
  interactive: boolean;
115
- pitch: number;
49
+ zoom: number;
116
50
  bearing: number;
51
+ pitch: number;
52
+ ariaLabel: string;
117
53
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ScriptMapLibreMapSlots>;
118
54
  type __VLS_WithSlots<T, S> = T & {
119
55
  new (): {
@@ -1,25 +1,16 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- type __VLS_Props = {
3
- /** Reactive marker position in `[longitude, latitude]` order. */
4
- position: MapLibre.LngLatLike;
5
- /** Accessible name for the marker element. */
6
- ariaLabel?: string;
7
- /** Tooltip text for the marker element. */
8
- title?: string;
9
- /** Options passed to `new maplibregl.Marker()`. Options with public setters also update reactively. */
10
- options?: MapLibre.MarkerOptions;
11
- };
2
+ import type { ScriptMapLibreMarkerProps } from './types.js';
12
3
  type __VLS_Slots = {
13
4
  default?: () => any;
14
5
  };
15
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
6
+ declare const __VLS_base: import("vue").DefineComponent<ScriptMapLibreMarkerProps, {
16
7
  marker: import("vue").ShallowRef<MapLibre.Marker | undefined>;
17
8
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
9
  click: (event: MouseEvent) => any;
19
10
  drag: (event: MapLibre.Event<string>) => any;
20
11
  dragend: (event: MapLibre.Event<string>) => any;
21
12
  dragstart: (event: MapLibre.Event<string>) => any;
22
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
13
+ }, string, import("vue").PublicProps, Readonly<ScriptMapLibreMarkerProps> & Readonly<{
23
14
  onClick?: ((event: MouseEvent) => any) | undefined;
24
15
  onDrag?: ((event: MapLibre.Event<string>) => any) | undefined;
25
16
  onDragend?: ((event: MapLibre.Event<string>) => any) | undefined;
@@ -1,25 +1,16 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- type __VLS_Props = {
3
- /** Reactive marker position in `[longitude, latitude]` order. */
4
- position: MapLibre.LngLatLike;
5
- /** Accessible name for the marker element. */
6
- ariaLabel?: string;
7
- /** Tooltip text for the marker element. */
8
- title?: string;
9
- /** Options passed to `new maplibregl.Marker()`. Options with public setters also update reactively. */
10
- options?: MapLibre.MarkerOptions;
11
- };
2
+ import type { ScriptMapLibreMarkerProps } from './types.js';
12
3
  type __VLS_Slots = {
13
4
  default?: () => any;
14
5
  };
15
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
6
+ declare const __VLS_base: import("vue").DefineComponent<ScriptMapLibreMarkerProps, {
16
7
  marker: import("vue").ShallowRef<MapLibre.Marker | undefined>;
17
8
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
9
  click: (event: MouseEvent) => any;
19
10
  drag: (event: MapLibre.Event<string>) => any;
20
11
  dragend: (event: MapLibre.Event<string>) => any;
21
12
  dragstart: (event: MapLibre.Event<string>) => any;
22
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
13
+ }, string, import("vue").PublicProps, Readonly<ScriptMapLibreMarkerProps> & Readonly<{
23
14
  onClick?: ((event: MouseEvent) => any) | undefined;
24
15
  onDrag?: ((event: MapLibre.Event<string>) => any) | undefined;
25
16
  onDragend?: ((event: MapLibre.Event<string>) => any) | undefined;
@@ -1,12 +1,7 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- type __VLS_Props = {
3
- /** Position of the navigation control. */
4
- position?: MapLibre.ControlPosition;
5
- /** Options passed to `new maplibregl.NavigationControl()`. */
6
- options?: MapLibre.NavigationControlOptions;
7
- };
8
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
2
+ import type { ScriptMapLibreNavigationControlProps } from './types.js';
3
+ declare const __VLS_export: import("vue").DefineComponent<ScriptMapLibreNavigationControlProps, {
9
4
  control: import("vue").ShallowRef<MapLibre.NavigationControl | undefined>;
10
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScriptMapLibreNavigationControlProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
6
  declare const _default: typeof __VLS_export;
12
7
  export default _default;
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { useMapLibreResource } from "./useMapLibreResource";
3
+ defineOptions({ render: () => null });
3
4
  const props = defineProps({
4
5
  position: { type: null, required: false },
5
6
  options: { type: null, required: false }
@@ -17,7 +18,3 @@ const control = useMapLibreResource({
17
18
  });
18
19
  defineExpose({ control });
19
20
  </script>
20
-
21
- <template>
22
- <!-- nuxt-scripts: MapLibre navigation control -->
23
- </template>
@@ -1,12 +1,7 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- type __VLS_Props = {
3
- /** Position of the navigation control. */
4
- position?: MapLibre.ControlPosition;
5
- /** Options passed to `new maplibregl.NavigationControl()`. */
6
- options?: MapLibre.NavigationControlOptions;
7
- };
8
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
2
+ import type { ScriptMapLibreNavigationControlProps } from './types.js';
3
+ declare const __VLS_export: import("vue").DefineComponent<ScriptMapLibreNavigationControlProps, {
9
4
  control: import("vue").ShallowRef<MapLibre.NavigationControl | undefined>;
10
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScriptMapLibreNavigationControlProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
6
  declare const _default: typeof __VLS_export;
12
7
  export default _default;
@@ -1,21 +1,14 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- type __VLS_Props = {
3
- /** Position for a standalone popup. Omit when nested inside a marker. */
4
- position?: MapLibre.LngLatLike;
5
- /** Whether the popup is open. @default false */
6
- open?: boolean;
7
- /** Options passed to `new maplibregl.Popup()`. Options with public setters also update reactively. */
8
- options?: MapLibre.PopupOptions;
9
- };
2
+ import type { ScriptMapLibrePopupProps } from './types.js';
10
3
  type __VLS_Slots = {
11
4
  default?: () => any;
12
5
  };
13
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
6
+ declare const __VLS_base: import("vue").DefineComponent<ScriptMapLibrePopupProps, {
14
7
  popup: import("vue").ShallowRef<MapLibre.Popup | undefined>;
15
8
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
9
  close: (event: MapLibre.Event<string>) => any;
17
10
  open: (event: MapLibre.Event<string>) => any;
18
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ }, string, import("vue").PublicProps, Readonly<ScriptMapLibrePopupProps> & Readonly<{
19
12
  onClose?: ((event: MapLibre.Event<string>) => any) | undefined;
20
13
  onOpen?: ((event: MapLibre.Event<string>) => any) | undefined;
21
14
  }>, {
@@ -1,21 +1,14 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- type __VLS_Props = {
3
- /** Position for a standalone popup. Omit when nested inside a marker. */
4
- position?: MapLibre.LngLatLike;
5
- /** Whether the popup is open. @default false */
6
- open?: boolean;
7
- /** Options passed to `new maplibregl.Popup()`. Options with public setters also update reactively. */
8
- options?: MapLibre.PopupOptions;
9
- };
2
+ import type { ScriptMapLibrePopupProps } from './types.js';
10
3
  type __VLS_Slots = {
11
4
  default?: () => any;
12
5
  };
13
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
6
+ declare const __VLS_base: import("vue").DefineComponent<ScriptMapLibrePopupProps, {
14
7
  popup: import("vue").ShallowRef<MapLibre.Popup | undefined>;
15
8
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
9
  close: (event: MapLibre.Event<string>) => any;
17
10
  open: (event: MapLibre.Event<string>) => any;
18
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
11
+ }, string, import("vue").PublicProps, Readonly<ScriptMapLibrePopupProps> & Readonly<{
19
12
  onClose?: ((event: MapLibre.Event<string>) => any) | undefined;
20
13
  onOpen?: ((event: MapLibre.Event<string>) => any) | undefined;
21
14
  }>, {
@@ -0,0 +1,7 @@
1
+ import type * as MapLibre from 'maplibre-gl';
2
+ import type { ScriptMapLibreScaleControlProps } from './types.js';
3
+ declare const __VLS_export: import("vue").DefineComponent<ScriptMapLibreScaleControlProps, {
4
+ control: import("vue").ShallowRef<MapLibre.ScaleControl | undefined>;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScriptMapLibreScaleControlProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
@@ -0,0 +1,25 @@
1
+ <script setup>
2
+ import { watch } from "vue";
3
+ import { useMapLibreResource } from "./useMapLibreResource";
4
+ defineOptions({ render: () => null });
5
+ const props = defineProps({
6
+ position: { type: null, required: false },
7
+ options: { type: null, required: false }
8
+ });
9
+ const control = useMapLibreResource({
10
+ create({ maplibre, map }) {
11
+ const instance = new maplibre.ScaleControl(props.options);
12
+ map.addControl(instance, props.position);
13
+ return instance;
14
+ },
15
+ cleanup(instance, { map }) {
16
+ if (map.hasControl(instance))
17
+ map.removeControl(instance);
18
+ }
19
+ });
20
+ watch(() => props.options?.unit, (unit) => {
21
+ if (control.value && unit)
22
+ control.value.setUnit(unit);
23
+ });
24
+ defineExpose({ control });
25
+ </script>
@@ -0,0 +1,7 @@
1
+ import type * as MapLibre from 'maplibre-gl';
2
+ import type { ScriptMapLibreScaleControlProps } from './types.js';
3
+ declare const __VLS_export: import("vue").DefineComponent<ScriptMapLibreScaleControlProps, {
4
+ control: import("vue").ShallowRef<MapLibre.ScaleControl | undefined>;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScriptMapLibreScaleControlProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;