@nuxt/scripts 2.0.0-beta.5 → 2.0.0-beta.7

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 (86) hide show
  1. package/LICENSE.md +9 -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/BI6wdYky.js +1 -0
  5. package/dist/devtools-client/_nuxt/BQKaRBnk.js +179 -0
  6. package/dist/devtools-client/_nuxt/BckE5qrE.js +1 -0
  7. package/dist/devtools-client/_nuxt/CIwvJvFr.js +1 -0
  8. package/dist/devtools-client/_nuxt/Car86Ubo.js +3 -0
  9. package/dist/devtools-client/_nuxt/{Dat651Oh.js → ClT2ZYzs.js} +1 -1
  10. package/dist/devtools-client/_nuxt/Cs0md1ml.js +1 -0
  11. package/dist/devtools-client/_nuxt/D4iN56En.js +1 -0
  12. package/dist/devtools-client/_nuxt/DN3hUMR_.js +1 -0
  13. package/dist/devtools-client/_nuxt/DXEYGql4.js +1 -0
  14. package/dist/devtools-client/_nuxt/Divy0_cA.js +8 -0
  15. package/dist/devtools-client/_nuxt/QMsSHdby.js +6 -0
  16. package/dist/devtools-client/_nuxt/WbNXtEed.js +2 -0
  17. package/dist/devtools-client/_nuxt/builds/latest.json +1 -1
  18. package/dist/devtools-client/_nuxt/builds/meta/7f4505e1-4a64-4e0a-b3dd-aa394b0cd7f2.json +1 -0
  19. package/dist/devtools-client/_nuxt/entry.-RqqMwHr.css +2 -0
  20. package/dist/devtools-client/_nuxt/error-404.BJ1JSMYb.css +1 -0
  21. package/dist/devtools-client/_nuxt/error-500.BBf0uW5X.css +1 -0
  22. package/dist/devtools-client/_nuxt/{pages.aU4WirOM.css → pages.BTJrCFzE.css} +1 -1
  23. package/dist/devtools-client/docs/index.html +1 -1
  24. package/dist/devtools-client/first-party/index.html +1 -1
  25. package/dist/devtools-client/index.html +1 -1
  26. package/dist/devtools-client/registry/index.html +1 -1
  27. package/dist/module.d.mts +1 -0
  28. package/dist/module.d.ts +1 -0
  29. package/dist/module.json +1 -1
  30. package/dist/module.mjs +4 -1
  31. package/dist/registry.mjs +24 -1
  32. package/dist/runtime/components/Leaflet/ScriptLeafletMap.d.vue.ts +5 -5
  33. package/dist/runtime/components/Leaflet/ScriptLeafletMap.vue.d.ts +5 -5
  34. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.d.vue.ts +14 -35
  35. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue +194 -12
  36. package/dist/runtime/components/MapLibre/ScriptMapLibreGeoJson.vue.d.ts +14 -35
  37. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.d.vue.ts +22 -86
  38. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue +16 -4
  39. package/dist/runtime/components/MapLibre/ScriptMapLibreMap.vue.d.ts +22 -86
  40. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.d.vue.ts +9 -18
  41. package/dist/runtime/components/MapLibre/ScriptMapLibreMarker.vue.d.ts +9 -18
  42. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.d.vue.ts +3 -8
  43. package/dist/runtime/components/MapLibre/ScriptMapLibreNavigationControl.vue.d.ts +3 -8
  44. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.d.vue.ts +7 -14
  45. package/dist/runtime/components/MapLibre/ScriptMapLibrePopup.vue.d.ts +7 -14
  46. package/dist/runtime/components/MapLibre/types.d.ts +186 -0
  47. package/dist/runtime/components/MapLibre/types.js +0 -0
  48. package/dist/runtime/components/MapLibre/useMapLibreResource.d.ts +8 -1
  49. package/dist/runtime/components/MapLibre/useMapLibreResource.js +9 -2
  50. package/dist/runtime/components/ScriptCarbonAds.vue +3 -1
  51. package/dist/runtime/components/ScriptGoogleAdsense.d.vue.ts +1 -1
  52. package/dist/runtime/components/ScriptGoogleAdsense.vue.d.ts +1 -1
  53. package/dist/runtime/registry/pulse-analytics.d.ts +32 -0
  54. package/dist/runtime/registry/pulse-analytics.js +80 -0
  55. package/dist/runtime/registry/schemas.d.ts +42 -0
  56. package/dist/runtime/registry/schemas.js +42 -0
  57. package/dist/runtime/registry/tawk-to.d.ts +126 -0
  58. package/dist/runtime/registry/tawk-to.js +147 -0
  59. package/dist/runtime/server/proxy-handler.d.ts +0 -4
  60. package/dist/runtime/server/proxy-handler.js +109 -38
  61. package/dist/runtime/server/utils/network-dispatcher.platform.d.ts +2 -2
  62. package/dist/runtime/server/utils/network-dispatcher.platform.js +4 -1
  63. package/dist/runtime/types.d.ts +6 -1
  64. package/dist/stats.mjs +81 -0
  65. package/dist/types-source.mjs +159 -6
  66. package/dist/types.d.mts +2 -0
  67. package/package.json +23 -23
  68. package/dist/devtools-client/_nuxt/2p1_IuX2.js +0 -1
  69. package/dist/devtools-client/_nuxt/9elIQxwW.js +0 -1
  70. package/dist/devtools-client/_nuxt/B-kTnbRv.js +0 -1
  71. package/dist/devtools-client/_nuxt/BDNMzG2s.js +0 -1
  72. package/dist/devtools-client/_nuxt/BNPn63Jz.js +0 -1
  73. package/dist/devtools-client/_nuxt/BuTlAAeI.js +0 -152
  74. package/dist/devtools-client/_nuxt/C41E8Pp1.js +0 -8
  75. package/dist/devtools-client/_nuxt/CDDBpkXG.js +0 -3
  76. package/dist/devtools-client/_nuxt/Cbmw_5H5.js +0 -1
  77. package/dist/devtools-client/_nuxt/DAsiyhPm.js +0 -6
  78. package/dist/devtools-client/_nuxt/DabLKy7M.js +0 -1
  79. package/dist/devtools-client/_nuxt/DiZU_C4m.js +0 -1
  80. package/dist/devtools-client/_nuxt/KsX6Az5B.js +0 -1
  81. package/dist/devtools-client/_nuxt/LFNkKKtz.js +0 -28
  82. package/dist/devtools-client/_nuxt/UmWNrBO5.js +0 -2
  83. package/dist/devtools-client/_nuxt/builds/meta/778de0a6-ec82-430f-966c-9a96d75eb772.json +0 -1
  84. package/dist/devtools-client/_nuxt/entry.CYUdJFoE.css +0 -2
  85. package/dist/devtools-client/_nuxt/error-404.DnwL1N6v.css +0 -1
  86. package/dist/devtools-client/_nuxt/error-500.DEbXRLdm.css +0 -1
