@nuxt/scripts 0.10.5 → 0.11.0

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 (41) hide show
  1. package/README.md +71 -71
  2. package/dist/client/200.html +10 -10
  3. package/dist/client/404.html +10 -10
  4. package/dist/client/_nuxt/{BOGJUGGn.js → BFM-Ncmx.js} +1 -1
  5. package/dist/client/_nuxt/{Bso10INu.js → BSA2bgdb.js} +1 -1
  6. package/dist/client/_nuxt/CtQNcfGE.js +1 -0
  7. package/dist/client/_nuxt/DuCkB5R-.js +21 -0
  8. package/dist/client/_nuxt/builds/latest.json +1 -1
  9. package/dist/client/_nuxt/builds/meta/e03354ab-f2ce-4d6b-8542-7b38262b3671.json +1 -0
  10. package/dist/client/_nuxt/{entry.CJckMUzn.css → entry.ipQkUTQD.css} +1 -1
  11. package/dist/client/_nuxt/error-404.BdjopNsg.css +1 -0
  12. package/dist/client/_nuxt/error-500.Bd7Z7Q7I.css +1 -0
  13. package/dist/client/index.html +10 -10
  14. package/dist/module.json +2 -2
  15. package/dist/module.mjs +7 -13
  16. package/dist/runtime/components/ScriptAriaLoadingIndicator.vue +5 -5
  17. package/dist/runtime/components/ScriptCarbonAds.vue +83 -83
  18. package/dist/runtime/components/ScriptCrisp.vue +94 -94
  19. package/dist/runtime/components/ScriptGoogleAdsense.vue +93 -93
  20. package/dist/runtime/components/ScriptGoogleMaps.vue +469 -469
  21. package/dist/runtime/components/ScriptIntercom.vue +103 -103
  22. package/dist/runtime/components/ScriptLemonSqueezy.vue +52 -52
  23. package/dist/runtime/components/ScriptLoadingIndicator.vue +22 -22
  24. package/dist/runtime/components/ScriptStripePricingTable.vue +74 -74
  25. package/dist/runtime/components/ScriptVimeoPlayer.vue +289 -289
  26. package/dist/runtime/components/ScriptYouTubePlayer.vue +215 -215
  27. package/dist/runtime/composables/useScript.d.ts +8 -4
  28. package/dist/runtime/composables/useScript.js +10 -59
  29. package/dist/runtime/registry/google-analytics.js +0 -3
  30. package/dist/runtime/registry/google-maps.d.ts +4 -10
  31. package/dist/runtime/registry/google-tag-manager.js +0 -3
  32. package/dist/runtime/registry/matomo-analytics.js +0 -4
  33. package/dist/runtime/registry/segment.js +0 -18
  34. package/dist/runtime/types.d.ts +2 -2
  35. package/dist/runtime/utils.js +1 -1
  36. package/package.json +32 -35
  37. package/dist/client/_nuxt/BqRljlc8.js +0 -21
  38. package/dist/client/_nuxt/CgFBdOe6.js +0 -1
  39. package/dist/client/_nuxt/builds/meta/a79d2e11-f9af-444c-b10e-0675b6cf7f55.json +0 -1
  40. package/dist/client/_nuxt/error-404.DrjQUyCj.css +0 -1
  41. package/dist/client/_nuxt/error-500.CIXIBnf9.css +0 -1
