@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.
- package/THIRD_PARTY_LICENSES.md +124 -0
- package/dist/devtools-client/200.html +1 -1
- package/dist/devtools-client/404.html +1 -1
- package/dist/devtools-client/_nuxt/{B551Pnuh.js → 2p1_IuX2.js} +1 -1
- package/dist/devtools-client/_nuxt/{KxC4Q3ev.js → 9elIQxwW.js} +1 -1
- package/dist/devtools-client/_nuxt/{DTP8MRtW.js → BNPn63Jz.js} +1 -1
- package/dist/devtools-client/_nuxt/BjRLaDIG.js +152 -0
- package/dist/devtools-client/_nuxt/BtNUYBXT.js +8 -0
- package/dist/devtools-client/_nuxt/CDDBpkXG.js +3 -0
- package/dist/devtools-client/_nuxt/Cpb0XAYP.js +1 -0
- package/dist/devtools-client/_nuxt/DAsiyhPm.js +6 -0
- package/dist/devtools-client/_nuxt/{VICyrUSM.js → DabLKy7M.js} +1 -1
- package/dist/devtools-client/_nuxt/Dat651Oh.js +1 -0
- package/dist/devtools-client/_nuxt/DcG2ZXvY.js +1 -0
- package/dist/devtools-client/_nuxt/DmlGWZ2X.js +1 -0
- package/dist/devtools-client/_nuxt/KsX6Az5B.js +1 -0
- package/dist/devtools-client/_nuxt/RL1np866.js +28 -0
- package/dist/devtools-client/_nuxt/UmWNrBO5.js +2 -0
- package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
- package/dist/devtools-client/_nuxt/builds/meta/e28b96f1-78e8-41a4-ad6f-904cd078f85e.json +1 -0
- package/dist/devtools-client/_nuxt/{entry.CYUdJFoE.css → entry.9HJPJ6Hp.css} +1 -1
- package/dist/devtools-client/_nuxt/error-404.DnwL1N6v.css +1 -0
- package/dist/devtools-client/_nuxt/error-500.DEbXRLdm.css +1 -0
- package/dist/devtools-client/docs/index.html +1 -1
- package/dist/devtools-client/first-party/index.html +1 -1
- package/dist/devtools-client/index.html +1 -1
- package/dist/devtools-client/registry/index.html +1 -1
- package/dist/module.d.mts +2 -86
- package/dist/module.d.ts +2 -86
- package/dist/module.json +3 -3
- package/dist/module.mjs +71 -328
- package/dist/registry.mjs +54 -22
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +1 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +7 -50
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +1 -28
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +0 -8
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +1 -13
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +0 -8
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.d.vue.ts +4 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue +9 -15
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue.d.ts +4 -4
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +0 -22
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +0 -31
- package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.d.vue.ts +31 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.vue +43 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.vue.d.ts +31 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletMap.d.vue.ts +90 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletMap.vue +171 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletMap.vue.d.ts +90 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletMarker.d.vue.ts +47 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletMarker.vue +70 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletMarker.vue.d.ts +47 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletPopup.d.vue.ts +31 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletPopup.vue +81 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletPopup.vue.d.ts +31 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.d.vue.ts +26 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.vue +38 -0
- package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.vue.d.ts +26 -0
- package/dist/runtime/components/Leaflet/useLeafletResource.d.ts +30 -0
- package/dist/runtime/components/Leaflet/useLeafletResource.js +46 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.d.vue.ts +39 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue +84 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue.d.ts +39 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreMap.d.vue.ts +122 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue +214 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue.d.ts +122 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.d.vue.ts +35 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.vue +98 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.vue.d.ts +35 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.d.vue.ts +12 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue +23 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue.d.ts +12 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.d.vue.ts +31 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.vue +99 -0
- package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.vue.d.ts +31 -0
- package/dist/runtime/components/MapLibre/useMapLibreResource.d.ts +23 -0
- package/dist/runtime/components/MapLibre/useMapLibreResource.js +41 -0
- package/dist/runtime/components/ScriptCrisp.vue +20 -18
- package/dist/runtime/components/ScriptDeskCrew.d.vue.ts +40 -0
- package/dist/runtime/components/ScriptDeskCrew.vue +82 -0
- package/dist/runtime/components/ScriptDeskCrew.vue.d.ts +40 -0
- package/dist/runtime/components/ScriptIntercom.vue +21 -19
- package/dist/runtime/components/ScriptLoadingIndicator.d.vue.ts +1 -1
- package/dist/runtime/components/ScriptLoadingIndicator.vue.d.ts +1 -1
- package/dist/runtime/components/ScriptPayPalButtons.vue +7 -3
- package/dist/runtime/components/ScriptPayPalMessages.vue +8 -4
- package/dist/runtime/composables/useScript.js +96 -49
- package/dist/runtime/composables/useScriptProxyUrl.d.ts +4 -8
- package/dist/runtime/composables/useScriptProxyUrl.js +0 -7
- package/dist/runtime/composables/useScriptTriggerIdleTimeout.d.ts +2 -1
- package/dist/runtime/composables/useScriptTriggerIdleTimeout.js +3 -34
- package/dist/runtime/composables/useScriptTriggerInteraction.d.ts +2 -1
- package/dist/runtime/composables/useScriptTriggerInteraction.js +13 -46
- package/dist/runtime/composables/useScriptTriggerServiceWorker.d.ts +2 -1
- package/dist/runtime/composables/useScriptTriggerServiceWorker.js +5 -38
- package/dist/runtime/leaflet-styles.d.ts +13 -0
- package/dist/runtime/leaflet-styles.js +684 -0
- package/dist/runtime/maplibre-styles.d.ts +7 -0
- package/dist/runtime/maplibre-styles.js +25 -0
- package/dist/runtime/npm-script-api-state.d.ts +4 -0
- package/dist/runtime/npm-script-api-state.js +13 -0
- package/dist/runtime/registry/crisp.d.ts +1 -1
- package/dist/runtime/registry/crisp.js +30 -18
- package/dist/runtime/registry/deskcrew.d.ts +52 -0
- package/dist/runtime/registry/deskcrew.js +31 -0
- package/dist/runtime/registry/google-analytics.d.ts +0 -2
- package/dist/runtime/registry/google-maps.d.ts +2 -11
- package/dist/runtime/registry/google-maps.js +31 -10
- package/dist/runtime/registry/google-tag-manager.d.ts +9 -3
- package/dist/runtime/registry/leaflet.d.ts +13 -0
- package/dist/runtime/registry/leaflet.js +29 -0
- package/dist/runtime/registry/maplibre.d.ts +13 -0
- package/dist/runtime/registry/maplibre.js +29 -0
- package/dist/runtime/registry/matomo-analytics.js +1 -8
- package/dist/runtime/registry/plausible-analytics.d.ts +4 -16
- package/dist/runtime/registry/plausible-analytics.js +15 -58
- package/dist/runtime/registry/rybbit-analytics.d.ts +0 -4
- package/dist/runtime/registry/rybbit-analytics.js +1 -4
- package/dist/runtime/registry/schemas.d.ts +61 -5
- package/dist/runtime/registry/schemas.js +64 -5
- package/dist/runtime/registry/tiktok-pixel.d.ts +2 -12
- package/dist/runtime/registry/tiktok-pixel.js +1 -1
- package/dist/runtime/registry/usercentrics.js +46 -6
- package/dist/runtime/registry/youtube-player.d.ts +3 -4
- package/dist/runtime/registry/youtube-player.js +30 -23
- package/dist/runtime/server/bluesky-embed-image.d.ts +1 -1
- package/dist/runtime/server/bluesky-embed.d.ts +1 -1
- package/dist/runtime/server/bluesky-embed.js +3 -6
- package/dist/runtime/server/gravatar-proxy.d.ts +1 -1
- package/dist/runtime/server/gravatar-proxy.js +2 -3
- package/dist/runtime/server/instagram-embed-asset.d.ts +1 -1
- package/dist/runtime/server/instagram-embed-image.d.ts +1 -1
- package/dist/runtime/server/instagram-embed.d.ts +1 -1
- package/dist/runtime/server/instagram-embed.js +4 -7
- package/dist/runtime/server/utils/cached-upstream.d.ts +6 -11
- package/dist/runtime/server/utils/cached-upstream.js +94 -23
- package/dist/runtime/server/utils/embed-rewriters.d.ts +3 -5
- package/dist/runtime/server/utils/embed-rewriters.js +8 -8
- package/dist/runtime/server/utils/image-proxy.d.ts +1 -1
- package/dist/runtime/server/utils/image-proxy.js +2 -3
- package/dist/runtime/server/utils/instagram-embed.d.ts +6 -6
- package/dist/runtime/server/utils/instagram-embed.js +18 -19
- package/dist/runtime/server/utils/proxy-url.d.ts +5 -6
- package/dist/runtime/server/utils/proxy-url.js +1 -4
- package/dist/runtime/server/x-embed-image.d.ts +1 -1
- package/dist/runtime/server/x-embed.d.ts +48 -1
- package/dist/runtime/server/x-embed.js +3 -6
- package/dist/runtime/types.d.ts +13 -13
- package/dist/runtime/utils/abortable-promise.js +26 -5
- package/dist/runtime/utils/nuxt-ready-script-trigger.d.ts +3 -0
- package/dist/runtime/utils/nuxt-ready-script-trigger.js +16 -0
- package/dist/runtime/utils.js +21 -32
- package/dist/stats.mjs +13 -0
- package/dist/types-source.mjs +1173 -100
- package/dist/types.d.mts +2 -2
- package/package.json +34 -21
- package/LICENSE.md +0 -9
- package/bin/cli.mjs +0 -2
- package/dist/cli.d.mts +0 -2
- package/dist/cli.d.ts +0 -2
- package/dist/cli.mjs +0 -50
- package/dist/devtools-client/_nuxt/8ltZ0o6d.js +0 -1
- package/dist/devtools-client/_nuxt/B8_EBdhg.js +0 -152
- package/dist/devtools-client/_nuxt/BKdLzFmX.js +0 -3
- package/dist/devtools-client/_nuxt/Bf2Kt1P0.js +0 -28
- package/dist/devtools-client/_nuxt/CC0GKROJ.js +0 -1
- package/dist/devtools-client/_nuxt/CH5oUfNi.js +0 -1
- package/dist/devtools-client/_nuxt/CMXzQxJZ.js +0 -1
- package/dist/devtools-client/_nuxt/CP7c-Js6.js +0 -8
- package/dist/devtools-client/_nuxt/C_v3_O0R.js +0 -6
- package/dist/devtools-client/_nuxt/CxN78VhB.js +0 -1
- package/dist/devtools-client/_nuxt/Dkc7iTdR.js +0 -1
- package/dist/devtools-client/_nuxt/builds/meta/173480db-0944-415b-962d-d619682f0042.json +0 -1
- package/dist/devtools-client/_nuxt/error-404.Bq2JQbJs.css +0 -1
- package/dist/devtools-client/_nuxt/error-500.5E_FOzlc.css +0 -1
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +0 -13
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +0 -15
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +0 -13
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.d.vue.ts +0 -27
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +0 -34
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue.d.ts +0 -27
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.d.vue.ts +0 -13
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +0 -11
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue.d.ts +0 -13
- package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.d.ts +0 -13
- package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.js +0 -8
- package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +0 -10
- package/dist/runtime/components/GoogleMaps/injectionKeys.js +0 -2
- package/dist/runtime/composables/useScriptProxyToken.d.ts +0 -12
- package/dist/runtime/composables/useScriptProxyToken.js +0 -4
- package/dist/runtime/npm-script-stub.d.ts +0 -20
- package/dist/runtime/npm-script-stub.js +0 -72
- package/dist/runtime/plugins/proxy-token.server.d.ts +0 -10
- package/dist/runtime/plugins/proxy-token.server.js +0 -17
- package/dist/runtime/server/google-maps-geocode-proxy.d.ts +0 -2
- package/dist/runtime/server/google-maps-geocode-proxy.js +0 -43
- package/dist/runtime/server/google-static-maps-proxy.d.ts +0 -2
- package/dist/runtime/server/google-static-maps-proxy.js +0 -56
- package/dist/runtime/server/utils/proxy-query.d.ts +0 -2
- package/dist/runtime/server/utils/proxy-query.js +0 -10
- package/dist/runtime/server/utils/sign-constants.d.ts +0 -16
- package/dist/runtime/server/utils/sign-constants.js +0 -5
- package/dist/runtime/server/utils/sign.d.ts +0 -101
- package/dist/runtime/server/utils/sign.js +0 -91
- package/dist/runtime/server/utils/withSigning.d.ts +0 -23
- package/dist/runtime/server/utils/withSigning.js +0 -19
- package/dist/runtime/unhead-features.d.ts +0 -1
- package/dist/runtime/unhead-features.js +0 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type * as Leaflet from 'leaflet';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** Position for a standalone popup. Omit when nested inside a marker. */
|
|
4
|
+
position?: Leaflet.LatLngExpression;
|
|
5
|
+
/** Whether the popup is open. @default false */
|
|
6
|
+
open?: boolean;
|
|
7
|
+
/** Options passed to `L.popup`. */
|
|
8
|
+
options?: Leaflet.PopupOptions;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_Slots = {
|
|
11
|
+
default?: () => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
14
|
+
popup: import("vue").ShallowRef<Leaflet.Popup | undefined>;
|
|
15
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
close: (event: Leaflet.LeafletEvent) => any;
|
|
17
|
+
open: (event: Leaflet.LeafletEvent) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
|
+
onClose?: ((event: Leaflet.LeafletEvent) => any) | undefined;
|
|
20
|
+
onOpen?: ((event: Leaflet.LeafletEvent) => any) | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
open: boolean;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject, useTemplateRef, watch } from "vue";
|
|
3
|
+
import { LEAFLET_MARKER_INJECTION_KEY, useLeafletResource } from "./useLeafletResource";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
position: { type: null, required: false },
|
|
6
|
+
open: { type: Boolean, required: false, default: false },
|
|
7
|
+
options: { type: null, required: false }
|
|
8
|
+
});
|
|
9
|
+
const emit = defineEmits(["open", "close"]);
|
|
10
|
+
defineSlots();
|
|
11
|
+
const markerContext = inject(LEAFLET_MARKER_INJECTION_KEY, void 0);
|
|
12
|
+
const content = useTemplateRef("content");
|
|
13
|
+
let boundMarker;
|
|
14
|
+
let popupMap;
|
|
15
|
+
const popup = useLeafletResource({
|
|
16
|
+
ready: () => !!content.value && (!!markerContext?.marker.value || !!props.position),
|
|
17
|
+
create({ leaflet, map }) {
|
|
18
|
+
popupMap = map;
|
|
19
|
+
const instance = leaflet.popup(props.options).setContent(content.value);
|
|
20
|
+
instance.on("add", (event) => emit("open", event));
|
|
21
|
+
instance.on("remove", (event) => emit("close", event));
|
|
22
|
+
boundMarker = markerContext?.marker.value;
|
|
23
|
+
if (boundMarker) {
|
|
24
|
+
boundMarker.bindPopup(instance);
|
|
25
|
+
if (props.open)
|
|
26
|
+
boundMarker.openPopup();
|
|
27
|
+
} else if (props.position) {
|
|
28
|
+
instance.setLatLng(props.position);
|
|
29
|
+
if (props.open)
|
|
30
|
+
instance.openOn(map);
|
|
31
|
+
}
|
|
32
|
+
return instance;
|
|
33
|
+
},
|
|
34
|
+
cleanup(instance) {
|
|
35
|
+
if (boundMarker) {
|
|
36
|
+
boundMarker.unbindPopup();
|
|
37
|
+
boundMarker = void 0;
|
|
38
|
+
}
|
|
39
|
+
instance.off();
|
|
40
|
+
instance.remove();
|
|
41
|
+
popupMap = void 0;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
watch(() => props.open, (open) => {
|
|
45
|
+
if (!popup.value)
|
|
46
|
+
return;
|
|
47
|
+
if (boundMarker) {
|
|
48
|
+
if (open)
|
|
49
|
+
boundMarker.openPopup();
|
|
50
|
+
else
|
|
51
|
+
boundMarker.closePopup();
|
|
52
|
+
} else if (open && popupMap) {
|
|
53
|
+
popup.value.openOn(popupMap);
|
|
54
|
+
} else {
|
|
55
|
+
popup.value.close();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
watch(() => props.position, (position) => {
|
|
59
|
+
if (popup.value && position && !boundMarker)
|
|
60
|
+
popup.value.setLatLng(position);
|
|
61
|
+
}, { deep: 1 });
|
|
62
|
+
watch(() => props.options, (options) => {
|
|
63
|
+
if (!popup.value || !options)
|
|
64
|
+
return;
|
|
65
|
+
Object.assign(popup.value.options, options);
|
|
66
|
+
popup.value.update();
|
|
67
|
+
}, { deep: 2 });
|
|
68
|
+
defineExpose({ popup });
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<div class="leaflet-popup-content-source">
|
|
73
|
+
<div ref="content">
|
|
74
|
+
<slot />
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<style scoped>
|
|
80
|
+
.leaflet-popup-content-source{display:none}
|
|
81
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type * as Leaflet from 'leaflet';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** Position for a standalone popup. Omit when nested inside a marker. */
|
|
4
|
+
position?: Leaflet.LatLngExpression;
|
|
5
|
+
/** Whether the popup is open. @default false */
|
|
6
|
+
open?: boolean;
|
|
7
|
+
/** Options passed to `L.popup`. */
|
|
8
|
+
options?: Leaflet.PopupOptions;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_Slots = {
|
|
11
|
+
default?: () => any;
|
|
12
|
+
};
|
|
13
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
14
|
+
popup: import("vue").ShallowRef<Leaflet.Popup | undefined>;
|
|
15
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
close: (event: Leaflet.LeafletEvent) => any;
|
|
17
|
+
open: (event: Leaflet.LeafletEvent) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
|
+
onClose?: ((event: Leaflet.LeafletEvent) => any) | undefined;
|
|
20
|
+
onOpen?: ((event: Leaflet.LeafletEvent) => any) | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
open: boolean;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type * as Leaflet from 'leaflet';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** Tile URL template, for example `https://tile.openstreetmap.org/{z}/{x}/{y}.png`. */
|
|
4
|
+
url: string;
|
|
5
|
+
/** Tile layer options. Include the provider's required `attribution`. */
|
|
6
|
+
options?: Leaflet.TileLayerOptions;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
9
|
+
tileLayer: import("vue").ShallowRef<Leaflet.TileLayer | undefined>;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
load: (event: Leaflet.LeafletEvent) => any;
|
|
12
|
+
loading: (event: Leaflet.LeafletEvent) => any;
|
|
13
|
+
tileerror: (event: Leaflet.TileErrorEvent) => any;
|
|
14
|
+
tileloadstart: (event: Leaflet.TileEvent) => any;
|
|
15
|
+
tileload: (event: Leaflet.TileEvent) => any;
|
|
16
|
+
tileabort: (event: Leaflet.TileEvent) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onLoad?: ((event: Leaflet.LeafletEvent) => any) | undefined;
|
|
19
|
+
onLoading?: ((event: Leaflet.LeafletEvent) => any) | undefined;
|
|
20
|
+
onTileerror?: ((event: Leaflet.TileErrorEvent) => any) | undefined;
|
|
21
|
+
onTileloadstart?: ((event: Leaflet.TileEvent) => any) | undefined;
|
|
22
|
+
onTileload?: ((event: Leaflet.TileEvent) => any) | undefined;
|
|
23
|
+
onTileabort?: ((event: Leaflet.TileEvent) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject, watch } from "vue";
|
|
3
|
+
import { bindLeafletEvents, LEAFLET_MAP_INJECTION_KEY, useLeafletResource } from "./useLeafletResource";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
url: { type: String, required: true },
|
|
6
|
+
options: { type: null, required: false }
|
|
7
|
+
});
|
|
8
|
+
const emit = defineEmits(["loading", "load", "tileloadstart", "tileload", "tileabort", "tileerror"]);
|
|
9
|
+
const mapContext = inject(LEAFLET_MAP_INJECTION_KEY, void 0);
|
|
10
|
+
const tileEvents = ["loading", "load", "tileloadstart", "tileload", "tileabort", "tileerror"];
|
|
11
|
+
const tileLayer = useLeafletResource({
|
|
12
|
+
create({ leaflet, map }) {
|
|
13
|
+
const layer = leaflet.tileLayer(props.url, props.options);
|
|
14
|
+
bindLeafletEvents(layer, emit, tileEvents);
|
|
15
|
+
return layer.addTo(map);
|
|
16
|
+
},
|
|
17
|
+
cleanup(layer) {
|
|
18
|
+
layer.off();
|
|
19
|
+
layer.remove();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
watch(() => props.url, (url) => tileLayer.value?.setUrl(url));
|
|
23
|
+
watch(() => props.options, (options) => {
|
|
24
|
+
if (!tileLayer.value || !mapContext?.leaflet.value || !options)
|
|
25
|
+
return;
|
|
26
|
+
mapContext.leaflet.value.Util.setOptions(tileLayer.value, options);
|
|
27
|
+
if (options.opacity !== void 0)
|
|
28
|
+
tileLayer.value.setOpacity(options.opacity);
|
|
29
|
+
if (options.zIndex !== void 0)
|
|
30
|
+
tileLayer.value.setZIndex(options.zIndex);
|
|
31
|
+
tileLayer.value.redraw();
|
|
32
|
+
}, { deep: 2 });
|
|
33
|
+
defineExpose({ tileLayer });
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<!-- nuxt-scripts: Leaflet tile layer -->
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type * as Leaflet from 'leaflet';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** Tile URL template, for example `https://tile.openstreetmap.org/{z}/{x}/{y}.png`. */
|
|
4
|
+
url: string;
|
|
5
|
+
/** Tile layer options. Include the provider's required `attribution`. */
|
|
6
|
+
options?: Leaflet.TileLayerOptions;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
9
|
+
tileLayer: import("vue").ShallowRef<Leaflet.TileLayer | undefined>;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
load: (event: Leaflet.LeafletEvent) => any;
|
|
12
|
+
loading: (event: Leaflet.LeafletEvent) => any;
|
|
13
|
+
tileerror: (event: Leaflet.TileErrorEvent) => any;
|
|
14
|
+
tileloadstart: (event: Leaflet.TileEvent) => any;
|
|
15
|
+
tileload: (event: Leaflet.TileEvent) => any;
|
|
16
|
+
tileabort: (event: Leaflet.TileEvent) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onLoad?: ((event: Leaflet.LeafletEvent) => any) | undefined;
|
|
19
|
+
onLoading?: ((event: Leaflet.LeafletEvent) => any) | undefined;
|
|
20
|
+
onTileerror?: ((event: Leaflet.TileErrorEvent) => any) | undefined;
|
|
21
|
+
onTileloadstart?: ((event: Leaflet.TileEvent) => any) | undefined;
|
|
22
|
+
onTileload?: ((event: Leaflet.TileEvent) => any) | undefined;
|
|
23
|
+
onTileabort?: ((event: Leaflet.TileEvent) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type * as Leaflet from 'leaflet';
|
|
2
|
+
import type { InjectionKey, ShallowRef } from 'vue';
|
|
3
|
+
export type LeafletNamespace = typeof Leaflet;
|
|
4
|
+
export interface LeafletMapContext {
|
|
5
|
+
map: ShallowRef<Leaflet.Map | undefined>;
|
|
6
|
+
leaflet: ShallowRef<LeafletNamespace | undefined>;
|
|
7
|
+
}
|
|
8
|
+
export declare const LEAFLET_MAP_INJECTION_KEY: InjectionKey<LeafletMapContext>;
|
|
9
|
+
export declare const LEAFLET_MARKER_INJECTION_KEY: InjectionKey<{
|
|
10
|
+
marker: ShallowRef<Leaflet.Marker | undefined>;
|
|
11
|
+
}>;
|
|
12
|
+
export interface LeafletResourceContext {
|
|
13
|
+
map: Leaflet.Map;
|
|
14
|
+
leaflet: LeafletNamespace;
|
|
15
|
+
}
|
|
16
|
+
type UnionToIntersection<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer I) => void ? I : never;
|
|
17
|
+
type LeafletEmit<TEvents extends object> = UnionToIntersection<{
|
|
18
|
+
[TEvent in keyof TEvents]: TEvents[TEvent] extends unknown[] ? (event: TEvent, ...args: TEvents[TEvent]) => void : never;
|
|
19
|
+
}[keyof TEvents]>;
|
|
20
|
+
export declare function bindLeafletEvents<TEvents extends object>(target: Leaflet.Evented, emit: LeafletEmit<TEvents>, events: readonly (keyof TEvents & string)[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a Leaflet resource once its parent map and any component-specific
|
|
23
|
+
* DOM refs are ready, then removes it synchronously during unmount.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useLeafletResource<T>({ ready, create, cleanup, }: {
|
|
26
|
+
ready?: () => boolean;
|
|
27
|
+
create: (context: LeafletResourceContext) => T;
|
|
28
|
+
cleanup: (resource: T, context: LeafletResourceContext) => void;
|
|
29
|
+
}): ShallowRef<T | undefined>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { inject, onUnmounted, shallowRef, watch } from "vue";
|
|
2
|
+
export const LEAFLET_MAP_INJECTION_KEY = Symbol("leaflet-map");
|
|
3
|
+
export const LEAFLET_MARKER_INJECTION_KEY = Symbol("leaflet-marker");
|
|
4
|
+
export function bindLeafletEvents(target, emit, events) {
|
|
5
|
+
const emitEvent = emit;
|
|
6
|
+
for (const event of events)
|
|
7
|
+
target.on(event, (payload) => emitEvent(event, payload));
|
|
8
|
+
}
|
|
9
|
+
export function useLeafletResource({
|
|
10
|
+
ready,
|
|
11
|
+
create,
|
|
12
|
+
cleanup
|
|
13
|
+
}) {
|
|
14
|
+
const mapContext = inject(LEAFLET_MAP_INJECTION_KEY, void 0);
|
|
15
|
+
const resource = shallowRef();
|
|
16
|
+
let creating = false;
|
|
17
|
+
let resourceContext;
|
|
18
|
+
if (import.meta.dev && !mapContext) {
|
|
19
|
+
console.warn("[nuxt-scripts] Leaflet child components must be placed inside <ScriptLeafletMap>.");
|
|
20
|
+
}
|
|
21
|
+
const stop = watch(
|
|
22
|
+
() => [mapContext?.map.value, mapContext?.leaflet.value, ready?.() ?? true],
|
|
23
|
+
([map, leaflet, isReady]) => {
|
|
24
|
+
if (!map || !leaflet || !isReady || resource.value || creating)
|
|
25
|
+
return;
|
|
26
|
+
creating = true;
|
|
27
|
+
try {
|
|
28
|
+
resourceContext = { map, leaflet };
|
|
29
|
+
resource.value = create(resourceContext);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error("[nuxt-scripts] Leaflet resource creation failed:", error);
|
|
32
|
+
} finally {
|
|
33
|
+
creating = false;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{ immediate: true }
|
|
37
|
+
);
|
|
38
|
+
onUnmounted(() => {
|
|
39
|
+
stop();
|
|
40
|
+
if (resource.value && resourceContext)
|
|
41
|
+
cleanup(resource.value, resourceContext);
|
|
42
|
+
resource.value = void 0;
|
|
43
|
+
resourceContext = void 0;
|
|
44
|
+
});
|
|
45
|
+
return resource;
|
|
46
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { GeoJSON } from 'geojson';
|
|
2
|
+
import type * as MapLibreGl from 'maplibre-gl';
|
|
3
|
+
import type * as MapLibre from 'maplibre-gl';
|
|
4
|
+
export type ScriptMapLibreGeoJsonLayer = Omit<MapLibre.LayerSpecification, 'source'> & {
|
|
5
|
+
/** Override the component's source ID for this layer. */
|
|
6
|
+
source?: string;
|
|
7
|
+
};
|
|
8
|
+
export interface ScriptMapLibreGeoJsonResource {
|
|
9
|
+
map: MapLibre.Map;
|
|
10
|
+
onLoad: () => void;
|
|
11
|
+
onStyleLoad: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
15
|
+
declare const __VLS_export: import("vue").DefineComponent<{
|
|
16
|
+
/** MapLibre source ID. Changing it rebuilds the owned source and layers. */
|
|
17
|
+
sourceId: string;
|
|
18
|
+
/** Inline GeoJSON data or a URL returning GeoJSON. */
|
|
19
|
+
data: GeoJSON | string;
|
|
20
|
+
/** GeoJSON source options. `type` and `data` are supplied by the component. */
|
|
21
|
+
sourceOptions?: Omit<MapLibreGl.GeoJSONSourceSpecification, "type" | "data">;
|
|
22
|
+
/** Style layers backed by this source. */
|
|
23
|
+
layers: ScriptMapLibreGeoJsonLayer[];
|
|
24
|
+
/** Existing layer ID before which the layers are inserted. */
|
|
25
|
+
beforeId?: string;
|
|
26
|
+
}, {
|
|
27
|
+
geoJson: import("vue").ShallowRef<ScriptMapLibreGeoJsonResource | undefined>;
|
|
28
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
29
|
+
/** MapLibre source ID. Changing it rebuilds the owned source and layers. */
|
|
30
|
+
sourceId: string;
|
|
31
|
+
/** Inline GeoJSON data or a URL returning GeoJSON. */
|
|
32
|
+
data: GeoJSON | string;
|
|
33
|
+
/** GeoJSON source options. `type` and `data` are supplied by the component. */
|
|
34
|
+
sourceOptions?: Omit<MapLibreGl.GeoJSONSourceSpecification, "type" | "data">;
|
|
35
|
+
/** Style layers backed by this source. */
|
|
36
|
+
layers: ScriptMapLibreGeoJsonLayer[];
|
|
37
|
+
/** Existing layer ID before which the layers are inserted. */
|
|
38
|
+
beforeId?: string;
|
|
39
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<script setup>
|
|
6
|
+
import { toRaw, watch } from "vue";
|
|
7
|
+
import { useMapLibreResource } from "./useMapLibreResource";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
sourceId: { type: String, required: true },
|
|
10
|
+
data: { type: null, required: true },
|
|
11
|
+
sourceOptions: { type: Object, required: false },
|
|
12
|
+
layers: { type: Array, required: true },
|
|
13
|
+
beforeId: { type: String, required: false }
|
|
14
|
+
});
|
|
15
|
+
let ownedLayerIds = [];
|
|
16
|
+
let ownedSourceId;
|
|
17
|
+
function removeOwnedResources(map) {
|
|
18
|
+
for (const layerId of [...ownedLayerIds].reverse()) {
|
|
19
|
+
if (map.getLayer(layerId))
|
|
20
|
+
map.removeLayer(layerId);
|
|
21
|
+
}
|
|
22
|
+
ownedLayerIds = [];
|
|
23
|
+
if (ownedSourceId && map.getSource(ownedSourceId))
|
|
24
|
+
map.removeSource(ownedSourceId);
|
|
25
|
+
ownedSourceId = void 0;
|
|
26
|
+
}
|
|
27
|
+
function syncResources(map) {
|
|
28
|
+
if (!map.isStyleLoaded())
|
|
29
|
+
return;
|
|
30
|
+
removeOwnedResources(map);
|
|
31
|
+
const sourceId = props.sourceId;
|
|
32
|
+
try {
|
|
33
|
+
map.addSource(sourceId, {
|
|
34
|
+
...toRaw(props.sourceOptions),
|
|
35
|
+
type: "geojson",
|
|
36
|
+
data: toRaw(props.data)
|
|
37
|
+
});
|
|
38
|
+
ownedSourceId = sourceId;
|
|
39
|
+
for (const layer of props.layers) {
|
|
40
|
+
const nextLayer = {
|
|
41
|
+
...toRaw(layer),
|
|
42
|
+
source: layer.source || sourceId
|
|
43
|
+
};
|
|
44
|
+
map.addLayer(nextLayer, props.beforeId);
|
|
45
|
+
ownedLayerIds.push(nextLayer.id);
|
|
46
|
+
}
|
|
47
|
+
} catch (error) {
|
|
48
|
+
removeOwnedResources(map);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const geoJson = useMapLibreResource({
|
|
53
|
+
create({ map }) {
|
|
54
|
+
const onStyleLoad = () => syncResources(map);
|
|
55
|
+
const onLoad = () => {
|
|
56
|
+
if (!ownedSourceId)
|
|
57
|
+
syncResources(map);
|
|
58
|
+
};
|
|
59
|
+
map.on("style.load", onStyleLoad);
|
|
60
|
+
map.on("load", onLoad);
|
|
61
|
+
syncResources(map);
|
|
62
|
+
return { map, onLoad, onStyleLoad };
|
|
63
|
+
},
|
|
64
|
+
cleanup(resource) {
|
|
65
|
+
resource.map.off("load", resource.onLoad);
|
|
66
|
+
resource.map.off("style.load", resource.onStyleLoad);
|
|
67
|
+
removeOwnedResources(resource.map);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
watch(() => props.data, (data) => {
|
|
71
|
+
const source = geoJson.value?.map.getSource(props.sourceId);
|
|
72
|
+
if (source?.type === "geojson")
|
|
73
|
+
source.setData(toRaw(data));
|
|
74
|
+
}, { deep: 2 });
|
|
75
|
+
watch(() => [props.sourceId, props.layers, props.sourceOptions, props.beforeId], () => {
|
|
76
|
+
if (geoJson.value)
|
|
77
|
+
syncResources(geoJson.value.map);
|
|
78
|
+
}, { deep: 3 });
|
|
79
|
+
defineExpose({ geoJson });
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<template>
|
|
83
|
+
<!-- nuxt-scripts: MapLibre GeoJSON source and layers -->
|
|
84
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { GeoJSON } from 'geojson';
|
|
2
|
+
import type * as MapLibreGl from 'maplibre-gl';
|
|
3
|
+
import type * as MapLibre from 'maplibre-gl';
|
|
4
|
+
export type ScriptMapLibreGeoJsonLayer = Omit<MapLibre.LayerSpecification, 'source'> & {
|
|
5
|
+
/** Override the component's source ID for this layer. */
|
|
6
|
+
source?: string;
|
|
7
|
+
};
|
|
8
|
+
export interface ScriptMapLibreGeoJsonResource {
|
|
9
|
+
map: MapLibre.Map;
|
|
10
|
+
onLoad: () => void;
|
|
11
|
+
onStyleLoad: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
15
|
+
declare const __VLS_export: import("vue").DefineComponent<{
|
|
16
|
+
/** MapLibre source ID. Changing it rebuilds the owned source and layers. */
|
|
17
|
+
sourceId: string;
|
|
18
|
+
/** Inline GeoJSON data or a URL returning GeoJSON. */
|
|
19
|
+
data: GeoJSON | string;
|
|
20
|
+
/** GeoJSON source options. `type` and `data` are supplied by the component. */
|
|
21
|
+
sourceOptions?: Omit<MapLibreGl.GeoJSONSourceSpecification, "type" | "data">;
|
|
22
|
+
/** Style layers backed by this source. */
|
|
23
|
+
layers: ScriptMapLibreGeoJsonLayer[];
|
|
24
|
+
/** Existing layer ID before which the layers are inserted. */
|
|
25
|
+
beforeId?: string;
|
|
26
|
+
}, {
|
|
27
|
+
geoJson: import("vue").ShallowRef<ScriptMapLibreGeoJsonResource | undefined>;
|
|
28
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
29
|
+
/** MapLibre source ID. Changing it rebuilds the owned source and layers. */
|
|
30
|
+
sourceId: string;
|
|
31
|
+
/** Inline GeoJSON data or a URL returning GeoJSON. */
|
|
32
|
+
data: GeoJSON | string;
|
|
33
|
+
/** GeoJSON source options. `type` and `data` are supplied by the component. */
|
|
34
|
+
sourceOptions?: Omit<MapLibreGl.GeoJSONSourceSpecification, "type" | "data">;
|
|
35
|
+
/** Style layers backed by this source. */
|
|
36
|
+
layers: ScriptMapLibreGeoJsonLayer[];
|
|
37
|
+
/** Existing layer ID before which the layers are inserted. */
|
|
38
|
+
beforeId?: string;
|
|
39
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type * as MapLibre from 'maplibre-gl';
|
|
2
|
+
import type { HTMLAttributes, ReservedProps, ShallowRef } from 'vue';
|
|
3
|
+
import type { ElementScriptTrigger } from '#nuxt-scripts/types';
|
|
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 used with MapLibre's CSP-compatible build. */
|
|
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
|
+
declare const _default: typeof __VLS_export;
|
|
74
|
+
export default _default;
|
|
75
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ScriptMapLibreMapProps, ScriptMapLibreMapExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
76
|
+
error: (error: Error) => any;
|
|
77
|
+
ready: (payload: ScriptMapLibreMapExpose) => any;
|
|
78
|
+
click: (event: MapLibre.MapMouseEvent) => any;
|
|
79
|
+
move: (event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>) => any;
|
|
80
|
+
zoom: (event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>) => any;
|
|
81
|
+
zoomend: (event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>) => any;
|
|
82
|
+
moveend: (event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>) => any;
|
|
83
|
+
"update:center": (center: MapLibre.LngLat) => any;
|
|
84
|
+
"update:zoom": (zoom: number) => any;
|
|
85
|
+
rotate: (event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | undefined>) => any;
|
|
86
|
+
rotateend: (event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | undefined>) => any;
|
|
87
|
+
pitch: (event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | undefined>) => any;
|
|
88
|
+
pitchend: (event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | undefined>) => any;
|
|
89
|
+
"update:bearing": (bearing: number) => any;
|
|
90
|
+
"update:pitch": (pitch: number) => any;
|
|
91
|
+
}, string, import("vue").PublicProps, Readonly<ScriptMapLibreMapProps> & Readonly<{
|
|
92
|
+
onError?: ((error: Error) => any) | undefined;
|
|
93
|
+
onReady?: ((payload: ScriptMapLibreMapExpose) => any) | undefined;
|
|
94
|
+
onClick?: ((event: MapLibre.MapMouseEvent) => any) | undefined;
|
|
95
|
+
onMove?: ((event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>) => any) | undefined;
|
|
96
|
+
onZoom?: ((event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>) => any) | undefined;
|
|
97
|
+
onZoomend?: ((event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>) => any) | undefined;
|
|
98
|
+
onMoveend?: ((event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>) => any) | undefined;
|
|
99
|
+
"onUpdate:center"?: ((center: MapLibre.LngLat) => any) | undefined;
|
|
100
|
+
"onUpdate:zoom"?: ((zoom: number) => any) | undefined;
|
|
101
|
+
onRotate?: ((event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | undefined>) => any) | undefined;
|
|
102
|
+
onRotateend?: ((event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | undefined>) => any) | undefined;
|
|
103
|
+
onPitch?: ((event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | undefined>) => any) | undefined;
|
|
104
|
+
onPitchend?: ((event: MapLibre.MapLibreEvent<MouseEvent | TouchEvent | undefined>) => any) | undefined;
|
|
105
|
+
"onUpdate:bearing"?: ((bearing: number) => any) | undefined;
|
|
106
|
+
"onUpdate:pitch"?: ((pitch: number) => any) | undefined;
|
|
107
|
+
}>, {
|
|
108
|
+
injectStyles: boolean;
|
|
109
|
+
trigger: ElementScriptTrigger;
|
|
110
|
+
width: number | string;
|
|
111
|
+
height: number | string;
|
|
112
|
+
zoom: number;
|
|
113
|
+
ariaLabel: string;
|
|
114
|
+
interactive: boolean;
|
|
115
|
+
pitch: number;
|
|
116
|
+
bearing: number;
|
|
117
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ScriptMapLibreMapSlots>;
|
|
118
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
119
|
+
new (): {
|
|
120
|
+
$slots: S;
|
|
121
|
+
};
|
|
122
|
+
};
|