@dargmuesli/nuxt-cookie-control 8.1.2 → 8.2.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.
Files changed (49) hide show
  1. package/dist/module.d.mts +2 -2
  2. package/dist/module.d.ts +2 -2
  3. package/dist/module.json +5 -1
  4. package/dist/module.mjs +92 -72
  5. package/dist/runtime/components/CookieControl.vue +1 -1
  6. package/dist/runtime/components/CookieIframe.vue +1 -2
  7. package/dist/runtime/composables.d.ts +1 -1
  8. package/dist/runtime/constants.d.ts +2 -1
  9. package/dist/runtime/constants.mjs +1 -0
  10. package/dist/runtime/locale/ar.d.ts +1 -1
  11. package/dist/runtime/locale/az.d.ts +1 -1
  12. package/dist/runtime/locale/be.d.ts +1 -1
  13. package/dist/runtime/locale/bg.d.ts +1 -1
  14. package/dist/runtime/locale/ca.d.ts +1 -1
  15. package/dist/runtime/locale/cs.d.ts +1 -1
  16. package/dist/runtime/locale/da.d.ts +1 -1
  17. package/dist/runtime/locale/de.d.ts +1 -1
  18. package/dist/runtime/locale/en.d.ts +1 -1
  19. package/dist/runtime/locale/es.d.ts +1 -1
  20. package/dist/runtime/locale/fi.d.ts +1 -1
  21. package/dist/runtime/locale/fr.d.ts +1 -1
  22. package/dist/runtime/locale/hr.d.ts +1 -1
  23. package/dist/runtime/locale/hu.d.ts +1 -1
  24. package/dist/runtime/locale/id.d.ts +1 -1
  25. package/dist/runtime/locale/it.d.ts +1 -1
  26. package/dist/runtime/locale/ja.d.ts +1 -1
  27. package/dist/runtime/locale/km.d.ts +1 -1
  28. package/dist/runtime/locale/ko.d.ts +1 -1
  29. package/dist/runtime/locale/lt.d.ts +1 -1
  30. package/dist/runtime/locale/nl.d.ts +1 -1
  31. package/dist/runtime/locale/no.d.ts +1 -1
  32. package/dist/runtime/locale/oc.d.ts +1 -1
  33. package/dist/runtime/locale/pl.d.ts +1 -1
  34. package/dist/runtime/locale/pt.d.ts +1 -1
  35. package/dist/runtime/locale/ro.d.ts +1 -1
  36. package/dist/runtime/locale/rs.d.ts +1 -1
  37. package/dist/runtime/locale/ru.d.ts +1 -1
  38. package/dist/runtime/locale/sk.d.ts +1 -1
  39. package/dist/runtime/locale/sv.d.ts +1 -1
  40. package/dist/runtime/locale/tr.d.ts +1 -1
  41. package/dist/runtime/locale/uk.d.ts +1 -1
  42. package/dist/runtime/locale/zh-CN.d.ts +1 -1
  43. package/dist/runtime/methods.d.ts +3 -3
  44. package/dist/runtime/methods.mjs +1 -1
  45. package/dist/runtime/plugin.d.ts +5 -4
  46. package/dist/runtime/plugin.mjs +4 -5
  47. package/dist/runtime/types.d.ts +2 -3
  48. package/dist/runtime/types.mjs +0 -56
  49. package/package.json +22 -12
package/dist/module.d.mts CHANGED
@@ -2,7 +2,7 @@ import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { CookieOptions } from 'nuxt/app';
3
3
 
