@nuxt/scripts 1.3.5 → 2.0.0-beta.1

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 (208) hide show
  1. package/THIRD_PARTY_LICENSES.md +124 -0
  2. package/dist/devtools-client/200.html +1 -1
  3. package/dist/devtools-client/404.html +1 -1
  4. package/dist/devtools-client/_nuxt/{B551Pnuh.js → 2p1_IuX2.js} +1 -1
  5. package/dist/devtools-client/_nuxt/{KxC4Q3ev.js → 9elIQxwW.js} +1 -1
  6. package/dist/devtools-client/_nuxt/{DTP8MRtW.js → BNPn63Jz.js} +1 -1
  7. package/dist/devtools-client/_nuxt/BjRLaDIG.js +152 -0
  8. package/dist/devtools-client/_nuxt/BtNUYBXT.js +8 -0
  9. package/dist/devtools-client/_nuxt/CDDBpkXG.js +3 -0
  10. package/dist/devtools-client/_nuxt/Cpb0XAYP.js +1 -0
  11. package/dist/devtools-client/_nuxt/DAsiyhPm.js +6 -0
  12. package/dist/devtools-client/_nuxt/{VICyrUSM.js → DabLKy7M.js} +1 -1
  13. package/dist/devtools-client/_nuxt/Dat651Oh.js +1 -0
  14. package/dist/devtools-client/_nuxt/DcG2ZXvY.js +1 -0
  15. package/dist/devtools-client/_nuxt/DmlGWZ2X.js +1 -0
  16. package/dist/devtools-client/_nuxt/KsX6Az5B.js +1 -0
  17. package/dist/devtools-client/_nuxt/RL1np866.js +28 -0
  18. package/dist/devtools-client/_nuxt/UmWNrBO5.js +2 -0
  19. package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
  20. package/dist/devtools-client/_nuxt/builds/meta/e28b96f1-78e8-41a4-ad6f-904cd078f85e.json +1 -0
  21. package/dist/devtools-client/_nuxt/{entry.CYUdJFoE.css → entry.9HJPJ6Hp.css} +1 -1
  22. package/dist/devtools-client/_nuxt/error-404.DnwL1N6v.css +1 -0
  23. package/dist/devtools-client/_nuxt/error-500.DEbXRLdm.css +1 -0
  24. package/dist/devtools-client/docs/index.html +1 -1
  25. package/dist/devtools-client/first-party/index.html +1 -1
  26. package/dist/devtools-client/index.html +1 -1
  27. package/dist/devtools-client/registry/index.html +1 -1
  28. package/dist/module.d.mts +2 -86
  29. package/dist/module.d.ts +2 -86
  30. package/dist/module.json +3 -3
  31. package/dist/module.mjs +71 -328
  32. package/dist/registry.mjs +54 -22
  33. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +1 -28
  34. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +7 -50
  35. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +1 -28
  36. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +0 -8
  37. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +1 -13
  38. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +0 -8
  39. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.d.vue.ts +4 -4
  40. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue +9 -15
  41. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue.d.ts +4 -4
  42. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +0 -22
  43. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +0 -31
  44. package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.d.vue.ts +31 -0
  45. package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.vue +43 -0
  46. package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.vue.d.ts +31 -0
  47. package/dist/runtime/components/Leaflet/ScriptLeafletMap.d.vue.ts +90 -0
  48. package/dist/runtime/components/Leaflet/ScriptLeafletMap.vue +171 -0
  49. package/dist/runtime/components/Leaflet/ScriptLeafletMap.vue.d.ts +90 -0
  50. package/dist/runtime/components/Leaflet/ScriptLeafletMarker.d.vue.ts +47 -0
  51. package/dist/runtime/components/Leaflet/ScriptLeafletMarker.vue +70 -0
  52. package/dist/runtime/components/Leaflet/ScriptLeafletMarker.vue.d.ts +47 -0
  53. package/dist/runtime/components/Leaflet/ScriptLeafletPopup.d.vue.ts +31 -0
  54. package/dist/runtime/components/Leaflet/ScriptLeafletPopup.vue +81 -0
  55. package/dist/runtime/components/Leaflet/ScriptLeafletPopup.vue.d.ts +31 -0
  56. package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.d.vue.ts +26 -0
  57. package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.vue +38 -0
  58. package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.vue.d.ts +26 -0
  59. package/dist/runtime/components/Leaflet/useLeafletResource.d.ts +30 -0
  60. package/dist/runtime/components/Leaflet/useLeafletResource.js +46 -0
  61. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.d.vue.ts +39 -0
  62. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue +84 -0
  63. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue.d.ts +39 -0
  64. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.d.vue.ts +122 -0
  65. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue +214 -0
  66. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue.d.ts +122 -0
  67. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.d.vue.ts +35 -0
  68. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.vue +98 -0
  69. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.vue.d.ts +35 -0
  70. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.d.vue.ts +12 -0
  71. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue +23 -0
  72. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue.d.ts +12 -0
  73. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.d.vue.ts +31 -0
  74. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.vue +99 -0
  75. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.vue.d.ts +31 -0
  76. package/dist/runtime/components/MapLibre/useMapLibreResource.d.ts +23 -0
  77. package/dist/runtime/components/MapLibre/useMapLibreResource.js +41 -0
  78. package/dist/runtime/components/ScriptCrisp.vue +20 -18
  79. package/dist/runtime/components/ScriptDeskCrew.d.vue.ts +40 -0
  80. package/dist/runtime/components/ScriptDeskCrew.vue +82 -0
  81. package/dist/runtime/components/ScriptDeskCrew.vue.d.ts +40 -0
  82. package/dist/runtime/components/ScriptIntercom.vue +21 -19
  83. package/dist/runtime/components/ScriptLoadingIndicator.d.vue.ts +1 -1
  84. package/dist/runtime/components/ScriptLoadingIndicator.vue.d.ts +1 -1
  85. package/dist/runtime/components/ScriptPayPalButtons.vue +7 -3
  86. package/dist/runtime/components/ScriptPayPalMessages.vue +8 -4
  87. package/dist/runtime/composables/useScript.js +96 -49
  88. package/dist/runtime/composables/useScriptProxyUrl.d.ts +4 -8
  89. package/dist/runtime/composables/useScriptProxyUrl.js +0 -7
  90. package/dist/runtime/composables/useScriptTriggerIdleTimeout.d.ts +2 -1
  91. package/dist/runtime/composables/useScriptTriggerIdleTimeout.js +3 -34
  92. package/dist/runtime/composables/useScriptTriggerInteraction.d.ts +2 -1
  93. package/dist/runtime/composables/useScriptTriggerInteraction.js +13 -46
  94. package/dist/runtime/composables/useScriptTriggerServiceWorker.d.ts +2 -1
  95. package/dist/runtime/composables/useScriptTriggerServiceWorker.js +5 -38
  96. package/dist/runtime/leaflet-styles.d.ts +13 -0
  97. package/dist/runtime/leaflet-styles.js +684 -0
  98. package/dist/runtime/maplibre-styles.d.ts +7 -0
  99. package/dist/runtime/maplibre-styles.js +25 -0
  100. package/dist/runtime/npm-script-api-state.d.ts +4 -0
  101. package/dist/runtime/npm-script-api-state.js +13 -0
  102. package/dist/runtime/registry/crisp.d.ts +1 -1
  103. package/dist/runtime/registry/crisp.js +30 -18
  104. package/dist/runtime/registry/deskcrew.d.ts +52 -0
  105. package/dist/runtime/registry/deskcrew.js +31 -0
  106. package/dist/runtime/registry/google-analytics.d.ts +0 -2
  107. package/dist/runtime/registry/google-maps.d.ts +2 -11
  108. package/dist/runtime/registry/google-maps.js +31 -10
  109. package/dist/runtime/registry/google-tag-manager.d.ts +9 -3
  110. package/dist/runtime/registry/leaflet.d.ts +13 -0
  111. package/dist/runtime/registry/leaflet.js +29 -0
  112. package/dist/runtime/registry/maplibre.d.ts +13 -0
  113. package/dist/runtime/registry/maplibre.js +29 -0
  114. package/dist/runtime/registry/matomo-analytics.js +1 -8
  115. package/dist/runtime/registry/plausible-analytics.d.ts +4 -16
  116. package/dist/runtime/registry/plausible-analytics.js +15 -58
  117. package/dist/runtime/registry/rybbit-analytics.d.ts +0 -4
  118. package/dist/runtime/registry/rybbit-analytics.js +1 -4
  119. package/dist/runtime/registry/schemas.d.ts +61 -5
  120. package/dist/runtime/registry/schemas.js +64 -5
  121. package/dist/runtime/registry/tiktok-pixel.d.ts +2 -12
  122. package/dist/runtime/registry/tiktok-pixel.js +1 -1
  123. package/dist/runtime/registry/usercentrics.js +46 -6
  124. package/dist/runtime/registry/youtube-player.d.ts +3 -4
  125. package/dist/runtime/registry/youtube-player.js +30 -23
  126. package/dist/runtime/server/bluesky-embed-image.d.ts +1 -1
  127. package/dist/runtime/server/bluesky-embed.d.ts +1 -1
  128. package/dist/runtime/server/bluesky-embed.js +3 -6
  129. package/dist/runtime/server/gravatar-proxy.d.ts +1 -1
  130. package/dist/runtime/server/gravatar-proxy.js +2 -3
  131. package/dist/runtime/server/instagram-embed-asset.d.ts +1 -1
  132. package/dist/runtime/server/instagram-embed-image.d.ts +1 -1
  133. package/dist/runtime/server/instagram-embed.d.ts +1 -1
  134. package/dist/runtime/server/instagram-embed.js +4 -7
  135. package/dist/runtime/server/utils/cached-upstream.d.ts +6 -11
  136. package/dist/runtime/server/utils/cached-upstream.js +94 -23
  137. package/dist/runtime/server/utils/embed-rewriters.d.ts +3 -5
  138. package/dist/runtime/server/utils/embed-rewriters.js +8 -8
  139. package/dist/runtime/server/utils/image-proxy.d.ts +1 -1
  140. package/dist/runtime/server/utils/image-proxy.js +2 -3
  141. package/dist/runtime/server/utils/instagram-embed.d.ts +6 -6
  142. package/dist/runtime/server/utils/instagram-embed.js +18 -19
  143. package/dist/runtime/server/utils/proxy-url.d.ts +5 -6
  144. package/dist/runtime/server/utils/proxy-url.js +1 -4
  145. package/dist/runtime/server/x-embed-image.d.ts +1 -1
  146. package/dist/runtime/server/x-embed.d.ts +48 -1
  147. package/dist/runtime/server/x-embed.js +3 -6
  148. package/dist/runtime/types.d.ts +13 -13
  149. package/dist/runtime/utils/abortable-promise.js +26 -5
  150. package/dist/runtime/utils/nuxt-ready-script-trigger.d.ts +3 -0
  151. package/dist/runtime/utils/nuxt-ready-script-trigger.js +16 -0
  152. package/dist/runtime/utils.js +21 -32
  153. package/dist/stats.mjs +13 -0
  154. package/dist/types-source.mjs +1173 -100
  155. package/dist/types.d.mts +2 -2
  156. package/package.json +34 -21
  157. package/LICENSE.md +0 -9
  158. package/bin/cli.mjs +0 -2
  159. package/dist/cli.d.mts +0 -2
  160. package/dist/cli.d.ts +0 -2
  161. package/dist/cli.mjs +0 -50
  162. package/dist/devtools-client/_nuxt/8ltZ0o6d.js +0 -1
  163. package/dist/devtools-client/_nuxt/B8_EBdhg.js +0 -152
  164. package/dist/devtools-client/_nuxt/BKdLzFmX.js +0 -3
  165. package/dist/devtools-client/_nuxt/Bf2Kt1P0.js +0 -28
  166. package/dist/devtools-client/_nuxt/CC0GKROJ.js +0 -1
  167. package/dist/devtools-client/_nuxt/CH5oUfNi.js +0 -1
  168. package/dist/devtools-client/_nuxt/CMXzQxJZ.js +0 -1
  169. package/dist/devtools-client/_nuxt/CP7c-Js6.js +0 -8
  170. package/dist/devtools-client/_nuxt/C_v3_O0R.js +0 -6
  171. package/dist/devtools-client/_nuxt/CxN78VhB.js +0 -1
  172. package/dist/devtools-client/_nuxt/Dkc7iTdR.js +0 -1
  173. package/dist/devtools-client/_nuxt/builds/meta/173480db-0944-415b-962d-d619682f0042.json +0 -1
  174. package/dist/devtools-client/_nuxt/error-404.Bq2JQbJs.css +0 -1
  175. package/dist/devtools-client/_nuxt/error-500.5E_FOzlc.css +0 -1
  176. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +0 -13
  177. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +0 -15
  178. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +0 -13
  179. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.d.vue.ts +0 -27
  180. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +0 -34
  181. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue.d.ts +0 -27
  182. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.d.vue.ts +0 -13
  183. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +0 -11
  184. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue.d.ts +0 -13
  185. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.d.ts +0 -13
  186. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.js +0 -8
  187. package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +0 -10
  188. package/dist/runtime/components/GoogleMaps/injectionKeys.js +0 -2
  189. package/dist/runtime/composables/useScriptProxyToken.d.ts +0 -12
  190. package/dist/runtime/composables/useScriptProxyToken.js +0 -4
  191. package/dist/runtime/npm-script-stub.d.ts +0 -20
  192. package/dist/runtime/npm-script-stub.js +0 -72
  193. package/dist/runtime/plugins/proxy-token.server.d.ts +0 -10
  194. package/dist/runtime/plugins/proxy-token.server.js +0 -17
  195. package/dist/runtime/server/google-maps-geocode-proxy.d.ts +0 -2
  196. package/dist/runtime/server/google-maps-geocode-proxy.js +0 -43
  197. package/dist/runtime/server/google-static-maps-proxy.d.ts +0 -2
  198. package/dist/runtime/server/google-static-maps-proxy.js +0 -56
  199. package/dist/runtime/server/utils/proxy-query.d.ts +0 -2
  200. package/dist/runtime/server/utils/proxy-query.js +0 -10
  201. package/dist/runtime/server/utils/sign-constants.d.ts +0 -16
  202. package/dist/runtime/server/utils/sign-constants.js +0 -5
  203. package/dist/runtime/server/utils/sign.d.ts +0 -101
  204. package/dist/runtime/server/utils/sign.js +0 -91
  205. package/dist/runtime/server/utils/withSigning.d.ts +0 -23
  206. package/dist/runtime/server/utils/withSigning.js +0 -19
  207. package/dist/runtime/unhead-features.d.ts +0 -1
  208. package/dist/runtime/unhead-features.js +0 -3
