@authup/client-web-nuxt 1.0.0-beta.65 → 1.0.0-beta.67

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@authup/client-web-nuxt",
3
3
  "configKey": "authup",
4
- "version": "1.0.0-beta.65",
4
+ "version": "1.0.0-beta.67",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "3.6.1"
@@ -1,12 +1,40 @@
1
- import { install } from "@authup/client-web-kit";
1
+ import {
2
+ COLOR_MODE_COOKIE,
3
+ COLOR_MODE_UNSET,
4
+ LOCALE_COOKIE,
5
+ LOCALE_UNSET,
6
+ install
7
+ } from "@authup/client-web-kit";
2
8
  import { API_URL_DEFAULT } from "@authup/core-http-kit";
3
9
  import { getPathValue } from "pathtrace";
10
+ import { computed } from "vue";
4
11
  import {
5
12
  defineNuxtPlugin,
6
13
  tryUseNuxtApp,
7
14
  useCookie,
8
15
  useRuntimeConfig
9
16
  } from "#imports";
17
+ function buildPreferenceRef(name, unset, options) {
18
+ const cookie = useCookie(name, {
19
+ path: "/",
20
+ maxAge: 60 * 60 * 24 * 365,
21
+ sameSite: "lax",
22
+ ...options || {}
23
+ });
24
+ return computed({
25
+ get: () => cookie.value || unset,
26
+ set: (value) => {
27
+ cookie.value = value;
28
+ }
29
+ });
30
+ }
31
+ function buildPreferences(runtimeConfig) {
32
+ const vuecs = runtimeConfig.public.vuecs;
33
+ return {
34
+ locale: buildPreferenceRef(LOCALE_COOKIE, LOCALE_UNSET, vuecs?.localeCookie || vuecs?.cookie),
35
+ colorMode: buildPreferenceRef(COLOR_MODE_COOKIE, COLOR_MODE_UNSET, vuecs?.cookie)
36
+ };
37
+ }
10
38
  function buildCookieOptions(runtimeConfig) {
11
39
  const options = runtimeConfig.public.authup;
12
40
  let domain;
@@ -103,6 +131,11 @@ export default defineNuxtPlugin({
103
131
  return null;
104
132
  },
105
133
  isServer: import.meta.server,
134
+ // Client only: a server render's cookie refs are per request and
135
+ // never in step with one another, so a seed there would reach
136
+ // nothing but a `Set-Cookie`, and the client's own resolve seeds
137
+ // right after hydration anyway.
138
+ preferences: import.meta.client ? buildPreferences(runtimeConfig) : void 0,
106
139
  // Same bucket `useAsyncData` transports its results in, so a
107
140
  // collection loaded during the server render is handed to the
108
141
  // browser through the regular Nuxt payload instead of being
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@authup/client-web-nuxt",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.65",
4
+ "version": "1.0.0-beta.67",
5
5
  "description": "Nuxt module for the authup ecosystem",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -32,10 +32,10 @@
32
32
  "node": "^22.13.0 || ^23.5.0 || >=24.0.0"
33
33
  },
34
34
  "dependencies": {
35
- "@authup/access": "^1.0.0-beta.65",
36
- "@authup/client-web-kit": "^1.0.0-beta.65",
37
- "@authup/core-http-kit": "^1.0.0-beta.65",
38
- "@authup/kit": "^1.0.0-beta.65",
35
+ "@authup/access": "^1.0.0-beta.67",
36
+ "@authup/client-web-kit": "^1.0.0-beta.67",
37
+ "@authup/core-http-kit": "^1.0.0-beta.67",
38
+ "@authup/kit": "^1.0.0-beta.67",
39
39
  "@nuxt/kit": "^4.0.0",
40
40
  "pathtrace": "^2.2.0",
41
41
  "smob": "^1.6.1"
@@ -52,7 +52,7 @@
52
52
  "rollup-plugin-dts": "^6.5.1",
53
53
  "strip-literal": "^4.0.0",
54
54
  "vitest": "^4.0.14",
55
- "vue": "^3.5.42",
55
+ "vue": "^3.5.43",
56
56
  "vue-router": "^5.3.1"
57
57
  },
58
58
  "peerDependencies": {