@canonical/design-system 0.46.0 → 0.47.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.
Files changed (122) hide show
  1. package/data/apps/pattern/data_views.ttl +85 -0
  2. package/data/apps/pattern/datatable.ttl +3 -73
  3. package/data/apps/pattern/page_header.ttl +50 -5
  4. package/data/apps/subcomponent/data_table-action_bar.ttl +2 -2
  5. package/data/apps/subcomponent/data_table-pagination_bar.ttl +2 -2
  6. package/data/apps/subcomponent/data_table-persistent_selection.ttl +1 -1
  7. package/data/apps/subcomponent/data_views-filters.ttl +13 -0
  8. package/data/apps/subcomponent/data_views-saved_views.ttl +13 -0
  9. package/data/apps/subcomponent/data_views-sort_panel.ttl +13 -0
  10. package/data/apps/subcomponent/side_panel-footer.ttl +1 -1
  11. package/data/apps_launchpad/component/modal.ttl +2 -2
  12. package/data/{apps_workplaceengineering → apps_workplace}/component/complex_multi_select.ttl +3 -3
  13. package/data/{apps_workplaceengineering → apps_workplace}/component/label-highlight.ttl +4 -4
  14. package/data/{apps_workplaceengineering → apps_workplace}/component/org_chart.ttl +2 -2
  15. package/data/{apps_workplaceengineering → apps_workplace}/component/rule.ttl +2 -2
  16. package/data/{apps_workplaceengineering → apps_workplace}/component/skip_link.ttl +2 -2
  17. package/data/{apps_workplaceengineering → apps_workplace}/component/theme_switcher.ttl +2 -2
  18. package/data/{apps_workplaceengineering → apps_workplace}/pattern/callout_numbers_card.ttl +2 -2
  19. package/data/{apps_workplaceengineering → apps_workplace}/pattern/confirmation_modal.ttl +2 -2
  20. package/data/{apps_workplaceengineering → apps_workplace}/pattern/org_event_card.ttl +2 -2
  21. package/data/{apps_workplaceengineering → apps_workplace}/subcomponent/multi_select_input.ttl +2 -2
  22. package/data/{apps_workplaceengineering.ttl → apps_workplace.ttl} +2 -2
  23. package/data/concept/Accessibility.ttl +9 -0
  24. package/data/concept/Breakpoints.ttl +9 -0
  25. package/data/concept/Design-tokens-Overview.ttl +10 -0
  26. package/data/concept/Filtering-patterns.ttl +0 -1
  27. package/data/concept/Foundations-Baseline.ttl +0 -1
  28. package/data/concept/Foundations-Color.ttl +10 -0
  29. package/data/concept/Foundations-Density--the-form-channel.ttl +0 -1
  30. package/data/concept/Foundations-Grid--Layout.ttl +1 -2
  31. package/data/concept/Foundations-Spacing/-Element-vs-container-owned.ttl +0 -1
  32. package/data/concept/Foundations-Spacing.ttl +0 -1
  33. package/data/concept/Foundations-Surfaces.ttl +0 -1
  34. package/data/concept/Foundations-Typography.ttl +1 -2
  35. package/data/concept/How-to-choose-between-question-mark-and-information-icon.ttl +10 -0
  36. package/data/concept/How-to-differentiate-types-of-UI-blocks-.ttl +0 -1
  37. package/data/concept/How-to-indicate-required-fields-in-forms.ttl +0 -1
  38. package/data/concept/How-to-support-modifiers-in-a-component.ttl +0 -1
  39. package/data/concept/Intentional-friction.ttl +0 -1
  40. package/data/concept/Overflow.ttl +0 -1
  41. package/data/concept/Understanding-the-modifier-contract.ttl +0 -1
  42. package/data/documentation/pattern/library_side_navigation.ttl +2 -2
  43. package/data/global/component/accordion.ttl +2 -2
  44. package/data/global/component/announcement.ttl +2 -1
  45. package/data/global/component/avatar.ttl +1 -1
  46. package/data/global/component/badge.ttl +2 -2
  47. package/data/global/component/breadcrumbs.ttl +3 -3
  48. package/data/global/component/button.ttl +3 -3
  49. package/data/global/component/button_link.ttl +1 -1
  50. package/data/global/component/card.ttl +3 -7
  51. package/data/global/component/chip.ttl +1 -0
  52. package/data/global/component/code_snippet.ttl +1 -1
  53. package/data/global/component/drag_and_drop_list.ttl +1 -1
  54. package/data/global/component/dropdown_button.ttl +2 -2
  55. package/data/global/component/file_upload_field.ttl +509 -60
  56. package/data/global/component/icon.ttl +1 -1
  57. package/data/global/component/icon_button.ttl +26 -4
  58. package/data/{apps → global}/component/key_value_pair.ttl +2 -2
  59. package/data/global/{subcomponent/markdown_input.ttl → component/markdown_editor_field.ttl} +3 -3
  60. package/data/global/component/mode_switcher.ttl +1 -1
  61. package/data/global/component/number_field.ttl +1 -1
  62. package/data/global/component/range_field.ttl +0 -80
  63. package/data/global/component/table.ttl +2 -2
  64. package/data/global/component/tile.ttl +1 -1
  65. package/data/global/component/tooltip.ttl +51 -91
  66. package/data/global/component/{data_tooltip.ttl → tooltip_data.ttl} +31 -23
  67. package/data/global/component/tooltip_wrapper.ttl +70 -14
  68. package/data/global/group/cards.ttl +1 -1
  69. package/data/{apps → global}/group/key_value_pairs.ttl +2 -2
  70. package/data/global/modifier/constructive.ttl +1 -1
  71. package/data/global/modifier/elevated.ttl +1 -1
  72. package/data/global/modifier_family/_emphasis.ttl +1 -2
  73. package/data/global/modifier_family/_other.ttl +1 -2
  74. package/data/global/modifier_family/surface.ttl +1 -1
  75. package/data/global/pattern/description_list.ttl +1 -1
  76. package/data/global/pattern/modal.ttl +1 -1
  77. package/data/global/pattern/timeline.ttl +1 -1
  78. package/data/global/pattern/{navigation.ttl → top_navigation.ttl} +2 -2
  79. package/data/global/subcomponent/chart_legend.ttl +1 -1
  80. package/data/global/subcomponent/chart_legend_item.ttl +1 -1
  81. package/data/global/subcomponent/file_upload_input.ttl +503 -50
  82. package/data/global/subcomponent/markdown_editor_input.ttl +13 -0
  83. package/data/global/subcomponent/modal-footer.ttl +1 -1
  84. package/data/global/subcomponent/number_input.ttl +1 -1
  85. package/data/global/subcomponent/range_input.ttl +3 -84
  86. package/data/global/{component/markdown_field.ttl → subcomponent/text_editor_input.ttl} +3 -3
  87. package/data/global/variant/tooltip_dense.ttl +86 -5
  88. package/data/global_dataviews/component/filter_button.ttl +487 -0
  89. package/data/global_dataviews/component/query_bar.ttl +1639 -0
  90. package/data/global_dataviews/component/query_chip.ttl +605 -0
  91. package/data/global_dataviews/group/query_chips.ttl +565 -0
  92. package/data/global_dataviews/modifier/exclusion.ttl +8 -0
  93. package/data/global_dataviews/modifier/inclusion.ttl +8 -0
  94. package/data/global_dataviews/modifier/match.ttl +8 -0
  95. package/data/global_dataviews/modifier/presence.ttl +8 -0
  96. package/data/global_dataviews/modifier/range.ttl +8 -0
  97. package/data/global_dataviews/modifier_family/condition.ttl +9 -0
  98. package/data/global_dataviews/subcomponent/query_chip-entry.ttl +186 -0
  99. package/data/global_dataviews/subcomponent/query_chip-segment.ttl +241 -0
  100. package/data/global_dataviews/subcomponent/query_input.ttl +1287 -0
  101. package/data/global_dataviews.ttl +6 -0
  102. package/data/sites/component/store_card.ttl +1 -1
  103. package/data/tag/{wpeinital-implementation.ttl → workplaceinitial-implementation.ttl} +2 -2
  104. package/data/tag/{wpetriageupstream-and-deprecate.ttl → workplacetriageupstream-and-deprecate.ttl} +2 -2
  105. package/definitions/ontology.ttl +8 -2
  106. package/package.json +6 -6
  107. package/skills/adoption-a1-styles/SKILL.md +11 -0
  108. package/skills/adoption-a2-components/SKILL.md +82 -2
  109. package/skills/anatomy-author/SKILL.md +278 -95
  110. package/skills/anatomy-author/clarification-guidelines.md +150 -0
  111. package/skills/anatomy-author/completeness-checklist.md +224 -0
  112. package/skills/implement-component/SKILL.md +2 -2
  113. package/skills/map-journeys/SKILL.md +395 -0
  114. package/skills/map-journeys/journey-graph.example.html +298 -0
  115. package/skills/model-domains/SKILL.md +502 -0
  116. package/data/concept/Question-mark-vs-information-icon.ttl +0 -11
  117. package/data/global/modifier/editable.ttl +0 -8
  118. package/data/global/modifier/focused.ttl +0 -8
  119. package/data/global/modifier/highlighted.ttl +0 -8
  120. package/data/global/modifier/loading.ttl +0 -8
  121. package/data/global/modifier/muted.ttl +0 -8
  122. package/data/global/modifier/wireframe.ttl +0 -8
