@dargmuesli/nuxt-cookie-control 6.4.5 → 6.5.3
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 +17 -7
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/CookieControl.vue +69 -58
- package/dist/runtime/components/CookieIframe.vue +1 -1
- package/dist/runtime/composables.d.ts +1 -1
- package/dist/runtime/constants.d.ts +1 -1
- package/dist/runtime/locale/ar.d.ts +1 -1
- package/dist/runtime/locale/az.d.ts +1 -1
- package/dist/runtime/locale/bg.d.ts +1 -1
- package/dist/runtime/locale/ca.d.ts +1 -1
- package/dist/runtime/locale/cs.d.ts +1 -1
- package/dist/runtime/locale/da.d.ts +1 -1
- package/dist/runtime/locale/de.d.ts +1 -1
- package/dist/runtime/locale/en.d.ts +1 -1
- package/dist/runtime/locale/es.d.ts +1 -1
- package/dist/runtime/locale/fi.d.ts +1 -1
- package/dist/runtime/locale/fr.d.ts +1 -1
- package/dist/runtime/locale/hr.d.ts +1 -1
- package/dist/runtime/locale/hu.d.ts +1 -1
- package/dist/runtime/locale/it.d.ts +1 -1
- package/dist/runtime/locale/ja.d.ts +1 -1
- package/dist/runtime/locale/ko.d.ts +1 -1
- package/dist/runtime/locale/lt.d.ts +1 -1
- package/dist/runtime/locale/nl.d.ts +1 -1
- package/dist/runtime/locale/no.d.ts +1 -1
- package/dist/runtime/locale/oc.d.ts +1 -1
- package/dist/runtime/locale/pl.d.ts +1 -1
- package/dist/runtime/locale/pt.d.ts +1 -1
- package/dist/runtime/locale/ro.d.ts +1 -1
- package/dist/runtime/locale/rs.d.ts +1 -1
- package/dist/runtime/locale/ru.d.ts +1 -1
- package/dist/runtime/locale/sk.d.ts +1 -1
- package/dist/runtime/locale/sv.d.ts +1 -1
- package/dist/runtime/locale/tr.d.ts +1 -1
- package/dist/runtime/locale/uk.d.ts +1 -1
- package/dist/runtime/methods.d.ts +2 -2
- package/dist/runtime/methods.mjs +2 -2
- package/dist/runtime/plugin.d.ts +2 -2
- package/dist/runtime/types.d.ts +2 -2
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -237,18 +237,28 @@ Every property that includes a `{ en: ... }` value is a translatable property th
|
|
|
237
237
|
#### Modal
|
|
238
238
|
|
|
239
239
|
```html
|
|
240
|
-
<
|
|
241
|
-
<
|
|
242
|
-
|
|
243
|
-
</
|
|
240
|
+
<CookieControl>
|
|
241
|
+
<template #modal>
|
|
242
|
+
<h3>Modal title</h3>
|
|
243
|
+
<p>Modal description</p>
|
|
244
|
+
</template>
|
|
245
|
+
</CookieControl>
|
|
244
246
|
```
|
|
245
247
|
|
|
246
248
|
#### Cookie
|
|
247
249
|
|
|
248
250
|
```html
|
|
249
|
-
<
|
|
250
|
-
<
|
|
251
|
-
|
|
251
|
+
<CookieControl>
|
|
252
|
+
<template #cookie="{ cookie }">
|
|
253
|
+
<h3 v-text="cookie.name" />
|
|
254
|
+
<span v-html="cookie.description" />
|
|
255
|
+
|
|
256
|
+
<div v-if="cookie.targetCookieIds">
|
|
257
|
+
<b>Cookie ids: </b>
|
|
258
|
+
<span v-text="cookie?.targetCookieIds?.join(', ')" />
|
|
259
|
+
</div>
|
|
260
|
+
</template>
|
|
261
|
+
</CookieControl>
|
|
252
262
|
```
|
|
253
263
|
|
|
254
264
|
### Props
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
3
3
|
import { createResolver, defineNuxtModule, addPlugin, addImports, addTemplate, extendWebpackConfig, extendViteConfig, resolvePath } from '@nuxt/kit';
|
|
4
4
|
|
|
5
5
|
const name = "@dargmuesli/nuxt-cookie-control";
|
|
6
|
-
const version = "6.
|
|
6
|
+
const version = "6.5.3";
|
|
7
7
|
|
|
8
8
|
const en = {
|
|
9
9
|
accept: "Accept",
|
|
@@ -152,7 +152,7 @@ const module = defineNuxtModule({
|
|
|
152
152
|
addTemplate({
|
|
153
153
|
filename: "cookie-control-options.ts",
|
|
154
154
|
write: true,
|
|
155
|
-
getContents: () => `import { ModuleOptions } from '#cookie-control/types'
|
|
155
|
+
getContents: () => `import type { ModuleOptions } from '#cookie-control/types'
|
|
156
156
|
|
|
157
157
|
export default ${JSON.stringify(
|
|
158
158
|
moduleOptions,
|
|
@@ -77,70 +77,76 @@
|
|
|
77
77
|
v-for="cookie in moduleOptions.cookies[cookieType]"
|
|
78
78
|
:key="cookie.id"
|
|
79
79
|
>
|
|
80
|
-
<
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
cookieType === CookieType.NECESSARY &&
|
|
84
|
-
cookie.name !== 'functional'
|
|
85
|
-
"
|
|
86
|
-
:id="resolveTranslatable(cookie.name, props.locale)"
|
|
87
|
-
type="checkbox"
|
|
88
|
-
disabled
|
|
89
|
-
checked
|
|
90
|
-
/>
|
|
91
|
-
<input
|
|
92
|
-
v-else
|
|
93
|
-
:id="resolveTranslatable(cookie.name, props.locale)"
|
|
94
|
-
type="checkbox"
|
|
95
|
-
:checked="
|
|
96
|
-
getCookieIds(localCookiesEnabled).includes(
|
|
97
|
-
getCookieId(cookie),
|
|
98
|
-
)
|
|
99
|
-
"
|
|
100
|
-
@change="toogleCookie(cookie)"
|
|
101
|
-
/>
|
|
102
|
-
<button @click="toggleButton($event)">
|
|
103
|
-
{{ getName(cookie.name) }}
|
|
104
|
-
</button>
|
|
105
|
-
<label
|
|
106
|
-
class="cookieControl__ModalCookieName"
|
|
107
|
-
:for="resolveTranslatable(cookie.name, props.locale)"
|
|
108
|
-
tabindex="0"
|
|
109
|
-
@keydown="toggleLabel($event)"
|
|
110
|
-
>
|
|
111
|
-
{{ getName(cookie.name) }}
|
|
112
|
-
<span v-if="cookie.description">
|
|
113
|
-
{{ getDescription(cookie.description) }}
|
|
114
|
-
</span>
|
|
115
|
-
<span
|
|
80
|
+
<slot name="cookie" v-bind="{ cookie }">
|
|
81
|
+
<div class="cookieControl__ModalInputWrapper">
|
|
82
|
+
<input
|
|
116
83
|
v-if="
|
|
117
|
-
|
|
118
|
-
cookie.
|
|
84
|
+
cookieType === CookieType.NECESSARY &&
|
|
85
|
+
cookie.name !== 'functional'
|
|
119
86
|
"
|
|
87
|
+
:id="resolveTranslatable(cookie.name, props.locale)"
|
|
88
|
+
type="checkbox"
|
|
89
|
+
disabled
|
|
90
|
+
checked
|
|
91
|
+
/>
|
|
92
|
+
<input
|
|
93
|
+
v-else
|
|
94
|
+
:id="resolveTranslatable(cookie.name, props.locale)"
|
|
95
|
+
type="checkbox"
|
|
96
|
+
:checked="
|
|
97
|
+
getCookieIds(localCookiesEnabled).includes(
|
|
98
|
+
getCookieId(cookie),
|
|
99
|
+
)
|
|
100
|
+
"
|
|
101
|
+
@change="toogleCookie(cookie)"
|
|
102
|
+
/>
|
|
103
|
+
<button @click="toggleButton($event)">
|
|
104
|
+
{{ getName(cookie.name) }}
|
|
105
|
+
</button>
|
|
106
|
+
<label
|
|
107
|
+
class="cookieControl__ModalCookieName"
|
|
108
|
+
:for="
|
|
109
|
+
resolveTranslatable(cookie.name, props.locale)
|
|
110
|
+
"
|
|
111
|
+
tabindex="0"
|
|
112
|
+
@keydown="toggleLabel($event)"
|
|
120
113
|
>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
.map((id: string) => `"${id}"`)
|
|
126
|
-
.join(', ')
|
|
127
|
-
}}
|
|
128
|
-
</span>
|
|
129
|
-
<template
|
|
130
|
-
v-if="Object.entries(cookie.links || {}).length"
|
|
131
|
-
>
|
|
114
|
+
{{ getName(cookie.name) }}
|
|
115
|
+
<span v-if="cookie.description">
|
|
116
|
+
{{ getDescription(cookie.description) }}
|
|
117
|
+
</span>
|
|
132
118
|
<span
|
|
133
|
-
v-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
119
|
+
v-if="
|
|
120
|
+
moduleOptions.isCookieIdVisible &&
|
|
121
|
+
cookie.targetCookieIds
|
|
122
|
+
"
|
|
137
123
|
>
|
|
138
124
|
<br />
|
|
139
|
-
|
|
125
|
+
{{
|
|
126
|
+
'IDs: ' +
|
|
127
|
+
cookie.targetCookieIds
|
|
128
|
+
.map((id: string) => `"${id}"`)
|
|
129
|
+
.join(', ')
|
|
130
|
+
}}
|
|
140
131
|
</span>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
132
|
+
<template
|
|
133
|
+
v-if="Object.entries(cookie.links || {}).length"
|
|
134
|
+
>
|
|
135
|
+
<span
|
|
136
|
+
v-for="entry in Object.entries(
|
|
137
|
+
cookie.links || {},
|
|
138
|
+
)"
|
|
139
|
+
:key="entry[0]"
|
|
140
|
+
>
|
|
141
|
+
<br />
|
|
142
|
+
<a :href="entry[0]">{{
|
|
143
|
+
entry[1] || entry[0]
|
|
144
|
+
}}</a>
|
|
145
|
+
</span>
|
|
146
|
+
</template>
|
|
147
|
+
</label>
|
|
148
|
+
</div>
|
|
149
|
+
</slot>
|
|
144
150
|
</li>
|
|
145
151
|
</ul>
|
|
146
152
|
</template>
|
|
@@ -188,7 +194,12 @@ import { ref, computed, onBeforeMount, watch } from 'vue'
|
|
|
188
194
|
|
|
189
195
|
import { useNuxtApp } from '#app'
|
|
190
196
|
|
|
191
|
-
import {
|
|
197
|
+
import {
|
|
198
|
+
type Cookie,
|
|
199
|
+
CookieType,
|
|
200
|
+
type Locale,
|
|
201
|
+
type Translatable,
|
|
202
|
+
} from '../types'
|
|
192
203
|
import {
|
|
193
204
|
getAllCookieIdsString,
|
|
194
205
|
getCookieId,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { State } from './types';
|
|
1
|
+
import type { State } from './types';
|
|
2
2
|
export declare const useCookieControl: () => State;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Locale } from './types';
|
|
1
|
+
import type { Locale } from './types';
|
|
2
2
|
export declare const LOCALE_DEFAULT: Locale;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Cookie, ModuleOptions, Translatable } from './types';
|
|
1
|
+
import type { Cookie, ModuleOptions, Translatable } from './types';
|
|
2
2
|
export declare const getAllCookieIdsString: (moduleOptions: ModuleOptions) => string;
|
|
3
3
|
export declare const getCookieId: (cookie: Cookie) => string;
|
|
4
4
|
export declare const getCookieIds: (cookies: Cookie[]) => string[];
|
|
5
|
-
export declare const removeCookie: (name: string) =>
|
|
5
|
+
export declare const removeCookie: (name: string) => any;
|
|
6
6
|
export declare const resolveTranslatable: (translatable: Translatable, locale?: import("./types").Locale) => string;
|
|
7
7
|
export declare const useResolveTranslatable: (locale?: import("./types").Locale) => (translatable: Translatable) => string;
|
package/dist/runtime/methods.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import slugify from "@sindresorhus/slugify";
|
|
2
|
-
import { serialize } from "cookie-es";
|
|
3
2
|
import { LOCALE_DEFAULT } from "./constants.mjs";
|
|
3
|
+
import { useCookie } from "#imports";
|
|
4
4
|
export const getAllCookieIdsString = (moduleOptions) => getCookieIds([
|
|
5
5
|
...moduleOptions.cookies.necessary,
|
|
6
6
|
...moduleOptions.cookies.optional
|
|
7
7
|
]).join("");
|
|
8
8
|
export const getCookieId = (cookie) => cookie.id || slugify(resolveTranslatable(cookie.name));
|
|
9
9
|
export const getCookieIds = (cookies) => cookies.map((cookie) => getCookieId(cookie));
|
|
10
|
-
export const removeCookie = (name) =>
|
|
10
|
+
export const removeCookie = (name) => useCookie(name, { expires: /* @__PURE__ */ new Date(0) });
|
|
11
11
|
export const resolveTranslatable = (translatable, locale = LOCALE_DEFAULT) => {
|
|
12
12
|
if (typeof translatable === "string")
|
|
13
13
|
return translatable;
|
package/dist/runtime/plugin.d.ts
CHANGED
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Ref } from 'vue';
|
|
2
|
-
import { CookieOptions } from 'nuxt/app';
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { CookieOptions } from 'nuxt/app';
|
|
3
3
|
export type Locale = 'ar' | 'az' | 'bg' | 'ca' | 'cs' | 'da' | 'de' | 'en' | 'es' | 'fi' | 'fr' | 'hr' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'nl' | 'no' | 'oc' | 'pt' | 'pl' | 'ro' | 'rs' | 'ru' | 'sk' | 'sv' | 'tr' | 'uk';
|
|
4
4
|
export type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
|
|
5
5
|
export type Translatable = string | PartialRecord<Locale, string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dargmuesli/nuxt-cookie-control",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.3",
|
|
4
4
|
"description": "Nuxt Cookie Control Module",
|
|
5
5
|
"author": "Dario Ferderber <dario.ferderber@broj42.com>",
|
|
6
6
|
"maintainers": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=16"
|
|
23
23
|
},
|
|
24
|
-
"packageManager": "pnpm@8.9.
|
|
24
|
+
"packageManager": "pnpm@8.9.2",
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
27
|
"import": "./dist/module.mjs",
|
|
@@ -37,36 +37,37 @@
|
|
|
37
37
|
"src/locale"
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "nuxt-module-build",
|
|
40
|
+
"build": "nuxt-module-build build",
|
|
41
41
|
"lint": "eslint --ext .js,.ts,.vue . && nuxt typecheck",
|
|
42
42
|
"lint:fix": "eslint --ext .js,.ts,.vue --fix . && nuxt typecheck --fix",
|
|
43
43
|
"prepack": "pnpm build",
|
|
44
44
|
"prepare": "husky install"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@nuxt/kit": "^3.
|
|
47
|
+
"@nuxt/kit": "^3.8.0",
|
|
48
48
|
"@sindresorhus/slugify": "^2.2.1",
|
|
49
49
|
"css-vars-ponyfill": "^2.4.8",
|
|
50
50
|
"string-replace-loader": "^3.1.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@commitlint/cli": "
|
|
54
|
-
"@commitlint/config-conventional": "
|
|
53
|
+
"@commitlint/cli": "18.0.0",
|
|
54
|
+
"@commitlint/config-conventional": "18.0.0",
|
|
55
55
|
"@dargmuesli/nuxt-cookie-control": "link:",
|
|
56
56
|
"@nuxt/module-builder": "0.5.2",
|
|
57
|
+
"@nuxt/schema": "3.8.0",
|
|
57
58
|
"@nuxtjs/eslint-config-typescript": "12.1.0",
|
|
58
59
|
"conventional-changelog-conventionalcommits": "7.0.2",
|
|
59
|
-
"eslint": "8.
|
|
60
|
+
"eslint": "8.52.0",
|
|
60
61
|
"eslint-config-prettier": "9.0.0",
|
|
61
|
-
"eslint-plugin-prettier": "5.0.
|
|
62
|
+
"eslint-plugin-prettier": "5.0.1",
|
|
62
63
|
"husky": "8.0.3",
|
|
63
|
-
"lint-staged": "
|
|
64
|
-
"nuxt": "3.
|
|
64
|
+
"lint-staged": "15.0.2",
|
|
65
|
+
"nuxt": "3.8.0",
|
|
65
66
|
"prettier": "3.0.3",
|
|
66
67
|
"typescript": "5.2.2",
|
|
67
|
-
"vue": "3.3.
|
|
68
|
-
"vue-tsc": "1.8.
|
|
69
|
-
"webpack": "5.
|
|
68
|
+
"vue": "3.3.6",
|
|
69
|
+
"vue-tsc": "1.8.19",
|
|
70
|
+
"webpack": "5.89.0"
|
|
70
71
|
},
|
|
71
72
|
"publishConfig": {
|
|
72
73
|
"access": "public"
|