4
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
- type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
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 {
8
8
  description?: Translatable;
@@ -33,7 +33,7 @@ interface LocaleStrings {
33
33
  interface ModuleOptions {
34
34
  barPosition: 'top-left' | 'top-right' | 'top-full' | 'bottom-left' | 'bottom-right' | 'bottom-full';
35
35
  closeModalOnClickOutside: boolean;
36
- colors: false | Record<string, any>;
36
+ colors: false | Record<string, unknown>;
37
37
  cookieExpiryOffsetMs: number;
38
38
  cookieNameCookiesEnabledIds: string;
39
39
  cookieNameIsConsentGiven: string;
package/dist/module.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { CookieOptions } from 'nuxt/app';
3
3
 
4
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
- type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
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 {
8
8
  description?: Translatable;
@@ -33,7 +33,7 @@ interface LocaleStrings {
33
33
  interface ModuleOptions {
34
34
  barPosition: 'top-left' | 'top-right' | 'top-full' | 'bottom-left' | 'bottom-right' | 'bottom-full';
35
35
  closeModalOnClickOutside: boolean;
36
- colors: false | Record<string, any>;
36
+ colors: false | Record<string, unknown>;
37
37
  cookieExpiryOffsetMs: number;
38
38
  cookieNameCookiesEnabledIds: string;
39
39
  cookieNameIsConsentGiven: string;
package/dist/module.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "8.1.2",
3
+ "version": "8.2.1",
4
4
  "configKey": "cookieControl",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0"
7
+ },
8
+ "builder": {
9
+ "@nuxt/module-builder": "0.6.0",
10
+ "unbuild": "unknown"
7
11
  }
8
12
  }
package/dist/module.mjs CHANGED
@@ -1,26 +1,48 @@
1
1
  import { resolve } from 'node:path';
2
2
  import { pathToFileURL } from 'node:url';
3
- import { createResolver, defineNuxtModule, addPlugin, addImports, addTemplate, extendWebpackConfig, extendViteConfig, resolvePath } from '@nuxt/kit';
3
+ import { createResolver, defineNuxtModule, addPlugin, addImports, addTypeTemplate, updateTemplates, extendWebpackConfig, extendViteConfig, resolvePath } from '@nuxt/kit';
4
4
 
5
- const name = "@dargmuesli/nuxt-cookie-control";
6
- const version = "8.1.2";
5
+ const CONFIG_KEY = "cookieControl";
7
6
 
8
- const en = {
9
- accept: "Accept",
10
- acceptAll: "Accept all",
11
- 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.",
12
- bannerTitle: "Cookies",
13
- close: "Close",
14
- cookiesFunctional: "Functional cookies",
15
- cookiesNecessary: "Necessary cookies",
16
- cookiesOptional: "Optional cookies",
17
- decline: "Decline",
18
- declineAll: "Decline all",
19
- here: "here",
20
- iframeBlocked: "To see this, please enable functional cookies",
21
- manageCookies: "Learn more and customize",
22
- save: "Save",
23
- settingsUnsaved: "You have unsaved settings"
7
+ const execSrcReplacements = (src, replacements) => {
8
+ for (const replacement of replacements) {
9
+ if ((typeof replacement.from === "string" || replacement.from instanceof RegExp) === false) {
10
+ throw new TypeError(
11
+ "[vite-plugin-replace]: The replacement option 'from' is not of type 'string' or 'RegExp'."
12
+ );
13
+ } else if ((typeof replacement.to === "string" || replacement.to instanceof Function) === false) {
14
+ throw new TypeError(
15
+ "[vite-plugin-replace]: The replacement option 'to' is not of type 'string' or 'Function'"
16
+ );
17
+ } else
18
+ src = src.replace(replacement.from, replacement.to);
19
+ }
20
+ return src;
21
+ };
22
+ const replaceCodePlugin = (config) => {
23
+ if (config === void 0) {
24
+ config = {
25
+ replacements: []
26
+ };
27
+ } else if ((typeof config === "object" || config !== null) === false) {
28
+ throw new TypeError(
29
+ "[vite-plugin-replace]: The configuration is not of type 'Object'."
30
+ );
31
+ } else if (Array.isArray(config.replacements) === false) {
32
+ throw new TypeError(
33
+ "[vite-plugin-replace]: The configuration option 'replacement' is not of type 'Array'."
34
+ );
35
+ }
36
+ return {
37
+ name: "transform-file",
38
+ enforce: "pre",
39
+ transform: function(src) {
40
+ return {
41
+ code: execSrcReplacements(src, config.replacements),
42
+ map: null
43
+ };
44
+ }
45
+ };
24
46
  };
25
47
 
26
48
  const DEFAULTS = {
@@ -76,57 +98,38 @@ const DEFAULTS = {
76
98
  isIframeBlocked: false,
77
99
  isModalForced: false,
78
100
  locales: ["en"],
79
- localeTexts: { en }
80
- };
81
-
82
- const execSrcReplacements = (src, replacements) => {
83
- for (const replacement of replacements) {
84
- if ((typeof replacement.from === "string" || replacement.from instanceof RegExp) === false) {
85
- throw new TypeError(
86
- "[vite-plugin-replace]: The replacement option 'from' is not of type 'string' or 'RegExp'."
87
- );
88
- } else if ((typeof replacement.to === "string" || replacement.to instanceof Function) === false) {
89
- throw new TypeError(
90
- "[vite-plugin-replace]: The replacement option 'to' is not of type 'string' or 'Function'"
91
- );
92
- } else
93
- src = src.replace(replacement.from, replacement.to);
94
- }
95
- return src;
96
- };
97
- const replaceCodePlugin = (config) => {
98
- if (config === void 0) {
99
- config = {
100
- replacements: []
101
- };
102
- } else if ((typeof config === "object" || config !== null) === false) {
103
- throw new TypeError(
104
- "[vite-plugin-replace]: The configuration is not of type 'Object'."
105
- );
106
- } else if (Array.isArray(config.replacements) === false) {
107
- throw new TypeError(
108
- "[vite-plugin-replace]: The configuration option 'replacement' is not of type 'Array'."
109
- );
110
- }
111
- return {
112
- name: "transform-file",
113
- enforce: "pre",
114
- transform: function(src) {
115
- return {
116
- code: execSrcReplacements(src, config.replacements),
117
- map: null
118
- };
101
+ // TODO: use Nuxt module "i18n"
102
+ localeTexts: {
103
+ en: {
104
+ accept: "Accept",
105
+ acceptAll: "Accept all",
106
+ 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.",
107
+ bannerTitle: "Cookies",
108
+ close: "Close",
109
+ cookiesFunctional: "Functional cookies",
110
+ cookiesNecessary: "Necessary cookies",
111
+ cookiesOptional: "Optional cookies",
112
+ decline: "Decline",
113
+ declineAll: "Decline all",
114
+ here: "here",
115
+ iframeBlocked: "To see this, please enable functional cookies",
116
+ manageCookies: "Learn more and customize",
117
+ save: "Save",
118
+ settingsUnsaved: "You have unsaved settings"
119
119
  }
120
- };
120
+ }
121
121
  };
122
122
 
123
+ const name = "@dargmuesli/nuxt-cookie-control";
124
+ const version = "8.2.1";
125
+
123
126
  const resolver = createResolver(import.meta.url);
124
127
  const runtimeDir = resolver.resolve("./runtime");
125
128
  const module = defineNuxtModule({
126
129
  meta: {
127
130
  name,
128
131
  version,
129
- configKey: "cookieControl",
132
+ configKey: CONFIG_KEY,
130
133
  compatibility: { nuxt: "^3.0.0" }
131
134
  },
132
135
  defaults: DEFAULTS,
@@ -141,7 +144,7 @@ const module = defineNuxtModule({
141
144
  async setup(moduleOptions, nuxt) {
142
145
  nuxt.options.alias["#cookie-control/set-vars"] = moduleOptions.isCssPonyfillEnabled ? resolver.resolve(runtimeDir, "set-vars/ponyfill") : resolver.resolve(runtimeDir, "set-vars/native");
143
146
  nuxt.options.alias["#cookie-control"] = runtimeDir;
144
- nuxt.options.build.transpile.push(runtimeDir);
147
+ nuxt.options.build.transpile.push("#cookie-control");
145
148
  pushCss(moduleOptions, nuxt);
146
149
  blockIframes(moduleOptions);
147
150
  await loadLocales(moduleOptions);
@@ -151,16 +154,17 @@ const module = defineNuxtModule({
151
154
  as: "useCookieControl",
152
155
  from: resolver.resolve(runtimeDir, "composables")
153
156
  });
154
- addTemplate({
155
- filename: "cookie-control-options.ts",
156
- write: true,
157
- getContents: () => `import type { ModuleOptions } from '#cookie-control/types'
158
-
159
- export default ${JSON.stringify(
160
- moduleOptions,
161
- void 0,
162
- 2
163
- )} as ModuleOptions`
157
+ addTypeTemplate({
158
+ filename: "types/cookie-control.d.ts",
159
+ getContents: getTypeTemplate,
160
+ options: moduleOptions
161
+ });
162
+ nuxt.hook("builder:watch", async (_event, path) => {
163
+ if (path.includes(`${CONFIG_KEY}.cookies`)) {
164
+ updateTemplates({
165
+ filter: (t) => t.filename === "types/cookie-control.d.ts"
166
+ });
167
+ }
164
168
  });
165
169
  }
166
170
  });
@@ -204,6 +208,22 @@ const blockIframes = (moduleOptions) => {
204
208
  });
205
209
  }
206
210
  };
211
+ const getTypeTemplate = (data) => `// Generated by ${name}
212
+
213
+ import type { ModuleOptions } from '#cookie-control/types'
214
+
215
+ export default ${JSON.stringify(data.options, void 0, 2)} as ModuleOptions
216
+
217
+ /**
218
+ * Union of the cookie ids specified in the Nuxt configuration.
219
+ */
220
+ export type CookieID = ${Object.values([
221
+ ...data.options.cookies.necessary,
222
+ ...data.options.cookies.optional
223
+ ]).map((cookie) => `"${cookie.id}"`).join(" | ") || "never"};
224
+
225
+ export type CookieIDs = Array<CookieID>;
226
+ `;
207
227
  const loadLocales = async (moduleOptions) => {
208
228
  const locales = moduleOptions.locales;
209
229
  moduleOptions.locales = [];
@@ -349,7 +349,7 @@ const toggleLabel = ($event: KeyboardEvent) => {
349
349
  // lifecycle
350
350
  onBeforeMount(() => {
351
351
  if (moduleOptions.colors) {
352
- const variables: Record<string, any> = {}
352
+ const variables: Record<string, string> = {}
353
353
 
354
354
  for (const key in moduleOptions.colors) {
355
355
  variables[`cookie-control-${key}`] = `${moduleOptions.colors[key]}`
@@ -21,8 +21,7 @@
21
21
  <script setup lang="ts">
22
22
  import { computed } from 'vue'
23
23
 
24
- import type { Cookie } from '../types'
25
-
24
+ import type { Cookie } from '#cookie-control/types'
26
25
  import { useNuxtApp, useCookieControl } from '#imports'
27
26
 
28
27
  const { cookiesEnabled, isModalActive, moduleOptions } = useCookieControl()
@@ -1,2 +1,2 @@
1
- import type { State } from './types';
1
+ import type { State } from '#cookie-control/types';
2
2
  export declare const useCookieControl: () => State;
@@ -1,3 +1,4 @@
1
- import type { Locale } from './types';
1
+ import type { Locale } from '#cookie-control/types';
2
+ export declare const CONFIG_KEY = "cookieControl";
2
3
  export declare const COOKIE_ID_SEPARATOR = "~";
3
4
  export declare const LOCALE_DEFAULT: Locale;
@@ -1,2 +1,3 @@
1
+ export const CONFIG_KEY = "cookieControl";
1
2
  export const COOKIE_ID_SEPARATOR = "~";
2
3
  export const LOCALE_DEFAULT = "en";
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,3 +1,3 @@
1
- import type { LocaleStrings } from '../types';
1
+ import type { LocaleStrings } from '#cookie-control/types';
2
2
  declare const _default: LocaleStrings;
3
3
  export default _default;
@@ -1,6 +1,6 @@
1
- import type { Cookie, ModuleOptions, Translatable } from './types';
1
+ import type { Cookie, ModuleOptions, Translatable } from '#cookie-control/types';
2
2
  export declare const getAllCookieIdsString: (moduleOptions: ModuleOptions) => string;
3
3
  export declare const getCookieIds: (cookies: Cookie[]) => string[];
4
4
  export declare const removeCookie: (name: string) => undefined;
5
- export declare const resolveTranslatable: (translatable: Translatable, locale?: import("./types").Locale) => string;
6
- export declare const useResolveTranslatable: (locale?: import("./types").Locale) => (translatable: Translatable) => string;
5
+ export declare const resolveTranslatable: (translatable: Translatable, locale?: import("#cookie-control/types").Locale) => string;
6
+ export declare const useResolveTranslatable: (locale?: import("#cookie-control/types").Locale) => (translatable: Translatable) => string;
@@ -1,4 +1,4 @@
1
- import { LOCALE_DEFAULT } from "./constants.mjs";
1
+ import { LOCALE_DEFAULT } from "#cookie-control/constants";
2
2
  import { useCookie } from "#imports";
3
3
  export const getAllCookieIdsString = (moduleOptions) => getCookieIds([
4
4
  ...moduleOptions.cookies.necessary,
@@ -1,6 +1,7 @@
1
- import type { Plugin } from '#app';
2
- import type { State } from './types';
3
- declare const plugin: Plugin<{
1
+ import type { State } from '#cookie-control/types';
2
+ declare const _default: import("nuxt/app").Plugin<{
3
+ cookies: State;
4
+ }> & import("nuxt/app").ObjectPlugin<{
4
5
  cookies: State;
5
6
  }>;
6
- export default plugin;
7
+ export default _default;
@@ -1,9 +1,9 @@
1
1
  import { ref } from "vue";
2
- import { COOKIE_ID_SEPARATOR } from "./constants.mjs";
3
- import { getAllCookieIdsString } from "./methods.mjs";
2
+ import moduleOptions from "#build/types/cookie-control";
3
+ import { COOKIE_ID_SEPARATOR } from "#cookie-control/constants";
4
+ import { getAllCookieIdsString } from "#cookie-control/methods";
4
5
  import { defineNuxtPlugin, useCookie } from "#imports";
5
- import moduleOptions from "#build/cookie-control-options";
6
- const plugin = defineNuxtPlugin((_nuxtApp) => {
6
+ export default defineNuxtPlugin((_nuxtApp) => {
7
7
  const cookieIsConsentGiven = useCookie(
8
8
  moduleOptions.cookieNameIsConsentGiven,
9
9
  moduleOptions.cookieOptions
@@ -42,4 +42,3 @@ const plugin = defineNuxtPlugin((_nuxtApp) => {
42
42
  }
43
43
  };
44
44
  });
45
- export default plugin;
@@ -1,7 +1,7 @@
1
1
  import type { Ref } from 'vue';
2
2
  import type { CookieOptions } from 'nuxt/app';
3
3
  export 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';
4
- export type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
4
+ export type PartialRecord<K extends string | number | symbol, T> = Partial<Record<K, T>>;
5
5
  export type Translatable = string | PartialRecord<Locale, string>;
6
6
  export declare enum CookieType {
7
7
  NECESSARY = "necessary",
@@ -36,7 +36,7 @@ export interface LocaleStrings {
36
36
  export interface ModuleOptions {
37
37
  barPosition: 'top-left' | 'top-right' | 'top-full' | 'bottom-left' | 'bottom-right' | 'bottom-full';
38
38
  closeModalOnClickOutside: boolean;
39
- colors: false | Record<string, any>;
39
+ colors: false | Record<string, unknown>;
40
40
  cookieExpiryOffsetMs: number;
41
41
  cookieNameCookiesEnabledIds: string;
42
42
  cookieNameIsConsentGiven: string;
@@ -58,7 +58,6 @@ export interface ModuleOptions {
58
58
  locales: Locale[];
59
59
  localeTexts: PartialRecord<Locale, Partial<LocaleStrings>>;
60
60
  }
61
- export declare const DEFAULTS: Required<ModuleOptions>;
62
61
  export interface State {
63
62
  cookiesEnabled: Ref<Cookie[] | undefined>;
64
63
  cookiesEnabledIds: Ref<string[] | undefined>;
@@ -1,61 +1,5 @@
1
- import en from "./locale/en.mjs";
2
1
  export var CookieType = /* @__PURE__ */ ((CookieType2) => {
3
2
  CookieType2["NECESSARY"] = "necessary";
4
3
  CookieType2["OPTIONAL"] = "optional";
5
4
  return CookieType2;
6
5
  })(CookieType || {});
7
- export const DEFAULTS = {
8
- barPosition: "bottom-full",
9
- closeModalOnClickOutside: false,
10
- colors: {
11
- barBackground: "#000",
12
- barButtonBackground: "#fff",
13
- barButtonColor: "#000",
14
- barButtonHoverBackground: "#333",
15
- barButtonHoverColor: "#fff",
16
- barTextColor: "#fff",
17
- checkboxActiveBackground: "#000",
18
- checkboxActiveCircleBackground: "#fff",
19
- checkboxDisabledBackground: "#ddd",
20
- checkboxDisabledCircleBackground: "#fff",
21
- checkboxInactiveBackground: "#000",
22
- checkboxInactiveCircleBackground: "#fff",
23
- controlButtonBackground: "#fff",
24
- controlButtonHoverBackground: "#000",
25
- controlButtonIconColor: "#000",
26
- controlButtonIconHoverColor: "#fff",
27
- focusRingColor: "#808080",
28
- modalBackground: "#fff",
29
- modalButtonBackground: "#000",
30
- modalButtonColor: "#fff",
31
- modalButtonHoverBackground: "#333",
32
- modalButtonHoverColor: "#fff",
33
- modalOverlay: "#000",
34
- modalOverlayOpacity: 0.8,
35
- modalTextColor: "#000",
36
- modalUnsavedColor: "#fff"
37
- },
38
- cookies: {
39
- necessary: [],
40
- optional: []
41
- },
42
- cookieExpiryOffsetMs: 1e3 * 60 * 60 * 24 * 365,
43
- // one year
44
- cookieNameIsConsentGiven: "ncc_c",
45
- cookieNameCookiesEnabledIds: "ncc_e",
46
- cookieOptions: {
47
- path: "/",
48
- sameSite: "strict",
49
- secure: process.env.NODE_ENV === "development" ? void 0 : true
50
- },
51
- isAcceptNecessaryButtonEnabled: true,
52
- isControlButtonEnabled: true,
53
- isCookieIdVisible: false,
54
- isCssEnabled: true,
55
- isCssPonyfillEnabled: false,
56
- isDashInDescriptionEnabled: true,
57
- isIframeBlocked: false,
58
- isModalForced: false,
59
- locales: ["en"],
60
- localeTexts: { en }
61
- };
package/package.json CHANGED
@@ -10,22 +10,30 @@
10
10
  },
11
11
  "description": "Nuxt Cookie Control Module",
12
12
  "devDependencies": {
13
- "@commitlint/cli": "19.2.1",
14
- "@commitlint/config-conventional": "19.1.0",
13
+ "@commitlint/cli": "19.3.0",
14
+ "@commitlint/config-conventional": "19.2.2",
15
15
  "@dargmuesli/nuxt-cookie-control": "link:",
16
- "@nuxt/module-builder": "0.5.5",
16
+ "@nuxt/eslint-config": "0.3.10",
17
+ "@nuxt/module-builder": "0.6.0",
17
18
  "@nuxt/schema": "3.11.2",
18
- "@nuxtjs/eslint-config-typescript": "12.1.0",
19
- "eslint": "8.57.0",
19
+ "@semantic-release/changelog": "6.0.3",
20
+ "@semantic-release/commit-analyzer": "12.0.0",
21
+ "@semantic-release/git": "10.0.1",
22
+ "@semantic-release/github": "10.0.3",
23
+ "@semantic-release/npm": "12.0.0",
24
+ "@semantic-release/release-notes-generator": "13.0.0",
25
+ "eslint": "9.2.0",
20
26
  "eslint-config-prettier": "9.1.0",
21
27
  "eslint-plugin-prettier": "5.1.3",
22
28
  "husky": "9.0.11",
23
29
  "lint-staged": "15.2.2",
24
30
  "nuxt": "3.11.2",
25
31
  "prettier": "3.2.5",
32
+ "semantic-release": "23.0.8",
26
33
  "typescript": "5.4.5",
27
- "vue": "3.4.21",
28
- "vue-tsc": "2.0.12",
34
+ "vite": "5.2.11",
35
+ "vue": "3.4.27",
36
+ "vue-tsc": "2.0.16",
29
37
  "webpack": "5.91.0"
30
38
  },
31
39
  "engines": {
@@ -61,7 +69,7 @@
61
69
  "Jonas Thelemann"
62
70
  ],
63
71
  "name": "@dargmuesli/nuxt-cookie-control",
64
- "packageManager": "pnpm@8.15.6",
72
+ "packageManager": "pnpm@9.1.0",
65
73
  "publishConfig": {
66
74
  "access": "public"
67
75
  },
@@ -72,12 +80,14 @@
72
80
  "scripts": {
73
81
  "build": "nuxt-module-build build",
74
82
  "dev": "pnpm --dir playground run dev",
75
- "lint": "eslint --ext .js,.ts,.vue . && nuxi typecheck",
76
- "lint:fix": "eslint --ext .js,.ts,.vue --fix . && nuxi typecheck --fix",
83
+ "lint": "pnpm run lint:js && pnpm run lint:ts",
84
+ "lint:fix": "pnpm run lint:js --fix . && pnpm run lint:ts --fix",
85
+ "lint:js": "eslint --cache",
86
+ "lint:ts": "vue-tsc --noEmit",
77
87
  "prepack": "pnpm build",
78
88
  "prepare": "husky && nuxt-module-build prepare"
79
89
  },
80
90
  "type": "module",
81
- "types": "./dist/module.d.ts",
82
- "version": "8.1.2"
91
+ "types": "./dist/types.d.ts",
92
+ "version": "8.2.1"
83
93
  }