@@ -9,10 +9,11 @@ Write component anatomy specifications using the Design System Anatomy DSL. This
9
9
 
10
10
  ## When to Use
11
11
 
12
- - Writing anatomy specifications for new or existing components
13
- - Documenting component structure before implementation
12
+ - Creating anatomy from an existing Figma design before implementation
13
+ - Documenting anatomy from an existing implementation, with or without a Figma design
14
+ - Creating anatomy from scratch without a Figma design or implementation
14
15
  - Discussing component composition with the team ("these nodes should be siblings, not parent-child")
15
- - Auditing a codebase against its specifications
16
+ - Auditing component implementations against their Anatomy DSL specifications
16
17
  - Supporting code generation from specifications
17
18
  - Serving as step 7 of the `specify-component` flow (and of `specify-pattern`)
18
19
 
@@ -31,9 +32,9 @@ This skill helps you author these specifications correctly and consistently.
31
32
 
32
33
  ## Working mode: assistant to a design authority
33
34
 
34
- Most of the time this skill runs in collaboration with a senior designer or engineer —
35
- they are the design authority, you are the assistant whose job is to make them
36
- successful. Default to that mode: lay out where the flow stands, do the legwork
35
+ This skill runs in collaboration with a designer, engineer, or other person responsible for the
36
+ component's design decisions — they are the design authority, you are the assistant whose job
37
+ is to make them successful. Default to that mode: lay out where the flow stands, do the legwork
37
38
  (discovery queries, template drafting, validation) and return digestible findings, and
38
39
  bring structural decisions to the person as a recommendation plus a question rather
39
40
  than a fait accompli. An anatomy encodes opinions the graph cannot settle alone —
@@ -43,7 +44,8 @@ Full autonomy is the exception, not the default: run the whole flow alone only w
43
44
  explicitly asked to. Even then, list every judgment call made unilaterally in the
44
45
  final report so a human can revisit them.
45
46
 
46
- Decision gates — in collaboration, pause at each and resolve it WITH the person:
47
+ Decision gates — in collaboration, pause only for unresolved decisions and resolve them
48
+ WITH the person:
47
49
 
48
50
  1. Node boundaries: what is a named subcomponent vs. an anonymous structural role.
49
51
  2. Slot names — they become API surface.
@@ -87,7 +89,8 @@ form to fill in:
87
89
 
88
90
  A sketch is enough to begin: discovery turns it into the real node set, and the sketch
