@panneau/ui 5.0.0-alpha.28 → 5.0.0-alpha.29
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 +3 -1
- package/dist/aside/Aside.css +255 -0
- package/dist/aside/Aside.d.ts +86 -0
- package/dist/aside/Aside.d.ts.map +1 -0
- package/dist/aside/Aside.js +403 -0
- package/dist/aside/Aside.js.map +1 -0
- package/dist/aside/Aside.module.js +46 -0
- package/dist/aside/Aside.module.js.map +1 -0
- package/dist/aside/tokens.d.ts +3 -0
- package/dist/aside/tokens.d.ts.map +1 -0
- package/dist/aside/tokens.js +23 -0
- package/dist/aside/tokens.js.map +1 -0
- package/dist/button/Button.css +13 -1
- package/dist/button/Button.module.js.map +1 -1
- package/dist/button/tokens.d.ts +1 -1
- package/dist/button/tokens.d.ts.map +1 -1
- package/dist/button/tokens.js +4 -0
- package/dist/button/tokens.js.map +1 -1
- package/dist/card/tokens.d.ts +1 -1
- package/dist/checkbox/Checkbox.css +15 -16
- package/dist/checkbox/Checkbox.module.js.map +1 -1
- package/dist/checkbox/tokens.js +2 -2
- package/dist/checkbox/tokens.js.map +1 -1
- package/dist/date-picker/DatePicker.css +10 -4
- package/dist/date-picker/DatePicker.module.js.map +1 -1
- package/dist/date-picker/calendarTokens.js +2 -2
- package/dist/date-picker/calendarTokens.js.map +1 -1
- package/dist/date-range-picker/DateRangePicker.css +1 -1
- package/dist/date-range-picker/DateRangePicker.module.js.map +1 -1
- package/dist/field/Field.css +4 -4
- package/dist/field/Field.module.js.map +1 -1
- package/dist/field/inputTokens.d.ts +1 -1
- package/dist/field/inputTokens.d.ts.map +1 -1
- package/dist/field/inputTokens.js +7 -1
- package/dist/field/inputTokens.js.map +1 -1
- package/dist/field/tokens.d.ts +1 -1
- package/dist/field/tokens.d.ts.map +1 -1
- package/dist/field/tokens.js +3 -1
- package/dist/field/tokens.js.map +1 -1
- package/dist/icon/Icon.css +5 -0
- package/dist/icon/Icon.d.ts +5 -1
- package/dist/icon/Icon.d.ts.map +1 -1
- package/dist/icon/Icon.js +20 -19
- package/dist/icon/Icon.js.map +1 -1
- package/dist/icon/Icon.module.js.map +1 -1
- package/dist/icon/tokens.d.ts +3 -0
- package/dist/icon/tokens.d.ts.map +1 -0
- package/dist/icon/tokens.js +13 -0
- package/dist/icon/tokens.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/pill-trigger/tokens.d.ts +1 -1
- package/dist/popover/tokens.d.ts +1 -1
- package/dist/radio-group/RadioGroup.css +15 -15
- package/dist/radio-group/RadioGroup.module.js.map +1 -1
- package/dist/radio-group/tokens.js +2 -2
- package/dist/radio-group/tokens.js.map +1 -1
- package/dist/root/PanneauRoot.css +5 -0
- package/dist/root/PanneauRoot.module.js.map +1 -1
- package/dist/segmented-control/SegmentedControl.css +5 -1
- package/dist/segmented-control/SegmentedControl.module.js.map +1 -1
- package/dist/segmented-control/tokens.d.ts +1 -1
- package/dist/segmented-control/tokens.d.ts.map +1 -1
- package/dist/segmented-control/tokens.js +5 -1
- package/dist/segmented-control/tokens.js.map +1 -1
- package/dist/select/ListBox.css +2 -0
- package/dist/select/ListBox.module.js.map +1 -1
- package/dist/slider/Slider.css +6 -5
- package/dist/slider/Slider.module.js.map +1 -1
- package/dist/switch/Switch.css +16 -10
- package/dist/switch/Switch.module.js.map +1 -1
- package/dist/switch/tokens.d.ts +1 -1
- package/dist/switch/tokens.d.ts.map +1 -1
- package/dist/switch/tokens.js +4 -2
- package/dist/switch/tokens.js.map +1 -1
- package/dist/tabs/Tabs.css +4 -1
- package/dist/tabs/Tabs.module.js.map +1 -1
- package/dist/tabs/tokens.js +1 -1
- package/dist/tabs/tokens.js.map +1 -1
- package/dist/tags-input/TagsInput.css +15 -2
- package/dist/tags-input/TagsInput.module.js.map +1 -1
- package/dist/theme/checkTheme.d.ts +4 -2
- package/dist/theme/checkTheme.d.ts.map +1 -1
- package/dist/theme/checkTheme.js +30 -7
- package/dist/theme/checkTheme.js.map +1 -1
- package/dist/theme/color.d.ts +13 -0
- package/dist/theme/color.d.ts.map +1 -1
- package/dist/theme/color.js +41 -1
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/components.d.ts +13 -10
- package/dist/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +6 -0
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/selectedTokens.d.ts +11 -0
- package/dist/theme/selectedTokens.d.ts.map +1 -0
- package/dist/theme/selectedTokens.js +23 -0
- package/dist/theme/selectedTokens.js.map +1 -0
- package/dist/theme/semanticTokens.d.ts +1 -1
- package/dist/theme/semanticTokens.d.ts.map +1 -1
- package/dist/theme/semanticTokens.js +1 -0
- package/dist/theme/semanticTokens.js.map +1 -1
- package/dist/toast/tokens.d.ts +1 -1
- package/dist/tooltip/tokens.d.ts +1 -1
- package/dist/utils/preference.d.ts +7 -0
- package/dist/utils/preference.d.ts.map +1 -0
- package/dist/utils/preference.js +54 -0
- package/dist/utils/preference.js.map +1 -0
- package/package.json +3 -3
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/* The tags as chips in the control, before the input. */
|
|
2
2
|
|
|
3
3
|
.panneau-tags-input-control.panneau-tags-input-control {
|
|
4
|
+
--panneau-tags-input-padding-y: 0.1875rem;
|
|
5
|
+
|
|
4
6
|
flex-wrap: wrap;
|
|
5
7
|
gap: var(--panneau-space-1);
|
|
6
8
|
height: auto;
|
|
7
|
-
padding-block: var(--panneau-
|
|
9
|
+
padding-block: var(--panneau-tags-input-padding-y);
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
.panneau-tags-input-group {
|
|
@@ -36,8 +38,11 @@
|
|
|
36
38
|
outline-offset: 1px;
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
/* Half a target of the density: the tag stays inside the control. */
|
|
39
42
|
.panneau-tags-input-remove {
|
|
40
43
|
display: inline-flex;
|
|
44
|
+
min-width: calc(var(--panneau-target-size) / 2);
|
|
45
|
+
min-height: calc(var(--panneau-target-size) / 2);
|
|
41
46
|
align-items: center;
|
|
42
47
|
justify-content: center;
|
|
43
48
|
padding: 0.125rem;
|
|
@@ -54,7 +59,15 @@
|
|
|
54
59
|
background-color: var(--panneau-color-hover);
|
|
55
60
|
}
|
|
56
61
|
|
|
57
|
-
|
|
62
|
+
/*
|
|
63
|
+
* The input takes what the control's borders and padding leave of its height, so that the control is
|
|
64
|
+
* as tall as other inputs while its tags fit on one line, in each density.
|
|
65
|
+
*/
|
|
66
|
+
.panneau-tags-input-control .panneau-tags-input-input {
|
|
58
67
|
flex: 1 1 6rem;
|
|
59
68
|
min-width: 6rem;
|
|
69
|
+
min-height: calc(
|
|
70
|
+
var(--panneau-control-height) - 2 * var(--panneau-border-width) - 2 *
|
|
71
|
+
var(--panneau-tags-input-padding-y)
|
|
72
|
+
);
|
|
60
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TagsInput.module.js","names":[],"sources":["../../src/tags-input/TagsInput.module.css"],"sourcesContent":["/* The tags as chips in the control, before the input. */\n\n.control.control {\n flex-wrap: wrap;\n gap: var(--panneau-space-1);\n height: auto;\n padding-block: var(--panneau-
|
|
1
|
+
{"version":3,"file":"TagsInput.module.js","names":[],"sources":["../../src/tags-input/TagsInput.module.css"],"sourcesContent":["/* The tags as chips in the control, before the input. */\n\n.control.control {\n --panneau-tags-input-padding-y: 0.1875rem;\n\n flex-wrap: wrap;\n gap: var(--panneau-space-1);\n height: auto;\n padding-block: var(--panneau-tags-input-padding-y);\n}\n\n.group {\n display: contents;\n}\n\n.list {\n display: contents;\n}\n\n.tag {\n display: inline-flex;\n align-items: center;\n gap: var(--panneau-space-1);\n max-width: 100%;\n padding: 0.125rem var(--panneau-space-1) 0.125rem var(--panneau-space-2);\n font-size: var(--panneau-font-size-sm);\n line-height: var(--panneau-line-height-tight);\n color: var(--panneau-color-text);\n background-color: var(--panneau-color-surface-sunken);\n border: var(--panneau-border-width) solid var(--panneau-color-border);\n border-radius: var(--panneau-radius-full);\n outline: none;\n overflow-wrap: anywhere;\n}\n\n.tag[data-focus-visible] {\n outline: var(--panneau-focus-width) solid var(--panneau-color-focus);\n outline-offset: 1px;\n}\n\n/* Half a target of the density: the tag stays inside the control. */\n.remove {\n display: inline-flex;\n min-width: calc(var(--panneau-target-size) / 2);\n min-height: calc(var(--panneau-target-size) / 2);\n align-items: center;\n justify-content: center;\n padding: 0.125rem;\n color: var(--panneau-color-text-muted);\n cursor: pointer;\n background: none;\n border: 0;\n border-radius: var(--panneau-radius-full);\n outline: none;\n}\n\n.remove[data-hovered] {\n color: var(--panneau-color-text);\n background-color: var(--panneau-color-hover);\n}\n\n/*\n * The input takes what the control's borders and padding leave of its height, so that the control is\n * as tall as other inputs while its tags fit on one line, in each density.\n */\n.control .input {\n flex: 1 1 6rem;\n min-width: 6rem;\n min-height: calc(\n var(--panneau-control-height) - 2 * var(--panneau-border-width) - 2 *\n var(--panneau-tags-input-padding-y)\n );\n}\n"],"mappings":""}
|
|
@@ -32,8 +32,10 @@ export interface ThemeReport {
|
|
|
32
32
|
* on the surface, its solid text on the solid background and its hover), and chart colors (3:1
|
|
33
33
|
* against the surface, and categorical colors distinct with color vision deficiencies). Pairs where a color comes
|
|
34
34
|
* from the default theme and is not set by the theme are skipped, except the surface, which falls
|
|
35
|
-
* back to the default one.
|
|
36
|
-
*
|
|
35
|
+
* back to the default one. Selections (`panneau-selected-*`) are checked against the surface, as
|
|
36
|
+
* the accent when the theme doesn't set them. Values that refer to the theme's palette or tokens
|
|
37
|
+
* with `var()` are checked as what they refer to, in tokens and in tones, and translucent colors as
|
|
38
|
+
* they show over what is under them; colors Panneau can't read are listed as unchecked.
|
|
37
39
|
*/
|
|
38
40
|
export declare function checkTheme(theme: Theme): ThemeReport;
|
|
39
41
|
//# sourceMappingURL=checkTheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkTheme.d.ts","sourceRoot":"","sources":["../../src/theme/checkTheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAyB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,KAAK,KAAK,EAAqD,MAAM,SAAS,CAAC;AAGxF,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gGAAgG;IAChG,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IACxB,0BAA0B;IAC1B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,uCAAuC;IACvC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,sEAAsE;IACtE,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC;;;OAGG;IACH,gBAAgB,EAAE,CAAC,oBAAoB,GAAG;QAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CAC7E;
|
|
1
|
+
{"version":3,"file":"checkTheme.d.ts","sourceRoot":"","sources":["../../src/theme/checkTheme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAyB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,KAAK,KAAK,EAAqD,MAAM,SAAS,CAAC;AAGxF,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,gGAAgG;IAChG,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IACxB,0BAA0B;IAC1B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,uCAAuC;IACvC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,sEAAsE;IACtE,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC;;;OAGG;IACH,gBAAgB,EAAE,CAAC,oBAAoB,GAAG;QAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CAC7E;AAkFD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CA+HpD"}
|
package/dist/theme/checkTheme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WHITE, contrastRatio, mixColors, parseColor } from "./color.js";
|
|
1
|
+
import { WHITE, contrastRatio, mixColors, parseColor, parseColorOver } from "./color.js";
|
|
2
2
|
import { MIN_CONTRAST_RATIO, SUBTLE_AMOUNTS, resolveTone } from "./tones.js";
|
|
3
3
|
import { paletteVariables, resolveReference, themeSurfaces } from "./theme.js";
|
|
4
4
|
import { checkColorDifferences } from "./colorVision.js";
|
|
@@ -19,6 +19,11 @@ var CHART_TOKENS = [
|
|
|
19
19
|
"panneau-chart-diverging-negative",
|
|
20
20
|
"panneau-chart-diverging-positive"
|
|
21
21
|
];
|
|
22
|
+
/** Component tokens checked here, and the token each one falls back to when a theme omits it. */
|
|
23
|
+
var FALLBACKS = {
|
|
24
|
+
"panneau-selected-bg": "panneau-color-accent",
|
|
25
|
+
"panneau-selected-text": "panneau-color-accent-text"
|
|
26
|
+
};
|
|
22
27
|
/** Non-text elements (borders of controls, outlines) need 3:1 (WCAG 2 non-text contrast). */
|
|
23
28
|
var MIN_NON_TEXT_RATIO = 3;
|
|
24
29
|
var TOKEN_PAIRS = [
|
|
@@ -58,6 +63,18 @@ var TOKEN_PAIRS = [
|
|
|
58
63
|
"panneau-color-surface",
|
|
59
64
|
MIN_NON_TEXT_RATIO
|
|
60
65
|
],
|
|
66
|
+
[
|
|
67
|
+
"selected text on selected",
|
|
68
|
+
"panneau-selected-text",
|
|
69
|
+
"panneau-selected-bg",
|
|
70
|
+
MIN_CONTRAST_RATIO
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
"selected on surface",
|
|
74
|
+
"panneau-selected-bg",
|
|
75
|
+
"panneau-color-surface",
|
|
76
|
+
MIN_NON_TEXT_RATIO
|
|
77
|
+
],
|
|
61
78
|
[
|
|
62
79
|
"muted tone text on surface",
|
|
63
80
|
"panneau-color-muted",
|
|
@@ -89,8 +106,10 @@ var TOKEN_PAIRS = [
|
|
|
89
106
|
* on the surface, its solid text on the solid background and its hover), and chart colors (3:1
|
|
90
107
|
* against the surface, and categorical colors distinct with color vision deficiencies). Pairs where a color comes
|
|
91
108
|
* from the default theme and is not set by the theme are skipped, except the surface, which falls
|
|
92
|
-
* back to the default one.
|
|
93
|
-
*
|
|
109
|
+
* back to the default one. Selections (`panneau-selected-*`) are checked against the surface, as
|
|
110
|
+
* the accent when the theme doesn't set them. Values that refer to the theme's palette or tokens
|
|
111
|
+
* with `var()` are checked as what they refer to, in tokens and in tones, and translucent colors as
|
|
112
|
+
* they show over what is under them; colors Panneau can't read are listed as unchecked.
|
|
94
113
|
*/
|
|
95
114
|
function checkTheme(theme) {
|
|
96
115
|
const checks = [];
|
|
@@ -104,10 +123,14 @@ function checkTheme(theme) {
|
|
|
104
123
|
...scheme === "dark" ? theme.dark : void 0
|
|
105
124
|
};
|
|
106
125
|
const tokens = Object.fromEntries(Object.entries(variables).map(([name, value]) => [name, resolveReference(value, variables)]));
|
|
126
|
+
Object.entries(FALLBACKS).forEach(([name, fallback]) => {
|
|
127
|
+
const value = tokens[fallback];
|
|
128
|
+
if (tokens[name] === void 0 && value !== void 0) tokens[name] = value;
|
|
129
|
+
});
|
|
107
130
|
const surface = tokens["panneau-color-surface"];
|
|
108
131
|
const surfaceColor = surface !== void 0 ? parseColor(surface) : DEFAULT_SURFACES[scheme];
|
|
109
|
-
const add = (name, foreground, background, minimum, backgroundColor =
|
|
110
|
-
const foregroundColor =
|
|
132
|
+
const add = (name, foreground, background, minimum, backgroundColor = parseColorOver(background, surfaceColor)) => {
|
|
133
|
+
const foregroundColor = parseColorOver(foreground, backgroundColor);
|
|
111
134
|
checks.push({
|
|
112
135
|
scheme,
|
|
113
136
|
name,
|
|
@@ -134,10 +157,10 @@ function checkTheme(theme) {
|
|
|
134
157
|
})));
|
|
135
158
|
Object.entries(theme.tones ?? {}).forEach(([tone, toneInput]) => {
|
|
136
159
|
const input = typeof toneInput === "string" ? resolveReference(toneInput, palette) : toneInput;
|
|
137
|
-
const values = resolveTone(input, surfaces)[scheme];
|
|
160
|
+
const values = Object.fromEntries(Object.entries(resolveTone(input, surfaces)[scheme]).map(([key, value]) => [key, resolveReference(value, variables)]));
|
|
138
161
|
add(`tone ${tone}: text on surface`, values.text, surface ?? (scheme === "light" ? "#ffffff" : "#18181b"), MIN_CONTRAST_RATIO, surfaceColor);
|
|
139
162
|
const color = typeof input === "string" ? parseColor(input) : null;
|
|
140
|
-
const subtleColor =
|
|
163
|
+
const subtleColor = parseColorOver(values.subtle, surfaceColor) ?? (color !== null && surfaceColor !== null ? mixColors(surfaceColor, color, SUBTLE_AMOUNTS[scheme]) : null);
|
|
141
164
|
add(`tone ${tone}: text on subtle`, values.text, values.subtle, MIN_CONTRAST_RATIO, subtleColor);
|
|
142
165
|
add(`tone ${tone}: solid text on solid`, values.solidText, values.solid, MIN_CONTRAST_RATIO);
|
|
143
166
|
add(`tone ${tone}: solid text on hover`, values.solidText, values.solidHover, MIN_CONTRAST_RATIO);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkTheme.js","names":["Rgb","WHITE","contrastRatio","mixColors","parseColor","ColorDifferenceCheck","checkColorDifferences","Theme","paletteVariables","resolveReference","themeSurfaces","MIN_CONTRAST_RATIO","SUBTLE_AMOUNTS","resolveTone","ThemeContrastCheck","scheme","name","foreground","background","ratio","minimum","ThemeReport","checks","failures","unchecked","colorDifferences","DEFAULT_SURFACES","Record","light","dark","r","g","b","CHART_TOKENS","Array","from","length","_","index","MIN_NON_TEXT_RATIO","TOKEN_PAIRS","checkTheme","theme","palette","surfaces","const","forEach","variables","tokens","undefined","Object","fromEntries","entries","map","value","surface","surfaceColor","add","backgroundColor","foregroundColor","push","Math","round","foregroundValue","backgroundValue","surfaceValue","token","replace","categorical","filter","includes","flatMap","check","tones","tone","toneInput","input","values","text","color","subtleColor","subtle","solidText","solid","solidHover"],"sources":["../../src/theme/checkTheme.ts"],"sourcesContent":["import { type Rgb, WHITE, contrastRatio, mixColors, parseColor } from './color';\nimport { type ColorDifferenceCheck, checkColorDifferences } from './colorVision';\nimport { type Theme, paletteVariables, resolveReference, themeSurfaces } from './theme';\nimport { MIN_CONTRAST_RATIO, SUBTLE_AMOUNTS, resolveTone } from './tones';\n\n/** A pair of colors that a theme must keep readable. */\nexport interface ThemeContrastCheck {\n scheme: 'light' | 'dark';\n /** What is checked: `tone signal: text on surface`, `tokens: text on bg`. */\n name: string;\n foreground: string;\n background: string;\n /** The contrast ratio, or `null` when a color can't be read (a CSS variable, `color-mix()`). */\n ratio: number | null;\n minimum: number;\n}\n\nexport interface ThemeReport {\n /** Every pair checked. */\n checks: ThemeContrastCheck[];\n /** Pairs below their minimum ratio. */\n failures: ThemeContrastCheck[];\n /** Pairs with a color Panneau can't read: check them in a browser. */\n unchecked: ThemeContrastCheck[];\n /**\n * Categorical chart colors of the theme that look too alike, for typical vision or with a\n * color vision deficiency.\n */\n colorDifferences: (ColorDifferenceCheck & { scheme: 'light' | 'dark' })[];\n}\n\n/** Surfaces of the default theme, used when a theme doesn't set its own. */\nconst DEFAULT_SURFACES: Record<'light' | 'dark', Rgb> = {\n light: WHITE,\n dark: { r: 24, g: 24, b: 27 },\n};\n\n/** Chart colors that must stand out from the surface: series, the high step and diverging ends. */\nconst CHART_TOKENS = [\n ...Array.from({ length: 8 }, (_, index) => `panneau-chart-categorical-${index + 1}`),\n 'panneau-chart-sequential-5',\n 'panneau-chart-diverging-negative',\n 'panneau-chart-diverging-positive',\n];\n\n/** Non-text elements (borders of controls, outlines) need 3:1 (WCAG 2 non-text contrast). */\nconst MIN_NON_TEXT_RATIO = 3;\n\nconst TOKEN_PAIRS: [name: string, foreground: string, background: string, minimum: number][] = [\n ['text on bg', 'panneau-color-text', 'panneau-color-bg', MIN_CONTRAST_RATIO],\n ['text on surface', 'panneau-color-text', 'panneau-color-surface', MIN_CONTRAST_RATIO],\n [\n 'muted text on surface',\n 'panneau-color-text-muted',\n 'panneau-color-surface',\n MIN_CONTRAST_RATIO,\n ],\n ['link on surface', 'panneau-color-link', 'panneau-color-surface', MIN_CONTRAST_RATIO],\n [\n 'accent text on accent',\n 'panneau-color-accent-text',\n 'panneau-color-accent',\n MIN_CONTRAST_RATIO,\n ],\n [\n 'control border on surface',\n 'panneau-color-border-control',\n 'panneau-color-surface',\n MIN_NON_TEXT_RATIO,\n ],\n // The muted tone has no fill: its text and its outline sit on the surface.\n [\n 'muted tone text on surface',\n 'panneau-color-muted',\n 'panneau-color-surface',\n MIN_CONTRAST_RATIO,\n ],\n [\n 'muted tone border on surface',\n 'panneau-color-muted-border',\n 'panneau-color-surface',\n MIN_NON_TEXT_RATIO,\n ],\n [\n 'muted tone solid text on solid',\n 'panneau-color-muted-solid-text',\n 'panneau-color-muted-solid',\n MIN_CONTRAST_RATIO,\n ],\n [\n 'muted tone solid text on hover',\n 'panneau-color-muted-solid-text',\n 'panneau-color-muted-solid-hover',\n MIN_CONTRAST_RATIO,\n ],\n];\n\n/**\n * Checks the contrast of a theme, like Bootstrap's `$min-contrast-ratio`, but as a report: text\n * tokens against backgrounds (4.5:1), control borders (3:1), and every tone of the theme (its text\n * on the surface, its solid text on the solid background and its hover), and chart colors (3:1\n * against the surface, and categorical colors distinct with color vision deficiencies). Pairs where a color comes\n * from the default theme and is not set by the theme are skipped, except the surface, which falls\n * back to the default one. Values that refer to the theme's palette or tokens with `var()` are\n * checked as what they refer to; colors Panneau can't read are listed as unchecked.\n */\nexport function checkTheme(theme: Theme): ThemeReport {\n const checks: ThemeContrastCheck[] = [];\n const colorDifferences: ThemeReport['colorDifferences'] = [];\n const palette = paletteVariables(theme.palette);\n const surfaces = themeSurfaces(theme);\n (['light', 'dark'] as const).forEach((scheme) => {\n const variables = {\n ...palette,\n ...theme.tokens,\n ...(scheme === 'dark' ? theme.dark : undefined),\n };\n const tokens = Object.fromEntries(\n Object.entries(variables).map(([name, value]) => [\n name,\n resolveReference(value, variables),\n ]),\n );\n const surface = tokens['panneau-color-surface'];\n const surfaceColor = surface !== undefined ? parseColor(surface) : DEFAULT_SURFACES[scheme];\n const add = (\n name: string,\n foreground: string,\n background: string,\n minimum: number,\n backgroundColor: Rgb | null = parseColor(background),\n ) => {\n const foregroundColor = parseColor(foreground);\n checks.push({\n scheme,\n name,\n foreground,\n background,\n ratio:\n foregroundColor !== null && backgroundColor !== null\n ? Math.round(contrastRatio(foregroundColor, backgroundColor) * 100) / 100\n : null,\n minimum,\n });\n };\n TOKEN_PAIRS.forEach(([name, foreground, background, minimum]) => {\n const foregroundValue = tokens[foreground];\n const backgroundValue = tokens[background];\n if (foregroundValue !== undefined && backgroundValue !== undefined) {\n add(`tokens: ${name}`, foregroundValue, backgroundValue, minimum);\n }\n });\n // Chart colors are graphics: 3:1 against the surface, and distinct from each other.\n const surfaceValue = surface ?? (scheme === 'light' ? '#ffffff' : '#18181b');\n CHART_TOKENS.forEach((token) => {\n const value = tokens[token];\n if (value !== undefined) {\n add(\n `chart: ${token.replace('panneau-chart-', '')} on surface`,\n value,\n surfaceValue,\n MIN_NON_TEXT_RATIO,\n surfaceColor,\n );\n }\n });\n const categorical = CHART_TOKENS.filter((token) => token.includes('categorical')).flatMap(\n (token) => (tokens[token] !== undefined ? [tokens[token]] : []),\n );\n colorDifferences.push(\n ...checkColorDifferences(categorical).map((check) => ({ ...check, scheme })),\n );\n Object.entries(theme.tones ?? {}).forEach(([tone, toneInput]) => {\n const input =\n typeof toneInput === 'string' ? resolveReference(toneInput, palette) : toneInput;\n const values = resolveTone(input, surfaces)[scheme];\n add(\n `tone ${tone}: text on surface`,\n values.text,\n surface ?? (scheme === 'light' ? '#ffffff' : '#18181b'),\n MIN_CONTRAST_RATIO,\n surfaceColor,\n );\n // The subtle background of a tone is often mixed with the surface in CSS: compute it\n // against the surface of the scheme when it can't be read directly.\n const color = typeof input === 'string' ? parseColor(input) : null;\n const subtleColor =\n parseColor(values.subtle) ??\n (color !== null && surfaceColor !== null\n ? mixColors(surfaceColor, color, SUBTLE_AMOUNTS[scheme])\n : null);\n add(\n `tone ${tone}: text on subtle`,\n values.text,\n values.subtle,\n MIN_CONTRAST_RATIO,\n subtleColor,\n );\n add(\n `tone ${tone}: solid text on solid`,\n values.solidText,\n values.solid,\n MIN_CONTRAST_RATIO,\n );\n add(\n `tone ${tone}: solid text on hover`,\n values.solidText,\n values.solidHover,\n MIN_CONTRAST_RATIO,\n );\n });\n });\n return {\n checks,\n failures: checks.filter((check) => check.ratio !== null && check.ratio < check.minimum),\n unchecked: checks.filter((check) => check.ratio === null),\n colorDifferences,\n };\n}\n"],"mappings":";;;;;;AAgCA,IAAM0B,mBAAkD;CACpDE,OAAO3B;CACP4B,MAAM;EAAEC,GAAG;EAAIC,GAAG;EAAIC,GAAG;CAAG;AAChC;;AAGA,IAAMC,eAAe;CACjB,GAAGC,MAAMC,KAAK,EAAEC,QAAQ,EAAE,IAAIC,GAAGC,UAAU,6BAA6BA,QAAQ,GAAG;CACnF;CACA;CACA;AAAkC;;AAItC,IAAMC,qBAAqB;AAE3B,IAAMC,cAAyF;CAC3F;EAAC;EAAc;EAAsB;EAAoB7B;CAAkB;CAC3E;EAAC;EAAmB;EAAsB;EAAyBA;CAAkB;CACrF;EACI;EACA;EACA;EACAA;CAAkB;CAEtB;EAAC;EAAmB;EAAsB;EAAyBA;CAAkB;CACrF;EACI;EACA;EACA;EACAA;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QiB,KAAI,wBACZG,OAAOK,WACPL,OAAOM,OACPxE,kBACJ;GACA8C,IACI,QAAQiB,KAAI,wBACZG,OAAOK,WACPL,OAAOO,YACPzE,kBACJ;EACJ,CAAC;CACL,CAAC;CACD,OAAO;EACHW;EACAC,UAAUD,OAAO+C,QAAQG,UAAUA,MAAMrD,UAAU,QAAQqD,MAAMrD,QAAQqD,MAAMpD,OAAO;EACtFI,WAAWF,OAAO+C,QAAQG,UAAUA,MAAMrD,UAAU,IAAI;EACxDM;CACJ;AACJ"}
|
|
1
|
+
{"version":3,"file":"checkTheme.js","names":["Rgb","WHITE","contrastRatio","mixColors","parseColor","parseColorOver","ColorDifferenceCheck","checkColorDifferences","Theme","paletteVariables","resolveReference","themeSurfaces","MIN_CONTRAST_RATIO","SUBTLE_AMOUNTS","ToneValues","resolveTone","ThemeContrastCheck","scheme","name","foreground","background","ratio","minimum","ThemeReport","checks","failures","unchecked","colorDifferences","DEFAULT_SURFACES","Record","light","dark","r","g","b","CHART_TOKENS","Array","from","length","_","index","FALLBACKS","Readonly","MIN_NON_TEXT_RATIO","TOKEN_PAIRS","checkTheme","theme","palette","surfaces","const","forEach","variables","tokens","undefined","Object","fromEntries","entries","map","value","fallback","surface","surfaceColor","add","backgroundColor","foregroundColor","push","Math","round","foregroundValue","backgroundValue","surfaceValue","token","replace","categorical","filter","includes","flatMap","check","tones","tone","toneInput","input","values","key","text","color","subtleColor","subtle","solidText","solid","solidHover"],"sources":["../../src/theme/checkTheme.ts"],"sourcesContent":["import { type Rgb, WHITE, contrastRatio, mixColors, parseColor, parseColorOver } from './color';\nimport { type ColorDifferenceCheck, checkColorDifferences } from './colorVision';\nimport { type Theme, paletteVariables, resolveReference, themeSurfaces } from './theme';\nimport { MIN_CONTRAST_RATIO, SUBTLE_AMOUNTS, type ToneValues, resolveTone } from './tones';\n\n/** A pair of colors that a theme must keep readable. */\nexport interface ThemeContrastCheck {\n scheme: 'light' | 'dark';\n /** What is checked: `tone signal: text on surface`, `tokens: text on bg`. */\n name: string;\n foreground: string;\n background: string;\n /** The contrast ratio, or `null` when a color can't be read (a CSS variable, `color-mix()`). */\n ratio: number | null;\n minimum: number;\n}\n\nexport interface ThemeReport {\n /** Every pair checked. */\n checks: ThemeContrastCheck[];\n /** Pairs below their minimum ratio. */\n failures: ThemeContrastCheck[];\n /** Pairs with a color Panneau can't read: check them in a browser. */\n unchecked: ThemeContrastCheck[];\n /**\n * Categorical chart colors of the theme that look too alike, for typical vision or with a\n * color vision deficiency.\n */\n colorDifferences: (ColorDifferenceCheck & { scheme: 'light' | 'dark' })[];\n}\n\n/** Surfaces of the default theme, used when a theme doesn't set its own. */\nconst DEFAULT_SURFACES: Record<'light' | 'dark', Rgb> = {\n light: WHITE,\n dark: { r: 24, g: 24, b: 27 },\n};\n\n/** Chart colors that must stand out from the surface: series, the high step and diverging ends. */\nconst CHART_TOKENS = [\n ...Array.from({ length: 8 }, (_, index) => `panneau-chart-categorical-${index + 1}`),\n 'panneau-chart-sequential-5',\n 'panneau-chart-diverging-negative',\n 'panneau-chart-diverging-positive',\n];\n\n/** Component tokens checked here, and the token each one falls back to when a theme omits it. */\nconst FALLBACKS: Readonly<Record<string, string>> = {\n 'panneau-selected-bg': 'panneau-color-accent',\n 'panneau-selected-text': 'panneau-color-accent-text',\n};\n\n/** Non-text elements (borders of controls, outlines) need 3:1 (WCAG 2 non-text contrast). */\nconst MIN_NON_TEXT_RATIO = 3;\n\nconst TOKEN_PAIRS: [name: string, foreground: string, background: string, minimum: number][] = [\n ['text on bg', 'panneau-color-text', 'panneau-color-bg', MIN_CONTRAST_RATIO],\n ['text on surface', 'panneau-color-text', 'panneau-color-surface', MIN_CONTRAST_RATIO],\n [\n 'muted text on surface',\n 'panneau-color-text-muted',\n 'panneau-color-surface',\n MIN_CONTRAST_RATIO,\n ],\n ['link on surface', 'panneau-color-link', 'panneau-color-surface', MIN_CONTRAST_RATIO],\n [\n 'accent text on accent',\n 'panneau-color-accent-text',\n 'panneau-color-accent',\n MIN_CONTRAST_RATIO,\n ],\n [\n 'control border on surface',\n 'panneau-color-border-control',\n 'panneau-color-surface',\n MIN_NON_TEXT_RATIO,\n ],\n // Checked boxes, selected rows and the current tab: the accent unless the theme sets them.\n [\n 'selected text on selected',\n 'panneau-selected-text',\n 'panneau-selected-bg',\n MIN_CONTRAST_RATIO,\n ],\n ['selected on surface', 'panneau-selected-bg', 'panneau-color-surface', MIN_NON_TEXT_RATIO],\n // The muted tone has no fill: its text and its outline sit on the surface.\n [\n 'muted tone text on surface',\n 'panneau-color-muted',\n 'panneau-color-surface',\n MIN_CONTRAST_RATIO,\n ],\n [\n 'muted tone border on surface',\n 'panneau-color-muted-border',\n 'panneau-color-surface',\n MIN_NON_TEXT_RATIO,\n ],\n [\n 'muted tone solid text on solid',\n 'panneau-color-muted-solid-text',\n 'panneau-color-muted-solid',\n MIN_CONTRAST_RATIO,\n ],\n [\n 'muted tone solid text on hover',\n 'panneau-color-muted-solid-text',\n 'panneau-color-muted-solid-hover',\n MIN_CONTRAST_RATIO,\n ],\n];\n\n/**\n * Checks the contrast of a theme, like Bootstrap's `$min-contrast-ratio`, but as a report: text\n * tokens against backgrounds (4.5:1), control borders (3:1), and every tone of the theme (its text\n * on the surface, its solid text on the solid background and its hover), and chart colors (3:1\n * against the surface, and categorical colors distinct with color vision deficiencies). Pairs where a color comes\n * from the default theme and is not set by the theme are skipped, except the surface, which falls\n * back to the default one. Selections (`panneau-selected-*`) are checked against the surface, as\n * the accent when the theme doesn't set them. Values that refer to the theme's palette or tokens\n * with `var()` are checked as what they refer to, in tokens and in tones, and translucent colors as\n * they show over what is under them; colors Panneau can't read are listed as unchecked.\n */\nexport function checkTheme(theme: Theme): ThemeReport {\n const checks: ThemeContrastCheck[] = [];\n const colorDifferences: ThemeReport['colorDifferences'] = [];\n const palette = paletteVariables(theme.palette);\n const surfaces = themeSurfaces(theme);\n (['light', 'dark'] as const).forEach((scheme) => {\n const variables = {\n ...palette,\n ...theme.tokens,\n ...(scheme === 'dark' ? theme.dark : undefined),\n };\n const tokens: Record<string, string> = Object.fromEntries(\n Object.entries(variables).map(([name, value]) => [\n name,\n resolveReference(value, variables),\n ]),\n );\n // Tokens that default to another one, as their fallback in the CSS does.\n Object.entries(FALLBACKS).forEach(([name, fallback]) => {\n const value = tokens[fallback];\n if (tokens[name] === undefined && value !== undefined) {\n tokens[name] = value;\n }\n });\n const surface = tokens['panneau-color-surface'];\n const surfaceColor = surface !== undefined ? parseColor(surface) : DEFAULT_SURFACES[scheme];\n const add = (\n name: string,\n foreground: string,\n background: string,\n minimum: number,\n // A translucent background shows the surface through it, and a translucent\n // foreground shows the background.\n backgroundColor: Rgb | null = parseColorOver(background, surfaceColor),\n ) => {\n const foregroundColor = parseColorOver(foreground, backgroundColor);\n checks.push({\n scheme,\n name,\n foreground,\n background,\n ratio:\n foregroundColor !== null && backgroundColor !== null\n ? Math.round(contrastRatio(foregroundColor, backgroundColor) * 100) / 100\n : null,\n minimum,\n });\n };\n TOKEN_PAIRS.forEach(([name, foreground, background, minimum]) => {\n const foregroundValue = tokens[foreground];\n const backgroundValue = tokens[background];\n if (foregroundValue !== undefined && backgroundValue !== undefined) {\n add(`tokens: ${name}`, foregroundValue, backgroundValue, minimum);\n }\n });\n // Chart colors are graphics: 3:1 against the surface, and distinct from each other.\n const surfaceValue = surface ?? (scheme === 'light' ? '#ffffff' : '#18181b');\n CHART_TOKENS.forEach((token) => {\n const value = tokens[token];\n if (value !== undefined) {\n add(\n `chart: ${token.replace('panneau-chart-', '')} on surface`,\n value,\n surfaceValue,\n MIN_NON_TEXT_RATIO,\n surfaceColor,\n );\n }\n });\n const categorical = CHART_TOKENS.filter((token) => token.includes('categorical')).flatMap(\n (token) => (tokens[token] !== undefined ? [tokens[token]] : []),\n );\n colorDifferences.push(\n ...checkColorDifferences(categorical).map((check) => ({ ...check, scheme })),\n );\n Object.entries(theme.tones ?? {}).forEach(([tone, toneInput]) => {\n const input =\n typeof toneInput === 'string' ? resolveReference(toneInput, palette) : toneInput;\n // Values given one by one can refer to the palette or to tokens, like tokens can.\n const values = Object.fromEntries(\n Object.entries(resolveTone(input, surfaces)[scheme]).map(([key, value]) => [\n key,\n resolveReference(value, variables),\n ]),\n ) as ToneValues;\n add(\n `tone ${tone}: text on surface`,\n values.text,\n surface ?? (scheme === 'light' ? '#ffffff' : '#18181b'),\n MIN_CONTRAST_RATIO,\n surfaceColor,\n );\n // The subtle background of a tone is often mixed with the surface in CSS: compute it\n // against the surface of the scheme when it can't be read directly.\n const color = typeof input === 'string' ? parseColor(input) : null;\n const subtleColor =\n parseColorOver(values.subtle, surfaceColor) ??\n (color !== null && surfaceColor !== null\n ? mixColors(surfaceColor, color, SUBTLE_AMOUNTS[scheme])\n : null);\n add(\n `tone ${tone}: text on subtle`,\n values.text,\n values.subtle,\n MIN_CONTRAST_RATIO,\n subtleColor,\n );\n add(\n `tone ${tone}: solid text on solid`,\n values.solidText,\n values.solid,\n MIN_CONTRAST_RATIO,\n );\n add(\n `tone ${tone}: solid text on hover`,\n values.solidText,\n values.solidHover,\n MIN_CONTRAST_RATIO,\n );\n });\n });\n return {\n checks,\n failures: checks.filter((check) => check.ratio !== null && check.ratio < check.minimum),\n unchecked: checks.filter((check) => check.ratio === null),\n colorDifferences,\n };\n}\n"],"mappings":";;;;;;AAgCA,IAAM4B,mBAAkD;CACpDE,OAAO7B;CACP8B,MAAM;EAAEC,GAAG;EAAIC,GAAG;EAAIC,GAAG;CAAG;AAChC;;AAGA,IAAMC,eAAe;CACjB,GAAGC,MAAMC,KAAK,EAAEC,QAAQ,EAAE,IAAIC,GAAGC,UAAU,6BAA6BA,QAAQ,GAAG;CACnF;CACA;CACA;AAAkC;;AAItC,IAAMC,YAA8C;CAChD,uBAAuB;CACvB,yBAAyB;AAC7B;;AAGA,IAAME,qBAAqB;AAE3B,IAAMC,cAAyF;CAC3F;EAAC;EAAc;EAAsB;EAAoBhC;CAAkB;CAC3E;EAAC;EAAmB;EAAsB;EAAyBA;CAAkB;C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AAOjC,QAAQ,CAAC,CAAC/B,OAAO,CAAC,CAACwC,KAAK,CAAC0B,KAAKzB,WAAW,CACvEyB,KACAzE,iBAAiBgD,OAAOP,SAAS,CAAC,CACrC,CACL;GACAW,IACI,QAAQiB,KAAI,oBACZG,OAAOE,MACPxB,YAAY3C,WAAW,UAAU,YAAY,YAC7CL,oBACAiD,YACJ;GAGA,MAAMwB,QAAQ,OAAOJ,UAAU,WAAW7E,WAAW6E,KAAK,IAAI;GAC9D,MAAMK,cACFjF,eAAe6E,OAAOK,QAAQ1B,YAAY,MACzCwB,UAAU,QAAQxB,iBAAiB,OAC9B1D,UAAU0D,cAAcwB,OAAOxE,eAAeI,OAAO,IACrD;GACV6C,IACI,QAAQiB,KAAI,mBACZG,OAAOE,MACPF,OAAOK,QACP3E,oBACA0E,WACJ;GACAxB,IACI,QAAQiB,KAAI,wBACZG,OAAOM,WACPN,OAAOO,OACP7E,kBACJ;GACAkD,IACI,QAAQiB,KAAI,wBACZG,OAAOM,WACPN,OAAOQ,YACP9E,kBACJ;EACJ,CAAC;CACL,CAAC;CACD,OAAO;EACHY;EACAC,UAAUD,OAAOkD,QAAQG,UAAUA,MAAMxD,UAAU,QAAQwD,MAAMxD,QAAQwD,MAAMvD,OAAO;EACtFI,WAAWF,OAAOkD,QAAQG,UAAUA,MAAMxD,UAAU,IAAI;EACxDM;CACJ;AACJ"}
|
package/dist/theme/color.d.ts
CHANGED
|
@@ -9,6 +9,19 @@ export interface Rgb {
|
|
|
9
9
|
* variable, a named color, `color-mix()`), which Panneau can't compute with.
|
|
10
10
|
*/
|
|
11
11
|
export declare function parseColor(value: string): Rgb | null;
|
|
12
|
+
/**
|
|
13
|
+
* Reads a color like `parseColor()`, with its opacity: `rgb(0 0 0 / 0.45)`, `rgba(0, 0, 0, 45%)`,
|
|
14
|
+
* `#00000073`. The opacity is 1 for opaque colors.
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseColorWithAlpha(value: string): {
|
|
17
|
+
color: Rgb;
|
|
18
|
+
alpha: number;
|
|
19
|
+
} | null;
|
|
20
|
+
/**
|
|
21
|
+
* Reads a color as it shows over another one: a translucent color is blended with what is under
|
|
22
|
+
* it. Returns `null` for a color Panneau can't read, or a translucent one over an unknown color.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseColorOver(value: string, under: Rgb | null): Rgb | null;
|
|
12
25
|
/** A color as `#rrggbb`. */
|
|
13
26
|
export declare function toHex({ r, g, b }: Rgb): string;
|
|
14
27
|
/** Mixes two colors in sRGB, like `color-mix(in srgb, a, b <amount>)`: 0 gives `a`, 1 gives `b`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/theme/color.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,MAAM,WAAW,GAAG;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAMD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAoBpD;AAED,4BAA4B;AAC5B,wBAAgB,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,MAAM,CAI9C;AAED,oGAAoG;AACpG,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAM7D;AAOD,gDAAgD;AAChD,wBAAgB,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,MAAM,CAElD;AAED,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAGpD;AAED,eAAO,MAAM,KAAK,EAAE,GAAgC,CAAC;AACrD,eAAO,MAAM,KAAK,EAAE,GAA0B,CAAC;A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GpD;AAED,eAAO,MAAM,KAAK,EAAE,GAAgC,CAAC;AACrD,eAAO,MAAM,KAAK,EAAE,GAA0B,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,CAY9E;AAED,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,GAAG,GAAG,GAAG,CAEtD"}
|
package/dist/theme/color.js
CHANGED
|
@@ -31,6 +31,46 @@ function parseColor(value) {
|
|
|
31
31
|
}
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
|
+
var HEX_ALPHA = /^#([0-9a-f]{4}|[0-9a-f]{8})$/i;
|
|
35
|
+
var ALPHA = /^rgba?\(.*[,/]\s*([\d.]+)(%?)\s*\)$/i;
|
|
36
|
+
/**
|
|
37
|
+
* Reads a color like `parseColor()`, with its opacity: `rgb(0 0 0 / 0.45)`, `rgba(0, 0, 0, 45%)`,
|
|
38
|
+
* `#00000073`. The opacity is 1 for opaque colors.
|
|
39
|
+
*/
|
|
40
|
+
function parseColorWithAlpha(value) {
|
|
41
|
+
const color = value.trim();
|
|
42
|
+
const hex = HEX_ALPHA.exec(color);
|
|
43
|
+
if (hex?.[1] !== void 0) {
|
|
44
|
+
const digits = hex[1].length === 4 ? [...hex[1]].map((digit) => digit + digit).join("") : hex[1];
|
|
45
|
+
const rgb = parseColor(`#${digits.slice(0, 6)}`);
|
|
46
|
+
return rgb !== null ? {
|
|
47
|
+
color: rgb,
|
|
48
|
+
alpha: Number.parseInt(digits.slice(6, 8), 16) / 255
|
|
49
|
+
} : null;
|
|
50
|
+
}
|
|
51
|
+
const rgb = parseColor(color);
|
|
52
|
+
if (rgb === null) return null;
|
|
53
|
+
const alpha = ALPHA.exec(color);
|
|
54
|
+
if (alpha?.[1] === void 0) return {
|
|
55
|
+
color: rgb,
|
|
56
|
+
alpha: 1
|
|
57
|
+
};
|
|
58
|
+
const amount = Number(alpha[1]) / (alpha[2] === "%" ? 100 : 1);
|
|
59
|
+
return {
|
|
60
|
+
color: rgb,
|
|
61
|
+
alpha: Math.min(1, Math.max(0, amount))
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Reads a color as it shows over another one: a translucent color is blended with what is under
|
|
66
|
+
* it. Returns `null` for a color Panneau can't read, or a translucent one over an unknown color.
|
|
67
|
+
*/
|
|
68
|
+
function parseColorOver(value, under) {
|
|
69
|
+
const parsed = parseColorWithAlpha(value);
|
|
70
|
+
if (parsed === null) return null;
|
|
71
|
+
if (parsed.alpha >= 1) return parsed.color;
|
|
72
|
+
return under !== null ? mixColors(under, parsed.color, parsed.alpha) : null;
|
|
73
|
+
}
|
|
34
74
|
/** A color as `#rrggbb`. */
|
|
35
75
|
function toHex({ r, g, b }) {
|
|
36
76
|
return `#${[
|
|
@@ -89,6 +129,6 @@ function readableTextColor(background) {
|
|
|
89
129
|
return contrastRatio(WHITE, background) >= contrastRatio(BLACK, background) ? WHITE : BLACK;
|
|
90
130
|
}
|
|
91
131
|
//#endregion
|
|
92
|
-
export { BLACK, WHITE, contrastRatio, ensureContrast, luminance, mixColors, parseColor, readableTextColor, toHex };
|
|
132
|
+
export { BLACK, WHITE, contrastRatio, ensureContrast, luminance, mixColors, parseColor, parseColorOver, parseColorWithAlpha, readableTextColor, toHex };
|
|
93
133
|
|
|
94
134
|
//# sourceMappingURL=color.js.map
|
package/dist/theme/color.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.js","names":["Rgb","r","g","b","HEX","RGB","parseColor","value","color","trim","hex","exec","undefined","digits","length","map","digit","join","Number","parseInt","slice","rgb","channel","Math","min","max","
|
|
1
|
+
{"version":3,"file":"color.js","names":["Rgb","r","g","b","HEX","RGB","parseColor","value","color","trim","hex","exec","undefined","digits","length","map","digit","join","Number","parseInt","slice","rgb","channel","Math","min","max","HEX_ALPHA","ALPHA","parseColorWithAlpha","alpha","amount","parseColorOver","under","parsed","mixColors","toHex","round","toString","padStart","a","linear","luminance","contrastRatio","light","dark","sort","x","y","WHITE","BLACK","ensureContrast","background","ratio","target","step","mixed","readableTextColor"],"sources":["../../src/theme/color.ts"],"sourcesContent":["/** An sRGB color, with channels from 0 to 255. */\nexport interface Rgb {\n r: number;\n g: number;\n b: number;\n}\n\nconst HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\nconst RGB =\n /^rgba?\\(\\s*(\\d+(?:\\.\\d+)?)[\\s,]+(\\d+(?:\\.\\d+)?)[\\s,]+(\\d+(?:\\.\\d+)?)\\s*(?:[,/]\\s*[\\d.]+%?\\s*)?\\)$/i;\n\n/**\n * Reads a hex (`#05f`, `#0055ff`) or `rgb()` color. Returns `null` for anything else (a CSS\n * variable, a named color, `color-mix()`), which Panneau can't compute with.\n */\nexport function parseColor(value: string): Rgb | null {\n const color = value.trim();\n const hex = HEX.exec(color);\n if (hex?.[1] !== undefined) {\n const digits =\n hex[1].length === 3 ? [...hex[1]].map((digit) => digit + digit).join('') : hex[1];\n return {\n r: Number.parseInt(digits.slice(0, 2), 16),\n g: Number.parseInt(digits.slice(2, 4), 16),\n b: Number.parseInt(digits.slice(4, 6), 16),\n };\n }\n const rgb = RGB.exec(color);\n if (rgb !== null) {\n const [r, g, b] = [rgb[1], rgb[2], rgb[3]].map((channel) =>\n Math.min(255, Math.max(0, Number(channel))),\n );\n return { r: r ?? 0, g: g ?? 0, b: b ?? 0 };\n }\n return null;\n}\n\nconst HEX_ALPHA = /^#([0-9a-f]{4}|[0-9a-f]{8})$/i;\nconst ALPHA = /^rgba?\\(.*[,/]\\s*([\\d.]+)(%?)\\s*\\)$/i;\n\n/**\n * Reads a color like `parseColor()`, with its opacity: `rgb(0 0 0 / 0.45)`, `rgba(0, 0, 0, 45%)`,\n * `#00000073`. The opacity is 1 for opaque colors.\n */\nexport function parseColorWithAlpha(value: string): { color: Rgb; alpha: number } | null {\n const color = value.trim();\n const hex = HEX_ALPHA.exec(color);\n if (hex?.[1] !== undefined) {\n const digits =\n hex[1].length === 4 ? [...hex[1]].map((digit) => digit + digit).join('') : hex[1];\n const rgb = parseColor(`#${digits.slice(0, 6)}`);\n return rgb !== null\n ? { color: rgb, alpha: Number.parseInt(digits.slice(6, 8), 16) / 255 }\n : null;\n }\n const rgb = parseColor(color);\n if (rgb === null) {\n return null;\n }\n const alpha = ALPHA.exec(color);\n if (alpha?.[1] === undefined) {\n return { color: rgb, alpha: 1 };\n }\n const amount = Number(alpha[1]) / (alpha[2] === '%' ? 100 : 1);\n return { color: rgb, alpha: Math.min(1, Math.max(0, amount)) };\n}\n\n/**\n * Reads a color as it shows over another one: a translucent color is blended with what is under\n * it. Returns `null` for a color Panneau can't read, or a translucent one over an unknown color.\n */\nexport function parseColorOver(value: string, under: Rgb | null): Rgb | null {\n const parsed = parseColorWithAlpha(value);\n if (parsed === null) {\n return null;\n }\n if (parsed.alpha >= 1) {\n return parsed.color;\n }\n return under !== null ? mixColors(under, parsed.color, parsed.alpha) : null;\n}\n\n/** A color as `#rrggbb`. */\nexport function toHex({ r, g, b }: Rgb): string {\n return `#${[r, g, b]\n .map((channel) => Math.round(channel).toString(16).padStart(2, '0'))\n .join('')}`;\n}\n\n/** Mixes two colors in sRGB, like `color-mix(in srgb, a, b <amount>)`: 0 gives `a`, 1 gives `b`. */\nexport function mixColors(a: Rgb, b: Rgb, amount: number): Rgb {\n return {\n r: a.r + (b.r - a.r) * amount,\n g: a.g + (b.g - a.g) * amount,\n b: a.b + (b.b - a.b) * amount,\n };\n}\n\nfunction linear(channel: number): number {\n const value = channel / 255;\n return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;\n}\n\n/** Relative luminance, as defined by WCAG 2. */\nexport function luminance({ r, g, b }: Rgb): number {\n return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);\n}\n\n/** Contrast ratio between two colors, from 1 to 21 (WCAG 2). */\nexport function contrastRatio(a: Rgb, b: Rgb): number {\n const [light, dark] = [luminance(a), luminance(b)].sort((x, y) => y - x) as [number, number];\n return (light + 0.05) / (dark + 0.05);\n}\n\nexport const WHITE: Rgb = { r: 255, g: 255, b: 255 };\nexport const BLACK: Rgb = { r: 0, g: 0, b: 0 };\n\n/**\n * The closest color to `color` that reaches `ratio` against `background`, by mixing it with black\n * or white (whichever moves away from the background), like Bootstrap's shade and tint. Returns\n * the color itself when it already passes.\n */\nexport function ensureContrast(color: Rgb, background: Rgb, ratio: number): Rgb {\n if (contrastRatio(color, background) >= ratio) {\n return color;\n }\n const target = luminance(background) > 0.18 ? BLACK : WHITE;\n for (let step = 1; step <= 20; step += 1) {\n const mixed = mixColors(color, target, step / 20);\n if (contrastRatio(mixed, background) >= ratio) {\n return mixed;\n }\n }\n return target;\n}\n\n/** White or black, whichever reads better on `background`, like Bootstrap's `color-contrast()`. */\nexport function readableTextColor(background: Rgb): Rgb {\n return contrastRatio(WHITE, background) >= contrastRatio(BLACK, background) ? WHITE : BLACK;\n}\n"],"mappings":";AAOA,IAAMI,MAAM;AACZ,IAAMC,MACF;;;;;AAMJ,SAAgBC,WAAWC,OAA2B;CAClD,MAAMC,QAAQD,MAAME,KAAK;CACzB,MAAMC,MAAMN,IAAIO,KAAKH,KAAK;CAC1B,IAAIE,MAAM,OAAOE,KAAAA,GAAW;EACxB,MAAMC,SACFH,IAAI,EAAE,CAACI,WAAW,IAAI,CAAC,GAAGJ,IAAI,EAAE,CAAC,CAACK,KAAKC,UAAUA,QAAQA,KAAK,CAAC,CAACC,KAAK,EAAE,IAAIP,IAAI;EACnF,OAAO;GACHT,GAAGiB,OAAOC,SAASN,OAAOO,MAAM,GAAG,CAAC,GAAG,EAAE;GACzClB,GAAGgB,OAAOC,SAASN,OAAOO,MAAM,GAAG,CAAC,GAAG,EAAE;GACzCjB,GAAGe,OAAOC,SAASN,OAAOO,MAAM,GAAG,CAAC,GAAG,EAAE;EAC7C;CACJ;CACA,MAAMC,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OAAO;AACpC;AAEA,IAAaI,QAAa;CAAE/C,GAAG;CAAKC,GAAG;CAAKC,GAAG;AAAI;AACnD,IAAa8C,QAAa;CAAEhD,GAAG;CAAGC,GAAG;CAAGC,GAAG;AAAE;;;;;;AAO7C,SAAgB+C,eAAe1C,OAAY2C,YAAiBC,OAAoB;CAC5E,IAAIV,cAAclC,OAAO2C,UAAU,KAAKC,OACpC,OAAO5C;CAEX,MAAM6C,SAASZ,UAAUU,UAAU,IAAI,MAAOF,QAAQD;CACtD,KAAK,IAAIM,OAAO,GAAGA,QAAQ,IAAIA,QAAQ,GAAG;EACtC,MAAMC,QAAQrB,UAAU1B,OAAO6C,QAAQC,OAAO,EAAE;EAChD,IAAIZ,cAAca,OAAOJ,UAAU,KAAKC,OACpC,OAAOG;CAEf;CACA,OAAOF;AACX;;AAGA,SAAgBG,kBAAkBL,YAAsB;CACpD,OAAOT,cAAcM,OAAOG,UAAU,KAAKT,cAAcO,OAAOE,UAAU,IAAIH,QAAQC;AAC1F"}
|
|
@@ -4,39 +4,42 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const componentTokens: Readonly<{
|
|
6
6
|
alert: Readonly<Record<"panneau-alert-radius" | "panneau-alert-gap" | "panneau-alert-padding-y" | "panneau-alert-padding-x" | "panneau-alert-border-width" | "panneau-alert-title-font-weight", string>>;
|
|
7
|
+
aside: Readonly<Record<"panneau-aside-border" | "panneau-aside-width" | "panneau-aside-radius" | "panneau-aside-padding" | "panneau-aside-width-wide" | "panneau-aside-bg" | "panneau-aside-shadow", string>>;
|
|
7
8
|
badge: Readonly<Record<"panneau-badge-height" | "panneau-badge-radius" | "panneau-badge-gap" | "panneau-badge-padding-x" | "panneau-badge-border-width" | "panneau-badge-font-size" | "panneau-badge-font-weight", string>>;
|
|
8
|
-
button: Readonly<Record<"panneau-button-radius" | "panneau-button-gap" | "panneau-button-padding-x" | "panneau-button-border-width" | "panneau-button-font-size" | "panneau-button-font-weight" | "panneau-button-padding-x-sm" | "panneau-button-font-size-sm", string>>;
|
|
9
|
+
button: Readonly<Record<"panneau-button-radius" | "panneau-button-gap" | "panneau-button-padding-x" | "panneau-button-border-width" | "panneau-button-font-size" | "panneau-button-font-weight" | "panneau-button-solid-border-color" | "panneau-button-pressed-scale" | "panneau-button-padding-x-sm" | "panneau-button-font-size-sm", string>>;
|
|
9
10
|
calendar: Readonly<Record<"panneau-calendar-cell-size" | "panneau-calendar-cell-radius" | "panneau-calendar-selected-color" | "panneau-calendar-selected-bg", string>>;
|
|
10
|
-
card: Readonly<Record<"panneau-card-radius" | "panneau-card-gap" | "panneau-card-padding-y" | "panneau-card-padding-x" | "panneau-card-border-width" | "panneau-card-title-font-weight" | "panneau-card-bg" | "panneau-card-
|
|
11
|
+
card: Readonly<Record<"panneau-card-radius" | "panneau-card-gap" | "panneau-card-padding-y" | "panneau-card-padding-x" | "panneau-card-border-width" | "panneau-card-title-font-weight" | "panneau-card-bg" | "panneau-card-shadow" | "panneau-card-border-color" | "panneau-card-header-padding-y" | "panneau-card-title-font-size", string>>;
|
|
11
12
|
checkbox: Readonly<Record<"panneau-checkbox-size" | "panneau-checkbox-radius" | "panneau-checkbox-bg" | "panneau-checkbox-border-color" | "panneau-checkbox-checked-color" | "panneau-checkbox-checked-bg", string>>;
|
|
12
13
|
'command-palette': Readonly<Record<"panneau-command-palette-width" | "panneau-command-palette-radius" | "panneau-command-palette-bg" | "panneau-command-palette-offset-top" | "panneau-command-palette-list-max-height" | "panneau-command-palette-item-radius" | "panneau-command-palette-item-active-bg", string>>;
|
|
13
14
|
container: Readonly<Record<"panneau-container-padding-x" | "panneau-container-width-sm" | "panneau-container-width-md" | "panneau-container-width-lg" | "panneau-container-width-xl", string>>;
|
|
14
15
|
dialog: Readonly<Record<"panneau-dialog-width" | "panneau-dialog-radius" | "panneau-dialog-padding-x" | "panneau-dialog-title-font-weight" | "panneau-dialog-bg" | "panneau-dialog-shadow" | "panneau-dialog-title-font-size" | "panneau-dialog-width-sm" | "panneau-dialog-width-lg" | "panneau-dialog-width-xl" | "panneau-dialog-backdrop", string>>;
|
|
15
16
|
disclosure: Readonly<Record<"panneau-disclosure-gap" | "panneau-disclosure-title-font-weight" | "panneau-disclosure-title-font-size", string>>;
|
|
16
17
|
divider: Readonly<Record<"panneau-divider-color" | "panneau-divider-width", string>>;
|
|
17
|
-
field: Readonly<Record<"panneau-field-gap" | "panneau-field-label-font-size" | "panneau-field-label-font-weight", string>>;
|
|
18
|
+
field: Readonly<Record<"panneau-field-gap" | "panneau-field-label-font-size" | "panneau-field-label-font-weight" | "panneau-field-required-color", string>>;
|
|
18
19
|
grid: Readonly<Record<"panneau-grid-gap", string>>;
|
|
19
20
|
heading: Readonly<Record<"panneau-heading-color" | "panneau-heading-font-family" | "panneau-heading-display-font-family" | "panneau-heading-1-font-size" | "panneau-heading-1-font-weight" | "panneau-heading-1-line-height" | "panneau-heading-1-letter-spacing" | "panneau-heading-2-font-size" | "panneau-heading-2-font-weight" | "panneau-heading-2-line-height" | "panneau-heading-2-letter-spacing" | "panneau-heading-3-font-size" | "panneau-heading-3-font-weight" | "panneau-heading-3-line-height" | "panneau-heading-3-letter-spacing" | "panneau-heading-4-font-size" | "panneau-heading-4-font-weight" | "panneau-heading-4-line-height" | "panneau-heading-4-letter-spacing" | "panneau-heading-display-1-font-size" | "panneau-heading-display-1-font-weight" | "panneau-heading-display-1-line-height" | "panneau-heading-display-1-letter-spacing" | "panneau-heading-display-2-font-size" | "panneau-heading-display-2-font-weight" | "panneau-heading-display-2-line-height" | "panneau-heading-display-2-letter-spacing", string>>;
|
|
21
|
+
icon: Readonly<Record<"panneau-icon-stroke-width", string>>;
|
|
20
22
|
inline: Readonly<Record<"panneau-inline-gap", string>>;
|
|
21
|
-
input: Readonly<Record<"panneau-input-radius" | "panneau-input-padding-x" | "panneau-input-border-width" | "panneau-input-bg" | "panneau-input-border-color" | "panneau-input-border-color-hover", string>>;
|
|
23
|
+
input: Readonly<Record<"panneau-input-radius" | "panneau-input-padding-x" | "panneau-input-border-width" | "panneau-input-bg" | "panneau-input-border-color" | "panneau-input-border-color-hover" | "panneau-input-border-color-focus" | "panneau-input-focus-ring" | "panneau-input-focus-ring-invalid", string>>;
|
|
22
24
|
'line-chart': Readonly<Record<"panneau-line-chart-height" | "panneau-line-chart-label-font-size" | "panneau-line-chart-line-width" | "panneau-line-chart-dot-size" | "panneau-line-chart-area-opacity", string>>;
|
|
23
25
|
'list-box': Readonly<Record<"panneau-list-box-padding" | "panneau-list-box-item-radius" | "panneau-list-box-item-padding-y" | "panneau-list-box-item-padding-y-described" | "panneau-list-box-item-padding-x" | "panneau-list-box-item-bg-hover", string>>;
|
|
24
26
|
menu: Readonly<Record<"panneau-menu-header-font-size" | "panneau-menu-header-font-weight" | "panneau-menu-header-color" | "panneau-menu-header-text-transform" | "panneau-menu-header-letter-spacing" | "panneau-menu-footer-font-size" | "panneau-menu-footer-color" | "panneau-menu-media-size" | "panneau-menu-media-size-described" | "panneau-menu-media-radius" | "panneau-menu-item-bg-selected", string>>;
|
|
25
27
|
'number-input': Readonly<Record<"panneau-number-input-stepper-width", string>>;
|
|
26
|
-
'pill-trigger': Readonly<Record<"panneau-pill-trigger-color" | "panneau-pill-trigger-radius" | "panneau-pill-trigger-gap" | "panneau-pill-trigger-padding-x" | "panneau-pill-trigger-
|
|
27
|
-
popover: Readonly<Record<"panneau-popover-radius" | "panneau-popover-padding" | "panneau-popover-bg" | "panneau-popover-
|
|
28
|
+
'pill-trigger': Readonly<Record<"panneau-pill-trigger-color" | "panneau-pill-trigger-radius" | "panneau-pill-trigger-gap" | "panneau-pill-trigger-padding-x" | "panneau-pill-trigger-bg" | "panneau-pill-trigger-font-size" | "panneau-pill-trigger-font-weight" | "panneau-pill-trigger-padding-x-sm" | "panneau-pill-trigger-font-size-sm" | "panneau-pill-trigger-border-color" | "panneau-pill-trigger-media-size" | "panneau-pill-trigger-media-radius" | "panneau-pill-trigger-bg-hover" | "panneau-pill-trigger-media-size-sm", string>>;
|
|
29
|
+
popover: Readonly<Record<"panneau-popover-radius" | "panneau-popover-padding" | "panneau-popover-bg" | "panneau-popover-shadow" | "panneau-popover-border-color", string>>;
|
|
28
30
|
prose: Readonly<Record<"panneau-prose-gap" | "panneau-prose-border-color" | "panneau-prose-line-height" | "panneau-prose-heading-gap" | "panneau-prose-list-indent" | "panneau-prose-link-color" | "panneau-prose-code-font-size" | "panneau-prose-code-color" | "panneau-prose-code-bg" | "panneau-prose-code-radius" | "panneau-prose-quote-border-color" | "panneau-prose-quote-color", string>>;
|
|
29
31
|
radio: Readonly<Record<"panneau-radio-size" | "panneau-radio-bg" | "panneau-radio-border-color" | "panneau-radio-checked-color" | "panneau-radio-media-size" | "panneau-radio-media-radius" | "panneau-radio-checked-border-width" | "panneau-radio-card-gap" | "panneau-radio-card-padding" | "panneau-radio-card-bg" | "panneau-radio-card-border-color" | "panneau-radio-card-border-color-hover" | "panneau-radio-card-border-color-selected" | "panneau-radio-card-radius" | "panneau-radio-card-label-font-weight", string>>;
|
|
30
|
-
'segmented-control': Readonly<Record<"panneau-segmented-control-radius" | "panneau-segmented-control-padding" | "panneau-segmented-control-bg" | "panneau-segmented-control-border-color" | "panneau-segmented-control-segment-padding-x" | "panneau-segmented-control-segment-font-weight" | "panneau-segmented-control-segment-color" | "panneau-segmented-control-segment-color-selected" | "panneau-segmented-control-segment-bg-selected" | "panneau-segmented-control-segment-shadow-selected", string>>;
|
|
32
|
+
'segmented-control': Readonly<Record<"panneau-segmented-control-radius" | "panneau-segmented-control-padding" | "panneau-segmented-control-bg" | "panneau-segmented-control-border-color" | "panneau-segmented-control-segment-padding-x" | "panneau-segmented-control-segment-font-weight" | "panneau-segmented-control-segment-color" | "panneau-segmented-control-segment-color-hover" | "panneau-segmented-control-segment-bg-hover" | "panneau-segmented-control-segment-color-selected" | "panneau-segmented-control-segment-bg-selected" | "panneau-segmented-control-segment-shadow-selected", string>>;
|
|
33
|
+
selected: Readonly<Record<"panneau-selected-text" | "panneau-selected-subtle" | "panneau-selected-bg", string>>;
|
|
31
34
|
skeleton: Readonly<Record<"panneau-skeleton-color" | "panneau-skeleton-radius" | "panneau-skeleton-duration", string>>;
|
|
32
35
|
spinner: Readonly<Record<"panneau-spinner-border-width", string>>;
|
|
33
36
|
stack: Readonly<Record<"panneau-stack-gap", string>>;
|
|
34
37
|
stat: Readonly<Record<"panneau-stat-gap" | "panneau-stat-label-font-size" | "panneau-stat-value-font-family" | "panneau-stat-value-font-size" | "panneau-stat-value-font-weight" | "panneau-stat-help-font-size", string>>;
|
|
35
|
-
switch: Readonly<Record<"panneau-switch-height" | "panneau-switch-width" | "panneau-switch-radius" | "panneau-switch-checked-bg" | "panneau-switch-track-bg" | "panneau-switch-thumb-size" | "panneau-switch-thumb-bg" | "panneau-switch-checked-thumb-bg", string>>;
|
|
38
|
+
switch: Readonly<Record<"panneau-switch-height" | "panneau-switch-width" | "panneau-switch-radius" | "panneau-switch-checked-bg" | "panneau-switch-track-bg" | "panneau-switch-track-border-color" | "panneau-switch-thumb-size" | "panneau-switch-thumb-bg" | "panneau-switch-checked-thumb-bg", string>>;
|
|
36
39
|
tabs: Readonly<Record<"panneau-tabs-gap" | "panneau-tabs-border-color" | "panneau-tabs-tab-padding-x" | "panneau-tabs-tab-font-weight" | "panneau-tabs-tab-color" | "panneau-tabs-indicator-height" | "panneau-tabs-tab-color-selected" | "panneau-tabs-indicator-color", string>>;
|
|
37
40
|
text: Readonly<Record<"panneau-text-muted-color", string>>;
|
|
38
|
-
toast: Readonly<Record<"panneau-toast-width" | "panneau-toast-radius" | "panneau-toast-bg" | "panneau-toast-
|
|
39
|
-
tooltip: Readonly<Record<"panneau-tooltip-color" | "panneau-tooltip-radius" | "panneau-tooltip-padding-y" | "panneau-tooltip-padding-x" | "panneau-tooltip-
|
|
41
|
+
toast: Readonly<Record<"panneau-toast-width" | "panneau-toast-radius" | "panneau-toast-bg" | "panneau-toast-shadow" | "panneau-toast-border-color" | "panneau-toast-tone-width", string>>;
|
|
42
|
+
tooltip: Readonly<Record<"panneau-tooltip-color" | "panneau-tooltip-radius" | "panneau-tooltip-padding-y" | "panneau-tooltip-padding-x" | "panneau-tooltip-bg" | "panneau-tooltip-font-size", string>>;
|
|
40
43
|
}>;
|
|
41
44
|
/** The name of a component token of `@panneau/ui`, without the leading `--`. */
|
|
42
45
|
export type ComponentTokenName = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/theme/components.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/theme/components.ts"],"names":[],"mappings":"AAsCA;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsC1B,CAAC;AAEH,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,GAAG;KAC5B,SAAS,IAAI,MAAM,OAAO,eAAe,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC,SAAS,CAAC;CACzF,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/theme/components.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { alertTokens } from "../alert/tokens.js";
|
|
2
|
+
import { asideTokens } from "../aside/tokens.js";
|
|
2
3
|
import { badgeTokens } from "../badge/tokens.js";
|
|
3
4
|
import { buttonTokens } from "../button/tokens.js";
|
|
4
5
|
import { cardTokens } from "../card/tokens.js";
|
|
@@ -13,6 +14,7 @@ import { inputTokens } from "../field/inputTokens.js";
|
|
|
13
14
|
import { fieldTokens } from "../field/tokens.js";
|
|
14
15
|
import { gridTokens } from "../grid/tokens.js";
|
|
15
16
|
import { headingTokens } from "../heading/tokens.js";
|
|
17
|
+
import { iconTokens } from "../icon/tokens.js";
|
|
16
18
|
import { inlineTokens } from "../inline/tokens.js";
|
|
17
19
|
import { lineChartTokens } from "../line-chart/tokens.js";
|
|
18
20
|
import { menuTokens } from "../menu/tokens.js";
|
|
@@ -32,6 +34,7 @@ import { tabsTokens } from "../tabs/tokens.js";
|
|
|
32
34
|
import { textTokens } from "../text/tokens.js";
|
|
33
35
|
import { toastTokens } from "../toast/tokens.js";
|
|
34
36
|
import { tooltipTokens } from "../tooltip/tokens.js";
|
|
37
|
+
import { selectedTokens } from "./selectedTokens.js";
|
|
35
38
|
//#region src/theme/components.ts
|
|
36
39
|
/**
|
|
37
40
|
* The component tokens of `@panneau/ui` and their defaults, by component: what a theme, a scope or
|
|
@@ -39,6 +42,7 @@ import { tooltipTokens } from "../tooltip/tokens.js";
|
|
|
39
42
|
*/
|
|
40
43
|
var componentTokens = Object.freeze({
|
|
41
44
|
alert: alertTokens.tokens,
|
|
45
|
+
aside: asideTokens.tokens,
|
|
42
46
|
badge: badgeTokens.tokens,
|
|
43
47
|
button: buttonTokens.tokens,
|
|
44
48
|
calendar: calendarTokens.tokens,
|
|
@@ -52,6 +56,7 @@ var componentTokens = Object.freeze({
|
|
|
52
56
|
field: fieldTokens.tokens,
|
|
53
57
|
grid: gridTokens.tokens,
|
|
54
58
|
heading: headingTokens.tokens,
|
|
59
|
+
icon: iconTokens.tokens,
|
|
55
60
|
inline: inlineTokens.tokens,
|
|
56
61
|
input: inputTokens.tokens,
|
|
57
62
|
"line-chart": lineChartTokens.tokens,
|
|
@@ -63,6 +68,7 @@ var componentTokens = Object.freeze({
|
|
|
63
68
|
prose: proseTokens.tokens,
|
|
64
69
|
radio: radioTokens.tokens,
|
|
65
70
|
"segmented-control": segmentedControlTokens.tokens,
|
|
71
|
+
selected: selectedTokens.tokens,
|
|
66
72
|
skeleton: skeletonTokens.tokens,
|
|
67
73
|
spinner: spinnerTokens.tokens,
|
|
68
74
|
stack: stackTokens.tokens,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","names":["alertTokens","badgeTokens","buttonTokens","cardTokens","checkboxTokens","commandPaletteTokens","containerTokens","calendarTokens","dialogTokens","disclosureTokens","dividerTokens","inputTokens","fieldTokens","gridTokens","headingTokens","inlineTokens","lineChartTokens","menuTokens","numberInputTokens","pillTriggerTokens","popoverTokens","proseTokens","radioTokens","segmentedControlTokens","listBoxTokens","skeletonTokens","spinnerTokens","stackTokens","statTokens","switchTokens","tabsTokens","textTokens","toastTokens","tooltipTokens","componentTokens","Object","freeze","alert","tokens","badge","button","calendar","card","checkbox","container","dialog","disclosure","divider","field","grid","heading","inline","input","menu","popover","prose","radio","skeleton","spinner","stack","stat","switch","tabs","text","toast","tooltip","ComponentTokenName","Component"],"sources":["../../src/theme/components.ts"],"sourcesContent":["import { alertTokens } from '../alert/tokens';\nimport { badgeTokens } from '../badge/tokens';\nimport { buttonTokens } from '../button/tokens';\nimport { cardTokens } from '../card/tokens';\nimport { checkboxTokens } from '../checkbox/tokens';\nimport { commandPaletteTokens } from '../command-palette/tokens';\nimport { containerTokens } from '../container/tokens';\nimport { calendarTokens } from '../date-picker/calendarTokens';\nimport { dialogTokens } from '../dialog/tokens';\nimport { disclosureTokens } from '../disclosure/tokens';\nimport { dividerTokens } from '../divider/tokens';\nimport { inputTokens } from '../field/inputTokens';\nimport { fieldTokens } from '../field/tokens';\nimport { gridTokens } from '../grid/tokens';\nimport { headingTokens } from '../heading/tokens';\nimport { inlineTokens } from '../inline/tokens';\nimport { lineChartTokens } from '../line-chart/tokens';\nimport { menuTokens } from '../menu/tokens';\nimport { numberInputTokens } from '../number-input/tokens';\nimport { pillTriggerTokens } from '../pill-trigger/tokens';\nimport { popoverTokens } from '../popover/tokens';\nimport { proseTokens } from '../prose/tokens';\nimport { radioTokens } from '../radio-group/tokens';\nimport { segmentedControlTokens } from '../segmented-control/tokens';\nimport { listBoxTokens } from '../select/listBoxTokens';\nimport { skeletonTokens } from '../skeleton/tokens';\nimport { spinnerTokens } from '../spinner/tokens';\nimport { stackTokens } from '../stack/tokens';\nimport { statTokens } from '../stat/tokens';\nimport { switchTokens } from '../switch/tokens';\nimport { tabsTokens } from '../tabs/tokens';\nimport { textTokens } from '../text/tokens';\nimport { toastTokens } from '../toast/tokens';\nimport { tooltipTokens } from '../tooltip/tokens';\n\n/**\n * The component tokens of `@panneau/ui` and their defaults, by component: what a theme, a scope or\n * a project's CSS can set to restyle one component without touching the others (decision 0024).\n */\nexport const componentTokens = Object.freeze({\n alert: alertTokens.tokens,\n badge: badgeTokens.tokens,\n button: buttonTokens.tokens,\n calendar: calendarTokens.tokens,\n card: cardTokens.tokens,\n checkbox: checkboxTokens.tokens,\n 'command-palette': commandPaletteTokens.tokens,\n container: containerTokens.tokens,\n dialog: dialogTokens.tokens,\n disclosure: disclosureTokens.tokens,\n divider: dividerTokens.tokens,\n field: fieldTokens.tokens,\n grid: gridTokens.tokens,\n heading: headingTokens.tokens,\n inline: inlineTokens.tokens,\n input: inputTokens.tokens,\n 'line-chart': lineChartTokens.tokens,\n 'list-box': listBoxTokens.tokens,\n menu: menuTokens.tokens,\n 'number-input': numberInputTokens.tokens,\n 'pill-trigger': pillTriggerTokens.tokens,\n popover: popoverTokens.tokens,\n prose: proseTokens.tokens,\n radio: radioTokens.tokens,\n 'segmented-control': segmentedControlTokens.tokens,\n skeleton: skeletonTokens.tokens,\n spinner: spinnerTokens.tokens,\n stack: stackTokens.tokens,\n stat: statTokens.tokens,\n switch: switchTokens.tokens,\n tabs: tabsTokens.tokens,\n text: textTokens.tokens,\n toast: toastTokens.tokens,\n tooltip: tooltipTokens.tokens,\n});\n\n/** The name of a component token of `@panneau/ui`, without the leading `--`. */\nexport type ComponentTokenName = {\n [Component in keyof typeof componentTokens]: keyof (typeof componentTokens)[Component];\n}[keyof typeof componentTokens];\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","names":["alertTokens","asideTokens","badgeTokens","buttonTokens","cardTokens","checkboxTokens","commandPaletteTokens","containerTokens","calendarTokens","dialogTokens","disclosureTokens","dividerTokens","inputTokens","fieldTokens","gridTokens","headingTokens","iconTokens","inlineTokens","lineChartTokens","menuTokens","numberInputTokens","pillTriggerTokens","popoverTokens","proseTokens","radioTokens","segmentedControlTokens","listBoxTokens","skeletonTokens","spinnerTokens","stackTokens","statTokens","switchTokens","tabsTokens","textTokens","toastTokens","tooltipTokens","selectedTokens","componentTokens","Object","freeze","alert","tokens","aside","badge","button","calendar","card","checkbox","container","dialog","disclosure","divider","field","grid","heading","icon","inline","input","menu","popover","prose","radio","selected","skeleton","spinner","stack","stat","switch","tabs","text","toast","tooltip","ComponentTokenName","Component"],"sources":["../../src/theme/components.ts"],"sourcesContent":["import { alertTokens } from '../alert/tokens';\nimport { asideTokens } from '../aside/tokens';\nimport { badgeTokens } from '../badge/tokens';\nimport { buttonTokens } from '../button/tokens';\nimport { cardTokens } from '../card/tokens';\nimport { checkboxTokens } from '../checkbox/tokens';\nimport { commandPaletteTokens } from '../command-palette/tokens';\nimport { containerTokens } from '../container/tokens';\nimport { calendarTokens } from '../date-picker/calendarTokens';\nimport { dialogTokens } from '../dialog/tokens';\nimport { disclosureTokens } from '../disclosure/tokens';\nimport { dividerTokens } from '../divider/tokens';\nimport { inputTokens } from '../field/inputTokens';\nimport { fieldTokens } from '../field/tokens';\nimport { gridTokens } from '../grid/tokens';\nimport { headingTokens } from '../heading/tokens';\nimport { iconTokens } from '../icon/tokens';\nimport { inlineTokens } from '../inline/tokens';\nimport { lineChartTokens } from '../line-chart/tokens';\nimport { menuTokens } from '../menu/tokens';\nimport { numberInputTokens } from '../number-input/tokens';\nimport { pillTriggerTokens } from '../pill-trigger/tokens';\nimport { popoverTokens } from '../popover/tokens';\nimport { proseTokens } from '../prose/tokens';\nimport { radioTokens } from '../radio-group/tokens';\nimport { segmentedControlTokens } from '../segmented-control/tokens';\nimport { listBoxTokens } from '../select/listBoxTokens';\nimport { skeletonTokens } from '../skeleton/tokens';\nimport { spinnerTokens } from '../spinner/tokens';\nimport { stackTokens } from '../stack/tokens';\nimport { statTokens } from '../stat/tokens';\nimport { switchTokens } from '../switch/tokens';\nimport { tabsTokens } from '../tabs/tokens';\nimport { textTokens } from '../text/tokens';\nimport { toastTokens } from '../toast/tokens';\nimport { tooltipTokens } from '../tooltip/tokens';\nimport { selectedTokens } from './selectedTokens';\n\n/**\n * The component tokens of `@panneau/ui` and their defaults, by component: what a theme, a scope or\n * a project's CSS can set to restyle one component without touching the others (decision 0024).\n */\nexport const componentTokens = Object.freeze({\n alert: alertTokens.tokens,\n aside: asideTokens.tokens,\n badge: badgeTokens.tokens,\n button: buttonTokens.tokens,\n calendar: calendarTokens.tokens,\n card: cardTokens.tokens,\n checkbox: checkboxTokens.tokens,\n 'command-palette': commandPaletteTokens.tokens,\n container: containerTokens.tokens,\n dialog: dialogTokens.tokens,\n disclosure: disclosureTokens.tokens,\n divider: dividerTokens.tokens,\n field: fieldTokens.tokens,\n grid: gridTokens.tokens,\n heading: headingTokens.tokens,\n icon: iconTokens.tokens,\n inline: inlineTokens.tokens,\n input: inputTokens.tokens,\n 'line-chart': lineChartTokens.tokens,\n 'list-box': listBoxTokens.tokens,\n menu: menuTokens.tokens,\n 'number-input': numberInputTokens.tokens,\n 'pill-trigger': pillTriggerTokens.tokens,\n popover: popoverTokens.tokens,\n prose: proseTokens.tokens,\n radio: radioTokens.tokens,\n 'segmented-control': segmentedControlTokens.tokens,\n selected: selectedTokens.tokens,\n skeleton: skeletonTokens.tokens,\n spinner: spinnerTokens.tokens,\n stack: stackTokens.tokens,\n stat: statTokens.tokens,\n switch: switchTokens.tokens,\n tabs: tabsTokens.tokens,\n text: textTokens.tokens,\n toast: toastTokens.tokens,\n tooltip: tooltipTokens.tokens,\n});\n\n/** The name of a component token of `@panneau/ui`, without the leading `--`. */\nexport type ComponentTokenName = {\n [Component in keyof typeof componentTokens]: keyof (typeof componentTokens)[Component];\n}[keyof typeof componentTokens];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAaqC,kBAAkBC,OAAOC,OAAO;CACzCC,OAAOxC,YAAYyC;CACnBC,OAAOzC,YAAYwC;CACnBE,OAAOzC,YAAYuC;CACnBG,QAAQzC,aAAasC;CACrBI,UAAUrC,eAAeiC;CACzBK,MAAM1C,WAAWqC;CACjBM,UAAU1C,eAAeoC;CACzB,mBAAmBnC,qBAAqBmC;CACxCO,WAAWzC,gBAAgBkC;CAC3BQ,QAAQxC,aAAagC;CACrBS,YAAYxC,iBAAiB+B;CAC7BU,SAASxC,cAAc8B;CACvBW,OAAOvC,YAAY4B;CACnBY,MAAMvC,WAAW2B;CACjBa,SAASvC,cAAc0B;CACvBc,MAAMvC,WAAWyB;CACjBe,QAAQvC,aAAawB;CACrBgB,OAAO7C,YAAY6B;CACnB,cAAcvB,gBAAgBuB;CAC9B,YAAYf,cAAce;CAC1BiB,MAAMvC,WAAWsB;CACjB,gBAAgBrB,kBAAkBqB;CAClC,gBAAgBpB,kBAAkBoB;CAClCkB,SAASrC,cAAcmB;CACvBmB,OAAOrC,YAAYkB;CACnBoB,OAAOrC,YAAYiB;CACnB,qBAAqBhB,uBAAuBgB;CAC5CqB,UAAU1B,eAAeK;CACzBsB,UAAUpC,eAAec;CACzBuB,SAASpC,cAAca;CACvBwB,OAAOpC,YAAYY;CACnByB,MAAMpC,WAAWW;CACjB0B,QAAQpC,aAAaU;CACrB2B,MAAMpC,WAAWS;CACjB4B,MAAMpC,WAAWQ;CACjB6B,OAAOpC,YAAYO;CACnB8B,SAASpC,cAAcM;AAC3B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tokens of what is selected, checked or current: checked boxes, radios and switches, the selected
|
|
3
|
+
* day of a calendar, the current tab, the value of a slider, selected rows, cards and media.
|
|
4
|
+
*
|
|
5
|
+
* They default to the accent, which a theme can keep for its main action only, as Bootstrap does
|
|
6
|
+
* with `$component-active-bg` next to `$primary`: a yellow main action, and black selections.
|
|
7
|
+
* Like other component tokens they are read with their default as a fallback and never declared,
|
|
8
|
+
* so a scope that changes the accent changes the selections in it, unless a theme sets them.
|
|
9
|
+
*/
|
|
10
|
+
export declare const selectedTokens: import("./componentTokens.js").ComponentTokens<"selected", "panneau-selected-text" | "panneau-selected-subtle" | "panneau-selected-bg">;
|
|
11
|
+
//# sourceMappingURL=selectedTokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectedTokens.d.ts","sourceRoot":"","sources":["../../src/theme/selectedTokens.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,sIAOzB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineComponentTokens } from "./componentTokens.js";
|
|
2
|
+
//#region src/theme/selectedTokens.ts
|
|
3
|
+
/**
|
|
4
|
+
* Tokens of what is selected, checked or current: checked boxes, radios and switches, the selected
|
|
5
|
+
* day of a calendar, the current tab, the value of a slider, selected rows, cards and media.
|
|
6
|
+
*
|
|
7
|
+
* They default to the accent, which a theme can keep for its main action only, as Bootstrap does
|
|
8
|
+
* with `$component-active-bg` next to `$primary`: a yellow main action, and black selections.
|
|
9
|
+
* Like other component tokens they are read with their default as a fallback and never declared,
|
|
10
|
+
* so a scope that changes the accent changes the selections in it, unless a theme sets them.
|
|
11
|
+
*/
|
|
12
|
+
var selectedTokens = defineComponentTokens("selected", {
|
|
13
|
+
/** Fill of what is selected or checked, and the border of a selected card or row. */
|
|
14
|
+
bg: "var(--panneau-color-accent)",
|
|
15
|
+
/** Text and icons on that fill: the check mark, the selected day. */
|
|
16
|
+
text: "var(--panneau-color-accent-text)",
|
|
17
|
+
/** Background of a selected row, card, or range of days. */
|
|
18
|
+
subtle: "var(--panneau-color-accent-subtle)"
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { selectedTokens };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=selectedTokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectedTokens.js","names":["defineComponentTokens","selectedTokens","bg","text","subtle"],"sources":["../../src/theme/selectedTokens.ts"],"sourcesContent":["import { defineComponentTokens } from './componentTokens';\n\n/**\n * Tokens of what is selected, checked or current: checked boxes, radios and switches, the selected\n * day of a calendar, the current tab, the value of a slider, selected rows, cards and media.\n *\n * They default to the accent, which a theme can keep for its main action only, as Bootstrap does\n * with `$component-active-bg` next to `$primary`: a yellow main action, and black selections.\n * Like other component tokens they are read with their default as a fallback and never declared,\n * so a scope that changes the accent changes the selections in it, unless a theme sets them.\n */\nexport const selectedTokens = defineComponentTokens('selected', {\n /** Fill of what is selected or checked, and the border of a selected card or row. */\n bg: 'var(--panneau-color-accent)',\n /** Text and icons on that fill: the check mark, the selected day. */\n text: 'var(--panneau-color-accent-text)',\n /** Background of a selected row, card, or range of days. */\n subtle: 'var(--panneau-color-accent-subtle)',\n});\n"],"mappings":";;;;;;;;;;;AAWA,IAAaC,iBAAiBD,sBAAsB,YAAY;;CAE5DE,IAAI;;CAEJC,MAAM;;CAENC,QAAQ;AACZ,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* root (`PanneauRoot.module.css`), and what a theme sets to restyle every component at once
|
|
4
4
|
* (decision 0024). A test keeps this list in sync with the stylesheet.
|
|
5
5
|
*/
|
|
6
|
-
export declare const SEMANTIC_TOKENS: readonly ["panneau-color-bg", "panneau-color-surface", "panneau-color-surface-sunken", "panneau-color-surface-raised", "panneau-color-hover", "panneau-color-pressed", "panneau-color-backdrop", "panneau-color-text", "panneau-color-text-muted", "panneau-color-link", "panneau-color-border", "panneau-color-border-control", "panneau-color-accent", "panneau-color-accent-hover", "panneau-color-accent-text", "panneau-color-accent-subtle", "panneau-color-focus", "panneau-color-danger", "panneau-color-danger-subtle", "panneau-color-danger-border", "panneau-color-danger-solid", "panneau-color-danger-solid-hover", "panneau-color-danger-solid-text", "panneau-color-success", "panneau-color-success-subtle", "panneau-color-success-border", "panneau-color-success-solid", "panneau-color-success-solid-hover", "panneau-color-success-solid-text", "panneau-color-warning", "panneau-color-warning-subtle", "panneau-color-warning-border", "panneau-color-warning-solid", "panneau-color-warning-solid-hover", "panneau-color-warning-solid-text", "panneau-color-info", "panneau-color-info-subtle", "panneau-color-info-border", "panneau-color-info-solid", "panneau-color-info-solid-hover", "panneau-color-info-solid-text", "panneau-color-muted", "panneau-color-muted-subtle", "panneau-color-muted-border", "panneau-color-muted-solid", "panneau-color-muted-solid-hover", "panneau-color-muted-solid-text", "panneau-chart-categorical-1", "panneau-chart-categorical-2", "panneau-chart-categorical-3", "panneau-chart-categorical-4", "panneau-chart-categorical-5", "panneau-chart-categorical-6", "panneau-chart-categorical-7", "panneau-chart-categorical-8", "panneau-chart-sequential-1", "panneau-chart-sequential-2", "panneau-chart-sequential-3", "panneau-chart-sequential-4", "panneau-chart-sequential-5", "panneau-chart-diverging-negative", "panneau-chart-diverging-neutral", "panneau-chart-diverging-positive", "panneau-font-family-body", "panneau-font-family-heading", "panneau-font-family-display", "panneau-font-family-mono", "panneau-font-family", "panneau-font-numeric", "panneau-font-size-xs", "panneau-font-size-sm", "panneau-font-size-md", "panneau-font-size-lg", "panneau-font-size-xl", "panneau-font-size-control", "panneau-line-height", "panneau-line-height-tight", "panneau-font-weight-normal", "panneau-font-weight-medium", "panneau-font-weight-bold", "panneau-space-1", "panneau-space-2", "panneau-space-3", "panneau-space-4", "panneau-space-5", "panneau-space-6", "panneau-space-8", "panneau-space-10", "panneau-radius-sm", "panneau-radius-md", "panneau-radius-lg", "panneau-radius-full", "panneau-border-width", "panneau-shadow-sm", "panneau-shadow-md", "panneau-shadow-lg", "panneau-control-height", "panneau-control-height-sm", "panneau-control-padding-x", "panneau-row-padding-y", "panneau-focus-width", "panneau-duration", "panneau-z-overlay", "panneau-z-toast"];
|
|
6
|
+
export declare const SEMANTIC_TOKENS: readonly ["panneau-color-bg", "panneau-color-surface", "panneau-color-surface-sunken", "panneau-color-surface-raised", "panneau-color-hover", "panneau-color-pressed", "panneau-color-backdrop", "panneau-color-text", "panneau-color-text-muted", "panneau-color-link", "panneau-color-border", "panneau-color-border-control", "panneau-color-accent", "panneau-color-accent-hover", "panneau-color-accent-text", "panneau-color-accent-subtle", "panneau-color-focus", "panneau-color-danger", "panneau-color-danger-subtle", "panneau-color-danger-border", "panneau-color-danger-solid", "panneau-color-danger-solid-hover", "panneau-color-danger-solid-text", "panneau-color-success", "panneau-color-success-subtle", "panneau-color-success-border", "panneau-color-success-solid", "panneau-color-success-solid-hover", "panneau-color-success-solid-text", "panneau-color-warning", "panneau-color-warning-subtle", "panneau-color-warning-border", "panneau-color-warning-solid", "panneau-color-warning-solid-hover", "panneau-color-warning-solid-text", "panneau-color-info", "panneau-color-info-subtle", "panneau-color-info-border", "panneau-color-info-solid", "panneau-color-info-solid-hover", "panneau-color-info-solid-text", "panneau-color-muted", "panneau-color-muted-subtle", "panneau-color-muted-border", "panneau-color-muted-solid", "panneau-color-muted-solid-hover", "panneau-color-muted-solid-text", "panneau-chart-categorical-1", "panneau-chart-categorical-2", "panneau-chart-categorical-3", "panneau-chart-categorical-4", "panneau-chart-categorical-5", "panneau-chart-categorical-6", "panneau-chart-categorical-7", "panneau-chart-categorical-8", "panneau-chart-sequential-1", "panneau-chart-sequential-2", "panneau-chart-sequential-3", "panneau-chart-sequential-4", "panneau-chart-sequential-5", "panneau-chart-diverging-negative", "panneau-chart-diverging-neutral", "panneau-chart-diverging-positive", "panneau-font-family-body", "panneau-font-family-heading", "panneau-font-family-display", "panneau-font-family-mono", "panneau-font-family", "panneau-font-numeric", "panneau-font-size-xs", "panneau-font-size-sm", "panneau-font-size-md", "panneau-font-size-lg", "panneau-font-size-xl", "panneau-font-size-control", "panneau-line-height", "panneau-line-height-tight", "panneau-font-weight-normal", "panneau-font-weight-medium", "panneau-font-weight-bold", "panneau-space-1", "panneau-space-2", "panneau-space-3", "panneau-space-4", "panneau-space-5", "panneau-space-6", "panneau-space-8", "panneau-space-10", "panneau-radius-sm", "panneau-radius-md", "panneau-radius-lg", "panneau-radius-full", "panneau-border-width", "panneau-shadow-sm", "panneau-shadow-md", "panneau-shadow-lg", "panneau-control-height", "panneau-control-height-sm", "panneau-control-padding-x", "panneau-row-padding-y", "panneau-target-size", "panneau-focus-width", "panneau-duration", "panneau-z-overlay", "panneau-z-toast"];
|
|
7
7
|
/** The name of a semantic token, without the leading `--`. */
|
|
8
8
|
export type SemanticTokenName = (typeof SEMANTIC_TOKENS)[number];
|
|
9
9
|
//# sourceMappingURL=semanticTokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semanticTokens.d.ts","sourceRoot":"","sources":["../../src/theme/semanticTokens.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"semanticTokens.d.ts","sourceRoot":"","sources":["../../src/theme/semanticTokens.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,eAAe,w0FA0GlB,CAAC;AAEX,8DAA8D;AAC9D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC"}
|