@nuxt/scripts 0.13.2 → 1.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.
- package/README.md +9 -0
- package/dist/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/{iNmKC7TZ.js → Bdf7Qtwg.js} +1 -1
- package/dist/client/_nuxt/CoyZWCgl.js +162 -0
- package/dist/client/_nuxt/{Bje-0OHL.js → DTDyDxvR.js} +1 -1
- package/dist/client/_nuxt/{rttsH3SL.js → Ds1k3yKJ.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/62574f80-71d4-4f9e-8b96-145c85230d99.json +1 -0
- package/dist/client/_nuxt/error-404.D45Vtjcx.css +1 -0
- package/dist/client/_nuxt/error-500.BOm1rWQf.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/module.d.mts +26 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +98 -54
- package/dist/registry.mjs +53 -0
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +29 -1
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +35 -10
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +29 -1
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.d.vue.ts +20 -8
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +2 -2
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue.d.ts +20 -8
- package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +7 -1
- package/dist/runtime/components/ScriptCrisp.d.vue.ts +1 -1
- package/dist/runtime/components/ScriptCrisp.vue.d.ts +1 -1
- package/dist/runtime/components/ScriptIntercom.d.vue.ts +1 -1
- package/dist/runtime/components/ScriptIntercom.vue.d.ts +1 -1
- package/dist/runtime/components/ScriptVimeoPlayer.d.vue.ts +2 -2
- package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +2 -2
- package/dist/runtime/components/ScriptYouTubePlayer.d.vue.ts +12 -1
- package/dist/runtime/components/ScriptYouTubePlayer.vue +41 -16
- package/dist/runtime/components/ScriptYouTubePlayer.vue.d.ts +12 -1
- package/dist/runtime/composables/useScript.js +10 -0
- package/dist/runtime/npm-script-stub.d.ts +20 -0
- package/dist/runtime/npm-script-stub.js +73 -0
- package/dist/runtime/registry/google-recaptcha.d.ts +27 -0
- package/dist/runtime/registry/google-recaptcha.js +45 -0
- package/dist/runtime/registry/google-sign-in.d.ts +84 -0
- package/dist/runtime/registry/google-sign-in.js +50 -0
- package/dist/runtime/registry/google-tag-manager.d.ts +3 -1
- package/dist/runtime/registry/google-tag-manager.js +15 -5
- package/dist/runtime/registry/matomo-analytics.js +1 -1
- package/dist/runtime/registry/plausible-analytics.js +8 -6
- package/dist/runtime/registry/posthog.d.ts +26 -0
- package/dist/runtime/registry/posthog.js +92 -0
- package/dist/runtime/registry/rybbit-analytics.js +38 -8
- package/dist/runtime/registry/tiktok-pixel.d.ts +43 -0
- package/dist/runtime/registry/tiktok-pixel.js +43 -0
- package/dist/runtime/server/google-static-maps-proxy.d.ts +2 -0
- package/dist/runtime/server/google-static-maps-proxy.js +54 -0
- package/dist/runtime/types.d.ts +13 -1
- package/dist/runtime/utils.d.ts +2 -1
- package/dist/runtime/utils.js +9 -0
- package/package.json +25 -19
- package/dist/client/_nuxt/DMut0W-e.js +0 -162
- package/dist/client/_nuxt/builds/meta/5e0206fe-a683-423c-8d59-2596d0b16fee.json +0 -1
- package/dist/client/_nuxt/error-404.B0ZhSNwd.css +0 -1
- package/dist/client/_nuxt/error-500.D4MdgPaC.css +0 -1
|
@@ -89,6 +89,20 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
89
89
|
* Extra Markers to add to the map.
|
|
90
90
|
*/
|
|
91
91
|
markers?: (`${string},${string}` | google.maps.marker.AdvancedMarkerElementOptions)[];
|
|
92
|
+
/**
|
|
93
|
+
* Map IDs for light and dark color modes.
|
|
94
|
+
* When provided, the map will automatically switch styles based on color mode.
|
|
95
|
+
* Requires @nuxtjs/color-mode or manual colorMode prop.
|
|
96
|
+
*/
|
|
97
|
+
mapIds?: {
|
|
98
|
+
light?: string;
|
|
99
|
+
dark?: string;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Manual color mode control. When provided, overrides auto-detection from @nuxtjs/color-mode.
|
|
103
|
+
* Accepts 'light', 'dark', or a reactive ref.
|
|
104
|
+
*/
|
|
105
|
+
colorMode?: "light" | "dark";
|
|
92
106
|
}, {
|
|
93
107
|
readonly googleMaps: Ref<typeof google.maps | undefined, typeof google.maps | undefined>;
|
|
94
108
|
readonly map: ShallowRef<google.maps.Map | undefined>;
|
|
@@ -182,6 +196,20 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
182
196
|
* Extra Markers to add to the map.
|
|
183
197
|
*/
|
|
184
198
|
markers?: (`${string},${string}` | google.maps.marker.AdvancedMarkerElementOptions)[];
|
|
199
|
+
/**
|
|
200
|
+
* Map IDs for light and dark color modes.
|
|
201
|
+
* When provided, the map will automatically switch styles based on color mode.
|
|
202
|
+
* Requires @nuxtjs/color-mode or manual colorMode prop.
|
|
203
|
+
*/
|
|
204
|
+
mapIds?: {
|
|
205
|
+
light?: string;
|
|
206
|
+
dark?: string;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Manual color mode control. When provided, overrides auto-detection from @nuxtjs/color-mode.
|
|
210
|
+
* Accepts 'light', 'dark', or a reactive ref.
|
|
211
|
+
*/
|
|
212
|
+
colorMode?: "light" | "dark";
|
|
185
213
|
}> & Readonly<{
|
|
186
214
|
onError?: (() => any) | undefined;
|
|
187
215
|
onReady?: ((e: {
|
|
@@ -205,7 +233,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
205
233
|
height: number | string;
|
|
206
234
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
207
235
|
placeholder?: (props: {
|
|
208
|
-
placeholder:
|
|
236
|
+
placeholder: string;
|
|
209
237
|
}) => any;
|
|
210
238
|
} & {
|
|
211
239
|
loading?: (props: {}) => any;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import type { MarkerClusterer, MarkerClustererOptions } from '@googlemaps/markerclusterer';
|
|
2
1
|
import { type InjectionKey, type ShallowRef } from 'vue';
|
|
2
|
+
export interface MarkerClustererInstance {
|
|
3
|
+
render: () => void;
|
|
4
|
+
setMap: (map: google.maps.Map | null) => void;
|
|
5
|
+
addListener: (event: string, handler: () => void) => void;
|
|
6
|
+
addMarker: (marker: google.maps.marker.AdvancedMarkerElement | google.maps.Marker, noDraw?: boolean) => void;
|
|
7
|
+
removeMarker: (marker: google.maps.marker.AdvancedMarkerElement | google.maps.Marker, noDraw?: boolean) => boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface MarkerClustererOptions {
|
|
10
|
+
markers?: google.maps.marker.AdvancedMarkerElement[];
|
|
11
|
+
algorithm?: unknown;
|
|
12
|
+
renderer?: unknown;
|
|
13
|
+
onClusterClick?: unknown;
|
|
14
|
+
}
|
|
3
15
|
export declare const MARKER_CLUSTERER_INJECTION_KEY: InjectionKey<{
|
|
4
|
-
markerClusterer: ShallowRef<
|
|
16
|
+
markerClusterer: ShallowRef<MarkerClustererInstance | undefined>;
|
|
5
17
|
requestRerender: () => void;
|
|
6
18
|
}>;
|
|
7
19
|
declare const _default: typeof __VLS_export;
|
|
@@ -9,15 +21,15 @@ export default _default;
|
|
|
9
21
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
10
22
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
11
23
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
12
|
-
click: (payload:
|
|
13
|
-
clusteringbegin: (payload:
|
|
14
|
-
clusteringend: (payload:
|
|
24
|
+
click: (payload: MarkerClustererInstance) => any;
|
|
25
|
+
clusteringbegin: (payload: MarkerClustererInstance) => any;
|
|
26
|
+
clusteringend: (payload: MarkerClustererInstance) => any;
|
|
15
27
|
}, string, import("vue").PublicProps, Readonly<{
|
|
16
28
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
17
29
|
}> & Readonly<{
|
|
18
|
-
onClick?: ((payload:
|
|
19
|
-
onClusteringbegin?: ((payload:
|
|
20
|
-
onClusteringend?: ((payload:
|
|
30
|
+
onClick?: ((payload: MarkerClustererInstance) => any) | undefined;
|
|
31
|
+
onClusteringbegin?: ((payload: MarkerClustererInstance) => any) | undefined;
|
|
32
|
+
onClusteringend?: ((payload: MarkerClustererInstance) => any) | undefined;
|
|
21
33
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
22
34
|
default?: (props: {}) => any;
|
|
23
35
|
}>;
|
|
@@ -54,9 +54,9 @@ provide(
|
|
|
54
54
|
requestRerender
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
|
-
function setupMarkerClustererEventListeners(
|
|
57
|
+
function setupMarkerClustererEventListeners(clusterer) {
|
|
58
58
|
markerClustererEvents.forEach((event) => {
|
|
59
|
-
|
|
59
|
+
clusterer.addListener(event, () => emit(event, clusterer));
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
</script>
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import type { MarkerClusterer, MarkerClustererOptions } from '@googlemaps/markerclusterer';
|
|
2
1
|
import { type InjectionKey, type ShallowRef } from 'vue';
|
|
2
|
+
export interface MarkerClustererInstance {
|
|
3
|
+
render: () => void;
|
|
4
|
+
setMap: (map: google.maps.Map | null) => void;
|
|
5
|
+
addListener: (event: string, handler: () => void) => void;
|
|
6
|
+
addMarker: (marker: google.maps.marker.AdvancedMarkerElement | google.maps.Marker, noDraw?: boolean) => void;
|
|
7
|
+
removeMarker: (marker: google.maps.marker.AdvancedMarkerElement | google.maps.Marker, noDraw?: boolean) => boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface MarkerClustererOptions {
|
|
10
|
+
markers?: google.maps.marker.AdvancedMarkerElement[];
|
|
11
|
+
algorithm?: unknown;
|
|
12
|
+
renderer?: unknown;
|
|
13
|
+
onClusterClick?: unknown;
|
|
14
|
+
}
|
|
3
15
|
export declare const MARKER_CLUSTERER_INJECTION_KEY: InjectionKey<{
|
|
4
|
-
markerClusterer: ShallowRef<
|
|
16
|
+
markerClusterer: ShallowRef<MarkerClustererInstance | undefined>;
|
|
5
17
|
requestRerender: () => void;
|
|
6
18
|
}>;
|
|
7
19
|
declare const _default: typeof __VLS_export;
|
|
@@ -9,15 +21,15 @@ export default _default;
|
|
|
9
21
|
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
10
22
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
11
23
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
12
|
-
click: (payload:
|
|
13
|
-
clusteringbegin: (payload:
|
|
14
|
-
clusteringend: (payload:
|
|
24
|
+
click: (payload: MarkerClustererInstance) => any;
|
|
25
|
+
clusteringbegin: (payload: MarkerClustererInstance) => any;
|
|
26
|
+
clusteringend: (payload: MarkerClustererInstance) => any;
|
|
15
27
|
}, string, import("vue").PublicProps, Readonly<{
|
|
16
28
|
options?: Omit<MarkerClustererOptions, "map">;
|
|
17
29
|
}> & Readonly<{
|
|
18
|
-
onClick?: ((payload:
|
|
19
|
-
onClusteringbegin?: ((payload:
|
|
20
|
-
onClusteringend?: ((payload:
|
|
30
|
+
onClick?: ((payload: MarkerClustererInstance) => any) | undefined;
|
|
31
|
+
onClusteringbegin?: ((payload: MarkerClustererInstance) => any) | undefined;
|
|
32
|
+
onClusteringend?: ((payload: MarkerClustererInstance) => any) | undefined;
|
|
21
33
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
22
34
|
default?: (props: {}) => any;
|
|
23
35
|
}>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { inject, shallowRef } from "vue";
|
|
6
|
+
import { inject, onUnmounted, shallowRef } from "vue";
|
|
7
7
|
import { whenever } from "@vueuse/core";
|
|
8
8
|
import { MAP_INJECTION_KEY } from "./ScriptGoogleMaps.vue";
|
|
9
9
|
import { ADVANCED_MARKER_ELEMENT_INJECTION_KEY } from "./ScriptGoogleMapsAdvancedMarkerElement.vue";
|
|
@@ -34,4 +34,10 @@ whenever(
|
|
|
34
34
|
once: true
|
|
35
35
|
}
|
|
36
36
|
);
|
|
37
|
+
onUnmounted(() => {
|
|
38
|
+
if (advancedMarkerElementContext?.advancedMarkerElement.value && pinElement.value) {
|
|
39
|
+
advancedMarkerElementContext.advancedMarkerElement.value.content = null;
|
|
40
|
+
}
|
|
41
|
+
pinElement.value = void 0;
|
|
42
|
+
});
|
|
37
43
|
</script>
|
|
@@ -64,6 +64,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
64
64
|
getPlaybackRate: () => Promise<number> | undefined;
|
|
65
65
|
setPlaybackRate: (rate: number) => Promise<number> | undefined;
|
|
66
66
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
67
|
+
progress: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
67
68
|
error: (event: import("@vimeo/player").Error, player: Vimeo.Player) => any;
|
|
68
69
|
loaded: (event: import("@vimeo/player").LoadedEvent, player: Vimeo.Player) => any;
|
|
69
70
|
cuechange: (event: import("@vimeo/player").CueChangeEvent, player: Vimeo.Player) => any;
|
|
@@ -72,7 +73,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
72
73
|
pause: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
73
74
|
play: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
74
75
|
playing: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
75
|
-
progress: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
76
76
|
resize: (event: import("@vimeo/player").ResizeEvent, player: Vimeo.Player) => any;
|
|
77
77
|
seeked: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
78
78
|
seeking: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
@@ -90,6 +90,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
90
90
|
enterpictureinpicture: (event: never, player: Vimeo.Player) => any;
|
|
91
91
|
leavepictureinpicture: (event: never, player: Vimeo.Player) => any;
|
|
92
92
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
93
|
+
onProgress?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
93
94
|
onError?: ((event: import("@vimeo/player").Error, player: Vimeo.Player) => any) | undefined;
|
|
94
95
|
onLoaded?: ((event: import("@vimeo/player").LoadedEvent, player: Vimeo.Player) => any) | undefined;
|
|
95
96
|
onCuechange?: ((event: import("@vimeo/player").CueChangeEvent, player: Vimeo.Player) => any) | undefined;
|
|
@@ -98,7 +99,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
98
99
|
onPause?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
99
100
|
onPlay?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
100
101
|
onPlaying?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
101
|
-
onProgress?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
102
102
|
onResize?: ((event: import("@vimeo/player").ResizeEvent, player: Vimeo.Player) => any) | undefined;
|
|
103
103
|
onSeeked?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
104
104
|
onSeeking?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
@@ -64,6 +64,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
64
64
|
getPlaybackRate: () => Promise<number> | undefined;
|
|
65
65
|
setPlaybackRate: (rate: number) => Promise<number> | undefined;
|
|
66
66
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
67
|
+
progress: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
67
68
|
error: (event: import("@vimeo/player").Error, player: Vimeo.Player) => any;
|
|
68
69
|
loaded: (event: import("@vimeo/player").LoadedEvent, player: Vimeo.Player) => any;
|
|
69
70
|
cuechange: (event: import("@vimeo/player").CueChangeEvent, player: Vimeo.Player) => any;
|
|
@@ -72,7 +73,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
72
73
|
pause: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
73
74
|
play: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
74
75
|
playing: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
75
|
-
progress: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
76
76
|
resize: (event: import("@vimeo/player").ResizeEvent, player: Vimeo.Player) => any;
|
|
77
77
|
seeked: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
78
78
|
seeking: (event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any;
|
|
@@ -90,6 +90,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
90
90
|
enterpictureinpicture: (event: never, player: Vimeo.Player) => any;
|
|
91
91
|
leavepictureinpicture: (event: never, player: Vimeo.Player) => any;
|
|
92
92
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
93
|
+
onProgress?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
93
94
|
onError?: ((event: import("@vimeo/player").Error, player: Vimeo.Player) => any) | undefined;
|
|
94
95
|
onLoaded?: ((event: import("@vimeo/player").LoadedEvent, player: Vimeo.Player) => any) | undefined;
|
|
95
96
|
onCuechange?: ((event: import("@vimeo/player").CueChangeEvent, player: Vimeo.Player) => any) | undefined;
|
|
@@ -98,7 +99,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
98
99
|
onPause?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
99
100
|
onPlay?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
100
101
|
onPlaying?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
101
|
-
onProgress?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
102
102
|
onResize?: ((event: import("@vimeo/player").ResizeEvent, player: Vimeo.Player) => any) | undefined;
|
|
103
103
|
onSeeked?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
104
104
|
onSeeking?: ((event: import("@vimeo/player").TimeEvent, player: Vimeo.Player) => any) | undefined;
|
|
@@ -10,6 +10,7 @@ type __VLS_Props = {
|
|
|
10
10
|
playerVars?: YT.PlayerVars;
|
|
11
11
|
width?: number;
|
|
12
12
|
height?: number;
|
|
13
|
+
ratio?: string;
|
|
13
14
|
/**
|
|
14
15
|
* Whether to use youtube-nocookie.com for embedding.
|
|
15
16
|
*
|
|
@@ -19,9 +20,15 @@ type __VLS_Props = {
|
|
|
19
20
|
playerOptions?: YT.PlayerOptions;
|
|
20
21
|
thumbnailSize?: YoutubeThumbnailSize;
|
|
21
22
|
webp?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Object-fit for the placeholder image.
|
|
25
|
+
*
|
|
26
|
+
* @default 'cover'
|
|
27
|
+
*/
|
|
28
|
+
placeholderObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
22
29
|
};
|
|
23
30
|
declare var __VLS_1: {
|
|
24
|
-
placeholder:
|
|
31
|
+
placeholder: string;
|
|
25
32
|
}, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
|
|
26
33
|
type __VLS_Slots = {} & {
|
|
27
34
|
placeholder?: (props: typeof __VLS_1) => any;
|
|
@@ -42,20 +49,24 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
42
49
|
"state-change": (e: YT.OnStateChangeEvent, target: YT.Player) => any;
|
|
43
50
|
"playback-quality-change": (e: YT.OnPlaybackQualityChangeEvent, target: YT.Player) => any;
|
|
44
51
|
"playback-rate-change": (e: YT.OnPlaybackRateChangeEvent, target: YT.Player) => any;
|
|
52
|
+
"api-change": (e: YT.PlayerEvent, target: YT.Player) => any;
|
|
45
53
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
46
54
|
onError?: ((e: YT.OnErrorEvent, target: YT.Player) => any) | undefined;
|
|
47
55
|
onReady?: ((e: YT.PlayerEvent) => any) | undefined;
|
|
48
56
|
"onState-change"?: ((e: YT.OnStateChangeEvent, target: YT.Player) => any) | undefined;
|
|
49
57
|
"onPlayback-quality-change"?: ((e: YT.OnPlaybackQualityChangeEvent, target: YT.Player) => any) | undefined;
|
|
50
58
|
"onPlayback-rate-change"?: ((e: YT.OnPlaybackRateChangeEvent, target: YT.Player) => any) | undefined;
|
|
59
|
+
"onApi-change"?: ((e: YT.PlayerEvent, target: YT.Player) => any) | undefined;
|
|
51
60
|
}>, {
|
|
52
61
|
trigger: ElementScriptTrigger;
|
|
53
62
|
width: number;
|
|
54
63
|
height: number;
|
|
55
64
|
playerVars: YT.PlayerVars;
|
|
65
|
+
ratio: string;
|
|
56
66
|
cookies: boolean;
|
|
57
67
|
thumbnailSize: YoutubeThumbnailSize;
|
|
58
68
|
webp: boolean;
|
|
69
|
+
placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
59
70
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
60
71
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
61
72
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed, onMounted, ref, watch } from "vue";
|
|
2
|
+
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useHead } from "nuxt/app";
|
|
5
5
|
import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
|
|
@@ -14,12 +14,14 @@ const props = defineProps({
|
|
|
14
14
|
playerVars: { type: null, required: false, default: { autoplay: 0, playsinline: 1 } },
|
|
15
15
|
width: { type: Number, required: false, default: 640 },
|
|
16
16
|
height: { type: Number, required: false, default: 360 },
|
|
17
|
+
ratio: { type: String, required: false, default: "16/9" },
|
|
17
18
|
cookies: { type: Boolean, required: false, default: false },
|
|
18
19
|
playerOptions: { type: null, required: false },
|
|
19
20
|
thumbnailSize: { type: String, required: false, default: "hq720" },
|
|
20
|
-
webp: { type: Boolean, required: false, default: true }
|
|
21
|
+
webp: { type: Boolean, required: false, default: true },
|
|
22
|
+
placeholderObjectFit: { type: String, required: false, default: "cover" }
|
|
21
23
|
});
|
|
22
|
-
const emits = defineEmits(["ready", "state-change", "playback-quality-change", "playback-rate-change", "error"]);
|
|
24
|
+
const emits = defineEmits(["ready", "state-change", "playback-quality-change", "playback-rate-change", "error", "api-change"]);
|
|
23
25
|
const events = [
|
|
24
26
|
"onReady",
|
|
25
27
|
"onStateChange",
|
|
@@ -31,24 +33,46 @@ const events = [
|
|
|
31
33
|
const rootEl = ref();
|
|
32
34
|
const youtubeEl = ref();
|
|
33
35
|
const ready = ref(false);
|
|
36
|
+
const isTriggered = ref(false);
|
|
34
37
|
const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
|
|
35
38
|
const script = useScriptYouTubePlayer({
|
|
36
39
|
scriptOptions: {
|
|
40
|
+
// Use immediate trigger so script loads when ANY player needs it
|
|
41
|
+
// Each player will wait for its own trigger before creating iframe
|
|
37
42
|
trigger
|
|
38
43
|
}
|
|
39
44
|
});
|
|
40
45
|
const { onLoaded, status } = script;
|
|
41
46
|
const player = ref();
|
|
42
|
-
|
|
43
|
-
if (
|
|
47
|
+
const clickTriggered = ref(false);
|
|
48
|
+
if (trigger instanceof Promise) {
|
|
44
49
|
trigger.then((triggered) => {
|
|
45
50
|
if (triggered) {
|
|
46
|
-
|
|
51
|
+
isTriggered.value = true;
|
|
52
|
+
if (props.trigger === "mousedown") {
|
|
53
|
+
clickTriggered.value = true;
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
56
|
});
|
|
57
|
+
} else {
|
|
58
|
+
isTriggered.value = true;
|
|
49
59
|
}
|
|
60
|
+
const stopVideoIdWatch = watch(() => props.videoId, (newId) => {
|
|
61
|
+
if (ready.value && player.value) {
|
|
62
|
+
player.value.loadVideoById(newId);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
onBeforeUnmount(() => {
|
|
66
|
+
stopVideoIdWatch();
|
|
67
|
+
player.value?.destroy();
|
|
68
|
+
});
|
|
50
69
|
onMounted(() => {
|
|
51
70
|
onLoaded(async (instance) => {
|
|
71
|
+
if (!isTriggered.value && trigger instanceof Promise) {
|
|
72
|
+
const triggered = await trigger;
|
|
73
|
+
if (!triggered) return;
|
|
74
|
+
}
|
|
75
|
+
if (!youtubeEl.value) return;
|
|
52
76
|
const YouTube = instance.YT instanceof Promise ? await instance.YT : instance.YT;
|
|
53
77
|
await new Promise((resolve) => {
|
|
54
78
|
if (typeof YT.Player === "undefined")
|
|
@@ -56,22 +80,23 @@ onMounted(() => {
|
|
|
56
80
|
else
|
|
57
81
|
resolve();
|
|
58
82
|
});
|
|
83
|
+
if (!youtubeEl.value) return;
|
|
59
84
|
player.value = new YT.Player(youtubeEl.value, {
|
|
60
85
|
host: !props.cookies ? "https://www.youtube-nocookie.com" : "https://www.youtube.com",
|
|
61
|
-
|
|
86
|
+
videoId: props.videoId,
|
|
87
|
+
width: props.width,
|
|
88
|
+
height: props.height,
|
|
89
|
+
playerVars: props.playerVars,
|
|
62
90
|
...props.playerOptions,
|
|
63
91
|
events: Object.fromEntries(events.map((event) => [event, (e) => {
|
|
64
92
|
const emitEventName = event.replace(/([A-Z])/g, "-$1").replace("on-", "").toLowerCase();
|
|
65
93
|
emits(emitEventName, e);
|
|
66
94
|
if (event === "onReady") {
|
|
67
95
|
ready.value = true;
|
|
68
|
-
if (clickTriggered) {
|
|
96
|
+
if (clickTriggered.value) {
|
|
69
97
|
player.value?.playVideo();
|
|
70
|
-
clickTriggered = false;
|
|
98
|
+
clickTriggered.value = false;
|
|
71
99
|
}
|
|
72
|
-
watch(() => props.videoId, () => {
|
|
73
|
-
player.value?.loadVideoById(props.videoId);
|
|
74
|
-
});
|
|
75
100
|
}
|
|
76
101
|
}]))
|
|
77
102
|
});
|
|
@@ -96,7 +121,7 @@ const rootAttrs = computed(() => {
|
|
|
96
121
|
position: "relative",
|
|
97
122
|
backgroundColor: "black",
|
|
98
123
|
width: "100%",
|
|
99
|
-
aspectRatio:
|
|
124
|
+
aspectRatio: props.ratio
|
|
100
125
|
},
|
|
101
126
|
...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
|
|
102
127
|
});
|
|
@@ -108,12 +133,12 @@ if (import.meta.server) {
|
|
|
108
133
|
useHead({
|
|
109
134
|
link: [
|
|
110
135
|
{
|
|
111
|
-
key:
|
|
136
|
+
key: "nuxt-script-youtube-img-preconnect",
|
|
112
137
|
rel: props.aboveTheFold ? "preconnect" : "dns-prefetch",
|
|
113
138
|
href: "https://i.ytimg.com"
|
|
114
139
|
},
|
|
115
140
|
props.aboveTheFold ? {
|
|
116
|
-
key: `nuxt-script-youtube-img`,
|
|
141
|
+
key: `nuxt-script-youtube-img-preload-${props.videoId}`,
|
|
117
142
|
rel: "preload",
|
|
118
143
|
as: "image",
|
|
119
144
|
href: placeholder.value
|
|
@@ -128,7 +153,7 @@ const placeholderAttrs = computed(() => {
|
|
|
128
153
|
loading: props.aboveTheFold ? "eager" : "lazy",
|
|
129
154
|
style: {
|
|
130
155
|
width: "100%",
|
|
131
|
-
objectFit:
|
|
156
|
+
objectFit: props.placeholderObjectFit,
|
|
132
157
|
height: "100%"
|
|
133
158
|
},
|
|
134
159
|
onLoad(payload) {
|
|
@@ -10,6 +10,7 @@ type __VLS_Props = {
|
|
|
10
10
|
playerVars?: YT.PlayerVars;
|
|
11
11
|
width?: number;
|
|
12
12
|
height?: number;
|
|
13
|
+
ratio?: string;
|
|
13
14
|
/**
|
|
14
15
|
* Whether to use youtube-nocookie.com for embedding.
|
|
15
16
|
*
|
|
@@ -19,9 +20,15 @@ type __VLS_Props = {
|
|
|
19
20
|
playerOptions?: YT.PlayerOptions;
|
|
20
21
|
thumbnailSize?: YoutubeThumbnailSize;
|
|
21
22
|
webp?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Object-fit for the placeholder image.
|
|
25
|
+
*
|
|
26
|
+
* @default 'cover'
|
|
27
|
+
*/
|
|
28
|
+
placeholderObjectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
22
29
|
};
|
|
23
30
|
declare var __VLS_1: {
|
|
24
|
-
placeholder:
|
|
31
|
+
placeholder: string;
|
|
25
32
|
}, __VLS_3: {}, __VLS_10: {}, __VLS_12: {}, __VLS_14: {};
|
|
26
33
|
type __VLS_Slots = {} & {
|
|
27
34
|
placeholder?: (props: typeof __VLS_1) => any;
|
|
@@ -42,20 +49,24 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
|
42
49
|
"state-change": (e: YT.OnStateChangeEvent, target: YT.Player) => any;
|
|
43
50
|
"playback-quality-change": (e: YT.OnPlaybackQualityChangeEvent, target: YT.Player) => any;
|
|
44
51
|
"playback-rate-change": (e: YT.OnPlaybackRateChangeEvent, target: YT.Player) => any;
|
|
52
|
+
"api-change": (e: YT.PlayerEvent, target: YT.Player) => any;
|
|
45
53
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
46
54
|
onError?: ((e: YT.OnErrorEvent, target: YT.Player) => any) | undefined;
|
|
47
55
|
onReady?: ((e: YT.PlayerEvent) => any) | undefined;
|
|
48
56
|
"onState-change"?: ((e: YT.OnStateChangeEvent, target: YT.Player) => any) | undefined;
|
|
49
57
|
"onPlayback-quality-change"?: ((e: YT.OnPlaybackQualityChangeEvent, target: YT.Player) => any) | undefined;
|
|
50
58
|
"onPlayback-rate-change"?: ((e: YT.OnPlaybackRateChangeEvent, target: YT.Player) => any) | undefined;
|
|
59
|
+
"onApi-change"?: ((e: YT.PlayerEvent, target: YT.Player) => any) | undefined;
|
|
51
60
|
}>, {
|
|
52
61
|
trigger: ElementScriptTrigger;
|
|
53
62
|
width: number;
|
|
54
63
|
height: number;
|
|
55
64
|
playerVars: YT.PlayerVars;
|
|
65
|
+
ratio: string;
|
|
56
66
|
cookies: boolean;
|
|
57
67
|
thumbnailSize: YoutubeThumbnailSize;
|
|
58
68
|
webp: boolean;
|
|
69
|
+
placeholderObjectFit: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
59
70
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
60
71
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
61
72
|
declare const _default: typeof __VLS_export;
|
|
@@ -65,6 +65,16 @@ export function useScript(input, options) {
|
|
|
65
65
|
}
|
|
66
66
|
return _load();
|
|
67
67
|
};
|
|
68
|
+
instance.reload = async () => {
|
|
69
|
+
instance.remove();
|
|
70
|
+
const reloadInput = typeof input === "string" ? { src: input, key: `${id}-${Date.now()}` } : { ...input, key: `${id}-${Date.now()}` };
|
|
71
|
+
const reloaded = _useScript(reloadInput, { ...options, trigger: "client" });
|
|
72
|
+
Object.assign(instance, {
|
|
73
|
+
status: reloaded.status,
|
|
74
|
+
entry: reloaded.entry
|
|
75
|
+
});
|
|
76
|
+
return reloaded.load();
|
|
77
|
+
};
|
|
68
78
|
nuxtApp.$scripts[id] = instance;
|
|
69
79
|
if (import.meta.dev && import.meta.client) {
|
|
70
80
|
let syncScripts = function() {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { NuxtUseScriptOptions } from './types.js';
|
|
3
|
+
export interface NpmScriptStubOptions {
|
|
4
|
+
key: string;
|
|
5
|
+
use?: () => any;
|
|
6
|
+
clientInit?: () => void | Promise<any>;
|
|
7
|
+
trigger?: NuxtUseScriptOptions['trigger'];
|
|
8
|
+
}
|
|
9
|
+
export interface NpmScriptStub<T = any> {
|
|
10
|
+
status: Ref<'awaitingLoad' | 'loading' | 'loaded' | 'error'>;
|
|
11
|
+
load: () => Promise<void>;
|
|
12
|
+
onLoaded: (callback: (api: T) => void) => void;
|
|
13
|
+
proxy: T;
|
|
14
|
+
$script?: any;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a script stub for NPM-only packages (no external script tag)
|
|
18
|
+
* Manages lifecycle and status without relying on script tag loading
|
|
19
|
+
*/
|
|
20
|
+
export declare function createNpmScriptStub<T = any>(options: NpmScriptStubOptions): NpmScriptStub<T>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { logger } from "./logger.js";
|
|
3
|
+
export function createNpmScriptStub(options) {
|
|
4
|
+
const status = ref("awaitingLoad");
|
|
5
|
+
const loadedCallbacks = [];
|
|
6
|
+
let initPromise = null;
|
|
7
|
+
let hasInitialized = false;
|
|
8
|
+
const proxy = options.use?.() || {};
|
|
9
|
+
const stub = {
|
|
10
|
+
status,
|
|
11
|
+
proxy,
|
|
12
|
+
async load() {
|
|
13
|
+
if (hasInitialized || status.value !== "awaitingLoad")
|
|
14
|
+
return;
|
|
15
|
+
hasInitialized = true;
|
|
16
|
+
status.value = "loading";
|
|
17
|
+
try {
|
|
18
|
+
if (options.clientInit) {
|
|
19
|
+
console.log(`[NpmScriptStub] Initializing ${options.key}...`);
|
|
20
|
+
initPromise = Promise.resolve(options.clientInit());
|
|
21
|
+
await initPromise;
|
|
22
|
+
console.log(`[NpmScriptStub] ${options.key} initialized successfully`);
|
|
23
|
+
}
|
|
24
|
+
status.value = "loaded";
|
|
25
|
+
loadedCallbacks.forEach((cb) => {
|
|
26
|
+
try {
|
|
27
|
+
cb(proxy);
|
|
28
|
+
} catch (error) {
|
|
29
|
+
logger.error(`[NpmScriptStub] Error in onLoaded callback for ${options.key}:`, error);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
} catch (error) {
|
|
33
|
+
logger.error(`[NpmScriptStub] Failed to initialize ${options.key}:`, error);
|
|
34
|
+
status.value = "error";
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
onLoaded(callback) {
|
|
38
|
+
if (status.value === "loaded") {
|
|
39
|
+
callback(proxy);
|
|
40
|
+
} else {
|
|
41
|
+
loadedCallbacks.push(callback);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
// Mock $script for compatibility with useScript API
|
|
45
|
+
get $script() {
|
|
46
|
+
return {
|
|
47
|
+
status: status.value,
|
|
48
|
+
load: stub.load
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
if (options.trigger) {
|
|
53
|
+
if (typeof options.trigger === "function") {
|
|
54
|
+
const res = options.trigger(() => stub.load());
|
|
55
|
+
if (res && typeof res === "object" && "then" in res)
|
|
56
|
+
res.then(() => stub.load());
|
|
57
|
+
} else if (options.trigger === "manual") {
|
|
58
|
+
} else if (options.trigger === "onNuxtReady") {
|
|
59
|
+
import("nuxt/app").then(({ onNuxtReady }) => {
|
|
60
|
+
onNuxtReady(() => stub.load());
|
|
61
|
+
});
|
|
62
|
+
} else if (options.trigger === "client") {
|
|
63
|
+
if (import.meta.client) {
|
|
64
|
+
stub.load();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
if (import.meta.client) {
|
|
69
|
+
stub.load();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return stub;
|
|
73
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RegistryScriptInput } from '#nuxt-scripts/types';
|
|
2
|
+
export declare const GoogleRecaptchaOptions: import("valibot").ObjectSchema<{
|
|
3
|
+
readonly siteKey: import("valibot").StringSchema<undefined>;
|
|
4
|
+
readonly enterprise: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
5
|
+
readonly recaptchaNet: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
6
|
+
readonly hl: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
|
|
7
|
+
}, undefined>;
|
|
8
|
+
export type GoogleRecaptchaInput = RegistryScriptInput<typeof GoogleRecaptchaOptions>;
|
|
9
|
+
export interface GoogleRecaptchaApi {
|
|
10
|
+
grecaptcha: {
|
|
11
|
+
ready: (callback: () => void) => void;
|
|
12
|
+
execute: (siteKey: string, options: {
|
|
13
|
+
action: string;
|
|
14
|
+
}) => Promise<string>;
|
|
15
|
+
enterprise?: {
|
|
16
|
+
ready: (callback: () => void) => void;
|
|
17
|
+
execute: (siteKey: string, options: {
|
|
18
|
+
action: string;
|
|
19
|
+
}) => Promise<string>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
declare global {
|
|
24
|
+
interface Window extends GoogleRecaptchaApi {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export declare function useScriptGoogleRecaptcha<T extends GoogleRecaptchaApi>(_options?: GoogleRecaptchaInput): import("#nuxt-scripts/types").UseScriptContext<T>;
|