@starci/eslint-grammar-core 0.21.38 → 0.23.1

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 (69) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/lib/app-shell-create.js +2 -2
  3. package/package.json +4 -2
  4. package/runtime/bundle.json +2 -68
  5. package/runtime/engine/by-code-unit.mjs +0 -12
  6. package/runtime/engine/config.mjs +0 -461
  7. package/runtime/engine/invalid-config.mjs +0 -15
  8. package/runtime/engine/model-config.mjs +0 -112
  9. package/runtime/engine/orca-config.mjs +0 -34
  10. package/runtime/engine/plain-object.mjs +0 -5
  11. package/runtime/engine/release-config.mjs +0 -32
  12. package/runtime/engine/removed-vocabulary.mjs +0 -27
  13. package/runtime/engine/resources-config.mjs +0 -59
  14. package/runtime/engine/runtime-root.mjs +0 -138
  15. package/runtime/engine/secrets.mjs +0 -202
  16. package/runtime/engine/sonar-config.mjs +0 -24
  17. package/runtime/engine/yaml.mjs +0 -161
  18. package/runtime/knowledge/grammars/core/playbook.yaml +0 -1198
  19. package/runtime/knowledge/grammars/index.yaml +0 -114
  20. package/runtime/knowledge/hfs/canon-pins.yaml +0 -716
  21. package/runtime/knowledge/hfs/rules.yaml +0 -6760
  22. package/runtime/knowledge/hfs/slots.yaml +0 -2783
  23. package/runtime/knowledge/ui/presentation/font.yaml +0 -101
  24. package/runtime/knowledge/ui/presentation/padding.yaml +0 -217
  25. package/runtime/modules/kernel/removed-vocabulary.yaml +0 -458
  26. package/runtime/modules/models/registry.yaml +0 -221
  27. package/runtime/modules/models/runtimes.yaml +0 -556
  28. package/runtime/modules/models/tiers.yaml +0 -66
  29. package/runtime/scripts/hfs/allows.mjs +0 -77
  30. package/runtime/scripts/hfs/architecture/component-tiers.mjs +0 -161
  31. package/runtime/scripts/hfs/architecture/config.mjs +0 -407
  32. package/runtime/scripts/hfs/architecture/root-packages.mjs +0 -78
  33. package/runtime/scripts/hfs/architecture/side-boundary.mjs +0 -13
  34. package/runtime/scripts/hfs/architecture/type-context.mjs +0 -335
  35. package/runtime/scripts/hfs/architecture/typescript.mjs +0 -477
  36. package/runtime/scripts/hfs/declaration-shape.mjs +0 -196
  37. package/runtime/scripts/hfs/declaration-slots.mjs +0 -89
  38. package/runtime/scripts/hfs/edition-slots.mjs +0 -80
  39. package/runtime/scripts/hfs/manifest-shape.mjs +0 -474
  40. package/runtime/scripts/hfs/param-names.mjs +0 -13
  41. package/runtime/scripts/hfs/rule-catalog.mjs +0 -458
  42. package/runtime/scripts/hfs/rule-params-shape.mjs +0 -103
  43. package/runtime/scripts/hfs/slot-app-view.mjs +0 -97
  44. package/runtime/scripts/hfs/slot-classify.mjs +0 -69
  45. package/runtime/scripts/hfs/slot-errors.mjs +0 -12
  46. package/runtime/scripts/hfs/slot-imports.mjs +0 -98
  47. package/runtime/scripts/hfs/slot-manifest-shape.mjs +0 -111
  48. package/runtime/scripts/hfs/slot-match.mjs +0 -164
  49. package/runtime/scripts/hfs/slot-path.mjs +0 -6
  50. package/runtime/scripts/hfs/slot-required.mjs +0 -95
  51. package/runtime/scripts/hfs/slot-semantic-problems.mjs +0 -175
  52. package/runtime/scripts/hfs/slot-side-problems.mjs +0 -32
  53. package/runtime/scripts/hfs/slots.mjs +0 -306
  54. package/runtime/scripts/hfs/typescript-programs.mjs +0 -95
  55. package/runtime/scripts/hfs/view.mjs +0 -180
  56. package/runtime/scripts/lib/glob.mjs +0 -32
  57. package/runtime/scripts/lib/grammar-lint.mjs +0 -57
  58. package/runtime/scripts/lib/i18n.mjs +0 -82
  59. package/runtime/scripts/lib/json-clone.mjs +0 -70
  60. package/runtime/scripts/lib/json.mjs +0 -44
  61. package/runtime/scripts/lib/list.mjs +0 -26
  62. package/runtime/scripts/lib/path-key.mjs +0 -124
  63. package/runtime/scripts/lib/read-text.mjs +0 -47
  64. package/runtime/scripts/lib/regex.mjs +0 -3
  65. package/runtime/scripts/lib/source-phrases.mjs +0 -34
  66. package/runtime/scripts/lib/ts-analysis.mjs +0 -39
  67. package/runtime/scripts/lib/ts-ast.mjs +0 -63
  68. package/runtime/scripts/lib/walk.mjs +0 -45
  69. package/runtime/scripts/lib/yaml-cached.mjs +0 -14
