@kerfjs/ui 4.4.1 → 5.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +234 -5
  2. package/ai/component-catalog.json +4473 -0
  3. package/ai/component-catalog.schema.json +79 -0
  4. package/ai/public-api-signatures-v1.md +619 -0
  5. package/ai/skill.md +65 -11
  6. package/ai/webawesome-jsx-signatures-v1.md +106 -0
  7. package/dist/app-tab.d.ts +12 -2
  8. package/dist/app-tab.js +2 -1
  9. package/dist/browser/app-tab.js +2 -2
  10. package/dist/browser/dialog-header.js +4 -2
  11. package/dist/browser/disclosure-arrow.js +4 -0
  12. package/dist/browser/empty-state.js +3 -3
  13. package/dist/browser/loading-spinner.js +2 -2
  14. package/dist/browser/lucide-icon.js +2 -2
  15. package/dist/browser/menu-action-row.js +3 -0
  16. package/dist/browser/menu-header.js +4 -2
  17. package/dist/browser/menu-item.js +2 -2
  18. package/dist/browser/page-header.js +2 -2
  19. package/dist/browser/resizable-region.js +2 -2
  20. package/dist/browser/segmented-control.js +2 -2
  21. package/dist/browser/select.js +3 -3
  22. package/dist/browser/state-banner.js +2 -2
  23. package/dist/browser/tab-bar.js +2 -2
  24. package/dist/browser/token-search-field.js +4 -0
  25. package/dist/browser/toolbar-control-group.js +2 -2
  26. package/dist/browser/toolbar-text.js +2 -2
  27. package/dist/browser/toolbar.js +2 -2
  28. package/dist/browser/value-table.js +2 -2
  29. package/dist/chunk-56RJXPHG.js +43 -0
  30. package/dist/chunk-56RJXPHG.js.map +1 -0
  31. package/dist/chunk-7BR3DO2A.js +31 -0
  32. package/dist/chunk-7BR3DO2A.js.map +1 -0
  33. package/dist/chunk-7LDCTU7D.js +134 -0
  34. package/dist/chunk-7LDCTU7D.js.map +1 -0
  35. package/dist/{chunk-4HHCYSGT.js → chunk-AQNKJRFH.js} +2 -2
  36. package/dist/{chunk-4HHCYSGT.js.map → chunk-AQNKJRFH.js.map} +1 -1
  37. package/dist/{chunk-NHXX4JI5.js → chunk-CTQKI2XL.js} +3 -3
  38. package/dist/chunk-CTQKI2XL.js.map +1 -0
  39. package/dist/chunk-EGHL5S4P.js +33 -0
  40. package/dist/chunk-EGHL5S4P.js.map +1 -0
  41. package/dist/chunk-H5AGGVU5.js +75 -0
  42. package/dist/chunk-H5AGGVU5.js.map +1 -0
  43. package/dist/chunk-K3G72I6D.js +24 -0
  44. package/dist/chunk-K3G72I6D.js.map +1 -0
  45. package/dist/{chunk-3O7ZEUW2.js → chunk-M5JRI6MN.js} +3 -3
  46. package/dist/chunk-M5JRI6MN.js.map +1 -0
  47. package/dist/chunk-NPPD2A6O.js +40 -0
  48. package/dist/chunk-NPPD2A6O.js.map +1 -0
  49. package/dist/chunk-R6JHHBKQ.js +19 -0
  50. package/dist/chunk-R6JHHBKQ.js.map +1 -0
  51. package/dist/chunk-S3TPM2LP.js +23 -0
  52. package/dist/chunk-S3TPM2LP.js.map +1 -0
  53. package/dist/{chunk-T5XNMVOI.js → chunk-XZXRLY5Q.js} +14 -5
  54. package/dist/chunk-XZXRLY5Q.js.map +1 -0
  55. package/dist/dialog-header.d.ts +3 -2
  56. package/dist/dialog-header.js +3 -1
  57. package/dist/disclosure-arrow.d.ts +14 -0
  58. package/dist/disclosure-arrow.js +4 -0
  59. package/dist/disclosure-arrow.js.map +1 -0
  60. package/dist/index.d.ts +5 -1
  61. package/dist/index.js +16 -11
  62. package/dist/menu-action-row.d.ts +50 -0
  63. package/dist/menu-action-row.js +4 -0
  64. package/dist/menu-action-row.js.map +1 -0
  65. package/dist/menu-header.d.ts +28 -2
  66. package/dist/menu-header.js +4 -1
  67. package/dist/menu-item.d.ts +10 -1
  68. package/dist/menu-item.js +2 -1
  69. package/dist/resizable-region.d.ts +3 -1
  70. package/dist/resizable-region.js +1 -1
  71. package/dist/select.js +1 -1
  72. package/dist/styles/app-tab.css +152 -0
  73. package/dist/styles/dialog-header.css +87 -0
  74. package/dist/styles/disclosure-arrow.css +23 -0
  75. package/dist/styles/empty-state.css +47 -0
  76. package/dist/styles/foundation.css +326 -0
  77. package/dist/styles/layout.css +73 -0
  78. package/dist/styles/loading-spinner.css +21 -0
  79. package/dist/styles/lucide-icon.css +6 -0
  80. package/dist/styles/menu-action-row.css +160 -0
  81. package/dist/styles/menu-header.css +143 -0
  82. package/dist/styles/menu-item.css +123 -0
  83. package/dist/styles/page-header.css +33 -0
  84. package/dist/styles/resizable-region.css +111 -0
  85. package/{src → dist/styles}/segmented-control.css +62 -31
  86. package/dist/styles/select.css +96 -0
  87. package/dist/styles/state-banner.css +173 -0
  88. package/dist/styles/styles.css +22 -0
  89. package/dist/styles/tab-bar.css +45 -0
  90. package/dist/styles/token-search-field.css +281 -0
  91. package/dist/styles/toolbar-control-group.css +161 -0
  92. package/dist/styles/toolbar-text.css +29 -0
  93. package/dist/styles/toolbar.css +52 -0
  94. package/dist/styles/value-table.css +75 -0
  95. package/{src → dist/styles}/webawesome.css +119 -29
  96. package/dist/token-search-field.d.ts +43 -0
  97. package/dist/token-search-field.js +4 -0
  98. package/dist/token-search-field.js.map +1 -0
  99. package/dist/value-table.d.ts +10 -2
  100. package/dist/value-table.js +1 -1
  101. package/dist/webawesome.d.ts +100 -0
  102. package/dist/webawesome.js +3 -0
  103. package/dist/webawesome.js.map +1 -0
  104. package/dist/wire-resizable-regions.js +1 -1
  105. package/dist/wire-token-search-fields.d.ts +11 -0
  106. package/dist/wire-token-search-fields.js +5 -0
  107. package/dist/wire-token-search-fields.js.map +1 -0
  108. package/docs/accessibility.md +60 -3
  109. package/docs/component-contract.md +131 -3
  110. package/docs/component-selection.md +133 -0
  111. package/docs/design-philosophy.md +38 -0
  112. package/docs/examples/command-palette-adapter.tsx +70 -0
  113. package/docs/layout.md +106 -0
  114. package/docs/recipes.md +124 -0
  115. package/docs/ux-demo.md +23 -9
  116. package/docs/webawesome-theme.md +15 -0
  117. package/llms.txt +25 -2
  118. package/package.json +70 -27
  119. package/ux-demo/recipes/app-shell.tsx +32 -0
  120. package/ux-demo/recipes/compact-toolbar.tsx +43 -0
  121. package/ux-demo/recipes/composer-form.tsx +63 -0
  122. package/ux-demo/recipes/list-workspace-states.tsx +26 -0
  123. package/ux-demo/recipes/loaders.ts +27 -0
  124. package/ux-demo/recipes/master-detail-dialog.tsx +45 -0
  125. package/ux-demo/recipes/mount-recipe.ts +38 -0
  126. package/ux-demo/recipes/navigation-sidebar.tsx +26 -0
  127. package/ux-demo/recipes/recipes.css +344 -0
  128. package/ux-demo/recipes/types.ts +11 -0
  129. package/ux-demo/recipes/workspace-header.tsx +12 -0
  130. package/dist/chunk-3O7ZEUW2.js.map +0 -1
  131. package/dist/chunk-723YNJBH.js +0 -17
  132. package/dist/chunk-723YNJBH.js.map +0 -1
  133. package/dist/chunk-NHXX4JI5.js.map +0 -1
  134. package/dist/chunk-OPCJRCYO.js +0 -19
  135. package/dist/chunk-OPCJRCYO.js.map +0 -1
  136. package/dist/chunk-T5XNMVOI.js.map +0 -1
  137. package/dist/chunk-VKH2JLDZ.js +0 -10
  138. package/dist/chunk-VKH2JLDZ.js.map +0 -1
  139. package/dist/chunk-WY4CAEPG.js +0 -14
  140. package/dist/chunk-WY4CAEPG.js.map +0 -1
  141. package/src/app-tab.css +0 -20
  142. package/src/dialog-header.css +0 -9
  143. package/src/empty-state.css +0 -6
  144. package/src/foundation.css +0 -106
  145. package/src/loading-spinner.css +0 -4
  146. package/src/lucide-icon.css +0 -1
  147. package/src/menu-header.css +0 -13
  148. package/src/menu-item.css +0 -12
  149. package/src/page-header.css +0 -3
  150. package/src/resizable-region.css +0 -19
  151. package/src/select.css +0 -18
  152. package/src/state-banner.css +0 -31
  153. package/src/styles.css +0 -18
  154. package/src/tab-bar.css +0 -4
  155. package/src/toolbar-control-group.css +0 -25
  156. package/src/toolbar-text.css +0 -4
  157. package/src/toolbar.css +0 -9
  158. package/src/value-table.css +0 -5
