@reqvire-org/ads 0.5.4 → 0.5.6

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.
Files changed (97) hide show
  1. package/dist/ads-errors.mjs +105 -8
  2. package/dist/analysis/client-directive.mjs +26 -0
  3. package/dist/analysis/externals.mjs +47 -0
  4. package/dist/analysis/module-graph.mjs +6 -0
  5. package/dist/analysis/owner-analysis-key.mjs +1 -1
  6. package/dist/analysis/owner-choices.mjs +12 -2
  7. package/dist/analysis/owner-composition.mjs +19 -4
  8. package/dist/analysis/owner-source.mjs +112 -15
  9. package/dist/border-paint.mjs +34 -0
  10. package/dist/check.mjs +2 -0
  11. package/dist/composed-contrast.mjs +10 -7
  12. package/dist/construction-output.mjs +52 -27
  13. package/dist/construction-spec.d.mts +40 -10
  14. package/dist/construction-spec.mjs +41 -19
  15. package/dist/corner-overpaint.mjs +3 -1
  16. package/dist/design-foundation.mjs +14 -0
  17. package/dist/emit/owner-emission-cache.mjs +1 -1
  18. package/dist/end-alignment.mjs +75 -0
  19. package/dist/external-macro.d.mts +20 -0
  20. package/dist/external-macro.mjs +12 -0
  21. package/dist/finding-rules.mjs +3 -0
  22. package/dist/forced-colors.mjs +81 -0
  23. package/dist/frame-regions.mjs +2 -2
  24. package/dist/grid-facts.mjs +1 -1
  25. package/dist/guard/externals.mjs +64 -0
  26. package/dist/guard/run.mjs +9 -5
  27. package/dist/inventories.mjs +1 -1
  28. package/dist/lowering-emitter.mjs +2 -1
  29. package/dist/lowering-layer.mjs +39 -4
  30. package/dist/lowering-overlaps.mjs +7 -0
  31. package/dist/lowering-properties.mjs +2 -0
  32. package/dist/lowering-region-layout.mjs +23 -3
  33. package/dist/lowering-session.mjs +1 -1
  34. package/dist/mcp/preview-http.bundle.js +2 -2
  35. package/dist/mcp/preview-widget.bundle.js +12 -12
  36. package/dist/measured-geometry.mjs +8 -2
  37. package/dist/owner-analysis-check.mjs +190 -11
  38. package/dist/owner-errors.mjs +3 -0
  39. package/dist/owner-lowering.mjs +3 -2
  40. package/dist/ownership-model.mjs +6 -3
  41. package/dist/platform-features.mjs +2 -0
  42. package/dist/preview-bun.mjs +15 -2
  43. package/dist/profile-macro.d.mts +18 -0
  44. package/dist/recipe-macro.d.mts +49 -6
  45. package/dist/recipe-model.mjs +13 -5
  46. package/dist/region-lowering.mjs +115 -22
  47. package/dist/render-audit/axe-run.page.mjs +40 -1
  48. package/dist/render-audit/forced-states.page.mjs +37 -0
  49. package/dist/render-audit/layout-overflow.page.mjs +52 -2
  50. package/dist/render-audit/non-text-contrast.page.mjs +14 -10
  51. package/dist/render-audit/worker.mjs +38 -0
  52. package/dist/render-audit.mjs +42 -5
  53. package/dist/role-vocabulary.d.mts +2 -2
  54. package/dist/role-vocabulary.mjs +3 -3
  55. package/dist/scenario-kit.d.mts +2 -2
  56. package/dist/showcase/assets-view.mjs +17 -47
  57. package/dist/showcase/client.bundle.js +54 -54
  58. package/dist/showcase/http-client.bundle.js +18 -18
  59. package/dist/showcase/token-sample.mjs +16 -6
  60. package/dist/showcase/ui/ui.css +1 -1
  61. package/dist/showcase/ui/ui.js +13 -13
  62. package/dist/skills/ads-designer/references/accessibility.md +21 -1
  63. package/dist/skills/ads-designer/references/branding.md +4 -0
  64. package/dist/skills/ads-designer/references/design-data.md +6 -0
  65. package/dist/skills/ads-designer/references/layers.md +5 -0
  66. package/dist/skills/ads-designer/references/layout.md +8 -1
  67. package/dist/skills/ads-designer/references/recipes.md +36 -0
  68. package/dist/skills/ads-designer/references/runtimes.md +4 -0
  69. package/dist/skills/ads-designer/references/scenarios.md +2 -0
  70. package/dist/skills/ads-import/references/design-data.md +6 -0
  71. package/dist/skills/ads-import/references/layers.md +5 -0
  72. package/dist/skills/ads-import/references/layout.md +8 -1
  73. package/dist/skills/ads-import/references/recipes.md +36 -0
  74. package/dist/skills/ads-import/references/runtimes.md +4 -0
  75. package/dist/skills/ads-import/references/scenarios.md +2 -0
  76. package/dist/skills/ads-migrate/SKILL.md +1 -0
  77. package/dist/skills/ads-migrate/references/0.5.4-to-0.5.5.md +61 -0
  78. package/dist/skills/ads-port/references/design-data.md +6 -0
  79. package/dist/skills/ads-port/references/layers.md +5 -0
  80. package/dist/skills/ads-port/references/layout.md +8 -1
  81. package/dist/skills/ads-port/references/recipes.md +36 -0
  82. package/dist/skills/ads-port/references/runtimes.md +4 -0
  83. package/dist/skills/ads-port/references/scenarios.md +2 -0
  84. package/dist/spatial-model.mjs +37 -10
  85. package/dist/system-colors.d.mts +9 -0
  86. package/dist/system-colors.mjs +1 -0
  87. package/dist/target-size.mjs +14 -1
  88. package/dist/tsconfig.declarations.json +1 -0
  89. package/docs/ADS.md +23 -1
  90. package/docs/ASSETS.md +21 -0
  91. package/docs/CACHING.md +1 -1
  92. package/docs/CHANGELOG.md +184 -27
  93. package/docs/GUIDE.md +31 -20
  94. package/docs/LANGUAGE.md +122 -6
  95. package/docs/PROFILE-KINDS.md +50 -4
  96. package/docs/RULES.md +21 -8
  97. package/package.json +7 -1
