@nuxt/scripts 1.3.5 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/THIRD_PARTY_LICENSES.md +124 -0
  2. package/dist/devtools-client/200.html +1 -1
  3. package/dist/devtools-client/404.html +1 -1
  4. package/dist/devtools-client/_nuxt/{B551Pnuh.js → 2p1_IuX2.js} +1 -1
  5. package/dist/devtools-client/_nuxt/{KxC4Q3ev.js → 9elIQxwW.js} +1 -1
  6. package/dist/devtools-client/_nuxt/{DTP8MRtW.js → BNPn63Jz.js} +1 -1
  7. package/dist/devtools-client/_nuxt/BjRLaDIG.js +152 -0
  8. package/dist/devtools-client/_nuxt/BtNUYBXT.js +8 -0
  9. package/dist/devtools-client/_nuxt/CDDBpkXG.js +3 -0
  10. package/dist/devtools-client/_nuxt/Cpb0XAYP.js +1 -0
  11. package/dist/devtools-client/_nuxt/DAsiyhPm.js +6 -0
  12. package/dist/devtools-client/_nuxt/{VICyrUSM.js → DabLKy7M.js} +1 -1
  13. package/dist/devtools-client/_nuxt/Dat651Oh.js +1 -0
  14. package/dist/devtools-client/_nuxt/DcG2ZXvY.js +1 -0
  15. package/dist/devtools-client/_nuxt/DmlGWZ2X.js +1 -0
  16. package/dist/devtools-client/_nuxt/KsX6Az5B.js +1 -0
  17. package/dist/devtools-client/_nuxt/RL1np866.js +28 -0
  18. package/dist/devtools-client/_nuxt/UmWNrBO5.js +2 -0
  19. package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
  20. package/dist/devtools-client/_nuxt/builds/meta/e28b96f1-78e8-41a4-ad6f-904cd078f85e.json +1 -0
  21. package/dist/devtools-client/_nuxt/{entry.CYUdJFoE.css → entry.9HJPJ6Hp.css} +1 -1
  22. package/dist/devtools-client/_nuxt/error-404.DnwL1N6v.css +1 -0
  23. package/dist/devtools-client/_nuxt/error-500.DEbXRLdm.css +1 -0
  24. package/dist/devtools-client/docs/index.html +1 -1
  25. package/dist/devtools-client/first-party/index.html +1 -1
  26. package/dist/devtools-client/index.html +1 -1
  27. package/dist/devtools-client/registry/index.html +1 -1
  28. package/dist/module.d.mts +2 -86
  29. package/dist/module.d.ts +2 -86
  30. package/dist/module.json +3 -3
  31. package/dist/module.mjs +71 -328
  32. package/dist/registry.mjs +54 -22
  33. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +1 -28
  34. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +7 -50
  35. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +1 -28
  36. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +0 -8
  37. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +1 -13
  38. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +0 -8
  39. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.d.vue.ts +4 -4
  40. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue +9 -15
  41. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue.d.ts +4 -4
  42. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +0 -22
  43. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +0 -31
  44. package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.d.vue.ts +31 -0
  45. package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.vue +43 -0
  46. package/dist/runtime/components/Leaflet/ScriptLeafletGeoJson.vue.d.ts +31 -0
  47. package/dist/runtime/components/Leaflet/ScriptLeafletMap.d.vue.ts +90 -0
  48. package/dist/runtime/components/Leaflet/ScriptLeafletMap.vue +171 -0
  49. package/dist/runtime/components/Leaflet/ScriptLeafletMap.vue.d.ts +90 -0
  50. package/dist/runtime/components/Leaflet/ScriptLeafletMarker.d.vue.ts +47 -0
  51. package/dist/runtime/components/Leaflet/ScriptLeafletMarker.vue +70 -0
  52. package/dist/runtime/components/Leaflet/ScriptLeafletMarker.vue.d.ts +47 -0
  53. package/dist/runtime/components/Leaflet/ScriptLeafletPopup.d.vue.ts +31 -0
  54. package/dist/runtime/components/Leaflet/ScriptLeafletPopup.vue +81 -0
  55. package/dist/runtime/components/Leaflet/ScriptLeafletPopup.vue.d.ts +31 -0
  56. package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.d.vue.ts +26 -0
  57. package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.vue +38 -0
  58. package/dist/runtime/components/Leaflet/ScriptLeafletTileLayer.vue.d.ts +26 -0
  59. package/dist/runtime/components/Leaflet/useLeafletResource.d.ts +30 -0
  60. package/dist/runtime/components/Leaflet/useLeafletResource.js +46 -0
  61. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.d.vue.ts +39 -0
  62. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue +84 -0
  63. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue.d.ts +39 -0
  64. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.d.vue.ts +122 -0
  65. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue +214 -0
  66. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue.d.ts +122 -0
  67. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.d.vue.ts +35 -0
  68. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.vue +98 -0
  69. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.vue.d.ts +35 -0
  70. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.d.vue.ts +12 -0
  71. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue +23 -0
  72. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue.d.ts +12 -0
  73. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.d.vue.ts +31 -0
  74. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.vue +99 -0
  75. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.vue.d.ts +31 -0
  76. package/dist/runtime/components/MapLibre/useMapLibreResource.d.ts +23 -0
  77. package/dist/runtime/components/MapLibre/useMapLibreResource.js +41 -0
  78. package/dist/runtime/components/ScriptCrisp.vue +20 -18
  79. package/dist/runtime/components/ScriptDeskCrew.d.vue.ts +40 -0
  80. package/dist/runtime/components/ScriptDeskCrew.vue +82 -0
  81. package/dist/runtime/components/ScriptDeskCrew.vue.d.ts +40 -0
  82. package/dist/runtime/components/ScriptIntercom.vue +21 -19
  83. package/dist/runtime/components/ScriptLoadingIndicator.d.vue.ts +1 -1
  84. package/dist/runtime/components/ScriptLoadingIndicator.vue.d.ts +1 -1
  85. package/dist/runtime/components/ScriptPayPalButtons.vue +7 -3
  86. package/dist/runtime/components/ScriptPayPalMessages.vue +8 -4
  87. package/dist/runtime/composables/useScript.js +96 -49
  88. package/dist/runtime/composables/useScriptProxyUrl.d.ts +4 -8
  89. package/dist/runtime/composables/useScriptProxyUrl.js +0 -7
  90. package/dist/runtime/composables/useScriptTriggerIdleTimeout.d.ts +2 -1
  91. package/dist/runtime/composables/useScriptTriggerIdleTimeout.js +3 -34
  92. package/dist/runtime/composables/useScriptTriggerInteraction.d.ts +2 -1
  93. package/dist/runtime/composables/useScriptTriggerInteraction.js +13 -46
  94. package/dist/runtime/composables/useScriptTriggerServiceWorker.d.ts +2 -1
  95. package/dist/runtime/composables/useScriptTriggerServiceWorker.js +5 -38
  96. package/dist/runtime/leaflet-styles.d.ts +13 -0
  97. package/dist/runtime/leaflet-styles.js +684 -0
  98. package/dist/runtime/maplibre-styles.d.ts +7 -0
  99. package/dist/runtime/maplibre-styles.js +25 -0
  100. package/dist/runtime/npm-script-api-state.d.ts +4 -0
  101. package/dist/runtime/npm-script-api-state.js +13 -0
  102. package/dist/runtime/registry/crisp.d.ts +1 -1
  103. package/dist/runtime/registry/crisp.js +30 -18
  104. package/dist/runtime/registry/deskcrew.d.ts +52 -0
  105. package/dist/runtime/registry/deskcrew.js +31 -0
  106. package/dist/runtime/registry/google-analytics.d.ts +0 -2
  107. package/dist/runtime/registry/google-maps.d.ts +2 -11
  108. package/dist/runtime/registry/google-maps.js +31 -10
  109. package/dist/runtime/registry/google-tag-manager.d.ts +9 -3
  110. package/dist/runtime/registry/leaflet.d.ts +13 -0
  111. package/dist/runtime/registry/leaflet.js +29 -0
  112. package/dist/runtime/registry/maplibre.d.ts +13 -0
  113. package/dist/runtime/registry/maplibre.js +29 -0
  114. package/dist/runtime/registry/matomo-analytics.js +1 -8
  115. package/dist/runtime/registry/plausible-analytics.d.ts +4 -16
  116. package/dist/runtime/registry/plausible-analytics.js +15 -58
  117. package/dist/runtime/registry/rybbit-analytics.d.ts +0 -4
  118. package/dist/runtime/registry/rybbit-analytics.js +1 -4
  119. package/dist/runtime/registry/schemas.d.ts +61 -5
  120. package/dist/runtime/registry/schemas.js +64 -5
  121. package/dist/runtime/registry/tiktok-pixel.d.ts +2 -12
  122. package/dist/runtime/registry/tiktok-pixel.js +1 -1
  123. package/dist/runtime/registry/usercentrics.js +46 -6
  124. package/dist/runtime/registry/youtube-player.d.ts +3 -4
  125. package/dist/runtime/registry/youtube-player.js +30 -23
  126. package/dist/runtime/server/bluesky-embed-image.d.ts +1 -1
  127. package/dist/runtime/server/bluesky-embed.d.ts +1 -1
  128. package/dist/runtime/server/bluesky-embed.js +3 -6
  129. package/dist/runtime/server/gravatar-proxy.d.ts +1 -1
  130. package/dist/runtime/server/gravatar-proxy.js +2 -3
  131. package/dist/runtime/server/instagram-embed-asset.d.ts +1 -1
  132. package/dist/runtime/server/instagram-embed-image.d.ts +1 -1
  133. package/dist/runtime/server/instagram-embed.d.ts +1 -1
  134. package/dist/runtime/server/instagram-embed.js +4 -7
  135. package/dist/runtime/server/utils/cached-upstream.d.ts +6 -11
  136. package/dist/runtime/server/utils/cached-upstream.js +94 -23
  137. package/dist/runtime/server/utils/embed-rewriters.d.ts +3 -5
  138. package/dist/runtime/server/utils/embed-rewriters.js +8 -8
  139. package/dist/runtime/server/utils/image-proxy.d.ts +1 -1
  140. package/dist/runtime/server/utils/image-proxy.js +2 -3
  141. package/dist/runtime/server/utils/instagram-embed.d.ts +6 -6
  142. package/dist/runtime/server/utils/instagram-embed.js +18 -19
  143. package/dist/runtime/server/utils/proxy-url.d.ts +5 -6
  144. package/dist/runtime/server/utils/proxy-url.js +1 -4
  145. package/dist/runtime/server/x-embed-image.d.ts +1 -1
  146. package/dist/runtime/server/x-embed.d.ts +48 -1
  147. package/dist/runtime/server/x-embed.js +3 -6
  148. package/dist/runtime/types.d.ts +13 -13
  149. package/dist/runtime/utils/abortable-promise.js +26 -5
  150. package/dist/runtime/utils/nuxt-ready-script-trigger.d.ts +3 -0
  151. package/dist/runtime/utils/nuxt-ready-script-trigger.js +16 -0
  152. package/dist/runtime/utils.js +21 -32
  153. package/dist/stats.mjs +13 -0
  154. package/dist/types-source.mjs +1173 -100
  155. package/dist/types.d.mts +2 -2
  156. package/package.json +34 -21
  157. package/LICENSE.md +0 -9
  158. package/bin/cli.mjs +0 -2
  159. package/dist/cli.d.mts +0 -2
  160. package/dist/cli.d.ts +0 -2
  161. package/dist/cli.mjs +0 -50
  162. package/dist/devtools-client/_nuxt/8ltZ0o6d.js +0 -1
  163. package/dist/devtools-client/_nuxt/B8_EBdhg.js +0 -152
  164. package/dist/devtools-client/_nuxt/BKdLzFmX.js +0 -3
  165. package/dist/devtools-client/_nuxt/Bf2Kt1P0.js +0 -28
  166. package/dist/devtools-client/_nuxt/CC0GKROJ.js +0 -1
  167. package/dist/devtools-client/_nuxt/CH5oUfNi.js +0 -1
  168. package/dist/devtools-client/_nuxt/CMXzQxJZ.js +0 -1
  169. package/dist/devtools-client/_nuxt/CP7c-Js6.js +0 -8
  170. package/dist/devtools-client/_nuxt/C_v3_O0R.js +0 -6
  171. package/dist/devtools-client/_nuxt/CxN78VhB.js +0 -1
  172. package/dist/devtools-client/_nuxt/Dkc7iTdR.js +0 -1
  173. package/dist/devtools-client/_nuxt/builds/meta/173480db-0944-415b-962d-d619682f0042.json +0 -1
  174. package/dist/devtools-client/_nuxt/error-404.Bq2JQbJs.css +0 -1
  175. package/dist/devtools-client/_nuxt/error-500.5E_FOzlc.css +0 -1
  176. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +0 -13
  177. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +0 -15
  178. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +0 -13
  179. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.d.vue.ts +0 -27
  180. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +0 -34
  181. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue.d.ts +0 -27
  182. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.d.vue.ts +0 -13
  183. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +0 -11
  184. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue.d.ts +0 -13
  185. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.d.ts +0 -13
  186. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.js +0 -8
  187. package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +0 -10
  188. package/dist/runtime/components/GoogleMaps/injectionKeys.js +0 -2
  189. package/dist/runtime/composables/useScriptProxyToken.d.ts +0 -12
  190. package/dist/runtime/composables/useScriptProxyToken.js +0 -4
  191. package/dist/runtime/npm-script-stub.d.ts +0 -20
  192. package/dist/runtime/npm-script-stub.js +0 -72
  193. package/dist/runtime/plugins/proxy-token.server.d.ts +0 -10
  194. package/dist/runtime/plugins/proxy-token.server.js +0 -17
  195. package/dist/runtime/server/google-maps-geocode-proxy.d.ts +0 -2
  196. package/dist/runtime/server/google-maps-geocode-proxy.js +0 -43
  197. package/dist/runtime/server/google-static-maps-proxy.d.ts +0 -2
  198. package/dist/runtime/server/google-static-maps-proxy.js +0 -56
  199. package/dist/runtime/server/utils/proxy-query.d.ts +0 -2
  200. package/dist/runtime/server/utils/proxy-query.js +0 -10
  201. package/dist/runtime/server/utils/sign-constants.d.ts +0 -16
  202. package/dist/runtime/server/utils/sign-constants.js +0 -5
  203. package/dist/runtime/server/utils/sign.d.ts +0 -101
  204. package/dist/runtime/server/utils/sign.js +0 -91
  205. package/dist/runtime/server/utils/withSigning.d.ts +0 -23
  206. package/dist/runtime/server/utils/withSigning.js +0 -19
  207. package/dist/runtime/unhead-features.d.ts +0 -1
  208. package/dist/runtime/unhead-features.js +0 -3
