shared-lib-web 0.0.2 → 0.0.3
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/README.md +381 -127
- package/dist/components/app-brand.d.ts.map +1 -1
- package/dist/components/app-brand.js +9 -5
- package/dist/components/app-brand.js.map +1 -1
- package/dist/components/coming-soon.d.ts.map +1 -1
- package/dist/components/coming-soon.js +3 -2
- package/dist/components/coming-soon.js.map +1 -1
- package/dist/components/language-switcher.d.ts +5 -1
- package/dist/components/language-switcher.d.ts.map +1 -1
- package/dist/components/language-switcher.js +20 -7
- package/dist/components/language-switcher.js.map +1 -1
- package/dist/components/settings-menu.d.ts +4 -0
- package/dist/components/settings-menu.d.ts.map +1 -1
- package/dist/components/settings-menu.js +15 -2
- package/dist/components/settings-menu.js.map +1 -1
- package/dist/context/use-ui.d.ts.map +1 -1
- package/dist/context/use-ui.js +4 -3
- package/dist/context/use-ui.js.map +1 -1
- package/dist/i18n/browser-language.d.ts +9 -0
- package/dist/i18n/browser-language.d.ts.map +1 -0
- package/dist/i18n/browser-language.js +89 -0
- package/dist/i18n/browser-language.js.map +1 -0
- package/dist/i18n/default-messages.d.ts.map +1 -1
- package/dist/i18n/default-messages.js +3 -0
- package/dist/i18n/default-messages.js.map +1 -1
- package/dist/i18n/locale-groups.d.ts +18 -0
- package/dist/i18n/locale-groups.d.ts.map +1 -0
- package/dist/i18n/locale-groups.js +74 -0
- package/dist/i18n/locale-groups.js.map +1 -0
- package/dist/i18n/locale-service.d.ts +22 -4
- package/dist/i18n/locale-service.d.ts.map +1 -1
- package/dist/i18n/locale-service.js +95 -27
- package/dist/i18n/locale-service.js.map +1 -1
- package/dist/i18n/locale-signal.d.ts +18 -0
- package/dist/i18n/locale-signal.d.ts.map +1 -0
- package/dist/i18n/locale-signal.js +142 -0
- package/dist/i18n/locale-signal.js.map +1 -0
- package/dist/i18n/translator.d.ts +8 -1
- package/dist/i18n/translator.d.ts.map +1 -1
- package/dist/i18n/translator.js +36 -12
- package/dist/i18n/translator.js.map +1 -1
- package/dist/index.d.ts +21 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/interfaces/app-types.d.ts +6 -0
- package/dist/interfaces/app-types.d.ts.map +1 -1
- package/dist/interfaces/ui-config.d.ts +162 -15
- package/dist/interfaces/ui-config.d.ts.map +1 -1
- package/dist/interfaces/ui-context.d.ts +1 -1
- package/dist/interfaces/ui-context.d.ts.map +1 -1
- package/dist/layouts/auth-layout.js +1 -1
- package/dist/layouts/auth-layout.js.map +1 -1
- package/dist/providers/provider-effects.d.ts +2 -2
- package/dist/providers/provider-effects.d.ts.map +1 -1
- package/dist/providers/provider-effects.js +4 -1
- package/dist/providers/provider-effects.js.map +1 -1
- package/dist/providers/register-config.d.ts.map +1 -1
- package/dist/providers/register-config.js +2 -0
- package/dist/providers/register-config.js.map +1 -1
- package/dist/providers/shared-web-ui-provider.d.ts +7 -19
- package/dist/providers/shared-web-ui-provider.d.ts.map +1 -1
- package/dist/providers/shared-web-ui-provider.js +21 -22
- package/dist/providers/shared-web-ui-provider.js.map +1 -1
- package/dist/query/query-param.d.ts +4 -1
- package/dist/query/query-param.d.ts.map +1 -1
- package/dist/query/query-param.js +6 -3
- package/dist/query/query-param.js.map +1 -1
- package/dist/state/api-loader.d.ts +19 -0
- package/dist/state/api-loader.d.ts.map +1 -0
- package/dist/state/api-loader.js +187 -0
- package/dist/state/api-loader.js.map +1 -0
- package/dist/state/auth-service.d.ts +4 -0
- package/dist/state/auth-service.d.ts.map +1 -1
- package/dist/state/auth-service.js +47 -3
- package/dist/state/auth-service.js.map +1 -1
- package/dist/state/branch-service.d.ts +1 -1
- package/dist/state/branch-service.js +3 -3
- package/dist/state/branch-service.js.map +1 -1
- package/dist/state/company-service.d.ts +16 -0
- package/dist/state/company-service.d.ts.map +1 -0
- package/dist/state/company-service.js +97 -0
- package/dist/state/company-service.js.map +1 -0
- package/dist/state/language-service.d.ts +5 -2
- package/dist/state/language-service.d.ts.map +1 -1
- package/dist/state/language-service.js +12 -7
- package/dist/state/language-service.js.map +1 -1
- package/dist/state/layout-choice-service.d.ts +10 -0
- package/dist/state/layout-choice-service.d.ts.map +1 -0
- package/dist/state/layout-choice-service.js +34 -0
- package/dist/state/layout-choice-service.js.map +1 -0
- package/dist/state/menu-service.d.ts +1 -1
- package/dist/state/menu-service.js +2 -2
- package/dist/state/menu-service.js.map +1 -1
- package/dist/state/preference-sync.d.ts +1 -1
- package/dist/state/preference-sync.d.ts.map +1 -1
- package/dist/state/preference-sync.js +11 -3
- package/dist/state/preference-sync.js.map +1 -1
- package/dist/state/signals.d.ts +9 -1
- package/dist/state/signals.d.ts.map +1 -1
- package/dist/state/signals.js +28 -4
- package/dist/state/signals.js.map +1 -1
- package/dist/theme/custom-themes.d.ts +28 -0
- package/dist/theme/custom-themes.d.ts.map +1 -0
- package/dist/theme/custom-themes.js +218 -0
- package/dist/theme/custom-themes.js.map +1 -0
- package/dist/theme/dark-themes.d.ts +9 -1
- package/dist/theme/dark-themes.d.ts.map +1 -1
- package/dist/theme/dark-themes.js +74 -2
- package/dist/theme/dark-themes.js.map +1 -1
- package/dist/theme/logo.d.ts +6 -3
- package/dist/theme/logo.d.ts.map +1 -1
- package/dist/theme/logo.js +17 -3
- package/dist/theme/logo.js.map +1 -1
- package/dist/theme/theme-service.d.ts +14 -3
- package/dist/theme/theme-service.d.ts.map +1 -1
- package/dist/theme/theme-service.js +64 -10
- package/dist/theme/theme-service.js.map +1 -1
- package/dist/utils/app-http.d.ts +29 -1
- package/dist/utils/app-http.d.ts.map +1 -1
- package/dist/utils/app-http.js +113 -11
- package/dist/utils/app-http.js.map +1 -1
- package/dist/utils/content-util.d.ts +6 -0
- package/dist/utils/content-util.d.ts.map +1 -0
- package/dist/utils/content-util.js +45 -0
- package/dist/utils/content-util.js.map +1 -0
- package/dist/utils/error-util.d.ts +3 -0
- package/dist/utils/error-util.d.ts.map +1 -0
- package/dist/utils/error-util.js +58 -0
- package/dist/utils/error-util.js.map +1 -0
- package/dist/utils/language-util.d.ts +3 -3
- package/dist/utils/language-util.d.ts.map +1 -1
- package/dist/utils/language-util.js +7 -7
- package/dist/utils/language-util.js.map +1 -1
- package/dist/utils/menu-util.js +1 -1
- package/dist/utils/menu-util.js.map +1 -1
- package/dist/utils/signal-source.d.ts +4 -0
- package/dist/utils/signal-source.d.ts.map +1 -0
- package/dist/utils/signal-source.js +13 -0
- package/dist/utils/signal-source.js.map +1 -0
- package/dist/utils/storage-keys.d.ts +5 -0
- package/dist/utils/storage-keys.d.ts.map +1 -1
- package/dist/utils/storage-keys.js +5 -0
- package/dist/utils/storage-keys.js.map +1 -1
- package/package.json +3 -3
- package/src/components/app-brand.tsx +9 -5
- package/src/components/coming-soon.tsx +3 -2
- package/src/components/language-switcher.tsx +26 -7
- package/src/components/settings-menu.tsx +28 -2
- package/src/context/use-ui.ts +4 -3
- package/src/i18n/browser-language.ts +98 -0
- package/src/i18n/default-messages.ts +3 -0
- package/src/i18n/locale-groups.ts +87 -0
- package/src/i18n/locale-service.ts +99 -27
- package/src/i18n/locale-signal.ts +173 -0
- package/src/i18n/translator.ts +38 -12
- package/src/index.ts +71 -3
- package/src/interfaces/app-types.ts +6 -0
- package/src/interfaces/ui-config.ts +168 -15
- package/src/interfaces/ui-context.ts +1 -1
- package/src/layouts/auth-layout.tsx +1 -1
- package/src/providers/provider-effects.ts +5 -2
- package/src/providers/register-config.ts +2 -0
- package/src/providers/shared-web-ui-provider.tsx +26 -43
- package/src/query/query-param.ts +6 -2
- package/src/state/api-loader.ts +205 -0
- package/src/state/auth-service.ts +58 -3
- package/src/state/branch-service.ts +3 -3
- package/src/state/company-service.ts +107 -0
- package/src/state/language-service.ts +12 -7
- package/src/state/layout-choice-service.ts +40 -0
- package/src/state/menu-service.ts +2 -2
- package/src/state/preference-sync.ts +11 -3
- package/src/state/signals.ts +36 -4
- package/src/theme/custom-themes.ts +236 -0
- package/src/theme/dark-themes.ts +80 -3
- package/src/theme/logo.ts +19 -4
- package/src/theme/org-themes.json +70 -0
- package/src/theme/theme-service.ts +70 -10
- package/src/utils/app-http.ts +125 -11
- package/src/utils/content-util.ts +49 -0
- package/src/utils/error-util.ts +64 -0
- package/src/utils/language-util.ts +7 -7
- package/src/utils/menu-util.ts +1 -1
- package/src/utils/signal-source.ts +15 -0
- package/src/utils/storage-keys.ts +6 -0
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
// language-service.ts
|
|
2
2
|
// Languages that come from the backend at runtime, separate from config.ts (like the menu: nav).
|
|
3
3
|
//
|
|
4
|
-
//
|
|
4
|
+
// config.loadSupportLanguages: "/app-api/languages" // the provider calls it on start
|
|
5
5
|
// setLanguages(langResponse); // or call it yourself
|
|
6
6
|
//
|
|
7
7
|
// langResponse is the backend reply { data: [...], meta } or only the list.
|
|
8
8
|
// Texts load from config.loadLocale(code): locales/en-US.json, locales/ar-SA.json ...
|
|
9
9
|
// When the reply arrives: the current language stays if it is in the list (and the user picked it),
|
|
10
|
-
// otherwise the language marked isDefault
|
|
10
|
+
// otherwise: the language marked isDefault, else config.defaultLanguage, else the browser / system language,
|
|
11
|
+
// else "en-US" (when listed), else the first one.
|
|
11
12
|
|
|
12
|
-
import { applyLanguage,
|
|
13
|
+
import { applyLanguage, readBrowserLanguage, readFallbackLanguage, readIsLanguageChosen } from "../i18n/locale-service.ts";
|
|
13
14
|
import type { LangSource } from "../interfaces/app-types.ts";
|
|
14
15
|
import { findLanguageOption } from "../i18n/direction.ts";
|
|
15
16
|
import { readDefaultLanguageCode, toLanguageOptions } from "../utils/language-util.ts";
|
|
@@ -28,7 +29,10 @@ export function isLanguageListed(languageCode: string | undefined): boolean {
|
|
|
28
29
|
return Boolean(language);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* The language to switch to after a new list (when the user did not pick one): the backend isDefault,
|
|
34
|
+
* config.defaultLanguage, the browser / system language, "en-US", or the first one.
|
|
35
|
+
*/
|
|
32
36
|
export function readLanguageAfterUpdate(source: LangSource): string | undefined {
|
|
33
37
|
const languages = languagesSignal.peek();
|
|
34
38
|
const currentCode = localeSignal.peek();
|
|
@@ -39,9 +43,10 @@ export function readLanguageAfterUpdate(source: LangSource): string | undefined
|
|
|
39
43
|
}
|
|
40
44
|
const backendDefault = readDefaultLanguageCode(source);
|
|
41
45
|
const config = uiConfigSignal.peek();
|
|
42
|
-
const
|
|
46
|
+
const browserLanguage = readBrowserLanguage();
|
|
47
|
+
const fallbackLanguage = readFallbackLanguage(config);
|
|
43
48
|
const firstLanguage = languages[0];
|
|
44
|
-
const candidates = [backendDefault,
|
|
49
|
+
const candidates = [backendDefault, config?.defaultLanguage, browserLanguage, fallbackLanguage, firstLanguage?.code];
|
|
45
50
|
for (const candidate of candidates) {
|
|
46
51
|
const isListed = isLanguageListed(candidate);
|
|
47
52
|
if (isListed) {
|
|
@@ -63,7 +68,7 @@ export function setLanguages(source: LangSource): void {
|
|
|
63
68
|
}
|
|
64
69
|
|
|
65
70
|
/**
|
|
66
|
-
* Used by
|
|
71
|
+
* Used by the config loaders (and tests). Applies the value only when it changed.
|
|
67
72
|
* undefined / null -> keep config.languages (or no list yet); texts of config.defaultLanguage still load
|
|
68
73
|
* reply / list -> show it (a new reply replaces the list)
|
|
69
74
|
*/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// layout-choice-service.ts
|
|
2
|
+
// Which app layout the user picked — for a shell with microfrontends, where the settings MFE offers the choice and
|
|
3
|
+
// the shell renders the layout:
|
|
4
|
+
// "app" AppLayout: header + menu (sidebar or mega menu)
|
|
5
|
+
// "aside" AsideLayout: menu only, no header, no mega menu
|
|
6
|
+
//
|
|
7
|
+
// changeLayoutChoice("aside"); // saves ORG-LAYOUT_CHOICE (localStorage) and fires PREFERENCE_EVENT
|
|
8
|
+
// layoutChoiceSignal.value // "app" | "aside" — every copy of the library on the page follows at once
|
|
9
|
+
//
|
|
10
|
+
// The provider reads the saved choice on mount; preference-sync.ts follows later changes (same tab and other tabs).
|
|
11
|
+
// An MFE has no layout of its own: it reads layoutChoiceSignal to know whether the shell shows a header.
|
|
12
|
+
|
|
13
|
+
import { signal } from "@preact/signals-react";
|
|
14
|
+
import { AppStorage } from "../utils/app-storage.ts";
|
|
15
|
+
import { LAYOUT_CHOICE } from "../utils/storage-keys.ts";
|
|
16
|
+
|
|
17
|
+
export type LayoutChoice = "app" | "aside";
|
|
18
|
+
|
|
19
|
+
/** The current layout choice ("app" until a saved one is read). */
|
|
20
|
+
export const layoutChoiceSignal = signal<LayoutChoice>("app");
|
|
21
|
+
|
|
22
|
+
/** "aside" stays "aside"; anything else (nothing saved, an old value) is "app". */
|
|
23
|
+
export function toLayoutChoice(value: string | null | undefined): LayoutChoice {
|
|
24
|
+
return value === "aside" ? "aside" : "app";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Reads the saved choice into layoutChoiceSignal (not saved again). */
|
|
28
|
+
export function applySavedLayoutChoice(): void {
|
|
29
|
+
const savedValue = AppStorage.getText(LAYOUT_CHOICE);
|
|
30
|
+
const choice = toLayoutChoice(savedValue);
|
|
31
|
+
if (choice !== layoutChoiceSignal.peek()) {
|
|
32
|
+
layoutChoiceSignal.value = choice;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Picks a layout: saved as LAYOUT_CHOICE; the shell and every MFE on the page follow at once. */
|
|
37
|
+
export function changeLayoutChoice(choice: LayoutChoice): void {
|
|
38
|
+
layoutChoiceSignal.value = choice;
|
|
39
|
+
AppStorage.setData(LAYOUT_CHOICE, choice);
|
|
40
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// menu-service.ts
|
|
2
2
|
// Menus that come from the backend at runtime, separate from config.ts.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
4
|
+
// config.loadMenuNavigation: "/app-api/menu-access" // the provider calls it after sign in
|
|
5
5
|
// setMenu(menuResponse); // or call it yourself, for example after login
|
|
6
6
|
// setMenuLoading(); // sidebar shows a skeleton until setMenu()
|
|
7
7
|
//
|
|
@@ -44,7 +44,7 @@ export function clearMenu(): void {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* Used by
|
|
47
|
+
* Used by the config loaders (and tests). Applies the value only when it changed.
|
|
48
48
|
* undefined -> use config.navigation
|
|
49
49
|
* null -> still loading: menu skeleton (typical first value before the API answers)
|
|
50
50
|
* reply / list -> show it (a new reply object later replaces the menu)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// preference-sync.ts
|
|
2
|
-
// Keeps the theme, language
|
|
2
|
+
// Keeps the theme, language, menu mode and layout choice the same in every copy of the library on the page — for microfrontends,
|
|
3
3
|
// where each MFE bundles its own shared-lib-web — and in other tabs.
|
|
4
4
|
//
|
|
5
5
|
// AppStorage.setData(THEME | LANG, ...) -> fires window event PREFERENCE_EVENT (same tab, storage-keys.ts)
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
import { applyLanguage } from "../i18n/locale-service.ts";
|
|
10
10
|
import { isKnownTheme } from "../theme/theme-service.ts";
|
|
11
11
|
import { AppStorage, readPrefixedKey } from "../utils/app-storage.ts";
|
|
12
|
-
import { LANG, MENU_MODE, PREFERENCE_EVENT, THEME } from "../utils/storage-keys.ts";
|
|
12
|
+
import { LANG, LAYOUT_CHOICE, MENU_MODE, PREFERENCE_EVENT, THEME } from "../utils/storage-keys.ts";
|
|
13
|
+
import { applySavedLayoutChoice } from "./layout-choice-service.ts";
|
|
13
14
|
import { localeSignal, navigationModeSignal, themeSignal, uiConfigSignal } from "./signals.ts";
|
|
14
15
|
|
|
15
16
|
let isPreferenceSyncStarted = false;
|
|
@@ -45,7 +46,7 @@ export function applySavedMenuMode(): void {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
/** Applies the preference named by the key ("THEME", "LANG" or "
|
|
49
|
+
/** Applies the preference named by the key ("THEME", "LANG", "MENU_MODE" or "LAYOUT_CHOICE"). */
|
|
49
50
|
export function applySavedPreference(key: string): void {
|
|
50
51
|
if (key === THEME) {
|
|
51
52
|
applySavedTheme();
|
|
@@ -56,6 +57,9 @@ export function applySavedPreference(key: string): void {
|
|
|
56
57
|
if (key === MENU_MODE) {
|
|
57
58
|
applySavedMenuMode();
|
|
58
59
|
}
|
|
60
|
+
if (key === LAYOUT_CHOICE) {
|
|
61
|
+
applySavedLayoutChoice();
|
|
62
|
+
}
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
/** Same tab: another library copy (or this one) saved a preference. */
|
|
@@ -70,6 +74,7 @@ export function handleStorageEvent(event: StorageEvent): void {
|
|
|
70
74
|
const themeKey = readPrefixedKey(THEME);
|
|
71
75
|
const languageKey = readPrefixedKey(LANG);
|
|
72
76
|
const menuModeKey = readPrefixedKey(MENU_MODE);
|
|
77
|
+
const layoutChoiceKey = readPrefixedKey(LAYOUT_CHOICE);
|
|
73
78
|
if (event.key === themeKey) {
|
|
74
79
|
applySavedTheme();
|
|
75
80
|
}
|
|
@@ -79,6 +84,9 @@ export function handleStorageEvent(event: StorageEvent): void {
|
|
|
79
84
|
if (event.key === menuModeKey) {
|
|
80
85
|
applySavedMenuMode();
|
|
81
86
|
}
|
|
87
|
+
if (event.key === layoutChoiceKey) {
|
|
88
|
+
applySavedLayoutChoice();
|
|
89
|
+
}
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
/** Starts listening once (called by SharedWebUiProvider). */
|
package/src/state/signals.ts
CHANGED
|
@@ -15,6 +15,9 @@ import { ConstValue } from "dff-util";
|
|
|
15
15
|
import { toPagePath } from "../query/page-path.ts";
|
|
16
16
|
import { resolveDirection } from "../i18n/direction.ts";
|
|
17
17
|
import type {
|
|
18
|
+
AppType,
|
|
19
|
+
CompanyDetails,
|
|
20
|
+
CustomTheme,
|
|
18
21
|
Direction,
|
|
19
22
|
LanguageOption,
|
|
20
23
|
LocaleMessages,
|
|
@@ -24,17 +27,26 @@ import type {
|
|
|
24
27
|
UiConfig,
|
|
25
28
|
} from "../interfaces/ui-config.ts";
|
|
26
29
|
import type { ToastItem } from "../interfaces/toast.ts";
|
|
27
|
-
import {
|
|
30
|
+
import { buildDarkThemeNames } from "../theme/dark-themes.ts";
|
|
28
31
|
|
|
29
32
|
/** The config given to <SharedWebUiProvider>. null until the provider renders. */
|
|
30
33
|
export const uiConfigSignal = signal<UiConfig | null>(null);
|
|
31
34
|
|
|
35
|
+
/** What the app is: <SharedWebUiProvider type="spa" | "shell" | "mfe"> (default "spa"). */
|
|
36
|
+
export const appTypeSignal = signal<AppType>("spa");
|
|
37
|
+
|
|
32
38
|
/** Current language code. */
|
|
33
39
|
export const localeSignal = signal<string>(ConstValue.EMPTY);
|
|
34
40
|
|
|
35
41
|
/** Current DaisyUI theme. */
|
|
36
42
|
export const themeSignal = signal<Theme>(ConstValue.LIGHT);
|
|
37
43
|
|
|
44
|
+
/** The custom themes (config.customThemes or setCustomThemes), listed first in the theme switcher. */
|
|
45
|
+
export const customThemesSignal = signal<CustomTheme[]>([]);
|
|
46
|
+
|
|
47
|
+
/** The company details (config.loadCompanyDetails or setCompanyDetails); null = not here yet (config values are used). */
|
|
48
|
+
export const companyDetailsSignal = signal<CompanyDetails | null>(null);
|
|
49
|
+
|
|
38
50
|
/** Messages of the current language. */
|
|
39
51
|
export const translationSignal = signal<LocaleMessages>({});
|
|
40
52
|
|
|
@@ -83,10 +95,29 @@ export function toPageFromPath(pathname: string): string {
|
|
|
83
95
|
return pathname.slice(0, end);
|
|
84
96
|
}
|
|
85
97
|
|
|
98
|
+
/** true when pages live in the path: layout.pageMode "path", or no pageMode and the app type "shell". */
|
|
99
|
+
export function readIsPathPageMode(config: UiConfig | null): boolean {
|
|
100
|
+
const pageMode = config?.layout?.pageMode;
|
|
101
|
+
if (pageMode) {
|
|
102
|
+
return pageMode === "path";
|
|
103
|
+
}
|
|
104
|
+
return appTypeSignal.value === "shell";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** config.homePath (not used by an "mfe": the shell owns the home page), else "/". */
|
|
108
|
+
function readHomePage(config: UiConfig | null): string {
|
|
109
|
+
const isMfe = appTypeSignal.value === "mfe";
|
|
110
|
+
if (isMfe) {
|
|
111
|
+
return DEFAULT_HOME_PAGE;
|
|
112
|
+
}
|
|
113
|
+
return config?.homePath ?? DEFAULT_HOME_PAGE;
|
|
114
|
+
}
|
|
115
|
+
|
|
86
116
|
function readCurrentPage(): string {
|
|
87
117
|
const config = uiConfigSignal.value;
|
|
88
|
-
const homePage = config
|
|
89
|
-
|
|
118
|
+
const homePage = readHomePage(config);
|
|
119
|
+
const isPathMode = readIsPathPageMode(config);
|
|
120
|
+
if (isPathMode) {
|
|
90
121
|
const pathname = pathnameSignal.value;
|
|
91
122
|
const pathPage = toPageFromPath(pathname);
|
|
92
123
|
return pathPage || homePage;
|
|
@@ -174,7 +205,8 @@ export const directionSignal = computed(readDirection);
|
|
|
174
205
|
function readIsDarkTheme(): boolean {
|
|
175
206
|
const config = uiConfigSignal.value;
|
|
176
207
|
const theme = themeSignal.value;
|
|
177
|
-
const
|
|
208
|
+
const customThemes = customThemesSignal.value;
|
|
209
|
+
const darkThemes = buildDarkThemeNames(config?.darkThemes, customThemes);
|
|
178
210
|
const isDark = darkThemes.includes(theme);
|
|
179
211
|
return isDark;
|
|
180
212
|
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// custom-themes.ts
|
|
2
|
+
// Custom DaisyUI themes from plain data (a JSON file or an API reply) — no CSS file, no rebuild.
|
|
3
|
+
// The themes are an object keyed by theme name ("name" inside is optional, the key is the name):
|
|
4
|
+
//
|
|
5
|
+
// { "org-light": { "isDark": false, "name": "org-light", "variables": { "color-primary": "oklch(55.8% 0.154 249.1)", ... } },
|
|
6
|
+
// "org-dark": { "isDark": true, "name": "org-dark", "variables": { ... } } }
|
|
7
|
+
//
|
|
8
|
+
// A plain list [{ "name": "org-light", ... }] is accepted too.
|
|
9
|
+
//
|
|
10
|
+
// setCustomThemes(list) writes ONE <style> element:
|
|
11
|
+
// [data-theme="org-light"] { color-scheme: light; --color-primary: oklch(55.8% 0.154 249.1); ... }
|
|
12
|
+
// DaisyUI components read these CSS variables, so a custom theme works like a built-in one, and the theme switcher
|
|
13
|
+
// lists it first. Pass them in config.customThemes, load them lazily with config.loadThemes (like loadLocale),
|
|
14
|
+
// or set them any time later with setCustomThemes(json).
|
|
15
|
+
// The built-in DaisyUI themes still come from your CSS: @plugin "daisyui" { themes: all; }.
|
|
16
|
+
|
|
17
|
+
import type { CustomTheme, CustomThemeMap, CustomThemes, CustomThemesModule, UiConfig } from "../interfaces/ui-config.ts";
|
|
18
|
+
import { customThemesSignal, uiConfigSignal } from "../state/signals.ts";
|
|
19
|
+
import { isSignalSource } from "../utils/signal-source.ts";
|
|
20
|
+
import { applySavedThemeWhenKnown, leaveUnknownTheme } from "./theme-service.ts";
|
|
21
|
+
|
|
22
|
+
const STYLE_ELEMENT_ID = "shared-lib-web-custom-themes";
|
|
23
|
+
/** Theme names: lowercase letters, digits and "-" (they go into a CSS selector). */
|
|
24
|
+
const SAFE_NAME = /^[a-z0-9][a-z0-9-]*$/;
|
|
25
|
+
/** Variable names, with or without the leading "--". */
|
|
26
|
+
const SAFE_VARIABLE = /^(--)?[a-z0-9][a-z0-9-]*$/i;
|
|
27
|
+
/** Characters that could end the CSS rule (values come from JSON, maybe from a server). */
|
|
28
|
+
const UNSAFE_VALUE = /[;{}<>"\\]/;
|
|
29
|
+
const VARIABLE_PREFIX = "--";
|
|
30
|
+
|
|
31
|
+
/** "color-primary" -> "--color-primary" ("--color-primary" stays). */
|
|
32
|
+
function toVariableName(key: string): string {
|
|
33
|
+
const hasPrefix = key.startsWith(VARIABLE_PREFIX);
|
|
34
|
+
return hasPrefix ? key : `${VARIABLE_PREFIX}${key}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The CSS lines of the variables; unsafe names or values are skipped. */
|
|
38
|
+
function buildVariableLines(variables: Record<string, string>): string[] {
|
|
39
|
+
const lines: string[] = [];
|
|
40
|
+
const entries = Object.entries(variables);
|
|
41
|
+
for (const [key, value] of entries) {
|
|
42
|
+
const valueText = String(value);
|
|
43
|
+
const isSafeKey = SAFE_VARIABLE.test(key);
|
|
44
|
+
const isUnsafeValue = UNSAFE_VALUE.test(valueText);
|
|
45
|
+
if (!isSafeKey || isUnsafeValue) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const variableName = toVariableName(key);
|
|
49
|
+
lines.push(` ${variableName}: ${valueText};`);
|
|
50
|
+
}
|
|
51
|
+
return lines;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** true when the theme has a usable name. */
|
|
55
|
+
export function isValidCustomTheme(theme: CustomTheme): boolean {
|
|
56
|
+
const hasName = typeof theme?.name === "string";
|
|
57
|
+
return hasName && SAFE_NAME.test(theme.name);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The CSS rule of one custom theme: [data-theme="name"] { color-scheme: ...; --color-primary: ...; } */
|
|
61
|
+
export function buildCustomThemeCss(theme: CustomTheme): string {
|
|
62
|
+
const isValid = isValidCustomTheme(theme);
|
|
63
|
+
if (!isValid) {
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
const colorScheme = theme.isDark ? "dark" : "light";
|
|
67
|
+
const variableLines = buildVariableLines(theme.variables ?? {});
|
|
68
|
+
const bodyLines = [` color-scheme: ${colorScheme};`, ...variableLines];
|
|
69
|
+
const bodyText = bodyLines.join("\n");
|
|
70
|
+
return `[data-theme="${theme.name}"] {\n${bodyText}\n}`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Writes the CSS into the one <style> element of the custom themes (created on first use). */
|
|
74
|
+
function writeThemeStyle(cssText: string): void {
|
|
75
|
+
if (typeof document === "undefined") {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
let styleElement = document.getElementById(STYLE_ELEMENT_ID);
|
|
79
|
+
if (!styleElement) {
|
|
80
|
+
styleElement = document.createElement("style");
|
|
81
|
+
styleElement.id = STYLE_ELEMENT_ID;
|
|
82
|
+
document.head.append(styleElement);
|
|
83
|
+
}
|
|
84
|
+
styleElement.textContent = cssText;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** true for a plain object (not null, not a list). */
|
|
88
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
89
|
+
const isObject = typeof value === "object" && value !== null;
|
|
90
|
+
return isObject && !Array.isArray(value);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** The themes of an object keyed by theme name; an entry without "name" gets its key as name. */
|
|
94
|
+
function readThemeMapEntries(themeMap: CustomThemeMap): CustomTheme[] {
|
|
95
|
+
const themeList: CustomTheme[] = [];
|
|
96
|
+
const entries = Object.entries(themeMap);
|
|
97
|
+
for (const [key, entry] of entries) {
|
|
98
|
+
if (!isPlainObject(entry)) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const hasName = typeof entry.name === "string";
|
|
102
|
+
const name = hasName ? entry.name : key;
|
|
103
|
+
themeList.push({ ...entry, name } as CustomTheme);
|
|
104
|
+
}
|
|
105
|
+
return themeList;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The custom themes as a list: an object keyed by theme name ({ "org-light": {...}, "org-dark": {...} }) is turned
|
|
110
|
+
* into a list (in key order); a list stays as it is; anything else is an empty list.
|
|
111
|
+
*/
|
|
112
|
+
export function toCustomThemeList(themes?: CustomThemes | null): CustomTheme[] {
|
|
113
|
+
if (Array.isArray(themes)) {
|
|
114
|
+
return themes;
|
|
115
|
+
}
|
|
116
|
+
if (isPlainObject(themes)) {
|
|
117
|
+
return readThemeMapEntries(themes as CustomThemeMap);
|
|
118
|
+
}
|
|
119
|
+
return [];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Sets the custom themes (replaces the earlier ones): writes their CSS, adds them to the theme switcher and,
|
|
124
|
+
* when the saved theme is one of them, switches to it. Accepts the parsed JSON as it is — the object keyed by theme
|
|
125
|
+
* name, or a list; invalid entries are skipped.
|
|
126
|
+
*/
|
|
127
|
+
export function setCustomThemes(themes?: CustomThemes | null): void {
|
|
128
|
+
const validThemes: CustomTheme[] = [];
|
|
129
|
+
const givenThemes = toCustomThemeList(themes);
|
|
130
|
+
for (const theme of givenThemes) {
|
|
131
|
+
const isValid = isValidCustomTheme(theme);
|
|
132
|
+
if (isValid) {
|
|
133
|
+
validThemes.push(theme);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const cssParts = validThemes.map(buildCustomThemeCss);
|
|
137
|
+
const cssText = cssParts.join("\n\n");
|
|
138
|
+
writeThemeStyle(cssText);
|
|
139
|
+
customThemesSignal.value = validThemes;
|
|
140
|
+
applySavedThemeWhenKnown();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** true when the value is a JSON module ({ default: themes }), not a theme map with a theme called "default". */
|
|
144
|
+
function isThemesJsonModule(themesModule: CustomThemesModule): themesModule is { default: CustomThemes } {
|
|
145
|
+
if (!isPlainObject(themesModule)) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const defaultValue = themesModule.default;
|
|
149
|
+
if (Array.isArray(defaultValue)) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
return isPlainObject(defaultValue) && !("variables" in defaultValue);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** The themes inside a themes module as a list: the object keyed by name or the list, or the default export of a JSON module. */
|
|
156
|
+
export function unwrapThemesModule(themesModule: CustomThemesModule): CustomTheme[] {
|
|
157
|
+
const isJsonModule = isThemesJsonModule(themesModule);
|
|
158
|
+
if (isJsonModule) {
|
|
159
|
+
return toCustomThemeList(themesModule.default);
|
|
160
|
+
}
|
|
161
|
+
return toCustomThemeList(themesModule as CustomThemes);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** baseThemes + extraThemes; a theme with the same name in extraThemes replaces the one in baseThemes. */
|
|
165
|
+
export function mergeCustomThemes(baseThemes: CustomTheme[], extraThemes: CustomTheme[]): CustomTheme[] {
|
|
166
|
+
const mergedThemes: CustomTheme[] = [];
|
|
167
|
+
const extraNames: string[] = [];
|
|
168
|
+
for (const extraTheme of extraThemes) {
|
|
169
|
+
extraNames.push(extraTheme?.name);
|
|
170
|
+
}
|
|
171
|
+
for (const baseTheme of baseThemes) {
|
|
172
|
+
const isReplaced = extraNames.includes(baseTheme.name);
|
|
173
|
+
if (!isReplaced) {
|
|
174
|
+
mergedThemes.push(baseTheme);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
mergedThemes.push(...extraThemes);
|
|
178
|
+
return mergedThemes;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Configs whose loadThemes already ran (StrictMode mounts twice). */
|
|
182
|
+
const loadedConfigs = new WeakSet<UiConfig>();
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Runs config.loadThemes once per config and adds the result to config.customThemes.
|
|
186
|
+
* When it fails, or the saved theme is not in the result, the default theme is used.
|
|
187
|
+
*/
|
|
188
|
+
export async function loadConfigThemes(config: UiConfig): Promise<void> {
|
|
189
|
+
const loadThemes = config.loadThemes;
|
|
190
|
+
const isLoaded = loadedConfigs.has(config);
|
|
191
|
+
if (typeof loadThemes !== "function" || isLoaded) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
loadedConfigs.add(config);
|
|
195
|
+
try {
|
|
196
|
+
const themesModule = await loadThemes();
|
|
197
|
+
const loadedThemes = unwrapThemesModule(themesModule);
|
|
198
|
+
const isConfigStillActive = uiConfigSignal.peek() === config;
|
|
199
|
+
if (isConfigStillActive) {
|
|
200
|
+
const baseThemes = toCustomThemeList(config.customThemes);
|
|
201
|
+
const mergedThemes = mergeCustomThemes(baseThemes, loadedThemes);
|
|
202
|
+
setCustomThemes(mergedThemes);
|
|
203
|
+
}
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.error("shared-lib-web: could not load the custom themes (config.loadThemes).", error);
|
|
206
|
+
}
|
|
207
|
+
leaveUnknownTheme();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** One value of a loadThemes signal: null = not here yet; a list (or JSON module) replaces the loaded themes. */
|
|
211
|
+
function applyThemesFromSignal(config: UiConfig, themesModule: CustomThemesModule | null): void {
|
|
212
|
+
const isConfigActive = uiConfigSignal.peek() === config;
|
|
213
|
+
if (!themesModule || !isConfigActive) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const loadedThemes = unwrapThemesModule(themesModule);
|
|
217
|
+
const baseThemes = toCustomThemeList(config.customThemes);
|
|
218
|
+
const mergedThemes = mergeCustomThemes(baseThemes, loadedThemes);
|
|
219
|
+
setCustomThemes(mergedThemes);
|
|
220
|
+
leaveUnknownTheme();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Follows config.loadThemes when it is a signal. Returns the stop function (nothing to stop otherwise). */
|
|
224
|
+
export function followConfigThemes(config: UiConfig): () => void {
|
|
225
|
+
const themesSource = config.loadThemes;
|
|
226
|
+
if (!isSignalSource(themesSource)) {
|
|
227
|
+
return stopNothing;
|
|
228
|
+
}
|
|
229
|
+
const applyThemes = applyThemesFromSignal.bind(null, config);
|
|
230
|
+
return themesSource.subscribe(applyThemes as (value: unknown) => void);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** Nothing to clean up. */
|
|
234
|
+
function stopNothing(): void {
|
|
235
|
+
return;
|
|
236
|
+
}
|
package/src/theme/dark-themes.ts
CHANGED
|
@@ -1,8 +1,51 @@
|
|
|
1
1
|
// dark-themes.ts
|
|
2
|
-
// DaisyUI 5
|
|
3
|
-
//
|
|
2
|
+
// The DaisyUI 5 theme names, and which of them are dark ("color-scheme: dark": dark logos, dark markdown editor).
|
|
3
|
+
// config.themes defaults to DAISYUI_THEMES; config.darkThemes replaces DEFAULT_DARK_THEMES.
|
|
4
|
+
// Custom themes (config.customThemes / setCustomThemes) are added to both lists by their own isDark flag.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
import type { CustomTheme, Theme } from "../interfaces/ui-config.ts";
|
|
7
|
+
|
|
8
|
+
/** All 35 DaisyUI 5 themes (enable them in CSS with @plugin "daisyui" { themes: all; }). */
|
|
9
|
+
export const DAISYUI_THEMES: Theme[] = [
|
|
10
|
+
"light",
|
|
11
|
+
"dark",
|
|
12
|
+
"cupcake",
|
|
13
|
+
"bumblebee",
|
|
14
|
+
"emerald",
|
|
15
|
+
"corporate",
|
|
16
|
+
"synthwave",
|
|
17
|
+
"retro",
|
|
18
|
+
"cyberpunk",
|
|
19
|
+
"valentine",
|
|
20
|
+
"halloween",
|
|
21
|
+
"garden",
|
|
22
|
+
"forest",
|
|
23
|
+
"aqua",
|
|
24
|
+
"lofi",
|
|
25
|
+
"pastel",
|
|
26
|
+
"fantasy",
|
|
27
|
+
"wireframe",
|
|
28
|
+
"black",
|
|
29
|
+
"luxury",
|
|
30
|
+
"dracula",
|
|
31
|
+
"cmyk",
|
|
32
|
+
"autumn",
|
|
33
|
+
"business",
|
|
34
|
+
"acid",
|
|
35
|
+
"lemonade",
|
|
36
|
+
"night",
|
|
37
|
+
"coffee",
|
|
38
|
+
"winter",
|
|
39
|
+
"dim",
|
|
40
|
+
"nord",
|
|
41
|
+
"sunset",
|
|
42
|
+
"caramellatte",
|
|
43
|
+
"abyss",
|
|
44
|
+
"silk",
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
/** The dark DaisyUI 5 themes. */
|
|
48
|
+
export const DEFAULT_DARK_THEMES: Theme[] = [
|
|
6
49
|
"dark",
|
|
7
50
|
"aqua",
|
|
8
51
|
"synthwave",
|
|
@@ -18,3 +61,37 @@ export const DEFAULT_DARK_THEMES = [
|
|
|
18
61
|
"sunset",
|
|
19
62
|
"abyss",
|
|
20
63
|
];
|
|
64
|
+
|
|
65
|
+
/** The dark theme names: the dark custom themes + (darkThemes, else the DaisyUI dark themes). */
|
|
66
|
+
export function buildDarkThemeNames(darkThemes: Theme[] | undefined, customThemes: CustomTheme[]): Theme[] {
|
|
67
|
+
const names: Theme[] = [];
|
|
68
|
+
for (const customTheme of customThemes) {
|
|
69
|
+
if (customTheme.isDark) {
|
|
70
|
+
names.push(customTheme.name);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const baseNames = darkThemes ?? DEFAULT_DARK_THEMES;
|
|
74
|
+
for (const name of baseNames) {
|
|
75
|
+
const isAdded = names.includes(name);
|
|
76
|
+
if (!isAdded) {
|
|
77
|
+
names.push(name);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return names;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The theme names of the switcher: the custom themes first, then (themes, else all DaisyUI themes). */
|
|
84
|
+
export function buildThemeNames(themes: Theme[] | undefined, customThemes: CustomTheme[]): Theme[] {
|
|
85
|
+
const names: Theme[] = [];
|
|
86
|
+
for (const customTheme of customThemes) {
|
|
87
|
+
names.push(customTheme.name);
|
|
88
|
+
}
|
|
89
|
+
const baseNames = themes ?? DAISYUI_THEMES;
|
|
90
|
+
for (const name of baseNames) {
|
|
91
|
+
const isAdded = names.includes(name);
|
|
92
|
+
if (!isAdded) {
|
|
93
|
+
names.push(name);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return names;
|
|
97
|
+
}
|
package/src/theme/logo.ts
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
// logo.ts
|
|
2
|
-
// Picks the logo for the current theme.
|
|
2
|
+
// Picks the logo for the current theme. Company details (loadCompanyDetails / setCompanyDetails) win over the config.
|
|
3
3
|
|
|
4
|
-
import type { UiConfig } from "../interfaces/ui-config.ts";
|
|
4
|
+
import type { CompanyDetails, UiConfig } from "../interfaces/ui-config.ts";
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/** The company logo for the theme: logoDarkUrl on dark themes (when set), else logoUrl. */
|
|
7
|
+
function readCompanyLogoUrl(details: CompanyDetails | null | undefined, isDarkTheme: boolean): string | undefined {
|
|
8
|
+
if (isDarkTheme && details?.logoDarkUrl) {
|
|
9
|
+
return details.logoDarkUrl;
|
|
10
|
+
}
|
|
11
|
+
return details?.logoUrl;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The logo URL. Dark themes: company logoDarkUrl, company logoUrl, config.logoDarkUrl, config.logoUrl.
|
|
16
|
+
* Light themes: company logoUrl, config.logoUrl.
|
|
17
|
+
*/
|
|
18
|
+
export function readLogoUrl(config: UiConfig, isDarkTheme: boolean, details?: CompanyDetails | null): string | undefined {
|
|
19
|
+
const companyLogoUrl = readCompanyLogoUrl(details, isDarkTheme);
|
|
20
|
+
if (companyLogoUrl) {
|
|
21
|
+
return companyLogoUrl;
|
|
22
|
+
}
|
|
8
23
|
if (isDarkTheme && config.logoDarkUrl) {
|
|
9
24
|
return config.logoDarkUrl;
|
|
10
25
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"org-dark": {
|
|
3
|
+
"isDark": true,
|
|
4
|
+
"name": "org-dark",
|
|
5
|
+
"variables": {
|
|
6
|
+
"border": "1px",
|
|
7
|
+
"color-accent": "oklch(70.4% 0.04 256.8)",
|
|
8
|
+
"color-accent-content": "oklch(12.9% 0.042 264.7)",
|
|
9
|
+
"color-base-100": "oklch(25.5% 0.04 264.5)",
|
|
10
|
+
"color-base-200": "oklch(20.8% 0.042 265.8)",
|
|
11
|
+
"color-base-300": "oklch(32% 0.04 262)",
|
|
12
|
+
"color-base-content": "oklch(92.9% 0.013 255.5)",
|
|
13
|
+
"color-error": "oklch(70.4% 0.191 22.2)",
|
|
14
|
+
"color-error-content": "oklch(25.8% 0.092 26)",
|
|
15
|
+
"color-info": "oklch(78.9% 0.154 211.5)",
|
|
16
|
+
"color-info-content": "oklch(30.2% 0.056 229.7)",
|
|
17
|
+
"color-neutral": "oklch(37.2% 0.044 257.3)",
|
|
18
|
+
"color-neutral-content": "oklch(96.8% 0.007 247.9)",
|
|
19
|
+
"color-primary": "oklch(74.6% 0.16 232.7)",
|
|
20
|
+
"color-primary-content": "oklch(29.3% 0.066 243.2)",
|
|
21
|
+
"color-secondary": "oklch(82.8% 0.189 84.4)",
|
|
22
|
+
"color-secondary-content": "oklch(27.9% 0.077 45.6)",
|
|
23
|
+
"color-success": "oklch(79.2% 0.209 151.7)",
|
|
24
|
+
"color-success-content": "oklch(26.6% 0.065 152.9)",
|
|
25
|
+
"color-warning": "oklch(75% 0.183 55.9)",
|
|
26
|
+
"color-warning-content": "oklch(26.6% 0.079 36.3)",
|
|
27
|
+
"depth": "1",
|
|
28
|
+
"noise": "0",
|
|
29
|
+
"radius-box": "0.75rem",
|
|
30
|
+
"radius-field": "0.5rem",
|
|
31
|
+
"radius-selector": "1rem",
|
|
32
|
+
"size-field": "0.25rem",
|
|
33
|
+
"size-selector": "0.25rem"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"org-light": {
|
|
37
|
+
"isDark": false,
|
|
38
|
+
"name": "org-light",
|
|
39
|
+
"variables": {
|
|
40
|
+
"border": "1px",
|
|
41
|
+
"color-accent": "oklch(55.4% 0.046 257.4)",
|
|
42
|
+
"color-accent-content": "oklch(98.4% 0.003 247.9)",
|
|
43
|
+
"color-base-100": "oklch(100% 0 0)",
|
|
44
|
+
"color-base-200": "oklch(96.8% 0.007 247.9)",
|
|
45
|
+
"color-base-300": "oklch(92.9% 0.013 255.5)",
|
|
46
|
+
"color-base-content": "oklch(20.8% 0.042 265.8)",
|
|
47
|
+
"color-error": "oklch(55% 0.23 27.3)",
|
|
48
|
+
"color-error-content": "oklch(97.1% 0.013 17.4)",
|
|
49
|
+
"color-info": "oklch(71.5% 0.143 215.2)",
|
|
50
|
+
"color-info-content": "oklch(30.2% 0.056 229.7)",
|
|
51
|
+
"color-neutral": "oklch(27.9% 0.041 260)",
|
|
52
|
+
"color-neutral-content": "oklch(98.4% 0.003 247.9)",
|
|
53
|
+
"color-primary": "oklch(55.8% 0.154 249.1)",
|
|
54
|
+
"color-primary-content": "oklch(98.5% 0.01 240)",
|
|
55
|
+
"color-secondary": "oklch(76.9% 0.188 70.1)",
|
|
56
|
+
"color-secondary-content": "oklch(27.9% 0.077 45.6)",
|
|
57
|
+
"color-success": "oklch(52.7% 0.154 150.1)",
|
|
58
|
+
"color-success-content": "oklch(98.2% 0.018 155.8)",
|
|
59
|
+
"color-warning": "oklch(75% 0.183 55.9)",
|
|
60
|
+
"color-warning-content": "oklch(26.6% 0.079 36.3)",
|
|
61
|
+
"depth": "1",
|
|
62
|
+
"noise": "0",
|
|
63
|
+
"radius-box": "0.75rem",
|
|
64
|
+
"radius-field": "0.5rem",
|
|
65
|
+
"radius-selector": "1rem",
|
|
66
|
+
"size-field": "0.25rem",
|
|
67
|
+
"size-selector": "0.25rem"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|