89
91
  is what you check that set against. Ask again only for what the next step genuinely
90
- blocks on.
92
+ blocks on. If the source is unclear, ask whether a Figma design, an existing
93
+ implementation, both, or neither are available.
91
94
 
92
95
  If the activation message already carries the starting point, do not re-ask — say what
93
96
  you took it to be, and go.
@@ -178,7 +181,7 @@ silently work around.
178
181
 
179
182
  ## Discovery Flow
180
183
 
181
- Before writing an anatomy, understand the component's context:
184
+ Before writing an anatomy, examine the available Figma design, implementation, or existing requirements according to the authoring scenario. Use the following queries to explore the component's context in the Pragma graph:
182
185
 
183
186
  ```bash
184
187
  pragma block list # every component, pattern, layout and subcomponent, with its type and tier
@@ -338,24 +341,28 @@ overwritten by the next sync. An authored anatomy lands in a file of its own, an
338
341
 
339
342
  ### Where the anatomy lands
340
343
 
341
- An anatomy is written by hand, from the component's implementation stylesheet, into
342
- one file in the design-system repository:
344
+ An anatomy is authored from available sources and confirmed structural decisions, then
345
+ written into one file in the design-system repository:
343
346
 
344
347
  anatomies/authored/<tier>/<uri>.yaml
345
348
 
346
349
  The file name IS the dotted uri (`anatomies/authored/global/global.component.button.yaml`),
347
350
  which is how the write finds the row it belongs to, and the text of the file is the
348
- text of the `anatomy_dsl` cell verbatim. Open the file with a comment saying where it
349
- was read from — the package, the stylesheet and the selector — because the next reader
350
- has to be able to check it:
351
+ text of the `anatomy_dsl` cell verbatim. Start the YAML file with the document marker
352
+ (---) followed by the root node:
351
353
 
352
354
  ```yaml
353
355
  ---
354
- # Authored 2026-09-13 from @canonical/react-ds-global src/lib/component/Button/styles.css on .ds.button
355
356
  node:
356
357
  uri: global.component.button
357
358
  ```
358
359
 
360
+ For new components or subcomponents not yet registered in Pragma, author and validate
361
+ their Anatomy DSL files as usual. Before publishing, verify that the corresponding
362
+ component records and writable anatomy fields exist in the documentation source. If
363
+ they do not, report registration as a publishing prerequisite. Do not assume that
364
+ `anatomies write` creates missing component records.
365
+
359
366
  Then, in order:
360
367
 
361
368
  1. **Check it offline.** `bun src/cli.ts anatomies validate --authored` reads every
@@ -383,8 +390,8 @@ whatever the cell said before — today, for most blocks, the retired notation.
383
390
  `color/text/muted` in that output is history, not a house style to copy.
384
391
 
385
392
  There is no derivation step, no `references.yaml` and no register category for a
386
- stylesheet fact: reading an implementation and choosing the node, the key and the
387
- symbol is judgement, which is why it happens in a file under review.
393
+ stylesheet fact: analysing available sources and choosing the node, the key and the
394
+ symbol requires judgement, which is why it happens in a file under review.
388
395
 
389
396
  ## Commenting Guidelines
390
397
 
@@ -400,7 +407,7 @@ symbol is judgement, which is why it happens in a file under review.
400
407
  Include the following comments when applicable:
401
408
 
402
409
  - **Non-obvious decisions:** Explain structural choices, exceptions, agreed assumptions, or limitations when the reason is not clear from the DSL. This includes CSS pseudo-elements and anonymous nodes used for components that do not yet exist.
403
- - **Differences:** Explain any known differences between the documented anatomy and the design or implementation specifications, identifying what differs and why.
410
+ - **Differences:** Explain non-obvious decisions in YAML comments when necessary to understand the anatomy. Report discrepancies among the design, implementation, and Pragma graph separately, outside the YAML.
404
411
 
405
412
  ### Excluded comments
406
413
 
@@ -599,9 +606,10 @@ edges:
599
606
  **Which blocks a `uri:` may reach.** A reference points at a block in the same tier or
600
607
  in `global`, and never the other way: a `global` anatomy that reached into an app
601
608
  tier would make the global block depend on one product. Where the part is real but the
602
- block it would name does not exist, write an anonymous `role:` node and say so in a
603
- comment — the reference is a claim about the graph, and a claim about a block nobody
604
- has created is one an anatomy must not make:
609
+ block it would name does not exist and is not explicitly being introduced as a new named
610
+ block, write an anonymous `role:` node and say so in a comment — a named reference must
611
+ point to an existing block or a new named block explicitly introduced in the
612
+ specification:
605
613
 
606
614
  ```yaml
607
615
  edges:
@@ -864,11 +872,11 @@ Common slot conventions:
864
872
 
865
873
  **Convention:** `slotName: default` implies the main children slot (`children` in React, default slot in Vue).
866
874
 
867
- ### A style value is the symbol consumed
875
+ ### Style values: tokens and literals
868
876
 
869
- A style value is **the name of a token symbol**, written in the symbol's own dotted
870
- spelling — or **an ordered list of symbol names**, which is the fallback order the
871
- implementation reads, ending in the one literal it falls back to last.
877
+ A style value may be **a token symbol** written in its dotted spelling, **a literal
878
+ permitted by the style key**, or **an ordered list of token symbols**, which represents
879
+ a confirmed fallback order and may end with one literal fallback.
872
880
 
873
881
  ```yaml
874
882
  styles:
@@ -892,11 +900,12 @@ Three things that are **retired** and rejected by the parser:
892
900
  | a trailing `?` marker — `shadow/card?` | nothing: a name no stratum declares is not written at all, and a `#` comment on the line records it |
893
901
  | `root` or `$root` inside a value | the dotted name without it — `color.text` |
894
902
 
