@kerfjs/ui 5.0.0-beta.119 → 5.0.0-beta.120

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.
@@ -116,6 +116,37 @@ const stringList = (value) =>
116
116
  value.every((item) => typeof item === 'string' && item.length > 0) &&
117
117
  new Set(value).size === value.length;
118
118
 
119
+ const wiringPath = (path) =>
120
+ typeof path === 'string' &&
121
+ path.length > 0 &&
122
+ !isAbsolute(path) &&
123
+ !path.split('/').includes('..') &&
124
+ !/[*?]/.test(path);
125
+
126
+ const wiringEntries = (entries) =>
127
+ Array.isArray(entries) &&
128
+ entries.every((entry) =>
129
+ typeof entry === 'string'
130
+ ? wiringPath(entry)
131
+ : entry &&
132
+ typeof entry === 'object' &&
133
+ !Array.isArray(entry) &&
134
+ Object.keys(entry).every((key) => ['render', 'client'].includes(key)) &&
135
+ stringList(entry.render) &&
136
+ entry.render.length > 0 &&
137
+ entry.render.every(wiringPath) &&
138
+ stringList(entry.client) &&
139
+ entry.client.length > 0 &&
140
+ entry.client.every(wiringPath),
141
+ ) &&
142
+ new Set(
143
+ entries.map((entry) =>
144
+ typeof entry === 'string'
145
+ ? `string:${entry}`
146
+ : JSON.stringify([entry.render, entry.client]),
147
+ ),
148
+ ).size === entries.length;
149
+
119
150
  function validateApplicationUiProfile(profile, options = {}) {
120
151
  const {
121
152
  source = '<profile>',
@@ -188,19 +219,11 @@ function validateApplicationUiProfile(profile, options = {}) {
188
219
  const exceptions = arrayAt(profile.exceptions, '$.exceptions');
189
220
  rejectUnknown(wiring, ['entries'], '$.wiring');
190
221
  if (wiring?.entries !== undefined) {
191
- if (
192
- !stringList(wiring.entries) ||
193
- wiring.entries.some(
194
- (entry) =>
195
- isAbsolute(entry) ||
196
- entry.split('/').includes('..') ||
197
- /[*?]/.test(entry),
198
- )
199
- )
222
+ if (!wiringEntries(wiring.entries))
200
223
  add(
201
224
  'KUI-P030',
202
225
  '$.wiring.entries',
203
- 'Wiring entries must be unique workspace-relative paths without traversal or wildcards.',
226
+ 'Wiring entries must be unique workspace-relative paths or render/client pairs without traversal or wildcards.',
204
227
  );
205
228
  }
206
229
  const packages = new Set();
@@ -40,8 +40,8 @@ export interface ApplicationUiProfile {
40
40
  spacingScale?: 'kerf-five-step' | 'application';
41
41
  };
42
42
  wiring?: {
43
- /** Static application entry modules, relative to the workspace root. */
44
- entries?: string[];
43
+ /** Static application entries or paired server-render/client roots, relative to the workspace root. */
44
+ entries?: Array<string | { render: string[]; client: string[] }>;
45
45
  };
46
46
  exceptions?: Array<{
47
47
  id: string;
@@ -210,6 +210,37 @@ const stringList = (value) =>
210
210
  value.every((item) => typeof item === 'string' && item.length > 0) &&
211
211
  new Set(value).size === value.length;
212
212
 
213
+ const wiringPath = (path) =>
214
+ typeof path === 'string' &&
215
+ path.length > 0 &&
216
+ !isAbsolute(path) &&
217
+ !path.split('/').includes('..') &&
218
+ !/[*?]/.test(path);
219
+
220
+ const wiringEntries = (entries) =>
221
+ Array.isArray(entries) &&
222
+ entries.every((entry) =>
223
+ typeof entry === 'string'
224
+ ? wiringPath(entry)
225
+ : entry &&
226
+ typeof entry === 'object' &&
227
+ !Array.isArray(entry) &&
228
+ Object.keys(entry).every((key) => ['render', 'client'].includes(key)) &&
229
+ stringList(entry.render) &&
230
+ entry.render.length > 0 &&
231
+ entry.render.every(wiringPath) &&
232
+ stringList(entry.client) &&
233
+ entry.client.length > 0 &&
234
+ entry.client.every(wiringPath),
235
+ ) &&
236
+ new Set(
237
+ entries.map((entry) =>
238
+ typeof entry === 'string'
239
+ ? `string:${entry}`
240
+ : JSON.stringify([entry.render, entry.client]),
241
+ ),
242
+ ).size === entries.length;
243
+
213
244
  export function validateApplicationUiProfile(
214
245
  profile,
215
246
  { source = '<profile>', knownComponents, knownTokens, knownRules } = {},
@@ -282,19 +313,11 @@ export function validateApplicationUiProfile(
282
313
  const exceptions = arrayAt(profile?.exceptions, '$.exceptions');
283
314
  rejectUnknown(wiring, ['entries'], '$.wiring');
284
315
  if (wiring?.entries !== undefined) {
285
- if (
286
- !stringList(wiring.entries) ||
287
- wiring.entries.some(
288
- (entry) =>
289
- isAbsolute(entry) ||
290
- entry.split('/').includes('..') ||
291
- /[*?]/.test(entry),
292
- )
293
- )
316
+ if (!wiringEntries(wiring.entries))
294
317
  add(
295
318
  'KUI-P030',
296
319
  '$.wiring.entries',
297
- 'Wiring entries must be unique workspace-relative paths without traversal or wildcards.',
320
+ 'Wiring entries must be unique workspace-relative paths or render/client pairs without traversal or wildcards.',
298
321
  );
299
322
  }
300
323
 
@@ -29,8 +29,15 @@
29
29
  "type": "object",
30
30
  "properties": {
31
31
  "entries": {
32
- "description": "Application entry modules, relative to the workspace root, where application-scoped wiring is installed.",
33
- "$ref": "#/$defs/stringList"
32
+ "description": "Application entry modules or paired server-render and browser-client module roots, relative to the workspace root.",
33
+ "type": "array",
34
+ "items": {
35
+ "oneOf": [
36
+ { "type": "string", "minLength": 1 },
37
+ { "$ref": "#/$defs/wiringPair" }
38
+ ]
39
+ },
40
+ "uniqueItems": true
34
41
  }
35
42
  },
36
43
  "additionalProperties": false
@@ -47,6 +54,21 @@
47
54
  "items": { "type": "string", "minLength": 1 },
48
55
  "uniqueItems": true
49
56
  },
57
+ "wiringPair": {
58
+ "type": "object",
59
+ "required": ["render", "client"],
60
+ "properties": {
61
+ "render": { "$ref": "#/$defs/nonemptyStringList" },
62
+ "client": { "$ref": "#/$defs/nonemptyStringList" }
63
+ },
64
+ "additionalProperties": false
65
+ },
66
+ "nonemptyStringList": {
67
+ "type": "array",
68
+ "items": { "type": "string", "minLength": 1 },
69
+ "minItems": 1,
70
+ "uniqueItems": true
71
+ },
50
72
  "catalogLocation": {
51
73
  "type": "object",
52
74
  "required": ["path", "schemaVersion"],
@@ -1,6 +1,6 @@
1
1
  # Public API signatures for the UI authoring corpus
2
2
 
3
- Generated from emitted declarations for `@kerfjs/ui@5.0.0-beta.119` and `kerfjs@5.0.0-beta.119`. This bounded reference covers only APIs used by the seven-task corpus. It is interface evidence, not an implementation or runtime guarantee.
3
+ Generated from emitted declarations for `@kerfjs/ui@5.0.0-beta.120` and `kerfjs@5.0.0-beta.120`. This bounded reference covers only APIs used by the seven-task corpus. It is interface evidence, not an implementation or runtime guarantee.
4
4
 
5
5
  ## `@kerfjs/ui/css-values`
6
6
 
package/ai/skill.md CHANGED
@@ -276,6 +276,13 @@ Each layer is checked against its then-effective catalogs; later overrides do
276
276
  not excuse broken catalogs or stale references in a parent layer. Synchronous
277
277
  ESLint integrations use `./application-ui-profile-sync.cjs` and surface any
278
278
  failure as `KUI-L090`.
279
+ Declare `wiring.entries` for application-scoped UI obligations. A plain path
280
+ checks one client import graph. If a server-rendered page loads a separate
281
+ browser entry by URL, pair the roots in one item, for example
282
+ `{ "render": ["src/routes/admin/index.tsx"], "client": ["src/client/app/admin.ts"] }`.
283
+ The `ui-wiring` rule checks render-side component use against helper calls and
284
+ registration imports in that pair's client graph; list every server page that
285
+ loads the entry. Module-scoped obligations still belong in the rendering module.
279
286
 
280
287
  Choose from the need, not from visual resemblance:
281
288
 
@@ -438,6 +445,10 @@ meaning) to an icon-only `Button`, or put a `Badge placement="corner"` inside a
438
445
  `ToolbarControlGroup` button and name the count in its `aria-label`; never
439
446
  position a badge with application CSS.
440
447
 
448
+ If the primary toolbar has search, make it search or filter the primary searchable content of the current page or view. Rebind its scope and available filters on sub-pages and alternate views; do not wire it only to the first view. Potentially long lists, especially dynamic or user-generated ones, should normally be searchable or filterable. Omit search where the page has no searchable content. `SearchField` supplies the editor; the application owns which content the query filters.
449
+
450
+ If primary selectable content has a context menu, especially with multiselect, put the same applicable actions in a primary-toolbar overflow `PopupMenu` so users can act without right-click. Keep both menus' availability and behavior tied to the current selection. An important action can also be a dedicated toolbar button; including it again in overflow is an application choice.
451
+
441
452
  For a page's content column, give the `List` `contentWidth` (`compact` 440px,
442
453
  `medium` 640px, `wide` 864px; centered by default, `contentAlign="start"`
443
454
  otherwise) instead of an application `max-width` wrapper; it composes with
@@ -1,6 +1,6 @@
1
1
  # Web Awesome JSX signatures for the UI authoring corpus
2
2
 
3
- Generated from the emitted `@kerfjs/ui@5.0.0-beta.119` declaration boundary. Import `@kerfjs/ui/webawesome` for type effects when authoring direct `wa-*` JSX. The module emits no runtime behavior and does not register custom elements.
3
+ Generated from the emitted `@kerfjs/ui@5.0.0-beta.120` declaration boundary. Import `@kerfjs/ui/webawesome` for type effects when authoring direct `wa-*` JSX. The module emits no runtime behavior and does not register custom elements.
4
4
 
5
5
  ```ts
6
6
  import { KerfCustomElement } from 'kerfjs/jsx-runtime';
@@ -227,6 +227,11 @@ application-scoped helper calls and registration imports once at each entry
227
227
  that reaches a rendering module, while a composition entry with
228
228
  `wiring.scope: "module"` keeps a local obligation. See the
229
229
  [`ui-wiring` rule](../../eslint-plugin/docs/rules/ui-wiring.md).
230
+ For server-rendered pages, an entry can instead pair `render` module roots with
231
+ the browser `client` roots their documents load, for example
232
+ `{ "render": ["src/routes/admin/index.tsx"], "client": ["src/client/app/admin.ts"] }`.
233
+ Application-scoped obligations from the render graph are satisfied by wiring
234
+ in the same item's client graph. String entries retain the single-graph rule.
230
235
  Every resolved field retains its source file. The shipped
231
236
  `application-ui-profile.mjs` API implements discovery, merge, loading, and
232
237
  validation and reports actionable originating file + JSON-path diagnostics for stale
@@ -560,6 +560,8 @@ still owns the controlled `value` and localized action labels.
560
560
  hidden compact replacement and keeps compact overlays exclusive by default.
561
561
  - `SearchField` is a structured editor. A `TextField` is the right answer for ordinary text.
562
562
 
563
+ When a `SearchField` sits in the primary toolbar, connect it to the current page or view's primary searchable content, including sub-pages and alternate views. Update its query scope and filters as that content changes; do not leave it wired only to the first view. Offer search or filtering for potentially long lists, especially dynamic or user-generated ones. Omit the control on pages without searchable content.
564
+
563
565
  For common structured search, use `createSearchFieldModel` from `@kerfjs/ui/search-field-model`, pass the model to `SearchField`, and register it under the field id in `wireSearchFields(root, { models })`. Rules parse `name:value` expressions and provide suggestions; the model owns chips, selection, removal, clear, and an optional evaluation result. The field subscribes only to `model.structure`, so typing plain text does not re-run the host render; read `model.state.peek()` in the host's render and bind `model.result` as a signal hole instead of reading `model.state.value`. Omit `model` and `models` for full manual control.
564
566
 
565
567
  In a form, use `SearchField presentation="form-field"` with its `label`,
@@ -788,6 +790,8 @@ bubbling, cancelable `kui-menu-select` event, alongside `detail.item` and its
788
790
  renders it. Commands still dispatch their own `data-action` once on pointer and
789
791
  keyboard selection; canceling `kui-menu-select` keeps the menu open.
790
792
 
793
+ For primary selectable content with a right-click context menu, also provide a primary-toolbar overflow `PopupMenu` for the applicable actions, especially when multiple items can be selected. Derive both menus' enabled state, labels, and handlers from the current selection so touch and keyboard users get the same commands. A prominent command may have its own toolbar button; keep it in overflow or omit that duplicate as the application needs. The two menus can be separate instances with shared action policy.
794
+
791
795
  For a row opened by right-click, render `PopupMenu` with `context`, `label`,
792
796
  `anchor`, and a stable root `data-*` marker. Its trigger is an invisible anchor
793
797
  removed from the accessibility tree; a separate visible button may stay
@@ -24,6 +24,10 @@ Unrelated updates must not close controls, move focus, reset a draft, replace a
24
24
 
25
25
  Establish one reading order and one dominant action per decision point. Group first with alignment, spacing, typography, and shared surfaces. A border, fill, badge, or nested card must communicate a real distinction. A divider is chrome too: a line between a pane's own header and its list, or under a toolbar whose content already spaces itself, marks nothing and is dropped (`dividerSides=""`), never padded around. Put a control near where its effect appears — a collapsed drawer's restore beside the drawer, not in a distant top toolbar.
26
26
 
27
+ A search control in the primary toolbar serves the primary searchable content of the current page or view. When navigation changes that content, change the search target and available filters with it. Potentially long lists, especially dynamic or user-generated lists, should normally offer search or filtering; a page without searchable content does not need a search control.
28
+
29
+ When primary selectable content has a context menu, especially for multiple selection, expose its applicable actions through a primary-toolbar overflow menu too. People on touch or keyboard-only devices must be able to reach those actions without right-click. A frequently used context action may also have a dedicated toolbar button; the application may keep or omit that duplicate in overflow. Both paths follow the same selection and action policy.
30
+
27
31
  ### Reach for the primitive, not for CSS
28
32
 
29
33
  The package is designed to look right _unstyled_. A screen built from the
package/llms.txt CHANGED
@@ -148,6 +148,11 @@ explains when to reuse, compose, extend, or use native HTML.
148
148
  tokens, layout conventions, and narrow source-located exceptions. Validation
149
149
  is catalog-aware per layer, including parent values later overridden by a
150
150
  child; synchronous hosts use [application-ui-profile-sync.cjs](./ai/application-ui-profile-sync.cjs).
151
+ In `wiring.entries`, use a plain path for one client import graph, or pair
152
+ server-rendered roots and the browser entries their documents load as
153
+ `{ "render": ["src/routes/admin/index.tsx"], "client": ["src/client/app/admin.ts"] }`.
154
+ The `ui-wiring` rule checks application-scoped render obligations against
155
+ wiring reachable from a client root in the same pair.
151
156
  See the
152
157
  [workspace profile example](./docs/examples/application-ui-profile.json).
153
158
  A zone's optional `jsx.prop` is its only authoritative JSX binding; never
@@ -466,6 +471,19 @@ headingLevel`, `SearchField clearIcon`, `ContentItem frame="framed"` for a
466
471
  whose strict "below" is one pixel off the Toolbar's inclusive width), or
467
472
  gather them behind a "…" `PopupMenu` overflow group. The app decides which
468
473
  controls yield.
474
+ - **Search the current view.** A primary-toolbar search filters the primary
475
+ searchable content on the current page or view, including sub-pages and
476
+ alternate views. Rebind its scope and filters when navigation changes that
477
+ content. Potentially long lists, especially dynamic or user-generated lists,
478
+ should normally offer search or filtering; omit search where there is no
479
+ searchable content. The application owns the query target; `SearchField`
480
+ supplies the editor.
481
+ - **Expose selection actions without right-click.** When primary selectable
482
+ content has a context menu, especially with multiselect, put its applicable
483
+ actions in a primary-toolbar overflow `PopupMenu` too. Keep both menus'
484
+ enabled state and behavior tied to the current selection. A key action may
485
+ also have its own toolbar button; the application may keep or omit that
486
+ duplicate in overflow.
469
487
  - **Change the brand with `--kui-color-brand`.** Set it once on `:root` (any
470
488
  color): Kerf derives the brand fill, brand text and links, text on brand
471
489
  fills, and the focus ring at WCAG AA, and Web Awesome's brand tokens follow.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kerfjs/ui",
3
- "version": "5.0.0-beta.119",
3
+ "version": "5.0.0-beta.120",
4
4
  "description": "Accessible, composable UI primitives for kerf applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",