@kerfjs/ui 5.0.0-beta.4 → 5.0.0-beta.7
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 +9 -8
- package/ai/component-catalog.json +379 -174
- package/ai/public-api-signatures-v1.md +387 -33
- package/ai/skill.md +15 -7
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/dist/app-tab.d.ts +3 -1
- package/dist/app-tab.js +2 -1
- package/dist/browser/app-tab.js +1 -0
- package/dist/browser/menu-action-row.js +1 -0
- package/dist/browser/menu-header.js +1 -0
- package/dist/browser/menu-item.js +1 -0
- package/dist/browser/panel-header.js +7 -0
- package/dist/browser/segmented-control.js +1 -0
- package/dist/browser/select.js +1 -0
- package/dist/browser/skeleton.js +3 -0
- package/dist/browser/state-banner.js +1 -0
- package/dist/browser/toolbar-text.js +1 -0
- package/dist/browser/value-table.js +1 -0
- package/dist/chunk-2RJBFNB6.js +172 -0
- package/dist/chunk-2RJBFNB6.js.map +1 -0
- package/dist/{chunk-XZXRLY5Q.js → chunk-2Z5TWHKQ.js} +7 -6
- package/dist/chunk-2Z5TWHKQ.js.map +1 -0
- package/dist/{chunk-EGHL5S4P.js → chunk-3YD6ZNRA.js} +8 -7
- package/dist/chunk-3YD6ZNRA.js.map +1 -0
- package/dist/chunk-B24C4A6T.js +22 -0
- package/dist/chunk-B24C4A6T.js.map +1 -0
- package/dist/{chunk-NPPD2A6O.js → chunk-H6URQGJI.js} +8 -6
- package/dist/chunk-H6URQGJI.js.map +1 -0
- package/dist/chunk-I7INRJO4.js +17 -0
- package/dist/chunk-I7INRJO4.js.map +1 -0
- package/dist/chunk-KJYXOTG3.js +10 -0
- package/dist/chunk-KJYXOTG3.js.map +1 -0
- package/dist/{chunk-CTQKI2XL.js → chunk-LC3YSAZC.js} +14 -3
- package/dist/chunk-LC3YSAZC.js.map +1 -0
- package/dist/chunk-N3SUXLLS.js +23 -0
- package/dist/chunk-N3SUXLLS.js.map +1 -0
- package/dist/{chunk-R6JHHBKQ.js → chunk-PONXLV5U.js} +5 -5
- package/dist/chunk-PONXLV5U.js.map +1 -0
- package/dist/chunk-TZNCCM5H.js +20 -0
- package/dist/chunk-TZNCCM5H.js.map +1 -0
- package/dist/{chunk-TRNBHPNW.js → chunk-YGN7OMLT.js} +11 -8
- package/dist/chunk-YGN7OMLT.js.map +1 -0
- package/dist/chunk-YKUUZPED.js +24 -0
- package/dist/chunk-YKUUZPED.js.map +1 -0
- package/dist/device-class.d.ts +62 -0
- package/dist/device-class.js +75 -0
- package/dist/device-class.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +15 -15
- package/dist/menu-action-row.d.ts +3 -1
- package/dist/menu-action-row.js +2 -1
- package/dist/menu-header.d.ts +3 -1
- package/dist/menu-header.js +2 -1
- package/dist/menu-item.d.ts +3 -1
- package/dist/menu-item.js +2 -1
- package/dist/nav-stack.d.ts +38 -0
- package/dist/nav-stack.js +5 -0
- package/dist/nav-stack.js.map +1 -0
- package/dist/panel-header.d.ts +28 -0
- package/dist/panel-header.js +7 -0
- package/dist/panel-header.js.map +1 -0
- package/dist/segmented-control.d.ts +3 -1
- package/dist/segmented-control.js +2 -1
- package/dist/select.d.ts +5 -2
- package/dist/select.js +2 -1
- package/dist/skeleton.d.ts +24 -0
- package/dist/skeleton.js +3 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/split-view.d.ts +42 -0
- package/dist/split-view.js +21 -0
- package/dist/split-view.js.map +1 -0
- package/dist/state-banner.d.ts +3 -1
- package/dist/state-banner.js +2 -1
- package/dist/styles/foundation.css +21 -0
- package/dist/styles/menu-header.css +19 -2
- package/dist/styles/nav-stack.css +112 -0
- package/dist/styles/panel-header.css +64 -0
- package/dist/styles/select.css +42 -0
- package/dist/styles/skeleton.css +31 -0
- package/dist/styles/split-view.css +35 -0
- package/dist/styles/styles.css +2 -2
- package/dist/styles/tab-scaffold.css +84 -0
- package/dist/styles/toolbar-control-group.css +52 -2
- package/dist/styles/toolbar-text.css +11 -0
- package/dist/styles/toolbar.css +9 -0
- package/dist/styles/workbench.css +94 -0
- package/dist/tab-scaffold.d.ts +30 -0
- package/dist/tab-scaffold.js +16 -0
- package/dist/tab-scaffold.js.map +1 -0
- package/dist/toolbar-text.d.ts +6 -2
- package/dist/toolbar-text.js +2 -1
- package/dist/value-table.d.ts +3 -1
- package/dist/value-table.js +2 -1
- package/dist/wire-nav-stack.d.ts +15 -0
- package/dist/wire-nav-stack.js +88 -0
- package/dist/wire-nav-stack.js.map +1 -0
- package/dist/wire-tab-scaffold.d.ts +11 -0
- package/dist/wire-tab-scaffold.js +16 -0
- package/dist/wire-tab-scaffold.js.map +1 -0
- package/dist/wire-token-search-fields.d.ts +46 -4
- package/dist/wire-token-search-fields.js +1 -1
- package/dist/workbench.d.ts +33 -0
- package/dist/workbench.js +17 -0
- package/dist/workbench.js.map +1 -0
- package/docs/accessibility.md +10 -10
- package/docs/app-layouts.md +57 -0
- package/docs/component-contract.md +46 -9
- package/docs/component-selection.md +57 -7
- package/docs/design-philosophy.md +23 -1
- package/docs/device-class.md +54 -0
- package/docs/layout.md +33 -8
- package/docs/nav-stack.md +47 -0
- package/docs/recipes.md +17 -5
- package/docs/split-view.md +49 -0
- package/docs/tab-scaffold.md +41 -0
- package/docs/ux-demo.md +3 -3
- package/docs/workbench.md +47 -0
- package/llms.txt +116 -43
- package/package.json +43 -11
- package/ux-demo/recipes/app-shell.tsx +3 -3
- package/ux-demo/recipes/composer-form.tsx +2 -2
- package/ux-demo/recipes/list-workspace-states.tsx +2 -2
- package/ux-demo/recipes/loaders.ts +2 -0
- package/ux-demo/recipes/master-detail-dialog.tsx +2 -2
- package/ux-demo/recipes/mount-recipe.ts +3 -0
- package/ux-demo/recipes/navigation-stack.tsx +76 -0
- package/ux-demo/recipes/recipes.css +19 -8
- package/ux-demo/recipes/workspace-header.tsx +2 -2
- package/dist/browser/dialog-header.js +0 -5
- package/dist/browser/page-header.js +0 -3
- package/dist/chunk-2PES33HS.js +0 -13
- package/dist/chunk-2PES33HS.js.map +0 -1
- package/dist/chunk-CTQKI2XL.js.map +0 -1
- package/dist/chunk-EGHL5S4P.js.map +0 -1
- package/dist/chunk-GY5WH7TO.js +0 -10
- package/dist/chunk-GY5WH7TO.js.map +0 -1
- package/dist/chunk-H5AGGVU5.js +0 -75
- package/dist/chunk-H5AGGVU5.js.map +0 -1
- package/dist/chunk-K3G72I6D.js +0 -24
- package/dist/chunk-K3G72I6D.js.map +0 -1
- package/dist/chunk-NPPD2A6O.js.map +0 -1
- package/dist/chunk-R6JHHBKQ.js.map +0 -1
- package/dist/chunk-S3TPM2LP.js +0 -23
- package/dist/chunk-S3TPM2LP.js.map +0 -1
- package/dist/chunk-TRNBHPNW.js.map +0 -1
- package/dist/chunk-VHW5YNIB.js +0 -17
- package/dist/chunk-VHW5YNIB.js.map +0 -1
- package/dist/chunk-XZXRLY5Q.js.map +0 -1
- package/dist/dialog-header.d.ts +0 -15
- package/dist/dialog-header.js +0 -5
- package/dist/dialog-header.js.map +0 -1
- package/dist/page-header.d.ts +0 -9
- package/dist/page-header.js +0 -3
- package/dist/page-header.js.map +0 -1
- package/dist/styles/dialog-header.css +0 -87
- package/dist/styles/page-header.css +0 -33
package/docs/ux-demo.md
CHANGED
|
@@ -13,15 +13,15 @@ deterministic state, and semantic layout owners from the [recipe guide](./recipe
|
|
|
13
13
|
- `ai/component-catalog.json` is the canonical catalog metadata. A deterministic checked-in projection supplies the demo's unique id, category, kind (`component`, `composition`, or `recipe`), source (`kerf` or `webawesome`), name, description, direct `uses` dependencies, existing documentation path, and demo-source path; first-party, recipe, and Web Awesome renderer maps are exhaustively typed against its generated id unions. Demo paths resolve to `ui/ux-demo/main.tsx`, the matching `ui/ux-demo/recipes/*.tsx` file, or `ui/ux-demo/webawesome-demos.tsx` according to the canonical entry. First-party component entries additionally derive `ui/src/<browser-subpath>.tsx` from their canonical `delivery.browserImport`.
|
|
14
14
|
- Every detail footer groups compact `Demo source` and `Guidance` actions; first-party component details also expose `Component source`. Web Awesome details say `Integration guidance` to distinguish the local integration contract from the upstream component implementation. Each button retains its repository-relative path in the DOM for verification and uses a deploy-safe absolute GitHub blob URL with a contextual new-tab name; the demo does not depend on a local source server or add a package runtime export. At phone widths, the resource group and related-component selector stack as full-width rows, with any resource overflow contained locally so labels cannot overlap the selector or widen the document.
|
|
15
15
|
- The master/detail shell groups first-party routes by category with production `MenuHeader` and `MenuItem` components. The 70 ecosystem components live in a separate `Web Awesome` disclosure with seven subgroups, so they remain discoverable without being presented as first-class `@kerfjs/ui` exports. Direct Web Awesome routes open the disclosure and reveal the selected row at wide sizes; narrow layouts keep the expanded list in document flow rather than introducing a competing nested scroller.
|
|
16
|
-
- The shell itself uses `@kerfjs/ui/layout.css`: sidebars, details, previews, dialogs, and resize specimens share unpadded panes plus self-contained content items. Its sidebar identity uses the Kerf logo beside a vertically centered title, with the subtitle in its own aligned row like `
|
|
17
|
-
- The composer-form recipe demonstrates one coherent visible form surface with `
|
|
16
|
+
- The shell itself uses `@kerfjs/ui/layout.css`: sidebars, details, previews, dialogs, and resize specimens share unpadded panes plus self-contained content items. Its sidebar identity uses the Kerf logo beside a vertically centered title, with the subtitle in its own aligned row like `PanelHeader`; the current-view heading is also a toolbar. Collapsing the catalog removes the pane completely and moves its restore action to the main toolbar's leading edge instead of leaving an icon-only rail. The selected view description remains inset below the page toolbar. The checkerboard belongs to the complete scrollable preview region rather than a nested card. A lightly separated footer keeps live status above compact source, guidance, and relationship groups. The focused `ResizableRegion` specimen stretches its surface through the available stage height and reports committed width in that shared status footer; narrow layouts retain local horizontal access when the pane is resized wider than the stage, and the split remains readable at 200% root scaling. Geometry coverage checks wide, intermediate, narrow, and 200% zoom layouts.
|
|
17
|
+
- The composer-form recipe demonstrates one coherent visible form surface with `PanelHeader` title/summary hierarchy, fields and actions on the shared 8px control gutter, and 24px major rhythm. Its conditional error or success `StateBanner` is the only nested semantic surface. Reset synchronizes the upgraded Web Awesome fields' live value properties with their empty controlled attributes and announces `Draft reset`; browser coverage preserves behavior and verifies wide, narrow, dark, validation, success, reset, 200% zoom, and forced-colors states.
|
|
18
18
|
- The master-detail dialog recipe places its header directly on the dialog edge while preserving the header's internal inset, gives the selected project title the complete outer-plus-inner content gutter, lets the value table fill the available detail column between the shared outer margins, and keeps record actions on one outer gutter without an extra content-item inset. Browser geometry coverage protects those relationships at wide and narrow widths.
|
|
19
19
|
- Catalog-only brand marks, preview dimensions, checkerboard tiles, and the compound display-settings control retain local geometry because they are specimen chrome or intrinsic control anatomy rather than reusable application spacing roles.
|
|
20
20
|
- The menu composition route demonstrates toolbar/content/footer anatomy, 24px major gaps, 8/1/8 child geometry, the full-width `MenuHeader` count-or-badge/action split, logical-end 44px action targets with 18px visuals, and 44px row/header/toolbar targets. Its one chevron is a production 18px `DisclosureArrow` inside a controlled Tools header that actually reveals and hides content; ordinary Projects navigation has no false disclosure affordance. Browser assertions cover stable naming, expanded/content transitions, visual rotation, node identity, reduced motion, RTL alignment and containment, and wide, narrow, dark, and 200% layouts. The focused MenuHeader route separately shows the shared neutral count pill for Attachments, Notes (including zero), and Duplicates plus a non-count legacy badge, full-width logical-end actions, and no disclosure without content.
|
|
21
21
|
- The `DisclosureArrow` route renders the production 18px root-scaled default without a catalog-only size override. Its two native buttons independently control the default right-to-down chevron and a recognizable right-facing replacement arrow with left-to-up custom directions; both use shortest-path rotation and their names stay stable while `aria-expanded` communicates state. Browser coverage verifies the custom clockwise path, pointer and native keyboard activation, focus, narrow and 200%-zoom stacking with contained labels, consumer sizing, and the independent `.5` Web Awesome glyph scale retained by Kerf `Select`.
|
|
22
22
|
- A detail with relationships renders one grouped footer selector: `Uses` links to direct dependencies and `Used by` links to reverse dependents. Choosing either navigates to that component's demo. The relationship group is absent when both sets are empty; no duplicate summary is rendered.
|
|
23
23
|
- Demo-only CSS supplies only the catalog shell and stages; component appearance stays in package CSS. Decorative chrome and Web Awesome controls share the same semantic system palette instead of carrying a separate demo identity.
|
|
24
|
-
- Scenarios use deterministic data and cover real variants, long content, disabled state, selection, progress, feedback, overlays, media, helpers, and stateful interactions. The Web Awesome theme route remains the broad system view, while individual action, form, layout, navigation, feedback, media, and helper routes provide focused specimens; MenuItem and MenuHeader demonstrate typed domain metadata, protected native button/disclosure semantics, and a native popover trigger relationship without product props;
|
|
24
|
+
- Scenarios use deterministic data and cover real variants, long content, disabled state, selection, progress, feedback, overlays, media, helpers, and stateful interactions. The Web Awesome theme route remains the broad system view, while individual action, form, layout, navigation, feedback, media, and helper routes provide focused specimens; MenuItem and MenuHeader demonstrate typed domain metadata, protected native button/disclosure semantics, and a native popover trigger relationship without product props; PanelHeader demonstrates its plain top-toolbar identity, extra-large title, optional subtitle row, and bordered brand-filled icon group; the Select route verifies that option icons survive unrelated Kerf rerenders and selected slot content follows value changes; the Animation route exposes preset, easing, duration, playback-rate, and transport controls with live lifecycle status; observer routes provide user-driven intersection, mutation, and resize events with live results; ToolbarControlGroup exposes all eight Hot Sheet 2 variants, loads the Web Awesome registrations needed by its popup specimen, and preserves the upgraded dropdown's managed light-DOM children across Kerf rerenders; the Toolbar route composes a collapsible TokenSearchField inside a group, animates between the empty iconic and complete field states, stays open while populated, and focuses the revealed editor; SegmentedControl covers toolbar, rounded-rectangle, pill, equal-width, and disabled presentations; TokenSearchField covers editable ordered chips, pointer and keyboard removal, caret-preserving controlled deletion, editing, clearing, free text, disabled state, and fixed first-line alignment while content wraps; StateBanner exposes every built-in tone plus a scoped override; TabBar demonstrates overflow, edge autoscroll, and controlled pointer/keyboard reordering.
|
|
25
25
|
- Recipe ownership notes are hidden by default. A page-toolbar toggle reveals them as floating warning-toned notes with a folded corner, keeping instructional copy visually distinct and removable from the specimen flow.
|
|
26
26
|
- Settings exercise light/dark, increased contrast, and reduced motion without changing component code. The theme action starts from the operating system's effective color scheme, always names the appearance it will switch to, and installs an explicit light or dark override when activated; contrast and reduced motion expose their independent preferences through `aria-pressed`.
|
|
27
27
|
- The footer action log is an `aria-live` region, making interactions visible to both people and browser tests.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Workbench
|
|
2
|
+
|
|
3
|
+
`@kerfjs/ui/workbench` is the Xcode-like multi-panel workspace: a collapsible
|
|
4
|
+
left rail, right rail, and bottom drawer around a central work area (any absent).
|
|
5
|
+
It generalizes the instant-width / sliding-content collapse used by the catalog
|
|
6
|
+
sidebar. One of the opt-in app layouts (see
|
|
7
|
+
[`../../docs/23-app-layouts.md`](../../docs/23-app-layouts.md)); best on
|
|
8
|
+
desktop-class devices.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { Workbench } from '@kerfjs/ui/workbench';
|
|
12
|
+
import '@kerfjs/ui/workbench.css';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## State lives in the app
|
|
16
|
+
|
|
17
|
+
`Workbench` is declarative and the collapse is **pure CSS** — no wire. The app
|
|
18
|
+
owns each panel's `collapsed` flag (usually a signal) and toggles it; the panel
|
|
19
|
+
animates itself.
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
const navCollapsed = signal(false);
|
|
23
|
+
|
|
24
|
+
<Workbench
|
|
25
|
+
id="studio"
|
|
26
|
+
label="Studio"
|
|
27
|
+
main={<Editor />}
|
|
28
|
+
leftRail={{ content: <Navigator />, label: 'Navigator', collapsed: navCollapsed.value, size: 280 }}
|
|
29
|
+
rightRail={{ content: <Inspector />, label: 'Inspector', collapsed: inspectorCollapsed.value }}
|
|
30
|
+
bottomDrawer={{ content: <Console />, label: 'Console', collapsed: consoleCollapsed.value }}
|
|
31
|
+
/>;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Each `WorkbenchPanel` takes `content`, an optional `collapsed`, an optional
|
|
35
|
+
`size` (rail width or drawer height in px, overriding the CSS default —
|
|
36
|
+
`--kui-workbench-rail-width` 280px, `--kui-workbench-drawer-height` 220px), and
|
|
37
|
+
an optional `label`.
|
|
38
|
+
|
|
39
|
+
## How the collapse animates
|
|
40
|
+
|
|
41
|
+
Collapsing snaps the panel's flex track to zero in a single reflow (so the work
|
|
42
|
+
area relayouts once, not per frame) while the panel's fixed-size content slides
|
|
43
|
+
out via a composited `transform` — a rail slides horizontally, the drawer
|
|
44
|
+
vertically — clipped by the shell's overflow. It honors `prefers-reduced-motion`
|
|
45
|
+
(the slide collapses to instant). On smaller device classes, present the rails'
|
|
46
|
+
contents through a `NavStack` or overlay drawers rather than shrinking the
|
|
47
|
+
three-panel shell.
|
package/llms.txt
CHANGED
|
@@ -1,45 +1,118 @@
|
|
|
1
1
|
# @kerfjs/ui
|
|
2
2
|
|
|
3
|
-
Accessible, production-backed UI primitives for kerf
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
3
|
+
> Accessible, production-backed UI primitives for [kerf](https://github.com/brianwestphal/kerf)
|
|
4
|
+
> applications. Components are plain functions returning `SafeHtml`; the app owns
|
|
5
|
+
> state and wires stable `data-action` hooks once. This file orients an LLM to
|
|
6
|
+
> generate correct, good-looking kerf UI — it is not a catalog to browse.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install kerfjs @kerfjs/ui # kerfjs is a peer; Web Awesome is an optional peer
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Import each component from its own subpath (`@kerfjs/ui/menu-item`, `@kerfjs/ui/toolbar`,
|
|
13
|
+
…); the browser build pulls that component's reachable CSS automatically, so do not
|
|
14
|
+
maintain a central style list. Configure JSX with `"jsxImportSource": "kerfjs"`.
|
|
15
|
+
|
|
16
|
+
## How to build a screen (retrieval order)
|
|
17
|
+
|
|
18
|
+
1. **Pick the component from the interface need**, not by appearance — read
|
|
19
|
+
[component-selection.md](./docs/component-selection.md) (the problem→component
|
|
20
|
+
matrix, with imports, wiring, ownership, and alternatives).
|
|
21
|
+
2. **Get exact signatures before emitting code** — read
|
|
22
|
+
[public-api-signatures-v1.md](./ai/public-api-signatures-v1.md) (real prop names,
|
|
23
|
+
callback shapes, disposer return types).
|
|
24
|
+
3. **For exhaustive, structured facts** (ids, exports, variants, `publicClasses`,
|
|
25
|
+
relationships, side effects) load the
|
|
26
|
+
[Machine-readable component catalog](./ai/component-catalog.json) — the
|
|
27
|
+
canonical checked-in source; its schema is alongside it.
|
|
28
|
+
4. **Apply the rules below and in** [skill.md](./ai/skill.md).
|
|
29
|
+
|
|
30
|
+
## Core rules (do the right thing)
|
|
31
|
+
|
|
32
|
+
- **Reach for the primitive, not for CSS.** The package is built to look right
|
|
33
|
+
*unstyled*. Before adding `padding`, `margin`, `width`, `height`, `border`,
|
|
34
|
+
`background`, a wrapper card, or a decoration, check whether the component, the
|
|
35
|
+
pane, or the content-item already owns it — it almost always does. Prefer a
|
|
36
|
+
component prop or a `--kui-*` token; write CSS only for genuinely new structure,
|
|
37
|
+
and then only join a component's documented `publicClasses` (never reach in by
|
|
38
|
+
tag/id/attribute or an unlisted class).
|
|
39
|
+
- **Never double-inset.** A `.kui-pane` has no padding; its `.kui-content` children
|
|
40
|
+
own the geometry (8px inline margin + 1px border + 8px padding). Do not add a
|
|
41
|
+
container padding on top of a content-item's own margin — pick one owner. Use
|
|
42
|
+
`.kui-content` for 24px major vertical rhythm.
|
|
43
|
+
- **Trust the defaults.** Render a control at its natural size and color (a
|
|
44
|
+
`LucideIcon` is 24px); if it looks wrong, fix the surrounding layout, not the
|
|
45
|
+
control. Never force a component's width/height to size it — that leaves a halo
|
|
46
|
+
or a stretched oval.
|
|
47
|
+
- **Toolbars hold only `ToolbarText` and `ToolbarControlGroup`.** Never put a bare
|
|
48
|
+
button, input, link, or loose markup in a `leading`/`center`/`trailing` zone.
|
|
49
|
+
Wrap every control — `SegmentedControl`, `Select`, a collapsible
|
|
50
|
+
`TokenSearchField`, Web Awesome controls — inside a `ToolbarControlGroup`. A
|
|
51
|
+
toolbar popup menu is a `single` `ToolbarControlGroup` around a `wa-dropdown`
|
|
52
|
+
(its `slot="trigger"` `wa-button` is the toolbar button, kept under
|
|
53
|
+
`data-morph-skip-children`).
|
|
54
|
+
- **`PanelHeader` is *the* panel/dialog/page heading.** A plain toolbar with an
|
|
55
|
+
optional bordered icon group, an extra-large `ToolbarText` title, the trailing
|
|
56
|
+
controls you pass, and an optional subtitle below — do not hand-build a heading
|
|
57
|
+
row or restyle a toolbar into one.
|
|
58
|
+
- **Space by the five-step scale, by relationship not by eye.** `0`
|
|
59
|
+
`--kui-space-none`, `4px` `--kui-space-2xs`, `8px` `--kui-space-xs` (inside a
|
|
60
|
+
group), `16px` `--kui-space-m`, `24px` `--kui-space-l` (between major differing
|
|
61
|
+
regions). 12px/32px are off-scale exceptions.
|
|
62
|
+
- **Panes share one child-owned geometry.** Sidebars, main areas, inspectors, and
|
|
63
|
+
dialogs all use an unpadded `.kui-pane` (optional `.kui-pane__toolbar`, one
|
|
64
|
+
scrolling `.kui-pane__content`, optional `.kui-pane__footer`). A visible pane owns
|
|
65
|
+
its collapse control; a hidden pane's restore moves to the adjacent main
|
|
66
|
+
toolbar's matching edge — no icon-only rail. Keep one scroll owner per region.
|
|
67
|
+
- **State and behavior live in the app.** Components take semantic `data-action`
|
|
68
|
+
strings and controlled values; wire them once with `delegate()`/`delegateActions()`
|
|
69
|
+
or the disposer-returning `wire…` helpers, and own domain copy, transport, and
|
|
70
|
+
policy in a thin adapter. Every element must earn its place — cut chrome, labels,
|
|
71
|
+
and readouts that do not help a person decide or act.
|
|
72
|
+
- **App state is domain/persisted; helpers own only ephemeral mechanics.** Keep
|
|
73
|
+
navigation stacks, tab selection and order, pane sizes, and `collapsed`/`expanded`
|
|
74
|
+
disclosure flags in the app — they are data or persisted layout, and the app reads
|
|
75
|
+
them to render. The `wire…` helpers own the *ephemeral* parts: `wireNavStack` the
|
|
76
|
+
push/pop animation, `wireTabBars` the overflow autoscroll and drag preview,
|
|
77
|
+
`wireResizableRegions` the live drag preview; they report committed changes via
|
|
78
|
+
callbacks. The one richer case is `wireTokenSearchFields`, which manages the
|
|
79
|
+
collapsible field's expand/collapse/focus by default (on, per-behavior opt-out) and
|
|
80
|
+
exposes the `expanded` signal on its handle — bind it in render or hand in your own
|
|
81
|
+
via `collapsible.signals`. Do not hand-roll open/collapse/focus that helper
|
|
82
|
+
provides; but do keep a plain disclosure toggle (a one-line boolean the app already
|
|
83
|
+
renders from) in the app.
|
|
84
|
+
- **Placeholder loading state, don't rebuild it.** For a value or component that is
|
|
85
|
+
still loading, set `placeholder` on the component (`Select`, `MenuHeader`,
|
|
86
|
+
`MenuItem`, `ValueTableRow`, `PanelHeader`, `SegmentedControl`, `StateBanner`,
|
|
87
|
+
`AppTab`, `ToolbarText`, `MenuActionRow`): it renders its real chrome with value
|
|
88
|
+
slots as subtle **unanimated** skeleton blocks and interactivity disabled, so a
|
|
89
|
+
parent composes a faithful loading view (e.g. an inspector) without hand-rebuilding
|
|
90
|
+
markup. Use the standalone `Skeleton` for a custom slot. Prefer it over `wa-skeleton`
|
|
91
|
+
(the pure-Kerf primitives avoid Web Awesome), and never animate it — use
|
|
92
|
+
`LoadingSpinner` for known busy activity instead.
|
|
93
|
+
|
|
94
|
+
## Public exports
|
|
95
|
+
|
|
96
|
+
`LucideIcon`, `DisclosureArrow`, `Toolbar`, `ToolbarControlGroup`, `ToolbarText`,
|
|
97
|
+
`PanelHeader`, `MenuItem`, `MenuActionRow`, `MenuHeader`, `SegmentedControl`,
|
|
98
|
+
`Select`, `TokenSearchField` (+ `readTokenSearchField`, `placeTokenSearchCaret`,
|
|
99
|
+
`wireTokenSearchFields`), `AppTab`, `TabBar` (+ `wireTabBars`, `reorderTabs`),
|
|
100
|
+
`ResizableRegion` (+ `wireResizableRegions`), `StateBanner`, `EmptyState`,
|
|
101
|
+
`LoadingSpinner`, `Skeleton`, `ValueTable`, `ValueTableRow`. Whole-screen layouts (opt-in,
|
|
102
|
+
tree-shakeable, declarative with `wire…` helpers, each with a companion CSS import):
|
|
103
|
+
`NavStack`, `SplitView`, `Workbench`, `TabScaffold`, driven by `deviceClass()` from
|
|
104
|
+
`@kerfjs/ui/device-class`. `@kerfjs/ui/webawesome` is a type-only boundary for
|
|
105
|
+
`wa-*` JSX; `@kerfjs/ui/select/register` and the CSS are the declared side effects.
|
|
106
|
+
|
|
107
|
+
## Reference
|
|
108
|
+
|
|
109
|
+
- [skill.md](./ai/skill.md): the full rule set + a common-mistakes table (the shipped AI skill).
|
|
110
|
+
- [design-philosophy.md](./docs/design-philosophy.md): why kerf UI is shaped this way — the decision principles behind the rules above.
|
|
111
|
+
- [layout.md](./docs/layout.md): the pane/content-item geometry, public roles/tokens, and the spacing scale.
|
|
112
|
+
- [component-contract.md](./docs/component-contract.md): what a component owns vs. what the app owns.
|
|
113
|
+
- [accessibility.md](./docs/accessibility.md): keyboard and ARIA contracts per component.
|
|
114
|
+
- [recipes.md](./docs/recipes.md): production compositions (app shell, master-detail dialog, composer form, …) as copyable references.
|
|
115
|
+
- [app-layouts.md](./docs/app-layouts.md): choosing `NavStack`/`SplitView`/`Workbench`/`TabScaffold` by data + interaction + device, and dialog presentation.
|
|
116
|
+
- [webawesome-theme.md](./docs/webawesome-theme.md): the optional Web Awesome theme; catalog coverage means themed-and-supported, not preferred (prefer the Kerf primitive when one exists).
|
|
117
|
+
- [component-catalog.json](./ai/component-catalog.json) + [public-api-signatures-v1.md](./ai/public-api-signatures-v1.md) + [webawesome-jsx-signatures-v1.md](./ai/webawesome-jsx-signatures-v1.md): machine-readable facts and exact signatures.
|
|
118
|
+
- [README.md](./README.md): package overview and the component subpath table.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kerfjs/ui",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.7",
|
|
4
4
|
"description": "Accessible, composable UI primitives for kerf applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -88,6 +88,10 @@
|
|
|
88
88
|
"types": "./dist/wire-resizable-regions.d.ts",
|
|
89
89
|
"import": "./dist/wire-resizable-regions.js"
|
|
90
90
|
},
|
|
91
|
+
"./device-class": {
|
|
92
|
+
"types": "./dist/device-class.d.ts",
|
|
93
|
+
"import": "./dist/device-class.js"
|
|
94
|
+
},
|
|
91
95
|
"./app-tab": {
|
|
92
96
|
"types": "./dist/app-tab.d.ts",
|
|
93
97
|
"browser": "./dist/browser/app-tab.js",
|
|
@@ -102,10 +106,29 @@
|
|
|
102
106
|
"types": "./dist/wire-tab-bars.d.ts",
|
|
103
107
|
"import": "./dist/wire-tab-bars.js"
|
|
104
108
|
},
|
|
105
|
-
"./
|
|
106
|
-
"types": "./dist/
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
+
"./nav-stack": {
|
|
110
|
+
"types": "./dist/nav-stack.d.ts",
|
|
111
|
+
"import": "./dist/nav-stack.js"
|
|
112
|
+
},
|
|
113
|
+
"./wire-nav-stack": {
|
|
114
|
+
"types": "./dist/wire-nav-stack.d.ts",
|
|
115
|
+
"import": "./dist/wire-nav-stack.js"
|
|
116
|
+
},
|
|
117
|
+
"./split-view": {
|
|
118
|
+
"types": "./dist/split-view.d.ts",
|
|
119
|
+
"import": "./dist/split-view.js"
|
|
120
|
+
},
|
|
121
|
+
"./workbench": {
|
|
122
|
+
"types": "./dist/workbench.d.ts",
|
|
123
|
+
"import": "./dist/workbench.js"
|
|
124
|
+
},
|
|
125
|
+
"./tab-scaffold": {
|
|
126
|
+
"types": "./dist/tab-scaffold.d.ts",
|
|
127
|
+
"import": "./dist/tab-scaffold.js"
|
|
128
|
+
},
|
|
129
|
+
"./wire-tab-scaffold": {
|
|
130
|
+
"types": "./dist/wire-tab-scaffold.d.ts",
|
|
131
|
+
"import": "./dist/wire-tab-scaffold.js"
|
|
109
132
|
},
|
|
110
133
|
"./loading-spinner": {
|
|
111
134
|
"types": "./dist/loading-spinner.d.ts",
|
|
@@ -117,6 +140,11 @@
|
|
|
117
140
|
"browser": "./dist/browser/select.js",
|
|
118
141
|
"import": "./dist/select.js"
|
|
119
142
|
},
|
|
143
|
+
"./skeleton": {
|
|
144
|
+
"types": "./dist/skeleton.d.ts",
|
|
145
|
+
"browser": "./dist/browser/skeleton.js",
|
|
146
|
+
"import": "./dist/skeleton.js"
|
|
147
|
+
},
|
|
120
148
|
"./segmented-control": {
|
|
121
149
|
"types": "./dist/segmented-control.d.ts",
|
|
122
150
|
"browser": "./dist/browser/segmented-control.js",
|
|
@@ -149,10 +177,10 @@
|
|
|
149
177
|
"browser": "./dist/browser/empty-state.js",
|
|
150
178
|
"import": "./dist/empty-state.js"
|
|
151
179
|
},
|
|
152
|
-
"./
|
|
153
|
-
"types": "./dist/
|
|
154
|
-
"browser": "./dist/browser/
|
|
155
|
-
"import": "./dist/
|
|
180
|
+
"./panel-header": {
|
|
181
|
+
"types": "./dist/panel-header.d.ts",
|
|
182
|
+
"browser": "./dist/browser/panel-header.js",
|
|
183
|
+
"import": "./dist/panel-header.js"
|
|
156
184
|
},
|
|
157
185
|
"./value-table": {
|
|
158
186
|
"types": "./dist/value-table.d.ts",
|
|
@@ -178,14 +206,18 @@
|
|
|
178
206
|
"./resizable-region.css": "./dist/styles/resizable-region.css",
|
|
179
207
|
"./app-tab.css": "./dist/styles/app-tab.css",
|
|
180
208
|
"./tab-bar.css": "./dist/styles/tab-bar.css",
|
|
181
|
-
"./
|
|
209
|
+
"./nav-stack.css": "./dist/styles/nav-stack.css",
|
|
210
|
+
"./split-view.css": "./dist/styles/split-view.css",
|
|
211
|
+
"./workbench.css": "./dist/styles/workbench.css",
|
|
212
|
+
"./tab-scaffold.css": "./dist/styles/tab-scaffold.css",
|
|
182
213
|
"./loading-spinner.css": "./dist/styles/loading-spinner.css",
|
|
183
214
|
"./select.css": "./dist/styles/select.css",
|
|
215
|
+
"./skeleton.css": "./dist/styles/skeleton.css",
|
|
184
216
|
"./segmented-control.css": "./dist/styles/segmented-control.css",
|
|
185
217
|
"./token-search-field.css": "./dist/styles/token-search-field.css",
|
|
186
218
|
"./state-banner.css": "./dist/styles/state-banner.css",
|
|
187
219
|
"./empty-state.css": "./dist/styles/empty-state.css",
|
|
188
|
-
"./
|
|
220
|
+
"./panel-header.css": "./dist/styles/panel-header.css",
|
|
189
221
|
"./value-table.css": "./dist/styles/value-table.css",
|
|
190
222
|
"./ai/*": "./ai/*",
|
|
191
223
|
"./docs/*": "./docs/*"
|
|
@@ -4,7 +4,7 @@ import './recipes.css';
|
|
|
4
4
|
import { LucideIcon } from '@kerfjs/ui/lucide-icon';
|
|
5
5
|
import { MenuHeader } from '@kerfjs/ui/menu-header';
|
|
6
6
|
import { MenuItem } from '@kerfjs/ui/menu-item';
|
|
7
|
-
import {
|
|
7
|
+
import { PanelHeader } from '@kerfjs/ui/panel-header';
|
|
8
8
|
import { ResizableRegion } from '@kerfjs/ui/resizable-region';
|
|
9
9
|
import { Toolbar } from '@kerfjs/ui/toolbar';
|
|
10
10
|
import { ToolbarControlGroup } from '@kerfjs/ui/toolbar-control-group';
|
|
@@ -24,8 +24,8 @@ export const createRecipe: RecipeFactory = (announce) => {
|
|
|
24
24
|
<Toolbar label="Atlas workspace" leading={<ToolbarControlGroup appearance="borderless" single><ToolbarText text="Atlas" /></ToolbarControlGroup>} trailing={<div class="recipe-shell__toolbar-actions"><ToolbarControlGroup className="recipe-shell__responsive-controls" appearance="borderless" label="Workspace panes"><button type="button" aria-label="Show navigation" aria-controls="recipe-shell-navigation" aria-pressed={String(responsivePane.value === 'navigation')} data-action="recipe-action" data-recipe-command="show-navigation"><LucideIcon icon={Folder} name="folder" /></button><button type="button" aria-label="Show content" aria-controls="recipe-shell-content" aria-pressed={String(responsivePane.value === 'content')} data-action="recipe-action" data-recipe-command="show-content"><LucideIcon icon={Inbox} name="inbox" /></button><button type="button" aria-label="Show inspector" aria-controls="recipe-shell-inspector" aria-pressed={String(responsivePane.value === 'inspector')} data-action="recipe-action" data-recipe-command="show-inspector"><LucideIcon icon={Settings} name="settings" /></button></ToolbarControlGroup><ToolbarControlGroup appearance="borderless" label="Workspace controls"><button type="button" aria-label="Notifications" data-action="recipe-action" data-recipe-command="notify"><LucideIcon icon={Bell} name="bell" /></button><button type="button" aria-label="Settings" data-action="recipe-action" data-recipe-command="settings"><LucideIcon icon={Settings} name="settings" /></button></ToolbarControlGroup></div>} />
|
|
25
25
|
<div class="recipe-shell__body">
|
|
26
26
|
<div id="recipe-shell-navigation" class="recipe-shell__nav-region"><ResizableRegion id="recipe-navigation" label="Navigation" size={navigationSize.value} min={180} max={320}><aside class="recipe-shell__nav kui-pane"><MenuHeader label="Workspace" /><nav class="recipe-shell__nav-list kui-pane__content kui-content" aria-label="Workspace"><section><MenuItem action="recipe-action" itemId="inbox" label="Inbox" icon={<LucideIcon icon={Inbox} name="inbox" />} selected={selected.value === 'inbox'} /><MenuItem action="recipe-action" itemId="projects" label="Projects with a deliberately wrapping title" icon={<LucideIcon icon={Folder} name="folder" />} selected={selected.value === 'projects'} multiline /></section></nav></aside></ResizableRegion></div>
|
|
27
|
-
<main id="recipe-shell-content" class="recipe-shell__main kui-pane"><
|
|
28
|
-
<div id="recipe-shell-inspector" class="recipe-shell__inspector-region"><ResizableRegion id="recipe-inspector" label="Inspector" size={inspectorSize.value} min={200} max={360} edge="start"><aside class="recipe-shell__inspector kui-pane"><
|
|
27
|
+
<main id="recipe-shell-content" class="recipe-shell__main kui-pane"><PanelHeader title={selected.value === 'inbox' ? 'Inbox triage' : 'Active projects'} titleId="recipe-shell-main-title" actions={<button class="kui-recipe__button" data-primary="true" type="button" data-action="recipe-action" data-recipe-command="new">New task</button>} /><div class="recipe-shell__main-body kui-pane__content kui-content"><p class="kui-recipe__ownership kui-content-item">Recipe owns pane geometry and one scroll owner per pane. The app owns routing, data, pane visibility, sizes, and persistence.</p><div class="recipe-shell__cards">{['Release accessibility audit', 'Prepare tablet navigation', 'Review stale-data states', 'Confirm package boundaries'].map((title) => <article class="recipe-shell__card kui-content-item"><strong>{title}</strong><p class="kui-recipe__muted">Assigned to the interface systems team · due this week</p></article>)}</div></div></main>
|
|
28
|
+
<div id="recipe-shell-inspector" class="recipe-shell__inspector-region"><ResizableRegion id="recipe-inspector" label="Inspector" size={inspectorSize.value} min={200} max={360} edge="start"><aside class="recipe-shell__inspector kui-pane"><PanelHeader title="Inspector" titleId="recipe-shell-inspector-title" /><div class="recipe-shell__inspector-body kui-pane__content kui-content"><ValueTable label="Selected task"><ValueTableRow label="Status" value="In review" /><ValueTableRow label="Owner" value="Mara Chen" /><ValueTableRow label="Priority" value="High" /></ValueTable></div></aside></ResizableRegion></div>
|
|
29
29
|
</div>
|
|
30
30
|
</section>;
|
|
31
31
|
return { render, action(command, element) { const pane = command.match(/^show-(navigation|content|inspector)$/)?.[1] as typeof responsivePane.value | undefined; if (pane) responsivePane.value = pane; const id = element.dataset.itemId; if (id) selected.value = id; announce(id ? `Opened ${id}` : pane ? `Showing ${pane}` : command === 'new' ? 'New task requested' : `${command} requested`); }, resize(id, size) { if (id === 'recipe-navigation') navigationSize.value = size; if (id === 'recipe-inspector') inspectorSize.value = size; announce(`${id} resized to ${size}px`); } };
|
|
@@ -6,7 +6,7 @@ import '@awesome.me/webawesome/dist/components/input/input.js';
|
|
|
6
6
|
import '@awesome.me/webawesome/dist/components/textarea/textarea.js';
|
|
7
7
|
import './recipes.css';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { PanelHeader } from '@kerfjs/ui/panel-header';
|
|
10
10
|
import { Select } from '@kerfjs/ui/select';
|
|
11
11
|
import { StateBanner } from '@kerfjs/ui/state-banner';
|
|
12
12
|
import { signal } from 'kerfjs';
|
|
@@ -30,7 +30,7 @@ export const createRecipe: RecipeFactory = (announce) => {
|
|
|
30
30
|
const audience = signal('team');
|
|
31
31
|
const status = signal<'idle' | 'error' | 'saved'>('idle');
|
|
32
32
|
const render = () => <form class="kui-recipe recipe-form kui-recipe__surface kui-content" data-recipe="recipe-composer-form" aria-labelledby="recipe-composer-title" aria-describedby="recipe-composer-summary" noValidate>
|
|
33
|
-
<
|
|
33
|
+
<PanelHeader title="Publish workspace update" titleId="recipe-composer-title" summary="Share a concise, actionable update with collaborators." summaryId="recipe-composer-summary" />
|
|
34
34
|
{status.value === 'error' && <StateBanner title="Add a title before publishing" detail="The update body and audience are preserved." tone="danger" urgency="alert" />}
|
|
35
35
|
{status.value === 'saved' && <StateBanner title="Update published" detail="The team audience can now read it." tone="success" />}
|
|
36
36
|
<div class="recipe-form__section recipe-form__fields">
|
|
@@ -3,7 +3,7 @@ import './recipes.css';
|
|
|
3
3
|
|
|
4
4
|
import { EmptyState } from '@kerfjs/ui/empty-state';
|
|
5
5
|
import { LoadingSpinner } from '@kerfjs/ui/loading-spinner';
|
|
6
|
-
import {
|
|
6
|
+
import { PanelHeader } from '@kerfjs/ui/panel-header';
|
|
7
7
|
import { StateBanner } from '@kerfjs/ui/state-banner';
|
|
8
8
|
import { signal } from 'kerfjs';
|
|
9
9
|
|
|
@@ -21,6 +21,6 @@ export const createRecipe: RecipeFactory = (announce) => {
|
|
|
21
21
|
if (state.value === 'error') return <StateBanner title="Release tasks could not be refreshed" detail="Existing filters are preserved. Try again when the connection recovers." tone="danger" urgency="alert" action={<button class="kui-recipe__button" type="button" data-action="recipe-action" data-recipe-command="retry">Retry</button>} />;
|
|
22
22
|
return <>{state.value === 'stale' && <StateBanner title="Showing saved results" detail="Refreshing in the background." tone="warning" action={<span class="kui-inline-metadata"><LoadingSpinner label="Refreshing release tasks" /><button class="kui-recipe__button" type="button" data-action="recipe-action" data-recipe-command="finish">Finish refresh</button></span>} />}{populated()}</>;
|
|
23
23
|
};
|
|
24
|
-
const render = () => <section class="kui-recipe recipe-list kui-recipe__surface kui-pane" data-recipe="recipe-list-workspace-states" data-list-state={state.value}><
|
|
24
|
+
const render = () => <section class="kui-recipe recipe-list kui-recipe__surface kui-pane" data-recipe="recipe-list-workspace-states" data-list-state={state.value}><PanelHeader title="Release tasks" titleId="recipe-list-title" actions={<div class="kui-control-cluster"><button class="kui-recipe__button" type="button" data-action="recipe-action" data-recipe-command="empty">Clear</button><button class="kui-recipe__button" type="button" data-action="recipe-action" data-recipe-command="fail">Simulate failure</button><button class="kui-recipe__button" data-primary="true" type="button" data-action="recipe-action" data-recipe-command="refresh">Refresh</button></div>} /><div class="recipe-list__body kui-pane__content kui-content">{renderBody()}<p class="kui-recipe__ownership kui-content-item">The recipe owns feedback placement and stable content. The app owns fetching, cache age, retry policy, and domain rows.</p></div></section>;
|
|
25
25
|
return { render, action(command) { const next: Record<string, ListState> = { load: 'populated', empty: 'empty', create: 'populated', fail: 'error', retry: 'populated', refresh: 'stale', finish: 'populated' }; if (command in next) state.value = next[command]!; announce(`List state: ${state.value}`); } };
|
|
26
26
|
};
|
|
@@ -8,6 +8,7 @@ export const recipeIds = [
|
|
|
8
8
|
'recipe-composer-form',
|
|
9
9
|
'recipe-list-workspace-states',
|
|
10
10
|
'recipe-compact-toolbar',
|
|
11
|
+
'recipe-navigation-stack',
|
|
11
12
|
] as const;
|
|
12
13
|
|
|
13
14
|
export type RecipeId = typeof recipeIds[number];
|
|
@@ -20,6 +21,7 @@ export const recipeLoaders: Record<RecipeId, () => Promise<{ createRecipe: Recip
|
|
|
20
21
|
'recipe-composer-form': () => import('./composer-form.js'),
|
|
21
22
|
'recipe-list-workspace-states': () => import('./list-workspace-states.js'),
|
|
22
23
|
'recipe-compact-toolbar': () => import('./compact-toolbar.js'),
|
|
24
|
+
'recipe-navigation-stack': () => import('./navigation-stack.js'),
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
export function isRecipeId(value: string): value is RecipeId {
|
|
@@ -4,10 +4,10 @@ import '@awesome.me/webawesome/dist/components/button/button.js';
|
|
|
4
4
|
import '@awesome.me/webawesome/dist/components/dialog/dialog.js';
|
|
5
5
|
import './recipes.css';
|
|
6
6
|
|
|
7
|
-
import { DialogHeader } from '@kerfjs/ui/dialog-header';
|
|
8
7
|
import { LucideIcon } from '@kerfjs/ui/lucide-icon';
|
|
9
8
|
import { MenuHeader } from '@kerfjs/ui/menu-header';
|
|
10
9
|
import { MenuItem } from '@kerfjs/ui/menu-item';
|
|
10
|
+
import { PanelHeader } from '@kerfjs/ui/panel-header';
|
|
11
11
|
import { ValueTable, ValueTableRow } from '@kerfjs/ui/value-table';
|
|
12
12
|
import { signal } from 'kerfjs';
|
|
13
13
|
import { FileText } from 'lucide';
|
|
@@ -27,7 +27,7 @@ interface RecipeDialogElement extends HTMLElement {
|
|
|
27
27
|
export const createRecipe: RecipeFactory = (announce) => {
|
|
28
28
|
const selected = signal<keyof typeof records>('alpha');
|
|
29
29
|
const open = { value: false };
|
|
30
|
-
const render = () => <section class="kui-recipe kui-content" data-recipe="recipe-master-detail-dialog"><button class="kui-recipe__button kui-content-item" data-primary="true" type="button" data-action="recipe-action" data-recipe-command="open">Open project details</button><p class="kui-recipe__ownership kui-content-item">Web Awesome owns modal focus and dismissal. The recipe owns header/body/master-detail anatomy; the app owns open state, selection, and policy.</p><wa-dialog class="recipe-dialog" label="Project details" without-header open={open.value}><div class="recipe-dialog__pane kui-pane"><
|
|
30
|
+
const render = () => <section class="kui-recipe kui-content" data-recipe="recipe-master-detail-dialog"><button class="kui-recipe__button kui-content-item" data-primary="true" type="button" data-action="recipe-action" data-recipe-command="open">Open project details</button><p class="kui-recipe__ownership kui-content-item">Web Awesome owns modal focus and dismissal. The recipe owns header/body/master-detail anatomy; the app owns open state, selection, and policy.</p><wa-dialog class="recipe-dialog" label="Project details" without-header open={open.value}><div class="recipe-dialog__pane kui-pane"><PanelHeader title="Project details" titleId="recipe-dialog-title" summary="Compare delivery state without leaving the workspace." summaryId="recipe-dialog-summary" icon={<LucideIcon icon={FileText} name="file-text" />} actions={<wa-button appearance="plain" data-action="recipe-action" data-recipe-command="close">Close</wa-button>} /><div class="recipe-master-detail kui-pane__content"><nav class="recipe-master-detail__master kui-pane" aria-label="Projects"><MenuHeader label="Recent projects" /><div class="kui-pane__content kui-content"><section>{Object.entries(records).map(([id, record]) => <MenuItem action="recipe-action" itemId={id} label={record.name} selected={selected.value === id} multiline />)}</section></div></nav><section class="recipe-master-detail__detail kui-content" aria-live="polite"><h3 class="recipe-master-detail__title kui-recipe__pane-title kui-content-item">{records[selected.value].name}</h3><ValueTable label="Project details"><ValueTableRow label="Owner" value={records[selected.value].owner} /><ValueTableRow label="Status" value={records[selected.value].state} /><ValueTableRow label="Updated" value={records[selected.value].updated} /></ValueTable><div class="recipe-master-detail__actions kui-control-cluster"><wa-button appearance="outlined" data-action="recipe-action" data-recipe-command="archive">Archive</wa-button><wa-button variant="brand" appearance="accent" data-action="recipe-action" data-recipe-command="open-record">Open project</wa-button></div></section></div></div></wa-dialog></section>;
|
|
31
31
|
return {
|
|
32
32
|
render,
|
|
33
33
|
action(command, element) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { wireNavStack } from '@kerfjs/ui/wire-nav-stack';
|
|
1
2
|
import { wireResizableRegions } from '@kerfjs/ui/wire-resizable-regions';
|
|
2
3
|
import { delegate, mount } from 'kerfjs';
|
|
3
4
|
import { delegateActions } from 'kerfjs/actions';
|
|
@@ -23,11 +24,13 @@ export function mountRecipe(root: HTMLElement, controller: RecipeController): ()
|
|
|
23
24
|
const stopResize = wireResizableRegions(root, {
|
|
24
25
|
onCommit: ({ id, size }) => controller.resize?.(id, size),
|
|
25
26
|
});
|
|
27
|
+
const stopNav = wireNavStack(root, { onBack: () => controller.action('nav-back', root) });
|
|
26
28
|
|
|
27
29
|
let disposed = false;
|
|
28
30
|
return () => {
|
|
29
31
|
if (disposed) return;
|
|
30
32
|
disposed = true;
|
|
33
|
+
stopNav();
|
|
31
34
|
stopResize();
|
|
32
35
|
stopDialogs();
|
|
33
36
|
stopInputs();
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import '@kerfjs/ui/layout.css';
|
|
2
|
+
import '@kerfjs/ui/nav-stack.css';
|
|
3
|
+
import '@kerfjs/ui/toolbar-text.css';
|
|
4
|
+
import './recipes.css';
|
|
5
|
+
|
|
6
|
+
import { LucideIcon } from '@kerfjs/ui/lucide-icon';
|
|
7
|
+
import { MenuHeader } from '@kerfjs/ui/menu-header';
|
|
8
|
+
import { MenuItem } from '@kerfjs/ui/menu-item';
|
|
9
|
+
import { NavStack, type NavStackView } from '@kerfjs/ui/nav-stack';
|
|
10
|
+
import { signal } from 'kerfjs';
|
|
11
|
+
import { ChevronRight, FileText, Folder } from 'lucide';
|
|
12
|
+
|
|
13
|
+
import type { RecipeFactory } from './types.js';
|
|
14
|
+
|
|
15
|
+
interface LibraryItem {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
detail: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const ITEMS: LibraryItem[] = [
|
|
22
|
+
{ id: 'tokens', label: 'Design tokens', detail: 'Semantic color, spacing, and radius scales shared across every surface.' },
|
|
23
|
+
{ id: 'controls', label: 'Toolbar controls', detail: 'Control groups and segmented controls with their hover and pressed contracts.' },
|
|
24
|
+
{ id: 'layouts', label: 'App layouts', detail: 'Navigation stacks, split views, workbench, and bottom-tab scaffolds.' },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export const createRecipe: RecipeFactory = (announce) => {
|
|
28
|
+
const listView = (): NavStackView => ({
|
|
29
|
+
key: 'library',
|
|
30
|
+
title: 'Library',
|
|
31
|
+
content: <div class="recipe-navstack__view kui-pane__content kui-content">
|
|
32
|
+
<section>
|
|
33
|
+
<MenuHeader label="Components" />
|
|
34
|
+
{ITEMS.map((item) => <MenuItem action="recipe-action" itemId={item.id} label={item.label} icon={<LucideIcon icon={Folder} name="folder" />} trailing={<LucideIcon icon={ChevronRight} name="chevron-right" />} />)}
|
|
35
|
+
</section>
|
|
36
|
+
<p class="kui-recipe__ownership kui-content-item">The recipe owns the stack as a signal of views and pushes/pops it; `NavStack` renders the stack and `wireNavStack` slides the content and settles the chrome. The app owns selection, data, and routing.</p>
|
|
37
|
+
</div>,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const detailView = (item: LibraryItem): NavStackView => ({
|
|
41
|
+
key: item.id,
|
|
42
|
+
title: item.label,
|
|
43
|
+
content: <div class="recipe-navstack__view kui-pane__content kui-content">
|
|
44
|
+
<div class="kui-content-item">
|
|
45
|
+
<LucideIcon icon={FileText} name="file-text" />
|
|
46
|
+
<strong>{item.label}</strong>
|
|
47
|
+
<p class="kui-recipe__muted">{item.detail}</p>
|
|
48
|
+
</div>
|
|
49
|
+
</div>,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const views = signal<NavStackView[]>([listView()]);
|
|
53
|
+
|
|
54
|
+
const render = () => <section class="kui-recipe recipe-navstack kui-recipe__surface" data-recipe="recipe-navigation-stack">
|
|
55
|
+
<div class="recipe-navstack__stage"><NavStack id="recipe-nav" label="Component library" views={views.value} /></div>
|
|
56
|
+
</section>;
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
render,
|
|
60
|
+
action(command, element) {
|
|
61
|
+
if (command === 'nav-back') {
|
|
62
|
+
if (views.value.length > 1) {
|
|
63
|
+
views.value = views.value.slice(0, -1);
|
|
64
|
+
announce('Navigated back');
|
|
65
|
+
}
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const id = element.dataset.itemId;
|
|
69
|
+
const item = ITEMS.find((candidate) => candidate.id === id);
|
|
70
|
+
if (item) {
|
|
71
|
+
views.value = [...views.value, detailView(item)];
|
|
72
|
+
announce(`Opened ${item.label}`);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
};
|