@@ -18,37 +18,6 @@ export function normalizeLatLng(p) {
18
18
  }
19
19
  return { lat: p.lat, lng: p.lng };
20
20
  }
21
- export function defineDeprecatedAlias(target, alias, canonicalKey, message) {
22
- let warned = false;
23
- Object.defineProperty(target, alias, {
24
- get() {
25
- if (!warned) {
26
- warned = true;
27
- console.warn(message);
28
- }
29
- return target[canonicalKey];
30
- },
31
- enumerable: true,
32
- configurable: true
33
- });
34
- return target;
35
- }
36
- export function warnDeprecatedTopLevelMapProps(props) {
37
- let warned = 0;
38
- if (props.center !== void 0) {
39
- warned++;
40
- console.warn(
41
- '[nuxt-scripts] <ScriptGoogleMaps> prop "center" is deprecated; use `:map-options="{ center: ... }"` instead. See https://scripts.nuxt.com/docs/migration-guide/v0-to-v1'
42
- );
43
- }
44
- if (props.zoom !== void 0) {
45
- warned++;
46
- console.warn(
47
- '[nuxt-scripts] <ScriptGoogleMaps> prop "zoom" is deprecated; use `:map-options="{ zoom: ... }"` instead. See https://scripts.nuxt.com/docs/migration-guide/v0-to-v1'
48
- );
49
- }
50
- return warned;
51
- }
52
21
  export async function waitForMapsReady({
53
22
  mapsApi,
54
23
  map,
@@ -0,0 +1,31 @@
1
+ import type { GeoJsonObject } from 'geojson';
2
+ import type * as Leaflet from 'leaflet';
3
+ type __VLS_Props = {
4
+ /** GeoJSON object, feature, or feature collection. Replace it to update the layer. */
5
+ data: GeoJsonObject | GeoJsonObject[];
6
+ /** Options passed to `L.geoJSON`. */
7
+ options?: Leaflet.GeoJSONOptions;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
10
+ geoJson: import("vue").ShallowRef<Leaflet.GeoJSON<any, import("geojson").Geometry> | undefined>;
11
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ click: (event: Leaflet.LeafletMouseEvent) => any;
13
+ contextmenu: (event: Leaflet.LeafletMouseEvent) => any;
14
+ dblclick: (event: Leaflet.LeafletMouseEvent) => any;
15
+ mousedown: (event: Leaflet.LeafletMouseEvent) => any;
16
+ mouseout: (event: Leaflet.LeafletMouseEvent) => any;
17
+ mouseover: (event: Leaflet.LeafletMouseEvent) => any;
18
+ layeradd: (event: Leaflet.LayerEvent) => any;
19
+ layerremove: (event: Leaflet.LayerEvent) => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
+ onClick?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
22
+ onContextmenu?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
23
+ onDblclick?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
24
+ onMousedown?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
25
+ onMouseout?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
26
+ onMouseover?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
27
+ onLayeradd?: ((event: Leaflet.LayerEvent) => any) | undefined;
28
+ onLayerremove?: ((event: Leaflet.LayerEvent) => any) | undefined;
29
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ declare const _default: typeof __VLS_export;
31
+ export default _default;
@@ -0,0 +1,43 @@
1
+ <script setup>
2
+ import { watch } from "vue";
3
+ import { bindLeafletEvents, useLeafletResource } from "./useLeafletResource";
4
+ const props = defineProps({
5
+ data: { type: [Object, Array], required: true },
6
+ options: { type: null, required: false }
7
+ });
8
+ const emit = defineEmits(["click", "dblclick", "mousedown", "mouseover", "mouseout", "contextmenu", "layeradd", "layerremove"]);
9
+ const geoJsonEvents = ["click", "dblclick", "mousedown", "mouseover", "mouseout", "contextmenu", "layeradd", "layerremove"];
10
+ const geoJson = useLeafletResource({
11
+ create({ leaflet, map }) {
12
+ const layer = leaflet.geoJSON(props.data, props.options);
13
+ bindLeafletEvents(layer, emit, geoJsonEvents);
14
+ return layer.addTo(map);
15
+ },
16
+ cleanup(layer) {
17
+ layer.off();
18
+ layer.remove();
19
+ }
20
+ });
21
+ watch(() => props.data, (data) => {
22
+ if (!geoJson.value)
23
+ return;
24
+ geoJson.value.clearLayers();
25
+ if (Array.isArray(data))
26
+ data.forEach((item) => geoJson.value.addData(item));
27
+ else
28
+ geoJson.value.addData(data);
29
+ });
30
+ watch(() => props.options?.style, (style) => {
31
+ if (!geoJson.value)
32
+ return;
33
+ if (style)
34
+ geoJson.value.setStyle(style);
35
+ else
36
+ geoJson.value.resetStyle();
37
+ }, { deep: 2 });
38
+ defineExpose({ geoJson });
39
+ </script>
40
+
41
+ <template>
42
+ <!-- nuxt-scripts: Leaflet GeoJSON layer -->
43
+ </template>
@@ -0,0 +1,31 @@
1
+ import type { GeoJsonObject } from 'geojson';
2
+ import type * as Leaflet from 'leaflet';
3
+ type __VLS_Props = {
4
+ /** GeoJSON object, feature, or feature collection. Replace it to update the layer. */
5
+ data: GeoJsonObject | GeoJsonObject[];
6
+ /** Options passed to `L.geoJSON`. */
7
+ options?: Leaflet.GeoJSONOptions;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
10
+ geoJson: import("vue").ShallowRef<Leaflet.GeoJSON<any, import("geojson").Geometry> | undefined>;
11
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ click: (event: Leaflet.LeafletMouseEvent) => any;
13
+ contextmenu: (event: Leaflet.LeafletMouseEvent) => any;
14
+ dblclick: (event: Leaflet.LeafletMouseEvent) => any;
15
+ mousedown: (event: Leaflet.LeafletMouseEvent) => any;
16
+ mouseout: (event: Leaflet.LeafletMouseEvent) => any;
17
+ mouseover: (event: Leaflet.LeafletMouseEvent) => any;
18
+ layeradd: (event: Leaflet.LayerEvent) => any;
19
+ layerremove: (event: Leaflet.LayerEvent) => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
+ onClick?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
22
+ onContextmenu?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
23
+ onDblclick?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
24
+ onMousedown?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
25
+ onMouseout?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
26
+ onMouseover?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
27
+ onLayeradd?: ((event: Leaflet.LayerEvent) => any) | undefined;
28
+ onLayerremove?: ((event: Leaflet.LayerEvent) => any) | undefined;
29
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ declare const _default: typeof __VLS_export;
31
+ export default _default;
@@ -0,0 +1,90 @@
1
+ import type * as Leaflet from 'leaflet';
2
+ import type { HTMLAttributes, ReservedProps, ShallowRef } from 'vue';
3
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
4
+ export { LEAFLET_MAP_INJECTION_KEY } from './useLeafletResource.js';
5
+ export interface ScriptLeafletMapProps {
6
+ /**
7
+ * Defines when the Leaflet script loads.
8
+ * @default 'visible'
9
+ */
10
+ trigger?: ElementScriptTrigger;
11
+ /** Initial and reactively controlled map center. */
12
+ center: Leaflet.LatLngExpression;
13
+ /** Initial and reactively controlled zoom level. @default 13 */
14
+ zoom?: number;
15
+ /** Options passed to `L.map`. `center` and `zoom` use their dedicated props. */
16
+ options?: Leaflet.MapOptions;
17
+ /** Inject Leaflet's styles and embedded default marker images. @default true */
18
+ injectStyles?: boolean;
19
+ /** Width reserved before the map loads. @default 640 */
20
+ width?: number | string;
21
+ /** Height reserved before the map loads. @default 400 */
22
+ height?: number | string;
23
+ /** Accessible name for an interactive map. @default 'Interactive map' */
24
+ ariaLabel?: string;
25
+ /** Disable map input and remove it from the accessibility tree when decorative. @default true */
26
+ interactive?: boolean;
27
+ /** Attributes applied to the outer layout container. */
28
+ rootAttrs?: HTMLAttributes & ReservedProps & Record<string, unknown>;
29
+ }
30
+ export interface ScriptLeafletMapExpose {
31
+ leaflet: ShallowRef<typeof Leaflet | undefined>;
32
+ map: ShallowRef<Leaflet.Map | undefined>;
33
+ load: () => Promise<unknown> | unknown;
34
+ }
35
+ export interface ScriptLeafletMapEmits {
36
+ 'ready': [payload: ScriptLeafletMapExpose];
37
+ 'error': [error: Error];
38
+ 'click': [event: Leaflet.LeafletMouseEvent];
39
+ 'move': [event: Leaflet.LeafletEvent];
40
+ 'moveend': [event: Leaflet.LeafletEvent];
41
+ 'zoom': [event: Leaflet.LeafletEvent];
42
+ 'zoomend': [event: Leaflet.LeafletEvent];
43
+ 'update:center': [center: Leaflet.LatLng];
44
+ 'update:zoom': [zoom: number];
45
+ }
46
+ export interface ScriptLeafletMapSlots {
47
+ default?: () => any;
48
+ loading?: () => any;
49
+ awaitingLoad?: () => any;
50
+ error?: (props: {
51
+ error: Error;
52
+ }) => any;
53
+ placeholder?: () => any;
54
+ }
55
+ declare const _default: typeof __VLS_export;
56
+ export default _default;
57
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ScriptLeafletMapProps, ScriptLeafletMapExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
58
+ error: (error: Error) => any;
59
+ ready: (payload: ScriptLeafletMapExpose) => any;
60
+ click: (event: Leaflet.LeafletMouseEvent) => any;
61
+ move: (event: Leaflet.LeafletEvent) => any;
62
+ zoom: (event: Leaflet.LeafletEvent) => any;
63
+ zoomend: (event: Leaflet.LeafletEvent) => any;
64
+ moveend: (event: Leaflet.LeafletEvent) => any;
65
+ "update:center": (center: Leaflet.LatLng) => any;
66
+ "update:zoom": (zoom: number) => any;
67
+ }, string, import("vue").PublicProps, Readonly<ScriptLeafletMapProps> & Readonly<{
68
+ onError?: ((error: Error) => any) | undefined;
69
+ onReady?: ((payload: ScriptLeafletMapExpose) => any) | undefined;
70
+ onClick?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
71
+ onMove?: ((event: Leaflet.LeafletEvent) => any) | undefined;
72
+ onZoom?: ((event: Leaflet.LeafletEvent) => any) | undefined;
73
+ onZoomend?: ((event: Leaflet.LeafletEvent) => any) | undefined;
74
+ onMoveend?: ((event: Leaflet.LeafletEvent) => any) | undefined;
75
+ "onUpdate:center"?: ((center: Leaflet.LatLng) => any) | undefined;
76
+ "onUpdate:zoom"?: ((zoom: number) => any) | undefined;
77
+ }>, {
78
+ injectStyles: boolean;
79
+ trigger: ElementScriptTrigger;
80
+ width: number | string;
81
+ height: number | string;
82
+ zoom: number;
83
+ ariaLabel: string;
84
+ interactive: boolean;
85
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ScriptLeafletMapSlots>;
86
+ type __VLS_WithSlots<T, S> = T & {
87
+ new (): {
88
+ $slots: S;
89
+ };
90
+ };
@@ -0,0 +1,171 @@
1
+ <script>
2
+ export { LEAFLET_MAP_INJECTION_KEY } from "./useLeafletResource";
3
+ </script>
4
+
5
+ <script setup>
6
+ import { computed, onBeforeUnmount, onMounted, onUnmounted, provide, shallowRef, toRaw, useTemplateRef, watch } from "vue";
7
+ import { useScriptTriggerElement } from "#nuxt-scripts/composables/useScriptTriggerElement";
8
+ import { useScriptLeaflet } from "#nuxt-scripts/registry/leaflet";
9
+ import ScriptAriaLoadingIndicator from "../ScriptAriaLoadingIndicator.vue";
10
+ import { LEAFLET_MAP_INJECTION_KEY } from "./useLeafletResource";
11
+ const props = defineProps({
12
+ trigger: { type: [String, Array, Boolean], required: false, default: "visible" },
13
+ center: { type: null, required: true },
14
+ zoom: { type: Number, required: false, default: 13 },
15
+ options: { type: null, required: false },
16
+ injectStyles: { type: Boolean, required: false, default: true },
17
+ width: { type: [Number, String], required: false, default: 640 },
18
+ height: { type: [Number, String], required: false, default: 400 },
19
+ ariaLabel: { type: String, required: false, default: "Interactive map" },
20
+ interactive: { type: Boolean, required: false, default: true },
21
+ rootAttrs: { type: Object, required: false }
22
+ });
23
+ const emit = defineEmits(["ready", "error", "click", "move", "moveend", "zoom", "zoomend", "update:center", "update:zoom"]);
24
+ defineSlots();
25
+ const rootEl = useTemplateRef("rootEl");
26
+ const mapEl = useTemplateRef("mapEl");
27
+ const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
28
+ const { load, status, onLoaded, onError } = useScriptLeaflet({
29
+ injectStyles: props.injectStyles,
30
+ scriptOptions: { trigger }
31
+ });
32
+ const leaflet = shallowRef();
33
+ const map = shallowRef();
34
+ const isMapReady = shallowRef(false);
35
+ const loadError = shallowRef(new Error("Leaflet failed to load"));
36
+ const initializationError = shallowRef();
37
+ const hasError = computed(() => status.value === "error" || !!initializationError.value);
38
+ let isUnmounted = false;
39
+ onError((error) => {
40
+ loadError.value = error ?? new Error("Leaflet failed to load");
41
+ emit("error", loadError.value);
42
+ });
43
+ const exposed = { leaflet, map, load };
44
+ defineExpose(exposed);
45
+ provide(LEAFLET_MAP_INJECTION_KEY, { leaflet, map });
46
+ function bindMapEvents(instance) {
47
+ instance.on("click", (event) => emit("click", event));
48
+ instance.on("move", (event) => emit("move", event));
49
+ instance.on("moveend", (event) => {
50
+ emit("moveend", event);
51
+ emit("update:center", instance.getCenter());
52
+ });
53
+ instance.on("zoom", (event) => emit("zoom", event));
54
+ instance.on("zoomend", (event) => {
55
+ emit("zoomend", event);
56
+ emit("update:zoom", instance.getZoom());
57
+ });
58
+ }
59
+ function mapOptions() {
60
+ if (props.interactive)
61
+ return { ...props.options };
62
+ return {
63
+ ...props.options,
64
+ boxZoom: false,
65
+ doubleClickZoom: false,
66
+ dragging: false,
67
+ keyboard: false,
68
+ scrollWheelZoom: false,
69
+ touchZoom: false,
70
+ zoomControl: false
71
+ };
72
+ }
73
+ onMounted(() => {
74
+ onLoaded((instance) => {
75
+ if (isUnmounted || !mapEl.value)
76
+ return;
77
+ leaflet.value = instance.L;
78
+ let mapInstance;
79
+ try {
80
+ mapInstance = instance.L.map(mapEl.value, mapOptions());
81
+ mapInstance.setView(toRaw(props.center), props.zoom, { animate: false });
82
+ bindMapEvents(mapInstance);
83
+ map.value = mapInstance;
84
+ isMapReady.value = true;
85
+ emit("ready", exposed);
86
+ } catch (error) {
87
+ mapInstance?.remove();
88
+ const cause = error instanceof Error ? error : new Error("Leaflet map initialization failed");
89
+ initializationError.value = cause;
90
+ loadError.value = cause;
91
+ emit("error", cause);
92
+ }
93
+ });
94
+ });
95
+ watch(() => props.center, (center) => {
96
+ if (!map.value || !leaflet.value)
97
+ return;
98
+ const next = leaflet.value.latLng(toRaw(center));
99
+ if (!map.value.getCenter().equals(next))
100
+ map.value.panTo(next, { animate: false });
101
+ }, { deep: 1 });
102
+ watch(() => props.zoom, (zoom) => {
103
+ if (map.value && map.value.getZoom() !== zoom)
104
+ map.value.setZoom(zoom);
105
+ });
106
+ const DIGITS_ONLY_RE = /^\d+$/;
107
+ const DIGITS_PX_RE = /^\d+px$/i;
108
+ function toCssUnit(value) {
109
+ return typeof value === "number" ? `${value}px` : value;
110
+ }
111
+ function isPixelValue(value) {
112
+ return typeof value === "number" || typeof value === "string" && (DIGITS_ONLY_RE.test(value) || DIGITS_PX_RE.test(value));
113
+ }
114
+ function pixelValue(value) {
115
+ return isPixelValue(value) ? Number.parseFloat(String(value)) : void 0;
116
+ }
117
+ const rootAttrs = computed(() => ({
118
+ ...trigger instanceof Promise ? trigger.ssrAttrs || {} : {},
119
+ ...props.rootAttrs,
120
+ "aria-busy": status.value === "loading" ? true : void 0,
121
+ "style": [
122
+ {
123
+ position: "relative",
124
+ maxWidth: "100%",
125
+ width: toCssUnit(props.width),
126
+ height: isPixelValue(props.width) && isPixelValue(props.height) ? "auto" : toCssUnit(props.height),
127
+ aspectRatio: isPixelValue(props.width) && isPixelValue(props.height) ? `${pixelValue(props.width)} / ${pixelValue(props.height)}` : void 0
128
+ },
129
+ props.rootAttrs?.style
130
+ ]
131
+ }));
132
+ onBeforeUnmount(() => {
133
+ isUnmounted = true;
134
+ });
135
+ onUnmounted(() => {
136
+ map.value?.off();
137
+ map.value?.remove();
138
+ map.value = void 0;
139
+ });
140
+ </script>
141
+
142
+ <template>
143
+ <div ref="rootEl" v-bind="rootAttrs">
144
+ <div
145
+ ref="mapEl"
146
+ :aria-hidden="interactive ? void 0 : 'true'"
147
+ :aria-label="interactive ? ariaLabel : void 0"
148
+ :inert="interactive ? void 0 : true"
149
+ :role="interactive ? 'region' : void 0"
150
+ :style="{
151
+ position: 'absolute',
152
+ inset: 0,
153
+ width: '100%',
154
+ height: '100%',
155
+ maxWidth: '100%',
156
+ visibility: isMapReady ? 'visible' : 'hidden'
157
+ }"
158
+ />
159
+ <slot v-if="!isMapReady && !hasError" name="placeholder" />
160
+ <slot v-if="hasError" name="error" :error="loadError">
161
+ <p role="alert">
162
+ The map could not be loaded.
163
+ </p>
164
+ </slot>
165
+ <slot v-else-if="status === 'loading'" name="loading">
166
+ <ScriptAriaLoadingIndicator />
167
+ </slot>
168
+ <slot v-else-if="status === 'awaitingLoad'" name="awaitingLoad" />
169
+ <slot />
170
+ </div>
171
+ </template>
@@ -0,0 +1,90 @@
1
+ import type * as Leaflet from 'leaflet';
2
+ import type { HTMLAttributes, ReservedProps, ShallowRef } from 'vue';
3
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
4
+ export { LEAFLET_MAP_INJECTION_KEY } from './useLeafletResource.js';
5
+ export interface ScriptLeafletMapProps {
6
+ /**
7
+ * Defines when the Leaflet script loads.
8
+ * @default 'visible'
9
+ */
10
+ trigger?: ElementScriptTrigger;
11
+ /** Initial and reactively controlled map center. */
12
+ center: Leaflet.LatLngExpression;
13
+ /** Initial and reactively controlled zoom level. @default 13 */
14
+ zoom?: number;
15
+ /** Options passed to `L.map`. `center` and `zoom` use their dedicated props. */
16
+ options?: Leaflet.MapOptions;
17
+ /** Inject Leaflet's styles and embedded default marker images. @default true */
18
+ injectStyles?: boolean;
19
+ /** Width reserved before the map loads. @default 640 */
20
+ width?: number | string;
21
+ /** Height reserved before the map loads. @default 400 */
22
+ height?: number | string;
23
+ /** Accessible name for an interactive map. @default 'Interactive map' */
24
+ ariaLabel?: string;
25
+ /** Disable map input and remove it from the accessibility tree when decorative. @default true */
26
+ interactive?: boolean;
27
+ /** Attributes applied to the outer layout container. */
28
+ rootAttrs?: HTMLAttributes & ReservedProps & Record<string, unknown>;
29
+ }
30
+ export interface ScriptLeafletMapExpose {
31
+ leaflet: ShallowRef<typeof Leaflet | undefined>;
32
+ map: ShallowRef<Leaflet.Map | undefined>;
33
+ load: () => Promise<unknown> | unknown;
34
+ }
35
+ export interface ScriptLeafletMapEmits {
36
+ 'ready': [payload: ScriptLeafletMapExpose];
37
+ 'error': [error: Error];
38
+ 'click': [event: Leaflet.LeafletMouseEvent];
39
+ 'move': [event: Leaflet.LeafletEvent];
40
+ 'moveend': [event: Leaflet.LeafletEvent];
41
+ 'zoom': [event: Leaflet.LeafletEvent];
42
+ 'zoomend': [event: Leaflet.LeafletEvent];
43
+ 'update:center': [center: Leaflet.LatLng];
44
+ 'update:zoom': [zoom: number];
45
+ }
46
+ export interface ScriptLeafletMapSlots {
47
+ default?: () => any;
48
+ loading?: () => any;
49
+ awaitingLoad?: () => any;
50
+ error?: (props: {
51
+ error: Error;
52
+ }) => any;
53
+ placeholder?: () => any;
54
+ }
55
+ declare const _default: typeof __VLS_export;
56
+ export default _default;
57
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ScriptLeafletMapProps, ScriptLeafletMapExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
58
+ error: (error: Error) => any;
59
+ ready: (payload: ScriptLeafletMapExpose) => any;
60
+ click: (event: Leaflet.LeafletMouseEvent) => any;
61
+ move: (event: Leaflet.LeafletEvent) => any;
62
+ zoom: (event: Leaflet.LeafletEvent) => any;
63
+ zoomend: (event: Leaflet.LeafletEvent) => any;
64
+ moveend: (event: Leaflet.LeafletEvent) => any;
65
+ "update:center": (center: Leaflet.LatLng) => any;
66
+ "update:zoom": (zoom: number) => any;
67
+ }, string, import("vue").PublicProps, Readonly<ScriptLeafletMapProps> & Readonly<{
68
+ onError?: ((error: Error) => any) | undefined;
69
+ onReady?: ((payload: ScriptLeafletMapExpose) => any) | undefined;
70
+ onClick?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
71
+ onMove?: ((event: Leaflet.LeafletEvent) => any) | undefined;
72
+ onZoom?: ((event: Leaflet.LeafletEvent) => any) | undefined;
73
+ onZoomend?: ((event: Leaflet.LeafletEvent) => any) | undefined;
74
+ onMoveend?: ((event: Leaflet.LeafletEvent) => any) | undefined;
75
+ "onUpdate:center"?: ((center: Leaflet.LatLng) => any) | undefined;
76
+ "onUpdate:zoom"?: ((zoom: number) => any) | undefined;
77
+ }>, {
78
+ injectStyles: boolean;
79
+ trigger: ElementScriptTrigger;
80
+ width: number | string;
81
+ height: number | string;
82
+ zoom: number;
83
+ ariaLabel: string;
84
+ interactive: boolean;
85
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ScriptLeafletMapSlots>;
86
+ type __VLS_WithSlots<T, S> = T & {
87
+ new (): {
88
+ $slots: S;
89
+ };
90
+ };
@@ -0,0 +1,47 @@
1
+ import type * as Leaflet from 'leaflet';
2
+ type __VLS_Props = {
3
+ /** Reactive marker position. */
4
+ position: Leaflet.LatLngExpression;
5
+ /** Unique text alternative for the marker icon. */
6
+ alt?: string;
7
+ /** Tooltip text for the marker icon. */
8
+ title?: string;
9
+ /** Options passed to `L.marker`. */
10
+ options?: Leaflet.MarkerOptions;
11
+ };
12
+ type __VLS_Slots = {
13
+ default?: () => any;
14
+ };
15
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
16
+ marker: import("vue").ShallowRef<Leaflet.Marker<any> | undefined>;
17
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
+ click: (event: Leaflet.LeafletMouseEvent) => any;
19
+ contextmenu: (event: Leaflet.LeafletMouseEvent) => any;
20
+ dblclick: (event: Leaflet.LeafletMouseEvent) => any;
21
+ drag: (event: Leaflet.LeafletEvent) => any;
22
+ dragend: (event: Leaflet.DragEndEvent) => any;
23
+ dragstart: (event: Leaflet.LeafletEvent) => any;
24
+ mousedown: (event: Leaflet.LeafletMouseEvent) => any;
25
+ mouseout: (event: Leaflet.LeafletMouseEvent) => any;
26
+ mouseover: (event: Leaflet.LeafletMouseEvent) => any;
27
+ move: (event: Leaflet.LeafletEvent) => any;
28
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
29
+ onClick?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
30
+ onContextmenu?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
31
+ onDblclick?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
32
+ onDrag?: ((event: Leaflet.LeafletEvent) => any) | undefined;
33
+ onDragend?: ((event: Leaflet.DragEndEvent) => any) | undefined;
34
+ onDragstart?: ((event: Leaflet.LeafletEvent) => any) | undefined;
35
+ onMousedown?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
36
+ onMouseout?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
37
+ onMouseover?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
38
+ onMove?: ((event: Leaflet.LeafletEvent) => any) | undefined;
39
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
40
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
41
+ declare const _default: typeof __VLS_export;
42
+ export default _default;
43
+ type __VLS_WithSlots<T, S> = T & {
44
+ new (): {
45
+ $slots: S;
46
+ };
47
+ };
@@ -0,0 +1,70 @@
1
+ <script setup>
2
+ import { inject, onMounted, provide, watch } from "vue";
3
+ import { bindLeafletEvents, LEAFLET_MAP_INJECTION_KEY, LEAFLET_MARKER_INJECTION_KEY, useLeafletResource } from "./useLeafletResource";
4
+ const props = defineProps({
5
+ position: { type: null, required: true },
6
+ alt: { type: String, required: false },
7
+ title: { type: String, required: false },
8
+ options: { type: null, required: false }
9
+ });
10
+ const emit = defineEmits(["click", "dblclick", "mousedown", "mouseover", "mouseout", "contextmenu", "dragstart", "drag", "dragend", "move"]);
11
+ defineSlots();
12
+ const mapContext = inject(LEAFLET_MAP_INJECTION_KEY, void 0);
13
+ const markerEvents = ["click", "dblclick", "mousedown", "mouseover", "mouseout", "contextmenu", "dragstart", "drag", "dragend", "move"];
14
+ function markerOptions() {
15
+ return {
16
+ ...props.options,
17
+ alt: props.alt ?? props.options?.alt,
18
+ title: props.title ?? props.options?.title
19
+ };
20
+ }
21
+ const marker = useLeafletResource({
22
+ create({ leaflet, map }) {
23
+ const instance = leaflet.marker(props.position, markerOptions());
24
+ bindLeafletEvents(instance, emit, markerEvents);
25
+ return instance.addTo(map);
26
+ },
27
+ cleanup(instance) {
28
+ instance.off();
29
+ instance.remove();
30
+ }
31
+ });
32
+ provide(LEAFLET_MARKER_INJECTION_KEY, { marker });
33
+ defineExpose({ marker });
34
+ onMounted(() => {
35
+ if (import.meta.dev && !props.alt && !props.options?.alt) {
36
+ console.warn("[nuxt-scripts] <ScriptLeafletMarker> should have a unique `alt` for screen reader users.");
37
+ }
38
+ });
39
+ watch(() => props.position, (position) => marker.value?.setLatLng(position), { deep: 1 });
40
+ watch(markerOptions, (options) => {
41
+ if (!marker.value || !mapContext?.leaflet.value)
42
+ return;
43
+ mapContext.leaflet.value.Util.setOptions(marker.value, options);
44
+ if (options.icon)
45
+ marker.value.setIcon(options.icon);
46
+ if (options.opacity !== void 0)
47
+ marker.value.setOpacity(options.opacity);
48
+ if (options.zIndexOffset !== void 0)
49
+ marker.value.setZIndexOffset(options.zIndexOffset);
50
+ if (options.draggable === true)
51
+ marker.value.dragging?.enable();
52
+ else if (options.draggable === false)
53
+ marker.value.dragging?.disable();
54
+ const element = marker.value.getElement();
55
+ if (element) {
56
+ if (options.alt)
57
+ element.setAttribute("alt", options.alt);
58
+ else
59
+ element.removeAttribute("alt");
60
+ if (options.title)
61
+ element.setAttribute("title", options.title);
62
+ else
63
+ element.removeAttribute("title");
64
+ }
65
+ }, { deep: 2 });
66
+ </script>
67
+
68
+ <template>
69
+ <slot />
70
+ </template>
@@ -0,0 +1,47 @@
1
+ import type * as Leaflet from 'leaflet';
2
+ type __VLS_Props = {
3
+ /** Reactive marker position. */
4
+ position: Leaflet.LatLngExpression;
5
+ /** Unique text alternative for the marker icon. */
6
+ alt?: string;
7
+ /** Tooltip text for the marker icon. */
8
+ title?: string;
9
+ /** Options passed to `L.marker`. */
10
+ options?: Leaflet.MarkerOptions;
11
+ };
12
+ type __VLS_Slots = {
13
+ default?: () => any;
14
+ };
15
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
16
+ marker: import("vue").ShallowRef<Leaflet.Marker<any> | undefined>;
17
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
+ click: (event: Leaflet.LeafletMouseEvent) => any;
19
+ contextmenu: (event: Leaflet.LeafletMouseEvent) => any;
20
+ dblclick: (event: Leaflet.LeafletMouseEvent) => any;
21
+ drag: (event: Leaflet.LeafletEvent) => any;
22
+ dragend: (event: Leaflet.DragEndEvent) => any;
23
+ dragstart: (event: Leaflet.LeafletEvent) => any;
24
+ mousedown: (event: Leaflet.LeafletMouseEvent) => any;
25
+ mouseout: (event: Leaflet.LeafletMouseEvent) => any;
26
+ mouseover: (event: Leaflet.LeafletMouseEvent) => any;
27
+ move: (event: Leaflet.LeafletEvent) => any;
28
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
29
+ onClick?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
30
+ onContextmenu?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
31
+ onDblclick?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
32
+ onDrag?: ((event: Leaflet.LeafletEvent) => any) | undefined;
33
+ onDragend?: ((event: Leaflet.DragEndEvent) => any) | undefined;
34
+ onDragstart?: ((event: Leaflet.LeafletEvent) => any) | undefined;
35
+ onMousedown?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
36
+ onMouseout?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
37
+ onMouseover?: ((event: Leaflet.LeafletMouseEvent) => any) | undefined;
38
+ onMove?: ((event: Leaflet.LeafletEvent) => any) | undefined;
39
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
40
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
41
+ declare const _default: typeof __VLS_export;
42
+ export default _default;
43
+ type __VLS_WithSlots<T, S> = T & {
44
+ new (): {
45
+ $slots: S;
46
+ };
47
+ };