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