@nuxt/scripts 1.0.0-beta.28 → 1.0.0-beta.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/client/200.html +1 -1
  2. package/dist/client/404.html +1 -1
  3. package/dist/client/_nuxt/builds/latest.json +1 -1
  4. package/dist/client/_nuxt/builds/meta/05eb1abd-7d1c-43e9-b78e-dc8ec287cc6f.json +1 -0
  5. package/dist/client/index.html +1 -1
  6. package/dist/module.json +1 -1
  7. package/dist/module.mjs +16 -15
  8. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +11 -1
  9. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +1 -1
  10. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +14 -13
  11. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +1 -1
  12. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.d.vue.ts +1 -1
  13. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +1 -1
  14. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue.d.ts +1 -1
  15. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.d.vue.ts +1 -1
  16. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue +3 -10
  17. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue.d.ts +1 -1
  18. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.d.vue.ts +1 -1
  19. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +32 -12
  20. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue.d.ts +1 -1
  21. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +1 -1
  22. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +1 -1
  23. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +1 -1
  24. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.d.vue.ts +1 -1
  25. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +3 -7
  26. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue.d.ts +1 -1
  27. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +2 -2
  28. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +2 -10
  29. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +2 -2
  30. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.d.vue.ts +1 -1
  31. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +1 -1
  32. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue.d.ts +1 -1
  33. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.d.vue.ts +1 -1
  34. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue +1 -1
  35. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue.d.ts +1 -1
  36. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.d.vue.ts +1 -1
  37. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue +1 -1
  38. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue.d.ts +1 -1
  39. package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +2 -0
  40. package/dist/runtime/composables/useScript.js +3 -1
  41. package/dist/runtime/registry/rybbit-analytics.js +3 -1
  42. package/dist/types-source.mjs +190 -0
  43. package/package.json +7 -7
  44. package/dist/client/_nuxt/builds/meta/3ca2fe82-918c-4528-826c-0bf9ff54a5fa.json +0 -1
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.C5SUNdim.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/Bl23o3st.js"><script type="module" src="/__nuxt-scripts/_nuxt/Bl23o3st.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{version:"",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:"",endpoints:{}}},app:{baseURL:"/__nuxt-scripts",buildId:"3ca2fe82-918c-4528-826c-0bf9ff54a5fa",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1773987205131,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.C5SUNdim.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/Bl23o3st.js"><script type="module" src="/__nuxt-scripts/_nuxt/Bl23o3st.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{version:"",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:"",endpoints:{}}},app:{baseURL:"/__nuxt-scripts",buildId:"05eb1abd-7d1c-43e9-b78e-dc8ec287cc6f",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1774014640218,false]</script></body></html>
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.C5SUNdim.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/Bl23o3st.js"><script type="module" src="/__nuxt-scripts/_nuxt/Bl23o3st.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{version:"",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:"",endpoints:{}}},app:{baseURL:"/__nuxt-scripts",buildId:"3ca2fe82-918c-4528-826c-0bf9ff54a5fa",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1773987205132,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.C5SUNdim.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/Bl23o3st.js"><script type="module" src="/__nuxt-scripts/_nuxt/Bl23o3st.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{version:"",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:"",endpoints:{}}},app:{baseURL:"/__nuxt-scripts",buildId:"05eb1abd-7d1c-43e9-b78e-dc8ec287cc6f",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1774014640219,false]</script></body></html>
@@ -1 +1 @@
1
- {"id":"3ca2fe82-918c-4528-826c-0bf9ff54a5fa","timestamp":1773987199411}
1
+ {"id":"05eb1abd-7d1c-43e9-b78e-dc8ec287cc6f","timestamp":1774014634721}
@@ -0,0 +1 @@
1
+ {"id":"05eb1abd-7d1c-43e9-b78e-dc8ec287cc6f","timestamp":1774014634721,"prerendered":[]}
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.C5SUNdim.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/Bl23o3st.js"><script type="module" src="/__nuxt-scripts/_nuxt/Bl23o3st.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{version:"",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:"",endpoints:{}}},app:{baseURL:"/__nuxt-scripts",buildId:"3ca2fe82-918c-4528-826c-0bf9ff54a5fa",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1773987205133,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.C5SUNdim.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/Bl23o3st.js"><script type="module" src="/__nuxt-scripts/_nuxt/Bl23o3st.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{version:"",defaultScriptOptions:{trigger:"onNuxtReady"},googleStaticMapsProxy:"",endpoints:{}}},app:{baseURL:"/__nuxt-scripts",buildId:"05eb1abd-7d1c-43e9-b78e-dc8ec287cc6f",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1774014640219,false]</script></body></html>
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16"
6
6
  },