package/README.md CHANGED
@@ -2,33 +2,107 @@
2
2
 
3
3
  Accessible, composable UI primitives for [kerf](https://github.com/brianwestphal/kerf). The package ships production components, component-reachable CSS, accessibility and keyboard contracts, an AI-readable guide, and a production-backed UX catalog.
4
4
 
5
+ Start interface work with the [need-first component selection matrix](./docs/component-selection.md). It distinguishes direct reuse, composition, thin application adapters, and genuinely custom semantics, with imports, required wiring, application ownership, alternatives, and recipes for every public primitive.
6
+
7
+ For connective application patterns, use the seven [production composition
8
+ recipes](./docs/recipes.md). Each has a stable catalog route, runnable state,
9
+ public-subpath source, semantic layout ownership, and explicit application
10
+ customization boundaries. The composer recipe demonstrates one coherent form
11
+ surface with `DialogHeader` hierarchy and field/action controls aligned to the
12
+ shared 8px gutter; only persistent feedback adds a nested semantic
13
+ `StateBanner` surface.
14
+
15
+ When no primitive matches, keep policy application-owned while reusing the
16
+ layout vocabulary. The typed
17
+ [`command-palette-adapter.tsx`](./docs/examples/command-palette-adapter.tsx)
18
+ shows that application boundary explicitly; it is reference source, not a package
19
+ runtime export.
20
+
5
21
  ```bash
6
22
  npm install kerfjs @kerfjs/ui
7
23
  ```
8
24
 
9
25
  ```tsx
10
26
  import { MenuItem } from '@kerfjs/ui/menu-item';
27
+ import { MenuHeader } from '@kerfjs/ui/menu-header';
28
+ import { MenuActionRow } from '@kerfjs/ui/menu-action-row';
11
29
  import { Toolbar } from '@kerfjs/ui/toolbar';
30
+ import { ToolbarControlGroup } from '@kerfjs/ui/toolbar-control-group';
12
31
  import { ToolbarText } from '@kerfjs/ui/toolbar-text';
13
32
 
14
33
  mount(root, () => <>
15
- <Toolbar label="Document" leading={<ToolbarText text="Notes" />} />
16
- <MenuItem action="open-notes" label="Notes" selected />
34
+ <Toolbar label="Document" leading={<ToolbarControlGroup appearance="borderless" single><ToolbarText text="Notes" /></ToolbarControlGroup>} />
35
+ <section>
36
+ <MenuHeader
37
+ label="Workspace"
38
+ action="show-workspace-actions"
39
+ actionLabel="Workspace actions"
40
+ rootAttributes={{ 'data-section-id': 'workspace' }}
41
+ triggerAttributes={{
42
+ popoverTarget: 'workspace-actions',
43
+ popoverTargetAction: 'toggle',
44
+ 'aria-controls': 'workspace-actions',
45
+ 'aria-haspopup': 'dialog',
46
+ }}
47
+ />
48
+ <MenuItem
49
+ action="open-notes"
50
+ label="Notes"
51
+ selected
52
+ rootAttributes={{ 'data-command-color': 'blue', 'data-drop-status': 'ready' }}
53
+ />
54
+ <MenuActionRow
55
+ action="open-file"
56
+ itemId="src/main.ts"
57
+ label="src/main.ts"
58
+ trailingAction="open-file-actions"
59
+ trailingActionLabel="Actions for src/main.ts"
60
+ trailingActionIcon={moreIcon}
61
+ />
62
+ <div id="workspace-actions" popover="auto">Application-owned actions</div>
63
+ </section>
17
64
  </>);
18
65
  ```
19
66
 
20
67
  Components return Kerf `SafeHtml`. They do not own application state or attach transient listeners. Actions are stable `data-action` hooks; the application wires them once with `delegate()` or `delegateActions()` and retains the disposer.
21
68
 
69
+ `MenuItem.rootAttributes`, `MenuHeader.rootAttributes`,
70
+ `MenuActionRow.rootAttributes`, and `AppTab.rootAttributes` carry typed
71
+ application `data-*` metadata without
72
+ teaching the package domain fields. `MenuHeader.triggerAttributes` and
73
+ `MenuActionRow.trailingActionAttributes` additionally support native popover
74
+ target and relationship attributes. Roles and component-owned action, selection,
75
+ disclosure, naming, disabled, and icon semantics remain protected props; an
76
+ isolated `role="menuitem"` is not an extension shortcut.
77
+ The slots are also filtered at runtime, so structurally widened objects and
78
+ JavaScript callers cannot bypass those protections with case-variant names.
79
+ `MenuItem.trailing` is dormant metadata. Use `MenuActionRow` when a row needs
80
+ sibling primary and trailing native-button actions with independent names,
81
+ disabled states, focus, and click ownership. Its `label`, `icon`, and
82
+ `trailingActionIcon` slots are dormant content and must not contain controls.
83
+ In either component's multiline mode, the leading icon remains aligned with
84
+ the first text line as the label wraps below it.
85
+ For section quantities, pass a non-negative safe-integer `count` together with
86
+ the localized full spoken phrase in `countLabel`, for example
87
+ `count={3} countLabel="3 notes"`. This renders the standard neutral count pill
88
+ and includes the count in the heading or disclosure button's accessible name.
89
+ Do not concatenate a count into `label` or pass a numeric `badge`; the mutually
90
+ exclusive legacy `badge` slot remains available for non-count `SafeHtml` such
91
+ as a `New` marker.
92
+
22
93
  ## Component subpaths
23
94
 
24
95
  | Component | Browser import (includes reachable CSS) | Manual CSS export |
25
96
  | --- | --- | --- |
26
97
  | `LucideIcon` | `@kerfjs/ui/lucide-icon` | `@kerfjs/ui/lucide-icon.css` |
98
+ | `DisclosureArrow` | `@kerfjs/ui/disclosure-arrow` | `@kerfjs/ui/disclosure-arrow.css` |
27
99
  | `Toolbar` | `@kerfjs/ui/toolbar` | `@kerfjs/ui/toolbar.css` |
28
100
  | `ToolbarControlGroup` | `@kerfjs/ui/toolbar-control-group` | `@kerfjs/ui/toolbar-control-group.css` |
29
101
  | `ToolbarText` | `@kerfjs/ui/toolbar-text` | `@kerfjs/ui/toolbar-text.css` |
102
+ | `MenuActionRow` | `@kerfjs/ui/menu-action-row` | `@kerfjs/ui/menu-action-row.css` |
30
103
  | `MenuItem` | `@kerfjs/ui/menu-item` | `@kerfjs/ui/menu-item.css` |
31
104
  | `MenuHeader` | `@kerfjs/ui/menu-header` | `@kerfjs/ui/menu-header.css` |
105
+ | Pane, content, and navigation composition | — | `@kerfjs/ui/layout.css` |
32
106
  | `ResizableRegion` | `@kerfjs/ui/resizable-region` | `@kerfjs/ui/resizable-region.css` |
33
107
  | `wireResizableRegions` | `@kerfjs/ui/wire-resizable-regions` | — |
34
108
  | `AppTab` | `@kerfjs/ui/app-tab` | `@kerfjs/ui/app-tab.css` |
@@ -38,10 +112,67 @@ Components return Kerf `SafeHtml`. They do not own application state or attach t
38
112
  | `LoadingSpinner` | `@kerfjs/ui/loading-spinner` | `@kerfjs/ui/loading-spinner.css` |
39
113
  | `Select` | `@kerfjs/ui/select` | `@kerfjs/ui/select.css` |
40
114
  | `SegmentedControl` | `@kerfjs/ui/segmented-control` | `@kerfjs/ui/segmented-control.css` |
115
+ | `TokenSearchField`, `readTokenSearchField`, `placeTokenSearchCaret` | `@kerfjs/ui/token-search-field` | `@kerfjs/ui/token-search-field.css` |
116
+ | `wireTokenSearchFields` | `@kerfjs/ui/wire-token-search-fields` | — |
41
117
  | `StateBanner` | `@kerfjs/ui/state-banner` | `@kerfjs/ui/state-banner.css` |
42
118
  | `EmptyState` | `@kerfjs/ui/empty-state` | `@kerfjs/ui/empty-state.css` |
43
119
  | `DialogHeader` | `@kerfjs/ui/dialog-header` | `@kerfjs/ui/dialog-header.css` |
44
- | `ValueTable` | `@kerfjs/ui/value-table` | `@kerfjs/ui/value-table.css` |
120
+ | `ValueTable`, `ValueTableRow` | `@kerfjs/ui/value-table` | `@kerfjs/ui/value-table.css` |
121
+
122
+ `DialogHeader` puts its 24px icon in a 34px circular background and aligns that
123
+ identity group with its automatically grouped action children in a real top
124
+ toolbar. Its optional summary stays on a separate row below the title. Pass a
125
+ localized `actionsLabel` when the action group needs an accessible name; new
126
+ callers pass action children directly rather than pre-wrapping groups.
127
+
128
+ `DisclosureArrow` defaults to an 18px root-scaled decorative visual. Override
129
+ `--kui-disclosure-arrow-size` at the narrowest useful scope when a consumer
130
+ needs another size; the owning control still supplies interaction, naming, and
131
+ expanded state. Kerf `Select` retains its independent Web Awesome expand-glyph
132
+ scale of `.5` through `--kui-disclosure-icon-scale`. Author replacement
133
+ `DisclosureArrow` icon content facing right before its configured direction
134
+ transform is applied. Direction changes take the shortest rotation path; a
135
+ 180-degree closed-to-open tie uses counterclockwise rotation.
136
+
137
+ `MenuHeader` supplies that production `DisclosureArrow` automatically when
138
+ `toggle` is true and `actionIcon` is omitted. Keep `expanded` synchronized with
139
+ real controlled content and preserve the button's stable label; ordinary
140
+ navigation must not display a disclosure arrow. A custom `actionIcon` remains
141
+ an escape hatch and replaces the default arrow entirely. The header fills its
142
+ available inline width, keeping a separate action at the logical end in a 44px
143
+ target. Its visible action glyph defaults to 18px through
144
+ `--kui-menu-header-action-icon-size`.
145
+
146
+ ## Machine-readable catalog
147
+
148
+ AI tools can retrieve the shipped [`ai/component-catalog.json`](./ai/component-catalog.json)
149
+ for the exhaustive component and composition inventory. It is the canonical
150
+ source for ids, public exports, purpose and selection guidance, relationships,
151
+ delivery and side effects, companion wiring, application-owned policy,
152
+ variants, accessibility obligations, public CSS hooks, routes, and current
153
+ documentation/recipe links. The adjacent
154
+ [`component-catalog.schema.json`](./ai/component-catalog.schema.json) describes
155
+ the versioned format.
156
+
157
+ For code generation, pair catalog selection guidance with the checked-in
158
+ [`public-api-signatures-v1.md`](./ai/public-api-signatures-v1.md) declaration
159
+ snapshot. It is generated from the emitted `@kerfjs/ui` declarations and the
160
+ installed `kerfjs/actions` declaration, so callback names, props, return values,
161
+ and accepted import paths do not have to be inferred from examples. Direct
162
+ Web Awesome JSX has its own generated
163
+ [`webawesome-jsx-signatures-v1.md`](./ai/webawesome-jsx-signatures-v1.md)
164
+ context so adding the declaration boundary does not mutate a frozen measured
165
+ regression suite.
166
+
167
+ `npm run catalog:sync` deterministically projects the fields used by the UX
168
+ catalog into `ux-demo/catalog.generated.ts`, including the existing guidance
169
+ path and the first-party source path for each main, recipe, or Web Awesome
170
+ specimen. First-party component entries also derive their implementation path
171
+ from the canonical browser import. Do not edit that generated file.
172
+ `npm run check:catalog` rejects stale generated output, exports and package
173
+ paths, Web Awesome manifest/declaration drift, invalid relationships, broken
174
+ links, or a missing AI-guidance entry. Prose remains authored where design
175
+ nuance matters.
45
176
 
46
177
  Import components from their explicit JavaScript subpaths. CSS-aware browser
47
178
  bundlers such as Vite, webpack, and esbuild follow each subpath's `browser`
@@ -61,17 +192,61 @@ entry for a browser build with a custom styling pipeline. The exported
61
192
  delivery. Load application overrides after package styles, or scope `--kui-*`
62
193
  variables directly on a component instance.
63
194
 
195
+ ## Pane and content geometry
196
+
197
+ Import `@kerfjs/ui/layout.css` and use the same structural vocabulary for a
198
+ sidebar, main area, inspector, or dialog. `.kui-pane` is unpadded and contains
199
+ an optional toolbar, one scrolling `.kui-pane__content`, and an optional footer.
200
+ Add `.kui-content` to make its major children a vertical stack with 24px gaps.
201
+
202
+ ```tsx
203
+ <aside class="kui-pane">
204
+ <div class="kui-pane__toolbar"><Toolbar label="Workspace" ... /></div>
205
+ <nav class="kui-pane__content kui-content">
206
+ <section>
207
+ <MenuHeader label="Workspace" count={3} countLabel="3 workspaces" />
208
+ <MenuItem action="open" label="Inbox" icon={inboxIcon} />
209
+ <MenuItem action="open" label="Drafts" />
210
+ </section>
211
+ <div class="kui-content-item">Workspace details</div>
212
+ </nav>
213
+ </aside>
214
+ ```
215
+
216
+ Ordinary children use `.kui-content-item`: 8px inline margin, a real 1px border
217
+ (transparent by default), 8px padding, and 12px rounded corners. The pill
218
+ modifier uses a 22px radius. A component can expose a transparent border or
219
+ background without changing layout. `MenuHeader` follows the same rule while
220
+ keeping its dormant title and count-or-badge cluster separate from its optional
221
+ 44px action.
222
+
223
+ ## Spacing and application layout
224
+
225
+ Use 24px only for major vertical separation; use 8px inside content items and
226
+ between toolbar groups. Toolbar groups are 44px outside (`2px + 42px`) and keep
227
+ that geometry when their border/background are transparent. Wrap text and other
228
+ dormant toolbar content in a `ToolbarControlGroup` too. Do not pad the pane
229
+ itself, add competing wrapper insets, or give it more than one scroll owner.
230
+ Reading width and responsive pane placement remain application decisions. See
231
+ the complete [layout contract](./docs/layout.md).
232
+
64
233
  ## Web Awesome theme
65
234
 
66
235
  Apps using Web Awesome's free components can opt into the same visual universe
67
236
  with one CSS import:
68
237
 
69
238
  ```ts
239
+ import type {} from '@kerfjs/ui/webawesome';
70
240
  import '@kerfjs/ui/webawesome.css';
71
241
  import '@awesome.me/webawesome/dist/components/button/button.js';
72
242
  import '@awesome.me/webawesome/dist/components/input/input.js';
73
243
  ```
74
244
 
245
+ The type-only `@kerfjs/ui/webawesome` import adds Kerf JSX intrinsic-element
246
+ declarations for the same 70 elements tracked by the catalog. It emits no
247
+ runtime code and registers nothing; keep importing only the individual Web
248
+ Awesome modules the application renders.
249
+
75
250
  `webawesome.css` includes Web Awesome's native/base theme and then applies the
76
251
  Hot Sheet 2 palette, surfaces, status colors, focus treatment, form geometry,
77
252
  radii, tooltips, and shadows through Web Awesome's public `--wa-*` contract.
@@ -100,6 +275,10 @@ foreground roles through `--kui-color-*`; stateful components also expose
100
275
  component variables such as `--kui-state-banner-background`. Override the
101
276
  foundation for an application theme, a tone variable for one semantic state, or
102
277
  a component variable on one instance without replacing component selectors.
278
+ Prefer an equivalent prop or token. When composition-specific layout still
279
+ needs a selector, the component catalog's `publicClasses` arrays define the
280
+ exact stable anatomy: public-class-to-public-class selectors are supported;
281
+ descendant tag, id, attribute-only, and unlisted-class selectors are not.
103
282
 
104
283
  `StateBanner` has opinionated `neutral`, `info`, `success`, `warning`, and
105
284
  `danger` palettes. Override an individual banner with
@@ -137,12 +316,45 @@ value through `data-segment-value`. Override an instance through
137
316
  `--kui-segmented-{background|border|foreground|hover-background}` and
138
317
  `--kui-segmented-selected-{background|foreground|border|shadow}`.
139
318
 
319
+ `TokenSearchField` is a token-controlled contenteditable searchbox that keeps
320
+ free text and ordered filter chips in one field. Its editable text stays
321
+ DOM-owned between token changes so typing does not replace the caret. Tokens
322
+ expose stable edit/remove actions and remain atomic during editing; the app owns
323
+ parsing, suggestions, query execution, and state. Use `readTokenSearchField()`
324
+ after browser input to recover text plus token offsets, and
325
+ `placeTokenSearchCaret()` when restoring focus after a controlled update.
326
+ Call `wireTokenSearchFields()` once at a stable root to make Enter submit through
327
+ `onSubmit` without inserting a contenteditable line break and to preserve focus
328
+ plus the text-relative caret when keyboard deletion of a chip causes controlled
329
+ rendering to replace the editor. Text still wraps visually when it reaches the
330
+ field edge.
331
+ Clear actions should empty the editor's `textContent` before clearing app state.
332
+ The leading icon, first text line, clear action, and trailing slot share one
333
+ fixed alignment row; when text wraps, those controls stay pinned to that first
334
+ row instead of recentering against the taller editor.
335
+ Set `collapsible` for the first-class compact presentation: an empty closed
336
+ field renders as one iconic search action, `expanded` reveals the complete
337
+ field, and text or tokens keep it expanded. Width changes animate by default
338
+ and respect reduced-motion preferences. The field works standalone or inside a
339
+ `ToolbarControlGroup`; the application owns the transient focused/open signal,
340
+ focus transfer, and focusout policy. The catalog's Toolbar route demonstrates
341
+ that composition at wide and narrow sizes.
342
+ Override its surface through `--kui-token-search-{background|border}` and its
343
+ chips through `--kui-token-search-token-{background|foreground}`. Override
344
+ `--kui-token-search-line-size` only when the complete first-line geometry must
345
+ change together.
346
+
140
347
  `TabBar` is controlled: pass ordered `AppTab` children, then wire its keyboard
141
348
  and same-bar drag behavior with `wireTabBars(root, { onReorder })`. During a
142
349
  drag, the scroll strip automatically moves toward either edge with speed based
143
350
  on pointer proximity, exposing earlier or later drop targets. Apply the reported
144
351
  change with `reorderTabs()` or application-specific state logic. The application
145
352
  still owns selection, closing, routing, and persistence.
353
+ Use `AppTab.rootAttributes` for domain `data-*` metadata and `closeIcon` for a
354
+ decorative replacement glyph. The runtime rejects roles and case variants of
355
+ the component- or wiring-owned action, tab identity, selection, drag, drop, and
356
+ component markers. Keep the icon free of interactive descendants; the named
357
+ close button retains all close interaction.
146
358
 
147
359
  `Select` uses Web Awesome but does not register anything by itself. Install the optional peer, import the shared theme if desired, and explicitly import the registration entry in the application:
148
360
 
@@ -152,25 +364,42 @@ import '@kerfjs/ui/select/register';
152
364
  ```
153
365
 
154
366
  That boundary keeps Web Awesome and its custom-element side effects out of bundles that use unrelated components. Automated consumer-bundle tests enforce it.
367
+ `Select` also owns the Kerf/Web Awesome reconciliation boundary: option icons
368
+ keep stable slotted elements across rerenders, and `renderSelected` content is
369
+ replaced when the controlled value changes. Consumers do not need to add
370
+ `data-key` or `data-morph-skip` workarounds around choice icons.
155
371
 
156
372
  For application choices and panes, prefer Kerf's purpose-built primitives:
157
373
  `Select` over direct Web Awesome selection/dropdown composition,
158
374
  `SegmentedControl` over Button Group, `TabBar` or `SegmentedControl` over Web
159
375
  Awesome Tabs, `LucideIcon` over Web Awesome Icon, and `ResizableRegion` over
160
376
  Split Panel. `ResizableRegion` includes Hot Sheet 2's 1px separator and
161
- hover/focus grip. Consider Web Awesome Popup when its anchored-positioning
377
+ hover/focus grip. Its optional `handleIcon` replaces only the decorative glyph;
378
+ the component and `wireResizableRegions()` retain separator semantics and
379
+ pointer/keyboard behavior. Consider Web Awesome Popup when its anchored-positioning
162
380
  engine removes custom placement code; treat Tree, Animated Image, Comparison,
163
381
  Zoomable Frame, and the displaced alternatives above as exceptional rather
164
382
  than default patterns. The detailed rationale lives in the theme contract.
165
383
 
166
384
  ## Design and tool guidance
167
385
 
386
+ - [Component selection and composition](./docs/component-selection.md)
168
387
  - [Design philosophy](./docs/design-philosophy.md)
169
388
  - [Apple HIG translation](./docs/apple-hig.md)
170
389
  - [Accessibility and keyboard contracts](./docs/accessibility.md)
171
390
  - [Component and integration contract](./docs/component-contract.md)
391
+ - [Spacing and application layout](./docs/layout.md)
172
392
  - [Web Awesome theme contract](./docs/webawesome-theme.md)
173
393
  - [UX catalog contract](./docs/ux-demo.md)
174
394
  - [AI guide](./ai/skill.md)
175
395
 
176
- Run `npm run dev` from this directory for the category-grouped master/detail catalog. Every public visual component has a focused route; all 70 free Web Awesome 3.12 components have focused routes under the collapsible ecosystem section. One grouped `Related components` selector contains derived `Uses` / `Used by` navigation across both sets. Run `npm run check` for static/unit/bundle gates and `npm run test:e2e` for the real-browser suite.
396
+ Run `npm run dev` from this directory for the category-grouped master/detail catalog. Every public visual component has a focused route; all 70 free Web Awesome 3.12 components have focused routes under the collapsible ecosystem section. Every detail visibly links its first-party demo source and existing guidance while showing the repository-relative paths; first-party components also link their implementation source, and Web Awesome entries label local guidance as Kerf integration guidance. One grouped `Related components` selector contains derived `Uses` / `Used by` navigation across both sets. Run `npm run check` for static/unit/bundle gates and `npm run test:e2e` for the real-browser suite.
397
+
398
+ Run `npm run format:css` after editing styles. The normal `npm run check` gate
399
+ uses Prettier to reject unformatted CSS in `src/` and `ux-demo/`.
400
+
401
+ For dimensions that should scale with the root font size, author pixels with
402
+ `remify()`: `gap: remify(17px)` builds to `gap: 1.0625rem` using a fixed 16px
403
+ baseline. Keep intentional 1px borders in pixels and contextual `em` values
404
+ explicit. `npm run build` emits standard CSS to `dist/styles`; `npm run dev`
405
+ applies the same transform directly to source styles and hot-reloads edits.