@@ -0,0 +1,99 @@
1
+ <script setup>
2
+ import { inject, useTemplateRef, watch } from "vue";
3
+ import { MAPLIBRE_MARKER_INJECTION_KEY, useMapLibreResource } from "./useMapLibreResource";
4
+ const props = defineProps({
5
+ position: { type: null, required: false },
6
+ open: { type: Boolean, required: false, default: false },
7
+ options: { type: null, required: false }
8
+ });
9
+ const emit = defineEmits(["open", "close"]);
10
+ defineSlots();
11
+ const markerContext = inject(MAPLIBRE_MARKER_INJECTION_KEY, void 0);
12
+ const content = useTemplateRef("content");
13
+ let boundMarker;
14
+ let popupMap;
15
+ let popupClassNames = new Set((props.options?.className || "").split(/\s+/).filter(Boolean));
16
+ const openHandler = (event) => emit("open", event);
17
+ const closeHandler = (event) => emit("close", event);
18
+ function setOpen(instance, open) {
19
+ if (open === instance.isOpen())
20
+ return;
21
+ if (open) {
22
+ if (boundMarker)
23
+ boundMarker.togglePopup();
24
+ else if (popupMap)
25
+ instance.addTo(popupMap);
26
+ } else {
27
+ instance.remove();
28
+ }
29
+ }
30
+ const popup = useMapLibreResource({
31
+ ready: () => !!content.value && (!!markerContext?.marker.value || !!props.position),
32
+ create({ maplibre, map }) {
33
+ popupMap = map;
34
+ const instance = new maplibre.Popup(props.options).setDOMContent(content.value);
35
+ popupClassNames = new Set((props.options?.className || "").split(/\s+/).filter(Boolean));
36
+ instance.on("open", openHandler);
37
+ instance.on("close", closeHandler);
38
+ boundMarker = markerContext?.marker.value;
39
+ if (boundMarker)
40
+ boundMarker.setPopup(instance);
41
+ else if (props.position)
42
+ instance.setLngLat(props.position);
43
+ setOpen(instance, props.open);
44
+ return instance;
45
+ },
46
+ cleanup(instance) {
47
+ if (boundMarker) {
48
+ boundMarker.setPopup(null);
49
+ boundMarker = void 0;
50
+ }
51
+ instance.off("open", openHandler);
52
+ instance.off("close", closeHandler);
53
+ instance.remove();
54
+ popupMap = void 0;
55
+ }
56
+ });
57
+ watch(() => props.open, (open) => popup.value && setOpen(popup.value, open));
58
+ watch(() => props.position, (position) => {
59
+ if (popup.value && position && !boundMarker)
60
+ popup.value.setLngLat(position);
61
+ }, { deep: 1 });
62
+ watch(() => props.options, (options) => {
63
+ if (!popup.value || !options)
64
+ return;
65
+ if (options.maxWidth !== void 0)
66
+ popup.value.setMaxWidth(options.maxWidth);
67
+ if (options.offset !== void 0)
68
+ popup.value.setOffset(options.offset);
69
+ if (options.padding !== void 0)
70
+ popup.value.setPadding(options.padding);
71
+ if (options.subpixelPositioning !== void 0)
72
+ popup.value.setSubpixelPositioning(options.subpixelPositioning);
73
+ if (options.className !== void 0) {
74
+ const nextClassNames = new Set(options.className.split(/\s+/).filter(Boolean));
75
+ for (const className of popupClassNames) {
76
+ if (!nextClassNames.has(className))
77
+ popup.value.removeClassName(className);
78
+ }
79
+ for (const className of nextClassNames) {
80
+ if (!popupClassNames.has(className))
81
+ popup.value.addClassName(className);
82
+ }
83
+ popupClassNames = nextClassNames;
84
+ }
85
+ }, { deep: 2 });
86
+ defineExpose({ popup });
87
+ </script>
88
+
89
+ <template>
90
+ <div class="maplibre-popup-content-source">
91
+ <div ref="content">
92
+ <slot />
93
+ </div>
94
+ </div>
95
+ </template>
96
+
97
+ <style scoped>
98
+ .maplibre-popup-content-source{display:none}
99
+ </style>
@@ -0,0 +1,31 @@
1
+ import type * as MapLibre from 'maplibre-gl';
2
+ type __VLS_Props = {
3
+ /** Position for a standalone popup. Omit when nested inside a marker. */
4
+ position?: MapLibre.LngLatLike;
5
+ /** Whether the popup is open. @default false */
6
+ open?: boolean;
7
+ /** Options passed to `new maplibregl.Popup()`. Options with public setters also update reactively. */
8
+ options?: MapLibre.PopupOptions;
9
+ };
10
+ type __VLS_Slots = {
11
+ default?: () => any;
12
+ };
13
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
14
+ popup: import("vue").ShallowRef<MapLibre.Popup | undefined>;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ close: (event: MapLibre.Event) => any;
17
+ open: (event: MapLibre.Event) => any;
18
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
19
+ onClose?: ((event: MapLibre.Event) => any) | undefined;
20
+ onOpen?: ((event: MapLibre.Event) => any) | undefined;
21
+ }>, {
22
+ open: boolean;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
25
+ declare const _default: typeof __VLS_export;
26
+ export default _default;
27
+ type __VLS_WithSlots<T, S> = T & {
28
+ new (): {
29
+ $slots: S;
30
+ };
31
+ };
@@ -0,0 +1,23 @@
1
+ import type * as MapLibre from 'maplibre-gl';
2
+ import type { InjectionKey, ShallowRef } from 'vue';
3
+ export interface MapLibreMapContext {
4
+ map: ShallowRef<MapLibre.Map | undefined>;
5
+ maplibre: ShallowRef<typeof MapLibre | undefined>;
6
+ }
7
+ export declare const MAPLIBRE_MAP_INJECTION_KEY: InjectionKey<MapLibreMapContext>;
8
+ export declare const MAPLIBRE_MARKER_INJECTION_KEY: InjectionKey<{
9
+ marker: ShallowRef<MapLibre.Marker | undefined>;
10
+ }>;
11
+ export interface MapLibreResourceContext {
12
+ map: MapLibre.Map;
13
+ maplibre: typeof MapLibre;
14
+ }
15
+ /**
16
+ * Creates a MapLibre resource after its parent map and any component-specific
17
+ * DOM refs are ready, then removes it synchronously during unmount.
18
+ */
19
+ export declare function useMapLibreResource<T>({ ready, create, cleanup, }: {
20
+ ready?: () => boolean;
21
+ create: (context: MapLibreResourceContext) => T;
22
+ cleanup: (resource: T, context: MapLibreResourceContext) => void;
23
+ }): ShallowRef<T | undefined>;
@@ -0,0 +1,41 @@
1
+ import { inject, onUnmounted, shallowRef, watch } from "vue";
2
+ export const MAPLIBRE_MAP_INJECTION_KEY = Symbol("maplibre-map");
3
+ export const MAPLIBRE_MARKER_INJECTION_KEY = Symbol("maplibre-marker");
4
+ export function useMapLibreResource({
5
+ ready,
6
+ create,
7
+ cleanup
8
+ }) {
9
+ const mapContext = inject(MAPLIBRE_MAP_INJECTION_KEY, void 0);
10
+ const resource = shallowRef();
11
+ let creating = false;
12
+ let resourceContext;
13
+ if (import.meta.dev && !mapContext) {
14
+ console.warn("[nuxt-scripts] MapLibre child components must be placed inside <ScriptMapLibreMap>.");
15
+ }
16
+ const stop = watch(
17
+ () => [mapContext?.map.value, mapContext?.maplibre.value, ready?.() ?? true],
18
+ ([map, maplibre, isReady]) => {
19
+ if (!map || !maplibre || !isReady || resource.value || creating)
20
+ return;
21
+ creating = true;
22
+ try {
23
+ resourceContext = { map, maplibre };
24
+ resource.value = create(resourceContext);
25
+ } catch (error) {
26
+ console.error("[nuxt-scripts] MapLibre resource creation failed:", error);
27
+ } finally {
28
+ creating = false;
29
+ }
30
+ },
31
+ { immediate: true }
32
+ );
33
+ onUnmounted(() => {
34
+ stop();
35
+ if (resource.value && resourceContext)
36
+ cleanup(resource.value, resourceContext);
37
+ resource.value = void 0;
38
+ resourceContext = void 0;
39
+ });
40
+ return resource;
41
+ }
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
- import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
2
+ import { useMutationObserver } from "@vueuse/core";
3
+ import { computed, onMounted, ref, shallowRef, watch } from "vue";
3
4
  import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
4
5
  import { useScriptCrisp } from "../registry/crisp";
5
6
  const props = defineProps({
@@ -34,28 +35,29 @@ if (props.trigger === "click") {
34
35
  defineExpose({
35
36
  crisp
36
37
  });
37
- let observer;
38
+ const observerTarget = shallowRef(null);
39
+ function markReady() {
40
+ if (isReady.value)
41
+ return true;
42
+ if (!document.getElementById("crisp-chatbox"))
43
+ return false;
44
+ isReady.value = true;
45
+ observerTarget.value = null;
46
+ emits("ready", crisp);
47
+ return true;
48
+ }
49
+ useMutationObserver(observerTarget, markReady, { childList: true, subtree: true });
38
50
  onMounted(() => {
39
51
  watch(status, (status2) => {
40
52
  if (status2 === "loaded") {
41
- observer?.disconnect();
42
- observer = new MutationObserver(() => {
43
- if (document.getElementById("crisp-chatbox")) {
44
- isReady.value = true;
45
- emits("ready", crisp);
46
- observer?.disconnect();
47
- observer = void 0;
48
- }
49
- });
50
- observer.observe(document.body, { childList: true, subtree: true });
53
+ if (!markReady())
54
+ observerTarget.value = document.body;
51
55
  } else if (status2 === "error") {
56
+ observerTarget.value = null;
57
+ isReady.value = false;
52
58
  emits("error");
53
59
  }
54
- });
55
- });
56
- onBeforeUnmount(() => {
57
- observer?.disconnect();
58
- observer = void 0;
60
+ }, { immediate: true });
59
61
  });
60
62
  const rootAttrs = computed(() => {
61
63
  return {
@@ -72,7 +74,7 @@ const rootAttrs = computed(() => {
72
74
  >
73
75
  <slot :ready="isReady" />
74
76
  <slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
75
- <slot v-else-if="status === 'loading' || !isReady" name="loading" />
76
77
  <slot v-else-if="status === 'error'" name="error" />
78
+ <slot v-else-if="status === 'loading' || !isReady" name="loading" />
77
79
  </div>
78
80
  </template>
@@ -0,0 +1,40 @@
1
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
2
+ type __VLS_Props = {
3
+ /**
4
+ * Defines the trigger event to load the script.
5
+ */
6
+ trigger?: ElementScriptTrigger;
7
+ widgetKey: string;
8
+ board?: string;
9
+ color?: string;
10
+ position?: 'left' | 'right';
11
+ greeting?: string;
12
+ launcher?: 'logo';
13
+ };
14
+ type __VLS_Slots = {
15
+ default?: (props: {
16
+ ready: boolean;
17
+ }) => any;
18
+ awaitingLoad?: () => any;
19
+ loading?: () => any;
20
+ error?: () => any;
21
+ };
22
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
23
+ deskcrew: import("#nuxt-scripts/types").UseScriptContext<import("../registry/deskcrew.js").DeskCrewApi>;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ error: () => any;
26
+ ready: (e: import("#nuxt-scripts/types").UseScriptContext<import("../registry/deskcrew.js").DeskCrewApi>) => any;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
28
+ onError?: (() => any) | undefined;
29
+ onReady?: ((e: import("#nuxt-scripts/types").UseScriptContext<import("../registry/deskcrew.js").DeskCrewApi>) => any) | undefined;
30
+ }>, {
31
+ trigger: ElementScriptTrigger;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -0,0 +1,82 @@
1
+ <script setup>
2
+ import { useMutationObserver } from "@vueuse/core";
3
+ import { computed, onMounted, ref, shallowRef, watch } from "vue";
4
+ import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
5
+ import { useScriptDeskCrew } from "../registry/deskcrew";
6
+ const props = defineProps({
7
+ trigger: { type: [String, Array, Boolean], required: false, default: "click" },
8
+ widgetKey: { type: String, required: true },
9
+ board: { type: String, required: false },
10
+ color: { type: String, required: false },
11
+ position: { type: String, required: false },
12
+ greeting: { type: String, required: false },
13
+ launcher: { type: String, required: false }
14
+ });
15
+ const emits = defineEmits(["ready", "error"]);
16
+ defineSlots();
17
+ const rootEl = ref(null);
18
+ const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
19
+ const isReady = ref(false);
20
+ const deskcrew = useScriptDeskCrew({
21
+ widgetKey: props.widgetKey,
22
+ board: props.board,
23
+ color: props.color,
24
+ position: props.position,
25
+ greeting: props.greeting,
26
+ launcher: props.launcher,
27
+ scriptOptions: {
28
+ trigger
29
+ }
30
+ });
31
+ const { onLoaded, status } = deskcrew;
32
+ if (props.trigger === "click") {
33
+ onLoaded((instance) => {
34
+ instance.open();
35
+ });
36
+ }
37
+ defineExpose({
38
+ deskcrew
39
+ });
40
+ const observerTarget = shallowRef(null);
41
+ function markReady() {
42
+ if (isReady.value)
43
+ return true;
44
+ if (!document.getElementById("deskcrew-root"))
45
+ return false;
46
+ isReady.value = true;
47
+ observerTarget.value = null;
48
+ emits("ready", deskcrew);
49
+ return true;
50
+ }
51
+ useMutationObserver(observerTarget, markReady, { childList: true, subtree: true });
52
+ onMounted(() => {
53
+ watch(status, (status2) => {
54
+ if (status2 === "loaded") {
55
+ if (!markReady())
56
+ observerTarget.value = document.body;
57
+ } else if (status2 === "error") {
58
+ observerTarget.value = null;
59
+ isReady.value = false;
60
+ emits("error");
61
+ }
62
+ }, { immediate: true });
63
+ });
64
+ const rootAttrs = computed(() => {
65
+ return {
66
+ ...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
67
+ };
68
+ });
69
+ </script>
70
+
71
+ <template>
72
+ <div
73
+ ref="rootEl"
74
+ :style="{ display: isReady ? 'none' : 'block' }"
75
+ v-bind="rootAttrs"
76
+ >
77
+ <slot :ready="isReady" />
78
+ <slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
79
+ <slot v-else-if="status === 'error'" name="error" />
80
+ <slot v-else-if="status === 'loading' || !isReady" name="loading" />
81
+ </div>
82
+ </template>
@@ -0,0 +1,40 @@
1
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types';
2
+ type __VLS_Props = {
3
+ /**
4
+ * Defines the trigger event to load the script.
5
+ */
6
+ trigger?: ElementScriptTrigger;
7
+ widgetKey: string;
8
+ board?: string;
9
+ color?: string;
10
+ position?: 'left' | 'right';
11
+ greeting?: string;
12
+ launcher?: 'logo';
13
+ };
14
+ type __VLS_Slots = {
15
+ default?: (props: {
16
+ ready: boolean;
17
+ }) => any;
18
+ awaitingLoad?: () => any;
19
+ loading?: () => any;
20
+ error?: () => any;
21
+ };
22
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
23
+ deskcrew: import("#nuxt-scripts/types").UseScriptContext<import("../registry/deskcrew.js").DeskCrewApi>;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ error: () => any;
26
+ ready: (e: import("#nuxt-scripts/types").UseScriptContext<import("../registry/deskcrew.js").DeskCrewApi>) => any;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
28
+ onError?: (() => any) | undefined;
29
+ onReady?: ((e: import("#nuxt-scripts/types").UseScriptContext<import("../registry/deskcrew.js").DeskCrewApi>) => any) | undefined;
30
+ }>, {
31
+ trigger: ElementScriptTrigger;
32
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
34
+ declare const _default: typeof __VLS_export;
35
+ export default _default;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
- import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
2
+ import { useMutationObserver } from "@vueuse/core";
3
+ import { computed, onMounted, ref, shallowRef, watch } from "vue";
3
4
  import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
4
5
  import { useScriptIntercom } from "../registry/intercom";
5
6
  const props = defineProps({
@@ -41,28 +42,29 @@ if (props.trigger === "click") {
41
42
  defineExpose({
42
43
  intercom
43
44
  });
44
- let observer;
45
+ const observerTarget = shallowRef(null);
46
+ function markReady() {
47
+ if (isReady.value)
48
+ return true;
49
+ if (!document.getElementById("intercom-frame"))
50
+ return false;
51
+ isReady.value = true;
52
+ observerTarget.value = null;
53
+ emits("ready", intercom);
54
+ return true;
55
+ }
56
+ useMutationObserver(observerTarget, markReady, { childList: true, subtree: true });
45
57
  onMounted(() => {
46
58
  watch(status, (status2) => {
47
- if (status2 === "loading") {
48
- observer?.disconnect();
49
- observer = new MutationObserver(() => {
50
- if (document.getElementById("intercom-frame")) {
51
- isReady.value = true;
52
- emits("ready", intercom);
53
- observer?.disconnect();
54
- observer = void 0;
55
- }
56
- });
57
- observer.observe(document.body, { childList: true, subtree: true });
59
+ if (status2 === "loading" || status2 === "loaded") {
60
+ if (!markReady())
61
+ observerTarget.value = document.body;
58
62
  } else if (status2 === "error") {
63
+ observerTarget.value = null;
64
+ isReady.value = false;
59
65
  emits("error");
60
66
  }
61
- });
62
- });
63
- onBeforeUnmount(() => {
64
- observer?.disconnect();
65
- observer = void 0;
67
+ }, { immediate: true });
66
68
  });
67
69
  const rootAttrs = computed(() => {
68
70
  return {
@@ -83,7 +85,7 @@ const rootAttrs = computed(() => {
83
85
  >
84
86
  <slot :ready="isReady" />
85
87
  <slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
86
- <slot v-else-if="status === 'loading' || !isReady" name="loading" />
87
88
  <slot v-else-if="status === 'error'" name="error" />
89
+ <slot v-else-if="status === 'loading' || !isReady" name="loading" />
88
90
  </div>
89
91
  </template>
@@ -3,8 +3,8 @@ type __VLS_Props = {
3
3
  size?: number;
4
4
  };
5
5
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
- size: number;
7
6
  color: string;
7
+ size: number;
8
8
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
9
  declare const _default: typeof __VLS_export;
10
10
  export default _default;
@@ -3,8 +3,8 @@ type __VLS_Props = {
3
3
  size?: number;
4
4
  };
5
5
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
- size: number;
7
6
  color: string;
7
+ size: number;
8
8
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
9
  declare const _default: typeof __VLS_export;
10
10
  export default _default;
@@ -9,7 +9,7 @@ const props = defineProps({
9
9
  clientId: { type: String, required: false, default: "test" },
10
10
  clientToken: { type: String, required: false },
11
11
  components: { type: Array, required: false, default: () => ["paypal-payments"] },
12
- pageType: { type: String, required: false },
12
+ pageType: { type: null, required: false },
13
13
  locale: { type: String, required: false },
14
14
  merchantId: { type: [String, Array], required: false },
15
15
  partnerAttributionId: { type: String, required: false },
@@ -23,9 +23,14 @@ const ready = ref(false);
23
23
  const failed = ref(false);
24
24
  const sdkInstance = shallowRef();
25
25
  let disposed = false;
26
+ const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
26
27
  const { onLoaded, status } = useScriptPayPal({
27
28
  ...props.clientToken ? { clientToken: props.clientToken } : { clientId: props.clientId },
28
- ...props.paypalScriptOptions
29
+ ...props.paypalScriptOptions,
30
+ scriptOptions: {
31
+ ...props.paypalScriptOptions.scriptOptions,
32
+ trigger
33
+ }
29
34
  });
30
35
  onMounted(() => {
31
36
  onLoaded(async ({ paypal }) => {
@@ -64,7 +69,6 @@ defineExpose({
64
69
  sdkInstance
65
70
  });
66
71
  const ScriptLoadingIndicator = resolveComponent("ScriptLoadingIndicator");
67
- const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
68
72
  const rootAttrs = computed(() => {
69
73
  return defu(props.rootAttrs, {
70
74
  "aria-busy": status.value === "loading",
@@ -10,9 +10,9 @@ const props = defineProps({
10
10
  clientToken: { type: String, required: false },
11
11
  merchantId: { type: [String, Array], required: false },
12
12
  partnerAttributionId: { type: String, required: false },
13
- pageType: { type: String, required: false },
13
+ pageType: { type: null, required: false },
14
14
  locale: { type: String, required: false },
15
- messagesOptions: { type: Object, required: false, default: () => ({}) },
15
+ messagesOptions: { type: null, required: false, default: () => ({}) },
16
16
  paypalScriptOptions: { type: Object, required: false, default: () => ({}) }
17
17
  });
18
18
  const emit = defineEmits(["ready", "error"]);
@@ -23,9 +23,14 @@ const ready = ref(false);
23
23
  const failed = ref(false);
24
24
  const messagesSession = shallowRef();
25
25
  let disposed = false;
26
+ const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
26
27
  const { onLoaded, status } = useScriptPayPal({
27
28
  ...props.clientToken ? { clientToken: props.clientToken } : { clientId: props.clientId },
28
- ...props.paypalScriptOptions
29
+ ...props.paypalScriptOptions,
30
+ scriptOptions: {
31
+ ...props.paypalScriptOptions.scriptOptions,
32
+ trigger
33
+ }
29
34
  });
30
35
  onMounted(() => {
31
36
  onLoaded(async ({ paypal }) => {
@@ -64,7 +69,6 @@ defineExpose({
64
69
  messagesSession
65
70
  });
66
71
  const ScriptLoadingIndicator = resolveComponent("ScriptLoadingIndicator");
67
- const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
68
72
  const rootAttrs = computed(() => {
69
73
  return defu(props.rootAttrs, {
70
74
  "aria-busy": status.value === "loading",