@nuxt/scripts 1.0.0-beta.6 → 1.0.0-rc.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/dist/devtools-client/200.html +1 -0
- package/dist/devtools-client/404.html +1 -0
- package/dist/devtools-client/_fonts/4ppnHhMi-pBsWSPo7mY0avYxlDoAg1N3PTzCwXLZ5rA-d9oibkGnTd1JL3tc_xnaVgBLYmOB8kjrK2cvZaqwj9s.woff2 +0 -0
- package/dist/devtools-client/_fonts/4qBuU9MRVUlPZNPSF7Xom_sK8RBEnfYu-9VXFrdq8A8-8TDwLE1HAj1sQn7XxVWtM_7sIaPM-DTdO3Pf8U2DF1U.woff2 +0 -0
- package/dist/devtools-client/_fonts/6dYsbWUd_BpKJ7mdDihgOcya1gHXLpJBuMYXux3WMjE-q3fYNS8YbW5n7ZeXI2vSNgkRWW5VDPKAl51SNTjG2qk.woff2 +0 -0
- package/dist/devtools-client/_fonts/Lr-hqqZZsYmCt0ITUlr1CUrWim9fsKvoDFZliMxgNHY-iTa_Yt_PzhOY9TX7ZXdSlEPim6iRt92xhECwaxWxd5w.woff2 +0 -0
- package/dist/devtools-client/_fonts/OknHvWI6KtYn1JQBzX7eSpNDBQ8520F9TvSUJYkVf6A-xeZn9253svK_8Q2LD0XEruY_MnEsuCRO5LenPoggC0Y.woff2 +0 -0
- package/dist/devtools-client/_fonts/PV2hrQG6wq5BlIPDjdL1IcOflycaghyt5MHzlBqZtlo-lb_WexLz3VZqfTN0oi554iBH5tT2j2UFEV-XErCAS3E.woff2 +0 -0
- package/dist/devtools-client/_fonts/UA7OtwYHwGN_HjcVGTdmiQxUit7FlqkCwxVUWSeXVnQ-B4OXCFOL_tWrYODpQTc07aMaj0c2cewTOmBRWR9tD-A.woff2 +0 -0
- package/dist/devtools-client/_fonts/VE4cDVCv5MxbFM7ZLoLCGbIpNd71zhp7MDI9lmN5Y7I-xZyDYCUVrd6LV8eVGF3Um3UZjBFuUtDGtvdyTBBRYBo.woff2 +0 -0
- package/dist/devtools-client/_fonts/fVoGbnMbBFd5L9BBp9fUPavUSkZ_EmsQNSyadkT-108-U4T0khaeLQSIhtt9eVvaCEKJjtWJ4ioRJOf8hvqkWY0.woff2 +0 -0
- package/dist/devtools-client/_fonts/lQAxeCEs1R0Lw-H9XRU1RlOARQN8J6npRsPjyEDMe5s-_DUSLEkO3tKTuun_gSnDLoQPVEnpOnyqZMOw0ByZ6PA.woff2 +0 -0
- package/dist/devtools-client/_fonts/lntlqNHKLV2n82yTwMde70QqOjcfLE2XJ5oKZ3vRPWc-z6TxpIZQdWXztWLr9_OFWqt_WJJoeGtuK_-XQMZGQwE.woff2 +0 -0
- package/dist/devtools-client/_fonts/qxAYvKsXWeYv731eb-h5TRurcdIP_W44mpNdX-HABAk-zUDeMEFlNtNbrwvT9JxLEBg0TphGy70O6RfIoIX_ZwU.woff2 +0 -0
- package/dist/devtools-client/_nuxt/B3kN3DAy.js +1 -0
- package/dist/devtools-client/_nuxt/B8PEiB0p.js +1 -0
- package/dist/devtools-client/_nuxt/C8jhSQ8l.js +1 -0
- package/dist/devtools-client/_nuxt/CJD6wrkT.js +188 -0
- package/dist/devtools-client/_nuxt/CfOsp0mU.js +1 -0
- package/dist/devtools-client/_nuxt/DKL6PHO3.js +1 -0
- package/dist/devtools-client/_nuxt/ajngqPCs.js +1 -0
- package/dist/devtools-client/_nuxt/builds/latest.json +1 -0
- package/dist/devtools-client/_nuxt/builds/meta/b800a0be-5cab-4ea6-89e3-dd3a85690a73.json +1 -0
- package/dist/devtools-client/_nuxt/dlaR8P-P.js +1 -0
- package/dist/devtools-client/_nuxt/entry.BwpOBArY.css +1 -0
- package/dist/devtools-client/_nuxt/error-404.CvOVjXeC.css +1 -0
- package/dist/devtools-client/_nuxt/error-500.BIm53nmx.css +1 -0
- package/dist/devtools-client/_nuxt/first-party.C8Ha4JLM.css +1 -0
- package/dist/devtools-client/_nuxt/index.CA-OpSj0.css +1 -0
- package/dist/devtools-client/_nuxt/registry.B9lnjF_b.css +1 -0
- package/dist/devtools-client/_nuxt/wDzz0qaB.js +1 -0
- package/dist/devtools-client/docs/index.html +1 -0
- package/dist/devtools-client/first-party/index.html +1 -0
- package/dist/devtools-client/index.html +1 -0
- package/dist/devtools-client/registry/index.html +1 -0
- package/dist/module.d.mts +29 -84
- package/dist/module.d.ts +121 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +941 -757
- package/dist/registry.d.mts +91 -4
- package/dist/registry.d.ts +93 -0
- package/dist/registry.mjs +669 -324
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +15 -79
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +78 -180
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +15 -79
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +6 -55
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +12 -83
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +6 -55
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.d.vue.ts +5 -1
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +24 -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 +60 -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 +56 -57
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue.d.ts +9 -5
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +24 -41
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +69 -73
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +24 -41
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.d.vue.ts +36 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +82 -37
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue.d.ts +36 -4
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +78 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +222 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +78 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.d.vue.ts +10 -3
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +9 -41
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue.d.ts +10 -3
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.d.vue.ts +7 -3
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +23 -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 +23 -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 +24 -38
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue.d.ts +7 -3
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.d.vue.ts +200 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue +165 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue.d.ts +200 -0
- 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 +10 -0
- package/dist/runtime/components/GoogleMaps/injectionKeys.js +2 -0
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +48 -0
- package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +51 -0
- package/dist/runtime/components/ScriptBlueskyEmbed.d.vue.ts +85 -0
- package/dist/runtime/components/ScriptBlueskyEmbed.vue +88 -0
- package/dist/runtime/components/ScriptBlueskyEmbed.vue.d.ts +85 -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 +1 -2
- package/dist/runtime/components/ScriptInstagramEmbed.vue +8 -3
- package/dist/runtime/components/ScriptInstagramEmbed.vue.d.ts +1 -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 +0 -2
- package/dist/runtime/components/ScriptXEmbed.vue +14 -8
- package/dist/runtime/components/ScriptXEmbed.vue.d.ts +0 -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 +148 -8
- 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/devtools-standalone-bridge.client.d.ts +8 -0
- package/dist/runtime/devtools-standalone-bridge.client.js +50 -0
- 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 +3 -25
- 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 +36 -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 +5 -13
- 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 +19 -14
- package/dist/runtime/registry/posthog.d.ts +10 -12
- package/dist/runtime/registry/posthog.js +4 -13
- 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 +5 -34
- 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/bluesky-embed-image.d.ts +2 -0
- 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 +176 -35
- package/dist/runtime/server/proxy-handler.js +142 -95
- 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 -10
- package/dist/runtime/server/utils/privacy.js +60 -40
- 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 +272 -51
- package/dist/runtime/types.js +0 -2
- package/dist/runtime/utils/pure.d.ts +1 -1
- package/dist/runtime/utils.d.ts +6 -4
- package/dist/runtime/utils.js +31 -14
- package/dist/stats.d.mts +202 -0
- package/dist/stats.d.ts +202 -0
- package/dist/stats.mjs +3875 -0
- package/dist/types-source.d.mts +17 -0
- package/dist/types-source.d.ts +17 -0
- package/dist/types-source.mjs +3414 -0
- package/dist/types.d.mts +4 -2
- package/package.json +35 -61
- package/README.md +0 -86
- package/dist/client/200.html +0 -1
- package/dist/client/404.html +0 -1
- package/dist/client/_nuxt/BPQ3VLAy.js +0 -1
- package/dist/client/_nuxt/BpR-tlZc.js +0 -1
- package/dist/client/_nuxt/CBbMDhE2.js +0 -162
- package/dist/client/_nuxt/CEMAW3aB.js +0 -1
- package/dist/client/_nuxt/MWkREqzj.js +0 -1
- package/dist/client/_nuxt/builds/latest.json +0 -1
- package/dist/client/_nuxt/builds/meta/762d443a-0880-424f-bda8-2b32b39d43ec.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/client/index.html +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/validation/mock.d.ts +0 -42
- package/dist/runtime/validation/mock.js +0 -21
- package/dist/runtime/validation/valibot.d.ts +0 -1
- package/dist/runtime/validation/valibot.js +0 -1
- /package/dist/{client → devtools-client}/_nuxt/CVO1_9PV.js +0 -0
- /package/dist/{client → devtools-client}/_nuxt/Cp-IABpG.js +0 -0
- /package/dist/{client → devtools-client}/_nuxt/D0r3Knsf.js +0 -0
|
@@ -1,58 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const MARKER_INJECTION_KEY: InjectionKey<{
|
|
3
|
-
marker: ShallowRef<google.maps.Marker | undefined>;
|
|
4
|
-
}>;
|
|
1
|
+
export { MARKER_INJECTION_KEY } from './useGoogleMapsResource.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<{
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The position of the marker on the map.
|
|
7
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/advanced-markers#AdvancedMarkerElementOptions.position
|
|
8
|
+
*/
|
|
9
|
+
position?: google.maps.LatLngLiteral | google.maps.LatLng;
|
|
10
|
+
/**
|
|
11
|
+
* Configuration options for the marker.
|
|
12
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/advanced-markers#AdvancedMarkerElementOptions
|
|
13
|
+
*/
|
|
14
|
+
options?: Omit<google.maps.marker.AdvancedMarkerElementOptions, "map">;
|
|
15
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
16
|
click: (payload: google.maps.MapMouseEvent) => any;
|
|
11
|
-
contextmenu: (payload: google.maps.MapMouseEvent) => any;
|
|
12
|
-
dblclick: (payload: google.maps.MapMouseEvent) => any;
|
|
13
17
|
drag: (payload: google.maps.MapMouseEvent) => any;
|
|
14
18
|
dragend: (payload: google.maps.MapMouseEvent) => any;
|
|
15
19
|
dragstart: (payload: google.maps.MapMouseEvent) => any;
|
|
16
|
-
mousedown: (payload: google.maps.MapMouseEvent) => any;
|
|
17
|
-
mouseout: (payload: google.maps.MapMouseEvent) => any;
|
|
18
|
-
mouseover: (payload: google.maps.MapMouseEvent) => any;
|
|
19
|
-
mouseup: (payload: google.maps.MapMouseEvent) => any;
|
|
20
|
-
animation_changed: () => any;
|
|
21
|
-
clickable_changed: () => any;
|
|
22
|
-
cursor_changed: () => any;
|
|
23
|
-
draggable_changed: () => any;
|
|
24
|
-
flat_changed: () => any;
|
|
25
|
-
icon_changed: () => any;
|
|
26
|
-
position_changed: () => any;
|
|
27
|
-
shape_changed: () => any;
|
|
28
|
-
title_changed: () => any;
|
|
29
|
-
visible_changed: () => any;
|
|
30
|
-
zindex_changed: () => any;
|
|
31
20
|
}, string, import("vue").PublicProps, Readonly<{
|
|
32
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The position of the marker on the map.
|
|
23
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/advanced-markers#AdvancedMarkerElementOptions.position
|
|
24
|
+
*/
|
|
25
|
+
position?: google.maps.LatLngLiteral | google.maps.LatLng;
|
|
26
|
+
/**
|
|
27
|
+
* Configuration options for the marker.
|
|
28
|
+
* @see https://developers.google.com/maps/documentation/javascript/reference/advanced-markers#AdvancedMarkerElementOptions
|
|
29
|
+
*/
|
|
30
|
+
options?: Omit<google.maps.marker.AdvancedMarkerElementOptions, "map">;
|
|
33
31
|
}> & Readonly<{
|
|
34
32
|
onClick?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
35
|
-
onContextmenu?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
36
|
-
onDblclick?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
37
33
|
onDrag?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
38
34
|
onDragend?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
39
35
|
onDragstart?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
40
|
-
onMousedown?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
41
|
-
onMouseout?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
42
|
-
onMouseover?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
43
|
-
onMouseup?: ((payload: google.maps.MapMouseEvent) => any) | undefined;
|
|
44
|
-
onAnimation_changed?: (() => any) | undefined;
|
|
45
|
-
onClickable_changed?: (() => any) | undefined;
|
|
46
|
-
onCursor_changed?: (() => any) | undefined;
|
|
47
|
-
onDraggable_changed?: (() => any) | undefined;
|
|
48
|
-
onFlat_changed?: (() => any) | undefined;
|
|
49
|
-
onIcon_changed?: (() => any) | undefined;
|
|
50
|
-
onPosition_changed?: (() => any) | undefined;
|
|
51
|
-
onShape_changed?: (() => any) | undefined;
|
|
52
|
-
onTitle_changed?: (() => any) | undefined;
|
|
53
|
-
onVisible_changed?: (() => any) | undefined;
|
|
54
|
-
onZindex_changed?: (() => any) | undefined;
|
|
55
36
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
37
|
+
content?: (props: {}) => any;
|
|
38
|
+
} & {
|
|
56
39
|
default?: (props: {}) => any;
|
|
57
40
|
}>;
|
|
58
41
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -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;
|
|
@@ -12,19 +12,51 @@ export interface MarkerClustererOptions {
|
|
|
12
12
|
renderer?: unknown;
|
|
13
13
|
onClusterClick?: unknown;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export interface Cluster {
|
|
16
|
+
marker: google.maps.marker.AdvancedMarkerElement;
|
|
17
|
+
markers?: google.maps.marker.AdvancedMarkerElement[];
|
|
18
|
+
position: google.maps.LatLng;
|
|
19
|
+
bounds: google.maps.LatLngBounds | undefined;
|
|
20
|
+
count: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ClusterStats {
|
|
23
|
+
markers: {
|
|
24
|
+
sum: number;
|
|
25
|
+
};
|
|
26
|
+
clusters: {
|
|
27
|
+
count: number;
|
|
28
|
+
markers: {
|
|
29
|
+
min: number;
|
|
30
|
+
max: number;
|
|
31
|
+
mean: number;
|
|
32
|
+
sum: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface MarkerClustererContext {
|
|
16
37
|
markerClusterer: ShallowRef<MarkerClustererInstance | undefined>;
|
|
17
38
|
requestRerender: () => void;
|
|
18
|
-
|
|
39
|
+
/** Increments after each clustering cycle; watch to detect cluster membership changes */
|
|
40
|
+
clusteringVersion: ShallowRef<number>;
|
|
41
|
+
}
|
|
42
|
+
export declare const MARKER_CLUSTERER_INJECTION_KEY: InjectionKey<MarkerClustererContext>;
|
|
19
43
|
declare const _default: typeof __VLS_export;
|
|
20
44
|
export default _default;
|
|
21
45
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
46
|
+
/**
|
|
47
|
+
* Configuration options for the marker clusterer.
|
|
48
|
+
* @see https://googlemaps.github.io/js-markerclusterer/interfaces/MarkerClustererOptions.html
|
|
49
|
+
*/
|
|
22
50
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
23
|
-
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
51
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
52
|
click: (payload: MarkerClustererInstance) => any;
|
|
25
53
|
clusteringbegin: (payload: MarkerClustererInstance) => any;
|
|
26
54
|
clusteringend: (payload: MarkerClustererInstance) => any;
|
|
27
55
|
}, string, import("vue").PublicProps, Readonly<{
|
|
56
|
+
/**
|
|
57
|
+
* Configuration options for the marker clusterer.
|
|
58
|
+
* @see https://googlemaps.github.io/js-markerclusterer/interfaces/MarkerClustererOptions.html
|
|
59
|
+
*/
|
|
28
60
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
29
61
|
}> & Readonly<{
|
|
30
62
|
onClick?: ((payload: MarkerClustererInstance) => any) | undefined;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<slot v-if="markerClusterer" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
1
|
<script>
|
|
6
|
-
import { inject,
|
|
7
|
-
import {
|
|
8
|
-
import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
|
|
2
|
+
import { getCurrentInstance, h, inject, onBeforeUnmount, provide, shallowRef, useSlots, render as vueRender, watch } from "vue";
|
|
3
|
+
import { bindGoogleMapsEvents, MAP_INJECTION_KEY, useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
9
4
|
export const MARKER_CLUSTERER_INJECTION_KEY = /* @__PURE__ */ Symbol("marker-clusterer");
|
|
10
5
|
</script>
|
|
11
6
|
|
|
@@ -13,50 +8,100 @@ export const MARKER_CLUSTERER_INJECTION_KEY = /* @__PURE__ */ Symbol("marker-clu
|
|
|
13
8
|
const props = defineProps({
|
|
14
9
|
options: { type: Object, required: false }
|
|
15
10
|
});
|
|
11
|
+
const emit = defineEmits(["click", "clusteringbegin", "clusteringend"]);
|
|
16
12
|
const markerClustererEvents = [
|
|
17
13
|
"click",
|
|
18
14
|
"clusteringbegin",
|
|
19
15
|
"clusteringend"
|
|
20
16
|
];
|
|
21
|
-
const
|
|
17
|
+
const slots = useSlots();
|
|
18
|
+
const instance = getCurrentInstance();
|
|
22
19
|
const mapContext = inject(MAP_INJECTION_KEY, void 0);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
const clusteringVersion = shallowRef(0);
|
|
21
|
+
const renderedContainers = [];
|
|
22
|
+
function cleanupRenderedClusters() {
|
|
23
|
+
for (const container of renderedContainers) {
|
|
24
|
+
vueRender(null, container);
|
|
25
|
+
}
|
|
26
|
+
renderedContainers.length = 0;
|
|
27
|
+
}
|
|
28
|
+
onBeforeUnmount(cleanupRenderedClusters);
|
|
29
|
+
const markerClusterer = useGoogleMapsResource({
|
|
30
|
+
async create({ map, mapsApi }) {
|
|
31
|
+
const { MarkerClusterer } = await import("@googlemaps/markerclusterer");
|
|
32
|
+
if (slots.renderer) {
|
|
33
|
+
await mapsApi.importLibrary("marker");
|
|
34
|
+
}
|
|
35
|
+
const clusterer = new MarkerClusterer({
|
|
36
|
+
map,
|
|
37
|
+
...props.options,
|
|
38
|
+
...slots.renderer ? {
|
|
39
|
+
renderer: {
|
|
40
|
+
render(cluster, stats) {
|
|
41
|
+
const container = document.createElement("div");
|
|
42
|
+
const vnode = h({
|
|
43
|
+
render: () => slots.renderer?.({ cluster, stats, map })
|
|
44
|
+
});
|
|
45
|
+
if (instance) {
|
|
46
|
+
vnode.appContext = instance.appContext;
|
|
47
|
+
}
|
|
48
|
+
vueRender(vnode, container);
|
|
49
|
+
renderedContainers.push(container);
|
|
50
|
+
const marker = new mapsApi.marker.AdvancedMarkerElement({
|
|
51
|
+
position: cluster.position,
|
|
52
|
+
content: container.firstElementChild || container
|
|
53
|
+
});
|
|
54
|
+
return marker;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} : {}
|
|
58
|
+
});
|
|
59
|
+
bindGoogleMapsEvents(clusterer, emit, { withPayload: markerClustererEvents });
|
|
60
|
+
clusterer.addListener("clusteringbegin", () => {
|
|
61
|
+
cleanupRenderedClusters();
|
|
62
|
+
});
|
|
63
|
+
clusterer.addListener("clusteringend", () => {
|
|
64
|
+
clusteringVersion.value++;
|
|
65
|
+
});
|
|
66
|
+
return clusterer;
|
|
67
|
+
},
|
|
68
|
+
cleanup(clusterer, { mapsApi }) {
|
|
69
|
+
mapsApi.event.clearInstanceListeners(clusterer);
|
|
70
|
+
clusterer.setMap(null);
|
|
71
|
+
cleanupRenderedClusters();
|
|
72
|
+
}
|
|
34
73
|
});
|
|
35
|
-
const
|
|
74
|
+
const rerenderPending = shallowRef(false);
|
|
36
75
|
function requestRerender() {
|
|
37
|
-
|
|
76
|
+
rerenderPending.value = true;
|
|
38
77
|
}
|
|
39
|
-
|
|
40
|
-
markerClusterer.value
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
78
|
+
watch(
|
|
79
|
+
() => rerenderPending.value && markerClusterer.value,
|
|
80
|
+
(ready) => {
|
|
81
|
+
if (!ready)
|
|
82
|
+
return;
|
|
83
|
+
if (!mapContext?.map.value?.getProjection())
|
|
84
|
+
return;
|
|
85
|
+
rerenderPending.value = false;
|
|
86
|
+
try {
|
|
87
|
+
markerClusterer.value.render();
|
|
88
|
+
} catch (err) {
|
|
89
|
+
if (import.meta.dev) {
|
|
90
|
+
console.error("[nuxt-scripts] MarkerClusterer render failed:", err);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
46
93
|
}
|
|
47
|
-
|
|
48
|
-
markerClusterer.value.setMap(null);
|
|
49
|
-
});
|
|
94
|
+
);
|
|
50
95
|
provide(
|
|
51
96
|
MARKER_CLUSTERER_INJECTION_KEY,
|
|
52
97
|
{
|
|
53
98
|
markerClusterer,
|
|
54
|
-
requestRerender
|
|
99
|
+
requestRerender,
|
|
100
|
+
clusteringVersion
|
|
55
101
|
}
|
|
56
102
|
);
|
|
57
|
-
function setupMarkerClustererEventListeners(clusterer) {
|
|
58
|
-
markerClustererEvents.forEach((event) => {
|
|
59
|
-
clusterer.addListener(event, () => emit(event, clusterer));
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
103
|
</script>
|
|
104
|
+
|
|
105
|
+
<template>
|
|
106
|
+
<slot v-if="markerClusterer" />
|
|
107
|
+
</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;
|
|
@@ -12,19 +12,51 @@ export interface MarkerClustererOptions {
|
|
|
12
12
|
renderer?: unknown;
|
|
13
13
|
onClusterClick?: unknown;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export interface Cluster {
|
|
16
|
+
marker: google.maps.marker.AdvancedMarkerElement;
|
|
17
|
+
markers?: google.maps.marker.AdvancedMarkerElement[];
|
|
18
|
+
position: google.maps.LatLng;
|
|
19
|
+
bounds: google.maps.LatLngBounds | undefined;
|
|
20
|
+
count: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ClusterStats {
|
|
23
|
+
markers: {
|
|
24
|
+
sum: number;
|
|
25
|
+
};
|
|
26
|
+
clusters: {
|
|
27
|
+
count: number;
|
|
28
|
+
markers: {
|
|
29
|
+
min: number;
|
|
30
|
+
max: number;
|
|
31
|
+
mean: number;
|
|
32
|
+
sum: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface MarkerClustererContext {
|
|
16
37
|
markerClusterer: ShallowRef<MarkerClustererInstance | undefined>;
|
|
17
38
|
requestRerender: () => void;
|
|
18
|
-
|
|
39
|
+
/** Increments after each clustering cycle; watch to detect cluster membership changes */
|
|
40
|
+
clusteringVersion: ShallowRef<number>;
|
|
41
|
+
}
|
|
42
|
+
export declare const MARKER_CLUSTERER_INJECTION_KEY: InjectionKey<MarkerClustererContext>;
|
|
19
43
|
declare const _default: typeof __VLS_export;
|
|
20
44
|
export default _default;
|
|
21
45
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
46
|
+
/**
|
|
47
|
+
* Configuration options for the marker clusterer.
|
|
48
|
+
* @see https://googlemaps.github.io/js-markerclusterer/interfaces/MarkerClustererOptions.html
|
|
49
|
+
*/
|
|
22
50
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
23
|
-
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
51
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
52
|
click: (payload: MarkerClustererInstance) => any;
|
|
25
53
|
clusteringbegin: (payload: MarkerClustererInstance) => any;
|
|
26
54
|
clusteringend: (payload: MarkerClustererInstance) => any;
|
|
27
55
|
}, string, import("vue").PublicProps, Readonly<{
|
|
56
|
+
/**
|
|
57
|
+
* Configuration options for the marker clusterer.
|
|
58
|
+
* @see https://googlemaps.github.io/js-markerclusterer/interfaces/MarkerClustererOptions.html
|
|
59
|
+
*/
|
|
28
60
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
29
61
|
}> & Readonly<{
|
|
30
62
|
onClick?: ((payload: MarkerClustererInstance) => any) | undefined;
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
* Pan the map so the overlay is fully visible when opened, similar to InfoWindow behavior.
|
|
38
|
+
* Set to `true` for default 40px padding, or a number for custom padding.
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
panOnOpen?: boolean | number;
|
|
42
|
+
/**
|
|
43
|
+
* Automatically hide the overlay when its parent marker joins a cluster (on zoom out).
|
|
44
|
+
* Only applies when nested inside a ScriptGoogleMapsMarkerClusterer.
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
hideWhenClustered?: boolean;
|
|
48
|
+
};
|
|
49
|
+
type __VLS_ModelProps = {
|
|
50
|
+
'open'?: boolean;
|
|
51
|
+
};
|
|
52
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
53
|
+
declare var __VLS_1: {};
|
|
54
|
+
type __VLS_Slots = {} & {
|
|
55
|
+
default?: (props: typeof __VLS_1) => any;
|
|
56
|
+
};
|
|
57
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
58
|
+
overlay: import("vue").ShallowRef<google.maps.OverlayView | undefined>;
|
|
59
|
+
dataState: import("vue").ComputedRef<"open" | "closed">;
|
|
60
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
61
|
+
"update:open": (value: boolean) => any;
|
|
62
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
63
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
64
|
+
}>, {
|
|
65
|
+
anchor: OverlayAnchor;
|
|
66
|
+
pane: OverlayPane;
|
|
67
|
+
blockMapInteraction: boolean;
|
|
68
|
+
panOnOpen: boolean | number;
|
|
69
|
+
hideWhenClustered: boolean;
|
|
70
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
71
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
72
|
+
declare const _default: typeof __VLS_export;
|
|
73
|
+
export default _default;
|
|
74
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
75
|
+
new (): {
|
|
76
|
+
$slots: S;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, inject, ref, useTemplateRef, watch } from "vue";
|
|
3
|
+
import { MARKER_CLUSTERER_INJECTION_KEY } from "./ScriptGoogleMapsMarkerClusterer.vue";
|
|
4
|
+
import { MARKER_INJECTION_KEY, useGoogleMapsResource } from "./useGoogleMapsResource";
|
|
5
|
+
defineOptions({
|
|
6
|
+
inheritAttrs: false
|
|
7
|
+
});
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
position: { type: null, required: false },
|
|
10
|
+
anchor: { type: String, required: false, default: "bottom-center" },
|
|
11
|
+
offset: { type: Object, required: false },
|
|
12
|
+
pane: { type: String, required: false, default: "floatPane" },
|
|
13
|
+
zIndex: { type: Number, required: false },
|
|
14
|
+
blockMapInteraction: { type: Boolean, required: false, default: true },
|
|
15
|
+
panOnOpen: { type: [Boolean, Number], required: false, default: true },
|
|
16
|
+
hideWhenClustered: { type: Boolean, required: false, default: true }
|
|
17
|
+
});
|
|
18
|
+
const open = defineModel("open", { type: Boolean, ...{ default: void 0 } });
|
|
19
|
+
const markerContext = inject(MARKER_INJECTION_KEY, void 0);
|
|
20
|
+
const markerClustererContext = inject(MARKER_CLUSTERER_INJECTION_KEY, void 0);
|
|
21
|
+
function getResolvedPosition() {
|
|
22
|
+
if (props.position)
|
|
23
|
+
return props.position;
|
|
24
|
+
if (markerContext?.advancedMarkerElement.value) {
|
|
25
|
+
const pos = markerContext.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 isPositioned = ref(false);
|
|
47
|
+
const dataState = computed(() => isPositioned.value ? "open" : "closed");
|
|
48
|
+
const listeners = [];
|
|
49
|
+
function setDataState(el, state) {
|
|
50
|
+
el.dataset.state = state;
|
|
51
|
+
const child = el.firstElementChild;
|
|
52
|
+
if (child)
|
|
53
|
+
child.dataset.state = state;
|
|
54
|
+
}
|
|
55
|
+
function hideElement(el) {
|
|
56
|
+
el.style.visibility = "hidden";
|
|
57
|
+
el.style.pointerEvents = "none";
|
|
58
|
+
setDataState(el, "closed");
|
|
59
|
+
}
|
|
60
|
+
function panMapToFitOverlay(el, map, padding) {
|
|
61
|
+
const child = el.firstElementChild;
|
|
62
|
+
if (!child)
|
|
63
|
+
return;
|
|
64
|
+
const overlayRect = child.getBoundingClientRect();
|
|
65
|
+
const mapRect = map.getDiv().getBoundingClientRect();
|
|
66
|
+
let panX = 0;
|
|
67
|
+
let panY = 0;
|
|
68
|
+
if (overlayRect.top - padding < mapRect.top)
|
|
69
|
+
panY = overlayRect.top - mapRect.top - padding;
|
|
70
|
+
if (overlayRect.bottom + padding > mapRect.bottom)
|
|
71
|
+
panY = overlayRect.bottom - mapRect.bottom + padding;
|
|
72
|
+
if (overlayRect.left - padding < mapRect.left)
|
|
73
|
+
panX = overlayRect.left - mapRect.left - padding;
|
|
74
|
+
else if (overlayRect.right + padding > mapRect.right)
|
|
75
|
+
panX = overlayRect.right - mapRect.right + padding;
|
|
76
|
+
if (panX !== 0 || panY !== 0)
|
|
77
|
+
map.panBy(panX, panY);
|
|
78
|
+
}
|
|
79
|
+
const overlay = useGoogleMapsResource({
|
|
80
|
+
// ready condition accesses .value on ShallowRefs — tracked by whenever() in useGoogleMapsResource
|
|
81
|
+
ready: () => !!overlayContent.value && !!(props.position || markerContext?.advancedMarkerElement.value),
|
|
82
|
+
create({ mapsApi, map }) {
|
|
83
|
+
const el = overlayContent.value;
|
|
84
|
+
class CustomOverlay extends mapsApi.OverlayView {
|
|
85
|
+
onAdd() {
|
|
86
|
+
const panes = this.getPanes();
|
|
87
|
+
if (panes) {
|
|
88
|
+
panes[props.pane].appendChild(el);
|
|
89
|
+
if (props.blockMapInteraction)
|
|
90
|
+
mapsApi.OverlayView.preventMapHitsAndGesturesFrom(el);
|
|
91
|
+
}
|
|
92
|
+
if (props.panOnOpen) {
|
|
93
|
+
const padding = typeof props.panOnOpen === "number" ? props.panOnOpen : 40;
|
|
94
|
+
requestAnimationFrame(() => {
|
|
95
|
+
panMapToFitOverlay(el, map, padding);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
draw() {
|
|
100
|
+
if (open.value === false) {
|
|
101
|
+
isPositioned.value = false;
|
|
102
|
+
hideElement(el);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const position = getResolvedPosition();
|
|
106
|
+
if (!position) {
|
|
107
|
+
isPositioned.value = false;
|
|
108
|
+
hideElement(el);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const projection = this.getProjection();
|
|
112
|
+
if (!projection) {
|
|
113
|
+
isPositioned.value = false;
|
|
114
|
+
hideElement(el);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const pos = projection.fromLatLngToDivPixel(
|
|
118
|
+
new mapsApi.LatLng(position.lat, position.lng)
|
|
119
|
+
);
|
|
120
|
+
if (!pos) {
|
|
121
|
+
isPositioned.value = false;
|
|
122
|
+
hideElement(el);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
el.style.position = "absolute";
|
|
126
|
+
el.style.left = `${pos.x + (props.offset?.x ?? 0)}px`;
|
|
127
|
+
el.style.top = `${pos.y + (props.offset?.y ?? 0)}px`;
|
|
128
|
+
el.style.transform = ANCHOR_TRANSFORMS[props.anchor];
|
|
129
|
+
if (props.zIndex !== void 0)
|
|
130
|
+
el.style.zIndex = String(props.zIndex);
|
|
131
|
+
el.style.visibility = "visible";
|
|
132
|
+
el.style.pointerEvents = "auto";
|
|
133
|
+
setDataState(el, "open");
|
|
134
|
+
isPositioned.value = true;
|
|
135
|
+
}
|
|
136
|
+
onRemove() {
|
|
137
|
+
el.parentNode?.removeChild(el);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
el.style.visibility = "hidden";
|
|
141
|
+
el.style.pointerEvents = "none";
|
|
142
|
+
const ov = new CustomOverlay();
|
|
143
|
+
ov.setMap(map);
|
|
144
|
+
if (markerContext?.advancedMarkerElement.value) {
|
|
145
|
+
const ame = markerContext.advancedMarkerElement.value;
|
|
146
|
+
listeners.push(
|
|
147
|
+
ame.addListener("drag", () => ov.draw()),
|
|
148
|
+
ame.addListener("dragend", () => ov.draw())
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
return ov;
|
|
152
|
+
},
|
|
153
|
+
cleanup(ov) {
|
|
154
|
+
listeners.forEach((l) => l.remove());
|
|
155
|
+
listeners.length = 0;
|
|
156
|
+
ov.setMap(null);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
if (markerContext) {
|
|
160
|
+
watch(
|
|
161
|
+
() => {
|
|
162
|
+
const pos = markerContext.advancedMarkerElement.value?.position;
|
|
163
|
+
if (!pos)
|
|
164
|
+
return void 0;
|
|
165
|
+
if ("lat" in pos && typeof pos.lat === "function")
|
|
166
|
+
return { lat: pos.lat(), lng: pos.lng() };
|
|
167
|
+
return pos;
|
|
168
|
+
},
|
|
169
|
+
() => {
|
|
170
|
+
overlay.value?.draw();
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
watch(
|
|
175
|
+
() => [props.position?.lat, props.position?.lng, props.offset?.x, props.offset?.y, props.zIndex, props.anchor],
|
|
176
|
+
() => {
|
|
177
|
+
overlay.value?.draw();
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
watch(() => open.value, () => {
|
|
181
|
+
if (!overlay.value)
|
|
182
|
+
return;
|
|
183
|
+
overlay.value.draw();
|
|
184
|
+
});
|
|
185
|
+
watch([() => props.pane, () => props.blockMapInteraction], () => {
|
|
186
|
+
if (overlay.value) {
|
|
187
|
+
const map = overlay.value.getMap();
|
|
188
|
+
overlay.value.setMap(null);
|
|
189
|
+
if (map)
|
|
190
|
+
overlay.value.setMap(map);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
if (markerClustererContext && markerContext) {
|
|
194
|
+
watch(
|
|
195
|
+
() => markerClustererContext.clusteringVersion.value,
|
|
196
|
+
() => {
|
|
197
|
+
if (!props.hideWhenClustered || open.value === false)
|
|
198
|
+
return;
|
|
199
|
+
const clusterer = markerClustererContext.markerClusterer.value;
|
|
200
|
+
if (!clusterer?.clusters)
|
|
201
|
+
return;
|
|
202
|
+
const parentMarker = markerContext.advancedMarkerElement.value;
|
|
203
|
+
if (!parentMarker)
|
|
204
|
+
return;
|
|
205
|
+
const isClustered = clusterer.clusters.some(
|
|
206
|
+
(cluster) => cluster.count > 1 && cluster.markers?.includes(parentMarker)
|
|
207
|
+
);
|
|
208
|
+
if (isClustered)
|
|
209
|
+
open.value = false;
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
defineExpose({ overlay, dataState });
|
|
214
|
+
</script>
|
|
215
|
+
|
|
216
|
+
<template>
|
|
217
|
+
<div style="display: none;">
|
|
218
|
+
<div ref="overlay-content" :data-state="dataState" v-bind="$attrs">
|
|
219
|
+
<slot />
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</template>
|