@nuxt/scripts 0.11.4 → 0.11.6
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/dist/client/200.html +9 -9
- package/dist/client/404.html +9 -9
- package/dist/client/_nuxt/{Bo1SWr6k.js → C347yIJI.js} +1 -1
- package/dist/client/_nuxt/DhL_UpCd.js +1 -0
- package/dist/client/_nuxt/Di440A2l.js +1 -0
- package/dist/client/_nuxt/V79VpDdr.js +21 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/3e09fd1b-e587-4ed5-a851-8fd373eda48a.json +1 -0
- package/dist/client/_nuxt/{entry.CJckMUzn.css → entry.B4DN0kwM.css} +1 -1
- package/dist/client/_nuxt/error-404.BtCtaqmq.css +1 -0
- package/dist/client/_nuxt/error-500.D9fi60uT.css +1 -0
- package/dist/client/index.html +9 -9
- package/dist/module.json +3 -3
- package/dist/registry.mjs +18 -0
- package/dist/runtime/components/ScriptAriaLoadingIndicator.vue.d.ts +2 -0
- package/dist/runtime/components/ScriptCarbonAds.vue +41 -57
- package/dist/runtime/components/ScriptCarbonAds.vue.d.ts +49 -0
- package/dist/runtime/components/ScriptCrisp.vue +43 -63
- package/dist/runtime/components/ScriptCrisp.vue.d.ts +65 -0
- package/dist/runtime/components/ScriptGoogleAdsense.vue +37 -60
- package/dist/runtime/components/ScriptGoogleAdsense.vue.d.ts +59 -0
- package/dist/runtime/components/ScriptGoogleMaps.vue +220 -365
- package/dist/runtime/components/ScriptGoogleMaps.vue.d.ts +215 -0
- package/dist/runtime/components/ScriptIntercom.vue +48 -67
- package/dist/runtime/components/ScriptIntercom.vue.d.ts +70 -0
- package/dist/runtime/components/ScriptLemonSqueezy.vue +26 -37
- package/dist/runtime/components/ScriptLemonSqueezy.vue.d.ts +41 -0
- package/dist/runtime/components/ScriptLoadingIndicator.vue +8 -13
- package/dist/runtime/components/ScriptLoadingIndicator.vue.d.ts +9 -0
- package/dist/runtime/components/ScriptStripePricingTable.vue +41 -53
- package/dist/runtime/components/ScriptStripePricingTable.vue.d.ts +56 -0
- package/dist/runtime/components/ScriptVimeoPlayer.vue +121 -218
- package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +233 -0
- package/dist/runtime/components/ScriptYouTubePlayer.vue +105 -163
- package/dist/runtime/components/ScriptYouTubePlayer.vue.d.ts +133 -0
- package/dist/runtime/registry/clarity.d.ts +1 -1
- package/dist/runtime/registry/clarity.js +7 -1
- package/dist/runtime/registry/snapchat-pixel.js +1 -1
- package/dist/types.d.mts +2 -2
- package/package.json +39 -34
- package/dist/client/_nuxt/BojlM8av.js +0 -21
- package/dist/client/_nuxt/BwFnCI0m.js +0 -1
- package/dist/client/_nuxt/builds/meta/d0cfdf7f-f013-4561-b983-7ab31692811a.json +0 -1
- package/dist/client/_nuxt/error-404.BiTeRF3j.css +0 -1
- package/dist/client/_nuxt/error-500.Be1AE5oK.css +0 -1
- package/dist/client/_nuxt/yRslIvSb.js +0 -1
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -60
- package/dist/registry.d.ts +0 -6
- package/dist/types.d.ts +0 -7
|
@@ -1,66 +1,54 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { ref, computed, onBeforeUnmount, onMounted, watch } from
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const emit = defineEmits<{
|
|
19
|
-
ready: [ReturnType<typeof useScript>]
|
|
20
|
-
error: []
|
|
21
|
-
}>()
|
|
22
|
-
|
|
23
|
-
const rootEl = ref<HTMLDivElement | undefined>()
|
|
24
|
-
const containerEl = ref<HTMLDivElement | undefined>()
|
|
25
|
-
const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl })
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, onBeforeUnmount, onMounted, watch } from "vue";
|
|
3
|
+
import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
|
|
4
|
+
import { useScript } from "#imports";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
trigger: { type: [String, Array, Boolean], required: false, default: "visible" },
|
|
7
|
+
publishableKey: { type: String, required: true },
|
|
8
|
+
pricingTableId: { type: String, required: true },
|
|
9
|
+
clientReferenceId: { type: String, required: false },
|
|
10
|
+
customerEmail: { type: String, required: false },
|
|
11
|
+
customerSessionClientSecret: { type: String, required: false }
|
|
12
|
+
});
|
|
13
|
+
const emit = defineEmits(["ready", "error"]);
|
|
14
|
+
const rootEl = ref();
|
|
15
|
+
const containerEl = ref();
|
|
16
|
+
const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
|
|
26
17
|
const instance = useScript(`https://js.stripe.com/v3/pricing-table.js`, {
|
|
27
|
-
trigger
|
|
28
|
-
})
|
|
29
|
-
const { onLoaded, status } = instance
|
|
30
|
-
|
|
31
|
-
const pricingTable = ref<HTMLElement | undefined>()
|
|
18
|
+
trigger
|
|
19
|
+
});
|
|
20
|
+
const { onLoaded, status } = instance;
|
|
21
|
+
const pricingTable = ref();
|
|
32
22
|
onMounted(() => {
|
|
33
23
|
onLoaded(() => {
|
|
34
|
-
const StripePricingTable = window.customElements.get(
|
|
35
|
-
const stripePricingTable = new StripePricingTable()
|
|
36
|
-
stripePricingTable.setAttribute(
|
|
37
|
-
stripePricingTable.setAttribute(
|
|
24
|
+
const StripePricingTable = window.customElements.get("stripe-pricing-table");
|
|
25
|
+
const stripePricingTable = new StripePricingTable();
|
|
26
|
+
stripePricingTable.setAttribute("publishable-key", props.publishableKey);
|
|
27
|
+
stripePricingTable.setAttribute("pricing-table-id", props.pricingTableId);
|
|
38
28
|
if (props.clientReferenceId)
|
|
39
|
-
stripePricingTable.setAttribute(
|
|
29
|
+
stripePricingTable.setAttribute("client-reference-id", props.clientReferenceId);
|
|
40
30
|
if (props.customerEmail)
|
|
41
|
-
stripePricingTable.setAttribute(
|
|
31
|
+
stripePricingTable.setAttribute("customer-email", props.customerEmail);
|
|
42
32
|
if (props.customerSessionClientSecret)
|
|
43
|
-
stripePricingTable.setAttribute(
|
|
44
|
-
pricingTable.value = stripePricingTable
|
|
45
|
-
rootEl.value
|
|
46
|
-
emit(
|
|
47
|
-
})
|
|
48
|
-
watch(status, (
|
|
49
|
-
if (
|
|
50
|
-
emit(
|
|
33
|
+
stripePricingTable.setAttribute("customer-session-client-secret", props.customerSessionClientSecret);
|
|
34
|
+
pricingTable.value = stripePricingTable;
|
|
35
|
+
rootEl.value.appendChild(stripePricingTable);
|
|
36
|
+
emit("ready", instance);
|
|
37
|
+
});
|
|
38
|
+
watch(status, (status2) => {
|
|
39
|
+
if (status2 === "error") {
|
|
40
|
+
emit("error");
|
|
51
41
|
}
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
|
|
42
|
+
});
|
|
43
|
+
});
|
|
55
44
|
onBeforeUnmount(() => {
|
|
56
|
-
pricingTable.value?.remove()
|
|
57
|
-
})
|
|
58
|
-
|
|
45
|
+
pricingTable.value?.remove();
|
|
46
|
+
});
|
|
59
47
|
const rootAttrs = computed(() => {
|
|
60
48
|
return {
|
|
61
|
-
...
|
|
62
|
-
}
|
|
63
|
-
})
|
|
49
|
+
...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
|
|
50
|
+
};
|
|
51
|
+
});
|
|
64
52
|
</script>
|
|
65
53
|
|
|
66
54
|
<template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ElementScriptTrigger } from '../types.js';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
trigger?: ElementScriptTrigger;
|
|
4
|
+
publishableKey: string;
|
|
5
|
+
pricingTableId: string;
|
|
6
|
+
clientReferenceId?: string;
|
|
7
|
+
customerEmail?: string;
|
|
8
|
+
customerSessionClientSecret?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const rootEl: import("vue").Ref<HTMLDivElement | undefined, HTMLDivElement | undefined>;
|
|
11
|
+
declare const containerEl: import("vue").Ref<HTMLDivElement | undefined, HTMLDivElement | undefined>;
|
|
12
|
+
declare const status: import("vue").Ref<import("@unhead/vue").UseScriptStatus, import("@unhead/vue").UseScriptStatus>;
|
|
13
|
+
declare const rootAttrs: import("vue").ComputedRef<{
|
|
14
|
+
[x: string]: string;
|
|
15
|
+
}>;
|
|
16
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
17
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {};
|
|
18
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
19
|
+
loading?: (props: typeof __VLS_1) => any;
|
|
20
|
+
} & {
|
|
21
|
+
awaitingLoad?: (props: typeof __VLS_3) => any;
|
|
22
|
+
} & {
|
|
23
|
+
error?: (props: typeof __VLS_5) => any;
|
|
24
|
+
} & {
|
|
25
|
+
default?: (props: typeof __VLS_7) => any;
|
|
26
|
+
}>;
|
|
27
|
+
declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
|
|
28
|
+
rootEl: typeof rootEl;
|
|
29
|
+
containerEl: typeof containerEl;
|
|
30
|
+
status: typeof status;
|
|
31
|
+
rootAttrs: typeof rootAttrs;
|
|
32
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
+
error: () => any;
|
|
34
|
+
ready: (args_0: import("../types.js").UseScriptContext<Record<string | symbol, any>>) => any;
|
|
35
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
36
|
+
onError?: (() => any) | undefined;
|
|
37
|
+
onReady?: ((args_0: import("../types.js").UseScriptContext<Record<string | symbol, any>>) => any) | undefined;
|
|
38
|
+
}>, {
|
|
39
|
+
trigger: ElementScriptTrigger;
|
|
40
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
42
|
+
error: () => any;
|
|
43
|
+
ready: (args_0: import("../types.js").UseScriptContext<Record<string | symbol, any>>) => any;
|
|
44
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
45
|
+
onError?: (() => any) | undefined;
|
|
46
|
+
onReady?: ((args_0: import("../types.js").UseScriptContext<Record<string | symbol, any>>) => any) | undefined;
|
|
47
|
+
}>, {
|
|
48
|
+
trigger: ElementScriptTrigger;
|
|
49
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
50
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
51
|
+
export default _default;
|
|
52
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
53
|
+
new (): {
|
|
54
|
+
$slots: S;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -1,273 +1,176 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
rootAttrs?: HTMLAttributes
|
|
51
|
-
aboveTheFold?: boolean
|
|
52
|
-
vimeoOptions?: VimeoOptions
|
|
53
|
-
id?: number | undefined
|
|
54
|
-
url?: string | undefined
|
|
55
|
-
}>(), {
|
|
56
|
-
trigger: 'mousedown',
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const emits = defineEmits<TEmits>()
|
|
60
|
-
|
|
61
|
-
type EventMap<E extends keyof Vimeo.EventMap> = [event: Vimeo.EventMap[E], player: Vimeo]
|
|
62
|
-
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
64
|
-
type TEmits = {
|
|
65
|
-
play: EventMap<'play'>
|
|
66
|
-
playing: EventMap<'playing'>
|
|
67
|
-
pause: EventMap<'pause'>
|
|
68
|
-
ended: EventMap<'ended'>
|
|
69
|
-
timeupdate: EventMap<'timeupdate'>
|
|
70
|
-
progress: EventMap<'progress'>
|
|
71
|
-
seeking: EventMap<'seeking'>
|
|
72
|
-
seeked: EventMap<'seeked'>
|
|
73
|
-
texttrackchange: EventMap<'texttrackchange'>
|
|
74
|
-
chapterchange: EventMap<'chapterchange'>
|
|
75
|
-
cuechange: EventMap<'cuechange'>
|
|
76
|
-
cuepoint: EventMap<'cuepoint'>
|
|
77
|
-
volumechange: EventMap<'volumechange'>
|
|
78
|
-
playbackratechange: EventMap<'playbackratechange'>
|
|
79
|
-
bufferstart: EventMap<'bufferstart'>
|
|
80
|
-
bufferend: EventMap<'bufferend'>
|
|
81
|
-
error: EventMap<'error'>
|
|
82
|
-
loaded: EventMap<'loaded'>
|
|
83
|
-
durationchange: EventMap<'durationchange'>
|
|
84
|
-
fullscreenchange: EventMap<'fullscreenchange'>
|
|
85
|
-
qualitychange: EventMap<'qualitychange'>
|
|
86
|
-
camerachange: EventMap<'camerachange'>
|
|
87
|
-
resize: EventMap<'resize'>
|
|
88
|
-
enterpictureinpicture: EventMap<'enterpictureinpicture'>
|
|
89
|
-
leavepictureinpicture: EventMap<'leavepictureinpicture'>
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const events: (keyof TEmits)[] = [
|
|
93
|
-
'play',
|
|
94
|
-
'playing',
|
|
95
|
-
'pause',
|
|
96
|
-
'ended',
|
|
97
|
-
'timeupdate',
|
|
98
|
-
'progress',
|
|
99
|
-
'seeking',
|
|
100
|
-
'seeked',
|
|
101
|
-
'texttrackchange',
|
|
102
|
-
'chapterchange',
|
|
103
|
-
'cuechange',
|
|
104
|
-
'cuepoint',
|
|
105
|
-
'volumechange',
|
|
106
|
-
'playbackratechange',
|
|
107
|
-
'bufferstart',
|
|
108
|
-
'bufferend',
|
|
109
|
-
'error',
|
|
110
|
-
'loaded',
|
|
111
|
-
'durationchange',
|
|
112
|
-
'fullscreenchange',
|
|
113
|
-
'qualitychange',
|
|
114
|
-
'camerachange',
|
|
115
|
-
'resize',
|
|
116
|
-
'enterpictureinpicture',
|
|
117
|
-
'leavepictureinpicture',
|
|
118
|
-
]
|
|
119
|
-
|
|
120
|
-
const elVimeo = ref()
|
|
121
|
-
const rootEl = ref()
|
|
122
|
-
|
|
123
|
-
const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl })
|
|
124
|
-
let clickTriggered = false
|
|
125
|
-
if (props.trigger === 'mousedown' && trigger instanceof Promise) {
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
3
|
+
import { defu } from "defu";
|
|
4
|
+
import { useAsyncData, useHead } from "nuxt/app";
|
|
5
|
+
import { useScriptTriggerElement } from "../composables/useScriptTriggerElement";
|
|
6
|
+
import { useScriptVimeoPlayer } from "../registry/vimeo-player";
|
|
7
|
+
import ScriptAriaLoadingIndicator from "./ScriptAriaLoadingIndicator.vue";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
trigger: { type: [String, Array, Boolean], required: false, default: "mousedown" },
|
|
10
|
+
placeholderAttrs: { type: Object, required: false },
|
|
11
|
+
rootAttrs: { type: Object, required: false },
|
|
12
|
+
aboveTheFold: { type: Boolean, required: false },
|
|
13
|
+
vimeoOptions: { type: Object, required: false },
|
|
14
|
+
id: { type: null, required: false },
|
|
15
|
+
url: { type: null, required: false }
|
|
16
|
+
});
|
|
17
|
+
const emits = defineEmits(["play", "playing", "pause", "ended", "timeupdate", "progress", "seeking", "seeked", "texttrackchange", "chapterchange", "cuechange", "cuepoint", "volumechange", "playbackratechange", "bufferstart", "bufferend", "error", "loaded", "durationchange", "fullscreenchange", "qualitychange", "camerachange", "resize", "enterpictureinpicture", "leavepictureinpicture"]);
|
|
18
|
+
const events = [
|
|
19
|
+
"play",
|
|
20
|
+
"playing",
|
|
21
|
+
"pause",
|
|
22
|
+
"ended",
|
|
23
|
+
"timeupdate",
|
|
24
|
+
"progress",
|
|
25
|
+
"seeking",
|
|
26
|
+
"seeked",
|
|
27
|
+
"texttrackchange",
|
|
28
|
+
"chapterchange",
|
|
29
|
+
"cuechange",
|
|
30
|
+
"cuepoint",
|
|
31
|
+
"volumechange",
|
|
32
|
+
"playbackratechange",
|
|
33
|
+
"bufferstart",
|
|
34
|
+
"bufferend",
|
|
35
|
+
"error",
|
|
36
|
+
"loaded",
|
|
37
|
+
"durationchange",
|
|
38
|
+
"fullscreenchange",
|
|
39
|
+
"qualitychange",
|
|
40
|
+
"camerachange",
|
|
41
|
+
"resize",
|
|
42
|
+
"enterpictureinpicture",
|
|
43
|
+
"leavepictureinpicture"
|
|
44
|
+
];
|
|
45
|
+
const elVimeo = ref();
|
|
46
|
+
const rootEl = ref();
|
|
47
|
+
const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl });
|
|
48
|
+
let clickTriggered = false;
|
|
49
|
+
if (props.trigger === "mousedown" && trigger instanceof Promise) {
|
|
126
50
|
trigger.then((val) => {
|
|
127
51
|
if (val) {
|
|
128
|
-
clickTriggered = true
|
|
52
|
+
clickTriggered = true;
|
|
129
53
|
}
|
|
130
|
-
})
|
|
54
|
+
});
|
|
131
55
|
}
|
|
132
|
-
const ready = ref(false)
|
|
56
|
+
const ready = ref(false);
|
|
133
57
|
const { onLoaded, status } = useScriptVimeoPlayer({
|
|
134
58
|
scriptOptions: {
|
|
135
|
-
trigger
|
|
136
|
-
}
|
|
137
|
-
})
|
|
138
|
-
|
|
59
|
+
trigger
|
|
60
|
+
}
|
|
61
|
+
});
|
|
139
62
|
if (import.meta.server) {
|
|
140
|
-
// dns-prefetch https://i.vimeocdn.com
|
|
141
63
|
useHead({
|
|
142
64
|
link: [
|
|
143
65
|
{
|
|
144
|
-
rel: props.aboveTheFold ?
|
|
145
|
-
href:
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
})
|
|
66
|
+
rel: props.aboveTheFold ? "preconnect" : "dns-prefetch",
|
|
67
|
+
href: "https://i.vimeocdn.com"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
});
|
|
149
71
|
}
|
|
150
|
-
|
|
151
72
|
const id = computed(() => {
|
|
152
|
-
return props.vimeoOptions?.id || props.id
|
|
153
|
-
})
|
|
154
|
-
|
|
73
|
+
return props.vimeoOptions?.id || props.id;
|
|
74
|
+
});
|
|
155
75
|
const { data: payload } = useAsyncData(
|
|
156
76
|
`vimeo-embed:${id.value}`,
|
|
157
77
|
// TODO ideally we cache this
|
|
158
|
-
() => $fetch(`https://vimeo.com/api/v2/video/${id.value}.json`).then(res =>
|
|
78
|
+
() => $fetch(`https://vimeo.com/api/v2/video/${id.value}.json`).then((res) => res[0]),
|
|
159
79
|
{
|
|
160
|
-
watch: [id]
|
|
161
|
-
}
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
let player: Vimeo | undefined
|
|
167
|
-
// we can't directly expose the player as vue will break the proxy
|
|
80
|
+
watch: [id]
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
const placeholder = computed(() => payload.value?.thumbnail_large);
|
|
84
|
+
let player;
|
|
168
85
|
defineExpose({
|
|
169
86
|
play: () => player?.play(),
|
|
170
87
|
pause: () => player?.pause(),
|
|
171
88
|
getDuration: () => player?.getDuration(),
|
|
172
89
|
getCurrentTime: () => player?.getCurrentTime(),
|
|
173
|
-
setCurrentTime: (time
|
|
90
|
+
setCurrentTime: (time) => player?.setCurrentTime(time),
|
|
174
91
|
getVolume: () => player?.getVolume(),
|
|
175
|
-
setVolume: (volume
|
|
92
|
+
setVolume: (volume) => player?.setVolume(volume),
|
|
176
93
|
getPaused: () => player?.getPaused(),
|
|
177
94
|
getEnded: () => player?.getEnded(),
|
|
178
95
|
getLoop: () => player?.getLoop(),
|
|
179
|
-
setLoop: (loop
|
|
96
|
+
setLoop: (loop) => player?.setLoop(loop),
|
|
180
97
|
getPlaybackRate: () => player?.getPlaybackRate(),
|
|
181
|
-
setPlaybackRate: (rate
|
|
182
|
-
})
|
|
183
|
-
|
|
98
|
+
setPlaybackRate: (rate) => player?.setPlaybackRate(rate)
|
|
99
|
+
});
|
|
184
100
|
const width = computed(() => {
|
|
185
|
-
return props.vimeoOptions?.width || elVimeo.value?.parentNode?.offsetWidth || 640
|
|
186
|
-
})
|
|
187
|
-
|
|
101
|
+
return props.vimeoOptions?.width || elVimeo.value?.parentNode?.offsetWidth || 640;
|
|
102
|
+
});
|
|
188
103
|
const height = computed(() => {
|
|
189
|
-
return props.vimeoOptions?.height || elVimeo.value?.parentNode?.offsetHeight || 480
|
|
190
|
-
})
|
|
191
|
-
|
|
104
|
+
return props.vimeoOptions?.height || elVimeo.value?.parentNode?.offsetHeight || 480;
|
|
105
|
+
});
|
|
192
106
|
onMounted(() => {
|
|
193
|
-
// @ts-ignore failing for end users
|
|
194
107
|
onLoaded(async ({ Vimeo }) => {
|
|
195
|
-
const vimeoOptions = props.vimeoOptions || {}
|
|
108
|
+
const vimeoOptions = props.vimeoOptions || {};
|
|
196
109
|
if (!vimeoOptions.id && props.id) {
|
|
197
|
-
vimeoOptions.id = props.id
|
|
110
|
+
vimeoOptions.id = props.id;
|
|
198
111
|
}
|
|
199
112
|
if (!vimeoOptions.url && props.url) {
|
|
200
|
-
vimeoOptions.url = props.url
|
|
113
|
+
vimeoOptions.url = props.url;
|
|
201
114
|
}
|
|
202
|
-
vimeoOptions.width = width.value
|
|
203
|
-
vimeoOptions.height = height.value
|
|
204
|
-
player = new Vimeo.Player(elVimeo.value, vimeoOptions)
|
|
115
|
+
vimeoOptions.width = width.value;
|
|
116
|
+
vimeoOptions.height = height.value;
|
|
117
|
+
player = new Vimeo.Player(elVimeo.value, vimeoOptions);
|
|
205
118
|
if (clickTriggered) {
|
|
206
|
-
player
|
|
207
|
-
clickTriggered = false
|
|
119
|
+
player.play();
|
|
120
|
+
clickTriggered = false;
|
|
208
121
|
}
|
|
209
122
|
for (const event of events) {
|
|
210
|
-
player
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
})
|
|
123
|
+
player.on(event, (e) => {
|
|
124
|
+
emits(event, e, player);
|
|
125
|
+
if (event === "loaded")
|
|
126
|
+
ready.value = true;
|
|
127
|
+
});
|
|
216
128
|
}
|
|
217
|
-
})
|
|
218
|
-
})
|
|
219
|
-
|
|
129
|
+
});
|
|
130
|
+
});
|
|
220
131
|
watch(() => props.id, (v) => {
|
|
221
132
|
if (v) {
|
|
222
|
-
player?.loadVideo(Number(v))
|
|
133
|
+
player?.loadVideo(Number(v));
|
|
223
134
|
}
|
|
224
|
-
})
|
|
225
|
-
watch(status, (
|
|
226
|
-
if (
|
|
227
|
-
|
|
228
|
-
emits('error')
|
|
135
|
+
});
|
|
136
|
+
watch(status, (status2) => {
|
|
137
|
+
if (status2 === "error") {
|
|
138
|
+
emits("error");
|
|
229
139
|
}
|
|
230
|
-
})
|
|
231
|
-
|
|
140
|
+
});
|
|
232
141
|
const rootAttrs = computed(() => {
|
|
233
142
|
return defu(props.rootAttrs, {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
'aria-live': 'polite',
|
|
241
|
-
'role': 'application',
|
|
242
|
-
'style': {
|
|
243
|
-
maxWidth: '100%',
|
|
143
|
+
"aria-busy": status.value === "loading",
|
|
144
|
+
"aria-label": status.value === "awaitingLoad" ? "Vimeo Player - Placeholder" : status.value === "loading" ? "Vimeo Player - Loading" : "Vimeo Player - Loaded",
|
|
145
|
+
"aria-live": "polite",
|
|
146
|
+
"role": "application",
|
|
147
|
+
"style": {
|
|
148
|
+
maxWidth: "100%",
|
|
244
149
|
width: `auto`,
|
|
245
|
-
height:
|
|
150
|
+
height: "auto",
|
|
246
151
|
aspectRatio: `16/9`,
|
|
247
|
-
position:
|
|
248
|
-
backgroundColor:
|
|
152
|
+
position: "relative",
|
|
153
|
+
backgroundColor: "black"
|
|
249
154
|
},
|
|
250
|
-
...
|
|
251
|
-
})
|
|
252
|
-
})
|
|
253
|
-
|
|
155
|
+
...trigger instanceof Promise ? trigger.ssrAttrs || {} : {}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
254
158
|
const placeholderAttrs = computed(() => {
|
|
255
159
|
return defu(props.placeholderAttrs, {
|
|
256
160
|
src: placeholder.value,
|
|
257
|
-
alt:
|
|
258
|
-
loading: props.aboveTheFold ?
|
|
161
|
+
alt: "",
|
|
162
|
+
loading: props.aboveTheFold ? "eager" : "lazy",
|
|
259
163
|
// @ts-expect-error untyped
|
|
260
|
-
fetchpriority: props.aboveTheFold ?
|
|
164
|
+
fetchpriority: props.aboveTheFold ? "high" : void 0,
|
|
261
165
|
style: {
|
|
262
|
-
cursor:
|
|
263
|
-
width:
|
|
264
|
-
objectFit:
|
|
265
|
-
height:
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
onBeforeUnmount(() => player?.unload())
|
|
166
|
+
cursor: "pointer",
|
|
167
|
+
width: "100%",
|
|
168
|
+
objectFit: "contain",
|
|
169
|
+
height: "100%"
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
onBeforeUnmount(() => player?.unload());
|
|
271
174
|
</script>
|
|
272
175
|
|
|
273
176
|
<template>
|