895
- **Consume the channel where the implementation reads the channel.** A modifier or
896
- surface family reaches a component through a channel variable, and the anatomy says so
897
- by consuming the channel by name: `modifier.color.text` is the channel of `color.text`,
898
- and it is a symbol of its own. Where the implementation reads the semantic token
899
- directly, the anatomy consumes the semantic token. Nothing is inferred either way.
903
+ **When documenting an implementation without a design, consume the channel where the
904
+ implementation reads the channel.** A modifier or surface family reaches a component
905
+ through a channel variable, and the anatomy says so by consuming the channel by name:
906
+ `modifier.color.text` is the channel of `color.text`, and it is a symbol of its own.
907
+ Where the implementation reads the semantic token directly, the anatomy consumes the
908
+ semantic token. Nothing is inferred either way.
900
909
 
901
910
  **This is also how a component's SUPPORT for a modifier family is expressed — and it is
902
911
  the only way.** There is no key that names a family, no `@state` for one, and no
@@ -916,11 +925,12 @@ nowhere. The family is in the channel, not in the tree.
916
925
 
917
926
  Two consequences worth holding on to. A component whose spec claims a family and whose
918
927
  anatomy consumes no channel of the symbols that family covers does not in fact support
919
- it — that mismatch is a finding, and the anatomy is where it shows. And the reverse:
920
- where the stylesheet reads the plain semantic token with no channel in front of it, the
921
- anatomy binds the plain token, and the component is correctly saying it is NOT
922
- family-sensitive at that key. Do not add a channel to express a family the
923
- implementation does not read.
928
+ it — that mismatch is a finding, and the anatomy is where it shows. And the reverse,
929
+ when documenting an implementation without a design: where the stylesheet reads the
930
+ plain semantic token with no channel in front of it, the anatomy binds the plain token,
931
+ and the component is correctly saying it is NOT family-sensitive at that key. When
932
+ design and implementation conflict, follow the design authority's confirmed decision
933
+ and report any resulting discrepancy.
924
934
 
925
935
  **A name no stratum declares is never written. The comment is the record.** An
926
936
  implementation reads plenty of variables that stand for no symbol — a component-local
@@ -944,10 +954,11 @@ resolve. `pragma token lookup <symbol>` settles whether a name resolves before y
944
954
  write it; `pragma variable lookup <name>` settles what a variable in the stylesheet
945
955
  stands for (see Discovery Flow above).
946
956
 
947
- **A list is the implementation's fallback chain, and the first element wins.** The head
948
- is what the slot reads, each later element is what it falls back to, and a chain may
949
- end in the one literal the implementation writes last. A list of one element is written
950
- as the scalar instead, and a primitive anywhere but last is a parse error.
957
+ **When documenting an implementation without a design, a list transcribes its fallback
958
+ chain, and the first element wins.** The head is what the slot reads, each later
959
+ element is what it falls back to, and a chain may end in the one literal the
960
+ implementation writes last. A list of one element is written as the scalar instead, and
961
+ a primitive anywhere but last is a parse error.
951
962
 
952
963
  ### The style keys are a closed roster
953
964
 
@@ -998,8 +1009,10 @@ roles resolves to the same dimension in every product context, and the implement
998
1009
  read `--dimension-*` directly for padding and gaps. So where the stylesheet reads
999
1010
  `--dimension-200`, the anatomy writes `dimension.200` on the spacing key, and the
1000
1011
  second namespace is in the roster for exactly as long as that is true — it comes back
1001
- out once a semantic spacing namespace lands. Write the symbol the implementation reads,
1002
- not the role you would have chosen.
1012
+ out once a semantic spacing namespace lands. When documenting an implementation without
1013
+ a design, write the symbol the implementation reads, not the role you would have
1014
+ chosen. When design and implementation conflict, follow the design authority's
1015
+ confirmed decision.
1003
1016
 
1004
1017
  **Not every CSS property has a key.** `box-shadow`, `animation`, a vendor prefix, a
1005
1018
  mask: no key in the roster takes them, so an anatomy does not bind what the
@@ -1009,8 +1022,11 @@ left unbound. Do not invent a key for a property that has none.
1009
1022
  ### The keys, by family
1010
1023
 
1011
1024
  Every key below is in the roster, and the comment says what it admits. Where a key
1012
- takes `either`, the choice is not taste: bind the symbol where the implementation
1013
- reads a variable, and write the literal where it writes a literal.
1025
+ takes `either`, use a verified token symbol or permitted literal according to the
1026
+ confirmed specification. When documenting an implementation without a design, bind the
1027
+ symbol where the implementation reads a variable and write the literal where it writes
1028
+ a literal. When design and implementation conflict, follow the design authority's
1029
+ confirmed decision.
1014
1030
 
1015
1031
  #### Layout — primitives throughout
