@nuxt/scripts 1.0.0-beta.3 → 1.0.0-beta.30
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/README.md +3 -3
- package/dist/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/{Ds2G8aQM.js → AwAKM0sG.js} +1 -1
- package/dist/client/_nuxt/Bl23o3st.js +162 -0
- package/dist/client/_nuxt/{DdVDSbUA.js → CYlYSSNW.js} +1 -1
- package/dist/client/_nuxt/{CD5B-xvT.js → D5FIkDae.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/f0b4dd20-8496-4003-b7a3-05cbae515923.json +1 -0
- package/dist/client/_nuxt/entry.C5SUNdim.css +1 -0
- package/dist/client/_nuxt/error-404.1K8v8Su2.css +1 -0
- package/dist/client/_nuxt/error-500.B9qvKpQm.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/module.d.mts +7 -19
- package/dist/module.d.ts +164 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +935 -645
- package/dist/registry.d.ts +6 -0
- package/dist/registry.mjs +235 -69
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +16 -9
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +57 -30
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +16 -9
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +22 -39
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +69 -72
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +22 -39
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.d.vue.ts +5 -1
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +25 -38
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue.d.ts +5 -1
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.d.vue.ts +43 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue +61 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue.d.ts +43 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.d.vue.ts +4 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +22 -26
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue.d.ts +4 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.d.vue.ts +9 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +62 -53
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue.d.ts +9 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +26 -11
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +48 -45
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +26 -11
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.d.vue.ts +10 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +38 -37
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue.d.ts +10 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +63 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +160 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +63 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.d.vue.ts +4 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +23 -32
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue.d.ts +4 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.d.vue.ts +7 -3
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +24 -38
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue.d.ts +7 -3
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.d.vue.ts +7 -3
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue +24 -38
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue.d.ts +7 -3
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.d.vue.ts +7 -3
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue +25 -38
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue.d.ts +7 -3
- package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.d.ts +13 -0
- package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.js +8 -0
- package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +13 -0
- package/dist/runtime/components/GoogleMaps/injectionKeys.js +3 -0
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +26 -0
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +42 -0
- package/dist/runtime/components/ScriptBlueskyEmbed.d.vue.ts +87 -0
- package/dist/runtime/components/ScriptBlueskyEmbed.vue +85 -0
- package/dist/runtime/components/ScriptBlueskyEmbed.vue.d.ts +87 -0
- package/dist/runtime/components/ScriptCrisp.vue +1 -1
- package/dist/runtime/components/ScriptGoogleAdsense.vue +1 -1
- package/dist/runtime/components/ScriptGravatar.d.vue.ts +22 -0
- package/dist/runtime/components/ScriptGravatar.vue +46 -0
- package/dist/runtime/components/ScriptGravatar.vue.d.ts +22 -0
- package/dist/runtime/components/ScriptInstagramEmbed.d.vue.ts +2 -2
- package/dist/runtime/components/ScriptInstagramEmbed.vue +5 -2
- package/dist/runtime/components/ScriptInstagramEmbed.vue.d.ts +2 -2
- package/dist/runtime/components/ScriptIntercom.vue +4 -3
- package/dist/runtime/components/ScriptPayPalButtons.d.vue.ts +43 -32
- package/dist/runtime/components/ScriptPayPalButtons.vue +48 -79
- package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +43 -32
- package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +37 -23
- package/dist/runtime/components/ScriptPayPalMessages.vue +46 -50
- package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +37 -23
- package/dist/runtime/components/ScriptStripePricingTable.vue +2 -2
- package/dist/runtime/components/ScriptVimeoPlayer.d.vue.ts +9 -0
- package/dist/runtime/components/ScriptVimeoPlayer.vue +13 -10
- package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +9 -0
- package/dist/runtime/components/ScriptXEmbed.d.vue.ts +2 -2
- package/dist/runtime/components/ScriptXEmbed.vue +6 -3
- package/dist/runtime/components/ScriptXEmbed.vue.d.ts +2 -2
- package/dist/runtime/components/ScriptYouTubePlayer.d.vue.ts +2 -2
- package/dist/runtime/components/ScriptYouTubePlayer.vue +11 -5
- package/dist/runtime/components/ScriptYouTubePlayer.vue.d.ts +2 -2
- package/dist/runtime/composables/useScript.js +13 -6
- package/dist/runtime/composables/useScriptEventPage.js +2 -2
- package/dist/runtime/composables/useScriptTriggerConsent.d.ts +10 -0
- package/dist/runtime/composables/useScriptTriggerConsent.js +33 -20
- package/dist/runtime/composables/useScriptTriggerElement.js +1 -1
- package/dist/runtime/composables/useScriptTriggerIdleTimeout.js +1 -1
- package/dist/runtime/registry/bing-uet.d.ts +20 -0
- package/dist/runtime/registry/bing-uet.js +29 -0
- package/dist/runtime/registry/bluesky-embed.d.ts +116 -0
- package/dist/runtime/registry/bluesky-embed.js +72 -0
- package/dist/runtime/registry/clarity.d.ts +10 -15
- package/dist/runtime/registry/clarity.js +22 -31
- package/dist/runtime/registry/cloudflare-web-analytics.d.ts +2 -13
- package/dist/runtime/registry/cloudflare-web-analytics.js +2 -14
- package/dist/runtime/registry/crisp.d.ts +10 -40
- package/dist/runtime/registry/crisp.js +2 -33
- package/dist/runtime/registry/databuddy-analytics.d.ts +2 -35
- package/dist/runtime/registry/databuddy-analytics.js +20 -45
- package/dist/runtime/registry/fathom-analytics.d.ts +7 -26
- package/dist/runtime/registry/fathom-analytics.js +2 -24
- package/dist/runtime/registry/google-adsense.d.ts +3 -11
- package/dist/runtime/registry/google-adsense.js +2 -11
- package/dist/runtime/registry/google-analytics.d.ts +3 -5
- package/dist/runtime/registry/google-analytics.js +3 -8
- package/dist/runtime/registry/google-maps.d.ts +3 -9
- package/dist/runtime/registry/google-maps.js +2 -8
- package/dist/runtime/registry/google-recaptcha.d.ts +2 -6
- package/dist/runtime/registry/google-recaptcha.js +4 -12
- package/dist/runtime/registry/google-sign-in.d.ts +2 -13
- package/dist/runtime/registry/google-sign-in.js +2 -22
- package/dist/runtime/registry/google-tag-manager.d.ts +3 -28
- package/dist/runtime/registry/google-tag-manager.js +4 -27
- package/dist/runtime/registry/gravatar.d.ts +26 -0
- package/dist/runtime/registry/gravatar.js +33 -0
- package/dist/runtime/registry/hotjar.d.ts +4 -6
- package/dist/runtime/registry/hotjar.js +2 -5
- package/dist/runtime/registry/instagram-embed.d.ts +3 -18
- package/dist/runtime/registry/instagram-embed.js +4 -19
- package/dist/runtime/registry/intercom.d.ts +4 -12
- package/dist/runtime/registry/intercom.js +2 -12
- package/dist/runtime/registry/matomo-analytics.d.ts +3 -12
- package/dist/runtime/registry/matomo-analytics.js +3 -12
- package/dist/runtime/registry/meta-pixel.d.ts +4 -6
- package/dist/runtime/registry/meta-pixel.js +2 -4
- package/dist/runtime/registry/mixpanel-analytics.d.ts +22 -0
- package/dist/runtime/registry/mixpanel-analytics.js +46 -0
- package/dist/runtime/registry/npm.d.ts +3 -7
- package/dist/runtime/registry/npm.js +2 -9
- package/dist/runtime/registry/paypal.d.ts +4 -25
- package/dist/runtime/registry/paypal.js +3 -66
- package/dist/runtime/registry/plausible-analytics.js +18 -13
- package/dist/runtime/registry/posthog.d.ts +10 -12
- package/dist/runtime/registry/posthog.js +7 -14
- package/dist/runtime/registry/reddit-pixel.d.ts +5 -6
- package/dist/runtime/registry/reddit-pixel.js +2 -4
- package/dist/runtime/registry/rybbit-analytics.d.ts +2 -14
- package/dist/runtime/registry/rybbit-analytics.js +10 -20
- package/dist/runtime/registry/schemas.d.ts +982 -0
- package/dist/runtime/registry/schemas.js +937 -0
- package/dist/runtime/registry/segment.d.ts +2 -5
- package/dist/runtime/registry/segment.js +2 -5
- package/dist/runtime/registry/snapchat-pixel.d.ts +4 -33
- package/dist/runtime/registry/snapchat-pixel.js +2 -20
- package/dist/runtime/registry/stripe.d.ts +3 -4
- package/dist/runtime/registry/stripe.js +2 -4
- package/dist/runtime/registry/tiktok-pixel.d.ts +4 -7
- package/dist/runtime/registry/tiktok-pixel.js +2 -6
- package/dist/runtime/registry/umami-analytics.d.ts +2 -31
- package/dist/runtime/registry/umami-analytics.js +2 -36
- package/dist/runtime/registry/vercel-analytics.d.ts +29 -0
- package/dist/runtime/registry/vercel-analytics.js +84 -0
- package/dist/runtime/registry/vimeo-player.d.ts +2 -2
- package/dist/runtime/registry/vimeo-player.js +1 -1
- package/dist/runtime/registry/x-embed.d.ts +3 -17
- package/dist/runtime/registry/x-embed.js +3 -18
- package/dist/runtime/registry/x-pixel.d.ts +4 -7
- package/dist/runtime/registry/x-pixel.js +2 -5
- package/dist/runtime/registry/youtube-player.d.ts +7 -7
- package/dist/runtime/registry/youtube-player.js +1 -1
- package/dist/runtime/server/{sw-handler.d.ts → bluesky-embed-image.d.ts} +1 -1
- package/dist/runtime/server/bluesky-embed-image.js +7 -0
- package/dist/runtime/server/bluesky-embed.d.ts +16 -0
- package/dist/runtime/server/bluesky-embed.js +59 -0
- package/dist/runtime/server/google-maps-geocode-proxy.d.ts +2 -0
- package/dist/runtime/server/google-maps-geocode-proxy.js +34 -0
- package/dist/runtime/server/google-static-maps-proxy.js +2 -13
- package/dist/runtime/server/gravatar-proxy.d.ts +2 -0
- package/dist/runtime/server/gravatar-proxy.js +46 -0
- package/dist/runtime/server/instagram-embed-asset.js +8 -41
- package/dist/runtime/server/instagram-embed-image.js +6 -53
- package/dist/runtime/server/instagram-embed.d.ts +16 -0
- package/dist/runtime/server/instagram-embed.js +173 -35
- package/dist/runtime/server/proxy-handler.js +134 -93
- package/dist/runtime/server/utils/image-proxy.d.ts +12 -0
- package/dist/runtime/server/utils/image-proxy.js +70 -0
- package/dist/runtime/server/utils/privacy.d.ts +1 -2
- package/dist/runtime/server/utils/privacy.js +54 -34
- package/dist/runtime/server/x-embed-image.js +5 -49
- package/dist/runtime/server/x-embed.js +3 -2
- package/dist/runtime/types.d.ts +74 -40
- package/dist/runtime/utils/pure.d.ts +1 -5
- package/dist/runtime/utils/pure.js +0 -67
- package/dist/runtime/utils.d.ts +4 -3
- package/dist/runtime/utils.js +24 -10
- package/dist/shared/scripts.ViOoYQXH.mjs +381 -0
- package/dist/stats.d.mts +202 -0
- package/dist/stats.d.ts +202 -0
- package/dist/stats.mjs +3868 -0
- package/dist/types-source.d.mts +17 -0
- package/dist/types-source.d.ts +17 -0
- package/dist/types-source.mjs +3600 -0
- package/package.json +52 -38
- package/dist/client/_nuxt/D-kOnTuH.js +0 -162
- package/dist/client/_nuxt/builds/meta/f1474569-6922-450d-bc3f-4fd5f3e1391a.json +0 -1
- package/dist/client/_nuxt/entry.D45OuV0w.css +0 -1
- package/dist/client/_nuxt/error-404.B57D-jUQ.css +0 -1
- package/dist/client/_nuxt/error-500.DTHUW7BI.css +0 -1
- package/dist/runtime/components/ScriptPayPalMarks.d.vue.ts +0 -52
- package/dist/runtime/components/ScriptPayPalMarks.vue +0 -69
- package/dist/runtime/components/ScriptPayPalMarks.vue.d.ts +0 -52
- package/dist/runtime/plugins/sw-register.client.d.ts +0 -2
- package/dist/runtime/plugins/sw-register.client.js +0 -12
- package/dist/runtime/server/sw-handler.js +0 -25
- package/dist/runtime/sw/proxy-sw.template.d.ts +0 -1
- package/dist/runtime/sw/proxy-sw.template.js +0 -54
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<slot v-if="marker" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
1
|
<script>
|
|
6
|
-
import { inject,
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { inject, provide, watch } from "vue";
|
|
3
|
+
import { bindGoogleMapsEvents } from "./bindGoogleMapsEvents";
|
|
4
|
+
import { MARKER_INJECTION_KEY } from "./injectionKeys";
|
|
9
5
|
import { MARKER_CLUSTERER_INJECTION_KEY } from "./ScriptGoogleMapsMarkerClusterer.vue";
|
|
10
|
-
|
|
6
|
+
import { useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
7
|
+
export { MARKER_INJECTION_KEY } from "./injectionKeys";
|
|
11
8
|
</script>
|
|
12
9
|
|
|
13
10
|
<script setup>
|
|
14
11
|
const props = defineProps({
|
|
12
|
+
position: { type: null, required: false },
|
|
15
13
|
options: { type: Object, required: false }
|
|
16
14
|
});
|
|
15
|
+
const emit = defineEmits(["animation_changed", "clickable_changed", "cursor_changed", "draggable_changed", "flat_changed", "icon_changed", "position_changed", "shape_changed", "title_changed", "visible_changed", "zindex_changed", "click", "contextmenu", "dblclick", "drag", "dragend", "dragstart", "mousedown", "mouseout", "mouseover", "mouseup"]);
|
|
16
|
+
if (import.meta.dev) {
|
|
17
|
+
console.warn("[nuxt-scripts] ScriptGoogleMapsMarker uses the deprecated google.maps.Marker class. Use ScriptGoogleMapsAdvancedMarkerElement instead.");
|
|
18
|
+
}
|
|
17
19
|
const eventsWithoutPayload = [
|
|
18
20
|
"animation_changed",
|
|
19
21
|
"clickable_changed",
|
|
@@ -39,47 +41,48 @@ const eventsWithMapMouseEventPayload = [
|
|
|
39
41
|
"mouseover",
|
|
40
42
|
"mouseup"
|
|
41
43
|
];
|
|
42
|
-
const emit = defineEmits([]);
|
|
43
|
-
const mapContext = inject(MAP_INJECTION_KEY, void 0);
|
|
44
44
|
const markerClustererContext = inject(MARKER_CLUSTERER_INJECTION_KEY, void 0);
|
|
45
|
-
const marker =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
const marker = useGoogleMapsResource({
|
|
46
|
+
create({ mapsApi, map }) {
|
|
47
|
+
const m = new mapsApi.Marker({
|
|
48
|
+
...props.options,
|
|
49
|
+
...props.position ? { position: props.position } : {}
|
|
50
|
+
});
|
|
51
|
+
bindGoogleMapsEvents(m, emit, {
|
|
52
|
+
noPayload: eventsWithoutPayload,
|
|
53
|
+
withPayload: eventsWithMapMouseEventPayload
|
|
54
|
+
});
|
|
55
|
+
if (markerClustererContext?.markerClusterer.value) {
|
|
56
|
+
markerClustererContext.markerClusterer.value.addMarker(m, true);
|
|
57
|
+
markerClustererContext.requestRerender();
|
|
58
|
+
} else {
|
|
59
|
+
m.setMap(map);
|
|
60
|
+
}
|
|
61
|
+
return m;
|
|
62
|
+
},
|
|
63
|
+
cleanup(m, { mapsApi }) {
|
|
64
|
+
mapsApi.event.clearInstanceListeners(m);
|
|
65
|
+
if (markerClustererContext?.markerClusterer.value) {
|
|
66
|
+
markerClustererContext.markerClusterer.value.removeMarker(m, true);
|
|
67
|
+
markerClustererContext.requestRerender();
|
|
68
|
+
} else {
|
|
69
|
+
m.setMap(null);
|
|
70
|
+
}
|
|
54
71
|
}
|
|
55
|
-
whenever(() => props.options, (options) => {
|
|
56
|
-
marker.value?.setOptions(options);
|
|
57
|
-
}, {
|
|
58
|
-
deep: true
|
|
59
|
-
});
|
|
60
|
-
}, {
|
|
61
|
-
immediate: true,
|
|
62
|
-
once: true
|
|
63
72
|
});
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
mapContext.mapsApi.value.event.clearInstanceListeners(marker.value);
|
|
69
|
-
if (markerClustererContext?.markerClusterer.value) {
|
|
70
|
-
markerClustererContext.markerClusterer.value.removeMarker(marker.value, true);
|
|
71
|
-
markerClustererContext.requestRerender();
|
|
72
|
-
} else {
|
|
73
|
-
marker.value.setMap(null);
|
|
73
|
+
watch(() => props.position, (position) => {
|
|
74
|
+
if (marker.value && position) {
|
|
75
|
+
marker.value.setPosition(position);
|
|
74
76
|
}
|
|
75
77
|
});
|
|
78
|
+
watch(() => props.options, (options) => {
|
|
79
|
+
if (marker.value && options) {
|
|
80
|
+
marker.value.setOptions(options);
|
|
81
|
+
}
|
|
82
|
+
}, { deep: true });
|
|
76
83
|
provide(MARKER_INJECTION_KEY, { marker });
|
|
77
|
-
function setupMarkerEventListeners(marker2) {
|
|
78
|
-
eventsWithoutPayload.forEach((event) => {
|
|
79
|
-
marker2.addListener(event, () => emit(event));
|
|
80
|
-
});
|
|
81
|
-
eventsWithMapMouseEventPayload.forEach((event) => {
|
|
82
|
-
marker2.addListener(event, (payload) => emit(event, payload));
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
84
|
</script>
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<slot v-if="marker" />
|
|
88
|
+
</template>
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const MARKER_INJECTION_KEY: InjectionKey<{
|
|
3
|
-
marker: ShallowRef<google.maps.Marker | undefined>;
|
|
4
|
-
}>;
|
|
1
|
+
export { MARKER_INJECTION_KEY } from './injectionKeys.js';
|
|
5
2
|
declare const _default: typeof __VLS_export;
|
|
6
3
|
export default _default;
|
|
7
4
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
5
|
+
/**
|
|
6
|
+
* The position of the marker on the map.
|
|
7
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.position
|
|
8
|
+
*/
|
|
9
|
+
position?: google.maps.LatLngLiteral | google.maps.LatLng;
|
|
10
|
+
/**
|
|
11
|
+
* Configuration options for the legacy marker. Deprecated: use ScriptGoogleMapsAdvancedMarkerElement instead.
|
|
12
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions
|
|
13
|
+
*/
|
|
8
14
|
options?: Omit<google.maps.MarkerOptions, "map">;
|
|
9
|
-
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
-
click: (payload: google.maps.MapMouseEvent) => any;
|
|
15
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
16
|
contextmenu: (payload: google.maps.MapMouseEvent) => any;
|
|
17
|
+
click: (payload: google.maps.MapMouseEvent) => any;
|
|
12
18
|
dblclick: (payload: google.maps.MapMouseEvent) => any;
|
|
13
19
|
drag: (payload: google.maps.MapMouseEvent) => any;
|
|
14
20
|
dragend: (payload: google.maps.MapMouseEvent) => any;
|
|
@@ -17,22 +23,31 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
17
23
|
mouseout: (payload: google.maps.MapMouseEvent) => any;
|
|
18
24
|
mouseover: (payload: google.maps.MapMouseEvent) => any;
|
|
19
25
|
mouseup: (payload: google.maps.MapMouseEvent) => any;
|
|
26
|
+
position_changed: () => any;
|
|
27
|
+
zindex_changed: () => any;
|
|
20
28
|
animation_changed: () => any;
|
|
21
29
|
clickable_changed: () => any;
|
|
22
30
|
cursor_changed: () => any;
|
|
23
31
|
draggable_changed: () => any;
|
|
24
32
|
flat_changed: () => any;
|
|
25
33
|
icon_changed: () => any;
|
|
26
|
-
position_changed: () => any;
|
|
27
34
|
shape_changed: () => any;
|
|
28
35
|
title_changed: () => any;
|
|
29
36
|
visible_changed: () => any;
|
|
30
|
-
zindex_changed: () => any;
|
|
31
37
|
}, string, import("vue").PublicProps, Readonly<{
|
|
38
|
+
/**
|
|
39
|
+
* The position of the marker on the map.
|
|
40
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.position
|
|
41
|
+
*/
|
|
42
|
+
position?: google.maps.LatLngLiteral | google.maps.LatLng;
|
|
43
|
+
/**
|
|
44
|
+
* Configuration options for the legacy marker. Deprecated: use ScriptGoogleMapsAdvancedMarkerElement instead.
|
|
45
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions
|
|
46
|
+
*/
|
|
32
47
|
options?: Omit<google.maps.MarkerOptions, "map">;
|
|
33
48
|
}> & Readonly<{
|
|
34
|
-
onClick?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
35
49
|
onContextmenu?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
50
|
+
onClick?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
36
51
|
onDblclick?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
37
52
|
onDrag?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
38
53
|
onDragend?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
@@ -41,17 +56,17 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
41
56
|
onMouseout?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
42
57
|
onMouseover?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
43
58
|
onMouseup?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
59
|
+
onPosition_changed?: (() => any) | undefined;
|
|
60
|
+
onZindex_changed?: (() => any) | undefined;
|
|
44
61
|
onAnimation_changed?: (() => any) | undefined;
|
|
45
62
|
onClickable_changed?: (() => any) | undefined;
|
|
46
63
|
onCursor_changed?: (() => any) | undefined;
|
|
47
64
|
onDraggable_changed?: (() => any) | undefined;
|
|
48
65
|
onFlat_changed?: (() => any) | undefined;
|
|
49
66
|
onIcon_changed?: (() => any) | undefined;
|
|
50
|
-
onPosition_changed?: (() => any) | undefined;
|
|
51
67
|
onShape_changed?: (() => any) | undefined;
|
|
52
68
|
onTitle_changed?: (() => any) | undefined;
|
|
53
69
|
onVisible_changed?: (() => any) | undefined;
|
|
54
|
-
onZindex_changed?: (() => any) | undefined;
|
|
55
70
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
56
71
|
default?: (props: {}) => any;
|
|
57
72
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { InjectionKey, ShallowRef } from 'vue';
|
|
2
2
|
export interface MarkerClustererInstance {
|
|
3
3
|
render: () => void;
|
|
4
4
|
setMap: (map: google.maps.Map | null) => void;
|
|
@@ -19,12 +19,20 @@ export declare const MARKER_CLUSTERER_INJECTION_KEY: InjectionKey<{
|
|
|
19
19
|
declare const _default: typeof __VLS_export;
|
|
20
20
|
export default _default;
|
|
21
21
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
22
|
+
/**
|
|
23
|
+
* Configuration options for the marker clusterer.
|
|
24
|
+
* @see https://googlemaps.github.io/js-markerclusterer/interfaces/MarkerClustererOptions.html
|
|
25
|
+
*/
|
|
22
26
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
23
|
-
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
28
|
click: (payload: MarkerClustererInstance) => any;
|
|
25
29
|
clusteringbegin: (payload: MarkerClustererInstance) => any;
|
|
26
30
|
clusteringend: (payload: MarkerClustererInstance) => any;
|
|
27
31
|
}, string, import("vue").PublicProps, Readonly<{
|
|
32
|
+
/**
|
|
33
|
+
* Configuration options for the marker clusterer.
|
|
34
|
+
* @see https://googlemaps.github.io/js-markerclusterer/interfaces/MarkerClustererOptions.html
|
|
35
|
+
*/
|
|
28
36
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
29
37
|
}> & Readonly<{
|
|
30
38
|
onClick?: ((payload: MarkerClustererInstance) => any) | undefined;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<slot v-if="markerClusterer" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
1
|
<script>
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { provide, shallowRef, watch } from "vue";
|
|
3
|
+
import { bindGoogleMapsEvents } from "./bindGoogleMapsEvents";
|
|
4
|
+
import { useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
9
5
|
export const MARKER_CLUSTERER_INJECTION_KEY = /* @__PURE__ */ Symbol("marker-clusterer");
|
|
10
6
|
</script>
|
|
11
7
|
|
|
@@ -13,40 +9,46 @@ export const MARKER_CLUSTERER_INJECTION_KEY = /* @__PURE__ */ Symbol("marker-clu
|
|
|
13
9
|
const props = defineProps({
|
|
14
10
|
options: { type: Object, required: false }
|
|
15
11
|
});
|
|
12
|
+
const emit = defineEmits(["click", "clusteringbegin", "clusteringend"]);
|
|
16
13
|
const markerClustererEvents = [
|
|
17
14
|
"click",
|
|
18
15
|
"clusteringbegin",
|
|
19
16
|
"clusteringend"
|
|
20
17
|
];
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
const markerClusterer = useGoogleMapsResource({
|
|
19
|
+
async create({ map }) {
|
|
20
|
+
const { MarkerClusterer } = await import("@googlemaps/markerclusterer");
|
|
21
|
+
const clusterer = new MarkerClusterer({
|
|
22
|
+
map,
|
|
23
|
+
...props.options
|
|
24
|
+
});
|
|
25
|
+
bindGoogleMapsEvents(clusterer, emit, { withPayload: markerClustererEvents });
|
|
26
|
+
return clusterer;
|
|
27
|
+
},
|
|
28
|
+
cleanup(clusterer, { mapsApi }) {
|
|
29
|
+
mapsApi.event.clearInstanceListeners(clusterer);
|
|
30
|
+
clusterer.setMap(null);
|
|
31
|
+
}
|
|
34
32
|
});
|
|
35
|
-
const
|
|
33
|
+
const rerenderPending = shallowRef(false);
|
|
36
34
|
function requestRerender() {
|
|
37
|
-
|
|
35
|
+
rerenderPending.value = true;
|
|
38
36
|
}
|
|
39
|
-
|
|
40
|
-
markerClusterer.value
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
watch(
|
|
38
|
+
() => rerenderPending.value && markerClusterer.value,
|
|
39
|
+
(ready) => {
|
|
40
|
+
if (!ready)
|
|
41
|
+
return;
|
|
42
|
+
rerenderPending.value = false;
|
|
43
|
+
try {
|
|
44
|
+
markerClusterer.value.render();
|
|
45
|
+
} catch (err) {
|
|
46
|
+
if (import.meta.dev) {
|
|
47
|
+
console.error("[nuxt-scripts] MarkerClusterer render failed:", err);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
46
50
|
}
|
|
47
|
-
|
|
48
|
-
markerClusterer.value.setMap(null);
|
|
49
|
-
});
|
|
51
|
+
);
|
|
50
52
|
provide(
|
|
51
53
|
MARKER_CLUSTERER_INJECTION_KEY,
|
|
52
54
|
{
|
|
@@ -54,9 +56,8 @@ provide(
|
|
|
54
56
|
requestRerender
|
|
55
57
|
}
|
|
56
58
|
);
|
|
57
|
-
function setupMarkerClustererEventListeners(clusterer) {
|
|
58
|
-
markerClustererEvents.forEach((event) => {
|
|
59
|
-
clusterer.addListener(event, () => emit(event, clusterer));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
59
|
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<slot v-if="markerClusterer" />
|
|
63
|
+
</template>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { InjectionKey, ShallowRef } from 'vue';
|
|
2
2
|
export interface MarkerClustererInstance {
|
|
3
3
|
render: () => void;
|
|
4
4
|
setMap: (map: google.maps.Map | null) => void;
|
|
@@ -19,12 +19,20 @@ export declare const MARKER_CLUSTERER_INJECTION_KEY: InjectionKey<{
|
|
|
19
19
|
declare const _default: typeof __VLS_export;
|
|
20
20
|
export default _default;
|
|
21
21
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
22
|
+
/**
|
|
23
|
+
* Configuration options for the marker clusterer.
|
|
24
|
+
* @see https://googlemaps.github.io/js-markerclusterer/interfaces/MarkerClustererOptions.html
|
|
25
|
+
*/
|
|
22
26
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
23
|
-
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
28
|
click: (payload: MarkerClustererInstance) => any;
|
|
25
29
|
clusteringbegin: (payload: MarkerClustererInstance) => any;
|
|
26
30
|
clusteringend: (payload: MarkerClustererInstance) => any;
|
|
27
31
|
}, string, import("vue").PublicProps, Readonly<{
|
|
32
|
+
/**
|
|
33
|
+
* Configuration options for the marker clusterer.
|
|
34
|
+
* @see https://googlemaps.github.io/js-markerclusterer/interfaces/MarkerClustererOptions.html
|
|
35
|
+
*/
|
|
28
36
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
29
37
|
}> & Readonly<{
|
|
30
38
|
onClick?: ((payload: MarkerClustererInstance) => any) | undefined;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
type OverlayAnchor = 'center' | 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'left-center' | 'right-center';
|
|
2
|
+
type OverlayPane = 'mapPane' | 'overlayLayer' | 'markerLayer' | 'overlayMouseTarget' | 'floatPane';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/**
|
|
5
|
+
* Geographic position for the overlay. Falls back to parent marker position if omitted.
|
|
6
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/overlay-view#OverlayView
|
|
7
|
+
*/
|
|
8
|
+
position?: google.maps.LatLngLiteral;
|
|
9
|
+
/**
|
|
10
|
+
* Anchor point of the overlay relative to its position.
|
|
11
|
+
* @default 'bottom-center'
|
|
12
|
+
*/
|
|
13
|
+
anchor?: OverlayAnchor;
|
|
14
|
+
/**
|
|
15
|
+
* Pixel offset from the anchor position.
|
|
16
|
+
*/
|
|
17
|
+
offset?: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The map pane on which to render the overlay.
|
|
23
|
+
* @default 'floatPane'
|
|
24
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes
|
|
25
|
+
*/
|
|
26
|
+
pane?: OverlayPane;
|
|
27
|
+
/**
|
|
28
|
+
* CSS z-index for the overlay element.
|
|
29
|
+
*/
|
|
30
|
+
zIndex?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to block map click and gesture events from passing through the overlay.
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
blockMapInteraction?: boolean;
|
|
36
|
+
};
|
|
37
|
+
type __VLS_ModelProps = {
|
|
38
|
+
'open'?: boolean;
|
|
39
|
+
};
|
|
40
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
41
|
+
declare var __VLS_1: {};
|
|
42
|
+
type __VLS_Slots = {} & {
|
|
43
|
+
default?: (props: typeof __VLS_1) => any;
|
|
44
|
+
};
|
|
45
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
46
|
+
overlay: import("vue").ShallowRef<google.maps.OverlayView | undefined>;
|
|
47
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
48
|
+
"update:open": (value: boolean) => any;
|
|
49
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
50
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
51
|
+
}>, {
|
|
52
|
+
anchor: OverlayAnchor;
|
|
53
|
+
pane: OverlayPane;
|
|
54
|
+
blockMapInteraction: boolean;
|
|
55
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
56
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
57
|
+
declare const _default: typeof __VLS_export;
|
|
58
|
+
export default _default;
|
|
59
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
60
|
+
new (): {
|
|
61
|
+
$slots: S;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject, useTemplateRef, watch } from "vue";
|
|
3
|
+
import { ADVANCED_MARKER_ELEMENT_INJECTION_KEY, MARKER_INJECTION_KEY } from "./injectionKeys";
|
|
4
|
+
import { useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
position: { type: null, required: false },
|
|
7
|
+
anchor: { type: String, required: false, default: "bottom-center" },
|
|
8
|
+
offset: { type: Object, required: false },
|
|
9
|
+
pane: { type: String, required: false, default: "floatPane" },
|
|
10
|
+
zIndex: { type: Number, required: false },
|
|
11
|
+
blockMapInteraction: { type: Boolean, required: false, default: true }
|
|
12
|
+
});
|
|
13
|
+
const open = defineModel("open", { type: Boolean, ...{ default: void 0 } });
|
|
14
|
+
const markerContext = inject(MARKER_INJECTION_KEY, void 0);
|
|
15
|
+
const advancedMarkerElementContext = inject(ADVANCED_MARKER_ELEMENT_INJECTION_KEY, void 0);
|
|
16
|
+
function getResolvedPosition() {
|
|
17
|
+
if (props.position)
|
|
18
|
+
return props.position;
|
|
19
|
+
if (markerContext?.marker.value) {
|
|
20
|
+
const pos = markerContext.marker.value.getPosition();
|
|
21
|
+
if (pos)
|
|
22
|
+
return { lat: pos.lat(), lng: pos.lng() };
|
|
23
|
+
}
|
|
24
|
+
if (advancedMarkerElementContext?.advancedMarkerElement.value) {
|
|
25
|
+
const pos = advancedMarkerElementContext.advancedMarkerElement.value.position;
|
|
26
|
+
if (pos) {
|
|
27
|
+
if ("lat" in pos && typeof pos.lat === "function")
|
|
28
|
+
return { lat: pos.lat(), lng: pos.lng() };
|
|
29
|
+
return pos;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
const ANCHOR_TRANSFORMS = {
|
|
35
|
+
"center": "translate(-50%, -50%)",
|
|
36
|
+
"top-left": "translate(0, 0)",
|
|
37
|
+
"top-center": "translate(-50%, 0)",
|
|
38
|
+
"top-right": "translate(-100%, 0)",
|
|
39
|
+
"bottom-left": "translate(0, -100%)",
|
|
40
|
+
"bottom-center": "translate(-50%, -100%)",
|
|
41
|
+
"bottom-right": "translate(-100%, -100%)",
|
|
42
|
+
"left-center": "translate(0, -50%)",
|
|
43
|
+
"right-center": "translate(-100%, -50%)"
|
|
44
|
+
};
|
|
45
|
+
const overlayContent = useTemplateRef("overlay-content");
|
|
46
|
+
const listeners = [];
|
|
47
|
+
const overlay = useGoogleMapsResource({
|
|
48
|
+
// ready condition accesses .value on ShallowRefs — tracked by whenever() in useGoogleMapsResource
|
|
49
|
+
ready: () => !!overlayContent.value && !!(props.position || markerContext?.marker.value || advancedMarkerElementContext?.advancedMarkerElement.value),
|
|
50
|
+
create({ mapsApi, map }) {
|
|
51
|
+
const el = overlayContent.value;
|
|
52
|
+
class CustomOverlay extends mapsApi.OverlayView {
|
|
53
|
+
onAdd() {
|
|
54
|
+
const panes = this.getPanes();
|
|
55
|
+
if (panes) {
|
|
56
|
+
panes[props.pane].appendChild(el);
|
|
57
|
+
if (props.blockMapInteraction)
|
|
58
|
+
mapsApi.OverlayView.preventMapHitsAndGesturesFrom(el);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
draw() {
|
|
62
|
+
if (open.value === false) {
|
|
63
|
+
el.style.visibility = "hidden";
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const position = getResolvedPosition();
|
|
67
|
+
if (!position) {
|
|
68
|
+
el.style.visibility = "hidden";
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const projection = this.getProjection();
|
|
72
|
+
if (!projection) {
|
|
73
|
+
el.style.visibility = "hidden";
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const pos = projection.fromLatLngToDivPixel(
|
|
77
|
+
new mapsApi.LatLng(position.lat, position.lng)
|
|
78
|
+
);
|
|
79
|
+
if (!pos) {
|
|
80
|
+
el.style.visibility = "hidden";
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
el.style.position = "absolute";
|
|
84
|
+
el.style.left = `${pos.x + (props.offset?.x ?? 0)}px`;
|
|
85
|
+
el.style.top = `${pos.y + (props.offset?.y ?? 0)}px`;
|
|
86
|
+
el.style.transform = ANCHOR_TRANSFORMS[props.anchor];
|
|
87
|
+
if (props.zIndex !== void 0)
|
|
88
|
+
el.style.zIndex = String(props.zIndex);
|
|
89
|
+
el.style.visibility = "visible";
|
|
90
|
+
}
|
|
91
|
+
onRemove() {
|
|
92
|
+
el.parentNode?.removeChild(el);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
el.style.visibility = "hidden";
|
|
96
|
+
const ov = new CustomOverlay();
|
|
97
|
+
ov.setMap(map);
|
|
98
|
+
if (markerContext?.marker.value) {
|
|
99
|
+
listeners.push(
|
|
100
|
+
markerContext.marker.value.addListener("position_changed", () => ov.draw())
|
|
101
|
+
);
|
|
102
|
+
} else if (advancedMarkerElementContext?.advancedMarkerElement.value) {
|
|
103
|
+
const ame = advancedMarkerElementContext.advancedMarkerElement.value;
|
|
104
|
+
listeners.push(
|
|
105
|
+
ame.addListener("drag", () => ov.draw()),
|
|
106
|
+
ame.addListener("dragend", () => ov.draw())
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return ov;
|
|
110
|
+
},
|
|
111
|
+
cleanup(ov) {
|
|
112
|
+
listeners.forEach((l) => l.remove());
|
|
113
|
+
listeners.length = 0;
|
|
114
|
+
ov.setMap(null);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
if (advancedMarkerElementContext) {
|
|
118
|
+
watch(
|
|
119
|
+
() => {
|
|
120
|
+
const pos = advancedMarkerElementContext.advancedMarkerElement.value?.position;
|
|
121
|
+
if (!pos)
|
|
122
|
+
return void 0;
|
|
123
|
+
if ("lat" in pos && typeof pos.lat === "function")
|
|
124
|
+
return { lat: pos.lat(), lng: pos.lng() };
|
|
125
|
+
return pos;
|
|
126
|
+
},
|
|
127
|
+
() => {
|
|
128
|
+
overlay.value?.draw();
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
watch(
|
|
133
|
+
() => [props.position?.lat, props.position?.lng, props.offset?.x, props.offset?.y, props.zIndex, props.anchor],
|
|
134
|
+
() => {
|
|
135
|
+
overlay.value?.draw();
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
watch(() => open.value, () => {
|
|
139
|
+
if (!overlay.value)
|
|
140
|
+
return;
|
|
141
|
+
overlay.value.draw();
|
|
142
|
+
});
|
|
143
|
+
watch([() => props.pane, () => props.blockMapInteraction], () => {
|
|
144
|
+
if (overlay.value) {
|
|
145
|
+
const map = overlay.value.getMap();
|
|
146
|
+
overlay.value.setMap(null);
|
|
147
|
+
if (map)
|
|
148
|
+
overlay.value.setMap(map);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
defineExpose({ overlay });
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<template>
|
|
155
|
+
<div style="display: none;">
|
|
156
|
+
<div ref="overlay-content">
|
|
157
|
+
<slot />
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</template>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
type OverlayAnchor = 'center' | 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'left-center' | 'right-center';
|
|
2
|
+
type OverlayPane = 'mapPane' | 'overlayLayer' | 'markerLayer' | 'overlayMouseTarget' | 'floatPane';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/**
|
|
5
|
+
* Geographic position for the overlay. Falls back to parent marker position if omitted.
|
|
6
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/overlay-view#OverlayView
|
|
7
|
+
*/
|
|
8
|
+
position?: google.maps.LatLngLiteral;
|
|
9
|
+
/**
|
|
10
|
+
* Anchor point of the overlay relative to its position.
|
|
11
|
+
* @default 'bottom-center'
|
|
12
|
+
*/
|
|
13
|
+
anchor?: OverlayAnchor;
|
|
14
|
+
/**
|
|
15
|
+
* Pixel offset from the anchor position.
|
|
16
|
+
*/
|
|
17
|
+
offset?: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The map pane on which to render the overlay.
|
|
23
|
+
* @default 'floatPane'
|
|
24
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/overlay-view#MapPanes
|
|
25
|
+
*/
|
|
26
|
+
pane?: OverlayPane;
|
|
27
|
+
/**
|
|
28
|
+
* CSS z-index for the overlay element.
|
|
29
|
+
*/
|
|
30
|
+
zIndex?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to block map click and gesture events from passing through the overlay.
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
blockMapInteraction?: boolean;
|
|
36
|
+
};
|
|
37
|
+
type __VLS_ModelProps = {
|
|
38
|
+
'open'?: boolean;
|
|
39
|
+
};
|
|
40
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
41
|
+
declare var __VLS_1: {};
|
|
42
|
+
type __VLS_Slots = {} & {
|
|
43
|
+
default?: (props: typeof __VLS_1) => any;
|
|
44
|
+
};
|
|
45
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
46
|
+
overlay: import("vue").ShallowRef<google.maps.OverlayView | undefined>;
|
|
47
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
48
|
+
"update:open": (value: boolean) => any;
|
|
49
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
50
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
51
|
+
}>, {
|
|
52
|
+
anchor: OverlayAnchor;
|
|
53
|
+
pane: OverlayPane;
|
|
54
|
+
blockMapInteraction: boolean;
|
|
55
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
56
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
57
|
+
declare const _default: typeof __VLS_export;
|
|
58
|
+
export default _default;
|
|
59
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
60
|
+
new (): {
|
|
61
|
+
$slots: S;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for the pin element that customizes the visual appearance of the marker.
|
|
4
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/advanced-markers#PinElementOptions
|
|
5
|
+
*/
|
|
2
6
|
options?: Omit<google.maps.marker.PinElementOptions, 'map'>;
|
|
3
7
|
};
|
|
4
8
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|