@@ -1,29 +1,20 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- type __VLS_Props = {
3
- /** Reactive marker position in `[longitude, latitude]` order. */
4
- position: MapLibre.LngLatLike;
5
- /** Accessible name for the marker element. */
6
- ariaLabel?: string;
7
- /** Tooltip text for the marker element. */
8
- title?: string;
9
- /** Options passed to `new maplibregl.Marker()`. Options with public setters also update reactively. */
10
- options?: MapLibre.MarkerOptions;
11
- };
2
+ import type { ScriptMapLibreMarkerProps } from './types.js';
12
3
  type __VLS_Slots = {
13
4
  default?: () => any;
14
5
  };
15
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
6
+ declare const __VLS_base: import("vue").DefineComponent<ScriptMapLibreMarkerProps, {
16
7
  marker: import("vue").ShallowRef<MapLibre.Marker | undefined>;
17
8
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
9
  click: (event: MouseEvent) => any;
19
- drag: (event: MapLibre.Event) => any;
20
- dragend: (event: MapLibre.Event) => any;
21
- dragstart: (event: MapLibre.Event) => any;
22
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ drag: (event: MapLibre.Event<string>) => any;
11
+ dragend: (event: MapLibre.Event<string>) => any;
12
+ dragstart: (event: MapLibre.Event<string>) => any;
13
+ }, string, import("vue").PublicProps, Readonly<ScriptMapLibreMarkerProps> & Readonly<{
23
14
  onClick?: ((event: MouseEvent) => any) | undefined;
24
- onDrag?: ((event: MapLibre.Event) => any) | undefined;
25
- onDragend?: ((event: MapLibre.Event) => any) | undefined;
26
- onDragstart?: ((event: MapLibre.Event) => any) | undefined;
15
+ onDrag?: ((event: MapLibre.Event<string>) => any) | undefined;
16
+ onDragend?: ((event: MapLibre.Event<string>) => any) | undefined;
17
+ onDragstart?: ((event: MapLibre.Event<string>) => any) | undefined;
27
18
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
19
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
29
20
  declare const _default: typeof __VLS_export;
@@ -1,29 +1,20 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- type __VLS_Props = {
3
- /** Reactive marker position in `[longitude, latitude]` order. */
4
- position: MapLibre.LngLatLike;
5
- /** Accessible name for the marker element. */
6
- ariaLabel?: string;
7
- /** Tooltip text for the marker element. */
8
- title?: string;
9
- /** Options passed to `new maplibregl.Marker()`. Options with public setters also update reactively. */
10
- options?: MapLibre.MarkerOptions;
11
- };
2
+ import type { ScriptMapLibreMarkerProps } from './types.js';
12
3
  type __VLS_Slots = {
13
4
  default?: () => any;
14
5
  };
15
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
6
+ declare const __VLS_base: import("vue").DefineComponent<ScriptMapLibreMarkerProps, {
16
7
  marker: import("vue").ShallowRef<MapLibre.Marker | undefined>;
17
8
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
9
  click: (event: MouseEvent) => any;
19
- drag: (event: MapLibre.Event) => any;
20
- dragend: (event: MapLibre.Event) => any;
21
- dragstart: (event: MapLibre.Event) => any;
22
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ drag: (event: MapLibre.Event<string>) => any;
11
+ dragend: (event: MapLibre.Event<string>) => any;
12
+ dragstart: (event: MapLibre.Event<string>) => any;
13
+ }, string, import("vue").PublicProps, Readonly<ScriptMapLibreMarkerProps> & Readonly<{
23
14
  onClick?: ((event: MouseEvent) => any) | undefined;
24
- onDrag?: ((event: MapLibre.Event) => any) | undefined;
25
- onDragend?: ((event: MapLibre.Event) => any) | undefined;
26
- onDragstart?: ((event: MapLibre.Event) => any) | undefined;
15
+ onDrag?: ((event: MapLibre.Event<string>) => any) | undefined;
16
+ onDragend?: ((event: MapLibre.Event<string>) => any) | undefined;
17
+ onDragstart?: ((event: MapLibre.Event<string>) => any) | undefined;
27
18
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
19
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
29
20
  declare const _default: typeof __VLS_export;
@@ -1,12 +1,7 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- type __VLS_Props = {
3
- /** Position of the navigation control. */
4
- position?: MapLibre.ControlPosition;
5
- /** Options passed to `new maplibregl.NavigationControl()`. */
6
- options?: MapLibre.NavigationControlOptions;
7
- };
8
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
2
+ import type { ScriptMapLibreNavigationControlProps } from './types.js';
3
+ declare const __VLS_export: import("vue").DefineComponent<ScriptMapLibreNavigationControlProps, {
9
4
  control: import("vue").ShallowRef<MapLibre.NavigationControl | undefined>;
10
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScriptMapLibreNavigationControlProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
6
  declare const _default: typeof __VLS_export;
12
7
  export default _default;
@@ -1,12 +1,7 @@
1
1
  import type * as MapLibre from 'maplibre-gl';
2
- type __VLS_Props = {
3
- /** Position of the navigation control. */
4
- position?: MapLibre.ControlPosition;
5
- /** Options passed to `new maplibregl.NavigationControl()`. */
6
- options?: MapLibre.NavigationControlOptions;
7
- };
8
- declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
2
+ import type { ScriptMapLibreNavigationControlProps } from './types.js';
3
+ declare const __VLS_export: import("vue").DefineComponent<ScriptMapLibreNavigationControlProps, {
9
4
  control: import("vue").ShallowRef<MapLibre.NavigationControl | undefined>;
10
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
5
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ScriptMapLibreNavigationControlProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
6
  declare const _default: typeof __VLS_export;
12
7
  export default _default;
@@ -1,23 +1,16 @@
1
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
- };
2
+ import type { ScriptMapLibrePopupProps } from './types.js';
10
3
  type __VLS_Slots = {
11
4
  default?: () => any;
12
5
  };
13
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
6
+ declare const __VLS_base: import("vue").DefineComponent<ScriptMapLibrePopupProps, {
14
7
  popup: import("vue").ShallowRef<MapLibre.Popup | undefined>;
15
8
  }, {}, {}, {}, 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;
9
+ close: (event: MapLibre.Event<string>) => any;
10
+ open: (event: MapLibre.Event<string>) => any;
11
+ }, string, import("vue").PublicProps, Readonly<ScriptMapLibrePopupProps> & Readonly<{
12
+ onClose?: ((event: MapLibre.Event<string>) => any) | undefined;
13
+ onOpen?: ((event: MapLibre.Event<string>) => any) | undefined;
21
14
  }>, {
22
15
  open: boolean;
23
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,23 +1,16 @@
1
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
- };
2
+ import type { ScriptMapLibrePopupProps } from './types.js';
10
3
  type __VLS_Slots = {
11
4
  default?: () => any;
12
5
  };
13
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
6
+ declare const __VLS_base: import("vue").DefineComponent<ScriptMapLibrePopupProps, {
14
7
  popup: import("vue").ShallowRef<MapLibre.Popup | undefined>;
15
8
  }, {}, {}, {}, 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;
9
+ close: (event: MapLibre.Event<string>) => any;
10
+ open: (event: MapLibre.Event<string>) => any;
11
+ }, string, import("vue").PublicProps, Readonly<ScriptMapLibrePopupProps> & Readonly<{
12
+ onClose?: ((event: MapLibre.Event<string>) => any) | undefined;
13
+ onOpen?: ((event: MapLibre.Event<string>) => any) | undefined;
21
14
  }>, {
22
15
  open: boolean;
23
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,186 @@
1
+ import type { GeoJSON } from 'geojson';
2
+ import type * as MapLibre from 'maplibre-gl';
3
+ import type { HTMLAttributes, ReservedProps, ShallowRef } from 'vue';
4
+ import type { ElementScriptTrigger } from '../../types.js';
5
+ /**
6
+ * Public types for the MapLibre components. They are re-exported from
7
+ * `@nuxt/scripts` so a consumer can type refs, layer arrays and event payloads
8
+ * without a deep import.
9
+ */
10
+ export interface ScriptMapLibreMapProps {
11
+ /**
12
+ * Defines when the MapLibre script loads.
13
+ * @default 'visible'
14
+ */
15
+ trigger?: ElementScriptTrigger;
16
+ /** MapLibre style URL or inline style specification. */
17
+ mapStyle: string | MapLibre.StyleSpecification;
18
+ /** Initial and reactively controlled map center. */
19
+ center: MapLibre.LngLatLike;
20
+ /** Initial and reactively controlled zoom level. @default 12 */
21
+ zoom?: number;
22
+ /** Initial and reactively controlled bearing in degrees. @default 0 */
23
+ bearing?: number;
24
+ /** Initial and reactively controlled pitch in degrees. @default 0 */
25
+ pitch?: number;
26
+ /** Options passed to `new maplibregl.Map()`. Dedicated props take precedence. */
27
+ options?: Omit<MapLibre.MapOptions, 'container'>;
28
+ /** Inject MapLibre's stylesheet when the script begins loading. @default true */
29
+ injectStyles?: boolean;
30
+ /** Custom MapLibre stylesheet URL. */
31
+ stylesheetUrl?: string;
32
+ /** Worker URL passed to `maplibregl.setWorkerUrl()`. */
33
+ workerUrl?: string;
34
+ /** Width reserved before the map loads. @default 640 */
35
+ width?: number | string;
36
+ /** Height reserved before the map loads. @default 400 */
37
+ height?: number | string;
38
+ /** Accessible name for an interactive map. @default 'Interactive map' */
39
+ ariaLabel?: string;
40
+ /** Disable map input and remove it from the accessibility tree when decorative. @default true */
41
+ interactive?: boolean;
42
+ /** Attributes applied to the outer layout container. */
43
+ rootAttrs?: HTMLAttributes & ReservedProps & Record<string, unknown>;
44
+ }
45
+ export interface ScriptMapLibreMapExpose {
46
+ maplibre: ShallowRef<typeof MapLibre | undefined>;
47
+ map: ShallowRef<MapLibre.Map | undefined>;
48
+ load: () => Promise<unknown> | unknown;
49
+ /** Moves the camera so the bounds fit the viewport. Does nothing before the map exists. */
50
+ fitBounds: (bounds: MapLibre.LngLatBoundsLike, options?: MapLibre.FitBoundsOptions) => void;
51
+ /** Animates the camera along a straight path. Does nothing before the map exists. */
52
+ easeTo: (options: MapLibre.EaseToOptions) => void;
53
+ /** Animates the camera along a curved flight path. Does nothing before the map exists. */
54
+ flyTo: (options: MapLibre.FlyToOptions) => void;
55
+ }
56
+ export interface ScriptMapLibreMapEmits {
57
+ 'ready': [payload: ScriptMapLibreMapExpose];
58
+ 'error': [error: Error];
59
+ /** The map finished its first complete render. Sources and layers are safe to add. */
60
+ 'load': [event: MapLibre.MapEventType['load']];
61
+ /** The style finished loading. MapLibre drops every source and layer before this fires. */
62
+ 'styleload': [event: MapLibre.MapEventType['style.load']];
63
+ 'click': [event: MapLibre.MapEventType['click']];
64
+ 'move': [event: MapLibre.MapEventType['move']];
65
+ 'moveend': [event: MapLibre.MapEventType['moveend']];
66
+ 'zoom': [event: MapLibre.MapEventType['zoom']];
67
+ 'zoomend': [event: MapLibre.MapEventType['zoomend']];
68
+ 'rotate': [event: MapLibre.MapEventType['rotate']];
69
+ 'rotateend': [event: MapLibre.MapEventType['rotateend']];
70
+ 'pitch': [event: MapLibre.MapEventType['pitch']];
71
+ 'pitchend': [event: MapLibre.MapEventType['pitchend']];
72
+ 'update:center': [center: MapLibre.LngLat];
73
+ 'update:zoom': [zoom: number];
74
+ 'update:bearing': [bearing: number];
75
+ 'update:pitch': [pitch: number];
76
+ }
77
+ export interface ScriptMapLibreMapSlots {
78
+ default?: () => any;
79
+ loading?: () => any;
80
+ awaitingLoad?: () => any;
81
+ error?: (props: {
82
+ error: Error;
83
+ }) => any;
84
+ placeholder?: () => any;
85
+ /** Text or links that expose the canvas map's essential information to assistive technology. */
86
+ description?: () => any;
87
+ }
88
+ /**
89
+ * Layer kinds a GeoJSON source can render. MapLibre's own style validation
90
+ * rejects the rest: `hillshade` and `color-relief` need a `raster-dem` source,
91
+ * `raster` needs raster tiles, and `background` takes no source at all.
92
+ */
93
+ type GeoJsonLayerType = 'circle' | 'fill' | 'fill-extrusion' | 'heatmap' | 'line' | 'symbol';
94
+ /**
95
+ * A style layer for this component's source.
96
+ *
97
+ * `LayerSpecification` is a union and a plain `Omit` is not distributive, so it
98
+ * collapses the union to its common keys and drops `filter`. MapLibre's own
99
+ * `DistributiveOmit` keeps each member, so `type` narrows `filter`, `paint` and
100
+ * `layout` for that layer kind.
101
+ *
102
+ * Only a GeoJSON-compatible layer may leave `source` out. A `raster`,
103
+ * `hillshade` or `color-relief` layer must name its own source.
104
+ */
105
+ export type ScriptMapLibreGeoJsonLayer = (MapLibre.DistributiveOmit<Extract<MapLibre.LayerSpecification, {
106
+ type: GeoJsonLayerType;
107
+ }>, 'source'> & {
108
+ /** Override the component's source ID for this layer. */
109
+ source?: string;
110
+ }) | Extract<MapLibre.LayerSpecification, {
111
+ type: 'color-relief' | 'hillshade' | 'raster';
112
+ }>;
113
+ export interface ScriptMapLibreGeoJsonProps {
114
+ /** MapLibre source ID. Changing it rebuilds the owned source and layers. */
115
+ sourceId: string;
116
+ /** Inline GeoJSON data or a URL returning GeoJSON. */
117
+ data: GeoJSON | string;
118
+ /** GeoJSON source options. `type` and `data` are supplied by the component. */
119
+ sourceOptions?: Omit<MapLibre.GeoJSONSourceSpecification, 'type' | 'data'>;
120
+ /**
121
+ * Style layers backed by this source.
122
+ * A paint, layout or filter change updates the layers in place.
123
+ * Any other change rebuilds the source and the layers.
124
+ */
125
+ layers: ScriptMapLibreGeoJsonLayer[];
126
+ /** Existing layer ID before which the layers are inserted. */
127
+ beforeId?: string;
128
+ /** CSS cursor applied while the pointer is over one of these layers. */
129
+ cursor?: string;
130
+ }
131
+ export interface ScriptMapLibreGeoJsonEmits {
132
+ /**
133
+ * The component could not apply a source or layer.
134
+ * A failed rebuild removes the component's own source and layers.
135
+ * A failed paint, layout or filter update leaves them on the map.
136
+ */
137
+ error: [error: Error];
138
+ /** The pointer clicked one of this component's layers. */
139
+ click: [event: MapLibre.MapLayerMouseEvent];
140
+ /** The pointer entered one of this component's layers. */
141
+ mouseenter: [event: MapLibre.MapLayerMouseEvent];
142
+ /** The pointer left one of this component's layers. */
143
+ mouseleave: [event: MapLibre.MapLayerMouseEvent];
144
+ }
145
+ export interface ScriptMapLibreGeoJsonResource {
146
+ map: MapLibre.Map;
147
+ onLoad: () => void;
148
+ onStyleLoad: () => void;
149
+ onStyleDataLoading: () => void;
150
+ onIdle: () => void;
151
+ }
152
+ export interface ScriptMapLibreMarkerProps {
153
+ /** Reactive marker position in `[longitude, latitude]` order. */
154
+ position: MapLibre.LngLatLike;
155
+ /** Accessible name for the marker element. */
156
+ ariaLabel?: string;
157
+ /** Tooltip text for the marker element. */
158
+ title?: string;
159
+ /** Options passed to `new maplibregl.Marker()`. Options with public setters also update reactively. */
160
+ options?: MapLibre.MarkerOptions;
161
+ }
162
+ export interface ScriptMapLibreMarkerEmits {
163
+ click: [event: MouseEvent];
164
+ dragstart: [event: MapLibre.Event];
165
+ drag: [event: MapLibre.Event];
166
+ dragend: [event: MapLibre.Event];
167
+ }
168
+ export interface ScriptMapLibrePopupProps {
169
+ /** Position for a standalone popup. Omit when nested inside a marker. */
170
+ position?: MapLibre.LngLatLike;
171
+ /** Whether the popup is open. @default false */
172
+ open?: boolean;
173
+ /** Options passed to `new maplibregl.Popup()`. Options with public setters also update reactively. */
174
+ options?: MapLibre.PopupOptions;
175
+ }
176
+ export interface ScriptMapLibrePopupEmits {
177
+ open: [event: MapLibre.Event];
178
+ close: [event: MapLibre.Event];
179
+ }
180
+ export interface ScriptMapLibreNavigationControlProps {
181
+ /** Position of the navigation control. */
182
+ position?: MapLibre.ControlPosition;
183
+ /** Options passed to `new maplibregl.NavigationControl()`. */
184
+ options?: MapLibre.NavigationControlOptions;
185
+ }
186
+ export {};
File without changes
@@ -12,12 +12,19 @@ export interface MapLibreResourceContext {
12
12
  map: MapLibre.Map;
13
13
  maplibre: typeof MapLibre;
14
14
  }
15
+ /**
16
+ * Logs a MapLibre resource failure and hands it to the owning component, so the
17
+ * consumer can surface it instead of only seeing a console message.
18
+ */
19
+ export declare function reportMapLibreResourceError(error: unknown, onError?: (error: Error) => void): Error;
15
20
  /**
16
21
  * Creates a MapLibre resource after its parent map and any component-specific
17
22
  * DOM refs are ready, then removes it synchronously during unmount.
18
23
  */
19
- export declare function useMapLibreResource<T>({ ready, create, cleanup, }: {
24
+ export declare function useMapLibreResource<T>({ ready, create, cleanup, onError, }: {
20
25
  ready?: () => boolean;
21
26
  create: (context: MapLibreResourceContext) => T;
22
27
  cleanup: (resource: T, context: MapLibreResourceContext) => void;
28
+ /** Called when `create` throws, after the failure is logged. */
29
+ onError?: (error: Error) => void;
23
30
  }): ShallowRef<T | undefined>;
@@ -1,10 +1,17 @@
1
1
  import { inject, onUnmounted, shallowRef, watch } from "vue";
2
2
  export const MAPLIBRE_MAP_INJECTION_KEY = Symbol("maplibre-map");
3
3
  export const MAPLIBRE_MARKER_INJECTION_KEY = Symbol("maplibre-marker");
4
+ export function reportMapLibreResourceError(error, onError) {
5
+ const failure = error instanceof Error ? error : new Error("MapLibre resource creation failed", { cause: error });
6
+ console.error("[nuxt-scripts] MapLibre resource creation failed:", error);
7
+ onError?.(failure);
8
+ return failure;
9
+ }
4
10
  export function useMapLibreResource({
5
11
  ready,
6
12
  create,
7
- cleanup
13
+ cleanup,
14
+ onError
8
15
  }) {
9
16
  const mapContext = inject(MAPLIBRE_MAP_INJECTION_KEY, void 0);
10
17
  const resource = shallowRef();
@@ -23,7 +30,7 @@ export function useMapLibreResource({
23
30
  resourceContext = { map, maplibre };
24
31
  resource.value = create(resourceContext);
25
32
  } catch (error) {
26
- console.error("[nuxt-scripts] MapLibre resource creation failed:", error);
33
+ reportMapLibreResourceError(error, onError);
27
34
  } finally {
28
35
  creating = false;
29
36
  }
@@ -62,7 +62,9 @@ onBeforeUnmount(() => {
62
62
  if (scriptEl) {
63
63
  scriptEl.onload = null;
64
64
  scriptEl.onerror = null;
65
- document.head.appendChild(scriptEl);
65
+ const owner = document.getElementById(attrId);
66
+ if (!owner || owner === scriptEl)
67
+ document.head.appendChild(scriptEl);
66
68
  scriptEl = void 0;
67
69
  }
68
70
  });
@@ -3,7 +3,7 @@ type __VLS_Props = {
3
3
  dataAdClient: string;
4
4
  dataAdSlot: string;
5
5
  dataAdFormat?: 'auto' | 'rectangle' | 'vertical' | 'horizontal' | 'fluid' | 'autorelaxed';
6
- dataAdLayout?: 'in-article';
6
+ dataAdLayout?: 'in-article' | 'image-top' | 'image-side' | 'text-only';
7
7
  dataAdLayoutKey?: string;
8
8
  dataFullWidthResponsive?: boolean;
9
9
  /**
@@ -3,7 +3,7 @@ type __VLS_Props = {
3
3
  dataAdClient: string;
4
4
  dataAdSlot: string;
5
5
  dataAdFormat?: 'auto' | 'rectangle' | 'vertical' | 'horizontal' | 'fluid' | 'autorelaxed';
6
- dataAdLayout?: 'in-article';
6
+ dataAdLayout?: 'in-article' | 'image-top' | 'image-side' | 'text-only';
7
7
  dataAdLayoutKey?: string;
8
8
  dataFullWidthResponsive?: boolean;
9
9
  /**
@@ -0,0 +1,32 @@
1
+ import type { RegistryScriptInput } from '#nuxt-scripts/types';
2
+ import { PulseAnalyticsOptions } from './schemas.js';
3
+ export { PulseAnalyticsOptions };
4
+ export type PulseAnalyticsInput = RegistryScriptInput<typeof PulseAnalyticsOptions, false>;
5
+ export interface PulseAnalyticsApi {
6
+ /**
7
+ * Records a custom event.
8
+ * @param name Event name: letters, numbers and underscores, up to 64 characters.
9
+ * Trimmed and lowercased before storage.
10
+ * @param props Optional properties. Values must be strings; a number or boolean
11
+ * rejects the whole event.
12
+ * @param revenue Optional monetary value, zero or greater.
13
+ * @see https://docs.ciphera.net/pulse/custom-events
14
+ */
15
+ track: (name: string, props?: Record<string, string>, revenue?: number) => void;
16
+ /**
17
+ * The current pathname as Pulse records it: trailing slash stripped, root kept
18
+ * as `/`. Returns `null` until the tracker has loaded.
19
+ */
20
+ cleanPath: () => string | null;
21
+ }
22
+ declare global {
23
+ interface Window {
24
+ pulse: PulseAnalyticsApi;
25
+ /**
26
+ * Set by the tracker before its opt-out checks run. Present without
27
+ * `pulse.track` means the tracker ran and declined to record.
28
+ */
29
+ __pulseInstalled?: boolean;
30
+ }
31
+ }
32
+ export declare function useScriptPulseAnalytics<T extends PulseAnalyticsApi>(_options?: PulseAnalyticsInput): import("#nuxt-scripts/types").UseScriptContext<T>;
@@ -0,0 +1,80 @@
1
+ import { useRegistryScript } from "../utils.js";
2
+ import { PulseAnalyticsOptions } from "./schemas.js";
3
+ export { PulseAnalyticsOptions };
4
+ const PULSE_QUEUE_KEY = Symbol.for("nuxt-scripts.pulse-queue");
5
+ const MAX_QUEUED_EVENTS = 100;
6
+ function getPulseState() {
7
+ if (typeof window === "undefined")
8
+ return;
9
+ const g = globalThis;
10
+ if (!g[PULSE_QUEUE_KEY]) {
11
+ g[PULSE_QUEUE_KEY] = { queue: [], flushed: false, declined: false };
12
+ }
13
+ return g[PULSE_QUEUE_KEY];
14
+ }
15
+ function isPulseReady() {
16
+ return typeof window !== "undefined" && typeof window.pulse?.track === "function";
17
+ }
18
+ function hasPulseDeclined() {
19
+ return typeof window !== "undefined" && window.__pulseInstalled === true && !isPulseReady();
20
+ }
21
+ export function useScriptPulseAnalytics(_options) {
22
+ const flushQueue = () => {
23
+ const state = getPulseState();
24
+ if (!state || state.flushed || state.declined)
25
+ return;
26
+ if (hasPulseDeclined()) {
27
+ state.declined = true;
28
+ state.queue.length = 0;
29
+ return;
30
+ }
31
+ if (!isPulseReady())
32
+ return;
33
+ state.flushed = true;
34
+ while (state.queue.length > 0) {
35
+ const args = state.queue.shift();
36
+ try {
37
+ window.pulse.track(...args);
38
+ } catch {
39
+ }
40
+ }
41
+ };
42
+ const track = (name, props, revenue) => {
43
+ if (isPulseReady()) {
44
+ window.pulse.track(name, props, revenue);
45
+ return;
46
+ }
47
+ const state = getPulseState();
48
+ if (!state || state.declined)
49
+ return;
50
+ if (hasPulseDeclined()) {
51
+ state.declined = true;
52
+ state.queue.length = 0;
53
+ return;
54
+ }
55
+ if (state.queue.length < MAX_QUEUED_EVENTS)
56
+ state.queue.push([name, props, revenue]);
57
+ };
58
+ return useRegistryScript("pulseAnalytics", (options) => ({
59
+ scriptInput: {
60
+ "src": "https://js.ciphera.net/script.js",
61
+ "data-domain": options.domain,
62
+ "data-api": options.apiUrl || void 0,
63
+ // Presence flags: the tracker reads them with hasAttribute(), so a
64
+ // rendered `data-no-scroll="false"` would still switch scroll tracking off.
65
+ "data-no-scroll": options.trackScroll === false ? "" : void 0,
66
+ "data-no-outbound": options.trackOutbound === false ? "" : void 0,
67
+ "data-no-downloads": options.trackDownloads === false ? "" : void 0
68
+ },
69
+ schema: import.meta.dev ? PulseAnalyticsOptions : void 0,
70
+ scriptOptions: {
71
+ use() {
72
+ flushQueue();
73
+ return {
74
+ track,
75
+ cleanPath: () => window.pulse?.cleanPath?.() ?? null
76
+ };
77
+ }
78
+ }
79
+ }), _options);
80
+ }
@@ -791,6 +791,34 @@ export declare const RedditPixelOptions: import("valibot").ObjectSchema<{
791
791
  */
792
792
  readonly id: import("valibot").StringSchema<undefined>;
793
793
  }, undefined>;
794
+ export declare const PulseAnalyticsOptions: import("valibot").ObjectSchema<{
795
+ /**
796
+ * The site domain as registered in Pulse.
797
+ * @see https://docs.ciphera.net/pulse/script-installation
798
+ */
799
+ readonly domain: import("valibot").StringSchema<undefined>;
800
+ /**
801
+ * The API origin the tracker posts events to. Only needed for a self-hosted
802
+ * or reverse-proxied Pulse API.
803
+ * @default 'https://pulse-api.ciphera.net'
804
+ */
805
+ readonly apiUrl: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
806
+ /**
807
+ * Record scroll depth.
808
+ * @default true
809
+ */
810
+ readonly trackScroll: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
811
+ /**
812
+ * Record outbound link clicks as `outbound_link` events.
813
+ * @default true
814
+ */
815
+ readonly trackOutbound: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
816
+ /**
817
+ * Record file download clicks as `file_download` events.
818
+ * @default true
819
+ */
820
+ readonly trackDownloads: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
821
+ }, undefined>;
794
822
  export declare const RybbitAnalyticsOptions: import("valibot").ObjectSchema<{
795
823
  /**
796
824
  * Your Rybbit site ID.
@@ -1188,6 +1216,20 @@ export declare const StripeOptions: import("valibot").ObjectSchema<{
1188
1216
  */
1189
1217
  readonly version: import("valibot").OptionalSchema<import("valibot").UnionSchema<[import("valibot").LiteralSchema<"v3", undefined>, import("valibot").LiteralSchema<"acacia", undefined>, import("valibot").LiteralSchema<"basil", undefined>, import("valibot").LiteralSchema<"clover", undefined>, import("valibot").LiteralSchema<"dahlia", undefined>, import("valibot").StringSchema<undefined>], undefined>, undefined>;
1190
1218
  }, undefined>;
1219
+ export declare const TawkToOptions: import("valibot").ObjectSchema<{
1220
+ /**
1221
+ * Your Tawk.to property ID: the first path segment of the widget embed URL
1222
+ * `https://embed.tawk.to/<propertyId>/<widgetId>`.
1223
+ * @see https://dashboard.tawk.to/
1224
+ */
1225
+ readonly propertyId: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>]>;
1226
+ /**
1227
+ * Your Tawk.to widget ID: the second path segment of the widget embed URL
1228
+ * `https://embed.tawk.to/<propertyId>/<widgetId>`.
1229
+ * @see https://dashboard.tawk.to/
1230
+ */
1231
+ readonly widgetId: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MinLengthAction<string, 1, undefined>]>;
1232
+ }, undefined>;
1191
1233
  export declare const TikTokPixelOptions: import("valibot").ObjectSchema<{
1192
1234
  /**
1193
1235
  * Your TikTok Pixel ID.