@leavepulse/ui 0.18.1 → 0.18.2
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/package.json +1 -1
- package/src/runtime/theme.plugin.ts +3 -11
package/package.json
CHANGED
|
@@ -16,11 +16,9 @@
|
|
|
16
16
|
* holds the full token values, including themes the server cannot name — keeps
|
|
17
17
|
* winning.
|
|
18
18
|
*/
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
// would load a second copy of the theme singleton from src/, leaving components
|
|
23
|
-
// subscribed to a different reactive state than the one this plugin drives.
|
|
19
|
+
// Through the barrel, not "../theme/…": this file is compiled by the consuming
|
|
20
|
+
// app, where the barrel resolves to the same dist instance the components use.
|
|
21
|
+
// A relative path would load a second copy of the theme singleton.
|
|
24
22
|
import {
|
|
25
23
|
bootstrapTheme,
|
|
26
24
|
leavepulse,
|
|
@@ -30,10 +28,6 @@ import {
|
|
|
30
28
|
themeToCssRule,
|
|
31
29
|
type TokenSet,
|
|
32
30
|
} from "@leavepulse/ui"
|
|
33
|
-
// "#imports" is Nuxt's virtual module: it resolves in the consuming app, which
|
|
34
|
-
// is what compiles this file. (No @ts-expect-error here — the kit's own build
|
|
35
|
-
// excludes src/runtime, so the directive would be unused there and error in the
|
|
36
|
-
// consumer, where the import type-checks fine.)
|
|
37
31
|
import { defineNuxtPlugin, useCookie, useHead, useRuntimeConfig } from "#imports"
|
|
38
32
|
|
|
39
33
|
export default defineNuxtPlugin(() => {
|
|
@@ -45,8 +39,6 @@ export default defineNuxtPlugin(() => {
|
|
|
45
39
|
const fallback =
|
|
46
40
|
themes.find((theme) => theme.name === options.defaultTheme) ?? leavepulse
|
|
47
41
|
|
|
48
|
-
// Read-only here: the cookie is written by cacheTheme() in the browser, which
|
|
49
|
-
// is the one place a theme choice is recorded.
|
|
50
42
|
const cookie = useCookie<string | null>(THEME_COOKIE, { readonly: true })
|
|
51
43
|
const initial = themeFromCookie(cookie.value, themes) ?? fallback
|
|
52
44
|
|