@starci/eslint-grammar-core 0.23.2 → 0.25.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.25.0 - 2026-11-07
4
+
5
+ - A minor of the Grammar family: rule sources (`freestyle.ts`, `status-colors.ts`, `surface-depth.ts`, `lib/rule-contract.ts`, `lib/why.ts`) changed their text, so the family moves to 0.25.0 (`contexts/grammars/contributing.md` "Patch or minor").
6
+ - Peers `@starci/hfs` ~6.0.0. Comments, rule docs, bundled knowledge and messages cite rules by their ids and carry no ruling history.
7
+
8
+ ## 0.24.0 - 2026-11-06
9
+
10
+ - Added: `no-button-view-switch` (R380, `FE_GROUPED_CHOICE_CONTROL`): two or more adjacent `Button` or `IconButton` elements, or one in a `.map`, carrying `aria-pressed`, `isSelected` or `isActive` are joined buttons or pills acting as tabs; use `Tabs` in the block's `filter` header zone. `docs/choice-controls.md` says which component switches what.
11
+ - Added: `no-primary-tabs-misuse` (R380): `Tabs appearance="primary"` and the `switch` header zone hold two to four fixed options with no `count`, `href` or `isAttention`; a literal that carries one is refused.
12
+ - Changed: the `SegmentedControl` replacement names `Tabs appearance="primary"`; the component is removed from `@starci/grammar` 0.24.0.
13
+ - Changed: with `@starci/grammar` 0.24.0 (the family shares a minor). `surface-card-kind` (R355) refuses a `Tabs`, `SearchField` or `Divider` inside a `{ kind: "custom" }` zone of a `SurfaceCard` or `Board` `headers` or `footers` array (message `zone`), and its messages and the `no-raised-surface-in-surface` fix name the typed zones instead of the removed `kind="bands"` and the renamed `footer` (now `note`).
14
+
3
15
  ## 0.23.2 - 2026-11-06
4
16
 
5
17
  - Changed: the peer range of `@starci/eslint-canon-fe` follows the canon's new minor (`~9.16.0`, eslint-canon-fe 9.16.0); no rule of this package changed. Grammar stays at 0.23.3 (a lint patch never re-releases it).
@@ -10,11 +22,11 @@
10
22
 
11
23
  ## 0.23.0 - 2026-11-05
12
24
 
13
- - Changed: with `@starci/grammar` 0.23.0; requires `@starci/eslint-canon-fe` `~9.15.0` and peers `@starci/hfs` `~5.13.0`, whose runtime it reads at run time instead of a bundled copy (decision release-only-what-changed); `runtime/` keeps only the knowledge it cites.
25
+ - Changed: with `@starci/grammar` 0.23.0; requires `@starci/eslint-canon-fe` `~9.15.0` and peers `@starci/hfs` `~5.13.0`, whose runtime it reads at run time instead of a bundled copy; `runtime/` keeps only the knowledge it cites.
14
26
 
15
27
  ## 0.22.0 - 2026-11-05
16
28
 
17
- - Changed: version stamp only, with `@starci/grammar` 0.22.0; requires `@starci/eslint-canon-fe` 9.14.4. The runtime copies carry the same-minor range of the canon pins (decision grammar-patch-range), R15 and the canon pins of `@starci/hfs` 5.12.0.
29
+ - Changed: version stamp only, with `@starci/grammar` 0.22.0; requires `@starci/eslint-canon-fe` 9.14.4. The runtime copies carry the same-minor range of the canon pins, R15 and the canon pins of `@starci/hfs` 5.12.0.
18
30
 
19
31
  ## 0.21.38 - 2026-11-05
20
32
 
@@ -194,8 +206,8 @@
194
206
 
195
207
  ## 0.20.2 - 2026-11-01
196
208
 
197
- - Changed: `status-text-uses-soft-foreground` follows the owner's pair rule. It refuses a solid tone painted as text on a `bg-<tone>-soft` tint of the same element (message `onTint`: use `text-<tone>-soft-foreground`) and the soft foreground with no `bg-<tone>-soft` behind it on its element or on an enclosing element of the file (message `alone`: use `text-<tone>`). A bare `text-<tone>`, which the rule refused before, is no longer a finding. Constants and `classes` entries are judged for the first finding only.
198
- - Changed: with `offset-pop` as the selected Grammar the `alone` finding is not reported (its light theme keeps the soft foreground for a bare mark, owner choice "1. Pastel").
209
+ - Changed: `status-text-uses-soft-foreground` follows the status pair rule. It refuses a solid tone painted as text on a `bg-<tone>-soft` tint of the same element (message `onTint`: use `text-<tone>-soft-foreground`) and the soft foreground with no `bg-<tone>-soft` behind it on its element or on an enclosing element of the file (message `alone`: use `text-<tone>`). A bare `text-<tone>`, which the rule refused before, is no longer a finding. Constants and `classes` entries are judged for the first finding only.
210
+ - Changed: with `offset-pop` as the selected Grammar the `alone` finding is not reported (its light theme keeps the soft foreground for a bare mark, the Pastel choice).
199
211
  - Changed: the bundled rule catalog carries R351 to R354 and the new R61 law text.