@@ -1,1198 +0,0 @@
1
- schema: starci/knowledge-source@1
2
- id: grammar.core.playbook
3
- title: StarCi Core — playbook
4
- purpose: |
5
- Which idioms a business shape asks for, and what a supplied reference is allowed to contribute to
6
- that answer. The idioms themselves are in idioms.yaml; what the package publishes is in DNA.yaml.
7
- A shape not listed here is not a house idiom. It may still be composed for the approved product
8
- direction when existing Common semantics, family anatomy and product facts can express it; only
9
- promotion into the family's reusable idiom set belongs to the family owner.
10
- Shapes marked `since: "0.5.0"` compose the forms, overlay and navigation renderers Common added in
11
- 0.5.0. They name renderers directly (`composition`) rather than idioms, because no product source
12
- has yet shown them twice; `guidance` holds the rules every Core app built on them follows.
13
- appliesTo:
14
- - grammar
15
- family: core
16
- provenance:
17
- publicEntry: "@starci/grammar/common"
18
- package: "@starci/grammar"
19
- version: "0.5.0"
20
- captured: "2026-09-23"
21
- limitations: |
22
- Use this playbook only when this family is selected in the current .starciwork specification.
23
- Examples below are historical references; verify actually installed exports (prefer
24
- @starci/grammar/common as the current public entry where supported), renderers and CSS before
25
- promising a capability. Reading steps below are reasoning within one op, not an auto-running op
26
- chain. Do not invent Grammar component APIs absent from DNA/installed source.
27
- shapes:
28
- - id: purchase-decision-page
29
- title: Purchase decision page — one offer, one price, one commitment (subscriptions)
30
- referenceMayContribute: |
31
- Keep: the order of regions (what is read before the price), which single decision dominates, and
32
- what folds away instead of competing with it. Never crosses over: page layout, brand, palette,
33
- type scale, component anatomy, or any control the reference draws that this Grammar does not
34
- publish.
35
- idiomSequence:
36
- - idiom: joined-bands-flush-card
37
- role: Explanatory column in primary of PrimaryRailLayout
38
- - idiom: neutral-summary-band
39
- role: A neutral band opens the card with its summary for its intro line
40
- - idiom: generated-art-band
41
- role: Generated art is a band, not a card for the journey asset
42
- - idiom: title-supporting-line
43
- role: Title and one supporting line for each included outcome
44
- - idiom: one-highlighted-card
45
- role: One highlighted card on the decision itself
46
- - idiom: bottom-action-band
47
- role: The card's one action closes the bottom band for the purchase
48
- - idiom: pending-same-tree
49
- role: Pending is the same tree, resting across the offer read
50
- notes: |
51
- Secondary explanation folds away; whether it folds into a disclosure is a
52
- DIRECTION_CHOICE_REQUIRED (seen once). Decision card sits in rail.
53
-
54
- - id: learner-dashboard
55
- title: Learner dashboard — many peer sections, one intended next step
56
- referenceMayContribute: |
57
- Keep: which sections exist and their reading order, and which single section is the reader's
58
- next action. Never crosses over: grid geometry, card chrome, densities, or a section that would
59
- need a renderer this family does not publish.
60
- idiomSequence:
61
- - idiom: joined-bands-flush-card
62
- role: Per section
63
- - idiom: neutral-summary-band
64
- role: Where the section states a measure
65
- - idiom: title-supporting-line
66
- role: Inside every row
67
- - idiom: bottom-action-band
68
- role: Where a section leads somewhere
69
- - idiom: pending-same-tree
70
- role: For every read, one slot per api through guidance state-recipes
71
- - idiom: one-highlighted-card
72
- role: Across the page exactly once, on the resume or next-step section
73
-
74
- - id: sign-in
75
- title: Sign-in — one surface, several journeys, one submit per step
76
- referenceMayContribute: |
77
- Keep: the order of the ways in (shortcut before form, or the reverse), which journeys share one
78
- surface, and where the way to the other journey sits. Never crosses over: provider branding,
79
- illustration, field chrome, or a social-login row this product does not have a provider for.
80
- idiomSequence:
81
- - idiom: title-supporting-line
82
- role: Surface header (Heading + muted subtitle)
83
- - idiom: single-column-form-stack
84
- role: Per step, one Button variant="primary" type="submit" each
85
- - idiom: pending-same-tree
86
- role: Through isPending and isDisabled rather than a replaced tree
87
- notes: |
88
- The way onward as TextAction, last. Whether the provider shortcut precedes the form is seen
89
- once; carry the reference's order and say so.
90
-
91
- - id: account-settings-form
92
- title: Settings or profile form — named groups, one submit, server errors in place
93
- since: "0.5.0"
94
- referenceMayContribute: |
95
- Keep: which groups exist, their order, and which fields are required. Never crosses over: field
96
- chrome, validation copy style, or a control the package does not publish.
97
- composition:
98
- - renderer: Form
99
- role: |
100
- The boundary: `label` (form landmark), `onSubmit(FormData)`, `validationErrors` keyed by field
101
- `name` for server-side refusals, `isPending` while the submit is in flight
102
- - renderer: Fieldset
103
- role: One per named group (`legend`, optional `description`, cross-field `errorMessage`)
104
- - renderer: "Select / ComboBox / Textarea / NumberField / SearchField / DateField / DatePicker"
105
- role: |
106
- Each control carries its own `label`, `description`, `errorMessage`, `isRequired`, `name` —
107
- the shared Field contract; a placeholder is never the name
108
- - renderer: "Checkbox / CheckboxGroup / RadioGroup / Switch / SegmentedControl / Slider"
109
- role: |
110
- Choices; a Switch is an immediate setting, a Checkbox a value submitted with the form
111
- - renderer: Field
112
- role: |
113
- Only for a control Grammar does not publish (a third-party widget, OtpInput, a native input):
114
- its render prop hands over the id and `aria-describedby`/`aria-invalid` so the control is
115
- announced like a Grammar one
116
- - renderer: Button
117
- role: One `variant="primary" type="submit"` after the last group; `isPending` mirrors the Form's
118
- notes: |
119
- The base `Input` still speaks `hint`/`isError`; the 0.5.0 controls speak
120
- `description`/`errorMessage`/`isInvalid`. Do not mix the two vocabularies in one form without
121
- checking that the Form's `validationErrors` reaches the control. In Core, fields are white fills
122
- with a transparent border (see family.yaml `fields-on-a-surface`): on a top-level SurfaceCard
123
- verify the rendered field edge.
124
-
125
- - id: destructive-confirmation
126
- title: Destructive confirmation — one irreversible decision
127
- since: "0.5.0"
128
- composition:
129
- - renderer: AlertDialog
130
- role: |
131
- `tone="negative"` (the default), `title` naming the consequence, `confirmLabel` and
132
- `cancelLabel` in the product's words; `onConfirm` may return a promise, which keeps the confirm
133
- pending and the dialog open until it settles
134
- - renderer: Button
135
- role: |
136
- The trigger, inside the Core root: `intent="destructive"` at the entry step, which resolves to
137
- `danger-soft` (CTA-6); the confirm inside the AlertDialog is the solid `danger` confirm, dismiss
138
- comes first and takes initial focus
139
- notes: |
140
- Initial focus lands on the cancel action and an outside press never dismisses. A reversible
141
- action is not a confirmation: act, then offer undo through a Toast `action`.
142
-
143
- - id: secondary-task-sheet
144
- title: Secondary task beside the page — filters, details, an edit
145
- since: "0.5.0"
146
- composition:
147
- - renderer: Drawer
148
- role: |
149
- `placement="right"` at wide widths; `placement="bottom"` (grab handle shown by default) when
150
- the task is thumb-driven on a phone. `footer` may take a render function receiving `close`
151
- - renderer: Dialog
152
- role: When the task must block the page and is short (`size` sm/md/lg/full)
153
- notes: |
154
- Both portal into the Core root and restore focus to their trigger. One overlay at a time; a
155
- Popover or DropdownMenu opened from inside a Drawer stays inside the same root.
156
-
157
- - id: app-shell-mobile-first
158
- title: App shell — WorkspaceShell, navbar and sidebar drawer
159
- since: "0.5.0"
160
- ownership: FE-RULE-OWNERSHIP
161
- knowledge: knowledge/ui/composition/app-shell.yaml
162
- composition:
163
- - renderer: CoreGrammarRoot
164
- role: The single root around everything below
165
- - renderer: WorkspaceShell
166
- role: |
167
- `viewport="fixed"` realizes FE-APP-SHELL-1: exactly 100dvh, a sticky navbar, optional sidebar,
168
- and independently scrolling navigation and primary content. The document never scrolls.
169
- Under viewport="fixed", navigation resolves navigationVisibility to wide and provides
170
- navigationDrawer or a compactHeader containing a left Drawer with Sidebar presentation="drawer".
171
- Both opener paths default visibility to wide; an explicit visibility also resolves to wide.
172
- Under viewport="fixed",
173
- navigationTrack defaults to intrinsic so a collapsed sidebar leaves no empty track.
174
- - renderer: Sidebar
175
- role: |
176
- Desktop navigation uses the expanded or collapsed rail; the left mobile Drawer composes
177
- `presentation="drawer"`. Its label, destinations and selectedKey come from the application.
178
- - renderer: Toaster
179
- role: Once, last child of the root
180
- recipes:
181
- - id: navbar-controls
182
- implements: [FE-APP-SHELL-2]
183
- compose: |
184
- Every bar control uses `size="control"`, the 2.5rem (40px) shared height. Icon uses the family
185
- size-5 token (20px) throughout the region. SearchField or its trigger shows Ctrl K and opens
186
- on Ctrl/Cmd+K; inside a surface its variant resolves through the nesting context. A compact
187
- language switch in a bar is SegmentedControl size="control" (the HeroUI lg group held to
188
- 2.75rem); md and lg keep HeroUI's own sizes.
189
- - id: site-chrome-bar
190
- implements: [FE-APP-SHELL-3]
191
- compose: |
192
- A public site composes its bar inside the flow shell, in one module (the scaffold SiteShell):
193
- WorkspaceShell viewport="flow" header={TopBar brand navigation actions}. navigation is a
194
- NavLandmark layout="bar" of TextAction links; actions is the language SegmentedControl
195
- size="control", then the sign-in Button intent="neutral" and the call-to-action Button, all
196
- size="control". The app right cluster (menu, theme Switch, bell, account) is for the app shell only.
197
- - id: workspace-identity
198
- implements: [FE-APP-SHELL-2]
199
- compose: |
200
- IdentityLockup is itself the pressable (size="control"). Its square logo mark has a
201
- transparent background, no radius and object-fit contain; without an image it uses Avatar's
202
- bundled DiceBear initials. The title
203
- has a muted role subtitle and no caret. The lockup has no button shape or hover effect;
204
- press uses scale(0.96), focus remains visible and reduced motion removes the zoom.
205
- - id: navbar-right-cluster
206
- implements: [FE-APP-SHELL-3]
207
- compose: |
208
- In order: a round tertiary IconButton with the Heroicons Language glyph opening a
209
- single-select DropdownMenu, Switch size="control" with sun/moon size-5 thumb icons and
210
- isLabelHidden, a bell IconButton with count badge opening Popover, then a circle-only
211
- AvatarButton size="control" opening the account DropdownMenu. AvatarButton uses uploaded src
212
- first and otherwise the bundled DiceBear initials style: the first and last words of name
213
- supply the letters, and userId passed as seed determines colour, falling back to name when
214
- seed is absent (owner:avatar-default-dicebear-initials). DropdownMenu preserves HeroUI's
215
- anatomy and default selection indicator. The supported language labels use the "Vietnamese"
216
- and "English" entries in modules/i18n/messages/app-shell.yaml; each language keeps its autonym.
217
- - id: account-menu
218
- implements: [FE-APP-SHELL-3]
219
- compose: |
220
- A workspace section shows identity marks and single selection. An account section shows an
221
- icon, account name and description email · role. The sign-out item and every destructive item
222
- use `tone="danger"`; the family prop realizes the universal danger semantics. Sections
223
- receive automatic separators. Localized sign-out copy comes from
224
- modules/i18n/messages/app-shell.yaml.
225
- - id: mobile-navigation
226
- implements: [FE-APP-SHELL-4]
227
- compose: |
228
- Below md the navbar holds identity, search trigger, bell and avatar; language and theme move
229
- into the drawer. The compactHeader band directly below it is also 4rem, with an edge-to-edge
230
- separator and one vertically centred round tertiary IconButton carrying the Heroicons
231
- ellipsis at size-5. It opens Drawer placement="left" containing Sidebar
232
- presentation="drawer" with every group plus language and theme. The drawer closes on item,
233
- backdrop or Escape, traps focus and scrolls independently. The opener band hides at desktop.
234
- Inline navigation is hidden below md with navigationVisibility="wide"; navigationDrawer or
235
- the compactHeader containing the left Drawer and its drawer Sidebar supplies the opener.
236
- The shell has neither tabs in the opener band nor a BottomNav.
237
- - id: create-actions
238
- implements: [FE-APP-SHELL-5]
239
- compose: |
240
- The create action stays on its page. The static matcher reads appShell.product from
241
- modules/goal/source-phrases.yaml; the navbar never receives that page command.
242
- - id: sidebar-rail
243
- implements: [FE-APP-SHELL-6]
244
- compose: |
245
- Sidebar fills the height below the navbar, uses the surface background in both themes and
246
- scrolls independently. Groups use translated headings such as Main, Operations and Settings
247
- from modules/i18n/messages/app-shell.yaml. The expanded item has a size-5 icon, label and
248
- Grammar current-page treatment. A keyboard-accessible toggle collapses it into icon-only
249
- destinations with size-5 icons in 2.5rem targets, current-page highlighting, count badges
250
- and hover/focus tooltips. Group order is stable, spacing replaces group headings and
251
- settings-type groups stay at the end. The application persists collapse state per user.
252
- - id: conversation-panel
253
- implements: [FE-APP-SHELL-7]
254
- compose: |
255
- The panel has its title, a nested SearchField and a filter Tabs row, then one list sorted by
256
- latest message. The approved reference categories are All, Groups, Customers and Unread
257
- when those categories exist in the product; labels come from modules/i18n/messages/ui.yaml
258
- and modules/i18n/messages/app-shell.yaml. ListBox panel alignment keeps rows and section
259
- captions on the same content edge without padding wrappers. A row shows avatar, name,
260
- trailing time, last message and unread badge; the open row is selected through HeroUI.
261
- The name and preview each occupy one line with an ellipsis, and the title carries no group
262
- glyph (owner:item-description-one-line). Pass emphasis="unread" for unread rows so Grammar
263
- strengthens the label and preview; read rows keep the vendor label and muted preview.
264
- Group identity uses AvatarGroup layout="grid" with the member/count arrangement declared
265
- by presentation.groupIdentity.
266
- notes: |
267
- FE-RULE-OWNERSHIP in knowledge/patterns/fe/index.yaml separates universal app-shell semantics
268
- from these family APIs, values, shapes and effects. @starci/eslint-grammar-core owns their
269
- code checks. Inspect installed Grammar exports and the running shell when proving the recipe.
270
-
271
- readingSteps:
272
- - id: business-shape-first
273
- order: 1
274
- title: Business shape first
275
- instruction: |
276
- Name the shape and the one outcome the surface exists to produce. The shape selects the idiom
277
- sequence; nothing else does.
278
- - id: then-reference
279
- order: 2
280
- title: Then the reference, if the request supplied one
281
- instruction: |
282
- A reference contributes region order, which decision dominates, and what folds away. It never
283
- contributes layout, brand, palette, or component anatomy — those are already owned, by this
284
- family and by knowledge/ui. A reference that can only be honoured by breaking an idiom is
285
- evidence about the reference, not about StarCi.
286
- - id: then-idioms
287
- order: 3
288
- title: Then the idioms
289
- instruction: |
290
- Composed in the order the shape's row gives, each one taken whole: an idiom is a relationship,
291
- and half of it is a different shape.
292
- - id: compare-dna
293
- order: 4
294
- title: Compare DNA with actually installed source
295
- instruction: |
296
- Confirm named renderers/props against DNA.yaml and installed exports (public entry
297
- @starci/grammar/common where supported), and read the gaps in family.yaml before promising a
298
- capability. A composition that needs a recorded gap is not a direction yet.
299
- - id: resolve-product-composition
300
- order: 5
301
- title: Then resolve the remaining product composition
302
- instruction: |
303
- Reuse an established idiom where it fits; otherwise compose existing Common semantics and family
304
- anatomy, extend an existing owner when evidence shows its declared gap, and add a new owner only
305
- for an evidenced gap. A shape absent from this table and a shape seen once are evidence limits
306
- on house style, not reasons to stop creative work already inside the approved product scope.
307
-
308
- authoritySplit:
309
- directionChoiceRequired: |
310
- DIRECTION_CHOICE_REQUIRED is reserved for a material product choice whose acceptable options lead
311
- to different outcomes and whose answer is absent from the request. A reference/idiom conflict is
312
- resolved by the authority split: product facts and approved region order come from the request,
313
- Common semantics come from knowledge/ui, and family anatomy and reusable style come from the
314
- selected Grammar source. State assumptions for minor in-scope choices; when a material choice has
315
- no answer, ask the user. Do not invent a fallback algorithm or run the next op.
316
- imageryClarification:
317
- date: "2026-09-05"
318
- guidance: |
319
- Imagery can highlight the key idea, explain content, strengthen recognition or create a relevant,
320
- evocative focal point. Deliberate visual emphasis is a concrete role; an image need not be a
321
- functional diagram to earn its place. Name the subject, the idea or claim it highlights, and the
322
- intended order of attention in the selected .starciwork design node. Judge its scale, contrast and
323
- crop on the rendered surface: it should support that hierarchy without obscuring the content or
324
- competing with the primary action. Blank space alone is never a reason to add an image; filling
325
- space or balancing density without a content or emphasis role does not qualify. Record no image
326
- when imagery would not improve the composition.
327
- limitation: |
328
- Extending or adding an owner is not authorized by this playbook; it needs an op with explicit
329
- library-edit scope. Historical image notes are design references, not decisions for the current
330
- product.
331
- guidance:
332
- - id: owner-ui-rulings-alpha-31
333
- ownership: FE-RULE-OWNERSHIP
334
- implements: [COLLECTION-1, LAYOUT-1, SURFACE-1, ACTION-3, CTA-6]
335
- requirement: |
336
- The canonical cases own the rule bodies; this entry only points to them. COLLECTION-1 case-9
337
- (owner:selection-fill-no-check): navigation-like single selection uses ListBox
338
- selectionIndicator="none", with the selectedKeys and accessibility contract unchanged.
339
- LAYOUT-1 case-10 (owner:joined-multi-pane): the selected family realizes one touching pane
340
- surface with vertical Dividers. SURFACE-1 case-4 (owner:scroll-region-background-tone):
341
- VerticalScrollRegion tone="background" under messages and log entries, with the header and
342
- composer on the surface. ACTION-3 case-5 (owner:hover-actions-floating-toolbar): MessageBubble's
343
- public floating toolbar owns the IconButtons and tooltips beside the text; apps do not target
344
- starci-core internals. CTA-6 case-4 (owner:button-variant-follows-intent): ordinary repeated
345
- item commands are neutral and render ghost.
346
- - id: nested-controls-and-panel-lists
347
- ownership: FE-RULE-OWNERSHIP
348
- implements: [ANATOMY-2, PADDING-0]
349
- requirement: |
350
- SurfaceCard (always painted, of any kind, the accordion kind when painted), Sidebar, Dialog,
351
- AlertDialog, Drawer and Popover establish the surface nesting context; Rail and
352
- an unpainted accordion SurfaceCard pass their parent's context through. Input, SearchField, Textarea,
353
- NumberField, DateField, TimeField, Select, ComboBox, DatePicker, DateRangePicker, Checkbox,
354
- CheckboxGroup, RadioGroup, OtpInput and PressableField resolve variant="secondary" inside it and
355
- variant="primary" outside. Compose the surface and omit the field variant.
356
- Switch and Slider have no layer variant; a Radio follows its RadioGroup. PaneGrid's
357
- collapsed-pane drawer also establishes the context. SurfaceCard and a bounded accordion SurfaceCard derive
358
- data-grammar-surface-depth from the parent context. The top layer is raised and a nested layer is
359
- subordinate; never raise both. The family DNA owns their surface paint.
360
- The field `variant` is not in the prop types, so an app cannot set it; FE_GRAMMAR_LAYOUT_ONLY rejects
361
- application paint utilities, arbitrary paint properties and inline style paint.
362
- DRAW_NESTED_VARIANT checks the corresponding rendered variant and
363
- surface stamps.
364
- ListBox resolves inset="panel" inside that context; callers may select the same value explicitly
365
- elsewhere. Its rows and sections captions share the panel edge. The list kind of SurfaceCard owns its list
366
- shell with no added inset; SurfaceCard composition="joined" owns flush bands. A grouping wrapper
367
- adds no padding. An extra px-*, ps-* or pe-* around ListBox or a section caption stacks the inset
368
- and fails FE_LIST_PANEL_PADDING.
369
- rationale: |
370
- ANATOMY-2 owns nested separation and PADDING-0 owns the single content edge. Their props and
371
- variant values belong here under FE-RULE-OWNERSHIP in knowledge/patterns/fe/index.yaml; R318
372
- executes the composition checks in the universal @starci/eslint-canon-fe because they hold for
373
- every family that publishes the shared surface and field API.
374
- - id: overlays-inside-the-root
375
- requirement: |
376
- Every overlay trigger (Dialog, AlertDialog, Drawer, Popover, DropdownMenu, and the Select,
377
- ComboBox and DatePicker fields) must render inside `CoreGrammarRoot`. They portal into the nearest
378
- `.grammar-common-root`; a trigger in a separate React tree or outside the root opens its overlay
379
- in `<body>`, where no Core token, theme or forced-colours rule applies.
380
- rationale: |
381
- Core's DNA is scoped to `[data-grammar-family="core"]`; an overlay is only Core while it is a DOM
382
- descendant of that scope.
383
- - id: one-toaster-placed-clear-of-chrome
384
- requirement: |
385
- Mount exactly one `Toaster` (with `label` and `dismissLabel`) inside the root and add toasts with
386
- `toastQueue.add({ title, description, tone, action })`. Keep the default `bottom-end` on a page
387
- with no fixed bottom chrome; choose a placement clear of any page-owned fixed content. A toast
388
- with an `action`, or `tone` negative/pending, persists until dismissed.
389
- rationale: |
390
- A second Toaster duplicates announcements; fixed content must not cover an action.
391
- - id: forms-share-the-field-contract
392
- requirement: |
393
- Compose forms from the Field-contract controls inside `Form` (and `Fieldset` for named groups);
394
- reach for `Field` only to give a non-Grammar control the same label/description/error anatomy.
395
- Server refusals go in `Form validationErrors` by field `name`, not in a separate banner.
396
- rationale: |
397
- One contract means one error location a screen reader can find, and one set of
398
- `data-grammar-field-*` hooks every family paints.
399
- - id: mobile-chrome-by-width
400
- requirement: |
401
- Follow FE-APP-SHELL-4 in knowledge/ui/composition/app-shell.yaml for mobile navbar content,
402
- the subnav trigger row and the Sidebar drawer.
403
- rationale: |
404
- The shell canon owns responsive navigation composition.
405
- - id: state-recipes
406
- title: stateRecipes — the one recipe for per-slot data status
407
- requirement: |
408
- A data status — loading, unauthorized, forbidden, error, empty — belongs to one slot, the data of one api, and
409
- renders only through the product's one `SlotView` composite with the recipes below. A data status
410
- is never drawn and never a shape: a surface's `XState` lists drawn shapes only
411
- (`starci-fe/no-data-status-shape`), and a Block's `component.tsx` never branches on `isLoading`,
412
- `isError` or `isForbidden` itself (`starci-grammar/slot-status-through-slotview`). Only a Block owns
413
- slots; a page, layout or overlay has no data status. A block with several apis carries one slot
414
- per api and each resolves its status independently. The block keeps its SurfaceCard and label in
415
- every status; the recipe replaces only that slot's region. Every product built on this family
416
- applies it.
417
- rationale: |
418
- One recipe per status keeps every block's loading, 403, failure and empty identical, and keeps
419
- the owner's approved drawings free of states nobody drew.
420
- reference:
421
- example: examples/shape-slot
422
- files:
423
- - apps/shape-slot/src/components/composites/SlotView/index.tsx # SlotView: the recipe, in status order
424
- - apps/shape-slot/src/modules/slot/index.ts # Slot, toSlot (403 is its own status), SlotLabels
425
- - apps/shape-slot/src/hooks/slot/useSlotLabels.ts # shared forbidden/error/retry copy + the slot's empty sentence
426
- codeExample: examples/index.yaml#connected-block
427
- consolidates:
428
- - idioms.yaml pending-same-tree
429
- - knowledge/ui/composition/state.yaml STATE-2, STATE-3
430
- - knowledge/ui/composition/feedback.yaml FEEDBACK-1, FEEDBACK-2
431
- - DNA.yaml Skeleton, EmptyNotice, Alert
432
- order: [loading, unauthorized, forbidden, error, empty, ready]
433
- recipes:
434
- - status: loading
435
- uiRules: [STATE-2]
436
- render: |
437
- The ready tree, drawn from placeholder data of the slot's type, in the shape the unit's
438
- `xDefaultState` names, with isLoading on every owner: same card, same bands, same row count
439
- (idiom pending-same-tree). Never a spinner and never a different tree. The skeleton renders
440
- inert geometry and states no value; an unknown number is a bar, never a rendered zero.
441
- skeletonMap:
442
- - part: Text line or Heading
443
- render: "`isLoading` on the owner: one bar at that type-scale step's line height, as long as the placeholder text"
444
- - part: Media (Image, MediaFrame viewport)
445
- render: "`Skeleton shape=\"rect\"` at the frame's `ratio` (square, landscape, wide); `shape=\"circle\"` for an avatar. A block at the ratio, never a collapsed box"
446
- - part: Button
447
- render: |
448
- A bar at the Button's height with the Button's pill corner (family.yaml button-pill):
449
- `isLoading` where the installed Button publishes it, otherwise `Skeleton shape="rect"` in
450
- the Button's box. It never fires (idiom pending-same-tree action-must-not-fire)
451
- - part: A region that exists only on ready data (a disclosure of the loaded lines)
452
- render: Absent while isLoading (STATE-3)
453
- - status: unauthorized
454
- uiRules: [STATE-3]
455
- render: |
456
- 401 is its own status, never forbidden and never an error. The slot shows one sign-in prompt in
457
- place: `EmptyNotice message={labels.unauthorized} actionLabel={labels.signIn}
458
- onAction={signIn}`, where `signIn` opens the product's sign-in route and
459
- returns to this address. The prompt discloses none of the slot's data. A secondary slot hides, as
460
- forbidden does, so a page whose reads all need a session shows the prompt once, in its primary slot.
461
- - status: forbidden
462
- uiRules: [STATE-3]
463
- render: |
464
- 403 is its own status, never an error (`toSlot`). The slot's role decides: a secondary slot
465
- uses `hide` — it unmounts with its wrapper and leaves nothing focusable; a primary slot uses
466
- `notice` — `EmptyNotice message={labels.forbidden}` in place. A primary slot is never hidden
467
- and a secondary slot never shows a notice.
468
- - status: error
469
- uiRules: [FEEDBACK-2]
470
- render: |
471
- Retry at the slot, re-running that slot's read only (the query's `mutate`), never a page
472
- reload. Block form, where the slot is a region: `EmptyNotice message={labels.error}
473
- actionLabel={labels.retry} onAction={retry}` with `isActionPending`
474
- bound while the retry runs. Inline form, where the slot is one line inside a row or band too
475
- small for a notice: `Alert tone="negative"` in the slot's place, carrying the retry action. A
476
- command that is unsafe to repeat is not retried (FEEDBACK-2 case-4); a rejected field value
477
- is a field error (FEEDBACK-1), never a slot status.
478
- - status: empty
479
- uiRules: [FEEDBACK-2, STATE-3]
480
- render: |
481
- `EmptyNotice message={labels.empty}` with the slot's own empty sentence; `actionLabel` and
482
- `onAction` only when a real next step exists, otherwise both are omitted.
483
- - status: ready
484
- render: The slot's items through the same tree, isLoading false.
485
- notFound: |
486
- A route whose resource does not exist calls `notFound()` in its route adapter (FE-FUNCTION-7
487
- case-2). 404 is never a page state, a shape or a slot status.
488
- copy: |
489
- unauthorized, signIn, forbidden, error and retry come from the shared `slot` message namespace; each slot adds its own
490
- empty sentence. The connected half resolves them into `SlotLabels`; no status string is written
491
- in a component.
492
-
493
- presentation:
494
- collectionItems:
495
- ownership: FE-RULE-OWNERSHIP
496
- requirement: |
497
- ListBoxItem, DropdownMenuItem, SidebarItem and the ListOption shared by Select and ComboBox
498
- render descriptions in HeroUI's Description slot. The family DNA's collectionItem.descriptionLines
499
- defaults to one line with an ellipsis (owner:item-description-one-line); descriptionLines accepts
500
- 1, 2 or 3 for a bounded override through the packaged stylesheet's line clamp. The complete
501
- description remains available to assistive technology. ListBoxItem emphasis="unread" uses
502
- collectionItem.unreadWeight for both label and description; omit it for HeroUI's read treatment.
503
- labelLeading remains an optional decorative title slot, separate from conversation identity.
504
- glyphs:
505
- ownership: FE-RULE-OWNERSHIP
506
- implements: FE-ICON
507
- source: knowledge/hfs/fe-stack.yaml
508
- requirement: |
509
- The glyph sources and cuts declared by the stack catalog are realized through the Icon leaf.
510
- StarCi's Grammar lint checks that concrete boundary and its measured icon scale. Verify the
511
- selected region's value against the family DNA and styles rather than inventing an app value.
512
- A menu item's brand mark is passed as DropdownMenuItem.mark with iconSource omitted; the public
513
- type makes them mutually exclusive and Grammar sizes the mark in the icon's leading slot.
514
- groupIdentity:
515
- ownership: FE-RULE-OWNERSHIP
516
- implements: COLLECTION-3
517
- requirement: |
518
- Compose AvatarGroup layout="grid" at one Avatar size, including size="control". Two members
519
- split the round mark; three show one member above two below; four occupy a 2 by 2 grid. Every cell
520
- has a ring in the surface colour. At five or more members the first three remain visible and the
521
- fourth cell shows the total member count, such as 5 or 30, through Avatar's shared fallback path.
522
- The row layout keeps its +N count. overflowLabel receives the hidden-member count in both layouts
523
- for accessible naming, while the grid digits show the total. A single person uses Avatar.
524
- Pass an uploaded image as `src`; otherwise Grammar always draws the bundled DiceBear `initials`
525
- style, with the first letter of the first word and the first letter of the last word of `name`
526
- (one word supplies one letter). `seed`, the user or entity id, determines colour when present;
527
- otherwise `name` does. The image clips to the Avatar shape, circle by default, and keeps text
528
- contrast in both themes (owner:avatar-default-dicebear-initials).
529
- Avatar, AvatarButton and each AvatarGroup member accept `kind="person" | "agent"`, default person.
530
- An agent's name is free text and uses exactly the same initials rule, without role-suffix parsing.
531
- `kind="agent"` adds a HeroUI Badge at the Avatar's bottom-right edge with a bot glyph, a surface-colour
532
- ring and an accessible name containing AI (owner:agent-avatar-initials-bot-badge). The family hides
533
- the badge below 32px, including the 16px to 24px cells in a 2 by 2 grid; the identity's accessible
534
- name still includes AI. Apps neither declare nor import `@dicebear/*`. Apps supply member identity
535
- data; the renderer owns the geometry.
536
- padding:
537
- ownership: FE-RULE-OWNERSHIP
538
- knowledge: knowledge/ui/presentation/padding.yaml
539
- ownerVocabulary:
540
- owners:
541
- - name: App
542
- meaning: The boundary belongs to the application
543
- applicationWrites: The class
544
- - name: A component name
545
- meaning: Common already applies the inset inside that component
546
- applicationWrites: Nothing. Compose it
547
- - name: —
548
- meaning: Common exposes no public path for this boundary
549
- applicationWrites: The class, recorded as a workaround
550
- notes: |-
551
- Each case names who owns the inset. The owner decides whether the application writes a class at all.
552
-
553
- Writing a class where a component is the owner is `APP_REIMPLEMENTATION`. Reaching into a Grammar
554
- component with a selector or a passed class to change its inset is `APP_OVERRIDE`.
555
- scale:
556
- steps:
557
- - id: PADDING-0
558
- class: p-0
559
- value: "0"
560
- - id: PADDING-1
561
- class: p-1
562
- value: .25rem
563
- - id: PADDING-2
564
- class: p-2
565
- value: .5rem
566
- - id: PADDING-3
567
- class: p-3
568
- value: .75rem
569
- - id: PADDING-4
570
- class: p-4
571
- value: 1rem
572
- - id: PADDING-5
573
- class: p-6
574
- value: 1.5rem
575
- - id: PADDING-6
576
- class: p-8
577
- value: 2rem
578
- notes: |-
579
- `COMMON_SPACING_SCALE` is closed. The rule ID is the ordinal position on that scale. It is not the
580
- Tailwind step number, and the two diverge from PADDING-5 onward.
581
-
582
- Common publishes no padding token. The internal insets below are reached through the components that
583
- own them, not through a variable the application may set.
584
- The page inset is the one exception and is not on this scale: `--grammar-page-inset` resolves to
585
- `clamp(1rem, 3vw, 2rem)`, a responsive value owned by `PageContainer`. An application never
586
- reproduces it with a fixed class.
587
- The rem values resolve to `0 / 4 / 8 / 12 / 16 / 24 / 32` CSS pixels only at a computed root of
588
- `16px`. Runtime checks use `expectedPx = remFactor * observedRootFontPx`.
589
- componentOwnership:
590
- title: Padding Common already owns
591
- notes: |-
592
- Retained ownership reference, not proof of the current package/API. Verify actual installed source/props/tokens before use; correct outdated rows within selected maintenance scope using [source and maintenance](index.yaml#source-and-maintenance).
593
- A part that carries one rule per side or per property names that CSS property after the part (`item padding-inline`); one part and property has one rule.
594
- rows:
595
- - component: PaneGrid
596
- element: drawer body, collapsing pane
597
- rule: PADDING-0
598
- - component: PaneGrid
599
- element: trigger bar padding-block, collapsing pane
600
- rule: PADDING-2
601
- - component: PaneGrid
602
- element: trigger bar padding-inline, collapsing pane
603
- rule: PADDING-4
604
- - component: PaneGrid
605
- element: drawer trigger, collapsing pane
606
- rule: PADDING-3
607
- - component: EmptyNotice
608
- element: root
609
- rule: PADDING-4
610
- - component: HorizontalScrollRegion
611
- element: root
612
- rule: PADDING-1
613
- - component: OtpInput
614
- element: root
615
- rule: PADDING-1
616
- - component: PressableField
617
- element: root
618
- rule: PADDING-3
619
- - component: PressableField
620
- element: shortcut, shortcut!=undefined
621
- rule: PADDING-1
622
- - component: Rail
623
- element: body padding-inline, inset="content"
624
- rule: PADDING-3
625
- - component: Rail
626
- element: body padding-block, inset="content"
627
- rule: PADDING-5
628
- - component: Sidebar
629
- element: footer padding-inline padding-block-end, not collapsed, footer!=undefined
630
- rule: PADDING-3
631
- - component: Sidebar
632
- element: footer padding-block-start, not collapsed, footer!=undefined
633
- rule: PADDING-0
634
- - component: Sidebar
635
- element: header, not collapsed, header!=undefined
636
- rule: PADDING-3
637
- - component: Sidebar
638
- element: list, collapsed
639
- rule: PADDING-2
640
- - component: Sidebar
641
- element: list, not collapsed
642
- rule: PADDING-3
643
- - component: Sidebar
644
- element: section label padding-block-end, group.label!=undefined, not collapsed
645
- rule: PADDING-1
646
- - component: Sidebar
647
- element: section label padding-inline, group.label!=undefined, not collapsed
648
- rule: PADDING-2
649
- - component: Sidebar
650
- element: section label padding-block-start, group.label!=undefined, not collapsed
651
- rule: PADDING-3
652
- - component: Sidebar
653
- element: toggle, canToggle
654
- rule: PADDING-2
655
- - component: StaticStateRow
656
- element: root
657
- rule: PADDING-4
658
- - component: ListRow
659
- element: root (carries starci-core-static-row, @starci/grammar 0.9.1)
660
- rule: PADDING-4
661
- - component: Subnav
662
- element: root
663
- rule: PADDING-3
664
- - component: SurfaceCard (accordion kind)
665
- element: accordion panel
666
- rule: PADDING-0
667
- - component: SurfaceCard (accordion kind)
668
- element: accordion trigger
669
- rule: PADDING-4
670
- - component: SurfaceCard (accordion kind)
671
- element: body padding-top
672
- rule: PADDING-0
673
- - component: SurfaceCard (accordion kind)
674
- element: body padding-bottom
675
- rule: PADDING-3
676
- - component: SurfaceCard (accordion kind)
677
- element: body padding-right
678
- rule: PADDING-4
679
- - component: SurfaceCard (accordion kind)
680
- element: body padding-left
681
- rule: PADDING-5
682
- - component: SurfaceCard
683
- element: content, composition!="joined"
684
- rule: PADDING-4
685
- - component: SurfaceCard
686
- element: content, composition="joined"
687
- rule: PADDING-0
688
- - component: SurfaceCard (list kind)
689
- element: root
690
- rule: PADDING-0
691
- - component: Tabs
692
- element: hero tabs tab
693
- rule: PADDING-3
694
- - component: Tabs
695
- element: root, inset="page"
696
- rule: PADDING-5
697
- - component: TextAction
698
- element: root padding-inline, appearance="choice"
699
- rule: PADDING-2
700
- - component: TextAction
701
- element: root padding-inline, appearance="route"
702
- rule: PADDING-3
703
- - component: TextAction
704
- element: root padding-inline, appearance="section"
705
- rule: PADDING-3
706
- - component: TextAction
707
- element: root padding-block, appearance="tab"
708
- rule: PADDING-3
709
- - component: Tooltip
710
- element: content padding-block
711
- rule: PADDING-1
712
- - component: Tooltip
713
- element: content padding-inline
714
- rule: PADDING-2
715
- guidance:
716
- - id: side-contact
717
- title: Side contact
718
- requirement: |-
719
- A boundary does not always take one value on all four sides. When a surface is flush and its child
720
- bands own their own inset, each side takes its value from what that side touches.
721
- | What the side touches | Value | Rule |
722
- | --- | --- | --- |
723
- | The outer edge of the surface | `1rem` | PADDING-4 |
724
- | A separator between bands | `.75rem` | PADDING-3 |
725
- | Nothing, because a child owns the edge | `0` | PADDING-0 |
726
- A separator already draws the boundary, so the side meeting it needs less clearance than a bare outer
727
- edge. Inline sides of a band always meet the outer edge, so they stay at `1rem`.
728
- For a stack of bands this resolves to `px-4` throughout, `pt-4` on the first band, `pb-4` on the last,
729
- and `.75rem` on every side that meets a separator. A band between two separators is `px-4 py-3`.
730
- Common owns the flush surface itself through `composition="joined"`, which sets the content inset to
731
- `0`. It exposes no path for the band insets, so those remain an application workaround.
732
- - id: composite-insets
733
- title: Composite insets
734
- requirement: |-
735
- `PADDING-0` through `PADDING-6` are the scale: one rule, one value. From `PADDING-7` onward the rules
736
- are named recipes whose sides deliberately take different values. The number keeps counting, but it
737
- stops meaning a position on the scale, so a composite rule never appears in the scale table and never
738
- introduces a value of its own. Every side of a composite resolves to a base rule.
739
- Append the next number when a genuinely new asymmetric pattern appears. State the reason each side
740
- differs; a recipe without one is a product decision, not a rule.
741
- - id: axis-variants
742
- title: Axis variants
743
- requirement: |-
744
- `px-*` and `py-*` are not separate rules. They apply an existing rule to one axis when the two axes
745
- carry different boundary decisions.
746
- | Axis | Class | Meaning |
747
- | --- | --- | --- |
748
- | Inline | `px-*` | The chosen rule applies to logical start and end only |
749
- | Block | `py-*` | The chosen rule applies to block start and end only |
750
- | One side | `pt-*`, `pb-*`, `ps-*`, `pe-*` | The chosen rule applies to that side only |
751
- Per-side classes are what the side-contact rule needs, because the two block sides of one band often
752
- take different values. `px-4 pt-4 pb-3` is PADDING-4 on three sides and PADDING-3 on the side meeting
753
- a separator, and every side still names its own case.
754
- On the same element the narrower class wins the sides it names rather than adding, so `p-4 pb-3`
755
- resolves to `1rem` on three sides and `.75rem` at the bottom. Between nested elements padding does
756
- add, which is why a wrapper introduced only to change one side produces an inset nobody intended.
757
- recipes:
758
- - rule: PADDING-0
759
- title: "`p-0` / `0`"
760
- cases:
761
- - id: case-1
762
- when: A container only groups children which each carry their own boundary
763
- owner: "`App`"
764
- render: '`<section className="p-0">`'
765
- - id: case-2
766
- when: Surface bands run flush to the card edge
767
- owner: "`SurfaceCard`"
768
- render: '`composition="joined"` already sets `0`'
769
- - id: case-3
770
- when: A Grammar list sits inside a panel or its rows own their own inset
771
- owner: "`SurfaceCard` list kind / `ListBox`"
772
- render: ListBox resolves inset="panel" in a surface nesting context, or callers select it explicitly. Its
773
- row boxes align with the panel content edge, like the search field and tabs boxes, without
774
- negative-margin bleed (owner:panel-list-box-edge). The list retains HeroUI p-1; items retain
775
- px-2 py-1.5, rounded-2xl and mt-1 between items, with the same padding and radius for hover,
776
- pressed and selected backgrounds. Section captions share the inset content edge. Padding
777
- wrappers with px-*, ps-* or pe-* stack this inset and fail FE_LIST_PANEL_PADDING in the universal
778
- FE canon (R318).
779
- - rule: PADDING-1
780
- title: "`p-1` / `.25rem`"
781
- cases:
782
- - id: case-1
783
- when: A compact marker or key floating over an app-owned canvas
784
- owner: "`App`"
785
- render: '`<aside className="p-1">` with `<Text size="xs">`'
786
- - id: case-2
787
- when: A scroll region reserving room so focus rings are not clipped
788
- owner: "`HorizontalScrollRegion`"
789
- render: Compose the region; no padding
790
- - id: case-3
791
- when: A short hint attached to a control
792
- owner: "`Tooltip`"
793
- render: Compose the tooltip; no padding
794
- - rule: PADDING-2
795
- title: "`p-2` / `.5rem`"
796
- cases:
797
- - id: case-1
798
- when: A small auxiliary strip whose four sides share one inset
799
- owner: "`App`"
800
- render: '`<aside className="p-2">` with `<Text size="sm">`'
801
- - id: case-2
802
- when: A compact bar of controls above app-owned content
803
- owner: "`App`"
804
- render: '`<div className="flex items-center gap-2 p-2">`'
805
- - rule: PADDING-3
806
- title: "`p-3` / `.75rem`"
807
- cases:
808
- - id: case-1
809
- when: A nested app container that owns a boundary distinct from its parent's
810
- owner: "`App`"
811
- render: '`<aside className="p-3">` inside a `p-4` section'
812
- - id: case-2
813
- when: The inline inset of a tab strip or secondary navigation
814
- owner: "`Tabs`, `Subnav`"
815
- render: Compose the component; no padding
816
- - id: case-3
817
- when: A band side that meets a separator inside a flush surface
818
- owner: "`—`"
819
- render: '`<div className="px-4 py-3">` between two separators'
820
- - id: case-4
821
- when: The separator-facing side of a metric cell or list row
822
- owner: '`DescriptionList` layout="stat-strip" (its divided cells, @starci/grammar 0.6.0), else `—`'
823
- render: '`<div className="p-4 pb-3">`, or `pt-3` when the separator is above'
824
- - rule: PADDING-4
825
- title: "`p-4` / `1rem`"
826
- cases:
827
- - id: case-1
828
- when: An app section that owns the full distance from its border to its content
829
- owner: "`App`"
830
- render: '`<section className="p-4">` with `<Heading level={2}>`'
831
- - id: case-2
832
- when: Content inside a card
833
- owner: "`SurfaceCard`"
834
- render: Compose the card; no padding
835
- - id: case-3
836
- when: A disclosure trigger and its expanded panel
837
- owner: "`SurfaceCard` accordion kind"
838
- render: Compose the card; no padding
839
- - id: case-4
840
- when: An empty-state notice
841
- owner: "`EmptyNotice`"
842
- render: Compose the notice; no padding
843
- - id: case-5
844
- when: A fenced code block
845
- owner: "`FencedCodeBlock`"
846
- render: Compose the block; no padding
847
- - id: case-6
848
- when: A band side that meets the outer edge of a flush surface
849
- owner: "`—`"
850
- render: "`pt-4` on the first band, `pb-4` on the last"
851
- - id: case-7
852
- when: The inline sides of any band inside a flush surface
853
- owner: "`—`"
854
- render: "`px-4` on every band, unchanged by position"
855
- - rule: PADDING-5
856
- title: "`p-6` / `1.5rem`"
857
- cases:
858
- - id: case-1
859
- when: A section whose four sides share one deliberately generous boundary decision
860
- owner: "`App`"
861
- render: '`<section className="p-6">`'
862
- - id: case-2
863
- when: A tab frame carrying the page-level inline inset
864
- owner: "`Tabs`"
865
- render: '`inset="page"` already sets `1.5rem`'
866
- - rule: PADDING-6
867
- title: "`p-8` / `2rem`"
868
- cases:
869
- - id: case-1
870
- when: A page region that needs strong equal clearance on every side
871
- owner: "`App`"
872
- render: '`<section className="p-8">`'
873
- - id: case-2
874
- when: An empty or waiting region occupying most of the viewport
875
- owner: "`App`"
876
- render: '`<section className="p-8">` with `<EmptyNotice>`'
877
- - rule: PADDING-7
878
- title: Inset step at the wider breakpoint
879
- cases:
880
- - id: case-1
881
- when: A decision surface whose inline inset opens up on a wider viewport
882
- owner: "`—`"
883
- render: '`<div className="px-4 sm:px-6">`'
884
- - id: case-2
885
- when: The same surface's outer-edge block sides, stepping with it
886
- owner: "`—`"
887
- render: '`<div className="px-4 pt-4 pb-4 sm:px-6 sm:pt-6 sm:pb-6">`'
888
- - id: case-3
889
- when: A separator-facing side inside that surface
890
- owner: "`—`"
891
- render: "`pt-3` stays `.75rem` at both widths"
892
- - rule: PADDING-8
893
- title: Subordinate content indented at the inline start
894
- cases:
895
- - id: case-1
896
- when: A disclosure body that reads as the answer belonging to the trigger above it
897
- owner: "`—`"
898
- render: '`<div className="ps-6 pe-4 py-3">`'
899
- - id: case-2
900
- when: A nested group whose rows belong to a named parent row
901
- owner: "`—`"
902
- render: Same recipe, one step per level of nesting
903
- - rule: PADDING-9
904
- title: Block inset of a routed block at the wider breakpoint
905
- cases:
906
- - id: case-1
907
- when: The `main` of a routed block that sits directly under the page shell
908
- owner: "`App`"
909
- render: '`<main className="py-6 sm:py-8">`'
910
- font:
911
- ownership: FE-RULE-OWNERSHIP
912
- knowledge: knowledge/ui/presentation/font.yaml
913
- ownerVocabulary:
914
- owners:
915
- - name: A component name
916
- meaning: "`Text` or `Heading` renders this rank"
917
- applicationWrites: The prop only
918
- - name: —
919
- meaning: The rank has no public prop
920
- applicationWrites: Nothing. Report the gap
921
- notes: |-
922
- Typography belongs to Grammar. The owner cell names which component renders the rank.
923
-
924
- There is no `App` owner in this file. An application typography class is `APP_OVERRIDE`, and a raw
925
- `font-size` or `font-weight` that changes semantic rank is rejected even when the pixels match.
926
- scale:
927
- steps:
928
- - id: FONT-1
929
- - id: FONT-2
930
- - id: FONT-3
931
- - id: FONT-4
932
- - id: FONT-5
933
- - id: FONT-6
934
- notes: |-
935
- The type scale is closed and shared by `Text` and `Heading`. The rule ID is the ordinal position on
936
- that scale, smallest first. It is not a Tailwind step and not a heading level.
937
-
938
- `Text` and `Heading` are not interchangeable at the same size. A heading declares document structure;
939
- a text line does not. Choosing `Heading` to obtain a size, or `Text` to avoid an outline entry, is a
940
- structure error rather than a typography one.
941
- Tracking is not an application decision. `Heading` applies `tracking-tight` at FONT-4 and FONT-6 only.
942
- componentOwnership:
943
- title: Font Common already owns
944
- notes: Retained ownership reference, not proof of the current package/API. Verify actual installed
945
- source/props/tokens before use; correct outdated rows within selected maintenance scope using [source
946
- and maintenance](index.yaml#source-and-maintenance).
947
- rows:
948
- - component: PaneGrid
949
- element: drawer trigger, collapsing pane
950
- rule: FONT-2
951
- - component: Heading
952
- element: root, scale!="display", level=1
953
- rule: FONT-4
954
- - component: Heading
955
- element: root, scale!="display", level=2
956
- rule: FONT-3
957
- - component: Heading
958
- element: root, scale!="display", level=3
959
- rule: FONT-2
960
- - component: Heading
961
- element: root, scale!="display", level=4
962
- rule: FONT-1
963
- - component: Heading
964
- element: root, scale="display"
965
- rule: FONT-6
966
- - component: Input
967
- element: reveal or copy label, action is present and its icon is absent
968
- rule: FONT-1
969
- - component: Label
970
- element: root, depth!="nested"
971
- rule: FONT-2
972
- - component: Label
973
- element: root, depth="nested"
974
- rule: FONT-1
975
- - component: PressableField
976
- element: placeholder
977
- rule: FONT-2
978
- - component: PressableField
979
- element: shortcut, shortcut!=undefined
980
- rule: FONT-1
981
- - component: Sidebar
982
- element: item label, not collapsed
983
- rule: FONT-2
984
- - component: Sidebar
985
- element: section label, group.label!=undefined, not collapsed
986
- rule: FONT-1
987
- - component: Text
988
- element: root, size="md"
989
- rule: FONT-3
990
- - component: Text
991
- element: root, size="sm"
992
- rule: FONT-2
993
- - component: Text
994
- element: root, size="xs"
995
- rule: FONT-1
996
- - component: TextAction
997
- element: root, size="md"
998
- rule: FONT-3
999
- - component: TextAction
1000
- element: root, size="sm"
1001
- rule: FONT-2
1002
- - component: TextAction
1003
- element: root, size="xs"
1004
- rule: FONT-1
1005
- - component: Tooltip
1006
- element: content
1007
- rule: FONT-1
1008
- - component: SurfaceCard (list kind)
1009
- element: fact, label is visible and fact is present, depth="nested"
1010
- rule: FONT-1
1011
- - component: SurfaceCard (list kind)
1012
- element: fact, label is visible and fact is present, depth!="nested"
1013
- rule: FONT-2
1014
- guidance:
1015
- - id: weight
1016
- title: Weight
1017
- requirement: |-
1018
- Weight is a second axis, not a position on the size scale. Its public set is closed.
1019
- | Prop | Rendered | Use for |
1020
- | --- | --- | --- |
1021
- | Where | Rendered | Use for |
1022
- | --- | --- | --- |
1023
- | `Text`, no prop | `font-normal`, the default | Reading copy and ordinary facts |
1024
- | `Heading` levels 3 and 4, and labels | `font-medium` | A compact label, or a title above its own description |
1025
- | `Text isStrong` | `font-semibold` | A value or a term that must be found first inside its line |
1026
- Weight refines a rank the application has already chosen. It never manufactures a new hierarchy
1027
- level, and it never substitutes for a heading: a group is headed by its `Section` title or its
1028
- card label, never by a strong `Text`. `Heading` applies its own weight per level and takes
1029
- no weight prop.
1030
- Bold beyond `semibold` has no public prop. Treat an intent that needs it as a gap rather than writing
1031
- a class.
1032
- recipes:
1033
- - rule: FONT-1
1034
- title: "`text-xs` / `leading-4`"
1035
- cases:
1036
- - id: case-1
1037
- when: Brief metadata that stays understandable at the smallest size
1038
- owner: "`Text`"
1039
- render: '`<Text size="xs">Optional</Text>`'
1040
- - id: case-2
1041
- when: The label of a nested region inside an already-titled section
1042
- owner: "`Heading`"
1043
- render: "`<Heading level={4}>Card details</Heading>`"
1044
- remark: |-
1045
- `Text size="xs"` always resolves to muted and cannot be promoted to another tone. `Heading level={4}`
1046
- carries the same muted treatment.
1047
- notThisRule: ordinary sentences, or any fact the reader must not miss. Use FONT-2 or FONT-3.
1048
- - rule: FONT-2
1049
- title: "`text-sm` / `leading-5`"
1050
- cases:
1051
- - id: case-1
1052
- when: A complete line ranked below normal body copy, such as a timestamp or short fact
1053
- owner: "`Text`"
1054
- render: '`<Text size="sm">Updated 2 minutes ago</Text>`'
1055
- - id: case-2
1056
- when: A third-level region heading inside a section
1057
- owner: "`Heading`"
1058
- render: "`<Heading level={3}>Payment method</Heading>`"
1059
- notThisRule: shrinking body copy so it fits a container that is too small. Fix the container.
1060
- - rule: FONT-3
1061
- title: "`text-base` / `leading-6`"
1062
- cases:
1063
- - id: case-1
1064
- when: Ordinary explanatory copy with normal reading priority
1065
- owner: "`Text`"
1066
- render: "`<Text>Your subscription renews on 12 March.</Text>`"
1067
- - id: case-2
1068
- when: The heading of a section inside a page
1069
- owner: "`Heading`"
1070
- render: "`<Heading level={2}>Billing</Heading>`"
1071
- - rule: FONT-4
1072
- title: "`text-xl`"
1073
- cases:
1074
- - id: case-1
1075
- when: The single heading that names the whole page or route
1076
- owner: "`Heading`"
1077
- render: "`<Heading level={1}>Account</Heading>`"
1078
- notThisRule: a second `level={1}` on the same page. One document, one top-level heading.
1079
- - rule: FONT-5
1080
- title: "`text-3xl` / `leading-9`"
1081
- cases:
1082
- - id: case-1
1083
- when: The single leading metric or short value that is the main fact of its region
1084
- owner: "`DescriptionList` layout=\"stat-strip\""
1085
- render: '`<DescriptionList layout="stat-strip" items={[{ id: "rate", term: "Resolved", description: "84%" }]} />`'
1086
- notThisRule: sentences, decoration, or imitating a heading. It creates no heading semantics.
1087
- - rule: FONT-6
1088
- title: "`text-4xl` / `leading-tight`"
1089
- cases:
1090
- - id: case-1
1091
- when: A page-root heading that must carry marketing or landing weight
1092
- owner: "`Heading`"
1093
- render: '`<Heading level={1} scale="display">Learn without limits</Heading>`'
1094
- notThisRule: raising the visual size of a nested heading. `scale` changes the recipe, never the outline position.
1095
- anatomyObservations:
1096
- - id: prompt-shape-b2
1097
- lane: ui
1098
- kind: proven-template
1099
- summary: |-
1100
- Verified in the draw lab against the real list SurfaceCard render — the prompt shape that
1101
- produced a direction both faithful and beautiful:
1102
- 1. Frame: flat product UI screenshot, size, light theme.
1103
- 2. SUBJECT: screen name + product name.
1104
- 3. FIXED ANATOMY: literal layout top-to-bottom; containment spelled as inside/outside the
1105
- surface; known-confusion regions get the anti-pattern callout plus the correct structure.
1106
- 4. BRAND + TOKENS: background, surface, radius, shadow, exact hex for primary and where it
1107
- may appear; nested controls use the secondary variant.
1108
- 5. CREATIVE LICENSE: an explicit "You MAY" list and an explicit "You MAY NOT" list.
1109
- 6. Text rule: every label spelled exactly, no lorem ipsum.
1110
- Control runs: the same prompt without section 3's literal containment drew the section
1111
- label inside the card (wrong vs the real render); the same prompt with unbounded freedom
1112
- produced a beautiful screen for a different product.
1113
- - id: surface-label-placement
1114
- lane: ui
1115
- kind: anatomy-detail
1116
- summary: |-
1117
- Every `SurfaceCard` kind except `tile` places its label outside: an unpainted row above the material
1118
- with the fact and the end action, and the card bounds only the content, the footer note below it.
1119
- A prompt that draws the label inside the card invents a placement the grammar does not have.
1120
- - id: list-separator-bleed
1121
- lane: ui
1122
- kind: anatomy-detail
1123
- summary: |-
1124
- List separators are edge-to-edge, not inset. The list shell ships `PADDING-0`; the
1125
- divider is a `border-top` on the row element itself, so it spans the card's full width
1126
- and touches both edges. Only the row's content is inset by the row's own padding.
1127
- Rows opt into this shipped geometry via `starci-core-static-row` — an app-owned row
1128
- without the class renders no separator at all.
1129
- - id: list-row-anatomy
1130
- lane: ui
1131
- kind: anatomy-detail
1132
- summary: |-
1133
- An interactive row in a list SurfaceCard is the grammar `ListRow` (@starci/grammar 0.9.1), never an
1134
- app-owned `<li>` and never a second `<ul>` nested in the card (the card already renders the list,
1135
- so a nested list loses the row inset and the separator - a defect that leaves rows flush against
1136
- the card edge). Its slots, in reading order: `leading`
1137
- (an IconTile, an avatar, or a logo; a horizontal bank wordmark takes a fixed 64x40 frame rather
1138
- than a square tile, which would shrink it to a sliver), `title`, `badges` (at most two,
1139
- DISCIPLINE-1 case-3), one muted `description`, `actions` (one visible Button, then a DropdownMenu
1140
- with destructive commands last behind an AlertDialog), and a `children` detail region under the
1141
- copy for an Alert about the row or revealed values. It carries `starci-core-static-row`, so the
1142
- inset, row gap and edge-to-edge separator are the static row's. Collapsed by default (the collapse
1143
- law): mark and copy share the first line, actions and detail take their own; the surface container
1144
- query at 28.001rem lays it out leading | copy | actions. Several accounts of one provider are one
1145
- ListRow each, told apart by the leading mark, the name and the account's last digits; the card's
1146
- `fact` carries the count and `labelEnd` the add action (0.9.1 renders both).
1147
- - id: card-division-and-measure
1148
- lane: ui
1149
- kind: anatomy-detail
1150
- summary: |-
1151
- Grammar ships card division and card width — a direction that invents either is
1152
- app-owned and must say so. `SurfaceCard composition="joined"` stacks children
1153
- edge-to-edge inside one card with shipped separators (the reference
1154
- joined-card pattern); it divides VERTICALLY only — a
1155
- side-by-side split inside one card is not shipped anatomy. `SurfaceCard
1156
- measure="form"/"formCompact"` is the owned width contract for compact forms: a
1157
- direction drawing a form card full-width and filling the dead space is answering
1158
- a question `measure` already answers better.
1159
- - id: joined-band-treatment
1160
- lane: ui
1161
- kind: anatomy-detail
1162
- summary: |-
1163
- Emphasis inside a joined card is a flush band, not an inset panel. The reference
1164
- dashboard's anatomy: children stack full-bleed inside the bounded
1165
- surface (`joined` sets the content to gap:0/padding:0), adjacent bands separate
1166
- with an edge-to-edge `border-t` hairline, and a band that needs emphasis carries
1167
- `bg-surface-secondary` (neutral) or `bg-accent-soft` (accent tint) across the
1168
- card's full width with its own padding (px-4/pt-4/pb-3 top, p-3 middle). A
1169
- nested rounded box floating inside the card is not the pattern.
1170
- - id: special-card-recipe
1171
- lane: ui
1172
- kind: anatomy-detail
1173
- summary: |-
1174
- The dashboard's "special card" formula is composition, not decoration: IMAGE × joined
1175
- plus HIGHLIGHT × joined. Proof in source — the reference task card: a joined card whose first band
1176
- is an accent-filled hero slab (`bg-accent`) carrying a decorative 3D illustration
1177
- anchored to the trailing edge (`aria-hidden`, `pointer-events-none`, bottom/right
1178
- absolute); separator; a reward band that is neutral by default and turns
1179
- `bg-success-soft` ONLY on the claimed state ("only a proven claimed outcome receives
1180
- success"); separator; a task-cell grid using `divide-y`/`divide-x` for edge-to-edge
1181
- cell lines. the reference purchase card: joined card = intro band + full-bleed journey
1182
- illustration band + benefit list, with MISSING-ASSET discipline — the illustration is
1183
- withheld entirely under the dark scheme rather than repainted. Grammar ships the
1184
- card-level "special" affordance itself: `SurfaceCard isHighlight` wraps the surface in
1185
- an animated conic-gradient edge sweep (`starci-core-surface-highlight-sweep`, 3s spin,
1186
- suppressed while `pending`). Direction prompts MAY therefore use: a tinted hero slab
1187
- band with anchored decorative art, state-semantic tinted bands (accent-soft /
1188
- surface-secondary / success-soft), and the card edge highlight — but a highlight or
1189
- tint must always MEAN a state, never mere prettiness.
1190
- - id: direction-scale-drift
1191
- lane: ui
1192
- kind: known-drift
1193
- summary: |-
1194
- Image models inflate type scale — surface labels ship at 0.875rem (0.75rem nested)
1195
- but directions routinely draw them 1.3–1.5x larger. Scale is token truth, not
1196
- direction truth: the image fixes containment and composition; the component's own
1197
- CSS fixes size. A direction drawn with oversized labels is not falsified for it —
1198
- but an implementation capture that reproduces the oversized size is.