@reqvire-org/ads 0.5.10 → 0.5.11

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.
@@ -1055,9 +1055,13 @@ export const constructionErrors = {
1055
1055
  return `Surface ${failure.surface} declares mask, but it is applied to a container that does not scroll: its content, text included, would fade where it stands.`;
1056
1056
  case "brightness-off-visual":
1057
1057
  return `Surface ${failure.surface} declares ${failure.field}, but it is not applied to a visual part: the text it covers would change colour without a contrast check.`;
1058
+ case "scrollbar-off-scroller":
1059
+ return `Surface ${failure.surface} declares ${failure.field}, but it is applied to an element that does not scroll, which has no scrollbar.`;
1060
+ case "scrollbar-pair":
1061
+ return `Surface ${failure.surface} declares a scrollbar ${failure.field === "scrollbar-thumb" ? "track without its thumb" : "thumb without its track"}: a scrollbar's colours are set together.`;
1058
1062
  }
1059
1063
  },
1060
- repair: "On a visual part use `shapeShadow`; on a container use `boxShadow` for the shadow of its box, or `groupShadow` when one shadow for everything inside it is what you want. Put a `mask` on a visual part, or on an element whose `overflow` scrolls. Put `brightness` on a visual part (the picture itself). Give each element its own surface profile where they differ."
1064
+ repair: "On a visual part use `shapeShadow`; on a container use `boxShadow` for the shadow of its box, or `groupShadow` when one shadow for everything inside it is what you want. Put a `mask` on a visual part, or on an element whose `overflow` scrolls. Put scrollbar colours and width on an element whose `overflow` scrolls, with the thumb and track together. Put `brightness` on a visual part (the picture itself). Give each element its own surface profile where they differ."
1061
1065
  },
