origam 2.37.32 → 2.37.34
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/CHANGELOG.md +20 -0
- package/dist/src/assets/css/main.css +1 -1
- package/dist/src/assets/css/tokens/dark.css +4 -0
- package/dist/src/assets/css/tokens/light.css +2 -0
- package/dist/src/assets/scss/tokens/_dark.scss +4 -0
- package/dist/src/assets/scss/tokens/_light.scss +2 -0
- package/dist/src/components/Table/OrigamTable.vue +2 -0
- package/dist/src/nuxt/plugin.client.cjs +1 -1
- package/dist/src/nuxt/plugin.client.js +2 -2
- package/dist/src/nuxt/plugin.server.cjs +3 -2
- package/dist/src/nuxt/plugin.server.js +4 -3
- package/dist/src/types/tokens.type.d.ts +1 -1
- package/dist/src/utils/Commons/apply-theme.util.cjs +7 -0
- package/dist/src/utils/Commons/apply-theme.util.d.ts +14 -0
- package/dist/src/utils/Commons/apply-theme.util.js +6 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ exports.applyTheme = applyTheme;
|
|
|
7
7
|
exports.applyThemes = applyThemes;
|
|
8
8
|
exports.installedThemesFromList = installedThemesFromList;
|
|
9
9
|
exports.isModePinned = isModePinned;
|
|
10
|
+
exports.knownBrand = knownBrand;
|
|
10
11
|
exports.resolveThemeVars = resolveThemeVars;
|
|
11
12
|
exports.semanticTreeToVars = semanticTreeToVars;
|
|
12
13
|
exports.themeSelector = themeSelector;
|
|
@@ -97,6 +98,12 @@ function isModePinned(cookieValue, defaultMode) {
|
|
|
97
98
|
const concrete = v => v === "light" || v === "dark";
|
|
98
99
|
return concrete(cookieValue) || concrete(defaultMode);
|
|
99
100
|
}
|
|
101
|
+
function knownBrand(value, themes) {
|
|
102
|
+
if (!value) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
return value === "auto" || (themes ?? []).some(t => t.name === value) ? value : null;
|
|
106
|
+
}
|
|
100
107
|
function themeToUnpinnedCss(theme) {
|
|
101
108
|
if (theme.mode !== "light" && theme.mode !== "dark") return "";
|
|
102
109
|
const vars = resolveThemeVars(theme);
|
|
@@ -53,6 +53,20 @@ export declare function themeToCss(theme: IOrigamTheme): string;
|
|
|
53
53
|
* Shared by both Nuxt plugins so server and client never disagree on it (#1103).
|
|
54
54
|
********************************************************/
|
|
55
55
|
export declare function isModePinned(cookieValue: string | null | undefined, defaultMode: string | undefined): boolean;
|
|
56
|
+
/*********************************************************
|
|
57
|
+
* knownBrand
|
|
58
|
+
*
|
|
59
|
+
* @description
|
|
60
|
+
* Trust boundary for the brand cookie (#1120): the value is returned only when
|
|
61
|
+
* it is `auto` or names an INSTALLED theme, otherwise `null` so the caller
|
|
62
|
+
* falls back to the configured default. A whitelist scan (`some`), never a
|
|
63
|
+
* property lookup, so `__proto__` / `constructor` are just unknown names.
|
|
64
|
+
* @description
|
|
65
|
+
* Shared by both Nuxt plugins so server and client never disagree on it.
|
|
66
|
+
********************************************************/
|
|
67
|
+
export declare function knownBrand(value: string | null | undefined, themes: readonly {
|
|
68
|
+
name?: string;
|
|
69
|
+
}[] | undefined): string | null;
|
|
56
70
|
/*********************************************************
|
|
57
71
|
* themeToUnpinnedCss
|
|
58
72
|
*
|
|
@@ -76,6 +76,12 @@ export function isModePinned(cookieValue, defaultMode) {
|
|
|
76
76
|
const concrete = (v) => v === "light" || v === "dark";
|
|
77
77
|
return concrete(cookieValue) || concrete(defaultMode);
|
|
78
78
|
}
|
|
79
|
+
export function knownBrand(value, themes) {
|
|
80
|
+
if (!value) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return value === "auto" || (themes ?? []).some((t) => t.name === value) ? value : null;
|
|
84
|
+
}
|
|
79
85
|
export function themeToUnpinnedCss(theme) {
|
|
80
86
|
if (theme.mode !== "light" && theme.mode !== "dark") return "";
|
|
81
87
|
const vars = resolveThemeVars(theme);
|