actual-css 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -0
- package/README.md +6 -6
- package/components.json +29 -7
- package/dist/actual.full.css +542 -135
- package/dist/actual.full.js +2 -2
- package/dist/actual.full.min.css +1 -1
- package/dist/types/data-flag.d.ts +1 -0
- package/dist/types/enhancement-loader-state.d.ts +6 -0
- package/dist/types/enhancement-loader.d.ts +0 -2
- package/dist/types/parse-config.d.ts +0 -1
- package/dist/types/popover-transport.d.ts +2 -0
- package/dist/types/status.d.ts +0 -1
- package/dist/types/tooltip.d.ts +4 -0
- package/dist/types/validation.d.ts +6 -2
- package/docs/pages/components/app-navigation.md +67 -0
- package/docs/pages/components/button.md +3 -0
- package/docs/pages/components/dialog.md +3 -0
- package/docs/pages/components/list.md +13 -0
- package/docs/pages/components/meter.md +1 -0
- package/docs/pages/components/progress.md +1 -0
- package/docs/pages/components/segmented.md +7 -4
- package/docs/pages/components/table.md +4 -1
- package/docs/pages/components/timeline.md +32 -0
- package/docs/pages/enhancements/flyout.md +12 -3
- package/docs/pages/enhancements/tooltip.md +6 -1
- package/docs/pages/examples/overview.md +30 -1
- package/docs/pages/forms/combobox.md +14 -10
- package/docs/pages/forms/labels.md +7 -0
- package/docs/pages/forms/overview.md +13 -10
- package/docs/pages/forms/range.md +3 -1
- package/docs/pages/forms/validation.md +3 -3
- package/docs/pages/foundations/philosophy.md +26 -0
- package/docs/pages/foundations/theming.md +80 -7
- package/docs/pages/foundations/tokens.md +39 -2
- package/docs/pages/guides/coding-agents.md +11 -0
- package/docs/pages/guides/introduction.md +1 -1
- package/docs/pages/guides/progressive-enhancement.md +109 -19
- package/docs/pages/guides/tailwind.md +12 -6
- package/docs/pages/guides/upgrading.md +52 -0
- package/docs/pages/layout/app-layout.md +50 -1
- package/docs/pages/patterns/empty-state.md +48 -10
- package/forms.json +325 -0
- package/llms.txt +2 -1
- package/package.json +3 -1
- package/reserved-classes.json +2 -0
- package/skills/actual-css/SKILL.md +1 -1
- package/skills/actual-css/references/api-and-vocabulary.md +2 -1
- package/src/cli/actual-css.js +8 -2
- package/src/css/components/app-nav.css +75 -18
- package/src/css/components/avatar.css +1 -0
- package/src/css/components/badge.css +7 -1
- package/src/css/components/button.css +20 -3
- package/src/css/components/flyout.css +8 -2
- package/src/css/components/list.css +28 -13
- package/src/css/components/menu.css +18 -0
- package/src/css/components/meter.css +11 -6
- package/src/css/components/progress.css +14 -6
- package/src/css/components/rating.css +2 -0
- package/src/css/components/segmented.css +22 -12
- package/src/css/components/table.css +21 -2
- package/src/css/components/timeline.css +50 -1
- package/src/css/core/theme.css +11 -1
- package/src/css/core/tokens.css +20 -2
- package/src/css/forms/choice-card.css +6 -4
- package/src/css/forms/choice.css +28 -16
- package/src/css/forms/control.css +23 -16
- package/src/css/forms/custom-select.css +3 -1
- package/src/css/forms/form.css +8 -5
- package/src/css/forms/otp.css +7 -1
- package/src/css/forms/range.css +31 -11
- package/src/css/forms/select.css +13 -4
- package/src/css/forms/switch.css +11 -5
- package/src/css/layout/app-layout.css +104 -5
- package/src/js/data-flag.js +4 -0
- package/src/js/dialog.js +24 -8
- package/src/js/enhancement-loader-state.js +7 -0
- package/src/js/enhancement-loader.js +4 -21
- package/src/js/keys.js +5 -7
- package/src/js/parse-config.js +0 -2
- package/src/js/popover-transport.js +18 -0
- package/src/js/status.js +0 -2
- package/src/js/surface.js +35 -41
- package/src/js/tooltip.js +70 -36
- package/src/js/validation.js +24 -10
- package/src/tooling/css-bundle.js +5 -0
- package/src/tooling/design-tokens.js +9 -2
- package/src/tooling/theme-contrast.js +45 -17
- package/tokens.json +5 -0
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* field, checkbox and radio, the track edge or knob of an unchecked switch
|
|
10
10
|
* - soft ink against the resting and the hovered soft fill (4.5:1), on each
|
|
11
11
|
* surface a soft element sits on
|
|
12
|
-
* - the solid pairs, -fg on the intent fill (4.5:1)
|
|
13
|
-
* background-image reads n/a
|
|
12
|
+
* - the solid pairs, -fg on the intent fill (4.5:1), under the --finish
|
|
13
|
+
* veil; a fill a theme paints with its own background-image reads n/a
|
|
14
14
|
* - selected ink on those surfaces: the current nav link at rest and on
|
|
15
15
|
* hover, the selected tab and the current step number (4.5:1), and the
|
|
16
16
|
* current step's ring (3:1)
|
|
@@ -61,7 +61,7 @@ function islandMarkup(id, scheme) {
|
|
|
61
61
|
).join("");
|
|
62
62
|
return `<div${style} id="${id}">
|
|
63
63
|
${softPairs}
|
|
64
|
-
${INTENTS.map((i) => `<button class="btn solid ${i}" data-solid="${i}" type="button">t</button>`).join("")}
|
|
64
|
+
${INTENTS.map((i) => `<button class="btn solid ${i}" data-solid="${i}" type="button" style="--finish: initial">t</button>`).join("")}
|
|
65
65
|
<span data-pair="focus-surface" style="color: var(--focus); background: var(--surface)"></span>
|
|
66
66
|
<span data-pair="focus-solid" style="color: var(--focus); background: var(--surface-solid)"></span>
|
|
67
67
|
<span data-pair="inverse" style="color: var(--surface-solid-fg); background: var(--surface-solid)"></span>
|
|
@@ -74,7 +74,10 @@ function islandMarkup(id, scheme) {
|
|
|
74
74
|
|
|
75
75
|
/* Controls whose resting edge is all that identifies them (WCAG 1.4.11): the
|
|
76
76
|
edge against the surface around them needs 3:1. The field is read on its
|
|
77
|
-
block-end side, the one an underline-only theme (material) keeps
|
|
77
|
+
block-end side, the one an underline-only theme (material) keeps, or on its
|
|
78
|
+
fill, whichever is stronger; under 3:1 it is a warning, not a miss: the
|
|
79
|
+
core's quiet field edge is a known trade-off (theme.css), and a field is
|
|
80
|
+
also identified by its label and place. An
|
|
78
81
|
unchecked switch is read on its track edge or its knob, whichever is
|
|
79
82
|
stronger: the core track is the --border-control edge, and a theme may move
|
|
80
83
|
the cue to a dark knob on a quiet track (docs/pages/forms/switch.md). */
|
|
@@ -148,14 +151,23 @@ export async function measureContrast({ css, themes, label = "default" }) {
|
|
|
148
151
|
const cs = (el, pseudo = null) => getComputedStyle(el, pseudo);
|
|
149
152
|
const pairs = {};
|
|
150
153
|
for (const el of island.querySelectorAll("[data-pair]")) {
|
|
151
|
-
// The invalid field
|
|
152
|
-
//
|
|
153
|
-
//
|
|
154
|
-
|
|
154
|
+
// The invalid field is measured focused (a focused text field always
|
|
155
|
+
// matches :focus-visible): its line is the outline in
|
|
156
|
+
// --form-invalid-border, against the focused fill. A theme that clears
|
|
157
|
+
// the outline for an inset line (material, minimal) keeps the hook on
|
|
158
|
+
// the block-end border; a theme that drops the invalid frame (plush)
|
|
159
|
+
// keeps it on the outline.
|
|
160
|
+
let fg = cs(el).color;
|
|
161
|
+
if (el.dataset.pair === "invalid-field") {
|
|
162
|
+
el.focus();
|
|
163
|
+
const outline = cs(el).outlineStyle === "none" ? null : rgba(cs(el).outlineColor);
|
|
164
|
+
fg = outline && outline[3] > 0 ? cs(el).outlineColor : cs(el).borderBlockEndColor;
|
|
165
|
+
}
|
|
155
166
|
pairs[el.dataset.pair] = { fg: rgba(fg), bg: rgba(cs(el).backgroundColor) };
|
|
156
167
|
}
|
|
157
|
-
//
|
|
158
|
-
//
|
|
168
|
+
// The --finish veil is cleared on these buttons (islandMarkup), so
|
|
169
|
+
// the pair is the intent fill. A fill a theme still paints with its own
|
|
170
|
+
// background-image has no single color: it is reported, not sampled.
|
|
159
171
|
const solid = {};
|
|
160
172
|
for (const el of island.querySelectorAll("[data-solid]")) {
|
|
161
173
|
solid[el.dataset.solid] =
|
|
@@ -207,11 +219,11 @@ export async function measureContrast({ css, themes, label = "default" }) {
|
|
|
207
219
|
const box = island.querySelector("[data-controls]");
|
|
208
220
|
const controls = { backdrop: rgba(cs(box).backgroundColor), edges: {} };
|
|
209
221
|
// The cues that can identify each control; the best one counts. A field
|
|
210
|
-
// shows its lower edge, a switch its track edge or its knob
|
|
211
|
-
// pill, or a theme's dark knob on a quiet track), any other
|
|
212
|
-
// edge.
|
|
222
|
+
// shows its lower edge or its fill, a switch its track edge or its knob
|
|
223
|
+
// (the core pill, or a theme's dark knob on a quiet track), any other
|
|
224
|
+
// control its edge.
|
|
213
225
|
const cues = {
|
|
214
|
-
field: (s) => [s.borderBlockEndColor],
|
|
226
|
+
field: (s) => [s.borderBlockEndColor, s.backgroundColor],
|
|
215
227
|
switch: (s, el) => [cs(el, "::before").backgroundColor, s.borderTopColor],
|
|
216
228
|
};
|
|
217
229
|
for (const el of box.querySelectorAll("[data-control]")) {
|
|
@@ -297,9 +309,11 @@ export async function measureThemeFile({ themeFile, name }) {
|
|
|
297
309
|
return measureContrast({ css, themes: [theme], label: themeFile ? ":root" : "default" });
|
|
298
310
|
}
|
|
299
311
|
|
|
300
|
-
/* Text tables for `rows`,
|
|
312
|
+
/* Text tables for `rows`, the number of pairs under their threshold, and the
|
|
313
|
+
number of warnings: fields with no 3:1 cue, a trade-off the core makes. */
|
|
301
314
|
export function formatContrast(rows) {
|
|
302
315
|
let misses = 0;
|
|
316
|
+
let warnings = 0;
|
|
303
317
|
const cell = (value, min) => {
|
|
304
318
|
if (value === null) return { text: "n/a", miss: false };
|
|
305
319
|
const miss = value < min;
|
|
@@ -373,10 +387,24 @@ export function formatContrast(rows) {
|
|
|
373
387
|
);
|
|
374
388
|
}
|
|
375
389
|
|
|
376
|
-
lines.push(
|
|
390
|
+
lines.push(
|
|
391
|
+
"",
|
|
392
|
+
"Control cue at rest (edge, a field's fill, or a switch's knob, vs --surface), needs 3:1.",
|
|
393
|
+
"A field under 3:1 is a warning: it reads by its label and place, which a WCAG 2 AA",
|
|
394
|
+
"audit does not count. Set --control-default-border: var(--border-control) for strong",
|
|
395
|
+
"identification, or give fields a fill or an edge that reaches 3:1.",
|
|
396
|
+
"",
|
|
397
|
+
);
|
|
377
398
|
lines.push(`${"theme".padEnd(width)} scheme control ratio`);
|
|
378
399
|
for (const row of rows) {
|
|
379
400
|
for (const { kind, value } of row.controls ?? []) {
|
|
401
|
+
if (kind === "field" && value !== null && value < 3) {
|
|
402
|
+
warnings += 1;
|
|
403
|
+
lines.push(
|
|
404
|
+
`${head(row)} ${kind.padEnd(9)} ${`${value.toFixed(2)}:1`.padStart(8)} <-- warning: under 3`,
|
|
405
|
+
);
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
380
408
|
const c = cell(value, 3);
|
|
381
409
|
lines.push(`${head(row)} ${kind.padEnd(9)} ${c.text.padStart(8)}${flag([c], 3)}`);
|
|
382
410
|
}
|
|
@@ -397,5 +425,5 @@ export function formatContrast(rows) {
|
|
|
397
425
|
4.5,
|
|
398
426
|
);
|
|
399
427
|
|
|
400
|
-
return { text: lines.join("\n"), misses };
|
|
428
|
+
return { text: lines.join("\n"), misses, warnings };
|
|
401
429
|
}
|
package/tokens.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"--backdrop-fill",
|
|
5
5
|
"--backdrop-opacity",
|
|
6
6
|
"--bar-height",
|
|
7
|
+
"--bar-radius",
|
|
7
8
|
"--border",
|
|
8
9
|
"--border-control",
|
|
9
10
|
"--border-control-mix",
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
"--btn-font-size",
|
|
12
13
|
"--choice-control-size",
|
|
13
14
|
"--control-default-bg",
|
|
15
|
+
"--control-default-border",
|
|
14
16
|
"--control-font-size",
|
|
15
17
|
"--control-pad-x",
|
|
16
18
|
"--control-pad-x-lg",
|
|
@@ -33,6 +35,7 @@
|
|
|
33
35
|
"--duration-spin",
|
|
34
36
|
"--ease-enter",
|
|
35
37
|
"--ease-exit",
|
|
38
|
+
"--finish",
|
|
36
39
|
"--focus",
|
|
37
40
|
"--focus-outline",
|
|
38
41
|
"--focus-outline-color",
|
|
@@ -81,6 +84,8 @@
|
|
|
81
84
|
"--selection-fg",
|
|
82
85
|
"--shadow",
|
|
83
86
|
"--shadow-color",
|
|
87
|
+
"--shadow-control",
|
|
88
|
+
"--shadow-inset",
|
|
84
89
|
"--shadow-popout",
|
|
85
90
|
"--soft-bg-mix",
|
|
86
91
|
"--soft-border-mix",
|