1016
1032
  ```yaml
@@ -1393,12 +1409,67 @@ node:
1393
1409
 
1394
1410
  ## Workflow
1395
1411
 
1396
- ### 1. Identify the Component
1397
-
1398
- First, a pre-step: could the name be a Group? Run the group query before the
1399
- lookup — neither `pragma block lookup` nor `pragma block list` covers groups, and
1400
- a name can be BOTH a Group and another tier's block (`BlogCards` is the Group
1401
- `sites.group.blog_cards` AND the Component
1412
+ The workflow adapts to four authoring scenarios:
1413
+
1414
+ - **Create from design:** Use the Figma design and designer-confirmed decisions as the
1415
+ source of truth.
1416
+ - **Document existing implementation:** Use the implementation when no Figma design
1417
+ exists.
1418
+ - **Document design and implementation:** Analyse both sources. When they conflict, ask
1419
+ the design authority to resolve or explicitly defer the discrepancy. Record confirmed
1420
+ decisions, explicit deferrals, and any differences from the implementation.
1421
+ - **Create from scratch:** Establish the anatomy through targeted questions when neither
1422
+ source exists.
1423
+
1424
+ Skip design or implementation analysis when neither source exists, and ask targeted
1425
+ questions only when information is missing, ambiguous, or conflicting.
1426
+
1427
+ ### 1. Establish Component Context
1428
+
1429
+ Analyse the available Figma design, implementation, or existing requirements according
1430
+ to the authoring scenario. Extract the component's visual anatomy, variants, and
1431
+ structural properties. When creating from scratch, establish the necessary information
1432
+ through clarification. Use the Pragma graph to identify existing components and related
1433
+ structures.
1434
+
1435
+ When additional component documentation is available, include it as an optional source
1436
+ of evidence. Extract relevant visual and structural requirements, including documented
1437
+ component relationships. Compare these requirements with Figma, implementation, and
1438
+ Pragma definitions where available. Identify contradictions and resolve them through
1439
+ clarification rather than assuming any source is automatically authoritative.
1440
+
1441
+ When analysing a Figma component set, inspect every variant individually, without
1442
+ exceptions. Examine each variant's structure, hierarchy, constituent parts, visibility,
1443
+ layout, and relevant visual properties. Compare variants to identify all structural and
1444
+ visual differences, including those caused by combinations of variant properties. Do
1445
+ not assume that variants share identical anatomy without verifying each one. Track
1446
+ structural and visual verification separately for each variant. Metadata inspection
1447
+ alone does not establish that all relevant visual properties have been verified. An
1448
+ overview screenshot is sufficient only when every variant is clearly visible at a
1449
+ scale that allows its relevant visual properties to be verified. Otherwise, inspect
1450
+ individual variants or smaller groups at sufficient resolution. Do not report visual
1451
+ verification as complete when relevant details cannot be distinguished in the
1452
+ rendered evidence. Before declaring Stage 1 complete, provide a verification summary
1453
+ that distinguishes structural inspection from rendered visual verification. Record how
1454
+ each variant was verified, which relevant visual properties were checked, and any
1455
+ properties that remain unverified. Programmatic inspection of Figma properties and
1456
+ variable bindings does not substitute for rendered visual verification. If relevant
1457
+ visual details cannot be verified at sufficient resolution, report Stage 1 as
1458
+ incomplete and identify the affected variants and properties. Use batch retrieval where
1459
+ supported, but do not substitute sampling or assumptions for inspecting each variant.
1460
+ Distinguish uninspected variants from supported optional configurations that are not
1461
+ rendered in any variant.
1462
+
1463
+ If technical limitations prevent complete inspection despite reasonable attempts,
1464
+ report Stage 1 as incomplete and identify the affected variants and properties. Proceed
1465
+ to Stage 2 only if the design authority explicitly accepts these limitations. Carry
1466
+ unverified requirements into the audit and Stage 3 for resolution or explicit deferral.
1467
+ Never treat unverified properties as confirmed.
1468
+
1469
+ Before using the block lookup, check whether the name could refer to a Group. Run the
1470
+ group query before the lookup — neither `pragma block lookup` nor `pragma block list`
1471
+ covers groups, and a name can be BOTH a Group and another tier's block (`BlogCards` is
1472
+ the Group `sites.group.blog_cards` AND the Component
1402
1473
  `sites_webcomponentsprototype.component.blog_cards`; the lookup answers with the
1403
1474
  component and never mentions the group):
1404
1475
 
@@ -1407,23 +1478,23 @@ pragma graph query "SELECT ?b ?name WHERE { ?b a ds:Group ; ds:name ?name }"
1407
1478
  ```
1408
1479
 
1409
1480
  If the name is in the answer and the Group is the block you were asked to write,
1410
- it is an existing block: take the URI from that query row (no §3 derivation),
1481
+ it is an existing block: take the URI from that query row (no URI derivation),
1411
1482
  gather its context with `pragma graph inspect <IRI>`, and continue from §2.
1412
1483
 
1413
1484
  Otherwise, determine if the component exists in the design system:
1414
1485
 
1415
1486
  ```bash
1416
- pragma block lookup Card
1487
+ pragma block lookup <ComponentName>
1417
1488
  ```
1418
1489
 
1419
1490
  Two branches:
1420
1491
 
1421
- - **Not found** (`ENTITY_NOT_FOUND`) — this is a NEW block: derive its URI in §3
1422
- below, then continue from §2.
1492
+ - **Not found** (`ENTITY_NOT_FOUND`) — this is a NEW block: continue to §2, then derive
1493
+ its URI in Determine Tier and Type under Stage 4.
1423
1494
  - **Found** — this is a draft for an existing block (the empty-anatomy worklist path):
1424
- take the URI from the block's `pragma block list` row and skip §3. The list carries a
1425
- row per block it covers, not per tier declaring the name, and the lookup above
1426
- resolved it globally — the name query
1495
+ take the URI from the block's `pragma block list` row and skip URI derivation. The
1496
+ list carries a row per block it covers, not per tier declaring the name, and the
1497
+ lookup above resolved it globally — the name query
1427
1498
  `pragma graph query "SELECT ?b WHERE { ?b ds:name ?n . FILTER(LCASE(?n) = LCASE('<Name>')) }"`
1428
1499
  lists every tier's IRI, so you take the one you meant.
