@nuxt/scripts 0.3.0 → 0.3.2

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 (66) hide show
  1. package/README.md +19 -10
  2. package/dist/client/200.html +5 -5
  3. package/dist/client/404.html +5 -5
  4. package/dist/client/_nuxt/{DIt5FBMJ.js → 5Hk8ESNW.js} +1 -1
  5. package/dist/client/_nuxt/BxcSmj5a.js +31 -0
  6. package/dist/client/_nuxt/{DOakR0z3.js → DeEC_XNp.js} +1 -1
  7. package/dist/client/_nuxt/{CovTDKFE.js → TwOttoDL.js} +1 -1
  8. package/dist/client/_nuxt/builds/latest.json +1 -1
  9. package/dist/client/_nuxt/builds/meta/d293267d-837e-425a-bc4b-81773905567b.json +1 -0
  10. package/dist/client/index.html +5 -5
  11. package/dist/module.json +1 -1
  12. package/dist/module.mjs +1 -0
  13. package/dist/runtime/components/GoogleMaps.vue +1 -1
  14. package/dist/runtime/components/StripePricingTableEmbed.vue +1 -1
  15. package/dist/runtime/components/VimeoEmbed.vue +1 -1
  16. package/dist/runtime/components/YouTubeEmbed.vue +1 -1
  17. package/dist/runtime/composables/useConsentScriptTrigger.d.ts +13 -0
  18. package/dist/runtime/composables/{createConsentScriptTrigger.mjs → useConsentScriptTrigger.mjs} +11 -3
  19. package/dist/runtime/composables/useElementScriptTrigger.d.ts +15 -1
  20. package/dist/runtime/composables/useElementScriptTrigger.mjs +4 -2
  21. package/dist/runtime/composables/useScript.d.ts +1 -1
  22. package/dist/runtime/registry/cloudflare-web-analytics.d.ts +1 -1
  23. package/dist/runtime/registry/cloudflare-web-analytics.mjs +1 -1
  24. package/dist/runtime/registry/facebook-pixel.d.ts +1 -1
  25. package/dist/runtime/registry/facebook-pixel.mjs +2 -2
  26. package/dist/runtime/registry/fathom-analytics.d.ts +1 -1
  27. package/dist/runtime/registry/fathom-analytics.mjs +1 -1
  28. package/dist/runtime/registry/google-analytics.d.ts +1 -1
  29. package/dist/runtime/registry/google-analytics.mjs +2 -2
  30. package/dist/runtime/registry/google-maps.d.ts +9 -3
  31. package/dist/runtime/registry/google-maps.mjs +2 -2
  32. package/dist/runtime/registry/google-tag-manager.d.ts +1 -1
  33. package/dist/runtime/registry/google-tag-manager.mjs +2 -2
  34. package/dist/runtime/registry/hotjar.d.ts +1 -1
  35. package/dist/runtime/registry/hotjar.mjs +2 -2
  36. package/dist/runtime/registry/intercom.d.ts +3 -3
  37. package/dist/runtime/registry/intercom.mjs +2 -2
  38. package/dist/runtime/registry/lemon-squeezy.d.ts +1 -1
  39. package/dist/runtime/registry/lemon-squeezy.mjs +2 -2
  40. package/dist/runtime/registry/matomo-analytics.d.ts +1 -1
  41. package/dist/runtime/registry/matomo-analytics.mjs +2 -2
  42. package/dist/runtime/registry/npm.d.ts +1 -1
  43. package/dist/runtime/registry/npm.mjs +1 -1
  44. package/dist/runtime/registry/plausible-analytics.d.ts +1 -1
  45. package/dist/runtime/registry/plausible-analytics.mjs +2 -2
  46. package/dist/runtime/registry/segment.d.ts +1 -1
  47. package/dist/runtime/registry/segment.mjs +2 -2
  48. package/dist/runtime/registry/stripe.d.ts +3 -3
  49. package/dist/runtime/registry/stripe.mjs +2 -2
  50. package/dist/runtime/registry/vimeo-player.d.ts +1 -1
  51. package/dist/runtime/registry/vimeo-player.mjs +2 -2
  52. package/dist/runtime/registry/x-pixel.d.ts +1 -1
  53. package/dist/runtime/registry/x-pixel.mjs +2 -2
  54. package/dist/runtime/registry/youtube-iframe.d.ts +2 -2
  55. package/dist/runtime/registry/youtube-iframe.mjs +2 -2
  56. package/dist/runtime/types.d.ts +2 -2
  57. package/dist/runtime/utils.d.ts +1 -4
  58. package/dist/runtime/utils.mjs +4 -8
  59. package/dist/runtime/validation/mock.d.ts +36 -0
  60. package/dist/runtime/validation/mock.mjs +13 -0
  61. package/dist/runtime/validation/valibot.d.ts +1 -0
  62. package/dist/runtime/validation/valibot.mjs +1 -0
  63. package/package.json +1 -1
  64. package/dist/client/_nuxt/8T3kBMJO.js +0 -31
  65. package/dist/client/_nuxt/builds/meta/ccc94de9-89fa-400b-88f2-8fc2599e191f.json +0 -1
  66. package/dist/runtime/composables/createConsentScriptTrigger.d.ts +0 -6
