Prettier formatting
This commit is contained in:
parent
9f4a3197de
commit
010117bed2
6 changed files with 99 additions and 57 deletions
|
|
@ -96,7 +96,10 @@ export const DEFAULT_THEME_CONFIG: ThemeConfig = {
|
||||||
uiEffects: true,
|
uiEffects: true,
|
||||||
motionEffects: true,
|
motionEffects: true,
|
||||||
dynamicAccent: true,
|
dynamicAccent: true,
|
||||||
gradient: { ...DEFAULT_GRADIENT_CONFIG, stops: [...DEFAULT_GRADIENT_CONFIG.stops] },
|
gradient: {
|
||||||
|
...DEFAULT_GRADIENT_CONFIG,
|
||||||
|
stops: [...DEFAULT_GRADIENT_CONFIG.stops],
|
||||||
|
},
|
||||||
custom: { ...DEFAULT_CUSTOM_TOKENS },
|
custom: { ...DEFAULT_CUSTOM_TOKENS },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -154,7 +157,10 @@ export function normalizeThemeConfig(
|
||||||
? rawGrad.stops
|
? rawGrad.stops
|
||||||
.slice(0, 3)
|
.slice(0, 3)
|
||||||
.map((s, idx) =>
|
.map((s, idx) =>
|
||||||
normalizeStoredHex(s, DEFAULT_GRADIENT_CONFIG.stops[idx] ?? "#0f172a"),
|
normalizeStoredHex(
|
||||||
|
s,
|
||||||
|
DEFAULT_GRADIENT_CONFIG.stops[idx] ?? "#0f172a",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: [...DEFAULT_GRADIENT_CONFIG.stops];
|
: [...DEFAULT_GRADIENT_CONFIG.stops];
|
||||||
while (rawStops.length < 2) {
|
while (rawStops.length < 2) {
|
||||||
|
|
@ -185,7 +191,10 @@ export function normalizeThemeConfig(
|
||||||
applyToPanels: rawGrad?.applyToPanels ?? true,
|
applyToPanels: rawGrad?.applyToPanels ?? true,
|
||||||
},
|
},
|
||||||
custom: {
|
custom: {
|
||||||
bgDeep: normalizeStoredHex(rawCustom?.bgDeep, DEFAULT_CUSTOM_TOKENS.bgDeep),
|
bgDeep: normalizeStoredHex(
|
||||||
|
rawCustom?.bgDeep,
|
||||||
|
DEFAULT_CUSTOM_TOKENS.bgDeep,
|
||||||
|
),
|
||||||
bgPanelSolid: normalizeStoredHex(
|
bgPanelSolid: normalizeStoredHex(
|
||||||
rawCustom?.bgPanelSolid,
|
rawCustom?.bgPanelSolid,
|
||||||
DEFAULT_CUSTOM_TOKENS.bgPanelSolid,
|
DEFAULT_CUSTOM_TOKENS.bgPanelSolid,
|
||||||
|
|
@ -194,18 +203,27 @@ export function normalizeThemeConfig(
|
||||||
rawCustom?.bgElevated,
|
rawCustom?.bgElevated,
|
||||||
DEFAULT_CUSTOM_TOKENS.bgElevated,
|
DEFAULT_CUSTOM_TOKENS.bgElevated,
|
||||||
),
|
),
|
||||||
border: normalizeStoredHex(rawCustom?.border, DEFAULT_CUSTOM_TOKENS.border),
|
border: normalizeStoredHex(
|
||||||
|
rawCustom?.border,
|
||||||
|
DEFAULT_CUSTOM_TOKENS.border,
|
||||||
|
),
|
||||||
text: normalizeStoredHex(rawCustom?.text, DEFAULT_CUSTOM_TOKENS.text),
|
text: normalizeStoredHex(rawCustom?.text, DEFAULT_CUSTOM_TOKENS.text),
|
||||||
textDim: normalizeStoredHex(
|
textDim: normalizeStoredHex(
|
||||||
rawCustom?.textDim,
|
rawCustom?.textDim,
|
||||||
DEFAULT_CUSTOM_TOKENS.textDim,
|
DEFAULT_CUSTOM_TOKENS.textDim,
|
||||||
),
|
),
|
||||||
accent: normalizeStoredHex(rawCustom?.accent, DEFAULT_CUSTOM_TOKENS.accent),
|
accent: normalizeStoredHex(
|
||||||
|
rawCustom?.accent,
|
||||||
|
DEFAULT_CUSTOM_TOKENS.accent,
|
||||||
|
),
|
||||||
glow: normalizeStoredHex(rawCustom?.glow, DEFAULT_CUSTOM_TOKENS.glow),
|
glow: normalizeStoredHex(rawCustom?.glow, DEFAULT_CUSTOM_TOKENS.glow),
|
||||||
green: normalizeStoredHex(rawCustom?.green, DEFAULT_CUSTOM_TOKENS.green),
|
green: normalizeStoredHex(rawCustom?.green, DEFAULT_CUSTOM_TOKENS.green),
|
||||||
amber: normalizeStoredHex(rawCustom?.amber, DEFAULT_CUSTOM_TOKENS.amber),
|
amber: normalizeStoredHex(rawCustom?.amber, DEFAULT_CUSTOM_TOKENS.amber),
|
||||||
red: normalizeStoredHex(rawCustom?.red, DEFAULT_CUSTOM_TOKENS.red),
|
red: normalizeStoredHex(rawCustom?.red, DEFAULT_CUSTOM_TOKENS.red),
|
||||||
violet: normalizeStoredHex(rawCustom?.violet, DEFAULT_CUSTOM_TOKENS.violet),
|
violet: normalizeStoredHex(
|
||||||
|
rawCustom?.violet,
|
||||||
|
DEFAULT_CUSTOM_TOKENS.violet,
|
||||||
|
),
|
||||||
panelOpacity: Number.isFinite(opacityNum)
|
panelOpacity: Number.isFinite(opacityNum)
|
||||||
? Math.max(0.65, Math.min(1, opacityNum))
|
? Math.max(0.65, Math.min(1, opacityNum))
|
||||||
: DEFAULT_CUSTOM_TOKENS.panelOpacity,
|
: DEFAULT_CUSTOM_TOKENS.panelOpacity,
|
||||||
|
|
@ -245,7 +263,9 @@ export function getSettings(): ClientSettings {
|
||||||
) as LegacyClientSettings;
|
) as LegacyClientSettings;
|
||||||
cachedSettings = {
|
cachedSettings = {
|
||||||
quality:
|
quality:
|
||||||
raw.quality === "low" || raw.quality === "medium" ? raw.quality : "high",
|
raw.quality === "low" || raw.quality === "medium"
|
||||||
|
? raw.quality
|
||||||
|
: "high",
|
||||||
sound: raw.sound ?? true,
|
sound: raw.sound ?? true,
|
||||||
notifications: raw.notifications ?? true,
|
notifications: raw.notifications ?? true,
|
||||||
theme: normalizeThemeConfig(raw.theme, raw),
|
theme: normalizeThemeConfig(raw.theme, raw),
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,7 @@ import {
|
||||||
type WikiScreenParams,
|
type WikiScreenParams,
|
||||||
} from "./state.js";
|
} from "./state.js";
|
||||||
import { applyVisualPreferences } from "./theme.js";
|
import { applyVisualPreferences } from "./theme.js";
|
||||||
import {
|
import { initNotificationDrawer, initTooltipController, toast } from "./ui.js";
|
||||||
initNotificationDrawer,
|
|
||||||
initTooltipController,
|
|
||||||
toast,
|
|
||||||
} from "./ui.js";
|
|
||||||
import { renderAuth } from "./screens/auth.js";
|
import { renderAuth } from "./screens/auth.js";
|
||||||
import { renderContracts } from "./screens/contracts.js";
|
import { renderContracts } from "./screens/contracts.js";
|
||||||
import { renderDashboard } from "./screens/dashboard.js";
|
import { renderDashboard } from "./screens/dashboard.js";
|
||||||
|
|
|
||||||
|
|
@ -309,11 +309,7 @@ export function mixHex(hexA: string, hexB: string, weightB: number): string {
|
||||||
const w = Math.max(0, Math.min(1, weightB));
|
const w = Math.max(0, Math.min(1, weightB));
|
||||||
const [r1, g1, b1] = hexToRgb(hexA);
|
const [r1, g1, b1] = hexToRgb(hexA);
|
||||||
const [r2, g2, b2] = hexToRgb(hexB);
|
const [r2, g2, b2] = hexToRgb(hexB);
|
||||||
return rgbToHex(
|
return rgbToHex(r1 + (r2 - r1) * w, g1 + (g2 - g1) * w, b1 + (b2 - b1) * w);
|
||||||
r1 + (r2 - r1) * w,
|
|
||||||
g1 + (g2 - g1) * w,
|
|
||||||
b1 + (b2 - b1) * w,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isLightHex(hex: string): boolean {
|
export function isLightHex(hex: string): boolean {
|
||||||
|
|
@ -398,7 +394,11 @@ function applyDerivedTokens(
|
||||||
const bgHover = mixHex(tokens.bgElevated, tokens.text, light ? 0.1 : 0.08);
|
const bgHover = mixHex(tokens.bgElevated, tokens.text, light ? 0.1 : 0.08);
|
||||||
const borderBright = mixHex(tokens.border, tokens.text, 0.18);
|
const borderBright = mixHex(tokens.border, tokens.text, 0.18);
|
||||||
const textFaint = mixHex(tokens.textDim, tokens.bgDeep, 0.35);
|
const textFaint = mixHex(tokens.textDim, tokens.bgDeep, 0.35);
|
||||||
const brandStrong = mixHex(tokens.accent, light ? "#000000" : "#0b0e14", 0.22);
|
const brandStrong = mixHex(
|
||||||
|
tokens.accent,
|
||||||
|
light ? "#000000" : "#0b0e14",
|
||||||
|
0.22,
|
||||||
|
);
|
||||||
|
|
||||||
set("--bg-deep", tokens.bgDeep);
|
set("--bg-deep", tokens.bgDeep);
|
||||||
set("--bg-panel", hexToRgba(tokens.bgPanelSolid, tokens.panelOpacity));
|
set("--bg-panel", hexToRgba(tokens.bgPanelSolid, tokens.panelOpacity));
|
||||||
|
|
@ -423,11 +423,23 @@ function applyDerivedTokens(
|
||||||
set("--amber", tokens.amber);
|
set("--amber", tokens.amber);
|
||||||
set("--red", tokens.red);
|
set("--red", tokens.red);
|
||||||
set("--violet", tokens.violet);
|
set("--violet", tokens.violet);
|
||||||
set("--bg-glass", hexToRgba(tokens.bgPanelSolid, Math.min(0.95, tokens.panelOpacity)));
|
set(
|
||||||
|
"--bg-glass",
|
||||||
|
hexToRgba(tokens.bgPanelSolid, Math.min(0.95, tokens.panelOpacity)),
|
||||||
|
);
|
||||||
set("--bg-inset", hexToRgba(tokens.bgDeep, light ? 0.72 : 0.6));
|
set("--bg-inset", hexToRgba(tokens.bgDeep, light ? 0.72 : 0.6));
|
||||||
set("--bg-header-fade", light ? "transparent" : hexToRgba(tokens.bgDeep, 0.92));
|
set(
|
||||||
set("--overlay-scrim", light ? "rgba(15, 23, 42, 0.42)" : "rgba(7, 10, 15, 0.84)");
|
"--bg-header-fade",
|
||||||
set("--badge-bg", light ? tokens.bgPanelSolid : hexToRgba(tokens.bgDeep, 0.72));
|
light ? "transparent" : hexToRgba(tokens.bgDeep, 0.92),
|
||||||
|
);
|
||||||
|
set(
|
||||||
|
"--overlay-scrim",
|
||||||
|
light ? "rgba(15, 23, 42, 0.42)" : "rgba(7, 10, 15, 0.84)",
|
||||||
|
);
|
||||||
|
set(
|
||||||
|
"--badge-bg",
|
||||||
|
light ? tokens.bgPanelSolid : hexToRgba(tokens.bgDeep, 0.72),
|
||||||
|
);
|
||||||
|
|
||||||
const accentIsLight = isLightHex(tokens.accent);
|
const accentIsLight = isLightHex(tokens.accent);
|
||||||
set(
|
set(
|
||||||
|
|
@ -440,26 +452,34 @@ function applyDerivedTokens(
|
||||||
);
|
);
|
||||||
set(
|
set(
|
||||||
"--btn-primary-text",
|
"--btn-primary-text",
|
||||||
light ? (accentIsLight ? "#0f172a" : "#ffffff") : mixHex(tokens.accent, "#ffffff", 0.75),
|
light
|
||||||
);
|
? accentIsLight
|
||||||
set(
|
? "#0f172a"
|
||||||
"--btn-warn-bg",
|
: "#ffffff"
|
||||||
hexToRgba(tokens.amber, 0.15),
|
: mixHex(tokens.accent, "#ffffff", 0.75),
|
||||||
);
|
);
|
||||||
|
set("--btn-warn-bg", hexToRgba(tokens.amber, 0.15));
|
||||||
set(
|
set(
|
||||||
"--btn-warn-text",
|
"--btn-warn-text",
|
||||||
light ? mixHex(tokens.amber, "#000000", 0.35) : mixHex(tokens.amber, "#ffffff", 0.65),
|
light
|
||||||
|
? mixHex(tokens.amber, "#000000", 0.35)
|
||||||
|
: mixHex(tokens.amber, "#ffffff", 0.65),
|
||||||
);
|
);
|
||||||
set("--btn-danger-bg", hexToRgba(tokens.red, 0.13));
|
set("--btn-danger-bg", hexToRgba(tokens.red, 0.13));
|
||||||
set(
|
set(
|
||||||
"--btn-danger-text",
|
"--btn-danger-text",
|
||||||
light ? mixHex(tokens.red, "#000000", 0.35) : mixHex(tokens.red, "#ffffff", 0.65),
|
light
|
||||||
|
? mixHex(tokens.red, "#000000", 0.35)
|
||||||
|
: mixHex(tokens.red, "#ffffff", 0.65),
|
||||||
);
|
);
|
||||||
set(
|
set(
|
||||||
"--btn-ghost-bg",
|
"--btn-ghost-bg",
|
||||||
light ? tokens.bgPanelSolid : hexToRgba(tokens.bgPanelSolid, 0.68),
|
light ? tokens.bgPanelSolid : hexToRgba(tokens.bgPanelSolid, 0.68),
|
||||||
);
|
);
|
||||||
set("--title-color", light ? tokens.text : mixHex(tokens.text, "#ffffff", 0.55));
|
set(
|
||||||
|
"--title-color",
|
||||||
|
light ? tokens.text : mixHex(tokens.text, "#ffffff", 0.55),
|
||||||
|
);
|
||||||
set("--bg-gradient", extras.bgGradient ?? "none");
|
set("--bg-gradient", extras.bgGradient ?? "none");
|
||||||
set("--panel-gradient", extras.panelGradient ?? "none");
|
set("--panel-gradient", extras.panelGradient ?? "none");
|
||||||
}
|
}
|
||||||
|
|
@ -475,7 +495,9 @@ function buildGradientTokens(theme: ThemeConfig): {
|
||||||
const sLast = normalizeHex(g.stops[g.stops.length - 1] ?? s1, s1);
|
const sLast = normalizeHex(g.stops[g.stops.length - 1] ?? s1, s1);
|
||||||
const light = g.surfaceBase === "light";
|
const light = g.surfaceBase === "light";
|
||||||
|
|
||||||
const bgDeep = light ? mixHex("#f1f5f9", s0, 0.16) : mixHex("#0b0e14", s0, 0.45);
|
const bgDeep = light
|
||||||
|
? mixHex("#f1f5f9", s0, 0.16)
|
||||||
|
: mixHex("#0b0e14", s0, 0.45);
|
||||||
const bgPanelSolid = light
|
const bgPanelSolid = light
|
||||||
? mixHex("#ffffff", s0, 0.08)
|
? mixHex("#ffffff", s0, 0.08)
|
||||||
: mixHex("#111622", s0, 0.42);
|
: mixHex("#111622", s0, 0.42);
|
||||||
|
|
@ -489,8 +511,12 @@ function buildGradientTokens(theme: ThemeConfig): {
|
||||||
// Choose an accent that stays legible against the surface base
|
// Choose an accent that stays legible against the surface base
|
||||||
const rawAccent = isLightHex(s1) === light ? sLast : s1;
|
const rawAccent = isLightHex(s1) === light ? sLast : s1;
|
||||||
const accent = light
|
const accent = light
|
||||||
? (isLightHex(rawAccent) ? "#0284c7" : rawAccent)
|
? isLightHex(rawAccent)
|
||||||
: (isLightHex(rawAccent) ? rawAccent : mixHex(rawAccent, "#60a5fa", 0.62));
|
? "#0284c7"
|
||||||
|
: rawAccent
|
||||||
|
: isLightHex(rawAccent)
|
||||||
|
? rawAccent
|
||||||
|
: mixHex(rawAccent, "#60a5fa", 0.62);
|
||||||
|
|
||||||
const tokens: CustomThemeTokens = {
|
const tokens: CustomThemeTokens = {
|
||||||
bgDeep,
|
bgDeep,
|
||||||
|
|
@ -622,10 +648,7 @@ export function getThemePalette(): ResolvedThemePalette {
|
||||||
"--bg-panel-solid",
|
"--bg-panel-solid",
|
||||||
isLight ? "#ffffff" : "#12161f",
|
isLight ? "#ffffff" : "#12161f",
|
||||||
);
|
);
|
||||||
const bgElevated = readVar(
|
const bgElevated = readVar("--bg-elevated", isLight ? "#e2e8f0" : "#19202e");
|
||||||
"--bg-elevated",
|
|
||||||
isLight ? "#e2e8f0" : "#19202e",
|
|
||||||
);
|
|
||||||
const border = readVar("--border", isLight ? "#cbd5e1" : "#2a3449");
|
const border = readVar("--border", isLight ? "#cbd5e1" : "#2a3449");
|
||||||
const text = readVar("--text", isLight ? "#0f172a" : "#e2e8f0");
|
const text = readVar("--text", isLight ? "#0f172a" : "#e2e8f0");
|
||||||
const textDim = readVar("--text-dim", isLight ? "#475569" : "#94a3b8");
|
const textDim = readVar("--text-dim", isLight ? "#475569" : "#94a3b8");
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,10 @@ function createPreviewCard(draft: ThemeConfig): HTMLElement {
|
||||||
{ class: "spread" },
|
{ class: "spread" },
|
||||||
h(
|
h(
|
||||||
"span",
|
"span",
|
||||||
{ class: "mono accent", style: { fontSize: "11px", fontWeight: "700" } },
|
{
|
||||||
|
class: "mono accent",
|
||||||
|
style: { fontSize: "11px", fontWeight: "700" },
|
||||||
|
},
|
||||||
"LIVE TELEMETRY PREVIEW",
|
"LIVE TELEMETRY PREVIEW",
|
||||||
),
|
),
|
||||||
h("span", { class: "badge info" }, `${shapeLabel} · ${colorLabel}`),
|
h("span", { class: "badge info" }, `${shapeLabel} · ${colorLabel}`),
|
||||||
|
|
@ -315,7 +318,11 @@ export function openThemeSettingsModal(): void {
|
||||||
h(
|
h(
|
||||||
"div",
|
"div",
|
||||||
{ class: "row", style: { gap: "6px" } },
|
{ class: "row", style: { gap: "6px" } },
|
||||||
h("span", { class: "mono dim", style: { fontSize: "10px" } }, "Starters:"),
|
h(
|
||||||
|
"span",
|
||||||
|
{ class: "mono dim", style: { fontSize: "10px" } },
|
||||||
|
"Starters:",
|
||||||
|
),
|
||||||
...GRADIENT_STARTERS.map((starter) =>
|
...GRADIENT_STARTERS.map((starter) =>
|
||||||
h(
|
h(
|
||||||
"button",
|
"button",
|
||||||
|
|
@ -438,7 +445,10 @@ export function openThemeSettingsModal(): void {
|
||||||
];
|
];
|
||||||
const seedSelect = h(
|
const seedSelect = h(
|
||||||
"select",
|
"select",
|
||||||
{ class: "input", style: { width: "auto", padding: "4px 8px", fontSize: "11px" } },
|
{
|
||||||
|
class: "input",
|
||||||
|
style: { width: "auto", padding: "4px 8px", fontSize: "11px" },
|
||||||
|
},
|
||||||
...seedOptions.map((o) => h("option", { value: o.id }, o.label)),
|
...seedOptions.map((o) => h("option", { value: o.id }, o.label)),
|
||||||
) as HTMLSelectElement;
|
) as HTMLSelectElement;
|
||||||
|
|
||||||
|
|
@ -658,21 +668,13 @@ export function openThemeSettingsModal(): void {
|
||||||
"label",
|
"label",
|
||||||
{ class: "row", style: { cursor: "pointer", fontSize: "12px" } },
|
{ class: "row", style: { cursor: "pointer", fontSize: "12px" } },
|
||||||
uiFxChk,
|
uiFxChk,
|
||||||
h(
|
h("span", {}, "UI Glows, Backdrop Blur, Shadows & Background Grid"),
|
||||||
"span",
|
|
||||||
{},
|
|
||||||
"UI Glows, Backdrop Blur, Shadows & Background Grid",
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
h(
|
h(
|
||||||
"label",
|
"label",
|
||||||
{ class: "row", style: { cursor: "pointer", fontSize: "12px" } },
|
{ class: "row", style: { cursor: "pointer", fontSize: "12px" } },
|
||||||
motionFxChk,
|
motionFxChk,
|
||||||
h(
|
h("span", {}, "Animations, 3D Bloom, Camera Shake & Plume Shimmer"),
|
||||||
"span",
|
|
||||||
{},
|
|
||||||
"Animations, 3D Bloom, Camera Shake & Plume Shimmer",
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
h(
|
h(
|
||||||
"label",
|
"label",
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,13 @@ export function closeWikiDrawer(): void {
|
||||||
activeCleanup = null;
|
activeCleanup = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openWikiDrawer(opts: {
|
export function openWikiDrawer(
|
||||||
|
opts: {
|
||||||
articleId?: WikiArticleId;
|
articleId?: WikiArticleId;
|
||||||
glossaryKey?: GlossaryKey | string;
|
glossaryKey?: GlossaryKey | string;
|
||||||
query?: string;
|
query?: string;
|
||||||
} = {}): void {
|
} = {},
|
||||||
|
): void {
|
||||||
closeWikiDrawer();
|
closeWikiDrawer();
|
||||||
const modalRoot = document.getElementById("modal-root") ?? document.body;
|
const modalRoot = document.getElementById("modal-root") ?? document.body;
|
||||||
const overlay = h("div", { class: "modal-overlay wiki-drawer-overlay" });
|
const overlay = h("div", { class: "modal-overlay wiki-drawer-overlay" });
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,7 @@ export function renderWikiWorkspace(
|
||||||
const needle = q.trim().toLowerCase();
|
const needle = q.trim().toLowerCase();
|
||||||
if (!needle) return [];
|
if (!needle) return [];
|
||||||
const hits: SearchHit[] = [];
|
const hits: SearchHit[] = [];
|
||||||
const clip = (s: string) =>
|
const clip = (s: string) => (s.length > 88 ? `${s.slice(0, 88)}...` : s);
|
||||||
s.length > 88 ? `${s.slice(0, 88)}...` : s;
|
|
||||||
|
|
||||||
for (const art of WIKI_ARTICLES) {
|
for (const art of WIKI_ARTICLES) {
|
||||||
const hay =
|
const hay =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue