@starci/eslint-grammar-core 0.27.1 → 0.30.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 (46) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +3 -1
  3. package/dist/button-arrow.d.ts +7 -0
  4. package/dist/button-arrow.js +146 -0
  5. package/dist/field-label.d.ts +7 -0
  6. package/dist/field-label.js +83 -0
  7. package/dist/gap-proximity.d.ts +7 -0
  8. package/dist/gap-proximity.js +194 -0
  9. package/dist/index.js +22 -0
  10. package/dist/lib/cross-file-inputs.js +3 -0
  11. package/dist/lib/grammar-jsx.d.ts +27 -0
  12. package/dist/lib/grammar-jsx.js +136 -0
  13. package/dist/lib/row-context.d.ts +25 -0
  14. package/dist/lib/row-context.js +134 -0
  15. package/dist/lib/why.js +60 -0
  16. package/dist/page-breadcrumbs.d.ts +7 -0
  17. package/dist/page-breadcrumbs.js +103 -0
  18. package/dist/row-title-link.d.ts +6 -0
  19. package/dist/row-title-link.js +172 -0
  20. package/dist/same-line-size.d.ts +6 -0
  21. package/dist/same-line-size.js +93 -0
  22. package/dist/single-child-card.d.ts +7 -0
  23. package/dist/single-child-card.js +103 -0
  24. package/dist/suggestion-chips.d.ts +6 -0
  25. package/dist/suggestion-chips.js +122 -0
  26. package/dist/surface-card.js +1 -1
  27. package/dist/surface-in-surface.d.ts +7 -0
  28. package/dist/surface-in-surface.js +84 -0
  29. package/dist/table-cell-type.d.ts +6 -0
  30. package/dist/table-cell-type.js +122 -0
  31. package/dist/tabs.d.ts +9 -0
  32. package/dist/tabs.js +147 -0
  33. package/docs/button-arrow.md +34 -0
  34. package/docs/field-label.md +26 -0
  35. package/docs/gap-proximity.md +31 -0
  36. package/docs/page-breadcrumbs.md +28 -0
  37. package/docs/row-title-link.md +30 -0
  38. package/docs/same-line-size.md +26 -0
  39. package/docs/single-child-card.md +37 -0
  40. package/docs/suggestion-chips.md +31 -0
  41. package/docs/surface-in-surface.md +28 -0
  42. package/docs/table-cell-type.md +32 -0
  43. package/docs/tabs.md +48 -0
  44. package/package.json +4 -4
  45. package/runtime/bundle.json +1 -0
  46. package/runtime/knowledge/ui/presentation/grammar-laws.yaml +121 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-grammar-core",
3
- "version": "0.27.1",
3
+ "version": "0.30.0",
4
4
  "description": "ESLint rules for the core Grammar's component, token and composition contracts.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@starci/eslint-canon-fe": "~9.16.0",
45
- "@starci/hfs": "~6.4.0",
45
+ "@starci/hfs": "~6.5.0",
46
46
  "eslint": ">=9",
47
47
  "typescript": ">=5.9"
48
48
  },
@@ -68,6 +68,6 @@
68
68
  "eslint-plugin-react-hooks": "^7.1.1",
69
69
  "typescript": "^6.0.3"
70
70
  },
71
- "gitHead": "247dce2b96806850cc135a4573c9b6069c908ef1",
72
- "starciSource": "5f404cef5ef2ea51c88213874c18642cb6049b737877362c263d05350e5c81e3"
71
+ "gitHead": "60a43b01a0944d2c8252e074946b82f3ee60c988",
72
+ "starciSource": "c9f0db9043d7d17e3fb8d7d1e230fde769670e27b4cf7e2c6b27fcc1901fd99f"
73
73
  }
@@ -4,6 +4,7 @@
4
4
  "knowledge/patterns/fe/index.yaml",
5
5
  "knowledge/patterns/fe/ui.yaml",
6
6
  "knowledge/ui/composition/app-shell.yaml",
7
+ "knowledge/ui/presentation/grammar-laws.yaml",
7
8
  "knowledge/ui/proof/anatomy-source.yaml",
8
9
  "modules/goal/source-phrases.yaml"
9
10
  ]