@@ -149,7 +149,7 @@ export const choiceErrors = {
149
149
  rule: "Design is selected from a finite set of choices ADS can enumerate, so every rendered combination can be checked.",
150
150
  guides: [RECIPES, "ads://guides/atomic-styles"],
151
151
  message: (problem) => problem.falsy === void 0 ? "A value that selects design does not come from a finite set of choices." : `\`${problem.falsy}\` selects design by a test that is not a finite choice: its type admits a given value that is falsy (\`0\`, \`""\`, \`false\` or \`null\`). Test \`!== undefined\`.`,
152
- repair: 'Type the selecting prop or variable as a literal union (or a const record key) so every choice can be enumerated. A decision made from data (a count, an element, a lookup) is named as design state: `const overflow: "fits" | "overflows" = members.length > 3 ? \u2026`, or `const fourth: Member | undefined = members[3]`. An optional object, callback or node prop selects by whether it is given: test a node (or any type that admits text, a number or a boolean) with `!== undefined`, never by truthiness.'
152
+ repair: 'Type the selecting prop or variable as a literal union (or a const record key) so every choice can be enumerated. A decision made from data (a count, an element, a lookup) is named as design state: `const overflow: "fits" | "overflows" = members.length > 3 ? \u2026`, `const fourth: Member | undefined = members[3]`, or a look an object\'s field chooses, `const color: Color = channel.color`. An optional object, callback or node prop selects by whether it is given: test a node (or any type that admits text, a number or a boolean) with `!== undefined`, never by truthiness.'
153
153
  },