7
- "version": "1.0.0-beta.28",
7
+ "version": "1.0.0-beta.29",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -308,8 +308,9 @@ function setupPublicAssetStrategy(options = {}) {
308
308
  route: assetsBaseURL,
309
309
  handler: lazyEventHandler(async () => {
310
310
  return eventHandler(async (event) => {
311
- const filename = event.path.slice(1);
312
- const scriptDescriptor = renderedScript.get(join(assetsBaseURL, event.path.slice(1)));
311
+ const cleanPath = (event.path || "").split("?")[0]?.slice(1) || "";
312
+ const filename = cleanPath;
313
+ const scriptDescriptor = renderedScript.get(join(assetsBaseURL, cleanPath));
313
314
  if (!scriptDescriptor || scriptDescriptor instanceof Error)
314
315
  throw createError({ statusCode: 404 });
315
316
  if (scriptDescriptor.content) {
@@ -1472,19 +1473,6 @@ const module$1 = defineNuxtModule({
1472
1473
  if (unheadVersion?.startsWith("1")) {
1473
1474
  logger.error(`Nuxt Scripts requires Unhead >= 2, you are using v${unheadVersion}. Please run \`nuxi upgrade --clean\` to upgrade...`);
1474
1475
  }
1475
- const googleMapsEnabled = config.googleStaticMapsProxy?.enabled || !!config.registry?.googleMaps;
1476
- nuxt.options.runtimeConfig["nuxt-scripts"] = {
1477
- version,
1478
- // Private proxy config with API key (server-side only)
1479
- googleStaticMapsProxy: googleMapsEnabled ? { apiKey: nuxt.options.runtimeConfig.public.scripts?.googleMaps?.apiKey } : void 0
1480
- };
1481
- nuxt.options.runtimeConfig.public["nuxt-scripts"] = {
1482
- // expose for devtools
1483
- version: nuxt.options.dev ? version : void 0,
1484
- defaultScriptOptions: config.defaultScriptOptions,
1485
- // Only expose enabled and cacheMaxAge to client, not apiKey
1486
- googleStaticMapsProxy: googleMapsEnabled ? { enabled: true, cacheMaxAge: config.googleStaticMapsProxy?.cacheMaxAge ?? 3600 } : void 0
1487
- };
1488
1476
  if (config.registry) {
1489
1477
  normalizeRegistryConfig(config.registry);
1490
1478
  nuxt.options.runtimeConfig.public = nuxt.options.runtimeConfig.public || {};
@@ -1510,6 +1498,19 @@ const module$1 = defineNuxtModule({
1510
1498
  registryWithDefaults
1511
1499
  );
1512
1500
  }
1501
+ const googleMapsEnabled = config.googleStaticMapsProxy?.enabled || !!config.registry?.googleMaps;
1502
+ nuxt.options.runtimeConfig["nuxt-scripts"] = {
1503
+ version,
1504
+ // Private proxy config with API key (server-side only)
1505
+ googleStaticMapsProxy: googleMapsEnabled ? { apiKey: nuxt.options.runtimeConfig.public.scripts?.googleMaps?.apiKey } : void 0
1506
+ };
1507
+ nuxt.options.runtimeConfig.public["nuxt-scripts"] = {
1508
+ // expose for devtools
1509
+ version: nuxt.options.dev ? version : void 0,
1510
+ defaultScriptOptions: config.defaultScriptOptions,
1511
+ // Only expose enabled and cacheMaxAge to client, not apiKey
1512
+ googleStaticMapsProxy: googleMapsEnabled ? { enabled: true, cacheMaxAge: config.googleStaticMapsProxy?.cacheMaxAge ?? 3600 } : void 0
1513
+ };
1513
1514
  if (config.defaultScriptOptions?.bundle !== void 0) {
1514
1515
  logger.warn(
1515
1516
  "`scripts.defaultScriptOptions.bundle` is deprecated. Use `scripts.firstParty: true` instead. First-party mode is now enabled by default."
@@ -194,7 +194,17 @@ const googleMaps = {
194
194
  importLibrary
195
195
  };
196
196
  defineExpose(googleMaps);
197
- provide(MAP_INJECTION_KEY, { map, mapsApi });
197
+ let activeInfoWindow;
198
+ provide(MAP_INJECTION_KEY, {
199
+ map,
200
+ mapsApi,
201
+ activateInfoWindow(iw) {
202
+ if (activeInfoWindow && activeInfoWindow !== iw) {
203
+ activeInfoWindow.close();
204
+ }
205
+ activeInfoWindow = iw;
206
+ }
207
+ });
198
208
  onMounted(() => {
199
209
  watch(ready, (v) => {
200
210
  if (v) {
@@ -4,7 +4,7 @@ export default _default;
4
4
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
5
5
  position?: google.maps.LatLngLiteral | google.maps.LatLng;
6
6
  options?: Omit<google.maps.marker.AdvancedMarkerElementOptions, "map">;
7
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
7
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
8
  click: (payload: google.maps.MapMouseEvent) => any;
9
9
  drag: (payload: google.maps.MapMouseEvent) => any;
10
10
  dragend: (payload: google.maps.MapMouseEvent) => any;
@@ -12,41 +12,42 @@ const props = defineProps({
12
12
  position: { type: null, required: false },
13
13
  options: { type: Object, required: false }
14
14
  });
15
- const emit = defineEmits([]);
16
- const eventsWithoutPayload = [];
17
- const eventsWithMapMouseEventPayload = [
18
- "click",
19
- "drag",
20
- "dragend",
21
- "dragstart"
22
- ];
15
+ const emit = defineEmits(["click", "drag", "dragend", "dragstart"]);
16
+ const dragEvents = ["drag", "dragend", "dragstart"];
23
17
  const slots = useSlots();
24
18
  const markerContent = useTemplateRef("marker-content");
25
19
  const markerClustererContext = inject(MARKER_CLUSTERER_INJECTION_KEY, void 0);
20
+ let gmpClickHandler;
26
21
  const advancedMarkerElement = useGoogleMapsResource({
27
22
  ready: () => !slots.content || !!markerContent.value,
28
23
  async create({ mapsApi, map }) {
29
24
  await mapsApi.importLibrary("marker");
30
25
  const marker = new mapsApi.marker.AdvancedMarkerElement({
31
26
  ...props.options,
27
+ gmpClickable: true,
32
28
  ...props.position ? { position: props.position } : {}
33
29
  });
34
30
  if (markerContent.value) {
35
31
  marker.content = markerContent.value;
36
32
  }
37
- bindGoogleMapsEvents(marker, emit, {
38
- noPayload: eventsWithoutPayload,
39
- withPayload: eventsWithMapMouseEventPayload
40
- });
41
33
  if (markerClustererContext?.markerClusterer.value) {
42
34
  markerClustererContext.markerClusterer.value.addMarker(marker, true);
43
35
  markerClustererContext.requestRerender();
44
36
  } else {
45
37
  marker.map = map;
46
38
  }
39
+ gmpClickHandler = (e) => emit("click", e);
40
+ marker.addEventListener("gmp-click", gmpClickHandler);
41
+ bindGoogleMapsEvents(marker, emit, {
42
+ withPayload: dragEvents
43
+ });
47
44
  return marker;
48
45
  },
49
46
  cleanup(marker, { mapsApi }) {
47
+ if (gmpClickHandler) {
48
+ marker.removeEventListener("gmp-click", gmpClickHandler);
49
+ gmpClickHandler = void 0;
50
+ }
50
51
  mapsApi.event.clearInstanceListeners(marker);
51
52
  if (markerClustererContext?.markerClusterer.value) {
52
53
  markerClustererContext.markerClusterer.value.removeMarker(marker, true);
@@ -57,7 +58,7 @@ const advancedMarkerElement = useGoogleMapsResource({
57
58
  }
58
59
  });
59
60
  watch(
60
- () => [props.position?.lat, props.position?.lng, props.position, props.options],
61
+ () => [props.position, props.options],
61
62
  () => {
62
63
  if (!advancedMarkerElement.value)
63
64
  return;
@@ -4,7 +4,7 @@ export default _default;
4
4
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
5
5
  position?: google.maps.LatLngLiteral | google.maps.LatLng;
6
6
  options?: Omit<google.maps.marker.AdvancedMarkerElementOptions, "map">;
7
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
7
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
8
  click: (payload: google.maps.MapMouseEvent) => any;
9
9
  drag: (payload: google.maps.MapMouseEvent) => any;
10
10
  dragend: (payload: google.maps.MapMouseEvent) => any;
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  options?: Omit<google.maps.CircleOptions, 'map'>;
3
3
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  click: (payload: google.maps.MapMouseEvent) => any;
6
6
  dblclick: (payload: google.maps.MapMouseEvent) => any;
7
7
  drag: (payload: google.maps.MapMouseEvent) => any;
@@ -5,7 +5,7 @@ import { useGoogleMapsResource } from "./useGoogleMapsResource";
5
5
  const props = defineProps({
6
6
  options: { type: Object, required: false }
7
7
  });
8
- const emit = defineEmits([]);
8
+ const emit = defineEmits(["center_changed", "radius_changed", "click", "dblclick", "drag", "dragend", "dragstart", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "rightclick"]);
9
9
  const eventsWithoutPayload = [
10
10
  "center_changed",
11
11
  "radius_changed"
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  options?: Omit<google.maps.CircleOptions, 'map'>;
3
3
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  click: (payload: google.maps.MapMouseEvent) => any;
6
6
  dblclick: (payload: google.maps.MapMouseEvent) => any;
7
7
  drag: (payload: google.maps.MapMouseEvent) => any;
@@ -2,7 +2,7 @@ type __VLS_Props = {
2
2
  src: string | object;
3
3
  style?: google.maps.Data.StylingFunction | google.maps.Data.StyleOptions;
4
4
  };
5
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
6
  contextmenu: (payload: google.maps.Data.MouseEvent) => any;
7
7
  click: (payload: google.maps.Data.MouseEvent) => any;
8
8
  dblclick: (payload: google.maps.Data.MouseEvent) => any;
@@ -1,11 +1,12 @@
1
1
  <script setup>
2
2
  import { watch } from "vue";
3
+ import { bindGoogleMapsEvents } from "./bindGoogleMapsEvents";
3
4
  import { useGoogleMapsResource } from "./useGoogleMapsResource";
4
5
  const props = defineProps({
5
6
  src: { type: [String, Object], required: true },
6
7
  style: { type: null, required: false }
7
8
  });
8
- const emit = defineEmits(["addfeature", "removefeature", "setgeometry", "setproperty", "removeproperty"]);
9
+ const emit = defineEmits(["click", "contextmenu", "dblclick", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "addfeature", "removefeature", "setgeometry", "setproperty", "removeproperty"]);
9
10
  const dataEvents = [
10
11
  "click",
11
12
  "contextmenu",
@@ -35,7 +36,7 @@ const dataLayer = useGoogleMapsResource({
35
36
  if (props.style)
36
37
  layer.setStyle(props.style);
37
38
  loadGeoJson(props.src, layer);
38
- setupEventListeners(layer);
39
+ bindGoogleMapsEvents(layer, emit, { withPayload: [...dataEvents, ...featureEvents] });
39
40
  return layer;
40
41
  },
41
42
  cleanup(layer, { mapsApi }) {
@@ -53,14 +54,6 @@ watch(() => props.style, (style) => {
53
54
  if (dataLayer.value)
54
55
  dataLayer.value.setStyle(style ?? {});
55
56
  }, { deep: true });
56
- function setupEventListeners(layer) {
57
- dataEvents.forEach((event) => {
58
- layer.addListener(event, (payload) => emit(event, payload));
59
- });
60
- featureEvents.forEach((event) => {
61
- layer.addListener(event, (payload) => emit(event, payload));
62
- });
63
- }
64
57
  </script>
65
58
 
66
59
  <template>
@@ -2,7 +2,7 @@ type __VLS_Props = {
2
2
  src: string | object;
3
3
  style?: google.maps.Data.StylingFunction | google.maps.Data.StyleOptions;
4
4
  };
5
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
6
  contextmenu: (payload: google.maps.Data.MouseEvent) => any;
7
7
  click: (payload: google.maps.Data.MouseEvent) => any;
8
8
  dblclick: (payload: google.maps.Data.MouseEvent) => any;
@@ -5,7 +5,7 @@ declare var __VLS_1: {};
5
5
  type __VLS_Slots = {} & {
6
6
  default?: (props: typeof __VLS_1) => any;
7
7
  };
8
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
8
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
9
  close: () => any;
10
10
  visible: () => any;
11
11
  closeclick: () => any;
@@ -1,12 +1,12 @@
1
1
  <script setup>
2
2
  import { inject, useTemplateRef, watch } from "vue";
3
3
  import { bindGoogleMapsEvents } from "./bindGoogleMapsEvents";
4
- import { ADVANCED_MARKER_ELEMENT_INJECTION_KEY, MARKER_INJECTION_KEY } from "./injectionKeys";
4
+ import { ADVANCED_MARKER_ELEMENT_INJECTION_KEY, MAP_INJECTION_KEY, MARKER_INJECTION_KEY } from "./injectionKeys";
5
5
  import { useGoogleMapsResource } from "./useGoogleMapsResource";
6
6
  const props = defineProps({
7
7
  options: { type: null, required: false }
8
8
  });
9
- const emit = defineEmits([]);
9
+ const emit = defineEmits(["close", "closeclick", "content_changed", "domready", "headercontent_changed", "headerdisabled_changed", "position_changed", "visible", "zindex_changed"]);
10
10
  const infoWindowEvents = [
11
11
  "close",
12
12
  "closeclick",
@@ -18,10 +18,13 @@ const infoWindowEvents = [
18
18
  "visible",
19
19
  "zindex_changed"
20
20
  ];
21
+ const mapContext = inject(MAP_INJECTION_KEY, void 0);
21
22
  const markerContext = inject(MARKER_INJECTION_KEY, void 0);
22
23
  const advancedMarkerElementContext = inject(ADVANCED_MARKER_ELEMENT_INJECTION_KEY, void 0);
23
24
  const infoWindowContainer = useTemplateRef("info-window-container");
24
25
  let markerClickListener;
26
+ let gmpClickHandler;
27
+ let isOpen = false;
25
28
  const infoWindow = useGoogleMapsResource({
26
29
  ready: () => !!infoWindowContainer.value,
27
30
  create({ mapsApi, map }) {
@@ -29,32 +32,49 @@ const infoWindow = useGoogleMapsResource({
29
32
  content: infoWindowContainer.value,
30
33
  ...props.options
31
34
  });
35
+ iw.addListener("closeclick", () => {
36
+ isOpen = false;
37
+ });
38
+ iw.addListener("close", () => {
39
+ isOpen = false;
40
+ });
32
41
  bindGoogleMapsEvents(iw, emit, { noPayload: infoWindowEvents });
42
+ const toggleOpen = (anchor) => {
43
+ if (isOpen) {
44
+ iw.close();
45
+ isOpen = false;
46
+ } else {
47
+ mapContext?.activateInfoWindow(iw);
48
+ iw.open({ anchor, map });
49
+ isOpen = true;
50
+ }
51
+ };
33
52
  if (markerContext?.marker.value) {
34
53
  markerClickListener = markerContext.marker.value.addListener("click", () => {
35
- iw.open({
36
- anchor: markerContext.marker.value,
37
- map
38
- });
54
+ toggleOpen(markerContext.marker.value);
39
55
  });
40
56
  } else if (advancedMarkerElementContext?.advancedMarkerElement.value) {
41
- markerClickListener = advancedMarkerElementContext.advancedMarkerElement.value.addListener("click", () => {
42
- iw.open({
43
- anchor: advancedMarkerElementContext.advancedMarkerElement.value,
44
- map
45
- });
46
- });
57
+ const ame = advancedMarkerElementContext.advancedMarkerElement.value;
58
+ ame.gmpClickable = true;
59
+ gmpClickHandler = () => toggleOpen(ame);
60
+ ame.addEventListener("gmp-click", gmpClickHandler);
47
61
  } else {
48
62
  iw.setPosition(props.options?.position);
49
63
  iw.open(map);
64
+ isOpen = true;
50
65
  }
51
66
  return iw;
52
67
  },
53
68
  cleanup(iw, { mapsApi }) {
54
69
  markerClickListener?.remove();
55
70
  markerClickListener = void 0;
71
+ if (gmpClickHandler && advancedMarkerElementContext?.advancedMarkerElement.value) {
72
+ advancedMarkerElementContext.advancedMarkerElement.value.removeEventListener("gmp-click", gmpClickHandler);
73
+ gmpClickHandler = void 0;
74
+ }
56
75
  mapsApi.event.clearInstanceListeners(iw);
57
76
  iw.close();
77
+ isOpen = false;
58
78
  }
59
79
  });
60
80
  watch(() => props.options, (options) => {
@@ -5,7 +5,7 @@ declare var __VLS_1: {};
5
5
  type __VLS_Slots = {} & {
6
6
  default?: (props: typeof __VLS_1) => any;
7
7
  };
8
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
8
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
9
  close: () => any;
10
10
  visible: () => any;
11
11
  closeclick: () => any;
@@ -4,7 +4,7 @@ export default _default;
4
4
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
5
5
  position?: google.maps.LatLngLiteral | google.maps.LatLng;
6
6
  options?: Omit<google.maps.MarkerOptions, "map">;
7
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
7
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
8
  contextmenu: (payload: google.maps.MapMouseEvent) => any;
9
9
  click: (payload: google.maps.MapMouseEvent) => any;
10
10
  dblclick: (payload: google.maps.MapMouseEvent) => any;
@@ -12,7 +12,7 @@ const props = defineProps({
12
12
  position: { type: null, required: false },
13
13
  options: { type: Object, required: false }
14
14
  });
15
- const emit = defineEmits([]);
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
16
  if (import.meta.dev) {
17
17
  console.warn("[nuxt-scripts] ScriptGoogleMapsMarker uses the deprecated google.maps.Marker class. Use ScriptGoogleMapsAdvancedMarkerElement instead.");
18
18
  }
@@ -4,7 +4,7 @@ export default _default;
4
4
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
5
5
  position?: google.maps.LatLngLiteral | google.maps.LatLng;
6
6
  options?: Omit<google.maps.MarkerOptions, "map">;
7
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
7
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
8
  contextmenu: (payload: google.maps.MapMouseEvent) => any;
9
9
  click: (payload: google.maps.MapMouseEvent) => any;
10
10
  dblclick: (payload: google.maps.MapMouseEvent) => any;
@@ -20,7 +20,7 @@ declare const _default: typeof __VLS_export;
20
20
  export default _default;
21
21
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
22
22
  options?: Omit<MarkerClustererOptions, "map">;
23
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
23
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
24
  click: (payload: MarkerClustererInstance) => any;
25
25
  clusteringbegin: (payload: MarkerClustererInstance) => any;
26
26
  clusteringend: (payload: MarkerClustererInstance) => any;
@@ -1,6 +1,7 @@
1
1
  <script>
2
2
  import { whenever } from "@vueuse/core";
3
3
  import { provide, shallowRef } from "vue";
4
+ import { bindGoogleMapsEvents } from "./bindGoogleMapsEvents";
4
5
  import { useGoogleMapsResource } from "./useGoogleMapsResource";
5
6
  export const MARKER_CLUSTERER_INJECTION_KEY = /* @__PURE__ */ Symbol("marker-clusterer");
6
7
  </script>
@@ -9,7 +10,7 @@ export const MARKER_CLUSTERER_INJECTION_KEY = /* @__PURE__ */ Symbol("marker-clu
9
10
  const props = defineProps({
10
11
  options: { type: Object, required: false }
11
12
  });
12
- const emit = defineEmits([]);
13
+ const emit = defineEmits(["click", "clusteringbegin", "clusteringend"]);
13
14
  const markerClustererEvents = [
14
15
  "click",
15
16
  "clusteringbegin",
@@ -22,7 +23,7 @@ const markerClusterer = useGoogleMapsResource({
22
23
  map,
23
24
  ...props.options
24
25
  });
25
- setupEventListeners(clusterer);
26
+ bindGoogleMapsEvents(clusterer, emit, { withPayload: markerClustererEvents });
26
27
  return clusterer;
27
28
  },
28
29
  cleanup(clusterer, { mapsApi }) {
@@ -45,11 +46,6 @@ provide(
45
46
  requestRerender
46
47
  }
47
48
  );
48
- function setupEventListeners(clusterer) {
49
- markerClustererEvents.forEach((event) => {
50
- clusterer.addListener(event, () => emit(event, clusterer));
51
- });
52
- }
53
49
  </script>
54
50
 
55
51
  <template>
@@ -20,7 +20,7 @@ declare const _default: typeof __VLS_export;
20
20
  export default _default;
21
21
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
22
22
  options?: Omit<MarkerClustererOptions, "map">;
23
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
23
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
24
  click: (payload: MarkerClustererInstance) => any;
25
25
  clusteringbegin: (payload: MarkerClustererInstance) => any;
26
26
  clusteringend: (payload: MarkerClustererInstance) => any;
@@ -22,9 +22,9 @@ type __VLS_Slots = {} & {
22
22
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
23
23
  overlay: import("vue").ShallowRef<google.maps.OverlayView | undefined>;
24
24
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
- "update:open": (value: boolean | undefined) => any;
25
+ "update:open": (value: boolean) => any;
26
26
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
- "onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
27
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
28
28
  }>, {
29
29
  anchor: OverlayAnchor;
30
30
  pane: OverlayPane;
@@ -10,7 +10,7 @@ const props = defineProps({
10
10
  zIndex: { type: Number, required: false },
11
11
  blockMapInteraction: { type: Boolean, required: false, default: true }
12
12
  });
13
- const open = defineModel("open", { type: Boolean });
13
+ const open = defineModel("open", { type: Boolean, ...{ default: void 0 } });
14
14
  const markerContext = inject(MARKER_INJECTION_KEY, void 0);
15
15
  const advancedMarkerElementContext = inject(ADVANCED_MARKER_ELEMENT_INJECTION_KEY, void 0);
16
16
  function getResolvedPosition() {
@@ -140,15 +140,7 @@ watch(() => open.value, () => {
140
140
  return;
141
141
  overlay.value.draw();
142
142
  });
143
- watch(() => props.pane, () => {
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
- watch(() => props.blockMapInteraction, () => {
143
+ watch([() => props.pane, () => props.blockMapInteraction], () => {
152
144
  if (overlay.value) {
153
145
  const map = overlay.value.getMap();
154
146
  overlay.value.setMap(null);
@@ -22,9 +22,9 @@ type __VLS_Slots = {} & {
22
22
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
23
23
  overlay: import("vue").ShallowRef<google.maps.OverlayView | undefined>;
24
24
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
- "update:open": (value: boolean | undefined) => any;
25
+ "update:open": (value: boolean) => any;
26
26
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
- "onUpdate:open"?: ((value: boolean | undefined) => any) | undefined;
27
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
28
28
  }>, {
29
29
  anchor: OverlayAnchor;
30
30
  pane: OverlayPane;
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  options?: Omit<google.maps.PolygonOptions, 'map'>;
3
3
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  contextmenu: (payload: google.maps.PolyMouseEvent) => any;
6
6
  click: (payload: google.maps.PolyMouseEvent) => any;
7
7
  dblclick: (payload: google.maps.PolyMouseEvent) => any;
@@ -5,7 +5,7 @@ import { useGoogleMapsResource } from "./useGoogleMapsResource";
5
5
  const props = defineProps({
6
6
  options: { type: Object, required: false }
7
7
  });
8
- const emit = defineEmits([]);
8
+ const emit = defineEmits(["click", "contextmenu", "dblclick", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "drag", "dragend", "dragstart"]);
9
9
  const eventsWithPolyMouseEventPayload = [
10
10
  "click",
11
11
  "contextmenu",
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  options?: Omit<google.maps.PolygonOptions, 'map'>;
3
3
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  contextmenu: (payload: google.maps.PolyMouseEvent) => any;
6
6
  click: (payload: google.maps.PolyMouseEvent) => any;
7
7
  dblclick: (payload: google.maps.PolyMouseEvent) => any;
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  options?: Omit<google.maps.PolylineOptions, 'map'>;
3
3
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  contextmenu: (payload: google.maps.PolyMouseEvent) => any;
6
6
  click: (payload: google.maps.PolyMouseEvent) => any;
7
7
  dblclick: (payload: google.maps.PolyMouseEvent) => any;
@@ -5,7 +5,7 @@ import { useGoogleMapsResource } from "./useGoogleMapsResource";
5
5
  const props = defineProps({
6
6
  options: { type: Object, required: false }
7
7
  });
8
- const emit = defineEmits([]);
8
+ const emit = defineEmits(["click", "contextmenu", "dblclick", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "drag", "dragend", "dragstart"]);
9
9
  const eventsWithPolyMouseEventPayload = [
10
10
  "click",
11
11
  "contextmenu",
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  options?: Omit<google.maps.PolylineOptions, 'map'>;
3
3
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  contextmenu: (payload: google.maps.PolyMouseEvent) => any;
6
6
  click: (payload: google.maps.PolyMouseEvent) => any;
7
7
  dblclick: (payload: google.maps.PolyMouseEvent) => any;
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  options?: Omit<google.maps.RectangleOptions, 'map'>;
3
3
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  contextmenu: (payload: google.maps.MapMouseEvent) => any;
6
6
  click: (payload: google.maps.MapMouseEvent) => any;
7
7
  dblclick: (payload: google.maps.MapMouseEvent) => any;
@@ -5,7 +5,7 @@ import { useGoogleMapsResource } from "./useGoogleMapsResource";
5
5
  const props = defineProps({
6
6
  options: { type: Object, required: false }
7
7
  });
8
- const emit = defineEmits([]);
8
+ const emit = defineEmits(["bounds_changed", "click", "contextmenu", "dblclick", "drag", "dragend", "dragstart", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup"]);
9
9
  const eventsWithoutPayload = [
10
10
  "bounds_changed"
11
11
  ];
@@ -1,7 +1,7 @@
1
1
  type __VLS_Props = {
2
2
  options?: Omit<google.maps.RectangleOptions, 'map'>;
3
3
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  contextmenu: (payload: google.maps.MapMouseEvent) => any;
6
6
  click: (payload: google.maps.MapMouseEvent) => any;
7
7
  dblclick: (payload: google.maps.MapMouseEvent) => any;
@@ -2,6 +2,8 @@ import type { InjectionKey, Ref, ShallowRef } from 'vue';
2
2
  export declare const MAP_INJECTION_KEY: InjectionKey<{
3
3
  map: ShallowRef<google.maps.Map | undefined>;
4
4
  mapsApi: Ref<typeof google.maps | undefined>;
5
+ /** Close the previously active InfoWindow and register a new one as active */
6
+ activateInfoWindow: (iw: google.maps.InfoWindow) => void;
5
7
  }>;
6
8
  export declare const ADVANCED_MARKER_ELEMENT_INJECTION_KEY: InjectionKey<{
7
9
  advancedMarkerElement: ShallowRef<google.maps.marker.AdvancedMarkerElement | undefined>;
@@ -2,7 +2,7 @@ import { resolveTrigger } from "#build/nuxt-scripts-trigger-resolver";
2
2
  import { useScript as _useScript } from "@unhead/vue/scripts";
3
3
  import { defu } from "defu";
4
4
  import { injectHead, onNuxtReady, useHead, useNuxtApp, useRuntimeConfig } from "nuxt/app";
5
- import { ref } from "vue";
5
+ import { markRaw, ref } from "vue";
6
6
  import { logger } from "../logger.js";
7
7
  function ensureScripts(nuxtApp) {
8
8
  if (!nuxtApp.$scripts) {
@@ -157,5 +157,7 @@ export function useScript(input, options) {
157
157
  syncScripts();
158
158
  }
159
159
  }
160
+ markRaw(instance);
161
+ instance.toJSON = () => ({ id: instance.id, status: instance.status.value });
160
162
  return instance;
161
163
  }
@@ -63,7 +63,9 @@ export function useScriptRybbitAnalytics(_options) {
63
63
  identify: (userId) => callOrQueue("identify", userId),
64
64
  clearUserId: () => callOrQueue("clearUserId"),
65
65
  getUserId: () => window.rybbit?.getUserId?.() ?? null,
66
- rybbit: window.rybbit
66
+ get rybbit() {
67
+ return window.rybbit;
68
+ }
67
69
  };
68
70
  }
69
71
  }
@@ -72,6 +72,11 @@ const types = {
72
72
  name: "ScriptCrispProps",
73
73
  kind: "interface",
74
74
  code: "interface ScriptCrispProps {\n /**\n * Defines the trigger event to load the script.\n */\n trigger?: ElementScriptTrigger\n id: string\n runtimeConfig?: {\n locale: string\n }\n tokenId?: string\n cookieDomain?: string\n cookieExpiry?: number\n}"
75
+ },
76
+ {
77
+ name: "ScriptCrispEvents",
78
+ kind: "interface",
79
+ code: "interface ScriptCrispEvents {\n ready: ReturnType<typeof useScriptCrisp>\n error: -\n}"
75
80
  }
76
81
  ],
77
82
  "databuddy-analytics": [
@@ -113,6 +118,11 @@ const types = {
113
118
  name: "ScriptGoogleAdsenseProps",
114
119
  kind: "interface",
115
120
  code: "interface ScriptGoogleAdsenseProps {\n dataAdClient: string\n dataAdSlot: string\n dataAdFormat?: 'auto' | 'rectangle' | 'vertical' | 'horizontal' | 'fluid' | 'autorelaxed'\n dataAdLayout?: 'in-article' | 'in-feed' | 'fixed'\n dataFullWidthResponsive?: boolean\n /**\n * Defines the trigger event to load the script.\n */\n trigger?: ElementScriptTrigger\n}"
121
+ },
122
+ {
123
+ name: "ScriptGoogleAdsenseEvents",
124
+ kind: "interface",
125
+ code: "interface ScriptGoogleAdsenseEvents {\n ready: ReturnType<typeof useScriptGoogleAdsense>\n error: -\n}"
116
126
  }
117
127
  ],
118
128
  "google-analytics": [
@@ -193,6 +203,11 @@ const types = {
193
203
  kind: "interface",
194
204
  code: "interface ScriptGoogleMapsProps {\n /**\n * Defines the trigger event to load the script.\n */\n trigger?: ElementScriptTrigger\n /**\n * Is Google Maps being rendered above the fold?\n * This will load the placeholder image with higher priority.\n */\n aboveTheFold?: boolean\n /**\n * Defines the Google Maps API key. Must have access to the Static Maps API as well.\n */\n apiKey?: string\n /**\n * A latitude / longitude of where to focus the map.\n */\n center?: google.maps.LatLng | google.maps.LatLngLiteral | `${string},${string}`\n /**\n * Zoom level for the map (0-21). Reactive: changing this will update the map.\n * Takes precedence over mapOptions.zoom when provided.\n */\n zoom?: number\n /**\n * Should a marker be displayed on the map where the centre is.\n */\n centerMarker?: boolean\n /**\n * Options for the map.\n */\n mapOptions?: google.maps.MapOptions\n /**\n * Defines the region of the map.\n */\n region?: string\n /**\n * Defines the language of the map\n */\n language?: string\n /**\n * Defines the version of google maps js API\n */\n version?: string\n /**\n * Defines the width of the map.\n */\n width?: number | string\n /**\n * Defines the height of the map\n */\n height?: number | string\n /**\n * Customize the placeholder image attributes.\n *\n * @see https://developers.google.com/maps/documentation/maps-static/start.\n */\n placeholderOptions?: PlaceholderOptions\n /**\n * Customize the placeholder image attributes.\n */\n placeholderAttrs?: ImgHTMLAttributes & ReservedProps & Record<string, unknown>\n /**\n * Customize the root element attributes.\n */\n rootAttrs?: HTMLAttributes & ReservedProps & Record<string, unknown>\n /**\n * Extra Markers to add to the map.\n */\n markers?: (`${string},${string}` | google.maps.marker.AdvancedMarkerElementOptions)[]\n /**\n * Map IDs for light and dark color modes.\n * When provided, the map will automatically switch styles based on color mode.\n * Requires @nuxtjs/color-mode or manual colorMode prop.\n */\n mapIds?: { light?: string, dark?: string }\n /**\n * Manual color mode control. When provided, overrides auto-detection from @nuxtjs/color-mode.\n * Accepts 'light', 'dark', or a reactive ref.\n */\n colorMode?: 'light' | 'dark'\n}"
195
205
  },
206
+ {
207
+ name: "ScriptGoogleMapsEvents",
208
+ kind: "interface",
209
+ code: "interface ScriptGoogleMapsEvents {\n ready: typeof googleMaps\n error: -\n}"
210
+ },
196
211
  {
197
212
  name: "ScriptGoogleMapsAdvancedMarkerElementProps",
198
213
  kind: "interface",
@@ -456,6 +471,11 @@ const types = {
456
471
  name: "ScriptIntercomProps",
457
472
  kind: "interface",
458
473
  code: "interface ScriptIntercomProps {\n appId: string\n apiBase?: string\n name?: string\n email?: string\n userId?: string\n // customizing the messenger\n alignment?: 'left' | 'right'\n horizontalPadding?: number\n verticalPadding?: number\n /**\n * Defines the trigger event to load the script.\n */\n trigger?: ElementScriptTrigger\n}"
474
+ },
475
+ {
476
+ name: "ScriptIntercomEvents",
477
+ kind: "interface",
478
+ code: "interface ScriptIntercomEvents {\n ready: ReturnType<typeof useScriptIntercom>\n error: -\n}"
459
479
  }
460
480
  ],
461
481
  "lemon-squeezy": [
@@ -473,6 +493,11 @@ const types = {
473
493
  name: "ScriptLemonSqueezyProps",
474
494
  kind: "interface",
475
495
  code: "interface ScriptLemonSqueezyProps {\n trigger?: ElementScriptTrigger\n}"
496
+ },
497
+ {
498
+ name: "ScriptLemonSqueezyEvents",
499
+ kind: "interface",
500
+ code: "interface ScriptLemonSqueezyEvents {\n ready: ReturnType<typeof useScriptLemonSqueezy>\n lemonSqueezyEvent: LemonSqueezyEventPayload\n}"
476
501
  }
477
502
  ],
478
503
  "matomo-analytics": [
@@ -564,10 +589,20 @@ const types = {
564
589
  kind: "interface",
565
590
  code: "interface ScriptPayPalButtonsProps {\n /**\n * Customize the root element attributes.\n */\n rootAttrs?: HTMLAttributes & ReservedProps & Record<string, unknown>\n /**\n * Defines the trigger event to load the script.\n */\n trigger?: ElementScriptTrigger\n /**\n * Client ID or client token for PayPal SDK v6 authentication.\n */\n clientId?: string\n /**\n * Server-generated client token for SDK v6.\n */\n clientToken?: string\n /**\n * The v6 SDK components to load.\n * @default ['paypal-payments']\n */\n components?: Components[]\n /**\n * The page type context hint.\n */\n pageType?: PageTypes\n /**\n * The locale for the SDK (BCP-47 code).\n */\n locale?: string\n /**\n * The merchant ID(s).\n */\n merchantId?: string | string[]\n /**\n * Partner attribution ID for revenue sharing.\n */\n partnerAttributionId?: string\n /**\n * The paypal script options.\n */\n paypalScriptOptions?: Partial<PayPalInput>\n}"
566
591
  },
592
+ {
593
+ name: "ScriptPayPalButtonsEvents",
594
+ kind: "interface",
595
+ code: "interface ScriptPayPalButtonsEvents {\n ready: SdkInstance<Components[]>\n error: unknown\n}"
596
+ },
567
597
  {
568
598
  name: "ScriptPayPalMessagesProps",
569
599
  kind: "interface",
570
600
  code: "interface ScriptPayPalMessagesProps {\n /**\n * Customize the root element attributes.\n */\n rootAttrs?: HTMLAttributes & ReservedProps & Record<string, unknown>\n /**\n * Defines the trigger event to load the script.\n */\n trigger?: ElementScriptTrigger\n /**\n * Client ID or client token for PayPal SDK v6 authentication.\n */\n clientId?: string\n /**\n * Server-generated client token for SDK v6.\n */\n clientToken?: string\n /**\n * The merchant ID for the paypal script.\n */\n merchantId?: string | string[]\n /**\n * The partner attribution ID.\n */\n partnerAttributionId?: string\n /**\n * The page type context hint.\n */\n pageType?: PageTypes\n /**\n * The locale for the SDK (BCP-47 code).\n */\n locale?: string\n /**\n * Options for the PayPal Messages session.\n */\n messagesOptions?: PayPalMessagesOptions\n /**\n * The paypal script options.\n */\n paypalScriptOptions?: Partial<PayPalInput>\n}"
601
+ },
602
+ {
603
+ name: "ScriptPayPalMessagesEvents",
604
+ kind: "interface",
605
+ code: "interface ScriptPayPalMessagesEvents {\n ready: PayPalMessagesSession\n error: unknown\n}"
571
606
  }
572
607
  ],
573
608
  "plausible-analytics": [
@@ -712,6 +747,11 @@ const types = {
712
747
  name: "ScriptStripePricingTableProps",
713
748
  kind: "interface",
714
749
  code: "interface ScriptStripePricingTableProps {\n trigger?: ElementScriptTrigger\n publishableKey: string\n pricingTableId: string\n clientReferenceId?: string\n customerEmail?: string\n customerSessionClientSecret?: string\n}"
750
+ },
751
+ {
752
+ name: "ScriptStripePricingTableEvents",
753
+ kind: "interface",
754
+ code: "interface ScriptStripePricingTableEvents {\n ready: ReturnType<typeof useScript>\n error: -\n}"
715
755
  }
716
756
  ],
717
757
  "tiktok-pixel": [
@@ -861,6 +901,11 @@ const types = {
861
901
  name: "ScriptYouTubePlayerProps",
862
902
  kind: "interface",
863
903
  code: "interface ScriptYouTubePlayerProps {\n placeholderAttrs?: ImgHTMLAttributes\n rootAttrs?: HTMLAttributes\n aboveTheFold?: boolean\n trigger?: ElementScriptTrigger\n videoId: string\n playerVars?: YT.PlayerVars\n width?: number\n height?: number\n ratio?: string\n /**\n * Whether to use youtube-nocookie.com for embedding.\n *\n * @default false\n */\n cookies?: boolean\n playerOptions?: YT.PlayerOptions\n thumbnailSize?: YoutubeThumbnailSize\n webp?: boolean\n /**\n * Object-fit for the placeholder image.\n *\n * @default 'cover'\n */\n placeholderObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down'\n}"
904
+ },
905
+ {
906
+ name: "ScriptYouTubePlayerEvents",
907
+ kind: "interface",
908
+ code: "interface ScriptYouTubePlayerEvents {\n ready: YT.PlayerEvent\n state-change: YT.OnStateChangeEvent\n playback-quality-change: YT.OnPlaybackQualityChangeEvent\n playback-rate-change: YT.OnPlaybackRateChangeEvent\n error: YT.OnErrorEvent\n api-change: YT.PlayerEvent\n}"
864
909
  }
865
910
  ],
866
911
  "carbon-ads": [
@@ -868,6 +913,11 @@ const types = {
868
913
  name: "ScriptCarbonAdsProps",
869
914
  kind: "interface",
870
915
  code: "interface ScriptCarbonAdsProps {\n serve: string\n placement: string\n format: string\n /**\n * Defines the trigger event to load the script.\n */\n trigger?: ElementScriptTrigger\n}"
916
+ },
917
+ {
918
+ name: "ScriptCarbonAdsEvents",
919
+ kind: "interface",
920
+ code: "interface ScriptCarbonAdsEvents {\n error: string | Event\n ready: HTMLScriptElement\n}"
871
921
  }
872
922
  ]
873
923
  };
@@ -2111,6 +2161,18 @@ const schemaFields = {
2111
2161
  required: false
2112
2162
  }
2113
2163
  ],
2164
+ ScriptGoogleMapsEvents: [
2165
+ {
2166
+ name: "ready",
2167
+ type: "typeof googleMaps",
2168
+ required: false
2169
+ },
2170
+ {
2171
+ name: "error",
2172
+ type: "-",
2173
+ required: false
2174
+ }
2175
+ ],
2114
2176
  ScriptGoogleMapsAdvancedMarkerElementProps: [
2115
2177
  {
2116
2178
  name: "position",
@@ -2787,6 +2849,18 @@ const schemaFields = {
2787
2849
  required: false
2788
2850
  }
2789
2851
  ],
2852
+ ScriptCarbonAdsEvents: [
2853
+ {
2854
+ name: "error",
2855
+ type: "string | Event",
2856
+ required: false
2857
+ },
2858
+ {
2859
+ name: "ready",
2860
+ type: "HTMLScriptElement",
2861
+ required: false
2862
+ }
2863
+ ],
2790
2864
  ScriptCrispProps: [
2791
2865
  {
2792
2866
  name: "trigger",
@@ -2819,6 +2893,18 @@ const schemaFields = {
2819
2893
  required: false
2820
2894
  }
2821
2895
  ],
2896
+ ScriptCrispEvents: [
2897
+ {
2898
+ name: "ready",
2899
+ type: "ReturnType<typeof useScriptCrisp>",
2900
+ required: false
2901
+ },
2902
+ {
2903
+ name: "error",
2904
+ type: "-",
2905
+ required: false
2906
+ }
2907
+ ],
2822
2908
  ScriptGoogleAdsenseProps: [
2823
2909
  {
2824
2910
  name: "dataAdClient",
@@ -2851,6 +2937,18 @@ const schemaFields = {
2851
2937
  required: false
2852
2938
  }
2853
2939
  ],
2940
+ ScriptGoogleAdsenseEvents: [
2941
+ {
2942
+ name: "ready",
2943
+ type: "ReturnType<typeof useScriptGoogleAdsense>",
2944
+ required: false
2945
+ },
2946
+ {
2947
+ name: "error",
2948
+ type: "-",
2949
+ required: false
2950
+ }
2951
+ ],
2854
2952
  ScriptInstagramEmbedProps: [
2855
2953
  {
2856
2954
  name: "postUrl",
@@ -2920,6 +3018,18 @@ const schemaFields = {
2920
3018
  required: false
2921
3019
  }
2922
3020
  ],
3021
+ ScriptIntercomEvents: [
3022
+ {
3023
+ name: "ready",
3024
+ type: "ReturnType<typeof useScriptIntercom>",
3025
+ required: false
3026
+ },
3027
+ {
3028
+ name: "error",
3029
+ type: "-",
3030
+ required: false
3031
+ }
3032
+ ],
2923
3033
  ScriptLemonSqueezyProps: [
2924
3034
  {
2925
3035
  name: "trigger",
@@ -2927,6 +3037,18 @@ const schemaFields = {
2927
3037
  required: false
2928
3038
  }
2929
3039
  ],
3040
+ ScriptLemonSqueezyEvents: [
3041
+ {
3042
+ name: "ready",
3043
+ type: "ReturnType<typeof useScriptLemonSqueezy>",
3044
+ required: false
3045
+ },
3046
+ {
3047
+ name: "lemonSqueezyEvent",
3048
+ type: "LemonSqueezyEventPayload",
3049
+ required: false
3050
+ }
3051
+ ],
2930
3052
  ScriptPayPalButtonsProps: [
2931
3053
  {
2932
3054
  name: "rootAttrs",
@@ -2979,6 +3101,18 @@ const schemaFields = {
2979
3101
  required: false
2980
3102
  }
2981
3103
  ],
3104
+ ScriptPayPalButtonsEvents: [
3105
+ {
3106
+ name: "ready",
3107
+ type: "SdkInstance<Components[]>",
3108
+ required: false
3109
+ },
3110
+ {
3111
+ name: "error",
3112
+ type: "unknown",
3113
+ required: false
3114
+ }
3115
+ ],
2982
3116
  ScriptPayPalMessagesProps: [
2983
3117
  {
2984
3118
  name: "rootAttrs",
@@ -3031,6 +3165,18 @@ const schemaFields = {
3031
3165
  required: false
3032
3166
  }
3033
3167
  ],
3168
+ ScriptPayPalMessagesEvents: [
3169
+ {
3170
+ name: "ready",
3171
+ type: "PayPalMessagesSession",
3172
+ required: false
3173
+ },
3174
+ {
3175
+ name: "error",
3176
+ type: "unknown",
3177
+ required: false
3178
+ }
3179
+ ],
3034
3180
  ScriptStripePricingTableProps: [
3035
3181
  {
3036
3182
  name: "trigger",
@@ -3063,6 +3209,18 @@ const schemaFields = {
3063
3209
  required: false
3064
3210
  }
3065
3211
  ],
3212
+ ScriptStripePricingTableEvents: [
3213
+ {
3214
+ name: "ready",
3215
+ type: "ReturnType<typeof useScript>",
3216
+ required: false
3217
+ },
3218
+ {
3219
+ name: "error",
3220
+ type: "-",
3221
+ required: false
3222
+ }
3223
+ ],
3066
3224
  ScriptVimeoPlayerProps: [
3067
3225
  {
3068
3226
  name: "trigger",
@@ -3203,6 +3361,38 @@ const schemaFields = {
3203
3361
  type: "'cover' | 'contain' | 'fill' | 'none' | 'scale-down'",
3204
3362
  required: false
3205
3363
  }
3364
+ ],
3365
+ ScriptYouTubePlayerEvents: [
3366
+ {
3367
+ name: "ready",
3368
+ type: "YT.PlayerEvent",
3369
+ required: false
3370
+ },
3371
+ {
3372
+ name: "state-change",
3373
+ type: "YT.OnStateChangeEvent",
3374
+ required: false
3375
+ },
3376
+ {
3377
+ name: "playback-quality-change",
3378
+ type: "YT.OnPlaybackQualityChangeEvent",
3379
+ required: false
3380
+ },
3381
+ {
3382
+ name: "playback-rate-change",
3383
+ type: "YT.OnPlaybackRateChangeEvent",
3384
+ required: false
3385
+ },
3386
+ {
3387
+ name: "error",
3388
+ type: "YT.OnErrorEvent",
3389
+ required: false
3390
+ },
3391
+ {
3392
+ name: "api-change",
3393
+ type: "YT.PlayerEvent",
3394
+ required: false
3395
+ }
3206
3396
  ]
3207
3397
  };
3208
3398
  const registryTypesJson = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/scripts",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.28",
4
+ "version": "1.0.0-beta.29",
5
5
  "description": "Load third-party scripts with better performance, privacy and DX in Nuxt Apps.",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -101,7 +101,7 @@
101
101
  "@vueuse/core": "^14.2.1",
102
102
  "consola": "^3.4.2",
103
103
  "defu": "^6.1.4",
104
- "h3": "^1.15.8",
104
+ "h3": "^1.15.9",
105
105
  "magic-string": "^0.30.21",
106
106
  "ofetch": "^1.5.1",
107
107
  "ohash": "^2.0.11",
@@ -123,7 +123,7 @@
123
123
  "@nuxt/module-builder": "^1.0.2",
124
124
  "@nuxt/test-utils": "^4.0.0",
125
125
  "@nuxtjs/partytown": "^2.0.0",
126
- "@paypal/paypal-js": "^9.4.0",
126
+ "@paypal/paypal-js": "^9.4.1",
127
127
  "@types/jest-image-snapshot": "^6.4.1",
128
128
  "@types/semver": "^7.7.1",
129
129
  "@types/youtube": "^0.1.2",
@@ -131,20 +131,20 @@
131
131
  "@vue/test-utils": "^2.4.6",
132
132
  "bumpp": "^11.0.1",
133
133
  "eslint": "^10.0.3",
134
- "eslint-plugin-harlanzw": "^0.8.0",
134
+ "eslint-plugin-harlanzw": "^0.9.0",
135
135
  "happy-dom": "^20.8.4",
136
136
  "jest-image-snapshot": "^6.5.2",
137
137
  "knitwork": "^1.3.0",
138
138
  "nuxt": "^4.4.2",
139
139
  "playwright-core": "^1.58.2",
140
- "posthog-js": "^1.362.0",
140
+ "posthog-js": "^1.363.1",
141
141
  "shiki": "^4.0.2",
142
142
  "typescript": "^5.9.3",
143
143
  "vitest": "^4.1.0",
144
144
  "vue": "^3.5.30",
145
- "vue-router": "^5.0.3",
145
+ "vue-router": "^5.0.4",
146
146
  "vue-tsc": "^3.2.6",
147
- "@nuxt/scripts": "1.0.0-beta.28"
147
+ "@nuxt/scripts": "1.0.0-beta.29"
148
148
  },
149
149
  "resolutions": {
150
150
  "@nuxt/scripts": "workspace:*"
@@ -1 +0,0 @@
1
- {"id":"3ca2fe82-918c-4528-826c-0bf9ff54a5fa","timestamp":1773987199411,"prerendered":[]}