Establish Mission Core as the shared theme foundation

This commit is contained in:
DCCONSTRUCTIONS
2026-11-05 13:46:35 +03:00
parent 06cb8ad4cd
commit 3750a94200
17 changed files with 240 additions and 107 deletions
+11 -2
View File
@@ -15,7 +15,7 @@ export interface NodedcMaterial {
export interface ApplyThemeOptions {
theme?: NodedcTheme;
/** Operator UI qualified against Mission Core; opt-in across portals. */
/** Mission Core is the canonical foundation. `default` is legacy compatibility. */
appearance?: "default" | "mission";
/** Flat surfaces remove decorative edges; keyboard focus uses a contrasting fill. */
edges?: "default" | "flat";
@@ -23,6 +23,15 @@ export interface ApplyThemeOptions {
material?: NodedcMaterial;
}
/** Complete shared foundation; colors live exclusively in @nodedc/tokens/themes.css. */
export const missionDarkTheme = Object.freeze({
theme: "dark", appearance: "mission", edges: "flat",
} as const satisfies ApplyThemeOptions);
export const missionLightTheme = Object.freeze({
theme: "light", appearance: "mission", edges: "flat",
} as const satisfies ApplyThemeOptions);
function formatRgb([red, green, blue]: RgbTuple): string {
return `${red} ${green} ${blue}`;
}
@@ -33,7 +42,7 @@ function clampOpacity(value: number): number {
export function applyNodedcTheme(
target: HTMLElement,
{ theme = "dark", accent, material, appearance = "default", edges = "default" }: ApplyThemeOptions = {},
{ theme = "dark", accent, material, appearance = "mission", edges = "flat" }: ApplyThemeOptions = {},
): void {
target.dataset.nodedcTheme = theme;
target.dataset.nodedcAppearance = appearance;