@starci/eslint-grammar-core 0.43.1 → 0.45.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 +17 -0
- package/README.md +4 -2
- package/dist/app-shell.js +30 -10
- package/dist/card-content.js +8 -19
- package/dist/{single-child-card.d.ts → card-is-object.d.ts} +2 -2
- package/dist/card-is-object.js +141 -0
- package/dist/choice-controls.d.ts +1 -1
- package/dist/choice-controls.js +5 -5
- package/dist/data-table-surface.d.ts +18 -0
- package/dist/data-table-surface.js +57 -0
- package/dist/index.js +4 -2
- package/dist/lib/why.js +26 -21
- package/dist/no-card-lead-description.js +3 -3
- package/dist/rows-in-card.d.ts +1 -1
- package/dist/rows-in-card.js +13 -12
- package/dist/surface-card-list.d.ts +1 -2
- package/dist/surface-card-list.js +1 -2
- package/dist/surface-card.d.ts +1 -1
- package/dist/surface-card.js +8 -63
- package/dist/surface-depth.js +1 -1
- package/dist/surface-in-surface.js +1 -1
- package/dist/tabs.d.ts +3 -2
- package/dist/tabs.js +26 -19
- package/docs/app-shell.md +5 -2
- package/docs/card-content.md +5 -6
- package/docs/card-is-object.md +42 -0
- package/docs/choice-controls.md +4 -4
- package/docs/data-table-surface.md +27 -0
- package/docs/layout-two-axis.md +3 -3
- package/docs/no-card-lead-description.md +2 -2
- package/docs/no-nested-label.md +3 -3
- package/docs/rows-in-card.md +5 -4
- package/docs/surface-card-list.md +1 -2
- package/docs/surface-card.md +4 -8
- package/docs/surface-depth.md +6 -7
- package/docs/surface-in-surface.md +2 -2
- package/docs/tabs.md +26 -5
- package/package.json +3 -3
- package/runtime/knowledge/ui/presentation/grammar-laws.yaml +33 -23
- package/dist/single-child-card.js +0 -90
- package/docs/single-child-card.md +0 -37
package/dist/lib/why.js
CHANGED
|
@@ -11,23 +11,23 @@ export const why = {
|
|
|
11
11
|
},
|
|
12
12
|
"tabs-switch-zone": {
|
|
13
13
|
code: "FE_TABS_SWITCH_ZONE",
|
|
14
|
-
en: "A pill (`Tabs appearance=\"primary\"`) is written in JSX in `<file>`, outside the `
|
|
15
|
-
fix: "A mode or period switch of one block is the
|
|
14
|
+
en: "A pill (`Tabs appearance=\"primary\"`) is written in JSX in `<file>`, outside the `action` of a `Section` and not the value of a row `control`.",
|
|
15
|
+
fix: "A mode or period switch of one block is the `action` of its Section: `<Section title action={<Tabs appearance=\"primary\" label items selectedKey onSelect />} />` with two to four short options. A row-level mode choice goes in the row's `control`. Views of a page are page tabs (`Page header.tabs`); views or filters inside a region are underline `Tabs`.",
|
|
16
16
|
},
|
|
17
17
|
"tabs-depth": {
|
|
18
18
|
code: "FE_TABS_DEPTH",
|
|
19
19
|
en: "Underline `Tabs` in `<file>` stack past two layers.",
|
|
20
|
-
fix: "A page has the page tabs (`Page header.tabs`) and at most one region set in a tab's panel. Fold a third level into a
|
|
20
|
+
fix: "A page has the page tabs (`Page header.tabs`) and at most one region set in a tab's panel. Fold a third level into a pill in a `Section action`, a `Section filter` row, a list, or a drawer.",
|
|
21
21
|
},
|
|
22
22
|
"tabs-in-well": {
|
|
23
23
|
code: "FE_TABS_IN_WELL",
|
|
24
24
|
en: "An underline `Tabs` in `<file>` is written in the body of a `Page`, `Pane` or `PaneSection`: on the pink well or in a pane.",
|
|
25
|
-
fix: "The second tab layer sits in the white header band under the page tabs: `Page header={{ tabs, subTabs }}`, on its own full-width separator and flush with the band's left inset. Or
|
|
25
|
+
fix: "The second tab layer sits in the white header band under the page tabs: `Page header={{ tabs, subTabs }}`, on its own full-width separator and flush with the band's left inset. Or, to narrow a list or a region, pass `Tabs kind=\"filter\"` in the `filter` row of its `Section`.",
|
|
26
26
|
},
|
|
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: "Key-value and disclosure rows stand in a `
|
|
30
|
+
fix: "Key-value and disclosure rows stand flat in a `Section` (`<Section title ...><DescriptionList isDivided items={...} /></Section>`) or, as the facts of ONE object, in the body of that object's `SurfaceCard`; a plain list of rows is `Section kind=\"list\"`, flat.",
|
|
31
31
|
},
|
|
32
32
|
"surface-card-list": {
|
|
33
33
|
code: "FE_SURFACE_CARD_LIST",
|
|
@@ -37,7 +37,7 @@ export const why = {
|
|
|
37
37
|
"no-card-lead-description": {
|
|
38
38
|
code: "FE_NO_CARD_LEAD_DESCRIPTION",
|
|
39
39
|
en: "A muted `Text` in `<file>` stands directly above a `SurfaceCard` as its description.",
|
|
40
|
-
fix: "A card has no description. Put the line in the row subtitle (
|
|
40
|
+
fix: "A card has no description. Put the line in the row subtitle (a `ListRow` subtitle of a `Section kind=\"list\"`, or an option `description` of a `RadioGroup`), or, when it explains the card's data (a legend, a source, a period), in the card `note`.",
|
|
41
41
|
},
|
|
42
42
|
"no-nested-label": {
|
|
43
43
|
code: "FE_NO_NESTED_LABEL",
|
|
@@ -56,8 +56,8 @@ export const why = {
|
|
|
56
56
|
},
|
|
57
57
|
"card-one-content": {
|
|
58
58
|
code: "FE_CARD_ONE_CONTENT",
|
|
59
|
-
en: "A `SurfaceCard` in `<file>` holds more than one content,
|
|
60
|
-
fix: "A card
|
|
59
|
+
en: "A `SurfaceCard` in `<file>` holds more than one content (a list, facts, a table, a graph, a form).",
|
|
60
|
+
fix: "A card is ONE object. A second list, table, form or graph is not part of it: put each flat in its own `Section` (a ribbon is `Section kind=\"figures\"`); items of the same kind stay in one list.",
|
|
61
61
|
},
|
|
62
62
|
"no-label-description": {
|
|
63
63
|
code: "FE_NO_LABEL_DESCRIPTION",
|
|
@@ -76,13 +76,13 @@ export const why = {
|
|
|
76
76
|
},
|
|
77
77
|
"no-primary-tabs-misuse": {
|
|
78
78
|
code: "FE_GROUPED_CHOICE_CONTROL",
|
|
79
|
-
en: "Primary `Tabs` (or a `
|
|
79
|
+
en: "Primary `Tabs` (a `Section action` or a row `control`) in `<file>` hold a count, an href, an attention mark, one item or more than four items.",
|
|
80
80
|
fix: "Primary tabs switch a mode or period of the same data among two to four short, fixed options. Views, filters with counts and destinations are the secondary (underline) `Tabs`.",
|
|
81
81
|
},
|
|
82
82
|
"no-button-view-switch": {
|
|
83
83
|
code: "FE_GROUPED_CHOICE_CONTROL",
|
|
84
84
|
en: "Buttons carrying `aria-pressed`, `isSelected` or `isActive` stand side by side in `<file>`: joined buttons or pills acting as tabs.",
|
|
85
|
-
fix: "Switching between views or periods of one block is `Tabs` (the primary underline) in the block's `
|
|
85
|
+
fix: "Switching between views or periods of one block is `Tabs` (the primary underline) in the `filter` row of the block's `Section`, or a pill (`Tabs appearance=\"primary\"`) in its `action`; choosing a form value is `ChoiceChips` or `RadioGroup`; a `Button` holds a command, never a selection state.",
|
|
86
86
|
},
|
|
87
87
|
"no-grouped-choice-controls": {
|
|
88
88
|
code: "FE_GROUPED_CHOICE_CONTROL",
|
|
@@ -117,7 +117,7 @@ export const why = {
|
|
|
117
117
|
"navbar-control-size": {
|
|
118
118
|
code: "FE_NAVBAR_CONTROL_SIZE",
|
|
119
119
|
en: "A navbar control does not use Grammar's shared control height.",
|
|
120
|
-
fix: "
|
|
120
|
+
fix: "Give every visible bar control the shared height: Button and IconButton at md (the default), Switch kind=\"toggle\" (never compact), the other controls size=\"control\".",
|
|
121
121
|
},
|
|
122
122
|
"no-navbar-create": {
|
|
123
123
|
code: "FE_NAVBAR_CREATE",
|
|
@@ -192,12 +192,12 @@ export const why = {
|
|
|
192
192
|
"no-label-in-grid": {
|
|
193
193
|
code: "FE_LABEL_IN_GRID",
|
|
194
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.",
|
|
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 `
|
|
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 `Section` holding a `DataTable`.",
|
|
196
196
|
},
|
|
197
197
|
"no-raised-surface-in-surface": {
|
|
198
198
|
code: "FE_RAISED_SURFACE_IN_SURFACE",
|
|
199
199
|
en: "A `SurfaceCard` in `<file>` stands inside another SurfaceCard: a card never stands inside a card (a Pane surface, Dialog, Drawer or Popover hosts cards, bordered, since 0.37.5).",
|
|
200
|
-
fix: "Give the content to the outer card's own body
|
|
200
|
+
fix: "Give the content to the outer card's own body; a list, a table or figures inside it stand flat in a `Section` (`Section kind=\"list\"`, `Section kind=\"figures\"`).",
|
|
201
201
|
},
|
|
202
202
|
"no-shell-bottom-tabs": {
|
|
203
203
|
code: "FE_APP_SHELL_BOTTOM_TABS",
|
|
@@ -207,17 +207,22 @@ export const why = {
|
|
|
207
207
|
"surface-in-surface": {
|
|
208
208
|
code: "FE_SURFACE_IN_SURFACE",
|
|
209
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.",
|
|
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 `
|
|
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 `card-is-object`).",
|
|
211
211
|
},
|
|
212
|
-
"
|
|
213
|
-
code: "
|
|
214
|
-
en: "A `SurfaceCard` in `<file>`
|
|
215
|
-
fix: "Drop the card
|
|
212
|
+
"card-is-object": {
|
|
213
|
+
code: "FE_CARD_IS_OBJECT",
|
|
214
|
+
en: "A `SurfaceCard` in `<file>` holds only a collection, a form or a placeholder (a `DataTable`, a `Section`, a `DescriptionList`, a `DisclosureList`, a `Form` or a lone field, an `EmptyNotice`, `Markdown`, a chart): a card is one object.",
|
|
215
|
+
fix: "Drop the card and stand the content flat: a table is `<Section title ...><DataTable .../></Section>`, a list `Section kind=\"list\"`, facts `<Section title ...><DescriptionList isDivided items={...} /></Section>`, disclosures `<Section title ...><DisclosureList .../></Section>`, a form or field `<Section title ...><Form .../></Section>`, an empty state an `EmptyNotice` on its own, markdown or a chart a `Section`. A card keeps an object's name and facts beside a control; a sign-in form with no page around it keeps `measure=\"formCompact\"`.",
|
|
216
|
+
},
|
|
217
|
+
"data-table-surface": {
|
|
218
|
+
code: "FE_DATA_TABLE_SURFACE",
|
|
219
|
+
en: "A `DataTable` in `<file>` carries a `surface` prop: it was removed in the Grammar family 0.45.0, a table has one flat look.",
|
|
220
|
+
fix: "Delete the `surface` attribute (the rule fixes it in place) and put the table under its `Section`: `<Section title ...><DataTable .../></Section>`.",
|
|
216
221
|
},
|
|
217
222
|
"surface-card-kind": {
|
|
218
223
|
code: "FE_SURFACE_CARD_KIND",
|
|
219
|
-
en: "A `body` SurfaceCard in `<file>` holds a hand-built list, a Divider, a SectionHeader or Heading as a second title
|
|
220
|
-
fix: "Rows are a `Section kind=\"list\"` (never a card), key figures `kind=\"figures\"`,
|
|
224
|
+
en: "A `body` SurfaceCard in `<file>` holds a hand-built list, a Divider, or a SectionHeader or Heading as a second title.",
|
|
225
|
+
fix: "Rows are a `Section kind=\"list\"` (never a card), key figures `Section kind=\"figures\"`, a band of commands at the card's foot is `actions`, a filter or search row the `filter` of a `Section`; the card's title is its `label`, a second subject its own `Section`.",
|
|
221
226
|
},
|
|
222
227
|
"status-text-uses-soft-foreground": {
|
|
223
228
|
code: "FE_STYLE_TOKEN_ONLY",
|
|
@@ -262,7 +267,7 @@ export const why = {
|
|
|
262
267
|
"message-surfaces": {
|
|
263
268
|
code: "FE_MESSAGE_SURFACES",
|
|
264
269
|
en: "`<file>` restyles a chat face: a class or style on MessageBubble or MessageCard, a class string reaching into a Grammar message part, a chat thread asked for the surface tone, or a chat frame (`Pane content=\"chat\"`, a Pane holding a log thread) given `surface`.",
|
|
265
|
-
fix: "Remove the override: the chat frame (head, thread, composer) is `--background` (`Pane content=\"chat\"`, no `surface`, DNA-COMMON-CHAT-FRAME), others' messages the flat `--surface`, your own `--accent` (DNA-COMMON-CHAT-SURFACES); a card's replies are `
|
|
270
|
+
fix: "Remove the override: the chat frame (head, thread, composer) is `--background` (`Pane content=\"chat\"`, no `surface`, DNA-COMMON-CHAT-FRAME), others' messages the flat `--surface`, your own `--accent` (DNA-COMMON-CHAT-SURFACES); a message card's replies are `Section kind=\"list\" layout=\"suggestions\"`.",
|
|
266
271
|
},
|
|
267
272
|
"suggestion-buttons": {
|
|
268
273
|
code: "FE_SUGGESTION_BUTTONS",
|
|
@@ -3,8 +3,8 @@ import { elementNameOf, grammarName, renderedChildren, stringProp } from "./lib/
|
|
|
3
3
|
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
|
-
* 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 (`
|
|
7
|
-
*
|
|
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 (a `ListRow` subtitle of a
|
|
7
|
+
* `Section kind="list"`, or an option `description` of a `RadioGroup`). 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 (`
|
|
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 (a `ListRow` subtitle of a `Section kind=\"list\"`, or an option `description` of a `RadioGroup`) 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.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from "eslint";
|
|
2
|
-
/**
|
|
2
|
+
/** Key-value and disclosure rows stand in a `Section` or in an object card. */
|
|
3
3
|
export declare const rowsInCard: Rule.RuleModule;
|
|
4
4
|
/** The rules this law contributes to the plugin. */
|
|
5
5
|
export declare const rules: Record<string, Rule.RuleModule>;
|
package/dist/rows-in-card.js
CHANGED
|
@@ -2,19 +2,20 @@ import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
|
2
2
|
import { grammarName } from "./lib/grammar-jsx.js";
|
|
3
3
|
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
4
4
|
/**
|
|
5
|
-
* ROWS IN A CARD (
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* ROWS IN A SECTION OR AN OBJECT CARD (ROWS-IN-CARD). Key-value rows (`DescriptionList`) and disclosure rows (`DisclosureList`) stand in a `Section`
|
|
6
|
+
* (the facts or the disclosures of a collection, flat on the surface) or in the body of an object card (a `SurfaceCard` of body kind: the facts of ONE
|
|
7
|
+
* object beside its name or a control). A row primitive written bare, with neither around it, is the repeated bug of rows with no head and no place.
|
|
8
8
|
*
|
|
9
|
-
* WHAT IT READS. In product source, a Grammar `DescriptionList`
|
|
10
|
-
*
|
|
9
|
+
* WHAT IT READS. In product source, a Grammar `DescriptionList` or `DisclosureList` that no `SurfaceCard` or `Section` of the same file encloses. A row
|
|
10
|
+
* primitive passed as a JSX attribute value (`body={<DescriptionList/>}`) is judged where the receiving component draws it.
|
|
11
11
|
*
|
|
12
12
|
* WHAT IT LEAVES ALONE. `ListBox` (a selectable list pane and a menu are navigation, not rows of data: no static signal tells them apart), a row primitive another
|
|
13
|
-
* file wraps (a file whose only job is to return the rows is flagged here: wrap it in the `Section` or card in the same file), and non-product source.
|
|
13
|
+
* file wraps (a file whose only job is to return the rows is flagged here: wrap it in the `Section` or the object card in the same file), and non-product source.
|
|
14
|
+
* A card whose ONLY content is the rows is `card-is-object`.
|
|
14
15
|
*/
|
|
15
16
|
const ROWS = new Set(["DescriptionList", "DisclosureList"]);
|
|
16
|
-
const
|
|
17
|
-
/** True when the element sits inside a Grammar
|
|
17
|
+
const HOSTS = new Set(["SurfaceCard", "Section"]);
|
|
18
|
+
/** True when the element sits inside a Grammar `Section` or `SurfaceCard` of this file, or inside a JSX attribute (the receiver draws it). */
|
|
18
19
|
const isHosted = (context, opening) => {
|
|
19
20
|
let previous = opening;
|
|
20
21
|
for (let current = opening.parent?.parent; current !== undefined && current !== null; previous = current, current = current.parent) {
|
|
@@ -25,19 +26,19 @@ const isHosted = (context, opening) => {
|
|
|
25
26
|
if (previous === current.openingElement)
|
|
26
27
|
continue;
|
|
27
28
|
const name = grammarName(context, current.openingElement);
|
|
28
|
-
if (name !== null &&
|
|
29
|
+
if (name !== null && HOSTS.has(name))
|
|
29
30
|
return true;
|
|
30
31
|
}
|
|
31
32
|
return false;
|
|
32
33
|
};
|
|
33
|
-
/**
|
|
34
|
+
/** Key-value and disclosure rows stand in a `Section` or in an object card. */
|
|
34
35
|
export const rowsInCard = defineRule({
|
|
35
36
|
meta: {
|
|
36
37
|
type: "problem",
|
|
37
|
-
docs: { description: "ROWS-IN-CARD: a DescriptionList or DisclosureList stands in a
|
|
38
|
+
docs: { description: "ROWS-IN-CARD: a DescriptionList or DisclosureList stands in a Section or in the body of an object SurfaceCard." },
|
|
38
39
|
schema: [],
|
|
39
40
|
messages: {
|
|
40
|
-
bare: "A `{{name}}` stands with no card around it. Key-value and disclosure rows stand in a `
|
|
41
|
+
bare: "A `{{name}}` stands with no `Section` or object card around it. Key-value and disclosure rows stand flat in a `Section` (`<Section title ...><DescriptionList isDivided items={...} /></Section>`), or, as the facts of ONE object, in the body of that object's `SurfaceCard`; a plain list of rows is `Section kind=\"list\"`.",
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
create(context) {
|
|
@@ -9,8 +9,7 @@ import type { Rule } from "eslint";
|
|
|
9
9
|
*
|
|
10
10
|
* WHAT IT LEAVES ALONE. A `kind` that is not a literal, another source's `SurfaceCard`, and non-product source.
|
|
11
11
|
*
|
|
12
|
-
* NO AUTOFIX. The move is not one rename: `label` becomes `title`, `labelEnd` becomes `action`,
|
|
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),
|
|
12
|
+
* NO AUTOFIX. The move is not one rename: `label` becomes `title`, `labelEnd` becomes `action`, a card's filter or search is the list's `filter`,
|
|
14
13
|
* the import changes, and the look changes from a card to flat rows, which the author should see.
|
|
15
14
|
*/
|
|
16
15
|
/** `SurfaceCard kind="list"` is refused: the list is `Section kind="list"`. */
|
|
@@ -11,8 +11,7 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
|
11
11
|
*
|
|
12
12
|
* WHAT IT LEAVES ALONE. A `kind` that is not a literal, another source's `SurfaceCard`, and non-product source.
|
|
13
13
|
*
|
|
14
|
-
* NO AUTOFIX. The move is not one rename: `label` becomes `title`, `labelEnd` becomes `action`,
|
|
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),
|
|
14
|
+
* NO AUTOFIX. The move is not one rename: `label` becomes `title`, `labelEnd` becomes `action`, a card's filter or search is the list's `filter`,
|
|
16
15
|
* the import changes, and the look changes from a card to flat rows, which the author should see.
|
|
17
16
|
*/
|
|
18
17
|
/** `SurfaceCard kind="list"` is refused: the list is `Section kind="list"`. */
|
package/dist/surface-card.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from "eslint";
|
|
2
|
-
/** A body card does not hold what a
|
|
2
|
+
/** A body card does not hold what a `Section` draws: hand rows, a divider, a second title. */
|
|
3
3
|
export declare const surfaceCardKind: Rule.RuleModule;
|
|
4
4
|
/** A labelled card repeated in a card grid is a tile. */
|
|
5
5
|
export declare const noLabelInGrid: Rule.RuleModule;
|
package/dist/surface-card.js
CHANGED
|
@@ -5,13 +5,10 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
|
5
5
|
* The card laws (HFS R355 `FE_SURFACE_CARD_KIND`, R366 `FE_LABEL_IN_GRID`): a `SurfaceCard` is one component with a `kind`,
|
|
6
6
|
* and what a kind draws is not drawn by hand around it.
|
|
7
7
|
*
|
|
8
|
-
* R355. A card of the default `body` kind holds copy and controls. It does not hold the things a kind draws for it
|
|
9
|
-
* hand-built list (`ul`, `ol`, `li`), a divider, a `SectionHeader` or a `Heading` standing as a second title
|
|
10
|
-
* `label`). Rows are a `Section kind="list"` (a list is never a card), key figures
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
* R355 (zones). A `custom` zone of a card (`headers` or `footers`) holds no `Tabs`, `SearchField` or `Divider`: filter and search are
|
|
14
|
-
* the typed `filter`, `search` and `toolbar` zones, and the card draws its own seams.
|
|
8
|
+
* R355. A card of the default `body` kind holds copy and controls: one object. It does not hold the things a kind draws for it or a
|
|
9
|
+
* `Section` draws around a collection: a hand-built list (`ul`, `ol`, `li`), a divider, a `SectionHeader` or a `Heading` standing as a second title
|
|
10
|
+
* (the card has a `label`). Rows are a `Section kind="list"` (a list is never a card), key figures `Section kind="figures"`, a filter or search row
|
|
11
|
+
* the `filter` of a `Section`, a band of commands the card's `actions`.
|
|
15
12
|
*
|
|
16
13
|
* R366. A card with a `label` heads a section; a peer you recognise and open is a `kind="tile"` and names itself inside. A
|
|
17
14
|
* labelled card repeated in a `Grid kind="cards"` (two or more, or one written in a `.map`) is a tile drawn with the wrong
|
|
@@ -112,49 +109,7 @@ const HAND_COMPONENTS = new Map([
|
|
|
112
109
|
["SectionHeader", "title"],
|
|
113
110
|
["Heading", "title"],
|
|
114
111
|
]);
|
|
115
|
-
/**
|
|
116
|
-
const ZONE_COMPONENTS = new Set(["Tabs", "SearchField", "Divider"]);
|
|
117
|
-
/** Every JSX element below a node, whatever holds it (an object property, a fragment, a call). */
|
|
118
|
-
const jsxBelow = (node, seen = new Set()) => {
|
|
119
|
-
if (typeof node !== "object" || node === null || seen.has(node))
|
|
120
|
-
return [];
|
|
121
|
-
seen.add(node);
|
|
122
|
-
const found = [];
|
|
123
|
-
if ("type" in node && node.type === "JSXElement")
|
|
124
|
-
found.push(node);
|
|
125
|
-
for (const [key, value] of Object.entries(node)) {
|
|
126
|
-
if (key === "parent" || key === "loc" || key === "range")
|
|
127
|
-
continue;
|
|
128
|
-
if (Array.isArray(value))
|
|
129
|
-
for (const item of value)
|
|
130
|
-
found.push(...jsxBelow(item, seen));
|
|
131
|
-
else
|
|
132
|
-
found.push(...jsxBelow(value, seen));
|
|
133
|
-
}
|
|
134
|
-
return found;
|
|
135
|
-
};
|
|
136
|
-
/** The `children` of every `{ kind: "custom" }` object of a `headers` or `footers` array. */
|
|
137
|
-
const customZoneChildren = (opening) => {
|
|
138
|
-
const zones = [];
|
|
139
|
-
for (const name of ["headers", "footers"]) {
|
|
140
|
-
const value = attributeOf(opening, name)?.value;
|
|
141
|
-
if (value === null || value === undefined || value.type !== "JSXExpressionContainer" || value.expression.type !== "ArrayExpression")
|
|
142
|
-
continue;
|
|
143
|
-
for (const zone of value.expression.elements) {
|
|
144
|
-
if (zone === null || zone.type !== "ObjectExpression")
|
|
145
|
-
continue;
|
|
146
|
-
const props = zone.properties.filter((property) => property.type === "Property" && property.key.type === "Identifier");
|
|
147
|
-
const kind = props.find((property) => property.key.type === "Identifier" && property.key.name === "kind");
|
|
148
|
-
if (kind === undefined || kind.value.type !== "Literal" || kind.value.value !== "custom")
|
|
149
|
-
continue;
|
|
150
|
-
const children = props.find((property) => property.key.type === "Identifier" && property.key.name === "children");
|
|
151
|
-
if (children !== undefined)
|
|
152
|
-
zones.push(children.value);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return zones;
|
|
156
|
-
};
|
|
157
|
-
/** A body card does not hold what a kind draws: hand rows, a divider, a second title; a custom zone holds none of the typed zones' parts. */
|
|
112
|
+
/** A body card does not hold what a `Section` draws: hand rows, a divider, a second title. */
|
|
158
113
|
export const surfaceCardKind = defineRule({
|
|
159
114
|
meta: {
|
|
160
115
|
type: "problem",
|
|
@@ -162,9 +117,8 @@ export const surfaceCardKind = defineRule({
|
|
|
162
117
|
schema: [],
|
|
163
118
|
messages: {
|
|
164
119
|
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
|
-
divider: "A `Divider` in a card is refused: the card draws its own seams.
|
|
166
|
-
|
|
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.",
|
|
120
|
+
divider: "A `Divider` in a card is refused: the card draws its own seams. A band of commands at the card's foot is `actions` (`<SurfaceCard actions={<Button>Pause</Button>} />`); rows divided by a line are a flat `Section kind=\"list\"`.",
|
|
121
|
+
title: "`<{{element}}>` stands as a second title inside a card. The card has a `label` (and `fact`, `labelEnd`, `note`); a second subject is its own `Section` (`<Section title ...>`), flat beside the card.",
|
|
168
122
|
},
|
|
169
123
|
},
|
|
170
124
|
create(context) {
|
|
@@ -174,15 +128,6 @@ export const surfaceCardKind = defineRule({
|
|
|
174
128
|
JSXElement(element) {
|
|
175
129
|
const opening = element.openingElement;
|
|
176
130
|
const component = grammarComponent(context, opening);
|
|
177
|
-
if (component === "SurfaceCard" || component === "Board") {
|
|
178
|
-
for (const content of customZoneChildren(opening)) {
|
|
179
|
-
for (const node of jsxBelow(content)) {
|
|
180
|
-
const inner = grammarComponent(context, node.openingElement);
|
|
181
|
-
if (inner !== null && ZONE_COMPONENTS.has(inner))
|
|
182
|
-
context.report({ node: node.openingElement, messageId: "zone", data: { element: inner } });
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
131
|
if (component === "SurfaceCard" && isBodyCard(opening)) {
|
|
187
132
|
for (const { node } of childElements(element)) {
|
|
188
133
|
const child = node.openingElement;
|
|
@@ -209,7 +154,7 @@ export const noLabelInGrid = defineRule({
|
|
|
209
154
|
docs: { description: "R366: a labelled SurfaceCard repeated in a Grid kind=\"cards\" is a tile: it names itself inside." },
|
|
210
155
|
schema: [],
|
|
211
156
|
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 `Section kind=\"list\"` or a `
|
|
157
|
+
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 `Section` holding a `DataTable`.",
|
|
213
158
|
},
|
|
214
159
|
},
|
|
215
160
|
create(context) {
|
package/dist/surface-depth.js
CHANGED
|
@@ -66,7 +66,7 @@ export const noRaisedSurfaceInSurface = defineRule({
|
|
|
66
66
|
docs: { description: "R340: a SurfaceCard never stands inside another SurfaceCard." },
|
|
67
67
|
schema: [],
|
|
68
68
|
messages: {
|
|
69
|
-
nested: "This `SurfaceCard` stands inside {{host}}: a surface never stands inside a surface (the Grammar has one depth and draws no nested edge). Give the content to the host's own body, or
|
|
69
|
+
nested: "This `SurfaceCard` stands inside {{host}}: a surface never stands inside a surface (the Grammar has one depth and draws no nested edge). Give the content to the host's own body; a list, a table or figures inside it stand flat in a `Section` (`Section kind=\"list\"`, `Section kind=\"figures\"`), never in a card of their own.",
|
|
70
70
|
},
|
|
71
71
|
},
|
|
72
72
|
create(context) {
|
|
@@ -56,7 +56,7 @@ export const surfaceInSurface = defineRule({
|
|
|
56
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." },
|
|
57
57
|
schema: [],
|
|
58
58
|
messages: {
|
|
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 `
|
|
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 `card-is-object`).",
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
create(context) {
|
package/dist/tabs.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Rule } from "eslint";
|
|
2
|
-
/** No pill in JSX: the pill is the `
|
|
2
|
+
/** No pill in JSX: the pill is the `action` of a `Section`, or the value of a row `control`. */
|
|
3
3
|
export declare const tabsSwitchZone: Rule.RuleModule;
|
|
4
4
|
/** At most two underline layers. */
|
|
5
5
|
export declare const tabsDepth: Rule.RuleModule;
|
|
6
6
|
/**
|
|
7
7
|
* The second tab layer stands in the white header band (owner, 2026-11-09, TABS-IN-WELL): `Page header={{ tabs, subTabs }}`, on its own
|
|
8
8
|
* full-width separator, flush with the band's left inset. An underline `Tabs` written as a child of a `Page`, `Pane` or `PaneSection`
|
|
9
|
-
* stands on the pink well or in a pane body, so it is a finding
|
|
9
|
+
* stands on the pink well or in a pane body, so it is a finding, unless it narrows a list or a region from the header row of its own: a
|
|
10
|
+
* `Tabs kind="filter"` in a `Section`'s `filter` row (0.43.1). A drawer, dialog, modal, popover or sheet starts its own surface.
|
|
10
11
|
*/
|
|
11
12
|
export declare const tabsInWell: Rule.RuleModule;
|
|
12
13
|
/** The rules this law contributes to the plugin. */
|
package/dist/tabs.js
CHANGED
|
@@ -4,12 +4,11 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
|
4
4
|
* The Tabs laws (`contexts/ui/components/tabs.md`, owner-approved 2026-11-09): where the pill stands, and how many
|
|
5
5
|
* underline layers a page stacks.
|
|
6
6
|
*
|
|
7
|
-
* `tabs-switch-zone`. The pill (`Tabs appearance="primary"`) is a mode or period switch of one block.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `control`
|
|
12
|
-
* literal, or a JSX attribute `control={...}`) is allowed. The item checks (two to four, no count, no href) stay in `no-primary-tabs-misuse`.
|
|
7
|
+
* `tabs-switch-zone`. The pill (`Tabs appearance="primary"`) is a mode or period switch of one block. It stands as the `action` of the block's
|
|
8
|
+
* `Section` (`<Section title action={<Tabs appearance="primary" label items selectedKey onSelect />} />`); a `<Tabs appearance="primary">` written in JSX
|
|
9
|
+
* anywhere else (a page body, under the page tabs, a pane, a drawer) is a finding. One more place (0.37.16, owner 2026-11-10): a row-level mode choice
|
|
10
|
+
* ("Tu dong | Hoi" on an agent's ability row) lives in the row's `control` slot, so a pill that is the value of a `control` (an object property named
|
|
11
|
+
* `control` in a list row literal, or a JSX attribute `control={...}`) is allowed. The item checks (two to four, no count, no href) stay in `no-primary-tabs-misuse`.
|
|
13
12
|
*
|
|
14
13
|
* `tabs-depth`. A page stacks at most two underline layers: the page tabs (`Page header.tabs`) and one region set. A `Tabs`
|
|
15
14
|
* is nested in another when it stands in the panel the other selects: inside a conditional or `&&` whose test reads the
|
|
@@ -38,12 +37,14 @@ const literalOf = (attribute) => {
|
|
|
38
37
|
const isPill = (opening) => literalOf(attributeOf(opening, "appearance")) === "primary";
|
|
39
38
|
/** Whether a node is an object property whose key is `control`. */
|
|
40
39
|
const isControlProperty = (node) => node.type === "Property" && !node.computed && ((node.key.type === "Identifier" && node.key.name === "control") || (node.key.type === "Literal" && node.key.value === "control"));
|
|
40
|
+
/** Whether a JSX attribute is the `action` of a `Section`. */
|
|
41
|
+
const isSectionAction = (node) => node.name.type === "JSXIdentifier" && node.name.name === "action" && node.parent.type === "JSXOpeningElement" && elementName(node.parent) === "Section";
|
|
41
42
|
/**
|
|
42
|
-
* Whether the pill stands
|
|
43
|
-
*
|
|
43
|
+
* Whether the pill stands in a slot made for it: climbing through fragments, expression containers, conditionals and `&&`/`||`/`??` it reaches an
|
|
44
|
+
* object property named `control`, a JSX attribute `control={...}` or the `action={...}` of a `Section`. A component or element that
|
|
44
45
|
* merely wraps the pill is not the slot.
|
|
45
46
|
*/
|
|
46
|
-
const
|
|
47
|
+
const isPillSlot = (opening) => {
|
|
47
48
|
let child = opening.parent ?? opening;
|
|
48
49
|
for (let node = child.parent; node !== undefined && node !== null; child = node, node = node.parent) {
|
|
49
50
|
if (node.type === "JSXFragment" || node.type === "JSXExpressionContainer")
|
|
@@ -53,22 +54,22 @@ const isRowControl = (opening) => {
|
|
|
53
54
|
if (node.type === "LogicalExpression" && child === node.right)
|
|
54
55
|
continue;
|
|
55
56
|
if (node.type === "JSXAttribute")
|
|
56
|
-
return node.name.type === "JSXIdentifier" && node.name.name === "control";
|
|
57
|
+
return node.name.type === "JSXIdentifier" && (node.name.name === "control" || isSectionAction(node));
|
|
57
58
|
return isControlProperty(node) && node.value === child;
|
|
58
59
|
}
|
|
59
60
|
return false;
|
|
60
61
|
};
|
|
61
|
-
/** No pill in JSX: the pill is the `
|
|
62
|
+
/** No pill in JSX: the pill is the `action` of a `Section`, or the value of a row `control`. */
|
|
62
63
|
export const tabsSwitchZone = defineRule({
|
|
63
64
|
meta: {
|
|
64
65
|
type: "problem",
|
|
65
66
|
docs: {
|
|
66
|
-
description: "A pill (Tabs appearance=\"primary\") stands only as the
|
|
67
|
+
description: "A pill (Tabs appearance=\"primary\") stands only as the `action` of a Section or as the value of a row `control`; written in JSX anywhere else it is a finding.",
|
|
67
68
|
url: "knowledge/ui/presentation/grammar-laws.yaml#TABS-SWITCH-ZONE",
|
|
68
69
|
},
|
|
69
70
|
schema: [],
|
|
70
71
|
messages: {
|
|
71
|
-
pill: "A pill (`Tabs appearance=\"primary\"`) switches a mode or period of one block and
|
|
72
|
+
pill: "A pill (`Tabs appearance=\"primary\"`) switches a mode or period of one block and stands as the `action` of that block's `Section`: `<Section title ... action={<Tabs appearance=\"primary\" label items selectedKey onSelect />} />`, two to four short options with no count and no href. A row-level mode choice is the one other place: the row's `control` (`items={[{ id, title, control: <Tabs appearance=\"primary\" ... /> }]}`). Written here it stands loose in the page. Views of a page are page tabs (`Page header.tabs`); views or filters inside a region are underline `Tabs`.",
|
|
72
73
|
},
|
|
73
74
|
},
|
|
74
75
|
create(context) {
|
|
@@ -76,7 +77,7 @@ export const tabsSwitchZone = defineRule({
|
|
|
76
77
|
return {};
|
|
77
78
|
return {
|
|
78
79
|
JSXOpeningElement(opening) {
|
|
79
|
-
if (elementName(opening) !== "Tabs" || !isPill(opening) ||
|
|
80
|
+
if (elementName(opening) !== "Tabs" || !isPill(opening) || isPillSlot(opening))
|
|
80
81
|
return;
|
|
81
82
|
context.report({ node: opening, messageId: "pill" });
|
|
82
83
|
},
|
|
@@ -106,7 +107,7 @@ export const tabsDepth = defineRule({
|
|
|
106
107
|
},
|
|
107
108
|
schema: [],
|
|
108
109
|
messages: {
|
|
109
|
-
depth: "This underline `Tabs` is layer {{layers}} ({{chain}}). A page stacks at most two underline layers: the page tabs (`Page header.tabs`) and one region set inside a tab's panel. Fold the third level into a
|
|
110
|
+
depth: "This underline `Tabs` is layer {{layers}} ({{chain}}). A page stacks at most two underline layers: the page tabs (`Page header.tabs`) and one region set inside a tab's panel. Fold the third level into a pill in a `Section action`, a `Section filter` row, a list, or a drawer.",
|
|
110
111
|
},
|
|
111
112
|
},
|
|
112
113
|
create(context) {
|
|
@@ -163,21 +164,24 @@ export const tabsDepth = defineRule({
|
|
|
163
164
|
});
|
|
164
165
|
/** The pink well and the panes: underline Tabs written in their children sit on the well, not in the white header band. */
|
|
165
166
|
const WELL_HOSTS = new Set(["Page", "Pane", "PaneSection"]);
|
|
167
|
+
/** Whether a JSX attribute is the `filter` row of a `Section` (a list's or a region's alike, 0.43.1). */
|
|
168
|
+
const isSectionFilter = (node) => node.name.type === "JSXIdentifier" && node.name.name === "filter" && node.parent.type === "JSXOpeningElement" && elementName(node.parent) === "Section";
|
|
166
169
|
/**
|
|
167
170
|
* The second tab layer stands in the white header band (owner, 2026-11-09, TABS-IN-WELL): `Page header={{ tabs, subTabs }}`, on its own
|
|
168
171
|
* full-width separator, flush with the band's left inset. An underline `Tabs` written as a child of a `Page`, `Pane` or `PaneSection`
|
|
169
|
-
* stands on the pink well or in a pane body, so it is a finding
|
|
172
|
+
* stands on the pink well or in a pane body, so it is a finding, unless it narrows a list or a region from the header row of its own: a
|
|
173
|
+
* `Tabs kind="filter"` in a `Section`'s `filter` row (0.43.1). A drawer, dialog, modal, popover or sheet starts its own surface.
|
|
170
174
|
*/
|
|
171
175
|
export const tabsInWell = defineRule({
|
|
172
176
|
meta: {
|
|
173
177
|
type: "problem",
|
|
174
178
|
docs: {
|
|
175
|
-
description: "An underline Tabs stands in the white header band (Page header.subTabs), never in the pink well or a pane body.",
|
|
179
|
+
description: "An underline Tabs stands in the white header band (Page header.subTabs) or, kind=\"filter\", a Section's filter row; never loose in the pink well or a pane body.",
|
|
176
180
|
url: "knowledge/ui/presentation/grammar-laws.yaml#TABS-IN-WELL",
|
|
177
181
|
},
|
|
178
182
|
schema: [],
|
|
179
183
|
messages: {
|
|
180
|
-
well: "This underline `Tabs` stands in the body of a `{{host}}`, on the pink well or in a pane. The second tab layer sits in the white header band under the page tabs: `Page header` with `subTabs`, on its own full-width separator and flush with the band left inset. Move it to `header.subTabs`, or
|
|
184
|
+
well: "This underline `Tabs` stands in the body of a `{{host}}`, on the pink well or in a pane. The second tab layer sits in the white header band under the page tabs: `Page header` with `subTabs`, on its own full-width separator and flush with the band left inset. Move it to `header.subTabs`, or, to narrow a list or a region, pass it as `Tabs kind=\"filter\"` in the `filter` row of its `Section`.",
|
|
181
185
|
},
|
|
182
186
|
},
|
|
183
187
|
create(context) {
|
|
@@ -187,14 +191,17 @@ export const tabsInWell = defineRule({
|
|
|
187
191
|
JSXOpeningElement(opening) {
|
|
188
192
|
if (elementName(opening) !== "Tabs" || isPill(opening))
|
|
189
193
|
return;
|
|
194
|
+
const isFilter = literalOf(attributeOf(opening, "kind")) === "filter";
|
|
190
195
|
let child = opening.parent ?? opening;
|
|
191
196
|
for (let node = child.parent; node !== undefined && node !== null; child = node, node = node.parent) {
|
|
197
|
+
if (node.type === "JSXAttribute" && isFilter && isSectionFilter(node))
|
|
198
|
+
return;
|
|
192
199
|
if (node.type !== "JSXElement")
|
|
193
200
|
continue;
|
|
194
201
|
const name = elementName(node.openingElement);
|
|
195
202
|
if (name === null)
|
|
196
203
|
continue;
|
|
197
|
-
if (SURFACE_BOUNDARIES.has(name)
|
|
204
|
+
if (SURFACE_BOUNDARIES.has(name))
|
|
198
205
|
return;
|
|
199
206
|
if (WELL_HOSTS.has(name) && node.children.includes(child)) {
|
|
200
207
|
context.report({ node: opening, messageId: "well", data: { host: name } });
|
package/docs/app-shell.md
CHANGED
|
@@ -21,7 +21,10 @@ export and rendered Base chain prove a `TopBar` in every alternative.
|
|
|
21
21
|
Workspace exports resolve back to source. Raw or unknown imported headers are red; the actual
|
|
22
22
|
bar's own actions are checked where composed. Each lint source snapshot has fresh dependency proofs.
|
|
23
23
|
|
|
24
|
-
`navbar-control-size` requires
|
|
24
|
+
`navbar-control-size` requires the shared 40px height of each bar control through its published API: `Button` and
|
|
25
|
+
`IconButton` at `md` (their default), `Switch` as `kind="toggle"` (a stated `kind` wins and the Grammar ignores `size` beside it;
|
|
26
|
+
with no `kind`, the toggle unless `size` says `md` or `lg`), every other control at `size="control"`. A `Switch kind="compact"`
|
|
27
|
+
(32x18) is refused in the bar with its own message, whatever `size` it carries. Unknown trailing prop spreads
|
|
25
28
|
cannot prove a size; put the explicit size after a spread. A left `Drawer` containing
|
|
26
29
|
`Sidebar presentation="drawer"` also identifies a mobile bar opener when composed in a separate
|
|
27
30
|
client owner. Its trigger is checked; drawer bodies and footers retain their normal field sizes.
|
|
@@ -35,7 +38,7 @@ does not execute application code.
|
|
|
35
38
|
| --- | --- | --- |
|
|
36
39
|
| `app-shell-frame` | An app `Shell` returns a hand-written `<header>` and `<nav>`. | `WorkspaceShell viewport="fixed"` owns the app frame. |
|
|
37
40
|
| `no-shell-bottom-tabs` | The shell supplies `compactNavigation={<BottomNav />}`. | The shell supplies `navigationDrawer` with a drawer `Sidebar`. |
|
|
38
|
-
| `navbar-control-size` | A navbar `IconButton` uses `size="
|
|
41
|
+
| `navbar-control-size` | A navbar `IconButton` uses `size="sm"`; the theme `Switch` is `kind="compact"`. | The `IconButton` keeps `md`; the theme `Switch` is `kind="toggle"`. |
|
|
39
42
|
| `navbar-cluster` | Account precedes notifications, or a language trigger uses a regular `Button`. | Language menu, theme switch, notification popover, account menu use their stated Grammar trigger kinds in that order. |
|
|
40
43
|
| `no-navbar-create` | A navbar button or attached menu item creates a record. | The page owns its create action. |
|
|
41
44
|
|
package/docs/card-content.md
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
# One
|
|
1
|
+
# One object per card
|
|
2
2
|
|
|
3
3
|
Law module: `card-content.ts`. Finding codes: `FE_CARD_ONE_CONTENT`, `FE_NO_LABEL_DESCRIPTION`. Knowledge: `knowledge/ui/presentation/grammar-laws.yaml#CARD-ONE-CONTENT`.
|
|
4
4
|
|
|
5
|
-
A `SurfaceCard`
|
|
5
|
+
A `SurfaceCard` is ONE object: its name, its facts and its commands (`actions`). A second list, table, form or graph is not part of the object: it stands flat in its own `Section` (a ribbon is `Section kind="figures"`); items of the same kind stay in one list. A card inside a card is `no-raised-surface-in-surface` (R340); a card whose only content is a collection is `card-is-object`. A label has no description under it.
|
|
6
6
|
|
|
7
7
|
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
8
8
|
|
|
9
9
|
## `starci-grammar/card-one-content`
|
|
10
10
|
|
|
11
|
-
- A `SurfaceCard` (not `
|
|
12
|
-
- A card that carries a `figures` header zone while it is not itself `kind="figures"`: a ribbon above another content (message `ribbon`).
|
|
11
|
+
- A `SurfaceCard` (not `tile`) whose body holds more than one content component (`ListBox`, `ItemList`, `DescriptionList`, `DataTable`, `FlowGraph`, `BarChart`, `Timeline`, `Form`, `FormGrid`, a `Section kind="list"` or `"figures"`, ...), looked through layout wrappers (message `many`).
|
|
13
12
|
|
|
14
13
|
## `starci-grammar/no-label-description`
|
|
15
14
|
|
|
@@ -26,8 +25,8 @@ Every rule below is an error in `coreGrammarConfig`; none can be switched off or
|
|
|
26
25
|
**Valid**
|
|
27
26
|
|
|
28
27
|
```tsx
|
|
29
|
-
<
|
|
30
|
-
<
|
|
28
|
+
<Section title="Lines"><DataTable label="Lines" columns={columns} rows={lines} renderCell={renderCell} emptyContent="-" /></Section>
|
|
29
|
+
<Section title="Facts"><DescriptionList isDivided items={facts} /></Section>
|
|
31
30
|
<Section title="Runs" caption="Everyone on the team">...</Section>
|
|
32
31
|
```
|
|
33
32
|
|