Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
chg(ui): theme v3 and setup for cleaner semantic color tokens (#5653)
Seamus5334e816b46b
diff --git a/apps/web/biome.jsonc b/apps/web/biome.jsoncindex 60b2c9c824..a1f5a6dfa1 100644--- a/apps/web/biome.jsonc+++ b/apps/web/biome.jsonc@@ -36,7 +36,7 @@}},{- "includes": ["src/lib/animate/**", "src/features/theme/**"],+ "includes": ["src/lib/animate/**"],"formatter": {"enabled": false},diff --git a/apps/web/src/components/app/FatalError.tsx b/apps/web/src/components/app/FatalError.tsxindex 4d6d51367a..b9f06b101c 100644--- a/apps/web/src/components/app/FatalError.tsx+++ b/apps/web/src/components/app/FatalError.tsx@@ -17,7 +17,7 @@ export function FatalError(props: FatalErrorProps) {return (<Dialog open position="center" class="w-120">- <Surface depth={2} class="rounded-xl">+ <Surface depth={2} class="rounded-xl bg-surface"><div class="p-6 sm:p-8 font-sans"><div class="text-center"><h1 class="text-ink text-lg/7 font-semibold mb-4">@@ -26,7 +26,7 @@ export function FatalError(props: FatalErrorProps) {<Show when={props.error} keyed>{(error) => (- <div class="mb-6 p-3 bg-failure/10 border border-edge rounded text-left">+ <div class="mb-6 p-3 bg-failure-bg border border-edge rounded text-left"><p class="text-sm text-failure-ink font-mono break-all">{error.message || error.toString()}</p>diff --git a/apps/web/src/components/app/GlobalHotkeys.tsx b/apps/web/src/components/app/GlobalHotkeys.tsxindex 8f0c192f80..9534fcfac2 100644--- a/apps/web/src/components/app/GlobalHotkeys.tsx+++ b/apps/web/src/components/app/GlobalHotkeys.tsx@@ -59,7 +59,7 @@ import {themeMode,themes,} from '@theme/signals/themeSignals';-import type { ThemeV2 } from '@theme/types/themeTypes';+import type { ThemeV3 } from '@theme/types/themeTypes';import {applySystemTheme,applyTheme,@@ -379,7 +379,7 @@ export default function GlobalShortcuts() {displayPriority: 10,});- const ThemeDisplay: Component<{ theme: ThemeV2 }> = (props) => (+ const ThemeDisplay: Component<{ theme: ThemeV3 }> = (props) => (<div class="flex items-center gap-2">{props.theme.name}<ThemeChips theme={props.theme} size="sm" />@@ -388,7 +388,7 @@ export default function GlobalShortcuts() {// The per-mode theme the OS scheme currently resolves to — shown as the// "System preference" option's swatch and previewed on highlight.- const systemResolvedTheme = (): ThemeV2 | undefined =>+ const systemResolvedTheme = (): ThemeV3 | undefined =>themes().find((theme) =>theme.id ===diff --git a/apps/web/src/components/app/side-panel/FileSidePanelSections.tsx b/apps/web/src/components/app/side-panel/FileSidePanelSections.tsxindex 8b674fae86..c71522be82 100644--- a/apps/web/src/components/app/side-panel/FileSidePanelSections.tsx+++ b/apps/web/src/components/app/side-panel/FileSidePanelSections.tsx@@ -136,7 +136,10 @@ export function FolderLink(props: { projectId: string; projectName: string }) {return (<span{...navHandlers}- class={SidePanel.pillClass + ' pointer-events-auto hover:bg-hover'}+ class={+ SidePanel.pillClass ++ ' pointer-events-auto text-link hover:text-link-hover hover:bg-hover'+ }><span class="relative size-3 shrink-0"><EntityIcon targetType="project" size="fill" />diff --git a/apps/web/src/components/app/side-panel/SidePanel.tsx b/apps/web/src/components/app/side-panel/SidePanel.tsxindex b886301a64..6e0b93314a 100644--- a/apps/web/src/components/app/side-panel/SidePanel.tsx+++ b/apps/web/src/components/app/side-panel/SidePanel.tsx@@ -8,7 +8,7 @@ import ArrowLeft from '@phosphor/arrow-left.svg';import CaretRight from '@phosphor/caret-right.svg';import CircleDashedEmpty from '@phosphor/circle-dashed.svg';import InfoIcon from '@phosphor/info.svg';-import { Button, Layer, Panel, Scroll } from '@ui';+import { Button, Panel, Scroll } from '@ui';import { cn } from '@ui/utils/classname';import {type Accessor,@@ -333,7 +333,11 @@ function Section(order: props.order,component: () => (<Accordion.Item value={props.id}>- <Panel depth={2} style={{ height: 'auto' }} class="rounded-xl">+ <Panel+ depth={2}+ style={{ height: 'auto' }}+ class="rounded-xl bg-surface"+ ><Accordion.Header class="group flex items-center"><Accordion.Trigger class="px-2 py-3 flex flex-1 min-w-0 items-center gap-2 text-xs hover:underline"><CaretRight class="size-3 text-ink-muted transition-transform duration-90 group-data-expanded:rotate-90" />@@ -460,7 +464,7 @@ function EmptyPill(props: { label?: JSX.Element } = {}) {function Loading() {return (<div class="flex items-center justify-center p-2">- <div class="animate-pulse text-ink-muted rounded-full h-2 w-full bg-edge-muted/50"></div>+ <div class="animate-pulse text-ink-muted rounded-full h-2 w-full bg-skeleton"></div></div>);}@@ -483,11 +487,9 @@ function CountTitle(props: { label: JSX.Element; count: number }) {function Card(props: ParentProps) {return (- <Layer depth={1}>- <div class="rounded-lg border border-edge-muted bg-surface overflow-hidden">- <div class="divide-y divide-edge-muted">{props.children}</div>- </div>- </Layer>+ <div class="rounded-lg border border-edge-muted bg-inset overflow-hidden">+ <div class="divide-y divide-edge-muted">{props.children}</div>+ </div>);}diff --git a/apps/web/src/components/app/split-layout/componentRegistry.tsx b/apps/web/src/components/app/split-layout/componentRegistry.tsxindex c66e1ed399..784b060f5f 100644--- a/apps/web/src/components/app/split-layout/componentRegistry.tsx+++ b/apps/web/src/components/app/split-layout/componentRegistry.tsx@@ -573,6 +573,10 @@ registerComponent(registerComponent('settings', () => <SettingsPanelComponentWrapper />);if (LOCAL_ONLY) {+ registerComponent(+ 'theme-edit-3',+ lazy(() => import('@theme/components/ThemeEdit3'))+ );registerComponent('theme-debug',lazy(() => import('@core/internal/ThemeDebug'))diff --git a/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx b/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsxindex fa6570e3ea..175630a78e 100644--- a/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx+++ b/apps/web/src/components/app/split-layout/components/PopoverSplitRenderer.tsx@@ -155,7 +155,7 @@ function PopoverSplitModal(props: {bindHotKeyDom(r);}}>- <Panel depth={2} class="rounded-xl *:max-h-[75vh]">+ <Panel depth={2} class="rounded-xl bg-dialog *:max-h-[75vh]"><SplitPanelContext.Provider value={stubPanelContext}><SoupContextProvider><Show when={props.popover.mount}>diff --git a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx b/apps/web/src/components/app/split-layout/components/SplitHeader.tsxindex 72fc863ccc..b6fe9d4f85 100644--- a/apps/web/src/components/app/split-layout/components/SplitHeader.tsx+++ b/apps/web/src/components/app/split-layout/components/SplitHeader.tsx@@ -516,7 +516,7 @@ export function SplitHeader(props: {isMobile() &&!isNativeMobilePlatform() &&'touch:top-[calc(var(--safe-top)+6px)]',- isEntityDraggingOver() && 'bg-active/50'+ isEntityDraggingOver() && 'bg-active')}data-split-headerref={mergeRefs(droppable, props.ref)}diff --git a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx b/apps/web/src/components/app/split-layout/components/SplitPanel.tsxindex d85e09d9a3..5b9638d128 100644--- a/apps/web/src/components/app/split-layout/components/SplitPanel.tsx+++ b/apps/web/src/components/app/split-layout/components/SplitPanel.tsx@@ -195,10 +195,8 @@ export function SplitPanel(props: SplitPanelProps) {});/**- * Both members of a tucked Preview Pair share the active edge color when- * either member is active. The active member stays solid; its partner is- * dashed so focus ownership remains visible without breaking the Preview- * Pair's shared visual treatment.+ * When either member of a tucked Preview Pair is active, the active member+ * stays solid and its partner is dashed. Both retain the standard edge color.*/const previewPairFocusStyling = createMemo(() => {const manager = globalSplitManager();@@ -214,7 +212,6 @@ export function SplitPanel(props: SplitPanelProps) {const activeId = manager.activeSplitId();return activeId === props.split.id || activeId === peerId;});-return (<SoupContextProvider soup={nextSoup}><SplitPanelContext.Provider@@ -292,16 +289,11 @@ export function SplitPanel(props: SplitPanelProps) {tabindex={-1}><Panel- edgeColor={- splitFocusStyling() || previewPairFocusStyling()- ? 'color-mix(in oklch, var(--color-edge) 80%, var(--color-ink))'- : undefined- }class={cn('rounded-xl touch:rounded-none touch:after:hidden touch:border-0! bg-panel',+ splitUnfocusedStyling() && 'split-panel-inactive',{- 'shadow-sm shadow-drop-shadow/50 bg-panel/80 dark-mode:bg-panel/30':- splitUnfocusedStyling(),+ 'shadow-sm shadow-drop-shadow/50': splitUnfocusedStyling(),'shadow-2xl shadow-drop-shadow': splitFocusStyling(),'border-solid!': previewPairFocusStyling() && props.active,'border-dashed!': previewPairFocusStyling() && !props.active,diff --git a/apps/web/src/components/ui/components/Button.tsx b/apps/web/src/components/ui/components/Button.tsxindex 586c09c3f3..2f2bf6d51e 100644--- a/apps/web/src/components/ui/components/Button.tsx+++ b/apps/web/src/components/ui/components/Button.tsx@@ -13,7 +13,7 @@ import { Tooltip } from './Tooltip';export type ButtonProps = ButtonRootProps<'button'> &ComponentProps<'button'> & {- depth?: 0 | 1 | 2 | 3 | 4 | 5;+ depth?: 0 | 1 | 2 | 3 | 4;tooltipPlacement?: Placement;/*** Stretch the button (and, when a tooltip wraps it, the tooltip's trigger@@ -55,19 +55,24 @@ export type ButtonVariant =| 'contrast'| 'cta';+// Hover/press feedback is painted as a translucent scrim *on top of* each+// variant's base background-color (via the `overlay-*` background-image utility)+// rather than replacing/thinning the base color, so buttons keep their full+// color on hover. The `cta`/`contrast` variants use a surface scrim so their+// solid backgrounds lighten toward the text color instead of washing out.const variantStyles: Record<ButtonVariant, string> = {danger:'bg-failure/10 text-failure dark:bg-failure/15 focus-visible:bg-failure/25 focus-visible:border focus-visible:border-failure/50 not-disabled:hover:bg-failure/25 not-disabled:active:bg-failure/30 disabled:opacity-30 ',base: 'bg-transparent text-ink-muted border border-edge-muted not-disabled:hover:bg-hover not-disabled:hover:text-ink active:bg-active disabled:opacity-30 ',active:- 'bg-accent-bg not-disabled:hover:bg-accent/30 text-accent disabled:opacity-30 ',+ 'bg-accent-bg not-disabled:hover:overlay-accent-bg text-accent disabled:opacity-30 ',success:- 'bg-success-bg not-disabled:hover:bg-success/30 text-success disabled:opacity-30 ',+ 'bg-success-bg not-disabled:hover:overlay-success-bg text-success disabled:opacity-30 ',ghost:- 'bg-transparent text-ink-muted not-disabled:hover:bg-hover not-disabled:hover:text-ink active:bg-active disabled:opacity-30 ',+ 'bg-transparent text-ink-muted not-disabled:hover:overlay-hover not-disabled:hover:text-ink active:overlay-active disabled:opacity-30 ',contrast:- 'bg-ink text-surface border border-transparent not-disabled:hover:bg-ink/90 active:bg-ink/80 disabled:opacity-30 focus-visible:bg-ink/90',- cta: 'bg-accent text-surface border border-transparent not-disabled:hover:bg-accent/90 active:bg-accent/80 disabled:opacity-30 focus-visible:bg-accent/90',+ 'bg-ink text-surface border border-transparent not-disabled:hover:overlay-[color-mix(in_oklch,var(--color-surface)_12%,transparent)] active:overlay-[color-mix(in_oklch,var(--color-surface)_22%,transparent)] disabled:opacity-30 focus-visible:bg-ink/90',+ cta: 'bg-accent text-surface border border-transparent not-disabled:hover:overlay-[color-mix(in_oklch,var(--color-surface)_12%,transparent)] active:overlay-[color-mix(in_oklch,var(--color-surface)_22%,transparent)] disabled:opacity-30 focus-visible:bg-accent/90',};const sizeStyles: Record<ButtonSize, string> = {diff --git a/apps/web/src/components/ui/components/ButtonGroup.tsx b/apps/web/src/components/ui/components/ButtonGroup.tsxindex 2cb5238db2..0ded81a96d 100644--- a/apps/web/src/components/ui/components/ButtonGroup.tsx+++ b/apps/web/src/components/ui/components/ButtonGroup.tsx@@ -6,7 +6,7 @@ import { Layer } from './Layer';type ButtonGroupOrientation = 'horizontal' | 'vertical';type ButtonGroupContextValue = {- depth?: 0 | 1 | 2 | 3 | 4 | 5;+ depth?: 0 | 1 | 2 | 3 | 4;variant?: ButtonVariant;size?: ButtonSize;orientation: ButtonGroupOrientation;@@ -19,7 +19,7 @@ const ButtonGroupContext = createContext<ButtonGroupContextValue | undefined>(export const useButtonGroupContext = () => useContext(ButtonGroupContext);type ButtonGroupProps = {- depth?: 0 | 1 | 2 | 3 | 4 | 5;+ depth?: 0 | 1 | 2 | 3 | 4;variant?: ButtonVariant;size?: ButtonSize;orientation?: ButtonGroupOrientation;diff --git a/apps/web/src/components/ui/components/CommandMenuPrimitives.tsx b/apps/web/src/components/ui/components/CommandMenuPrimitives.tsxindex 3f6b8d38f6..e67655258d 100644--- a/apps/web/src/components/ui/components/CommandMenuPrimitives.tsx+++ b/apps/web/src/components/ui/components/CommandMenuPrimitives.tsx@@ -119,7 +119,10 @@ function CommandMenuShellRoot(props: SurfaceProps) {const [local, rest] = splitProps(props, ['children', 'class']);return (- <Panel class={cn('max-h-[75vh] rounded-xl', local.class)} {...rest}>+ <Panel+ class={cn('max-h-[75vh] rounded-xl bg-dialog', local.class)}+ {...rest}+ >{local.children}</Panel>);@@ -127,7 +130,7 @@ function CommandMenuShellRoot(props: SurfaceProps) {function CommandMenuHeader(props: ParentProps<{ class?: string }>) {return (- <Panel.Header class={cn('gap-2 px-4 my-1 bg-surface', props.class)}>+ <Panel.Header class={cn('gap-2 px-4 my-1', props.class)}>{props.children}</Panel.Header>);@@ -135,7 +138,7 @@ function CommandMenuHeader(props: ParentProps<{ class?: string }>) {function CommandMenuToolbar(props: ParentProps<{ class?: string }>) {return (- <Panel.Toolbar class={cn('bg-surface', props.class)}>+ <Panel.Toolbar class={cn('bg-dialog', props.class)}>{props.children}</Panel.Toolbar>);@@ -155,7 +158,7 @@ function CommandMenuFooter(props: ParentProps<{ class?: string }>) {return (<Panel.Footerclass={cn(- 'gap-4 px-4 bg-surface text-xs text-ink-extra-muted/80',+ 'gap-4 px-4 bg-dialog text-xs text-ink-extra-muted/80',props.class)}>diff --git a/apps/web/src/components/ui/components/Dialog.tsx b/apps/web/src/components/ui/components/Dialog.tsxindex 28ea9bb3b7..2b0989446a 100644--- a/apps/web/src/components/ui/components/Dialog.tsx+++ b/apps/web/src/components/ui/components/Dialog.tsx@@ -89,7 +89,7 @@ export function Dialog(props: DialogProps) {<KobalteDialog.Contentref={props.contentRef}class={cn(- 'portal-scope isolate rounded-xl',+ 'portal-scope isolate rounded-xl bg-dialog',props.fullscreen ? 'size-full' : 'w-200 max-w-[calc(100vw-16px)]',animateOnOpen() &&(props.fullscreendiff --git a/apps/web/src/components/ui/components/Dropdown.tsx b/apps/web/src/components/ui/components/Dropdown.tsxindex cb918ee7ef..cca8dc3f24 100644--- a/apps/web/src/components/ui/components/Dropdown.tsx+++ b/apps/web/src/components/ui/components/Dropdown.tsx@@ -242,7 +242,7 @@ function DropdownSubContent(props: DropdownSubContentProps) {><KobalteDropdownMenu.SubContentclass={cn(- 'rounded-xl size-auto z-action-menu menu-open-animation bg-menu',+ 'rounded-xl size-auto z-action-menu menu-open-animation bg-menu [--color-surface:var(--color-menu)]',local.class)}depth={local.depth ?? 2}diff --git a/apps/web/src/components/ui/components/HoverCard.tsx b/apps/web/src/components/ui/components/HoverCard.tsxindex 45d8e3be76..f35238ff68 100644--- a/apps/web/src/components/ui/components/HoverCard.tsx+++ b/apps/web/src/components/ui/components/HoverCard.tsx@@ -56,7 +56,7 @@ export function HoverCard(props: HoverCardProps) {<KobalteTooltip.Content class="z-tool-tip max-w-[calc(100vw-32px)]"><Surfaceclass={cn(- 'flex items-center justify-center p-2 text-ink-muted text-xs wrap-break-word',+ 'flex items-center justify-center p-2 text-ink-muted text-xs wrap-break-word bg-tooltip',props.contentClass)}depth={3}diff --git a/apps/web/src/components/ui/components/Layer.tsx b/apps/web/src/components/ui/components/Layer.tsxindex ccc62cf71c..05d3068b8e 100644--- a/apps/web/src/components/ui/components/Layer.tsx+++ b/apps/web/src/components/ui/components/Layer.tsx@@ -1,78 +1,17 @@-import { isTouchDevice } from '@core/mobile/isTouchDevice';-import { DEFAULT_LIGHT_THEME } from '@theme/constants';-import { currentThemeId, themeDepth } from '@theme/signals/themeSignals';-import { createMemo, type JSX } from 'solid-js';+import type { JSX } from 'solid-js';type LayerProps = {children?: JSX.Element;- depth?: 0 | 1 | 2 | 3 | 4 | 5;+ depth?: 0 | 1 | 2 | 3 | 4;};+/** Marks a subtree with its surface depth. CSS owns all layer semantics. */export function Layer(props: LayerProps) {- const isDefaultMobileLight = createMemo(- () => currentThemeId() === DEFAULT_LIGHT_THEME && isTouchDevice()- );- // HACK: on default mobile light theme, we reverse the sign- const sign = () => (isDefaultMobileLight() ? -1 : 1);- const depth = () => ((props.depth ?? 0) / 5) * themeDepth() * sign();-- // As Layer depth increases, Borders should get lighter slower than surfaces. So we multiple them by this.- const BORDER_SCALAR = 0.4;- // For pure black mobile theme, we need to set a min step to get appropriate contrast- const nearBlackStepMin = () =>- (props.depth ?? 0) > 0 && isTouchDevice() ? 0.19 : 0;-return (<div- data-layer-depth={props.depth}- style={{- display: 'contents',- '--b0': `oklch(max(var(--b0l) + ${depth()}, ${nearBlackStepMin()}) var(--b0c) var(--b0h))`,- '--b1': `oklch(calc(var(--b1l) + ${depth()}) var(--b1c) var(--b1h))`,- '--b2': `oklch(calc(var(--b2l) + ${depth()}) var(--b2c) var(--b2h))`,- '--b3': `oklch(calc(var(--b3l) + ${depth() * BORDER_SCALAR}) var(--b3c) var(--b3h))`,- '--b4': `oklch(calc(var(--b4l) + ${depth() * BORDER_SCALAR}) var(--b4c) var(--b4h))`,- '--c0': `oklch(calc(var(--c0l) + ${depth()}) var(--c0c) var(--c0h))`,- '--c1': `oklch(calc(var(--c1l) + ${depth()}) var(--c1c) var(--c1h))`,- '--c2': `oklch(calc(var(--c2l) + ${depth()}) var(--c2c) var(--c2h))`,- '--c3': `oklch(calc(var(--c3l) + ${depth()}) var(--c3c) var(--c3h))`,- '--c4': `oklch(calc(var(--c4l) + ${depth()}) var(--c4c) var(--c4h))`,-- '--color-accent': 'var(--a0)',- '--color-accent-bg': 'oklch(from var(--a0) l c h / 0.15)',-- // TODO (seamus): --color-surface could be better handled with fractional layer depth- '--color-surface': 'var(--b0)',-- '--color-shadow':- 'oklch(calc(var(--b0l) - 0.005 ) var(--b0c) var(--b0h) / 0.2)',- // TODO (seamus): --color-message could be better handled with fractional layer depth- '--color-overlay': 'oklch(from var(--b2) l c h / 0.5)',- '--color-edge-muted': 'var(--b3)',- '--color-edge': 'var(--b4)',- '--color-rail': 'color-mix(in oklch, var(--b4) 90%, var(--c0))',-- '--color-ink': 'var(--c0)',- '--color-ink-muted': 'var(--c1)',- '--color-ink-extra-muted': 'var(--c2)',- '--color-ink-disabled': 'var(--c3)',- '--color-ink-placeholder': 'var(--c4)',-- // Semantic design tokens with theme overrides, get set to the theme override, otherwise, they get set to --b0, same as `--color-surface`, and get controlled entirely by Layer system- '--color-page': 'var(--theme-page, var(--b0))',- '--color-panel': 'var(--theme-panel, var(--b0))',- '--color-inset': 'var(--theme-inset, var(--b0))',- '--color-dialog': 'var(--theme-dialog, var(--b0))',- '--color-menu': 'var(--theme-menu, var(--b0))',- '--color-input': 'var(--theme-input, var(--b0))',- '--color-message':- 'var(--theme-message, color-mix(in oklch, var(--b1) 50%, var(--b2)))',- '--color-active': 'var(--theme-active, var(--b1))',- '--color-hover': 'var(--theme-hover, var(--b2))',- '--color-button': 'var(--theme-button, var(--b0))',- '--color-chrome':- 'var(--theme-chrome, color-mix(in oklch, var(--color-menu) 85%, var(--color-active)))',- }}+ data-layer+ data-depth={props.depth ?? 0}+ style={{ display: 'contents' }}>{props.children}</div>diff --git a/apps/web/src/components/ui/components/Panel.tsx b/apps/web/src/components/ui/components/Panel.tsxindex 50b2bf85cc..03ce2c547f 100644--- a/apps/web/src/components/ui/components/Panel.tsx+++ b/apps/web/src/components/ui/components/Panel.tsx@@ -28,7 +28,7 @@ function PanelRoot(props: PanelProps) {'grid-template-rows': 'auto auto minmax(0, 1fr) auto','grid-template-columns': 'minmax(0, 1fr)',}}- class={cn('grid min-h-0 min-w-0', local.class)}+ class={cn('grid min-h-0 min-w-0 bg-panel', local.class)}{...surfaceProps}>{local.children}diff --git a/apps/web/src/components/ui/components/SendButton.tsx b/apps/web/src/components/ui/components/SendButton.tsxindex e789f442a7..689c21f806 100644--- a/apps/web/src/components/ui/components/SendButton.tsx+++ b/apps/web/src/components/ui/components/SendButton.tsx@@ -24,7 +24,7 @@ export function SendButton(props: SendButtonProps) {return (<Button- depth={5}+ depth={4}variant="cta"size="icon-sm"draggable={false}diff --git a/apps/web/src/components/ui/components/Surface.test.tsx b/apps/web/src/components/ui/components/Surface.test.tsxnew file mode 100644index 0000000000..3a38db4d14--- /dev/null+++ b/apps/web/src/components/ui/components/Surface.test.tsx@@ -0,0 +1,21 @@+import { cleanup, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it } from 'vitest';+import { Surface } from './Surface';++describe('Surface', () => {+ afterEach(cleanup);++ it('uses the layer-relative surface background by default', () => {+ render(() => <Surface data-testid="surface" />);++ expect(screen.getByTestId('surface').classList).toContain('bg-surface');+ });++ it('allows an explicit semantic background to override the default', () => {+ render(() => <Surface data-testid="surface" class="bg-panel" />);++ const surface = screen.getByTestId('surface');+ expect(surface.classList).toContain('bg-panel');+ expect(surface.classList).not.toContain('bg-surface');+ });+});diff --git a/apps/web/src/components/ui/components/Surface.tsx b/apps/web/src/components/ui/components/Surface.tsxindex 4302f323e3..5db8a8fb49 100644--- a/apps/web/src/components/ui/components/Surface.tsx+++ b/apps/web/src/components/ui/components/Surface.tsx@@ -3,7 +3,7 @@ import { cn } from '../utils/classname';import { Layer } from './Layer';export type SurfaceProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'style'> & {- depth?: 0 | 1 | 2 | 3 | 4 | 5;+ depth?: 0 | 1 | 2 | 3 | 4;style?: JSX.CSSProperties;edgeColor?: string;highlightColor?: string;@@ -29,11 +29,11 @@ export function Surface(props: SurfaceProps) {const base: JSX.CSSProperties = {};if (!local.hideBorder) {- base.border = `var(--app-border-width, 0.5px) solid ${local.edgeColor ?? 'var(--b4)'}`;+ base.border = `var(--app-border-width, 0.5px) solid ${local.edgeColor ?? 'var(--color-edge)'}`;}if (local.active) {- const ring = local.highlightColor ?? 'var(--b4)';+ const ring = local.highlightColor ?? 'var(--color-edge)';base['box-shadow'] =`0 0 0 2px color-mix(in srgb, ${ring} 60%, transparent)`;}@@ -46,7 +46,7 @@ export function Surface(props: SurfaceProps) {<divstyle={style()}class={cn(- 'relative rounded-md overflow-clip min-h-0 size-full bg-(--b0)',+ 'relative rounded-md overflow-clip min-h-0 size-full bg-surface',local.class)}{...rest}@@ -56,9 +56,3 @@ export function Surface(props: SurfaceProps) {</Layer>);}--/*-shadow sudo element-"after:content-[''] after:absolute after:inset-0 after:pointer-events-none after:rounded-[inherit] after:z-10",-'after:shadow-[inset_0_0_4px_var(--color-shadow)]'"-*/diff --git a/apps/web/src/components/ui/components/Tooltip.tsx b/apps/web/src/components/ui/components/Tooltip.tsxindex 2e5503493e..b5175c3ac9 100644--- a/apps/web/src/components/ui/components/Tooltip.tsx+++ b/apps/web/src/components/ui/components/Tooltip.tsx@@ -122,7 +122,7 @@ export function Tooltip(props: TooltipProps) {<KobalteTooltip.Portal><KobalteTooltip.Content class="z-tool-tip max-w-[calc(100vw-32px)]"><Surface- class="flex items-center justify-center p-2 text-ink-muted text-xs wrap-break-word"+ class="flex items-center justify-center p-2 text-ink-muted text-xs wrap-break-word bg-tooltip"depth={3}><div class="flex flex-row items-center gap-2">diff --git a/apps/web/src/features/auth/Login.tsx b/apps/web/src/features/auth/Login.tsxindex f14bc36430..9c9f82620c 100644--- a/apps/web/src/features/auth/Login.tsx+++ b/apps/web/src/features/auth/Login.tsx@@ -635,14 +635,14 @@ export function Login(props: { signupMode?: boolean }) {<div class="text-center text-xs text-ink/50 wrap-break-word">By continuing, you agree to our{' '}<a- class="underline underline-offset-2 hover:text-ink focus-visible:text-ink"+ class="text-link hover:text-link-hover visited:text-link-visited underline underline-offset-2 focus-visible:text-link-hover"href="/terms">terms</a>{' '}and{' '}<a- class="underline underline-offset-2 hover:text-ink focus-visible:text-ink"+ class="text-link hover:text-link-hover visited:text-link-visited underline underline-offset-2 focus-visible:text-link-hover"href="/privacy">privacy policydiff --git a/apps/web/src/features/block-code/component/cmTheme.ts b/apps/web/src/features/block-code/component/cmTheme.tsindex 30934d3f5f..eae1aae1b1 100644--- a/apps/web/src/features/block-code/component/cmTheme.ts+++ b/apps/web/src/features/block-code/component/cmTheme.ts@@ -37,20 +37,20 @@ const base = {edge50: 'color-mix(in oklch, var(--color-edge), var(--color-surface) 50%)',accent: 'var(--color-accent)',error: 'var(--color-failure)',- link: 'var(--color-accent)',-- c0: 'var(--color-accent)',- c1: 'var(--color-accent-30)',- c2: 'var(--color-accent-60)',- c3: 'var(--color-accent-90)',- c4: 'var(--color-accent-120)',- c5: 'var(--color-accent-150)',- c6: 'var(--color-accent-180)',- c7: 'var(--color-accent-210)',- c8: 'var(--color-accent-240)',- c9: 'var(--color-accent-270)',- c10: 'var(--color-accent-300)',- c11: 'var(--color-accent-330)',+ link: 'var(--color-link)',++ c0: 'var(--color-red)',+ c1: 'var(--color-orange)',+ c2: 'var(--color-amber)',+ c3: 'var(--color-yellow)',+ c4: 'var(--color-lime)',+ c5: 'var(--color-green)',+ c6: 'var(--color-teal)',+ c7: 'var(--color-cyan)',+ c8: 'var(--color-blue)',+ c9: 'var(--color-violet)',+ c10: 'var(--color-purple)',+ c11: 'var(--color-pink)',};const theme = EditorView.theme({diff --git a/apps/web/src/features/block-email/component/CollapsedMessage.tsx b/apps/web/src/features/block-email/component/CollapsedMessage.tsxindex c1534efec3..31bf93947e 100644--- a/apps/web/src/features/block-email/component/CollapsedMessage.tsx+++ b/apps/web/src/features/block-email/component/CollapsedMessage.tsx@@ -62,8 +62,8 @@ export function CollapsedMessage(props: CollapsedMessageProps) {class={cn('relative flex flex-col gap-2 p-4 rounded-lg min-w-0 border',props.isFocused- ? 'bg-active/60 border-edge'- : 'bg-ink-muted/2.5 hover:bg-active/40 hover:border-edge border-transparent'+ ? 'bg-active border-edge'+ : 'bg-hover hover:bg-active hover:border-edge border-transparent')}style={{'--user-icon-width': '1rem',diff --git a/apps/web/src/features/block-email/component/MessageContainer.tsx b/apps/web/src/features/block-email/component/MessageContainer.tsxindex e5e807c7b1..7458cd23d0 100644--- a/apps/web/src/features/block-email/component/MessageContainer.tsx+++ b/apps/web/src/features/block-email/component/MessageContainer.tsx@@ -229,7 +229,7 @@ export function MessageContainer(props: MessageContainerProps) {style={{ '--user-icon-width': '1rem' }}classList={{'bg-accent border-transparent': props.isTarget,- 'bg-active/60 border-edge': !props.isTarget && props.isFocused,+ 'bg-active border-edge': !props.isTarget && props.isFocused,'bg-ink-muted/4 border-transparent':!props.isTarget && !props.isFocused,}}diff --git a/apps/web/src/features/block-md/component/InlineTaskGithubPullRequests.tsx b/apps/web/src/features/block-md/component/InlineTaskGithubPullRequests.tsxindex 0be9ee0b0b..f0c210787d 100644--- a/apps/web/src/features/block-md/component/InlineTaskGithubPullRequests.tsx+++ b/apps/web/src/features/block-md/component/InlineTaskGithubPullRequests.tsx@@ -53,7 +53,7 @@ function InlineTaskGithubPullRequestsSkeleton(): JSX.Element {class={cn(PILL_CLASS, 'pointer-events-none select-none')}><GithubIcon class="size-3 shrink-0 text-ink-extra-muted" />- <span class="skeleton-shimmer h-3 w-24 rounded-full bg-ink/10" />+ <span class="skeleton-shimmer h-3 w-24 rounded-full bg-skeleton" /></div></Layer>);diff --git a/apps/web/src/features/block-md/component/MarkdownEditor.tsx b/apps/web/src/features/block-md/component/MarkdownEditor.tsxindex c3c4d2cb53..4e77ece7e5 100644--- a/apps/web/src/features/block-md/component/MarkdownEditor.tsx+++ b/apps/web/src/features/block-md/component/MarkdownEditor.tsx@@ -1037,9 +1037,9 @@ export function MarkdownEditor(props: {aria-hidden="true"class="pointer-events-none absolute inset-x-0 top-0 flex flex-col gap-2.5 pt-1">- <div class="skeleton-shimmer h-2.5 w-full rounded-full bg-placeholder/30" />- <div class="skeleton-shimmer h-2.5 w-full rounded-full bg-placeholder/30" />- <div class="skeleton-shimmer h-2.5 w-2/3 rounded-full bg-placeholder/30" />+ <div class="skeleton-shimmer h-2.5 w-full rounded-full bg-skeleton" />+ <div class="skeleton-shimmer h-2.5 w-full rounded-full bg-skeleton" />+ <div class="skeleton-shimmer h-2.5 w-2/3 rounded-full bg-skeleton" /></div></Show><Show when={editorReady() && isBlankMarkdown()}>diff --git a/apps/web/src/features/block-md/component/TaskDuplicateMatches.tsx b/apps/web/src/features/block-md/component/TaskDuplicateMatches.tsxindex 6a418bf8f4..e3bd0edeb8 100644--- a/apps/web/src/features/block-md/component/TaskDuplicateMatches.tsx+++ b/apps/web/src/features/block-md/component/TaskDuplicateMatches.tsx@@ -210,7 +210,7 @@ function TaskDuplicateRow(props: {onDismiss: () => void;}) {return (- <div class={cn('rounded-lg px-2 py-1.5', 'hover:bg-surface-hover')}>+ <div class={cn('rounded-lg px-2 py-1.5', 'hover:bg-hover')}><div class="flex min-w-0 items-center gap-1.5"><TaskDuplicateMention match={props.match} /><DismissDuplicateButton onDismiss={props.onDismiss} />diff --git a/apps/web/src/features/block-md/component/sidepanel/MarkdownSidePanelSections.tsx b/apps/web/src/features/block-md/component/sidepanel/MarkdownSidePanelSections.tsxindex 403b8d457f..4ac3e3bcec 100644--- a/apps/web/src/features/block-md/component/sidepanel/MarkdownSidePanelSections.tsx+++ b/apps/web/src/features/block-md/component/sidepanel/MarkdownSidePanelSections.tsx@@ -238,7 +238,7 @@ function HistorySkeleton() {aria-hidden="true"class="hidden min-w-0 flex-col gap-2.5 overflow-hidden md:flex">- <div class="skeleton-shimmer h-12 w-full rounded-md bg-ink/3" />+ <div class="skeleton-shimmer h-12 w-full rounded-md bg-skeleton" /></div>);}@@ -393,7 +393,7 @@ function FolderLink(props: { projectId: string; projectName: string }) {return (<span{...navHandlers}- class="pointer-events-auto min-w-0 truncate py-0.5 rounded-xs hover:bg-hover focus:bg-active"+ class="pointer-events-auto min-w-0 truncate py-0.5 rounded-xs text-link hover:text-link-hover hover:bg-hover focus:bg-active"><span class="relative top-[0.125em] size-[1em] inline-flex mx-1"><EntityIcon targetType="project" size="fill" />diff --git a/apps/web/src/features/block-pr/component/PrSkeletons.tsx b/apps/web/src/features/block-pr/component/PrSkeletons.tsxindex e2b88228f9..82ed366c9c 100644--- a/apps/web/src/features/block-pr/component/PrSkeletons.tsx+++ b/apps/web/src/features/block-pr/component/PrSkeletons.tsx@@ -6,16 +6,14 @@ import { prDisplayName } from '../util/prKey';export function SkeletonBar(props: { class?: string }) {return (- <div- class={cn('skeleton-shimmer rounded-full bg-edge-muted/50', props.class)}- />+ <div class={cn('skeleton-shimmer rounded-full bg-skeleton', props.class)} />);}function MessageSkeleton() {return (<div class="flex gap-2 py-3">- <div class="animate-pulse size-6 rounded-full bg-edge-muted/50 shrink-0" />+ <div class="animate-pulse size-6 rounded-full bg-skeleton shrink-0" /><div class="flex flex-col gap-2 grow min-w-0 pt-1"><SkeletonBar class="h-2.5 w-32" /><SkeletonBar class="h-2 w-full max-w-md" />diff --git a/apps/web/src/features/block-pr/side-panel/github-pull-request.tsx b/apps/web/src/features/block-pr/side-panel/github-pull-request.tsxindex e73aa1735e..1c96c5223d 100644--- a/apps/web/src/features/block-pr/side-panel/github-pull-request.tsx+++ b/apps/web/src/features/block-pr/side-panel/github-pull-request.tsx@@ -157,8 +157,8 @@ export function GithubPullRequestDetailsRows(props: {when={props.enrichment.authorLogin}fallback={<>- <span class="skeleton-shimmer size-3.5 rounded-full bg-ink/10" />- <span class="skeleton-shimmer h-3 w-16 rounded-full bg-ink/10" />+ <span class="skeleton-shimmer size-3.5 rounded-full bg-skeleton" />+ <span class="skeleton-shimmer h-3 w-16 rounded-full bg-skeleton" /></>}>@@ -208,7 +208,7 @@ export function GithubPullRequestDetailsRows(props: {href={props.enrichment.url}target="_blank"rel="noreferrer"- class="min-w-0 truncate underline decoration-current/20 decoration-[max(1px,0.1em)] underline-offset-2 hover:decoration-current"+ class="min-w-0 truncate text-link hover:text-link-hover visited:text-link-visited underline decoration-current/20 decoration-[max(1px,0.1em)] underline-offset-2 hover:decoration-current">{props.enrichment.displayName}</a>@@ -246,7 +246,7 @@ export function GithubPullRequestChecksContent(props: {target="_blank"rel="noreferrer"aria-label={`Open ${check.name} on GitHub`}- class="hover:opacity-70 transition-opacity"+ class="text-link hover:text-link-hover visited:text-link-visited transition-colors"><ArrowSquareOut class="size-3" /></a>diff --git a/apps/web/src/features/channel/Input/ChannelInput.tsx b/apps/web/src/features/channel/Input/ChannelInput.tsxindex 2adb71e696..015a377e9c 100644--- a/apps/web/src/features/channel/Input/ChannelInput.tsx+++ b/apps/web/src/features/channel/Input/ChannelInput.tsx@@ -511,7 +511,7 @@ export function ChannelInput(props: ChannelInputProps) {collapsedInput.collapse();}}class={cn(- 'rounded-xl touch:rounded-3xl touch:island',+ 'rounded-xl bg-surface touch:rounded-3xl touch:island',isCollapsed() && 'hidden',isTouchDevice() && 'bg-chrome')}diff --git a/apps/web/src/features/command/CommandMenu.tsx b/apps/web/src/features/command/CommandMenu.tsxindex bd8360bd4c..cffd2693cb 100644--- a/apps/web/src/features/command/CommandMenu.tsx+++ b/apps/web/src/features/command/CommandMenu.tsx@@ -132,7 +132,7 @@ export function CommandMenuInner(props: {/** Optional class merged onto the Panel wrapper. */class?: string;/** Optional depth for the Panel wrapper. */- depth?: 0 | 1 | 2 | 3 | 4 | 5;+ depth?: 0 | 1 | 2 | 3 | 4;}) {const [commandMenuRef, setCommandMenuRef] = createSignal<HTMLDivElement>();@@ -622,7 +622,7 @@ export function CommandMenuInner(props: {<CommandMenuShell.Body><div- class="bg-surface overflow-hidden transition-[height] duration-60 ease-out p-2"+ class="overflow-hidden transition-[height] duration-60 ease-out p-2"style={{ height: `${resultsHeight()}px` }}><Showdiff --git a/apps/web/src/features/command/Launcher.tsx b/apps/web/src/features/command/Launcher.tsxindex 67f16b6bac..95f05e5272 100644--- a/apps/web/src/features/command/Launcher.tsx+++ b/apps/web/src/features/command/Launcher.tsx@@ -874,7 +874,7 @@ export const LauncherInner = (props: LauncherInnerProps) => {ref={ref}tabindex={-1}>- <CommandMenuShell.Header class="gap-2 px-4 my-1 bg-surface border-b-0">+ <CommandMenuShell.Header class="gap-2 px-4 my-1 border-b-0"><Showwhen={searchMode()}fallback={@@ -996,7 +996,7 @@ export const Launcher = (props: LauncherProps) => {<Dialog open={props.open} onOpenChange={props.onOpenChange} modal={true}><Dialog.Portal><Dialog.Overlay class="fixed inset-0 z-modal"></Dialog.Overlay>- <Dialog.Content>+ <Dialog.Content class="[--color-surface:var(--color-dialog)]"><divclass={cn('fixed top-0 bottom-(--virtual-keyboard-height,0) inset-x-0 z-modal w-screen flex justify-center px-2',diff --git a/apps/web/src/features/contacts/Contact/ContactMetadataSection.tsx b/apps/web/src/features/contacts/Contact/ContactMetadataSection.tsxindex 5ca7777f52..7123493f8d 100644--- a/apps/web/src/features/contacts/Contact/ContactMetadataSection.tsx+++ b/apps/web/src/features/contacts/Contact/ContactMetadataSection.tsx@@ -41,7 +41,7 @@ export function ContactMetadataSection(props: {<buttontype="button"onClick={() => openCompany(contact().companyId)}- class="text-left text-sm text-accent hover:underline"+ class="text-left text-sm text-link hover:text-link-hover hover:underline">{company()?.name ?? 'Open company'}</button>diff --git a/apps/web/src/features/entity/components/Badges.tsx b/apps/web/src/features/entity/components/Badges.tsxindex 7789305c66..b0c6abc36e 100644--- a/apps/web/src/features/entity/components/Badges.tsx+++ b/apps/web/src/features/entity/components/Badges.tsx@@ -81,7 +81,7 @@ export function CreatedByBadgeSmall(props: { ownerId: string }) {}export function DraftBadge() {- return <Badge class="text-accent-30 border-edge-muted px-2">draft</Badge>;+ return <Badge class="text-yellow border-edge-muted px-2">draft</Badge>;}function _ImportantBadge() {@@ -106,7 +106,7 @@ function getCallStatusBadgeConfig(status: CallStatus): CallStatusBadgeConfig {};case 'MISSED':return {- class: 'text-accent-30 border-edge-muted px-2',+ class: 'text-yellow border-edge-muted px-2',label: 'missed',};case 'UNATTENDED':diff --git a/apps/web/src/features/entity/components/ProjectBreadCrumb.tsx b/apps/web/src/features/entity/components/ProjectBreadCrumb.tsxindex 2c8171cd9a..e426dfd45d 100644--- a/apps/web/src/features/entity/components/ProjectBreadCrumb.tsx+++ b/apps/web/src/features/entity/components/ProjectBreadCrumb.tsx@@ -53,7 +53,7 @@ export function ProjectBreadCrumb(props: {<aonClick={handleClick}class={cn('flex gap-1 items-center min-w-0 cursor-default', {- 'hover:text-accent': projectQuery.isSuccess,+ 'text-link hover:text-link-hover': projectQuery.isSuccess,})}><FolderIcon class="size-[1em]" />diff --git a/apps/web/src/features/entity/composed/ListEntity.tsx b/apps/web/src/features/entity/composed/ListEntity.tsxindex 966f0a5e5a..5d4a44fc4d 100644--- a/apps/web/src/features/entity/composed/ListEntity.tsx+++ b/apps/web/src/features/entity/composed/ListEntity.tsx@@ -212,10 +212,11 @@ export function ListEntity(props: ListEntityProps) {{'min-h-10 mx-1': !isMobile() && !usesCondensedNarrowLayout(),'min-h-9 mx-1': !isMobile() && usesCondensedNarrowLayout(),- 'bg-accent/8': props.checked,- 'bg-accent/16': props.checked && props.highlighted,- 'bg-hover': props.highlighted && !props.checked && !isTouchDevice(),- 'hover:bg-hover/65':+ 'bg-list-selected': props.checked,+ 'bg-list-selected-highlighted': props.checked && props.highlighted,+ 'bg-list-highlighted':+ props.highlighted && !props.checked && !isTouchDevice(),+ 'hover:bg-list-hover':!props.highlighted && !props.checked && !isTouchDevice(),})}diff --git a/apps/web/src/features/entity/composed/list-entity/foreign.tsx b/apps/web/src/features/entity/composed/list-entity/foreign.tsxindex 15aad74186..60ff4d3ea3 100644--- a/apps/web/src/features/entity/composed/list-entity/foreign.tsx+++ b/apps/web/src/features/entity/composed/list-entity/foreign.tsx@@ -362,7 +362,7 @@ function GithubPullRequestChecksPopover(props: {</span>)}</Show>- <Layer depth={5}>+ <Layer depth={4}><spanclass={cn('absolute right-1.5 top-1/2 z-10 inline-flex size-5 -translate-y-1/2 items-center justify-center rounded-md border border-edge-muted bg-active text-ink-extra-muted opacity-0 shadow-sm',diff --git a/apps/web/src/features/home/home-section-boundary.tsx b/apps/web/src/features/home/home-section-boundary.tsxindex d5d563e541..af8693179b 100644--- a/apps/web/src/features/home/home-section-boundary.tsx+++ b/apps/web/src/features/home/home-section-boundary.tsx@@ -77,10 +77,10 @@ function HomeSectionError(props: HomeSectionErrorProps) {function HomeSectionFallback() {return (<div class="space-y-3">- <div class="skeleton-shimmer h-4 w-32 rounded-full bg-ink/10" />+ <div class="skeleton-shimmer h-4 w-32 rounded-full bg-skeleton" /><div class="space-y-2">- <div class="skeleton-shimmer h-12 rounded-xl bg-hover/60" />- <div class="skeleton-shimmer h-12 rounded-xl bg-hover/40" />+ <div class="skeleton-shimmer h-12 rounded-xl bg-skeleton" />+ <div class="skeleton-shimmer h-12 rounded-xl bg-skeleton" /></div></div>);diff --git a/apps/web/src/features/integrations/import-linear/ImportLinear.tsx b/apps/web/src/features/integrations/import-linear/ImportLinear.tsxindex 6d547b235f..15c015afb9 100644--- a/apps/web/src/features/integrations/import-linear/ImportLinear.tsx+++ b/apps/web/src/features/integrations/import-linear/ImportLinear.tsx@@ -330,7 +330,7 @@ export default function ImportLinear() {<For each={createdIds()}>{(id) => (<a- class="text-sm text-ink underline underline-offset-2"+ class="text-sm text-link hover:text-link-hover visited:text-link-visited underline underline-offset-2"href={buildSimpleEntityUrl({ type: 'task', id })}target="_blank"rel="noreferrer"diff --git a/apps/web/src/features/next-soup/soup-view/section-header.tsx b/apps/web/src/features/next-soup/soup-view/section-header.tsxindex 1d4e19d908..6aacb60c9b 100644--- a/apps/web/src/features/next-soup/soup-view/section-header.tsx+++ b/apps/web/src/features/next-soup/soup-view/section-header.tsx@@ -17,7 +17,7 @@ export const SoupSectionHeader = (props: {data-highlighted={props.highlighted || undefined}class={cn('group/header relative w-[calc(100%-0.5rem)] mx-1 my-0.5 rounded-lg px-2 py-1.5 flex items-center gap-2.5 text-xs font-semibold tracking-tight',- 'text-text-muted bg-surface border border-edge-muted relative',+ 'text-ink-muted bg-surface border border-edge-muted relative',props.onClick && 'hover:bg-active',props.class,props.highlighted && 'bg-active'diff --git a/apps/web/src/features/next-soup/soup-view/soup-view.tsx b/apps/web/src/features/next-soup/soup-view/soup-view.tsxindex fa3793990c..928f1fbea7 100644--- a/apps/web/src/features/next-soup/soup-view/soup-view.tsx+++ b/apps/web/src/features/next-soup/soup-view/soup-view.tsx@@ -1234,7 +1234,7 @@ const SoupViewListContent = (props: SoupViewListProps) => {!isPullRefreshing()}>- <div class="flex items-center gap-2 p-3 text-xs text-text-muted touch:mt-(--mobile-content-inset-top) touch:mb-(--mobile-content-inset-bottom)">+ <div class="flex items-center gap-2 p-3 text-xs text-ink-muted touch:mt-(--mobile-content-inset-top) touch:mb-(--mobile-content-inset-bottom)"><Spinner class="size-3 animate-spin" />Searching...</div>@@ -1500,7 +1500,7 @@ const SoupViewListContent = (props: SoupViewListProps) => {source.isFetchingNextPage())}>- <div class="flex items-center gap-2 p-3 text-xs text-text-muted">+ <div class="flex items-center gap-2 p-3 text-xs text-ink-muted"><Spinner class="size-3 animate-spin" />{source.isFetchingNextPage()? 'Loading more...'diff --git a/apps/web/src/features/next-soup/soup-view/views/companies/CompanyListEntity.tsx b/apps/web/src/features/next-soup/soup-view/views/companies/CompanyListEntity.tsxindex 57e1454a38..d9382b8354 100644--- a/apps/web/src/features/next-soup/soup-view/views/companies/CompanyListEntity.tsx+++ b/apps/web/src/features/next-soup/soup-view/views/companies/CompanyListEntity.tsx@@ -85,11 +85,12 @@ export function CompanyListEntity(props: BaseListEntityProps) {'soup-list-entity @container/entity w-[calc(100%-0.5rem)] mr-1 relative group/narrow flex flex-col py-0.5 rounded-lg',{'min-h-10 mx-1': !isMobile(),- 'bg-accent/8': props.checked,- 'bg-accent/16':+ 'bg-list-selected': props.checked,+ 'bg-list-selected-highlighted':props.checked && props.highlighted && !isTouchDevice(),- 'bg-hover': props.highlighted && !props.checked && !isTouchDevice(),- 'hover:bg-hover/65':+ 'bg-list-highlighted':+ props.highlighted && !props.checked && !isTouchDevice(),+ 'hover:bg-list-hover':!props.highlighted && !props.checked && !isTouchDevice(),})}diff --git a/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx b/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsxindex 01a75e3c83..857107a3e6 100644--- a/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx+++ b/apps/web/src/features/next-soup/soup-view/views/inbox/InboxCard.tsx@@ -43,10 +43,11 @@ function Root(props: RootProps): JSX.Element {'group/inbox-item relative min-h-16 grid w-full grid-cols-[2rem_minmax(0,1fr)_max-content] grid-rows-[min-content_min-content] items-start gap-x-3 rounded-lg py-2.5 pr-2 pl-9',{- 'bg-accent/8': props.selected,- 'bg-accent/16': props.selected && props.highlighted,- 'bg-hover': props.highlighted && !props.selected && !isTouchDevice(),- 'hover:bg-hover/65':+ 'bg-list-selected': props.selected,+ 'bg-list-selected-highlighted': props.selected && props.highlighted,+ 'bg-list-highlighted':+ props.highlighted && !props.selected && !isTouchDevice(),+ 'hover:bg-list-hover':!props.highlighted && !props.selected && !isTouchDevice(),},props.classdiff --git a/apps/web/src/features/next-soup/soup-view/views/tasks/TaskListEntity.tsx b/apps/web/src/features/next-soup/soup-view/views/tasks/TaskListEntity.tsxindex 01cc2d6844..d9500d8e20 100644--- a/apps/web/src/features/next-soup/soup-view/views/tasks/TaskListEntity.tsx+++ b/apps/web/src/features/next-soup/soup-view/views/tasks/TaskListEntity.tsx@@ -148,11 +148,12 @@ export function TaskListEntity(props: TaskListEntityProps) {'soup-list-entity @container/entity w-[calc(100%-0.5rem)] mr-1 relative group/narrow flex flex-col py-0.5 rounded-lg',{'min-h-10 mx-1': !isMobile(),- 'bg-accent/8': props.checked,- 'bg-accent/16':+ 'bg-list-selected': props.checked,+ 'bg-list-selected-highlighted':props.checked && props.highlighted && !isTouchDevice(),- 'bg-hover': props.highlighted && !props.checked && !isTouchDevice(),- 'hover:bg-hover/65':+ 'bg-list-highlighted':+ props.highlighted && !props.checked && !isTouchDevice(),+ 'hover:bg-list-hover':!props.highlighted && !props.checked && !isTouchDevice(),})}diff --git a/apps/web/src/features/notifications/components/Playground.tsx b/apps/web/src/features/notifications/components/Playground.tsxindex 68bcd5e87d..e6390f5662 100644--- a/apps/web/src/features/notifications/components/Playground.tsx+++ b/apps/web/src/features/notifications/components/Playground.tsx@@ -295,7 +295,7 @@ function CustomBuilder(props: {<div><h3 class="text-sm font-medium text-ink mb-3">Live Preview</h3>- <div class="p-4 bg-surface-hover rounded-lg border border-edge-muted">+ <div class="p-4 bg-hover rounded-lg border border-edge-muted"><NotificationRenderernotification={props.customNotification}mode="preview"diff --git a/apps/web/src/features/onboarding/InteractiveOnboardingModal.tsx b/apps/web/src/features/onboarding/InteractiveOnboardingModal.tsxindex adec585b5e..b6a300baff 100644--- a/apps/web/src/features/onboarding/InteractiveOnboardingModal.tsx+++ b/apps/web/src/features/onboarding/InteractiveOnboardingModal.tsx@@ -222,7 +222,7 @@ function LessonsScreen(props: { onFinish: () => void; onReplay: () => void }) {</div></aside>- <main class="flex-1 min-w-0 flex flex-col bg-surface-secondary/30">+ <main class="flex-1 min-w-0 flex flex-col bg-panel"><div class="flex-1 min-h-0 overflow-hidden"><div style={bodyStyle()} class="size-full"><Showdiff --git a/apps/web/src/features/onboarding/OnboardingLesson.tsx b/apps/web/src/features/onboarding/OnboardingLesson.tsxindex 604a664b0e..8bbf8ea1e8 100644--- a/apps/web/src/features/onboarding/OnboardingLesson.tsx+++ b/apps/web/src/features/onboarding/OnboardingLesson.tsx@@ -176,7 +176,7 @@ export function OnboardingDemoFallback() {export function OnboardingDemoPanel(props: LessonStyleProps) {return (- <div class="flex-1 min-w-0 flex items-center justify-center bg-surface-secondary/30 overflow-hidden">+ <div class="flex-1 min-w-0 flex items-center justify-center bg-panel overflow-hidden"><div style={props.bodyStyle()} class="size-full"><Showwhen={props.lesson.definition.demo}diff --git a/apps/web/src/features/onboarding/OnboardingModalLayout.tsx b/apps/web/src/features/onboarding/OnboardingModalLayout.tsxindex 566c200eea..ed4c1d95b5 100644--- a/apps/web/src/features/onboarding/OnboardingModalLayout.tsx+++ b/apps/web/src/features/onboarding/OnboardingModalLayout.tsx@@ -106,7 +106,7 @@ export function OnboardingModalLayout(props: OnboardingModalLayoutProps) {</div></aside>- <main class="flex-1 min-w-0 flex flex-col bg-surface-secondary/30">+ <main class="flex-1 min-w-0 flex flex-col bg-panel"><div class="flex-1 min-h-0 overflow-hidden"><div style={props.bodyStyle()} class="size-full"><Showdiff --git a/apps/web/src/features/onboarding/components/MockAppChrome.tsx b/apps/web/src/features/onboarding/components/MockAppChrome.tsxindex 824a7b0075..66c1417471 100644--- a/apps/web/src/features/onboarding/components/MockAppChrome.tsx+++ b/apps/web/src/features/onboarding/components/MockAppChrome.tsx@@ -163,7 +163,7 @@ export function MockAppChrome(props: MockAppChromeProps) {.sidebar-glow { animation: sidebar-glow-pulse 1.8s ease-in-out infinite; border-radius: 4px; }`}</style><div class="flex size-full bg-surface rounded-sm border border-edge-muted">- <div class="px-2 shrink-0 bg-surface-secondary/50 flex flex-col items-center py-3 gap-1">+ <div class="px-2 shrink-0 bg-panel flex flex-col items-center py-3 gap-1"><MacroIcon class="size-5 text-accent mb-3" /><buttontype="button"diff --git a/apps/web/src/features/onboarding/lessons/create-entity.tsx b/apps/web/src/features/onboarding/lessons/create-entity.tsxindex fcb8553341..9eeb01bfc7 100644--- a/apps/web/src/features/onboarding/lessons/create-entity.tsx+++ b/apps/web/src/features/onboarding/lessons/create-entity.tsx@@ -187,6 +187,7 @@ function CreateEntityDemo(props: LessonContentProps) {<Dialog.Portal><Dialog.Overlay class="fixed inset-0 z-modal bg-modal-overlay pattern-diagonal-4 pattern-edge-muted" /><Dialog.Content+ class="[--color-surface:var(--color-dialog)]"onCloseAutoFocus={(e) => {// Once the lesson is complete, don't let the Dialog restore// focus to the element that opened it (containerRef or the `+`diff --git a/apps/web/src/features/paywall/PaywallComponent.tsx b/apps/web/src/features/paywall/PaywallComponent.tsxindex 2b52d0ffe3..6faa488438 100644--- a/apps/web/src/features/paywall/PaywallComponent.tsx+++ b/apps/web/src/features/paywall/PaywallComponent.tsx@@ -118,7 +118,7 @@ const PaywallComponent = (props: PaywallProps) => {<Show when={paywallMetadata()?.learnMoreUrl}>{(learnMoreUrl) => (<a- class="mt-16 inline-flex items-center gap-1 self-start text-xs text-ink-extra-muted hover:text-accent"+ class="mt-16 inline-flex items-center gap-1 self-start text-xs text-link hover:text-link-hover visited:text-link-visited"href={learnMoreUrl()}target="_blank"rel="noopener"diff --git a/apps/web/src/features/property/component/propertyValue/PropertyTooltip.tsx b/apps/web/src/features/property/component/propertyValue/PropertyTooltip.tsxindex e798589aa3..c3b167c05a 100644--- a/apps/web/src/features/property/component/propertyValue/PropertyTooltip.tsx+++ b/apps/web/src/features/property/component/propertyValue/PropertyTooltip.tsx@@ -308,7 +308,7 @@ const LinkValuePill = (props: { url: string }) => {href={props.url}target="_blank"rel="noopener noreferrer"- class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-ink-muted h-fit w-fit rounded-sm"+ class="inline-flex items-center gap-1.5 px-2 py-1 text-xs leading-none text-link hover:text-link-hover visited:text-link-visited h-fit w-fit rounded-sm"title={props.url}><Showdiff --git a/apps/web/src/features/property/component/propertyValue/PropertyValueIcon.tsx b/apps/web/src/features/property/component/propertyValue/PropertyValueIcon.tsxindex 4cbfda9402..599c998f56 100644--- a/apps/web/src/features/property/component/propertyValue/PropertyValueIcon.tsx+++ b/apps/web/src/features/property/component/propertyValue/PropertyValueIcon.tsx@@ -80,7 +80,7 @@ export const PropertyValueIcon: Component<PropertyValueIconProps> = (props) => {</Match><Match when={props.optionId === PROPERTY_OPTION_IDS.STATUS.IN_PROGRESS}><StatusInProgress- class={twMerge('size-3', props.class, 'text-alert-ink')}+ class={twMerge('size-3', props.class, 'text-yellow')}/></Match><Match when={props.optionId === PROPERTY_OPTION_IDS.STATUS.IN_REVIEW}>diff --git a/apps/web/src/features/settings/Appearance.tsx b/apps/web/src/features/settings/Appearance.tsxindex 178b2ef1d0..a3602a89dd 100644--- a/apps/web/src/features/settings/Appearance.tsx+++ b/apps/web/src/features/settings/Appearance.tsx@@ -22,14 +22,13 @@ import {themes,userThemes,} from '@theme/signals/themeSignals';-import type { ThemeV2 } from '@theme/types/themeTypes';+import type { ThemeV3 } from '@theme/types/themeTypes';import {applyTheme,clearThemePreview,deleteTheme,exportTheme,getLiveTheme,- isTokensDark,pinTheme,previewTheme,resolveActiveThemeId,@@ -203,7 +202,7 @@ function createThemeEditorController(onSelect: (id: string) => void) {toast.success('Theme saved');};- const deleteThemeById = (theme: ThemeV2) => {+ const deleteThemeById = (theme: ThemeV3) => {// The delete button sits inside the theme's (hovered, so previewed) row and// closes the dropdown programmatically, which skips onOpenChange — revert// the preview here so the deleted theme's colors don't linger.@@ -231,7 +230,7 @@ function ThemeSelectorRow(props: {description?: string;value: () => string;onSelect: (id: string) => void;- filter: (theme: ThemeV2) => boolean;+ filter: (theme: ThemeV3) => boolean;}) {const editor = createThemeEditorController(props.onSelect);@@ -276,11 +275,11 @@ function InterfaceThemeSelect(props: {value: () => string;onPick: (id: string) => void;onEdit: (id: string) => void;- onDelete: (theme: ThemeV2) => void;+ onDelete: (theme: ThemeV3) => void;onNewTheme: () => void;// Restricts the listed themes to this mode's themes (light or dark). The// selected value's swatch is always shown, even if it falls outside the filter.- filter?: (theme: ThemeV2) => boolean;+ filter?: (theme: ThemeV3) => boolean;// Whether this selector's inline editor is open — makes the pill's edit button// a toggle that scraps edits and closes via onCloseEditor.editorOpen?: () => boolean;@@ -291,16 +290,15 @@ function InterfaceThemeSelect(props: {let inputRef: HTMLInputElement | undefined;const current = () => themes().find((theme) => theme.id === props.value());- const matches = (theme: ThemeV2) =>+ const matches = (theme: ThemeV3) =>(props.filter?.(theme) ?? true) &&theme.name.toLowerCase().includes(filter().trim().toLowerCase());- const defaults = () =>- (DEFAULT_THEMES as unknown as ThemeV2[]).filter(matches);+ const defaults = () => DEFAULT_THEMES.filter(matches);const customs = () => userThemes().filter(matches);// `editable` custom themes get an inline edit affordance that opens the// editor for that theme (saving writes back to it).- const themeItem = (theme: ThemeV2, editable?: boolean) => (+ const themeItem = (theme: ThemeV3, editable?: boolean) => (<Dropdown.Itemclass="group touch:min-h-10"onSelect={() => props.onPick(theme.id)}@@ -479,21 +477,21 @@ const SYSTEM_VALUE = 'system';* to, so the user sees the theme it would apply.*/function ActiveThemeSelect(props: {- onChooseTheme: (theme: ThemeV2) => void;+ onChooseTheme: (theme: ThemeV3) => void;onChooseSystem: () => void;}) {const [open, setOpen] = createSignal(false);// The theme the OS scheme currently resolves to (for the System preference// swatch). Falls back to the live tokens so a swatch always renders.- const systemTheme = (): ThemeV2 => {+ const systemTheme = (): ThemeV3 => {const id = systemMode() === 'dark' ? darkModeTheme() : lightModeTheme();return themes().find((theme) => theme.id === id) ?? getLiveTheme();};// The active theme shown on the chip: the OS-resolved theme in system mode,// otherwise the pinned theme (via resolveActiveThemeId).- const activeTheme = (): ThemeV2 =>+ const activeTheme = (): ThemeV3 =>themes().find((theme) => theme.id === resolveActiveThemeId()) ??getLiveTheme();@@ -669,14 +667,14 @@ export function Appearance() {description="Used when your system is set to light."value={lightModeTheme}onSelect={setLightModeTheme}- filter={(theme) => !isTokensDark(theme.tokens)}+ filter={(theme) => theme.mode === 'light'}/><ThemeSelectorRowlabel="Dark theme"description="Used when your system is set to dark."value={darkModeTheme}onSelect={setDarkModeTheme}- filter={(theme) => isTokensDark(theme.tokens)}+ filter={(theme) => theme.mode === 'dark'}/></Show></SettingsCard>diff --git a/apps/web/src/features/settings/Billing.tsx b/apps/web/src/features/settings/Billing.tsxindex d1164c5d3b..d2941cc744 100644--- a/apps/web/src/features/settings/Billing.tsx+++ b/apps/web/src/features/settings/Billing.tsx@@ -95,7 +95,7 @@ export const Billing = () => {<>For questions about billing,{' '}<a- class="text-ink inline-flex items-center hover:text-accent"+ class="text-link hover:text-link-hover visited:text-link-visited inline-flex items-center"href="mailto:[email protected]">contact usdiff --git a/apps/web/src/features/settings/Crm.tsx b/apps/web/src/features/settings/Crm.tsxindex ebc968c72f..b00941f265 100644--- a/apps/web/src/features/settings/Crm.tsx+++ b/apps/web/src/features/settings/Crm.tsx@@ -321,9 +321,7 @@ function CrmContent() {export function Crm() {return (<Suspense- fallback={- <div class="animate-pulse bg-ink-extra-muted rounded h-4 w-32 m-6" />- }+ fallback={<div class="animate-pulse bg-skeleton rounded h-4 w-32 m-6" />}><CrmContent /></Suspense>diff --git a/apps/web/src/features/settings/MobileApp.tsx b/apps/web/src/features/settings/MobileApp.tsxindex 66650bacb6..d12022c7c9 100644--- a/apps/web/src/features/settings/MobileApp.tsx+++ b/apps/web/src/features/settings/MobileApp.tsx@@ -16,7 +16,7 @@ export function MobileApp() {<ahref="https://apps.apple.com/us/app/macro-app/id6743133649"rel="noopener noreferrer"- class="text-accent hover:underline"+ class="text-link hover:text-link-hover visited:text-link-visited hover:underline"target="_blank">App Storediff --git a/apps/web/src/features/settings/Shortcuts.tsx b/apps/web/src/features/settings/Shortcuts.tsxindex a3f72ef6bd..844c3b5535 100644--- a/apps/web/src/features/settings/Shortcuts.tsx+++ b/apps/web/src/features/settings/Shortcuts.tsx@@ -1019,7 +1019,7 @@ function Kbd(props: { shortcut: string; class?: string }) {function ShortcutRow(props: { item: ShortcutItem; spacer?: string }) {return (<div- class="group flex items-center gap-2 py-1.5 rounded-md hover:bg-surface-secondary/50 transition-colors"+ class="group flex items-center gap-2 py-1.5 rounded-md hover:bg-hover transition-colors"onMouseEnter={() => setHoveredCodes(props.item.codes)}onMouseLeave={() => setHoveredCodes([])}>diff --git a/apps/web/src/features/settings/Team.tsx b/apps/web/src/features/settings/Team.tsxindex a028553e64..d7159e367d 100644--- a/apps/web/src/features/settings/Team.tsx+++ b/apps/web/src/features/settings/Team.tsx@@ -1381,7 +1381,7 @@ function TeamManagement(props: {when={!teamQuery.isLoading}fallback={<SettingsCard>- <div class="animate-pulse bg-ink-extra-muted rounded h-16 m-4" />+ <div class="animate-pulse bg-skeleton rounded h-16 m-4" /></SettingsCard>}>@@ -1694,9 +1694,7 @@ export function Team() {// Each state renders its own SettingsPage (scrolling, centered column) so// Team matches the Account/Appearance layout.<Suspense- fallback={- <div class="animate-pulse bg-ink-extra-muted rounded h-4 w-32 m-6" />- }+ fallback={<div class="animate-pulse bg-skeleton rounded h-4 w-32 m-6" />}><TeamContent /></Suspense>diff --git a/apps/web/src/features/setup/flow/TeamStep.tsx b/apps/web/src/features/setup/flow/TeamStep.tsxindex 2f1d867a54..ed85adc407 100644--- a/apps/web/src/features/setup/flow/TeamStep.tsx+++ b/apps/web/src/features/setup/flow/TeamStep.tsx@@ -83,7 +83,7 @@ function OnTeamPanel(props: { name?: string; onContinue: () => void }) {return (<div class="flex flex-col gap-3"><div class="flex flex-col items-center gap-2 py-4 text-center">- <span class="flex size-10 items-center justify-center rounded-full bg-success/10 text-success">+ <span class="flex size-10 items-center justify-center rounded-full bg-success-bg text-success"><CheckIcon class="size-5" /></span><p class="text-sm font-medium text-ink">diff --git a/apps/web/src/features/theme/components/ColorPickerPopover.tsx b/apps/web/src/features/theme/components/ColorPickerPopover.tsxindex 6cbb0a6e81..2f58eddbad 100644--- a/apps/web/src/features/theme/components/ColorPickerPopover.tsx+++ b/apps/web/src/features/theme/components/ColorPickerPopover.tsx@@ -1,21 +1,33 @@import { Popover } from '@kobalte/core/popover';import { Slider } from '@kobalte/core/slider';+import { Tabs } from '@kobalte/core/tabs';import { cn, Layer } from '@ui';+import Color from 'colorjs.io';import {batch,createEffect,+ createMemo,createSignal,+ For,type JSX,onCleanup,onMount,Show,untrack,} from 'solid-js';-import { convertOklchTo, getOklch, validateColor } from '../utils/colorUtil';+import {+ convertOklchTo,+ formatOklch,+ getOklch,+ sanitizeOklch,+ validateColor,+} from '../utils/colorUtil';import { ColorSwatch } from './ColorSwatch';// Chroma axis maxes out at 0.37, matching the Basic editor's chroma slider.const CHROMA_MAX = 0.37;+const COLOR_FIELD_SAMPLE_WIDTH = 64;+const COLOR_FIELD_SAMPLE_HEIGHT = 40;const RING ='pointer-events-none absolute size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[white] shadow-[0_1px_3px_oklch(0_0_0/0.4)]';@@ -29,8 +41,55 @@ function ColorField(props: {onC: (n: number) => void;}) {let ref!: HTMLDivElement;+ let canvas!: HTMLCanvasElement;+ let drawFrame: number | undefined;const [dragging, setDragging] = createSignal(false);+ // CSS overlay gradients do not preserve an exact OKLCH lightness/chroma+ // coordinate at their intersections. Paint the field from the same OKLCH+ // values used by the thumb so its center matches the sampled area.+ createEffect(() => {+ const hue = props.h();+ if (drawFrame !== undefined) cancelAnimationFrame(drawFrame);+ drawFrame = requestAnimationFrame(() => {+ const context = canvas.getContext('2d');+ if (!context) return;++ const sampleCanvas = document.createElement('canvas');+ sampleCanvas.width = COLOR_FIELD_SAMPLE_WIDTH;+ sampleCanvas.height = COLOR_FIELD_SAMPLE_HEIGHT;+ const sampleContext = sampleCanvas.getContext('2d');+ if (!sampleContext) return;++ const image = sampleContext.createImageData(+ COLOR_FIELD_SAMPLE_WIDTH,+ COLOR_FIELD_SAMPLE_HEIGHT+ );+ const color = new Color('oklch', [0, 0, hue]);++ for (let y = 0; y < COLOR_FIELD_SAMPLE_HEIGHT; y += 1) {+ const lightness = 1 - y / (COLOR_FIELD_SAMPLE_HEIGHT - 1);+ for (let x = 0; x < COLOR_FIELD_SAMPLE_WIDTH; x += 1) {+ const chroma = (x / (COLOR_FIELD_SAMPLE_WIDTH - 1)) * CHROMA_MAX;+ color.coords = [lightness, chroma, hue];+ const [red = 0, green = 0, blue = 0] = color.to('srgb').coords;+ const offset = (y * COLOR_FIELD_SAMPLE_WIDTH + x) * 4;++ image.data[offset] = Math.round(clamp(red, 0, 1) * 255);+ image.data[offset + 1] = Math.round(clamp(green, 0, 1) * 255);+ image.data[offset + 2] = Math.round(clamp(blue, 0, 1) * 255);+ image.data[offset + 3] = 255;+ }+ }++ sampleContext.putImageData(image, 0, 0);+ context.imageSmoothingEnabled = true;+ context.imageSmoothingQuality = 'high';+ context.clearRect(0, 0, canvas.width, canvas.height);+ context.drawImage(sampleCanvas, 0, 0, canvas.width, canvas.height);+ });+ });+const apply = (e: PointerEvent) => {const r = ref.getBoundingClientRect();const x = Math.min(Math.max(e.clientX - r.left, 0), r.width) / r.width;@@ -47,6 +106,7 @@ function ColorField(props: {document.addEventListener('pointermove', move, { passive: true });document.addEventListener('pointerup', up, { passive: true });onCleanup(() => {+ if (drawFrame !== undefined) cancelAnimationFrame(drawFrame);document.removeEventListener('pointermove', move);document.removeEventListener('pointerup', up);});@@ -55,15 +115,18 @@ function ColorField(props: {return (<divref={ref}- class="relative h-40 flex-1 cursor-crosshair touch-none rounded-md"- style={{- background: `linear-gradient(to bottom, transparent, oklch(0 0 ${props.h()}deg)), linear-gradient(to right, oklch(1 0 ${props.h()}deg), oklch(0.65 ${CHROMA_MAX} ${props.h()}deg))`,- }}+ class="relative h-40 flex-1 cursor-crosshair touch-none overflow-hidden rounded-md"onPointerDown={(e) => {setDragging(true);apply(e);}}>+ <canvas+ ref={canvas}+ width={256}+ height={160}+ class="pointer-events-none absolute inset-0 size-full"+ /><divclass={RING}style={{@@ -81,6 +144,51 @@ function ColorField(props: {const HUE_GRADIENT ='linear-gradient(to bottom, oklch(0.7 0.2 0deg), oklch(0.7 0.2 60deg), oklch(0.7 0.2 120deg), oklch(0.7 0.2 180deg), oklch(0.7 0.2 240deg), oklch(0.7 0.2 300deg), oklch(0.7 0.2 360deg))';+const HORIZONTAL_HUE_GRADIENT =+ 'linear-gradient(to right, hsl(0 100% 50%), hsl(60 100% 50%), hsl(120 100% 50%), hsl(180 100% 50%), hsl(240 100% 50%), hsl(300 100% 50%), hsl(360 100% 50%))';++function clamp(value: number, min: number, max: number): number {+ return Math.min(Math.max(value, min), max);+}++function ChannelSlider(props: {+ label: string;+ value: () => number;+ min: number;+ max: number;+ step: number;+ gradient: () => string;+ suffix?: string;+ onChange: (value: number) => void;+}) {+ return (+ <Slider+ minValue={props.min}+ maxValue={props.max}+ step={props.step}+ value={[props.value()]}+ onChange={(value) => props.onChange(value[0] ?? props.min)}+ aria-label={props.label}+ class="flex items-center gap-3"+ >+ <span class="w-10 text-xs text-ink-muted">{props.label}</span>+ <Slider.Track+ class="relative h-3 flex-1 rounded-full border border-edge-muted"+ style={{ background: props.gradient() }}+ >+ <Slider.Fill class="absolute h-full rounded-full bg-transparent" />+ <Slider.Thumb class="top-1/2 size-4 -translate-y-1/2 rounded-full border-2 border-[white] bg-surface shadow-[0_1px_3px_oklch(0_0_0/0.4)] outline-none">+ <Slider.Input />+ </Slider.Thumb>+ </Slider.Track>+ <span class="w-12 text-right font-mono text-[11px] text-ink-muted">+ {Math.round(props.value())}+ {props.suffix}+ </span>+ </Slider>+ );+}+/** Vertical hue slider (0 → 360), backed by Kobalte's generic Slider so pointer* dragging and keyboard control come for free; we only style the rail/thumb.* `inverted` keeps 0° at the top (matching the prior hand-rolled slider). */@@ -123,9 +231,11 @@ export function ColorPickerPopover(props: {l: () => number;c: () => number;h: () => number;+ alpha?: () => number;onL: (n: number) => void;onC: (n: number) => void;onH: (n: number) => void;+ onAlpha?: (n: number) => void;ariaLabel: string;title?: string;subtitle?: string;@@ -134,26 +244,110 @@ export function ColorPickerPopover(props: {/** Custom trigger content (replaces the default swatch). */trigger?: JSX.Element;}) {- const oklch = () => `oklch(${props.l()} ${props.c()} ${props.h()}deg)`;+ const pickerColor = createMemo(() =>+ sanitizeOklch({+ l: props.l(),+ c: props.c(),+ h: props.h(),+ alpha: props.alpha?.() ?? 1,+ })+ );+ const lightness = () => pickerColor().l;+ const chroma = () => pickerColor().c;+ const hue = () => pickerColor().h;+ const alpha = () => pickerColor().alpha;+ const oklch = () => formatOklch(pickerColor());- // Hex field keeps its own text state while dragging so picker-driven updates- // don't fight the user's keystrokes.- const [hexText, setHexText] = createSignal('');- const [hexInvalid, setHexInvalid] = createSignal(false);+ const color = () => new Color(oklch());+ const rgb = createMemo(() => {+ const [r, g, b] = color()+ .to('srgb')+ .coords.map((channel) => clamp(Number(channel) || 0, 0, 1));+ return { r: r * 255, g: g * 255, b: b * 255 };+ });+ const convertedHsl = createMemo(() => {+ const [h, s, l] = color().to('hsl').coords;+ return {+ h: Number(h),+ s: clamp(Number(s) || 0, 0, 100),+ l: clamp(Number(l) || 0, 0, 100),+ };+ });+ const initialHslHue = convertedHsl().h;+ const [hslHue, setHslHue] = createSignal(+ Number.isFinite(initialHslHue) ? initialHslHue : 0+ );++ // HSL hue is undefined at zero saturation. Keep the last meaningful HSL hue+ // so gray, white, and black can be saturated without jumping to red.+ createEffect(() => {+ const next = convertedHsl();+ if (next.s > 0.001 && Number.isFinite(next.h)) setHslHue(next.h);+ });++ const applyColor = (next: Color) => {+ const converted = next.to('oklch');+ const nextH = Number(converted.coords[2]);+ const safe = sanitizeOklch(+ {+ l: converted.coords[0],+ c: converted.coords[1],+ h: nextH,+ alpha: converted.alpha,+ },+ pickerColor()+ );+ batch(() => {+ props.onL(safe.l);+ props.onC(safe.c);+ if (safe.c > 0.0001 && Number.isFinite(nextH)) props.onH(safe.h);+ });+ };++ const setRgbChannel = (channel: 'r' | 'g' | 'b', value: number) => {+ const next = { ...rgb(), [channel]: value };+ applyColor(+ new Color('srgb', [next.r / 255, next.g / 255, next.b / 255], alpha())+ );+ };++ const setHslChannel = (channel: 'h' | 's' | 'l', value: number) => {+ if (channel === 'h') setHslHue(value);+ const next = {+ h: channel === 'h' ? value : hslHue(),+ s: channel === 's' ? value : convertedHsl().s,+ l: channel === 'l' ? value : convertedHsl().l,+ };+ applyColor(new Color('hsl', [next.h, next.s, next.l], alpha()));+ };++ type ColorFormat = 'hex' | 'rgb' | 'hsl';+ const [format, setFormat] = createSignal<ColorFormat>('hex');+ // The format field keeps its own text state while dragging so picker-driven+ // updates don't fight the user's keystrokes.+ const [colorText, setColorText] = createSignal('');+ const [colorInvalid, setColorInvalid] = createSignal(false);const [isSetByInput, setIsSetByInput] = createSignal(false);createEffect(() => {- const next = convertOklchTo(props.l(), props.c(), props.h(), 'hex');+ const next = convertOklchTo(+ props.l(),+ props.c(),+ props.h(),+ format(),+ alpha()+ );if (untrack(isSetByInput)) {setIsSetByInput(false);} else {- setHexText(next);+ setColorText(next);}});- const setHex = (value: string) => {- if (!value || value.trim().length < 6 || !validateColor(value)) {- setHexInvalid(true);+ const setColorTextValue = (value: string) => {+ setColorText(value);+ if (!value || value.trim().length < 4 || !validateColor(value)) {+ setColorInvalid(true);return;}try {@@ -162,12 +356,15 @@ export function ColorPickerPopover(props: {setIsSetByInput(true);props.onL(next.l || 0);props.onC(next.c || 0);- props.onH(next.h || 0);+ // White, black, and gray have no defined hue. Preserve the picker's+ // current hue so adding chroma does not jump back to red.+ if (next.c > 0.0001) props.onH(next.h || 0);+ props.onAlpha?.(next.alpha);});- setHexInvalid(false);+ setColorInvalid(false);} catch (error) {console.error(`Error processing color "${value}":`, error);- setHexInvalid(true);+ setColorInvalid(true);}};@@ -192,7 +389,7 @@ export function ColorPickerPopover(props: {<Popover.Content class="z-modal"><Popover.Arrow class="fill-surface" /><div- class="flex w-64 flex-col gap-3 rounded-xl border border-edge-muted bg-surface p-3 shadow-lg"+ class="flex w-[34rem] max-w-[calc(100vw-2rem)] flex-col gap-4 rounded-xl border border-edge-muted bg-surface p-4 shadow-lg"role="dialog"aria-label={props.ariaLabel}>@@ -213,26 +410,150 @@ export function ColorPickerPopover(props: {</div></Show>- <div class="flex gap-3">+ <div class="flex gap-4"><ColorField- l={props.l}- c={props.c}- h={props.h}+ l={lightness}+ c={chroma}+ h={hue}onL={props.onL}onC={props.onC}/>- <HueSlider h={props.h} onH={props.onH} />+ <HueSlider h={hue} onH={props.onH} /></div>+ <Slider+ minValue={0}+ maxValue={1}+ step={0.01}+ value={[alpha()]}+ onChange={(value) => props.onAlpha?.(value[0] ?? 1)}+ aria-label="Alpha"+ class="flex items-center gap-3"+ >+ <span class="w-10 text-xs text-ink-muted">Alpha</span>+ <Slider.Track+ class="relative h-3 flex-1 rounded-full border border-edge-muted theme-alpha-track"+ style={{+ background: `linear-gradient(to right, transparent, ${formatOklch({ ...pickerColor(), alpha: 1 })}), repeating-conic-gradient(var(--color-surface-2) 0 25%, var(--color-surface-4) 0 50%) 0 / 8px 8px`,+ }}+ >+ <Slider.Fill class="absolute h-full rounded-full bg-transparent" />+ <Slider.Thumb+ class="top-1/2 size-4 -translate-y-1/2 rounded-full border-2 border-[white] bg-[var(--picker-color)] shadow-[0_1px_3px_oklch(0_0_0/0.4)] outline-none"+ style={{ '--picker-color': oklch() }}+ >+ <Slider.Input />+ </Slider.Thumb>+ </Slider.Track>+ <span class="w-10 text-right font-mono text-[11px] text-ink-muted">+ {Math.round(alpha() * 100)}%+ </span>+ </Slider>++ <Tabs+ value={format()}+ onChange={(value) => setFormat(value as ColorFormat)}+ >+ <Tabs.List class="grid grid-cols-3 overflow-hidden rounded-md border border-edge-muted bg-inset p-0.5">+ <For each={['hex', 'rgb', 'hsl'] as const}>+ {(value) => (+ <Tabs.Trigger+ value={value}+ class="rounded-sm px-3 py-1.5 text-xs uppercase text-ink-muted outline-none data-selected:bg-surface data-selected:text-ink data-selected:shadow-sm"+ >+ {value}+ </Tabs.Trigger>+ )}+ </For>+ </Tabs.List>+ </Tabs>++ <Show when={format() === 'rgb'}>+ <div class="flex flex-col gap-3 rounded-md bg-inset p-3">+ <ChannelSlider+ label="Red"+ value={() => rgb().r}+ min={0}+ max={255}+ step={1}+ gradient={() =>+ `linear-gradient(to right, rgb(0 ${rgb().g} ${rgb().b}), rgb(255 ${rgb().g} ${rgb().b}))`+ }+ onChange={(value) => setRgbChannel('r', value)}+ />+ <ChannelSlider+ label="Green"+ value={() => rgb().g}+ min={0}+ max={255}+ step={1}+ gradient={() =>+ `linear-gradient(to right, rgb(${rgb().r} 0 ${rgb().b}), rgb(${rgb().r} 255 ${rgb().b}))`+ }+ onChange={(value) => setRgbChannel('g', value)}+ />+ <ChannelSlider+ label="Blue"+ value={() => rgb().b}+ min={0}+ max={255}+ step={1}+ gradient={() =>+ `linear-gradient(to right, rgb(${rgb().r} ${rgb().g} 0), rgb(${rgb().r} ${rgb().g} 255))`+ }+ onChange={(value) => setRgbChannel('b', value)}+ />+ </div>+ </Show>++ <Show when={format() === 'hsl'}>+ <div class="flex flex-col gap-3 rounded-md bg-inset p-3">+ <ChannelSlider+ label="Hue"+ value={hslHue}+ min={0}+ max={360}+ step={1}+ gradient={() => HORIZONTAL_HUE_GRADIENT}+ suffix="°"+ onChange={(value) => setHslChannel('h', value)}+ />+ <ChannelSlider+ label="Sat"+ value={() => convertedHsl().s}+ min={0}+ max={100}+ step={1}+ gradient={() =>+ `linear-gradient(to right, hsl(${hslHue()} 0% ${convertedHsl().l}%), hsl(${hslHue()} 100% ${convertedHsl().l}%))`+ }+ suffix="%"+ onChange={(value) => setHslChannel('s', value)}+ />+ <ChannelSlider+ label="Light"+ value={() => convertedHsl().l}+ min={0}+ max={100}+ step={1}+ gradient={() =>+ `linear-gradient(to right, hsl(${hslHue()} ${convertedHsl().s}% 0%), hsl(${hslHue()} ${convertedHsl().s}% 50%), hsl(${hslHue()} ${convertedHsl().s}% 100%))`+ }+ suffix="%"+ onChange={(value) => setHslChannel('l', value)}+ />+ </div>+ </Show>+<inputclass={cn(- 'rounded-md border border-edge-muted bg-transparent px-2 py-1 font-mono text-xs text-ink outline-none focus:border-accent',- hexInvalid() && 'border-failure text-failure'+ 'h-10 rounded-md border border-edge-muted bg-transparent px-3 text-center font-mono text-sm text-ink outline-none focus:border-accent',+ colorInvalid() && 'border-failure text-failure')}- value={hexText()}- onInput={(e) => setHex(e.currentTarget.value)}+ value={colorText()}+ onInput={(e) => setColorTextValue(e.currentTarget.value)}spellcheck={false}- aria-label="Hex color"+ aria-label={`${format().toUpperCase()} color`}/></div></Popover.Content>diff --git a/apps/web/src/features/theme/components/ThemeChipPill.tsx b/apps/web/src/features/theme/components/ThemeChipPill.tsxindex 374020b137..22814fcc25 100644--- a/apps/web/src/features/theme/components/ThemeChipPill.tsx+++ b/apps/web/src/features/theme/components/ThemeChipPill.tsx@@ -1,15 +1,20 @@-import { type ComponentProps, Show, splitProps, type ValidComponent } from 'solid-js';-import { Dynamic } from 'solid-js/web';import CaretDownIcon from '@phosphor/caret-down.svg';import { cn } from '@ui';-import type { ThemeV2 } from '../types/themeTypes';+import {+ type ComponentProps,+ Show,+ splitProps,+ type ValidComponent,+} from 'solid-js';+import { Dynamic } from 'solid-js/web';+import type { ThemeV3 } from '../types/themeTypes';import { ThemeChips } from './ThemeChips';type ThemeChipPillProps = {/** Element/component to render as. Defaults to a <button>. */as?: ValidComponent;/** Theme whose swatch is shown; when absent, only the name renders. */- theme?: ThemeV2 | null;+ theme?: ThemeV3 | null;/** Label shown beside the swatch. */name: string;/** Shows a trailing caret, signalling the pill opens a dropdown. */diff --git a/apps/web/src/features/theme/components/ThemeChips.tsx b/apps/web/src/features/theme/components/ThemeChips.tsxindex 5de782694e..5097f7a181 100644--- a/apps/web/src/features/theme/components/ThemeChips.tsx+++ b/apps/web/src/features/theme/components/ThemeChips.tsx@@ -1,8 +1,8 @@-import type { ThemeV2 } from '@theme/types/themeTypes';import IconTextA from '@phosphor-icons/core/regular/text-aa.svg?component-solid';+import type { ThemeV3 } from '@theme/types/themeTypes';import { cn } from '@ui';+import type { JSX } from 'solid-js';-type Token = { l: number; c: number; h: number };type ThemeChipsSize = 'inline' | 'sm' | 'md';const sizeStyles: Record<@@ -35,28 +35,18 @@ const sizeStyles: Record</** A theme swatch: an encompassing square of the theme's panel surface with the* accent and ink (A) inside. Always shows the theme's original intended colors* — each theme is intrinsically light or dark. */-export function ThemeChips(props: { theme: ThemeV2; size?: ThemeChipsSize }) {+export function ThemeChips(props: { theme: ThemeV3; size?: ThemeChipsSize }) {const styles = () => sizeStyles[props.size ?? 'md'];- const oklch = (token: Token) => {- if (!token) {- return 'transparent';+ const tokenStyle = (): JSX.CSSProperties => {+ const style: Record<string, string> = {+ 'background-color': 'var(--color-panel)',+ };+ for (const [token, value] of Object.entries(props.theme.colorTokens)) {+ style[`--color-${token}`] = value;}- return `oklch(${token.l} ${token.c} ${token.h}deg)`;+ return style as JSX.CSSProperties;};- // Approximate the app's prevalent panel surface rather than the darkest base- // background: lift b0's lightness by the theme's depth, matching how Layer- // elevates surfaces (b0l + (layer/5) * themeDepth) at a typical panel depth.- // Flat b0 made the swatches read too dark and blend together.- const PANEL_LAYER = 2;- const bg = () => {- const b0 = props.theme.tokens.b0;- const l = b0.l + (PANEL_LAYER / 5) * (props.theme.depth ?? 0.15);- return `oklch(${l} ${b0.c} ${b0.h}deg)`;- };- const accent = () => oklch(props.theme.tokens.a0);- const ink = () => oklch(props.theme.tokens.c0);-// Uniform padding around and gap between the items so the spacing reads evenly.return (<span@@ -64,17 +54,15 @@ export function ThemeChips(props: { theme: ThemeV2; size?: ThemeChipsSize }) {'inline-flex items-center border border-edge-muted',styles().root)}- style={{- 'background-color': bg(),- }}+ style={tokenStyle()}><spanclass={cn('inline-block rounded-sm', styles().accent)}style={{- 'background-color': accent(),+ 'background-color': 'var(--color-accent)',}}/>- <IconTextA class={styles().icon} style={{ color: ink() }} />+ <IconTextA class={styles().icon} style={{ color: 'var(--color-ink)' }} /></span>);}diff --git a/apps/web/src/features/theme/components/ThemeCrud.tsx b/apps/web/src/features/theme/components/ThemeCrud.tsxindex 5032256a75..e68168fb43 100644--- a/apps/web/src/features/theme/components/ThemeCrud.tsx+++ b/apps/web/src/features/theme/components/ThemeCrud.tsx@@ -1,11 +1,17 @@-import IconClipboard from '@phosphor-icons/core/regular/clipboard.svg?component-solid';import IconDotsThreeVertical from '@phosphor/dots-three-vertical.svg';-import { deleteTheme, exportTheme } from '../utils/themeUtils';-import { setDarkModeTheme, setLightModeTheme, userThemes } from '../signals/themeSignals';-import { createMemo, Show } from 'solid-js';+import IconClipboard from '@phosphor-icons/core/regular/clipboard.svg?component-solid';import { Button, Dropdown } from '@ui';+import { createMemo, Show } from 'solid-js';+import {+ setDarkModeTheme,+ setLightModeTheme,+ userThemes,+} from '../signals/themeSignals';+import { deleteTheme, exportTheme } from '../utils/themeUtils';-interface ThemeCrudProps { themeId: string; }+interface ThemeCrudProps {+ themeId: string;+}export function ThemeCrud(props: ThemeCrudProps) {const isUserTheme = createMemo(() =>diff --git a/apps/web/src/features/theme/components/ThemeEdit3.tsx b/apps/web/src/features/theme/components/ThemeEdit3.tsxnew file mode 100644index 0000000000..214b998e9d--- /dev/null+++ b/apps/web/src/features/theme/components/ThemeEdit3.tsx@@ -0,0 +1,241 @@+import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHeader';+import { StaticSplitLabel } from '@components/app/split-layout/components/SplitLabel';+import { toast } from '@core/component/Toast/Toast';+import type { CollectionNode } from '@kobalte/core';+import { Select } from '@kobalte/core/select';+import CaretDownIcon from '@phosphor/caret-down.svg';+import CheckIcon from '@phosphor/check.svg';+import ClipboardIcon from '@phosphor/clipboard.svg';+import { Button, Layer } from '@ui';+import { createEffect, createSignal, onMount } from 'solid-js';+import { DEFAULT_THEMES } from '../constants';+import {+ currentThemeId,+ liveThemeMode,+ setIsThemeSaved,+ setLiveThemeMode,+ themeColorTokens,+} from '../signals/themeSignals';+import { paletteTokens, type ThemeV3 } from '../types/themeTypes';+import { setLiveThemeColorTokens } from '../utils/themeUtils';+import { isThemeV3 } from '../utils/themeValidation';+import { ThemeTokenEditor } from './ThemeTokenEditor';++type SystemTheme = (typeof DEFAULT_THEMES)[number];+type StoredDraft = {+ sourceThemeId: string;+ paletteVersion: number;+ theme: ThemeV3;+};++const THEME_EDIT_3_DRAFT_KEY = 'macro-theme-edit-3-draft';+const FIXED_PALETTE_VERSION = 1;++function readStoredDraft(): StoredDraft | null {+ if (typeof localStorage === 'undefined') return null;++ try {+ const value = localStorage.getItem(THEME_EDIT_3_DRAFT_KEY);+ if (!value) return null;+ const parsed: unknown = JSON.parse(value);+ if (typeof parsed !== 'object' || parsed === null) return null;+ const candidate = parsed as Record<string, unknown>;+ if (typeof candidate.sourceThemeId !== 'string') return null;+ if (!isThemeV3(candidate.theme)) return null;+ return {+ sourceThemeId: candidate.sourceThemeId,+ paletteVersion:+ typeof candidate.paletteVersion === 'number'+ ? candidate.paletteVersion+ : 0,+ theme: candidate.theme,+ };+ } catch {+ return null;+ }+}++function initialSystemTheme(): SystemTheme {+ return (+ DEFAULT_THEMES.find((theme) => theme.id === currentThemeId()) ??+ DEFAULT_THEMES[0]+ );+}++/** Local V3 theme workbench. Edits are rendered immediately but are not saved. */+export default function ThemeEdit3() {+ const initial = initialSystemTheme();+ const [selectedTheme, setSelectedTheme] = createSignal(initial);+ const [name, setName] = createSignal(`${initial.name} custom`);+ const [draftId, setDraftId] = createSignal(`${initial.id}-custom`);+ const [storageHydrated, setStorageHydrated] = createSignal(false);++ const loadSystemTheme = (theme: SystemTheme) => {+ setSelectedTheme(theme);+ setName(`${theme.name} custom`);+ setDraftId(`${theme.id}-custom`);+ setLiveThemeMode(theme.mode);+ setLiveThemeColorTokens({ ...theme.colorTokens });+ setIsThemeSaved(false);+ };++ // Restore the local workbench without changing the user's selected app+ // theme. If the source was removed, start from the current system theme.+ onMount(() => {+ const stored = readStoredDraft();+ const source = stored+ ? DEFAULT_THEMES.find((theme) => theme.id === stored.sourceThemeId)+ : undefined;++ if (stored && source) {+ const restoredTokens = {+ ...source.colorTokens,+ ...stored.theme.colorTokens,+ };+ if (stored.paletteVersion !== FIXED_PALETTE_VERSION) {+ for (const token of paletteTokens) {+ restoredTokens[token] = source.colorTokens[token];+ }+ }++ setSelectedTheme(source);+ setName(stored.theme.name);+ setDraftId(stored.theme.id);+ setLiveThemeMode(stored.theme.mode);+ setLiveThemeColorTokens(restoredTokens);+ setIsThemeSaved(false);+ } else {+ loadSystemTheme(initial);+ }+ setStorageHydrated(true);+ });++ createEffect(() => {+ if (!storageHydrated() || typeof localStorage === 'undefined') return;++ const stored: StoredDraft = {+ sourceThemeId: selectedTheme().id,+ paletteVersion: FIXED_PALETTE_VERSION,+ theme: {+ id: draftId(),+ name: name(),+ version: 3,+ mode: liveThemeMode(),+ colorTokens: { ...themeColorTokens() },+ },+ };++ try {+ localStorage.setItem(THEME_EDIT_3_DRAFT_KEY, JSON.stringify(stored));+ } catch {+ // The editor remains fully usable when storage is unavailable or full.+ }+ });++ const copyTheme = async () => {+ const theme: ThemeV3 = {+ id: draftId(),+ name: name().trim() || 'Custom theme',+ version: 3,+ mode: liveThemeMode(),+ colorTokens: { ...themeColorTokens() },+ };+ await navigator.clipboard.writeText(JSON.stringify(theme, null, 2));+ toast.success('Full theme JSON copied to clipboard');+ };++ return (+ <div class="size-full overflow-auto text-ink">+ <SplitHeaderLeft>+ <StaticSplitLabel label="Theme editor V3" />+ </SplitHeaderLeft>++ <div class="sticky top-0 z-10 border-b border-edge-muted bg-panel px-6 py-4 backdrop-blur-xl">+ <div class="flex w-full flex-wrap items-center gap-3">+ <Select<SystemTheme>+ options={DEFAULT_THEMES}+ value={selectedTheme()}+ onChange={(theme) => theme && loadSystemTheme(theme)}+ optionValue="id"+ optionTextValue="name"+ gutter={6}+ itemComponent={(itemProps: {+ item: CollectionNode<SystemTheme>;+ }) => (+ <Select.Item+ item={itemProps.item}+ class="flex items-center gap-2 rounded-sm px-2 py-2 text-sm text-ink outline-none data-highlighted:bg-hover"+ >+ <span+ class="size-4 rounded-full border border-edge-muted"+ style={{+ 'background-color':+ itemProps.item.rawValue.colorTokens.accent,+ }}+ />+ <Select.ItemLabel class="min-w-0 flex-1 truncate">+ {itemProps.item.rawValue.name}+ </Select.ItemLabel>+ <span class="text-[10px] uppercase text-ink-extra-muted">+ {itemProps.item.rawValue.mode}+ </span>+ <Select.ItemIndicator>+ <CheckIcon class="size-3.5" />+ </Select.ItemIndicator>+ </Select.Item>+ )}+ >+ <Select.Trigger class="flex h-9 min-w-52 items-center gap-2 rounded-md border border-edge-muted bg-surface px-3 text-left text-sm outline-none hover:bg-hover data-expanded:bg-active">+ <span+ class="size-4 rounded-full border border-edge-muted"+ style={{+ 'background-color': selectedTheme().colorTokens.accent,+ }}+ />+ <Select.Value<SystemTheme>>+ {(state) => (+ <span class="min-w-0 flex-1 truncate">+ {state.selectedOption().name}+ </span>+ )}+ </Select.Value>+ <CaretDownIcon class="size-3.5 shrink-0 text-ink-muted" />+ </Select.Trigger>+ <Select.Portal>+ <Layer depth={3}>+ <Select.Content class="z-action-menu min-w-60 rounded-md border border-edge-muted bg-surface p-1 shadow-lg">+ <Select.Listbox />+ </Select.Content>+ </Layer>+ </Select.Portal>+ </Select>++ <input+ value={name()}+ onInput={(event) => setName(event.currentTarget.value)}+ aria-label="Theme name"+ spellcheck={false}+ class="h-9 min-w-48 flex-1 rounded-md border border-edge-muted bg-surface px-3 text-sm text-ink outline-none placeholder:text-ink-placeholder focus:border-accent"+ />++ <Button variant="base" size="md" onClick={copyTheme}>+ <ClipboardIcon class="size-4" />+ Copy full theme JSON+ </Button>+ </div>+ </div>++ <main class="mx-auto max-w-6xl px-6 py-8">+ <div class="mb-5">+ <h2 class="text-base font-medium">Color tokens</h2>+ <p class="mt-1 max-w-2xl text-xs leading-relaxed text-ink-muted">+ Pick a color to make it custom, or compose it from another raw token+ with link, mix, and alpha controls. Every change updates the active+ CSS variables immediately.+ </p>+ </div>+ <ThemeTokenEditor />+ </main>+ </div>+ );+}diff --git a/apps/web/src/features/theme/components/ThemeEditor.tsx b/apps/web/src/features/theme/components/ThemeEditor.tsxindex db9077d996..b2c8b57d03 100644--- a/apps/web/src/features/theme/components/ThemeEditor.tsx+++ b/apps/web/src/features/theme/components/ThemeEditor.tsx@@ -1,21 +1,13 @@-import { TabsInset } from '@core/component/TabsInset';-import ShuffleIcon from '@phosphor/shuffle.svg';import XIcon from '@phosphor/x.svg';import { Button, Layer } from '@ui';-import { createSignal, Show } from 'solid-js';-import { ThemeEditorAdvanced } from './ThemeEditorAdvanced';-import { randomizeTheme, ThemeEditorBasic } from './ThemeEditorBasic';--type EditorTab = 'basic' | 'advanced';+import { ThemeTokenEditor } from './ThemeTokenEditor';/**- * The inline theme-editing panel: a toolbar (close, name, randomize, Basic /- * Variables tabs) over the Basic and Advanced (variables) editors, plus a save- * action. Rendered beneath a theme selector while its editor is open — mounting- * fresh each time resets the tab to Basic.+ * The inline theme-editing panel: a toolbar over the VNext raw tokens and+ * component-facing semantic assignments, followed by a save action.*- * Editing mutates the live theme tokens directly (via the Basic/Advanced- * editors); the parent owns open/close, the editable name, and what save does.+ * Editing mutates live color tokens; the parent owns open/close, the editable+ * name, and what save does.*/export function ThemeEditor(props: {/** The editable theme name (controlled by the parent). */@@ -24,14 +16,12 @@ export function ThemeEditor(props: {onClose: () => void;onSave: () => void;}) {- const [editorTab, setEditorTab] = createSignal<EditorTab>('basic');-return (// A distinct active-editing block: a neutral, slightly elevated surface (one// step lighter than the card via Layer depth), inset + rounded so it reads as// a nested element. No color-forward accent.<Layer depth={3}>- <div class="mx-3 my-2 flex flex-col gap-3 rounded-xl border border-ink/[0.05] bg-surface px-4 py-4">+ <div class="mx-3 my-2 flex max-h-[70vh] flex-col gap-3 rounded-xl border border-edge-muted bg-surface px-4 py-4"><div class="flex items-center gap-2"><Buttonlabel="Close editor"@@ -51,38 +41,9 @@ export function ThemeEditor(props: {class="w-40 min-w-0 rounded-md border border-edge-muted bg-transparent px-2 py-1 text-xs text-ink outline-none placeholder:text-ink-placeholder focus:border-accent"/><div class="flex-1" />- <Button- label="Randomize theme"- onPointerDown={randomizeTheme}- variant="ghost"- size="icon-sm"- >- <ShuffleIcon class="size-4" />- </Button>- <TabsInset- depth={3}- onChange={(value) => setEditorTab(value as EditorTab)}- list={[- { value: 'basic', label: 'Basic' },- { value: 'advanced', label: 'Variables' },- ]}- value={editorTab()}- defaultValue="basic"- /></div>- <div class="relative overflow-hidden rounded-lg">- {/* The Basic view defines the box height; it stays mounted (just- hidden) on the Variables tab so the variables list scrolls within- that same height. Basic rows use dividers only; the Variables list- keeps a bordered container. */}- <div classList={{ invisible: editorTab() !== 'basic' }}>- <ThemeEditorBasic />- </div>- <Show when={editorTab() === 'advanced'}>- <div class="absolute inset-0 overflow-y-auto rounded-lg border border-ink/[0.05] bg-surface">- <ThemeEditorAdvanced />- </div>- </Show>+ <div class="min-h-0 overflow-y-auto pr-1">+ <ThemeTokenEditor /></div><div class="flex justify-end"><Button variant="base" size="sm" onClick={props.onSave}>diff --git a/apps/web/src/features/theme/components/ThemeEditorAdvanced.tsx b/apps/web/src/features/theme/components/ThemeEditorAdvanced.tsxindex 0cea0dc91c..2fa75640c2 100644--- a/apps/web/src/features/theme/components/ThemeEditorAdvanced.tsx+++ b/apps/web/src/features/theme/components/ThemeEditorAdvanced.tsx@@ -1,13 +1,30 @@-import { batch, createEffect, createSignal, For, type Setter, untrack } from 'solid-js';-import { convertOklchTo, getOklch, validateColor } from '../utils/colorUtil';-import type { ThemeReactiveColor } from '../types/themeTypes';+import {+ batch,+ createEffect,+ createSignal,+ For,+ type Setter,+ untrack,+} from 'solid-js';import { themeReactive } from '../signals/themeReactive';+import type { ThemeReactiveColor } from '../types/themeTypes';+import { convertOklchTo, getOklch, validateColor } from '../utils/colorUtil';import { ColorPickerPopover } from './ColorPickerPopover';const displayType = () => 'hex';-function setColor(colorValue: ThemeReactiveColor, colorString: string, inputElement: HTMLInputElement, setIsSetByInput: Setter<boolean>){- if(!colorString || colorString.trim() === '' || colorString.length < 6 || !validateColor(colorString)){+function setColor(+ colorValue: ThemeReactiveColor,+ colorString: string,+ inputElement: HTMLInputElement,+ setIsSetByInput: Setter<boolean>+) {+ if (+ !colorString ||+ colorString.trim() === '' ||+ colorString.length < 6 ||+ !validateColor(colorString)+ ) {inputElement.classList.add('invalid');return;}@@ -20,11 +37,12 @@ function setColor(colorValue: ThemeReactiveColor, colorString: string, inputElemcolorValue.h[1](oklch.h ? oklch.h : 0);});inputElement.classList.remove('invalid');+ } catch (error) {+ console.error(`Error processing color "${colorString}":`, error);}- catch(error) { console.error(`Error processing color "${colorString}":`, error); }}-export function ThemeEditorAdvanced(){+export function ThemeEditorAdvanced() {return (<><style>{`@@ -42,7 +60,7 @@ export function ThemeEditorAdvanced(){style={{'font-size': 'var(--text-xs)','font-weight': 300,- 'display': 'block',+ display: 'block',}}><div@@ -55,32 +73,35 @@ export function ThemeEditorAdvanced(){"><For each={Object.entries(themeReactive)}>- {([colorKey, colorValue]) => {- // a1 thru a4 are not currently being used, so we will hide them- if (['a1', 'a2', 'a3', 'a4'].includes(colorKey)) return null;- const [isSetByInput, setIsSetByInput] = createSignal(false);- const [inputValue, setInputValue] = createSignal('');+ {([colorKey, colorValue]) => {+ // a1 thru a4 are not currently being used, so we will hide them+ if (['a1', 'a2', 'a3', 'a4'].includes(colorKey)) return null;+ const [isSetByInput, setIsSetByInput] = createSignal(false);+ const [inputValue, setInputValue] = createSignal('');- createEffect(() => {- const newValue = convertOklchTo(- colorValue.l[0](),- colorValue.c[0](),- colorValue.h[0](),- displayType()- );- if (untrack(isSetByInput)) { setIsSetByInput(false); /* console.log('blocked!!!'); */ }- else { setInputValue(newValue); }- });+ createEffect(() => {+ const newValue = convertOklchTo(+ colorValue.l[0](),+ colorValue.c[0](),+ colorValue.h[0](),+ displayType()+ );+ if (untrack(isSetByInput)) {+ setIsSetByInput(false); /* console.log('blocked!!!'); */+ } else {+ setInputValue(newValue);+ }+ });- return (- <div- style="+ return (+ <div+ style="font-family: var(--font-mono);background-color: var(--b0);"- >- <div- style="+ >+ <div+ style="grid-template-columns: 104px calc(7ch + 40px) 1fr calc(4ch + 40px);background-color: oklch(from var(--c0) l c h / 0.06);align-items: center;@@ -88,9 +109,9 @@ export function ThemeEditorAdvanced(){height: 61px;gap: 1px 0px;"- >- <div- style="+ >+ <div+ style="background-color: var(--b0);box-sizing: border-box;align-items: center;@@ -99,22 +120,22 @@ export function ThemeEditorAdvanced(){height: 100%;width: 100%;"- >- <ColorPickerPopover- l={() => colorValue.l[0]()}- c={() => colorValue.c[0]()}- h={() => colorValue.h[0]()}- onL={(n) => colorValue.l[1](n)}- onC={(n) => colorValue.c[1](n)}- onH={(n) => colorValue.h[1](n)}- title={colorValue.description}- subtitle={`--${colorKey}`}- ariaLabel={`Edit ${colorValue.description} (--${colorKey})`}- />- </div>+ >+ <ColorPickerPopover+ l={() => colorValue.l[0]()}+ c={() => colorValue.c[0]()}+ h={() => colorValue.h[0]()}+ onL={(n) => colorValue.l[1](n)}+ onC={(n) => colorValue.c[1](n)}+ onH={(n) => colorValue.h[1](n)}+ title={colorValue.description}+ subtitle={`--${colorKey}`}+ ariaLabel={`Edit ${colorValue.description} (--${colorKey})`}+ />+ </div>- <div- style="+ <div+ style="background-color: var(--b0);box-sizing: border-box;align-items: center;@@ -124,10 +145,17 @@ export function ThemeEditorAdvanced(){height: 100%;width: 100%;"- >- <input- onInput={ (e) => {setColor(colorValue, e.target.value, e.target, setIsSetByInput); }}- style="+ >+ <input+ onInput={(e) => {+ setColor(+ colorValue,+ e.target.value,+ e.target,+ setIsSetByInput+ );+ }}+ style="color: var(--color-ink-extra-muted);font-family: var(--font-mono);font-size: var(--text-xs);@@ -137,14 +165,14 @@ export function ThemeEditorAdvanced(){border: none;width: 100%;"- class="theme-editor-advanced-input"- value={inputValue()}- type="text"- />- </div>+ class="theme-editor-advanced-input"+ value={inputValue()}+ type="text"+ />+ </div>- <div- style="+ <div+ style="color: var(--color-ink-extra-muted);background-color: var(--b0);box-sizing: border-box;@@ -157,11 +185,11 @@ export function ThemeEditorAdvanced(){height: 100%;width: 100%;"- >- {colorValue.description}- </div>- <div- style="+ >+ {colorValue.description}+ </div>+ <div+ style="background-color: var(--b0);box-sizing: border-box;white-space: nowrap;@@ -171,13 +199,13 @@ export function ThemeEditorAdvanced(){height: 100%;width: 100%;"- >- --{colorKey}- </div>+ >+ --{colorKey}</div></div>- );- }}+ </div>+ );+ }}</For></div></div>diff --git a/apps/web/src/features/theme/components/ThemeEditorBasic.tsx b/apps/web/src/features/theme/components/ThemeEditorBasic.tsxindex 706f9edebf..a6457cf0ab 100644--- a/apps/web/src/features/theme/components/ThemeEditorBasic.tsx+++ b/apps/web/src/features/theme/components/ThemeEditorBasic.tsx@@ -1,6 +1,6 @@import { batch, createEffect, createSignal, type JSX, untrack } from 'solid-js';-import { setThemeDepth, themeDepth } from '../signals/themeSignals';import { themeReactive } from '../signals/themeReactive';+import { setThemeDepth, themeDepth } from '../signals/themeSignals';import { convertOklchTo, getOklch, validateColor } from '../utils/colorUtil';import { ColorPickerPopover } from './ColorPickerPopover';@@ -27,9 +27,9 @@ function setChroma(chroma: number, saturation: number) {function setHue(hue: number) {batch(() => {- themeReactive.a0.h[1](hue );- themeReactive.a1.h[1](hue + 40);- themeReactive.a2.h[1](hue + 80);+ themeReactive.a0.h[1](hue);+ themeReactive.a1.h[1](hue + 40);+ themeReactive.a2.h[1](hue + 80);themeReactive.a3.h[1](hue + 120);themeReactive.a4.h[1](hue + 160);@@ -67,11 +67,31 @@ function setSaturation(saturation: number) {let q = 8;function sigmoid(x: number, b: number): number {- return (-((1 / (1 + Math.exp(b * (x - 0.5))) - 0.5) * (0.5 / (1 / (1 + Math.exp(q / 2)) - 0.5))) + 0.5);+ return (+ -(+ (1 / (1 + Math.exp(b * (x - 0.5))) - 0.5) *+ (0.5 / (1 / (1 + Math.exp(q / 2)) - 0.5))+ ) + 0.5+ );}function getContrastFromY(y: number): number {- return ((-2 * Math.log(1 / (-(y - 0.5) / (0.5 / (1 / (1 + Math.exp(q / 2)) - 0.5)) + 0.5) - 1) - (-2 * Math.log(1 / (-(y - 0.5) / (0.5 / (1 / (1 + Math.exp(q / 2)) - 0.5)) + 0.5) - 1) < 0 ? -1 : 1)) / (q - 1) / 2 + 0.4);+ return (+ (-2 *+ Math.log(+ 1 / (-(y - 0.5) / (0.5 / (1 / (1 + Math.exp(q / 2)) - 0.5)) + 0.5) - 1+ ) -+ (-2 *+ Math.log(+ 1 / (-(y - 0.5) / (0.5 / (1 / (1 + Math.exp(q / 2)) - 0.5)) + 0.5) - 1+ ) <+ 0+ ? -1+ : 1)) /+ (q - 1) /+ 2 ++ 0.4+ );}function setContrast(contrast: number) {@@ -80,7 +100,7 @@ function setContrast(contrast: number) {const b = c * (q - 1) + p;batch(() => {- themeReactive.b0.l[1](sigmoid(0.00, b));+ themeReactive.b0.l[1](sigmoid(0.0, b));themeReactive.b1.l[1](sigmoid(0.08, b));themeReactive.b2.l[1](sigmoid(0.18, b));themeReactive.b3.l[1](sigmoid(0.22, b));@@ -90,11 +110,11 @@ function setContrast(contrast: number) {themeReactive.c3.l[1](sigmoid(0.76, b));themeReactive.c2.l[1](sigmoid(0.84, b));themeReactive.c1.l[1](sigmoid(0.92, b));- themeReactive.c0.l[1](sigmoid(1.00, b));+ themeReactive.c0.l[1](sigmoid(1.0, b));});}-export function randomizeTheme(){+export function randomizeTheme() {batch(() => {const randLightness = Math.random();const randHue = Math.random();@@ -104,7 +124,7 @@ export function randomizeTheme(){const randSaturation = Math.random() * 0.5;const randContrast = 1 - randLightness;const randChroma = (Math.random() * 0.5 + 0.5) * 0.37;- const randDepth = (Math.random() * 0.2 + 0.1);+ const randDepth = Math.random() * 0.2 + 0.1;setContrast(randContrast);setChroma(randChroma, randSaturation);@@ -136,8 +156,11 @@ function NumberInput(props: {createEffect(() => {const value = props.get();- if (untrack(isSetByInput)) { setIsSetByInput(false); }- else { setText(Math.round(toDisplay(value)).toString()); }+ if (untrack(isSetByInput)) {+ setIsSetByInput(false);+ } else {+ setText(Math.round(toDisplay(value)).toString());+ }});return (@@ -154,22 +177,24 @@ function NumberInput(props: {width: 6ch;">- <input- class="theme-editor-basic-num"- type="number"- value={text()}- min={dMin()}- max={dMax()}- step={1}- onInput={(e) => {- const raw = e.currentTarget.value;- setIsSetByInput(true);- setText(raw);- const d = parseFloat(raw);- if (!Number.isNaN(d)) { props.set(fromDisplay(Math.max(dMin(), Math.min(dMax(), d)))); }- }}- onBlur={() => setText(Math.round(toDisplay(props.get())).toString())}- style="+ <input+ class="theme-editor-basic-num"+ type="number"+ value={text()}+ min={dMin()}+ max={dMax()}+ step={1}+ onInput={(e) => {+ const raw = e.currentTarget.value;+ setIsSetByInput(true);+ setText(raw);+ const d = parseFloat(raw);+ if (!Number.isNaN(d)) {+ props.set(fromDisplay(Math.max(dMin(), Math.min(dMax(), d))));+ }+ }}+ onBlur={() => setText(Math.round(toDisplay(props.get())).toString())}+ style="font-family: var(--font-mono);background: transparent;box-sizing: border-box;@@ -182,7 +207,7 @@ function NumberInput(props: {padding: 0;flex: 1;"- />+ /><span style="color: var(--c2); font-size: 12px; flex: none;">%</span></div>);@@ -338,7 +363,7 @@ function BasicSlider(props: {);}-export function ThemeEditorBasic(){+export function ThemeEditorBasic() {const a0 = themeReactive.a0;// Saturation is stored as a fraction of the accent's chroma; recover it so@@ -352,11 +377,17 @@ export function ThemeEditorBasic(){Math.max(min, Math.min(max, n));const handleSaturationChange = (e: Event) =>- setSaturation(clamp(parseFloat((e.target as HTMLInputElement).value), 0, 1));+ setSaturation(+ clamp(parseFloat((e.target as HTMLInputElement).value), 0, 1)+ );const handleContrastChange = (e: Event) =>- setContrast(clamp(parseFloat((e.target as HTMLInputElement).value), 0, 0.8));+ setContrast(+ clamp(parseFloat((e.target as HTMLInputElement).value), 0, 0.8)+ );const handleDepthChange = (e: Event) =>- setThemeDepth(clamp(parseFloat((e.target as HTMLInputElement).value), 0, 0.4));+ setThemeDepth(+ clamp(parseFloat((e.target as HTMLInputElement).value), 0, 0.4)+ );return (<>@@ -408,7 +439,12 @@ export function ThemeEditorBasic(){min={0}max={1}/>- <NumberInput get={satFraction} set={setSaturation} min={0} max={1} />+ <NumberInput+ get={satFraction}+ set={setSaturation}+ min={0}+ max={1}+ /></Control><Control label="Lightness">@@ -435,7 +471,12 @@ export function ThemeEditorBasic(){min={0}max={0.4}/>- <NumberInput get={themeDepth} set={setThemeDepth} min={0} max={0.4} />+ <NumberInput+ get={themeDepth}+ set={setThemeDepth}+ min={0}+ max={0.4}+ /></Control></div></div>diff --git a/apps/web/src/features/theme/components/ThemeList.tsx b/apps/web/src/features/theme/components/ThemeList.tsxindex 63d04e9a43..03500acf4e 100644--- a/apps/web/src/features/theme/components/ThemeList.tsx+++ b/apps/web/src/features/theme/components/ThemeList.tsx@@ -1,65 +1,73 @@-import { currentThemeId, isThemeSaved, showDarkThemes, showLightThemes, themes } from '../signals/themeSignals';import { useAnalytics } from '@app/lib/analytics/analytics-context';-import { applyTheme, isTokensDark } from '../utils/themeUtils';-import { ThemeChips } from './ThemeChips';-import { ThemeCrud } from './ThemeCrud';import { cn } from '@ui';-import { createMemo, For } from 'solid-js';+import {+ currentThemeId,+ isThemeSaved,+ showDarkThemes,+ showLightThemes,+ themes,+} from '../signals/themeSignals';+import { applyTheme } from '../utils/themeUtils';+import { ThemeChips } from './ThemeChips';+import { ThemeCrud } from './ThemeCrud';function ThemeList() {- const analytics = useAnalytics()+ const analytics = useAnalytics();const visibleThemes = createMemo(() =>themes().filter((theme) =>- isTokensDark(theme.tokens) ? showDarkThemes() : showLightThemes()+ theme.mode === 'dark' ? showDarkThemes() : showLightThemes()));return (- <div class="@container p-2">- <div class="grid grid-cols-1 gap-2 @md:grid-cols-2 @2xl:grid-cols-3">- <For each={visibleThemes()}>- {(theme) => {- const selected = () => theme.id === currentThemeId() && isThemeSaved();- const select = () => {- analytics.track('theme_changed', { themeId: theme.id })- applyTheme(theme.id)- };- return (- // role="button" (not <button>) because the card contains ThemeCrud's- // own buttons, and nesting native buttons is invalid HTML.- <div- role="button"- tabIndex={0}+ <div class="@container p-2">+ <div class="grid grid-cols-1 gap-2 @md:grid-cols-2 @2xl:grid-cols-3">+ <For each={visibleThemes()}>+ {(theme) => {+ const selected = () =>+ theme.id === currentThemeId() && isThemeSaved();+ const select = () => {+ analytics.track('theme_changed', { themeId: theme.id });+ applyTheme(theme.id);+ };+ return (+ // role="button" (not <button>) because the card contains ThemeCrud's+ // own buttons, and nesting native buttons is invalid HTML.+ <div+ role="button"+ tabIndex={0}+ class={cn(+ 'flex min-w-0 cursor-pointer items-center gap-2 rounded-lg border bg-surface p-2 transition-colors duration-[var(--transition)]',+ selected()+ ? 'border-accent'+ : 'border-edge-muted hover:bg-hover'+ )}+ onClick={select}+ onKeyDown={(e) => {+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ select();+ }+ }}+ >+ <ThemeChips theme={theme} />+ <spanclass={cn(- 'flex min-w-0 cursor-pointer items-center gap-2 rounded-lg border bg-surface p-2 transition-colors duration-[var(--transition)]',- selected() ? 'border-accent' : 'border-edge-muted hover:bg-hover'+ 'min-w-0 flex-1 truncate text-sm',+ selected() ? 'text-accent' : 'text-ink')}- onClick={select}- onKeyDown={(e) => {- if (e.key === 'Enter' || e.key === ' ') {- e.preventDefault()- select()- }- }}>- <ThemeChips theme={theme} />- <span- class={cn(- 'min-w-0 flex-1 truncate text-sm',- selected() ? 'text-accent' : 'text-ink'- )}- >- {theme.name}- </span>- <ThemeCrud themeId={theme.id} />- </div>- )- }}- </For>- </div>+ {theme.name}+ </span>+ <ThemeCrud themeId={theme.id} />+ </div>+ );+ }}+ </For></div>+ </div>);}diff --git a/apps/web/src/features/theme/components/ThemeTokenEditor.tsx b/apps/web/src/features/theme/components/ThemeTokenEditor.tsxnew file mode 100644index 0000000000..4f56efa50e--- /dev/null+++ b/apps/web/src/features/theme/components/ThemeTokenEditor.tsx@@ -0,0 +1,775 @@+import type { CollectionNode } from '@kobalte/core';+import { Collapsible } from '@kobalte/core/collapsible';+import { Select } from '@kobalte/core/select';+import CaretDownIcon from '@phosphor/caret-down.svg';+import CheckIcon from '@phosphor/check.svg';+import PlusIcon from '@phosphor/plus.svg';+import XIcon from '@phosphor/x.svg';+import { Button, Checkbox, Layer } from '@ui';+import {+ batch,+ createEffect,+ createMemo,+ createSignal,+ For,+ Show,+} from 'solid-js';+import { themeColorTokens } from '../signals/themeSignals';+import {+ contentTokens,+ edgeTokens,+ inputColorTokens,+ paletteTokens,+ surfaceTokens,+} from '../types/themeTypes';+import {+ convertOklchTo,+ getOklch,+ sanitizeOklch,+ tryGetOklch,+} from '../utils/colorUtil';+import {+ parseThemeAssignment,+ serializeThemeAssignment,+ type ThemeAssignment,+} from '../utils/themeAssignments';+import {+ previewLiveThemeColorToken,+ updateLiveThemeColorToken,+} from '../utils/themeUtils';+import { ColorPickerPopover } from './ColorPickerPopover';++const TOKEN_OPTIONS = inputColorTokens;+type TokenOption = { value: string; label: string };+const TOKEN_SELECT_OPTIONS: TokenOption[] = TOKEN_OPTIONS.map((token) => ({+ value: token,+ label: token,+}));++const tokenSections = [+ { label: 'Surface', tokens: surfaceTokens, defaultOpen: true, ramp: true },+ { label: 'Content', tokens: contentTokens, ramp: true },+ { label: 'Edge', tokens: edgeTokens },+ { label: 'Accent', tokens: ['accent'] as const },+ { label: 'Palette', tokens: paletteTokens },+ {+ label: 'Semantic surfaces',+ tokens: [+ 'surface',+ 'inset',+ 'lift',+ 'page',+ 'panel',+ 'dialog',+ 'menu',+ 'tooltip',+ 'toast',+ 'input',+ 'input-focus',+ 'message',+ 'chrome',+ ] as const,+ defaultOpen: true,+ },+ {+ label: 'Ink',+ tokens: [+ 'ink',+ 'ink-muted',+ 'ink-subtle',+ 'ink-disabled',+ 'ink-placeholder',+ ] as const,+ },+ {+ label: 'Links',+ tokens: ['link', 'link-hover', 'link-visited'] as const,+ },+ {+ label: 'Interaction',+ tokens: ['hover', 'active', 'selected'] as const,+ },+ {+ label: 'Status',+ tokens: ['success', 'warning', 'failure'] as const,+ },+] as const;++function tokenLabel(token: string): string {+ return token+ .split('-')+ .map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)+ .join(' ');+}++function resolvedColor(token: string): string {+ if (typeof document === 'undefined') return '#000000';+ const probe = document.createElement('span');+ try {+ probe.style.position = 'absolute';+ probe.style.visibility = 'hidden';+ probe.style.backgroundColor = `var(--color-${token})`;+ (document.body ?? document.documentElement).append(probe);+ return getComputedStyle(probe).backgroundColor || '#000000';+ } catch {+ return '#000000';+ } finally {+ probe.remove();+ }+}++function ColorControl(props: {+ token: string;+ value: string;+ onChange: (value: string) => void;+}) {+ const readColor = () => {+ try {+ return getOklch(props.value);+ } catch {+ return tryGetOklch(resolvedColor(props.token));+ }+ };+ const initial = readColor();+ const [l, setL] = createSignal(initial.l);+ const [c, setC] = createSignal(initial.c);+ const [h, setH] = createSignal(initial.h);+ const [alpha, setAlpha] = createSignal(initial.alpha);+ let lastWritten = props.value;++ createEffect(() => {+ const value = props.value;+ if (value === lastWritten) return;+ lastWritten = value;+ try {+ const next = getOklch(value);+ setL(next.l);+ setC(next.c);+ setAlpha(next.alpha);+ // Achromatic colors have no meaningful hue. Keep the picker's hue state.+ if (next.c > 0.0001) setH(next.h);+ } catch {+ const next = tryGetOklch(resolvedColor(props.token), {+ l: l(),+ c: c(),+ h: h(),+ alpha: alpha(),+ });+ setL(next.l);+ setC(next.c);+ setAlpha(next.alpha);+ if (next.c > 0.0001) setH(next.h);+ }+ });++ const write = (next: {+ l?: number;+ c?: number;+ h?: number;+ alpha?: number;+ }) => {+ const current = sanitizeOklch({+ l: l(),+ c: c(),+ h: h(),+ alpha: alpha(),+ });+ const safe = sanitizeOklch({ ...current, ...next }, current);+ setL(safe.l);+ setC(safe.c);+ setH(safe.h);+ setAlpha(safe.alpha);+ lastWritten = convertOklchTo(safe.l, safe.c, safe.h, 'oklch', safe.alpha);+ props.onChange(lastWritten);+ };++ return (+ <ColorPickerPopover+ l={l}+ c={c}+ h={h}+ alpha={alpha}+ onL={(value) => write({ l: value })}+ onC={(value) => write({ c: value })}+ onH={(value) => write({ h: value })}+ onAlpha={(value) => write({ alpha: value })}+ ariaLabel={`Edit ${props.token}`}+ title={tokenLabel(props.token)}+ subtitle={props.token}+ trigger={+ <div+ class="size-9 rounded-md border border-edge-muted shadow-sm"+ style={{ 'background-color': `var(--color-${props.token})` }}+ />+ }+ />+ );+}++function TokenPill(props: {+ value: string;+ onChange: (value: string) => void;+ onRemove: () => void;+ label: string;+}) {+ const selectedOption = () =>+ TOKEN_SELECT_OPTIONS.find((option) => option.value === props.value) ??+ TOKEN_SELECT_OPTIONS[0];++ return (+ <div class="flex h-7 min-w-0 items-center rounded-full bg-ink/5 pl-0.5 text-xs text-ink">+ <Select<TokenOption>+ options={TOKEN_SELECT_OPTIONS}+ value={selectedOption()}+ onChange={(option) => option && props.onChange(option.value)}+ optionValue="value"+ optionTextValue="label"+ gutter={4}+ placement="bottom-start"+ itemComponent={(itemProps: { item: CollectionNode<TokenOption> }) => (+ <Select.Item+ item={itemProps.item}+ class="flex items-center gap-2 rounded-sm px-2 py-1.5 font-mono text-[11px] text-ink outline-none data-highlighted:bg-hover"+ >+ <span+ class="size-3 shrink-0 rounded-full border border-edge-muted"+ style={{+ 'background-color': `var(--color-${itemProps.item.rawValue.value})`,+ }}+ />+ <Select.ItemLabel class="min-w-0 flex-1 truncate">+ {itemProps.item.rawValue.label}+ </Select.ItemLabel>+ <Select.ItemIndicator>+ <CheckIcon class="size-3" />+ </Select.ItemIndicator>+ </Select.Item>+ )}+ >+ <Select.Trigger+ class="flex h-7 min-w-0 items-center gap-1.5 rounded-full px-1.5 outline-none hover:bg-hover data-expanded:bg-active"+ aria-label={props.label}+ >+ <span+ class="size-3 shrink-0 rounded-full border border-edge-muted"+ style={{ 'background-color': `var(--color-${props.value})` }}+ />+ <Select.Value<TokenOption>>+ {(state) => (+ <span class="max-w-28 truncate font-mono text-[11px]">+ {state.selectedOption().label}+ </span>+ )}+ </Select.Value>+ <CaretDownIcon class="size-3 shrink-0 text-ink-muted" />+ </Select.Trigger>+ <Select.Portal>+ <Layer depth={3}>+ <Select.Content class="z-action-menu max-h-64 min-w-40 overflow-auto rounded-md border border-edge-muted bg-surface p-1 shadow-lg">+ <Select.Listbox />+ </Select.Content>+ </Layer>+ </Select.Portal>+ </Select>+ <button+ type="button"+ class="mr-1 grid size-5 shrink-0 place-items-center rounded-full text-ink-muted hover:bg-hover hover:text-ink"+ aria-label={`Remove ${props.label}`}+ onClick={props.onRemove}+ >+ <XIcon class="size-3" />+ </button>+ </div>+ );+}++function TokenSlider(props: {+ label: string;+ value: number;+ color: string;+ track?: string;+ onPreview: (value: number) => void;+ onCommit: (value: number) => void;+}) {+ const [draft, setDraft] = createSignal(props.value);+ createEffect(() => setDraft(props.value));++ const update = (event: Event, commit: boolean) => {+ const value = Number((event.currentTarget as HTMLInputElement).value);+ setDraft(value);+ props.onPreview(value);+ if (commit) props.onCommit(value);+ };++ return (+ <label class="flex min-w-24 flex-1 items-center gap-2 text-[10px] text-ink-muted">+ <span class="w-8 shrink-0">{props.label}</span>+ <input+ type="range"+ min="0"+ max="1"+ step="0.01"+ value={draft()}+ aria-label={props.label}+ class="theme-token-slider h-1 min-w-16 flex-1 cursor-pointer appearance-none rounded-full"+ style={{+ '--slider-color': props.color,+ 'accent-color': props.color,+ background:+ props.track ??+ `linear-gradient(to right, ${props.color} ${draft() * 100}%, color-mix(in oklch, ${props.color} 15%, transparent) ${draft() * 100}%)`,+ }}+ onInput={(event) => update(event, false)}+ onChange={(event) => update(event, true)}+ />+ <span class="w-8 text-right font-mono">{Math.round(draft() * 100)}%</span>+ </label>+ );+}++function AssignmentControls(props: { token: string; value: string }) {+ const assignment = createMemo(() => parseThemeAssignment(props.value));+ const commit = (next: ThemeAssignment) =>+ updateLiveThemeColorToken(props.token, serializeThemeAssignment(next));+ const preview = (next: ThemeAssignment) =>+ previewLiveThemeColorToken(props.token, serializeThemeAssignment(next));+ const makeCustom = () =>+ commit({ kind: 'custom', value: resolvedColor(props.token) });++ return (+ <div class="flex min-w-0 flex-wrap items-center justify-end gap-2">+ {(() => {+ const current = assignment();+ if (current.kind === 'custom') {+ return (+ <>+ <span class="rounded-full bg-ink/5 px-2 py-1 font-mono text-[10px] text-ink-muted">+ custom+ </span>+ <Button+ variant="ghost"+ size="sm"+ onClick={() =>+ commit({ kind: 'linked', token: 'accent', alpha: 1 })+ }+ >+ <PlusIcon class="size-3" /> link+ </Button>+ </>+ );+ }++ if (current.kind === 'linked') {+ const withAlpha = (alpha: number): ThemeAssignment => ({+ ...current,+ alpha,+ });+ return (+ <>+ <TokenPill+ label={`${props.token} linked token`}+ value={current.token}+ onChange={(token) => commit({ ...current, token })}+ onRemove={makeCustom}+ />+ <TokenSlider+ label="Alpha"+ value={current.alpha}+ color={`var(--color-${current.token})`}+ onPreview={(alpha) => preview(withAlpha(alpha))}+ onCommit={(alpha) => commit(withAlpha(alpha))}+ />+ <Button+ variant="ghost"+ size="sm"+ onClick={() =>+ commit({+ kind: 'mixed',+ first: current.token,+ second: current.token === 'accent' ? 'content-0' : 'accent',+ mix: 0.5,+ alpha: current.alpha,+ })+ }+ >+ <PlusIcon class="size-3" /> mix+ </Button>+ </>+ );+ }++ const withSecondMix = (secondMix: number): ThemeAssignment => ({+ ...current,+ mix: 1 - secondMix,+ });+ const withAlpha = (alpha: number): ThemeAssignment => ({+ ...current,+ alpha,+ });+ return (+ <>+ <TokenPill+ label={`${props.token} first mix token`}+ value={current.first}+ onChange={(first) => commit({ ...current, first })}+ onRemove={makeCustom}+ />+ <TokenSlider+ label="Mix"+ value={1 - current.mix}+ color={`var(--color-${props.token})`}+ track={`linear-gradient(90deg in ${current.space ?? 'oklch'}, var(--color-${current.first}), var(--color-${current.second}))`}+ onPreview={(secondMix) => preview(withSecondMix(secondMix))}+ onCommit={(secondMix) => commit(withSecondMix(secondMix))}+ />+ <TokenPill+ label={`${props.token} second mix token`}+ value={current.second}+ onChange={(second) => commit({ ...current, second })}+ onRemove={() =>+ commit({+ kind: 'linked',+ token: current.first,+ alpha: current.alpha,+ })+ }+ />+ <TokenSlider+ label="Alpha"+ value={current.alpha}+ color={`var(--color-${current.second})`}+ onPreview={(alpha) => preview(withAlpha(alpha))}+ onCommit={(alpha) => commit(withAlpha(alpha))}+ />+ </>+ );+ })()}+ </div>+ );+}++function RampEditor(props: { tokens: readonly string[] }) {+ const from = () => props.tokens[0] ?? '';+ const to = () => props.tokens.at(-1) ?? '';+ const middle = () => props.tokens.slice(1, -1);++ const positionFromAssignment = (token: string): number | null => {+ const current = parseThemeAssignment(+ themeColorTokens()[token] ?? 'transparent'+ );+ if (current.kind !== 'mixed' || current.alpha < 0.999) return null;+ if (current.first === from() && current.second === to()) {+ return 1 - current.mix;+ }+ if (current.first === to() && current.second === from()) {+ return current.mix;+ }+ return null;+ };++ const defaultPositions = () =>+ Object.fromEntries(+ middle().map((token, index) => [+ token,+ positionFromAssignment(token) ??+ (index + 1) / (props.tokens.length - 1),+ ])+ );+ const [positions, setPositions] = createSignal<Record<string, number>>(+ defaultPositions()+ );+ const [overwrite, setOverwrite] = createSignal(false);++ createEffect(() => {+ themeColorTokens();+ setPositions((current) => {+ const next = { ...current };+ for (const [index, token] of middle().entries()) {+ next[token] =+ positionFromAssignment(token) ??+ current[token] ??+ (index + 1) / (props.tokens.length - 1);+ }+ return next;+ });++ if (+ overwrite() &&+ middle().some((token) => positionFromAssignment(token) === null)+ ) {+ setOverwrite(false);+ }+ });++ const rampValue = (token: string, position = positions()[token] ?? 0.5) =>+ serializeThemeAssignment({+ kind: 'mixed',+ first: from(),+ second: to(),+ mix: 1 - position,+ alpha: 1,+ space: 'srgb',+ });++ const attach = (token: string) =>+ updateLiveThemeColorToken(token, rampValue(token));+ const detach = (token: string) =>+ updateLiveThemeColorToken(token, resolvedColor(token));++ const setPosition = (token: string, position: number, commit: boolean) => {+ setPositions((current) => ({ ...current, [token]: position }));+ const value = rampValue(token, position);+ if (commit) updateLiveThemeColorToken(token, value);+ else previewLiveThemeColorToken(token, value);+ };++ const setOverwriteAll = (checked: boolean) => {+ setOverwrite(checked);+ if (!checked) return;+ batch(() => {+ for (const token of middle()) attach(token);+ });+ };++ return (+ <div class="border-b border-edge-muted bg-inset/50 px-4 py-4">+ <div class="mb-4 flex flex-wrap items-center gap-4">+ <div class="mr-auto">+ <div class="text-xs font-medium text-ink">Ramp editor</div>+ <div class="text-[11px] text-ink-extra-muted">+ Drag a stop to attach it to the sRGB interpolation.+ </div>+ </div>+ <Checkbox+ as="label"+ checked={overwrite()}+ onChange={setOverwriteAll}+ class="flex items-center gap-2 text-xs text-ink-muted"+ >+ <Checkbox.Control />+ <span>Overwrite custom stops</span>+ </Checkbox>+ </div>++ <div class="mb-5 grid grid-cols-2 gap-4 mobile:grid-cols-1">+ <div class="flex items-center gap-3 rounded-lg border border-edge-muted bg-surface p-2.5">+ <ColorControl+ token={from()}+ value={themeColorTokens()[from()] ?? 'transparent'}+ onChange={(value) => updateLiveThemeColorToken(from(), value)}+ />+ <div class="min-w-0">+ <div class="text-[10px] uppercase tracking-wide text-ink-extra-muted">+ From+ </div>+ <code class="text-xs text-ink-muted">{from()}</code>+ </div>+ </div>+ <div class="flex items-center gap-3 rounded-lg border border-edge-muted bg-surface p-2.5">+ <ColorControl+ token={to()}+ value={themeColorTokens()[to()] ?? 'transparent'}+ onChange={(value) => updateLiveThemeColorToken(to(), value)}+ />+ <div class="min-w-0">+ <div class="text-[10px] uppercase tracking-wide text-ink-extra-muted">+ To+ </div>+ <code class="text-xs text-ink-muted">{to()}</code>+ </div>+ </div>+ </div>++ <div class="relative h-14 px-2">+ <div+ class="absolute inset-x-2 top-3 h-5 rounded-full border border-edge-muted shadow-inner"+ style={{+ background: `linear-gradient(90deg in srgb, var(--color-${from()}), var(--color-${to()}))`,+ }}+ />+ <For each={middle()}>+ {(token) => {+ const attached = () => positionFromAssignment(token) !== null;+ return (+ <input+ type="range"+ min="0.04"+ max="0.96"+ step="0.01"+ value={positions()[token] ?? 0.5}+ aria-label={`${token} ramp position`}+ class="theme-ramp-stop pointer-events-none absolute inset-x-2 top-0 h-11 appearance-none bg-transparent"+ classList={{ 'is-attached': attached() }}+ style={{ '--stop-color': `var(--color-${token})` }}+ onInput={(event) =>+ setPosition(token, Number(event.currentTarget.value), false)+ }+ onChange={(event) =>+ setPosition(token, Number(event.currentTarget.value), true)+ }+ />+ );+ }}+ </For>+ </div>++ <div class="flex flex-wrap justify-center gap-2">+ <For each={middle()}>+ {(token) => {+ const attached = () => positionFromAssignment(token) !== null;+ return (+ <button+ type="button"+ class="flex items-center gap-1.5 rounded-full border border-edge-muted bg-surface px-2 py-1 font-mono text-[10px] text-ink-muted hover:bg-hover hover:text-ink"+ classList={{ 'border-accent/40': attached() }}+ onClick={() => (attached() ? detach(token) : attach(token))}+ title={+ attached()+ ? `Make ${token} custom`+ : `Link ${token} to this ramp`+ }+ >+ <span+ class="size-2.5 rounded-full border border-edge-muted"+ style={{ 'background-color': `var(--color-${token})` }}+ />+ {token}+ <span class="text-ink-extra-muted">+ {attached() ? 'linked' : 'custom'}+ </span>+ </button>+ );+ }}+ </For>+ </div>+ </div>+ );+}++function TokenRow(props: { token: string }) {+ const value = () => themeColorTokens()[props.token] ?? 'transparent';+ return (+ <div class="grid min-h-14 grid-cols-[minmax(12rem,0.8fr)_minmax(16rem,2fr)] items-center gap-4 border-t border-edge-muted px-4 py-2.5 first:border-t-0 mobile:grid-cols-1 mobile:gap-2">+ <div class="flex min-w-0 items-center gap-3">+ <ColorControl+ token={props.token}+ value={value()}+ onChange={(next) => updateLiveThemeColorToken(props.token, next)}+ />+ <div class="min-w-0">+ <div class="truncate text-sm text-ink">{tokenLabel(props.token)}</div>+ <code class="block truncate text-[11px] text-ink-extra-muted">+ {props.token}+ </code>+ </div>+ </div>+ <AssignmentControls token={props.token} value={value()} />+ </div>+ );+}++function TokenSection(props: {+ title: string;+ tokens: readonly string[];+ defaultOpen?: boolean;+ ramp?: boolean;+}) {+ return (+ <Collapsible+ defaultOpen={props.defaultOpen}+ class="border-b border-edge-muted last:border-b-0"+ >+ <Collapsible.Trigger class="group flex w-full items-center gap-2 bg-surface px-4 py-3 text-left text-sm text-ink-muted outline-none hover:bg-hover hover:text-ink">+ <span>{props.title}</span>+ <span class="rounded border border-edge-muted bg-inset px-1.5 py-0.5 font-mono text-[10px] text-ink-extra-muted">+ {props.tokens.length}+ </span>+ <CaretDownIcon class="ml-auto size-3.5 -rotate-90 text-ink-extra-muted transition-transform group-data-expanded:rotate-0" />+ </Collapsible.Trigger>+ <Collapsible.Content class="data-closed:hidden">+ <div>+ <Show when={props.ramp}>+ <RampEditor tokens={props.tokens} />+ </Show>+ <For each={props.tokens}>{(token) => <TokenRow token={token} />}</For>+ </div>+ </Collapsible.Content>+ </Collapsible>+ );+}++export function ThemeTokenEditor() {+ return (+ <>+ <style>{`+ .theme-token-slider::-webkit-slider-thumb {+ -webkit-appearance: none;+ appearance: none;+ width: 14px;+ height: 14px;+ border: 2px solid var(--color-surface);+ border-radius: 999px;+ background: var(--slider-color);+ box-shadow: 0 1px 3px color-mix(in oklch, var(--color-ink) 25%, transparent);+ }+ .theme-token-slider::-moz-range-thumb {+ width: 10px;+ height: 10px;+ border: 2px solid var(--color-surface);+ border-radius: 999px;+ background: var(--slider-color);+ box-shadow: 0 1px 3px color-mix(in oklch, var(--color-ink) 25%, transparent);+ }+ .theme-ramp-stop::-webkit-slider-runnable-track {+ height: 20px;+ background: transparent;+ }+ .theme-ramp-stop::-webkit-slider-thumb {+ pointer-events: auto;+ -webkit-appearance: none;+ appearance: none;+ width: 18px;+ height: 28px;+ margin-top: -4px;+ border: 2px solid var(--color-surface);+ border-radius: 999px;+ background: var(--stop-color);+ box-shadow: 0 0 0 1px var(--color-edge), 0 2px 5px color-mix(in oklch, var(--color-ink) 25%, transparent);+ cursor: grab;+ }+ .theme-ramp-stop.is-attached::-webkit-slider-thumb {+ box-shadow: 0 0 0 2px var(--color-accent), 0 2px 5px color-mix(in oklch, var(--color-ink) 25%, transparent);+ }+ .theme-ramp-stop::-moz-range-track {+ height: 20px;+ background: transparent;+ }+ .theme-ramp-stop::-moz-range-thumb {+ pointer-events: auto;+ width: 14px;+ height: 24px;+ border: 2px solid var(--color-surface);+ border-radius: 999px;+ background: var(--stop-color);+ box-shadow: 0 0 0 1px var(--color-edge), 0 2px 5px color-mix(in oklch, var(--color-ink) 25%, transparent);+ cursor: grab;+ }+ .theme-ramp-stop.is-attached::-moz-range-thumb {+ box-shadow: 0 0 0 2px var(--color-accent), 0 2px 5px color-mix(in oklch, var(--color-ink) 25%, transparent);+ }+ `}</style>+ <div class="overflow-hidden rounded-xl border border-edge-muted bg-surface shadow-sm">+ <For each={tokenSections}>+ {(section) => (+ <TokenSection+ title={section.label}+ tokens={section.tokens}+ defaultOpen={'defaultOpen' in section && section.defaultOpen}+ ramp={'ramp' in section && section.ramp}+ />+ )}+ </For>+ </div>+ </>+ );+}diff --git a/apps/web/src/features/theme/components/ThemeTools.tsx b/apps/web/src/features/theme/components/ThemeTools.tsxindex db0649b8f2..66be528f15 100644--- a/apps/web/src/features/theme/components/ThemeTools.tsx+++ b/apps/web/src/features/theme/components/ThemeTools.tsx@@ -1,10 +1,10 @@-import { currentThemeId, isThemeSaved, themes } from '../signals/themeSignals';-import { saveTheme, updateTheme } from '../utils/themeUtils';+import { isMobile } from '@core/mobile/isMobile';import IconSave from '@phosphor-icons/core/regular/floppy-disk-back.svg?component-solid';import IconShuffle from '@phosphor-icons/core/regular/shuffle.svg?component-solid';-import { isMobile } from '@core/mobile/isMobile';-import { createMemo, Show } from 'solid-js';import { Button, cn } from '@ui';+import { createMemo, Show } from 'solid-js';+import { currentThemeId, isThemeSaved, themes } from '../signals/themeSignals';+import { saveTheme, updateTheme } from '../utils/themeUtils';function ThemeTools(props: {class?: string;@@ -25,8 +25,11 @@ function ThemeTools(props: {const editing = editingTheme();if (editing) return editing.name;const theme = themes().find((theme) => theme.id === currentThemeId());- if(isThemeSaved()){return theme?.name}- else{return defaultThemeName}+ if (isThemeSaved()) {+ return theme?.name;+ } else {+ return defaultThemeName;+ }});// Editing an existing custom theme writes back to it; otherwise save a new one.@@ -41,29 +44,33 @@ function ThemeTools(props: {return (<div- class={cn('flex items-center overflow-hidden w-full min-w-0', props.class)}+ class={cn(+ 'flex items-center overflow-hidden w-full min-w-0',+ props.class+ )}style={{- 'gap': '4.5px' /* (41 - 32) / 2 */,+ gap: '4.5px' /* (41 - 32) / 2 */,'font-family': 'var(--font-sans)','scrollbar-width': 'none','font-size': '14px',- 'height': '39.5px',+ height: '39.5px',}}><divonKeyDown={(e) => {- if(e.key === 'Enter'){+ if (e.key === 'Enter') {e.preventDefault();const name = themeName.innerText.trim();- if(name){+ if (name) {commit(name);themeName.blur();+ } else {+ themeName.innerText = currentThemeName() ?? defaultThemeName;}- else { themeName.innerText = currentThemeName() ?? defaultThemeName; }}}}onBlur={() => {- if(!themeName.innerText.trim()){+ if (!themeName.innerText.trim()) {themeName.innerText = currentThemeName() ?? defaultThemeName;}}}@@ -72,12 +79,12 @@ function ThemeTools(props: {'bg-transparent text-ink-muted border-ink/[0.06]','hover:bg-surface hover:text-ink','focus:bg-surface focus:text-ink focus:border-accent',- 'min-w-0 overflow-hidden text-ellipsis',+ 'min-w-0 overflow-hidden text-ellipsis')}style={{'white-space': 'nowrap',// Narrower on mobile so it fits on the same line as the Basic/Advanced tabs.- 'flex': isMobile() ? '0 1 7.5rem' : '0 1 13rem',+ flex: isMobile() ? '0 1 7.5rem' : '0 1 13rem','min-width': '0',}}contentEditable={true}diff --git a/apps/web/src/features/theme/constants.ts b/apps/web/src/features/theme/constants.tsindex c5376b115d..aab552862c 100644--- a/apps/web/src/features/theme/constants.ts+++ b/apps/web/src/features/theme/constants.ts@@ -1,373 +1,8 @@-import type { ThemeV2 } from './types/themeTypes';-import { isTouchDevice } from '@core/mobile/isTouchDevice';+import { DEFAULT_THEMES } from './themes';++type DefaultTheme = (typeof DEFAULT_THEMES)[number]['id'];export const DEFAULT_LIGHT_THEME: DefaultTheme = 'Macro Light';export const DEFAULT_DARK_THEME: DefaultTheme = 'Macro Dark';-const MACRO_DARK: Pick<ThemeV2, 'depth' | 'tokens' | 'overrides'> = isTouchDevice() ? {- depth: 0.35,- tokens: {- a0: { l: 0.75, c: 0.20, h: 59 },- a1: { l: 0.75, c: 0.20, h: 99 },- a2: { l: 0.75, c: 0.20, h: 139 },- a3: { l: 0.75, c: 0.20, h: 179 },- a4: { l: 0.75, c: 0.20, h: 219 },- b0: { l: 0.00, c: 0.00, h: 21 },- b1: { l: 0.18, c: 0.00, h: 21 },- b2: { l: 0.23, c: 0.00, h: 21 },- b3: { l: 0.25, c: 0.00, h: 21 },- b4: { l: 0.28, c: 0.00, h: 21 },- c0: { l: 0.95, c: 0.00, h: 21 },- c1: { l: 0.83, c: 0.00, h: 21 },- c2: { l: 0.75, c: 0.00, h: 21 },- c3: { l: 0.63, c: 0.00, h: 21 },- c4: { l: 0.55, c: 0.00, h: 21 },- },- }- : {- depth: 0.15,- tokens: {- a0: { l: 0.75, c: 0.20, h: 59 },- a1: { l: 0.75, c: 0.20, h: 99 },- a2: { l: 0.75, c: 0.20, h: 139 },- a3: { l: 0.75, c: 0.20, h: 179 },- a4: { l: 0.75, c: 0.20, h: 219 },- b0: { l: 0.14, c: 0.00, h: 59 },- b1: { l: 0.20, c: 0.00, h: 59 },- b2: { l: 0.23, c: 0.00, h: 59 },- b3: { l: 0.25, c: 0.00, h: 59 },- b4: { l: 0.28, c: 0.00, h: 59 },- c0: { l: 0.95, c: 0.00, h: 59 },- c1: { l: 0.83, c: 0.00, h: 59 },- c2: { l: 0.75, c: 0.00, h: 59 },- c3: { l: 0.63, c: 0.00, h: 59 },- c4: { l: 0.55, c: 0.00, h: 59 },- },- };--const MACRO_LIGHT: Pick<ThemeV2, 'depth' | 'tokens' | 'overrides'> = isTouchDevice()- ? {- depth: 0.06,- tokens: {- a0: { l: 0.65, c: 0.20, h: 59 },- a1: { l: 0.65, c: 0.20, h: 99 },- a2: { l: 0.65, c: 0.20, h: 139 },- a3: { l: 0.65, c: 0.20, h: 179 },- a4: { l: 0.65, c: 0.20, h: 219 },- b0: { l: 1.00, c: 0.00, h: 59 },- b1: { l: 0.96, c: 0.00, h: 59 },- b2: { l: 0.96, c: 0.00, h: 59 },- b3: { l: 0.92, c: 0.00, h: 59 },- b4: { l: 0.91, c: 0.00, h: 59 },- c0: { l: 0.14, c: 0.00, h: 59 },- c1: { l: 0.40, c: 0.00, h: 59 },- c2: { l: 0.55, c: 0.00, h: 59 },- c3: { l: 0.65, c: 0.00, h: 59 },- c4: { l: 0.75, c: 0.00, h: 59 },- },- overrides: [- {- token: 'menu',- value: { l: 1.00, c: 0.00, h: 59 },- },- {- token: 'panel',- value: { l: 1.00, c: 0.00, h: 59 },- },- {- token: 'dialog',- value: { l: 1.00, c: 0.00, h: 59 },- },- {- token: 'input',- value: { l: 1.00, c: 0.00, h: 59 },- },- ]- }- : {- depth: 0.16,- tokens: {- a0: { l: 0.65, c: 0.20, h: 59 },- a1: { l: 0.65, c: 0.20, h: 99 },- a2: { l: 0.65, c: 0.20, h: 139 },- a3: { l: 0.65, c: 0.20, h: 179 },- a4: { l: 0.65, c: 0.20, h: 219 },- b0: { l: 0.964, c: 0.00, h: 59 },- b1: { l: 0.92, c: 0.00, h: 59 },- b2: { l: 0.91, c: 0.00, h: 59 },- b3: { l: 0.92, c: 0.00, h: 59 },- b4: { l: 0.91, c: 0.00, h: 59 },- c0: { l: 0.16, c: 0.00, h: 59 },- c1: { l: 0.40, c: 0.00, h: 59 },- c2: { l: 0.45, c: 0.00, h: 59 },- c3: { l: 0.55, c: 0.00, h: 59 },- c4: { l: 0.70, c: 0.00, h: 59 },- },- };---// Ordered for the theme picker: dark themes first (led by the Macro brand theme),-// then light themes (led by the Macro brand theme). ThemeList renders in array order.-export const DEFAULT_THEMES = [- {- id: 'Macro Dark',- name: 'Macro Dark',- version: 2,- depth: MACRO_DARK.depth,- tokens: MACRO_DARK.tokens,- overrides: MACRO_DARK.overrides- },- {- // Neutral anchor: a true graphite monochrome, accents carry only a whisper of- // cool hue so categorical charts stay distinguishable without breaking the grey.- id: "Void",- name: "Void",- version: 2,- depth: 0.18,- tokens: {- a0: { l: 0.80, c: 0.03, h: 250 },- a1: { l: 0.80, c: 0.03, h: 290 },- a2: { l: 0.80, c: 0.03, h: 330 },- a3: { l: 0.80, c: 0.03, h: 10 },- a4: { l: 0.80, c: 0.03, h: 50 },- b0: { l: 0.15, c: 0.00, h: 0 },- b1: { l: 0.19, c: 0.00, h: 0 },- b2: { l: 0.22, c: 0.00, h: 0 },- b3: { l: 0.25, c: 0.00, h: 0 },- b4: { l: 0.29, c: 0.00, h: 0 },- c0: { l: 0.95, c: 0.00, h: 0 },- c1: { l: 0.82, c: 0.00, h: 0 },- c2: { l: 0.72, c: 0.00, h: 0 },- c3: { l: 0.63, c: 0.00, h: 0 },- c4: { l: 0.55, c: 0.00, h: 0 },- },- },- {- // Warm: a deep ember charcoal with a soft amber accent.- id: 'Ember',- name: 'Ember',- version: 2,- depth: 0.12,- tokens: {- a0: { l: 0.75, c: 0.15, h: 55 },- a1: { l: 0.75, c: 0.15, h: 95 },- a2: { l: 0.75, c: 0.15, h: 135 },- a3: { l: 0.75, c: 0.15, h: 175 },- a4: { l: 0.75, c: 0.15, h: 215 },- b0: { l: 0.16, c: 0.010, h: 55 },- b1: { l: 0.20, c: 0.010, h: 55 },- b2: { l: 0.24, c: 0.012, h: 55 },- b3: { l: 0.27, c: 0.012, h: 55 },- b4: { l: 0.31, c: 0.014, h: 55 },- c0: { l: 0.95, c: 0.008, h: 55 },- c1: { l: 0.83, c: 0.008, h: 55 },- c2: { l: 0.73, c: 0.008, h: 55 },- c3: { l: 0.63, c: 0.008, h: 55 },- c4: { l: 0.55, c: 0.008, h: 55 },- },- },- {- // Cool: an ethereal violet-indigo night, calm and a touch mysterious.- id: 'Spirit',- name: 'Spirit',- version: 2,- depth: 0.20,- tokens: {- a0: { l: 0.72, c: 0.16, h: 295 },- a1: { l: 0.72, c: 0.16, h: 335 },- a2: { l: 0.72, c: 0.16, h: 15 },- a3: { l: 0.72, c: 0.16, h: 55 },- a4: { l: 0.72, c: 0.16, h: 95 },- b0: { l: 0.16, c: 0.014, h: 295 },- b1: { l: 0.20, c: 0.014, h: 295 },- b2: { l: 0.24, c: 0.016, h: 295 },- b3: { l: 0.27, c: 0.016, h: 295 },- b4: { l: 0.31, c: 0.018, h: 295 },- c0: { l: 0.93, c: 0.012, h: 295 },- c1: { l: 0.84, c: 0.012, h: 295 },- c2: { l: 0.74, c: 0.012, h: 295 },- c3: { l: 0.64, c: 0.012, h: 295 },- c4: { l: 0.56, c: 0.012, h: 295 },- },- },- {- // Cool: a deep midnight blue with a periwinkle accent — quiet and nocturnal.- id: 'Moon',- name: 'Moon',- version: 2,- depth: 0.15,- tokens: {- a0: { l: 0.70, c: 0.15, h: 255 },- a1: { l: 0.70, c: 0.15, h: 295 },- a2: { l: 0.70, c: 0.15, h: 335 },- a3: { l: 0.70, c: 0.15, h: 15 },- a4: { l: 0.70, c: 0.15, h: 55 },- b0: { l: 0.15, c: 0.012, h: 255 },- b1: { l: 0.19, c: 0.012, h: 255 },- b2: { l: 0.23, c: 0.014, h: 255 },- b3: { l: 0.26, c: 0.014, h: 255 },- b4: { l: 0.30, c: 0.016, h: 255 },- c0: { l: 0.95, c: 0.010, h: 255 },- c1: { l: 0.85, c: 0.010, h: 255 },- c2: { l: 0.75, c: 0.010, h: 255 },- c3: { l: 0.65, c: 0.010, h: 255 },- c4: { l: 0.57, c: 0.010, h: 255 },- },- },- {- // Cool: a slate teal, like rain on glass — muted, fresh, easy on the eyes.- id: 'Rain',- name: 'Rain',- version: 2,- depth: 0.13,- tokens: {- a0: { l: 0.72, c: 0.13, h: 200 },- a1: { l: 0.72, c: 0.13, h: 240 },- a2: { l: 0.72, c: 0.13, h: 280 },- a3: { l: 0.72, c: 0.13, h: 320 },- a4: { l: 0.72, c: 0.13, h: 360 },- b0: { l: 0.15, c: 0.010, h: 210 },- b1: { l: 0.19, c: 0.010, h: 210 },- b2: { l: 0.23, c: 0.012, h: 210 },- b3: { l: 0.26, c: 0.012, h: 210 },- b4: { l: 0.30, c: 0.014, h: 210 },- c0: { l: 0.94, c: 0.008, h: 210 },- c1: { l: 0.84, c: 0.008, h: 210 },- c2: { l: 0.74, c: 0.008, h: 210 },- c3: { l: 0.64, c: 0.008, h: 210 },- c4: { l: 0.56, c: 0.008, h: 210 },- },- },- {- id: 'Macro Light',- name: 'Macro Light',- version: 2,- depth: MACRO_LIGHT.depth,- tokens: MACRO_LIGHT.tokens,- overrides: MACRO_LIGHT.overrides- },- {- // Warm: a cream page with a sun-ripe orange accent — citrus, but restrained.- id: 'Satsuma',- name: 'Satsuma',- version: 2,- depth: 0.06,- tokens: {- a0: { l: 0.62, c: 0.16, h: 55 },- a1: { l: 0.62, c: 0.16, h: 95 },- a2: { l: 0.62, c: 0.16, h: 135 },- a3: { l: 0.62, c: 0.16, h: 175 },- a4: { l: 0.62, c: 0.16, h: 215 },- b0: { l: 0.98, c: 0.008, h: 70 },- b1: { l: 0.96, c: 0.010, h: 70 },- b2: { l: 0.93, c: 0.012, h: 65 },- b3: { l: 0.95, c: 0.010, h: 65 },- b4: { l: 0.93, c: 0.012, h: 65 },- c0: { l: 0.27, c: 0.020, h: 55 },- c1: { l: 0.41, c: 0.018, h: 55 },- c2: { l: 0.53, c: 0.015, h: 55 },- c3: { l: 0.63, c: 0.012, h: 55 },- c4: { l: 0.72, c: 0.010, h: 55 },- },- },- {- // Cool: a crisp white with a deep lapis-blue accent — clean and confident.- id: 'Lapis',- name: 'Lapis',- version: 2,- depth: 0.04,- tokens: {- a0: { l: 0.55, c: 0.17, h: 255 },- a1: { l: 0.55, c: 0.17, h: 295 },- a2: { l: 0.55, c: 0.17, h: 335 },- a3: { l: 0.55, c: 0.17, h: 15 },- a4: { l: 0.55, c: 0.17, h: 55 },- b0: { l: 0.98, c: 0.006, h: 250 },- b1: { l: 0.96, c: 0.008, h: 250 },- b2: { l: 0.93, c: 0.010, h: 250 },- b3: { l: 0.95, c: 0.008, h: 250 },- b4: { l: 0.93, c: 0.010, h: 250 },- c0: { l: 0.23, c: 0.018, h: 250 },- c1: { l: 0.40, c: 0.016, h: 250 },- c2: { l: 0.52, c: 0.014, h: 250 },- c3: { l: 0.62, c: 0.012, h: 250 },- c4: { l: 0.72, c: 0.010, h: 250 },- },- },- {- // Neutral anchor: a clean near-white with a deep botanical green accent.- // Surfaces and text stay essentially neutral — the green lives in the accent,- // not a wash over the whole UI.- id: 'Flora',- name: 'Flora',- version: 2,- depth: 0.06,- tokens: {- a0: { l: 0.55, c: 0.16, h: 150 },- a1: { l: 0.55, c: 0.16, h: 190 },- a2: { l: 0.55, c: 0.16, h: 230 },- a3: { l: 0.55, c: 0.16, h: 270 },- a4: { l: 0.55, c: 0.16, h: 310 },- b0: { l: 0.98, c: 0.003, h: 150 },- b1: { l: 0.96, c: 0.004, h: 150 },- b2: { l: 0.93, c: 0.005, h: 150 },- b3: { l: 0.95, c: 0.004, h: 150 },- b4: { l: 0.93, c: 0.005, h: 150 },- c0: { l: 0.25, c: 0.005, h: 150 },- c1: { l: 0.40, c: 0.005, h: 150 },- c2: { l: 0.52, c: 0.004, h: 150 },- c3: { l: 0.62, c: 0.004, h: 150 },- c4: { l: 0.72, c: 0.003, h: 150 },- },- },- {- // Warm: warm off-white paper with a cool ink-blue accent — paper meets pen.- id: 'Paper',- name: 'Paper',- version: 2,- depth: 0.05,- tokens: {- a0: { l: 0.50, c: 0.13, h: 250 },- a1: { l: 0.50, c: 0.13, h: 290 },- a2: { l: 0.50, c: 0.13, h: 330 },- a3: { l: 0.50, c: 0.13, h: 10 },- a4: { l: 0.50, c: 0.13, h: 50 },- b0: { l: 0.985, c: 0.006, h: 75 },- b1: { l: 0.965, c: 0.007, h: 75 },- b2: { l: 0.935, c: 0.008, h: 75 },- b3: { l: 0.955, c: 0.007, h: 75 },- b4: { l: 0.935, c: 0.008, h: 75 },- c0: { l: 0.22, c: 0.008, h: 70 },- c1: { l: 0.40, c: 0.007, h: 70 },- c2: { l: 0.52, c: 0.006, h: 70 },- c3: { l: 0.62, c: 0.005, h: 70 },- c4: { l: 0.72, c: 0.004, h: 70 },- },- },- {- // Cool: a pale violet-grey with a rich plum accent — soft, refined, distinct.- id: 'Decepticon',- name: 'Decepticon',- version: 2,- depth: 0.06,- tokens: {- a0: { l: 0.52, c: 0.18, h: 295 },- a1: { l: 0.52, c: 0.18, h: 335 },- a2: { l: 0.52, c: 0.18, h: 15 },- a3: { l: 0.52, c: 0.18, h: 55 },- a4: { l: 0.52, c: 0.18, h: 95 },- b0: { l: 0.98, c: 0.006, h: 295 },- b1: { l: 0.96, c: 0.008, h: 295 },- b2: { l: 0.93, c: 0.010, h: 295 },- b3: { l: 0.95, c: 0.008, h: 295 },- b4: { l: 0.93, c: 0.010, h: 295 },- c0: { l: 0.23, c: 0.014, h: 295 },- c1: { l: 0.40, c: 0.012, h: 295 },- c2: { l: 0.52, c: 0.010, h: 295 },- c3: { l: 0.62, c: 0.008, h: 295 },- c4: { l: 0.72, c: 0.006, h: 295 },- },- },-] as const satisfies readonly ThemeV2[];--type DefaultTheme = (typeof DEFAULT_THEMES)[number]['id'];+export { DEFAULT_THEMES };diff --git a/apps/web/src/features/theme/signals/themeReactive.ts b/apps/web/src/features/theme/signals/themeReactive.tsindex 45b528f3ac..2f322e478a 100644--- a/apps/web/src/features/theme/signals/themeReactive.ts+++ b/apps/web/src/features/theme/signals/themeReactive.ts@@ -1,41 +1,116 @@-import type { ThemePrevious, ThemeReactive } from '../types/themeTypes';-import { setIsThemeSaved, setThemeUpdate } from './themeSignals';import { createEffect, createSignal, on } from 'solid-js';+import type { ThemePrevious, ThemeReactive } from '../types/themeTypes';+import { setThemeUpdate } from './themeSignals';export const themeReactive: ThemeReactive = {- a0: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'accent color'},- a1: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'accent color +40°'},- a2: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'accent color +80°'},- a3: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'accent color +120°'},- a4: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'accent color +160°'},- b0: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'background'},- b1: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'background active'},- b2: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'background hover'},- b3: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'muted edge'},- b4: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'edge'},- c0: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'text'},- c1: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'text muted'},- c2: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'text extra muted'},- c3: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'text disabled'},- c4: {l: createSignal(0), c: createSignal(0), h: createSignal(0), description: 'text placeholder'},+ a0: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'accent color',+ },+ a1: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'accent color +40°',+ },+ a2: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'accent color +80°',+ },+ a3: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'accent color +120°',+ },+ a4: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'accent color +160°',+ },+ b0: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'background',+ },+ b1: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'background active',+ },+ b2: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'background hover',+ },+ b3: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'muted edge',+ },+ b4: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'edge',+ },+ c0: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'text',+ },+ c1: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'text muted',+ },+ c2: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'text extra muted',+ },+ c3: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'text disabled',+ },+ c4: {+ l: createSignal(0),+ c: createSignal(0),+ h: createSignal(0),+ description: 'text placeholder',+ },} as const;const previousTheme: ThemePrevious = {- a0: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- a1: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- a2: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- a3: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- a4: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- b0: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- b1: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- b2: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- b3: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- b4: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- c0: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- c1: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- c2: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- c3: {l: Number.NaN, c: Number.NaN, h: Number.NaN},- c4: {l: Number.NaN, c: Number.NaN, h: Number.NaN},+ a0: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ a1: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ a2: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ a3: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ a4: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ b0: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ b1: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ b2: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ b3: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ b4: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ c0: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ c1: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ c2: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ c3: { l: Number.NaN, c: Number.NaN, h: Number.NaN },+ c4: { l: Number.NaN, c: Number.NaN, h: Number.NaN },};let transitionState = false;@@ -52,21 +127,51 @@ function jamTransition(): void {}}const ALL_THEME_SIGNALS = [- themeReactive.a0.l[0], themeReactive.a0.c[0], themeReactive.a0.h[0],- themeReactive.a1.l[0], themeReactive.a1.c[0], themeReactive.a1.h[0],- themeReactive.a2.l[0], themeReactive.a2.c[0], themeReactive.a2.h[0],- themeReactive.a3.l[0], themeReactive.a3.c[0], themeReactive.a3.h[0],- themeReactive.a4.l[0], themeReactive.a4.c[0], themeReactive.a4.h[0],- themeReactive.b0.l[0], themeReactive.b0.c[0], themeReactive.b0.h[0],- themeReactive.b1.l[0], themeReactive.b1.c[0], themeReactive.b1.h[0],- themeReactive.b2.l[0], themeReactive.b2.c[0], themeReactive.b2.h[0],- themeReactive.b3.l[0], themeReactive.b3.c[0], themeReactive.b3.h[0],- themeReactive.b4.l[0], themeReactive.b4.c[0], themeReactive.b4.h[0],- themeReactive.c0.l[0], themeReactive.c0.h[0], themeReactive.c0.c[0],- themeReactive.c1.l[0], themeReactive.c1.c[0], themeReactive.c1.h[0],- themeReactive.c2.l[0], themeReactive.c2.c[0], themeReactive.c2.h[0],- themeReactive.c3.l[0], themeReactive.c3.c[0], themeReactive.c3.h[0],- themeReactive.c4.l[0], themeReactive.c4.c[0], themeReactive.c4.h[0],+ themeReactive.a0.l[0],+ themeReactive.a0.c[0],+ themeReactive.a0.h[0],+ themeReactive.a1.l[0],+ themeReactive.a1.c[0],+ themeReactive.a1.h[0],+ themeReactive.a2.l[0],+ themeReactive.a2.c[0],+ themeReactive.a2.h[0],+ themeReactive.a3.l[0],+ themeReactive.a3.c[0],+ themeReactive.a3.h[0],+ themeReactive.a4.l[0],+ themeReactive.a4.c[0],+ themeReactive.a4.h[0],+ themeReactive.b0.l[0],+ themeReactive.b0.c[0],+ themeReactive.b0.h[0],+ themeReactive.b1.l[0],+ themeReactive.b1.c[0],+ themeReactive.b1.h[0],+ themeReactive.b2.l[0],+ themeReactive.b2.c[0],+ themeReactive.b2.h[0],+ themeReactive.b3.l[0],+ themeReactive.b3.c[0],+ themeReactive.b3.h[0],+ themeReactive.b4.l[0],+ themeReactive.b4.c[0],+ themeReactive.b4.h[0],+ themeReactive.c0.l[0],+ themeReactive.c0.h[0],+ themeReactive.c0.c[0],+ themeReactive.c1.l[0],+ themeReactive.c1.c[0],+ themeReactive.c1.h[0],+ themeReactive.c2.l[0],+ themeReactive.c2.c[0],+ themeReactive.c2.h[0],+ themeReactive.c3.l[0],+ themeReactive.c3.c[0],+ themeReactive.c3.h[0],+ themeReactive.c4.l[0],+ themeReactive.c4.c[0],+ themeReactive.c4.h[0],];function syncThemeLightAttribute(): void {@@ -80,55 +185,324 @@ createEffect(() => {jamTransition();- if(themeReactive.a0.l[0]() !== previousTheme.a0.l){document.documentElement.style.setProperty( '--a0l', `${themeReactive.a0.l[0]()}` ); previousTheme.a0.l = themeReactive.a0.l[0]()}- if(themeReactive.a0.c[0]() !== previousTheme.a0.c){document.documentElement.style.setProperty( '--a0c', `${themeReactive.a0.c[0]()}` ); previousTheme.a0.c = themeReactive.a0.c[0]()}- if(themeReactive.a0.h[0]() !== previousTheme.a0.h){document.documentElement.style.setProperty( '--a0h', `${themeReactive.a0.h[0]()}deg` ); previousTheme.a0.h = themeReactive.a0.h[0]()}- if(themeReactive.a1.l[0]() !== previousTheme.a1.l){document.documentElement.style.setProperty( '--a1l', `${themeReactive.a1.l[0]()}` ); previousTheme.a1.l = themeReactive.a1.l[0]()}- if(themeReactive.a1.c[0]() !== previousTheme.a1.c){document.documentElement.style.setProperty( '--a1c', `${themeReactive.a1.c[0]()}` ); previousTheme.a1.c = themeReactive.a1.c[0]()}- if(themeReactive.a1.h[0]() !== previousTheme.a1.h){document.documentElement.style.setProperty( '--a1h', `${themeReactive.a1.h[0]()}deg` ); previousTheme.a1.h = themeReactive.a1.h[0]()}- if(themeReactive.a2.l[0]() !== previousTheme.a2.l){document.documentElement.style.setProperty( '--a2l', `${themeReactive.a2.l[0]()}` ); previousTheme.a2.l = themeReactive.a2.l[0]()}- if(themeReactive.a2.c[0]() !== previousTheme.a2.c){document.documentElement.style.setProperty( '--a2c', `${themeReactive.a2.c[0]()}` ); previousTheme.a2.c = themeReactive.a2.c[0]()}- if(themeReactive.a2.h[0]() !== previousTheme.a2.h){document.documentElement.style.setProperty( '--a2h', `${themeReactive.a2.h[0]()}deg` ); previousTheme.a2.h = themeReactive.a2.h[0]()}- if(themeReactive.a3.l[0]() !== previousTheme.a3.l){document.documentElement.style.setProperty( '--a3l', `${themeReactive.a3.l[0]()}` ); previousTheme.a3.l = themeReactive.a3.l[0]()}- if(themeReactive.a3.c[0]() !== previousTheme.a3.c){document.documentElement.style.setProperty( '--a3c', `${themeReactive.a3.c[0]()}` ); previousTheme.a3.c = themeReactive.a3.c[0]()}- if(themeReactive.a3.h[0]() !== previousTheme.a3.h){document.documentElement.style.setProperty( '--a3h', `${themeReactive.a3.h[0]()}deg` ); previousTheme.a3.h = themeReactive.a3.h[0]()}- if(themeReactive.a4.l[0]() !== previousTheme.a4.l){document.documentElement.style.setProperty( '--a4l', `${themeReactive.a4.l[0]()}` ); previousTheme.a4.l = themeReactive.a4.l[0]()}- if(themeReactive.a4.c[0]() !== previousTheme.a4.c){document.documentElement.style.setProperty( '--a4c', `${themeReactive.a4.c[0]()}` ); previousTheme.a4.c = themeReactive.a4.c[0]()}- if(themeReactive.a4.h[0]() !== previousTheme.a4.h){document.documentElement.style.setProperty( '--a4h', `${themeReactive.a4.h[0]()}deg` ); previousTheme.a4.h = themeReactive.a4.h[0]()}- if(themeReactive.b0.l[0]() !== previousTheme.b0.l){document.documentElement.style.setProperty( '--b0l', `${themeReactive.b0.l[0]()}` ); previousTheme.b0.l = themeReactive.b0.l[0]()}- if(themeReactive.b0.c[0]() !== previousTheme.b0.c){document.documentElement.style.setProperty( '--b0c', `${themeReactive.b0.c[0]()}` ); previousTheme.b0.c = themeReactive.b0.c[0]()}- if(themeReactive.b0.h[0]() !== previousTheme.b0.h){document.documentElement.style.setProperty( '--b0h', `${themeReactive.b0.h[0]()}deg` ); previousTheme.b0.h = themeReactive.b0.h[0]()}- if(themeReactive.b1.l[0]() !== previousTheme.b1.l){document.documentElement.style.setProperty( '--b1l', `${themeReactive.b1.l[0]()}` ); previousTheme.b1.l = themeReactive.b1.l[0]()}- if(themeReactive.b1.c[0]() !== previousTheme.b1.c){document.documentElement.style.setProperty( '--b1c', `${themeReactive.b1.c[0]()}` ); previousTheme.b1.c = themeReactive.b1.c[0]()}- if(themeReactive.b1.h[0]() !== previousTheme.b1.h){document.documentElement.style.setProperty( '--b1h', `${themeReactive.b1.h[0]()}deg` ); previousTheme.b1.h = themeReactive.b1.h[0]()}- if(themeReactive.b2.l[0]() !== previousTheme.b2.l){document.documentElement.style.setProperty( '--b2l', `${themeReactive.b2.l[0]()}` ); previousTheme.b2.l = themeReactive.b2.l[0]()}- if(themeReactive.b2.c[0]() !== previousTheme.b2.c){document.documentElement.style.setProperty( '--b2c', `${themeReactive.b2.c[0]()}` ); previousTheme.b2.c = themeReactive.b2.c[0]()}- if(themeReactive.b2.h[0]() !== previousTheme.b2.h){document.documentElement.style.setProperty( '--b2h', `${themeReactive.b2.h[0]()}deg` ); previousTheme.b2.h = themeReactive.b2.h[0]()}- if(themeReactive.b3.l[0]() !== previousTheme.b3.l){document.documentElement.style.setProperty( '--b3l', `${themeReactive.b3.l[0]()}` ); previousTheme.b3.l = themeReactive.b3.l[0]()}- if(themeReactive.b3.c[0]() !== previousTheme.b3.c){document.documentElement.style.setProperty( '--b3c', `${themeReactive.b3.c[0]()}` ); previousTheme.b3.c = themeReactive.b3.c[0]()}- if(themeReactive.b3.h[0]() !== previousTheme.b3.h){document.documentElement.style.setProperty( '--b3h', `${themeReactive.b3.h[0]()}deg` ); previousTheme.b3.h = themeReactive.b3.h[0]()}- if(themeReactive.b4.l[0]() !== previousTheme.b4.l){document.documentElement.style.setProperty( '--b4l', `${themeReactive.b4.l[0]()}` ); previousTheme.b4.l = themeReactive.b4.l[0]()}- if(themeReactive.b4.c[0]() !== previousTheme.b4.c){document.documentElement.style.setProperty( '--b4c', `${themeReactive.b4.c[0]()}` ); previousTheme.b4.c = themeReactive.b4.c[0]()}- if(themeReactive.b4.h[0]() !== previousTheme.b4.h){document.documentElement.style.setProperty( '--b4h', `${themeReactive.b4.h[0]()}deg` ); previousTheme.b4.h = themeReactive.b4.h[0]()}- if(themeReactive.c0.l[0]() !== previousTheme.c0.l){document.documentElement.style.setProperty( '--c0l', `${themeReactive.c0.l[0]()}` ); previousTheme.c0.l = themeReactive.c0.l[0]()}- if(themeReactive.c0.c[0]() !== previousTheme.c0.c){document.documentElement.style.setProperty( '--c0c', `${themeReactive.c0.c[0]()}` ); previousTheme.c0.c = themeReactive.c0.c[0]()}- if(themeReactive.c0.h[0]() !== previousTheme.c0.h){document.documentElement.style.setProperty( '--c0h', `${themeReactive.c0.h[0]()}deg` ); previousTheme.c0.h = themeReactive.c0.h[0]()}- if(themeReactive.c1.l[0]() !== previousTheme.c1.l){document.documentElement.style.setProperty( '--c1l', `${themeReactive.c1.l[0]()}` ); previousTheme.c1.l = themeReactive.c1.l[0]()}- if(themeReactive.c1.c[0]() !== previousTheme.c1.c){document.documentElement.style.setProperty( '--c1c', `${themeReactive.c1.c[0]()}` ); previousTheme.c1.c = themeReactive.c1.c[0]()}- if(themeReactive.c1.h[0]() !== previousTheme.c1.h){document.documentElement.style.setProperty( '--c1h', `${themeReactive.c1.h[0]()}deg` ); previousTheme.c1.h = themeReactive.c1.h[0]()}- if(themeReactive.c2.l[0]() !== previousTheme.c2.l){document.documentElement.style.setProperty( '--c2l', `${themeReactive.c2.l[0]()}` ); previousTheme.c2.l = themeReactive.c2.l[0]()}- if(themeReactive.c2.c[0]() !== previousTheme.c2.c){document.documentElement.style.setProperty( '--c2c', `${themeReactive.c2.c[0]()}` ); previousTheme.c2.c = themeReactive.c2.c[0]()}- if(themeReactive.c2.h[0]() !== previousTheme.c2.h){document.documentElement.style.setProperty( '--c2h', `${themeReactive.c2.h[0]()}deg` ); previousTheme.c2.h = themeReactive.c2.h[0]()}- if(themeReactive.c3.l[0]() !== previousTheme.c3.l){document.documentElement.style.setProperty( '--c3l', `${themeReactive.c3.l[0]()}` ); previousTheme.c3.l = themeReactive.c3.l[0]()}- if(themeReactive.c3.c[0]() !== previousTheme.c3.c){document.documentElement.style.setProperty( '--c3c', `${themeReactive.c3.c[0]()}` ); previousTheme.c3.c = themeReactive.c3.c[0]()}- if(themeReactive.c3.h[0]() !== previousTheme.c3.h){document.documentElement.style.setProperty( '--c3h', `${themeReactive.c3.h[0]()}deg` ); previousTheme.c3.h = themeReactive.c3.h[0]()}- if(themeReactive.c4.l[0]() !== previousTheme.c4.l){document.documentElement.style.setProperty( '--c4l', `${themeReactive.c4.l[0]()}` ); previousTheme.c4.l = themeReactive.c4.l[0]()}- if(themeReactive.c4.c[0]() !== previousTheme.c4.c){document.documentElement.style.setProperty( '--c4c', `${themeReactive.c4.c[0]()}` ); previousTheme.c4.c = themeReactive.c4.c[0]()}- if(themeReactive.c4.h[0]() !== previousTheme.c4.h){document.documentElement.style.setProperty( '--c4h', `${themeReactive.c4.h[0]()}deg` ); previousTheme.c4.h = themeReactive.c4.h[0]()}+ if (themeReactive.a0.l[0]() !== previousTheme.a0.l) {+ document.documentElement.style.setProperty(+ '--a0l',+ `${themeReactive.a0.l[0]()}`+ );+ previousTheme.a0.l = themeReactive.a0.l[0]();+ }+ if (themeReactive.a0.c[0]() !== previousTheme.a0.c) {+ document.documentElement.style.setProperty(+ '--a0c',+ `${themeReactive.a0.c[0]()}`+ );+ previousTheme.a0.c = themeReactive.a0.c[0]();+ }+ if (themeReactive.a0.h[0]() !== previousTheme.a0.h) {+ document.documentElement.style.setProperty(+ '--a0h',+ `${themeReactive.a0.h[0]()}deg`+ );+ previousTheme.a0.h = themeReactive.a0.h[0]();+ }+ if (themeReactive.a1.l[0]() !== previousTheme.a1.l) {+ document.documentElement.style.setProperty(+ '--a1l',+ `${themeReactive.a1.l[0]()}`+ );+ previousTheme.a1.l = themeReactive.a1.l[0]();+ }+ if (themeReactive.a1.c[0]() !== previousTheme.a1.c) {+ document.documentElement.style.setProperty(+ '--a1c',+ `${themeReactive.a1.c[0]()}`+ );+ previousTheme.a1.c = themeReactive.a1.c[0]();+ }+ if (themeReactive.a1.h[0]() !== previousTheme.a1.h) {+ document.documentElement.style.setProperty(+ '--a1h',+ `${themeReactive.a1.h[0]()}deg`+ );+ previousTheme.a1.h = themeReactive.a1.h[0]();+ }+ if (themeReactive.a2.l[0]() !== previousTheme.a2.l) {+ document.documentElement.style.setProperty(+ '--a2l',+ `${themeReactive.a2.l[0]()}`+ );+ previousTheme.a2.l = themeReactive.a2.l[0]();+ }+ if (themeReactive.a2.c[0]() !== previousTheme.a2.c) {+ document.documentElement.style.setProperty(+ '--a2c',+ `${themeReactive.a2.c[0]()}`+ );+ previousTheme.a2.c = themeReactive.a2.c[0]();+ }+ if (themeReactive.a2.h[0]() !== previousTheme.a2.h) {+ document.documentElement.style.setProperty(+ '--a2h',+ `${themeReactive.a2.h[0]()}deg`+ );+ previousTheme.a2.h = themeReactive.a2.h[0]();+ }+ if (themeReactive.a3.l[0]() !== previousTheme.a3.l) {+ document.documentElement.style.setProperty(+ '--a3l',+ `${themeReactive.a3.l[0]()}`+ );+ previousTheme.a3.l = themeReactive.a3.l[0]();+ }+ if (themeReactive.a3.c[0]() !== previousTheme.a3.c) {+ document.documentElement.style.setProperty(+ '--a3c',+ `${themeReactive.a3.c[0]()}`+ );+ previousTheme.a3.c = themeReactive.a3.c[0]();+ }+ if (themeReactive.a3.h[0]() !== previousTheme.a3.h) {+ document.documentElement.style.setProperty(+ '--a3h',+ `${themeReactive.a3.h[0]()}deg`+ );+ previousTheme.a3.h = themeReactive.a3.h[0]();+ }+ if (themeReactive.a4.l[0]() !== previousTheme.a4.l) {+ document.documentElement.style.setProperty(+ '--a4l',+ `${themeReactive.a4.l[0]()}`+ );+ previousTheme.a4.l = themeReactive.a4.l[0]();+ }+ if (themeReactive.a4.c[0]() !== previousTheme.a4.c) {+ document.documentElement.style.setProperty(+ '--a4c',+ `${themeReactive.a4.c[0]()}`+ );+ previousTheme.a4.c = themeReactive.a4.c[0]();+ }+ if (themeReactive.a4.h[0]() !== previousTheme.a4.h) {+ document.documentElement.style.setProperty(+ '--a4h',+ `${themeReactive.a4.h[0]()}deg`+ );+ previousTheme.a4.h = themeReactive.a4.h[0]();+ }+ if (themeReactive.b0.l[0]() !== previousTheme.b0.l) {+ document.documentElement.style.setProperty(+ '--b0l',+ `${themeReactive.b0.l[0]()}`+ );+ previousTheme.b0.l = themeReactive.b0.l[0]();+ }+ if (themeReactive.b0.c[0]() !== previousTheme.b0.c) {+ document.documentElement.style.setProperty(+ '--b0c',+ `${themeReactive.b0.c[0]()}`+ );+ previousTheme.b0.c = themeReactive.b0.c[0]();+ }+ if (themeReactive.b0.h[0]() !== previousTheme.b0.h) {+ document.documentElement.style.setProperty(+ '--b0h',+ `${themeReactive.b0.h[0]()}deg`+ );+ previousTheme.b0.h = themeReactive.b0.h[0]();+ }+ if (themeReactive.b1.l[0]() !== previousTheme.b1.l) {+ document.documentElement.style.setProperty(+ '--b1l',+ `${themeReactive.b1.l[0]()}`+ );+ previousTheme.b1.l = themeReactive.b1.l[0]();+ }+ if (themeReactive.b1.c[0]() !== previousTheme.b1.c) {+ document.documentElement.style.setProperty(+ '--b1c',+ `${themeReactive.b1.c[0]()}`+ );+ previousTheme.b1.c = themeReactive.b1.c[0]();+ }+ if (themeReactive.b1.h[0]() !== previousTheme.b1.h) {+ document.documentElement.style.setProperty(+ '--b1h',+ `${themeReactive.b1.h[0]()}deg`+ );+ previousTheme.b1.h = themeReactive.b1.h[0]();+ }+ if (themeReactive.b2.l[0]() !== previousTheme.b2.l) {+ document.documentElement.style.setProperty(+ '--b2l',+ `${themeReactive.b2.l[0]()}`+ );+ previousTheme.b2.l = themeReactive.b2.l[0]();+ }+ if (themeReactive.b2.c[0]() !== previousTheme.b2.c) {+ document.documentElement.style.setProperty(+ '--b2c',+ `${themeReactive.b2.c[0]()}`+ );+ previousTheme.b2.c = themeReactive.b2.c[0]();+ }+ if (themeReactive.b2.h[0]() !== previousTheme.b2.h) {+ document.documentElement.style.setProperty(+ '--b2h',+ `${themeReactive.b2.h[0]()}deg`+ );+ previousTheme.b2.h = themeReactive.b2.h[0]();+ }+ if (themeReactive.b3.l[0]() !== previousTheme.b3.l) {+ document.documentElement.style.setProperty(+ '--b3l',+ `${themeReactive.b3.l[0]()}`+ );+ previousTheme.b3.l = themeReactive.b3.l[0]();+ }+ if (themeReactive.b3.c[0]() !== previousTheme.b3.c) {+ document.documentElement.style.setProperty(+ '--b3c',+ `${themeReactive.b3.c[0]()}`+ );+ previousTheme.b3.c = themeReactive.b3.c[0]();+ }+ if (themeReactive.b3.h[0]() !== previousTheme.b3.h) {+ document.documentElement.style.setProperty(+ '--b3h',+ `${themeReactive.b3.h[0]()}deg`+ );+ previousTheme.b3.h = themeReactive.b3.h[0]();+ }+ if (themeReactive.b4.l[0]() !== previousTheme.b4.l) {+ document.documentElement.style.setProperty(+ '--b4l',+ `${themeReactive.b4.l[0]()}`+ );+ previousTheme.b4.l = themeReactive.b4.l[0]();+ }+ if (themeReactive.b4.c[0]() !== previousTheme.b4.c) {+ document.documentElement.style.setProperty(+ '--b4c',+ `${themeReactive.b4.c[0]()}`+ );+ previousTheme.b4.c = themeReactive.b4.c[0]();+ }+ if (themeReactive.b4.h[0]() !== previousTheme.b4.h) {+ document.documentElement.style.setProperty(+ '--b4h',+ `${themeReactive.b4.h[0]()}deg`+ );+ previousTheme.b4.h = themeReactive.b4.h[0]();+ }+ if (themeReactive.c0.l[0]() !== previousTheme.c0.l) {+ document.documentElement.style.setProperty(+ '--c0l',+ `${themeReactive.c0.l[0]()}`+ );+ previousTheme.c0.l = themeReactive.c0.l[0]();+ }+ if (themeReactive.c0.c[0]() !== previousTheme.c0.c) {+ document.documentElement.style.setProperty(+ '--c0c',+ `${themeReactive.c0.c[0]()}`+ );+ previousTheme.c0.c = themeReactive.c0.c[0]();+ }+ if (themeReactive.c0.h[0]() !== previousTheme.c0.h) {+ document.documentElement.style.setProperty(+ '--c0h',+ `${themeReactive.c0.h[0]()}deg`+ );+ previousTheme.c0.h = themeReactive.c0.h[0]();+ }+ if (themeReactive.c1.l[0]() !== previousTheme.c1.l) {+ document.documentElement.style.setProperty(+ '--c1l',+ `${themeReactive.c1.l[0]()}`+ );+ previousTheme.c1.l = themeReactive.c1.l[0]();+ }+ if (themeReactive.c1.c[0]() !== previousTheme.c1.c) {+ document.documentElement.style.setProperty(+ '--c1c',+ `${themeReactive.c1.c[0]()}`+ );+ previousTheme.c1.c = themeReactive.c1.c[0]();+ }+ if (themeReactive.c1.h[0]() !== previousTheme.c1.h) {+ document.documentElement.style.setProperty(+ '--c1h',+ `${themeReactive.c1.h[0]()}deg`+ );+ previousTheme.c1.h = themeReactive.c1.h[0]();+ }+ if (themeReactive.c2.l[0]() !== previousTheme.c2.l) {+ document.documentElement.style.setProperty(+ '--c2l',+ `${themeReactive.c2.l[0]()}`+ );+ previousTheme.c2.l = themeReactive.c2.l[0]();+ }+ if (themeReactive.c2.c[0]() !== previousTheme.c2.c) {+ document.documentElement.style.setProperty(+ '--c2c',+ `${themeReactive.c2.c[0]()}`+ );+ previousTheme.c2.c = themeReactive.c2.c[0]();+ }+ if (themeReactive.c2.h[0]() !== previousTheme.c2.h) {+ document.documentElement.style.setProperty(+ '--c2h',+ `${themeReactive.c2.h[0]()}deg`+ );+ previousTheme.c2.h = themeReactive.c2.h[0]();+ }+ if (themeReactive.c3.l[0]() !== previousTheme.c3.l) {+ document.documentElement.style.setProperty(+ '--c3l',+ `${themeReactive.c3.l[0]()}`+ );+ previousTheme.c3.l = themeReactive.c3.l[0]();+ }+ if (themeReactive.c3.c[0]() !== previousTheme.c3.c) {+ document.documentElement.style.setProperty(+ '--c3c',+ `${themeReactive.c3.c[0]()}`+ );+ previousTheme.c3.c = themeReactive.c3.c[0]();+ }+ if (themeReactive.c3.h[0]() !== previousTheme.c3.h) {+ document.documentElement.style.setProperty(+ '--c3h',+ `${themeReactive.c3.h[0]()}deg`+ );+ previousTheme.c3.h = themeReactive.c3.h[0]();+ }+ if (themeReactive.c4.l[0]() !== previousTheme.c4.l) {+ document.documentElement.style.setProperty(+ '--c4l',+ `${themeReactive.c4.l[0]()}`+ );+ previousTheme.c4.l = themeReactive.c4.l[0]();+ }+ if (themeReactive.c4.c[0]() !== previousTheme.c4.c) {+ document.documentElement.style.setProperty(+ '--c4c',+ `${themeReactive.c4.c[0]()}`+ );+ previousTheme.c4.c = themeReactive.c4.c[0]();+ }+ if (themeReactive.c4.h[0]() !== previousTheme.c4.h) {+ document.documentElement.style.setProperty(+ '--c4h',+ `${themeReactive.c4.h[0]()}deg`+ );+ previousTheme.c4.h = themeReactive.c4.h[0]();+ }syncThemeLightAttribute();setThemeUpdate();- setIsThemeSaved(false);},{ defer: true })@@ -139,6 +513,10 @@ function _createThemeEffect(cb: () => void) {}export function useReactiveColorString(colorKey: keyof ThemeReactive) {- const [l, c, h] = [themeReactive[colorKey].l[0], themeReactive[colorKey].c[0], themeReactive[colorKey].h[0]];+ const [l, c, h] = [+ themeReactive[colorKey].l[0],+ themeReactive[colorKey].c[0],+ themeReactive[colorKey].h[0],+ ];return () => `oklch(${l()} ${c()} ${h()}deg)`;}diff --git a/apps/web/src/features/theme/signals/themeSignals.ts b/apps/web/src/features/theme/signals/themeSignals.tsindex 61acb5ab03..313d969b17 100644--- a/apps/web/src/features/theme/signals/themeSignals.ts+++ b/apps/web/src/features/theme/signals/themeSignals.ts@@ -1,52 +1,97 @@-import { DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, DEFAULT_THEMES } from '../constants';-import { createMemo, createSignal } from 'solid-js';-import type { ThemeV0, ThemeV1, ThemeV2 } from '../types/themeTypes';-import { convertThemev0v1, convertThemev1v2 } from '../utils/themeMigrations';import { makePersisted } from '@solid-primitives/storage';+import { createMemo, createSignal } from 'solid-js';+import {+ DEFAULT_DARK_THEME,+ DEFAULT_LIGHT_THEME,+ DEFAULT_THEMES,+} from '../constants';+import type {+ ThemeColorTokens,+ ThemeV0,+ ThemeV1,+ ThemeV3,+} from '../types/themeTypes';+import {+ convertThemev0v1,+ convertThemev1v2,+ convertThemev2v3,+} from '../utils/themeMigrations';+import { isThemeV2, isThemeV3 } from '../utils/themeValidation';+import { normalizeThemeColorTokens } from '../utils/themeVNext';export const [isThemeSaved, setIsThemeSaved] = createSignal<boolean>(true);-export const [themeUpdate, setThemeUpdate] = createSignal<undefined>(undefined, {equals: () => false});+export const [themeUpdate, setThemeUpdate] = createSignal<undefined>(+ undefined,+ { equals: () => false }+);export const [htmlColor, setHtmlColor] = makePersisted(createSignal({ color: '' }),- {name: 'html-color-theme'}+ { name: 'html-color-theme' });export const [userThemes, setUserThemes] = makePersisted(- createSignal<ThemeV2[]>([]),- {name: 'macro-user-themes'}+ createSignal<ThemeV3[]>([]),+ { name: 'macro-user-themes' });setUserThemes(- userThemes().map((theme) => {- if(!theme.version){return convertThemev1v2(convertThemev0v1(theme as unknown as ThemeV0))}- else if(theme.version === 1){return convertThemev1v2(theme as unknown as ThemeV1)}- else{return theme}+ (userThemes() as unknown[]).flatMap((theme) => {+ if (isThemeV3(theme)) {+ return [+ {+ ...theme,+ colorTokens: normalizeThemeColorTokens(theme.colorTokens, theme.mode),+ },+ ];+ }+ if (isThemeV2(theme)) return [convertThemev2v3(theme)];+ if (typeof theme !== 'object' || theme === null) return [];++ const version = (theme as { version?: unknown }).version;+ if (version === 1) {+ return [convertThemev2v3(convertThemev1v2(theme as ThemeV1))];+ }+ if (version === undefined || version === 0) {+ return [+ convertThemev2v3(convertThemev1v2(convertThemev0v1(theme as ThemeV0))),+ ];+ }+ return [];}));export const [currentThemeId, setCurrentThemeId] = makePersisted(createSignal<string>(DEFAULT_DARK_THEME),- {name: 'macro-selected-theme'}+ { name: 'macro-selected-theme' });-export const themes = createMemo<ThemeV2[]>(() => [- ...(DEFAULT_THEMES as readonly ThemeV2[]),+export const themes = createMemo<ThemeV3[]>(() => [+ ...DEFAULT_THEMES,...userThemes(),]);+/** VNext colors currently rendered and edited in the document. */+export const [themeColorTokens, setThemeColorTokens] =+ createSignal<ThemeColorTokens>({});++/** Intrinsic mode of the currently rendered theme. */+export const [liveThemeMode, setLiveThemeMode] = createSignal<'light' | 'dark'>(+ 'dark'+);+// Per-mode theme preferences, persisted to localStorage. The active one is// applied by systemThemeEffect / resolveActiveThemeId (themeUtils.ts): the light// theme when themeMode is 'light' (or 'system' + OS light), the dark theme when// 'dark' (or 'system' + OS dark).export const [lightModeTheme, setLightModeTheme] = makePersisted(createSignal<string>(DEFAULT_LIGHT_THEME),- {name: 'macro-light-mode-theme'}+ { name: 'macro-light-mode-theme' });export const [darkModeTheme, setDarkModeTheme] = makePersisted(createSignal<string>(DEFAULT_DARK_THEME),- {name: 'macro-dark-mode-theme'}+ { name: 'macro-dark-mode-theme' });/** The "Active theme" mode: pin a fixed light or dark theme, or follow the OS@@ -60,20 +105,26 @@ export type ThemeMode = 'light' | 'dark' | 'system';* light/dark mode matching the previously-selected theme. Only used until the* new `macro-theme-mode` key is written. */function initialThemeMode(): ThemeMode {- if (typeof localStorage === 'undefined') { return 'system' }+ if (typeof localStorage === 'undefined') {+ return 'system';+ }const legacy = localStorage.getItem('macro-theme-should-match-system');// New/already-migrated users, and anyone who had auto-detect on: follow the OS.- if (legacy !== 'false') { return 'system' }+ if (legacy !== 'false') {+ return 'system';+ }// Auto-detect was off: pin to the mode matching the previously-selected theme- // (dark when its text is lighter than its background — see isTokensDark).+ // based on the explicit mode stored by V3.const pinned = themes().find((theme) => theme.id === currentThemeId());- if (!pinned) { return 'system' }- return pinned.tokens.c0.l > pinned.tokens.b0.l ? 'dark' : 'light';+ if (!pinned) {+ return 'system';+ }+ return pinned.mode;}export const [themeMode, setThemeMode] = makePersisted(createSignal<ThemeMode>(initialThemeMode()),- {name: 'macro-theme-mode'}+ { name: 'macro-theme-mode' });const supportsMatchMedia =@@ -82,7 +133,8 @@ const supportsMatchMedia =// Tracks the OS color scheme so the active theme can follow it when themeMode is// 'system'.export const [systemMode, setSystemMode] = createSignal<'dark' | 'light'>(- supportsMatchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches+ supportsMatchMedia &&+ window.matchMedia('(prefers-color-scheme: dark)').matches? 'dark': 'light');@@ -97,11 +149,11 @@ if (supportsMatchMedia) {// Theme-list filters: whether light and/or dark themes are shown in the list.export const [showLightThemes, setShowLightThemes] = makePersisted(createSignal<boolean>(true),- {name: 'macro-show-light-themes'}+ { name: 'macro-show-light-themes' });export const [showDarkThemes, setShowDarkThemes] = makePersisted(createSignal<boolean>(true),- {name: 'macro-show-dark-themes'}+ { name: 'macro-show-dark-themes' });export const [themeDepth, setThemeDepth] = createSignal<number>(0.15);diff --git a/apps/web/src/features/theme/themes/decepticon.ts b/apps/web/src/features/theme/themes/decepticon.tsnew file mode 100644index 0000000000..4709dd15ee--- /dev/null+++ b/apps/web/src/features/theme/themes/decepticon.ts@@ -0,0 +1,23 @@+import { defineLegacyDefaultTheme } from './defineLegacyDefaultTheme';++/** A pale violet-grey with a rich plum accent. */+export const decepticonTheme = defineLegacyDefaultTheme({+ id: 'Decepticon',+ tokens: {+ a0: { l: 0.52, c: 0.18, h: 295 },+ a1: { l: 0.52, c: 0.18, h: 335 },+ a2: { l: 0.52, c: 0.18, h: 15 },+ a3: { l: 0.52, c: 0.18, h: 55 },+ a4: { l: 0.52, c: 0.18, h: 95 },+ b0: { l: 0.98, c: 0.006, h: 295 },+ b1: { l: 0.96, c: 0.008, h: 295 },+ b2: { l: 0.93, c: 0.01, h: 295 },+ b3: { l: 0.95, c: 0.008, h: 295 },+ b4: { l: 0.93, c: 0.01, h: 295 },+ c0: { l: 0.23, c: 0.014, h: 295 },+ c1: { l: 0.4, c: 0.012, h: 295 },+ c2: { l: 0.52, c: 0.01, h: 295 },+ c3: { l: 0.62, c: 0.008, h: 295 },+ c4: { l: 0.72, c: 0.006, h: 295 },+ },+});diff --git a/apps/web/src/features/theme/themes/defineLegacyDefaultTheme.ts b/apps/web/src/features/theme/themes/defineLegacyDefaultTheme.tsnew file mode 100644index 0000000000..2833dc2242--- /dev/null+++ b/apps/web/src/features/theme/themes/defineLegacyDefaultTheme.ts@@ -0,0 +1,26 @@+import type { ThemeV2, ThemeV2Tokens, ThemeV3 } from '../types/themeTypes';+import {+ getThemeColorMode,+ legacyThemeToVNextTokens,+} from '../utils/themeVNext';++type LegacyDefaultThemeDefinition<TId extends string> = {+ id: TId;+ name?: string;+ tokens: ThemeV2Tokens;+ overrides?: ThemeV2['overrides'];+};++/** Converts a temporary legacy ramp definition into a token-only built-in. */+export function defineLegacyDefaultTheme<const TId extends string>(+ definition: LegacyDefaultThemeDefinition<TId>+): ThemeV3 & { id: TId } {+ const mode = getThemeColorMode(definition.tokens);+ return {+ id: definition.id,+ name: definition.name ?? definition.id,+ version: 3,+ mode,+ colorTokens: legacyThemeToVNextTokens(definition, mode),+ };+}diff --git a/apps/web/src/features/theme/themes/ember.ts b/apps/web/src/features/theme/themes/ember.tsnew file mode 100644index 0000000000..0b4de18d8b--- /dev/null+++ b/apps/web/src/features/theme/themes/ember.ts@@ -0,0 +1,23 @@+import { defineLegacyDefaultTheme } from './defineLegacyDefaultTheme';++/** A deep ember charcoal with a soft amber accent. */+export const emberTheme = defineLegacyDefaultTheme({+ id: 'Ember',+ tokens: {+ a0: { l: 0.75, c: 0.15, h: 55 },+ a1: { l: 0.75, c: 0.15, h: 95 },+ a2: { l: 0.75, c: 0.15, h: 135 },+ a3: { l: 0.75, c: 0.15, h: 175 },+ a4: { l: 0.75, c: 0.15, h: 215 },+ b0: { l: 0.16, c: 0.01, h: 55 },+ b1: { l: 0.2, c: 0.01, h: 55 },+ b2: { l: 0.24, c: 0.012, h: 55 },+ b3: { l: 0.27, c: 0.012, h: 55 },+ b4: { l: 0.31, c: 0.014, h: 55 },+ c0: { l: 0.95, c: 0.008, h: 55 },+ c1: { l: 0.83, c: 0.008, h: 55 },+ c2: { l: 0.73, c: 0.008, h: 55 },+ c3: { l: 0.63, c: 0.008, h: 55 },+ c4: { l: 0.55, c: 0.008, h: 55 },+ },+});diff --git a/apps/web/src/features/theme/themes/flora.ts b/apps/web/src/features/theme/themes/flora.tsnew file mode 100644index 0000000000..53d63d4428--- /dev/null+++ b/apps/web/src/features/theme/themes/flora.ts@@ -0,0 +1,68 @@+import type { ThemeV3 } from '../types/themeTypes';++export const floraTheme: ThemeV3 = {+ id: 'Flora',+ name: 'Flora',+ version: 3,+ mode: 'light',+ colorTokens: {+ 'surface-0': 'oklch(92.74% 0.0134 92)',+ 'surface-1':+ 'color-mix(in srgb, var(--color-surface-0) 56%, var(--color-surface-4))',+ 'surface-2':+ 'color-mix(in srgb, var(--color-surface-0) 27%, var(--color-surface-4))',+ 'surface-3':+ 'color-mix(in srgb, var(--color-surface-0) 6%, var(--color-surface-4))',+ 'surface-4': 'oklch(1 0 150deg)',+ 'content-0': 'oklch(32.49% 0.0365 150)',+ 'content-1':+ 'color-mix(in srgb, var(--color-content-0) 76%, var(--color-content-4))',+ 'content-2':+ 'color-mix(in srgb, var(--color-content-0) 54%, var(--color-content-4))',+ 'content-3':+ 'color-mix(in srgb, var(--color-content-0) 15%, var(--color-content-4))',+ 'content-4': 'oklch(73.59% 0.0319 150.2)',+ edge: 'oklch(79.13% 0.045 78 / 0.7)',+ 'edge-muted': 'oklch(81.55% 0.0382 98 / 0.76)',+ accent: 'oklch(65.07% 0.1903 336)',+ red: 'oklch(61.06% 0.1705 24.97)',+ orange: 'oklch(67.07% 0.1759 50.19)',+ amber: 'oklch(76.45% 0.1675 70.08)',+ yellow: 'oklch(82.38% 0.238 86.05)',+ lime: 'oklch(78.46% 0.2278 120)',+ green: 'oklch(73.51% 0.1207 159)',+ teal: 'oklch(51.34% 0.0896 185.5)',+ cyan: 'oklch(67.9% 0.1385 233)',+ blue: 'oklch(0.55 0.16 259.815deg)',+ violet: 'oklch(0.55 0.16 292.717deg)',+ purple: 'oklch(0.55 0.16 303.9deg)',+ pink: 'oklch(86.77% 0.2673 354.3)',+ surface: 'var(--layer-surface)',+ inset: 'var(--layer-inset)',+ lift: 'var(--layer-lift)',+ ink: 'var(--color-content-0)',+ 'ink-muted': 'var(--color-content-1)',+ 'ink-subtle': 'var(--color-content-2)',+ 'ink-disabled': 'var(--color-content-3)',+ 'ink-placeholder': 'var(--color-content-4)',+ link: 'var(--color-accent)',+ 'link-hover': 'var(--color-accent)',+ 'link-visited': 'var(--color-accent)',+ page: 'var(--color-surface-0)',+ panel: 'var(--color-surface-1)',+ dialog: 'var(--color-surface-2)',+ menu: 'var(--color-surface-2)',+ tooltip: 'var(--color-surface-2)',+ toast: 'var(--color-surface-2)',+ input: 'oklch(82.4% 0.1172 0 / 0.07)',+ 'input-focus': 'var(--color-lift)',+ message: 'var(--color-lift)',+ hover: 'color-mix(in oklch, var(--color-content-0) 3%, transparent)',+ active: 'color-mix(in oklch, var(--color-content-0) 6%, transparent)',+ selected: 'color-mix(in oklch, var(--color-accent) 8%, transparent)',+ success: 'var(--color-green)',+ warning: 'var(--color-yellow)',+ failure: 'var(--color-red)',+ chrome: 'var(--color-surface-4)',+ },+};diff --git a/apps/web/src/features/theme/themes/index.ts b/apps/web/src/features/theme/themes/index.tsnew file mode 100644index 0000000000..3097c93f03--- /dev/null+++ b/apps/web/src/features/theme/themes/index.ts@@ -0,0 +1,32 @@+import type { ThemeV3 } from '../types/themeTypes';+import { decepticonTheme } from './decepticon';+import { emberTheme } from './ember';+import { floraTheme } from './flora';+import { lapisTheme } from './lapis';+import { macroDarkTheme } from './macro-dark';+import { macroGruvboxTheme } from './macro-gruvbox';+import { macroLightTheme } from './macro-light';+import { moonTheme } from './moon';+import { paperTheme } from './paper';+import { rainTheme } from './rain';+import { satsumaTheme } from './satsuma';+import { spiritTheme } from './spirit';+import { voidTheme } from './void';++// Ordered for the theme picker: dark themes first (led by Macro Dark), then+// light themes (led by Macro Light).+export const DEFAULT_THEMES = [+ macroDarkTheme,+ macroGruvboxTheme,+ voidTheme,+ emberTheme,+ spiritTheme,+ moonTheme,+ rainTheme,+ macroLightTheme,+ satsumaTheme,+ lapisTheme,+ floraTheme,+ paperTheme,+ decepticonTheme,+] satisfies ThemeV3[];diff --git a/apps/web/src/features/theme/themes/lapis.ts b/apps/web/src/features/theme/themes/lapis.tsnew file mode 100644index 0000000000..e399daca2b--- /dev/null+++ b/apps/web/src/features/theme/themes/lapis.ts@@ -0,0 +1,68 @@+import type { ThemeV3 } from '../types/themeTypes';++export const lapisTheme: ThemeV3 = {+ id: 'Lapis',+ name: 'Lapis',+ version: 3,+ mode: 'light',+ colorTokens: {+ 'surface-0': 'oklch(93.66% 0.0113 250)',+ 'surface-1':+ 'color-mix(in srgb, var(--color-surface-0) 38%, var(--color-surface-4))',+ 'surface-2':+ 'color-mix(in srgb, var(--color-surface-0) 24%, var(--color-surface-4))',+ 'surface-3':+ 'color-mix(in srgb, var(--color-surface-0) 10%, var(--color-surface-4))',+ 'surface-4': 'oklch(1 0 250deg)',+ 'content-0': 'oklch(0.23 0.018 250deg)',+ 'content-1': 'oklch(0.4 0.016 250deg)',+ 'content-2':+ 'color-mix(in srgb, var(--color-content-0) 51%, var(--color-content-4))',+ 'content-3': 'oklch(0.62 0.012 250deg)',+ 'content-4': 'oklch(70.26% 0.0412 250)',+ edge: 'oklch(93% 0.01 250 / 0)',+ 'edge-muted': 'oklch(95% 0.008 250 / 0)',+ accent: 'oklch(67.41% 0.1964 255)',+ red: 'oklch(56.77% 0.2102 27.67)',+ orange: 'oklch(72.22% 0.1679 47.6)',+ amber: 'oklch(74.91% 0.1462 70.08)',+ yellow: 'oklch(84.36% 0.1931 86.05)',+ lime: 'oklch(79.88% 0.1645 130.9)',+ green: 'oklch(68.03% 0.1701 149.6)',+ teal: 'oklch(72.82% 0.1729 182.5)',+ cyan: 'oklch(69.5% 0.1452 215.2)',+ blue: 'oklch(0.55 0.17 259.815deg)',+ violet: 'oklch(0.55 0.17 292.717deg)',+ purple: 'oklch(0.55 0.17 303.9deg)',+ pink: 'oklch(0.55 0.17 354.308deg)',+ surface: 'var(--layer-surface)',+ inset: 'var(--layer-inset)',+ lift: 'var(--layer-lift)',+ ink: 'var(--color-content-0)',+ 'ink-muted': 'var(--color-content-1)',+ 'ink-subtle': 'var(--color-content-2)',+ 'ink-disabled': 'var(--color-content-3)',+ 'ink-placeholder': 'var(--color-content-4)',+ link: 'var(--color-accent)',+ 'link-hover': 'var(--color-accent)',+ 'link-visited': 'oklch(72.47% 0.2016 286)',+ page: 'var(--color-surface-0)',+ panel: 'var(--color-surface-1)',+ dialog: 'var(--color-surface-2)',+ menu: 'var(--color-surface-2)',+ tooltip: 'var(--color-surface-2)',+ toast: 'var(--color-surface-2)',+ input: 'transparent',+ 'input-focus': 'var(--color-lift)',+ message: 'var(--color-lift)',+ hover:+ 'color-mix(in oklch, color-mix(in oklch, var(--color-content-0) 50%, var(--color-accent)) 3%, transparent)',+ active:+ 'color-mix(in oklch, color-mix(in oklch, var(--color-content-0) 50%, var(--color-accent)) 6%, transparent)',+ selected: 'color-mix(in oklch, var(--color-accent) 8%, transparent)',+ success: 'var(--color-green)',+ warning: 'var(--color-yellow)',+ failure: 'var(--color-red)',+ chrome: 'var(--color-surface-4)',+ },+};diff --git a/apps/web/src/features/theme/themes/macro-dark.ts b/apps/web/src/features/theme/themes/macro-dark.tsnew file mode 100644index 0000000000..d5c40aef66--- /dev/null+++ b/apps/web/src/features/theme/themes/macro-dark.ts@@ -0,0 +1,44 @@+import { isTouchDevice } from '@core/mobile/isTouchDevice';+import type { ThemeV2Tokens } from '../types/themeTypes';+import { defineLegacyDefaultTheme } from './defineLegacyDefaultTheme';++const tokens: ThemeV2Tokens = isTouchDevice()+ ? {+ a0: { l: 0.75, c: 0.2, h: 59 },+ a1: { l: 0.75, c: 0.2, h: 99 },+ a2: { l: 0.75, c: 0.2, h: 139 },+ a3: { l: 0.75, c: 0.2, h: 179 },+ a4: { l: 0.75, c: 0.2, h: 219 },+ b0: { l: 0, c: 0, h: 21 },+ b1: { l: 0.18, c: 0, h: 21 },+ b2: { l: 0.23, c: 0, h: 21 },+ b3: { l: 0.25, c: 0, h: 21 },+ b4: { l: 0.28, c: 0, h: 21 },+ c0: { l: 0.95, c: 0, h: 21 },+ c1: { l: 0.83, c: 0, h: 21 },+ c2: { l: 0.75, c: 0, h: 21 },+ c3: { l: 0.63, c: 0, h: 21 },+ c4: { l: 0.55, c: 0, h: 21 },+ }+ : {+ a0: { l: 0.75, c: 0.2, h: 59 },+ a1: { l: 0.75, c: 0.2, h: 99 },+ a2: { l: 0.75, c: 0.2, h: 139 },+ a3: { l: 0.75, c: 0.2, h: 179 },+ a4: { l: 0.75, c: 0.2, h: 219 },+ b0: { l: 0.14, c: 0, h: 59 },+ b1: { l: 0.2, c: 0, h: 59 },+ b2: { l: 0.23, c: 0, h: 59 },+ b3: { l: 0.25, c: 0, h: 59 },+ b4: { l: 0.28, c: 0, h: 59 },+ c0: { l: 0.95, c: 0, h: 59 },+ c1: { l: 0.83, c: 0, h: 59 },+ c2: { l: 0.75, c: 0, h: 59 },+ c3: { l: 0.63, c: 0, h: 59 },+ c4: { l: 0.55, c: 0, h: 59 },+ };++export const macroDarkTheme = defineLegacyDefaultTheme({+ id: 'Macro Dark',+ tokens,+});diff --git a/apps/web/src/features/theme/themes/macro-gruvbox.ts b/apps/web/src/features/theme/themes/macro-gruvbox.tsnew file mode 100644index 0000000000..3c192a57ef--- /dev/null+++ b/apps/web/src/features/theme/themes/macro-gruvbox.ts@@ -0,0 +1,63 @@+import type { ThemeV3 } from '../types/themeTypes';++/** A dark theme built from the classic Gruvbox palette. */+export const macroGruvboxTheme = {+ id: 'Macro-Gruvbox',+ name: 'Macro-Gruvbox',+ version: 3,+ mode: 'dark',+ colorTokens: {+ 'surface-0': '#282828',+ 'surface-1': '#32302f',+ 'surface-2': '#3c3836',+ 'surface-3': '#504945',+ 'surface-4': '#665c54',+ 'content-0': '#fbf1c7',+ 'content-1': '#ebdbb2',+ 'content-2': '#d5c4a1',+ 'content-3': '#bdae93',+ 'content-4': '#a89984',+ edge: '#504945',+ 'edge-muted': '#3c3836',+ accent: '#689d6a',+ red: '#fb4934',+ orange: '#fe8019',+ amber: '#d79921',+ yellow: '#fabd2f',+ lime: '#b8bb26',+ green: '#98971a',+ teal: '#689d6a',+ cyan: '#8ec07c',+ blue: '#83a598',+ violet: '#d3869b',+ purple: '#b16286',+ pink: '#d3869b',+ surface: 'var(--layer-surface)',+ inset: 'var(--layer-inset)',+ lift: 'var(--layer-lift)',+ ink: 'var(--color-content-0)',+ 'ink-muted': 'var(--color-content-1)',+ 'ink-subtle': 'var(--color-content-2)',+ 'ink-disabled': 'var(--color-content-3)',+ 'ink-placeholder': 'var(--color-content-4)',+ link: 'var(--color-accent)',+ 'link-hover': '#8ec07c',+ 'link-visited': 'var(--color-accent)',+ page: 'var(--color-surface-0)',+ panel: 'var(--color-surface-1)',+ dialog: 'var(--color-surface-2)',+ menu: 'var(--color-surface-2)',+ tooltip: 'var(--color-surface-2)',+ toast: 'var(--color-surface-2)',+ input: 'transparent',+ 'input-focus': 'var(--color-lift)',+ message: 'var(--color-lift)',+ hover: 'color-mix(in oklch, var(--color-content-0) 3%, transparent)',+ active: 'color-mix(in oklch, var(--color-content-0) 6%, transparent)',+ selected: 'color-mix(in oklch, var(--color-accent) 8%, transparent)',+ success: 'var(--color-green)',+ warning: 'var(--color-amber)',+ failure: 'var(--color-red)',+ chrome: '#1d2021',+ },+} satisfies ThemeV3;diff --git a/apps/web/src/features/theme/themes/macro-light.ts b/apps/web/src/features/theme/themes/macro-light.tsnew file mode 100644index 0000000000..ccc8a8a4e1--- /dev/null+++ b/apps/web/src/features/theme/themes/macro-light.ts@@ -0,0 +1,65 @@+import type { ThemeV3 } from '../types/themeTypes';++export const macroLightTheme = {+ id: 'Macro Light',+ name: 'Macro Light',+ version: 3,+ mode: 'light',+ colorTokens: {+ 'surface-0': 'oklch(0.964 0 59deg)',+ 'surface-1':+ 'color-mix(in srgb, var(--color-surface-0) 30%, var(--color-surface-4))',+ 'surface-2':+ 'color-mix(in srgb, var(--color-surface-0) 15%, var(--color-surface-4))',+ 'surface-3':+ 'color-mix(in srgb, var(--color-surface-0) 7%, var(--color-surface-4))',+ 'surface-4': 'oklch(1 0 59deg)',+ 'content-0': 'oklch(0.16 0 59deg)',+ 'content-1': 'oklch(0.4 0 59deg)',+ 'content-2': 'oklch(0.45 0 59deg)',+ 'content-3': 'oklch(0.55 0 59deg)',+ 'content-4': 'oklch(0.7 0 59deg)',+ edge: 'oklch(0.91 0 59deg)',+ 'edge-muted': 'oklch(0.92 0 59deg)',+ accent: 'oklch(0.65 0.2 59deg)',+ red: 'oklch(63.7% 0.237 25.331)',+ orange: 'oklch(70.5% 0.213 47.604)',+ amber: 'oklch(76.9% 0.188 70.08)',+ yellow: 'oklch(79.5% 0.184 86.047)',+ lime: 'oklch(76.8% 0.233 130.85)',+ green: 'oklch(72.3% 0.219 149.579)',+ teal: 'oklch(71.05% 0.1276 181.6)',+ cyan: 'oklch(79.06% 0.1438 215.2)',+ blue: 'oklch(62.3% 0.214 259.815)',+ violet: 'oklch(60.6% 0.25 292.717)',+ purple: 'oklch(62.7% 0.265 303.9)',+ pink: 'oklch(65.6% 0.241 354.308)',+ surface: 'var(--layer-surface)',+ inset: 'var(--layer-inset)',+ lift: 'var(--layer-lift)',+ ink: 'var(--color-content-0)',+ 'ink-muted': 'var(--color-content-1)',+ 'ink-subtle': 'var(--color-content-2)',+ 'ink-disabled': 'var(--color-content-3)',+ 'ink-placeholder': 'var(--color-content-4)',+ link: 'var(--color-accent)',+ 'link-hover': 'var(--color-accent)',+ 'link-visited': 'var(--color-accent)',+ page: 'var(--color-surface-0)',+ panel: 'var(--color-surface-1)',+ dialog: 'var(--color-surface-3)',+ menu: 'var(--color-surface-3)',+ tooltip: 'var(--color-surface-2)',+ toast: 'var(--color-surface-2)',+ input: 'transparent',+ 'input-focus': 'var(--color-lift)',+ message: 'var(--color-lift)',+ hover: 'color-mix(in oklch, var(--color-content-0) 3%, transparent)',+ active: 'color-mix(in oklch, var(--color-content-0) 6%, transparent)',+ selected: 'color-mix(in oklch, var(--color-accent) 8%, transparent)',+ success: 'var(--color-green)',+ warning: 'var(--color-yellow)',+ failure: 'var(--color-red)',+ chrome: 'var(--color-surface-4)',+ },+} satisfies ThemeV3;diff --git a/apps/web/src/features/theme/themes/moon.ts b/apps/web/src/features/theme/themes/moon.tsnew file mode 100644index 0000000000..35553efe49--- /dev/null+++ b/apps/web/src/features/theme/themes/moon.ts@@ -0,0 +1,23 @@+import { defineLegacyDefaultTheme } from './defineLegacyDefaultTheme';++/** A deep midnight blue with a periwinkle accent. */+export const moonTheme = defineLegacyDefaultTheme({+ id: 'Moon',+ tokens: {+ a0: { l: 0.7, c: 0.15, h: 255 },+ a1: { l: 0.7, c: 0.15, h: 295 },+ a2: { l: 0.7, c: 0.15, h: 335 },+ a3: { l: 0.7, c: 0.15, h: 15 },+ a4: { l: 0.7, c: 0.15, h: 55 },+ b0: { l: 0.15, c: 0.012, h: 255 },+ b1: { l: 0.19, c: 0.012, h: 255 },+ b2: { l: 0.23, c: 0.014, h: 255 },+ b3: { l: 0.26, c: 0.014, h: 255 },+ b4: { l: 0.3, c: 0.016, h: 255 },+ c0: { l: 0.95, c: 0.01, h: 255 },+ c1: { l: 0.85, c: 0.01, h: 255 },+ c2: { l: 0.75, c: 0.01, h: 255 },+ c3: { l: 0.65, c: 0.01, h: 255 },+ c4: { l: 0.57, c: 0.01, h: 255 },+ },+});diff --git a/apps/web/src/features/theme/themes/paper.ts b/apps/web/src/features/theme/themes/paper.tsnew file mode 100644index 0000000000..8e9768bcee--- /dev/null+++ b/apps/web/src/features/theme/themes/paper.ts@@ -0,0 +1,62 @@+import type { ThemeV3 } from '../types/themeTypes';++export const paperTheme: ThemeV3 = {+ id: 'Paper',+ name: 'Paper',+ version: 3,+ mode: 'light',+ colorTokens: {+ 'surface-0': 'oklch(0.985 0.006 75deg)',+ 'surface-1': 'oklch(0.98875 0.0045 75deg)',+ 'surface-2': 'oklch(0.9925 0.003 75deg)',+ 'surface-3': 'oklch(0.99625 0.0015 75deg)',+ 'surface-4': 'oklch(1 0 75deg)',+ 'content-0': 'oklch(0.22 0.008 70deg)',+ 'content-1': 'oklch(0.4 0.007 70deg)',+ 'content-2': 'oklch(0.52 0.006 70deg)',+ 'content-3': 'oklch(0.62 0.005 70deg)',+ 'content-4': 'oklch(0.72 0.004 70deg)',+ edge: 'oklch(85.92% 0.0135 75)',+ 'edge-muted': 'oklch(90.67% 0.0089 75)',+ accent: 'oklch(0.5 0.13 250deg)',+ red: 'oklch(62.51% 0.2414 25.33)',+ orange: 'oklch(70.86% 0.2077 47.6)',+ amber: 'oklch(78.71% 0.1661 70.08)',+ yellow: 'oklch(83.13% 0.1532 86.05)',+ lime: 'oklch(67.19% 0.1467 130.9)',+ green: 'oklch(64.14% 0.1655 149.6)',+ teal: 'oklch(66.2% 0.1453 182.5)',+ cyan: 'oklch(70.49% 0.1294 215.2)',+ blue: 'oklch(0.5 0.13 259.815deg)',+ violet: 'oklch(54.32% 0.1603 292.7)',+ purple: 'oklch(32.76% 0.2243 303.9)',+ pink: 'oklch(64.14% 0.1929 354.3)',+ surface: 'var(--layer-surface)',+ inset: 'var(--layer-inset)',+ lift: 'var(--layer-lift)',+ ink: 'var(--color-content-0)',+ 'ink-muted': 'var(--color-content-1)',+ 'ink-subtle': 'var(--color-content-2)',+ 'ink-disabled': 'var(--color-content-3)',+ 'ink-placeholder': 'var(--color-content-4)',+ link: 'oklch(55.37% 0.2379 250)',+ 'link-hover': 'oklch(72.02% 0.119 250)',+ 'link-visited': 'oklch(60.16% 0.2119 294)',+ page: 'var(--color-surface-0)',+ panel: 'var(--color-surface-1)',+ dialog: 'var(--color-surface-2)',+ menu: 'var(--color-surface-2)',+ tooltip: 'var(--color-surface-2)',+ toast: 'var(--color-surface-2)',+ input: 'transparent',+ 'input-focus': 'var(--color-lift)',+ message: 'var(--color-lift)',+ hover: 'color-mix(in oklch, var(--color-content-0) 3%, transparent)',+ active: 'color-mix(in oklch, var(--color-content-0) 6%, transparent)',+ selected: 'color-mix(in oklch, var(--color-accent) 8%, transparent)',+ success: 'var(--color-green)',+ warning: 'var(--color-yellow)',+ failure: 'var(--color-red)',+ chrome: 'var(--color-surface-4)',+ },+};diff --git a/apps/web/src/features/theme/themes/rain.ts b/apps/web/src/features/theme/themes/rain.tsnew file mode 100644index 0000000000..f01cf3a3b2--- /dev/null+++ b/apps/web/src/features/theme/themes/rain.ts@@ -0,0 +1,67 @@+import type { ThemeV3 } from '../types/themeTypes';++export const rainTheme: ThemeV3 = {+ id: 'Rain',+ name: 'Rain',+ version: 3,+ mode: 'dark',+ colorTokens: {+ 'surface-0': 'oklch(12.33% 0.0822 210)',+ 'surface-1':+ 'color-mix(in srgb, var(--color-surface-0) 65%, var(--color-surface-4))',+ 'surface-2':+ 'color-mix(in srgb, var(--color-surface-0) 42%, var(--color-surface-4))',+ 'surface-3':+ 'color-mix(in srgb, var(--color-surface-0) 21%, var(--color-surface-4))',+ 'surface-4': 'oklch(27.57% 0.0256 210)',+ 'content-0': 'oklch(94.35% 0.0205 210)',+ 'content-1':+ 'color-mix(in srgb, var(--color-content-0) 76%, var(--color-content-4))',+ 'content-2':+ 'color-mix(in srgb, var(--color-content-0) 51%, var(--color-content-4))',+ 'content-3': 'oklch(0.64 0.008 210deg)',+ 'content-4': 'oklch(38.98% 0.0114 210)',+ edge: 'oklch(30.89% 0.1632 210)',+ 'edge-muted': 'oklch(33.42% 0.0201 210)',+ accent: 'oklch(86.93% 0.1683 200)',+ red: 'oklch(0.72 0.13 25.331deg)',+ orange: 'oklch(0.72 0.13 47.604deg)',+ amber: 'oklch(0.72 0.13 70.08deg)',+ yellow: 'oklch(0.72 0.13 86.047deg)',+ lime: 'oklch(0.72 0.13 130.85deg)',+ green: 'oklch(0.72 0.13 149.579deg)',+ teal: 'oklch(0.72 0.13 182.503deg)',+ cyan: 'oklch(0.72 0.13 215.221deg)',+ blue: 'oklch(0.72 0.13 259.815deg)',+ violet: 'oklch(0.72 0.13 292.717deg)',+ purple: 'oklch(0.72 0.13 303.9deg)',+ pink: 'oklch(0.72 0.13 354.308deg)',+ surface: 'var(--layer-surface)',+ inset: 'var(--layer-inset)',+ lift: 'var(--layer-lift)',+ ink: 'var(--color-content-0)',+ 'ink-muted': 'var(--color-content-1)',+ 'ink-subtle': 'var(--color-content-2)',+ 'ink-disabled': 'var(--color-content-3)',+ 'ink-placeholder': 'var(--color-content-4)',+ link: 'oklch(71.06% 0.3078 200)',+ 'link-hover': 'oklch(89.63% 0.105 200)',+ 'link-visited': 'oklch(72% 0.13 261)',+ page: 'var(--color-surface-0)',+ panel: 'var(--color-surface-1)',+ dialog: 'var(--color-surface-2)',+ menu: 'var(--color-surface-2)',+ tooltip: 'var(--color-surface-2)',+ toast: 'var(--color-surface-2)',+ input: 'transparent',+ 'input-focus': 'var(--color-lift)',+ message: 'var(--color-lift)',+ hover: 'color-mix(in oklch, var(--color-content-0) 3%, transparent)',+ active: 'color-mix(in oklch, var(--color-content-0) 6%, transparent)',+ selected: 'color-mix(in oklch, var(--color-accent) 8%, transparent)',+ success: 'var(--color-green)',+ warning: 'var(--color-amber)',+ failure: 'var(--color-red)',+ chrome: 'var(--color-surface-4)',+ },+};diff --git a/apps/web/src/features/theme/themes/satsuma.ts b/apps/web/src/features/theme/themes/satsuma.tsnew file mode 100644index 0000000000..fb03a2a272--- /dev/null+++ b/apps/web/src/features/theme/themes/satsuma.ts@@ -0,0 +1,68 @@+import type { ThemeV3 } from '../types/themeTypes';++export const satsumaTheme = {+ id: 'Satsuma',+ name: 'Satsuma',+ version: 3,+ mode: 'light',+ colorTokens: {+ 'surface-0': 'oklch(90.87% 0.0173 79.76)',+ 'surface-1':+ 'color-mix(in srgb, var(--color-surface-0) 59%, var(--color-surface-4))',+ 'surface-2':+ 'color-mix(in srgb, var(--color-surface-0) 30%, var(--color-surface-4))',+ 'surface-3':+ 'color-mix(in srgb, var(--color-surface-0) 5%, var(--color-surface-4))',+ 'surface-4': 'oklch(98.12% 0.0054 70)',+ 'content-0': 'oklch(43.79% 0.0333 55)',+ 'content-1':+ 'color-mix(in srgb, var(--color-content-0) 75%, var(--color-content-4))',+ 'content-2':+ 'color-mix(in srgb, var(--color-content-0) 50%, var(--color-content-4))',+ 'content-3':+ 'color-mix(in srgb, var(--color-content-0) 25%, var(--color-content-4))',+ 'content-4': 'oklch(59.5% 0.0397 59)',+ edge: 'oklch(66.5% 0.0703 57.89 / 0.21)',+ 'edge-muted': 'color-mix(in oklch, var(--color-edge) 70%, transparent)',+ accent: 'oklch(0.62 0.16 55deg)',+ red: 'oklch(54.51% 0.2036 28.71)',+ orange: 'oklch(62.17% 0.1708 45.9)',+ amber: 'oklch(72.52% 0.1425 77.61)',+ yellow: 'oklch(72.52% 0.1425 77.61)',+ lime: 'oklch(65.64% 0.1354 109.1)',+ green: 'oklch(65.64% 0.1354 109.1)',+ teal: 'oklch(64.5% 0.0939 145.3)',+ cyan: 'oklch(64.5% 0.0939 145.3)',+ blue: 'oklch(47.05% 0.0819 215.7)',+ violet: 'oklch(59.73% 0.1105 352.2)',+ purple: 'oklch(59.73% 0.1105 352.2)',+ pink: 'oklch(63.59% 0.1549 341.8)',+ surface: 'var(--layer-surface)',+ inset: 'var(--layer-inset)',+ lift: 'var(--layer-lift)',+ ink: 'var(--color-content-0)',+ 'ink-muted': 'var(--color-content-1)',+ 'ink-subtle': 'var(--color-content-2)',+ 'ink-disabled': 'var(--color-content-3)',+ 'ink-placeholder': 'var(--color-content-4)',+ link: 'var(--color-blue)',+ 'link-hover': 'oklch(60.37% 0.0934 215.7)',+ 'link-visited': 'oklch(45.02% 0.1102 215.7)',+ page: 'var(--color-surface-0)',+ panel: 'var(--color-surface-1)',+ dialog: 'var(--color-surface-2)',+ menu: 'var(--color-surface-2)',+ tooltip: 'var(--color-surface-2)',+ toast: 'var(--color-surface-2)',+ input: 'transparent',+ 'input-focus': 'var(--color-lift)',+ message: 'var(--color-lift)',+ hover: 'color-mix(in oklch, var(--color-content-0) 3%, transparent)',+ active: 'color-mix(in oklch, var(--color-content-0) 6%, transparent)',+ selected: 'color-mix(in oklch, var(--color-accent) 8%, transparent)',+ success: 'var(--color-green)',+ warning: 'var(--color-yellow)',+ failure: 'var(--color-red)',+ chrome: 'var(--color-surface-4)',+ },+} satisfies ThemeV3;diff --git a/apps/web/src/features/theme/themes/spirit.ts b/apps/web/src/features/theme/themes/spirit.tsnew file mode 100644index 0000000000..9354bf174f--- /dev/null+++ b/apps/web/src/features/theme/themes/spirit.ts@@ -0,0 +1,23 @@+import { defineLegacyDefaultTheme } from './defineLegacyDefaultTheme';++/** An ethereal violet-indigo night. */+export const spiritTheme = defineLegacyDefaultTheme({+ id: 'Spirit',+ tokens: {+ a0: { l: 0.72, c: 0.16, h: 295 },+ a1: { l: 0.72, c: 0.16, h: 335 },+ a2: { l: 0.72, c: 0.16, h: 15 },+ a3: { l: 0.72, c: 0.16, h: 55 },+ a4: { l: 0.72, c: 0.16, h: 95 },+ b0: { l: 0.16, c: 0.014, h: 295 },+ b1: { l: 0.2, c: 0.014, h: 295 },+ b2: { l: 0.24, c: 0.016, h: 295 },+ b3: { l: 0.27, c: 0.016, h: 295 },+ b4: { l: 0.31, c: 0.018, h: 295 },+ c0: { l: 0.93, c: 0.012, h: 295 },+ c1: { l: 0.84, c: 0.012, h: 295 },+ c2: { l: 0.74, c: 0.012, h: 295 },+ c3: { l: 0.64, c: 0.012, h: 295 },+ c4: { l: 0.56, c: 0.012, h: 295 },+ },+});diff --git a/apps/web/src/features/theme/themes/void.ts b/apps/web/src/features/theme/themes/void.tsnew file mode 100644index 0000000000..b330a0c7f0--- /dev/null+++ b/apps/web/src/features/theme/themes/void.ts@@ -0,0 +1,23 @@+import { defineLegacyDefaultTheme } from './defineLegacyDefaultTheme';++/** A true graphite monochrome with a whisper of cool accent hue. */+export const voidTheme = defineLegacyDefaultTheme({+ id: 'Void',+ tokens: {+ a0: { l: 0.8, c: 0.03, h: 250 },+ a1: { l: 0.8, c: 0.03, h: 290 },+ a2: { l: 0.8, c: 0.03, h: 330 },+ a3: { l: 0.8, c: 0.03, h: 10 },+ a4: { l: 0.8, c: 0.03, h: 50 },+ b0: { l: 0.15, c: 0, h: 0 },+ b1: { l: 0.19, c: 0, h: 0 },+ b2: { l: 0.22, c: 0, h: 0 },+ b3: { l: 0.25, c: 0, h: 0 },+ b4: { l: 0.29, c: 0, h: 0 },+ c0: { l: 0.95, c: 0, h: 0 },+ c1: { l: 0.82, c: 0, h: 0 },+ c2: { l: 0.72, c: 0, h: 0 },+ c3: { l: 0.63, c: 0, h: 0 },+ c4: { l: 0.55, c: 0, h: 0 },+ },+});diff --git a/apps/web/src/features/theme/types/themeTypes.ts b/apps/web/src/features/theme/types/themeTypes.tsindex 107c294660..0463be92a4 100644--- a/apps/web/src/features/theme/types/themeTypes.ts+++ b/apps/web/src/features/theme/types/themeTypes.ts@@ -45,23 +45,114 @@ export type ThemePrevious = {c4: { l: number; c: number; h: number };};-export const semanticTokens = ['page', 'panel', 'inset', 'dialog', 'menu', 'input', 'message', 'hover', 'active', 'button', 'chrome'] as const;+export const surfaceTokens = [+ 'surface-0',+ 'surface-1',+ 'surface-2',+ 'surface-3',+ 'surface-4',+] as const;++export const contentTokens = [+ 'content-0',+ 'content-1',+ 'content-2',+ 'content-3',+ 'content-4',+] as const;++export const edgeTokens = ['edge', 'edge-muted'] as const;++export const paletteTokens = [+ 'red',+ 'orange',+ 'amber',+ 'yellow',+ 'lime',+ 'green',+ 'teal',+ 'cyan',+ 'blue',+ 'violet',+ 'purple',+ 'pink',+] as const;++export const inputColorTokens = [+ ...surfaceTokens,+ ...contentTokens,+ ...edgeTokens,+ 'accent',+ ...paletteTokens,+] as const;++export type InputColorToken = (typeof inputColorTokens)[number];++export const semanticTokens = [+ 'surface',+ 'inset',+ 'lift',+ 'ink',+ 'ink-muted',+ 'ink-subtle',+ 'ink-disabled',+ 'ink-placeholder',+ 'link',+ 'link-hover',+ 'link-visited',+ 'page',+ 'panel',+ 'dialog',+ 'menu',+ 'tooltip',+ 'toast',+ 'input',+ 'input-focus',+ 'message',+ 'hover',+ 'active',+ 'selected',+ 'success',+ 'warning',+ 'failure',+ 'chrome',+] as const;export type SemanticToken = (typeof semanticTokens)[number];+/** Flat, serializable source of truth for authored VNext theme colors. */+export type ThemeColorTokens = Record<string, string>;++export type ThemeColorMode = 'light' | 'dark';+type TokenColor = {- token: SemanticToken,- value: { l: number; c: number; h: number }-}+ token: SemanticToken;+ value: { l: number; c: number; h: number };+};export type ThemeV2 = {id: string;name: string;- version: number;+ version: 2;depth: number;tokens: ThemeV2Tokens;overrides?: TokenColor[];+ /** VNext input and semantic colors. Legacy themes omit this field. */+ colorTokens?: ThemeColorTokens;};+/** Token-only theme format. Legacy ramps and depth are generated compatibility+ * state and are deliberately not persisted. */+export type ThemeV3 = {+ id: string;+ name: string;+ version: 3;+ mode: ThemeColorMode;+ colorTokens: ThemeColorTokens;+};++/** The normalized theme shape used by the application at runtime. */+export type Theme = ThemeV3;+export type ThemeV2Tokens = {a0: { l: number; c: number; h: number };a1: { l: number; c: number; h: number };diff --git a/apps/web/src/features/theme/utils/__tests__/colorUtil.test.ts b/apps/web/src/features/theme/utils/__tests__/colorUtil.test.tsnew file mode 100644index 0000000000..6368a90097--- /dev/null+++ b/apps/web/src/features/theme/utils/__tests__/colorUtil.test.ts@@ -0,0 +1,56 @@+import { describe, expect, it } from 'vitest';+import {+ convertOklchTo,+ formatOklch,+ getOklch,+ sanitizeOklch,+ tryGetOklch,+} from '../colorUtil';++describe('OKLCH runtime safety', () => {+ it('replaces missing and non-finite channels with finite defaults', () => {+ expect(+ sanitizeOklch({+ l: undefined,+ c: Number.NaN,+ h: undefined,+ alpha: Infinity,+ })+ ).toEqual({ l: 0, c: 0, h: 0, alpha: 1 });+ });++ it('never serializes undefined or NaN channels', () => {+ const value = formatOklch({+ l: undefined,+ c: Number.NaN,+ h: undefined,+ alpha: undefined,+ });++ expect(value).toBe('oklch(0 0 0deg / 1)');+ expect(value).not.toMatch(/undefined|NaN/);+ });++ it('defends Color.js conversion against invalid runtime arguments', () => {+ const value = convertOklchTo(+ undefined as unknown as number,+ Number.NaN,+ undefined as unknown as number,+ 'oklch',+ undefined+ );++ expect(value).not.toMatch(/undefined|NaN|none/);+ expect(() => getOklch(value)).not.toThrow();+ });++ it('returns a finite fallback for malformed and unresolved CSS colors', () => {+ const fallback = { l: 0.5, c: 0.1, h: 120, alpha: 0.8 };++ expect(tryGetOklch('var(--missing-color)', fallback)).toEqual(fallback);+ expect(tryGetOklch('oklch(undefined 0.2 30deg)', fallback)).toEqual(+ fallback+ );+ expect(tryGetOklch(undefined, fallback)).toEqual(fallback);+ });+});diff --git a/apps/web/src/features/theme/utils/__tests__/themeVNext.test.ts b/apps/web/src/features/theme/utils/__tests__/themeVNext.test.tsnew file mode 100644index 0000000000..761ef931ee--- /dev/null+++ b/apps/web/src/features/theme/utils/__tests__/themeVNext.test.ts@@ -0,0 +1,226 @@+import { describe, expect, it } from 'vitest';+import { semanticTokens, type ThemeV2Tokens } from '../../types/themeTypes';+import {+ parseThemeAssignment,+ serializeThemeAssignment,+} from '../themeAssignments';+import { convertThemev2v3 } from '../themeMigrations';+import {+ getDefaultSemanticColorTokens,+ legacyThemeToVNextTokens,+ normalizeThemeColorTokens,+} from '../themeVNext';++const legacyTokens: ThemeV2Tokens = {+ a0: { l: 0.7, c: 0.2, h: 40 },+ a1: { l: 0.7, c: 0.2, h: 80 },+ a2: { l: 0.7, c: 0.2, h: 120 },+ a3: { l: 0.7, c: 0.2, h: 160 },+ a4: { l: 0.7, c: 0.2, h: 200 },+ b0: { l: 0.1, c: 0, h: 0 },+ b1: { l: 0.2, c: 0, h: 0 },+ b2: { l: 0.3, c: 0, h: 0 },+ b3: { l: 0.4, c: 0, h: 0 },+ b4: { l: 0.5, c: 0, h: 0 },+ c0: { l: 0.95, c: 0, h: 0 },+ c1: { l: 0.85, c: 0, h: 0 },+ c2: { l: 0.75, c: 0, h: 0 },+ c3: { l: 0.65, c: 0, h: 0 },+ c4: { l: 0.55, c: 0, h: 0 },+};++describe('legacyThemeToVNextTokens', () => {+ it('fills semantic defaults and removes retired tokens from V3 token maps', () => {+ const result = normalizeThemeColorTokens(+ {+ 'surface-4': '#fff',+ 'surface-5': '#eee',+ 'edge-subtle': '#ddd',+ extension: '#000',+ },+ 'dark'+ );++ expect(result).toMatchObject({+ 'surface-4': '#fff',+ extension: '#000',+ tooltip: 'var(--color-surface-2)',+ toast: 'var(--color-surface-2)',+ link: 'var(--color-accent)',+ 'link-hover': 'var(--color-accent)',+ 'link-visited': 'var(--color-accent)',+ });+ expect(result['surface-5']).toBeUndefined();+ expect(result['edge-subtle']).toBeUndefined();+ });++ it('centralizes a default for every semantic token', () => {+ const defaults = getDefaultSemanticColorTokens('dark');+ expect(Object.keys(defaults)).toEqual([...semanticTokens]);+ expect(defaults).toMatchObject({+ surface: 'var(--layer-surface)',+ panel: 'var(--color-surface-1)',+ warning: 'var(--color-amber)',+ message: 'var(--color-lift)',+ });+ expect(getDefaultSemanticColorTokens('light').warning).toBe(+ 'var(--color-yellow)'+ );+ });++ it('builds the final input and semantic registry', () => {+ const result = legacyThemeToVNextTokens({ tokens: legacyTokens }, 'dark');++ expect(result['surface-0']).toBe('oklch(0.1 0 0deg)');+ expect(result['surface-4']).toBe('oklch(0.5 0 0deg)');+ expect(result['content-4']).toBe('oklch(0.55 0 0deg)');+ expect(result['content-5']).toBeUndefined();+ expect(result['edge-subtle']).toBeUndefined();+ expect(result.chrome).toBe('var(--color-surface-4)');+ expect(result.surface).toBe('var(--layer-surface)');+ expect(result.inset).toBe('var(--layer-inset)');+ expect(result.lift).toBe('var(--layer-lift)');+ expect(result.panel).toBe('var(--color-surface-1)');+ expect(result.tooltip).toBe('var(--color-surface-2)');+ expect(result.toast).toBe('var(--color-surface-2)');+ expect(result.link).toBe('var(--color-accent)');+ expect(result['link-hover']).toBe('var(--color-accent)');+ expect(result['link-visited']).toBe('var(--color-accent)');+ expect(result.hover).toBe(+ 'color-mix(in oklch, var(--color-content-0) 3%, transparent)'+ );+ expect(result.active).toBe(+ 'color-mix(in oklch, var(--color-content-0) 6%, transparent)'+ );+ expect(result.warning).toBe('var(--color-amber)');+ expect(result.red).toBe('oklch(0.7 0.2 25.331deg)');+ expect(result.yellow).toBe('oklch(0.7 0.2 86.047deg)');+ expect(result.pink).toBe('oklch(0.7 0.2 354.308deg)');+ });++ it('converts inverted legacy light surfaces into a rising ramp', () => {+ const result = legacyThemeToVNextTokens(+ {+ tokens: {+ ...legacyTokens,+ b0: { l: 0.96, c: 0.01, h: 60 },+ b1: { l: 0.92, c: 0.01, h: 60 },+ b2: { l: 0.91, c: 0.01, h: 60 },+ b3: { l: 0.9, c: 0.01, h: 60 },+ b4: { l: 0.89, c: 0.01, h: 60 },+ },+ },+ 'light'+ );++ expect(result['surface-0']).toBe('oklch(0.96 0.01 60deg)');+ expect(result['surface-1']).toBe('oklch(0.97 0.0075 60deg)');+ expect(result['surface-4']).toBe('oklch(1 0 60deg)');+ expect(result.edge).toBe('oklch(0.89 0.01 60deg)');+ });++ it('rounds every numeric OKLCH component to at most eight decimals', () => {+ const result = legacyThemeToVNextTokens(+ {+ tokens: {+ ...legacyTokens,+ a0: { l: 0.6789, c: 0.1234, h: 42.678 },+ c0: { l: 0.9345, c: 0.0123, h: 12.345 },+ },+ overrides: [+ {+ token: 'panel',+ value: { l: 0.8765, c: 0.0345, h: 123.456 },+ },+ ],+ },+ 'dark'+ );++ expect(result.accent).toBe('oklch(0.6789 0.1234 42.678deg)');+ expect(result['content-0']).toBe('oklch(0.9345 0.0123 12.345deg)');+ expect(result.red).toBe('oklch(0.6789 0.1234 25.331deg)');+ expect(result.panel).toBe('oklch(0.8765 0.0345 123.456deg)');+ });+});++describe('theme assignment serialization', () => {+ it('round trips a linked token with alpha', () => {+ const value = serializeThemeAssignment({+ kind: 'linked',+ token: 'accent',+ alpha: 0.08,+ });++ expect(parseThemeAssignment(value)).toEqual({+ kind: 'linked',+ token: 'accent',+ alpha: 0.08,+ });+ });++ it('round trips a mixed token with alpha', () => {+ const assignment = {+ kind: 'mixed' as const,+ first: 'content-0',+ second: 'surface-0',+ mix: 0.35,+ alpha: 0.6,+ };++ expect(parseThemeAssignment(serializeThemeAssignment(assignment))).toEqual(+ assignment+ );+ });++ it('round trips an sRGB ramp mix', () => {+ const assignment = {+ kind: 'mixed' as const,+ first: 'surface-0',+ second: 'surface-4',+ mix: 0.75,+ alpha: 1,+ space: 'srgb' as const,+ };++ expect(serializeThemeAssignment(assignment)).toBe(+ 'color-mix(in srgb, var(--color-surface-0) 75%, var(--color-surface-4))'+ );+ expect(parseThemeAssignment(serializeThemeAssignment(assignment))).toEqual(+ assignment+ );+ });+});++describe('ThemeV2 to ThemeV3 migration', () => {+ it('produces a token-only theme with an explicit mode', () => {+ const result = convertThemev2v3({+ id: 'legacy',+ name: 'Legacy',+ version: 2,+ depth: 0.15,+ tokens: legacyTokens,+ });++ expect(result.version).toBe(3);+ expect(result.mode).toBe('dark');+ expect(result.colorTokens['surface-0']).toBe('oklch(0.1 0 0deg)');+ expect(result).not.toHaveProperty('tokens');+ expect(result).not.toHaveProperty('depth');+ });++ it('fills a partial experimental color registry during migration', () => {+ const result = convertThemev2v3({+ id: 'partial',+ name: 'Partial',+ version: 2,+ depth: 0.15,+ tokens: legacyTokens,+ colorTokens: { accent: '#ff0000' },+ });++ expect(result.colorTokens.accent).toBe('#ff0000');+ expect(result.colorTokens['surface-0']).toBe('oklch(0.1 0 0deg)');+ expect(result.colorTokens.ink).toBe('var(--color-content-0)');+ });+});diff --git a/apps/web/src/features/theme/utils/__tests__/themeValidation.test.ts b/apps/web/src/features/theme/utils/__tests__/themeValidation.test.tsindex 31b71a347a..073500fa2a 100644--- a/apps/web/src/features/theme/utils/__tests__/themeValidation.test.ts+++ b/apps/web/src/features/theme/utils/__tests__/themeValidation.test.ts@@ -1,8 +1,12 @@-import { describe, expect, it } from 'vitest';+import { DEFAULT_THEMES } from '@theme/constants';+import { inputColorTokens, semanticTokens } from '@theme/types/themeTypes';import {isThemeV2,+ isThemeV3,parseThemeV2Json,+ parseThemeV3Json,} from '@theme/utils/themeValidation';+import { describe, expect, it } from 'vitest';const validThemeJson = JSON.stringify({id: 'test-theme-id',@@ -28,6 +32,21 @@ const validThemeJson = JSON.stringify({},});+const validV3Theme = {+ id: 'token-only-theme',+ name: 'Token only',+ version: 3,+ mode: 'light',+ colorTokens: Object.fromEntries(+ [...inputColorTokens, ...semanticTokens].map((token) => [+ token,+ token === 'hover'+ ? 'color-mix(in oklch, var(--color-content-0) 3%, transparent)'+ : `var(--test-${token})`,+ ])+ ),+};+describe('parseThemeV2Json', () => {it('returns parsed ThemeV2 for valid theme JSON', () => {const result = parseThemeV2Json(validThemeJson);@@ -133,4 +152,80 @@ describe('isThemeV2', () => {delete data.depth;expect(isThemeV2(data)).toBe(false);});++ it('accepts flat VNext color tokens', () => {+ const data = JSON.parse(validThemeJson);+ data.colorTokens = {+ 'surface-0': '#000000',+ chrome: 'var(--color-surface-4)',+ };+ expect(isThemeV2(data)).toBe(true);+ });++ it('rejects non-string VNext color token values', () => {+ const data = JSON.parse(validThemeJson);+ data.colorTokens = { accent: 42 };+ expect(isThemeV2(data)).toBe(false);+ });++ it('rejects a V3 version number even when legacy fields are present', () => {+ const data = JSON.parse(validThemeJson);+ data.version = 3;+ expect(isThemeV2(data)).toBe(false);+ });+});++describe('token-only ThemeV3 validation', () => {+ it('accepts a V3 theme containing only required raw input tokens', () => {+ const inputOnlyTheme = structuredClone(validV3Theme);+ for (const token of semanticTokens) {+ delete inputOnlyTheme.colorTokens[token];+ }++ expect(isThemeV3(inputOnlyTheme)).toBe(true);+ expect(parseThemeV3Json(JSON.stringify(inputOnlyTheme))).toEqual(+ inputOnlyTheme+ );+ });++ it('accepts a complete V3 theme without legacy tokens or depth', () => {+ expect(isThemeV3(validV3Theme)).toBe(true);+ expect(parseThemeV3Json(JSON.stringify(validV3Theme))).toEqual(+ validV3Theme+ );+ });++ it('requires an explicit light or dark mode', () => {+ expect(isThemeV3({ ...validV3Theme, mode: 'system' })).toBe(false);+ });++ it('rejects a missing required raw input token', () => {+ const colorTokens = { ...validV3Theme.colorTokens };+ delete colorTokens['surface-4'];+ expect(isThemeV3({ ...validV3Theme, colorTokens })).toBe(false);+ });++ it('rejects empty and non-string token values', () => {+ expect(+ isThemeV3({+ ...validV3Theme,+ colorTokens: { ...validV3Theme.colorTokens, accent: '' },+ })+ ).toBe(false);+ expect(+ isThemeV3({+ ...validV3Theme,+ colorTokens: { ...validV3Theme.colorTokens, accent: 42 },+ })+ ).toBe(false);+ });++ it('exports every built-in theme in token-only V3 form', () => {+ for (const theme of DEFAULT_THEMES) {+ expect(isThemeV3(theme)).toBe(true);+ expect(theme.version).toBe(3);+ expect(theme).not.toHaveProperty('tokens');+ expect(theme).not.toHaveProperty('depth');+ }+ });});diff --git a/apps/web/src/features/theme/utils/colorUtil.ts b/apps/web/src/features/theme/utils/colorUtil.tsindex 559a89a14f..e5799a9213 100644--- a/apps/web/src/features/theme/utils/colorUtil.ts+++ b/apps/web/src/features/theme/utils/colorUtil.ts@@ -1,40 +1,100 @@import Color from 'colorjs.io';-export function validateColor(color: string): boolean{+export type OklchColor = {+ l: number;+ c: number;+ h: number;+ alpha: number;+};++const DEFAULT_OKLCH: OklchColor = { l: 0, c: 0, h: 0, alpha: 1 };++const finiteNumber = (value: unknown, fallback: number): number => {+ const number = Number(value);+ return Number.isFinite(number) ? number : fallback;+};++/** Converts potentially incomplete runtime color channels into finite values. */+export function sanitizeOklch(+ color: Partial<Record<keyof OklchColor, unknown>>,+ fallback: OklchColor = DEFAULT_OKLCH+): OklchColor {+ return {+ l: Math.max(0, Math.min(1, finiteNumber(color.l, fallback.l))),+ c: Math.max(0, finiteNumber(color.c, fallback.c)),+ h: Math.max(0, Math.min(360, finiteNumber(color.h, fallback.h))),+ alpha: Math.max(0, Math.min(1, finiteNumber(color.alpha, fallback.alpha))),+ };+}++/** Produces an OKLCH CSS color without ever serializing undefined or NaN. */+export function formatOklch(color: Partial<OklchColor>): string {+ const safe = sanitizeOklch(color);+ return `oklch(${safe.l} ${safe.c} ${safe.h}deg / ${safe.alpha})`;+}++export function validateColor(color: string): boolean {return CSS.supports('color', color);}-export function getOklch(cssColor: string){+export function getOklch(cssColor: string): OklchColor {const color = new Color(cssColor);const convert = color.to('oklch');- let l = convert.coords[0] ? convert.coords[0] : 0;- let c = convert.coords[1] ? convert.coords[1] : 0;- let h = convert.coords[2] ? convert.coords[2] : 0;-- let returnColor = { l: l, c: c, h: h };- return returnColor;+ return sanitizeOklch({+ l: convert.coords[0],+ c: convert.coords[1],+ h: convert.coords[2],+ alpha: convert.alpha,+ });}-export function convertOklchTo(l: number, c: number, h: number, type: string){- // console.log(`oklch values: L=${l}, C=${c}, H=${h} | type: ${type}`);- try{- const lightness = Math.max(0, Math.min(1, l));- const chroma = Math.max(0, c < 1e-10 ? 0 : c);- const hue = h;+/** Parses a CSS color without allowing invalid or unresolved editor state to+ * escape into rendering. CSS variables and mixes should be resolved by the+ * caller first; malformed values simply retain the supplied finite fallback. */+export function tryGetOklch(+ cssColor: unknown,+ fallback: OklchColor = DEFAULT_OKLCH+): OklchColor {+ const safeFallback = sanitizeOklch(fallback);+ if (typeof cssColor !== 'string' || cssColor.trim().length === 0) {+ return safeFallback;+ }++ try {+ return getOklch(cssColor);+ } catch {+ return safeFallback;+ }+}- const color = new Color('oklch', [lightness, chroma, hue]);+export function convertOklchTo(+ l: number,+ c: number,+ h: number,+ type: string,+ alpha = 1+): string {+ try {+ const safe = sanitizeOklch({ l, c, h, alpha });+ if (safe.c < 1e-10) safe.c = 0;+ const color = new Color('oklch', [safe.l, safe.c, safe.h], safe.alpha);switch (type) {- case 'hex' : return color.to('srgb' ).toString({ precision: 4, format: 'hex'});- case 'rgb' : return color.to('srgb' ).toString({ precision: 4, format: 'rgb'});- case 'oklab': return color.to('oklab').toString({ precision: 4 });- case 'hsl' : return color.to('hsl' ).toString({ precision: 4 });- case 'oklch': return color.toString({ precision: 4 });- default: return color.to('srgb').toString({ format: 'hex' });+ case 'hex':+ return color.to('srgb').toString({ precision: 4, format: 'hex' });+ case 'rgb':+ return color.to('srgb').toString({ precision: 4, format: 'rgb' });+ case 'oklab':+ return color.to('oklab').toString({ precision: 4 });+ case 'hsl':+ return color.to('hsl').toString({ precision: 4 });+ case 'oklch':+ return color.toString({ precision: 4 });+ default:+ return color.to('srgb').toString({ format: 'hex' });}- }- catch(error){+ } catch (error) {console.error(error);return '#000000';}diff --git a/apps/web/src/features/theme/utils/themeAssignments.ts b/apps/web/src/features/theme/utils/themeAssignments.tsnew file mode 100644index 0000000000..d7a17e2f56--- /dev/null+++ b/apps/web/src/features/theme/utils/themeAssignments.ts@@ -0,0 +1,65 @@+import { alphaToken, mixTokens, tokenReference } from './themeVNext';++export type ThemeAssignment =+ | { kind: 'custom'; value: string }+ | { kind: 'linked'; token: string; alpha: number }+ | {+ kind: 'mixed';+ first: string;+ second: string;+ mix: number;+ alpha: number;+ space?: 'oklch' | 'srgb';+ };++const ALPHA_WRAPPER = /^color-mix\(in oklch, (.+) ([\d.]+)%, transparent\)$/;+const LINK = /^var\(--color-([a-z0-9-]+)\)$/;+const MIX =+ /^color-mix\(in (oklch|srgb), var\(--color-([a-z0-9-]+)\) ([\d.]+)%, var\(--color-([a-z0-9-]+)\)\)$/;++export function parseThemeAssignment(value: string): ThemeAssignment {+ let expression = value.trim();+ let alpha = 1;+ const alphaMatch = expression.match(ALPHA_WRAPPER);+ if (alphaMatch) {+ expression = alphaMatch[1] ?? expression;+ alpha = Number(alphaMatch[2]) / 100;+ }++ const link = expression.match(LINK);+ if (link?.[1]) return { kind: 'linked', token: link[1], alpha };++ const mix = expression.match(MIX);+ if (mix?.[1] && mix[2] && mix[3] && mix[4]) {+ return {+ kind: 'mixed',+ first: mix[2],+ second: mix[4],+ mix: Number(mix[3]) / 100,+ alpha,+ ...(mix[1] === 'srgb' && { space: 'srgb' as const }),+ };+ }++ return { kind: 'custom', value };+}++export function serializeThemeAssignment(assignment: ThemeAssignment): string {+ if (assignment.kind === 'custom') return assignment.value;++ const base =+ assignment.kind === 'linked'+ ? tokenReference(assignment.token)+ : mixTokens(+ assignment.first,+ assignment.second,+ assignment.mix,+ assignment.space+ );++ if (assignment.alpha >= 0.999) return base;+ if (assignment.kind === 'linked') {+ return alphaToken(assignment.token, assignment.alpha);+ }+ return `color-mix(in oklch, ${base} ${Math.round(assignment.alpha * 10000) / 100}%, transparent)`;+}diff --git a/apps/web/src/features/theme/utils/themeMigrations.ts b/apps/web/src/features/theme/utils/themeMigrations.tsindex aece9dca71..d29228170a 100644--- a/apps/web/src/features/theme/utils/themeMigrations.ts+++ b/apps/web/src/features/theme/utils/themeMigrations.ts@@ -1,4 +1,5 @@-import type { ThemeV0, ThemeV1, ThemeV2 } from '../types/themeTypes';+import type { ThemeV0, ThemeV1, ThemeV2, ThemeV3 } from '../types/themeTypes';+import { getThemeColorMode, getThemeColorTokens } from './themeVNext';export function convertThemev0v1(theme: ThemeV0): ThemeV1 {return {@@ -6,21 +7,81 @@ export function convertThemev0v1(theme: ThemeV0): ThemeV1 {name: theme.name,version: 1,tokens: {- a0: { l: theme.specification['--accent-l' ], c: theme.specification['--accent-c' ], h: (theme.specification['--accent-h' ] + 30) % 360},- a1: { l: theme.specification['--accent-l' ], c: theme.specification['--accent-c' ], h: (theme.specification['--accent-h' ] + 30) % 360},- a2: { l: theme.specification['--accent-l' ], c: theme.specification['--accent-c' ], h: (theme.specification['--accent-h' ] + 30) % 360},- a3: { l: theme.specification['--accent-l' ], c: theme.specification['--accent-c' ], h: (theme.specification['--accent-h' ] + 30) % 360},- a4: { l: theme.specification['--accent-l' ], c: theme.specification['--accent-c' ], h: (theme.specification['--accent-h' ] + 30) % 360},- b0: { l: theme.specification['--surface-l' ], c: theme.specification['--surface-c' ], h: theme.specification['--surface-h' ] },- b1: { l: theme.specification['--surface-l-1' ], c: theme.specification['--surface-c' ], h: theme.specification['--surface-h' ] },- b2: { l: theme.specification['--surface-l-2' ], c: theme.specification['--surface-c' ], h: theme.specification['--surface-h' ] },- b3: { l: theme.specification['--surface-l-3' ], c: theme.specification['--surface-c' ], h: theme.specification['--surface-h' ] },- b4: { l: theme.specification['--surface-l-4' ], c: theme.specification['--surface-c' ], h: theme.specification['--surface-h' ] },- c0: { l: theme.specification['--contrast-l' ], c: theme.specification['--contrast-c'], h: theme.specification['--contrast-h'] },- c1: { l: theme.specification['--contrast-l-1'], c: theme.specification['--contrast-c'], h: theme.specification['--contrast-h'] },- c2: { l: theme.specification['--contrast-l-2'], c: theme.specification['--contrast-c'], h: theme.specification['--contrast-h'] },- c3: { l: theme.specification['--contrast-l-3'], c: theme.specification['--contrast-c'], h: theme.specification['--contrast-h'] },- c4: { l: theme.specification['--contrast-l-4'], c: theme.specification['--contrast-c'], h: theme.specification['--contrast-h'] },+ a0: {+ l: theme.specification['--accent-l'],+ c: theme.specification['--accent-c'],+ h: (theme.specification['--accent-h'] + 30) % 360,+ },+ a1: {+ l: theme.specification['--accent-l'],+ c: theme.specification['--accent-c'],+ h: (theme.specification['--accent-h'] + 30) % 360,+ },+ a2: {+ l: theme.specification['--accent-l'],+ c: theme.specification['--accent-c'],+ h: (theme.specification['--accent-h'] + 30) % 360,+ },+ a3: {+ l: theme.specification['--accent-l'],+ c: theme.specification['--accent-c'],+ h: (theme.specification['--accent-h'] + 30) % 360,+ },+ a4: {+ l: theme.specification['--accent-l'],+ c: theme.specification['--accent-c'],+ h: (theme.specification['--accent-h'] + 30) % 360,+ },+ b0: {+ l: theme.specification['--surface-l'],+ c: theme.specification['--surface-c'],+ h: theme.specification['--surface-h'],+ },+ b1: {+ l: theme.specification['--surface-l-1'],+ c: theme.specification['--surface-c'],+ h: theme.specification['--surface-h'],+ },+ b2: {+ l: theme.specification['--surface-l-2'],+ c: theme.specification['--surface-c'],+ h: theme.specification['--surface-h'],+ },+ b3: {+ l: theme.specification['--surface-l-3'],+ c: theme.specification['--surface-c'],+ h: theme.specification['--surface-h'],+ },+ b4: {+ l: theme.specification['--surface-l-4'],+ c: theme.specification['--surface-c'],+ h: theme.specification['--surface-h'],+ },+ c0: {+ l: theme.specification['--contrast-l'],+ c: theme.specification['--contrast-c'],+ h: theme.specification['--contrast-h'],+ },+ c1: {+ l: theme.specification['--contrast-l-1'],+ c: theme.specification['--contrast-c'],+ h: theme.specification['--contrast-h'],+ },+ c2: {+ l: theme.specification['--contrast-l-2'],+ c: theme.specification['--contrast-c'],+ h: theme.specification['--contrast-h'],+ },+ c3: {+ l: theme.specification['--contrast-l-3'],+ c: theme.specification['--contrast-c'],+ h: theme.specification['--contrast-h'],+ },+ c4: {+ l: theme.specification['--contrast-l-4'],+ c: theme.specification['--contrast-c'],+ h: theme.specification['--contrast-h'],+ },},};}@@ -49,8 +110,28 @@ export function convertThemev1v2(theme: ThemeV1): ThemeV2 {depth: 0.15,tokens: {...theme.tokens,- b0, b1, b2, b3, b4,- c0, c1, c2, c3, c4,+ b0,+ b1,+ b2,+ b3,+ b4,+ c0,+ c1,+ c2,+ c3,+ c4,},};}++/** Removes the legacy ramps after converting them into the authored VNext+ * registry. The explicit mode replaces light/dark inference from b0/c0. */+export function convertThemev2v3(theme: ThemeV2): ThemeV3 {+ return {+ id: theme.id,+ name: theme.name,+ version: 3,+ mode: getThemeColorMode(theme.tokens),+ colorTokens: getThemeColorTokens(theme),+ };+}diff --git a/apps/web/src/features/theme/utils/themeUtils.ts b/apps/web/src/features/theme/utils/themeUtils.tsindex acf1d81eaf..4fdba25314 100644--- a/apps/web/src/features/theme/utils/themeUtils.ts+++ b/apps/web/src/features/theme/utils/themeUtils.ts@@ -1,91 +1,212 @@-import { currentThemeId, darkModeTheme, lightModeTheme, setCurrentThemeId, setDarkModeTheme, setHtmlColor, setIsThemeSaved, setLightModeTheme, setThemeDepth, setThemeMode, setUserThemes, systemMode, themeDepth, themeMode, themes, userThemes} from '../signals/themeSignals';-import { semanticTokens, type ThemeV2, type ThemeV2Tokens } from '../types/themeTypes';-import { themeReactive } from '../signals/themeReactive';import { toast } from '@core/component/Toast/Toast';import { batch, createEffect, on } from 'solid-js';import { DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME } from '../constants';+import { themeReactive } from '../signals/themeReactive';+import {+ currentThemeId,+ darkModeTheme,+ lightModeTheme,+ liveThemeMode,+ setCurrentThemeId,+ setDarkModeTheme,+ setHtmlColor,+ setIsThemeSaved,+ setLightModeTheme,+ setLiveThemeMode,+ setThemeColorTokens,+ setThemeMode,+ setUserThemes,+ systemMode,+ themeColorTokens,+ themeMode,+ themes,+ userThemes,+} from '../signals/themeSignals';+import type {+ ThemeColorTokens,+ ThemeV2Tokens,+ ThemeV3,+} from '../types/themeTypes';+import { getOklch } from './colorUtil';+import { convertThemev2v3 } from './themeMigrations';+import { isThemeV2, isThemeV3 } from './themeValidation';+import { normalizeThemeColorTokens } from './themeVNext';-export function exportTheme(themeId?: string){+export function exportTheme(themeId?: string) {const id = themeId ?? currentThemeId();const theme = JSON.stringify(themes().find((t) => t.id === id));navigator.clipboard.writeText(theme);}-async function _importTheme(): Promise<void>{+async function _importTheme(): Promise<void> {try {const text = await navigator.clipboard.readText();const parsed: unknown = JSON.parse(text);- if(!isThemeV2(parsed)){+ const imported = isThemeV3(parsed)+ ? parsed+ : isThemeV2(parsed)+ ? convertThemev2v3(parsed)+ : null;+ if (!imported) {toast.alert('Clipboard does not contain a valid theme.');return;}const id = crypto.randomUUID();- const newTheme: ThemeV2 = {+ const newTheme: ThemeV3 = {id,- name: parsed.name,- version: parsed.version,- depth: parsed.depth,- tokens: parsed.tokens,+ name: imported.name,+ version: 3,+ mode: imported.mode,+ colorTokens: normalizeThemeColorTokens(+ imported.colorTokens,+ imported.mode+ ),};setUserThemes([...userThemes(), newTheme]);applyTheme(id);- } catch(e) {+ } catch (e) {console.error('Failed to import theme:', e);toast.alert('Failed to import theme from clipboard.');}}-function isThemeV2(value: unknown): value is ThemeV2 {- if(typeof value !== 'object' || value === null){return false}- const v = value as Record<string, unknown>;- if(typeof v.name !== 'string' || typeof v.version !== 'number' || typeof v.depth !== 'number' || typeof v.tokens !== 'object' || v.tokens === null){return false}- const tokenKeys: Array<keyof ThemeV2Tokens> = ['a0','a1','a2','a3','a4','b0','b1','b2','b3','b4','c0','c1','c2','c3','c4'];- const tokens = v.tokens as Record<string, unknown>;- return tokenKeys.every((key) => {- const t = tokens[key];- if(typeof t !== 'object' || t === null){return false}- const tok = t as Record<string, unknown>;- return typeof tok.l === 'number' && typeof tok.c === 'number' && typeof tok.h === 'number';+let renderedColorTokenKeys = new Set<string>();++/** Old non-CSS integrations still consume a/b/c numeric signals. V3 does not+ * store those values; this bridge derives them from the rendered token graph. */+const LEGACY_TOKEN_MAP = {+ a0: 'accent',+ a1: 'orange',+ a2: 'lime',+ a3: 'teal',+ a4: 'blue',+ b0: 'surface-0',+ b1: 'surface-1',+ b2: 'surface-2',+ b3: 'edge-muted',+ b4: 'edge',+ c0: 'content-0',+ c1: 'content-1',+ c2: 'content-2',+ c3: 'content-3',+ c4: 'content-4',+} as const satisfies Record<keyof ThemeV2Tokens, string>;++function resolvedTokenOklch(+ token: string+): { l: number; c: number; h: number } | null {+ const authored = themeColorTokens()[token];+ if (authored) {+ try {+ return getOklch(authored);+ } catch {+ // var() and color-mix() values need the browser to resolve the graph.+ }+ }+ if (typeof document === 'undefined') return null;++ const probe = document.createElement('span');+ probe.style.cssText = 'position:fixed;visibility:hidden;pointer-events:none';+ probe.style.color = `var(--color-${token})`;+ document.documentElement.append(probe);+ const resolved = getComputedStyle(probe).color;+ probe.remove();++ try {+ return getOklch(resolved);+ } catch {+ return null;+ }+}++function syncLegacyCompatibilityTokens(): void {+ batch(() => {+ for (const [legacyToken, colorToken] of Object.entries(LEGACY_TOKEN_MAP)) {+ const color = resolvedTokenOklch(colorToken);+ if (!color) continue;+ const target = themeReactive[legacyToken as keyof ThemeV2Tokens];+ target.l[1](color.l);+ target.c[1](color.c);+ target.h[1](color.h);+ }});}-/** Writes a theme's semantic-token overrides to the document root, clearing- * tokens the theme doesn't override. */-function setThemeOverrides(theme: ThemeV2): void{- for (const token of semanticTokens) {- const themeOverride = theme.overrides?.find((o) => o.token === token)- if (themeOverride) {- document.documentElement.style.setProperty(`--theme-${token}`, `oklch(${themeOverride.value.l} ${themeOverride.value.c} ${themeOverride.value.h})`)+const LAYER_RELATIVE_TOKENS = {+ surface: 'var(--layer-surface)',+ inset: 'var(--layer-inset)',+ lift: 'var(--layer-lift)',+} as const;++function renderThemeColorToken(token: string, value: string): void {+ if (token === 'panel') {+ // Keep the authored structural value separate from the public semantic var+ // so containers can scope --color-panel without losing the theme source.+ document.documentElement.style.removeProperty('--color-panel');+ document.documentElement.style.setProperty('--theme-panel', value);+ return;+ }++ const layerDefault =+ LAYER_RELATIVE_TOKENS[token as keyof typeof LAYER_RELATIVE_TOKENS];++ if (layerDefault) {+ // CSS owns the public --color-* mapping for layer-relative semantics.+ // Only author an optional theme override when the assignment is custom.+ document.documentElement.style.removeProperty(`--color-${token}`);+ if (value === layerDefault) {+ document.documentElement.style.removeProperty(`--theme-${token}`);} else {- document.documentElement.style.removeProperty(`--theme-${token}`)+ document.documentElement.style.setProperty(`--theme-${token}`, value);}+ return;}++ document.documentElement.style.setProperty(`--color-${token}`, value);}-/** Writes a token set + depth to the live theme signals (the CSS variables). */-function setLiveTokens(tokens: ThemeV2Tokens, depth: number): void{- batch(() => {- (Object.keys(tokens) as Array<keyof ThemeV2Tokens>).forEach((tokenKey) => {- (Object.keys(tokens[tokenKey]) as Array<'l' | 'c' | 'h'>).forEach((prop) => {- themeReactive[tokenKey][prop][1](tokens[tokenKey][prop]);- });- }- );- setThemeDepth(depth);- });+/** Applies a color token for an editor drag without updating persisted state. */+export function previewLiveThemeColorToken(token: string, value: string): void {+ renderThemeColorToken(token, value);+}++/** Writes all VNext authored tokens to the root and updates editor state. */+export function setLiveThemeColorTokens(tokens: ThemeColorTokens): void {+ const normalizedTokens = normalizeThemeColorTokens(tokens, liveThemeMode());+ for (const key of renderedColorTokenKeys) {+ if (!(key in normalizedTokens)) {+ document.documentElement.style.removeProperty(`--color-${key}`);+ document.documentElement.style.removeProperty(`--theme-${key}`);+ }+ }+ for (const [key, value] of Object.entries(normalizedTokens)) {+ renderThemeColorToken(key, value);+ }+ renderedColorTokenKeys = new Set(Object.keys(normalizedTokens));+ setThemeColorTokens(normalizedTokens);+ syncLegacyCompatibilityTokens();+}++/** Updates one authored token immediately; persistence still happens on save. */+export function updateLiveThemeColorToken(token: string, value: string): void {+ const next = { ...themeColorTokens(), [token]: value };+ renderThemeColorToken(token, value);+ renderedColorTokenKeys.add(token);+ setThemeColorTokens(next);+ syncLegacyCompatibilityTokens();+ setIsThemeSaved(false);}/** The live tokens/overrides as they were when a preview started; restored* when the preview ends. Null while no preview is active. */let previewSnapshot: {- tokens: ThemeV2Tokens;- depth: number;- overrides: Record<string, string>;+ colorTokens: ThemeColorTokens;+ mode: 'light' | 'dark';} | null = null;-export function applyTheme(id: string): void{+export function applyTheme(id: string): void {let theme = themes().find((t) => t.id === id);- if(!theme){+ if (!theme) {console.error(`theme not found: ${id}`);theme = themes().find((t) => t.id === DEFAULT_DARK_THEME)!;}@@ -94,9 +215,10 @@ export function applyTheme(id: string): void{// clearThemePreview doesn't revert the commit.previewSnapshot = null;- setThemeOverrides(theme);- setLiveTokens(theme.tokens, theme.depth ?? 0.15);- queueMicrotask(() => {/* scuffed af */+ setLiveThemeMode(theme.mode);+ setLiveThemeColorTokens(theme.colorTokens);+ queueMicrotask(() => {+ /* scuffed af */setIsThemeSaved(true);syncHtmlColor();});@@ -107,35 +229,31 @@ export function applyTheme(id: string): void{* change — currentThemeId, saved-state, and the persisted first-paint color* are untouched. Revert with clearThemePreview; committing via applyTheme* makes the preview permanent. */-export function previewTheme(id: string): void{+export function previewTheme(id: string): void {const theme = themes().find((t) => t.id === id);- if(!theme){return}- if(!previewSnapshot){- const overrides: Record<string, string> = {};- for(const token of semanticTokens){- overrides[token] = document.documentElement.style.getPropertyValue(`--theme-${token}`);- }+ if (!theme) {+ return;+ }+ if (!previewSnapshot) {// Snapshot the live tokens (not the selected theme id) so ending the// preview restores unsaved in-editor edits too.- previewSnapshot = { tokens: getCurrentTokens(), depth: themeDepth(), overrides };+ previewSnapshot = {+ colorTokens: { ...themeColorTokens() },+ mode: liveThemeMode(),+ };}- setThemeOverrides(theme);- setLiveTokens(theme.tokens, theme.depth ?? 0.15);+ setLiveThemeMode(theme.mode);+ setLiveThemeColorTokens(theme.colorTokens);}/** Ends an active theme preview, restoring the pre-preview tokens. No-op when* nothing is being previewed. */-export function clearThemePreview(): void{- if(!previewSnapshot){return}- for(const token of semanticTokens){- const value = previewSnapshot.overrides[token];- if(value){- document.documentElement.style.setProperty(`--theme-${token}`, value);- } else {- document.documentElement.style.removeProperty(`--theme-${token}`);- }+export function clearThemePreview(): void {+ if (!previewSnapshot) {+ return;}- setLiveTokens(previewSnapshot.tokens, previewSnapshot.depth);+ setLiveThemeMode(previewSnapshot.mode);+ setLiveThemeColorTokens(previewSnapshot.colorTokens);previewSnapshot = null;}@@ -143,7 +261,7 @@ export function clearThemePreview(): void{* mode: the pinned light/dark theme, or — in system mode — whichever matches* the OS color scheme. Read inside a reactive scope, it subscribes to the mode,* the OS scheme (system mode only), and the relevant per-mode theme. */-export function resolveActiveThemeId(): string{+export function resolveActiveThemeId(): string {const resolved = themeMode() === 'system' ? systemMode() : themeMode();return resolved === 'dark' ? darkModeTheme() : lightModeTheme();}@@ -154,108 +272,44 @@ export function resolveActiveThemeId(): string{* changes — but not when the inactive mode's theme changes (that id isn't read* by resolveActiveThemeId, so it isn't tracked). Call once from a reactive root* (see Root.tsx). */-export function systemThemeEffect(): void{+export function systemThemeEffect(): void {createEffect(- on(- resolveActiveThemeId,- (id) => applyTheme(id),- { defer: true }- )+ on(resolveActiveThemeId, (id) => applyTheme(id), { defer: true }));}/** Persists the live background color, used for the pre-hydration first paint. */-function syncHtmlColor(): void{- setHtmlColor({color: `oklch(${themeReactive.b0.l[0]()} ${themeReactive.b0.c[0]()} ${themeReactive.b0.h[0]()}deg)`});-}--/** Flips the lightness of every background (b*) and text (c*) token, leaving- * chroma and hue untouched. The shared primitive behind light/dark mode. */-function invertLightness(): void{- batch(() => {- themeReactive.b0.l[1](1 - themeReactive.b0.l[0]());- themeReactive.b1.l[1](1 - themeReactive.b1.l[0]());- themeReactive.b2.l[1](1 - themeReactive.b2.l[0]());- themeReactive.b3.l[1](1 - themeReactive.b3.l[0]());- themeReactive.b4.l[1](1 - themeReactive.b4.l[0]());- themeReactive.c0.l[1](1 - themeReactive.c0.l[0]());- themeReactive.c1.l[1](1 - themeReactive.c1.l[0]());- themeReactive.c2.l[1](1 - themeReactive.c2.l[0]());- themeReactive.c3.l[1](1 - themeReactive.c3.l[0]());- themeReactive.c4.l[1](1 - themeReactive.c4.l[0]());- });-}--/** Flips the theme between light and dark by inverting the background/text lightness- * — the same axis as the contrast slider's sign. Treated as an edit: marks the theme- * unsaved, unless the flip lands back on the stored theme (then it's saved again). */-export function flipLightDark(): void{- invertLightness();- queueMicrotask(() => {- setIsThemeSaved(liveMatchesStoredTheme());- syncHtmlColor();- });-}--/** True when the live theme equals the currently-selected stored theme, within a- * float tolerance (1 − (1 − l) from a double flip isn't bit-exact). */-function liveMatchesStoredTheme(): boolean{- const stored = themes().find((t) => t.id === currentThemeId());- if(!stored){return false}- const live = getCurrentTokens();- const close = (a: number, b: number) => Math.abs(a - b) < 1e-6;- const tokensMatch = (Object.keys(stored.tokens) as Array<keyof ThemeV2Tokens>).every((k) =>- close(live[k].l, stored.tokens[k].l) &&- close(live[k].c, stored.tokens[k].c) &&- close(live[k].h, stored.tokens[k].h)- );- return tokensMatch && close(themeDepth(), stored.depth ?? 0.15);+function syncHtmlColor(): void {+ const color = resolvedTokenOklch('surface-0');+ if (!color) return;+ setHtmlColor({ color: `oklch(${color.l} ${color.c} ${color.h}deg)` });}-function getCurrentTokens(): ThemeV2Tokens{- const themeTokens: ThemeV2Tokens = {- a0: { l: themeReactive.a0.l[0](), c: themeReactive.a0.c[0](), h: themeReactive.a0.h[0]()},- a1: { l: themeReactive.a1.l[0](), c: themeReactive.a1.c[0](), h: themeReactive.a1.h[0]()},- a2: { l: themeReactive.a2.l[0](), c: themeReactive.a2.c[0](), h: themeReactive.a2.h[0]()},- a3: { l: themeReactive.a3.l[0](), c: themeReactive.a3.c[0](), h: themeReactive.a3.h[0]()},- a4: { l: themeReactive.a4.l[0](), c: themeReactive.a4.c[0](), h: themeReactive.a4.h[0]()},- b0: { l: themeReactive.b0.l[0](), c: themeReactive.b0.c[0](), h: themeReactive.b0.h[0]()},- b1: { l: themeReactive.b1.l[0](), c: themeReactive.b1.c[0](), h: themeReactive.b1.h[0]()},- b2: { l: themeReactive.b2.l[0](), c: themeReactive.b2.c[0](), h: themeReactive.b2.h[0]()},- b3: { l: themeReactive.b3.l[0](), c: themeReactive.b3.c[0](), h: themeReactive.b3.h[0]()},- b4: { l: themeReactive.b4.l[0](), c: themeReactive.b4.c[0](), h: themeReactive.b4.h[0]()},- c0: { l: themeReactive.c0.l[0](), c: themeReactive.c0.c[0](), h: themeReactive.c0.h[0]()},- c1: { l: themeReactive.c1.l[0](), c: themeReactive.c1.c[0](), h: themeReactive.c1.h[0]()},- c2: { l: themeReactive.c2.l[0](), c: themeReactive.c2.c[0](), h: themeReactive.c2.h[0]()},- c3: { l: themeReactive.c3.l[0](), c: themeReactive.c3.c[0](), h: themeReactive.c3.h[0]()},- c4: { l: themeReactive.c4.l[0](), c: themeReactive.c4.c[0](), h: themeReactive.c4.h[0]()},- };- return themeTokens;-}--export function saveTheme(name: string): void{+export function saveTheme(name: string): void {const id = crypto.randomUUID();- const tokens = getCurrentTokens();- const newTheme: ThemeV2 = {+ const newTheme: ThemeV3 = {id: id,name: name,- version: 2,- depth: themeDepth(),- tokens: tokens,+ version: 3,+ mode: liveThemeMode(),+ colorTokens: { ...themeColorTokens() },};setUserThemes([...userThemes(), newTheme]);setCurrentThemeId(id);setIsThemeSaved(true);}-/** Save the live theme back onto an existing custom theme (same id), updating- * its name, depth, and tokens in place. */-export function updateTheme(id: string, name: string): void{- const tokens = getCurrentTokens();+/** Save the live V3 registry back onto an existing custom theme. */+export function updateTheme(id: string, name: string): void {setUserThemes(userThemes().map((theme) =>theme.id === id- ? { ...theme, name, depth: themeDepth(), tokens }+ ? {+ ...theme,+ name,+ mode: liveThemeMode(),+ colorTokens: { ...themeColorTokens() },+ }: theme));@@ -263,13 +317,17 @@ export function updateTheme(id: string, name: string): void{setIsThemeSaved(true);}-export function deleteTheme(id: string): void{+export function deleteTheme(id: string): void {setUserThemes(userThemes().filter((theme) => theme.id !== id));// A deleted theme can no longer serve as a per-mode default; fall back to the// built-in Macro light/dark themes.- if(lightModeTheme() === id){setLightModeTheme(DEFAULT_LIGHT_THEME)}- if(darkModeTheme() === id){setDarkModeTheme(DEFAULT_DARK_THEME)}- if(currentThemeId() === id){+ if (lightModeTheme() === id) {+ setLightModeTheme(DEFAULT_LIGHT_THEME);+ }+ if (darkModeTheme() === id) {+ setDarkModeTheme(DEFAULT_DARK_THEME);+ }+ if (currentThemeId() === id) {// Keep the live tokens in place so the picker still shows this theme's// swatch, but mark it unsaved/unselected — it now reads as "Unsaved Theme"// until the user saves it again.@@ -278,32 +336,27 @@ export function deleteTheme(id: string): void{}}-/** A synthetic ThemeV2 snapshot of the live (in-editor) tokens. Lets the picker+/** A synthetic ThemeV3 snapshot of the live (in-editor) tokens. Lets the picker* render a swatch for the active theme even when it isn't a stored theme — e.g.* after the selected theme was deleted, leaving an unsaved live theme. Reading* it inside a reactive scope subscribes to the live token signals. */-export function getLiveTheme(): ThemeV2{+export function getLiveTheme(): ThemeV3 {return {id: '',name: 'Unsaved Theme',- version: 2,- depth: themeDepth(),- tokens: getCurrentTokens(),+ version: 3,+ mode: liveThemeMode(),+ colorTokens: { ...themeColorTokens() },};}-/** Intrinsic darkness of a stored theme: dark when text is lighter than background. */-export function isTokensDark(tokens: ThemeV2Tokens): boolean {- return tokens.c0.l > tokens.b0.l;-}-/** Pins a theme as the "Active theme": makes it the stored theme for its* intrinsic light/dark mode and switches the mode to match, so* resolveActiveThemeId / systemThemeEffect apply it live. Shared by the settings* Active-theme picker and the command-palette "Change theme" action so choosing* a theme in either place is reflected in the other. */-export function pinTheme(theme: ThemeV2): void {- if (isTokensDark(theme.tokens)) {+export function pinTheme(theme: ThemeV3): void {+ if (theme.mode === 'dark') {setDarkModeTheme(theme.id);setThemeMode('dark');} else {@@ -322,11 +375,16 @@ export function applySystemTheme(): void {/** Checks if the theme contrast is too low, and if so, applies a readable theme. This is to prevent malicious actors sending "Theme Viruses" which make a user's theme unusable. */export function ensureMinimalThemeContrast() {- const spec = themes().find((t) => t.id === currentThemeId())?.tokens;- if(!spec){return}// Check if the contrast is too low, so that users can't get stuck with an unreadable theme- const lowContrastTheme = Math.abs(spec.c0.l - spec.b0.l) < 0.2;- if(lowContrastTheme){+ const surface = resolvedTokenOklch('surface-0');+ const content = resolvedTokenOklch('content-0');+ if (!surface || !content) {+ return;+ }+ const lowContrastTheme = Math.abs(content.l - surface.l) < 0.2;+ if (lowContrastTheme) {applyTheme(DEFAULT_DARK_THEME);- toast.alert('Tried to load a theme with low contrast, applying a readable theme.');+ toast.alert(+ 'Tried to load a theme with low contrast, applying a readable theme.'+ );}}diff --git a/apps/web/src/features/theme/utils/themeVNext.ts b/apps/web/src/features/theme/utils/themeVNext.tsnew file mode 100644index 0000000000..c72fc67bb6--- /dev/null+++ b/apps/web/src/features/theme/utils/themeVNext.ts@@ -0,0 +1,194 @@+import type {+ InputColorToken,+ SemanticToken,+ ThemeColorMode,+ ThemeColorTokens,+ ThemeV2,+ ThemeV2Tokens,+} from '../types/themeTypes';++/** Tailwind 500 hue angles used to project a legacy theme's accent color. */+export const PALETTE_HUES = {+ red: 25.331,+ orange: 47.604,+ amber: 70.08,+ yellow: 86.047,+ lime: 130.85,+ green: 149.579,+ teal: 182.503,+ cyan: 215.221,+ blue: 259.815,+ violet: 292.717,+ purple: 303.9,+ pink: 354.308,+} as const satisfies Record<string, number>;++const roundToEightDecimals = (value: number) => {+ const rounded =+ Math.round((value + Number.EPSILON) * 100_000_000) / 100_000_000;+ return Object.is(rounded, -0) ? 0 : rounded;+};++const oklch = (color: { l: number; c: number; h: number }) =>+ `oklch(${roundToEightDecimals(color.l)} ${roundToEightDecimals(color.c)} ${roundToEightDecimals(color.h)}deg)`;++const clamp = (value: number) => Math.max(0, Math.min(1, value));++function buildSurfaceRamp(+ tokens: ThemeV2Tokens,+ mode: ThemeColorMode+): string[] {+ const legacy = [tokens.b0, tokens.b1, tokens.b2, tokens.b3, tokens.b4];++ if (mode === 'light') {+ // Legacy light themes expected Layer to raise b0 mathematically, so their+ // authored b1-b4 values often run in the opposite direction. VNext stores+ // the actual layer colors: preserve the base and interpolate toward white.+ return Array.from({ length: 5 }, (_, index) => {+ const progress = index / 4;+ return oklch({+ l: clamp(tokens.b0.l + (1 - tokens.b0.l) * progress),+ c: tokens.b0.c * (1 - progress),+ h: tokens.b0.h,+ });+ });+ }++ // Dark legacy ramps already rise with depth. Guard against any small+ // non-monotonic authored steps.+ let previousLightness = legacy[0]?.l ?? 0;+ return legacy.map((color) => {+ previousLightness = Math.max(previousLightness, color.l);+ return oklch({ ...color, l: previousLightness });+ });+}++export const tokenReference = (token: string) => `var(--color-${token})`;++export const alphaToken = (token: string, alpha: number) =>+ `color-mix(in oklch, ${tokenReference(token)} ${Math.round(alpha * 10000) / 100}%, transparent)`;++export const mixTokens = (+ first: string,+ second: string,+ amount: number,+ space: 'oklch' | 'srgb' = 'oklch'+) =>+ `color-mix(in ${space}, ${tokenReference(first)} ${Math.round(amount * 10000) / 100}%, ${tokenReference(second)})`;++/** The complete default semantic graph. Themes only need to store raw input+ * colors; any entry they author here overrides this CSS-variable assignment. */+export function getDefaultSemanticColorTokens(+ mode: ThemeColorMode+): Record<SemanticToken, string> {+ return {+ surface: 'var(--layer-surface)',+ inset: 'var(--layer-inset)',+ lift: 'var(--layer-lift)',+ ink: tokenReference('content-0'),+ 'ink-muted': tokenReference('content-1'),+ 'ink-subtle': tokenReference('content-2'),+ 'ink-disabled': tokenReference('content-3'),+ 'ink-placeholder': tokenReference('content-4'),+ link: tokenReference('accent'),+ 'link-hover': tokenReference('accent'),+ 'link-visited': tokenReference('accent'),+ page: tokenReference('surface-0'),+ panel: tokenReference('surface-1'),+ dialog: tokenReference('surface-2'),+ menu: tokenReference('surface-2'),+ tooltip: tokenReference('surface-2'),+ toast: tokenReference('surface-2'),+ input: 'transparent',+ 'input-focus': tokenReference('lift'),+ message: tokenReference('lift'),+ hover: alphaToken('content-0', 0.03),+ active: alphaToken('content-0', 0.06),+ selected: alphaToken('accent', 0.08),+ success: tokenReference('green'),+ warning: tokenReference(mode === 'dark' ? 'amber' : 'yellow'),+ failure: tokenReference('red'),+ chrome: tokenReference('surface-4'),+ };+}++/** Fills optional semantic assignments from the central defaults and drops+ * tokens removed from the V3 registry while preserving extension keys. */+export function normalizeThemeColorTokens(+ tokens: ThemeColorTokens,+ mode: ThemeColorMode+): ThemeColorTokens {+ const next: ThemeColorTokens = {+ ...getDefaultSemanticColorTokens(mode),+ ...tokens,+ };+ delete next['surface-5'];+ delete next['edge-subtle'];+ return next;+}++/**+ * Converts a legacy b/c/a theme into the VNext flat token model. Palette+ * colors preserve a0's lightness and chroma at fixed Tailwind hue angles.+ */+export function legacyThemeToVNextTokens(+ theme: Pick<ThemeV2, 'tokens' | 'overrides'> | { tokens: ThemeV2Tokens },+ mode: ThemeColorMode+): ThemeColorTokens {+ const { tokens } = theme;+ const surfaces = buildSurfaceRamp(tokens, mode);+ const result: ThemeColorTokens = {+ 'surface-0': surfaces[0] ?? oklch(tokens.b0),+ 'surface-1': surfaces[1] ?? oklch(tokens.b1),+ 'surface-2': surfaces[2] ?? oklch(tokens.b2),+ 'surface-3': surfaces[3] ?? oklch(tokens.b3),+ 'surface-4': surfaces[4] ?? oklch(tokens.b4),+ 'content-0': oklch(tokens.c0),+ 'content-1': oklch(tokens.c1),+ 'content-2': oklch(tokens.c2),+ 'content-3': oklch(tokens.c3),+ 'content-4': oklch(tokens.c4),+ edge: oklch(tokens.b4),+ 'edge-muted': oklch(tokens.b3),+ accent: oklch(tokens.a0),+ };++ for (const [name, hue] of Object.entries(PALETTE_HUES)) {+ result[name] = oklch({ l: tokens.a0.l, c: tokens.a0.c, h: hue });+ }++ const defaults = getDefaultSemanticColorTokens(mode);++ Object.assign(result, defaults);++ // Preserve the old custom semantic overrides during conversion.+ const overrides = 'overrides' in theme ? theme.overrides : undefined;+ for (const override of overrides ?? []) {+ if (override.token in defaults)+ result[override.token] = oklch(override.value);+ }++ return result;+}++export function getThemeColorMode(tokens: ThemeV2Tokens): ThemeColorMode {+ return tokens.c0.l > tokens.b0.l ? 'dark' : 'light';+}++export function getThemeColorTokens(theme: ThemeV2): ThemeColorTokens {+ return {+ ...legacyThemeToVNextTokens(theme, getThemeColorMode(theme.tokens)),+ ...theme.colorTokens,+ };+}++export function isInputColorToken(token: string): token is InputColorToken {+ return (+ token.startsWith('surface-') ||+ token.startsWith('content-') ||+ token === 'edge' ||+ token === 'edge-muted' ||+ token === 'accent' ||+ token in PALETTE_HUES+ );+}diff --git a/apps/web/src/features/theme/utils/themeValidation.ts b/apps/web/src/features/theme/utils/themeValidation.tsindex 7b0cc2d8cf..46986c59af 100644--- a/apps/web/src/features/theme/utils/themeValidation.ts+++ b/apps/web/src/features/theme/utils/themeValidation.ts@@ -1,4 +1,9 @@-import type { ThemeV2, ThemeV2Tokens } from '../types/themeTypes';+import {+ inputColorTokens,+ type ThemeV2,+ type ThemeV2Tokens,+ type ThemeV3,+} from '../types/themeTypes';const THEME_V2_TOKEN_KEYS: ReadonlyArray<keyof ThemeV2Tokens> = ['a0',@@ -18,7 +23,9 @@ const THEME_V2_TOKEN_KEYS: ReadonlyArray<keyof ThemeV2Tokens> = ['c4',];-function isTokenValue(val: unknown): val is { l: number; c: number; h: number } {+function isTokenValue(+ val: unknown+): val is { l: number; c: number; h: number } {if (typeof val !== 'object' || val === null) return false;const obj = val as Record<string, unknown>;return (@@ -34,7 +41,7 @@ export function isThemeV2(data: unknown): data is ThemeV2 {if (typeof obj.id !== 'string') return false;if (typeof obj.name !== 'string') return false;- if (typeof obj.version !== 'number') return false;+ if (obj.version !== 2) return false;if (typeof obj.depth !== 'number') return false;if (typeof obj.tokens !== 'object' || obj.tokens === null) return false;@@ -43,9 +50,51 @@ export function isThemeV2(data: unknown): data is ThemeV2 {if (!isTokenValue(tokens[key])) return false;}+ if (obj.colorTokens !== undefined) {+ if (typeof obj.colorTokens !== 'object' || obj.colorTokens === null) {+ return false;+ }+ if (+ !Object.values(obj.colorTokens as Record<string, unknown>).every(+ (value) => typeof value === 'string'+ )+ ) {+ return false;+ }+ }+return true;}+/** Validates the token-only persisted theme format. Raw input colors are the+ * only required authored values. Semantic and extension tokens are optional+ * overrides and are filled from the central defaults when the theme loads. */+export function isThemeV3(data: unknown): data is ThemeV3 {+ if (typeof data !== 'object' || data === null) return false;+ const obj = data as Record<string, unknown>;++ if (typeof obj.id !== 'string') return false;+ if (typeof obj.name !== 'string') return false;+ if (obj.version !== 3) return false;+ if (obj.mode !== 'light' && obj.mode !== 'dark') return false;+ if (typeof obj.colorTokens !== 'object' || obj.colorTokens === null) {+ return false;+ }++ const colorTokens = obj.colorTokens as Record<string, unknown>;+ if (+ !Object.values(colorTokens).every(+ (value) => typeof value === 'string' && value.trim().length > 0+ )+ ) {+ return false;+ }++ return inputColorTokens.every(+ (token) => typeof colorTokens[token] === 'string'+ );+}+export function parseThemeV2Json(text: string): ThemeV2 | null {try {const parsed: unknown = JSON.parse(text);@@ -55,3 +104,12 @@ export function parseThemeV2Json(text: string): ThemeV2 | null {return null;}}++export function parseThemeV3Json(text: string): ThemeV3 | null {+ try {+ const parsed: unknown = JSON.parse(text);+ return isThemeV3(parsed) ? parsed : null;+ } catch {+ return null;+ }+}diff --git a/apps/web/src/index.css b/apps/web/src/index.cssindex 2ee3505687..b4facea271 100644--- a/apps/web/src/index.css+++ b/apps/web/src/index.css@@ -108,6 +108,11 @@/* scuffed: defualt 0.15, used for transition jamming, currently disabled */--transition: 0s;+ /* Depth-0 defaults for content rendered outside a Layer marker. */+ --layer-surface: var(--color-surface-0);+ --layer-inset: var(--color-surface-0);+ --layer-lift: var(--color-surface-1);+::selection {background-color: oklch(from var(--color-accent) l c h / 0.5);}@@ -127,6 +132,54 @@ body.tauri-ios {}}+/* These mappings are the complete layer contract; structural semantic colors+ do not change across layers. */+[data-layer] {+ --color-surface: var(--theme-surface, var(--layer-surface));+ --color-inset: var(--theme-inset, var(--layer-inset));+ --color-lift: var(--theme-lift, var(--layer-lift));+}++[data-layer][data-depth='0'] {+ --layer-surface: var(--color-surface-0);+ --layer-inset: var(--color-surface-0);+ --layer-lift: var(--color-surface-1);+}++[data-layer][data-depth='1'] {+ --layer-surface: var(--color-surface-1);+ --layer-inset: var(--color-surface-0);+ --layer-lift: var(--color-surface-2);+}++[data-layer][data-depth='2'] {+ --layer-surface: var(--color-surface-2);+ --layer-inset: var(--color-surface-1);+ --layer-lift: var(--color-surface-3);+}++[data-layer][data-depth='3'] {+ --layer-surface: var(--color-surface-3);+ --layer-inset: var(--color-surface-2);+ --layer-lift: var(--color-surface-4);+}++[data-layer][data-depth='4'] {+ --layer-surface: var(--color-surface-4);+ --layer-inset: var(--color-surface-3);+ --layer-lift: var(--color-surface-4);+}++/* Scope the panel semantic itself so nested bg-panel consumers share the same+ inactive split chrome instead of only tinting the outer panel element. */+.split-panel-inactive {+ --color-panel: color-mix(+ in oklch,+ var(--theme-panel, var(--color-surface-1)) 80%,+ var(--color-page)+ );+}+@theme {/* Disable default tailwind color palette */--color-*: initial;@@ -135,90 +188,171 @@ body.tauri-ios {Explicit widths (ring, ring-2, …) are left untouched. */--default-ring-width: var(--app-ring-width);- /* Semantic Color names, use these when writing tailwind */- --color-accent: var(--a0);- --color-accent-bg: oklch(var(--a0) / 0.08);- --color-accent-hover: oklch(var(--a0) / 0.20);-- --color-surface: var(--b0);- --color-drop-shadow: oklch(0.15 0 0 / 0.04);- --color-overlay: oklch(0 0 0 / 0.25);-- --color-edge-muted: var(--b3);- --color-edge: var(--b4);- --color-rail: color-mix(in oklch, var(--b4) 90%, var(--c0));-- --color-ink: var(--c0);- --color-ink-muted: var(--c1);- --color-ink-extra-muted: var(--c2);- --color-ink-disabled: var(--c3);- --color-ink-placeholder: var(--c4);-- /* Below are our semantic surface tokens, which either pick up color overrides from the theme, or are set to --b0, which allows them to be controlled by our Layer system */- /* NOTE: these are NOT all wired up. We erased a lot of our semantic design tokens when moving to Layer system, these are part of a migration back towards semantic tokens. */- /* To wire them up you should change the generic '*-surface' class on a component to instead use one of these tokens. */- --color-page: var(--theme-page, var(--b0));- --color-panel: var(--theme-panel, var(--b0));- --color-inset: var(--theme-inset, var(--b0));- --color-dialog: var(--theme-dialog, var(--b0));- --color-menu: var(--theme-menu, var(--b0));- --color-input: var(--theme-input, var(--b0));- --color-message: var(--theme-message, color-mix(in oklch, var(--b1) 50%, var(--b2)));- --color-hover: var(--theme-hover, var(--b2));- --color-active: var(--theme-active, var(--b1));- --color-button: var(--theme-button, var(--b0));- /* Used for floating mobile navigation chrome */- --color-chrome: var(--theme-chrome, color-mix(in oklch, var(--color-menu) 85%, var(--color-active)));--- /* Below are hardcoded colors */- --color-failure: oklch(0.637 0.237 25.331);- --color-failure-bg: oklch(from var(--color-failure) l c h / 0.15);- --color-failure-ink: oklch(from var(--color-failure) var(--c1l) c h); /* scuffed */-- --color-success: oklch(0.696 0.17 162.48);- --color-success-bg: oklch(from var(--color-success) l c h / 0.15);- --color-success-ink: oklch(from var(--color-success) var(--c1l) c h); /* scuffed */-- --color-alert: oklch(0.769 0.188 70.08);- --color-alert-bg: oklch(from var(--color-alert) l c h / 0.15);- --color-alert-ink: oklch(from var(--color-alert) var(--c1l) c h); /* scuffed */-- --color-comment: oklch(from var(--a0) l c 90deg);+ /* Input tokens: the only raw colors stored by a VNext theme. */+ --color-surface-0: var(--b0);+ --color-surface-1: var(--b1);+ --color-surface-2: var(--b2);+ --color-surface-3: var(--b3);+ --color-surface-4: var(--b4);+ --color-content-0: var(--c0);+ --color-content-1: var(--c1);+ --color-content-2: var(--c2);+ --color-content-3: var(--c3);+ --color-content-4: var(--c4);+ --color-edge: var(--color-surface-4);+ --color-edge-muted: var(--color-surface-3);+ --color-accent: var(--a0);+ --color-red: oklch(63.7% 0.237 25.331);+ --color-orange: oklch(70.5% 0.213 47.604);+ --color-amber: oklch(76.9% 0.188 70.08);+ --color-yellow: oklch(79.5% 0.184 86.047);+ --color-lime: oklch(76.8% 0.233 130.85);+ --color-green: oklch(72.3% 0.219 149.579);+ --color-teal: oklch(70.4% 0.14 182.503);+ --color-cyan: oklch(71.5% 0.143 215.221);+ --color-blue: oklch(62.3% 0.214 259.815);+ --color-violet: oklch(60.6% 0.25 292.717);+ --color-purple: oklch(62.7% 0.265 303.9);+ --color-pink: oklch(65.6% 0.241 354.308);++ /* Component-facing semantic assignments. A theme may override the three+ layer-relative colors; otherwise they resolve through the nearest Layer. */+ --color-surface: var(--theme-surface, var(--layer-surface));+ --color-inset: var(--theme-inset, var(--layer-inset));+ --color-lift: var(--theme-lift, var(--layer-lift));+ --color-ink: var(--color-content-0);+ --color-ink-muted: var(--color-content-1);+ --color-ink-subtle: var(--color-content-2);+ --color-ink-disabled: var(--color-content-3);+ --color-ink-placeholder: var(--color-content-4);+ --color-link: var(--color-accent);+ --color-link-hover: var(--color-accent);+ --color-link-visited: var(--color-accent);+ --color-page: var(--color-surface-0);+ --color-panel: var(--theme-panel, var(--color-surface-1));+ --color-dialog: var(--color-surface-2);+ --color-menu: var(--color-surface-2);+ --color-tooltip: var(--color-surface-2);+ --color-toast: var(--color-surface-2);+ --color-input: transparent;+ --color-input-focus: var(--color-lift);+ --color-message: var(--color-lift);+ --color-code-buffer: color-mix(in srgb, var(--color-surface-0) 60%, var(--color-surface-1));+ --color-hover: color-mix(in oklch, var(--color-content-0) 3%, transparent);+ --color-active: color-mix(in oklch, var(--color-content-0) 6%, transparent);+ --color-selected: color-mix(in oklch, var(--color-accent) 8%, transparent);+ --color-success: var(--color-green);+ --color-warning: var(--color-amber);+ --color-failure: var(--color-red);+ --color-chrome: var(--color-surface-4);++ /* Generated compatibility tokens. */+ --color-accent-bg: color-mix(in oklch, var(--color-accent) 8%, transparent);+ --color-accent-ink: var(--color-accent);+ --color-accent-hover: color-mix(in oklch, var(--color-accent) 20%, transparent);++ --color-red-bg: color-mix(in oklch, var(--color-red) 15%, transparent);+ --color-red-ink: var(--color-red);+ --color-red-hover: color-mix(in oklch, var(--color-red) 20%, transparent);+ --color-orange-bg: color-mix(in oklch, var(--color-orange) 15%, transparent);+ --color-orange-ink: var(--color-orange);+ --color-orange-hover: color-mix(in oklch, var(--color-orange) 20%, transparent);+ --color-amber-bg: color-mix(in oklch, var(--color-amber) 15%, transparent);+ --color-amber-ink: var(--color-amber);+ --color-amber-hover: color-mix(in oklch, var(--color-amber) 20%, transparent);+ --color-yellow-bg: color-mix(in oklch, var(--color-yellow) 15%, transparent);+ --color-yellow-ink: var(--color-yellow);+ --color-yellow-hover: color-mix(in oklch, var(--color-yellow) 20%, transparent);+ --color-lime-bg: color-mix(in oklch, var(--color-lime) 15%, transparent);+ --color-lime-ink: var(--color-lime);+ --color-lime-hover: color-mix(in oklch, var(--color-lime) 20%, transparent);+ --color-green-bg: color-mix(in oklch, var(--color-green) 15%, transparent);+ --color-green-ink: var(--color-green);+ --color-green-hover: color-mix(in oklch, var(--color-green) 20%, transparent);+ --color-teal-bg: color-mix(in oklch, var(--color-teal) 15%, transparent);+ --color-teal-ink: var(--color-teal);+ --color-teal-hover: color-mix(in oklch, var(--color-teal) 20%, transparent);+ --color-cyan-bg: color-mix(in oklch, var(--color-cyan) 15%, transparent);+ --color-cyan-ink: var(--color-cyan);+ --color-cyan-hover: color-mix(in oklch, var(--color-cyan) 20%, transparent);+ --color-blue-bg: color-mix(in oklch, var(--color-blue) 15%, transparent);+ --color-blue-ink: var(--color-blue);+ --color-blue-hover: color-mix(in oklch, var(--color-blue) 20%, transparent);+ --color-violet-bg: color-mix(in oklch, var(--color-violet) 15%, transparent);+ --color-violet-ink: var(--color-violet);+ --color-violet-hover: color-mix(in oklch, var(--color-violet) 20%, transparent);+ --color-purple-bg: color-mix(in oklch, var(--color-purple) 15%, transparent);+ --color-purple-ink: var(--color-purple);+ --color-purple-hover: color-mix(in oklch, var(--color-purple) 20%, transparent);+ --color-pink-bg: color-mix(in oklch, var(--color-pink) 15%, transparent);+ --color-pink-ink: var(--color-pink);+ --color-pink-hover: color-mix(in oklch, var(--color-pink) 20%, transparent);++ --color-success-bg: color-mix(in oklch, var(--color-success) 15%, transparent);+ --color-success-ink: var(--color-success);+ --color-success-hover: color-mix(in oklch, var(--color-success) 20%, transparent);+ --color-warning-bg: color-mix(in oklch, var(--color-warning) 15%, transparent);+ --color-warning-ink: var(--color-warning);+ --color-warning-hover: color-mix(in oklch, var(--color-warning) 20%, transparent);+ --color-failure-bg: color-mix(in oklch, var(--color-failure) 15%, transparent);+ --color-failure-ink: var(--color-failure);+ --color-failure-hover: color-mix(in oklch, var(--color-failure) 20%, transparent);+ --color-alert: var(--color-warning);+ --color-alert-bg: var(--color-warning-bg);+ --color-alert-ink: var(--color-warning-ink);++ /* Utility outputs. */+ --color-channel-rail: color-mix(in oklch, var(--color-edge) 90%, var(--color-ink));+ --color-channel-rail-active: var(--color-accent);+ --color-modal-overlay: oklch(0 0 0 / 0.25);+ --color-drop-shadow: oklch(0.15 0 0 / 0.04);+ --color-rail: var(--color-channel-rail);+ --color-skeleton: color-mix(in oklch, var(--color-ink) 10%, transparent);+ --color-list-hover: color-mix(in oklch, var(--color-hover) 65%, transparent);+ --color-list-highlighted: var(--color-hover);+ --color-list-selected: var(--color-selected);+ --color-list-selected-highlighted: color-mix(in oklch, var(--color-accent) 16%, transparent);++ /* Temporary compatibility aliases while component classes migrate. */+ --color-ink-extra-muted: var(--color-ink-subtle);+ --color-button: var(--color-surface);+ --color-overlay: var(--color-modal-overlay);++ /* Entity colors are aliases of the authored named palette. */+ --color-comment: var(--color-yellow);--color-comment-bg: oklch(from var(--color-comment) l c h / 0.15);--color-comment-ink: oklch(from var(--color-comment) var(--c1l) c h); /* scuffed */- --color-calendar: oklch(from var(--a0) l c 100deg);- --color-contact: oklch(from var(--a0) l c 94deg);- --color-canvas: oklch(from var(--a0) l c 60deg);- --color-folder: oklch(from var(--a0) l c 240deg);- --color-image: oklch(from var(--a0) l c 95deg);- --color-video: oklch(from var(--a0) l c 277deg);- --color-write: oklch(from var(--a0) l c 260deg);- --color-code: oklch(from var(--a0) l c 180deg);- --color-chat: oklch(from var(--a0) l c 220deg);- --color-html: oklch(from var(--a0) l c 47deg);- --color-note: oklch(from var(--a0) l c 293deg);- --color-task: oklch(from var(--a0) l c 150deg);- --color-snippet: oklch(from var(--a0) l c 330deg);- --color-pdf: oklch(from var(--a0) l c 25deg);- --color-rss: oklch(from var(--a0) l c 260deg);- --color-default: var(--c1);+ --color-calendar: var(--color-yellow);+ --color-contact: var(--color-yellow);+ --color-canvas: var(--color-amber);+ --color-folder: var(--color-blue);+ --color-image: var(--color-yellow);+ --color-video: var(--color-violet);+ --color-write: var(--color-blue);+ --color-code: var(--color-lime);+ --color-chat: var(--color-cyan);+ --color-html: var(--color-orange);+ --color-note: var(--color-violet);+ --color-task: var(--color-green);+ --color-snippet: var(--color-pink);+ --color-pdf: var(--color-red);+ --color-rss: var(--color-blue);+ --color-default: var(--color-content-1);--color-email: var(--color-default);- /* SCUFFED We probably want to let the theme determine 3 or 4 "extra" hue offsets. Rights now these are only being */- /* used as debug colors and to improve the consistency of markdown block lightness/chroma with themed css */- --color-accent-30: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 30deg));- --color-accent-60: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 60deg));- --color-accent-90: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 90deg));- --color-accent-120: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 120deg));- --color-accent-150: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 150deg));- --color-accent-180: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 180deg));- --color-accent-210: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 210deg));- --color-accent-240: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 240deg));- --color-accent-270: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 270deg));- --color-accent-300: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 300deg));- --color-accent-330: oklch(var(--a0l) var(--a0c) calc(var(--a0h) + 330deg));+ /* Compatibility aliases for existing syntax-highlight classes. */+ --color-accent-30: var(--color-red);+ --color-accent-60: var(--color-orange);+ --color-accent-90: var(--color-yellow);+ --color-accent-120: var(--color-lime);+ --color-accent-150: var(--color-green);+ --color-accent-180: var(--color-teal);+ --color-accent-210: var(--color-cyan);+ --color-accent-240: var(--color-blue);+ --color-accent-270: var(--color-violet);+ --color-accent-300: var(--color-purple);+ --color-accent-330: var(--color-pink);/* Font families */--font-sans: "Inter Variable", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";@@ -500,6 +634,16 @@ a {--pattern-color: --value(--color-*);}+/* Paint a translucent scrim as a background *image* so it layers on top of the+ element's background-color instead of replacing it. Handy for hover/press+ feedback on buttons with a solid or tinted background: the base color shows+ through instead of being washed out by lowering its opacity.+ Accepts a theme color (e.g. `overlay-hover`) or an arbitrary color value. */+@utility overlay-* {+ --tw-overlay: --value(--color-*, [color], [*]);+ background-image: linear-gradient(var(--tw-overlay), var(--tw-overlay));+}+/* utils for striped bg images */@utility pattern-diagonal-* {background-size: --value(integer)px --value(integer)px;diff --git a/apps/web/src/lib/core/comments/Comment.tsx b/apps/web/src/lib/core/comments/Comment.tsxindex 91f1721111..5469fea0da 100644--- a/apps/web/src/lib/core/comments/Comment.tsx+++ b/apps/web/src/lib/core/comments/Comment.tsx@@ -40,13 +40,13 @@ function CommentContainer(<divclass="relative isolate group"classList={{- 'outline-1 outline-accent/20 -outline-offset-1': props.isHighlighted,+ 'outline-1 outline-yellow/20 -outline-offset-1': props.isHighlighted,}}><divclass="absolute top-0 left-0 size-[calc(100%)] rounded-lg -z-1"classList={{- 'bg-accent/5 opacity-100': props.isHighlighted,+ 'bg-yellow/5 opacity-100': props.isHighlighted,'bg-hover/50 opacity-0 group-hover:opacity-100': !props.isHighlighted,}}/>diff --git a/apps/web/src/lib/core/comments/MinimizedThreads.tsx b/apps/web/src/lib/core/comments/MinimizedThreads.tsxindex 9217274c08..4554d1d13a 100644--- a/apps/web/src/lib/core/comments/MinimizedThreads.tsx+++ b/apps/web/src/lib/core/comments/MinimizedThreads.tsx@@ -105,7 +105,7 @@ export function MinimizedThread(props: {<divclass={cn('inline-flex items-center gap-1 px-1 rounded-lg', {'group-hover:bg-hover': !props.isActive,- 'bg-comment/10 group-hover:bg-comment/20': props.isActive,+ 'bg-yellow/10 group-hover:bg-yellow/20': props.isActive,})}><ChatTeardrop class="size-4" onClick={clickHandler} />diff --git a/apps/web/src/lib/core/comments/discussion/DiscussionInput.tsx b/apps/web/src/lib/core/comments/discussion/DiscussionInput.tsxindex 705641e6a7..71508b85dd 100644--- a/apps/web/src/lib/core/comments/discussion/DiscussionInput.tsx+++ b/apps/web/src/lib/core/comments/discussion/DiscussionInput.tsx@@ -216,7 +216,7 @@ export function DiscussionInput(props: DiscussionInputProps) {}}onFocusIn={() => setIsFocused(true)}active={isFocused()}- class="rounded-xl"+ class="rounded-xl bg-surface"depth={2}solid>diff --git a/apps/web/src/lib/core/component/AI/component/input/ChatInput.tsx b/apps/web/src/lib/core/component/AI/component/input/ChatInput.tsxindex 3dc3cdda84..75562ca72a 100644--- a/apps/web/src/lib/core/component/AI/component/input/ChatInput.tsx+++ b/apps/web/src/lib/core/component/AI/component/input/ChatInput.tsx@@ -297,7 +297,7 @@ export function ChatInput(props: ChatInputComponentProps) {return (<div class="relative">- <Surface class="rounded-xl" depth={2} solid>+ <Surface class="rounded-xl bg-surface" depth={2} solid><divonFocusOut={(e) => {const next = e.relatedTarget as Node | null;diff --git a/apps/web/src/lib/core/component/AI/component/tool/ImportTools.tsx b/apps/web/src/lib/core/component/AI/component/tool/ImportTools.tsxindex d814c9718a..181b3b61da 100644--- a/apps/web/src/lib/core/component/AI/component/tool/ImportTools.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/ImportTools.tsx@@ -62,7 +62,7 @@ export const importNotionPageHandler = createToolRenderer({type="call"response={hasResponse() && isExpanded() ? (- <div class="rounded-md bg-surface-secondary px-3 py-2 text-xs text-ink-muted">+ <div class="rounded-md bg-panel px-3 py-2 text-xs text-ink-muted">{ctx.response?.data.message}</div>) : undefineddiff --git a/apps/web/src/lib/core/component/AI/component/tool/ListEntities.tsx b/apps/web/src/lib/core/component/AI/component/tool/ListEntities.tsxindex f5200aaa08..1c994c4bba 100644--- a/apps/web/src/lib/core/component/AI/component/tool/ListEntities.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/ListEntities.tsx@@ -124,7 +124,7 @@ const ListEntitiesToolResponse = (props: {return (<buttontype="button"- class="block w-full text-left hover:bg-surface-hover"+ class="block w-full text-left hover:bg-hover"onClick={clickHandler}><Tool.ListItem icon={getItemIcon(item)}>diff --git a/apps/web/src/lib/core/component/AI/component/tool/ReadProject.tsx b/apps/web/src/lib/core/component/AI/component/tool/ReadProject.tsxindex 6be3ee970a..92822ae01e 100644--- a/apps/web/src/lib/core/component/AI/component/tool/ReadProject.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/ReadProject.tsx@@ -79,7 +79,7 @@ const ReadProjectToolResponse = (props: { items: ReadProjectItem[] }) => {return (<buttontype="button"- class="block w-full text-left hover:bg-surface-hover"+ class="block w-full text-left hover:bg-hover"onClick={clickHandler}><Tool.ListItem icon={getItemIcon(item)}>diff --git a/apps/web/src/lib/core/component/AI/component/tool/Search.tsx b/apps/web/src/lib/core/component/AI/component/tool/Search.tsxindex 91f0883d9d..0678e87210 100644--- a/apps/web/src/lib/core/component/AI/component/tool/Search.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/Search.tsx@@ -37,7 +37,7 @@ function SearchResultRow(props: { entity: SearchEntity; onClick: () => void }) {return (<buttontype="button"- class="block w-full text-left hover:bg-surface-hover"+ class="block w-full text-left hover:bg-hover"onClick={props.onClick}><Tool.ListItem icon={<EntityRowIcon entity={props.entity} />}>diff --git a/apps/web/src/lib/core/component/AI/component/tool/SearchSkills.tsx b/apps/web/src/lib/core/component/AI/component/tool/SearchSkills.tsxindex a32c2a3487..e910232b3f 100644--- a/apps/web/src/lib/core/component/AI/component/tool/SearchSkills.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/SearchSkills.tsx@@ -36,7 +36,7 @@ function SkillResultRow(props: { result: SkillSearchResult }) {{(skill) => (<buttontype="button"- class="block w-full text-left hover:bg-surface-hover"+ class="block w-full text-left hover:bg-hover"onClick={openSkill}><Tool.ListItem icon={<EntityRowIcon entity={skill()} />}>diff --git a/apps/web/src/lib/core/component/AI/component/tool/SendEmail.tsx b/apps/web/src/lib/core/component/AI/component/tool/SendEmail.tsxindex a1e8e1df06..d0a2ce9ce9 100644--- a/apps/web/src/lib/core/component/AI/component/tool/SendEmail.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/SendEmail.tsx@@ -94,7 +94,7 @@ function DraftPreviewButton(props: {return (<button- class="text-ink text-xs border border-edge-muted rounded-xs hover:bg-surface-hover flex flex-row h-6 px-2 justify-center items-center"+ class="text-ink text-xs border border-edge-muted rounded-xs hover:bg-hover flex flex-row h-6 px-2 justify-center items-center"onClick={() =>replaceOrInsertSplit({...(props.threadIddiff --git a/apps/web/src/lib/core/component/AI/component/tool/WebFetch.tsx b/apps/web/src/lib/core/component/AI/component/tool/WebFetch.tsxindex a4bbe139af..5582d1de6b 100644--- a/apps/web/src/lib/core/component/AI/component/tool/WebFetch.tsx+++ b/apps/web/src/lib/core/component/AI/component/tool/WebFetch.tsx@@ -12,7 +12,7 @@ const handler = createToolRenderer({href={ctx.tool.data.input}target="_blank"rel="noopener noreferrer"- class="italic text-ink hover:underline"+ class="italic text-link hover:text-link-hover visited:text-link-visited hover:underline">{ctx.tool.data.input}</a>diff --git a/apps/web/src/lib/core/component/ContextMenu.tsx b/apps/web/src/lib/core/component/ContextMenu.tsxindex 66c77d1b4f..bd9dffdbea 100644--- a/apps/web/src/lib/core/component/ContextMenu.tsx+++ b/apps/web/src/lib/core/component/ContextMenu.tsx@@ -308,7 +308,9 @@ const menuWidths: Record<MenuWidth, string> = {screen: 'w-screen',};-export const MENU_CONTENT_CLASS = `flex flex-col justify-start items-start border border-edge bg-surface shadow-menu rounded-xl p-1.5 cursor-default select-none max-w-full max-h-[calc(100dvh-10rem)] overflow-y-auto z-modal menu-open-animation`;+const MENU_SURFACE_SCOPE = '[--color-surface:var(--color-menu)]';++export const MENU_CONTENT_CLASS = `flex flex-col justify-start items-start border border-edge bg-menu ${MENU_SURFACE_SCOPE} shadow-menu rounded-xl p-1.5 cursor-default select-none max-w-full max-h-[calc(100dvh-10rem)] overflow-y-auto z-modal menu-open-animation`;type MenuContentProps = ParentProps<{class?: string;@@ -419,6 +421,7 @@ export function ContextMenuContent(props: ParentProps<MenuContentProps>) {<Layer depth={2}><ContextMenu.Contentclass={cn(+ MENU_SURFACE_SCOPE,!props.overrideStyling && MENU_CONTENT_CLASS,'menu-open-animation',props.class,diff --git a/apps/web/src/lib/core/component/ItemPreview.tsx b/apps/web/src/lib/core/component/ItemPreview.tsxindex f7ab1ab271..96c3563c9b 100644--- a/apps/web/src/lib/core/component/ItemPreview.tsx+++ b/apps/web/src/lib/core/component/ItemPreview.tsx@@ -117,7 +117,7 @@ export function useItemPreviewData(entity: Accessor<ItemEntity>) {}const DEFAULT_BUTTON_CLASS =- 'text-ink-base text-sm border border-edge-muted rounded-xs hover:bg-surface-hover flex flex-row h-6 px-2 justify-center items-center';+ 'text-ink text-sm border border-edge-muted rounded-xs hover:bg-hover flex flex-row h-6 px-2 justify-center items-center';const DEFAULT_ICON_CLASS = 'flex justify-start items-center w-3.5 h-3.5 mr-2';const DEFAULT_TEXT_CLASS = 'flex-1 text-left leading-5 min-w-0 truncate';diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/PullRequestMention.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/PullRequestMention.tsxindex fbd5591529..6f0b57e453 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/PullRequestMention.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/PullRequestMention.tsx@@ -280,7 +280,7 @@ function PullRequestPreviewBody(props: {href={url()}target="_blank"rel="noreferrer"- class="shrink-0 text-ink-muted hover:text-ink"+ class="shrink-0 text-link hover:text-link-hover visited:text-link-visited"onClick={(e) => e.stopPropagation()}><OpenIcon class="size-4" />diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsxindex ec5d9a7dd3..2e293f7d0a 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx@@ -2,9 +2,10 @@ import { useSettingsState } from '@core/constant/SettingsState';import type { ThemeMentionDecoratorProps } from '@macro-inc/lexical-core';import { ThemeChips } from '@theme/components/ThemeChips';import { setUserThemes, themes, userThemes } from '@theme/signals/themeSignals';-import type { ThemeV2 } from '@theme/types/themeTypes';+import type { ThemeV3 } from '@theme/types/themeTypes';+import { convertThemev2v3 } from '@theme/utils/themeMigrations';import { pinTheme } from '@theme/utils/themeUtils';-import { isThemeV2 } from '@theme/utils/themeValidation';+import { isThemeV2, isThemeV3 } from '@theme/utils/themeValidation';import { cn } from '@ui';import { Show, useContext } from 'solid-js';import { LexicalWrapperContext } from '../../context/LexicalWrapperContext';@@ -20,8 +21,9 @@ export function ThemeMention(props: ThemeMentionDecoratorProps) {return sel.type === 'node' && sel.nodeKeys.has(props.key);};- const theme = (): ThemeV2 | null => {- if (isThemeV2(props.data)) return props.data;+ const theme = (): ThemeV3 | null => {+ if (isThemeV3(props.data)) return props.data;+ if (isThemeV2(props.data)) return convertThemev2v3(props.data);return null;};diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/text-paste/textPastePlugin.ts b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/text-paste/textPastePlugin.tsindex 55155cf23c..27d83a4fd0 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/text-paste/textPastePlugin.ts+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/text-paste/textPastePlugin.ts@@ -7,7 +7,11 @@ import {import { isValidMacroAppHostname } from '@core/util/macroAppUrl';import { mergeRegister } from '@lexical/utils';import { $createPasteNode, PasteNode } from '@macro-inc/lexical-core';-import { parseThemeV2Json } from '@theme/utils/themeValidation';+import { convertThemev2v3 } from '@theme/utils/themeMigrations';+import {+ parseThemeV2Json,+ parseThemeV3Json,+} from '@theme/utils/themeValidation';import {$getSelection,$isRangeSelection,@@ -120,16 +124,21 @@ function registerTextPastePlugin(editor: LexicalEditor) {event.clipboardData?.getData('text/plain') || '';// Check for theme JSON before checking for Macro URL- const themeV2 = parseThemeV2Json(pastedText);- if (themeV2) {+ const themeV3 =+ parseThemeV3Json(pastedText) ??+ (() => {+ const legacy = parseThemeV2Json(pastedText);+ return legacy ? convertThemev2v3(legacy) : null;+ })();+ if (themeV3) {const selection = $getSelection();if ($isRangeSelection(selection) && !selection.isCollapsed())return false;event.preventDefault();editor.dispatchCommand(INSERT_THEME_MENTION_COMMAND, {- name: themeV2.name,- data: themeV2,+ name: themeV3.name,+ data: themeV3,});return true;}diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/styles.css b/apps/web/src/lib/core/component/LexicalMarkdown/styles.cssindex 1d9f773add..3faca6af08 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/styles.css+++ b/apps/web/src/lib/core/component/LexicalMarkdown/styles.css@@ -505,25 +505,25 @@ mark {}.md-mark.comment {- background: oklch(from var(--color-comment) l c h / 0.1);- border-bottom: 2px solid oklch(from var(--color-comment) l c h / 0.3);+ background: oklch(from var(--color-yellow) l c h / 0.1);+ border-bottom: 2px solid oklch(from var(--color-yellow) l c h / 0.3);padding-bottom: 2px;}.md-mark-overlap.comment {- background: oklch(from var(--color-comment) l c h / 0.2);- border-bottom: 2px solid oklch(from var(--color-comment) l c h / 0.4);+ background: oklch(from var(--color-yellow) l c h / 0.2);+ border-bottom: 2px solid oklch(from var(--color-yellow) l c h / 0.4);}.md-mark.selected.comment {- background: oklch(from var(--color-comment) l c h / 0.3);- border-bottom: 2px solid oklch(from var(--color-comment) l c h / 0.5);- color: var(--color-comment-ink);+ background: oklch(from var(--color-yellow) l c h / 0.3);+ border-bottom: 2px solid oklch(from var(--color-yellow) l c h / 0.5);+ color: var(--color-ink);}.md-mark-overlap.selected.comment {- background: oklch(from var(--color-comment) l c h / 0.4);- border-bottom: 2px solid oklch(from var(--color-comment) l c h / 0.6);+ background: oklch(from var(--color-yellow) l c h / 0.4);+ border-bottom: 2px solid oklch(from var(--color-yellow) l c h / 0.6);}.md-mark.draft.comment:not(.local) {diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/theme.ts b/apps/web/src/lib/core/component/LexicalMarkdown/theme.tsindex 7206901f03..cb0b7a1a4f 100644--- a/apps/web/src/lib/core/component/LexicalMarkdown/theme.ts+++ b/apps/web/src/lib/core/component/LexicalMarkdown/theme.ts@@ -3,38 +3,38 @@ import type { EditorThemeClasses } from 'lexical';const VERTICAL_GAP = 'my-4 first:mt-1.5 last:mb-1.5';-// SCUFFED THEMING: we have to figure out what to do about code highlighting.+// Syntax highlighting consumes the theme's authored named palette directly.const codeHighlight: Record<string, string> = {- atrule: 'text-accent-30',- attr: 'text-accent-60',- boolean: 'text-accent-90',- builtin: 'text-accent-120',+ atrule: 'text-red',+ attr: 'text-orange',+ boolean: 'text-yellow',+ builtin: 'text-lime',cdata: 'text-ink-muted',- char: 'text-accent-150',- class: 'text-accent-180',- 'class-name': 'text-accent-180',+ char: 'text-green',+ class: 'text-teal',+ 'class-name': 'text-teal',comment: 'text-ink-muted',- constant: 'text-accent-270',- deleted: 'text-accent-300',- doctype: 'text-accent-330',- entity: 'text-accent-30',- function: 'text-accent-60',- important: 'text-accent-90',- inserted: 'text-accent-120',- keyword: 'text-accent-150',- namespace: 'text-accent-180',- number: 'text-accent-120',- operator: 'text-accent-300',+ constant: 'text-violet',+ deleted: 'text-purple',+ doctype: 'text-pink',+ entity: 'text-red',+ function: 'text-orange',+ important: 'text-yellow',+ inserted: 'text-lime',+ keyword: 'text-green',+ namespace: 'text-teal',+ number: 'text-lime',+ operator: 'text-purple',prolog: 'text-ink-muted',- property: 'text-accent-270',+ property: 'text-violet',punctuation: 'text-ink',- regex: 'text-accent-60',- selector: 'text-accent-90',- string: 'text-accent-30',- symbol: 'text-accent-60',- tag: 'text-accent-90',- url: 'text-accent-120',- variable: 'text-accent-150',+ regex: 'text-orange',+ selector: 'text-yellow',+ string: 'text-red',+ symbol: 'text-orange',+ tag: 'text-yellow',+ url: 'text-lime',+ variable: 'text-green',};export const theme: EditorThemeClasses = {@@ -42,7 +42,7 @@ export const theme: EditorThemeClasses = {text: {bold: 'font-bold',italic: 'italic',- code: 'bg-message font-mono rounded-xs md-inline-code p-0.5',+ code: 'bg-code-buffer font-mono rounded-xs md-inline-code p-0.5',strikethrough: 'md-strike',underline: 'md-underline',highlight: 'text-accent font-semibold',@@ -66,12 +66,12 @@ export const theme: EditorThemeClasses = {checklist: 'md-list md-check',listitemChecked: 'checked md-strike text-ink-extra-muted',},- link: 'text-accent underline hover:underline cursor-default underline-offset-[0.15em]',+ link: 'text-link hover:text-link-hover visited:text-link-visited underline hover:underline cursor-default underline-offset-[0.15em]',quote:'md-quote border-l-2 border-edge pl-4 py-2 italic text-ink-muted my-4 first:mt-1.5',- code: 'bg-message font-mono p-3 rounded block md-code-box before:text-ink-extra-muted/70 whitespace-pre mb-4',+ code: 'bg-code-buffer font-mono p-3 rounded block md-code-box before:text-ink-extra-muted/70 whitespace-pre mb-4',static: {- 'code-container': 'bg-message rounded',+ 'code-container': 'bg-code-buffer rounded','table-container': 'my-4 max-w-full',},codeHighlight,@@ -157,7 +157,7 @@ export const aiChatTheme = createTheme(},code: 'w-full bg-transparent',static: {- 'code-container': 'bg-message m-2',+ 'code-container': 'bg-code-buffer m-2',},},theme,@@ -169,7 +169,7 @@ export const channelTheme = createTheme(root: 'channel-markdown max-w-full min-w-0',code: 'rounded w-full bg-transparent',static: {- 'code-container': 'bg-message rounded m-2',+ 'code-container': 'bg-code-buffer rounded m-2',},},theme,@@ -186,7 +186,7 @@ export const channelThemeSender = createTheme(list: {listitemChecked: 'checked chat-blue md-strike text-current/50',},- link: 'text-current underline hover:opacity-50',+ link: 'text-link hover:text-link-hover visited:text-link-visited underline',code: `chat-blue font-mono p-3 rounded block md-code-box before:text-current/50`,static: {'code-container': `bg-[navy]/20 rounded m-2`,@@ -202,7 +202,7 @@ export const embeddedCodeBlock = createTheme({});export const unifiedListMarkdownTheme = createTheme({- code: 'font-mono overflow-hidden px-1.5 py-0.5 rounded bg-message inline-block',+ code: 'font-mono overflow-hidden px-1.5 py-0.5 rounded bg-code-buffer inline-block',quote: 'border-l-2 border-current/20 pl-1 italic text-current/80',static: {'code-container':diff --git a/apps/web/src/lib/core/component/OldMenu.tsx b/apps/web/src/lib/core/component/OldMenu.tsxindex 437b8e7041..9f1bf6034b 100644--- a/apps/web/src/lib/core/component/OldMenu.tsx+++ b/apps/web/src/lib/core/component/OldMenu.tsx@@ -242,7 +242,7 @@ export function OldMenu(props: ParentProps<OldMenuProps>) {return (<divclass={cn(- 'flex flex-col py-1 justify-start items-start border border-edge bg-surface shadow-lg rounded-md cursor-default select-none',+ 'flex flex-col py-1 justify-start items-start border border-edge bg-menu [--color-surface:var(--color-menu)] shadow-lg rounded-md cursor-default select-none',props.width && (oldMenuWidths[props.width] ?? props.width),isTouchDevice() && 'relative',props.hide && 'hidden',diff --git a/apps/web/src/lib/core/component/RecipientSelector.tsx b/apps/web/src/lib/core/component/RecipientSelector.tsxindex 369d575f6f..f3ad2a18b8 100644--- a/apps/web/src/lib/core/component/RecipientSelector.tsx+++ b/apps/web/src/lib/core/component/RecipientSelector.tsx@@ -279,7 +279,7 @@ type RecipientSelectorProps<K extends CombinedRecipientKind> = {hideMenuOnEscape?: boolean;horizontalScroll?: boolean;class?: string;- depth?: 0 | 1 | 2 | 3 | 4 | 5;+ depth?: 0 | 1 | 2 | 3 | 4;portalScope?: 'local';};diff --git a/apps/web/src/lib/core/component/TabsInset.tsx b/apps/web/src/lib/core/component/TabsInset.tsxindex a4c96bea6c..a113e2ab3d 100644--- a/apps/web/src/lib/core/component/TabsInset.tsx+++ b/apps/web/src/lib/core/component/TabsInset.tsx@@ -16,7 +16,7 @@ type TabsInsetProps = {value?: string;defaultValue?: string;class?: string;- depth?: 0 | 1 | 2 | 3 | 4 | 5;+ depth?: 0 | 1 | 2 | 3 | 4;} & Omit<SegmentedControlRootProps, 'defaultValue'>;export const TabsInset = (props: TabsInsetProps) => {@@ -33,8 +33,7 @@ export const TabsInset = (props: TabsInsetProps) => {// checked item is elevated two steps above it so the active pill still reads// as raised regardless of the panel depth.const trackDepth = () => local.depth ?? 0;- const itemDepth = () =>- Math.min(5, trackDepth() + 2) as 0 | 1 | 2 | 3 | 4 | 5;+ const itemDepth = () => Math.min(4, trackDepth() + 2) as 0 | 1 | 2 | 3 | 4;return (<KSegmentedControldiff --git a/apps/web/src/lib/core/component/TabsInsetDropdown.tsx b/apps/web/src/lib/core/component/TabsInsetDropdown.tsxindex 5b05398933..f2f5f4ed68 100644--- a/apps/web/src/lib/core/component/TabsInsetDropdown.tsx+++ b/apps/web/src/lib/core/component/TabsInsetDropdown.tsx@@ -11,7 +11,7 @@ export type TabItem = {export type TabsInsetDropdownProps = {placeholder?: string | JSX.Element;onChange?: (value: string) => void;- depth?: 0 | 1 | 2 | 3 | 4 | 5;+ depth?: 0 | 1 | 2 | 3 | 4;defaultValue?: string;disabled?: boolean;list: TabItem[];diff --git a/apps/web/src/lib/core/component/Toast/Toast.tsx b/apps/web/src/lib/core/component/Toast/Toast.tsxindex 443f3540bf..2d191b2ad7 100644--- a/apps/web/src/lib/core/component/Toast/Toast.tsx+++ b/apps/web/src/lib/core/component/Toast/Toast.tsx@@ -4,7 +4,7 @@ import CheckIcon from '@phosphor/check.svg';import ExclamationIcon from '@phosphor/exclamation-mark.svg';import Spinner from '@phosphor/spinner.svg';import XIcon from '@phosphor/x.svg';-import { Button, cn, Layer, Surface } from '@ui';+import { Button, cn, Surface } from '@ui';import type { Component, JSX } from 'solid-js';import {createEffect,@@ -50,7 +50,7 @@ interface ToastStyle {const TOAST_STYLES: Record<ToastType, ToastStyle> = {[ToastType.SUCCESS]: {- background: 'bg-success/10',+ background: 'bg-success-bg',accent: 'bg-success',borderColor: 'var(--color-success)',titleText: 'text-success-ink',@@ -61,10 +61,10 @@ const TOAST_STYLES: Record<ToastType, ToastStyle> = {hover: 'hover:bg-success/80',text: 'text-success-ink',},- closeButtonHover: 'hover:text-success-ink hover:bg-success/10',+ closeButtonHover: 'hover:text-success-ink hover:bg-success-hover',},[ToastType.FAILURE]: {- background: 'bg-failure/10',+ background: 'bg-failure-bg',accent: 'bg-failure',titleText: 'text-failure-ink',borderColor: 'var(--color-failure)',@@ -75,7 +75,7 @@ const TOAST_STYLES: Record<ToastType, ToastStyle> = {hover: 'hover:bg-failure/80',text: 'text-failure-ink',},- closeButtonHover: 'hover:text-failure-ink hover:bg-failure/10',+ closeButtonHover: 'hover:text-failure-ink hover:bg-failure-hover',},[ToastType.ALERT]: {background: 'bg-alert/10',@@ -281,18 +281,15 @@ function ToastBodyWrapper(props: {fallback={<SurfacehighlightColor={props.accentColor}- class="relative w-[90vw] sm:w-md p-2 sm:p-3 rounded-xl shadow-lg shadow-drop-shadow"- depth={2}+ class="relative w-[90vw] sm:w-md p-2 sm:p-3 rounded-xl bg-toast shadow-lg shadow-drop-shadow">{props.children}</Surface>}>- <Layer depth={3}>- <div class="island relative w-[90vw] p-2 rounded-xl">- {props.children}- </div>- </Layer>+ <div class="island relative w-[90vw] p-2 rounded-xl bg-toast">+ {props.children}+ </div></Show>);}diff --git a/apps/web/src/lib/core/email/tests/email-rendering.pw.ts b/apps/web/src/lib/core/email/tests/email-rendering.pw.tsindex 5177018cbf..cfbdd5cbfe 100644--- a/apps/web/src/lib/core/email/tests/email-rendering.pw.ts+++ b/apps/web/src/lib/core/email/tests/email-rendering.pw.ts@@ -2,6 +2,7 @@ import fs from 'node:fs';import path from 'node:path';import { expect, test } from '@playwright/test';import { DEFAULT_THEMES } from '@theme/constants';+import { getOklch } from '@theme/utils/colorUtil';import type { ThemeColorParams } from '../transform-email-colors';// =============================================================================@@ -51,14 +52,17 @@ function getThemeConfig(themeName: string): ThemeColorParams {if (!theme) {throw new Error(`Theme "${themeName}" not found in DEFAULT_THEMES`);}+ const ink = getOklch(theme.colorTokens['content-0']);+ const panel = getOklch(theme.colorTokens['surface-1']);+ const accent = getOklch(theme.colorTokens.accent);return {- inkL: theme.tokens.c0.l,- inkC: theme.tokens.c0.c,- inkH: theme.tokens.c0.h,- panelL: theme.tokens.b1.l,- accentL: theme.tokens.a0.l,- accentC: theme.tokens.a0.c,- accentH: theme.tokens.a0.h,+ inkL: ink.l,+ inkC: ink.c,+ inkH: ink.h,+ panelL: panel.l,+ accentL: accent.l,+ accentC: accent.c,+ accentH: accent.h,};}@@ -66,11 +70,8 @@ function generateThemeCSS(themeName: string): string {const theme = DEFAULT_THEMES.find((t) => t.name === themeName);if (!theme) return '';- const vars = Object.entries(theme.tokens)- .map(- ([key, value]) =>- `--${key}l: ${value.l}; --${key}c: ${value.c}; --${key}h: ${value.h}deg;`- )+ const vars = Object.entries(theme.colorTokens)+ .map(([key, value]) => `--color-${key}: ${value};`).join('\n ');return `:root {\n ${vars}\n }`;diff --git a/apps/web/src/lib/core/internal/DataDebug.tsx b/apps/web/src/lib/core/internal/DataDebug.tsxindex c321cb5199..8a0afc9ac8 100644--- a/apps/web/src/lib/core/internal/DataDebug.tsx+++ b/apps/web/src/lib/core/internal/DataDebug.tsx@@ -38,7 +38,7 @@ function SignalDebugCard(props: SignalDebugCardProps) {<Showwhen={props.data.length > 0}fallback={- <div class="text-text-secondary italic">+ <div class="text-ink-muted italic">No {props.title.toLowerCase()} found</div>}@@ -54,7 +54,7 @@ function SignalDebugCard(props: SignalDebugCardProps) {<div class="mt-2 relative"><buttononClick={copyToClipboard}- class="absolute top-2 right-2 p-1 rounded bg-surface-secondary hover:bg-surface-tertiary text-text-secondary hover:text-text-primary transition-colors z-10"+ class="absolute top-2 right-2 p-1 rounded bg-panel hover:bg-lift text-ink-muted hover:text-ink transition-colors z-10"title="Copy to clipboard"><Copy class="size-4" />@@ -99,9 +99,9 @@ const DataDebug: Component = () => {title="useContacts()"data={contacts()}renderItem={(contact) => (- <div class="bg-surface-secondary p-2 rounded text-sm">+ <div class="bg-panel p-2 rounded text-sm"><div class="font-medium">{contact.email}</div>- <div class="text-text-secondary">ID: {contact.id}</div>+ <div class="text-ink-muted">ID: {contact.id}</div></div>)}/>@@ -110,9 +110,9 @@ const DataDebug: Component = () => {title="useHistoryQuery()"data={historyQuery.data ?? []}renderItem={(item) => (- <div class="bg-surface-secondary p-2 rounded text-sm">+ <div class="bg-panel p-2 rounded text-sm"><div class="font-medium">{item.name}</div>- <div class="text-text-secondary">+ <div class="text-ink-muted">ID: {item.id} | Type: {item.type}</div></div>diff --git a/apps/web/src/lib/core/internal/ThemeDebug.tsx b/apps/web/src/lib/core/internal/ThemeDebug.tsxindex de128b6555..17cd7844eb 100644--- a/apps/web/src/lib/core/internal/ThemeDebug.tsx+++ b/apps/web/src/lib/core/internal/ThemeDebug.tsx@@ -27,17 +27,17 @@ const BUTTON_SIZES = ['sm', 'md', 'lg'] as const;function ThemeDebug() {return (- <div class="size-full overflow-auto bg-surface p-6">+ <div class="size-full overflow-auto p-6"><div class="flex flex-col gap-8 max-w-6xl mx-auto"><h1 class="text-2xl font-bold text-ink">Theme Debug</h1>{/* Panel Depths Section */}<section class="flex flex-col gap-4">- <h2 class="text-xl font-semibold text-ink">Panel Depths (0-5)</h2>+ <h2 class="text-xl font-semibold text-ink">Panel Depths (0-4)</h2><div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">- <For each={[0, 1, 2, 3, 4, 5] as const}>+ <For each={[0, 1, 2, 3, 4] as const}>{(depth) => (- <Panel depth={depth} class="min-h-40">+ <Panel depth={depth} class="min-h-40 bg-surface"><Panel.Header><span class="text-sm font-medium text-ink">Depth {depth}@@ -53,19 +53,16 @@ function ThemeDebug() {{/* Nested panels to show depth hierarchy */}<h3 class="text-lg font-medium text-ink mt-4">Nested Panel Depths</h3>- <Panel depth={0} class="p-4">+ <Panel depth={0} class="bg-surface p-4"><p class="text-xs text-ink-muted mb-2">Depth 0</p>- <Panel depth={1} class="p-4">+ <Panel depth={1} class="bg-surface p-4"><p class="text-xs text-ink-muted mb-2">Depth 1</p>- <Panel depth={2} class="p-4">+ <Panel depth={2} class="bg-surface p-4"><p class="text-xs text-ink-muted mb-2">Depth 2</p>- <Panel depth={3} class="p-4">+ <Panel depth={3} class="bg-surface p-4"><p class="text-xs text-ink-muted mb-2">Depth 3</p>- <Panel depth={4} class="p-4">- <p class="text-xs text-ink-muted mb-2">Depth 4</p>- <Panel depth={5} class="p-4">- <p class="text-xs text-ink-muted">Depth 5 (innermost)</p>- </Panel>+ <Panel depth={4} class="bg-surface p-4">+ <p class="text-xs text-ink-muted">Depth 4 (innermost)</p></Panel></Panel></Panel>@@ -77,12 +74,12 @@ function ThemeDebug() {<section class="flex flex-col gap-4"><h2 class="text-xl font-semibold text-ink">Active Panels</h2><p class="text-sm text-ink-muted">- Panels with the `active` prop show an accent border gradient.+ Panels with the `active` prop show the active focus ring.</p><div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"><For each={[1, 2, 3] as const}>{(depth) => (- <Panel depth={depth} class="min-h-32">+ <Panel active depth={depth} class="min-h-32 bg-surface"><Panel.Header><span class="text-sm font-medium text-ink">Active Depth {depth}@@ -90,7 +87,7 @@ function ThemeDebug() {</Panel.Header><Panel.Body class="p-4"><p class="text-sm text-ink-muted">- Active panel with accent styling+ Active panel using its layer-relative surface</p></Panel.Body></Panel>@@ -309,7 +306,7 @@ function ThemeDebug() {<div class="grid grid-cols-1 md:grid-cols-2 gap-4"><For each={[1, 2, 3, 4] as const}>{(depth) => (- <Panel depth={depth}>+ <Panel depth={depth} class="bg-surface"><Panel.Header><span class="text-sm font-medium text-ink">Panel Depth {depth}