@adea-ai/themes 0.11.6 → 0.11.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/dist/accents.d.ts +19 -19
- package/dist/accents.d.ts.map +1 -1
- package/dist/accents.js +45 -93
- package/dist/accents.js.map +1 -1
- package/dist/adapters/base24.d.ts +21 -12
- package/dist/adapters/base24.d.ts.map +1 -1
- package/dist/adapters/base24.js +47 -72
- package/dist/adapters/base24.js.map +1 -1
- package/dist/adapters/css-variables.d.ts +29 -0
- package/dist/adapters/css-variables.d.ts.map +1 -0
- package/dist/adapters/css-variables.js +56 -0
- package/dist/adapters/css-variables.js.map +1 -0
- package/dist/adapters/css.d.ts +2 -4
- package/dist/adapters/css.d.ts.map +1 -1
- package/dist/adapters/css.js +7 -39
- package/dist/adapters/css.js.map +1 -1
- package/dist/adapters/shadcn.d.ts +8 -4
- package/dist/adapters/shadcn.d.ts.map +1 -1
- package/dist/adapters/shadcn.js +38 -57
- package/dist/adapters/shadcn.js.map +1 -1
- package/dist/adapters/shiki.d.ts +2 -10
- package/dist/adapters/shiki.d.ts.map +1 -1
- package/dist/adapters/shiki.js +16 -29
- package/dist/adapters/shiki.js.map +1 -1
- package/dist/adapters/tailwind.d.ts +3 -3
- package/dist/adapters/tailwind.d.ts.map +1 -1
- package/dist/adapters/tailwind.js +7 -28
- package/dist/adapters/tailwind.js.map +1 -1
- package/dist/adapters/xterm.d.ts.map +1 -1
- package/dist/adapters/xterm.js +9 -21
- package/dist/adapters/xterm.js.map +1 -1
- package/dist/base24-synthesis.d.ts +31 -0
- package/dist/base24-synthesis.d.ts.map +1 -0
- package/dist/base24-synthesis.js +25 -0
- package/dist/base24-synthesis.js.map +1 -0
- package/dist/derive.d.ts +1 -1
- package/dist/derive.d.ts.map +1 -1
- package/dist/derive.js +11 -26
- package/dist/derive.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/normalize.d.ts +0 -8
- package/dist/normalize.d.ts.map +1 -1
- package/dist/normalize.js +105 -232
- package/dist/normalize.js.map +1 -1
- package/dist/oklch.d.ts +4 -10
- package/dist/oklch.d.ts.map +1 -1
- package/dist/oklch.js +18 -38
- package/dist/oklch.js.map +1 -1
- package/dist/policy.d.ts +14 -4
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +16 -4
- package/dist/policy.js.map +1 -1
- package/dist/render.d.ts +30 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +74 -0
- package/dist/render.js.map +1 -0
- package/dist/schema.d.ts +2 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +2 -1
- package/dist/schema.js.map +1 -1
- package/dist/sources.d.ts +26 -33
- package/dist/sources.d.ts.map +1 -1
- package/dist/sources.js +136 -305
- package/dist/sources.js.map +1 -1
- package/dist/step-search.d.ts +10 -0
- package/dist/step-search.d.ts.map +1 -0
- package/dist/step-search.js +21 -0
- package/dist/step-search.js.map +1 -0
- package/dist/theme-token-projection-script.d.ts +2 -0
- package/dist/theme-token-projection-script.js +2 -0
- package/dist/theme-token-projection.d.ts +35 -0
- package/dist/theme-token-projection.d.ts.map +1 -0
- package/dist/theme-token-projection.js +79 -0
- package/dist/theme-token-projection.js.map +1 -0
- package/dist/validate.d.ts +12 -17
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +33 -55
- package/dist/validate.js.map +1 -1
- package/package.json +14 -4
- package/src/accents.ts +57 -96
- package/src/adapters/base24.ts +53 -75
- package/src/adapters/css-variables.ts +67 -0
- package/src/adapters/css.ts +9 -54
- package/src/adapters/shadcn.ts +34 -60
- package/src/adapters/shiki.ts +17 -30
- package/src/adapters/tailwind.ts +7 -37
- package/src/adapters/xterm.ts +9 -21
- package/src/base24-synthesis.ts +29 -0
- package/src/derive.ts +12 -27
- package/src/index.ts +6 -5
- package/src/normalize.ts +140 -267
- package/src/oklch.ts +23 -38
- package/src/policy.ts +18 -4
- package/src/render.ts +82 -0
- package/src/schema.ts +2 -1
- package/src/sources.ts +160 -330
- package/src/step-search.ts +25 -0
- package/src/theme-token-projection.ts +126 -0
- package/src/validate.ts +46 -66
package/dist/adapters/base24.js
CHANGED
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
* `base09` (orange) and `base0F` (brown) have no counterpart in the canonical
|
|
22
22
|
* schema: Adea has no "constant" or "deprecated" role, because a UI does not. On
|
|
23
23
|
* export they are re-derived from `red` and `yellow` by a fixed rotation, and
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* `getBase24Scheme` returns the vendored schemes for callers who need the
|
|
25
|
+
* originals byte-for-byte. Round-tripping is therefore lossless for every
|
|
26
26
|
* role Adea models, and explicitly approximate for the two it does not — rather
|
|
27
27
|
* than silently lossy, which is what an unnamed slot would have been.
|
|
28
28
|
*/
|
|
29
|
-
import { formatOklch, parseColor } from '../oklch.js';
|
|
29
|
+
import { formatOklch, parseColor, shiftLightness } from '../oklch.js';
|
|
30
|
+
import { PAST_CANVAS_STEPS, SYNTHESISED_HUES, pastCanvasDirection, rotateHue, } from '../base24-synthesis.js';
|
|
30
31
|
/** The twenty-four Base24 slots, in the order the specification lists them. */
|
|
31
32
|
export const BASE24_SLOTS = [
|
|
32
33
|
'base00',
|
|
@@ -57,9 +58,8 @@ export const BASE24_SLOTS = [
|
|
|
57
58
|
/**
|
|
58
59
|
* What each slot means, in the specification's own terms.
|
|
59
60
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* the mapping is right.
|
|
61
|
+
* The documentation a reader needs to check the mappings below against the
|
|
62
|
+
* specification.
|
|
63
63
|
*/
|
|
64
64
|
export const BASE24_SLOT_MEANING = Object.freeze({
|
|
65
65
|
base00: 'Background',
|
|
@@ -88,11 +88,11 @@ export const BASE24_SLOT_MEANING = Object.freeze({
|
|
|
88
88
|
base17: 'Bright magenta',
|
|
89
89
|
});
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
91
|
+
* ANSI role → Base24 slot.
|
|
92
92
|
*
|
|
93
|
-
* `black`, `white` and `
|
|
94
|
-
* the background and foreground slots do double duty. The
|
|
95
|
-
*
|
|
93
|
+
* `black`, `brightBlack`, `white` and `brightWhite` are absent because Base24 does
|
|
94
|
+
* not name them: the background and foreground slots do double duty. The
|
|
95
|
+
* normalizer decides those four; see its `buildAnsiRamp` note for why.
|
|
96
96
|
*/
|
|
97
97
|
export const BASE24_TO_ANSI = Object.freeze({
|
|
98
98
|
red: 'base08',
|
|
@@ -113,9 +113,11 @@ export const ANSI_TO_BASE24 = Object.freeze(Object.fromEntries(Object.entries(BA
|
|
|
113
113
|
/**
|
|
114
114
|
* How each semantic role is written back to a Base24 slot on export.
|
|
115
115
|
*
|
|
116
|
-
* The
|
|
117
|
-
*
|
|
118
|
-
*
|
|
116
|
+
* The accent and status roles are absent because their slots belong to the ANSI
|
|
117
|
+
* hues: `base08`–`base0E` are written from `BASE24_TO_ANSI`, the colours a terminal
|
|
118
|
+
* reads, not from the repaired UI roles. `base01` receives `black` rather than a
|
|
119
|
+
* role because an ANSI black that equals the background is invisible as foreground
|
|
120
|
+
* text — the defect the import side documents. The
|
|
119
121
|
* surface ladder has no Base24 slot at all, so it is deliberately absent here:
|
|
120
122
|
* Base24 cannot express it, and pretending otherwise by packing four rungs into
|
|
121
123
|
* `base01`/`base02` would make the export lie about what it preserves.
|
|
@@ -132,12 +134,12 @@ export const THEME_TO_BASE24 = Object.freeze({
|
|
|
132
134
|
text: 'base06',
|
|
133
135
|
textMuted: 'base04',
|
|
134
136
|
textSubtle: 'base03',
|
|
135
|
-
accent:
|
|
137
|
+
accent: undefined,
|
|
136
138
|
accentForeground: undefined,
|
|
137
|
-
success:
|
|
138
|
-
warning:
|
|
139
|
-
error:
|
|
140
|
-
info:
|
|
139
|
+
success: undefined,
|
|
140
|
+
warning: undefined,
|
|
141
|
+
error: undefined,
|
|
142
|
+
info: undefined,
|
|
141
143
|
});
|
|
142
144
|
/** Thrown when a palette is missing a slot or holds an unparseable colour. */
|
|
143
145
|
export class Base24ParseError extends Error {
|
|
@@ -164,17 +166,6 @@ export function parseBase24Palette(palette) {
|
|
|
164
166
|
}
|
|
165
167
|
return parsed;
|
|
166
168
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Rotates a hue by a fixed number of degrees.
|
|
169
|
-
*
|
|
170
|
-
* Used only for the two Base24 slots Adea has no role for. A rotation is chosen
|
|
171
|
-
* over an interpolation toward grey because both source colours are already
|
|
172
|
-
* saturated, and a rotation keeps saturation while moving the hue far enough to
|
|
173
|
-
* read as a distinct token.
|
|
174
|
-
*/
|
|
175
|
-
function rotateHue(color, degrees) {
|
|
176
|
-
return { ...color, h: (color.h + degrees + 360) % 360 };
|
|
177
|
-
}
|
|
178
169
|
/**
|
|
179
170
|
* Writes a theme back to Base24.
|
|
180
171
|
*
|
|
@@ -185,42 +176,27 @@ function rotateHue(color, degrees) {
|
|
|
185
176
|
*/
|
|
186
177
|
export function toBase24(theme, options = {}) {
|
|
187
178
|
const background = requireColor(theme.colors.background, 'background');
|
|
188
|
-
const
|
|
189
|
-
const yellow = requireColor(theme.ansi.yellow, 'ansi.yellow');
|
|
190
|
-
const text = requireColor(theme.colors.text, 'text');
|
|
191
|
-
const palette = {
|
|
192
|
-
base00: theme.colors.background,
|
|
179
|
+
const fixed = {
|
|
193
180
|
base01: theme.ansi.black,
|
|
194
181
|
base02: theme.selection,
|
|
195
|
-
base03: theme.colors.textSubtle,
|
|
196
|
-
base04: theme.colors.textMuted,
|
|
197
|
-
base05: theme.colors.foreground,
|
|
198
|
-
base06: theme.colors.text,
|
|
199
182
|
base07: theme.ansi.brightWhite,
|
|
200
|
-
base08: theme.ansi.red,
|
|
201
|
-
// Synthesised: Base24's constants/orange slot and its deprecated/brown slot
|
|
202
|
-
// have no Adea role. See the module header.
|
|
203
|
-
base09: formatOklch(rotateHue(red, -18)),
|
|
204
|
-
base0A: theme.ansi.yellow,
|
|
205
|
-
base0B: theme.ansi.green,
|
|
206
|
-
base0C: theme.ansi.cyan,
|
|
207
|
-
base0D: theme.ansi.blue,
|
|
208
|
-
base0E: theme.ansi.magenta,
|
|
209
|
-
base0F: formatOklch(rotateHue(yellow, 22)),
|
|
210
|
-
base10: formatOklch({ ...background, l: Math.max(0, background.l - 0.03) }),
|
|
211
|
-
base11: formatOklch({ ...background, l: Math.max(0, background.l - 0.06) }),
|
|
212
|
-
base12: theme.ansi.brightRed,
|
|
213
|
-
base13: theme.ansi.brightYellow,
|
|
214
|
-
base14: theme.ansi.brightGreen,
|
|
215
|
-
base15: theme.ansi.brightCyan,
|
|
216
|
-
base16: theme.ansi.brightBlue,
|
|
217
|
-
base17: theme.ansi.brightMagenta,
|
|
218
183
|
};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
184
|
+
for (const [role, slot] of Object.entries(THEME_TO_BASE24)) {
|
|
185
|
+
if (slot)
|
|
186
|
+
fixed[slot] = theme.colors[role];
|
|
187
|
+
}
|
|
188
|
+
const direction = pastCanvasDirection(theme.appearance);
|
|
189
|
+
for (const [slot, step] of Object.entries(PAST_CANVAS_STEPS)) {
|
|
190
|
+
fixed[slot] = formatOklch(shiftLightness(background, direction * step));
|
|
191
|
+
}
|
|
192
|
+
for (const [role, slot] of Object.entries(BASE24_TO_ANSI)) {
|
|
193
|
+
fixed[slot] = theme.ansi[role];
|
|
194
|
+
}
|
|
195
|
+
for (const [slot, { from, degrees }] of Object.entries(SYNTHESISED_HUES)) {
|
|
196
|
+
const source = requireColor(theme.ansi[from], `ansi.${from}`);
|
|
197
|
+
fixed[slot] = formatOklch(rotateHue(source, degrees));
|
|
198
|
+
}
|
|
199
|
+
const palette = Object.fromEntries(BASE24_SLOTS.map((slot) => [slot, fixed[slot]]));
|
|
224
200
|
return {
|
|
225
201
|
system: 'base24',
|
|
226
202
|
name: options.name ?? theme.name,
|
|
@@ -247,15 +223,6 @@ export function formatBase24Scheme(scheme) {
|
|
|
247
223
|
];
|
|
248
224
|
return `${lines.join('\n')}\n`;
|
|
249
225
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Reads the YAML dialect Base24 schemes are published in.
|
|
252
|
-
*
|
|
253
|
-
* Hand-written rather than pulled from a YAML library: the format is a fixed set
|
|
254
|
-
* of scalar keys, the package has no runtime dependencies and no build-time
|
|
255
|
-
* dependencies beyond the TypeScript compiler, and a general parser would accept
|
|
256
|
-
* documents this bridge cannot actually honour. Anything outside the specification
|
|
257
|
-
* is rejected loudly instead of being parsed into a half-scheme.
|
|
258
|
-
*/
|
|
259
226
|
/**
|
|
260
227
|
* A line with its trailing `#` comment removed.
|
|
261
228
|
*
|
|
@@ -266,7 +233,7 @@ export function formatBase24Scheme(scheme) {
|
|
|
266
233
|
* `js/polynomial-redos`, which is how it was found.
|
|
267
234
|
*
|
|
268
235
|
* A `#` is a comment marker only when whitespace precedes it and it is outside a
|
|
269
|
-
* quoted scalar.
|
|
236
|
+
* quoted scalar.
|
|
270
237
|
*/
|
|
271
238
|
function stripTrailingComment(line) {
|
|
272
239
|
const separator = line.indexOf(':');
|
|
@@ -295,6 +262,14 @@ function stripTrailingComment(line) {
|
|
|
295
262
|
}
|
|
296
263
|
return line;
|
|
297
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Reads the YAML dialect Base24 schemes are published in.
|
|
267
|
+
*
|
|
268
|
+
* Hand-written rather than pulled from a YAML library: the format is a fixed set
|
|
269
|
+
* of scalar keys, the package has no runtime dependencies, and a general parser would accept
|
|
270
|
+
* documents this bridge cannot actually honour. Anything outside the specification
|
|
271
|
+
* is rejected loudly instead of being parsed into a half-scheme.
|
|
272
|
+
*/
|
|
298
273
|
export function parseBase24Scheme(source) {
|
|
299
274
|
const scalars = new Map();
|
|
300
275
|
const palette = new Map();
|
|
@@ -309,7 +284,7 @@ export function parseBase24Scheme(source) {
|
|
|
309
284
|
const separator = line.indexOf(':');
|
|
310
285
|
if (separator === -1)
|
|
311
286
|
continue;
|
|
312
|
-
const key =
|
|
287
|
+
const key = line.slice(0, separator).trim();
|
|
313
288
|
const rawValue = line.slice(separator + 1).trim();
|
|
314
289
|
let value = rawValue.replace(/^["']|["']$/g, '');
|
|
315
290
|
if (rawValue.startsWith('"') && rawValue.endsWith('"')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base24.js","sourceRoot":"","sources":["../../src/adapters/base24.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"base24.js","sourceRoot":"","sources":["../../src/adapters/base24.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,GACV,MAAM,wBAAwB,CAAA;AAE/B,+EAA+E;AAC/E,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,QAAQ;CACA,CAAA;AAgBV;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAyC,MAAM,CAAC,MAAM,CAAC;IACrF,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,gDAAgD;IACxD,MAAM,EAAE,sBAAsB;IAC9B,MAAM,EAAE,sBAAsB;IAC9B,MAAM,EA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EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAC/B,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,gBAAgB,CAAC,4BAA4B,IAAI,EAAE,EAAE,IAAI,CAAC,CAAA;QAChF,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,gBAAgB,CAAC,oCAAoC,IAAI,KAAK,KAAK,EAAE,EAAE,IAAI,CAAC,CAAA;QACxF,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;IACxB,CAAC;IAED,OAAO;QACL,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE;QAC/B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,SAAS;QAC1C,OAAO;QACP,OAAO,EAAE,QAAQ;KAClB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The custom properties the CSS adapter writes, named once.
|
|
3
|
+
*
|
|
4
|
+
* `adapters/css.ts` writes their values and `adapters/tailwind.ts` points utilities at
|
|
5
|
+
* them, so a variable added here becomes both a property and a utility.
|
|
6
|
+
*/
|
|
7
|
+
import type { AdeaTheme } from '../schema.js';
|
|
8
|
+
/** camelCase to kebab-case, the way the property names read in CSS. */
|
|
9
|
+
export declare function kebab(name: string): string;
|
|
10
|
+
/** The full property name for an unprefixed variable. */
|
|
11
|
+
export declare function variableName(name: string, prefix: string): string;
|
|
12
|
+
export type CssVariable = {
|
|
13
|
+
/** The unprefixed name, e.g. `surface-elevated`. */
|
|
14
|
+
name: string;
|
|
15
|
+
value: (theme: AdeaTheme) => string;
|
|
16
|
+
};
|
|
17
|
+
/** The theme's own roles, plus its cursor and selection. */
|
|
18
|
+
export declare const CANONICAL_VARIABLES: readonly CssVariable[];
|
|
19
|
+
/**
|
|
20
|
+
* Variables computed from the roles: the ANSI colours, the chart series, the status
|
|
21
|
+
* fills and the text drawn on them, and the sunken surface.
|
|
22
|
+
*
|
|
23
|
+
* A status fill is the role at low strength against the canvas; its foreground is the
|
|
24
|
+
* theme's legible extreme for that fill, not the body text — see
|
|
25
|
+
* `derive.statusForeground`. The sunken surface is the one step below the canvas that
|
|
26
|
+
* a well or a code block sits in.
|
|
27
|
+
*/
|
|
28
|
+
export declare const DERIVED_VARIABLES: readonly CssVariable[];
|
|
29
|
+
//# sourceMappingURL=css-variables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-variables.d.ts","sourceRoot":"","sources":["../../src/adapters/css-variables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAI7C,uEAAuE;AACvE,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,MAAM,CAAA;CACpC,CAAA;AAED,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAOpD,CAAA;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,WAAW,EAoBlD,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The custom properties the CSS adapter writes, named once.
|
|
3
|
+
*
|
|
4
|
+
* `adapters/css.ts` writes their values and `adapters/tailwind.ts` points utilities at
|
|
5
|
+
* them, so a variable added here becomes both a property and a utility.
|
|
6
|
+
*/
|
|
7
|
+
import { ANSI_KEYS, THEME_COLOR_KEYS } from '../schema.js';
|
|
8
|
+
import { CHART_SERIES, STATUS_ROLES, chartSeries, statusForeground, tint } from '../derive.js';
|
|
9
|
+
/** camelCase to kebab-case, the way the property names read in CSS. */
|
|
10
|
+
export function kebab(name) {
|
|
11
|
+
return name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
12
|
+
}
|
|
13
|
+
/** The full property name for an unprefixed variable. */
|
|
14
|
+
export function variableName(name, prefix) {
|
|
15
|
+
return prefix ? `--${prefix}-${name}` : `--${name}`;
|
|
16
|
+
}
|
|
17
|
+
/** The theme's own roles, plus its cursor and selection. */
|
|
18
|
+
export const CANONICAL_VARIABLES = Object.freeze([
|
|
19
|
+
...THEME_COLOR_KEYS.map((key) => ({
|
|
20
|
+
name: kebab(key),
|
|
21
|
+
value: (theme) => theme.colors[key],
|
|
22
|
+
})),
|
|
23
|
+
{ name: 'cursor', value: (theme) => theme.cursor },
|
|
24
|
+
{ name: 'selection', value: (theme) => theme.selection },
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* Variables computed from the roles: the ANSI colours, the chart series, the status
|
|
28
|
+
* fills and the text drawn on them, and the sunken surface.
|
|
29
|
+
*
|
|
30
|
+
* A status fill is the role at low strength against the canvas; its foreground is the
|
|
31
|
+
* theme's legible extreme for that fill, not the body text — see
|
|
32
|
+
* `derive.statusForeground`. The sunken surface is the one step below the canvas that
|
|
33
|
+
* a well or a code block sits in.
|
|
34
|
+
*/
|
|
35
|
+
export const DERIVED_VARIABLES = Object.freeze([
|
|
36
|
+
...ANSI_KEYS.map((key) => ({
|
|
37
|
+
name: `ansi-${kebab(key)}`,
|
|
38
|
+
value: (theme) => theme.ansi[key],
|
|
39
|
+
})),
|
|
40
|
+
...CHART_SERIES.map((_, index) => ({
|
|
41
|
+
name: `chart-${index + 1}`,
|
|
42
|
+
value: (theme) => chartSeries(theme)[index],
|
|
43
|
+
})),
|
|
44
|
+
...STATUS_ROLES.flatMap((role) => [
|
|
45
|
+
{
|
|
46
|
+
name: `${role}-subtle`,
|
|
47
|
+
value: (theme) => tint(theme.colors[role], theme.colors.background),
|
|
48
|
+
},
|
|
49
|
+
{ name: `${role}-foreground`, value: (theme) => statusForeground(theme, role) },
|
|
50
|
+
]),
|
|
51
|
+
{
|
|
52
|
+
name: 'surface-sunken',
|
|
53
|
+
value: (theme) => tint(theme.colors.text, theme.colors.background, 0.03),
|
|
54
|
+
},
|
|
55
|
+
]);
|
|
56
|
+
//# sourceMappingURL=css-variables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-variables.js","sourceRoot":"","sources":["../../src/adapters/css-variables.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9F,uEAAuE;AACvE,MAAM,UAAU,KAAK,CAAC,IAAY;IAChC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AACvE,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAAc;IACvD,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAA;AACrD,CAAC;AAQD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAA2B,MAAM,CAAC,MAAM,CAAC;IACvE,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAChC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;QAChB,KAAK,EAAE,CAAC,KAAgB,EAAE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C,EAAE;KAC3F,CAAC;IACF;QACE,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,CAAC,KAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;KACpF;CACF,CAAC,CAAA"}
|
package/dist/adapters/css.d.ts
CHANGED
|
@@ -17,10 +17,8 @@
|
|
|
17
17
|
* ## What is derived rather than stored
|
|
18
18
|
*
|
|
19
19
|
* A handful of variables have no role in the canonical schema and are computed:
|
|
20
|
-
* the chart series (see `
|
|
21
|
-
* the ANSI variables.
|
|
22
|
-
* they are pure functions of the theme and caching them would put a second copy of
|
|
23
|
-
* the truth in the module.
|
|
20
|
+
* the chart series (see `derive.ts`), the status tints used behind status text, and
|
|
21
|
+
* the ANSI variables.
|
|
24
22
|
*
|
|
25
23
|
* ## Why `oklch()` strings and not hex
|
|
26
24
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/adapters/css.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/adapters/css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9D,mCAAmC;AACnC,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,wFAAwF;IACxF,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAID;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,QAAQ,CAAM,GACpD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASxB;AAED,gCAAgC;AAChC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,UAAe,GAAG,MAAM,CAQ3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,SAAS,SAAS,EAAE,EAC5B,OAAO,GAAE,UAAU,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAChD,MAAM,CAKR;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,eAAe,EAAE,MAAM,SAAiB,GAAG,MAAM,CAE5F"}
|
package/dist/adapters/css.js
CHANGED
|
@@ -17,10 +17,8 @@
|
|
|
17
17
|
* ## What is derived rather than stored
|
|
18
18
|
*
|
|
19
19
|
* A handful of variables have no role in the canonical schema and are computed:
|
|
20
|
-
* the chart series (see `
|
|
21
|
-
* the ANSI variables.
|
|
22
|
-
* they are pure functions of the theme and caching them would put a second copy of
|
|
23
|
-
* the truth in the module.
|
|
20
|
+
* the chart series (see `derive.ts`), the status tints used behind status text, and
|
|
21
|
+
* the ANSI variables.
|
|
24
22
|
*
|
|
25
23
|
* ## Why `oklch()` strings and not hex
|
|
26
24
|
*
|
|
@@ -30,16 +28,8 @@
|
|
|
30
28
|
* predictable result. Converted to hex on the way out, that composition would be
|
|
31
29
|
* an sRGB blend, which is what makes hand-mixed tints go muddy.
|
|
32
30
|
*/
|
|
33
|
-
import {
|
|
34
|
-
import { STATUS_ROLES, chartSeries, statusForeground, tint } from '../derive.js';
|
|
31
|
+
import { CANONICAL_VARIABLES, DERIVED_VARIABLES, kebab, variableName } from './css-variables.js';
|
|
35
32
|
const DEFAULT_PREFIX = 'adea';
|
|
36
|
-
function variableName(name, prefix) {
|
|
37
|
-
return prefix ? `--${prefix}-${name}` : `--${name}`;
|
|
38
|
-
}
|
|
39
|
-
/** camelCase to kebab-case, the way the property names read in CSS. */
|
|
40
|
-
function kebab(name) {
|
|
41
|
-
return name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
42
|
-
}
|
|
43
33
|
/**
|
|
44
34
|
* The literal roles, plus the derived ones.
|
|
45
35
|
*
|
|
@@ -48,32 +38,10 @@ function kebab(name) {
|
|
|
48
38
|
*/
|
|
49
39
|
export function themeCssVariables(theme, options = {}) {
|
|
50
40
|
const prefix = options.prefix ?? DEFAULT_PREFIX;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
variables[variableName('cursor', prefix)] = theme.cursor;
|
|
57
|
-
variables[variableName('selection', prefix)] = theme.selection;
|
|
58
|
-
if (!includeDerived)
|
|
59
|
-
return variables;
|
|
60
|
-
for (const key of ANSI_KEYS) {
|
|
61
|
-
variables[variableName(`ansi-${kebab(key)}`, prefix)] = theme.ansi[key];
|
|
62
|
-
}
|
|
63
|
-
chartSeries(theme).forEach((value, index) => {
|
|
64
|
-
variables[variableName(`chart-${index + 1}`, prefix)] = value;
|
|
65
|
-
});
|
|
66
|
-
// Status fills and the text that goes on them. The fill is the role at low
|
|
67
|
-
// strength against the canvas; the foreground is the theme's legible extreme for
|
|
68
|
-
// that fill, not the theme's body text — see `derive.statusForeground`.
|
|
69
|
-
for (const role of STATUS_ROLES) {
|
|
70
|
-
variables[variableName(`${role}-subtle`, prefix)] = tint(theme.colors[role], theme.colors.background);
|
|
71
|
-
variables[variableName(`${role}-foreground`, prefix)] = statusForeground(theme, role);
|
|
72
|
-
}
|
|
73
|
-
// A dimmer rule for tables and inner separators, and the surface one step below
|
|
74
|
-
// the canvas that a well or a code block sits in.
|
|
75
|
-
variables[variableName('surface-sunken', prefix)] = tint(theme.colors.text, theme.colors.background, 0.03);
|
|
76
|
-
return variables;
|
|
41
|
+
const variables = options.includeDerived === false
|
|
42
|
+
? CANONICAL_VARIABLES
|
|
43
|
+
: [...CANONICAL_VARIABLES, ...DERIVED_VARIABLES];
|
|
44
|
+
return Object.fromEntries(variables.map(({ name, value }) => [variableName(name, prefix), value(theme)]));
|
|
77
45
|
}
|
|
78
46
|
/** A CSS rule for one theme. */
|
|
79
47
|
export function themeCss(theme, options = {}) {
|
package/dist/adapters/css.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/adapters/css.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/adapters/css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAchG,MAAM,cAAc,GAAG,MAAM,CAAA;AAE7B;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAgB,EAChB,OAAO,GAA4C,EAAE;IAErD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,cAAc,CAAA;IAC/C,MAAM,SAAS,GACb,OAAO,CAAC,cAAc,KAAK,KAAK;QAC9B,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,CAAC,GAAG,mBAAmB,EAAE,GAAG,iBAAiB,CAAC,CAAA;IACpD,OAAO,MAAM,CAAC,WAAW,CACvB,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAC/E,CAAA;AACH,CAAC;AAED,gCAAgC;AAChC,MAAM,UAAU,QAAQ,CAAC,KAAgB,EAAE,OAAO,GAAe,EAAE;IACjE,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAA;IAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAA;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;IAEjE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAErF,OAAO,GAAG,QAAQ,OAAO,IAAI,KAAK,CAAA;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC1B,MAA4B,EAC5B,OAAO,GAAwC,EAAE;IAEjD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,YAAY,CAAA;IACnD,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,IAAI,SAAS,KAAK,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;SACzF,IAAI,CAAC,MAAM,CAAC,CAAA;AACjB,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,eAAe,CAAC,IAA2B,EAAE,MAAM,GAAG,cAAc;IAClF,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAA;AAC1C,CAAC"}
|
|
@@ -38,15 +38,19 @@ export interface ShadcnDestructiveProjection {
|
|
|
38
38
|
*
|
|
39
39
|
* A filled destructive button uses `--destructive/90` on hover. A foreground that
|
|
40
40
|
* clears the original fill can fall below AA when that color is alpha-composited
|
|
41
|
-
* over a light or dark surface.
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* margin
|
|
41
|
+
* over a light or dark surface. The canonical error color is untouched; the fill
|
|
42
|
+
* differs from it only in lightness, and the foreground clears 5:1 against the fill
|
|
43
|
+
* and against its 90% composite over the canvas and both card surfaces, as eight-bit
|
|
44
|
+
* sRGB. The margin over 4.5:1 protects the AA floor from browser quantization.
|
|
45
45
|
*/
|
|
46
46
|
export declare function shadcnDestructiveProjection(theme: ShadcnTheme): ShadcnDestructiveProjection;
|
|
47
47
|
/**
|
|
48
48
|
* Canonical role → shadcn custom-property name.
|
|
49
49
|
*
|
|
50
|
+
* The default source of each name: `shadcnVariables` replaces `--destructive` with
|
|
51
|
+
* the destructive projection, and `--card`, `--popover`, `--muted-foreground` and
|
|
52
|
+
* `--border` with a record's own `shadcn` values when it has them.
|
|
53
|
+
*
|
|
50
54
|
* Every entry is a deliberate correspondence, and the ones that are not a plain
|
|
51
55
|
* rename carry the reason here rather than in the output. A `null` destination
|
|
52
56
|
* is a deliberate "not emitted": the role has no shadcn consumer, and the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadcn.d.ts","sourceRoot":"","sources":["../../src/adapters/shadcn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"shadcn.d.ts","sourceRoot":"","sources":["../../src/adapters/shadcn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAOrF,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG;IAAE,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAAE,CAAA;AAExE,oEAAoE;AACpE,MAAM,WAAW,2BAA2B;IAC1C,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAMD;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,WAAW,GAAG,2BAA2B,CAyD3F;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC,CA4BjF,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAItE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAqE1E;AAED,0CAA0C;AAC1C,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,SAAU,GAAG,MAAM,CAKxE"}
|