@adea-ai/ui 0.128.3 → 0.129.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The no-flash boot script, importable where there is no UI runtime.
3
+ *
4
+ * `themeScript` writes the document attributes before first paint. A host that
5
+ * renders its HTML at build time (a Vite `index.html` served by a desktop shell
6
+ * whose CSP allows no inline script) needs the string in Node, and the provider
7
+ * entries cannot be imported there: they load Solid's client runtime. This entry
8
+ * holds only the script and the types it takes, so it loads anywhere.
9
+ */
10
+ export { inlineScriptLiteral, themeScript, type ThemeScriptOptions } from './theme-script';
11
+ export type { ThemeStorageSchema } from './theme-persistence';
12
+ //# sourceMappingURL=script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../../src/components/theme/script.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAC1F,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { inlineScriptLiteral, themeScript } from "./theme-script.js";
2
+ export { inlineScriptLiteral, themeScript };
package/dist/index.js CHANGED
@@ -108,7 +108,8 @@ import { isCustomAccent, normalizeCustomAccent, paintAccentRoles, resolveAccentR
108
108
  import { isThemeAccentId } from "./lib/theme-accents.js";
109
109
  import { terminalCssVariables, tokensAsHex } from "./lib/theme-css.js";
110
110
  import { defaultDarkThemeId, defaultLightThemeId, resolveVariant } from "./lib/theme-defaults.js";
111
- import { appearancePreviewThemes, builtinThemes, contrastRatio, editorPaletteFor, resolveAccentPreset, themeAccentsFor, themeById, themeCssVariables, themeFamilies, themeRecordById, themeRecords, themesForAppearance, validateTheme, validateThemeRegistry, variantFromRecord, withAccent } from "./lib/themes.js";
111
+ import { variantFromRecord } from "./lib/theme-records.js";
112
+ import { appearancePreviewThemes, builtinThemes, contrastRatio, editorPaletteFor, resolveAccentPreset, themeAccentsFor, themeById, themeCssVariables, themeFamilies, themeRecordById, themeRecords, themesForAppearance, validateTheme, validateThemeRegistry, withAccent } from "./lib/themes.js";
112
113
  import { APPEARANCE_EDITOR_FONT_AXES, APPEARANCE_EDITOR_FONT_SIZE_MAX, APPEARANCE_EDITOR_FONT_SIZE_MIN, DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS, applyAppearanceFontSettings, fontSettingsBootstrapScript, normalizeAppearanceEditorFontSettings, normalizeAppearanceEditorFontSize } from "./lib/appearance-font-settings.js";
113
114
  import { AppearanceFontSettingsGroup } from "./components/composites/appearance-editor/font-settings-group.js";
114
115
  import { ThemePicker, ThemePreview, ThemeSwatch } from "./components/theme/theme-picker.js";
@@ -23,4 +23,13 @@ export type AccentPreset = {
23
23
  dark?: string;
24
24
  };
25
25
  export declare const accentPresets: readonly AccentPreset[];
26
+ /**
27
+ * The six brand accent presets, in the order a picker should show them: the list
28
+ * `accentPresets` carries after its own `theme` entry.
29
+ *
30
+ * Here and not beside the theme table in `lib/themes.ts` (which re-exports it, so
31
+ * `@adea-ai/ui/lib/themes` still has it) because a bundler places a module whole, and
32
+ * a host that wants only the list should not ship the 34-theme catalogue with it.
33
+ */
34
+ export declare const accents: readonly import("@adea-ai/themes").AccentPreset[];
26
35
  //# sourceMappingURL=accent-presets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accent-presets.d.ts","sourceRoot":"","sources":["../../src/lib/accent-presets.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAA;IACnB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,YAAY,EAQ/C,CAAA"}
1
+ {"version":3,"file":"accent-presets.d.ts","sourceRoot":"","sources":["../../src/lib/accent-presets.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAA;IACnB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,YAAY,EAQ/C,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,mDAAU,CAAA"}
@@ -5,7 +5,16 @@ var accentPresets = Object.freeze([{
5
5
  label: "Theme",
6
6
  description: "The variant's own primary. Neutral in adea's palette, so the interface stays monochrome."
7
7
  }, ...ACCENTS]);
8
+ /**
9
+ * The six brand accent presets, in the order a picker should show them: the list
10
+ * `accentPresets` carries after its own `theme` entry.
11
+ *
12
+ * Here and not beside the theme table in `lib/themes.ts` (which re-exports it, so
13
+ * `@adea-ai/ui/lib/themes` still has it) because a bundler places a module whole, and
14
+ * a host that wants only the list should not ship the 34-theme catalogue with it.
15
+ */
16
+ var accents = ACCENTS;
8
17
  //#endregion
9
- export { accentPresets };
18
+ export { accentPresets, accents };
10
19
 
11
20
  //# sourceMappingURL=accent-presets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accent-presets.js","names":[],"sources":["../../src/lib/accent-presets.ts"],"sourcesContent":["import { ACCENTS } from '@adea-ai/themes'\n\n/*\n * Its own module so the theme provider's start-up path (the stored-preference reader\n * and the boot script both need the preset ids) does not import the token manifest in\n * `tokens.ts`, which is 20 KB of documentation data a provider never reads.\n * `tokens.ts` re-exports both names, so every existing import keeps working.\n */\n\n/**\n * The accent axis.\n *\n * adea's accent presets, as a selection rather than a constant. `theme` is the\n * default and means \"the variant's own primary\" — monochrome in adea's palette —\n * and each named preset overrides the interactive roles through the\n * `[data-accent]` blocks in `theme.css`.\n *\n * These are the same six presets `accentPresets` exports in adea's own\n * `appearance.ts`, and the values match. A consumer's appearance picker and the\n * workshop's theme toolbar read this one list, so the two cannot disagree about\n * what a preset is called or what colour it is.\n */\nexport type AccentPreset = {\n /** The `data-accent` value. `theme` is the variant's own primary. */\n id: string\n label: string\n /** What the preset is for, in the gallery and in a picker. */\n description: string\n /** The accent as it appears in the light theme. Absent for `theme`. */\n light?: string\n /** The accent as it appears in the dark theme. Absent for `theme`. */\n dark?: string\n}\n\nexport const accentPresets: readonly AccentPreset[] = Object.freeze([\n {\n id: 'theme',\n label: 'Theme',\n description:\n \"The variant's own primary. Neutral in adea's palette, so the interface stays monochrome.\",\n },\n ...ACCENTS,\n])\n"],"mappings":";;AAkCA,IAAa,gBAAyC,OAAO,OAAO,CAClE;CACE,IAAI;CACJ,OAAO;CACP,aACE;AACJ,GACA,GAAG,OACL,CAAC"}
1
+ {"version":3,"file":"accent-presets.js","names":[],"sources":["../../src/lib/accent-presets.ts"],"sourcesContent":["import { ACCENTS } from '@adea-ai/themes'\n\n/*\n * Its own module so the theme provider's start-up path (the stored-preference reader\n * and the boot script both need the preset ids) does not import the token manifest in\n * `tokens.ts`, which is 20 KB of documentation data a provider never reads.\n * `tokens.ts` re-exports `accentPresets` and `AccentPreset`, and `themes.ts` re-exports\n * `accents`, so every existing import keeps working.\n */\n\n/**\n * The accent axis.\n *\n * adea's accent presets, as a selection rather than a constant. `theme` is the\n * default and means \"the variant's own primary\" — monochrome in adea's palette —\n * and each named preset overrides the interactive roles through the\n * `[data-accent]` blocks in `theme.css`.\n *\n * These are the same six presets `accentPresets` exports in adea's own\n * `appearance.ts`, and the values match. A consumer's appearance picker and the\n * workshop's theme toolbar read this one list, so the two cannot disagree about\n * what a preset is called or what colour it is.\n */\nexport type AccentPreset = {\n /** The `data-accent` value. `theme` is the variant's own primary. */\n id: string\n label: string\n /** What the preset is for, in the gallery and in a picker. */\n description: string\n /** The accent as it appears in the light theme. Absent for `theme`. */\n light?: string\n /** The accent as it appears in the dark theme. Absent for `theme`. */\n dark?: string\n}\n\nexport const accentPresets: readonly AccentPreset[] = Object.freeze([\n {\n id: 'theme',\n label: 'Theme',\n description:\n \"The variant's own primary. Neutral in adea's palette, so the interface stays monochrome.\",\n },\n ...ACCENTS,\n])\n\n/**\n * The six brand accent presets, in the order a picker should show them: the list\n * `accentPresets` carries after its own `theme` entry.\n *\n * Here and not beside the theme table in `lib/themes.ts` (which re-exports it, so\n * `@adea-ai/ui/lib/themes` still has it) because a bundler places a module whole, and\n * a host that wants only the list should not ship the 34-theme catalogue with it.\n */\nexport const accents = ACCENTS\n"],"mappings":";;AAmCA,IAAa,gBAAyC,OAAO,OAAO,CAClE;CACE,IAAI;CACJ,OAAO;CACP,aACE;AACJ,GACA,GAAG,OACL,CAAC;;;;;;;;;AAUD,IAAa,UAAU"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * One catalogue record, as this system's {@link ThemeVariant}.
3
+ *
4
+ * `variantFromRecord` and the lazy form the catalogue is built with live here, and not
5
+ * beside the 34-theme table in `lib/themes.ts`, because a bundler places a module
6
+ * whole: a host that imports `variantFromRecord` from the same module as the table
7
+ * ships the table with it. This module reads a record it is handed and imports no
8
+ * catalogue, so a start-up path that only turns a stored record into a variant
9
+ * (an imported theme, a reconstruction) stays small. `lib/themes.ts` re-exports
10
+ * `variantFromRecord`, so `@adea-ai/ui/lib/themes` keeps working; the lazy start-up
11
+ * gate (`check:theme-startup`) holds the split in place.
12
+ *
13
+ * It does import `@adea-ai/themes` for the projection helpers (`chartSeries`,
14
+ * `tint`, `shadcnVariables`…), none of which reads the table of themes.
15
+ */
16
+ import { type AdeaThemeRecord } from '@adea-ai/themes';
17
+ import type { ThemeVariant } from './themes';
18
+ /**
19
+ * The design system's view of one catalogue record, built in full and at once.
20
+ *
21
+ * For a host that holds a record the catalogue does not — an imported theme, a
22
+ * reconstruction from stored data — and wants a variant it can hand to
23
+ * `ThemeProvider`'s `themes`. It throws for a record the shadcn projection cannot
24
+ * map, here and now, rather than on first paint. The catalogue itself goes through
25
+ * {@link lazyVariantFromRecord} instead.
26
+ */
27
+ export declare function variantFromRecord(theme: AdeaThemeRecord): ThemeVariant;
28
+ /**
29
+ * {@link variantFromRecord} with the four derived palettes built on first read.
30
+ *
31
+ * Evaluating this module used to project all 34 catalogue themes up front, about
32
+ * 155 ms before a single one was needed, on the hydration path of every consumer.
33
+ * A page paints one variant, and a picker's labels and appearance are plain
34
+ * fields, so only a variant whose `colors`, `terminal`, `editor` or `chart` is read
35
+ * pays for them, once. The properties stay enumerable data-shaped accessors, so
36
+ * spreading, `Object.entries` and JSON see the same object they always did.
37
+ */
38
+ export declare function lazyVariantFromRecord(theme: AdeaThemeRecord): ThemeVariant;
39
+ //# sourceMappingURL=theme-records.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-records.d.ts","sourceRoot":"","sources":["../../src/lib/theme-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAA;AAExB,OAAO,KAAK,EAKV,YAAY,EACb,MAAM,UAAU,CAAA;AAuGjB;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CActE;AAoBD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAkB1E"}
@@ -0,0 +1,178 @@
1
+ import { chartSeries, shadcnDestructiveProjection, statusForeground, syntaxRoles, tint } from "@adea-ai/themes";
2
+ import { shadcnVariables } from "@adea-ai/themes/adapters/shadcn";
3
+ //#region src/lib/theme-records.ts
4
+ /**
5
+ * One catalogue record, as this system's {@link ThemeVariant}.
6
+ *
7
+ * `variantFromRecord` and the lazy form the catalogue is built with live here, and not
8
+ * beside the 34-theme table in `lib/themes.ts`, because a bundler places a module
9
+ * whole: a host that imports `variantFromRecord` from the same module as the table
10
+ * ships the table with it. This module reads a record it is handed and imports no
11
+ * catalogue, so a start-up path that only turns a stored record into a variant
12
+ * (an imported theme, a reconstruction) stays small. `lib/themes.ts` re-exports
13
+ * `variantFromRecord`, so `@adea-ai/ui/lib/themes` keeps working; the lazy start-up
14
+ * gate (`check:theme-startup`) holds the split in place.
15
+ *
16
+ * It does import `@adea-ai/themes` for the projection helpers (`chartSeries`,
17
+ * `tint`, `shadcnVariables`…), none of which reads the table of themes.
18
+ */
19
+ /**
20
+ * The shadcn-vocabulary roles of one catalogue entry.
21
+ *
22
+ * The expensive half of a variant: `shadcnVariables` projects the whole palette
23
+ * (about 4 ms a theme), which is why {@link lazyVariantFromRecord} defers it.
24
+ */
25
+ function colorsOf(theme) {
26
+ const projected = shadcnVariables(theme);
27
+ const token = (name) => {
28
+ const value = projected[`--${name}`];
29
+ if (!value) throw new Error(`${theme.id} has no shared shadcn projection for --${name}`);
30
+ return value;
31
+ };
32
+ const destructiveAction = shadcnDestructiveProjection(theme);
33
+ return {
34
+ background: token("background"),
35
+ foreground: token("foreground"),
36
+ card: token("card"),
37
+ cardForeground: token("card-foreground"),
38
+ popover: token("popover"),
39
+ popoverForeground: token("popover-foreground"),
40
+ primary: token("primary"),
41
+ primaryForeground: token("primary-foreground"),
42
+ secondary: token("secondary"),
43
+ secondaryForeground: token("secondary-foreground"),
44
+ muted: token("muted"),
45
+ mutedForeground: token("muted-foreground"),
46
+ accent: token("accent"),
47
+ accentForeground: token("accent-foreground"),
48
+ destructive: theme.colors.error,
49
+ destructiveForeground: statusForeground(theme, "error"),
50
+ destructiveSubtle: tint(theme.colors.error, theme.colors.background),
51
+ destructiveAction: destructiveAction.fill,
52
+ destructiveActionForeground: destructiveAction.foreground,
53
+ success: token("success"),
54
+ successForeground: statusForeground(theme, "success"),
55
+ successSubtle: tint(theme.colors.success, theme.colors.background),
56
+ warning: token("warning"),
57
+ warningForeground: statusForeground(theme, "warning"),
58
+ warningSubtle: tint(theme.colors.warning, theme.colors.background),
59
+ info: token("info"),
60
+ infoForeground: statusForeground(theme, "info"),
61
+ infoSubtle: tint(theme.colors.info, theme.colors.background),
62
+ border: token("border"),
63
+ input: token("input"),
64
+ ring: token("ring"),
65
+ sidebar: token("sidebar"),
66
+ sidebarForeground: token("sidebar-foreground"),
67
+ sidebarAccent: token("sidebar-accent"),
68
+ sidebarBorder: token("sidebar-border"),
69
+ sidebarMutedForeground: token("sidebar-muted-foreground")
70
+ };
71
+ }
72
+ function terminalOf(theme) {
73
+ return {
74
+ background: theme.colors.background,
75
+ foreground: theme.colors.foreground,
76
+ cursor: theme.cursor,
77
+ selection: theme.selection,
78
+ ...theme.ansi
79
+ };
80
+ }
81
+ function editorOf(theme) {
82
+ const syntax = syntaxRoles(theme);
83
+ return {
84
+ keyword: syntax.keyword,
85
+ string: syntax.string,
86
+ number: syntax.number,
87
+ comment: syntax.comment,
88
+ function: syntax.function,
89
+ variable: syntax.variable,
90
+ type: syntax.type,
91
+ tag: syntax.tag,
92
+ attribute: syntax.attribute,
93
+ operator: syntax.operator,
94
+ heading: syntax.heading,
95
+ link: syntax.link,
96
+ diffAdd: syntax.diffAdd,
97
+ diffDelete: syntax.diffDelete,
98
+ diffHunk: syntax.diffHunk,
99
+ searchMatch: syntax.searchMatch
100
+ };
101
+ }
102
+ function provenanceOf(theme) {
103
+ return {
104
+ source: theme.provenance.project,
105
+ url: theme.provenance.url,
106
+ license: theme.provenance.license
107
+ };
108
+ }
109
+ /**
110
+ * The design system's view of one catalogue record, built in full and at once.
111
+ *
112
+ * For a host that holds a record the catalogue does not — an imported theme, a
113
+ * reconstruction from stored data — and wants a variant it can hand to
114
+ * `ThemeProvider`'s `themes`. It throws for a record the shadcn projection cannot
115
+ * map, here and now, rather than on first paint. The catalogue itself goes through
116
+ * {@link lazyVariantFromRecord} instead.
117
+ */
118
+ function variantFromRecord(theme) {
119
+ return {
120
+ id: theme.id,
121
+ family: theme.family,
122
+ familyLabel: theme.familyLabel,
123
+ label: theme.label,
124
+ appearance: theme.appearance,
125
+ description: theme.description,
126
+ colors: colorsOf(theme),
127
+ terminal: terminalOf(theme),
128
+ editor: editorOf(theme),
129
+ chart: chartSeries(theme),
130
+ provenance: provenanceOf(theme)
131
+ };
132
+ }
133
+ /** Runs `build` on first call and returns that value from then on. A throw is not cached. */
134
+ function once(build) {
135
+ let built = false;
136
+ let value;
137
+ return () => {
138
+ if (!built) {
139
+ value = build();
140
+ built = true;
141
+ }
142
+ return value;
143
+ };
144
+ }
145
+ var lazy = (build) => ({
146
+ get: once(build),
147
+ enumerable: true
148
+ });
149
+ /**
150
+ * {@link variantFromRecord} with the four derived palettes built on first read.
151
+ *
152
+ * Evaluating this module used to project all 34 catalogue themes up front, about
153
+ * 155 ms before a single one was needed, on the hydration path of every consumer.
154
+ * A page paints one variant, and a picker's labels and appearance are plain
155
+ * fields, so only a variant whose `colors`, `terminal`, `editor` or `chart` is read
156
+ * pays for them, once. The properties stay enumerable data-shaped accessors, so
157
+ * spreading, `Object.entries` and JSON see the same object they always did.
158
+ */
159
+ function lazyVariantFromRecord(theme) {
160
+ return Object.defineProperties({
161
+ id: theme.id,
162
+ family: theme.family,
163
+ familyLabel: theme.familyLabel,
164
+ label: theme.label,
165
+ appearance: theme.appearance,
166
+ description: theme.description,
167
+ provenance: provenanceOf(theme)
168
+ }, {
169
+ colors: lazy(() => colorsOf(theme)),
170
+ terminal: lazy(() => terminalOf(theme)),
171
+ editor: lazy(() => editorOf(theme)),
172
+ chart: lazy(() => chartSeries(theme))
173
+ });
174
+ }
175
+ //#endregion
176
+ export { lazyVariantFromRecord, variantFromRecord };
177
+
178
+ //# sourceMappingURL=theme-records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-records.js","names":[],"sources":["../../src/lib/theme-records.ts"],"sourcesContent":["/**\n * One catalogue record, as this system's {@link ThemeVariant}.\n *\n * `variantFromRecord` and the lazy form the catalogue is built with live here, and not\n * beside the 34-theme table in `lib/themes.ts`, because a bundler places a module\n * whole: a host that imports `variantFromRecord` from the same module as the table\n * ships the table with it. This module reads a record it is handed and imports no\n * catalogue, so a start-up path that only turns a stored record into a variant\n * (an imported theme, a reconstruction) stays small. `lib/themes.ts` re-exports\n * `variantFromRecord`, so `@adea-ai/ui/lib/themes` keeps working; the lazy start-up\n * gate (`check:theme-startup`) holds the split in place.\n *\n * It does import `@adea-ai/themes` for the projection helpers (`chartSeries`,\n * `tint`, `shadcnVariables`…), none of which reads the table of themes.\n */\nimport {\n chartSeries,\n shadcnDestructiveProjection,\n statusForeground,\n syntaxRoles,\n tint,\n type AdeaThemeRecord,\n} from '@adea-ai/themes'\nimport { shadcnVariables } from '@adea-ai/themes/adapters/shadcn'\nimport type {\n ThemeColors,\n ThemeEditorPalette,\n ThemeProvenance,\n ThemeTerminalPalette,\n ThemeVariant,\n} from './themes'\n\n/**\n * The shadcn-vocabulary roles of one catalogue entry.\n *\n * The expensive half of a variant: `shadcnVariables` projects the whole palette\n * (about 4 ms a theme), which is why {@link lazyVariantFromRecord} defers it.\n */\nfunction colorsOf(theme: AdeaThemeRecord): ThemeColors {\n const projected = shadcnVariables(theme)\n const token = (name: string): string => {\n const value = projected[`--${name}`]\n if (!value) throw new Error(`${theme.id} has no shared shadcn projection for --${name}`)\n return value\n }\n const destructiveAction = shadcnDestructiveProjection(theme)\n return {\n background: token('background'),\n foreground: token('foreground'),\n card: token('card'),\n cardForeground: token('card-foreground'),\n popover: token('popover'),\n popoverForeground: token('popover-foreground'),\n primary: token('primary'),\n primaryForeground: token('primary-foreground'),\n secondary: token('secondary'),\n secondaryForeground: token('secondary-foreground'),\n muted: token('muted'),\n mutedForeground: token('muted-foreground'),\n accent: token('accent'),\n accentForeground: token('accent-foreground'),\n // Preserve the UI's semantic error token. The Themes projection uses its\n // contrast-safe solid-action fill for --destructive; UI keeps that fill in\n // the separate destructiveAction pair below.\n destructive: theme.colors.error,\n destructiveForeground: statusForeground(theme, 'error'),\n destructiveSubtle: tint(theme.colors.error, theme.colors.background),\n destructiveAction: destructiveAction.fill,\n destructiveActionForeground: destructiveAction.foreground,\n success: token('success'),\n successForeground: statusForeground(theme, 'success'),\n successSubtle: tint(theme.colors.success, theme.colors.background),\n warning: token('warning'),\n warningForeground: statusForeground(theme, 'warning'),\n warningSubtle: tint(theme.colors.warning, theme.colors.background),\n info: token('info'),\n infoForeground: statusForeground(theme, 'info'),\n infoSubtle: tint(theme.colors.info, theme.colors.background),\n border: token('border'),\n input: token('input'),\n ring: token('ring'),\n sidebar: token('sidebar'),\n sidebarForeground: token('sidebar-foreground'),\n sidebarAccent: token('sidebar-accent'),\n sidebarBorder: token('sidebar-border'),\n sidebarMutedForeground: token('sidebar-muted-foreground'),\n }\n}\n\n// The embedded terminal uses the theme's own canvas rather than a palette of its\n// own. The ANSI colours came from the palette that produced the canvas, so they\n// were chosen against it; a terminal on a different background would be the one\n// surface in the application not lit by the active theme.\nfunction terminalOf(theme: AdeaThemeRecord): ThemeTerminalPalette {\n return {\n background: theme.colors.background,\n foreground: theme.colors.foreground,\n cursor: theme.cursor,\n selection: theme.selection,\n ...theme.ansi,\n }\n}\n\nfunction editorOf(theme: AdeaThemeRecord): ThemeEditorPalette {\n const syntax = syntaxRoles(theme)\n return {\n keyword: syntax.keyword,\n string: syntax.string,\n number: syntax.number,\n comment: syntax.comment,\n function: syntax.function,\n variable: syntax.variable,\n type: syntax.type,\n tag: syntax.tag,\n attribute: syntax.attribute,\n operator: syntax.operator,\n heading: syntax.heading,\n link: syntax.link,\n diffAdd: syntax.diffAdd,\n diffDelete: syntax.diffDelete,\n diffHunk: syntax.diffHunk,\n searchMatch: syntax.searchMatch,\n }\n}\n\nfunction provenanceOf(theme: AdeaThemeRecord): ThemeProvenance {\n return {\n source: theme.provenance.project,\n url: theme.provenance.url,\n license: theme.provenance.license,\n }\n}\n\n/**\n * The design system's view of one catalogue record, built in full and at once.\n *\n * For a host that holds a record the catalogue does not — an imported theme, a\n * reconstruction from stored data — and wants a variant it can hand to\n * `ThemeProvider`'s `themes`. It throws for a record the shadcn projection cannot\n * map, here and now, rather than on first paint. The catalogue itself goes through\n * {@link lazyVariantFromRecord} instead.\n */\nexport function variantFromRecord(theme: AdeaThemeRecord): ThemeVariant {\n return {\n id: theme.id,\n family: theme.family,\n familyLabel: theme.familyLabel,\n label: theme.label,\n appearance: theme.appearance,\n description: theme.description,\n colors: colorsOf(theme),\n terminal: terminalOf(theme),\n editor: editorOf(theme),\n chart: chartSeries(theme),\n provenance: provenanceOf(theme),\n }\n}\n\n/** Runs `build` on first call and returns that value from then on. A throw is not cached. */\nfunction once<T>(build: () => T): () => T {\n let built = false\n let value: T\n return () => {\n if (!built) {\n value = build()\n built = true\n }\n return value\n }\n}\n\nconst lazy = <T>(build: () => T): PropertyDescriptor => ({\n get: once(build),\n enumerable: true,\n})\n\n/**\n * {@link variantFromRecord} with the four derived palettes built on first read.\n *\n * Evaluating this module used to project all 34 catalogue themes up front, about\n * 155 ms before a single one was needed, on the hydration path of every consumer.\n * A page paints one variant, and a picker's labels and appearance are plain\n * fields, so only a variant whose `colors`, `terminal`, `editor` or `chart` is read\n * pays for them, once. The properties stay enumerable data-shaped accessors, so\n * spreading, `Object.entries` and JSON see the same object they always did.\n */\nexport function lazyVariantFromRecord(theme: AdeaThemeRecord): ThemeVariant {\n return Object.defineProperties(\n {\n id: theme.id,\n family: theme.family,\n familyLabel: theme.familyLabel,\n label: theme.label,\n appearance: theme.appearance,\n description: theme.description,\n provenance: provenanceOf(theme),\n },\n {\n colors: lazy(() => colorsOf(theme)),\n terminal: lazy(() => terminalOf(theme)),\n editor: lazy(() => editorOf(theme)),\n chart: lazy(() => chartSeries(theme)),\n }\n ) as ThemeVariant\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAS,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AAK;CACf,YAAY;AACd;;;;;;;;;;;AAYA,SAAgB,sBAAsB,OAAsC;CAC1E,OAAO,OAAO,iBACZ;EACE,IAAI,MAAM;EACV,QAAQ,MAAM;EACd,aAAa,MAAM;EACnB,OAAO,MAAM;EACb,YAAY,MAAM;EAClB,aAAa,MAAM;EACnB,YAAY,aAAa,KAAK;CAChC,GACA;EACE,QAAQ,WAAW,SAAS,KAAK,CAAC;EAClC,UAAU,WAAW,WAAW,KAAK,CAAC;EACtC,QAAQ,WAAW,SAAS,KAAK,CAAC;EAClC,OAAO,WAAW,YAAY,KAAK,CAAC;CACtC,CACF;AACF"}
@@ -34,9 +34,11 @@
34
34
  */
35
35
  import { type AccentPreset, type AdeaTheme, type AdeaThemeRecord } from '@adea-ai/themes';
36
36
  import { type AccentRoles } from './accent-roles';
37
+ export { accents } from './accent-presets';
37
38
  export { isThemeAccentId } from './theme-accents';
38
39
  export { terminalCssVariables, tokensAsHex } from './theme-css';
39
40
  export { defaultDarkThemeId, defaultLightThemeId, resolveVariant } from './theme-defaults';
41
+ export { variantFromRecord } from './theme-records';
40
42
  export type ThemeAppearance = 'light' | 'dark';
41
43
  /**
42
44
  * The surface and text roles, in shadcn's vocabulary.
@@ -160,16 +162,6 @@ export type ThemeVariant = {
160
162
  */
161
163
  tokens?: Readonly<Record<string, string>>;
162
164
  };
163
- /**
164
- * The design system's view of one catalogue record, built in full and at once.
165
- *
166
- * For a host that holds a record the catalogue does not — an imported theme, a
167
- * reconstruction from stored data — and wants a variant it can hand to
168
- * `ThemeProvider`'s `themes`. It throws for a record the shadcn projection cannot
169
- * map, here and now, rather than on first paint. The catalogue itself goes through
170
- * {@link lazyVariant} instead.
171
- */
172
- export declare function variantFromRecord(theme: AdeaThemeRecord): ThemeVariant;
173
165
  /**
174
166
  * A variant's `--primary-subtle`: the tint over `var(--primary)` at the strength its
175
167
  * catalogue record measures (`primarySubtleAlpha`). A variant that is not in the
@@ -193,8 +185,6 @@ export declare function themeFamilies(): {
193
185
  label: string;
194
186
  themes: ThemeVariant[];
195
187
  }[];
196
- /** The accent presets, in the order a picker should show them. */
197
- export declare const accents: readonly AccentPreset[];
198
188
  /**
199
189
  * The canonical catalogue records, in catalogue order.
200
190
  *
@@ -1 +1 @@
1
- {"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/lib/themes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAiBL,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,eAAe,EAErB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAA+C,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAK9F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAE1F,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAA;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,MAAM,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,iBAAiB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AG;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAMD,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,EAAE,CAMjE;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CACnC,MAAM,GAAE,SAAS,YAAY,EAAkB,GAC9C,YAAY,EAAE,CAchB;AAED,kFAAkF;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
@@ -1,9 +1,10 @@
1
+ import { accents } from "./accent-presets.js";
1
2
  import { accentOverrideVariables, resolveAccentRoles } from "./accent-roles.js";
2
3
  import { isThemeAccentId } from "./theme-accents.js";
3
4
  import { terminalCssVariables, themeCssVariablesWith, tokensAsHex } from "./theme-css.js";
4
5
  import { defaultDarkThemeId, defaultLightThemeId, resolveVariant } from "./theme-defaults.js";
5
- import { ACCENTS, accentForeground, chartSeries, contrastRatio, editorRolesHex, getAccent, getTheme, hasTheme, primarySubtleCss, shadcnDestructiveProjection, statusForeground, syntaxRoles, themeAccentPresets, themes, themesByAppearance, tint, validateCatalogue } from "@adea-ai/themes";
6
- import { shadcnVariables } from "@adea-ai/themes/adapters/shadcn";
6
+ import { lazyVariantFromRecord, variantFromRecord } from "./theme-records.js";
7
+ import { accentForeground, contrastRatio, editorRolesHex, getAccent, getTheme, hasTheme, primarySubtleCss, themeAccentPresets, themes, themesByAppearance, validateCatalogue } from "@adea-ai/themes";
7
8
  //#region src/lib/themes.ts
8
9
  /**
9
10
  * The theme registry, now a bridge.
@@ -40,162 +41,6 @@ import { shadcnVariables } from "@adea-ai/themes/adapters/shadcn";
40
41
  * `surfaceHover`, which is what shadcn components actually use it for.
41
42
  */
42
43
  /**
43
- * The shadcn-vocabulary roles of one catalogue entry.
44
- *
45
- * The expensive half of a variant: `shadcnVariables` projects the whole palette
46
- * (about 4 ms a theme), which is why {@link lazyVariant} defers it.
47
- */
48
- function colorsOf(theme) {
49
- const projected = shadcnVariables(theme);
50
- const token = (name) => {
51
- const value = projected[`--${name}`];
52
- if (!value) throw new Error(`${theme.id} has no shared shadcn projection for --${name}`);
53
- return value;
54
- };
55
- const destructiveAction = shadcnDestructiveProjection(theme);
56
- return {
57
- background: token("background"),
58
- foreground: token("foreground"),
59
- card: token("card"),
60
- cardForeground: token("card-foreground"),
61
- popover: token("popover"),
62
- popoverForeground: token("popover-foreground"),
63
- primary: token("primary"),
64
- primaryForeground: token("primary-foreground"),
65
- secondary: token("secondary"),
66
- secondaryForeground: token("secondary-foreground"),
67
- muted: token("muted"),
68
- mutedForeground: token("muted-foreground"),
69
- accent: token("accent"),
70
- accentForeground: token("accent-foreground"),
71
- destructive: theme.colors.error,
72
- destructiveForeground: statusForeground(theme, "error"),
73
- destructiveSubtle: tint(theme.colors.error, theme.colors.background),
74
- destructiveAction: destructiveAction.fill,
75
- destructiveActionForeground: destructiveAction.foreground,
76
- success: token("success"),
77
- successForeground: statusForeground(theme, "success"),
78
- successSubtle: tint(theme.colors.success, theme.colors.background),
79
- warning: token("warning"),
80
- warningForeground: statusForeground(theme, "warning"),
81
- warningSubtle: tint(theme.colors.warning, theme.colors.background),
82
- info: token("info"),
83
- infoForeground: statusForeground(theme, "info"),
84
- infoSubtle: tint(theme.colors.info, theme.colors.background),
85
- border: token("border"),
86
- input: token("input"),
87
- ring: token("ring"),
88
- sidebar: token("sidebar"),
89
- sidebarForeground: token("sidebar-foreground"),
90
- sidebarAccent: token("sidebar-accent"),
91
- sidebarBorder: token("sidebar-border"),
92
- sidebarMutedForeground: token("sidebar-muted-foreground")
93
- };
94
- }
95
- function terminalOf(theme) {
96
- return {
97
- background: theme.colors.background,
98
- foreground: theme.colors.foreground,
99
- cursor: theme.cursor,
100
- selection: theme.selection,
101
- ...theme.ansi
102
- };
103
- }
104
- function editorOf(theme) {
105
- const syntax = syntaxRoles(theme);
106
- return {
107
- keyword: syntax.keyword,
108
- string: syntax.string,
109
- number: syntax.number,
110
- comment: syntax.comment,
111
- function: syntax.function,
112
- variable: syntax.variable,
113
- type: syntax.type,
114
- tag: syntax.tag,
115
- attribute: syntax.attribute,
116
- operator: syntax.operator,
117
- heading: syntax.heading,
118
- link: syntax.link,
119
- diffAdd: syntax.diffAdd,
120
- diffDelete: syntax.diffDelete,
121
- diffHunk: syntax.diffHunk,
122
- searchMatch: syntax.searchMatch
123
- };
124
- }
125
- function provenanceOf(theme) {
126
- return {
127
- source: theme.provenance.project,
128
- url: theme.provenance.url,
129
- license: theme.provenance.license
130
- };
131
- }
132
- /**
133
- * The design system's view of one catalogue record, built in full and at once.
134
- *
135
- * For a host that holds a record the catalogue does not — an imported theme, a
136
- * reconstruction from stored data — and wants a variant it can hand to
137
- * `ThemeProvider`'s `themes`. It throws for a record the shadcn projection cannot
138
- * map, here and now, rather than on first paint. The catalogue itself goes through
139
- * {@link lazyVariant} instead.
140
- */
141
- function variantFromRecord(theme) {
142
- return {
143
- id: theme.id,
144
- family: theme.family,
145
- familyLabel: theme.familyLabel,
146
- label: theme.label,
147
- appearance: theme.appearance,
148
- description: theme.description,
149
- colors: colorsOf(theme),
150
- terminal: terminalOf(theme),
151
- editor: editorOf(theme),
152
- chart: chartSeries(theme),
153
- provenance: provenanceOf(theme)
154
- };
155
- }
156
- /** Runs `build` on first call and returns that value from then on. A throw is not cached. */
157
- function once(build) {
158
- let built = false;
159
- let value;
160
- return () => {
161
- if (!built) {
162
- value = build();
163
- built = true;
164
- }
165
- return value;
166
- };
167
- }
168
- var lazy = (build) => ({
169
- get: once(build),
170
- enumerable: true
171
- });
172
- /**
173
- * {@link variantFromRecord} with the four derived palettes built on first read.
174
- *
175
- * Evaluating this module used to project all 34 catalogue themes up front, about
176
- * 155 ms before a single one was needed, on the hydration path of every consumer.
177
- * A page paints one variant, and a picker's labels and appearance are plain
178
- * fields, so only a variant whose `colors`, `terminal`, `editor` or `chart` is read
179
- * pays for them, once. The properties stay enumerable data-shaped accessors, so
180
- * spreading, `Object.entries` and JSON see the same object they always did.
181
- */
182
- function lazyVariant(theme) {
183
- return Object.defineProperties({
184
- id: theme.id,
185
- family: theme.family,
186
- familyLabel: theme.familyLabel,
187
- label: theme.label,
188
- appearance: theme.appearance,
189
- description: theme.description,
190
- provenance: provenanceOf(theme)
191
- }, {
192
- colors: lazy(() => colorsOf(theme)),
193
- terminal: lazy(() => terminalOf(theme)),
194
- editor: lazy(() => editorOf(theme)),
195
- chart: lazy(() => chartSeries(theme))
196
- });
197
- }
198
- /**
199
44
  * A variant's `--primary-subtle`: the tint over `var(--primary)` at the strength its
200
45
  * catalogue record measures (`primarySubtleAlpha`). A variant that is not in the
201
46
  * catalogue has nothing to measure, and gets its appearance's ceiling.
@@ -211,7 +56,7 @@ function primarySubtleFor(theme) {
211
56
  * from a consumer that imports only this module's catalogue-free helpers
212
57
  * (`tokensAsHex`, `isThemeAccentId`, `resolveVariant`…) and never reads it.
213
58
  */
214
- var builtinThemes = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ themes.map(lazyVariant));
59
+ var builtinThemes = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ themes.map(lazyVariantFromRecord));
215
60
  function themeById(id) {
216
61
  if (!hasTheme(id)) return void 0;
217
62
  return builtinThemes.find((theme) => theme.id === id);
@@ -235,8 +80,6 @@ function themeFamilies() {
235
80
  }
236
81
  return [...families.values()];
237
82
  }
238
- /** The accent presets, in the order a picker should show them. */
239
- var accents = ACCENTS;
240
83
  /**
241
84
  * The canonical catalogue records, in catalogue order.
242
85
  *