@@ -1 +1 @@
1
- import{_ as o,u as a}from"./CovTDKFE.js";import{o as s,c as i,a as e,t as r,p as u,e as l}from"./8T3kBMJO.js";const c=t=>(u("data-v-478fb72d"),t=t(),l(),t),d={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},p=c(()=>e("div",{class:"fixed -bottom-1/2 left-0 right-0 h-1/2 spotlight"},null,-1)),h={class:"max-w-520px text-center"},b=["textContent"],g=["textContent"],f={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:500},statusMessage:{type:String,default:"Server error"},description:{type:String,default:"This page is temporarily unavailable."}},setup(t){const n=t;return a({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[],style:[{children:'*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--un-default-border-color, #e5e7eb)}:before,:after{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}h1{font-size:inherit;font-weight:inherit}h1,p{margin:0}*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(m,x)=>(s(),i("div",d,[p,e("div",h,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:r(t.statusCode)},null,8,b),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:r(t.description)},null,8,g)])]))}},w=o(f,[["__scopeId","data-v-478fb72d"]]);export{w as default};
1
+ import{_ as o,u as a}from"./TwOttoDL.js";import{o as s,c as i,a as e,t as r,p as u,e as l}from"./BxcSmj5a.js";const c=t=>(u("data-v-478fb72d"),t=t(),l(),t),d={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},p=c(()=>e("div",{class:"fixed -bottom-1/2 left-0 right-0 h-1/2 spotlight"},null,-1)),h={class:"max-w-520px text-center"},b=["textContent"],g=["textContent"],f={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:500},statusMessage:{type:String,default:"Server error"},description:{type:String,default:"This page is temporarily unavailable."}},setup(t){const n=t;return a({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[],style:[{children:'*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--un-default-border-color, #e5e7eb)}:before,:after{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}h1{font-size:inherit;font-weight:inherit}h1,p{margin:0}*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(m,x)=>(s(),i("div",d,[p,e("div",h,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:r(t.statusCode)},null,8,b),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:r(t.description)},null,8,g)])]))}},w=o(f,[["__scopeId","data-v-478fb72d"]]);export{w as default};
@@ -1 +1 @@
1
- import{i as u,r as c,f,g as v,h as d,j as l,k as i,l as h,m as p}from"./8T3kBMJO.js";function g(t,a={}){const e=a.head||u();if(e)return e.ssr?e.push(t,a):m(e,t,a)}function m(t,a,e={}){const s=c(!1),n=c({});f(()=>{n.value=s.value?{}:h(a)});const r=t.push(n.value,e);return v(n,o=>{r.patch(o)}),p()&&(d(()=>{r.dispose()}),l(()=>{s.value=!0}),i(()=>{s.value=!1})),r}const I=(t,a)=>{const e=t.__vccOpts||t;for(const[s,n]of a)e[s]=n;return e};export{I as _,g as u};
1
+ import{i as u,r as c,f,g as v,h as d,j as l,k as i,l as h,m as p}from"./BxcSmj5a.js";function g(t,a={}){const e=a.head||u();if(e)return e.ssr?e.push(t,a):m(e,t,a)}function m(t,a,e={}){const s=c(!1),n=c({});f(()=>{n.value=s.value?{}:h(a)});const r=t.push(n.value,e);return v(n,o=>{r.patch(o)}),p()&&(d(()=>{r.dispose()}),l(()=>{s.value=!0}),i(()=>{s.value=!1})),r}const I=(t,a)=>{const e=t.__vccOpts||t;for(const[s,n]of a)e[s]=n;return e};export{I as _,g as u};
@@ -1 +1 @@
1
- {"id":"ccc94de9-89fa-400b-88f2-8fc2599e191f","timestamp":1714573376455}
1
+ {"id":"d293267d-837e-425a-bc4b-81773905567b","timestamp":1714631408028}
@@ -0,0 +1 @@
1
+ {"id":"d293267d-837e-425a-bc4b-81773905567b","timestamp":1714631408028,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html><html><head><meta charset="utf-8">
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1">
3
3
  <link rel="stylesheet" href="/__nuxt-scripts/_nuxt/entry.D91GVkD7.css">
4
- <link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/8T3kBMJO.js">
4
+ <link rel="modulepreload" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BxcSmj5a.js">
5
5
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DXFkqnOI.js">
6
6
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/D6NljDpC.js">
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CowR2XfX.js">
@@ -239,10 +239,10 @@
239
239
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/V_y36BGi.js">
240
240
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/BGq4KZyx.js">
241
241
  <link rel="prefetch" as="style" href="/__nuxt-scripts/_nuxt/error-404.BRldFSII.css">
242
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DIt5FBMJ.js">
243
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/CovTDKFE.js">
242
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/5Hk8ESNW.js">
243
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/TwOttoDL.js">
244
244
  <link rel="prefetch" as="style" href="/__nuxt-scripts/_nuxt/error-500.D8yw_IbC.css">
245
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DOakR0z3.js">
246
- <script type="module" src="/__nuxt-scripts/_nuxt/8T3kBMJO.js" crossorigin></script><script>"use strict";(()=>{const a=window,e=document.documentElement,c=window.localStorage,d=["dark","light"],n=c&&c.getItem&&c.getItem("nuxt-color-mode")||"system";let l=n==="system"?f():n;const i=e.getAttribute("data-color-mode-forced");i&&(l=i),r(l),a["__NUXT_COLOR_MODE__"]={preference:n,value:l,getColorScheme:f,addColorScheme:r,removeColorScheme:u};function r(o){const t=""+o+"",s="";e.classList?e.classList.add(t):e.className+=" "+t,s&&e.setAttribute("data-"+s,o)}function u(o){const t=""+o+"",s="";e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(t,"g"),""),s&&e.removeAttribute("data-"+s)}function m(o){return a.matchMedia("(prefers-color-scheme"+o+")")}function f(){if(a.matchMedia&&m("").media!=="not all"){for(const o of d)if(m(":"+o).matches)return o}return"light"}})();
245
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-scripts/_nuxt/DeEC_XNp.js">
246
+ <script type="module" src="/__nuxt-scripts/_nuxt/BxcSmj5a.js" crossorigin></script><script>"use strict";(()=>{const a=window,e=document.documentElement,c=window.localStorage,d=["dark","light"],n=c&&c.getItem&&c.getItem("nuxt-color-mode")||"system";let l=n==="system"?f():n;const i=e.getAttribute("data-color-mode-forced");i&&(l=i),r(l),a["__NUXT_COLOR_MODE__"]={preference:n,value:l,getColorScheme:f,addColorScheme:r,removeColorScheme:u};function r(o){const t=""+o+"",s="";e.classList?e.classList.add(t):e.className+=" "+t,s&&e.setAttribute("data-"+s,o)}function u(o){const t=""+o+"",s="";e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(t,"g"),""),s&&e.removeAttribute("data-"+s)}function m(o){return a.matchMedia("(prefers-color-scheme"+o+")")}function f(){if(a.matchMedia&&m("").media!=="not all"){for(const o of d)if(m(":"+o).matches)return o}return"light"}})();
247
247
  </script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4,"once":5},{},false,{},{},["Set"]]</script>
248
248
  <script>window.__NUXT__={};window.__NUXT__.config={public:{"nuxt-scripts":{defaultScriptOptions:{trigger:"onNuxtReady"}}},app:{baseURL:"/__nuxt-scripts",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "nuxt": ">=3",
6
6
  "bridge": false
7
7
  },
8
- "version": "0.3.0",
8
+ "version": "0.3.2",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.6.0",
11
11
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -370,6 +370,7 @@ const module = defineNuxtModule({
370
370
  logger.debug("The module is disabled, skipping setup.");
371
371
  return;
372
372
  }
373
+ nuxt.options.alias["#nuxt-scripts-validator"] = resolve(`./runtime/validation/${nuxt.options.dev || nuxt.options._prepare ? "valibot" : "mock"}`);
373
374
  nuxt.options.alias["#nuxt-scripts"] = resolve("./runtime/types");
374
375
  nuxt.options.runtimeConfig["nuxt-scripts"] = { version };
375
376
  nuxt.options.runtimeConfig.public["nuxt-scripts"] = { defaultScriptOptions: config.defaultScriptOptions };
@@ -48,7 +48,7 @@ const elMap = ref<HTMLElement>()
48
48
  const { $script } = useScriptGoogleMaps({
49
49
  apiKey: props.apiKey,
50
50
  scriptOptions: {
51
- trigger: useElementScriptTrigger(props.trigger, elMap),
51
+ trigger: useElementScriptTrigger({ trigger: props.trigger, el: elMap }),
52
52
  },
53
53
  })
54
54
 
@@ -14,7 +14,7 @@ const props = defineProps<{
14
14
 
15
15
  const table = ref()
16
16
  useScript(`https://js.stripe.com/v3/pricing-table.js`, {
17
- trigger: useElementScriptTrigger(props.trigger, table),
17
+ trigger: useElementScriptTrigger({ trigger: props.trigger, el: table }),
18
18
  })
19
19
  </script>
20
20
 
@@ -104,7 +104,7 @@ const root = ref()
104
104
  const ready = ref(false)
105
105
  const { $script } = useScriptVimeoPlayer({
106
106
  scriptOptions: {
107
- trigger: useElementScriptTrigger(props.trigger, root.value),
107
+ trigger: useElementScriptTrigger({ trigger: props.trigger, el: root.value }),
108
108
  },
109
109
  })
110
110
 
@@ -37,7 +37,7 @@ const elYoutube = ref()
37
37
  const ready = ref(false)
38
38
  const { $script } = useScriptYouTubeIframe({
39
39
  scriptOptions: {
40
- trigger: useElementScriptTrigger(props.trigger, elYoutube.value),
40
+ trigger: useElementScriptTrigger({ trigger: props.trigger, el: elYoutube.value }),
41
41
  },
42
42
  })
43
43
 
@@ -0,0 +1,13 @@
1
+ import type { ConsentScriptTriggerOptions } from '../types';
2
+ interface UseConsentScriptTriggerApi extends Promise<void> {
3
+ /**
4
+ * A function that can be called to accept the consent and load the script.
5
+ */
6
+ accept: () => void;
7
+ }
8
+ /**
9
+ * Load a script once consent has been provided either through a resolvable `consent` or calling the `accept` method.
10
+ * @param options
11
+ */
12
+ export declare function useConsentScriptTrigger(options?: ConsentScriptTriggerOptions): UseConsentScriptTriggerApi;
13
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { isRef, onNuxtReady, ref, requestIdleCallback, toValue, tryUseNuxtApp, watch } from "#imports";
2
- export function createConsentScriptTrigger(options) {
2
+ export function useConsentScriptTrigger(options) {
3
3
  if (import.meta.server)
4
4
  return new Promise(() => {
5
5
  });
@@ -9,8 +9,16 @@ export function createConsentScriptTrigger(options) {
9
9
  watch(consented, (ready) => {
10
10
  if (ready) {
11
11
  const runner = nuxtApp?.runWithContext || ((cb) => cb());
12
- const idleTimeout = options?.loadOnNuxtReady ? nuxtApp ? onNuxtReady : requestIdleCallback : (cb) => cb();
13
- runner(() => idleTimeout(resolve));
12
+ if (options?.postConsentTrigger instanceof Promise) {
13
+ options.postConsentTrigger.then(() => runner(resolve));
14
+ return;
15
+ }
16
+ if (options?.postConsentTrigger === "onNuxtReady") {
17
+ const idleTimeout = options?.postConsentTrigger ? nuxtApp ? onNuxtReady : requestIdleCallback : (cb) => cb();
18
+ runner(() => idleTimeout(resolve));
19
+ return;
20
+ }
21
+ runner(resolve);
14
22
  }
15
23
  });
16
24
  if (options?.consent) {
@@ -1,3 +1,17 @@
1
1
  import type { Ref } from 'vue';
2
2
  export type ElementScriptTrigger = 'visible' | 'mouseover' | false;
3
- export declare function useElementScriptTrigger(trigger: ElementScriptTrigger | undefined, el?: HTMLElement | Ref<HTMLElement | undefined> | null): Promise<void>;
3
+ export interface ElementScriptTriggerOptions {
4
+ /**
5
+ * The event to trigger the script load.
6
+ */
7
+ trigger?: ElementScriptTrigger | undefined;
8
+ /**
9
+ * The element to watch for the trigger event.
10
+ * @default document.body
11
+ */
12
+ el?: HTMLElement | Ref<HTMLElement | undefined> | null;
13
+ }
14
+ /**
15
+ * Create a trigger for an element to load a script based on specific element events.
16
+ */
17
+ export declare function useElementScriptTrigger(options: ElementScriptTriggerOptions): Promise<void>;
@@ -1,9 +1,11 @@
1
1
  import { useElementHover, useElementVisibility, watchOnce } from "@vueuse/core";
2
2
  import { ref } from "vue";
3
- export function useElementScriptTrigger(trigger, el) {
3
+ export function useElementScriptTrigger(options) {
4
+ const { el, trigger } = options;
4
5
  if (import.meta.server || !el)
5
6
  return new Promise(() => {
6
7
  });
7
- const activeRef = trigger ? trigger === "mouseover" ? useElementHover(el) : useElementVisibility(el) : ref(false);
8
+ const $el = typeof el !== "undefined" ? el : document.body;
9
+ const activeRef = trigger ? trigger === "mouseover" ? useElementHover($el) : useElementVisibility($el) : ref(false);
8
10
  return trigger ? new Promise((resolve) => watchOnce([activeRef], () => resolve())) : Promise.resolve();
9
11
  }
@@ -1,5 +1,5 @@
1
1
  import { type UseScriptInput, type VueScriptInstance } from '@unhead/vue';
2
2
  import type { NuxtUseScriptOptions } from '#nuxt-scripts';
3
3
  export declare function useScript<T extends Record<string | symbol, any>>(input: UseScriptInput, options?: NuxtUseScriptOptions): T & {
4
- $script: VueScriptInstance<T> & Promise<T>;
4
+ $script: Promise<T> & VueScriptInstance<T>;
5
5
  };
@@ -34,5 +34,5 @@ export declare const CloudflareWebAnalyticsOptions: import("valibot").ObjectSche
34
34
  }>;
35
35
  export type CloudflareWebAnalyticsInput = RegistryScriptInput<typeof CloudflareWebAnalyticsOptions>;
36
36
  export declare function useScriptCloudflareWebAnalytics<T extends CloudflareWebAnalyticsApi>(_options?: CloudflareWebAnalyticsInput): T & {
37
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
37
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
38
38
  };
@@ -1,6 +1,6 @@
1
- import { boolean, minLength, object, optional, string } from "valibot";
2
1
  import { defu } from "defu";
3
2
  import { registryScript } from "../utils.mjs";
3
+ import { boolean, minLength, object, optional, string } from "#nuxt-scripts-validator";
4
4
  export const CloudflareWebAnalyticsOptions = object({
5
5
  /**
6
6
  * The Cloudflare Web Analytics token.
@@ -39,6 +39,6 @@ export declare const FacebookPixelOptions: import("valibot").ObjectSchema<{
39
39
  }>;
40
40
  export type FacebookPixelInput = RegistryScriptInput<typeof FacebookPixelOptions>;
41
41
  export declare function useScriptFacebookPixel<T extends FacebookPixelApi>(_options?: FacebookPixelInput): T & {
42
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
42
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
43
43
  };
44
44
  export {};
@@ -1,6 +1,6 @@
1
- import { number, object, string, union } from "valibot";
2
1
  import { registryScript } from "../utils.mjs";
3
2
  import { FacebookPixelScriptResolver } from "../../registry";
3
+ import { number, object, string, union } from "#nuxt-scripts-validator";
4
4
  export const FacebookPixelOptions = object({
5
5
  id: union([string(), number()])
6
6
  });
@@ -9,7 +9,7 @@ export function useScriptFacebookPixel(_options) {
9
9
  scriptInput: {
10
10
  src: FacebookPixelScriptResolver()
11
11
  },
12
- schema: FacebookPixelOptions,
12
+ schema: import.meta.dev ? FacebookPixelOptions : void 0,
13
13
  scriptOptions: {
14
14
  use() {
15
15
  return { fbq: window.fbq };
@@ -54,5 +54,5 @@ declare global {
54
54
  }
55
55
  }
56
56
  export declare function useScriptFathomAnalytics<T extends FathomAnalyticsApi>(_options?: FathomAnalyticsInput): T & {
57
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
57
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
58
58
  };
@@ -1,5 +1,5 @@
1
- import { boolean, literal, object, optional, string, union } from "valibot";
2
1
  import { registryScript } from "../utils.mjs";
2
+ import { boolean, literal, object, optional, string, union } from "#nuxt-scripts-validator";
3
3
  export const FathomAnalyticsOptions = object({
4
4
  /**
5
5
  * The Fathom Analytics site ID.
@@ -16,6 +16,6 @@ declare global {
16
16
  * A 3P wrapper for Google Analytics that takes an options input to feed into third-party-capital({@link https://github.com/GoogleChromeLabs/third-party-capital}), which returns instructions for nuxt-scripts.
17
17
  */
18
18
  export declare function useScriptGoogleAnalytics<T extends GoogleAnalyticsApi>(_options?: GoogleAnalyticsInput): T & {
19
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
19
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
20
20
  };
21
21
  export {};
@@ -1,6 +1,6 @@
1
- import { object, string } from "valibot";
2
1
  import { registryScript } from "../utils.mjs";
3
2
  import { GoogleAnalyticsScriptResolver } from "../../registry";
3
+ import { object, string } from "#nuxt-scripts-validator";
4
4
  const GoogleAnalyticsOptions = object({
5
5
  id: string()
6
6
  });
@@ -9,7 +9,7 @@ export function useScriptGoogleAnalytics(_options) {
9
9
  scriptInput: {
10
10
  src: GoogleAnalyticsScriptResolver(options)
11
11
  },
12
- schema: GoogleAnalyticsOptions,
12
+ schema: import.meta.dev ? GoogleAnalyticsOptions : void 0,
13
13
  scriptOptions: {
14
14
  use() {
15
15
  return { dataLayer: window.dataLayer, gtag: window.gtag };
@@ -1,4 +1,3 @@
1
- import type google from 'google.maps';
2
1
  import type { RegistryScriptInput } from '#nuxt-scripts';
3
2
  export declare const GoogleMapsOptions: import("valibot").ObjectSchema<{
4
3
  apiKey: import("valibot").StringSchema<string>;
@@ -10,8 +9,14 @@ export declare const GoogleMapsOptions: import("valibot").ObjectSchema<{
10
9
  v?: "weekly" | "beta" | "alpha" | undefined;
11
10
  }>;
12
11
  export type GoogleMapsInput = RegistryScriptInput<typeof GoogleMapsOptions>;
12
+ declare namespace google.maps {
13
+ /**
14
+ * @internal
15
+ */
16
+ function __ib__(): void;
17
+ }
13
18
  export interface GoogleMapsApi {
14
- maps: google.maps;
19
+ maps: typeof google.maps;
15
20
  }
16
21
  declare global {
17
22
  interface Window {
@@ -19,5 +24,6 @@ declare global {
19
24
  }
20
25
  }
21
26
  export declare function useScriptGoogleMaps<T extends GoogleMapsApi>(_options?: GoogleMapsInput): T & {
22
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
27
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
23
28
  };
29
+ export {};
@@ -1,6 +1,6 @@
1
- import { array, literal, object, optional, string, union } from "valibot";
2
1
  import { withQuery } from "ufo";
3
2
  import { registryScript } from "../utils.mjs";
3
+ import { array, literal, object, optional, string, union } from "#nuxt-scripts-validator";
4
4
  export const GoogleMapsOptions = object({
5
5
  apiKey: string(),
6
6
  libraries: optional(array(string())),
@@ -26,7 +26,7 @@ export function useScriptGoogleMaps(_options) {
26
26
  window.google.maps.__ib__ = resolve;
27
27
  });
28
28
  },
29
- schema: GoogleMapsOptions,
29
+ schema: import.meta.dev ? GoogleMapsOptions : void 0,
30
30
  scriptOptions: {
31
31
  use() {
32
32
  return {
@@ -16,6 +16,6 @@ declare global {
16
16
  * A 3P wrapper for Google Tag Manager that takes an options input to feed into third-party-capital({@link https://github.com/GoogleChromeLabs/third-party-capital}), which returns instructions for nuxt-scripts.
17
17
  */
18
18
  export declare function useScriptGoogleTagManager<T extends GoogleTagManagerApi>(options?: GoogleTagManagerInput): T & {
19
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
19
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
20
20
  };
21
21
  export {};
@@ -1,6 +1,6 @@
1
- import { object, string } from "valibot";
2
1
  import { withQuery } from "ufo";
3
2
  import { registryScript } from "../utils.mjs";
3
+ import { object, string } from "#nuxt-scripts-validator";
4
4
  const GoogleTagManagerOptions = object({
5
5
  id: string()
6
6
  });
@@ -12,7 +12,7 @@ export function useScriptGoogleTagManager(options) {
12
12
  id: options2?.id
13
13
  })
14
14
  },
15
- schema: GoogleTagManagerOptions,
15
+ schema: import.meta.dev ? GoogleTagManagerOptions : void 0,
16
16
  scriptOptions: {
17
17
  use() {
18
18
  return { dataLayer: window.dataLayer, google_tag_manager: window.google_tag_manager };
@@ -21,5 +21,5 @@ export declare const HotjarOptions: import("valibot").ObjectSchema<{
21
21
  }>;
22
22
  export type HotjarInput = RegistryScriptInput<typeof HotjarOptions>;
23
23
  export declare function useScriptHotjar<T extends HotjarApi>(_options?: HotjarInput): T & {
24
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
24
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
25
25
  };
@@ -1,5 +1,5 @@
1
- import { number, object, optional } from "valibot";
2
1
  import { registryScript } from "../utils.mjs";
2
+ import { number, object, optional } from "#nuxt-scripts-validator";
3
3
  export const HotjarOptions = object({
4
4
  id: number(),
5
5
  sv: optional(number())
@@ -9,7 +9,7 @@ export function useScriptHotjar(_options) {
9
9
  scriptInput: {
10
10
  src: `https://static.hotjar.com/c/hotjar-${options?.id}.js?sv=${options?.sv}`
11
11
  },
12
- schema: HotjarOptions,
12
+ schema: import.meta.dev ? HotjarOptions : void 0,
13
13
  scriptOptions: {
14
14
  use() {
15
15
  return { hj: window.hj };
@@ -1,4 +1,4 @@
1
- import { type Input } from 'valibot';
1
+ import { type Input } from '#nuxt-scripts-validator';
2
2
  import type { RegistryScriptInput } from '#nuxt-scripts';
3
3
  export declare const IntercomOptions: import("valibot").ObjectSchema<{
4
4
  app_id: import("valibot").StringSchema<string>;
@@ -11,8 +11,8 @@ export declare const IntercomOptions: import("valibot").ObjectSchema<{
11
11
  vertical_padding: import("valibot").OptionalSchema<import("valibot").NumberSchema<number>, undefined, number | undefined>;
12
12
  }, undefined, {
13
13
  app_id: string;
14
- api_base?: "https://api-iam.intercom.io" | "https://api-iam.eu.intercom.io" | "https://api-iam.au.intercom.io" | undefined;
15
14
  name?: string | undefined;
15
+ api_base?: "https://api-iam.intercom.io" | "https://api-iam.eu.intercom.io" | "https://api-iam.au.intercom.io" | undefined;
16
16
  email?: string | undefined;
17
17
  user_id?: string | undefined;
18
18
  alignment?: "left" | "right" | undefined;
@@ -29,5 +29,5 @@ declare global {
29
29
  }
30
30
  }
31
31
  export declare function useScriptIntercom<T extends IntercomApi>(_options?: IntercomInput): T & {
32
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
32
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
33
33
  };
@@ -1,6 +1,6 @@
1
- import { literal, number, object, optional, string, union } from "valibot";
2
1
  import { joinURL } from "ufo";
3
2
  import { registryScript } from "../utils.mjs";
3
+ import { literal, number, object, optional, string, union } from "#nuxt-scripts-validator";
4
4
  export const IntercomOptions = object({
5
5
  app_id: string(),
6
6
  api_base: optional(union([literal("https://api-iam.intercom.io"), literal("https://api-iam.eu.intercom.io"), literal("https://api-iam.au.intercom.io")])),
@@ -22,7 +22,7 @@ export function useScriptIntercom(_options) {
22
22
  return acc;
23
23
  })
24
24
  },
25
- schema: IntercomOptions,
25
+ schema: import.meta.dev ? IntercomOptions : void 0,
26
26
  scriptOptions: {
27
27
  use() {
28
28
  return { Intercom: window.Intercom };
@@ -64,5 +64,5 @@ declare global {
64
64
  }
65
65
  }
66
66
  export declare function useScriptLemonSqueezy<T extends LemonSqueezyApi>(_options?: LemonSqueezyInput): T & {
67
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
67
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
68
68
  };
@@ -1,5 +1,5 @@
1
- import { object } from "valibot";
2
1
  import { registryScript } from "../utils.mjs";
2
+ import { object } from "#nuxt-scripts-validator";
3
3
  export const LemonSqueezyOptions = object({});
4
4
  export function useScriptLemonSqueezy(_options) {
5
5
  return registryScript("lemonSqueezy", () => ({
@@ -8,7 +8,7 @@ export function useScriptLemonSqueezy(_options) {
8
8
  // @ts-expect-error untyped
9
9
  crossorigin: null
10
10
  },
11
- schema: LemonSqueezyOptions,
11
+ schema: import.meta.dev ? LemonSqueezyOptions : void 0,
12
12
  scriptOptions: {
13
13
  use() {
14
14
  if (typeof window.createLemonSqueezy === "undefined")
@@ -19,6 +19,6 @@ declare global {
19
19
  }
20
20
  }
21
21
  export declare function useScriptMatomoAnalytics<T extends MatomoAnalyticsApi>(_options?: MatomoAnalyticsInput): T & {
22
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
22
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
23
23
  };
24
24
  export {};
@@ -1,5 +1,5 @@
1
- import { boolean, object, optional, string } from "valibot";
2
1
  import { registryScript } from "../utils.mjs";
2
+ import { boolean, object, optional, string } from "#nuxt-scripts-validator";
3
3
  export const MatomoAnalyticsOptions = object({
4
4
  matomoUrl: string(),
5
5
  // site is required
@@ -12,7 +12,7 @@ export function useScriptMatomoAnalytics(_options) {
12
12
  scriptInput: {
13
13
  src: `https://${options?.matomoUrl}/matomo.js`
14
14
  },
15
- schema: MatomoAnalyticsOptions,
15
+ schema: import.meta.dev ? MatomoAnalyticsOptions : void 0,
16
16
  scriptOptions: {
17
17
  use() {
18
18
  return { _paq: window._paq };
@@ -12,5 +12,5 @@ export declare const NpmOptions: import("valibot").ObjectSchema<{
12
12
  }>;
13
13
  export type NpmInput = RegistryScriptInput<typeof NpmOptions>;
14
14
  export declare function useScriptNpm<T extends Record<string | symbol, any>>(_options: NpmInput): T & {
15
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
15
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
16
16
  };
@@ -1,6 +1,6 @@
1
- import { object, optional, string } from "valibot";
2
1
  import { withBase } from "ufo";
3
2
  import { registryScript } from "../utils.mjs";
3
+ import { object, optional, string } from "#nuxt-scripts-validator";
4
4
  export const NpmOptions = object({
5
5
  packageName: string(),
6
6
  file: optional(string()),
@@ -18,5 +18,5 @@ declare global {
18
18
  }
19
19
  }
20
20
  export declare function useScriptPlausibleAnalytics<T extends PlausibleAnalyticsApi>(_options?: PlausibleAnalyticsInput): T & {
21
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
21
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
22
22
  };
@@ -1,6 +1,6 @@
1
- import { array, literal, object, optional, string, union } from "valibot";
2
1
  import { registryScript } from "../utils.mjs";
3
2
  import { PlausibleAnalyticsScriptResolver } from "../../registry";
3
+ import { array, literal, object, optional, string, union } from "#nuxt-scripts-validator";
4
4
  const extensions = [
5
5
  literal("hash"),
6
6
  literal("outbound-links"),
@@ -24,7 +24,7 @@ export function useScriptPlausibleAnalytics(_options) {
24
24
  "src": PlausibleAnalyticsScriptResolver(options),
25
25
  "data-domain": options?.domain
26
26
  },
27
- schema: PlausibleAnalyticsOptions,
27
+ schema: import.meta.dev ? PlausibleAnalyticsOptions : void 0,
28
28
  scriptOptions: {
29
29
  use() {
30
30
  return { plausible: window.plausible };
@@ -22,5 +22,5 @@ declare global {
22
22
  }
23
23
  }
24
24
  export declare function useScriptSegment<T extends SegmentApi>(_options?: SegmentInput): T & {
25
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
25
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
26
26
  };
@@ -1,6 +1,6 @@
1
- import { object, optional, string } from "valibot";
2
1
  import { registryScript } from "../utils.mjs";
3
2
  import { SegmentScriptResolver } from "../../registry";
3
+ import { object, optional, string } from "#nuxt-scripts-validator";
4
4
  export const SegmentOptions = object({
5
5
  writeKey: string(),
6
6
  analyticsKey: optional(string())
@@ -13,7 +13,7 @@ export function useScriptSegment(_options) {
13
13
  "data-global-segment-analytics-key": analyticsKey,
14
14
  "src": SegmentScriptResolver(options)
15
15
  },
16
- schema: SegmentOptions,
16
+ schema: import.meta.dev ? SegmentOptions : void 0,
17
17
  scriptOptions: {
18
18
  use() {
19
19
  return { analytics: window[analyticsKey] };
@@ -1,4 +1,4 @@
1
- import type { Stripe } from '@types/stripe-v3';
1
+ /// <reference types="stripe-v3" />
2
2
  import type { RegistryScriptInput } from '#nuxt-scripts';
3
3
  export declare const StripeOptions: import("valibot").ObjectSchema<{
4
4
  advancedFraudSignals: import("valibot").OptionalSchema<import("valibot").BooleanSchema<boolean>, undefined, boolean | undefined>;
@@ -7,12 +7,12 @@ export declare const StripeOptions: import("valibot").ObjectSchema<{
7
7
  }>;
8
8
  export type StripeInput = RegistryScriptInput<typeof StripeOptions, false>;
9
9
  export interface StripeApi {
10
- Stripe: Stripe;
10
+ Stripe: stripe.StripeStatic;
11
11
  }
12
12
  declare global {
13
13
  interface Window extends StripeApi {
14
14
  }
15
15
  }
16
16
  export declare function useScriptStripe<T extends StripeApi>(_options?: StripeInput): T & {
17
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
17
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
18
18
  };
@@ -1,6 +1,6 @@
1
- import { boolean, object, optional } from "valibot";
2
1
  import { withQuery } from "ufo";
3
2
  import { registryScript } from "../utils.mjs";
3
+ import { boolean, object, optional } from "#nuxt-scripts-validator";
4
4
  export const StripeOptions = object({
5
5
  advancedFraudSignals: optional(boolean())
6
6
  });
@@ -17,7 +17,7 @@ export function useScriptStripe(_options) {
17
17
  // @ts-expect-error TODO add types
18
18
  referrerpolicy: null
19
19
  },
20
- schema: StripeOptions,
20
+ schema: import.meta.dev ? StripeOptions : void 0,
21
21
  scriptOptions: {
22
22
  use() {
23
23
  return { Stripe: window.Stripe };
@@ -11,5 +11,5 @@ declare global {
11
11
  }
12
12
  }
13
13
  export declare function useScriptVimeoPlayer<T extends VimeoPlayerApi>(_options?: VimeoPlayerInput): T & {
14
- $script: import("@unhead/vue").VueScriptInstance<T> & Promise<T>;
14
+ $script: Promise<T> & import("@unhead/vue").VueScriptInstance<T>;
15
15
  };
@@ -1,5 +1,5 @@
1
- import { object } from "valibot";
2
1
  import { registryScript } from "../utils.mjs";
2
+ import { object } from "#nuxt-scripts-validator";
3
3
  import { useHead } from "#imports";
4
4
  export const VimeoPlayerOptions = object({});
5
5
  export function useScriptVimeoPlayer(_options) {
@@ -7,7 +7,7 @@ export function useScriptVimeoPlayer(_options) {
7
7
  scriptInput: {
8
8
  src: "https://player.vimeo.com/api/player.js"
9
9
  },
10
- schema: VimeoPlayerOptions,
10
+ schema: import.meta.dev ? VimeoPlayerOptions : void 0,
11
11
  scriptOptions: {
12
12
  use() {
13
13
  let Player;