@@ -0,0 +1,121 @@
1
+ schema: starci/knowledge-source@1
2
+ id: ui.presentation.grammar-laws
3
+ title: Grammar presentation laws (owner, 2026-11-09)
4
+ appliesTo: [ui, frontend]
5
+ family: presentation
6
+ purpose: |-
7
+ The spacing, surface, field, typography, link and button laws the owner approved on 2026-11-09. The core Grammar
8
+ owns the values; these rules say what an app composition may not do against them.
9
+ provenance:
10
+ reviewedAt: 2026-11-09
11
+ sources:
12
+ - knowledge/patterns/fe/ui.yaml
13
+ limitations: |-
14
+ Static checks read JSX composition only; the rendered gaps are measured by the Grammar's audit-gap script.
15
+ rules:
16
+ - id: GAP-PROXIMITY
17
+ title: Children stand closer than their container's siblings
18
+ governs: The gap role of a Grammar layout element nested in another.
19
+ cases:
20
+ - id: case-1
21
+ when: A Grammar layout element (Stack, Cluster, PaneSection, Section, Grid, Form) sits directly inside another
22
+ assert: |-
23
+ The child's gap role is at least one step below its parent's (identity 4 < inline 8 < row 12 < section 24 <
24
+ region 32). A field stack (fields 24 apart) inside a Form or a Drawer body is the Field rule's own rhythm.
25
+ - id: SURFACE-IN-SURFACE
26
+ title: A list of rows inside a surface is a nested surface
27
+ governs: Row lists placed inside a card body, a drawer, a dialog or a pane band.
28
+ cases:
29
+ - id: case-1
30
+ when: Rows divided by lines stand inside a surface without being that surface's own full-bleed body
31
+ assert: |-
32
+ The Grammar list draws them in a nested surface: a 1px separator border, the card radius, clipped.
33
+ A hand-made row list (blocks divided by Divider) is the bare form and is refused.
34
+ - id: FIELD-LABEL
35
+ title: A control is labelled by its own label prop
36
+ governs: The label of every form control.
37
+ cases:
38
+ - id: case-1
39
+ when: A form control is composed
40
+ assert: |-
41
+ The label is the control's `label` prop: label to control 8, control to help 4, field to field 24. A Text
42
+ placed beside the control as its label is refused.
43
+ - id: PAGE-BREADCRUMBS
44
+ title: Every console page states its trail
45
+ governs: The header of an app console page.
46
+ cases:
47
+ - id: case-1
48
+ when: An app console page draws a Page header
49
+ assert: |-
50
+ The header carries `breadcrumbs`, or `breadcrumbs="root"` for the root page of its console.
51
+ - id: BUTTON-ARROW
52
+ title: A leads-somewhere button ends with endArrow
53
+ governs: Arrows on Buttons.
54
+ cases:
55
+ - id: case-1
56
+ when: A Button leads somewhere
57
+ assert: |-
58
+ It takes `endArrow`; an arrow typed in its label or passed as end content is refused. A Button that does
59
+ something takes `startGlyph`; never both.
60
+ - id: SUGGESTION-CHIPS
61
+ title: Quick replies and suggested questions are SuggestionChips
62
+ governs: A row of Buttons that suggest something to say or ask.
63
+ cases:
64
+ - id: case-1
65
+ when: A row of neutral sm Buttons each send their own label
66
+ assert: |-
67
+ It is `SuggestionChips` (pill chips, a labelled toolbar), not a Button row; a form value is ChoiceChips and a
68
+ label is a Badge or a TagGroup.
69
+ - id: TABLE-CELL-TYPE
70
+ title: Table and row cells take the row type sizes
71
+ governs: Text inside a DataTable cell or a ListRow.
72
+ cases:
73
+ - id: case-1
74
+ when: Text is drawn in a DataTable cell or a ListRow
75
+ assert: |-
76
+ The primary is md 14 / 500, the secondary sm 13 muted; a heading-size Text is refused.
77
+ - id: SAME-LINE-SIZE
78
+ title: One line, one size
79
+ governs: Text siblings of one inline line.
80
+ cases:
81
+ - id: case-1
82
+ when: Texts stand side by side in one Cluster
83
+ assert: |-
84
+ They share one size; a Badge or a chip is exempt.
85
+ - id: ROW-TITLE-LINK
86
+ title: A row title is never a link when the row opens
87
+ governs: The primary of a ListRow or a DataTable row.
88
+ cases:
89
+ - id: case-1
90
+ when: A row has an action, an href or a chevron
91
+ assert: |-
92
+ Its title is plain text; the row is the one pressable.
93
+ - id: TABS-SWITCH-ZONE
94
+ title: The pill is the switch zone of a card
95
+ governs: Tabs appearance="primary".
96
+ cases:
97
+ - id: case-1
98
+ when: A mode or period of one block's data is switched among two to four short options
99
+ assert: |-
100
+ It is the card's `switch` header zone (`headers={[{ kind: "switch", label, items, selectedKey, onSelect }]}`),
101
+ with no count and no href. A pill written in JSX in a page body, under the page tabs, in a pane or in a drawer
102
+ is refused: views of a page are page tabs, views or filters inside a region are underline `Tabs`.
103
+ - id: TABS-DEPTH
104
+ title: A page stacks two underline layers at most
105
+ governs: Underline Tabs nested through the panels they select.
106
+ cases:
107
+ - id: case-1
108
+ when: An underline Tabs stands in the panel of another, or in the body of a Page whose header carries tabs
109
+ assert: |-
110
+ The page tabs (`Page header.tabs`) and one region set are the two layers; a third nested set is refused.
111
+ Every tab is one size, so only the count of layers is judged.
112
+ - id: SINGLE-CHILD-CARD
113
+ title: A table, list or chart standing alone is the surface
114
+ governs: A SurfaceCard whose only content is a table, a list or a chart.
115
+ cases:
116
+ - id: case-1
117
+ when: A card has no zones (headers, footers, head actions) and holds one DataTable, list (ListBox, ItemList, DisclosureList, Timeline, Section kind="list") or chart (BarChart, ProportionBar, BubbleMap, FlowGraph, MermaidDiagram), or is kind="table" or kind="list"
118
+ assert: |-
119
+ The Grammar draws a standalone DataTable and every Section kind="list" as ONE frame (border, card radius), so the
120
+ card is a second frame. The title sits above as a Section head and one caption sits below (Section caption, muted sm).
121
+ A card groups two or more different parts (figures + list + actions), or carries zones (tabs, search, head actions).