1429
1500
  Gather the full context — anatomy, modifiers, properties come with the lookup (a
@@ -1434,36 +1505,108 @@ Two branches:
1434
1505
  pragma graph inspect ds:global.component.card
1435
1506
  ```
1436
1507
 
1437
- ### 2. Gather Structural Requirements
1438
1508
 
1439
- Ask:
1509
+ ### 2. Audit Completeness
1510
+
1511
+ Read `completeness-checklist.md` and assess all relevant visual and structural
1512
+ requirements against available sources and confirmed decisions. Identify missing,
1513
+ ambiguous, or conflicting information, including requirements not represented in Figma
1514
+ or supported by the current DSL.
1515
+
1516
+ ### 3. Gather Structural Requirements
1517
+
1518
+ Use `clarification-guidelines.md` to resolve missing, ambiguous, or conflicting
1519
+ requirements identified during the completeness audit. Ask only questions that cannot
1520
+ be answered from available sources or confirmed decisions.
1521
+
1522
+ Before declaring Stage 3 complete, reconcile every outstanding requirement using the
1523
+ exit criteria in `clarification-guidelines.md`. Do not treat unasked questions or
1524
+ unsupported assumptions as resolved decisions.
1525
+
1526
+ Before proceeding to Stage 4, produce the consolidated visual and structural
1527
+ requirements specification described in `clarification-guidelines.md`. Preserve the
1528
+ conditions and exceptions associated with each requirement, along with source
1529
+ discrepancies, confirmed decisions, and explicit deferrals. Do not simplify or omit
1530
+ requirements because the current DSL cannot express them.
1531
+
1532
+ Examples of structural clarification questions include:
1440
1533
  - What are the main parts? (header, body, footer, icon, label)
1441
1534
  - Which parts are required vs optional?
1442
1535
  - Can any parts repeat?
1443
1536
  - Are there anonymous structural wrappers needed?
1444
1537
 
1445
- Two sources answer these, and they disagree more often than you would expect: the
1446
- block's `ds:hasProperty` rows in the graph, and the implementation you are authoring
1447
- from. The graph records what was DOCUMENTED; the implementation ships what was BUILT,
1448
- and the two run ahead of each other in both directions. Chip is the live case — the
1449
- graph lists `icon` and `badge` as properties that the current `ChipProps` does not
1450
- have, and marks `value` as required where the code renders it conditionally.
1451
-
1452
- **An anatomy transcribes the implementation, so where they disagree the implementation
1453
- wins — and the disagreement is recorded, not smoothed over.** Write the tree the
1454
- stylesheet and the component file support, put a `#` comment on the node (or in the
1455
- file header) saying which graph row it departs from and why, and raise the mismatch:
1456
- a property in the graph that the code cannot reach is a documentation gap, and a part
1457
- in the code that the graph does not list is a specification gap. Neither is fixed by
1458
- inventing a node for a property nothing renders, or by marking a node required because
1459
- a row said `optional: "false"`.
1460
-
1461
- The one exception is a block you were asked to author from its SPEC rather than from an
1462
- implementation — a component not built yet. There the graph is all there is, and the
1463
- anatomy follows it; say so in the file header, because the next reader cannot tell the
1464
- two situations apart from the file alone.
1465
-
1466
- ### 3. Determine Tier and Type
1538
+ These questions are examples, not an exhaustive list. Clarification also covers
1539
+ unresolved visual and structural requirements identified during the completeness audit,
1540
+ including sizing, layout, overflow, truncation, responsive and RTL presentation, and
1541
+ state-dependent appearance, even when the node tree remains unchanged.
1542
+
1543
+ Available sources may disagree: the block's `ds:hasProperty` rows in the graph, a Figma
1544
+ design, and an existing implementation you are authoring from. The graph records what
1545
+ was DOCUMENTED; the implementation ships what was BUILT, and the two run ahead of each
1546
+ other in both directions. Chip is the live case — the graph lists `icon` and `badge` as
1547
+ properties that the current `ChipProps` does not have, and marks `value` as required
1548
+ where the code renders it conditionally.
1549
+
1550
+ When sources disagree, distinguish the observed discrepancy from its cause. Identify
1551
+ which source requires correction only when supported by evidence or an explicit
1552
+ decision from the design authority. Do not assume that a source is incorrect merely
1553
+ because it differs from another source.
1554
+
1555
+ **When both design and implementation exist, do not automatically prefer either source
1556
+ when they conflict.** Ask the design authority to resolve or explicitly defer each
1557
+ discrepancy before generating the Anatomy DSL. Record the confirmed decision and report
1558
+ any resulting differences from the implementation outside the YAML.
1559
+
1560
+ **When only an implementation exists,** document the structure supported by the
1561
+ component file and stylesheet. Treat the Pragma graph as supporting context and report
1562
+ discrepancies between the graph and implementation outside the YAML. Do not invent
1563
+ nodes for properties that nothing renders or mark nodes as required solely because the
1564
+ graph lists them as required.
1565
+
1566
+ When no implementation exists, use the available Figma design, additional component
1567
+ documentation, and designer-confirmed decisions to establish the intended anatomy. If
1568
+ only documentation or requirements are available, use them as evidence and ask targeted
1569
+ questions about missing, ambiguous, or conflicting requirements. If no sources exist,
1570
+ establish the anatomy through clarification with the design authority. Use the Pragma
1571
+ graph as supporting context, not as a substitute for confirmed design decisions.
1572
+
1573
+ When the design authority explicitly corrects a Figma value, property mapping, or
1574
+ variant specification, use the confirmed correction when authoring the DSL. Record the
1575
+ original Figma value, the corrected value, and the affected configurations. Report the
1576
+ discrepancy outside the YAML. Do not silently treat the Figma source as corrected or
1577
+ extend the correction to other configurations without evidence.
1578
+
1579
+ ### 4. Generate Anatomy DSL
1580
+
1581
+ When a confirmed visual or structural requirement cannot be expressed by the current
1582
+ DSL, report it separately in the response, outside the YAML. Follow the existing
1583
+ Commenting Guidelines for all YAML comments. Do not invent unsupported syntax or
1584
+ silently omit requirements.
1585
+
1586
+ For each confirmed variant, responsive change, conditional structure, or state-dependent
1587
+ appearance, determine whether it changes the structure or styles. Use `cardinality` for
1588
+ optional or repeating parts, `switch` for structural alternatives, and `@state` for
1589
+ supported state-specific styles.
1590
+
1591
+ When applying state-dependent styles to nested nodes, verify which element owns the
1592
+ state and which elements must visually change. Do not assume that a state on the parent
1593
+ automatically applies to its children, or that a state on a child represents the
1594
+ parent's state. Check whether the DSL can express the required relationship. If not,
1595
+ report the limitation rather than encoding a misleading state binding.
1596
+
1597
+ #### Determine Tier and Type
1598
+
1599
+ When documentation describes a main component and its subcomponents:
1600
+
1601
+ 1. Identify the component hierarchy and distinguish named subcomponents from anonymous
1602
+ structural nodes.
1603
+ 2. Check which components and subcomponents already exist in the Pragma graph.
1604
+ 3. Confirm missing or ambiguous component identities and relationships with the design
1605
+ authority.
1606
+ 4. Generate a separate Anatomy DSL file for each named component or subcomponent within
1607
+ the agreed scope, referencing named children from their parent anatomy.
1608
+ 5. Do not automatically turn every Figma frame or documented part into a separate
1609
+ subcomponent.
1467
1610
 
