@starci/eslint-grammar-core 0.41.0 → 0.43.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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -0
- package/dist/index.js +2 -0
- package/dist/lib/row-context.d.ts +2 -2
- package/dist/lib/row-context.js +4 -10
- package/dist/lib/why.js +12 -7
- package/dist/no-card-lead-description.js +2 -2
- package/dist/rows-in-card.js +1 -1
- package/dist/single-child-card.d.ts +1 -1
- package/dist/single-child-card.js +13 -11
- package/dist/surface-card-list.d.ts +21 -0
- package/dist/surface-card-list.js +48 -0
- package/dist/surface-card.js +3 -3
- package/dist/surface-in-surface.js +5 -6
- package/dist/table-cell-type.js +2 -2
- package/docs/card-content.md +1 -1
- package/docs/choice-controls.md +1 -1
- package/docs/message-surfaces.md +2 -2
- package/docs/rows-in-card.md +2 -2
- package/docs/single-child-card.md +6 -4
- package/docs/surface-card-list.md +34 -0
- package/docs/surface-card.md +2 -2
- package/docs/surface-in-surface.md +3 -3
- package/docs/table-cell-type.md +1 -1
- package/docs/tabs.md +1 -1
- package/package.json +3 -3
- package/runtime/knowledge/ui/presentation/grammar-laws.yaml +24 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.43.0 - 2026-11-17
|
|
4
|
+
|
|
5
|
+
- Added: `surface-card-list` (`FE_SURFACE_CARD_LIST`, law LIST-ONE-LOOK): a Grammar `SurfaceCard` whose `kind` is the literal `"list"` is refused with the fix: `<Section kind="list" title items empty />` with `ListRow` rows; `label` becomes `title`, `labelEnd` becomes `action`, a filter or search goes in the list's `filter`, `layout` stays. No autofix: the zones, the import and the look change too. Doc `docs/surface-card-list.md`.
|
|
6
|
+
- Changed: `single-child-card` also refuses a `SurfaceCard` with no zones whose only child is a `Section kind="list"` (a list titles itself and is never a card); key-value and choice cards stay valid.
|
|
7
|
+
- Changed (messages and docs): `surface-card-kind`, `no-label-in-grid`, `surface-in-surface`, `rows-in-card` and `no-card-lead-description` point at `Section kind="list"`, never a list card; `surface-in-surface` no longer speaks of a nested surface.
|
|
8
|
+
- Removed: the dead row paths of the rules that read list rows (`lib/row-context.ts`: `table-cell-type`, `row-title-link`, `button-arrow`, `message-surfaces`, `same-line-size`, `suggestion-buttons`): a `{ kind: "list", items }` collection object and the `items` of a `SurfaceCard kind="list"`; the rows of a `Section kind="list"` and a `ListRow` are read as before.
|
|
9
|
+
- Knowledge (`runtime/knowledge/ui/presentation/grammar-laws.yaml`): LIST-ONE-LOOK added; SURFACE-IN-SURFACE, MESSAGE-SURFACES, ROWS-IN-CARD, CARD-NO-DESCRIPTION and SINGLE-CHILD-CARD rewritten for the flat list.
|
|
10
|
+
|
|
11
|
+
## 0.42.0 - 2026-11-17
|
|
12
|
+
|
|
13
|
+
- Version: moves with the Grammar family (@starci/grammar 0.42.0: the steps graph opens fitted, back edges clear their own cards, the pill Select sizes to its value, the section divider hook, neutral disabled buttons, one-line action cells); no rule changed.
|
|
14
|
+
|
|
3
15
|
## 0.41.0 - 2026-11-17
|
|
4
16
|
|
|
5
17
|
- Version: moves with the Grammar family (@starci/grammar 0.41.0: the white-theme hooks, the inline link underline, the page head on the body's measure, `Section filter` on a region); no rule changed.
|
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ chip labels that start uppercase, a Button that leads somewhere ending with `end
|
|
|
23
23
|
its behavioral knowledge source and the governing ownership test. The R318 surface composition
|
|
24
24
|
rules (nested control variants, panel-list alignment, layout-only CSS) stay in the universal canon.
|
|
25
25
|
`suggestion-buttons` (suggestions and quick replies are a Cluster of neutral sm Buttons, never a Link row, ChoiceChips or Chip that sends; `docs/suggestion-buttons.md`).
|
|
26
|
+
`surface-card-list` (0.43.0, LIST-ONE-LOOK: a list is `Section kind="list"` of `ListRow`s, flat rows aligned with the title, never `SurfaceCard kind="list"`; `docs/surface-card-list.md`).
|
|
26
27
|
`message-surfaces` (0.37.31: every chat draws Grammar's faces, the thread `--background`, others' messages flat `--surface`, your own `--accent`; no class or style on `MessageBubble`/`MessageCard`, no class string reaching a message part, no `tone: "surface"` on a `role: "log"` thread; `docs/message-surfaces.md`).
|
|
27
28
|
The proximity and composition laws of 2026-11-09 each have a doc: `gap-proximity` (a layout element stands at least one gap step closer than its layout parent), `field-label` (a control is labelled by its own `label` prop), `surface-in-surface` (a hand-made divided row list in a surface is `Section kind="list"`) `single-child-card` (a table, list or chart alone is the surface, not a card's only content) and `page-breadcrumbs` (a console `Page` header states `breadcrumbs`, or `"root"`).
|
|
28
29
|
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ import { rules as sectionHeadActionRules } from "./section-head-action.js";
|
|
|
30
30
|
import { rules as sameLineSizeRules } from "./same-line-size.js";
|
|
31
31
|
import { rules as statusColorsRules } from "./status-colors.js";
|
|
32
32
|
import { rules as surfaceCardRules } from "./surface-card.js";
|
|
33
|
+
import { rules as surfaceCardListRules } from "./surface-card-list.js";
|
|
33
34
|
import { rules as surfaceDepthRules } from "./surface-depth.js";
|
|
34
35
|
import { rules as singleChildCardRules } from "./single-child-card.js";
|
|
35
36
|
import { rules as surfaceInSurfaceRules } from "./surface-in-surface.js";
|
|
@@ -73,6 +74,7 @@ const CONTRIBUTIONS = [
|
|
|
73
74
|
{ law: "single-child-card", rules: singleChildCardRules },
|
|
74
75
|
{ law: "status-colors", rules: statusColorsRules },
|
|
75
76
|
{ law: "surface-card", rules: surfaceCardRules },
|
|
77
|
+
{ law: "surface-card-list", rules: surfaceCardListRules },
|
|
76
78
|
{ law: "surface-depth", rules: surfaceDepthRules },
|
|
77
79
|
{ law: "suggestion-buttons", rules: suggestionButtonsRules },
|
|
78
80
|
{ law: "surface-in-surface", rules: surfaceInSurfaceRules },
|
|
@@ -16,8 +16,8 @@ export declare const keyName: (property: TSESTree.Property) => string | null;
|
|
|
16
16
|
/** The value of an object literal's property by name. */
|
|
17
17
|
export declare const propertyOf: (object: TSESTree.ObjectExpression, name: string) => TSESTree.Property | null;
|
|
18
18
|
/**
|
|
19
|
-
* True when an object literal is a ListRow data object in the source: it stands in the `items` of a
|
|
20
|
-
*
|
|
19
|
+
* True when an object literal is a ListRow data object in the source: it stands in the `items` of a `Section` written
|
|
20
|
+
* `kind="list"`, through any `.map` callback, array,
|
|
21
21
|
* conditional or `as` wrapper, or it is the `row` of a `<ListRow>`. A row list declared elsewhere and passed by name is not followed.
|
|
22
22
|
*/
|
|
23
23
|
export declare const isListRow: (object: TSESTree.ObjectExpression, bound: ReadonlyMap<string, string>) => boolean;
|
package/dist/lib/row-context.js
CHANGED
|
@@ -68,13 +68,9 @@ export const propertyOf = (object, name) => {
|
|
|
68
68
|
}
|
|
69
69
|
return null;
|
|
70
70
|
};
|
|
71
|
-
const isListKind = (object) => {
|
|
72
|
-
const kind = propertyOf(object, "kind")?.value;
|
|
73
|
-
return kind?.type === "Literal" && kind.value === "list";
|
|
74
|
-
};
|
|
75
71
|
/**
|
|
76
|
-
* True when an object literal is a ListRow data object in the source: it stands in the `items` of a
|
|
77
|
-
*
|
|
72
|
+
* True when an object literal is a ListRow data object in the source: it stands in the `items` of a `Section` written
|
|
73
|
+
* `kind="list"`, through any `.map` callback, array,
|
|
78
74
|
* conditional or `as` wrapper, or it is the `row` of a `<ListRow>`. A row list declared elsewhere and passed by name is not followed.
|
|
79
75
|
*/
|
|
80
76
|
export const isListRow = (object, bound) => {
|
|
@@ -99,9 +95,7 @@ export const isListRow = (object, bound) => {
|
|
|
99
95
|
return false;
|
|
100
96
|
continue;
|
|
101
97
|
case "Property":
|
|
102
|
-
|
|
103
|
-
return false;
|
|
104
|
-
return parent.parent.type === "ObjectExpression" && isListKind(parent.parent);
|
|
98
|
+
return false;
|
|
105
99
|
case "JSXExpressionContainer": {
|
|
106
100
|
const attribute = parent.parent;
|
|
107
101
|
if (attribute.type !== "JSXAttribute" || attribute.name.type !== "JSXIdentifier")
|
|
@@ -112,7 +106,7 @@ export const isListRow = (object, bound) => {
|
|
|
112
106
|
return grammar === "ListRow";
|
|
113
107
|
if (attribute.name.name !== "items")
|
|
114
108
|
return false;
|
|
115
|
-
return literalAttribute(opening, "kind") === "list" &&
|
|
109
|
+
return literalAttribute(opening, "kind") === "list" && grammar === "Section";
|
|
116
110
|
}
|
|
117
111
|
default:
|
|
118
112
|
return false;
|
package/dist/lib/why.js
CHANGED
|
@@ -27,12 +27,17 @@ export const why = {
|
|
|
27
27
|
"rows-in-card": {
|
|
28
28
|
code: "FE_ROWS_IN_CARD",
|
|
29
29
|
en: "A `DescriptionList` or `DisclosureList` in `<file>` stands with no `Section` or `SurfaceCard` around it.",
|
|
30
|
-
fix: "
|
|
30
|
+
fix: "Key-value and disclosure rows stand in a `SurfaceCard` (a details card is one) or a `Section`, which draws their edge or their place; a plain list of rows is `Section kind=\"list\"`, flat.",
|
|
31
|
+
},
|
|
32
|
+
"surface-card-list": {
|
|
33
|
+
code: "FE_SURFACE_CARD_LIST",
|
|
34
|
+
en: "A `SurfaceCard kind=\"list\"` in `<file>`: the list card was removed in the Grammar family 0.43.0, a list is never a card.",
|
|
35
|
+
fix: "Write the list as `<Section kind=\"list\" title items empty />` with `ListRow` rows: flat rows on the surface, divided by hairlines, aligned with the title. `label` becomes `title`, `labelEnd` becomes `action`, a filter or search goes in the list's `filter`, and `layout=\"keyValue\" | \"suggestions\"` stays on the Section.",
|
|
31
36
|
},
|
|
32
37
|
"no-card-lead-description": {
|
|
33
38
|
code: "FE_NO_CARD_LEAD_DESCRIPTION",
|
|
34
39
|
en: "A muted `Text` in `<file>` stands directly above a `SurfaceCard` as its description.",
|
|
35
|
-
fix: "A card has no description. Put the line in the row subtitle (`SurfaceCard kind=\"select\"` or `kind=\"list\"`), or, when it explains the card's data (a legend, a source, a period), in the card `note`.",
|
|
40
|
+
fix: "A card has no description. Put the line in the row subtitle (`SurfaceCard kind=\"select\"` or a `Section kind=\"list\"` row), or, when it explains the card's data (a legend, a source, a period), in the card `note`.",
|
|
36
41
|
},
|
|
37
42
|
"no-nested-label": {
|
|
38
43
|
code: "FE_NO_NESTED_LABEL",
|
|
@@ -187,7 +192,7 @@ export const why = {
|
|
|
187
192
|
"no-label-in-grid": {
|
|
188
193
|
code: "FE_LABEL_IN_GRID",
|
|
189
194
|
en: "A `SurfaceCard` with a `label` is repeated in a `Grid kind=\"cards\"` in `<file>`: the label sits outside the material, so the grid reads as headings over boxes.",
|
|
190
|
-
fix: "A peer you recognise and open is a tile: `<SurfaceCard kind=\"tile\" name mark description badge action />`, named inside beside its mark. Comparing a fact across peers is one `kind=\"list\"` card.",
|
|
195
|
+
fix: "A peer you recognise and open is a tile: `<SurfaceCard kind=\"tile\" name mark description badge action />`, named inside beside its mark. Comparing a fact across peers is one `Section kind=\"list\"` or a `kind=\"table\"` card.",
|
|
191
196
|
},
|
|
192
197
|
"no-raised-surface-in-surface": {
|
|
193
198
|
code: "FE_RAISED_SURFACE_IN_SURFACE",
|
|
@@ -202,17 +207,17 @@ export const why = {
|
|
|
202
207
|
"surface-in-surface": {
|
|
203
208
|
code: "FE_SURFACE_IN_SURFACE",
|
|
204
209
|
en: "A hand-made row list (a Stack, ul, ol or div whose rows are divided by `Divider`) in `<file>` stands inside a SurfaceCard, Drawer, Dialog, PaneSection or main-rail rail.",
|
|
205
|
-
fix: "Use `<Section kind=\"list\">`
|
|
210
|
+
fix: "Use `<Section kind=\"list\">` with `ListRow` rows: the Grammar draws one list wherever it stands, flat rows divided by hairlines and aligned with the title (a card around a lone list is refused by `single-child-card`).",
|
|
206
211
|
},
|
|
207
212
|
"single-child-card": {
|
|
208
213
|
code: "FE_SINGLE_CHILD_CARD",
|
|
209
|
-
en: "A `SurfaceCard` in `<file>` has no zones and holds one `DataTable
|
|
210
|
-
fix: "Drop the card: put the title in a `Section` head (`title`) and one line under it in `Section caption`. A card groups two or more different parts, or carries zones (`headers`, `footers`) or head actions (`labelEnd`); a
|
|
214
|
+
en: "A `SurfaceCard` in `<file>` has no zones and holds one `DataTable`, chart (`BarChart`, `ProportionBar`, `BubbleMap`, `FlowGraph`, `MermaidDiagram`) or `Section kind=\"list\"`: a standalone table or chart is its own surface and a list is flat, so the card is a second frame. A card of key-value or choice rows is valid.",
|
|
215
|
+
fix: "Drop the card: put the title in a `Section` head (`title`) and one line under it in `Section caption`. A card groups two or more different parts, or carries zones (`headers`, `footers`) or head actions (`labelEnd`); a card of key-value or choice rows (`kind=\"details\"`, `\"select\"`, `\"table\"`) is valid; a list titles itself as a `Section kind=\"list\"`.",
|
|
211
216
|
},
|
|
212
217
|
"surface-card-kind": {
|
|
213
218
|
code: "FE_SURFACE_CARD_KIND",
|
|
214
219
|
en: "A `body` SurfaceCard in `<file>` holds a hand-built list, a Divider, a SectionHeader or Heading as a second title, or a `custom` zone holds a Tabs, SearchField or Divider.",
|
|
215
|
-
fix: "Rows are `kind=\"list\"
|
|
220
|
+
fix: "Rows are a `Section kind=\"list\"` (never a card), key figures `kind=\"figures\"`, bands divided by seams the typed `headers` and `footers` zones (`filter`, `search`, `toolbar`, `figures`, `more`, `paging`); the card's title is its `label`.",
|
|
216
221
|
},
|
|
217
222
|
"status-text-uses-soft-foreground": {
|
|
218
223
|
code: "FE_STYLE_TOKEN_ONLY",
|
|
@@ -4,7 +4,7 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* NO CARD LEAD DESCRIPTION (owner, 2026-11-09, CARD-NO-DESCRIPTION). A card head is its label, a count chip, one fact and one end action: it has NO description. The
|
|
6
6
|
* words that explain a card's data go in the card's `note` (a legend, a source, a period); the words that explain a row are that row's own subtitle (`kind="select"`
|
|
7
|
-
* and `kind="list"`). A free-standing muted line placed directly above a card (the title + description + card pattern) is the same description drawn by hand.
|
|
7
|
+
* and a `Section kind="list"` row). A free-standing muted line placed directly above a card (the title + description + card pattern) is the same description drawn by hand.
|
|
8
8
|
*
|
|
9
9
|
* WHAT IT READS. In product source, a Grammar `Text` with `tone="muted"` that is the sibling written IMMEDIATELY BEFORE a Grammar `SurfaceCard` in the same children list.
|
|
10
10
|
*
|
|
@@ -24,7 +24,7 @@ export const noCardLeadDescription = defineRule({
|
|
|
24
24
|
docs: { description: "CARD-NO-DESCRIPTION: a card has no lead description; the line goes in a row subtitle or the card `note`." },
|
|
25
25
|
schema: [],
|
|
26
26
|
messages: {
|
|
27
|
-
lead: "A muted `Text` stands directly above a `SurfaceCard` as its description. A card has no description: put the line in the row subtitle (`kind=\"select\"` or `kind=\"list\"`) or, if it explains the card's data (a legend, a source, a period), in the card `note`.",
|
|
27
|
+
lead: "A muted `Text` stands directly above a `SurfaceCard` as its description. A card has no description: put the line in the row subtitle (`kind=\"select\"` or a `Section kind=\"list\"` row) or, if it explains the card's data (a legend, a source, a period), in the card `note`.",
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
create(context) {
|
package/dist/rows-in-card.js
CHANGED
|
@@ -37,7 +37,7 @@ export const rowsInCard = defineRule({
|
|
|
37
37
|
docs: { description: "ROWS-IN-CARD: a DescriptionList or DisclosureList stands in a SurfaceCard or a Section, so it is a card (shadow on the well, 1px border on a white surface)." },
|
|
38
38
|
schema: [],
|
|
39
39
|
messages: {
|
|
40
|
-
bare: "A `{{name}}` stands with no card around it.
|
|
40
|
+
bare: "A `{{name}}` stands with no card around it. Key-value and disclosure rows stand in a `SurfaceCard` (Grammar draws the shadow on the pink well and the 1px border on a white aside, pane or drawer by itself) or a `Section`; a plain list of rows is `Section kind=\"list\"`, flat.",
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
create(context) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from "eslint";
|
|
2
|
-
/** A table component or a
|
|
2
|
+
/** A table component, a chart or a list standing alone is the surface, never wrapped in a card. */
|
|
3
3
|
export declare const singleChildCard: Rule.RuleModule;
|
|
4
4
|
/** The rules this law contributes to the plugin. */
|
|
5
5
|
export declare const rules: Record<string, Rule.RuleModule>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
2
|
-
import { attributeOf, elementNameOf, grammarName, hasSpread, renderedChildren } from "./lib/grammar-jsx.js";
|
|
2
|
+
import { attributeOf, elementNameOf, grammarName, hasSpread, renderedChildren, stringProp } from "./lib/grammar-jsx.js";
|
|
3
3
|
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
4
4
|
/**
|
|
5
|
-
* The lone surface law (owner, 2026-11-09, SINGLE-CHILD-CARD; aligned 0.37.8): a card groups two or more different parts or carries zones. A card
|
|
6
|
-
* key-value rows (`
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The lone surface law (owner, 2026-11-09, SINGLE-CHILD-CARD; aligned 0.37.8 and 0.43.0): a card groups two or more different parts or carries zones. A card of
|
|
6
|
+
* key-value or choice rows (`kind="table"`, `kind="select"`, `kind="details"`, a `ListBox`, `DisclosureList`, a `DescriptionList`) is valid, alone or not. What is
|
|
7
|
+
* wrong is a card wrapping ONE leaf that stands on its own: a `DataTable` (standalone it draws its own frame), a chart, or a `Section kind="list"` (a list is flat
|
|
8
|
+
* and never a card, LIST-ONE-LOOK). The title sits above it as a `Section` head; a list's own `title` is that head.
|
|
9
9
|
*
|
|
10
10
|
* WHAT IT READS. A Grammar `SurfaceCard` (imported from `@starci/grammar`) with no zones: no `headers` or `footers` prop (an empty array literal counts as none) and no
|
|
11
11
|
* `labelEnd` (head actions). Its body is read through fragments, `cond && <x/>`, `cond ? <x/> : <y/>` and `.map`, ignoring blank text. It is refused when that body is ONE
|
|
12
|
-
* element and that element is a `DataTable
|
|
12
|
+
* element and that element is a `DataTable`, a chart (`BarChart`, `ProportionBar`, `BubbleMap`, `FlowGraph`, `MermaidDiagram`) or a `Section kind="list"`.
|
|
13
13
|
*
|
|
14
|
-
* DECIDED.
|
|
15
|
-
* `accordion`, `
|
|
14
|
+
* DECIDED. Key-value and choice rows are never refused here. `Meter`, `Progress` and `ProgressCircle` are single values, not charts. `SurfaceCard kind="figures"`, `details`,
|
|
15
|
+
* `accordion`, `table`, `select` and `tile` are not judged; `SurfaceCard kind="list"` is `surface-card-list`. Kinds, depth and nesting stay with `surface-card-kind`, `no-raised-surface-in-surface` and `surface-depth`.
|
|
16
16
|
*
|
|
17
17
|
* WHAT IT LEAVES ALONE. A card with two or more body children, a card with zones or `labelEnd`, a card with a JSX spread, a non-Grammar `SurfaceCard`, and non-product source.
|
|
18
18
|
*
|
|
@@ -51,16 +51,18 @@ const loneChild = (context, card) => {
|
|
|
51
51
|
const name = elementNameOf(child);
|
|
52
52
|
if (name === null || grammarName(context, child.openingElement) === null)
|
|
53
53
|
return null;
|
|
54
|
+
if (name === "Section" && stringProp(child.openingElement, "kind") === "list")
|
|
55
|
+
return "Section kind=\"list\"";
|
|
54
56
|
return LONE.has(name) ? name : null;
|
|
55
57
|
};
|
|
56
|
-
/** A table component or a
|
|
58
|
+
/** A table component, a chart or a list standing alone is the surface, never wrapped in a card. */
|
|
57
59
|
export const singleChildCard = defineRule({
|
|
58
60
|
meta: {
|
|
59
61
|
type: "problem",
|
|
60
|
-
docs: { description: "SINGLE-CHILD-CARD: a SurfaceCard with no zones whose only content is a DataTable or a
|
|
62
|
+
docs: { description: "SINGLE-CHILD-CARD: a SurfaceCard with no zones whose only content is a DataTable, a chart or a Section kind=\"list\" is a second frame; a card of key-value or choice rows is valid." },
|
|
61
63
|
schema: [],
|
|
62
64
|
messages: {
|
|
63
|
-
lone: "A {{child}} standing alone is the surface: drop the SurfaceCard, put its title in a `Section` head (`title`) and one line under it in `Section caption`. A card groups two or more different parts, or carries zones (tabs, search, head actions); a card of
|
|
65
|
+
lone: "A {{child}} standing alone is the surface: drop the SurfaceCard, put its title in a `Section` head (`title`) and one line under it in `Section caption`. A list is a flat `Section kind=\"list\"` that titles itself. A card groups two or more different parts, or carries zones (tabs, search, head actions); a card of key-value or choice rows (`kind=\"details\"`, `\"select\"`, `\"table\"`) is valid.",
|
|
64
66
|
},
|
|
65
67
|
},
|
|
66
68
|
create(context) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Rule } from "eslint";
|
|
2
|
+
/**
|
|
3
|
+
* ONE LOOK FOR A LIST (owner, 2026-11-17, LIST-ONE-LOOK). A list is one thing: `Section kind="list"` of `ListRow`s, plain rows on the
|
|
4
|
+
* surface divided by hairlines and aligned with the section title, with no frame, fill, radius or shadow. A list is never a card;
|
|
5
|
+
* cards stay for real objects. The Grammar family 0.43.0 removed `SurfaceCard kind="list"`, so the compiler refuses it where the types
|
|
6
|
+
* are read; this rule says how to fix it where an app still writes it (a pinned older Grammar, a JavaScript file, an `any` prop).
|
|
7
|
+
*
|
|
8
|
+
* WHAT IT READS. In product source, a Grammar `SurfaceCard` (named or `G.SurfaceCard`) whose `kind` is the literal `"list"`.
|
|
9
|
+
*
|
|
10
|
+
* WHAT IT LEAVES ALONE. A `kind` that is not a literal, another source's `SurfaceCard`, and non-product source.
|
|
11
|
+
*
|
|
12
|
+
* NO AUTOFIX. The move is not one rename: `label` becomes `title`, `labelEnd` becomes `action`, the card's zones (`headers`,
|
|
13
|
+
* `footers`) have no list form (a filter or search is the list's `filter`; figures and a list together are a body card holding both),
|
|
14
|
+
* the import changes, and the look changes from a card to flat rows, which the author should see.
|
|
15
|
+
*/
|
|
16
|
+
/** `SurfaceCard kind="list"` is refused: the list is `Section kind="list"`. */
|
|
17
|
+
export declare const surfaceCardList: Rule.RuleModule;
|
|
18
|
+
/** The rules this law contributes to the plugin. */
|
|
19
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
20
|
+
/** Every rule of this law is an error. */
|
|
21
|
+
export declare const recommended: Record<string, "error">;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
2
|
+
import { grammarName, stringProp } from "./lib/grammar-jsx.js";
|
|
3
|
+
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
4
|
+
/**
|
|
5
|
+
* ONE LOOK FOR A LIST (owner, 2026-11-17, LIST-ONE-LOOK). A list is one thing: `Section kind="list"` of `ListRow`s, plain rows on the
|
|
6
|
+
* surface divided by hairlines and aligned with the section title, with no frame, fill, radius or shadow. A list is never a card;
|
|
7
|
+
* cards stay for real objects. The Grammar family 0.43.0 removed `SurfaceCard kind="list"`, so the compiler refuses it where the types
|
|
8
|
+
* are read; this rule says how to fix it where an app still writes it (a pinned older Grammar, a JavaScript file, an `any` prop).
|
|
9
|
+
*
|
|
10
|
+
* WHAT IT READS. In product source, a Grammar `SurfaceCard` (named or `G.SurfaceCard`) whose `kind` is the literal `"list"`.
|
|
11
|
+
*
|
|
12
|
+
* WHAT IT LEAVES ALONE. A `kind` that is not a literal, another source's `SurfaceCard`, and non-product source.
|
|
13
|
+
*
|
|
14
|
+
* NO AUTOFIX. The move is not one rename: `label` becomes `title`, `labelEnd` becomes `action`, the card's zones (`headers`,
|
|
15
|
+
* `footers`) have no list form (a filter or search is the list's `filter`; figures and a list together are a body card holding both),
|
|
16
|
+
* the import changes, and the look changes from a card to flat rows, which the author should see.
|
|
17
|
+
*/
|
|
18
|
+
/** `SurfaceCard kind="list"` is refused: the list is `Section kind="list"`. */
|
|
19
|
+
export const surfaceCardList = defineRule({
|
|
20
|
+
meta: {
|
|
21
|
+
type: "problem",
|
|
22
|
+
docs: { description: "LIST-ONE-LOOK: a list is `Section kind=\"list\"` with `ListRow` rows, never `SurfaceCard kind=\"list\"` (removed in the Grammar family 0.43.0)." },
|
|
23
|
+
schema: [],
|
|
24
|
+
messages: {
|
|
25
|
+
list: "`SurfaceCard kind=\"list\"` is removed: a list is never a card. Use `<Section kind=\"list\" title=\"…\" items={rows} empty={…} />` with `ListRow` rows (flat rows divided by hairlines, aligned with the title): `label` becomes `title`, `labelEnd` becomes `action`, a filter or search goes in the list's `filter`, and `layout=\"keyValue\" | \"suggestions\"` stays on the Section.",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
create(context) {
|
|
29
|
+
if (!isProductSource(context))
|
|
30
|
+
return {};
|
|
31
|
+
return {
|
|
32
|
+
JSXOpeningElement(opening) {
|
|
33
|
+
if (grammarName(context, opening) !== "SurfaceCard")
|
|
34
|
+
return;
|
|
35
|
+
if (stringProp(opening, "kind") !== "list")
|
|
36
|
+
return;
|
|
37
|
+
context.report({ node: opening, messageId: "list" });
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
/** The rules this law contributes to the plugin. */
|
|
43
|
+
export const rules = {
|
|
44
|
+
"surface-card-list": surfaceCardList,
|
|
45
|
+
};
|
|
46
|
+
defineFamilyRules(rules, "knowledge/ui/presentation/grammar-laws.yaml#LIST-ONE-LOOK");
|
|
47
|
+
/** Every rule of this law is an error. */
|
|
48
|
+
export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
|
package/dist/surface-card.js
CHANGED
|
@@ -7,7 +7,7 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
|
7
7
|
*
|
|
8
8
|
* R355. A card of the default `body` kind holds copy and controls. It does not hold the things a kind draws for it: a
|
|
9
9
|
* hand-built list (`ul`, `ol`, `li`), a divider, a `SectionHeader` or a `Heading` standing as a second title (the card has a
|
|
10
|
-
* `label`)
|
|
10
|
+
* `label`). Rows are a `Section kind="list"` (a list is never a card), key figures
|
|
11
11
|
* `kind="figures"`, bands divided by seams are the typed `headers` and `footers` zones.
|
|
12
12
|
*
|
|
13
13
|
* R355 (zones). A `custom` zone of a card (`headers` or `footers`) holds no `Tabs`, `SearchField` or `Divider`: filter and search are
|
|
@@ -161,7 +161,7 @@ export const surfaceCardKind = defineRule({
|
|
|
161
161
|
docs: { description: "R355: a SurfaceCard of the body kind holds no hand list, no Divider and no SectionHeader or Heading." },
|
|
162
162
|
schema: [],
|
|
163
163
|
messages: {
|
|
164
|
-
list: "`<{{element}}>` is a hand-built list in a `body` card. Rows are `<Section kind=\"list\" items={...} empty={...} />` (
|
|
164
|
+
list: "`<{{element}}>` is a hand-built list in a `body` card. Rows are `<Section kind=\"list\" items={...} empty={...} />` (its `filter` holds a filter or search), which draws every row the same way, flat.",
|
|
165
165
|
divider: "A `Divider` in a card is refused: the card draws its own seams. Bands divided by a line are the typed `headers` and `footers` zones: `<SurfaceCard headers={[{ kind: \"figures\", items }]} />`.",
|
|
166
166
|
zone: "`<{{element}}>` stands in a `custom` zone of a card. Filter and search are the typed zones (`{ kind: \"filter\" | \"search\" | \"toolbar\" }`) and the card draws its own seams, so a `custom` zone holds no `Tabs`, `SearchField` or `Divider`.",
|
|
167
167
|
title: "`<{{element}}>` stands as a second title inside a card. The card has a `label` (and `fact`, `labelEnd`, `note`); a sub-section of one subject is a typed header or footer zone.",
|
|
@@ -209,7 +209,7 @@ export const noLabelInGrid = defineRule({
|
|
|
209
209
|
docs: { description: "R366: a labelled SurfaceCard repeated in a Grid kind=\"cards\" is a tile: it names itself inside." },
|
|
210
210
|
schema: [],
|
|
211
211
|
messages: {
|
|
212
|
-
tile: "A card with a `label` repeated in a `Grid kind=\"cards\"`: the label sits outside the material, so the grid reads as headings over boxes. A peer you recognise and open is `<SurfaceCard kind=\"tile\" name mark description badge action />`, named inside beside its mark. Comparing a fact across peers is a `kind=\"list\"` card.",
|
|
212
|
+
tile: "A card with a `label` repeated in a `Grid kind=\"cards\"`: the label sits outside the material, so the grid reads as headings over boxes. A peer you recognise and open is `<SurfaceCard kind=\"tile\" name mark description badge action />`, named inside beside its mark. Comparing a fact across peers is a `Section kind=\"list\"` or a `kind=\"table\"` card.",
|
|
213
213
|
},
|
|
214
214
|
},
|
|
215
215
|
create(context) {
|
|
@@ -2,10 +2,9 @@ import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
|
2
2
|
import { elementNameOf, grammarName, nameOf, renderedChildren, stringProp } from "./lib/grammar-jsx.js";
|
|
3
3
|
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
4
4
|
/**
|
|
5
|
-
* The row list law (owner, 2026-11-09, SURFACE-IN-SURFACE): rows divided by lines that stand
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* reach is a hand-made row list, which has no edge, no radius and no clip.
|
|
5
|
+
* The row list law (owner, 2026-11-09, SURFACE-IN-SURFACE; one look 0.43.0, LIST-ONE-LOOK): rows divided by lines that stand
|
|
6
|
+
* inside a surface are the Grammar list, `Section kind="list"`, the same flat rows divided by hairlines wherever it stands (a card
|
|
7
|
+
* body, a drawer, a dialog, a pane band or a rail). The bare form an app can still reach is a hand-made row list.
|
|
9
8
|
*
|
|
10
9
|
* WHAT IT READS. A `Stack` (Grammar), `ul`, `ol` or `div` whose rendered children (looked through fragments,
|
|
11
10
|
* `cond && <x/>` and `.map`) include a Grammar `Divider` between other children, inside a `SurfaceCard`, `Drawer`,
|
|
@@ -54,10 +53,10 @@ const enclosingSurface = (context, node) => {
|
|
|
54
53
|
export const surfaceInSurface = defineRule({
|
|
55
54
|
meta: {
|
|
56
55
|
type: "problem",
|
|
57
|
-
docs: { description: "SURFACE-IN-SURFACE: a row list divided by Dividers inside a card, drawer, dialog, pane band or rail is a Section kind=list
|
|
56
|
+
docs: { description: "SURFACE-IN-SURFACE: a row list divided by Dividers inside a card, drawer, dialog, pane band or rail is a Section kind=list." },
|
|
58
57
|
schema: [],
|
|
59
58
|
messages: {
|
|
60
|
-
handMade: "This `{{element}}` is a hand-made row list inside {{host}}: its rows are divided by `Divider` elements
|
|
59
|
+
handMade: "This `{{element}}` is a hand-made row list inside {{host}}: its rows are divided by `Divider` elements by hand. Use `<Section kind=\"list\">` with `ListRow` rows: the Grammar draws one list wherever it stands, flat rows divided by hairlines and aligned with the title (a card around a lone list is refused by `single-child-card`).",
|
|
61
60
|
},
|
|
62
61
|
},
|
|
63
62
|
create(context) {
|
package/dist/table-cell-type.js
CHANGED
|
@@ -9,8 +9,8 @@ import { attributeOf, descendants, elementOf, grammarBindings, isListRow, keyNam
|
|
|
9
9
|
* WHAT IT READS.
|
|
10
10
|
* - the function a `DataTable` takes as `renderCell` (inline, or a function or arrow declared by name in the file), and the
|
|
11
11
|
* `editor` function of a column object in its `columns` literal;
|
|
12
|
-
* - the `title` and `description` of a ListRow data object: a row of the `items` of a
|
|
13
|
-
*
|
|
12
|
+
* - the `title` and `description` of a ListRow data object: a row of the `items` of a `Section` written
|
|
13
|
+
* `kind="list"`, through `.map` callbacks, or the `row` of a `<ListRow>`.
|
|
14
14
|
* In those, a `Text` whose literal `size` is not `xs`, `sm` or `md`, any `Heading`, any `Label` and the tags `h1`-`h6` are findings. A row list declared elsewhere
|
|
15
15
|
* and passed by name is not followed.
|
|
16
16
|
*/
|
package/docs/card-content.md
CHANGED
|
@@ -26,7 +26,7 @@ Every rule below is an error in `coreGrammarConfig`; none can be switched off or
|
|
|
26
26
|
**Valid**
|
|
27
27
|
|
|
28
28
|
```tsx
|
|
29
|
-
<Sublabel>Lines</Sublabel><SurfaceCard kind="
|
|
29
|
+
<Sublabel>Lines</Sublabel><SurfaceCard kind="table" label="Lines" columns={columns} rows={lines} empty="-" />
|
|
30
30
|
<Sublabel>Facts</Sublabel><SurfaceCard kind="details" label="Facts" items={facts} />
|
|
31
31
|
<Section title="Runs" caption="Everyone on the team">...</Section>
|
|
32
32
|
```
|
package/docs/choice-controls.md
CHANGED
|
@@ -30,7 +30,7 @@ Finding code: `FE_GROUPED_CHOICE_CONTROL` (R380). Two or more adjacent `Button`
|
|
|
30
30
|
**Valid**
|
|
31
31
|
|
|
32
32
|
```tsx
|
|
33
|
-
<SurfaceCard kind="
|
|
33
|
+
<SurfaceCard kind="table" label="Cash" columns={columns} headers={[{ kind: "filter", label: "Period", items, selectedKey: period, onSelect: setPeriod }]} rows={rows} empty={empty} />
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
## `starci-grammar/no-primary-tabs-misuse`
|
package/docs/message-surfaces.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Law module: `message-surfaces.ts`. Finding code: `FE_MESSAGE_SURFACES`. Knowledge: `knowledge/ui/presentation/grammar-laws.yaml#MESSAGE-SURFACES`. Grammar laws: `DNA-COMMON-CHAT-SURFACES` (0.37.31), `DNA-COMMON-CHAT-FRAME` (0.37.33).
|
|
4
4
|
|
|
5
|
-
Every chat (team chat, an agent's chat, an inbox thread, the assistant) draws the same three faces, and they belong to the Grammar: the thread is the page tone (`--background`; a `PaneSection scroll role="log"` paints it whatever `tone` says), a message of someone else (`MessageBubble` incoming, `MessageCard`) is the flat `--surface` with no border and no shadow, and the reader's own message is `--accent` with `--accent-foreground`. The replies a message card offers are `
|
|
5
|
+
Every chat (team chat, an agent's chat, an inbox thread, the assistant) draws the same three faces, and they belong to the Grammar: the thread is the page tone (`--background`; a `PaneSection scroll role="log"` paints it whatever `tone` says), a message of someone else (`MessageBubble` incoming, `MessageCard`) is the flat `--surface` with no border and no shadow, and the reader's own message is `--accent` with `--accent-foreground`. The replies a message card offers are `Section kind="list" layout="suggestions"` (one flat list, a pressable plain-text row per reply with a chevron); the pills by the composer stay `Button size="sm"` (`suggestion-buttons`).
|
|
6
6
|
|
|
7
7
|
A chat is one frame on any page (0.37.33): its head, its thread and its composer footer are `--background`, whether it stands in a white pane, the aside, a drawer, a dialog or a popover; the rest of the page keeps its own rule. The frame is a `Pane content="chat"` (a pane whose own stack holds a thread is drawn as one too); the app gives it no tone, and a message in it is flat (no border, no shadow).
|
|
8
8
|
|
|
@@ -33,5 +33,5 @@ A spread, a computed class and a tone held in a variable are not read; a thread
|
|
|
33
33
|
```tsx
|
|
34
34
|
<Pane area="room" content="chat" label="Room" footer={composer}>{head}{thread}</Pane>
|
|
35
35
|
<PaneSection scroll={{ label: "Thread", role: "log", align: "end" }}>{thread}</PaneSection>
|
|
36
|
-
<MessageCard title="Workflow paused" body={<
|
|
36
|
+
<MessageCard title="Workflow paused" body={<Section kind="list" layout="suggestions" ariaLabel="Suggestions" empty={null} items={replies} />} />
|
|
37
37
|
```
|
package/docs/rows-in-card.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Key-value and disclosure rows stand in a card or a section
|
|
2
2
|
|
|
3
3
|
Law module: `rows-in-card.ts`. Finding code: `FE_ROWS_IN_CARD`. Knowledge: `knowledge/ui/presentation/grammar-laws.yaml#ROWS-IN-CARD`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Key-value rows (`DescriptionList`) and disclosure rows (`DisclosureList`) stand in a `SurfaceCard` or a `Section`. In a card they take the card's edge: on the pink well a shadow and no border, on a white surface (aside, pane, drawer) a 1px border and no shadow, which Grammar draws itself. A plain list of rows is a flat `Section kind="list"` (LIST-ONE-LOOK, `surface-card-list`).
|
|
6
6
|
|
|
7
7
|
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# A lone DataTable or
|
|
1
|
+
# A lone DataTable, chart or list is the surface, never a card
|
|
2
2
|
|
|
3
3
|
Law module: `single-child-card.ts`. Knowledge: `knowledge/ui/presentation/grammar-laws.yaml#SINGLE-CHILD-CARD`. Finding code: `FE_SINGLE_CHILD_CARD`.
|
|
4
4
|
|
|
5
|
-
A card (`SurfaceCard`) groups two or more different parts (figures + list + actions), or carries zones (tabs, search, head actions). A card of
|
|
5
|
+
A card (`SurfaceCard`) groups two or more different parts (figures + list + actions), or carries zones (tabs, search, head actions). A card of key-value or choice rows (`kind="table"`, `kind="select"`, `kind="details"`, a `ListBox`, `DisclosureList`, `Timeline`, a `DescriptionList`) is valid alone or not (0.37.8). A standalone `DataTable` (`surface="card"`) or chart IS the surface: its title sits above it as a `Section` head and one line under it as `Section caption`, so a card around it is a second card. A list is a flat `Section kind="list"` that titles itself (0.43.0, LIST-ONE-LOOK), so a card around a lone list is refused the same way.
|
|
6
6
|
|
|
7
7
|
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
8
8
|
|
|
@@ -12,21 +12,23 @@ A Grammar `SurfaceCard` is refused when it has no zones (no `headers` or `footer
|
|
|
12
12
|
|
|
13
13
|
- table: `DataTable`
|
|
14
14
|
- chart: `BarChart`, `ProportionBar`, `BubbleMap`, `FlowGraph`, `MermaidDiagram`
|
|
15
|
+
- list: `Section kind="list"`
|
|
15
16
|
|
|
16
|
-
Not flagged: any
|
|
17
|
+
Not flagged: any key-value or choice card (`kind="table"`, `kind="select"`, `ListBox`, `DisclosureList`, `Timeline`, `DescriptionList`), a card with two or more body children, a card with zones or `labelEnd`, a card with a JSX spread, `kind` `figures`, `details`, `accordion` or `tile`, a non-Grammar `SurfaceCard`, and non-product source. `Meter` and `Progress` are single values, not charts.
|
|
17
18
|
|
|
18
19
|
**Invalid**
|
|
19
20
|
|
|
20
21
|
```tsx
|
|
21
22
|
<SurfaceCard label="Runs"><DataTable columns={columns} rows={runs} /></SurfaceCard>
|
|
22
23
|
<SurfaceCard label="Usage"><BarChart data={usage} /></SurfaceCard>
|
|
24
|
+
<SurfaceCard label="Runs"><Section kind="list" ariaLabel="Runs" items={runs} empty={null} /></SurfaceCard>
|
|
23
25
|
```
|
|
24
26
|
|
|
25
27
|
**Valid**
|
|
26
28
|
|
|
27
29
|
```tsx
|
|
28
30
|
<Section title="Runs" caption="Last 30 days"><DataTable columns={columns} rows={runs} /></Section>
|
|
29
|
-
<
|
|
31
|
+
<Section kind="list" title="Runs" items={runs} empty={null} />
|
|
30
32
|
<SurfaceCard label="Runs"><ListBox items={runs} /></SurfaceCard>
|
|
31
33
|
<SurfaceCard label="Runs" headers={[{ kind: "search", /* ... */ }]}><DataTable columns={columns} rows={runs} /></SurfaceCard>
|
|
32
34
|
<SurfaceCard label="Runs"><Text>3 failed</Text><DataTable columns={columns} rows={runs} /></SurfaceCard>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# A list is one thing, never a card
|
|
2
|
+
|
|
3
|
+
Law module: `surface-card-list.ts`. Finding code: `FE_SURFACE_CARD_LIST`. Knowledge: `knowledge/ui/presentation/grammar-laws.yaml#LIST-ONE-LOOK`.
|
|
4
|
+
|
|
5
|
+
A list is `Section kind="list"` of `ListRow`s wherever it stands (the page canvas, a card body, a drawer, a pane band, a rail): plain rows
|
|
6
|
+
on the surface, divided by hairlines, the rows aligned with the section title, with no frame, fill, radius or shadow. A list is never a
|
|
7
|
+
card; cards stay for real objects. The Grammar family 0.43.0 removed `SurfaceCard kind="list"`, so the compiler refuses it where the
|
|
8
|
+
types are read; this rule names the fix where an app still writes it.
|
|
9
|
+
|
|
10
|
+
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
11
|
+
|
|
12
|
+
## `starci-grammar/surface-card-list`
|
|
13
|
+
|
|
14
|
+
A Grammar `SurfaceCard` whose `kind` is the literal `"list"` (message `list`). A `kind` that is not a literal is left to the compiler.
|
|
15
|
+
|
|
16
|
+
There is no autofix: `label` becomes `title` and `labelEnd` becomes `action`, the card's zones have no list form (a filter or search
|
|
17
|
+
is the list's `filter`; figures and a list together are a body card holding both), the import changes, and the look changes from a
|
|
18
|
+
card to flat rows.
|
|
19
|
+
|
|
20
|
+
**Invalid**
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
<SurfaceCard kind="list" label="Runs" labelEnd={<Link variant="head" href="/runs">View all</Link>} items={runs} empty={empty} />
|
|
24
|
+
<MessageCard title="Workflow paused" body={<SurfaceCard kind="list" layout="suggestions" ariaLabel="Replies" items={replies} empty={null} />} />
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Valid**
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
<Section kind="list" title="Runs" action={<Link variant="head" href="/runs">View all</Link>} items={runs} empty={empty} />
|
|
31
|
+
<MessageCard title="Workflow paused" body={<Section kind="list" layout="suggestions" ariaLabel="Replies" items={replies} empty={null} />} />
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Rule ownership: [FE-RULE-OWNERSHIP](../../../contexts/code/fe/README.md#the-placement-test-fe-rule-ownership).
|
package/docs/surface-card.md
CHANGED
|
@@ -31,14 +31,14 @@ its own seams. Grammar also refuses them at run time in development.
|
|
|
31
31
|
**Valid** (`src/components/blocks/Runs/component.tsx`)
|
|
32
32
|
|
|
33
33
|
```tsx
|
|
34
|
-
<
|
|
34
|
+
<Section kind="list" title="Runs" items={runs.map((run) => ({ id: run.id, title: run.name }))} empty={empty} />
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## `starci-grammar/no-label-in-grid`
|
|
38
38
|
|
|
39
39
|
Finding code: `FE_LABEL_IN_GRID` (R366). A `SurfaceCard` with a `label` repeated in a `Grid kind="cards"` (two or more as
|
|
40
40
|
direct children, or one written in a `.map`) is refused. A peer you recognise and open is a tile, named inside beside its
|
|
41
|
-
mark; comparing a fact across peers is one `kind="list"` card.
|
|
41
|
+
mark; comparing a fact across peers is one `Section kind="list"` or a `kind="table"` card.
|
|
42
42
|
|
|
43
43
|
**Invalid** (`src/components/blocks/Connectors/component.tsx`)
|
|
44
44
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# A list of rows inside a surface is
|
|
1
|
+
# A list of rows inside a surface is the Grammar list
|
|
2
2
|
|
|
3
3
|
Law module: `surface-in-surface.ts`. Knowledge: `knowledge/ui/presentation/grammar-laws.yaml#SURFACE-IN-SURFACE`. Finding code: `FE_SURFACE_IN_SURFACE`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Rows inside a card body, a drawer, a dialog, a pane band or a rail are a `Section kind="list"`, drawn as everywhere else: flat rows divided by hairlines, aligned with the title (LIST-ONE-LOOK). A hand-made row list is the bare form.
|
|
6
6
|
|
|
7
7
|
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
8
8
|
|
|
@@ -22,7 +22,7 @@ A Grammar `Stack`, or a `ul`, `ol` or `div`, whose rendered children include a G
|
|
|
22
22
|
|
|
23
23
|
```tsx
|
|
24
24
|
<Drawer title="Runs"><Section kind="list" items={runs} /></Drawer>
|
|
25
|
-
<SurfaceCard label="Runs"
|
|
25
|
+
<SurfaceCard label="Runs" headers={[{ kind: "figures", /* ... */ }]}><Section kind="list" ariaLabel="Runs" items={runs} empty={null} /></SurfaceCard>
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
Rule ownership: [FE-RULE-OWNERSHIP](../../../contexts/code/fe/README.md#the-placement-test-fe-rule-ownership).
|
package/docs/table-cell-type.md
CHANGED
|
@@ -11,7 +11,7 @@ Every rule below is an error in `coreGrammarConfig`; none can be switched off or
|
|
|
11
11
|
Inside the places below, a `Text` with a literal `size` other than `xs`, `sm` or `md` (`lg`, `xl`, `figure`), any `Heading`, any `Label` and the tags `h1`-`h6` are findings:
|
|
12
12
|
|
|
13
13
|
- the function a `DataTable` takes as `renderCell` (inline, or a function or arrow declared by name in the file), and the `editor` function of a column object in its `columns` literal;
|
|
14
|
-
- the `title` and `description` of a ListRow data object: a row of the `items` of a
|
|
14
|
+
- the `title` and `description` of a ListRow data object: a row of the `items` of a `Section` written `kind="list"` (also through a `.map` callback), or the `row` of a `<ListRow>`.
|
|
15
15
|
|
|
16
16
|
A row list declared elsewhere and passed by name is not followed. A `figure` Text outside a cell or row (a KPI) is not judged.
|
|
17
17
|
|
package/docs/tabs.md
CHANGED
|
@@ -20,7 +20,7 @@ Finding code: `FE_TABS_SWITCH_ZONE`. A `<Tabs appearance="primary">` written in
|
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
22
|
<SurfaceCard kind="select" label="Agent" selectionMode="multiple" items={[{ id: "send", title: "Send", control: <Tabs appearance="primary" label="Send" items={modes} selectedKey={mode} onSelect={setMode} /> }]} value={value} onChange={setValue} />
|
|
23
|
-
<SurfaceCard kind="
|
|
23
|
+
<SurfaceCard kind="table" label="Cash" columns={columns} headers={[{ kind: "switch", label: "Period", items: periods, selectedKey: period, onSelect: setPeriod }]} rows={rows} empty={empty} />
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## `starci-grammar/tabs-depth`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starci/eslint-grammar-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
4
4
|
"description": "ESLint rules for the core Grammar's component, token and composition contracts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -68,6 +68,6 @@
|
|
|
68
68
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
69
69
|
"typescript": "^6.0.3"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
72
|
-
"starciSource": "
|
|
71
|
+
"gitHead": "c9bb95c1298a59fb792353ee5ca6a07dc778e78c",
|
|
72
|
+
"starciSource": "599190fea30dc2d1448254b2a3fd46438b45c9647d805acc949b696979c57cec"
|
|
73
73
|
}
|
|
@@ -22,14 +22,24 @@ rules:
|
|
|
22
22
|
assert: |-
|
|
23
23
|
The child's gap role is at least one step below its parent's (identity 4 < inline 8 < row 12 < section 24 <
|
|
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: LIST-ONE-LOOK
|
|
26
|
+
title: A list is one thing, flat rows on the surface, never a card
|
|
27
|
+
governs: Every list of rows, on the page canvas, in a card body, a drawer, a dialog, a pane band or a rail (owner, 2026-11-17).
|
|
28
|
+
cases:
|
|
29
|
+
- id: case-1
|
|
30
|
+
when: Rows of peers are listed (a worklist, a collection, the facts of a record as key-value rows, the replies a message card offers)
|
|
31
|
+
assert: |-
|
|
32
|
+
They are `Section kind="list"` of `ListRow`s: plain rows on the surface, divided by hairlines, the rows aligned with the section
|
|
33
|
+
title, with no frame, fill, radius or shadow, by default and with no theme hook. A list is never a card: `SurfaceCard` has no
|
|
34
|
+
`list` kind (removed in the Grammar family 0.43.0) and `SurfaceCard kind="list"` is refused. Cards stay for real objects.
|
|
25
35
|
- id: SURFACE-IN-SURFACE
|
|
26
|
-
title: A list of rows inside a surface is
|
|
36
|
+
title: A list of rows inside a surface is the Grammar list
|
|
27
37
|
governs: Row lists placed inside a card body, a drawer, a dialog or a pane band.
|
|
28
38
|
cases:
|
|
29
39
|
- id: case-1
|
|
30
|
-
when: Rows divided by lines stand inside a surface
|
|
40
|
+
when: Rows divided by lines stand inside a surface
|
|
31
41
|
assert: |-
|
|
32
|
-
|
|
42
|
+
They are a `Section kind="list"`, drawn flat as everywhere else (LIST-ONE-LOOK).
|
|
33
43
|
A hand-made row list (blocks divided by Divider) is the bare form and is refused.
|
|
34
44
|
- id: FIELD-LABEL
|
|
35
45
|
title: A control is labelled by its own label prop
|
|
@@ -90,7 +100,7 @@ rules:
|
|
|
90
100
|
- id: case-2
|
|
91
101
|
when: A message card offers replies to send
|
|
92
102
|
assert: |-
|
|
93
|
-
They are one
|
|
103
|
+
They are one flat list, `Section kind="list" layout="suggestions"`, a plain-text row per reply whose whole
|
|
94
104
|
row sends it, with a trailing chevron; the suggestion pills by the composer stay `Button size="sm"`.
|
|
95
105
|
- id: case-3
|
|
96
106
|
when: A chat is drawn on any page (the chat page, an inbox thread between a list and an aside, an agent's chat tab, an aside or a drawer)
|
|
@@ -170,14 +180,14 @@ rules:
|
|
|
170
180
|
It is HeroUI v3's link: the primary colour, the underline on hover only, the anchor icon at the end. Its type size and leading are
|
|
171
181
|
inherited (14 in a body, 12 in meta or caption text). A size prop, a size class and an underline or decoration class are refused.
|
|
172
182
|
- id: ROWS-IN-CARD
|
|
173
|
-
title:
|
|
174
|
-
governs:
|
|
183
|
+
title: Key-value and disclosure rows stand in a card or a section
|
|
184
|
+
governs: Key-value and disclosure rows on the well or on a white surface (a plain list of rows is LIST-ONE-LOOK).
|
|
175
185
|
cases:
|
|
176
186
|
- id: case-1
|
|
177
187
|
when: A DescriptionList or DisclosureList is drawn
|
|
178
188
|
assert: |-
|
|
179
|
-
It stands in a Section or a SurfaceCard
|
|
180
|
-
surface (aside, pane, drawer)
|
|
189
|
+
It stands in a Section or a SurfaceCard; in a card it takes the card's edge, a shadow and no border on the pink well, a 1px border and no
|
|
190
|
+
shadow on a white surface (aside, pane, drawer), which Grammar draws itself. A row primitive with neither around it is refused. ListBox is a navigation list and is not read.
|
|
181
191
|
- id: CARD-NO-DESCRIPTION
|
|
182
192
|
title: A card has no description
|
|
183
193
|
governs: The head of a SurfaceCard and the line above it.
|
|
@@ -186,7 +196,7 @@ rules:
|
|
|
186
196
|
when: A card is drawn with a label
|
|
187
197
|
assert: |-
|
|
188
198
|
The head is the label, a count chip, one fact and one end action; SurfaceCard has no description or subtitle prop. A muted Text written directly above a
|
|
189
|
-
SurfaceCard as its description is refused: the line is a row subtitle (select or list) or, when it explains the card's data, the card note.
|
|
199
|
+
SurfaceCard as its description is refused: the line is a row subtitle (a select card or a Section list) or, when it explains the card's data, the card note.
|
|
190
200
|
- id: LABEL-SUBLABEL-HIERARCHY
|
|
191
201
|
title: One Label per section; nested groups use a Sublabel
|
|
192
202
|
governs: The Label of a Section or SurfaceCard and the Sublabel of the groups inside it.
|
|
@@ -244,15 +254,15 @@ rules:
|
|
|
244
254
|
label, a search field, a button start icon, a link arrow, meta) is a plain outline icon at text size with no tile. A status (done, running, failed, waiting,
|
|
245
255
|
skipped) is a tone-coloured outline icon with no tile: outline check-circle in success, x-circle in danger, a spinning arrow for running.
|
|
246
256
|
- id: SINGLE-CHILD-CARD
|
|
247
|
-
title: A lone DataTable or
|
|
248
|
-
governs: A SurfaceCard whose only content is a DataTable
|
|
257
|
+
title: A lone DataTable, chart or list is the surface, never a card
|
|
258
|
+
governs: A SurfaceCard whose only content is a DataTable, a chart or a Section kind="list" (a key-value or choice card is valid, 0.37.8).
|
|
249
259
|
cases:
|
|
250
260
|
- id: case-1
|
|
251
|
-
when: A card has no zones (headers, footers, head actions) and holds one DataTable
|
|
261
|
+
when: A card has no zones (headers, footers, head actions) and holds one DataTable, chart (BarChart, ProportionBar, BubbleMap, FlowGraph, MermaidDiagram) or Section kind="list"
|
|
252
262
|
assert: |-
|
|
253
263
|
A standalone DataTable and chart is ONE frame (border, card radius), so the card is a second frame. The title sits above as a Section head and one caption
|
|
254
|
-
sits below (Section caption, muted sm)
|
|
255
|
-
DescriptionList) is valid alone or not (0.37.8). A card groups two or more different parts (figures + list + actions), or carries zones (tabs, search, head actions).
|
|
264
|
+
sits below (Section caption, muted sm); a list is a flat Section kind="list" that titles itself (LIST-ONE-LOOK). A card of key-value or choice rows
|
|
265
|
+
(SurfaceCard kind="table", "select", "details", ListBox, DisclosureList, DescriptionList) is valid alone or not (0.37.8). A card groups two or more different parts (figures + list + actions), or carries zones (tabs, search, head actions).
|
|
256
266
|
- id: NO-RAW-SCROLL
|
|
257
267
|
title: Grammar never shows scrollbars
|
|
258
268
|
governs: Scroll areas an app draws.
|