1062
1066
  "surface-shadow-layer": {
1063
1067
  group: "wrong-value",
@@ -1340,9 +1344,9 @@ export const constructionErrors = {
1340
1344
  },
1341
1345
  "progress-contrast-insufficient": {
1342
1346
  group: "accessibility-semantics",
1343
- rule: "A progress bar's fill, and a range slider's thumb, has at least 3:1 contrast against its track in every theme, brand and state (WCAG 1.4.11): the progress part's own background, the slider track's surface.",
1347
+ rule: "A progress bar's fill, a range slider's thumb and a scrollbar's thumb have at least 3:1 contrast against their track in every theme, brand and state (WCAG 1.4.11): the progress part's own background, the slider track's surface.",
1344
1348
  guides: [RECIPES, "ads://guides/accessibility", "ads://guides/tokens"],
1345
- message: (failure) => `The ${failure.subject === "slider-thumb" ? "slider thumb" : "progress fill"} of part "${failure.part}" has contrast ${failure.ratio}:1 (minimum ${failure.minimum}:1) against its track in ${failure.context}, fill state ${failure.states[0] ?? "base"}, track state ${failure.states[1] ?? "base"}.`,
1349
+ message: (failure) => `The ${failure.subject === "slider-thumb" ? "slider thumb" : failure.subject === "scrollbar-thumb" ? "scrollbar thumb" : "progress fill"} of ${failure.subject === "scrollbar-thumb" ? "surface" : "part"} "${failure.part}" has contrast ${failure.ratio}:1 (minimum ${failure.minimum}:1) against its track in ${failure.context}, fill state ${failure.states[0] ?? "base"}, track state ${failure.states[1] ?? "base"}.`,
1346
1350
  repair: "Choose a fill surface whose background token contrasts enough with the part's own background in that context, or adjust the token's value there."
1347
1351
  },
1348
1352
  "progress-contrast-unresolved": {
@@ -2,6 +2,7 @@ import { createLoweringSession, reviewedLoweringContext } from "./lowering-sessi
2
2
  import { selectAsset } from "./asset-model.mjs";
3
3
  import { REDUCED_MOTION, paintTransitionRules, transitionSetRules } from "./lowering-transitions.mjs";
4
4
  import { reducedMotionPolicy } from "./lowering-motion.mjs";
5
+ import { checkProgressContrast } from "./placeholder-contrast.mjs";
5
6
  import { BORDER_STYLE, BORDER_STYLES, INACTIVE_STATE, SURFACE_STATE, TEXT_TRANSFORM, TEXT_TRANSFORMS, sequenceStepTokenRoles } from "./role-vocabulary.mjs";
6
7
  import { FORCED_FIELDS, FORCED_ONLY, FORCED_PREFIX } from "./forced-colors.mjs";
7
8
  import { controlFrameInsets } from "./lowering-region-layout.mjs";
@@ -11,7 +12,7 @@ import { inspectMotion } from "./motion-model.mjs";
11
12
  import { references, selectedProfile, tokenValueContexts } from "./design-foundation.mjs";
12
13
  import { enterRules } from "./lowering-enter.mjs";
13
14
  import { SEQUENCE_REPEATS, sequenceRules } from "./lowering-sequence.mjs";
14
- import { GROUP_SHADOW, SHAPE_SHADOW, effectDeclarations, effectMisplaced, shadowLayerFinding } from "./surface-effects.mjs";
15
+ import { GROUP_SHADOW, SCROLLBAR_THUMB, SCROLLBAR_TRACK, SHAPE_SHADOW, effectDeclarations, effectMisplaced, shadowLayerFinding } from "./surface-effects.mjs";
15
16
  export const NO_REGIONS = { cells: {}, conditions: [], tilePx: null, contexts: [] }, LIGHT = { name: "light", scheme: "light" };
16
17
  export { REFERENCE_ROOT_PX } from "./css-length.mjs";
17
18
  const context = reviewedLoweringContext();
@@ -156,6 +157,12 @@ export function checkSurfaceEffects(foundation, profile, surfaces, place, reject
156
157
  const fields = profile.of(surface, "surface"), misplaced = effectMisplaced(fields, place);
157
158
  if (misplaced !== null)
158
159
  return reject({ kind: "surface-effect-misplaced", surface, field: misplaced.field, reason: misplaced.reason });
160
+ const thumb = fields[SCROLLBAR_THUMB], track = fields[SCROLLBAR_TRACK];
161
+ if (thumb !== void 0 && track !== void 0) {
162
+ const checked = checkProgressContrast(foundation, surface, [{ condition: null, value: thumb }], [{ condition: null, value: track }]);
163
+ if (checked.kind === "err")
164
+ return reject({ ...checked.error, subject: "scrollbar-thumb" });
165
+ }
159
166
  for (const field of [SHAPE_SHADOW, GROUP_SHADOW]) {
160
167
  const value = fields[field];
161
168
  if (value === void 0)
@@ -138,6 +138,8 @@ export const FAMILIES = [
138
138
  "overlay",
139
139
  "position",
140
140
  "scrollbar-gutter",
141
+ "scrollbar-color",
142
+ "scrollbar-width",
141
143
  "rotate",
142
144
  "scale",
143
145
  "text-box-edge",
@@ -70,6 +70,7 @@ export const PLATFORM_FEATURES = [
70
70
  css: ["overlay", "transition-property: overlay"],
71
71
  degrades: "The top-layer exit animation is cut: where overlay cannot be transitioned, the element leaves the top layer at once and closes instantly."
72
72
  },
73
+ { id: "scrollbar-color", css: ["scrollbar-color", "scrollbar-width"], degrades: "A scrolling element keeps the browser's own scrollbar colours and width." },
73
74
  { id: "scrollbar-gutter", css: ["scrollbar-gutter"], degrades: "The page behind an open modal card shifts sideways by the scrollbar's width when the scroll lock hides it." },
74
75
  { id: "popover", css: [":popover-open"], degrades: "Required by popovers and menus: without the Popover API the overlay never enters the top layer, is not hidden while closed and is not light-dismissed." },
75
76
  { id: "prefers-color-scheme", css: ["@media (prefers-color-scheme)"], degrades: "The operating system's colour scheme is not followed: the default theme applies." },
@@ -17,7 +17,7 @@ export type ValueBound = {
17
17
  /** The CSS numeric types a quantity shape admits. A unitless zero is also a length. */
18
18
  export type QuantityType = "length" | "percentage" | "number" | "time" | "angle";
19
19
  /** CSS properties whose value grammar a non-numeric shape borrows (validated by css-tree). */
20
- export type GrammarProperty = "box-shadow" | "font-family" | "font-feature-settings" | "font-variation-settings" | "transition-timing-function";
20
+ export type GrammarProperty = "box-shadow" | "font-family" | "font-feature-settings" | "font-variation-settings" | "transition-timing-function" | "scrollbar-width";
21
21
  /** What one shape admits. `unregistrable` says why no registered CSS type describes it. */
22
22
  export type ShapeGrammar =
23
23
  /**
@@ -73,6 +73,7 @@ export declare const tokenShapeGrammars: {
73
73
  readonly "opentype-features-or-normal": ShapeGrammar;
74
74
  readonly "opentype-axes-or-normal": ShapeGrammar;
75
75
  readonly "timing-function": ShapeGrammar;
76
+ readonly "scrollbar-width-keyword": ShapeGrammar;
76
77
  };
77
78
  /** A token role's value shape. */
78
79
  export type TokenShape = keyof typeof tokenShapeGrammars;
@@ -159,6 +160,9 @@ declare const tokenRolesByKind: {
159
160
  "border-block-end-color": string[];
160
161
  "shape-shadow": string[];
161
162
  "group-shadow": string[];
163
+ "scrollbar-thumb": string[];
164
+ "scrollbar-track": string[];
165
+ "scrollbar-width": string[];
162
166
  };
163
167
  spacing: {
164
168
  "content-gap": string[];
@@ -23,7 +23,8 @@ export const tokenShapeGrammars = {
23
23
  "font-family-list": property("font-family", "no registered CSS type describes font-family lists"),
24
24
  "opentype-features-or-normal": property("font-feature-settings", "no registered CSS type describes OpenType feature settings"),
25
25
  "opentype-axes-or-normal": property("font-variation-settings", "no registered CSS type describes OpenType axis settings"),
26
- "timing-function": property("transition-timing-function", "no registered CSS type describes timing functions")
26
+ "timing-function": property("transition-timing-function", "no registered CSS type describes timing functions"),
27
+ "scrollbar-width-keyword": property("scrollbar-width", "no registered CSS type describes scrollbar widths")
27
28
  }, tokenRoleShapes = Object.freeze({
28
29
  spacing: "nonnegative-length",
29
30
  "content-gap": "nonnegative-length",
@@ -48,6 +49,7 @@ export const tokenShapeGrammars = {
48
49
  brightness: "nonnegative-percentage",
49
50
  grayscale: "nonnegative-percentage",
50
51
  invert: "nonnegative-percentage",
52
+ "scrollbar-width": "scrollbar-width-keyword",
51
53
  "box-share": "nonnegative-percentage",
52
54
  overlap: "nonnegative-length",
53
55
  "font-family": "font-family-list",
@@ -90,6 +92,7 @@ export const tokenRoleGuides = Object.freeze({
90
92
  brightness: { purpose: "How bright a drawing is shown, as a filter: a picture with no dark version, dimmed in the dark theme.", write: "a percentage: 100% leaves it as it is, below 100% dims it, 0% is black" },
91
93
  grayscale: { purpose: "How grey a drawing is shown, as a filter: colour artwork made quiet, or prepared for inverting on a dark page.", write: "a percentage: 0% leaves its colours, 100% is fully grey" },
92
94
  invert: { purpose: "How far a drawing's tones are inverted, as a filter: dark marks made for a light page shown light on a dark one.", write: "a percentage: 0% leaves it as it is, 100% inverts it fully" },
95
+ "scrollbar-width": { purpose: "How wide a scrolling element's scrollbar is drawn: the platform's, a thin one, or none.", write: "auto, thin or none" },
93
96
  "box-share": { purpose: "A share of an element's own box: how far a backdrop is drawn past it on an axis, growing with the box.", write: "a percentage of the box's size on that axis" },
94
97
  overlap: { purpose: "How far neighbours of an arrangement overlap, in place of a gap between them.", write: "px or rem" },
95
98
  "font-family": { purpose: "The text font and its fallbacks.", write: null },
@@ -185,7 +188,10 @@ const tokenRolesByKind = {
185
188
  "border-block-start-color": ["paint"],
186
189
  "border-block-end-color": ["paint"],
187
190
  "shape-shadow": ["shadow"],
188
- "group-shadow": ["shadow"]
191
+ "group-shadow": ["shadow"],
192
+ "scrollbar-thumb": ["paint"],
193
+ "scrollbar-track": ["paint"],
194
+ "scrollbar-width": ["scrollbar-width"]
189
195
  },
190
196
  spacing: {
191
197
  "content-gap": ["content-gap", "spacing"],
@@ -238,7 +238,9 @@ a recipe never creates a state machine.
238
238
  cast one shadow. `mask` (a `gradient` token whose alpha fades the element)
239
239
  goes on a visual part or on an element that scrolls, never on a container of
240
240
  standing text. The two shadows need a one-layer shadow token (no spread,
241
- inset, `none` or second layer) in every theme.
241
+ inset, `none` or second layer) in every theme. A scrolling element's scrollbar
242
+ takes `scrollbarThumb` and `scrollbarTrack` (together, the thumb at 3:1) and
243
+ `scrollbarWidth` from its surface; never style scrollbars in owner CSS.
242
244
  - Pressing: a glyph part, or a region or control root, declares
243
245
  `transition: ["scale"]` and one `when` entry with
244
246
  `scale: { slot: "motion", field: "scale" }`. The element rests at `scale: 1`
@@ -238,7 +238,9 @@ a recipe never creates a state machine.
238
238
  cast one shadow. `mask` (a `gradient` token whose alpha fades the element)
239
239
  goes on a visual part or on an element that scrolls, never on a container of
240
240
  standing text. The two shadows need a one-layer shadow token (no spread,
241
- inset, `none` or second layer) in every theme.
241
+ inset, `none` or second layer) in every theme. A scrolling element's scrollbar
242
+ takes `scrollbarThumb` and `scrollbarTrack` (together, the thumb at 3:1) and
243
+ `scrollbarWidth` from its surface; never style scrollbars in owner CSS.
242
244
  - Pressing: a glyph part, or a region or control root, declares
243
245
  `transition: ["scale"]` and one `when` entry with
244
246
  `scale: { slot: "motion", field: "scale" }`. The element rests at `scale: 1`
@@ -238,7 +238,9 @@ a recipe never creates a state machine.
238
238
  cast one shadow. `mask` (a `gradient` token whose alpha fades the element)
239
239
  goes on a visual part or on an element that scrolls, never on a container of
240
240
  standing text. The two shadows need a one-layer shadow token (no spread,
241
- inset, `none` or second layer) in every theme.
241
+ inset, `none` or second layer) in every theme. A scrolling element's scrollbar
242
+ takes `scrollbarThumb` and `scrollbarTrack` (together, the thumb at 3:1) and
243
+ `scrollbarWidth` from its surface; never style scrollbars in owner CSS.
242
244
  - Pressing: a glyph part, or a region or control root, declares
243
245
  `transition: ["scale"]` and one `when` entry with
244
246
  `scale: { slot: "motion", field: "scale" }`. The element rests at `scale: 1`
@@ -1,7 +1,9 @@
1
1
  import { resolveTokenValue } from "./token-resolution.mjs";
2
2
  export const SHAPE_SHADOW = "shape-shadow", GROUP_SHADOW = "group-shadow", BRIGHTNESS = "brightness", GRAYSCALE = "grayscale", INVERT = "invert";
3
3
  const TONE_FIELDS = [GRAYSCALE, INVERT, BRIGHTNESS], FILTER_FIELDS = [...TONE_FIELDS, "blur", SHAPE_SHADOW, GROUP_SHADOW], BACKDROP_FIELDS = ["backdrop-blur", "backdrop-saturate"];
4
- export const MASK = "mask", BACKGROUND_TILE = "background-tile", EFFECT_FIELDS = [...FILTER_FIELDS, ...BACKDROP_FIELDS], EFFECT_PROPERTY_FIELDS = { filter: FILTER_FIELDS, "backdrop-filter": BACKDROP_FIELDS };
4
+ export const MASK = "mask", SCROLLBAR_THUMB = "scrollbar-thumb", SCROLLBAR_TRACK = "scrollbar-track", SCROLLBAR_WIDTH = "scrollbar-width";
5
+ const SCROLLBAR_FIELDS = [SCROLLBAR_THUMB, SCROLLBAR_TRACK, SCROLLBAR_WIDTH];
6
+ export const BACKGROUND_TILE = "background-tile", EFFECT_FIELDS = [...FILTER_FIELDS, ...BACKDROP_FIELDS], EFFECT_PROPERTY_FIELDS = { filter: FILTER_FIELDS, "backdrop-filter": BACKDROP_FIELDS };
5
7
  export function filterValue(fields) {
6
8
  const shadow = fields[SHAPE_SHADOW] ?? fields[GROUP_SHADOW], parts = [...TONE_FIELDS.flatMap((field) => fields[field] === void 0 ? [] : [`${field}(${fields[field]})`]), ...fields.blur === void 0 ? [] : [`blur(${fields.blur})`], ...shadow === void 0 ? [] : [`drop-shadow(${shadow})`]];
7
9
  return parts.length === 0 ? null : parts.join(" ");
@@ -21,6 +23,13 @@ export function effectDeclarations(values) {
21
23
  declarations.push(["background-size", `${value} ${value}`], ["background-repeat", "repeat"]);
22
24
  continue;
23
25
  }
26
+ if (property === SCROLLBAR_THUMB || property === SCROLLBAR_TRACK) {
27
+ if (property === SCROLLBAR_THUMB || values[SCROLLBAR_THUMB] === void 0) {
28
+ if (values[SCROLLBAR_THUMB] !== void 0 && values[SCROLLBAR_TRACK] !== void 0)
29
+ declarations.push(["scrollbar-color", `${values[SCROLLBAR_THUMB]} ${values[SCROLLBAR_TRACK]}`]);
30
+ }
31
+ continue;
32
+ }
24
33
  if (property === MASK) {
25
34
  declarations.push(["-webkit-mask-image", value], ["mask-image", value]);
26
35
  continue;
@@ -46,6 +55,11 @@ export function effectMisplaced(fields, place) {
46
55
  return { reason: "both", field: GROUP_SHADOW };
47
56
  if (fields[MASK] !== void 0 && place === "container")
48
57
  return { reason: "mask-on-container", field: MASK };
58
+ const scrollbar = SCROLLBAR_FIELDS.find((field) => fields[field] !== void 0);
59
+ if (scrollbar !== void 0 && place !== "scroller")
60
+ return { reason: "scrollbar-off-scroller", field: scrollbar };
61
+ if (fields[SCROLLBAR_THUMB] === void 0 !== (fields[SCROLLBAR_TRACK] === void 0))
62
+ return { reason: "scrollbar-pair", field: fields[SCROLLBAR_THUMB] === void 0 ? SCROLLBAR_THUMB : SCROLLBAR_TRACK };
49
63
  const tone = TONE_FIELDS.find((field) => fields[field] !== void 0);
50
64
  if (tone !== void 0 && place !== "visual")
51
65
  return { reason: "brightness-off-visual", field: tone };
@@ -23,7 +23,8 @@ export const DTCG_EXTENSION = "org.reqvire.ads", DTCG_TYPES = {
23
23
  "font-family-list": "fontFamily",
24
24
  "opentype-features-or-normal": null,
25
25
  "opentype-axes-or-normal": null,
26
- "timing-function": "cubicBezier"
26
+ "timing-function": "cubicBezier",
27
+ "scrollbar-width-keyword": null
27
28
  };
28
29
  export function modeName({ theme, brand, condition }) {
29
30
  return [[brand, theme].filter((part) => part !== null).join("/"), condition].filter((part) => part !== null && part !== "").join(" ") || "default";
package/docs/CHANGELOG.md CHANGED
@@ -1,24 +1,24 @@
1
1
  # Changelog
2
2
 
3
- ## 0.5.10
3
+ ## 0.5.11
4
4
 
5
5
  <!-- ads-local-tests:start -->
6
6
  Hot patch: the unit and integration groups; the browser group was not run.
7
- Local verification: **1889/1889 passed** with `bun run test:hotpatch`.
8
- Tested commit: `5e8607a7a836bd22e9c90192b57afba99761f0f0`; Bun 1.4.4.
9
- Completed 2026-11-25T19:01:28.346Z (1550 seconds).
7
+ Local verification: **1891/1891 passed** with `bun run test:hotpatch`.
8
+ Tested commit: `648d91c76fb65290d62f65e2176c88aee9c0e2ef`; Bun 1.4.4.
9
+ Completed 2026-11-25T19:51:24.944Z (1495 seconds).
10
10
 
11
11
  <!-- ads-local-test-proof
12
12
  {
13
13
  "schema": 3,
14
- "version": "0.5.10",
15
- "commit": "5e8607a7a836bd22e9c90192b57afba99761f0f0",
16
- "sourceSha256": "01ea140189ee874134a6e221695045e07bea540794ba99b2f69a79f715977e1e",
14
+ "version": "0.5.11",
15
+ "commit": "648d91c76fb65290d62f65e2176c88aee9c0e2ef",
16
+ "sourceSha256": "6af1e0c2748d4d6e23a40ab159cb246d045c9967dffd42aae97be75c59369e76",
17
17
  "command": "bun run test:hotpatch",
18
18
  "scope": "hotpatch",
19
19
  "result": "pass",
20
- "tests": 1889,
21
- "pass": 1889,
20
+ "tests": 1891,
21
+ "pass": 1891,
22
22
  "fail": 0,
23
23
  "skipped": 0,
24
24
  "groups": [
@@ -28,26 +28,36 @@ Completed 2026-11-25T19:01:28.346Z (1550 seconds).
28
28
  "pass": 846,
29
29
  "fail": 0,
30
30
  "skipped": 0,
31
- "reportSha256": "09ee5055c17233a42fb6d4338a6a0450a63e6ec47ab9ef8fd89abca1aa039ec5"
31
+ "reportSha256": "6345564f7e950a85afc5eb2836448966e6f8091e9f91c0085bf8cdca8a06c44b"
32
32
  },
33
33
  {
34
34
  "name": "integration",
35
- "tests": 1043,
36
- "pass": 1043,
35
+ "tests": 1045,
36
+ "pass": 1045,
37
37
  "fail": 0,
38
38
  "skipped": 0,
39
- "reportSha256": "06279ab2f36dc240a06149cb1204a06e76e322ccd9bbd53384013e6d8cc9e253"
39
+ "reportSha256": "2d7516ff31fc5441401354209e1eea1097f5a0755ab8ab545c2f88ea6b553a59"
40
40
  }
41
41
  ],
42
42
  "testOverrides": {},
43
43
  "bun": "1.4.4",
44
- "completedAt": "2026-11-25T19:01:28.346Z",
45
- "durationMs": 1549866,
46
- "logSha256": "154782a5ad2a3298b1199543ac692d8c1c3a62baca7c76ab1633c018b0788b40"
44
+ "completedAt": "2026-11-25T19:51:24.944Z",
45
+ "durationMs": 1495008,
46
+ "logSha256": "19d24c850349946e6edc2c724e14de7feeabdfa426b6c9e2f64c40ffba87d743"
47
47
  }
48
48
  -->
49
49
  <!-- ads-local-tests:end -->
50
50
 
51
+ - *A scrolling element's scrollbar colours and width.* A surface's
52
+ `scrollbarThumb` and `scrollbarTrack` (paints, set together) are written as
53
+ `scrollbar-color`, and `scrollbarWidth`, a token of the new
54
+ `scrollbar-width` role (`auto`, `thin` or `none`), as `scrollbar-width`. They
55
+ belong to an element whose `overflow` scrolls, and the thumb needs 3:1
56
+ against the track in every theme and brand. Baseline since December 2025; an
57
+ older browser keeps its own scrollbar.
58
+
59
+ ## 0.5.10
60
+
51
61
  Changes an existing design may notice: an `inline` row directly in block flow
52
62
  that states its own space (`spaceBefore`, `spaceAfter`, `spacing`) now starts its
53
63
  own line and collapses its space with its neighbours' (#46); a row beside inline
@@ -109,7 +109,8 @@ underline's paint, which a state and a paint transition change like any paint)
109
109
  `opacity` (`opacity`), the effects
110
110
  `blur` and `backdropBlur` (`blur`), `backdropSaturate` (`saturation`),
111
111
  `shapeShadow` and `groupShadow` (`shadow`), `mask` (`gradient`), a paint per
112
- border side, and the policy field `state`.
112
+ border side, a scrollbar's `scrollbarThumb` and `scrollbarTrack` (`paint`) and
113
+ `scrollbarWidth` (`scrollbar-width`), and the policy field `state`.
113
114
 
114
115
  A shadow is a composite effect, not component-local raw offsets and colors.
115
116
  Light, dark and brand variants may resolve to different paints and shadows. In
@@ -285,6 +286,21 @@ graph that fades toward the text beside it) or to an element whose `overflow`
285
286
  container its text would fade where it stands, which cannot be proven
286
287
  readable: `construction/surface-effect-misplaced`.
287
288
 
289
+ A scrolling element's scrollbar takes its colours and width from its surface:
290
+ `scrollbarThumb` and `scrollbarTrack` (paints, set together) are written as
291
+ `scrollbar-color`, and `scrollbarWidth` (a `scrollbar-width` token: `auto`,
292
+ `thin` or `none`) as `scrollbar-width`. They belong to an element whose
293
+ `overflow` scrolls (`construction/surface-effect-misplaced` elsewhere, or for a
294
+ thumb without its track). The thumb shows where the view is: 3:1 against the
295
+ track in every theme and brand (`construction/progress-contrast-insufficient`).
296
+ A browser without the properties keeps its own scrollbar. The page's own
297
+ scrollbar follows the theme through `color-scheme`.
298
+
299
+ ```ts
300
+ // tokens/Surfaces/scrollbar-width.ads.css: --list-scrollbar-width: thin;
301
+ profile({ name: "scrolling-list", kind: "surface", fields: { scrollbarThumb: "--outline-control", scrollbarTrack: "--surface-panel", scrollbarWidth: "--list-scrollbar-width" } });
302
+ ```
303
+
288
304
  ```ts
289
305
  // tokens/Surfaces/gradient.ads.css: --fade-inline-end: linear-gradient(to right, black 80%, transparent);
290
306
  profile({ name: "graph-fade", kind: "surface", fields: { mask: "--fade-inline-end" } });
package/docs/RULES.md CHANGED
@@ -248,7 +248,7 @@ Owned markup or motion lacks required accessible semantics: a text alternative,
248
248
  | `construction/non-text-contrast-insufficient` | error | A control part inside a known surface keeps its boundary and focus visible (WCAG 2.2 1.4.11): where its own background does not reach 3:1 against the enclosing background, its border colour (base and each owner state) does; its focus outline colour reaches 3:1 against what it sits on (the enclosing background outside the box, its own inside), in every theme, brand and condition. | Choose a border or focus colour token that reaches 3:1 against the surrounding background in that context, or give the control a background that does. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
249
249
  | `construction/paint-contrast-insufficient` | error | Every declared value of a runtime paint keeps its contrast against the background the construction knows, in every theme, brand and owner state: a `color` paint 4.5:1 (3:1 for provably large text, WCAG 2.2 1.4.3); a `fill`, `stroke` or `border-color` paint, and a `background-color` paint against its enclosing background, 3:1 (1.4.11); text on a painted background its text minimum. The set is finite, so one failing value fails whichever value data selects. | Adjust that token's value in the failing context, remove it from the paint's values, or place the element on a background it contrasts with. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
250
250
  | `construction/placeholder-contrast-insufficient` | error | Placeholder text has at least 4.5:1 contrast against its part's background in every theme, brand and state (WCAG 1.4.3). | Choose a placeholder surface whose colour token contrasts enough with the part's background in that context, or adjust the token's value there. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
251
- | `construction/progress-contrast-insufficient` | error | A progress bar's fill, and a range slider's thumb, has at least 3:1 contrast against its track in every theme, brand and state (WCAG 1.4.11): the progress part's own background, the slider track's surface. | Choose a fill surface whose background token contrasts enough with the part's own background in that context, or adjust the token's value there. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
251
+ | `construction/progress-contrast-insufficient` | error | A progress bar's fill, a range slider's thumb and a scrollbar's thumb have at least 3:1 contrast against their track in every theme, brand and state (WCAG 1.4.11): the progress part's own background, the slider track's surface. | Choose a fill surface whose background token contrasts enough with the part's own background in that context, or adjust the token's value there. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
252
252
  | `construction/state-contrast-insufficient` | error | An element's owner states keep it readable (text 4.5:1 or 3:1 when large; a visual part's or a text-less control's artwork 3:1; artwork hidden from assistive technology has no minimum, nor has a fully transparent colour, which draws nothing): where a state's colour meets a background from another surface profile (a colour-only state over the base fill, a state fill under the base colour), the pair has at least 4.5:1 contrast in every theme, brand and condition, or 3:1 where the element's text profile makes its text large there (at least 24px, or 18.66px at weight 700); a state that holds only while the element is inactive (:disabled, [aria-disabled="true"]) has no minimum (WCAG 2.2 1.4.3). Two states that cannot hold on one root together (two values of one attribute, a state and its :not(), :disabled and :enabled) are not paired. | Treat the state with a surface that sets both its colour and background, or choose colour and background tokens that contrast in that context. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
253
253
  | `construction/target-area-overlap` | error | The enlarged hit areas of neighbouring targets in a stack or inline arrangement do not overlap across their gap in any context: a press there would reach two targets (WCAG 2.2 2.5.8). | Widen the arrangement's gap to at least the hit areas' reach beyond the two boxes, or reduce the min-target sizes. | `ads://guides/recipes`, `ads://guides/accessibility` |
254
254
  | `construction/target-size-below-minimum` | error | Every control construction and `frame: "control"` part is a pointer target of at least 24 × 24 CSS px in every theme, brand and condition (WCAG 2.2 2.5.8), computed from its lowered box: min block = max(min-block-size, content + 2 (inset + border)), inline = 2 (padding-inline + border) + content; an enlarged hit area (min-target-inline-size, min-target-block-size) counts. Relative lengths are evaluated at the 16px reference root. The spacing exception holds for a smaller part of a stack or inline arrangement: a 24px circle centred on it reaches neither a neighbouring target's box nor, for a smaller neighbour, that neighbour's circle, at every gap the arrangement takes; a root or a part with no neighbouring target keeps the minimum. | Raise the frame profile's min-block-size, padding-inline or the visual size in that context, give the frame a min-target-inline-size / min-target-block-size hit area of at least 24px, or (for a part between targets) widen the arrangement's gap until 24px circles centred on the targets keep clear of each other. | `ads://guides/recipes`, `ads://guides/accessibility`, `ads://guides/tokens` |
@@ -341,7 +341,7 @@ A value has the wrong kind, role or range for where it is used. Choose one of th
341
341
  | `construction/spatial-bound-unit` | error | A breakpoint or named condition bound is a media or container query bound and is authored in rem or em, which follow the reader's text size; ADS writes it as authored and never converts px. | Write the token in rem (divide the px value by 16). | `ads://guides/layout`, `ads://guides/tokens` |
342
342
  | `construction/state-geometry-unsupported` | error | An owner state may select an element's geometry: another frame profile, another spacing profile, and whether a part is collapsed. The state's frame states every field the element's own frame writes; a listed geometry channel changes under some state; a `:hover` state has a focus or attribute state of the same geometry, so it is not for pointer users only; a collapsed part has no frame or arrangement of its own and sits in a stack or a row; a state's frame keeps the element's hit area; neighbouring targets do not overlap. | Give the element a frame before a state changes it; state every field in the state's frame profile; list only channels that change; repeat a hover state's geometry under `:focus-visible`, `:focus-within` or an attribute state; put a collapsible part's box on the one element it holds. | `ads://guides/recipes`, `ads://guides/layout` |
343
343
  | `construction/state-text-field` | error | A text profile selected under an owner state (`when: { state: { text } }`) changes the weight and the tracking only (`font-weight`, `letter-spacing`): the family, the size, the line height and every other text property stay the element's own, so the state moves neither the line nor the box's height. | Derive the state's text profile from the element's own (`extends`) and change only `weight` or `letterSpacing`; a different size or family is a different element or a recipe choice, not a state. | `ads://guides/recipes` |
344
- | `construction/surface-effect-misplaced` | error | A shadow that follows an element's shape is declared where it belongs. `shapeShadow` is a visual part's (an image, artwork, a glyph), which has nothing inside it. `groupShadow` is a container's choice: everything inside it casts one shadow. A surface declares at most one of them. `boxShadow` remains the shadow of an element's box and suits any rectangular or rounded element. A `mask` fades a drawing (a visual part) or the edge of an element that scrolls; on any other container its text would fade where it stands, and that cannot be proven readable. | On a visual part use `shapeShadow`; on a container use `boxShadow` for the shadow of its box, or `groupShadow` when one shadow for everything inside it is what you want. Put a `mask` on a visual part, or on an element whose `overflow` scrolls. Put `brightness` on a visual part (the picture itself). Give each element its own surface profile where they differ. | `ads://guides/recipes`, `ads://guides/tokens` |
344
+ | `construction/surface-effect-misplaced` | error | A shadow that follows an element's shape is declared where it belongs. `shapeShadow` is a visual part's (an image, artwork, a glyph), which has nothing inside it. `groupShadow` is a container's choice: everything inside it casts one shadow. A surface declares at most one of them. `boxShadow` remains the shadow of an element's box and suits any rectangular or rounded element. A `mask` fades a drawing (a visual part) or the edge of an element that scrolls; on any other container its text would fade where it stands, and that cannot be proven readable. | On a visual part use `shapeShadow`; on a container use `boxShadow` for the shadow of its box, or `groupShadow` when one shadow for everything inside it is what you want. Put a `mask` on a visual part, or on an element whose `overflow` scrolls. Put scrollbar colours and width on an element whose `overflow` scrolls, with the thumb and track together. Put `brightness` on a visual part (the picture itself). Give each element its own surface profile where they differ. | `ads://guides/recipes`, `ads://guides/tokens` |
345
345
  | `construction/surface-shadow-layer` | error | A `shapeShadow` or `groupShadow` token is one shadow layer in every theme and brand: two offsets, an optional blur and a colour. `filter: drop-shadow()` takes no second layer, no spread and no `inset`, and `none` is not a shadow to cast; a shadow token with those is for `boxShadow`. | Give the field its own shadow token with one layer and no spread, in every theme and brand, or use `boxShadow` for this shadow. | `ads://guides/tokens`, `ads://guides/recipes` |
346
346
  | `construction/vector-surface-unsupported` | error | A vector part's surface sets exactly one field, its stroke `color`. | Give the vector part a colour-only surface profile. | `ads://guides/recipes`, `ads://guides/pictograms` |
347
347
  | `contexts/declaration-rejected` | error | foundation.ads.ts is one literal foundation() declaration the design language accepts. | Correct the foundation declaration as the message describes. | `ads://guides/tokens`, `ads://guides/recipes` |
@@ -27,7 +27,7 @@ construction and owner code supplies behavior: these are different contracts.
27
27
  - Primitive and semantic describe a token's purpose, not role kinds. A folder
28
28
  name does not prove primitive status. The example design system uses
29
29
  `Foundation/spacing.ads.css` for primitive scale steps and functional groups
30
- (`Surfaces/` for paints, gradients, shadows, opacity, blur, saturation, brightness, grayscale and invert) for semantic
30
+ (`Surfaces/` for paints, gradients, shadows, opacity, blur, saturation, brightness, grayscale, invert and scrollbar widths) for semantic
31
31
  decisions.
32
32
  - A primitive must not depend on a semantic consumer. Semantic tokens compose
33
33
  primitives and other semantic tokens through the
@@ -88,6 +88,7 @@ construction and owner code supplies behavior: these are different contracts.
88
88
  | `saturation.ads.css` | Nonnegative percentage; `100%` leaves colours unchanged, `0%` is greyscale | A surface's `backdropSaturate`: how vivid what is behind it appears | `--surface-backdrop-saturation` |
89
89
  | `brightness.ads.css` | Nonnegative percentage; `100%` leaves the drawing unchanged, lower dims it, `0%` is black | A surface's `brightness` on a visual part: a picture with no dark version, dimmed in the dark theme | `--image-brightness` |
90
90
  | `grayscale.ads.css` | Nonnegative percentage; `0%` leaves the drawing's colours, `100%` is fully grey | A surface's `grayscale` on a visual part: colour artwork made quiet, or a logo prepared for inverting on a dark page | `--logo-grey` |
91
+ | `scrollbar-width.ads.css` | `auto`, `thin` or `none` | A surface's `scrollbarWidth` on an element that scrolls: how wide its scrollbar is drawn (`none` hides it; the element still scrolls) |
91
92
  | `invert.ads.css` | Nonnegative percentage; `0%` leaves the drawing, `100%` inverts its tones | A surface's `invert` on a visual part: dark marks made for a light page shown light on a dark one | `--logo-invert` |
92
93
  | `overlap.ads.css` | Nonnegative length | A spacing profile's `overlap`: how far the neighbours of an `inline` or `stack` arrangement overlap, in place of a gap | `--facepile-overlap` |
93
94
  | `box-share.ads.css` | Nonnegative percentage of an element's own box on one axis | A spacing profile's `outsetBlock` / `outsetInline`: how far a layered backdrop is drawn past its box, growing with it | `--glow-outset-block` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "type": "module",
5
5
  "description": "A design system your agent can see and shape. Your components. Your look. Your code.",
6
6
  "repository": {