1468
1611
  The URI is `{tier}.{type}.{snake_name}` (see URI Encoding Convention above). The tier
1469
1612
  segment comes from the live tier set — run `pragma tier list` and pick from what it
@@ -1479,14 +1622,22 @@ UIBlock classes:
1479
1622
  | Does it divide space? | Yes | `{tier}.layout.{name}` |
1480
1623
  | Is it many instances of ONE sibling block laid out together? | Yes | `{tier}.group.{name}` |
1481
1624
 
1482
- ### 4. Define Edges
1625
+ #### Define Edges
1483
1626
 
1484
1627
  For each child:
1485
1628
  1. Is it named (in DS) or anonymous (structural wrapper)?
1486
1629
  2. What is its cardinality?
1487
1630
  3. Does it map to a slot?
1488
1631
 
1489
- ### 5. Apply Styles
1632
+ #### Apply Styles
1633
+
1634
+ When only an implementation exists, derive style values from its stylesheet using the
1635
+ rules above. When both design and implementation exist, compare their styles and ask the
1636
+ design authority to resolve any discrepancies before selecting values. When no
1637
+ implementation exists, use available Figma designs, additional component documentation,
1638
+ and designer-confirmed requirements. Resolve any conflicting evidence through Stage 3
1639
+ clarification. Verify token symbols against the Pragma graph, and do not invent CSS
1640
+ variables or fallback chains.
1490
1641
 
1491
1642
  For each node, consider:
1492
1643
  - **Layout**: How is content arranged?
@@ -1496,11 +1647,24 @@ For each node, consider:
1496
1647
  - **Typography**: Text styling (for text-containing nodes)
1497
1648
  - **Interaction**: Cursor, transitions (for interactive nodes)
1498
1649
 
1650
+ For constrained layouts, verify that the combined styles of parent and child nodes
1651
+ preserve the confirmed resizing behaviour. Check minimum and maximum dimensions, flex
1652
+ growth and shrinkage, text overflow, and parts that must retain their size. Do not
1653
+ assume that specifying text truncation alone establishes the required resizing
1654
+ behaviour. Represent supported constraints in the DSL and report unsupported
1655
+ requirements separately.
1656
+
1657
+ Verify dimensional consistency between parent and child nodes. Check that child
1658
+ dimensions, padding, borders, and gaps fit within the intended container dimensions,
1659
+ accounting for the applicable box-sizing model. Identify unintended overflow or
1660
+ conflicting constraints. Resolve discrepancies using available evidence or
1661
+ clarification rather than silently adjusting values.
1662
+
1499
1663
  **Rule of thumb**:
1500
1664
  - Structural values (`flex`, `center`, `100%`) = invariant
1501
1665
  - A symbol (spacing.inset.surface.block) = themeable
1502
1666
 
1503
- ### 6. Bind Data and Pin Props
1667
+ #### Bind Data and Pin Props
1504
1668
 
1505
1669
  Both are optional, and both are decision gates — bring them to the person
1506
1670
  rather than deciding alone.
@@ -1514,11 +1678,12 @@ and multiplicity. Generic containers project nothing — that is a real answer.
1514
1678
 
1515
1679
  **Pins** — for each named child, ask what the spec FIXES versus what it leaves
1516
1680
  to the consumer. An intrinsic icon is pinned (`props: { icon: … }`); a
1517
- consumer-filled icon slot is not. Confirm each prop name against
1518
- `pragma block lookup <Component>`; a pin naming a prop the component does not
1519
- have is invisible to schema validation and will only fail later.
1681
+ consumer-filled icon slot is not. For existing components, confirm each prop name
1682
+ against `pragma block lookup <Component>`; for new components, confirm planned prop
1683
+ names with the design authority; a pin naming a prop the component does not have is
1684
+ invisible to schema validation and will only fail later.
1520
1685
 
1521
- ### 7. Validate
1686
+ ### 5. Validate
1522
1687
 
1523
1688
  Two checks, and they cover different ground. Know which is which before you read an
1524
1689
  exit code as approval.
@@ -1530,31 +1695,37 @@ RESOLVES in a stratum, and that each symbol sits inside the namespace its key ad
1530
1695
  That is a great deal, and it is all mechanical.
1531
1696
 
1532
1697
  **What the gate does not check is whether the anatomy is TRUE of the component.** It
1533
- cannot: it never reads the stylesheet. So every one of these passes the gate silently —
1698
+ cannot: it does not compare the DSL with the available design, implementation, or
1699
+ confirmed decisions. So every one of these passes the gate silently —
1534
1700
  a lawful key that is the wrong key for the CSS property (`layout.align` where the
1535
1701
  stylesheet wrote `align-self`), a resolving symbol in the right namespace that is the
1536
1702
  wrong symbol for the part, a node boundary drawn in the wrong place, a cardinality that
1537
1703
  contradicts the component's own props, a missing node for a part the stylesheet draws.
1538
1704
  Exit 0 with no findings means the file is LAWFUL. It does not mean the judgment calls
1539
1705
  were right, and it is not a second opinion on them. The check that catches those is the
1540
- pull-request review by someone who can open the same stylesheet — which is why the file
1541
- goes through review at all.
1706
+ pull-request review against available sources and confirmed decisions — which is why the
1707
+ file goes through review at all.
1542
1708
 
1543
1709
  So read the list below as the author's own pass, and keep its items honest about which
1544
1710
  kind they are: the ones the gate will confirm, and the ones only a reader can.
1545
1711
 
