@dargmuesli/nuxt-cookie-control 5.0.0 → 5.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/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "configKey": "cookieControl",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.0.0"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { resolve } from 'node:path';
2
2
  import { createResolver, defineNuxtModule, addPlugin, addImports, addTemplate, extendWebpackConfig, resolvePath } from '@nuxt/kit';
3
3
 
4
4
  const name = "@dargmuesli/nuxt-cookie-control";
5
- const version = "5.0.0";
5
+ const version = "5.0.1";
6
6
 
7
7
  const en = {
8
8
  accept: "Accept",
@@ -91,6 +91,7 @@ const module = defineNuxtModule({
91
91
  }
92
92
  },
93
93
  async setup(moduleOptions, nuxt) {
94
+ nuxt.options.alias["#cookie-control/set-vars"] = moduleOptions.isCssPonyfillEnabled ? resolve(runtimeDir, "set-vars/ponyfill") : resolve(runtimeDir, "set-vars/native");
94
95
  nuxt.options.alias["#cookie-control"] = runtimeDir;
95
96
  nuxt.options.build.transpile.push(runtimeDir);
96
97
  pushCss(moduleOptions, nuxt);
@@ -196,6 +196,7 @@ import {
196
196
  setCookie,
197
197
  resolveTranslatable,
198
198
  } from '../methods'
199
+ import setCssVariables from '#cookie-control/set-vars'
199
200
 
200
201
  import { useCookieControl } from '#imports'
201
202
 
@@ -312,7 +313,7 @@ const toggleLabel = ($event: KeyboardEvent) => {
312
313
  }
313
314
 
314
315
  // lifecycle
315
- onBeforeMount(async () => {
316
+ onBeforeMount(() => {
316
317
  if (moduleOptions.colors) {
317
318
  const variables: Record<string, any> = {}
318
319
 
@@ -320,18 +321,7 @@ onBeforeMount(async () => {
320
321
  variables[`cookie-control-${key}`] = `${moduleOptions.colors[key]}`
321
322
  }
322
323
 
323
- if (moduleOptions.isCssPonyfillEnabled) {
324
- const module = await import('css-vars-ponyfill')
325
- const cssVars = module.default
326
- cssVars({ variables })
327
- } else {
328
- for (const cssVar in variables) {
329
- document.documentElement.style.setProperty(
330
- `--${cssVar}`,
331
- variables[cssVar]
332
- )
333
- }
334
- }
324
+ setCssVariables(variables)
335
325
  }
336
326
 
337
327
  if (
@@ -0,0 +1 @@
1
+ export default function (variables: Record<string, string>): void;
@@ -0,0 +1,5 @@
1
+ export default function(variables) {
2
+ for (const cssVar in variables) {
3
+ document.documentElement.style.setProperty(`--${cssVar}`, variables[cssVar]);
4
+ }
5
+ }
@@ -0,0 +1 @@
1
+ export default function (variables: Record<string, string>): void;
@@ -0,0 +1,4 @@
1
+ import cssVars from "css-vars-ponyfill";
2
+ export default function(variables) {
3
+ cssVars({ variables });
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dargmuesli/nuxt-cookie-control",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Nuxt Cookies Control Module",
5
5
  "author": "Dario Ferderber <dario.ferderber@broj42.com>",
6
6
  "maintainers": [
@@ -36,7 +36,7 @@
36
36
  "lint": "pnpm prepack && eslint --ext .js,.ts,.vue . && nuxi typecheck playground"
37
37
  },
38
38
  "dependencies": {
39
- "@nuxt/kit": "3.2.2",
39
+ "@nuxt/kit": "3.2.3",
40
40
  "@sindresorhus/slugify": "2.2.0",
41
41
  "css-vars-ponyfill": "2.4.8",
42
42
  "js-cookie": "3.0.1",
@@ -52,7 +52,7 @@
52
52
  "eslint-plugin-prettier": "4.2.1",
53
53
  "husky": "8.0.3",
54
54
  "lint-staged": "13.1.2",
55
- "nuxt": "3.2.2",
55
+ "nuxt": "3.2.3",
56
56
  "prettier": "2.8.4",
57
57
  "typescript": "4.9.5",
58
58
  "vue": "3.2.47",