@dargmuesli/nuxt-cookie-control 9.0.0-beta.1 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -1
- package/dist/module.d.mts +2 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +7 -25
- package/dist/runtime/components/ClientOnlyPrerender.vue +12 -0
- package/dist/runtime/components/ClientOnlyPrerender.vue.d.ts +19 -0
- package/dist/runtime/components/CookieControl.vue +294 -357
- package/dist/runtime/components/CookieControl.vue.d.ts +223 -0
- package/dist/runtime/components/CookieIframe.vue +31 -32
- package/dist/runtime/components/CookieIframe.vue.d.ts +23 -0
- package/dist/runtime/locale/index.d.ts +1 -1
- package/dist/runtime/locale/index.js +2 -2
- package/dist/runtime/types.d.ts +1 -1
- package/dist/types.d.mts +2 -2
- package/package.json +38 -34
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -67
- package/dist/types.d.ts +0 -7
- /package/dist/runtime/locale/{zh.d.ts → zh-CN.d.ts} +0 -0
- /package/dist/runtime/locale/{zh.js → zh-CN.js} +0 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
✅ Translated for: ar, az, be, bg, ca, cs, da, de, en, es, fi, fr, hr, hu, id, it, ja, km, ko, lt, nl, no, oc, pt, pl, ro, rs, ru, sk, sl, sv, tr, uk and zh
|
|
9
|
+
✅ Translated for: ar, az, be, bg, ca, cs, da, de, en, es, fi, fr, hr, hu, id, it, ja, km, ko, lt, nl, no, oc, pt, pl, ro, rs, ru, sk, sl, sv, tr, uk and zh-CN
|
|
10
10
|
|
|
11
11
|
✅ Vue 3 support
|
|
12
12
|
|
|
@@ -260,6 +260,26 @@ Every property that includes a `{ en: ... }` value is a translatable property th
|
|
|
260
260
|
</CookieControl>
|
|
261
261
|
```
|
|
262
262
|
|
|
263
|
+
#### Iframe
|
|
264
|
+
|
|
265
|
+
```html
|
|
266
|
+
<CookieIframe>
|
|
267
|
+
<template #iframe>
|
|
268
|
+
Content to display if iframes are blocked.
|
|
269
|
+
</template>
|
|
270
|
+
</CookieIframe>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
#### Control button
|
|
274
|
+
|
|
275
|
+
```html
|
|
276
|
+
<CookieIframe>
|
|
277
|
+
<template #controlButton>
|
|
278
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path fill="currentColor" d="M247.2 17c-22.1-3.1-44.6.9-64.4 11.4l-74 39.5c-19.7 10.5-35.6 27-45.4 47.1l-36.7 75.6c-9.8 20.1-13 42.9-9.1 64.9l14.5 82.8c3.9 22.1 14.6 42.3 30.7 57.9l60.3 58.4c16.1 15.6 36.6 25.6 58.7 28.7l83 11.7c22.1 3.1 44.6-.9 64.4-11.4l74-39.5c19.7-10.5 35.6-27 45.4-47.2l36.7-75.5c9.8-20.1 13-42.9 9.1-64.9l-14.6-82.8c-3.9-22.1-14.6-42.3-30.7-57.9l-60.2-58.3c-16.1-15.6-36.6-25.6-58.7-28.7zM208 144a32 32 0 1 1 0 64a32 32 0 1 1 0-64m-64 192a32 32 0 1 1 64 0a32 32 0 1 1-64 0m224-64a32 32 0 1 1 0 64a32 32 0 1 1 0-64"/></svg>
|
|
279
|
+
</template>
|
|
280
|
+
</CookieIframe>
|
|
281
|
+
```
|
|
282
|
+
|
|
263
283
|
### Props
|
|
264
284
|
|
|
265
285
|
- locale: `['en']`
|
package/dist/module.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { CookieOptions } from 'nuxt/app';
|
|
3
3
|
|
|
4
|
-
type Locale = 'ar' | 'az' | 'be' | 'bg' | 'ca' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'km' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ro' | 'rs' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk' | 'zh';
|
|
4
|
+
type Locale = 'ar' | 'az' | 'be' | 'bg' | 'ca' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'id' | 'it' | 'ja' | 'km' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ro' | 'rs' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk' | 'zh-CN';
|
|
5
5
|
type PartialRecord<K extends string | number | symbol, T> = Partial<Record<K, T>>;
|
|
6
6
|
type Translatable = string | PartialRecord<Locale, string>;
|
|
7
7
|
interface Cookie {
|
|
@@ -31,6 +31,7 @@ interface LocaleStrings {
|
|
|
31
31
|
settingsUnsaved: string;
|
|
32
32
|
}
|
|
33
33
|
interface ModuleOptions {
|
|
34
|
+
_isPrerendered: boolean | undefined;
|
|
34
35
|
barPosition: 'top-left' | 'top-right' | 'top-full' | 'bottom-left' | 'bottom-right' | 'bottom-full';
|
|
35
36
|
closeModalOnClickOutside: boolean;
|
|
36
37
|
colors: false | Record<string, unknown>;
|
package/dist/module.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dargmuesli/nuxt-cookie-control",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"configKey": "cookieControl",
|
|
5
5
|
"compatibility": {
|
|
6
6
|
"nuxt": ">=3.0.0"
|
|
7
7
|
},
|
|
8
8
|
"builder": {
|
|
9
|
-
"@nuxt/module-builder": "0.
|
|
9
|
+
"@nuxt/module-builder": "1.0.1",
|
|
10
10
|
"unbuild": "unknown"
|
|
11
11
|
}
|
|
12
12
|
}
|
package/dist/module.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { resolve } from 'node:path';
|
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
import { createResolver, defineNuxtModule, addPlugin, addImports, addTypeTemplate, updateTemplates, extendWebpackConfig, extendViteConfig, resolvePath } from '@nuxt/kit';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
|
+
import en from '../dist/runtime/locale/en.js';
|
|
5
6
|
|
|
6
7
|
const CONFIG_KEY = "cookieControl";
|
|
7
8
|
|
|
@@ -15,8 +16,7 @@ const execSrcReplacements = (src, replacements) => {
|
|
|
15
16
|
throw new TypeError(
|
|
16
17
|
"[vite-plugin-replace]: The replacement option 'to' is not of type 'string' or 'Function'"
|
|
17
18
|
);
|
|
18
|
-
} else
|
|
19
|
-
src = src.replace(replacement.from, replacement.to);
|
|
19
|
+
} else src = src.replace(replacement.from, replacement.to);
|
|
20
20
|
}
|
|
21
21
|
return src;
|
|
22
22
|
};
|
|
@@ -47,6 +47,7 @@ const replaceCodePlugin = (config) => {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
const DEFAULTS = {
|
|
50
|
+
_isPrerendered: void 0,
|
|
50
51
|
barPosition: "bottom-full",
|
|
51
52
|
closeModalOnClickOutside: false,
|
|
52
53
|
colors: {
|
|
@@ -99,30 +100,11 @@ const DEFAULTS = {
|
|
|
99
100
|
isIframeBlocked: false,
|
|
100
101
|
isModalForced: false,
|
|
101
102
|
locales: ["en"],
|
|
102
|
-
|
|
103
|
-
localeTexts: {
|
|
104
|
-
en: {
|
|
105
|
-
accept: "Accept",
|
|
106
|
-
acceptAll: "Accept all",
|
|
107
|
-
bannerDescription: "We use our own cookies and third-party cookies so that we can display this website correctly and better understand how this website is used, with a view to improving the services we offer. A decision on cookie usage permissions can be changed anytime using the cookie button that will appear after a selection has been made on this banner.",
|
|
108
|
-
bannerTitle: "Cookies",
|
|
109
|
-
close: "Close",
|
|
110
|
-
cookiesFunctional: "Functional cookies",
|
|
111
|
-
cookiesNecessary: "Necessary cookies",
|
|
112
|
-
cookiesOptional: "Optional cookies",
|
|
113
|
-
decline: "Decline",
|
|
114
|
-
declineAll: "Decline all",
|
|
115
|
-
here: "here",
|
|
116
|
-
iframeBlocked: "To see this, please enable functional cookies",
|
|
117
|
-
manageCookies: "Learn more and customize",
|
|
118
|
-
save: "Save",
|
|
119
|
-
settingsUnsaved: "You have unsaved settings"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
103
|
+
localeTexts: { en }
|
|
122
104
|
};
|
|
123
105
|
|
|
124
106
|
const name = "@dargmuesli/nuxt-cookie-control";
|
|
125
|
-
const version = "9.0.
|
|
107
|
+
const version = "9.0.1";
|
|
126
108
|
|
|
127
109
|
const resolver = createResolver(import.meta.url);
|
|
128
110
|
const runtimeDir = resolver.resolve("./runtime");
|
|
@@ -143,6 +125,7 @@ const module = defineNuxtModule({
|
|
|
143
125
|
}
|
|
144
126
|
},
|
|
145
127
|
async setup(moduleOptions, nuxt) {
|
|
128
|
+
moduleOptions._isPrerendered = nuxt.options._generate;
|
|
146
129
|
nuxt.options.alias["#cookie-control/set-vars"] = moduleOptions.isCssPonyfillEnabled ? resolver.resolve(runtimeDir, "set-vars/ponyfill") : resolver.resolve(runtimeDir, "set-vars/native");
|
|
147
130
|
nuxt.options.alias["#cookie-control"] = runtimeDir;
|
|
148
131
|
nuxt.options.build.transpile.push("#cookie-control");
|
|
@@ -232,8 +215,7 @@ const loadLocales = async (moduleOptions) => {
|
|
|
232
215
|
moduleOptions.locales = [];
|
|
233
216
|
for (const locale of locales) {
|
|
234
217
|
const text = await import(pathToFileURL(await resolvePath(resolve(runtimeDir, "locale", locale))).href).then((r) => r.default || r);
|
|
235
|
-
if (!text)
|
|
236
|
-
throw new Error(`Could not import text for locale ${locale}`);
|
|
218
|
+
if (!text) throw new Error(`Could not import text for locale ${locale}`);
|
|
237
219
|
moduleOptions.locales.push(locale);
|
|
238
220
|
moduleOptions.localeTexts[locale] = {
|
|
239
221
|
...text,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<slot v-if="!isPrerendered" />
|
|
3
|
+
<ClientOnly v-else>
|
|
4
|
+
<slot />
|
|
5
|
+
</ClientOnly>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup>
|
|
9
|
+
import { useRuntimeConfig } from "#app";
|
|
10
|
+
const runtimeConfig = useRuntimeConfig();
|
|
11
|
+
const isPrerendered = runtimeConfig.public.cookieControl._isPrerendered;
|
|
12
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const isPrerendered: any;
|
|
2
|
+
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
3
|
+
declare var __VLS_1: {}, __VLS_8: {};
|
|
4
|
+
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
5
|
+
default?: (props: typeof __VLS_1) => any;
|
|
6
|
+
} & {
|
|
7
|
+
default?: (props: typeof __VLS_8) => any;
|
|
8
|
+
}>;
|
|
9
|
+
declare const __VLS_self: import("vue").DefineComponent<{}, {
|
|
10
|
+
isPrerendered: typeof isPrerendered;
|
|
11
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
13
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|