1712
+ Apply implementation-specific checks only when an implementation exists. Otherwise,
1713
+ assess visual and structural correctness against the available Figma design or confirmed
1714
+ requirements.
1715
+
1546
1716
  Check your anatomy against:
1717
+ - [ ] Verify the generated DSL against the consolidated Stage 3 specification, including all applicable conditions and exceptions. Report missing, partially represented, or unsupported requirements separately. Do not treat valid syntax or YAML comments as proof of completeness.
1547
1718
  - [ ] Root node is named (has `uri`)
1548
1719
  - [ ] All cardinalities are valid notation
1549
1720
  - [ ] Every style key is in the roster — the gate confirms this one
1550
- - [ ] Each key is the key for the CSS property the stylesheet actually wrote (judgment: `layout.align` for `align-items`, `layout.alignSelf` for `align-self`; the gate accepts either)
1721
+ - [ ] Each style key represents the confirmed intended property. When documenting an implementation without a design, check it against the stylesheet (`layout.align` for `align-items`, `layout.alignSelf` for `align-self`). When design and implementation conflict, validate against the design authority's confirmed decision rather than automatically following the stylesheet.
1551
1722
  - [ ] Every style value is one dotted symbol, a fallback chain with at most one primitive LAST, or a primitive — no slash path, no `?` marker, no `root`/`$root` segment
1552
1723
  - [ ] Every symbol resolves (`pragma token lookup <symbol>`) and sits in its key's namespace; a name that does not resolve is a `#` comment, never a value — the gate confirms both
1553
1724
  - [ ] Every component-local variable that came back `ENTITY_NOT_FOUND` was followed through the component's own `:root` to a declared variable or a literal before it was written off
1554
1725
  - [ ] `layout.type` and `layout.direction` are spelled as CSS spells them (`flex`, `grid`, `inline-flex`, `block`; `row`, `column`)
1555
1726
  - [ ] Anonymous nodes have `role`, not `uri`
1556
1727
  - [ ] Multi-word names encode word boundaries with `_`; `-` appears only where the name carries a dot (per the URI Encoding Convention table)
1557
- - [ ] Every non-root `uri:` either resolves (`pragma graph inspect ds:<uri>`) or is `$custom`, a template placeholder, or a new block or child this same spec introduces (§3)
1728
+ - [ ] Every non-root `uri:` either resolves (`pragma graph inspect ds:<uri>`) or is `$custom`, a template placeholder, or a new block or child this same spec introduces (see Determine Tier and Type)
1558
1729
  - [ ] Named (`uri:`) children carry no copy of their own subtree — contextual style overrides only
1559
1730
  - [ ] Nested components make semantic sense (judgment — nothing checks this but a reader)
1560
1731
  - [ ] Every symbol is the right symbol for the part, not merely one that resolves in the key's namespace (judgment — the gate checks resolution and namespace, never fit)
@@ -1564,7 +1735,7 @@ Check your anatomy against:
1564
1735
  - [ ] Every node `projection` has at least one of `on` / `field`; every relation `projection` has `field` and no `on`
1565
1736
  - [ ] No projection spells an unwrapping path (`edges.node`), and every projected field name exists in the provider SDL
1566
1737
  - [ ] Each projected relation's cardinality matches the field's nullability and multiplicity
1567
- - [ ] `props` appears only on named nodes, holds scalars only, and every pinned prop name exists on that component (`pragma block lookup`)
1738
+ - [ ] `props` appears only on named nodes, holds scalars only, and every pinned prop name matches the existing component's properties (`pragma block lookup`) or the confirmed properties of a new component
1568
1739
  - [ ] A part the stylesheet draws as `::before`/`::after` is an anonymous `role:` node with a comment saying so, and no `slotName`
1569
1740
  - [ ] Every `uri:` names a block in this tier or in `global`, and a `global` anatomy reaches into no app tier
1570
1741
 
@@ -1601,16 +1772,27 @@ When creating an anatomy, respond with:
1601
1772
  {yaml content}
1602
1773
  \`\`\`
1603
1774
 
1775
+ ### Validation
1776
+
1777
+ - DSL validation: {command, exit code, findings, and warnings}
1778
+ - Specification coverage: {confirmed coverage and any missing, partially represented,
1779
+ or unverified requirements}
1780
+
1604
1781
  ### Notes
1605
1782
  - {Design decision 1}
1606
1783
  - {Design decision 2}
1784
+ - {Explicitly deferred requirements and their impact on DSL completeness, if any}
1785
+ - {Unsupported DSL requirements and why they cannot be represented, if any}
1786
+ - {Discrepancies among the design, implementation, and Pragma graph, if any}
1607
1787
 
1608
1788
  ### Next Steps
1609
1789
  1. Land the file at `anatomies/authored/{tier}/{uri}.yaml` in the design-system
1610
1790
  repository — never under `data/`, which the pull sync regenerates
1611
1791
  2. `bun src/cli.ts anatomies validate --authored` — exit 0, and no findings
1612
1792
  3. Review it as a file, in a pull request
1613
- 4. `anatomies write` — dry, then a `--only <uri> --apply` canary, then `--apply`;
1793
+ 4. For new components or subcomponents, confirm that their records and anatomy
1794
+ fields exist in the documentation source before publishing.
1795
+ 5. `anatomies write` — dry, then a `--only <uri> --apply` canary, then `--apply`;
1614
1796
  after that the document is the source of record
1615
1797
  ```
1616
1798
 
@@ -1627,7 +1809,8 @@ When creating an anatomy, respond with:
1627
1809
 
1628
1810
  ## Limitations
1629
1811
 
1630
- - Does not handle conditional rendering (show/hide based on state)
1812
+ - Does not support arbitrary conditional rendering (show/hide based on state);
1813
+ `cardinality` defines optional parts and `switch` defines structural alternatives
1631
1814
  - Does not represent portal content (elements rendered elsewhere in DOM)
1632
1815
  - Style inheritance is not yet supported (e.g., "inherits from Card")
1633
1816
  - No runtime behavior specification (only static structure)