@nuxt/scripts 0.13.2 → 1.0.0-beta.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.
- package/README.md +15 -0
- package/dist/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/B66N9HCo.js +1 -0
- package/dist/client/_nuxt/B8XOar-X.js +162 -0
- package/dist/client/_nuxt/{Bje-0OHL.js → DfLgoB--.js} +1 -1
- package/dist/client/_nuxt/DvH517bE.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/133a46c5-a5c1-4a63-87d1-037947a5bcdb.json +1 -0
- package/dist/client/_nuxt/entry.D45OuV0w.css +1 -0
- package/dist/client/_nuxt/error-404.B57D-jUQ.css +1 -0
- package/dist/client/_nuxt/error-500.DTHUW7BI.css +1 -0
- package/dist/client/index.html +1 -1
- package/dist/module.d.mts +106 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +705 -173
- package/dist/registry.mjs +63 -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/ScriptInstagramEmbed.d.vue.ts +53 -0
- package/dist/runtime/components/ScriptInstagramEmbed.vue +38 -0
- package/dist/runtime/components/ScriptInstagramEmbed.vue.d.ts +53 -0
- 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/ScriptXEmbed.d.vue.ts +82 -0
- package/dist/runtime/components/ScriptXEmbed.vue +76 -0
- package/dist/runtime/components/ScriptXEmbed.vue.d.ts +82 -0
- 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 +34 -3
- package/dist/runtime/composables/useScriptTriggerServiceWorker.d.ts +7 -0
- package/dist/runtime/composables/useScriptTriggerServiceWorker.js +39 -0
- package/dist/runtime/npm-script-stub.d.ts +20 -0
- package/dist/runtime/npm-script-stub.js +73 -0
- package/dist/runtime/plugins/sw-register.client.d.ts +2 -0
- package/dist/runtime/plugins/sw-register.client.js +12 -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/instagram-embed.d.ts +23 -0
- package/dist/runtime/registry/instagram-embed.js +22 -0
- package/dist/runtime/registry/lemon-squeezy.d.ts +0 -1
- 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 +44 -0
- package/dist/runtime/registry/tiktok-pixel.js +44 -0
- package/dist/runtime/registry/x-embed.d.ts +77 -0
- package/dist/runtime/registry/x-embed.js +41 -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/server/instagram-embed-asset.d.ts +2 -0
- package/dist/runtime/server/instagram-embed-asset.js +42 -0
- package/dist/runtime/server/instagram-embed-image.d.ts +2 -0
- package/dist/runtime/server/instagram-embed-image.js +54 -0
- package/dist/runtime/server/instagram-embed.d.ts +2 -0
- package/dist/runtime/server/instagram-embed.js +91 -0
- package/dist/runtime/server/proxy-handler.d.ts +6 -0
- package/dist/runtime/server/proxy-handler.js +230 -0
- package/dist/runtime/server/sw-handler.d.ts +2 -0
- package/dist/runtime/server/sw-handler.js +25 -0
- package/dist/runtime/server/utils/privacy.d.ts +97 -0
- package/dist/runtime/server/utils/privacy.js +268 -0
- package/dist/runtime/server/x-embed-image.d.ts +2 -0
- package/dist/runtime/server/x-embed-image.js +53 -0
- package/dist/runtime/server/x-embed.d.ts +49 -0
- package/dist/runtime/server/x-embed.js +31 -0
- package/dist/runtime/sw/proxy-sw.template.d.ts +1 -0
- package/dist/runtime/sw/proxy-sw.template.js +54 -0
- package/dist/runtime/types.d.ts +42 -1
- package/dist/runtime/utils/pure.d.ts +13 -0
- package/dist/runtime/utils/pure.js +67 -0
- package/dist/runtime/utils.d.ts +3 -2
- package/dist/runtime/utils.js +11 -1
- package/dist/types.d.mts +1 -1
- package/package.json +39 -32
- 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/entry.BjfcJo5q.css +0 -1
- package/dist/client/_nuxt/error-404.B0ZhSNwd.css +0 -1
- package/dist/client/_nuxt/error-500.D4MdgPaC.css +0 -1
- package/dist/client/_nuxt/iNmKC7TZ.js +0 -1
- package/dist/client/_nuxt/rttsH3SL.js +0 -1
package/dist/registry.mjs
CHANGED
|
@@ -26,6 +26,17 @@ async function registry(resolve) {
|
|
|
26
26
|
from: await resolve("./runtime/registry/cloudflare-web-analytics")
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
label: "PostHog",
|
|
31
|
+
src: false,
|
|
32
|
+
scriptBundling: false,
|
|
33
|
+
category: "analytics",
|
|
34
|
+
logo: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 128 128"><path fill="#1d4aff" d="M0 .52v32.15l31.79 31.78V32.3L0 .52zm32.3 32.15v32.15l31.78 31.78V64.45L32.3 32.67zM0 64.97v32.15l31.79 31.78V96.75L0 64.97zm64.6-32.3v32.15l31.78 31.78V64.45L64.6 32.67zm31.78 31.78v32.15l31.78 31.78V96.23l-31.78-31.78zm-64.08.52v32.15l31.78 31.78V96.75L32.3 64.97zM64.6 .52v32.15l31.78 31.78V32.3L64.6 .52zm0 64.45v32.15l31.78 31.78V96.75L64.6 64.97z"/></svg>`,
|
|
35
|
+
import: {
|
|
36
|
+
name: "useScriptPostHog",
|
|
37
|
+
from: await resolve("./runtime/registry/posthog")
|
|
38
|
+
}
|
|
39
|
+
},
|
|
29
40
|
{
|
|
30
41
|
label: "Fathom Analytics",
|
|
31
42
|
scriptBundling: false,
|
|
@@ -68,6 +79,7 @@ async function registry(resolve) {
|
|
|
68
79
|
},
|
|
69
80
|
{
|
|
70
81
|
label: "Segment",
|
|
82
|
+
proxy: "segment",
|
|
71
83
|
scriptBundling: (options) => {
|
|
72
84
|
return joinURL("https://cdn.segment.com/analytics.js/v1", options?.writeKey || "", "analytics.min.js");
|
|
73
85
|
},
|
|
@@ -80,6 +92,7 @@ async function registry(resolve) {
|
|
|
80
92
|
},
|
|
81
93
|
{
|
|
82
94
|
label: "Meta Pixel",
|
|
95
|
+
proxy: "metaPixel",
|
|
83
96
|
src: "https://connect.facebook.net/en_US/fbevents.js",
|
|
84
97
|
category: "tracking",
|
|
85
98
|
logo: `<svg xmlns="http://www.w3.org/2000/svg" width="47.91" height="32" viewBox="0 0 256 171"><defs><linearGradient id="logosMetaIcon0" x1="13.878%" x2="89.144%" y1="55.934%" y2="58.694%"><stop offset="0%" stop-color="#0064E1"/><stop offset="40%" stop-color="#0064E1"/><stop offset="83%" stop-color="#0073EE"/><stop offset="100%" stop-color="#0082FB"/></linearGradient><linearGradient id="logosMetaIcon1" x1="54.315%" x2="54.315%" y1="82.782%" y2="39.307%"><stop offset="0%" stop-color="#0082FB"/><stop offset="100%" stop-color="#0064E0"/></linearGradient></defs><path fill="#0081FB" d="M27.651 112.136c0 9.775 2.146 17.28 4.95 21.82c3.677 5.947 9.16 8.466 14.751 8.466c7.211 0 13.808-1.79 26.52-19.372c10.185-14.092 22.186-33.874 30.26-46.275l13.675-21.01c9.499-14.591 20.493-30.811 33.1-41.806C161.196 4.985 172.298 0 183.47 0c18.758 0 36.625 10.87 50.3 31.257C248.735 53.584 256 81.707 256 110.729c0 17.253-3.4 29.93-9.187 39.946c-5.591 9.686-16.488 19.363-34.818 19.363v-27.616c15.695 0 19.612-14.422 19.612-30.927c0-23.52-5.484-49.623-17.564-68.273c-8.574-13.23-19.684-21.313-31.907-21.313c-13.22 0-23.859 9.97-35.815 27.75c-6.356 9.445-12.882 20.956-20.208 33.944l-8.066 14.289c-16.203 28.728-20.307 35.271-28.408 46.07c-14.2 18.91-26.324 26.076-42.287 26.076c-18.935 0-30.91-8.2-38.325-20.556C2.973 139.413 0 126.202 0 111.148z"/><path fill="url(#logosMetaIcon0)" d="M21.802 33.206C34.48 13.666 52.774 0 73.757 0C85.91 0 97.99 3.597 110.605 13.897c13.798 11.261 28.505 29.805 46.853 60.368l6.58 10.967c15.881 26.459 24.917 40.07 30.205 46.49c6.802 8.243 11.565 10.7 17.752 10.7c15.695 0 19.612-14.422 19.612-30.927l24.393-.766c0 17.253-3.4 29.93-9.187 39.946c-5.591 9.686-16.488 19.363-34.818 19.363c-11.395 0-21.49-2.475-32.654-13.007c-8.582-8.083-18.615-22.443-26.334-35.352l-22.96-38.352C118.528 64.08 107.96 49.73 101.845 43.23c-6.578-6.988-15.036-15.428-28.532-15.428c-10.923 0-20.2 7.666-27.963 19.39z"/><path fill="url(#logosMetaIcon1)" d="M73.312 27.802c-10.923 0-20.2 7.666-27.963 19.39c-10.976 16.568-17.698 41.245-17.698 64.944c0 9.775 2.146 17.28 4.95 21.82L9.027 149.482C2.973 139.413 0 126.202 0 111.148C0 83.772 7.514 55.24 21.802 33.206C34.48 13.666 52.774 0 73.757 0z"/></svg>`,
|
|
@@ -90,6 +103,7 @@ async function registry(resolve) {
|
|
|
90
103
|
},
|
|
91
104
|
{
|
|
92
105
|
label: "X Pixel",
|
|
106
|
+
proxy: "xPixel",
|
|
93
107
|
src: "https://static.ads-twitter.com/uwt.js",
|
|
94
108
|
category: "tracking",
|
|
95
109
|
logo: {
|
|
@@ -101,8 +115,24 @@ async function registry(resolve) {
|
|
|
101
115
|
from: await resolve("./runtime/registry/x-pixel")
|
|
102
116
|
}
|
|
103
117
|
},
|
|
118
|
+
{
|
|
119
|
+
label: "TikTok Pixel",
|
|
120
|
+
proxy: "tiktokPixel",
|
|
121
|
+
category: "tracking",
|
|
122
|
+
logo: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><path d="M224 72a52.059 52.059 0 0 1-52-52a4 4 0 0 0-4-4h-40a4 4 0 0 0-4 4v132a28 28 0 1 1-40.567-25.019a4 4 0 0 0 2.567-3.734V80a4 4 0 0 0-4.652-3.949A84.032 84.032 0 1 0 156 152v-43.047a99.432 99.432 0 0 0 52 14.586a4 4 0 0 0 4-4V76a4 4 0 0 0-4-4z" fill="currentColor"/></svg>`,
|
|
123
|
+
import: {
|
|
124
|
+
name: "useScriptTikTokPixel",
|
|
125
|
+
from: await resolve("./runtime/registry/tiktok-pixel")
|
|
126
|
+
},
|
|
127
|
+
scriptBundling(options) {
|
|
128
|
+
if (!options?.id)
|
|
129
|
+
return false;
|
|
130
|
+
return withQuery("https://analytics.tiktok.com/i18n/pixel/events.js", { sdkid: options.id, lib: "ttq" });
|
|
131
|
+
}
|
|
132
|
+
},
|
|
104
133
|
{
|
|
105
134
|
label: "Snapchat Pixel",
|
|
135
|
+
proxy: "snapchatPixel",
|
|
106
136
|
src: "https://sc-static.net/scevent.min.js",
|
|
107
137
|
category: "tracking",
|
|
108
138
|
logo: '<svg width="50" height="50" viewBox="147.353 39.286 514.631 514.631" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"><path style="fill:#FFFC00;" d="M147.553,423.021v0.023c0.308,11.424,0.403,22.914,2.33,34.268 c2.042,12.012,4.961,23.725,10.53,34.627c7.529,14.756,17.869,27.217,30.921,37.396c9.371,7.309,19.608,13.111,30.94,16.771 c16.524,5.33,33.571,7.373,50.867,7.473c10.791,0.068,21.575,0.338,32.37,0.293c78.395-0.33,156.792,0.566,235.189-0.484 c10.403-0.141,20.636-1.41,30.846-3.277c19.569-3.582,36.864-11.932,51.661-25.133c17.245-15.381,28.88-34.205,34.132-56.924 c3.437-14.85,4.297-29.916,4.444-45.035v-3.016c0-1.17-0.445-256.892-0.486-260.272c-0.115-9.285-0.799-18.5-2.54-27.636 c-2.117-11.133-5.108-21.981-10.439-32.053c-5.629-10.641-12.68-20.209-21.401-28.57c-13.359-12.81-28.775-21.869-46.722-26.661 c-16.21-4.327-32.747-5.285-49.405-5.27c-0.027-0.004-0.09-0.173-0.094-0.255H278.56c-0.005,0.086-0.008,0.172-0.014,0.255 c-9.454,0.173-18.922,0.102-28.328,1.268c-10.304,1.281-20.509,3.21-30.262,6.812c-15.362,5.682-28.709,14.532-40.11,26.347 c-12.917,13.386-22.022,28.867-26.853,46.894c-4.31,16.084-5.248,32.488-5.271,49.008"/><path style="fill:#FFFFFF;" d="M407.001,473.488c-1.068,0-2.087-0.039-2.862-0.076c-0.615,0.053-1.25,0.076-1.886,0.076 c-22.437,0-37.439-10.607-50.678-19.973c-9.489-6.703-18.438-13.031-28.922-14.775c-5.149-0.854-10.271-1.287-15.22-1.287 c-8.917,0-15.964,1.383-21.109,2.389c-3.166,0.617-5.896,1.148-8.006,1.148c-2.21,0-4.895-0.49-6.014-4.311 c-0.887-3.014-1.523-5.934-2.137-8.746c-1.536-7.027-2.65-11.316-5.281-11.723c-28.141-4.342-44.768-10.738-48.08-18.484 c-0.347-0.814-0.541-1.633-0.584-2.443c-0.129-2.309,1.501-4.334,3.777-4.711c22.348-3.68,42.219-15.492,59.064-35.119 c13.049-15.195,19.457-29.713,20.145-31.316c0.03-0.072,0.065-0.148,0.101-0.217c3.247-6.588,3.893-12.281,1.926-16.916 c-3.626-8.551-15.635-12.361-23.58-14.882c-1.976-0.625-3.845-1.217-5.334-1.808c-7.043-2.782-18.626-8.66-17.083-16.773 c1.124-5.916,8.949-10.036,15.273-10.036c1.756,0,3.312,0.308,4.622,0.923c7.146,3.348,13.575,5.045,19.104,5.045 c6.876,0,10.197-2.618,11-3.362c-0.198-3.668-0.44-7.546-0.674-11.214c0-0.004-0.005-0.048-0.005-0.048 c-1.614-25.675-3.627-57.627,4.546-75.95c24.462-54.847,76.339-59.112,91.651-59.112c0.408,0,6.674-0.062,6.674-0.062 c0.283-0.005,0.59-0.009,0.908-0.009c15.354,0,67.339,4.27,91.816,59.15c8.173,18.335,6.158,50.314,4.539,76.016l-0.076,1.23 c-0.222,3.49-0.427,6.793-0.6,9.995c0.756,0.696,3.795,3.096,9.978,3.339c5.271-0.202,11.328-1.891,17.998-5.014 c2.062-0.968,4.345-1.169,5.895-1.169c2.343,0,4.727,0.456,6.714,1.285l0.106,0.041c5.66,2.009,9.367,6.024,9.447,10.242 c0.071,3.932-2.851,9.809-17.223,15.485c-1.472,0.583-3.35,1.179-5.334,1.808c-7.952,2.524-19.951,6.332-23.577,14.878 c-1.97,4.635-1.322,10.326,1.926,16.912c0.036,0.072,0.067,0.145,0.102,0.221c1,2.344,25.205,57.535,79.209,66.432 c2.275,0.379,3.908,2.406,3.778,4.711c-0.048,0.828-0.248,1.656-0.598,2.465c-3.289,7.703-19.915,14.09-48.064,18.438 c-2.642,0.408-3.755,4.678-5.277,11.668c-0.63,2.887-1.271,5.717-2.146,8.691c-0.819,2.797-2.641,4.164-5.567,4.164h-0.441 c-1.905,0-4.604-0.346-8.008-1.012c-5.95-1.158-12.623-2.236-21.109-2.236c-4.948,0-10.069,0.434-15.224,1.287 c-10.473,1.744-19.421,8.062-28.893,14.758C444.443,462.88,429.436,473.488,407.001,473.488"/><path style="fill:#020202;" d="M408.336,124.235c14.455,0,64.231,3.883,87.688,56.472c7.724,17.317,5.744,48.686,4.156,73.885 c-0.248,3.999-0.494,7.875-0.694,11.576l-0.084,1.591l1.062,1.185c0.429,0.476,4.444,4.672,13.374,5.017l0.144,0.008l0.15-0.003 c5.904-0.225,12.554-2.059,19.776-5.442c1.064-0.498,2.48-0.741,3.978-0.741c1.707,0,3.521,0.321,5.017,0.951l0.226,0.09 c3.787,1.327,6.464,3.829,6.505,6.093c0.022,1.28-0.935,5.891-14.359,11.194c-1.312,0.518-3.039,1.069-5.041,1.7 c-8.736,2.774-21.934,6.96-26.376,17.427c-2.501,5.896-1.816,12.854,2.034,20.678c1.584,3.697,26.52,59.865,82.631,69.111 c-0.011,0.266-0.079,0.557-0.229,0.9c-0.951,2.24-6.996,9.979-44.612,15.783c-5.886,0.902-7.328,7.5-9,15.17 c-0.604,2.746-1.218,5.518-2.062,8.381c-0.258,0.865-0.306,0.914-1.233,0.914c-0.128,0-0.278,0-0.442,0 c-1.668,0-4.2-0.346-7.135-0.922c-5.345-1.041-12.647-2.318-21.982-2.318c-5.21,0-10.577,0.453-15.962,1.352 c-11.511,1.914-20.872,8.535-30.786,15.543c-13.314,9.408-27.075,19.143-48.071,19.143c-0.917,0-1.812-0.031-2.709-0.076 l-0.236-0.01l-0.237,0.018c-0.515,0.045-1.034,0.068-1.564,0.068c-20.993,0-34.76-9.732-48.068-19.143 c-9.916-7.008-19.282-13.629-30.791-15.543c-5.38-0.896-10.752-1.352-15.959-1.352c-9.333,0-16.644,1.428-21.978,2.471 c-2.935,0.574-5.476,1.066-7.139,1.066c-1.362,0-1.388-0.08-1.676-1.064c-0.844-2.865-1.461-5.703-2.062-8.445 c-1.676-7.678-3.119-14.312-9.002-15.215c-37.613-5.809-43.659-13.561-44.613-15.795c-0.149-0.352-0.216-0.652-0.231-0.918 c56.11-9.238,81.041-65.408,82.63-69.119c3.857-7.818,4.541-14.775,2.032-20.678c-4.442-10.461-17.638-14.653-26.368-17.422 c-2.007-0.635-3.735-1.187-5.048-1.705c-11.336-4.479-14.823-8.991-14.305-11.725c0.601-3.153,6.067-6.359,10.837-6.359 c1.072,0,2.012,0.173,2.707,0.498c7.747,3.631,14.819,5.472,21.022,5.472c9.751,0,14.091-4.537,14.557-5.055l1.057-1.182 l-0.085-1.583c-0.197-3.699-0.44-7.574-0.696-11.565c-1.583-25.205-3.563-56.553,4.158-73.871 c23.37-52.396,72.903-56.435,87.525-56.435c0.36,0,6.717-0.065,6.717-0.065C407.744,124.239,408.033,124.235,408.336,124.235 M408.336,115.197h-0.017c-0.333,0-0.646,0-0.944,0.004c-2.376,0.024-6.282,0.062-6.633,0.066c-8.566,0-25.705,1.21-44.115,9.336 c-10.526,4.643-19.994,10.921-28.14,18.66c-9.712,9.221-17.624,20.59-23.512,33.796c-8.623,19.336-6.576,51.905-4.932,78.078 l0.006,0.041c0.176,2.803,0.361,5.73,0.53,8.582c-1.265,0.581-3.316,1.194-6.339,1.194c-4.864,0-10.648-1.555-17.187-4.619 c-1.924-0.896-4.12-1.349-6.543-1.349c-3.893,0-7.997,1.146-11.557,3.239c-4.479,2.63-7.373,6.347-8.159,10.468 c-0.518,2.726-0.493,8.114,5.492,13.578c3.292,3.008,8.128,5.782,14.37,8.249c1.638,0.645,3.582,1.261,5.641,1.914 c7.145,2.271,17.959,5.702,20.779,12.339c1.429,3.365,0.814,7.793-1.823,13.145c-0.069,0.146-0.138,0.289-0.201,0.439 c-0.659,1.539-6.807,15.465-19.418,30.152c-7.166,8.352-15.059,15.332-23.447,20.752c-10.238,6.617-21.316,10.943-32.923,12.855 c-4.558,0.748-7.813,4.809-7.559,9.424c0.078,1.33,0.39,2.656,0.931,3.939c0.004,0.008,0.009,0.016,0.013,0.023 c1.843,4.311,6.116,7.973,13.063,11.203c8.489,3.943,21.185,7.26,37.732,9.855c0.836,1.59,1.704,5.586,2.305,8.322 c0.629,2.908,1.285,5.898,2.22,9.074c1.009,3.441,3.626,7.553,10.349,7.553c2.548,0,5.478-0.574,8.871-1.232 c4.969-0.975,11.764-2.305,20.245-2.305c4.702,0,9.575,0.414,14.48,1.229c9.455,1.574,17.606,7.332,27.037,14 c13.804,9.758,29.429,20.803,53.302,20.803c0.651,0,1.304-0.021,1.949-0.066c0.789,0.037,1.767,0.066,2.799,0.066 c23.88,0,39.501-11.049,53.29-20.799l0.022-0.02c9.433-6.66,17.575-12.41,27.027-13.984c4.903-0.814,9.775-1.229,14.479-1.229 c8.102,0,14.517,1.033,20.245,2.15c3.738,0.736,6.643,1.09,8.872,1.09l0.218,0.004h0.226c4.917,0,8.53-2.699,9.909-7.422 c0.916-3.109,1.57-6.029,2.215-8.986c0.562-2.564,1.46-6.674,2.296-8.281c16.558-2.6,29.249-5.91,37.739-9.852 c6.931-3.215,11.199-6.873,13.053-11.166c0.556-1.287,0.881-2.621,0.954-3.979c0.261-4.607-2.999-8.676-7.56-9.424 c-51.585-8.502-74.824-61.506-75.785-63.758c-0.062-0.148-0.132-0.295-0.205-0.438c-2.637-5.354-3.246-9.777-1.816-13.148 c2.814-6.631,13.621-10.062,20.771-12.332c2.07-0.652,4.021-1.272,5.646-1.914c7.039-2.78,12.07-5.796,15.389-9.221 c3.964-4.083,4.736-7.995,4.688-10.555c-0.121-6.194-4.856-11.698-12.388-14.393c-2.544-1.052-5.445-1.607-8.399-1.607 c-2.011,0-4.989,0.276-7.808,1.592c-6.035,2.824-11.441,4.368-16.082,4.588c-2.468-0.125-4.199-0.66-5.32-1.171 c0.141-2.416,0.297-4.898,0.458-7.486l0.067-1.108c1.653-26.19,3.707-58.784-4.92-78.134c-5.913-13.253-13.853-24.651-23.604-33.892 c-8.178-7.744-17.678-14.021-28.242-18.661C434.052,116.402,416.914,115.197,408.336,115.197"/><rect x="147.553" y="39.443" style="fill:none;" width="514.231" height="514.23"/></svg>',
|
|
@@ -113,6 +143,7 @@ async function registry(resolve) {
|
|
|
113
143
|
},
|
|
114
144
|
{
|
|
115
145
|
label: "Reddit Pixel",
|
|
146
|
+
proxy: "redditPixel",
|
|
116
147
|
src: "https://www.redditstatic.com/ads/pixel.js",
|
|
117
148
|
category: "tracking",
|
|
118
149
|
logo: `<svg viewBox="0 0 800 800" xmlns="http://www.w3.org/2000/svg" width="32" height="32"> <circle cx="400" cy="400" fill="#ff4500" r="400"/> <path d="M666.8 400c.08 5.48-.6 10.95-2.04 16.24s-3.62 10.36-6.48 15.04c-2.85 4.68-6.35 8.94-10.39 12.65s-8.58 6.83-13.49 9.27c.11 1.46.2 2.93.25 4.4a107.268 107.268 0 0 1 0 8.8c-.05 1.47-.14 2.94-.25 4.4 0 89.6-104.4 162.4-233.2 162.4S168 560.4 168 470.8c-.11-1.46-.2-2.93-.25-4.4a107.268 107.268 0 0 1 0-8.8c.05-1.47.14-2.94.25-4.4a58.438 58.438 0 0 1-31.85-37.28 58.41 58.41 0 0 1 7.8-48.42 58.354 58.354 0 0 1 41.93-25.4 58.4 58.4 0 0 1 46.52 15.5 286.795 286.795 0 0 1 35.89-20.71c12.45-6.02 25.32-11.14 38.51-15.3s26.67-7.35 40.32-9.56 27.45-3.42 41.28-3.63L418 169.6c.33-1.61.98-3.13 1.91-4.49.92-1.35 2.11-2.51 3.48-3.4 1.38-.89 2.92-1.5 4.54-1.8 1.61-.29 3.27-.26 4.87.09l98 19.6c9.89-16.99 30.65-24.27 48.98-17.19s28.81 26.43 24.71 45.65c-4.09 19.22-21.55 32.62-41.17 31.61-19.63-1.01-35.62-16.13-37.72-35.67L440 186l-26 124.8c13.66.29 27.29 1.57 40.77 3.82a284.358 284.358 0 0 1 77.8 24.86A284.412 284.412 0 0 1 568 360a58.345 58.345 0 0 1 29.4-15.21 58.361 58.361 0 0 1 32.95 3.21 58.384 58.384 0 0 1 25.91 20.61A58.384 58.384 0 0 1 666.8 400zm-396.96 55.31c2.02 4.85 4.96 9.26 8.68 12.97 3.71 3.72 8.12 6.66 12.97 8.68A40.049 40.049 0 0 0 306.8 480c16.18 0 30.76-9.75 36.96-24.69 6.19-14.95 2.76-32.15-8.68-43.59s-28.64-14.87-43.59-8.68c-14.94 6.2-24.69 20.78-24.69 36.96 0 5.25 1.03 10.45 3.04 15.31zm229.1 96.02c2.05-2 3.22-4.73 3.26-7.59.04-2.87-1.07-5.63-3.07-7.68s-4.73-3.22-7.59-3.26c-2.87-.04-5.63 1.07-7.94 2.8a131.06 131.06 0 0 1-19.04 11.35 131.53 131.53 0 0 1-20.68 7.99c-7.1 2.07-14.37 3.54-21.72 4.39-7.36.85-14.77 1.07-22.16.67-7.38.33-14.78.03-22.11-.89a129.01 129.01 0 0 1-21.64-4.6c-7.08-2.14-13.95-4.88-20.56-8.18s-12.93-7.16-18.89-11.53c-2.07-1.7-4.7-2.57-7.38-2.44s-5.21 1.26-7.11 3.15c-1.89 1.9-3.02 4.43-3.15 7.11s.74 5.31 2.44 7.38c7.03 5.3 14.5 9.98 22.33 14s16 7.35 24.4 9.97 17.01 4.51 25.74 5.66c8.73 1.14 17.54 1.53 26.33 1.17 8.79.36 17.6-.03 26.33-1.17A153.961 153.961 0 0 0 476.87 564c7.83-4.02 15.3-8.7 22.33-14zm-7.34-68.13c5.42.06 10.8-.99 15.81-3.07 5.01-2.09 9.54-5.17 13.32-9.06s6.72-8.51 8.66-13.58A39.882 39.882 0 0 0 532 441.6c0-16.18-9.75-30.76-24.69-36.96-14.95-6.19-32.15-2.76-43.59 8.68s-14.87 28.64-8.68 43.59c6.2 14.94 20.78 24.69 36.96 24.69z" fill="#fff"/> </svg>`,
|
|
@@ -163,6 +194,7 @@ async function registry(resolve) {
|
|
|
163
194
|
},
|
|
164
195
|
{
|
|
165
196
|
label: "Hotjar",
|
|
197
|
+
proxy: "hotjar",
|
|
166
198
|
scriptBundling(options) {
|
|
167
199
|
if (!options?.id) {
|
|
168
200
|
return false;
|
|
@@ -180,6 +212,7 @@ async function registry(resolve) {
|
|
|
180
212
|
},
|
|
181
213
|
{
|
|
182
214
|
label: "Clarity",
|
|
215
|
+
proxy: "clarity",
|
|
183
216
|
scriptBundling(options) {
|
|
184
217
|
if (!options?.id) {
|
|
185
218
|
return false;
|
|
@@ -281,9 +314,38 @@ async function registry(resolve) {
|
|
|
281
314
|
from: await resolve("./runtime/registry/npm")
|
|
282
315
|
}
|
|
283
316
|
},
|
|
317
|
+
{
|
|
318
|
+
label: "Google reCAPTCHA",
|
|
319
|
+
category: "utility",
|
|
320
|
+
logo: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64"><path fill="#1c3aa9" d="M64 32a32 32 0 1 1-64 0 32 32 0 0 1 64 0"/><path fill="#4285f4" d="m32 14-2 18 2 2 18-2V14z"/><path fill="#efefef" d="M14 32v18h18l2-2-2-16-16-2z"/><path fill="#f1f1f1" d="M32 32h18v18H32z"/><path fill="#e1e1e1" d="M14 14h18v18H14z"/><path fill="#1c3aa9" d="M32 14v18H14V14z"/><path fill="#4285f4" d="M32 32v18h18V32z"/><path d="M14 32h18v18H14z" fill="#f1f1f1"/><path d="M32 14h18v18H32z" fill="#fff"/></svg>`,
|
|
321
|
+
import: {
|
|
322
|
+
name: "useScriptGoogleRecaptcha",
|
|
323
|
+
from: await resolve("./runtime/registry/google-recaptcha")
|
|
324
|
+
},
|
|
325
|
+
scriptBundling(options) {
|
|
326
|
+
if (!options?.siteKey) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
const baseUrl = options?.recaptchaNet ? "https://www.recaptcha.net/recaptcha" : "https://www.google.com/recaptcha";
|
|
330
|
+
return `${baseUrl}/${options?.enterprise ? "enterprise.js" : "api.js"}`;
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
label: "Google Sign-In",
|
|
335
|
+
src: "https://accounts.google.com/gsi/client",
|
|
336
|
+
scriptBundling: false,
|
|
337
|
+
// CORS prevents bundling
|
|
338
|
+
category: "utility",
|
|
339
|
+
logo: `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 262"><path fill="#4285F4" d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"/><path fill="#34A853" d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"/><path fill="#FBBC05" d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z"/><path fill="#EB4335" d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"/></svg>`,
|
|
340
|
+
import: {
|
|
341
|
+
name: "useScriptGoogleSignIn",
|
|
342
|
+
from: await resolve("./runtime/registry/google-sign-in")
|
|
343
|
+
}
|
|
344
|
+
},
|
|
284
345
|
{
|
|
285
346
|
label: "Google Tag Manager",
|
|
286
347
|
category: "tracking",
|
|
348
|
+
proxy: "googleTagManager",
|
|
287
349
|
import: {
|
|
288
350
|
name: "useScriptGoogleTagManager",
|
|
289
351
|
from: await resolve("./runtime/registry/google-tag-manager")
|
|
@@ -310,6 +372,7 @@ async function registry(resolve) {
|
|
|
310
372
|
{
|
|
311
373
|
label: "Google Analytics",
|
|
312
374
|
category: "analytics",
|
|
375
|
+
proxy: "googleAnalytics",
|
|
313
376
|
import: {
|
|
314
377
|
name: "useScriptGoogleAnalytics",
|
|
315
378
|
from: await resolve("./runtime/registry/google-analytics")
|
|
@@ -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;
|
|
@@ -3,7 +3,7 @@ import { computed, onBeforeUnmount, onMounted, ref, watch, toRaw, provide, shall
|
|
|
3
3
|
import { withQuery } from "ufo";
|
|
4
4
|
import { defu } from "defu";
|
|
5
5
|
import { hash } from "ohash";
|
|
6
|
-
import { useHead } from "nuxt/app";
|
|
6
|
+
import { tryUseNuxtApp, useHead, useRuntimeConfig } from "nuxt/app";
|
|
7
7
|
import { scriptRuntimeConfig } from "#nuxt-scripts/utils";
|
|
8
8
|
import { useScriptTriggerElement } from "#nuxt-scripts/composables/useScriptTriggerElement";
|
|
9
9
|
import { useScriptGoogleMaps } from "#nuxt-scripts/registry/google-maps";
|
|
@@ -27,10 +27,28 @@ const props = defineProps({
|
|
|
27
27
|
placeholderOptions: { type: Object, required: false },
|
|
28
28
|
placeholderAttrs: { type: Object, required: false },
|
|
29
29
|
rootAttrs: { type: Object, required: false },
|
|
30
|
-
markers: { type: Array, required: false }
|
|
30
|
+
markers: { type: Array, required: false },
|
|
31
|
+
mapIds: { type: Object, required: false },
|
|
32
|
+
colorMode: { type: String, required: false }
|
|
31
33
|
});
|
|
32
34
|
const emits = defineEmits(["ready", "error"]);
|
|
33
35
|
const apiKey = props.apiKey || scriptRuntimeConfig("googleMaps")?.apiKey;
|
|
36
|
+
const runtimeConfig = useRuntimeConfig();
|
|
37
|
+
const proxyConfig = runtimeConfig.public["nuxt-scripts"]?.googleStaticMapsProxy;
|
|
38
|
+
const nuxtApp = tryUseNuxtApp();
|
|
39
|
+
const nuxtColorMode = nuxtApp?.$colorMode;
|
|
40
|
+
const currentColorMode = computed(() => {
|
|
41
|
+
if (props.colorMode)
|
|
42
|
+
return props.colorMode;
|
|
43
|
+
if (nuxtColorMode?.value)
|
|
44
|
+
return nuxtColorMode.value === "dark" ? "dark" : "light";
|
|
45
|
+
return "light";
|
|
46
|
+
});
|
|
47
|
+
const currentMapId = computed(() => {
|
|
48
|
+
if (!props.mapIds)
|
|
49
|
+
return props.mapOptions?.mapId;
|
|
50
|
+
return props.mapIds[currentColorMode.value] || props.mapIds.light || props.mapOptions?.mapId;
|
|
51
|
+
});
|
|
34
52
|
const mapsApi = ref();
|
|
35
53
|
if (import.meta.dev && !apiKey)
|
|
36
54
|
throw new Error("GoogleMaps requires an API key. Please provide `apiKey` on the <ScriptGoogleMaps> or globally via `runtimeConfig.public.scripts.googleMaps.apiKey`.");
|
|
@@ -48,10 +66,10 @@ const { load, status, onLoaded } = useScriptGoogleMaps({
|
|
|
48
66
|
v: props.version
|
|
49
67
|
});
|
|
50
68
|
const options = computed(() => {
|
|
51
|
-
|
|
69
|
+
const mapId = props.mapOptions?.styles ? void 0 : currentMapId.value || "map";
|
|
70
|
+
return defu({ center: centerOverride.value, mapId }, props.mapOptions, {
|
|
52
71
|
center: props.center,
|
|
53
|
-
zoom: 15
|
|
54
|
-
mapId: props.mapOptions?.styles ? void 0 : "map"
|
|
72
|
+
zoom: 15
|
|
55
73
|
});
|
|
56
74
|
});
|
|
57
75
|
const ready = ref(false);
|
|
@@ -146,8 +164,12 @@ function importLibrary(key) {
|
|
|
146
164
|
}
|
|
147
165
|
}, { immediate: true });
|
|
148
166
|
});
|
|
149
|
-
|
|
150
|
-
|
|
167
|
+
const cached = Promise.resolve(p).catch((err) => {
|
|
168
|
+
libraries.delete(key);
|
|
169
|
+
throw err;
|
|
170
|
+
});
|
|
171
|
+
libraries.set(key, cached);
|
|
172
|
+
return cached;
|
|
151
173
|
}
|
|
152
174
|
const googleMaps = {
|
|
153
175
|
googleMaps: mapsApi,
|
|
@@ -244,7 +266,7 @@ onMounted(() => {
|
|
|
244
266
|
ready.value = true;
|
|
245
267
|
});
|
|
246
268
|
});
|
|
247
|
-
if (import.meta.server) {
|
|
269
|
+
if (import.meta.server && !proxyConfig?.enabled) {
|
|
248
270
|
useHead({
|
|
249
271
|
link: [
|
|
250
272
|
{
|
|
@@ -280,10 +302,12 @@ const placeholder = computed(() => {
|
|
|
280
302
|
center
|
|
281
303
|
}, {
|
|
282
304
|
size: `${props.width}x${props.height}`,
|
|
283
|
-
key
|
|
305
|
+
// Only include API key if not using proxy (proxy injects it server-side)
|
|
306
|
+
key: proxyConfig?.enabled ? void 0 : apiKey,
|
|
284
307
|
scale: 2,
|
|
285
308
|
// we assume a high DPI to avoid hydration issues
|
|
286
309
|
style: props.mapOptions?.styles ? transformMapStyles(props.mapOptions.styles) : void 0,
|
|
310
|
+
map_id: currentMapId.value,
|
|
287
311
|
markers: [
|
|
288
312
|
...props.markers || [],
|
|
289
313
|
props.centerMarker && center
|
|
@@ -297,7 +321,8 @@ const placeholder = computed(() => {
|
|
|
297
321
|
return m;
|
|
298
322
|
}).join("|")
|
|
299
323
|
});
|
|
300
|
-
|
|
324
|
+
const baseUrl = proxyConfig?.enabled ? "/_scripts/google-static-maps-proxy" : "https://maps.googleapis.com/maps/api/staticmap";
|
|
325
|
+
return withQuery(baseUrl, placeholderOptions);
|
|
301
326
|
});
|
|
302
327
|
const placeholderAttrs = computed(() => {
|
|
303
328
|
return defu(props.placeholderAttrs, {
|
|
@@ -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>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/**
|
|
4
|
+
* The Instagram post URL to embed
|
|
5
|
+
* e.g., https://www.instagram.com/p/ABC123/
|
|
6
|
+
*/
|
|
7
|
+
postUrl: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to include captions in the embed
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
captions?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Custom API endpoint for fetching embed HTML
|
|
15
|
+
* @default '/api/_scripts/instagram-embed'
|
|
16
|
+
*/
|
|
17
|
+
apiEndpoint?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Root element attributes
|
|
20
|
+
*/
|
|
21
|
+
rootAttrs?: HTMLAttributes;
|
|
22
|
+
};
|
|
23
|
+
declare var __VLS_1: {}, __VLS_3: {
|
|
24
|
+
error: import("nuxt/app").NuxtError<unknown> | undefined;
|
|
25
|
+
}, __VLS_5: {
|
|
26
|
+
html: string;
|
|
27
|
+
shortcode: string | undefined;
|
|
28
|
+
postUrl: string;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_Slots = {} & {
|
|
31
|
+
loading?: (props: typeof __VLS_1) => any;
|
|
32
|
+
} & {
|
|
33
|
+
error?: (props: typeof __VLS_3) => any;
|
|
34
|
+
} & {
|
|
35
|
+
default?: (props: typeof __VLS_5) => any;
|
|
36
|
+
};
|
|
37
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
38
|
+
html: import("vue").Ref<string | undefined, string | undefined>;
|
|
39
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
|
|
40
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined, import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
41
|
+
shortcode: import("vue").ComputedRef<string | undefined>;
|
|
42
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
43
|
+
captions: boolean;
|
|
44
|
+
apiEndpoint: string;
|
|
45
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
46
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
47
|
+
declare const _default: typeof __VLS_export;
|
|
48
|
+
export default _default;
|
|
49
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
50
|
+
new (): {
|
|
51
|
+
$slots: S;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useAsyncData } from "nuxt/app";
|
|
4
|
+
import { extractInstagramShortcode } from "../registry/instagram-embed";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
postUrl: { type: String, required: true },
|
|
7
|
+
captions: { type: Boolean, required: false, default: true },
|
|
8
|
+
apiEndpoint: { type: String, required: false, default: "/api/_scripts/instagram-embed" },
|
|
9
|
+
rootAttrs: { type: Object, required: false }
|
|
10
|
+
});
|
|
11
|
+
const shortcode = computed(() => extractInstagramShortcode(props.postUrl));
|
|
12
|
+
const { data: html, status, error } = useAsyncData(
|
|
13
|
+
`instagram-embed-${props.postUrl}`,
|
|
14
|
+
() => $fetch(`${props.apiEndpoint}?url=${encodeURIComponent(props.postUrl)}&captions=${props.captions}`),
|
|
15
|
+
{ watch: [() => props.postUrl, () => props.captions] }
|
|
16
|
+
);
|
|
17
|
+
defineExpose({
|
|
18
|
+
html,
|
|
19
|
+
status,
|
|
20
|
+
error,
|
|
21
|
+
shortcode
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<div v-bind="rootAttrs">
|
|
27
|
+
<slot v-if="status === 'pending'" name="loading">
|
|
28
|
+
<div>Loading Instagram post...</div>
|
|
29
|
+
</slot>
|
|
30
|
+
<slot v-else-if="status === 'error'" name="error" :error="error">
|
|
31
|
+
<div>Failed to load Instagram post</div>
|
|
32
|
+
</slot>
|
|
33
|
+
<slot v-else-if="html" :html="html" :shortcode="shortcode" :post-url="postUrl">
|
|
34
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
35
|
+
<div v-html="html" />
|
|
36
|
+
</slot>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/**
|
|
4
|
+
* The Instagram post URL to embed
|
|
5
|
+
* e.g., https://www.instagram.com/p/ABC123/
|
|
6
|
+
*/
|
|
7
|
+
postUrl: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to include captions in the embed
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
captions?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Custom API endpoint for fetching embed HTML
|
|
15
|
+
* @default '/api/_scripts/instagram-embed'
|
|
16
|
+
*/
|
|
17
|
+
apiEndpoint?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Root element attributes
|
|
20
|
+
*/
|
|
21
|
+
rootAttrs?: HTMLAttributes;
|
|
22
|
+
};
|
|
23
|
+
declare var __VLS_1: {}, __VLS_3: {
|
|
24
|
+
error: import("nuxt/app").NuxtError<unknown> | undefined;
|
|
25
|
+
}, __VLS_5: {
|
|
26
|
+
html: string;
|
|
27
|
+
shortcode: string | undefined;
|
|
28
|
+
postUrl: string;
|
|
29
|
+
};
|
|
30
|
+
type __VLS_Slots = {} & {
|
|
31
|
+
loading?: (props: typeof __VLS_1) => any;
|
|
32
|
+
} & {
|
|
33
|
+
error?: (props: typeof __VLS_3) => any;
|
|
34
|
+
} & {
|
|
35
|
+
default?: (props: typeof __VLS_5) => any;
|
|
36
|
+
};
|
|
37
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
38
|
+
html: import("vue").Ref<string | undefined, string | undefined>;
|
|
39
|
+
status: import("vue").Ref<import("nuxt/app").AsyncDataRequestStatus, import("nuxt/app").AsyncDataRequestStatus>;
|
|
40
|
+
error: import("vue").Ref<import("nuxt/app").NuxtError<unknown> | undefined, import("nuxt/app").NuxtError<unknown> | undefined>;
|
|
41
|
+
shortcode: import("vue").ComputedRef<string | undefined>;
|
|
42
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
43
|
+
captions: boolean;
|
|
44
|
+
apiEndpoint: string;
|
|
45
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
46
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
47
|
+
declare const _default: typeof __VLS_export;
|
|
48
|
+
export default _default;
|
|
49
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
50
|
+
new (): {
|
|
51
|
+
$slots: S;
|
|
52
|
+
};
|
|
53
|
+
};
|