@adea-ai/themes 0.11.17 → 0.11.19
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/NOTICE +11 -11
- package/README.md +87 -100
- package/dist/accents.d.ts +29 -29
- package/dist/accents.js +28 -28
- package/dist/adapters/base24.d.ts +4 -4
- package/dist/adapters/base24.js +5 -5
- package/dist/adapters/css-variables.d.ts +1 -1
- package/dist/adapters/css-variables.js +1 -1
- package/dist/adapters/css.d.ts +3 -3
- package/dist/adapters/css.js +3 -3
- package/dist/adapters/shadcn.d.ts +8 -9
- package/dist/adapters/shadcn.d.ts.map +1 -1
- package/dist/adapters/shadcn.js +10 -11
- package/dist/adapters/shadcn.js.map +1 -1
- package/dist/adapters/shiki.d.ts +3 -3
- package/dist/adapters/shiki.js +4 -4
- package/dist/adapters/xterm.d.ts +1 -1
- package/dist/adapters/xterm.js +1 -1
- package/dist/catalogue.d.ts +4 -4
- package/dist/catalogue.js +4 -4
- package/dist/derive.d.ts +10 -10
- package/dist/derive.js +14 -14
- package/dist/derive.js.map +1 -1
- package/dist/generated/schemes.d.ts +2 -2
- package/dist/generated/schemes.js +2 -2
- package/dist/normalize.d.ts +9 -9
- package/dist/normalize.js +35 -35
- package/dist/normalize.js.map +1 -1
- package/dist/oklch.d.ts +2 -2
- package/dist/oklch.js +6 -6
- package/dist/oklch.js.map +1 -1
- package/dist/policy.d.ts +3 -3
- package/dist/policy.js +3 -3
- package/dist/schema.d.ts +5 -5
- package/dist/schema.js +4 -4
- package/dist/sources.d.ts +9 -9
- package/dist/sources.js +10 -10
- package/dist/validate.d.ts +8 -8
- package/dist/validate.js +7 -7
- package/dist/validate.js.map +1 -1
- package/package.json +1 -1
- package/src/accents.ts +32 -32
- package/src/adapters/base24.ts +5 -5
- package/src/adapters/css-variables.ts +1 -1
- package/src/adapters/css.ts +3 -3
- package/src/adapters/shadcn.ts +10 -11
- package/src/adapters/shiki.ts +4 -4
- package/src/adapters/xterm.ts +1 -1
- package/src/catalogue.ts +4 -4
- package/src/derive.ts +14 -14
- package/src/generated/schemes.ts +2 -2
- package/src/normalize.ts +40 -40
- package/src/oklch.ts +6 -6
- package/src/policy.ts +3 -3
- package/src/schema.ts +5 -5
- package/src/sources.ts +14 -14
- package/src/validate.ts +9 -9
package/dist/accents.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The accent axis.
|
|
3
3
|
*
|
|
4
|
-
* A theme has one interactive colour
|
|
4
|
+
* A theme has one interactive colour, its primary, and the accent axis lets a
|
|
5
5
|
* user replace it without changing the theme. That is a different question from
|
|
6
6
|
* "which palette do you want": a user may like Catppuccin's surfaces and still want
|
|
7
7
|
* a violet primary, and a product may ship a brand colour that has to survive every
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
*
|
|
10
10
|
* ## Why the presets live here
|
|
11
11
|
*
|
|
12
|
-
* They are colour data with a light/dark pair per preset
|
|
12
|
+
* They are colour data with a light/dark pair per preset, structurally the same
|
|
13
13
|
* thing as a theme's primary, and the last colour a consumer should have to author
|
|
14
14
|
* itself. With the values and the derivation in one module, a consumer emits the
|
|
15
|
-
* preset list and its CSS from the same rule, and the two cannot drift apart
|
|
15
|
+
* preset list and its CSS from the same rule, and the two cannot drift apart, as
|
|
16
16
|
* they did when a consumer hand-wrote both and its default primary hovered the
|
|
17
17
|
* opposite way to every other accent.
|
|
18
18
|
*
|
|
@@ -24,39 +24,39 @@
|
|
|
24
24
|
* Two rules were tried here before this one, and both are worth recording because
|
|
25
25
|
* each looks right until it is measured:
|
|
26
26
|
*
|
|
27
|
-
* - **Toward `--background
|
|
27
|
+
* - **Toward `--background`**: inverted in both
|
|
28
28
|
* appearances: it moves the button toward the page it sits on, so a hovered button
|
|
29
29
|
* recedes.
|
|
30
|
-
* - **Toward `--foreground
|
|
30
|
+
* - **Toward `--foreground`**: correct in principle, since the foreground is
|
|
31
31
|
* normally away from the canvas, and wrong in practice: a dark theme's foreground
|
|
32
|
-
* is mid-lightness (`0.79` in the default), so an accent lighter than that
|
|
33
|
-
* dark green is `0.80
|
|
34
|
-
* - **Toward white or black
|
|
32
|
+
* is mid-lightness (`0.79` in the default), so an accent lighter than that, the
|
|
33
|
+
* dark green is `0.80`, moves *toward* the canvas by a hair.
|
|
34
|
+
* - **Toward white or black**: always the right direction, but a *proportional*
|
|
35
35
|
* step: a mid-lightness light accent moves ~0.10 and a pale dark accent ~0.03, so
|
|
36
36
|
* the same rule gives one appearance a hover twice as strong as the other's.
|
|
37
37
|
*
|
|
38
38
|
* A uniform step needs a resolved value, which is why {@link primaryHover} returns
|
|
39
39
|
* one and why the tint below can stay an expression. `shiftLightness` is what keeps
|
|
40
|
-
* the step uniform *and* the hue intact
|
|
40
|
+
* the step uniform *and* the hue intact, a mix toward a neutral cannot do both.
|
|
41
41
|
*
|
|
42
42
|
* ## The tint rule
|
|
43
43
|
*
|
|
44
|
-
* The tint is the selected state across the component library
|
|
44
|
+
* The tint is the selected state across the component library, `bg-primary-subtle
|
|
45
45
|
* text-foreground` on an active nav row, a pressed toggle, the highlighted command
|
|
46
|
-
* row, a selected tab
|
|
46
|
+
* row, a selected tab, so body text on it is held to the body floor, on every
|
|
47
47
|
* surface body text is held to it on, for every accent the theme offers.
|
|
48
48
|
*
|
|
49
49
|
* It stays a translucent `color-mix()` rather than becoming an opaque value, and
|
|
50
50
|
* that is a measured choice rather than a habit. An opaque tint mixed into the
|
|
51
|
-
* canvas is legible everywhere by construction
|
|
52
|
-
* that way
|
|
51
|
+
* canvas is legible everywhere by construction, the status `-subtle` fills work
|
|
52
|
+
* that way, but it is a wash *of the canvas*: on a dark theme's popover, which is
|
|
53
53
|
* already lighter than the canvas, a selected command row resolved that way lands
|
|
54
54
|
* within ΔE 0.01 of the popover and disappears. A translucent tint is a wash of
|
|
55
55
|
* whatever it sits on, so it reads as selected on every rung.
|
|
56
56
|
*
|
|
57
57
|
* What moves instead is the **strength**, per theme. {@link ACCENT_SUBTLE_ALPHA} is
|
|
58
|
-
* the ceiling, and {@link primarySubtleAlpha} lowers it
|
|
59
|
-
* needs
|
|
58
|
+
* the ceiling, and {@link primarySubtleAlpha} lowers it, only as far as a theme
|
|
59
|
+
* needs, until the composite clears the floor everywhere. The palettes whose body
|
|
60
60
|
* text sits closest to the floor get a lighter wash, and the colour, the
|
|
61
61
|
* foreground and the surfaces stay exactly as their authors wrote them.
|
|
62
62
|
*/
|
|
@@ -131,7 +131,7 @@ export function accentValue(preset, appearance) {
|
|
|
131
131
|
* The label to draw on an accent fill: black or white, whichever wins on contrast.
|
|
132
132
|
*
|
|
133
133
|
* Measured rather than conventional. The usual convention is "white on a coloured
|
|
134
|
-
* fill", which is wrong for the bright half of this set
|
|
134
|
+
* fill", which is wrong for the bright half of this set, white on `#a78bfa` is
|
|
135
135
|
* about 2.1:1, and black on it is about 9.9:1. That is why the same accent carries a
|
|
136
136
|
* black label in dark mode and a white one in light: the pair is designed so the
|
|
137
137
|
* polarity flips, and the label has to flip with it.
|
|
@@ -157,7 +157,7 @@ export function accentForegroundContrast(accent) {
|
|
|
157
157
|
* A **uniform step**, not a proportional one, and the difference matters. Mixing a
|
|
158
158
|
* fixed share toward white or black moves an accent by a share of its headroom, so
|
|
159
159
|
* the same rule gives a mid-lightness light accent a step of ~0.10 and a pale dark
|
|
160
|
-
* accent one of ~0.03
|
|
160
|
+
* accent one of ~0.03, a hover that feels twice as strong in one appearance as the
|
|
161
161
|
* other, and nearly invisible on the palest accent.
|
|
162
162
|
*
|
|
163
163
|
* 0.05 is the step this system's accents were already hand-written with, so the
|
|
@@ -168,7 +168,7 @@ export const ACCENT_HOVER_STEP = 0.05;
|
|
|
168
168
|
* The hovered primary, as a resolved colour.
|
|
169
169
|
*
|
|
170
170
|
* Resolved rather than expressed as a `color-mix()`, because a uniform step cannot
|
|
171
|
-
* be written as a mix
|
|
171
|
+
* be written as a mix, see {@link ACCENT_HOVER_STEP}. That means it does **not**
|
|
172
172
|
* follow `--primary` on its own, so a consumer that applies themes at runtime has to
|
|
173
173
|
* write this token too; the alternative is a hover left over from the previous
|
|
174
174
|
* theme's primary. `shadcnVariables` includes it for that reason.
|
|
@@ -207,8 +207,8 @@ export const ACCENT_SUBTLE_ALPHA = Object.freeze({
|
|
|
207
207
|
*
|
|
208
208
|
* {@link primarySubtleAlpha} lowers a theme's strength for legibility, and this is
|
|
209
209
|
* how far it may go: below it the selected state stops reading as a state at all.
|
|
210
|
-
* The normalizer reserves it
|
|
211
|
-
* clears the floor under a tint this strong
|
|
210
|
+
* The normalizer reserves it, it fits a theme's hover rung so body text still
|
|
211
|
+
* clears the floor under a tint this strong, so every theme in the catalogue can
|
|
212
212
|
* carry at least this much. At 4% the tint over One Dark's popover measures ΔE 0.018
|
|
213
213
|
* against the popover, about the same as its hover rung's feedback there.
|
|
214
214
|
*/
|
|
@@ -218,7 +218,7 @@ export const ACCENT_SUBTLE_MINIMUM_ALPHA = 4;
|
|
|
218
218
|
* on.
|
|
219
219
|
*
|
|
220
220
|
* The canvas, the two raised rungs and the hover rung, plus whatever a source
|
|
221
|
-
* substitutes for them in the shadcn bridge
|
|
221
|
+
* substitutes for them in the shadcn bridge, `--card`, `--popover`, `--muted` and
|
|
222
222
|
* `--secondary`; `--sidebar` is the first rung and `--accent` the hover rung. The
|
|
223
223
|
* hover rung is here because a selected item that is also hovered paints the tint
|
|
224
224
|
* over it in some components. The active rung is not: it is the pressed state of an
|
|
@@ -289,7 +289,7 @@ export function tintCheck(theme, primaries = []) {
|
|
|
289
289
|
* {@link ACCENT_SUBTLE_MINIMUM_ALPHA}, because the normalizer fits its hover rung to
|
|
290
290
|
* leave room for it.
|
|
291
291
|
*
|
|
292
|
-
* Pass `primaries` to hold the strength for colours outside the offered set too
|
|
292
|
+
* Pass `primaries` to hold the strength for colours outside the offered set too,
|
|
293
293
|
* a product's own brand primary, say. The offered set is always included.
|
|
294
294
|
*/
|
|
295
295
|
export function primarySubtleAlpha(theme, primaries = []) {
|
|
@@ -307,14 +307,14 @@ export function primarySubtleAlpha(theme, primaries = []) {
|
|
|
307
307
|
* Pass the **theme**: the expression then carries that theme's measured strength
|
|
308
308
|
* ({@link primarySubtleAlpha}) and body text on it is held to the floor for every
|
|
309
309
|
* accent the theme offers. It still reads `var(--primary)`, so it follows a runtime
|
|
310
|
-
* accent switch
|
|
310
|
+
* accent switch, but the strength is the theme's, so a consumer that applies
|
|
311
311
|
* themes at runtime has to write this token per theme, as it already does for
|
|
312
312
|
* {@link primaryHover}. A consumer whose primary is not one the theme offers passes
|
|
313
313
|
* it as `primaries` to have the strength measured for it as well.
|
|
314
314
|
*
|
|
315
315
|
* Passing only an **appearance** gives the {@link ACCENT_SUBTLE_ALPHA} ceiling for
|
|
316
|
-
* that appearance, unmeasured. It is not legible on every theme
|
|
317
|
-
* text on its own primary's tint over a card measures 4.34:1 at the dark ceiling
|
|
316
|
+
* that appearance, unmeasured. It is not legible on every theme: One Dark's body
|
|
317
|
+
* text on its own primary's tint over a card measures 4.34:1 at the dark ceiling,
|
|
318
318
|
* so it is kept for a consumer without a theme object in hand, not as the default
|
|
319
319
|
* to reach for.
|
|
320
320
|
*/
|
|
@@ -325,8 +325,8 @@ export function primarySubtleCss(target, primaryVariable = '--primary', primarie
|
|
|
325
325
|
/**
|
|
326
326
|
* A slot's offerable value on one theme: the palette's own colour when it already
|
|
327
327
|
* clears the accent floors on that theme's canvas, otherwise the catalogue's
|
|
328
|
-
* contrast repair
|
|
329
|
-
* canvas, within the accent budget
|
|
328
|
+
* contrast repair, lightness moved, hue and chroma kept, direction away from the
|
|
329
|
+
* canvas, within the accent budget, applied to reach the raised-surface floor
|
|
330
330
|
* with a legible label. `undefined` when even the budget cannot get there, which
|
|
331
331
|
* is the one case where the theme honestly cannot offer the slot.
|
|
332
332
|
*/
|
|
@@ -378,7 +378,7 @@ export function themeAccentPresets(light, dark) {
|
|
|
378
378
|
export function accentRoles(preset,
|
|
379
379
|
/**
|
|
380
380
|
* The theme the accent is applied to, or only its appearance. A theme gives the
|
|
381
|
-
* tint that theme's measured strength
|
|
381
|
+
* tint that theme's measured strength, see {@link primarySubtleCss}; an
|
|
382
382
|
* appearance gives the unmeasured ceiling.
|
|
383
383
|
*/
|
|
384
384
|
target,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* ## The slot order is not the ANSI order
|
|
10
10
|
*
|
|
11
11
|
* Base24's `base12`–`base17` are *bright red, bright yellow, bright green, bright
|
|
12
|
-
* cyan, bright blue, bright magenta
|
|
12
|
+
* cyan, bright blue, bright magenta*, the order Base16 needed to keep its ramps
|
|
13
13
|
* monotonic, not the ANSI order of yellow before green. Reading them positionally
|
|
14
14
|
* as ANSI 1–6 silently swaps green and yellow and blue and cyan, which is the kind
|
|
15
15
|
* of mistake that survives review because the theme still *looks* like itself.
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* export they are re-derived from `red` and `yellow` by a fixed rotation, and
|
|
24
24
|
* `getBase24Scheme` returns the vendored schemes for callers who need the
|
|
25
25
|
* originals byte-for-byte. Round-tripping is therefore lossless for every
|
|
26
|
-
* role Adea models, and explicitly approximate for the two it does not
|
|
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
29
|
import type { AdeaTheme, AdeaThemeColors } from '../schema.js';
|
|
@@ -91,7 +91,7 @@ export declare const ANSI_TO_BASE24: Readonly<{
|
|
|
91
91
|
* hues: `base08`–`base0E` are written from `BASE24_TO_ANSI`, the colours a terminal
|
|
92
92
|
* reads, not from the repaired UI roles. `base01` receives `black` rather than a
|
|
93
93
|
* role because an ANSI black that equals the background is invisible as foreground
|
|
94
|
-
* text
|
|
94
|
+
* text, the defect the import side documents. The
|
|
95
95
|
* surface ladder has no Base24 slot at all, so it is deliberately absent here:
|
|
96
96
|
* Base24 cannot express it, and pretending otherwise by packing four rungs into
|
|
97
97
|
* `base01`/`base02` would make the export lie about what it preserves.
|
|
@@ -107,7 +107,7 @@ export declare function parseBase24Palette(palette: Base24Palette): Record<Base2
|
|
|
107
107
|
/**
|
|
108
108
|
* Writes a theme back to Base24.
|
|
109
109
|
*
|
|
110
|
-
* `base09` and `base0F` are synthesised
|
|
110
|
+
* `base09` and `base0F` are synthesised, see this module's header. `base10` and
|
|
111
111
|
* `base11` are the two rungs below `base00`, which is what the specification
|
|
112
112
|
* defines them as and what a terminal needs in order to draw a black that is
|
|
113
113
|
* darker than the background.
|
package/dist/adapters/base24.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* ## The slot order is not the ANSI order
|
|
10
10
|
*
|
|
11
11
|
* Base24's `base12`–`base17` are *bright red, bright yellow, bright green, bright
|
|
12
|
-
* cyan, bright blue, bright magenta
|
|
12
|
+
* cyan, bright blue, bright magenta*, the order Base16 needed to keep its ramps
|
|
13
13
|
* monotonic, not the ANSI order of yellow before green. Reading them positionally
|
|
14
14
|
* as ANSI 1–6 silently swaps green and yellow and blue and cyan, which is the kind
|
|
15
15
|
* of mistake that survives review because the theme still *looks* like itself.
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* export they are re-derived from `red` and `yellow` by a fixed rotation, and
|
|
24
24
|
* `getBase24Scheme` returns the vendored schemes for callers who need the
|
|
25
25
|
* originals byte-for-byte. Round-tripping is therefore lossless for every
|
|
26
|
-
* role Adea models, and explicitly approximate for the two it does not
|
|
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
29
|
import { formatOklch, parseColor, shiftLightness } from '../oklch.js';
|
|
@@ -117,7 +117,7 @@ export const ANSI_TO_BASE24 = Object.freeze(Object.fromEntries(Object.entries(BA
|
|
|
117
117
|
* hues: `base08`–`base0E` are written from `BASE24_TO_ANSI`, the colours a terminal
|
|
118
118
|
* reads, not from the repaired UI roles. `base01` receives `black` rather than a
|
|
119
119
|
* role because an ANSI black that equals the background is invisible as foreground
|
|
120
|
-
* text
|
|
120
|
+
* text, the defect the import side documents. The
|
|
121
121
|
* surface ladder has no Base24 slot at all, so it is deliberately absent here:
|
|
122
122
|
* Base24 cannot express it, and pretending otherwise by packing four rungs into
|
|
123
123
|
* `base01`/`base02` would make the export lie about what it preserves.
|
|
@@ -169,7 +169,7 @@ export function parseBase24Palette(palette) {
|
|
|
169
169
|
/**
|
|
170
170
|
* Writes a theme back to Base24.
|
|
171
171
|
*
|
|
172
|
-
* `base09` and `base0F` are synthesised
|
|
172
|
+
* `base09` and `base0F` are synthesised, see this module's header. `base10` and
|
|
173
173
|
* `base11` are the two rungs below `base00`, which is what the specification
|
|
174
174
|
* defines them as and what a terminal needs in order to draw a black that is
|
|
175
175
|
* darker than the background.
|
|
@@ -228,7 +228,7 @@ export function formatBase24Scheme(scheme) {
|
|
|
228
228
|
*
|
|
229
229
|
* Written as a scan rather than `replace(/\s+#.*$/, '')`, which is what it was: that
|
|
230
230
|
* pattern is a quantified `\s+` followed by `.*`, so on a line with many spaces and no
|
|
231
|
-
* `#` the engine retries every split of the run at every start position
|
|
231
|
+
* `#` the engine retries every split of the run at every start position, quadratic
|
|
232
232
|
* in the line length, on input this function does not control. CodeQL reports it as
|
|
233
233
|
* `js/polynomial-redos`, which is how it was found.
|
|
234
234
|
*
|
|
@@ -21,7 +21,7 @@ export declare const CANONICAL_VARIABLES: readonly CssVariable[];
|
|
|
21
21
|
* fills and the text drawn on them, and the sunken surface.
|
|
22
22
|
*
|
|
23
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
|
|
24
|
+
* theme's legible extreme for that fill, not the body text, see
|
|
25
25
|
* `derive.statusForeground`. The sunken surface is the one step below the canvas that
|
|
26
26
|
* a well or a code block sits in.
|
|
27
27
|
*/
|
|
@@ -28,7 +28,7 @@ export const CANONICAL_VARIABLES = Object.freeze([
|
|
|
28
28
|
* fills and the text drawn on them, and the sunken surface.
|
|
29
29
|
*
|
|
30
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
|
|
31
|
+
* theme's legible extreme for that fill, not the body text, see
|
|
32
32
|
* `derive.statusForeground`. The sunken surface is the one step below the canvas that
|
|
33
33
|
* a well or a code block sits in.
|
|
34
34
|
*/
|
package/dist/adapters/css.d.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* ## Two names for the same values
|
|
9
9
|
*
|
|
10
|
-
* {@link themeCssVariables} emits the canonical names
|
|
11
|
-
* `--adea-surface
|
|
10
|
+
* {@link themeCssVariables} emits the canonical names, `--adea-background`,
|
|
11
|
+
* `--adea-surface`, and is what a new consumer should use.
|
|
12
12
|
* `adapters/shadcn.ts` emits the shadcn vocabulary this organisation's components
|
|
13
13
|
* are already written against. Both are generated from the same theme object, so
|
|
14
14
|
* the two can never disagree about what `surface` is; that is the entire reason to
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
* Custom properties are evaluated by the browser. Writing OKLCH means the values
|
|
26
26
|
* stay on the perceptual axis all the way to paint, so a consumer can compose them
|
|
27
|
-
*
|
|
27
|
+
* `color-mix(in oklch, var(--adea-accent), transparent 20%)`, and get a
|
|
28
28
|
* predictable result. Converted to hex on the way out, that composition would be
|
|
29
29
|
* an sRGB blend, which is what makes hand-mixed tints go muddy.
|
|
30
30
|
*/
|
package/dist/adapters/css.js
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* ## Two names for the same values
|
|
9
9
|
*
|
|
10
|
-
* {@link themeCssVariables} emits the canonical names
|
|
11
|
-
* `--adea-surface
|
|
10
|
+
* {@link themeCssVariables} emits the canonical names, `--adea-background`,
|
|
11
|
+
* `--adea-surface`, and is what a new consumer should use.
|
|
12
12
|
* `adapters/shadcn.ts` emits the shadcn vocabulary this organisation's components
|
|
13
13
|
* are already written against. Both are generated from the same theme object, so
|
|
14
14
|
* the two can never disagree about what `surface` is; that is the entire reason to
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
* Custom properties are evaluated by the browser. Writing OKLCH means the values
|
|
26
26
|
* stay on the perceptual axis all the way to paint, so a consumer can compose them
|
|
27
|
-
*
|
|
27
|
+
* `color-mix(in oklch, var(--adea-accent), transparent 20%)`, and get a
|
|
28
28
|
* predictable result. Converted to hex on the way out, that composition would be
|
|
29
29
|
* an sRGB blend, which is what makes hand-mixed tints go muddy.
|
|
30
30
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The shadcn bridge.
|
|
3
3
|
*
|
|
4
|
-
* This organisation's components are written against shadcn's vocabulary
|
|
5
|
-
* `--background`, `--card`, `--muted-foreground`, `--primary`, `--ring
|
|
4
|
+
* This organisation's components are written against shadcn's vocabulary,
|
|
5
|
+
* `--background`, `--card`, `--muted-foreground`, `--primary`, `--ring`, and that
|
|
6
6
|
* vocabulary is not the canonical schema. Rather than rename every component, the
|
|
7
7
|
* two are bridged here, in one place, from one theme object.
|
|
8
8
|
*
|
|
@@ -10,16 +10,15 @@
|
|
|
10
10
|
*
|
|
11
11
|
* - **Adea's `accent` becomes shadcn's `primary`.** In shadcn, `--primary` is the
|
|
12
12
|
* main action colour and `--accent` is a *subtle hover background*. Adea's
|
|
13
|
-
* `accent` is the interactive colour
|
|
14
|
-
* what a focus ring is drawn in
|
|
13
|
+
* `accent` is the interactive colour, what a primary button is filled with,
|
|
14
|
+
* what a focus ring is drawn in, so it is shadcn's `primary`. Mapping it to
|
|
15
15
|
* `--accent` instead would turn every primary button into a hover wash. The
|
|
16
16
|
* shadcn `accent` slot is filled from `surfaceHover`, which is what it is
|
|
17
17
|
* actually used for.
|
|
18
18
|
* - **Adea's `surface` ladder becomes `card` and `popover`.** shadcn has two
|
|
19
19
|
* surfaces rather than four, so `surface` maps to `card` and `surfaceElevated`
|
|
20
20
|
* to `popover`, and the remaining two rungs keep their own names.
|
|
21
|
-
|
|
22
|
-
* A table of the whole mapping is in `docs/shadcn-bridge.md`.
|
|
21
|
+
|
|
23
22
|
*/
|
|
24
23
|
import type { AdeaTheme, AdeaThemeColors, ShadcnThemeProjection } from '../schema.js';
|
|
25
24
|
/** A canonical theme with optional owner-authored shadcn presentation values. */
|
|
@@ -60,8 +59,8 @@ export declare const SHADCN_MAPPING: Readonly<Record<keyof AdeaThemeColors, stri
|
|
|
60
59
|
/**
|
|
61
60
|
* The shadcn roles as an object, keyed by role name without the `--` prefix.
|
|
62
61
|
*
|
|
63
|
-
* For a consumer that keeps a theme as data
|
|
64
|
-
* screen, a component reading `theme.colors.card
|
|
62
|
+
* For a consumer that keeps a theme as data, a picker showing swatches, a settings
|
|
63
|
+
* screen, a component reading `theme.colors.card`, rather than writing it straight
|
|
65
64
|
* to the document.
|
|
66
65
|
*/
|
|
67
66
|
export declare function shadcnRoles(theme: ShadcnTheme): Record<string, string>;
|
|
@@ -69,7 +68,7 @@ export declare function shadcnRoles(theme: ShadcnTheme): Record<string, string>;
|
|
|
69
68
|
* The shadcn custom properties for a theme.
|
|
70
69
|
*
|
|
71
70
|
* `--accent` is filled from `surfaceHover` because that is what shadcn components
|
|
72
|
-
* use it for
|
|
71
|
+
* use it for, the background of a hovered menu item, and `--ring` from the
|
|
73
72
|
* accent, because that is what a focus ring must be drawn in for the focus state
|
|
74
73
|
* to be visible.
|
|
75
74
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadcn.d.ts","sourceRoot":"","sources":["../../src/adapters/shadcn.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shadcn.d.ts","sourceRoot":"","sources":["../../src/adapters/shadcn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;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"}
|
package/dist/adapters/shadcn.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The shadcn bridge.
|
|
3
3
|
*
|
|
4
|
-
* This organisation's components are written against shadcn's vocabulary
|
|
5
|
-
* `--background`, `--card`, `--muted-foreground`, `--primary`, `--ring
|
|
4
|
+
* This organisation's components are written against shadcn's vocabulary,
|
|
5
|
+
* `--background`, `--card`, `--muted-foreground`, `--primary`, `--ring`, and that
|
|
6
6
|
* vocabulary is not the canonical schema. Rather than rename every component, the
|
|
7
7
|
* two are bridged here, in one place, from one theme object.
|
|
8
8
|
*
|
|
@@ -10,16 +10,15 @@
|
|
|
10
10
|
*
|
|
11
11
|
* - **Adea's `accent` becomes shadcn's `primary`.** In shadcn, `--primary` is the
|
|
12
12
|
* main action colour and `--accent` is a *subtle hover background*. Adea's
|
|
13
|
-
* `accent` is the interactive colour
|
|
14
|
-
* what a focus ring is drawn in
|
|
13
|
+
* `accent` is the interactive colour, what a primary button is filled with,
|
|
14
|
+
* what a focus ring is drawn in, so it is shadcn's `primary`. Mapping it to
|
|
15
15
|
* `--accent` instead would turn every primary button into a hover wash. The
|
|
16
16
|
* shadcn `accent` slot is filled from `surfaceHover`, which is what it is
|
|
17
17
|
* actually used for.
|
|
18
18
|
* - **Adea's `surface` ladder becomes `card` and `popover`.** shadcn has two
|
|
19
19
|
* surfaces rather than four, so `surface` maps to `card` and `surfaceElevated`
|
|
20
20
|
* to `popover`, and the remaining two rungs keep their own names.
|
|
21
|
-
|
|
22
|
-
* A table of the whole mapping is in `docs/shadcn-bridge.md`.
|
|
21
|
+
|
|
23
22
|
*/
|
|
24
23
|
import { primaryHover, primarySubtleCss } from '../accents.js';
|
|
25
24
|
import { STATUS_ROLES, statusForeground, tint } from '../derive.js';
|
|
@@ -129,8 +128,8 @@ export const SHADCN_MAPPING = Object.freeze({
|
|
|
129
128
|
/**
|
|
130
129
|
* The shadcn roles as an object, keyed by role name without the `--` prefix.
|
|
131
130
|
*
|
|
132
|
-
* For a consumer that keeps a theme as data
|
|
133
|
-
* screen, a component reading `theme.colors.card
|
|
131
|
+
* For a consumer that keeps a theme as data, a picker showing swatches, a settings
|
|
132
|
+
* screen, a component reading `theme.colors.card`, rather than writing it straight
|
|
134
133
|
* to the document.
|
|
135
134
|
*/
|
|
136
135
|
export function shadcnRoles(theme) {
|
|
@@ -140,7 +139,7 @@ export function shadcnRoles(theme) {
|
|
|
140
139
|
* The shadcn custom properties for a theme.
|
|
141
140
|
*
|
|
142
141
|
* `--accent` is filled from `surfaceHover` because that is what shadcn components
|
|
143
|
-
* use it for
|
|
142
|
+
* use it for, the background of a hovered menu item, and `--ring` from the
|
|
144
143
|
* accent, because that is what a focus ring must be drawn in for the focus state
|
|
145
144
|
* to be visible.
|
|
146
145
|
*/
|
|
@@ -162,8 +161,8 @@ export function shadcnVariables(theme) {
|
|
|
162
161
|
variables['--ring'] = theme.shadcn?.ring ?? theme.colors.accent;
|
|
163
162
|
variables['--input'] = theme.shadcn?.input ?? theme.colors.border;
|
|
164
163
|
// The rest of shadcn's default vocabulary. These are not in `SHADCN_MAPPING`
|
|
165
|
-
// because they are not new *roles
|
|
166
|
-
// first surface rung used as a fill, and its `card-foreground` is the body text
|
|
164
|
+
// because they are not new *roles*, shadcn's `secondary` and `muted` are both the
|
|
165
|
+
// first surface rung used as a fill, and its `card-foreground` is the body text,
|
|
167
166
|
// so they are filled from the roles that already exist rather than getting
|
|
168
167
|
// second-class entries of their own.
|
|
169
168
|
variables['--card'] = theme.shadcn?.card ?? theme.colors.surface;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadcn.js","sourceRoot":"","sources":["../../src/adapters/shadcn.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shadcn.js","sourceRoot":"","sources":["../../src/adapters/shadcn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAalD,MAAM,8BAA8B,GAAG,CAAC,CAAA;AACxC,MAAM,yBAAyB,GAAG,GAAG,CAAA;AACrC,MAAM,iCAAiC,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,iBAAiB,CAAU,CAAA;AAE/F;;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C,MAAM,CAAA;IAErE,SAAS,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,MAAM,CAAA;IACpC,SAAS,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,SAAS,CAAA;IAE1C,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,SAAS,CAAC,KAAkB,EAAE,QAAQ,GAAG,OAAO;IAC9D,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;SAChD,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC;SAC9C,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,OAAO,GAAG,QAAQ,OAAO,IAAI,KAAK,CAAA;AACpC,CAAC"}
|
package/dist/adapters/shiki.d.ts
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* Shiki drives the code views and diffs in Adea's editor and conversation surfaces,
|
|
5
5
|
* and its theme contract is an editor contract: a `colors` map for the chrome and a
|
|
6
6
|
* `settings` list of scope selectors. Neither is in the canonical schema, so both
|
|
7
|
-
* are derived
|
|
7
|
+
* are derived, the chrome from the semantic roles, the scopes from the ANSI
|
|
8
8
|
* colours via `derive.syntaxRoles`.
|
|
9
9
|
*
|
|
10
10
|
* ## Hex, not OKLCH
|
|
11
11
|
*
|
|
12
12
|
* Shiki is the one adapter that gets hex. Its colour resolution runs through a
|
|
13
13
|
* syntax highlighter that does not evaluate CSS colour functions, and its output is
|
|
14
|
-
* used to build inline styles and a text-mate scopes map
|
|
14
|
+
* used to build inline styles and a text-mate scopes map, places where an
|
|
15
15
|
* `oklch()` string is not a colour but a string. The conversion gamut-maps rather
|
|
16
16
|
* than clipping, so an out-of-gamut accent becomes a slightly less saturated real
|
|
17
17
|
* colour instead of a broken channel.
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* `toShikiTheme` returns the object; it does not call `loadTheme`, and it does
|
|
22
22
|
* not import Shiki. That keeps this package free of a dependency on a library that
|
|
23
23
|
* is an application's choice, and it means a consumer can register the result
|
|
24
|
-
* however it likes
|
|
24
|
+
* however it likes, synchronously, into a custom highlighter, or inside a worker.
|
|
25
25
|
*/
|
|
26
26
|
import type { AdeaTheme } from '../schema.js';
|
|
27
27
|
/**
|
package/dist/adapters/shiki.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* Shiki drives the code views and diffs in Adea's editor and conversation surfaces,
|
|
5
5
|
* and its theme contract is an editor contract: a `colors` map for the chrome and a
|
|
6
6
|
* `settings` list of scope selectors. Neither is in the canonical schema, so both
|
|
7
|
-
* are derived
|
|
7
|
+
* are derived, the chrome from the semantic roles, the scopes from the ANSI
|
|
8
8
|
* colours via `derive.syntaxRoles`.
|
|
9
9
|
*
|
|
10
10
|
* ## Hex, not OKLCH
|
|
11
11
|
*
|
|
12
12
|
* Shiki is the one adapter that gets hex. Its colour resolution runs through a
|
|
13
13
|
* syntax highlighter that does not evaluate CSS colour functions, and its output is
|
|
14
|
-
* used to build inline styles and a text-mate scopes map
|
|
14
|
+
* used to build inline styles and a text-mate scopes map, places where an
|
|
15
15
|
* `oklch()` string is not a colour but a string. The conversion gamut-maps rather
|
|
16
16
|
* than clipping, so an out-of-gamut accent becomes a slightly less saturated real
|
|
17
17
|
* colour instead of a broken channel.
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* `toShikiTheme` returns the object; it does not call `loadTheme`, and it does
|
|
22
22
|
* not import Shiki. That keeps this package free of a dependency on a library that
|
|
23
23
|
* is an application's choice, and it means a consumer can register the result
|
|
24
|
-
* however it likes
|
|
24
|
+
* however it likes, synchronously, into a custom highlighter, or inside a worker.
|
|
25
25
|
*/
|
|
26
26
|
import { syntaxRolesHex } from '../derive.js';
|
|
27
27
|
import { toHex as hex } from '../render.js';
|
|
@@ -37,7 +37,7 @@ import { toHex as hex } from '../render.js';
|
|
|
37
37
|
* claim more than one scope because grammars disagree: a type annotation may arrive
|
|
38
38
|
* as `entity.name.type`, as `support.type`, or as `storage.type` depending on the
|
|
39
39
|
* language, and a theme that names only one of them renders that language
|
|
40
|
-
* unhighlighted. The lists are conservative
|
|
40
|
+
* unhighlighted. The lists are conservative, they claim the scopes that mean the
|
|
41
41
|
* role unambiguously, and leave the rest to the editor's default.
|
|
42
42
|
*/
|
|
43
43
|
const SHIKI_SCOPES = Object.freeze({
|
package/dist/adapters/xterm.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface XtermTheme {
|
|
|
50
50
|
* The two derived fields are the whole point:
|
|
51
51
|
*
|
|
52
52
|
* - **`cursorAccent`** is the glyph *under* the block cursor. xterm draws it in
|
|
53
|
-
* this colour, so it must contrast with `cursor
|
|
53
|
+
* this colour, so it must contrast with `cursor`, not with the background.
|
|
54
54
|
* Palettes frequently set their cursor to the foreground colour, which puts the
|
|
55
55
|
* accent at the far end of the canvas.
|
|
56
56
|
* - **`selectionForeground`** is text inside a selection. Base24's `base02` is
|
package/dist/adapters/xterm.js
CHANGED
|
@@ -35,7 +35,7 @@ const CURSOR_FLOOR = 3;
|
|
|
35
35
|
* The two derived fields are the whole point:
|
|
36
36
|
*
|
|
37
37
|
* - **`cursorAccent`** is the glyph *under* the block cursor. xterm draws it in
|
|
38
|
-
* this colour, so it must contrast with `cursor
|
|
38
|
+
* this colour, so it must contrast with `cursor`, not with the background.
|
|
39
39
|
* Palettes frequently set their cursor to the foreground colour, which puts the
|
|
40
40
|
* accent at the far end of the canvas.
|
|
41
41
|
* - **`selectionForeground`** is text inside a selection. Base24's `base02` is
|
package/dist/catalogue.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* The catalogue's public surface.
|
|
3
3
|
*
|
|
4
4
|
* The generated data is a flat, sorted array; everything a consumer wants to *do*
|
|
5
|
-
* with it
|
|
6
|
-
* stored preference still names a real theme
|
|
5
|
+
* with it, find one theme, group it by family, list what exists, check that a
|
|
6
|
+
* stored preference still names a real theme, is here.
|
|
7
7
|
*
|
|
8
8
|
* ## Lookups answer, they do not throw
|
|
9
9
|
*
|
|
@@ -52,8 +52,8 @@ export declare function themesByAppearance(appearance: ThemeAppearance, themesLi
|
|
|
52
52
|
* The vendored Base24 scheme for a theme, untouched.
|
|
53
53
|
*
|
|
54
54
|
* Present for interop and for licence auditing. `toBase24()` writes a scheme too,
|
|
55
|
-
* but it has to re-derive Base24's orange and brown slots
|
|
56
|
-
* has no role for them
|
|
55
|
+
* but it has to re-derive Base24's orange and brown slots, the canonical schema
|
|
56
|
+
* has no role for them, so it is not a byte-exact round trip. This returns the
|
|
57
57
|
* artefact as it was reproduced, so a caller that needs exactness has it.
|
|
58
58
|
*/
|
|
59
59
|
export declare function getBase24Scheme(id: string): Base24Scheme | undefined;
|
package/dist/catalogue.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* The catalogue's public surface.
|
|
3
3
|
*
|
|
4
4
|
* The generated data is a flat, sorted array; everything a consumer wants to *do*
|
|
5
|
-
* with it
|
|
6
|
-
* stored preference still names a real theme
|
|
5
|
+
* with it, find one theme, group it by family, list what exists, check that a
|
|
6
|
+
* stored preference still names a real theme, is here.
|
|
7
7
|
*
|
|
8
8
|
* ## Lookups answer, they do not throw
|
|
9
9
|
*
|
|
@@ -80,8 +80,8 @@ export function themesByAppearance(appearance, themesList = generatedThemes) {
|
|
|
80
80
|
* The vendored Base24 scheme for a theme, untouched.
|
|
81
81
|
*
|
|
82
82
|
* Present for interop and for licence auditing. `toBase24()` writes a scheme too,
|
|
83
|
-
* but it has to re-derive Base24's orange and brown slots
|
|
84
|
-
* has no role for them
|
|
83
|
+
* but it has to re-derive Base24's orange and brown slots, the canonical schema
|
|
84
|
+
* has no role for them, so it is not a byte-exact round trip. This returns the
|
|
85
85
|
* artefact as it was reproduced, so a caller that needs exactness has it.
|
|
86
86
|
*/
|
|
87
87
|
export function getBase24Scheme(id) {
|