@dargmuesli/nuxt-cookie-control 6.4.6 → 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 CHANGED
@@ -249,8 +249,14 @@ Every property that includes a `{ en: ... }` value is a translatable property th
249
249
 
250
250
  ```html
251
251
  <CookieControl>
252
- <template #cookie="{config}">
253
- <span v-for="c in config" :key="c.id" v-text="c.cookies" />
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>
254
260
  </template>
255
261
  </CookieControl>
256
262
  ```
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "6.4.6",
3
+ "version": "6.5.3",
4
4
  "configKey": "cookieControl",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0"
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.4.6";
6
+ const version = "6.5.3";
7
7
 
8
8
  const en = {
9
9
  accept: "Accept",
@@ -77,70 +77,76 @@
77
77
  v-for="cookie in moduleOptions.cookies[cookieType]"
78
78
  :key="cookie.id"
79
79
  >
80
- <div class="cookieControl__ModalInputWrapper">
81
- <input
82
- v-if="
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
- moduleOptions.isCookieIdVisible &&
118
- cookie.targetCookieIds
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
- <br />
122
- {{
123
- 'IDs: ' +
124
- cookie.targetCookieIds
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-for="entry in Object.entries(
134
- cookie.links || {},
135
- )"
136
- :key="entry[0]"
119
+ v-if="
120
+ moduleOptions.isCookieIdVisible &&
121
+ cookie.targetCookieIds
122
+ "
137
123
  >
138
124
  <br />
139
- <a :href="entry[0]">{{ entry[1] || entry[0] }}</a>
125
+ {{
126
+ 'IDs: ' +
127
+ cookie.targetCookieIds
128
+ .map((id: string) => `"${id}"`)
129
+ .join(', ')
130
+ }}
140
131
  </span>
141
- </template>
142
- </label>
143
- </div>
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>
@@ -2,6 +2,6 @@ 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) => 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;
@@ -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) => document.cookie = serialize(name, "", { expires: /* @__PURE__ */ new Date(0) });
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "6.4.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": [
@@ -37,7 +37,7 @@
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",
@@ -50,13 +50,14 @@
50
50
  "string-replace-loader": "^3.1.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@commitlint/cli": "17.8.0",
54
- "@commitlint/config-conventional": "17.8.0",
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.51.0",
60
+ "eslint": "8.52.0",
60
61
  "eslint-config-prettier": "9.0.0",
61
62
  "eslint-plugin-prettier": "5.0.1",
62
63
  "husky": "8.0.3",
@@ -64,7 +65,7 @@
64
65
  "nuxt": "3.8.0",
65
66
  "prettier": "3.0.3",
66
67
  "typescript": "5.2.2",
67
- "vue": "3.3.4",
68
+ "vue": "3.3.6",
68
69
  "vue-tsc": "1.8.19",
69
70
  "webpack": "5.89.0"
70
71
  },