154
154
  "work-limit": {
155
155
  group: "unanalyzable",
@@ -635,6 +635,27 @@ export const choiceErrors = {
635
635
  message: (failure) => `${failure.part === "&" ? "The root" : `Part "${failure.part}"`} is a summary outside a <details> element.`,
636
636
  repair: "Render the summary inside the owner's `<details>`, or declare another element."
637
637
  },
638
+ "document-lang-missing": {
639
+ group: "accessibility-semantics",
640
+ rule: 'The document pattern (`element: "document"`) renders `<html>` with its language (`lang`, WCAG 3.1.1), from a required prop.',
641
+ guides: [RECIPES, "ads://guides/accessibility"],
642
+ message: () => "The document's <html> has no lang attribute.",
643
+ repair: "Give the pattern a required `language` prop and render `<html lang={language}>`."
644
+ },
645
+ "end-misaligned": {
646
+ group: "conflict",
647
+ rule: "Blocks stacked in one column end their content on one line: a block's content ends where its frame's inline end padding (and, for a grid, its gutter's end inset) puts it, and a block that ends a few pixels to a gutter away from its siblings is not on their grid or gutter (a header whose actions end past the sections below). Text ends ragged and is not compared; a block further than 64px off is taken as deliberately narrower.",
648
+ guides: [RECIPES, "ads://guides/layout"],
649
+ message: (failure) => `Part "${failure.part}" ends its content ${Math.abs(failure.distancePx)}px ${failure.distancePx > 0 ? "past" : "short of"} the line part "${failure.other}" ends on, under ${failure.context}: it is probably not on the same grid or gutter.`,
650
+ repair: "Put the block on the same tracks and gutter as its siblings, or give its frame the inline end padding that ends its content on their line."
651
+ },
652
+ "document-duplicate": {
653
+ group: "conflict",
654
+ rule: 'A design system has at most one document pattern (`element: "document"`): it is the page\'s `<html>`.',
655
+ guides: [RECIPES],
656
+ message: (failure) => `Another owner already renders the document (${failure.first}).`,
657
+ repair: "Keep one document pattern and give the other owner a root of its own."
658
+ },
638
659
  "clamp-on-control": {
639
660
  group: "accessibility-semantics",
640
661
  rule: "A clamp (`lines`) cuts text off for sighted readers: never on a control or a form label (a button, label, legend, summary, select, option or text field) or on text inside one, whose text says what the control does.",
@@ -805,10 +826,10 @@ export const choiceErrors = {
805
826
  },
806
827
  "scheme-image-element": {
807
828
  group: "structure-mismatch",
808
- rule: "A part that declares `scheme` is one file of a content image's light and dark pair: it is rendered as an `<img>` without an artwork binding. Declared artwork has its own theme variants.",
829
+ rule: "A part that declares `scheme` is one drawing of a light and dark pair: a content `<img>` without an artwork binding, or declared artwork bound for a theme of that scheme (a logo black on light, white on dark).",
809
830
  guides: [RECIPES, "ads://guides/branding"],
810
- message: (failure) => `Part "${failure.part}" declares \`scheme\` but is rendered as <${failure.element}>${failure.element === "img" ? " with an artwork binding" : ""}.`,
811
- repair: "Render both scheme parts as plain `<img>` elements whose `src` the application supplies, or remove `scheme`."
831
+ message: (failure) => failure.element.startsWith("artwork") ? `Part "${failure.part}" declares \`scheme\` but shows ${failure.element}, of the other scheme.` : `Part "${failure.part}" declares \`scheme\` but is rendered as <${failure.element}>.`,
832
+ repair: 'Render a content pair as plain `<img>` elements whose `src` the application supplies; bind declared artwork for a theme of the part\'s scheme (`recipe({ theme: "dark", \u2026 })` on the dark part); or remove `scheme`.'
812
833
  },
813
834
  "scheme-image-size-missing": {
814
835
  group: "structure-mismatch",
@@ -1263,9 +1284,9 @@ export const constructionErrors = {
1263
1284
  },
1264
1285
  "progress-contrast-insufficient": {
1265
1286
  group: "accessibility-semantics",
1266
- rule: "A progress bar's fill has at least 3:1 contrast against its track, the part's own background, in every theme, brand and state (WCAG 1.4.11).",
1287
+ 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.",
1267
1288
  guides: [RECIPES, "ads://guides/accessibility", "ads://guides/tokens"],
1268
- message: (failure) => `The 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"}.`,
1289
+ 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"}.`,
1269
1290
  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."
1270
1291
  },
1271
1292
  "progress-contrast-unresolved": {
@@ -1299,11 +1320,18 @@ export const constructionErrors = {
1299
1320
  ].join(" and ")}; a pointer target needs ${pixels(failure.minimumPx)} \xD7 ${pixels(failure.minimumPx)}.`,
1300
1321
  repair: "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."
1301
1322
  },
1323
+ "forced-boundary-missing": {
1324
+ group: "accessibility-semantics",
1325
+ rule: "A control keeps a visible edge in forced colours, where backgrounds become Canvas and shadows are removed but borders stay: its frame draws a border in every context.",
1326
+ guides: ["ads://guides/accessibility"],
1327
+ message: (failure) => `${failure.element === "&" ? "The control" : `Part "${failure.element}"`} has no border${failure.frame === null ? "" : `: frame ${failure.frame} declares no borderWidth`}. In forced colours (Windows contrast themes) its fill becomes the page's background and it has no visible edge.`,
1328
+ repair: 'Give the frame profile a borderWidth; `borderStyle: "forced-only"` keeps it transparent in normal mode and draws it in forced colours.'
1329
+ },
1302
1330
  "corner-overpaint": {
1303
1331
  group: "conflict",
1304
- rule: "A rounded frame's corners stay rounded. A region root whose frame profile declares a `radius`, with visible overflow and no inset on a corner's edges, does not clip what it holds: a part that reaches that corner (the first or last part of a stack, a layer of a layered root) and paints a background of its own draws a square corner over the curve. ADS does not clip for the author, because clipping also cuts focus outlines, shadows and menus.",
1332
+ rule: "A rounded frame's corners stay rounded. A region root whose frame profile declares a `radius`, with visible overflow and no inset on a corner's edges, does not clip what it holds: a part that reaches that corner (the first or last part of a stack, a layer of a layered root) and paints a background of its own, or draws a border of its own, puts a square corner over the curve. ADS does not clip for the author, because clipping also cuts focus outlines, shadows and menus.",
1305
1333
  guides: [RECIPES],
1306
- message: (failure) => `Part "${failure.part}" paints the background of surface ${failure.surface}${failure.state === null ? "" : ` (state ${failure.state})`} over the root's rounded ${failure.corners.join(", ")} corner${failure.corners.length === 1 ? "" : "s"}${failure.under === null ? "" : ` under ${failure.under}`}: the root has a radius, visible overflow and no inset there${failure.under === null ? "" : " with the frames that state selects"}.`,
1334
+ message: (failure) => failure.paint === "border" ? `Part "${failure.part}" draws a border of its own with square corners over the root's rounded ${failure.corners.join(", ")} corner${failure.corners.length === 1 ? "" : "s"}${failure.under === null ? "" : ` under ${failure.under}`}: the root has a radius, visible overflow and no inset there.` : `Part "${failure.part}" paints the background of surface ${failure.surface}${failure.state === null ? "" : ` (state ${failure.state})`} over the root's rounded ${failure.corners.join(", ")} corner${failure.corners.length === 1 ? "" : "s"}${failure.under === null ? "" : ` under ${failure.under}`}: the root has a radius, visible overflow and no inset there${failure.under === null ? "" : " with the frames that state selects"}.`,
1307
1335
  repair: 'Choose one: clip the root (`overflow: "clip"`), inset it (padding in its frame profile), or round the part (a `frame: { profile }` whose frame profile has the matching radius). Name the rounded corners with `frame: { corners }` when only some are rounded.'
1308
1336
  },
1309
1337
  "non-text-contrast-insufficient": {
@@ -1689,6 +1717,20 @@ export const constructionErrors = {
1689
1717
  message: (failure) => `${failure.profile} provides ${failure.token} and its ${failure.field} reads ${failure.token}: the element would take the provided value itself.`,
1690
1718
  repair: "Read another token in the surface's own fields, or provide a role the surface itself does not read (a link ink, an icon ink)."
1691
1719
  },
1720
+ "forced-color-invalid": {
1721
+ group: "wrong-value",
1722
+ rule: "A surface profile's `forcedColors` (background, color, border) names CSS system colours, which the user's contrast theme sets: Canvas, CanvasText, Highlight, HighlightText, ButtonFace, ButtonText, LinkText, GrayText, AccentColor, AccentColorText.",
1723
+ guides: [RECIPES],
1724
+ message: (failure) => `${failure.profile}'s forced colour ${failure.field.replace("forced-colors-", "")} is ${failure.value}, not a CSS system colour.`,
1725
+ repair: "Use a system colour: Highlight and HighlightText for a selection, GrayText for a disabled control, ButtonText for a control's edge, LinkText for a link."
1726
+ },
1727
+ "document-text-incomplete": {
1728
+ group: "wrong-value",
1729
+ rule: "The document's text profile (`foundation({ text })`) is the fallback of every text: foundation.css writes it on <body>. It states the font family, size and line height, so no text shows the browser's own default.",
1730
+ guides: ["ads://guides/tokens", RECIPES],
1731
+ message: (failure) => `The document's text profile ${failure.reference} states no ${failure.missing.join(", ")}: text with no text profile of its own would show the browser's default.`,
1732
+ repair: "Give the document's text profile fontFamily, fontSize and lineHeight from your type tokens."
1733
+ },
1692
1734
  "document-profile-kind": {
1693
1735
  group: "wrong-value",
1694
1736
  rule: "foundation.ads.ts's text names a text profile, its surface a surface profile and its focus a focus profile: they style the document and its default focus indicator.",
@@ -2115,6 +2157,24 @@ export const runtimeErrors = {
2115
2157
  emitters: ["src/owner-analysis-check.mts"],
2116
2158
  situations: "owner-analysis errors with code construction/target-size-below-minimum (the element, its size, the context and the deficit) or construction/target-area-overlap, at the construction's first selecting expression. The render audit's axe target-size rule cross-checks the rendered result."
2117
2159
  },
2160
+ "a11y-forced-colors": {
2161
+ group: "accessibility-semantics",
2162
+ severity: "error",
2163
+ rule: 'A control keeps a visible edge in forced colours (Windows contrast themes), where backgrounds become Canvas and shadows are removed but borders stay: every control construction and frame: "control" part draws a border in every context, or a frame border drawn only there (`borderStyle: "forced-only"`, transparent otherwise). A surface\'s `forcedColors` names CSS system colours.',
2164
+ guides: ["ads://guides/accessibility"],
2165
+ repair: 'Give the control\'s frame profile a borderWidth (transparent in normal mode with `borderStyle: "forced-only"`), and use a system colour in `forcedColors`.',
2166
+ emitters: ["src/owner-analysis-check.mts"],
2167
+ situations: "owner-analysis errors with code construction/forced-boundary-missing (the element, its frame and the context) at the construction, and foundation/forced-color-invalid at the foundation."
2168
+ },
2169
+ "a11y-forced-colors-review": {
2170
+ group: "accessibility-semantics",
2171
+ severity: "review",
2172
+ rule: "A selected, pressed, checked or current state stays visible in forced colours: a state surface that differs from the base only by fill (background, background image, shadow) shows nothing there unless it declares `forcedColors`. Pointer and focus feedback, open disclosures and autofill are not listed.",
2173
+ guides: ["ads://guides/accessibility"],
2174
+ repair: 'Declare `forcedColors` on the state\'s surface (a selection: `{ background: "Highlight", color: "HighlightText" }`), or show the state by more than fill (a border, a mark, text).',
2175
+ emitters: ["src/owner-analysis-check.mts"],
2176
+ situations: "owner-analysis review notes with code review/forced-state-fill-only at the construction."
2177
+ },
2118
2178
  "a11y-target-size-unresolved": {
2119
2179
  group: "unanalyzable",
2120
2180
  severity: "review",
@@ -2133,6 +2193,15 @@ export const runtimeErrors = {
2133
2193
  emitters: ["src/owner-analysis-check.mts"],
2134
2194
  situations: "part of the token-type check, located at the defining declaration in the token sheet; the message names the token, its role and the first failing context. Line heights are included because a px line height stays fixed while resized text grows, so lines overlap."
2135
2195
  },
2196
+ "a11y-forced-colors-render": {
2197
+ group: "accessibility-semantics",
2198
+ severity: "error",
2199
+ rule: "Each scenario is also rendered in forced colours (Chromium's emulation of Windows contrast themes) and with a coarse pointer (a touch context, whose `pointer: coarse` selects touch-density tokens); axe runs in both, and its findings name the environment. In forced colours an element in a meant state (aria-selected, aria-pressed, aria-checked, aria-current) must not render exactly like a sibling without it: text, background, border, outline and what it draws inside are compared.",
2200
+ guides: ["ads://guides/accessibility"],
2201
+ repair: 'Declare `forcedColors` on the state\'s surface (a selection: `{ background: "Highlight", color: "HighlightText" }`), or show the state by a border, a mark or text as well.',
2202
+ emitters: ["src/render-audit.mts"],
2203
+ situations: 'render-audit errors with `environment: "forced-colors"`; axe findings of either environment carry `environment` and say it in the message.'
2204
+ },
2136
2205
  "a11y-text-scale": {
2137
2206
  group: "rendered-check",
2138
2207
  severity: "error",
@@ -3417,6 +3486,27 @@ export const runtimeErrors = {
3417
3486
  message: (review) => `Summary ${review.part === "&" ? "root" : `part "${review.part}"`} removes its marker and renders no artwork.`,
3418
3487
  repair: "Render a chevron (a visual part or a public Icon) chosen by the controlled open state, or keep the native marker."
3419
3488
  },
3489
+ "border-paint-missing": {
3490
+ group: "conflict",
3491
+ rule: "A frame that draws a border (`borderWidth`) has a paint for it: a surface of the element, at rest or under a state, sets `borderColor` (or a side's colour). Without one CSS paints the border in the text colour, almost always a forgotten paint. Listed for review: the text colour may be meant.",
3492
+ guides: [RECIPES],
3493
+ message: (review) => `${review.element === "&" ? "The root" : `Part "${review.element}"`} draws the border of frame ${review.frame}, but no surface of it sets a border colour: the border takes the text colour.`,
3494
+ repair: "Give the element's surface a borderColor (a rule or edge paint), or remove the frame's borderWidth if no border is meant."
3495
+ },
3496
+ "client-directive-unneeded": {
3497
+ group: "conflict",
3498
+ rule: 'ADS derives `"use client"` for each emitted owner: it writes it where the owner calls a hook or gives an element an event handler, and leaves it out of a purely presentational owner, which stays usable in a React Server Component. A directive the author wrote where nothing needs the client is listed for review.',
3499
+ guides: [RECIPES],
3500
+ message: () => 'The owner writes "use client" but calls no hook and handles no event: emitted without it, it can render in a Server Component.',
3501
+ repair: "Remove the directive: ADS writes it whenever the owner needs the client."
3502
+ },
3503
+ "forced-state-fill-only": {
3504
+ group: "accessibility-semantics",
3505
+ rule: "A state the page means stays visible in forced colours, where backgrounds become Canvas and shadows are removed: a state surface that differs from the base only by fill declares `forcedColors`.",
3506
+ guides: ["ads://guides/accessibility"],
3507
+ message: (review) => `${review.element === "&" ? "The construction" : `Part "${review.element}"`} shows ${review.condition} only by the fill of surface ${review.surface}: in forced colours it looks like the base.`,
3508
+ repair: 'Declare `forcedColors` on that surface (a selection: `{ background: "Highlight", color: "HighlightText" }`), or show the state by a border, a mark or text as well.'
3509
+ },
3420
3510
  "hover-geometry-shift": {
3421
3511
  group: "conflict",
3422
3512
  rule: "Geometry an element in flow takes under `:hover` (another frame or spacing profile, a part that opens) moves what follows it whenever the pointer passes over it. ADS accepts it as the designer's choice and lists it for review; a layer of a layered parent draws over its neighbours instead and is not listed.",
@@ -3431,6 +3521,13 @@ export const runtimeErrors = {
3431
3521
  message: (review) => `Part "${review.part}" truncates its text without a title.`,
3432
3522
  repair: "Set `title` on the truncated element to its full text; when an expand control or the full content elsewhere shows it, the note can be dismissed after review."
3433
3523
  },
3524
+ "counter-unreset": {
3525
+ group: "conflict",
3526
+ rule: "A CSS counter a construction shows (`content: { counter | counters }`) or counts (`counter: { increment }`) is reset by some recipe of the design system (`counter: { reset }`), or is the browser's own `list-item`. Without a reset the browser starts an implicit counter at each element that counts, so every item shows 1. Listed for review, since a page may reset it outside the design system.",
3527
+ guides: [RECIPES],
3528
+ message: (review) => `Counter "${review.counter}" is shown or counted here, but no recipe of the design system resets it: each element would start its own count.`,
3529
+ repair: 'Reset it on the element that contains the counted ones (`counter: { reset: "<name>" }` on the list or the flow), or count with `list-item`.'
3530
+ },
3434
3531
  "optional-cell-row": {
3435
3532
  group: "conflict",
3436
3533
  rule: "A grid cell that may be absent (`required: false`) and is pinned to a row (`row`) leaves that row empty whenever it is absent: the row's track and the gaps around it stay. ADS accepts it as the designer's choice and lists it for review.",
@@ -0,0 +1,26 @@
1
+ import { SyntaxKind, isCallExpression, isExpressionStatement, isIdentifier, isJsxAttribute, isPropertyAccessExpression, isStringLiteral } from "typescript/ast";
2
+ import { nodesOfKind } from "./native-boundary.mjs";
3
+ export const CLIENT_DIRECTIVE = '"use client";';
4
+ const HOOK = /^use[A-Z0-9]/, HANDLER = /^on[A-Z]/;
5
+ export function clientNeed(source) {
6
+ for (const call of nodesOfKind(source, SyntaxKind.CallExpression, isCallExpression)) {
7
+ const callee = call.expression, name = isIdentifier(callee) ? callee.text : isPropertyAccessExpression(callee) ? callee.name.text : null;
8
+ if (name !== null && HOOK.test(name))
9
+ return { reason: `it calls ${name}`, at: call };
10
+ }
11
+ for (const attribute of nodesOfKind(source, SyntaxKind.JsxAttribute, isJsxAttribute)) {
12
+ const name = attribute.name.getText(source);
13
+ if (HANDLER.test(name))
14
+ return { reason: `it handles ${name}`, at: attribute };
15
+ }
16
+ return null;
17
+ }
18
+ export function writtenDirective(source) {
19
+ for (const statement of source.statements) {
20
+ if (!isExpressionStatement(statement) || !isStringLiteral(statement.expression))
21
+ return null;
22
+ if (statement.expression.text === "use client")
23
+ return statement;
24
+ }
25
+ return null;
26
+ }
@@ -0,0 +1,47 @@
1
+ import { isCallExpression, isIdentifier, isImportDeclaration, isNamedImports, isObjectLiteralExpression, isPropertyAssignment, isStringLiteral, isVariableStatement, SyntaxKind } from "typescript/ast";
2
+ export const EXTERNAL_MODULE = "@reqvire-org/ads/external", EXTERNAL_MARKER = "/* ads-external ", importsExternal = (source) => source.statements.some((statement) => isImportDeclaration(statement) && isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === EXTERNAL_MODULE);
3
+ export function externalDeclarations(source) {
4
+ if (!importsExternal(source))
5
+ return [];
6
+ const macro = new Set;
7
+ for (const statement of source.statements) {
8
+ if (!isImportDeclaration(statement) || !isStringLiteral(statement.moduleSpecifier) || statement.moduleSpecifier.text !== EXTERNAL_MODULE)
9
+ continue;
10
+ const bindings = statement.importClause?.namedBindings;
11
+ if (bindings !== void 0 && isNamedImports(bindings)) {
12
+ for (const element of bindings.elements)
13
+ if ((element.propertyName ?? element.name).text === "external")
14
+ macro.add(element.name.text);
15
+ }
16
+ }
17
+ const found = [];
18
+ for (const statement of source.statements) {
19
+ if (!isVariableStatement(statement) || !statement.modifiers?.some((modifier) => modifier.kind === SyntaxKind.ExportKeyword))
20
+ continue;
21
+ for (const declaration of statement.declarationList.declarations) {
22
+ const call = declaration.initializer;
23
+ if (!isIdentifier(declaration.name) || call === void 0 || !isCallExpression(call) || !isIdentifier(call.expression) || !macro.has(call.expression.text))
24
+ continue;
25
+ const [spec] = call.arguments;
26
+ if (spec === void 0 || !isObjectLiteralExpression(spec))
27
+ continue;
28
+ const field = (key) => {
29
+ const property = spec.properties.find((item) => isPropertyAssignment(item) && isIdentifier(item.name) && item.name.text === key);
30
+ if (property === void 0 || !isPropertyAssignment(property))
31
+ return;
32
+ if (isStringLiteral(property.initializer))
33
+ return property.initializer.text;
34
+ if (property.initializer.kind === SyntaxKind.TrueKeyword)
35
+ return !0;
36
+ if (property.initializer.kind === SyntaxKind.FalseKeyword)
37
+ return !1;
38
+ return;
39
+ }, from = field("from"), renders = field("renders"), name = field("name"), client = field("client");
40
+ if (typeof from !== "string" || typeof renders !== "string")
41
+ continue;
42
+ found.push({ name: declaration.name.text, from, exportName: typeof name === "string" ? name : "default", renders, client: client === !0, at: declaration });
43
+ }
44
+ }
45
+ return found;
46
+ }
47
+ export const externalPackage = (specifier) => specifier.startsWith("@") ? specifier.split("/").slice(0, 2).join("/") : specifier.split("/")[0] ?? specifier;
@@ -15,6 +15,7 @@ import {
15
15
  isStringLiteral
16
16
  } from "typescript/ast";
17
17
  import { isDevelopmentModule } from "../development-modules.mjs";
18
+ import { EXTERNAL_MODULE, externalDeclarations, externalPackage } from "./externals.mjs";
18
19
  import { location, nodesOfKind, optionalSourceText } from "./native-boundary.mjs";
19
20
  import { cssInJsPackage, isStylesheet } from "./styling-ownership.mjs";
20
21
  export function runtimeModules(graph) {
@@ -84,6 +85,8 @@ export async function collectModuleGraph(inputs, programRoots) {
84
85
  return;
85
86
  if (roles.get(file) !== "worker" && text === "@reqvire-org/ads/asset")
86
87
  return;
88
+ if (roles.get(file) === "module" && text === EXTERNAL_MODULE)
89
+ return;
87
90
  return fail(at, { kind: "authoring-import", specifier: text });
88
91
  }
89
92
  if (text === inputs.publicModule)
@@ -150,6 +153,9 @@ export async function collectModuleGraph(inputs, programRoots) {
150
153
  else if (!unrooted.includes(worker))
151
154
  unrooted.push(worker);
152
155
  }
156
+ for (const declared of externalDeclarations(source))
157
+ if (!external.some((item) => item.specifier === declared.from && item.form === "re-export"))
158
+ external.push({ specifier: declared.from, packageName: externalPackage(declared.from), form: "re-export", typeOnly: !1, declarations: null });
153
159
  modules.set(file, { file, role: roles.get(file) ?? "module", external, local });
154
160
  }
155
161
  return unrooted.length > 0 ? { kind: "needs-roots", workers: unrooted } : { kind: "complete", graph: { modules } };
@@ -2,7 +2,7 @@ import path from "node:path";
2
2
  import { SyntaxKind, isExportAssignment, isExportDeclaration, isImportDeclaration } from "typescript/ast";
3
3
  import { digest } from "../digest.mjs";
4
4
  import { memoProgram } from "./context.mjs";
5
- export const OWNER_ANALYSIS_SCHEMA = "ads-owner-analysis/13";
5
+ export const OWNER_ANALYSIS_SCHEMA = "ads-owner-analysis/14";
6
6
  export function canonical(value) {
7
7
  return JSON.stringify(value, (_key, item) => {
8
8
  if (item instanceof Map)
@@ -1,3 +1,4 @@
1
+ import { externalDeclarations } from "./externals.mjs";
1
2
  import {
2
3
  NodeFlags,
3
4
  SyntaxKind,
@@ -882,12 +883,21 @@ export async function choiceValues({ program, source, root, validateSpec, fail }
882
883
  return failure(node, { kind: "choice", problem: { kind: "no-reachable-choice" } });
883
884
  return { tree, leaves, axes: [...selectedAxes.values()], branches };
884
885
  }
885
- const tags = new Map;
886
+ const tags = new Map, externals = [];
886
887
  for (const opening of [...nodesOfKind(source, SyntaxKind.JsxOpeningElement, isJsxOpeningElement), ...nodesOfKind(source, SyntaxKind.JsxSelfClosingElement, isJsxSelfClosingElement)]) {
887
888
  const tagName = opening.tagName;
888
889
  if (!isIdentifier(tagName) || !/^[A-Z]/.test(tagName.text))
889
890
  continue;
890
891
  const declared = (await symbol(tagName))?.valueDeclaration;
892
+ if (declared !== void 0 && isVariableDeclaration(declared)) {
893
+ const external = externalDeclarations(declared.getSourceFile()).find((item) => item.at === declared);
894
+ if (external !== void 0) {
895
+ tags.set(tagName, external.renders);
896
+ if (!externals.includes(external))
897
+ externals.push(external);
898
+ continue;
899
+ }
900
+ }
891
901
  if (!(declared !== void 0 && (isBindingElement(declared) || isParameterDeclaration(declared) || isVariableDeclaration(declared) && declared.initializer !== void 0 && !isArrowFunction(declared.initializer) && !isFunctionExpression(declared.initializer))))
892
902
  continue;
893
903
  const domain = finiteType(await type(tagName)), names = domain?.filter((value) => typeof value === "string" && ELEMENT_NAME.test(value)) ?? [];
@@ -897,7 +907,7 @@ export async function choiceValues({ program, source, root, validateSpec, fail }
897
907
  if (first !== void 0 && (names.length === 1 || names.every((name) => HEADING_LEVEL.test(name))))
898
908
  tags.set(tagName, first);
899
909
  }
900
- return { source, evaluate, choices, truthy, symbol, touched, macroCalls, tag: (opening) => tags.get(opening.tagName) ?? opening.tagName.getText() };
910
+ return { source, evaluate, choices, truthy, symbol, touched, macroCalls, tag: (opening) => tags.get(opening.tagName) ?? opening.tagName.getText(), externals };
901
911
  }
902
912
  function test(axis, value) {
903
913
  switch (axis.test) {
@@ -51,7 +51,7 @@ import { frameInlinePadding, gridKeylineOf, rootFrames } from "../frame-regions.
51
51
  import { attemptAsync } from "../result.mjs";
52
52
  import { location, nodesOfKind } from "./native-boundary.mjs";
53
53
  import { authoredAt, classItems, mapCallback, nameText, presenceDomain, truthiness } from "./owner-choices.mjs";
54
- async function componentTarget(root, opening, symbol) {
54
+ export async function componentTarget(root, opening, symbol) {
55
55
  const declaration = (await symbol(opening.tagName))?.valueDeclaration;
56
56
  if (declaration === void 0)
57
57
  return null;
@@ -418,7 +418,7 @@ export async function compositionFacts(inputs) {
418
418
  return test(!0);
419
419
  const read = await optional(expression(found), context, evaluate);
420
420
  return read.known && test(read.value);
421
- }, hidden = await flag("hidden", (value) => truthy(value) && value !== "until-found"), inactive = await flag("aria-disabled", (value) => value === !0 || value === "true") || DISABLEABLE.has(tag) && await flag("disabled", truthy), named = async (attribute) => {
421
+ }, hidden = await flag("hidden", (value) => truthy(value) && value !== "until-found"), decorative = await flag("aria-hidden", (value) => value === !0 || value === "true"), inactive = await flag("aria-disabled", (value) => value === !0 || value === "true") || DISABLEABLE.has(tag) && await flag("disabled", truthy), named = async (attribute) => {
422
422
  const found = attributeOf(opening, attribute);
423
423
  if (found === void 0)
424
424
  return null;
@@ -457,7 +457,7 @@ export async function compositionFacts(inputs) {
457
457
  else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
458
458
  attributes.set(name, String(value));
459
459
  }
460
- return { opening, classes, exempt: hidden ? "hidden" : inactive ? "inactive" : null, context: subtree, attributes };
460
+ return { opening, classes, exempt: hidden ? "hidden" : inactive ? "inactive" : decorative ? "decorative" : null, context: subtree, attributes };
461
461
  }
462
462
  async function resolveLeaf(pathed, context, evaluate) {
463
463
  const steps = [];
@@ -587,7 +587,7 @@ export async function compositionFacts(inputs) {
587
587
  }
588
588
  text = textOf(own, "&") ?? text;
589
589
  }
590
- return { surfaces, text, scope: surfaces.length === 0 ? null : ownScope, flow, parts, grid, frame, keyline, ...pseudo.length === 0 ? {} : { pseudo } };
590
+ return { surfaces, text, scope: surfaces.length === 0 ? null : ownScope, flow, parts, grid, frame, keyline, ...pseudo.length === 0 ? {} : { pseudo }, ...part?.content.kind === "visual" ? { visual: !0 } : {} };
591
591
  }
592
592
  function chainElements(raws) {
593
593
  const elements = [];
@@ -612,6 +612,7 @@ export async function compositionFacts(inputs) {
612
612
  exempt: raw.exempt,
613
613
  ...role.frame === void 0 ? {} : { frame: role.frame },
614
614
  ...role.pseudo === void 0 ? {} : { pseudo: role.pseudo },
615
+ ...role.visual === void 0 ? {} : { visual: role.visual },
615
616
  ...role.keyline === void 0 ? {} : { keyline: role.keyline }
616
617
  });
617
618
  parent = role;
@@ -659,6 +660,20 @@ export async function compositionFacts(inputs) {
659
660
  continue;
660
661
  pending.push({ node: element, content: await placementContent(opening, componentOf(element)), at: opening, path: pathed, opening });
661
662
  }
663
+ for (const opening of openings) {
664
+ if (!lowercase(opening))
665
+ continue;
666
+ const className = opening.attributes.properties.find((property) => isJsxAttribute(property) && nameText(property.name) === "className");
667
+ if (className === void 0 || !className.getText(source).includes(".parts."))
668
+ continue;
669
+ const hidden = opening.attributes.properties.find((property) => isJsxAttribute(property) && nameText(property.name) === "aria-hidden");
670
+ if (hidden !== void 0 && isJsxAttribute(hidden) && !/false/.test(hidden.initializer?.getText(source) ?? ""))
671
+ continue;
672
+ const self = elementOf(opening), above = pathOf(self), pathed = isJsxSelfClosingElement(opening) ? { steps: [{ kind: "element", opening }, ...above.steps], end: above.end } : pathOf(opening);
673
+ if (insideSvg(pathed))
674
+ continue;
675
+ pending.push({ node: self, content: { kind: "text", certain: !0, graphic: !0 }, at: opening, path: pathed, opening: null });
676
+ }
662
677
  const childOfMarkup = (node) => node.parent !== void 0 && (isJsxElement(node.parent) || isJsxFragment(node.parent));
663
678
  for (const text of nodesOfKind(source, SyntaxKind.JsxText, isJsxText)) {
664
679
  if (!childOfMarkup(text) || text.text.trim() === "")