@nuxt/scripts 1.0.0-beta.25 → 1.0.0-beta.26

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 (32) 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/33e1ac0e-aba1-4856-8beb-775c426be236.json +1 -0
  5. package/dist/client/index.html +1 -1
  6. package/dist/module.json +1 -1
  7. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +2 -5
  8. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +14 -15
  9. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +2 -5
  10. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +1 -4
  11. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +30 -41
  12. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +1 -4
  13. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +19 -28
  14. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +18 -22
  15. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +30 -37
  16. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +1 -4
  17. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +31 -36
  18. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +1 -4
  19. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +17 -22
  20. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +19 -28
  21. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +19 -28
  22. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue +19 -28
  23. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue +19 -28
  24. package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +11 -0
  25. package/dist/runtime/components/GoogleMaps/injectionKeys.js +3 -0
  26. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +26 -0
  27. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +37 -0
  28. package/dist/stats.d.mts +18 -1
  29. package/dist/stats.d.ts +18 -1
  30. package/dist/stats.mjs +833 -248
  31. package/package.json +5 -5
  32. package/dist/client/_nuxt/builds/meta/2ec0342e-5e00-4781-82aa-c3c0f9154516.json +0 -1
@@ -1,41 +1,32 @@
1
1
  <script setup>
2
- import { whenever } from "@vueuse/core";
3
- import { inject, onUnmounted, shallowRef } from "vue";
4
- import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
5
- import { ADVANCED_MARKER_ELEMENT_INJECTION_KEY } from "./ScriptGoogleMapsAdvancedMarkerElement.vue";
2
+ import { inject, watch } from "vue";
3
+ import { ADVANCED_MARKER_ELEMENT_INJECTION_KEY } from "./injectionKeys";
4
+ import { useGoogleMapsResource } from "./useGoogleMapsResource";
6
5
  const props = defineProps({
7
6
  options: { type: Object, required: false }
8
7
  });
9
- const mapContext = inject(MAP_INJECTION_KEY, void 0);
10
8
  const advancedMarkerElementContext = inject(ADVANCED_MARKER_ELEMENT_INJECTION_KEY, void 0);