@@ -1,93 +1,93 @@
1
- <script setup lang="ts">
2
- import { computed, onMounted, ref, watch } from 'vue'
3
- import { callOnce } from 'nuxt/app'
4
- import { useScriptTriggerElement } from '../composables/useScriptTriggerElement'
5
- import { useScriptGoogleAdsense } from '../registry/google-adsense'
6
- import { scriptRuntimeConfig } from '../utils'
7
- import type { ElementScriptTrigger } from '#nuxt-scripts/types'
8
-
9
- const props = withDefaults(defineProps<{
10
- dataAdClient: string
11
- dataAdSlot: string
12
- dataAdFormat?: 'auto' | 'rectangle' | 'vertical' | 'horizontal' | 'fluid' | 'autorelaxed'
13
- dataAdLayout?: 'in-article' | 'in-feed' | 'fixed'
14
- dataFullWidthResponsive?: boolean
15
- /**
16
- * Defines the trigger event to load the script.
17
- */
18
- trigger?: ElementScriptTrigger
19
- }>(), {
20
- dataFullWidthResponsive: true,
21
- dataAdFormat: undefined, // Preserve previous behavior
22
- })
23
-
24
- const emits = defineEmits<{
25
- // our emit
26
- ready: [e: ReturnType<typeof useScriptGoogleAdsense>]
27
- error: []
28
- }>()
29
-
30
- const rootEl = ref(null)
31
- const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl })
32
-
33
- const scriptConfig = scriptRuntimeConfig('googleAdsense')
34
- const addClient = computed(() => {
35
- return props.dataAdClient || scriptConfig?.client
36
- })
37
-
38
- const instance = useScriptGoogleAdsense({
39
- client: addClient.value,
40
- scriptOptions: {
41
- trigger,
42
- },
43
- })
44
-
45
- const { status } = instance
46
-
47
- function pushAdSlot() {
48
- (window.adsbygoogle = window.adsbygoogle || []).push({})
49
- }
50
-
51
- onMounted(() => {
52
- if (import.meta.dev) {
53
- callOnce(() => pushAdSlot())
54
- }
55
- else {
56
- pushAdSlot()
57
- }
58
-
59
- watch(status, (val) => {
60
- if (val === 'loaded') {
61
- emits('ready', instance)
62
- }
63
- else if (val === 'error') {
64
- emits('error')
65
- }
66
- })
67
- })
68
-
69
- const rootAttrs = computed(() => {
70
- return {
71
- ...(trigger instanceof Promise ? trigger.ssrAttrs || {} : {}),
72
- }
73
- })
74
- </script>
75
-
76
- <template>
77
- <div>
78
- <ins
79
- ref="rootEl"
80
- class="adsbygoogle"
81
- style="display: block;"
82
- :data-ad-client="addClient"
83
- :data-ad-slot="dataAdSlot"
84
- :data-ad-format="dataAdFormat"
85
- :data-ad-layout="dataAdLayout"
86
- :data-full-width-responsive="dataFullWidthResponsive"
87
- v-bind="rootAttrs"
88
- />
89
- <slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
90
- <slot v-else-if="status === 'loading'" name="loading" />
91
- <slot v-else-if="status === 'error'" name="error" />
92
- </div>
93
- </template>
1
+ <script setup lang="ts">
2
+ import { computed, onMounted, ref, watch } from 'vue'
3
+ import { callOnce } from 'nuxt/app'
4
+ import { useScriptTriggerElement } from '../composables/useScriptTriggerElement'
5
+ import { useScriptGoogleAdsense } from '../registry/google-adsense'
6
+ import { scriptRuntimeConfig } from '../utils'
7
+ import type { ElementScriptTrigger } from '#nuxt-scripts/types'
8
+
9
+ const props = withDefaults(defineProps<{
10
+ dataAdClient: string
11
+ dataAdSlot: string
12
+ dataAdFormat?: 'auto' | 'rectangle' | 'vertical' | 'horizontal' | 'fluid' | 'autorelaxed'
13
+ dataAdLayout?: 'in-article' | 'in-feed' | 'fixed'
14
+ dataFullWidthResponsive?: boolean
15
+ /**
16
+ * Defines the trigger event to load the script.
17
+ */
18
+ trigger?: ElementScriptTrigger
19
+ }>(), {
20
+ dataFullWidthResponsive: true,
21
+ dataAdFormat: undefined, // Preserve previous behavior
22
+ })
23
+
24
+ const emits = defineEmits<{
25
+ // our emit
26
+ ready: [e: ReturnType<typeof useScriptGoogleAdsense>]
27
+ error: []
28
+ }>()
29
+
30
+ const rootEl = ref(null)
31
+ const trigger = useScriptTriggerElement({ trigger: props.trigger, el: rootEl })
32
+
33
+ const scriptConfig = scriptRuntimeConfig('googleAdsense')
34
+ const addClient = computed(() => {
35
+ return props.dataAdClient || scriptConfig?.client
36
+ })
37
+
38
+ const instance = useScriptGoogleAdsense({
39
+ client: addClient.value,
40
+ scriptOptions: {
41
+ trigger,
42
+ },
43
+ })
44
+
45
+ const { status } = instance
46
+
47
+ function pushAdSlot() {
48
+ (window.adsbygoogle = window.adsbygoogle || []).push({})
49
+ }
50
+
51
+ onMounted(() => {
52
+ if (import.meta.dev) {
53
+ callOnce(() => pushAdSlot())
54
+ }
55
+ else {
56
+ pushAdSlot()
57
+ }
58
+
59
+ watch(status, (val) => {
60
+ if (val === 'loaded') {
61
+ emits('ready', instance)
62
+ }
63
+ else if (val === 'error') {
64
+ emits('error')
65
+ }
66
+ })
67
+ })
68
+
69
+ const rootAttrs = computed(() => {
70
+ return {
71
+ ...(trigger instanceof Promise ? trigger.ssrAttrs || {} : {}),
72
+ }
73
+ })
74
+ </script>
75
+
76
+ <template>
77
+ <div>
78
+ <ins
79
+ ref="rootEl"
80
+ class="adsbygoogle"
81
+ style="display: block;"
82
+ :data-ad-client="addClient"
83
+ :data-ad-slot="dataAdSlot"
84
+ :data-ad-format="dataAdFormat"
85
+ :data-ad-layout="dataAdLayout"
86
+ :data-full-width-responsive="dataFullWidthResponsive"
87
+ v-bind="rootAttrs"
88
+ />
89
+ <slot v-if="status === 'awaitingLoad'" name="awaitingLoad" />
90
+ <slot v-else-if="status === 'loading'" name="loading" />
91
+ <slot v-else-if="status === 'error'" name="error" />
92
+ </div>
93
+ </template>