200
212
  - Changed: moves with `@starci/grammar` 0.20.2 (the stat strip's dividers) and requires `@starci/eslint-canon-fe` 9.8.5; the bundled canon pins follow; the status rule changes (below).
201
213
 
@@ -239,8 +251,8 @@
239
251
  ## 0.16.3 - 2026-10-31
240
252
 
241
253
  - Changed: the peer moves to eslint-canon-fe 9.6.3; the bundled canon pins name the 0.16.3 cohort (@starci/grammar, eslint-grammar-core and eslint-grammar-offset-pop 0.16.3, eslint-canon-fe 9.6.3, eslint-canon-be 3.9.3, stylelint-canon 2.3.0, jest-preset 2.6.0, hfs 4.13.0); ChatWorkspace and PaneLayout are removed with no alias; PaneGrid and Pane are the one generic pane grid: grammar names are generic. The core playbook names PaneGrid in its layout-frame and container lists.
242
- - Added: starci-grammar/freestyle-has-reason (R341, FE_FREESTYLE_REASON_MISSING): a `<Freestyle>` region names a non-empty string-literal `reason`. no-raw-structural-element, no-fractional-step, generated-art-in-mascot-or-media-frame and no-inline-svg-outside-brand-mark-leaf do not report the raw elements inside a Freestyle subtree (owner ruling grammar-freestyle-region). Specs: src/freestyle.spec.ts.
243
- - Added: `crossFileInputs` for the lint result cache of `starci app check` (ruling app-check-cache): the files each grammar rule reads beyond the linted file.
254
+ - Added: starci-grammar/freestyle-has-reason (R341, FE_FREESTYLE_REASON_MISSING): a `<Freestyle>` region names a non-empty string-literal `reason`. no-raw-structural-element, no-fractional-step, generated-art-in-mascot-or-media-frame and no-inline-svg-outside-brand-mark-leaf do not report the raw elements inside a Freestyle subtree. Specs: src/freestyle.spec.ts.
255
+ - Added: `crossFileInputs` for the lint result cache of `starci app check`: the files each grammar rule reads beyond the linted file.
244
256
 
245
257
  ## 0.16.2 - 2026-10-31
246
258
 
@@ -335,7 +347,7 @@
335
347
 
336
348
  ## 0.15.15 - 2026-10-29
337
349
 
338
- - Changed: the peer moves to the 0.15.15 cohort (eslint-canon-fe 9.5.4); the bundled slot manifest 3.13.0 admits `pgmq` in `ruleParams.db.extensions` (the lite event bus, ruling lite-pgmq-bus-bullmq-jobs), retires `ruleParams.db.queueOutbox` and `sides.be.queueOutbox` with the pg_cron half of R258, lists `public.event_bus_send`, `public.event_bus_read`, `public.event_bus_archive`, `public.event_bus_bury`, `public.event_bus_dead_letters` and `public.event_bus_requeue` in place of `public.event_bus_write` in `ruleParams.be.dbFunctions`, and moves slot `app.db.image` to `.starcistacks/images/db/Dockerfile` (ruling lite-db-image-in-stacks, admitted by the lite `app.starcistacks` allows); the bundled rule catalog keeps R258 `DB_PGMQ_DECLARED` as the event-bus law, retires `DB_CRON_OWNED` and adds R336 `BE_EVENT_BUS_LITE_SHAPE`; the bundled canon pins name hfs 4.11.3, eslint-canon-be 3.8.2, eslint-canon-fe 9.5.4 and the Grammar family 0.15.15. No rule changed.
350
+ - Changed: the peer moves to the 0.15.15 cohort (eslint-canon-fe 9.5.4); the bundled slot manifest 3.13.0 admits `pgmq` in `ruleParams.db.extensions` (the lite event bus), retires `ruleParams.db.queueOutbox` and `sides.be.queueOutbox` with the pg_cron half of R258, lists `public.event_bus_send`, `public.event_bus_read`, `public.event_bus_archive`, `public.event_bus_bury`, `public.event_bus_dead_letters` and `public.event_bus_requeue` in place of `public.event_bus_write` in `ruleParams.be.dbFunctions`, and moves slot `app.db.image` to `.starcistacks/images/db/Dockerfile` (admitted by the lite `app.starcistacks` allows); the bundled rule catalog keeps R258 `DB_PGMQ_DECLARED` as the event-bus law, retires `DB_CRON_OWNED` and adds R336 `BE_EVENT_BUS_LITE_SHAPE`; the bundled canon pins name hfs 4.11.3, eslint-canon-be 3.8.2, eslint-canon-fe 9.5.4 and the Grammar family 0.15.15. No rule changed.
339
351
 
340
352
  ## 0.15.14 - 2026-10-29
341
353
 
@@ -365,14 +377,14 @@
365
377
 
366
378
  ## 0.15.8 - 2026-10-29
367
379
 
368
- - Changed: `starci-grammar/route-page-is-one-page` (R325) follows the owner ruling `page-frame` as rewritten: a route segment `layout` whose owner (`fe.feature`, kind `layouts`), its pure half or its one root block draws a `Page` whose `header` carries `tabs` is the one `Page` of every route under it. The rule finds the route `page` files that mount a page owner, walks up through the `layout` files of their segments and resolves each layout's owner one level deep. A page owner every route of which is so framed is not judged `missing`; one that draws a `Page` (or a root block that draws one) under such a layout is `twice`, and the message names the layout. A layout whose `Page` carries no `tabs` frames no segment.
380
+ - Changed: `starci-grammar/route-page-is-one-page` (R325): a route segment `layout` whose owner (`fe.feature`, kind `layouts`), its pure half or its one root block draws a `Page` whose `header` carries `tabs` is the one `Page` of every route under it. The rule finds the route `page` files that mount a page owner, walks up through the `layout` files of their segments and resolves each layout's owner one level deep. A page owner every route of which is so framed is not judged `missing`; one that draws a `Page` (or a root block that draws one) under such a layout is `twice`, and the message names the layout. A layout whose `Page` carries no `tabs` frames no segment.
369
381
  - Changed: R325 also judges layout owners (`fe.feature`, kind `layouts`): a `Page` they draw has nothing beside it (`sibling`; a `PageHeader` block beside the segment's `Page` belongs in its `header`), no `Page` inside another (`twice`), and no bare `PageHeader` or `PageContainer` (`part`). A layout owner that draws no `Page` is never `missing`.
370
382
  - Changed: `@starci/eslint-canon-fe` 9.4.7 is the peer dependency; versioned together with Grammar 0.15.8; the bundled canon pins name the Grammar family 0.15.8 (grammar, eslint-grammar-core, eslint-grammar-offset-pop), eslint-canon-fe 9.4.7 and eslint-canon-be 3.6.6.
371
383
  - Spec: `src/page.spec.ts`, `src/page-owners.spec.ts` (layout cases on the project fixture); docs: `docs/page.md`.
372
384
 
373
385
  ## 0.15.7 - 2026-10-29
374
386
 
375
- - Changed: `starci-grammar/route-page-is-one-page` (R325) follows the owner ruling that a route draws exactly one `Page`, drawn by the page owner, its pure half (`./component`), or the one connected block (`fe.components`, kind `blocks`) the owner renders as its root, read one level deep (the block's connected half and its own pure half). A server page owner whose header needs client data renders that block and passes the page body as its children. An element that draws the `Page` with an element sibling stays `sibling`; a `Page` (or a block that draws one) inside another is the new finding `twice`.
387
+ - Changed: `starci-grammar/route-page-is-one-page` (R325): a route draws exactly one `Page`, drawn by the page owner, its pure half (`./component`), or the one connected block (`fe.components`, kind `blocks`) the owner renders as its root, read one level deep (the block's connected half and its own pure half). A server page owner whose header needs client data renders that block and passes the page body as its children. An element that draws the `Page` with an element sibling stays `sibling`; a `Page` (or a block that draws one) inside another is the new finding `twice`.
376
388
  - Changed: R325 does not judge a page owner as `missing` when every route `page` file that imports it lies under the route group `(auth)` with its own `layout`: that layout draws the auth frame, the page frame of its sign-in, sign-up, password and callback pages. A page owner that draws no JSX (it only calls `redirect()` or `notFound()`, or returns null) stays unjudged. Workbench pages get no exemption.
377
389
  - Changed: `@starci/eslint-canon-fe` 9.4.6 is the peer dependency; versioned together with Grammar 0.15.7; the bundled canon pins name the Grammar family 0.15.7 (grammar, eslint-grammar-core, eslint-grammar-offset-pop) and eslint-canon-fe 9.4.6.
378
390
  - Spec: `src/page.spec.ts`, `src/page-owners.spec.ts` (new, cross-file); docs: `docs/page.md`.
@@ -424,7 +436,7 @@
424
436
 
425
437
  - Changed: `@starci/eslint-canon-fe` is a peer dependency (9.2.0), installed by the app beside this package, instead of a nested dependency.
426
438
  - Changed: the package lives in github.com/starci183/starci-harness under `packages/` and publishes from there; its bundled `runtime/` is committed source, edited in place (no generator, no `prepack`/`pretest` hook).
427
- - Changed: owner ruling: there are exactly two Grammar families, `core` and `offset-pop`. This package is renamed from
439
+ - Changed: there are exactly two Grammar families, `core` and `offset-pop`. This package is renamed from
428
440
  `@starci/eslint-grammar-starci` to `@starci/eslint-grammar-core`, and its factory from `starciGrammarConfig` to
429
441
  `coreGrammarConfig`, which loads for `sides.fe.grammar: core`.
430
442
  - Removed: the ids `starci` and `starci-core` are not families and have no alias; an app that names them is refused.
@@ -7,11 +7,20 @@ import type { Rule } from "eslint";
7
7
  *
8
8
  * WHAT IT READS. A JSX element named `ButtonGroup`, `FilterButtonGroup` or `SegmentedControl` in product source, written
9
9
  * bare or as a member (`Grammar.ButtonGroup`). The components stay exported and deprecated for one release.
10
+ *
11
+ * A second rule holds the same law for loose buttons: two or more adjacent `Button` or `IconButton` elements (or one written in a
12
+ * `.map`) that carry `aria-pressed`, `isSelected` or `isActive` are joined buttons acting as tabs, a pill toggle ("This month / Last
13
+ * month"). A switch between views or periods of one block is `Tabs` (the primary underline) in the block's `filter` header zone;
14
+ * `ChoiceChips` or `RadioGroup` choose a form value; a button holds a command, never a selection state.
10
15
  */
11
16
  /** Each banned component with the replacement its message names. */
12
17
  export declare const REPLACEMENTS: Readonly<Record<string, string>>;
13
18
  /** No ButtonGroup, FilterButtonGroup or SegmentedControl in product source. */
14
19
  export declare const noGroupedChoiceControls: Rule.RuleModule;
20
+ /** No joined buttons acting as tabs: two or more Buttons carrying a selection state are a view switch. */
21
+ export declare const noButtonViewSwitch: Rule.RuleModule;
22
+ /** Primary tabs (a pill in a track) switch a mode or period: 2 to 4 short fixed options, no count, no destination. */
23
+ export declare const noPrimaryTabsMisuse: Rule.RuleModule;
15
24
  /** The rules this law contributes to the plugin. */
16
25
  export declare const rules: Record<string, Rule.RuleModule>;
17
26
  /** Every rule of this law is an error. */
@@ -8,12 +8,17 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
8
8
  *
9
9
  * WHAT IT READS. A JSX element named `ButtonGroup`, `FilterButtonGroup` or `SegmentedControl` in product source, written
10
10
  * bare or as a member (`Grammar.ButtonGroup`). The components stay exported and deprecated for one release.
11
+ *
12
+ * A second rule holds the same law for loose buttons: two or more adjacent `Button` or `IconButton` elements (or one written in a
13
+ * `.map`) that carry `aria-pressed`, `isSelected` or `isActive` are joined buttons acting as tabs, a pill toggle ("This month / Last
14
+ * month"). A switch between views or periods of one block is `Tabs` (the primary underline) in the block's `filter` header zone;
15
+ * `ChoiceChips` or `RadioGroup` choose a form value; a button holds a command, never a selection state.
11
16
  */
12
17
  /** Each banned component with the replacement its message names. */
13
18
  export const REPLACEMENTS = {
14
19
  ButtonGroup: "separate `Button`s (one commit, the rest alternative or dismiss), or a `DropdownMenu` for the overflow",
15
20
  FilterButtonGroup: "`Tabs kind=\"filter\"` (compact underline tabs with a `count` each, under the list's search field) to narrow a list that stays in place",
16
- SegmentedControl: "`ChoiceChips` or `RadioGroup` to choose a value of a form, or `Tabs` only to switch a view",
21
+ SegmentedControl: "`ChoiceChips` or `RadioGroup` to choose a value of a form, or `Tabs appearance=\"primary\"` (a `switch` header zone) to switch a mode or period of one block",
17
22
  };
18
23
  /** The element name of a JSX opening element (`ButtonGroup`, or `Grammar.ButtonGroup` as `ButtonGroup`). */
19
24
  const elementName = (opening) => {
@@ -50,9 +55,142 @@ export const noGroupedChoiceControls = defineRule({
50
55
  };
51
56
  },
52
57
  });
58
+ /** The buttons whose pressed or selected state makes a set of them a switch. */
59
+ const BUTTON_COMPONENTS = new Set(["Button", "IconButton"]);
60
+ const SELECTION_ATTRIBUTES = new Set(["aria-pressed", "isSelected", "isActive"]);
61
+ /** Whether an opening element is a Button or IconButton carrying a selection attribute. */
62
+ const isSelectionButton = (opening) => {
63
+ const name = elementName(opening);
64
+ if (name === null || !BUTTON_COMPONENTS.has(name))
65
+ return false;
66
+ return opening.attributes.some((attribute) => attribute.type === "JSXAttribute" && attribute.name.type === "JSXIdentifier" && SELECTION_ATTRIBUTES.has(attribute.name.name));
67
+ };
68
+ /** The selection buttons a child position renders, read through conditionals, `&&` and `.map`. */
69
+ const selectionButtonsOf = (node, inMap = false) => {
70
+ if (node === null || node === undefined)
71
+ return [];
72
+ switch (node.type) {
73
+ case "JSXElement":
74
+ return isSelectionButton(node.openingElement) ? [{ opening: node.openingElement, inMap }] : [];
75
+ case "JSXFragment":
76
+ return node.children.flatMap((child) => selectionButtonsOf(child, inMap));
77
+ case "JSXExpressionContainer":
78
+ return selectionButtonsOf(node.expression, inMap);
79
+ case "ConditionalExpression":
80
+ return [...selectionButtonsOf(node.consequent, inMap), ...selectionButtonsOf(node.alternate, inMap)];
81
+ case "LogicalExpression":
82
+ return node.operator === "&&" ? selectionButtonsOf(node.right, inMap) : [...selectionButtonsOf(node.left, inMap), ...selectionButtonsOf(node.right, inMap)];
83
+ case "CallExpression": {
84
+ const callee = node.callee;
85
+ const method = callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier" ? callee.property.name : null;
86
+ const callback = node.arguments[0];
87
+ if (method !== "map" || callback === undefined || (callback.type !== "ArrowFunctionExpression" && callback.type !== "FunctionExpression"))
88
+ return [];
89
+ if (callback.body.type !== "BlockStatement")
90
+ return selectionButtonsOf(callback.body, true);
91
+ return callback.body.body.flatMap((statement) => (statement.type === "ReturnStatement" ? selectionButtonsOf(statement.argument, true) : []));
92
+ }
93
+ default:
94
+ return [];
95
+ }
96
+ };
97
+ /** No joined buttons acting as tabs: two or more Buttons carrying a selection state are a view switch. */
98
+ export const noButtonViewSwitch = defineRule({
99
+ meta: {
100
+ type: "problem",
101
+ docs: { description: "R380: no row of Buttons carrying aria-pressed, isSelected or isActive as a view switch; a switch between views or periods is Tabs in the block's filter header zone." },
102
+ schema: [],
103
+ messages: {
104
+ switch: "Buttons that carry `{{attribute}}` side by side are a view switch drawn as joined buttons or pills. Switching between views or periods of one block is `Tabs` (the primary underline) in the block's `filter` header zone; choosing a form value is `ChoiceChips` or `RadioGroup`; a `Button` holds a command, never a selection state.",
105
+ },
106
+ },
107
+ create(context) {
108
+ if (!isProductSource(context))
109
+ return {};
110
+ return {
111
+ JSXElement(element) {
112
+ const found = element.children.flatMap((child) => selectionButtonsOf(child));
113
+ if (found.length < 2 && !found.some(({ inMap }) => inMap))
114
+ return;
115
+ for (const { opening } of found) {
116
+ const attribute = opening.attributes.find((entry) => entry.type === "JSXAttribute" && entry.name.type === "JSXIdentifier" && SELECTION_ATTRIBUTES.has(entry.name.name));
117
+ const named = attribute !== undefined && attribute.type === "JSXAttribute" && attribute.name.type === "JSXIdentifier" ? attribute.name.name : "aria-pressed";
118
+ context.report({ node: opening, messageId: "switch", data: { attribute: named } });
119
+ }
120
+ },
121
+ };
122
+ },
123
+ });
124
+ /** The item keys a primary tab never carries: a count, an attention mark or a destination. */
125
+ const PRIMARY_FORBIDDEN_KEYS = new Set(["count", "href", "isAttention"]);
126
+ /** The static `items` array of a primary strip, or null when it is not an array literal. */
127
+ const itemsArrayOf = (value) => {
128
+ if (value === null || value === undefined)
129
+ return null;
130
+ const expression = value.type === "JSXExpressionContainer" ? value.expression : value;
131
+ return expression.type === "ArrayExpression" ? expression : null;
132
+ };
133
+ /** Whether an object literal has `kind: "<literal>"`. */
134
+ const hasKind = (object, literal) => object.properties.some((property) => property.type === "Property" && property.key.type === "Identifier" && property.key.name === "kind" && property.value.type === "Literal" && property.value.value === literal);
135
+ /** Primary tabs (a pill in a track) switch a mode or period: 2 to 4 short fixed options, no count, no destination. */
136
+ export const noPrimaryTabsMisuse = defineRule({
137
+ meta: {
138
+ type: "problem",
139
+ docs: { description: "R380: Tabs appearance=\"primary\" (and the switch header zone) hold two to four short, fixed options with no count, no href and no attention mark; views, filters and navigation are the secondary underline tabs." },
140
+ schema: [],
141
+ messages: {
142
+ primary: "Primary tabs (a pill in a track) switch a mode or period of the same data among two to four short, fixed options: {{problem}}. Views, filters with counts and destinations are the secondary (underline) `Tabs`.",
143
+ },
144
+ },
145
+ create(context) {
146
+ if (!isProductSource(context))
147
+ return {};
148
+ const check = (items, node) => {
149
+ if (items === null)
150
+ return;
151
+ const problems = [];
152
+ if (items.elements.length > 4)
153
+ problems.push(`${String(items.elements.length)} items`);
154
+ if (items.elements.length === 1)
155
+ problems.push("one item");
156
+ for (const element of items.elements) {
157
+ if (element === null || element.type !== "ObjectExpression")
158
+ continue;
159
+ for (const property of element.properties) {
160
+ if (property.type === "Property" && property.key.type === "Identifier" && PRIMARY_FORBIDDEN_KEYS.has(property.key.name))
161
+ problems.push(`an item with \`${property.key.name}\``);
162
+ }
163
+ }
164
+ if (problems.length > 0)
165
+ context.report({ node, messageId: "primary", data: { problem: [...new Set(problems)].join(", ") } });
166
+ };
167
+ return {
168
+ JSXOpeningElement(opening) {
169
+ if (elementName(opening) !== "Tabs")
170
+ return;
171
+ const appearance = opening.attributes.find((entry) => entry.type === "JSXAttribute" && entry.name.type === "JSXIdentifier" && entry.name.name === "appearance");
172
+ if (appearance === undefined || appearance.type !== "JSXAttribute" || appearance.value === null)
173
+ return;
174
+ const value = appearance.value.type === "JSXExpressionContainer" ? appearance.value.expression : appearance.value;
175
+ if (value.type !== "Literal" || value.value !== "primary")
176
+ return;
177
+ const items = opening.attributes.find((entry) => entry.type === "JSXAttribute" && entry.name.type === "JSXIdentifier" && entry.name.name === "items");
178
+ check(items !== undefined && items.type === "JSXAttribute" ? itemsArrayOf(items.value) : null, opening);
179
+ },
180
+ ObjectExpression(object) {
181
+ if (!hasKind(object, "switch"))
182
+ return;
183
+ const items = object.properties.find((property) => property.type === "Property" && property.key.type === "Identifier" && property.key.name === "items");
184
+ check(items === undefined ? null : itemsArrayOf(items.value), object);
185
+ },
186
+ };
187
+ },
188
+ });
53
189
  /** The rules this law contributes to the plugin. */
54
190
  export const rules = {
55
191
  "no-grouped-choice-controls": noGroupedChoiceControls,
192
+ "no-button-view-switch": noButtonViewSwitch,
193
+ "no-primary-tabs-misuse": noPrimaryTabsMisuse,
56
194
  };
57
195
  defineFamilyRules(rules, "knowledge/hfs/rules.yaml#R380");
58
196
  /** Every rule of this law is an error. */
package/dist/freestyle.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
2
2
  import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
3
3
  /**
4
- * The Freestyle law (HFS R341 `FE_FREESTYLE_REASON_MISSING`; owner ruling `grammar-freestyle-region`): Freestyle is the one
4
+ * The Freestyle law (HFS R341 `FE_FREESTYLE_REASON_MISSING`): Freestyle is the one
5
5
  * sanctioned escape hatch of the Grammar, a region where the app writes its own plain elements and app CSS because no
6
6
  * Grammar component fits. It is a last resort, so it always says why: `reason` is a non-empty string literal such as
7
7
  * `"sign-in brand art"`, and the Grammar stamps it on the DOM (`data-grammar-freestyle-reason`).
@@ -9,8 +9,8 @@ export declare const RULE_OWNERSHIP = "knowledge/patterns/fe/index.yaml#FE-RULE-
9
9
  */
10
10
  export declare const defineRule: (definition: RuleDefinition) => Rule.RuleModule;
11
11
  /**
12
- * A rule that leaves the raw elements of a Freestyle subtree alone (owner ruling grammar-freestyle-region): a finding about a
13
- * plain element, or its class or style, inside `<Freestyle>` is dropped; a Grammar component inside it is judged as before.
12
+ * A rule that leaves the raw elements of a Freestyle subtree alone: a finding about a
13
+ * plain element, or its class or style, inside `<Freestyle>` is dropped; a Grammar component inside it is judged.
14
14
  */
15
15
  export declare const exemptFreestyle: (rule: Rule.RuleModule) => Rule.RuleModule;
16
16
  /** Attach the governing ownership rule and the rule's behavioral source without changing enforcement. */
@@ -11,8 +11,8 @@ export const defineRule = (definition) => ({
11
11
  create: (context) => definition.create(context),
12
12
  });
13
13
  /**
14
- * A rule that leaves the raw elements of a Freestyle subtree alone (owner ruling grammar-freestyle-region): a finding about a
15
- * plain element, or its class or style, inside `<Freestyle>` is dropped; a Grammar component inside it is judged as before.
14
+ * A rule that leaves the raw elements of a Freestyle subtree alone: a finding about a
15
+ * plain element, or its class or style, inside `<Freestyle>` is dropped; a Grammar component inside it is judged.
16
16
  */
17
17
  export const exemptFreestyle = (rule) => ({
18
18
  ...rule,
package/dist/lib/why.js CHANGED
@@ -9,6 +9,16 @@ export const why = {
9
9
  en: "A StatusDot or Badge label in `<file>` starts with a lowercase letter.",
10
10
  fix: "Start the label with an uppercase letter (`Running`, not `running`); the rule fixes a literal label in place.",
11
11
  },
12
+ "no-primary-tabs-misuse": {
13
+ code: "FE_GROUPED_CHOICE_CONTROL",
14
+ en: "Primary `Tabs` (or a `switch` header zone) in `<file>` hold a count, an href, an attention mark, one item or more than four items.",
15
+ 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`.",
16
+ },
17
+ "no-button-view-switch": {
18
+ code: "FE_GROUPED_CHOICE_CONTROL",
19
+ en: "Buttons carrying `aria-pressed`, `isSelected` or `isActive` stand side by side in `<file>`: joined buttons or pills acting as tabs.",
20
+ fix: "Switching between views or periods of one block is `Tabs` (the primary underline) in the block's `filter` header zone of its card; choosing a form value is `ChoiceChips` or `RadioGroup`; a `Button` holds a command, never a selection state.",
21
+ },
12
22
  "no-grouped-choice-controls": {
13
23
  code: "FE_GROUPED_CHOICE_CONTROL",
14
24
  en: "A ButtonGroup, FilterButtonGroup or SegmentedControl in `<file>` draws a group of attached buttons, which the Grammar no longer has.",
@@ -107,7 +117,7 @@ export const why = {
107
117
  "no-raised-surface-in-surface": {
108
118
  code: "FE_RAISED_SURFACE_IN_SURFACE",
109
119
  en: "A `SurfaceCard` in `<file>` stands inside another SurfaceCard, a Pane surface, or a Dialog, Drawer, AlertDialog or Popover: a surface never stands inside a surface.",
110
- fix: "Give the content to the host's own body, or use a kind of the outer card (`bands`, `list`, `figures`) for what needs its own faces.",
120
+ fix: "Give the content to the host's own body, or use a kind of the outer card (`list`, `figures`) or its typed `headers` and `footers` zones for what needs its own faces.",
111
121
  },
112
122
  "no-shell-bottom-tabs": {
113
123
  code: "FE_APP_SHELL_BOTTOM_TABS",
@@ -116,12 +126,12 @@ export const why = {
116
126
  },
117
127
  "surface-card-kind": {
118
128
  code: "FE_SURFACE_CARD_KIND",
119
- en: "A `body` SurfaceCard in `<file>` holds a hand-built list, a Divider, a SectionHeader or Heading as a second title.",
120
- fix: "Rows are `kind=\"list\"`, key figures `kind=\"figures\"`, faces divided by seams `kind=\"bands\"`; the card's title is its `label`.",
129
+ 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.",
130
+ fix: "Rows are `kind=\"list\"`, 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`.",
121
131
  },
122
132
  "status-text-uses-soft-foreground": {
123
133
  code: "FE_STYLE_TOKEN_ONLY",
124
- en: "`<file>` colours status content against the owner's pair rule (`<what>`): content on a `bg-<tone>-soft` tint paints with the solid tone (e.g. `bg-success-soft text-success`), or a mark with no tint behind it paints with the soft foreground (e.g. `text-success-soft-foreground` alone).",
134
+ en: "`<file>` colours status content against the status pair rule (`<what>`): content on a `bg-<tone>-soft` tint paints with the solid tone (e.g. `bg-success-soft text-success`), or a mark with no tint behind it paints with the soft foreground (e.g. `text-success-soft-foreground` alone).",
125
135
  fix: "Content on a background of the tone takes the pair: `bg-<tone>-soft` with `text-<tone>-soft-foreground`. A mark that stands alone, with no background of the tone, takes the tone itself: `text-<tone>`. A solid fill takes `bg-<tone>` with `text-<tone>-foreground`.",
126
136
  },
127
137
  };
@@ -3,7 +3,7 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
3
3
  * The rule that holds `status-colors.md` (HFS R61 `FE_STYLE_TOKEN_ONLY`, the status-pair rule for class names; no gate
4
4
  * judges the colours an app's theme gives the pair).
5
5
  *
6
- * A STATUS TONE x PAINTS IN TWO WAYS (owner ruling `status-soft-pair-on-background`). Content that sits ON A BACKGROUND OF THE
6
+ * A STATUS TONE x PAINTS IN TWO WAYS. Content that sits ON A BACKGROUND OF THE
7
7
  * TONE uses the pair `x-soft` and `x-soft-foreground`, the way a HeroUI flat Chip does. A mark that STANDS ALONE, with no
8
8
  * background of the tone behind it, uses `x` itself. A solid fill takes `x-foreground`.
9
9
  *
@@ -19,8 +19,8 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
19
19
  * enclosing element of the same file sets `bg-x-soft`. A mark with no tint behind it takes `text-x`. A constant, an array in
20
20
  * a constant or a `classes` entry is not judged for this finding, since the element that wears it is not in view.
21
21
  *
22
- * OFFSET POP. The family's light-theme tones are pastel fills (1.3 to 1.5:1 as bare text), and the owner chose to keep them
23
- * ("1. Pastel"): a bare mark wears the soft foreground there. When the selected Grammar is `offset-pop` the ALONE finding is
22
+ * OFFSET POP. The family's light-theme tones are pastel fills (1.3 to 1.5:1 as bare text), and they stay
23
+ * pastel: a bare mark wears the soft foreground there. When the selected Grammar is `offset-pop` the ALONE finding is
24
24
  * not reported; the ON A TINT finding still is.
25
25
  *
26
26
  * WHAT IT LEAVES ALONE: a bare solid tone (`text-success` with no `bg-success-soft` on the element), the soft pair on its tint, a
@@ -166,7 +166,7 @@ export const statusTextUsesSoftForeground = defineRule({
166
166
  },
167
167
  create(context) {
168
168
  // A `classes` entry inside a constant is reached twice (as part of the constant, and as the entry): one finding per string.
169
- // Offset Pop's light theme draws a bare mark with the soft foreground (owner choice "1. Pastel"), so the lone soft foreground is not judged there.
169
+ // Offset Pop's light theme draws a bare mark with the soft foreground, so the lone soft foreground is not judged there.
170
170
  const aloneJudged = grammarOf(context.settings) !== "offset-pop";
171
171
  const seen = new Set();
172
172
  const fresh = (strings) => [...strings].filter(({ node }) => !seen.has(node) && seen.add(node));
@@ -1,5 +1,5 @@
1
1
  import type { Rule } from "eslint";
2
- /** A body card does not hold what a kind draws: hand rows, a divider, a second title. */
2
+ /** 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. */
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;
@@ -8,7 +8,10 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
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
10
  * `label`),. Rows are `kind="list"`, key figures
11
- * `kind="figures"`, faces divided by seams `kind="bands"`.
11
+ * `kind="figures"`, bands divided by seams are the typed `headers` and `footers` zones.
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.
12
15
  *
13
16
  * R366. A card with a `label` heads a section; a peer you recognise and open is a `kind="tile"` and names itself inside. A
14
17
  * labelled card repeated in a `Grid kind="cards"` (two or more, or one written in a `.map`) is a tile drawn with the wrong
@@ -109,7 +112,49 @@ const HAND_COMPONENTS = new Map([
109
112
  ["SectionHeader", "title"],
110
113
  ["Heading", "title"],
111
114
  ]);
112
- /** A body card does not hold what a kind draws: hand rows, a divider, a second title. */
115
+ /** The Grammar components a `custom` zone never holds: the typed zones draw them. */
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. */
113
158
  export const surfaceCardKind = defineRule({
114
159
  meta: {
115
160
  type: "problem",
@@ -117,8 +162,9 @@ export const surfaceCardKind = defineRule({
117
162
  schema: [],
118
163
  messages: {
119
164
  list: "`<{{element}}>` is a hand-built list in a `body` card. Rows are `<SurfaceCard kind=\"list\" items={...} empty={...} />`, and the card draws every row the same way.",
120
- divider: "A `Divider` in a card is refused: the card draws its own seams. Faces divided by a line are `<SurfaceCard kind=\"bands\" bands={[...]} />`.",
121
- title: "`<{{element}}>` stands as a second title inside a card. The card has a `label` (and `fact`, `labelEnd`, `footer`); a sub-section of one subject is a band with its own `label` in `kind=\"bands\"`.",
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
+ 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
+ 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.",
122
168
  },
123
169
  },
124
170
  create(context) {
@@ -128,6 +174,15 @@ export const surfaceCardKind = defineRule({
128
174
  JSXElement(element) {
129
175
  const opening = element.openingElement;
130
176
  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
+ }
131
186
  if (component === "SurfaceCard" && isBodyCard(opening)) {
132
187
  for (const { node } of childElements(element)) {
133
188
  const child = node.openingElement;
@@ -4,8 +4,8 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
4
4
  /**
5
5
  * The surface nesting law (HFS R340 `FE_RAISED_SURFACE_IN_SURFACE`): a surface never stands inside another surface. A
6
6
  * `SurfaceCard` inside another `SurfaceCard`, inside a `Pane surface`, or inside a `Dialog`, `Drawer`, `AlertDialog` or
7
- * `Popover` is refused; the Grammar has one depth, raised, and draws no nested edge (owner decision: surface in surface is
8
- * banned totally, dialogs and drawers included). The Grammar throws the same refusal in development; this is its
7
+ * `Popover` is refused; the Grammar has one depth, raised, and draws no nested edge: a surface never
8
+ * sits in a surface, dialogs and drawers included. The Grammar throws the same refusal in development; this is its
9
9
  * same-file half, and R356 closes it across files.
10
10
  *
11
11
  * WHAT IT READS. A `SurfaceCard` element (or `<ns>.SurfaceCard`) imported from `@starci/grammar` that a `SurfaceCard`,
@@ -6,6 +6,37 @@ The Grammar draws no group of attached buttons. A choice among a few has one com
6
6
 
7
7
  Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
8
8
 
9
+ ## Which component switches what
10
+
11
+ - `Tabs` switches the views or periods of one block, or filters its list: the primary underline, `kind="filter"` in the block's `filter` (or `toolbar`) header zone of a `SurfaceCard`, one line under the strip.
12
+ - `ChoiceChips` or `RadioGroup` chooses a value of a form.
13
+ - A `Button` holds a command, never a selection state; a `ButtonGroup` holds commands only.
14
+ - A switch between modes or periods of one block ("This month / Last month", "Day / Week / Month", "List / Board") is `Tabs appearance="primary"` in the card's `switch` header zone.
15
+ - Two joined buttons or pills acting as tabs are banned. `SegmentedControl` is removed.
16
+
17
+ ## `starci-grammar/no-button-view-switch`
18
+
19
+ Finding code: `FE_GROUPED_CHOICE_CONTROL` (R380). Two or more adjacent `Button` or `IconButton` elements, or one written in a `.map`, that carry `aria-pressed`, `isSelected` or `isActive` are a view switch drawn as buttons and are a finding; one toggle button on its own is a command with a state and is not. Use `Tabs`.
20
+
21
+ **Invalid** (`src/components/blocks/Cash/component.tsx`)
22
+
23
+ ```tsx
24
+ <div>
25
+ <Button aria-pressed={period === "this"} onPress={() => setPeriod("this")}>This month</Button>
26
+ <Button aria-pressed={period === "last"} onPress={() => setPeriod("last")}>Last month</Button>
27
+ </div>
28
+ ```
29
+
30
+ **Valid**
31
+
32
+ ```tsx
33
+ <SurfaceCard kind="list" label="Cash" headers={[{ kind: "filter", label: "Period", items, selectedKey: period, onSelect: setPeriod }]} items={rows} empty={empty} />
34
+ ```
35
+
36
+ ## `starci-grammar/no-primary-tabs-misuse`
37
+
38
+ Finding code: `FE_GROUPED_CHOICE_CONTROL` (R380). `Tabs appearance="primary"` (HeroUI's primary variant, a pill in a track) and a card's `{ kind: "switch" }` header zone switch a mode or period of the same data among two to four short, fixed options. An `items` array literal with an item carrying `count`, `href` or `isAttention`, with one item, or with more than four items is a finding; views, filters with counts and destinations are the secondary (underline) `Tabs`. Grammar also refuses these at run time in development, and its types refuse them.
39
+
9
40
  ## `starci-grammar/no-grouped-choice-controls`
10
41
 
11
42
  A JSX element named `ButtonGroup`, `FilterButtonGroup` or `SegmentedControl` (bare or as a member) in product source is a finding; the message names the replacement for that component.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Law module: `status-colors.ts`. Catalogue: R61 FE_STYLE_TOKEN_ONLY (the status-pair rule for class names; no gate judges the colours an app's theme gives the pair).
4
4
 
5
- A status tone `x` (`success`, `warning`, `danger`, `info`, read from `lib/status-tones.generated.ts`, which is generated from the grammar with the stylelint vocabulary) paints in two ways. Content that sits on a background of the tone uses the pair `x-soft` and `x-soft-foreground`, the way a HeroUI flat Chip does. A mark that stands alone, with no background of the tone behind it, uses `x` itself. A solid fill takes `x-foreground`. The owner's words: "TEXT TRÊN BG THÌ X-SOFT VÀ X-SOFT-FOREGROUND, CÒN NẾU X ĐỘC LẬP THÌ ĐỂ X LUN" (ruling `status-soft-pair-on-background`).
5
+ A status tone `x` (`success`, `warning`, `danger`, `info`, read from `lib/status-tones.generated.ts`, which is generated from the grammar with the stylelint vocabulary) paints in two ways. Content that sits on a background of the tone uses the pair `x-soft` and `x-soft-foreground`, the way a HeroUI flat Chip does. A mark that stands alone, with no background of the tone behind it, uses `x` itself. A solid fill takes `x-foreground`.
6
6
 
7
7
  Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
8
8
 
@@ -13,7 +13,7 @@ Two findings, both read from `className`/`class`, from `cn()`/`clsx()` arguments
13
13
  - **on a tint** (message `onTint`): a class string that sets `bg-<tone>-soft` and also paints text, an icon or a text decoration with the solid tone of the same tone: `text-<tone>`, `fill-<tone>`, `stroke-<tone>`, `decoration-<tone>`. The content on the tint takes `text-<tone>-soft-foreground`.
14
14
  - **alone** (message `alone`): `text-<tone>-soft-foreground` (or `fill-`, `stroke-`, `decoration-`) in the `className` of an element when neither that element nor an element that encloses it in the same file sets `bg-<tone>-soft`. A mark with no tint behind it takes `text-<tone>`. A constant, an array in a constant or a `classes` entry is not judged for this finding, since the element that wears it is not in view; a component that receives its tint from another file is judged where the tint is written.
15
15
 
16
- On Offset Pop (`settings.starci.hfs.grammar` is `offset-pop`) the **alone** finding is not reported: the family's light-theme tones are pastel fills and a bare mark wears the soft foreground there (owner choice "1. Pastel"); its dark theme keeps bare x, which the rule does not refuse either.
16
+ On Offset Pop (`settings.starci.hfs.grammar` is `offset-pop`) the **alone** finding is not reported: the family's light-theme tones are pastel fills and a bare mark wears the soft foreground there; its dark theme keeps bare x, which the rule does not refuse either.
17
17
 
18
18
  A bare solid tone (`text-success` with no `bg-success-soft` on the element), the pair on its tint, a solid fill with its own ink, a solid border, ring or outline, and a tone beside a tint of another tone are not findings.
19
19
 
@@ -36,7 +36,7 @@ A bare solid tone (`text-success` with no `bg-success-soft` on the element), the
36
36
 
37
37
  **Finding code:** `FE_STYLE_TOKEN_ONLY`
38
38
 
39
- **Why:** `<file>` colours status content against the owner's pair rule (`<what>`): content on a `bg-<tone>-soft` tint paints with the solid tone, or a mark with no tint behind it paints with the soft foreground.
39
+ **Why:** `<file>` colours status content against the status pair rule (`<what>`): content on a `bg-<tone>-soft` tint paints with the solid tone, or a mark with no tint behind it paints with the soft foreground.
40
40
 
41
41
  **Fix:** Content on a background of the tone takes the pair: `bg-<tone>-soft` with `text-<tone>-soft-foreground`. A mark that stands alone, with no background of the tone, takes the tone itself: `text-<tone>`. A solid fill takes `bg-<tone>` with `text-<tone>-foreground`.
42
42
 
@@ -2,9 +2,8 @@
2
2
 
3
3
  Law module: `surface-card.ts`. Catalogue: R355 FE_SURFACE_CARD_KIND, R366 FE_LABEL_IN_GRID.
4
4
 
5
- `SurfaceCard` is one component whose `kind` the compiler checks: `body` (the default), `figures`, `list`, `accordion`,
6
- `bands` and `tile`. What a kind draws is not drawn by hand around it, and where the name sits follows the kind (ruling
7
- `card-label-by-kind`): a card that heads a section has a `label` outside the material, a tile names itself inside.
5
+ `SurfaceCard` is one component whose `kind` the compiler checks: `body` (the default), `figures`, `list`, `accordion`
6
+ and `tile`; any kind may carry typed `headers` and `footers` zones. What a kind draws is not drawn by hand around it, and where the name sits follows the kind: a card that heads a section has a `label` outside the material, a tile names itself inside.
8
7
 
9
8
  Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline. It applies to product
10
9
  source; a script or a file no slot owns is not judged.
@@ -15,6 +14,9 @@ Finding code: `FE_SURFACE_CARD_KIND` (R355). The direct children of a `SurfaceCa
15
14
  `kind="body"`) are not a raw `ul`, `ol`, `li` or `dl`, not a `Divider`, and not a `SectionHeader` or `Heading` standing as a
16
15
  second title. A `Section` whose only child is one `SurfaceCard` frames one subject twice. Children are read through
17
16
  `cond && <x/>`, `cond ? <x/> : <y/>` and `.map`.
17
+ On a `SurfaceCard` or a `Board`, the `children` of a `{ kind: "custom" }` zone written in a `headers` or `footers` array literal hold no
18
+ `Tabs`, `SearchField` or `Divider` (`zone`): filter and search are the typed `filter`, `search` and `toolbar` zones and the card draws
19
+ its own seams. Grammar also refuses them at run time in development.
18
20
 
19
21
  **Invalid** (`src/components/blocks/Runs/component.tsx`)
20
22
 
@@ -3,8 +3,8 @@
3
3
  Law module: `surface-depth.ts`. Catalogue: R340 FE_RAISED_SURFACE_IN_SURFACE.
4
4
 
5
5
  The Grammar draws one depth, raised, and no nested edge: a `SurfaceCard` inside another `SurfaceCard`, inside a
6
- `Pane surface`, or inside a `Dialog`, `Drawer`, `AlertDialog` or `Popover` is refused (owner decision: surface in surface
7
- is banned totally, dialogs and drawers included). Development throws the same refusal from the Grammar itself; this rule is
6
+ `Pane surface`, or inside a `Dialog`, `Drawer`, `AlertDialog` or `Popover` is refused: a surface
7
+ never sits in a surface, dialogs and drawers included. Development throws the same refusal from the Grammar itself; this rule is
8
8
  its same-file half and R356 closes it across files.
9
9
 
10
10
  Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline. It applies to product
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-grammar-core",
3
- "version": "0.23.2",
3
+ "version": "0.25.0",
4
4
  "description": "ESLint rules for the core Grammar's component, token and composition contracts.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@starci/eslint-canon-fe": "~9.16.0",
45
- "@starci/hfs": "~5.13.0",
45
+ "@starci/hfs": "~6.0.0",
46
46
  "eslint": ">=9",
47
47
  "typescript": ">=5.9"
48
48
  },
@@ -35,33 +35,25 @@ rules:
35
35
  One kit keeps one design language and one token source.
36
36
  cases:
37
37
  - id: case-1
38
- date: "2026-10-13"
39
- source: owner
40
38
  when: A feature needs a visual capability the selected Grammar lacks
41
39
  write: Extend and release the owning Grammar before consuming it; keep one visual language in the app.
42
40
  - id: case-2
43
- date: "2026-10-25"
44
- source: owner
45
41
  when: A conversation or group identity represents several people
46
42
  write: |-
47
43
  Show a composite identity based on the actual members, distinguish it from an individual,
48
44
  and follow COLLECTION-3 in knowledge/ui/composition/collection.yaml. The selected family
49
45
  owns its renderer, cell geometry, overflow treatment and fallback API.
50
46
  - id: case-3
51
- date: "2026-10-25"
52
- source: owner
53
47
  when: A person or identity needs an avatar
54
48
  write: |-
55
49
  Pass the uploaded image when one exists; otherwise the selected Grammar's identity renderer uses
56
50
  bundled DiceBear initials from the first and last words of the name, with colour seeded by the
57
- user or identity id when present and by the name otherwise (owner:avatar-default-dicebear-initials).
58
- Agent names follow the same free-text rule and add the Grammar's bot badge
59
- (owner:agent-avatar-initials-bot-badge). Apps neither declare nor import an avatar-generation
51
+ user or identity id when present and by the name otherwise.
52
+ Agent names follow the same free-text rule and add the Grammar's bot badge.
53
+ Apps neither declare nor import an avatar-generation
60
54
  library and draw no avatar visuals; the family owns the renderer API (the StarCi recipe is
61
55
  groupIdentity in its playbook).
62
56
  - id: case-4
63
- date: "2026-10-30"
64
- source: owner
65
57
  when: A screen shows generated character art (a mascot)
66
58
  write: |-
67
59
  Render it with the selected Grammar's Mascot at a step of its size scale (sm, md, lg, or hero for a split
@@ -69,8 +61,6 @@ rules:
69
61
  or illustration is framed by MediaFrame. Generated art under /images/ never renders through a bare Image or
70
62
  img (R338, R339).
71
63
  - id: case-5
72
- date: "2026-10-31"
73
- source: owner
74
64
  when: A screen places content in a PaneGrid
75
65
  write: |-
76
66
  Compose a PaneGrid of Pane elements (never a wrapper component), give each Pane PaneSection bands (never a raw
@@ -15,7 +15,7 @@ provenance:
15
15
  - knowledge/patterns/fe/index.yaml
16
16
  - knowledge/ui/composition/layout.yaml
17
17
  limitations: |-
18
- The owner will refine these rules. Static checks prove source composition only; keyboard behavior,
18
+ Static checks prove source composition only; keyboard behavior,
19
19
  scrolling, responsive visibility, rendered geometry and menu contents require inspection of the running shell.
20
20
  rules:
21
21
  - id: FE-APP-SHELL-1
@@ -77,7 +77,7 @@ rules:
77
77
  choice clear and names each supported language by its autonym. The theme control exposes its
78
78
  current setting accessibly. Notifications expose an unread count and open their own region.
79
79
  The account control shows the user's uploaded identity or the selected Grammar's bundled DiceBear
80
- initials fallback (owner:avatar-default-dicebear-initials): the first and last words of the name
80
+ initials fallback: the first and last words of the name
81
81
  supply its letters, and the user id seeds its colour, falling back to the name when no id exists.
82
82
  - id: case-2
83
83
  when: The account control opens its menu
@@ -62,8 +62,7 @@ rules:
62
62
  A field or choice control sits inside a painted surface: a card, panel, modal, drawer,
63
63
  popover or navigation region
64
64
  observe: |-
65
- Owner ruling 2026-10-25 (owner:surfacecard-always-painted; ruling:R318/case-1): the selected
66
- Grammar supplies a nested treatment that separates the control from its owning painted
65
+ The selected Grammar supplies a nested treatment that separates the control from its owning painted
67
66
  surface, and every card surface paints a face. A control placed outside a surface uses the
68
67
  treatment for that layer. Unpainted grouping containers pass their parent's context through.
69
68
  Applications compose the published surface and control and omit the field variant, allowing