11
- const pinElement = shallowRef(void 0);
12
- whenever(
13
- () => mapContext?.map.value && mapContext.mapsApi.value && advancedMarkerElementContext?.advancedMarkerElement.value,
14
- async () => {
15
- await mapContext.mapsApi.value.importLibrary("marker");
16
- pinElement.value = new mapContext.mapsApi.value.marker.PinElement(props.options);
9
+ const pinElement = useGoogleMapsResource({
10
+ ready: () => !!advancedMarkerElementContext?.advancedMarkerElement.value,
11
+ async create({ mapsApi }) {
12
+ await mapsApi.importLibrary("marker");
13
+ const pin = new mapsApi.marker.PinElement(props.options);
17
14
  if (advancedMarkerElementContext?.advancedMarkerElement.value) {
18
- advancedMarkerElementContext.advancedMarkerElement.value.content = pinElement.value.element;
15
+ advancedMarkerElementContext.advancedMarkerElement.value.content = pin.element;
19
16
  }
20
- whenever(() => props.options, (options) => {
21
- if (pinElement.value && options) {
22
- Object.assign(pinElement.value, options);
23
- }
24
- }, {
25
- deep: true
26
- });
17
+ return pin;
27
18
  },
28
- {
29
- immediate: true,
30
- once: true
31
- }
32
- );
33
- onUnmounted(() => {
34
- if (advancedMarkerElementContext?.advancedMarkerElement.value && pinElement.value) {
35
- advancedMarkerElementContext.advancedMarkerElement.value.content = null;
19
+ cleanup() {
20
+ if (advancedMarkerElementContext?.advancedMarkerElement.value) {
21
+ advancedMarkerElementContext.advancedMarkerElement.value.content = null;
22
+ }
36
23
  }
37
- pinElement.value = void 0;
38
24
  });
25
+ watch(() => props.options, (options) => {
26
+ if (pinElement.value && options) {
27
+ Object.assign(pinElement.value, options);
28
+ }
29
+ }, { deep: true });
39
30
  </script>
40
31
 
41
32
  <template>
@@ -1,7 +1,6 @@
1
1
  <script setup>
2
- import { whenever } from "@vueuse/core";
3
- import { inject, onUnmounted } from "vue";
4
- import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
2
+ import { watch } from "vue";
3
+ import { useGoogleMapsResource } from "./useGoogleMapsResource";
5
4
  const props = defineProps({
6
5
  options: { type: Object, required: false }
7
6
  });
@@ -21,36 +20,28 @@ const eventsWithMapMouseEventPayload = [
21
20
  "dragend",
22
21
  "dragstart"
23
22
  ];
24
- const mapContext = inject(MAP_INJECTION_KEY, void 0);
25
- let polygon;
26
- whenever(() => mapContext?.map.value && mapContext.mapsApi.value, () => {
27
- polygon = new mapContext.mapsApi.value.Polygon({
28
- map: mapContext.map.value,
29
- ...props.options
30
- });
31
- setupPolygonEventListeners(polygon);
32
- whenever(() => props.options, (options) => {
33
- polygon?.setOptions(options);
34
- }, {
35
- deep: true
36
- });
37
- }, {
38
- immediate: true,
39
- once: true
40
- });
41
- onUnmounted(() => {
42
- if (!polygon || !mapContext?.mapsApi.value) {
43
- return;
23
+ const polygon = useGoogleMapsResource({
24
+ create({ mapsApi, map }) {
25
+ const p = new mapsApi.Polygon({ map, ...props.options });
26
+ setupEventListeners(p);
27
+ return p;
28
+ },
29
+ cleanup(p, { mapsApi }) {
30
+ mapsApi.event.clearInstanceListeners(p);
31
+ p.setMap(null);
44
32
  }
45
- mapContext.mapsApi.value.event.clearInstanceListeners(polygon);
46
- polygon.setMap(null);
47
33
  });
48
- function setupPolygonEventListeners(polygon2) {
34
+ watch(() => props.options, (options) => {
35
+ if (polygon.value && options) {
36
+ polygon.value.setOptions(options);
37
+ }
38
+ }, { deep: true });
39
+ function setupEventListeners(p) {
49
40
  eventsWithPolyMouseEventPayload.forEach((event) => {
50
- polygon2.addListener(event, (payload) => emit(event, payload));
41
+ p.addListener(event, (payload) => emit(event, payload));
51
42
  });
52
43
  eventsWithMapMouseEventPayload.forEach((event) => {
53
- polygon2.addListener(event, (payload) => emit(event, payload));
44
+ p.addListener(event, (payload) => emit(event, payload));
54
45
  });
55
46
  }
56
47
  </script>
@@ -1,7 +1,6 @@
1
1
  <script setup>
2
- import { whenever } from "@vueuse/core";
3
- import { inject, onUnmounted } from "vue";
4
- import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
2
+ import { watch } from "vue";
3
+ import { useGoogleMapsResource } from "./useGoogleMapsResource";
5
4
  const props = defineProps({
6
5
  options: { type: Object, required: false }
7
6
  });
@@ -21,36 +20,28 @@ const eventsWithMapMouseEventPayload = [
21
20
  "dragend",
22
21
  "dragstart"
23
22
  ];
24
- const mapContext = inject(MAP_INJECTION_KEY, void 0);
25
- let polyline;
26
- whenever(() => mapContext?.map.value && mapContext.mapsApi.value, () => {
27
- polyline = new mapContext.mapsApi.value.Polyline({
28
- map: mapContext.map.value,
29
- ...props.options
30
- });
31
- setupPolylineEventListeners(polyline);
32
- whenever(() => props.options, (options) => {
33
- polyline?.setOptions(options);
34
- }, {
35
- deep: true
36
- });
37
- }, {
38
- immediate: true,
39
- once: true
40
- });
41
- onUnmounted(() => {
42
- if (!polyline || !mapContext?.mapsApi.value) {
43
- return;
23
+ const polyline = useGoogleMapsResource({
24
+ create({ mapsApi, map }) {
25
+ const p = new mapsApi.Polyline({ map, ...props.options });
26
+ setupEventListeners(p);
27
+ return p;
28
+ },
29
+ cleanup(p, { mapsApi }) {
30
+ mapsApi.event.clearInstanceListeners(p);
31
+ p.setMap(null);
44
32
  }
45
- mapContext.mapsApi.value.event.clearInstanceListeners(polyline);
46
- polyline.setMap(null);
47
33
  });
48
- function setupPolylineEventListeners(polyline2) {
34
+ watch(() => props.options, (options) => {
35
+ if (polyline.value && options) {
36
+ polyline.value.setOptions(options);
37
+ }
38
+ }, { deep: true });
39
+ function setupEventListeners(p) {
49
40
  eventsWithPolyMouseEventPayload.forEach((event) => {
50
- polyline2.addListener(event, (payload) => emit(event, payload));
41
+ p.addListener(event, (payload) => emit(event, payload));
51
42
  });
52
43
  eventsWithMapMouseEventPayload.forEach((event) => {
53
- polyline2.addListener(event, (payload) => emit(event, payload));
44
+ p.addListener(event, (payload) => emit(event, payload));
54
45
  });
55
46
  }
56
47
  </script>
@@ -1,7 +1,6 @@
1
1
  <script setup>
2
- import { whenever } from "@vueuse/core";
3
- import { inject, onUnmounted } from "vue";
4
- import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
2
+ import { watch } from "vue";
3
+ import { useGoogleMapsResource } from "./useGoogleMapsResource";
5
4
  const props = defineProps({
6
5
  options: { type: Object, required: false }
7
6
  });
@@ -22,36 +21,28 @@ const eventsWithMapMouseEventPayload = [
22
21
  "mouseover",
23
22
  "mouseup"
24
23
  ];
25
- const mapContext = inject(MAP_INJECTION_KEY, void 0);
26
- let rectangle;
27
- whenever(() => mapContext?.map.value && mapContext.mapsApi.value, () => {
28
- rectangle = new mapContext.mapsApi.value.Rectangle({
29
- map: mapContext.map.value,
30
- ...props.options
31
- });
32
- setupRectangleEventListeners(rectangle);
33
- whenever(() => props.options, (options) => {
34
- rectangle?.setOptions(options);
35
- }, {
36
- deep: true
37
- });
38
- }, {
39
- immediate: true,
40
- once: true
41
- });
42
- onUnmounted(() => {
43
- if (!rectangle || !mapContext?.mapsApi.value) {
44
- return;
24
+ const rectangle = useGoogleMapsResource({
25
+ create({ mapsApi, map }) {
26
+ const r = new mapsApi.Rectangle({ map, ...props.options });
27
+ setupEventListeners(r);
28
+ return r;
29
+ },
30
+ cleanup(r, { mapsApi }) {
31
+ mapsApi.event.clearInstanceListeners(r);
32
+ r.setMap(null);
45
33
  }
46
- mapContext.mapsApi.value.event.clearInstanceListeners(rectangle);
47
- rectangle.setMap(null);
48
34
  });
49
- function setupRectangleEventListeners(rectangle2) {
35
+ watch(() => props.options, (options) => {
36
+ if (rectangle.value && options) {
37
+ rectangle.value.setOptions(options);
38
+ }
39
+ }, { deep: true });
40
+ function setupEventListeners(r) {
50
41
  eventsWithoutPayload.forEach((event) => {
51
- rectangle2.addListener(event, () => emit(event));
42
+ r.addListener(event, () => emit(event));
52
43
  });
53
44
  eventsWithMapMouseEventPayload.forEach((event) => {
54
- rectangle2.addListener(event, (payload) => emit(event, payload));
45
+ r.addListener(event, (payload) => emit(event, payload));
55
46
  });
56
47
  }
57
48
  </script>
@@ -0,0 +1,11 @@
1
+ import type { InjectionKey, Ref, ShallowRef } from 'vue';
2
+ export declare const MAP_INJECTION_KEY: InjectionKey<{
3
+ map: ShallowRef<google.maps.Map | undefined>;
4
+ mapsApi: Ref<typeof google.maps | undefined>;
5
+ }>;
6
+ export declare const ADVANCED_MARKER_ELEMENT_INJECTION_KEY: InjectionKey<{
7
+ advancedMarkerElement: ShallowRef<google.maps.marker.AdvancedMarkerElement | undefined>;
8
+ }>;
9
+ export declare const MARKER_INJECTION_KEY: InjectionKey<{
10
+ marker: ShallowRef<google.maps.Marker | undefined>;
11
+ }>;
@@ -0,0 +1,3 @@
1
+ export const MAP_INJECTION_KEY = Symbol("map");
2
+ export const ADVANCED_MARKER_ELEMENT_INJECTION_KEY = Symbol("marker");
3
+ export const MARKER_INJECTION_KEY = Symbol("marker");
@@ -0,0 +1,26 @@
1
+ import type { ShallowRef } from 'vue';
2
+ export interface GoogleMapsResourceContext {
3
+ map: google.maps.Map;
4
+ mapsApi: typeof google.maps;
5
+ }
6
+ /**
7
+ * Composable for safely managing Google Maps resource lifecycle.
8
+ *
9
+ * Handles the common pattern: wait for map readiness → async create → cleanup on unmount.
10
+ *
11
+ * Safety guarantees:
12
+ * - No watchers created after `await` (prevents orphaned watchers that leak memory)
13
+ * - Unmount guard prevents resource creation after component unmount
14
+ * - Resources created during the async gap are immediately cleaned up
15
+ * - Resource ref is always nulled on unmount to allow GC
16
+ */
17
+ export declare function useGoogleMapsResource<T>({ ready, create, cleanup, }: {
18
+ /** Additional readiness condition beyond map + mapsApi being available */
19
+ ready?: () => boolean;
20
+ /** Create the Google Maps resource. Receives map context snapshot. May be async. */
21
+ create: (ctx: GoogleMapsResourceContext) => Promise<T> | T;
22
+ /** Clean up the resource. Called on unmount, or immediately if resource was created after unmount. */
23
+ cleanup?: (resource: T, ctx: {
24
+ mapsApi: typeof google.maps;
25
+ }) => void;
26
+ }): ShallowRef<T | undefined>;
@@ -0,0 +1,37 @@
1
+ import { whenever } from "@vueuse/core";
2
+ import { inject, onUnmounted, ref, shallowRef } from "vue";
3
+ import { MAP_INJECTION_KEY } from "./injectionKeys.js";
4
+ export function useGoogleMapsResource({
5
+ ready,
6
+ create,
7
+ cleanup
8
+ }) {
9
+ const mapContext = inject(MAP_INJECTION_KEY, void 0);
10
+ const resource = shallowRef(void 0);
11
+ const isUnmounted = ref(false);
12
+ whenever(
13
+ () => mapContext?.map.value && mapContext.mapsApi.value && (!ready || ready()),
14
+ async () => {
15
+ const result = await create({
16
+ map: mapContext.map.value,
17
+ mapsApi: mapContext.mapsApi.value
18
+ });
19
+ if (isUnmounted.value) {
20
+ if (cleanup && mapContext?.mapsApi.value) {
21
+ cleanup(result, { mapsApi: mapContext.mapsApi.value });
22
+ }
23
+ return;
24
+ }
25
+ resource.value = result;
26
+ },
27
+ { immediate: true, once: true }
28
+ );
29
+ onUnmounted(() => {
30
+ isUnmounted.value = true;
31
+ if (resource.value && cleanup && mapContext?.mapsApi.value) {
32
+ cleanup(resource.value, { mapsApi: mapContext.mapsApi.value });
33
+ }
34
+ resource.value = void 0;
35
+ });
36
+ return resource;
37
+ }
package/dist/stats.d.mts CHANGED
@@ -26,11 +26,26 @@ interface ScriptApis {
26
26
  webgl: boolean;
27
27
  audioContext: boolean;
28
28
  userAgent: boolean;
29
+ doNotTrack: boolean;
29
30
  hardwareConcurrency: boolean;
30
31
  deviceMemory: boolean;
31
32
  plugins: boolean;
32
33
  languages: boolean;
33
34
  screen: boolean;
35
+ timezone: boolean;
36
+ platform: boolean;
37
+ vendor: boolean;
38
+ connection: boolean;
39
+ maxTouchPoints: boolean;
40
+ devicePixelRatio: boolean;
41
+ mediaDevices: boolean;
42
+ getBattery: boolean;
43
+ referrer: boolean;
44
+ windowName: boolean;
45
+ rtcPeerConnection: boolean;
46
+ geolocation: boolean;
47
+ serviceWorker: boolean;
48
+ cacheApi: boolean;
34
49
  sendBeacon: boolean;
35
50
  fetch: boolean;
36
51
  xhr: boolean;
@@ -44,8 +59,10 @@ interface ApiPrivacyScore {
44
59
  score: number;
45
60
  /** Persistence APIs used (cookies, localStorage, sessionStorage, indexedDB) */
46
61
  persistence: number;
47
- /** Fingerprinting APIs used (canvas, webgl, audioContext, deviceMemory, hardwareConcurrency, plugins, screen, userAgent, languages) */
62
+ /** Fingerprinting APIs used (canvas, webgl, audioContext, deviceMemory, hardwareConcurrency, plugins, screen, userAgent, languages, timezone, platform, vendor, connection, maxTouchPoints, devicePixelRatio, mediaDevices, getBattery) */
48
63
  fingerprinting: number;
64
+ /** Tracking APIs used (referrer, windowName, rtcPeerConnection, geolocation, serviceWorker, cacheApi) */
65
+ tracking: number;
49
66
  /** Behavioral monitoring APIs used (mutationObserver, intersectionObserver) */
50
67
  monitoring: number;
51
68
  }
package/dist/stats.d.ts CHANGED
@@ -26,11 +26,26 @@ interface ScriptApis {
26
26
  webgl: boolean;
27
27
  audioContext: boolean;
28
28
  userAgent: boolean;
29
+ doNotTrack: boolean;
29
30
  hardwareConcurrency: boolean;
30
31
  deviceMemory: boolean;
31
32
  plugins: boolean;
32
33
  languages: boolean;
33
34
  screen: boolean;
35
+ timezone: boolean;
36
+ platform: boolean;
37
+ vendor: boolean;
38
+ connection: boolean;
39
+ maxTouchPoints: boolean;
40
+ devicePixelRatio: boolean;
41
+ mediaDevices: boolean;
42
+ getBattery: boolean;
43
+ referrer: boolean;
44
+ windowName: boolean;
45
+ rtcPeerConnection: boolean;
46
+ geolocation: boolean;
47
+ serviceWorker: boolean;
48
+ cacheApi: boolean;
34
49
  sendBeacon: boolean;
35
50
  fetch: boolean;
36
51
  xhr: boolean;
@@ -44,8 +59,10 @@ interface ApiPrivacyScore {
44
59
  score: number;
45
60
  /** Persistence APIs used (cookies, localStorage, sessionStorage, indexedDB) */
46
61
  persistence: number;
47
- /** Fingerprinting APIs used (canvas, webgl, audioContext, deviceMemory, hardwareConcurrency, plugins, screen, userAgent, languages) */
62
+ /** Fingerprinting APIs used (canvas, webgl, audioContext, deviceMemory, hardwareConcurrency, plugins, screen, userAgent, languages, timezone, platform, vendor, connection, maxTouchPoints, devicePixelRatio, mediaDevices, getBattery) */
48
63
  fingerprinting: number;
64
+ /** Tracking APIs used (referrer, windowName, rtcPeerConnection, geolocation, serviceWorker, cacheApi) */
65
+ tracking: number;
49
66
  /** Behavioral monitoring APIs used (mutationObserver, intersectionObserver) */
50
67
  monitoring: number;
51
68
  }