@kerf-js/veneer 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +16 -0
- package/README.md +1338 -2
- package/package.json +56 -3
- package/plugin.d.mts +187 -0
- package/plugin.mjs +399 -0
- package/src/Accordion.tsx +98 -0
- package/src/Alert.tsx +55 -0
- package/src/Badge.tsx +39 -0
- package/src/Button.tsx +175 -0
- package/src/Calendar-month.tsx +140 -0
- package/src/Calendar.tsx +335 -0
- package/src/Canvas.tsx +221 -0
- package/src/Card.tsx +85 -0
- package/src/Chart.tsx +278 -0
- package/src/Charts.tsx +158 -0
- package/src/Chip.tsx +61 -0
- package/src/Choice-checkbox.tsx +53 -0
- package/src/Choice-parts.tsx +7 -0
- package/src/Choice-radio.tsx +78 -0
- package/src/Choice-segmented.tsx +76 -0
- package/src/Choice-switch.tsx +51 -0
- package/src/Choice.tsx +4 -0
- package/src/CloseX.tsx +14 -0
- package/src/CodeBlock.tsx +81 -0
- package/src/CodeInput.tsx +256 -0
- package/src/Combobox.tsx +281 -0
- package/src/CommandPalette-controller.ts +314 -0
- package/src/CommandPalette-rows.tsx +137 -0
- package/src/CommandPalette.tsx +196 -0
- package/src/DataGrid-actions.ts +119 -0
- package/src/DataGrid-body.tsx +58 -0
- package/src/DataGrid-controller.ts +145 -0
- package/src/DataGrid-header.tsx +108 -0
- package/src/DataGrid-model.ts +248 -0
- package/src/DataGrid-pivot.tsx +108 -0
- package/src/DataGrid-rows.tsx +296 -0
- package/src/DataGrid-toolbar.tsx +127 -0
- package/src/DataGrid-tree.ts +149 -0
- package/src/DataGrid-viewport.tsx +37 -0
- package/src/DataGrid.tsx +145 -0
- package/src/DateField-presets.tsx +27 -0
- package/src/DateField-range.tsx +370 -0
- package/src/DateField.tsx +295 -0
- package/src/Dither.tsx +313 -0
- package/src/Drawer.tsx +123 -0
- package/src/DurationField.tsx +227 -0
- package/src/Feed.tsx +78 -0
- package/src/Field/view.tsx +147 -0
- package/src/Field.tsx +238 -0
- package/src/HamburgerMenu.tsx +119 -0
- package/src/Icon.tsx +15 -0
- package/src/Kbd.tsx +6 -0
- package/src/KeyValueEditor/actions.ts +75 -0
- package/src/KeyValueEditor/rows.tsx +104 -0
- package/src/KeyValueEditor.tsx +112 -0
- package/src/Layout.tsx +221 -0
- package/src/Markdown.tsx +127 -0
- package/src/MentionsInput/actions.ts +161 -0
- package/src/MentionsInput/end.tsx +82 -0
- package/src/MentionsInput.tsx +103 -0
- package/src/Menu.tsx +221 -0
- package/src/Modal.tsx +109 -0
- package/src/MonthPicker/month.tsx +117 -0
- package/src/MonthPicker/period.tsx +197 -0
- package/src/MonthPicker/shared.tsx +272 -0
- package/src/MonthPicker/week.tsx +103 -0
- package/src/MonthPicker.tsx +11 -0
- package/src/MultiSelect.tsx +139 -0
- package/src/Nav.tsx +36 -0
- package/src/NumberField.tsx +156 -0
- package/src/Pagination.tsx +335 -0
- package/src/PaymentCard.tsx +111 -0
- package/src/Picker.tsx +228 -0
- package/src/PlaceField.tsx +285 -0
- package/src/Popover.tsx +88 -0
- package/src/Presence.tsx +37 -0
- package/src/Progress.tsx +71 -0
- package/src/RecurrenceField.tsx +372 -0
- package/src/RichSelect/codes.tsx +94 -0
- package/src/RichSelect/list.tsx +380 -0
- package/src/RichSelect/phone-view.tsx +114 -0
- package/src/RichSelect/phone.tsx +305 -0
- package/src/RichSelect/search-keys.ts +28 -0
- package/src/RichSelect/timezone.tsx +53 -0
- package/src/RichSelect.tsx +13 -0
- package/src/RichTextEditor/controller.tsx +305 -0
- package/src/RichTextEditor/editor.tsx +61 -0
- package/src/RichTextEditor/tools.tsx +132 -0
- package/src/RichTextEditor/view.tsx +210 -0
- package/src/RichTextEditor.tsx +9 -0
- package/src/ScrollGrid/measure.ts +39 -0
- package/src/ScrollGrid/parts.tsx +112 -0
- package/src/ScrollGrid.tsx +375 -0
- package/src/ScrollRail.tsx +114 -0
- package/src/ScrollView.tsx +57 -0
- package/src/Segments/controller.tsx +148 -0
- package/src/Segments/events.ts +99 -0
- package/src/Segments/view.tsx +77 -0
- package/src/Segments.tsx +2 -0
- package/src/Select.tsx +343 -0
- package/src/Shape.tsx +41 -0
- package/src/Shell/branches.tsx +108 -0
- package/src/Shell/button.tsx +33 -0
- package/src/Shell/shared.tsx +220 -0
- package/src/Shell/shell.tsx +25 -0
- package/src/Shell/state.ts +138 -0
- package/src/Shell/view.tsx +280 -0
- package/src/Shell.tsx +17 -0
- package/src/SideNav/sections.tsx +50 -0
- package/src/SideNav/state.ts +140 -0
- package/src/SideNav.tsx +130 -0
- package/src/SideNavTitle.tsx +25 -0
- package/src/SignaturePad/state.ts +172 -0
- package/src/SignaturePad/view.tsx +69 -0
- package/src/SignaturePad.tsx +76 -0
- package/src/Skeleton.tsx +46 -0
- package/src/Slider.tsx +81 -0
- package/src/Spinner.tsx +21 -0
- package/src/Stage-director.ts +361 -0
- package/src/Stage-look.ts +75 -0
- package/src/Stage-poster.tsx +62 -0
- package/src/Stage-types.ts +206 -0
- package/src/Stage.tsx +147 -0
- package/src/TabBar.tsx +114 -0
- package/src/Table-actions.tsx +51 -0
- package/src/Table-base.ts +70 -0
- package/src/Table-body.tsx +84 -0
- package/src/Table-columns.tsx +58 -0
- package/src/Table-details.tsx +66 -0
- package/src/Table-editor.tsx +66 -0
- package/src/Table-head.tsx +52 -0
- package/src/Table-model.ts +82 -0
- package/src/Table-notice.ts +39 -0
- package/src/Table-paging.ts +50 -0
- package/src/Table-rows.tsx +308 -0
- package/src/Table-selection.ts +63 -0
- package/src/Table-sortbar.tsx +41 -0
- package/src/Table-source.ts +66 -0
- package/src/Table-toolbar.tsx +71 -0
- package/src/Table-types.ts +115 -0
- package/src/Table-view.tsx +87 -0
- package/src/Table.tsx +31 -0
- package/src/Tabs.tsx +129 -0
- package/src/Tag.tsx +40 -0
- package/src/Ticker.tsx +42 -0
- package/src/TimeField-date-model.ts +77 -0
- package/src/TimeField-date-view.tsx +152 -0
- package/src/TimeField-model.ts +80 -0
- package/src/TimeField-options.tsx +224 -0
- package/src/TimeField-slots.tsx +32 -0
- package/src/TimeField-types.ts +33 -0
- package/src/TimeField-view.tsx +124 -0
- package/src/TimeField.tsx +126 -0
- package/src/Toast.tsx +143 -0
- package/src/Toggle.tsx +75 -0
- package/src/Tooltip.tsx +69 -0
- package/src/Type.tsx +136 -0
- package/src/VirtualList-controls.ts +105 -0
- package/src/VirtualList-data.ts +43 -0
- package/src/VirtualList-measure.ts +169 -0
- package/src/VirtualList-metrics.ts +41 -0
- package/src/VirtualList-mount.ts +145 -0
- package/src/VirtualList-rows.tsx +91 -0
- package/src/VirtualList-types.ts +76 -0
- package/src/VirtualList-view.tsx +123 -0
- package/src/VirtualList.tsx +81 -0
- package/src/admin/ApiKeys-actions.ts +124 -0
- package/src/admin/ApiKeys-form.tsx +64 -0
- package/src/admin/ApiKeys-view.tsx +101 -0
- package/src/admin/ApiKeys.tsx +224 -0
- package/src/admin/Audit.tsx +246 -0
- package/src/admin/Billing.tsx +307 -0
- package/src/admin/Cart.tsx +177 -0
- package/src/admin/Checkout-address.tsx +125 -0
- package/src/admin/Checkout-cart.tsx +78 -0
- package/src/admin/Checkout-coupon.ts +34 -0
- package/src/admin/Checkout-done.tsx +31 -0
- package/src/admin/Checkout-model.ts +33 -0
- package/src/admin/Checkout-navigation.ts +76 -0
- package/src/admin/Checkout-payment-view.tsx +49 -0
- package/src/admin/Checkout-payment.ts +80 -0
- package/src/admin/Checkout-review.tsx +60 -0
- package/src/admin/Checkout-shipping.tsx +47 -0
- package/src/admin/Checkout-state.ts +122 -0
- package/src/admin/Checkout-steps.ts +10 -0
- package/src/admin/Checkout-summary.tsx +97 -0
- package/src/admin/Checkout-types.ts +60 -0
- package/src/admin/Checkout-view.tsx +51 -0
- package/src/admin/Checkout.tsx +72 -0
- package/src/admin/CsvImport-actions.ts +131 -0
- package/src/admin/CsvImport.tsx +379 -0
- package/src/admin/Danger.tsx +240 -0
- package/src/admin/Integrations/Card.tsx +82 -0
- package/src/admin/Integrations/Webhooks.tsx +341 -0
- package/src/admin/Integrations.tsx +169 -0
- package/src/admin/InviteDialog.tsx +153 -0
- package/src/admin/Members/columns.tsx +181 -0
- package/src/admin/Members.tsx +316 -0
- package/src/admin/Order.tsx +115 -0
- package/src/admin/PlainTable.tsx +34 -0
- package/src/admin/Plans.tsx +375 -0
- package/src/admin/SaveBar/actions.ts +86 -0
- package/src/admin/SaveBar.tsx +153 -0
- package/src/admin/Secret.tsx +74 -0
- package/src/admin/Settings.tsx +145 -0
- package/src/admin/StepBar.tsx +66 -0
- package/src/admin/TagsInput/actions.ts +60 -0
- package/src/admin/TagsInput.tsx +95 -0
- package/src/admin/atoms.tsx +73 -0
- package/src/admin/index.ts +67 -0
- package/src/agent/Actions/reasons.tsx +38 -0
- package/src/agent/Actions.tsx +166 -0
- package/src/agent/AgentPlan.tsx +86 -0
- package/src/agent/ArtifactPanel.tsx +299 -0
- package/src/agent/Assistant.tsx +168 -0
- package/src/agent/Checkpoint.tsx +19 -0
- package/src/agent/Cite.tsx +70 -0
- package/src/agent/ContextMeter.tsx +70 -0
- package/src/agent/Conversation.tsx +70 -0
- package/src/agent/Message.tsx +92 -0
- package/src/agent/ModelPicker.tsx +167 -0
- package/src/agent/Prompt-model.ts +118 -0
- package/src/agent/Prompt-view.tsx +246 -0
- package/src/agent/Prompt.tsx +128 -0
- package/src/agent/Prose.tsx +118 -0
- package/src/agent/Question.tsx +137 -0
- package/src/agent/Reasoning.tsx +31 -0
- package/src/agent/Shimmer.tsx +11 -0
- package/src/agent/Sources.tsx +23 -0
- package/src/agent/SpeechInput.tsx +243 -0
- package/src/agent/Suggestions.tsx +36 -0
- package/src/agent/ToolCall.tsx +219 -0
- package/src/agent/TraceViewer.tsx +96 -0
- package/src/agent/bits.tsx +88 -0
- package/src/agent/index.ts +38 -0
- package/src/bind.ts +57 -0
- package/src/collab/AutoTrack.tsx +91 -0
- package/src/collab/Comments.tsx +204 -0
- package/src/collab/Composer/state.ts +125 -0
- package/src/collab/Composer/view.tsx +155 -0
- package/src/collab/Composer.tsx +141 -0
- package/src/collab/ConversationList.tsx +120 -0
- package/src/collab/Cursors.tsx +71 -0
- package/src/collab/DataIntegrity.tsx +103 -0
- package/src/collab/Kanban-card.ts +74 -0
- package/src/collab/Kanban.tsx +368 -0
- package/src/collab/Lock.tsx +36 -0
- package/src/collab/PresenceStack.tsx +176 -0
- package/src/collab/ShareDialog.tsx +273 -0
- package/src/collab/Status.tsx +101 -0
- package/src/collab/SyncedForm.tsx +42 -0
- package/src/collab/Thread/Message.tsx +265 -0
- package/src/collab/Thread/rows.tsx +56 -0
- package/src/collab/Thread.tsx +323 -0
- package/src/collab/VersionHistory.tsx +173 -0
- package/src/collab/ViewportRail.tsx +73 -0
- package/src/collab/index.ts +37 -0
- package/src/collab/peer.tsx +42 -0
- package/src/fields.ts +5 -0
- package/src/flow/AuthScreen.tsx +81 -0
- package/src/flow/AuthSteps.tsx +296 -0
- package/src/flow/Checklist.tsx +211 -0
- package/src/flow/ConnBanner.tsx +304 -0
- package/src/flow/Flow.tsx +97 -0
- package/src/flow/MfaSetup.tsx +244 -0
- package/src/flow/Otp.tsx +243 -0
- package/src/flow/ReauthDialog.tsx +79 -0
- package/src/flow/ShortcutsOverlay.tsx +121 -0
- package/src/flow/SignGate.tsx +184 -0
- package/src/flow/SignIn.tsx +136 -0
- package/src/flow/SignUp.tsx +149 -0
- package/src/flow/Sso.tsx +96 -0
- package/src/flow/SystemPage/accounts.tsx +74 -0
- package/src/flow/SystemPage/art.tsx +113 -0
- package/src/flow/SystemPage.tsx +395 -0
- package/src/flow/Tour.tsx +207 -0
- package/src/flow/index.ts +29 -0
- package/src/flow/kit.tsx +334 -0
- package/src/index.ts +237 -0
- package/src/layout.css +4 -0
- package/src/links.css +4 -0
- package/src/live/ActivityFeed.tsx +88 -0
- package/src/live/Bell.tsx +108 -0
- package/src/live/Connection.tsx +113 -0
- package/src/live/Inbox.tsx +113 -0
- package/src/live/InboxFeed.tsx +67 -0
- package/src/live/InboxGestures.ts +41 -0
- package/src/live/InboxHandlers.ts +102 -0
- package/src/live/InboxHeader.tsx +81 -0
- package/src/live/InboxModel.ts +81 -0
- package/src/live/InboxRow.tsx +125 -0
- package/src/live/MeetingRoom.tsx +22 -0
- package/src/live/MeetingRoomControlBar.tsx +197 -0
- package/src/live/MeetingRoomHandlers.ts +53 -0
- package/src/live/MeetingRoomLayout.tsx +27 -0
- package/src/live/MeetingRoomModel.ts +49 -0
- package/src/live/MeetingRoomMount.ts +49 -0
- package/src/live/MeetingRoomParts.tsx +178 -0
- package/src/live/MeetingRoomPerson.tsx +21 -0
- package/src/live/MeetingRoomState.ts +88 -0
- package/src/live/MeetingRoomTile.tsx +84 -0
- package/src/live/MeetingRoomTypes.ts +68 -0
- package/src/live/MeetingRoomView.tsx +36 -0
- package/src/live/NotificationPreferences.tsx +99 -0
- package/src/live/NotificationPreferencesActions.ts +55 -0
- package/src/live/NotificationPreferencesCell.tsx +26 -0
- package/src/live/NotificationPreferencesCells.tsx +59 -0
- package/src/live/NotificationPreferencesGrid.tsx +129 -0
- package/src/live/NotificationPreferencesModel.tsx +91 -0
- package/src/live/NotificationPreferencesSave.ts +85 -0
- package/src/live/NotificationPreferencesWatch.ts +31 -0
- package/src/live/Prejoin.tsx +238 -0
- package/src/live/PrejoinMeter.tsx +26 -0
- package/src/live/PrejoinPreview.tsx +53 -0
- package/src/live/PushSoftAsk.tsx +63 -0
- package/src/live/TransportPicker.tsx +341 -0
- package/src/live/TransportPickerDetails.tsx +130 -0
- package/src/live/index.ts +31 -0
- package/src/live/notify.tsx +22 -0
- package/src/live/shared.tsx +110 -0
- package/src/parts.tsx +199 -0
- package/src/plugin/catalog.mjs +129 -0
- package/src/plugin/dtcg.mjs +79 -0
- package/src/plugin/icons.mjs +7 -0
- package/src/plugin/seed.mjs +40 -0
- package/src/plugin/theme-context.mjs +44 -0
- package/src/plugin/theme-css.mjs +143 -0
- package/src/plugin/theme-motion.mjs +43 -0
- package/src/plugin/theme-parts.d.mts +41 -0
- package/src/plugin/theme-parts.mjs +224 -0
- package/src/plugin/theme-text.mjs +93 -0
- package/src/plugin/theme-values.mjs +15 -0
- package/src/plugin/theme.d.mts +82 -0
- package/src/plugin/theme.mjs +316 -0
- package/src/schedule/Agenda.tsx +124 -0
- package/src/schedule/AgendaActions.ts +31 -0
- package/src/schedule/AgendaDay.tsx +124 -0
- package/src/schedule/AgendaGestures.ts +27 -0
- package/src/schedule/AgendaKeys.ts +52 -0
- package/src/schedule/AgendaModel.ts +82 -0
- package/src/schedule/AgendaNavigation.ts +38 -0
- package/src/schedule/AgendaPage.tsx +39 -0
- package/src/schedule/AgendaStrip.tsx +55 -0
- package/src/schedule/AvailabilityEditor-actions.ts +146 -0
- package/src/schedule/AvailabilityEditor-day.tsx +119 -0
- package/src/schedule/AvailabilityEditor-view.tsx +205 -0
- package/src/schedule/AvailabilityEditor.tsx +113 -0
- package/src/schedule/BookingCalendar.tsx +121 -0
- package/src/schedule/BookingCalendarActions.ts +85 -0
- package/src/schedule/BookingCalendarModel.ts +86 -0
- package/src/schedule/BookingCalendarParts.tsx +87 -0
- package/src/schedule/Calendar/AgendaView.tsx +45 -0
- package/src/schedule/Calendar/CalendarDialogs.tsx +105 -0
- package/src/schedule/Calendar/CalendarMain.tsx +47 -0
- package/src/schedule/Calendar/CalendarToolbar.tsx +106 -0
- package/src/schedule/Calendar/Column.tsx +129 -0
- package/src/schedule/Calendar/EventBlock.tsx +71 -0
- package/src/schedule/Calendar/MiniMonth.tsx +169 -0
- package/src/schedule/Calendar/MonthGrid.tsx +296 -0
- package/src/schedule/Calendar/TimeGrid.tsx +252 -0
- package/src/schedule/Calendar/Timeline.tsx +287 -0
- package/src/schedule/Calendar/ZoneChip.tsx +73 -0
- package/src/schedule/Calendar/calendar-shell.ts +160 -0
- package/src/schedule/Calendar/calendar-state.ts +30 -0
- package/src/schedule/Calendar/now-spans.tsx +33 -0
- package/src/schedule/Calendar/shared.ts +3 -0
- package/src/schedule/Calendar/state-actions.ts +189 -0
- package/src/schedule/Calendar/state-base.ts +143 -0
- package/src/schedule/Calendar/state-keys.ts +128 -0
- package/src/schedule/Calendar/time-fit.ts +84 -0
- package/src/schedule/Calendar.tsx +182 -0
- package/src/schedule/EventEditor.tsx +267 -0
- package/src/schedule/EventPopover.tsx +190 -0
- package/src/schedule/MeetingPlanner-model.ts +222 -0
- package/src/schedule/MeetingPlanner-view.tsx +310 -0
- package/src/schedule/MeetingPlanner.tsx +122 -0
- package/src/schedule/MoveSheet.tsx +168 -0
- package/src/schedule/YearView-model.ts +164 -0
- package/src/schedule/YearView-parts.tsx +147 -0
- package/src/schedule/YearView.tsx +100 -0
- package/src/schedule/bits.tsx +65 -0
- package/src/schedule/index.ts +25 -0
- package/src/skeleton-css.ts +4 -0
- package/src/styles.ts +13 -0
- package/src/type.css +15 -0
- package/src/ui.ts +41 -0
- package/src/use-ui.ts +10 -0
- package/tailwind.css +38 -0
- package/tokens/color.mjs +87 -0
package/README.md
CHANGED
|
@@ -1,3 +1,1339 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://github.com/Ravonus/kerf">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/Ravonus/kerf/main/site/public/logo.svg" width="88" height="88" alt="Kerf">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
<h1 align="center">@kerf-js/veneer</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<strong>Kerf's UI toolkit: over 240 accessible components, themed from one config.</strong><br>
|
|
11
|
+
Keyboard support, screen-reader names and checked contrast are built into each component, not left for you to add.
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://www.npmjs.com/package/@kerf-js/veneer"><img src="https://img.shields.io/npm/v/@kerf-js/veneer?color=145c3c&label=npm" alt="npm version"></a>
|
|
16
|
+
<a href="https://github.com/Ravonus/kerf/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-145c3c" alt="MIT license"></a>
|
|
17
|
+
<a href="https://github.com/Ravonus/kerf/actions"><img src="https://img.shields.io/github/actions/workflow/status/Ravonus/kerf/quality.yml?branch=main&label=checks" alt="checks"></a>
|
|
18
|
+
<img src="https://img.shields.io/badge/node-%3E%3D24-145c3c" alt="Node 24 or later">
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="#quick-start">Quick start</a> ·
|
|
23
|
+
<a href="https://github.com/Ravonus/kerf/tree/main/docs">Docs</a> ·
|
|
24
|
+
<a href="https://github.com/Ravonus/kerf/tree/main/examples">Examples</a> ·
|
|
25
|
+
<a href="https://github.com/Ravonus/kerf/blob/main/CHANGELOG.md">Changelog</a> ·
|
|
26
|
+
<a href="https://github.com/Ravonus/kerf">GitHub</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
> [!IMPORTANT]
|
|
30
|
+
> **Early release (0.1.x).** APIs can change between minor versions. Pin the version and read the
|
|
31
|
+
> [changelog](https://github.com/Ravonus/kerf/blob/main/CHANGELOG.md) before you upgrade.
|
|
32
|
+
|
|
33
|
+
Veneer is the component library for [Kerf](https://github.com/Ravonus/kerf) apps. It covers layout, type, fields, pickers,
|
|
34
|
+
overlays, tables, charts and whole app flows such as sign-in, settings, chat, calendars and checkout. One `veneer()` call in
|
|
35
|
+
`kerf.config.ts` sets the look of every component, and the build checks the colours you choose against WCAG contrast
|
|
36
|
+
before it ships them.
|
|
37
|
+
|
|
38
|
+
The components and their look live here. Their behaviour (focus, keys, positioning, timers) lives in
|
|
39
|
+
[`@kerf-js/veneer-core`](https://www.npmjs.com/package/@kerf-js/veneer-core) <sup>[source](https://github.com/Ravonus/kerf/tree/main/packages/veneer-core)</sup>, which works without any framework.
|
|
40
|
+
|
|
41
|
+
## Highlights
|
|
42
|
+
|
|
43
|
+
- **Accessible by construction.** Every field requires a `label`, every table a `caption`, and an icon-only button a
|
|
44
|
+
`label`. Leaving one out is a type error. Composite widgets follow the WAI-ARIA Authoring Practices keyboard patterns.
|
|
45
|
+
- **Contrast is a build error.** A seed, colour or token that drops text, a control border or the focus ring below WCAG
|
|
46
|
+
contrast at any theme and expression stop fails the build with D010, which names each failing pair.
|
|
47
|
+
- **One config, every component.** `veneer({ seed, dials, radius, fonts, colors, system, parts, themes })` re-themes the
|
|
48
|
+
whole kit. Named themes switch at run time with `setPalette()`.
|
|
49
|
+
- **Dials instead of variants.** Expression (`quiet`, `balanced`, `vivid`), density, theme, motion and flair are
|
|
50
|
+
`data-*` attributes. They nest, so one region can be compact and dark inside a cozy, light page.
|
|
51
|
+
- **A page pays for what it renders.** Each component imports only its own CSS. `pnpm run size` measures what each one
|
|
52
|
+
costs alone, ten times over, and on a page that already has the rest.
|
|
53
|
+
- **No code at load.** Components run nothing as they load, so an island holding them can wait for the screen or a tap.
|
|
54
|
+
- **Whole flows, not just parts.** Sign-in, MFA, onboarding tours, settings, members, billing, cart and checkout,
|
|
55
|
+
an AI chat, a calendar, a video room and multiplayer cursors ship as ready components.
|
|
56
|
+
- **Tailwind if you want it.** `@kerf-js/veneer/tailwind.css` exposes Veneer's tokens as Tailwind v4 theme values, so
|
|
57
|
+
utilities follow the dials too.
|
|
58
|
+
|
|
59
|
+
## Contents
|
|
60
|
+
|
|
61
|
+
- [Install](#install)
|
|
62
|
+
- [Quick start](#quick-start)
|
|
63
|
+
- [Guide](#guide)
|
|
64
|
+
- [What the plugin does](#what-the-plugin-does)
|
|
65
|
+
- [Layout and intent props](#layout-and-intent-props)
|
|
66
|
+
- [Fields and forms](#fields-and-forms)
|
|
67
|
+
- [Overlays](#overlays)
|
|
68
|
+
- [Toasts](#toasts)
|
|
69
|
+
- [Tables and long lists](#tables-and-long-lists)
|
|
70
|
+
- [Scroll motion](#scroll-motion)
|
|
71
|
+
- [Component catalogue](#component-catalogue)
|
|
72
|
+
- [Theming](#theming)
|
|
73
|
+
- [The Theme studio](#the-theme-studio)
|
|
74
|
+
- [Accessibility](#accessibility)
|
|
75
|
+
- [Tailwind](#tailwind)
|
|
76
|
+
- [Per-page cost](#per-page-cost)
|
|
77
|
+
- [API reference](#api-reference)
|
|
78
|
+
- [Recipes](#recipes)
|
|
79
|
+
- [Troubleshooting](#troubleshooting)
|
|
80
|
+
- [Related packages](#related-packages)
|
|
81
|
+
- [Contributing](#contributing)
|
|
82
|
+
- [License](#license)
|
|
83
|
+
|
|
84
|
+
## Install
|
|
85
|
+
|
|
86
|
+
A new app made with `npm create kerf` gets Veneer by default (`--ui veneer`). The other choices are `headless`
|
|
87
|
+
(`@kerf-js/veneer-core` only), `tailwind` and `none`.
|
|
88
|
+
|
|
89
|
+
To add Veneer to an existing Kerf app, let the CLI install it and add the plugin to your config, whatever format the config
|
|
90
|
+
is in:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npx kerf add veneer
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Or install it yourself:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm install @kerf-js/veneer
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
pnpm add @kerf-js/veneer
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
bun add @kerf-js/veneer
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Then add the plugin:
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
// kerf.config.ts
|
|
114
|
+
import { defineConfig } from '@kerf-js/core/config'
|
|
115
|
+
import { veneer } from '@kerf-js/veneer/plugin'
|
|
116
|
+
|
|
117
|
+
export default defineConfig({ plugins: [veneer()] })
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`@kerf-js/core` is a peer dependency. Veneer depends on
|
|
121
|
+
[`@kerf-js/veneer-core`](https://www.npmjs.com/package/@kerf-js/veneer-core) <sup>[source](https://github.com/Ravonus/kerf/tree/main/packages/veneer-core)</sup> and
|
|
122
|
+
[`@kerf-js/veneer-icons`](https://www.npmjs.com/package/@kerf-js/veneer-icons) <sup>[source](https://github.com/Ravonus/kerf/tree/main/packages/veneer-icons)</sup>, so both arrive with it. Node 24
|
|
123
|
+
or later is required.
|
|
124
|
+
|
|
125
|
+
## Quick start
|
|
126
|
+
|
|
127
|
+
Import what you use. A page pays only for the components it renders.
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
import { state } from '@kerf-js/core'
|
|
131
|
+
import { Badge, Button, Card } from '@kerf-js/veneer'
|
|
132
|
+
|
|
133
|
+
export default function Product() {
|
|
134
|
+
const inCart = state(0)
|
|
135
|
+
return (
|
|
136
|
+
<Card eyebrow="Coffee" title="House blend, 250 g">
|
|
137
|
+
<p>
|
|
138
|
+
In your cart <Badge count>{inCart.value}</Badge>
|
|
139
|
+
</p>
|
|
140
|
+
<Button onClick={() => inCart.value++}>Add to cart</Button>
|
|
141
|
+
</Card>
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
A fuller page, with layout primitives and a field:
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import {
|
|
150
|
+
Button,
|
|
151
|
+
Card,
|
|
152
|
+
Heading,
|
|
153
|
+
Input,
|
|
154
|
+
Row,
|
|
155
|
+
Stack,
|
|
156
|
+
Text,
|
|
157
|
+
} from '@kerf-js/veneer'
|
|
158
|
+
|
|
159
|
+
export function Billing() {
|
|
160
|
+
return (
|
|
161
|
+
<Stack
|
|
162
|
+
as="section"
|
|
163
|
+
gap="section"
|
|
164
|
+
>
|
|
165
|
+
<Heading
|
|
166
|
+
level={1}
|
|
167
|
+
role="title"
|
|
168
|
+
>
|
|
169
|
+
Billing
|
|
170
|
+
</Heading>
|
|
171
|
+
<Card title="Card on file">
|
|
172
|
+
<Stack gap="related">
|
|
173
|
+
<Text subtle>Visa ending 4242</Text>
|
|
174
|
+
<Input
|
|
175
|
+
label="Billing email"
|
|
176
|
+
type="email"
|
|
177
|
+
/>
|
|
178
|
+
<Row
|
|
179
|
+
gap="tight"
|
|
180
|
+
justify="end"
|
|
181
|
+
>
|
|
182
|
+
<Button emphasis="ghost">Cancel</Button>
|
|
183
|
+
<Button>Save</Button>
|
|
184
|
+
</Row>
|
|
185
|
+
</Stack>
|
|
186
|
+
</Card>
|
|
187
|
+
</Stack>
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Guide
|
|
193
|
+
|
|
194
|
+
### What the plugin does
|
|
195
|
+
|
|
196
|
+
`veneer()` is a Kerf plugin (namespace `D`). At build time it:
|
|
197
|
+
|
|
198
|
+
- validates its options and rejects unknown keys with the path of the bad one;
|
|
199
|
+
- writes Veneer's tokens and your overrides as CSS, plus a Tailwind entry when you define `colors`;
|
|
200
|
+
- runs veneer-core's contrast checker over the resolved stylesheet and fails with **D010** on any pair below WCAG;
|
|
201
|
+
- registers a catalogue of components for `kerf plugins` and short instructions for coding agents;
|
|
202
|
+
- gives generated share cards (`site.card`) your page, text and accent colours.
|
|
203
|
+
|
|
204
|
+
It also exports `dialScript`, a tiny inline script for `site.head` that restores dials saved with
|
|
205
|
+
`setDial(…, { persist: true })` before the first paint, so a prerendered page doesn't flash the OS theme:
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
import { defineConfig } from '@kerf-js/core/config'
|
|
209
|
+
import { dialScript, veneer } from '@kerf-js/veneer/plugin'
|
|
210
|
+
|
|
211
|
+
export default defineConfig({
|
|
212
|
+
site: { head: dialScript },
|
|
213
|
+
plugins: [veneer()],
|
|
214
|
+
})
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Layout and intent props
|
|
218
|
+
|
|
219
|
+
Name what a thing is and the look follows the theme, the dials and the density. Raw values are reported by `kerf check`
|
|
220
|
+
as D001–D007.
|
|
221
|
+
|
|
222
|
+
| Thing | Use |
|
|
223
|
+
|---|---|
|
|
224
|
+
| Vertical flow | `Stack gap align divided` |
|
|
225
|
+
| Horizontal cluster | `Row gap justify align wrap reflow` (`reflow` stacks it below a width step) |
|
|
226
|
+
| Columns | `Grid min cols gap` |
|
|
227
|
+
| Side and main | `Split side width at gap` |
|
|
228
|
+
| Measured column | `Center max gutter intrinsic` |
|
|
229
|
+
| Full screen, one centred child | `Cover`, with `data-part="center"` on the child |
|
|
230
|
+
| Media box | `Frame ratio` |
|
|
231
|
+
| Push to the far end | `Spacer` |
|
|
232
|
+
| Sunken region | `Inset pad` |
|
|
233
|
+
| Raised box | `Card` |
|
|
234
|
+
| Heading | `Heading level role`: `level` is the outline and picks the look; `role` overrides it |
|
|
235
|
+
| Text | `Text role tone subtle faint inline` |
|
|
236
|
+
| Link | `Link href subtle external` |
|
|
237
|
+
|
|
238
|
+
`gap` is a relationship, not a size: `none hair tight related group section page`. There are no breakpoint props,
|
|
239
|
+
because boxes answer to their container.
|
|
240
|
+
|
|
241
|
+
Components share three intent props:
|
|
242
|
+
|
|
243
|
+
| Prop | Values | Default |
|
|
244
|
+
|---|---|---|
|
|
245
|
+
| `tone` | `neutral` `accent` `positive` `caution` `critical` `info`, plus any name from `veneer({ colors })` | `accent` on Button |
|
|
246
|
+
| `emphasis` (Button) | `solid` `soft` `outline` `ghost` `frame` `link` | `solid` |
|
|
247
|
+
| `size` | `sm` `md` `lg` | `md` |
|
|
248
|
+
|
|
249
|
+
### Fields and forms
|
|
250
|
+
|
|
251
|
+
Every field is built on the same shell: a floating label in a notch (or above the box with `variant="classic"` or
|
|
252
|
+
`veneer({ fields: 'classic' })`), an optional icon, prefix, suffix, clear button, counter, hint and error.
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
import { Input, NumberField, Select, Textarea } from '@kerf-js/veneer'
|
|
256
|
+
import { state } from '@kerf-js/core'
|
|
257
|
+
|
|
258
|
+
export function Profile() {
|
|
259
|
+
const region = state<string | null>('eu')
|
|
260
|
+
return (
|
|
261
|
+
<form>
|
|
262
|
+
<Input
|
|
263
|
+
label="Display name"
|
|
264
|
+
hint="Shown on your posts"
|
|
265
|
+
counter={40}
|
|
266
|
+
clearable
|
|
267
|
+
/>
|
|
268
|
+
<Input
|
|
269
|
+
label="Website"
|
|
270
|
+
type="url"
|
|
271
|
+
prefix="https://"
|
|
272
|
+
error="That address doesn't resolve"
|
|
273
|
+
/>
|
|
274
|
+
<NumberField
|
|
275
|
+
label="Weight"
|
|
276
|
+
suffix="kg"
|
|
277
|
+
/>
|
|
278
|
+
<Select
|
|
279
|
+
label="Region"
|
|
280
|
+
value={region}
|
|
281
|
+
options={[
|
|
282
|
+
{ value: 'eu', label: 'Europe' },
|
|
283
|
+
{
|
|
284
|
+
value: 'us',
|
|
285
|
+
label: 'United States',
|
|
286
|
+
hint: 'Virginia and Oregon',
|
|
287
|
+
},
|
|
288
|
+
]}
|
|
289
|
+
/>
|
|
290
|
+
<Textarea
|
|
291
|
+
label="Bio"
|
|
292
|
+
rows={3}
|
|
293
|
+
/>
|
|
294
|
+
</form>
|
|
295
|
+
)
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
| Field prop | Type | Default | What it does |
|
|
300
|
+
|---|---|---|---|
|
|
301
|
+
| `label` | `string` | required | The accessible name, drawn as the floating label |
|
|
302
|
+
| `hint` | node | | Help under the field |
|
|
303
|
+
| `error` | node | | Shown instead of the hint; marks the field invalid |
|
|
304
|
+
| `icon` | icon name or component | | Leading icon; it sweeps with the border |
|
|
305
|
+
| `prefix`, `suffix` | node | | Inside the field, before or after the value (`$`, `kg`) |
|
|
306
|
+
| `variant` | `floating` · `classic` | the app's `fields` | Where the label sits |
|
|
307
|
+
| `appearance` | `line` | boxed | Only a bottom line under the value |
|
|
308
|
+
| `size` | `sm` · `md` · `lg` | `md` | |
|
|
309
|
+
| `clearable` | `boolean` | `false` | A clear button once there is a value |
|
|
310
|
+
| `counter` | `number` | | Maximum length, shown as `n/max` |
|
|
311
|
+
| `readonly` | `boolean` | `false` | Selectable and copyable, not editable |
|
|
312
|
+
|
|
313
|
+
Any other attribute (`type`, `autocomplete`, `inputmode`, `required`) passes through to the native control. Veneer draws
|
|
314
|
+
the browser's constraint message in the field itself, never as the browser bubble, and moves focus to the first invalid
|
|
315
|
+
control. `Textarea` grows from `rows` to 10 lines, and Cmd or Ctrl+Enter submits its form.
|
|
316
|
+
|
|
317
|
+
Rich fields (`DateField`, `TimeField`, `Select`, `PhoneField` and the rest) share `Bindable<T>`: pass `value` as a
|
|
318
|
+
plain value or a `State`, or use `defaultValue`. `onValueChange(value, reason)` tells you whether a pointer, a key or
|
|
319
|
+
code made the change.
|
|
320
|
+
|
|
321
|
+
### Overlays
|
|
322
|
+
|
|
323
|
+
`Modal` and `Drawer` sit on the native `<dialog>`. Focus moves to `[autofocus]` or the title, returns to the opener on
|
|
324
|
+
every close path, and CSS locks the page's scroll. `open` is a box: the dialog writes `false` when the user closes it.
|
|
325
|
+
Any element with `data-close` closes them. A backdrop press closes them too, except an `alert` dialog, where you give
|
|
326
|
+
Cancel `autofocus`. Layers stack, so Escape closes only the top one.
|
|
327
|
+
|
|
328
|
+
```tsx
|
|
329
|
+
import { state } from '@kerf-js/core'
|
|
330
|
+
import { Button, Modal } from '@kerf-js/veneer'
|
|
331
|
+
|
|
332
|
+
export function DeleteProject(props: {
|
|
333
|
+
onDelete: () => Promise<void>
|
|
334
|
+
}) {
|
|
335
|
+
const open = state(false)
|
|
336
|
+
const remove = async () => {
|
|
337
|
+
await props.onDelete()
|
|
338
|
+
open.value = false
|
|
339
|
+
}
|
|
340
|
+
return (
|
|
341
|
+
<>
|
|
342
|
+
<Button
|
|
343
|
+
tone="critical"
|
|
344
|
+
emphasis="outline"
|
|
345
|
+
onClick={() => (open.value = true)}
|
|
346
|
+
>
|
|
347
|
+
Delete project
|
|
348
|
+
</Button>
|
|
349
|
+
<Modal
|
|
350
|
+
open={open}
|
|
351
|
+
alert
|
|
352
|
+
title="Delete this project?"
|
|
353
|
+
description="Its pages and history go with it."
|
|
354
|
+
footer={
|
|
355
|
+
<>
|
|
356
|
+
<Button
|
|
357
|
+
emphasis="ghost"
|
|
358
|
+
data-close=""
|
|
359
|
+
autofocus
|
|
360
|
+
>
|
|
361
|
+
Cancel
|
|
362
|
+
</Button>
|
|
363
|
+
<Button
|
|
364
|
+
tone="critical"
|
|
365
|
+
onClick={() => remove()}
|
|
366
|
+
>
|
|
367
|
+
Delete
|
|
368
|
+
</Button>
|
|
369
|
+
</>
|
|
370
|
+
}
|
|
371
|
+
/>
|
|
372
|
+
</>
|
|
373
|
+
)
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
| Component | Key props | Notes |
|
|
378
|
+
|---|---|---|
|
|
379
|
+
| `Modal` | `open: State<boolean>`, `title`, `description`, `footer`, `size` (`sm` `md` `lg`), `placement` (`center` `top` `bottom` `left` `right` `full`), `alert`, `tone`, `inline` | `alert` makes it an AlertDialog |
|
|
380
|
+
| `Drawer` | `open`, `title`, `description`, `footer`, `side` (`auto` `right` `left` `bottom` `top`), `inline` | `auto` is a side sheet on wide screens and a bottom sheet on phones |
|
|
381
|
+
| `Popover` | `label`, `title`, `description`, `side`, `align`, `trigger` (Button props), `inline` | A non-modal dialog. Focus moves in and returns to the trigger |
|
|
382
|
+
| `Tooltip` | `content`, `kbd`, `side`, `align`, `inline`; `children` is the one focusable trigger | Shows on hover after 500 ms and on keyboard focus. Never holds essential content |
|
|
383
|
+
| `Menu` | `label`, `items`, `trigger`, `side`, `align` | Items are `{ label, onSelect, href, icon, shortcut, tone, disabled }`, `{ separator: true }` or `{ group }` |
|
|
384
|
+
| `CommandPalette` | see its props type | An APG combobox in a modal dialog, opened with Cmd or Ctrl+K |
|
|
385
|
+
|
|
386
|
+
`inline` draws an overlay open in the page's flow, with no top layer, scrim or focus trap. It is meant for docs and
|
|
387
|
+
previews.
|
|
388
|
+
|
|
389
|
+
```tsx
|
|
390
|
+
import { Button, Menu, Popover, Tooltip } from '@kerf-js/veneer'
|
|
391
|
+
|
|
392
|
+
export function Toolbar(props: { signOut: () => void }) {
|
|
393
|
+
return (
|
|
394
|
+
<>
|
|
395
|
+
<Tooltip
|
|
396
|
+
content="Copy link"
|
|
397
|
+
kbd="⌘C"
|
|
398
|
+
>
|
|
399
|
+
<Button
|
|
400
|
+
icon="copy"
|
|
401
|
+
label="Copy link"
|
|
402
|
+
emphasis="ghost"
|
|
403
|
+
/>
|
|
404
|
+
</Tooltip>
|
|
405
|
+
<Popover
|
|
406
|
+
label="Filters"
|
|
407
|
+
title="Filter results"
|
|
408
|
+
>
|
|
409
|
+
<p>Filter controls go here.</p>
|
|
410
|
+
</Popover>
|
|
411
|
+
<Menu
|
|
412
|
+
label="Account"
|
|
413
|
+
items={[
|
|
414
|
+
{ label: 'Profile', href: '/profile' },
|
|
415
|
+
{ separator: true },
|
|
416
|
+
{
|
|
417
|
+
label: 'Sign out',
|
|
418
|
+
tone: 'critical',
|
|
419
|
+
onSelect: props.signOut,
|
|
420
|
+
},
|
|
421
|
+
]}
|
|
422
|
+
/>
|
|
423
|
+
</>
|
|
424
|
+
)
|
|
425
|
+
}
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### Toasts
|
|
429
|
+
|
|
430
|
+
Mount one `<Toaster />` near the root, then call `toast` from anywhere:
|
|
431
|
+
|
|
432
|
+
```tsx
|
|
433
|
+
// src/routes/_layout.tsx
|
|
434
|
+
import { Toaster } from '@kerf-js/veneer'
|
|
435
|
+
|
|
436
|
+
export default function Layout(props: { children?: unknown }) {
|
|
437
|
+
return (
|
|
438
|
+
<>
|
|
439
|
+
{props.children}
|
|
440
|
+
<Toaster position="bottom-right" />
|
|
441
|
+
</>
|
|
442
|
+
)
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
import { toast } from '@kerf-js/veneer'
|
|
448
|
+
|
|
449
|
+
toast.show({
|
|
450
|
+
title: 'Invite sent',
|
|
451
|
+
description: 'mei@example.com',
|
|
452
|
+
tone: 'positive',
|
|
453
|
+
})
|
|
454
|
+
|
|
455
|
+
toast.show({
|
|
456
|
+
title: 'Message archived',
|
|
457
|
+
action: { label: 'Undo', onClick: () => restore() },
|
|
458
|
+
})
|
|
459
|
+
|
|
460
|
+
// One toast through a promise's life, updated in place. Returns the
|
|
461
|
+
// promise.
|
|
462
|
+
await toast.promise(save(), {
|
|
463
|
+
pending: 'Saving…',
|
|
464
|
+
done: 'Saved',
|
|
465
|
+
error: () => ({ title: "Couldn't save", tone: 'critical' }),
|
|
466
|
+
})
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
How they behave:
|
|
470
|
+
|
|
471
|
+
- **Life.** 5 s plus 60 ms a word, 10 s with an action. A critical toast with an action stays until it is dismissed.
|
|
472
|
+
- **Stacking.** Newest first. Three stack collapsed and fan out on hover or focus, which pauses every timer. Timers also
|
|
473
|
+
pause while the page is hidden.
|
|
474
|
+
- **Dismissal.** Swipe, or the Dismiss button. F8 focuses the newest toast.
|
|
475
|
+
- **Announcements.** The Toaster pre-mounts a polite and an assertive live region. While a modal is open the regions
|
|
476
|
+
move into it, because the modal would otherwise make them inert.
|
|
477
|
+
- **One list.** Every `Toaster` shares one list. If a page mounts two, only the newest shows it.
|
|
478
|
+
|
|
479
|
+
`position` is `top-left`, `top-center`, `top-right`, `bottom-left`, `bottom-center` or `bottom-right` (the default).
|
|
480
|
+
|
|
481
|
+
### Tables and long lists
|
|
482
|
+
|
|
483
|
+
```tsx
|
|
484
|
+
import { Table, type Column } from '@kerf-js/veneer'
|
|
485
|
+
|
|
486
|
+
type Order = {
|
|
487
|
+
id: string
|
|
488
|
+
customer: string
|
|
489
|
+
total: number
|
|
490
|
+
status: string
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const columns: Column<Order>[] = [
|
|
494
|
+
{ id: 'customer', header: 'Customer', rowHeader: true, sort: true },
|
|
495
|
+
{ id: 'total', header: 'Total', numeric: true, sort: true },
|
|
496
|
+
{ id: 'status', header: 'Status', priority: 2 },
|
|
497
|
+
]
|
|
498
|
+
|
|
499
|
+
export function Orders(props: { rows: Order[] }) {
|
|
500
|
+
return (
|
|
501
|
+
<Table
|
|
502
|
+
caption="Recent orders"
|
|
503
|
+
columns={columns}
|
|
504
|
+
rows={props.rows}
|
|
505
|
+
filter="Filter orders"
|
|
506
|
+
selection
|
|
507
|
+
/>
|
|
508
|
+
)
|
|
509
|
+
}
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
`Table` is a semantic `<table>` with sort, filter, column picking, resizing, selection with Shift-click ranges, a bulk
|
|
513
|
+
bar and phone cards (`phone="cards"`). `rows` can be an array, a `State`, a `Derived` or a `Resource`, and `server`
|
|
514
|
+
hands sorting, filtering and paging to your data source. `DataGrid` is the same parts as an ARIA grid, or a treegrid when
|
|
515
|
+
grouped, with one tab stop and arrow keys between cells. `PivotTable`, `VirtualList`, `Feed` and `ScrollGrid` cover
|
|
516
|
+
pivots, long lists, activity feeds and two-axis windows.
|
|
517
|
+
|
|
518
|
+
### Scroll motion
|
|
519
|
+
|
|
520
|
+
Veneer's components run no code as they load. Scroll motion (`data-flow`) belongs to the page, so the app arms it once, in
|
|
521
|
+
`src/entry.client.ts`:
|
|
522
|
+
|
|
523
|
+
```ts
|
|
524
|
+
import { start } from '@kerf-js/start/client'
|
|
525
|
+
import { flow } from '@kerf-js/veneer-core'
|
|
526
|
+
import * as routes from 'virtual:kerf/routes'
|
|
527
|
+
|
|
528
|
+
flow()
|
|
529
|
+
start(routes)
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
Without it the page stays still, with every word in place. Until the first scroll the page holds still and whole, so
|
|
533
|
+
the first screen, a crawler and an audit all read every word at full contrast.
|
|
534
|
+
|
|
535
|
+
The page itself scrolls smoothly by default: in-page anchors and skip links glide, unless the visitor asked for reduced
|
|
536
|
+
motion (or the app set `data-motion="reduce"`). A route change still jumps to the top, or to its hash target, at once.
|
|
537
|
+
Anchors land below the sticky top bar; a page with a taller header, or none, sets `--veneer-scroll-offset`:
|
|
538
|
+
|
|
539
|
+
```css
|
|
540
|
+
:root { --veneer-scroll-offset: 96px; }
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### Scenes behind the page
|
|
544
|
+
|
|
545
|
+
`@kerf-js/veneer/scenes` pins one canvas behind the whole page and draws a scene per section on it. Each `<Scene>`
|
|
546
|
+
is a section; its scene comes from a renderer's bridge (`defineScene` in `@kerf-js/keel/scene`).
|
|
547
|
+
|
|
548
|
+
```tsx
|
|
549
|
+
import { Scene, Stage } from '@kerf-js/veneer/scenes'
|
|
550
|
+
import { orchard, harbour } from './scenes'
|
|
551
|
+
|
|
552
|
+
<Stage label="An orchard, then a harbour">
|
|
553
|
+
<Scene use={orchard} poster="#2f4a3a">
|
|
554
|
+
<h2>Orchard</h2>
|
|
555
|
+
</Scene>
|
|
556
|
+
<Scene use={harbour} poster="/harbour.avif">
|
|
557
|
+
<h2>Harbour</h2>
|
|
558
|
+
</Scene>
|
|
559
|
+
</Stage>
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
Each scene's position is in viewports since its section began to enter. Its section carries it as
|
|
563
|
+
`--scene-position`, so the section's own styles can move with the scene without a second `progress()`. The
|
|
564
|
+
stage keeps the active scene and its neighbours built and frees one two away. As a section arrives its scene blends in over `hero` viewports; the
|
|
565
|
+
active scene moves at the half-way point. Without a `blend` the stage cuts there. A `governor` sets the levers,
|
|
566
|
+
the pixel ratio and the frame rate. A scene's `poster` is pinned behind its section: the first paint, and what
|
|
567
|
+
shows without WebGL2.
|
|
568
|
+
|
|
569
|
+
A `blend` (`keelBlend()` from `@kerf-js/keel/blend`) draws every frame: each `<Scene>` says how it arrives
|
|
570
|
+
(`mode="radial"`, a `centre`, `lines={false}`), and the less visible scene is drawn at the levers' `blendScale`.
|
|
571
|
+
It also lays the active section's pass over the frame: a paper panel's `progress`, `position`, `tear` and
|
|
572
|
+
`colour`, and the `darken` and `blur` under it. Give them as `<Scene post={{ tear: 1 }}>`, as a function of the
|
|
573
|
+
position, or from the scene's own tracks. Under reduced motion the scroll moves no hand-over: the active scene
|
|
574
|
+
changes at the half-way point with a 300 ms dissolve. A scene with a `hold` (`<Scene hold={1.2}>`, or its scene's
|
|
575
|
+
own) stands at that position under reduced motion and where the governor holds scenes still (a low tier),
|
|
576
|
+
whatever the scroll.
|
|
577
|
+
|
|
578
|
+
A poster can be baked: `poster="bake"` shows the still `bakedPosters` holds under the scene's `id`, a wide one
|
|
579
|
+
and a tall one as media records. `@kerf-js/capture` renders them from the scenes themselves at build time, each
|
|
580
|
+
through the blend and at its `hold` where it has one, and writes the module that registers them. `tier` picks what draws: `live` (the default) draws the scenes, `poster`
|
|
581
|
+
shows only posters and never loads a renderer, and `auto` shows posters on a phone or tablet and where the
|
|
582
|
+
governor rates the device `low`, decided before anything 3D loads.
|
|
583
|
+
|
|
584
|
+
Once every section's position has caught up with the scroll and the scenes it wants have drawn, the stage writes
|
|
585
|
+
the scroll offset on its root as `data-stage-ready` and calls `onReady`: the frame a test or a capture may take.
|
|
586
|
+
A driver outside the page reaches the stage through `root[STAGE]` (`Symbol.for('kerf.stage')`), a `StageHandle`:
|
|
587
|
+
its scenes, `freeze(seconds)` to stop the shared clock and TAA, so that a frame owes nothing to the ones before it,
|
|
588
|
+
and `still(index, position)`, which draws one scene alone through the blend and resolves with a PNG of the canvas;
|
|
589
|
+
without a position the scene stands at its `hold`. `@kerf-js/capture` drives both.
|
|
590
|
+
|
|
591
|
+
## Component catalogue
|
|
592
|
+
|
|
593
|
+
Every component exported from `@kerf-js/veneer`, grouped by what it is for. The docs site has a page for each one with its
|
|
594
|
+
props, live examples and keyboard table. `kerf plugins` lists the core catalogue in your terminal.
|
|
595
|
+
|
|
596
|
+
<details open>
|
|
597
|
+
<summary><strong>Layout and type</strong></summary>
|
|
598
|
+
|
|
599
|
+
| Component | Purpose |
|
|
600
|
+
|---|---|
|
|
601
|
+
| `Stack` | Vertical flow; the gap is the relationship between the children |
|
|
602
|
+
| `Row` | A horizontal cluster that wraps; `reflow` makes it a Stack below a step |
|
|
603
|
+
| `Grid` | Intrinsic columns: as many as fit at `min`, never more than `cols` |
|
|
604
|
+
| `Split` | A fixed side and a fluid main, stacked below its step |
|
|
605
|
+
| `Center` | A measured, centred column, with page gutters when `gutter` is set |
|
|
606
|
+
| `Cover` | Fills the screen and centres one child (auth and error pages) |
|
|
607
|
+
| `Frame` | A fixed-ratio media box |
|
|
608
|
+
| `Spacer` | Takes the free space in a Row or Stack |
|
|
609
|
+
| `Inset` | A sunken, padded region |
|
|
610
|
+
| `Card` | A raised surface; with `href` or `onClick` it is a real link or button |
|
|
611
|
+
| `Heading` | A real heading; `level` is the outline, `role` the look |
|
|
612
|
+
| `Text` | Text in a role, with `tone`, `subtle` and `faint` |
|
|
613
|
+
| `Link` | An underlined link with the underline sweep; `external` says it opens a new tab |
|
|
614
|
+
| `Kbd` | One key, such as `<Kbd>⌘</Kbd><Kbd>K</Kbd>` |
|
|
615
|
+
| `Code` | Inline code in running text |
|
|
616
|
+
| `Icon` | Any Veneer icon by name (re-exported from `@kerf-js/veneer-icons/icon`) |
|
|
617
|
+
|
|
618
|
+
</details>
|
|
619
|
+
|
|
620
|
+
<details open>
|
|
621
|
+
<summary><strong>Actions and choices</strong></summary>
|
|
622
|
+
|
|
623
|
+
| Component | Purpose |
|
|
624
|
+
|---|---|
|
|
625
|
+
| `Button` | A native button in six emphases, with `loading`, `icon` and `collapse` to icon-only on small screens |
|
|
626
|
+
| `Toggle` | A toggle button with `aria-pressed` |
|
|
627
|
+
| `Chip` | A filter chip: a toggle that draws its check when pressed |
|
|
628
|
+
| `Checkbox` | A native checkbox; `indeterminate` is the real property |
|
|
629
|
+
| `Radio` | One native radio |
|
|
630
|
+
| `RadioGroup` | A set of native radios, so arrows, form values and the group name are the platform's |
|
|
631
|
+
| `Switch` | A native checkbox with `role="switch"` that applies at once |
|
|
632
|
+
| `Segmented` | Native radios drawn as a segmented control |
|
|
633
|
+
| `Slider` | One or more `role="slider"` thumbs with APG keys and a press anywhere on the track |
|
|
634
|
+
| `Menu` | A menu button: roving focus, typeahead, Escape back to the trigger |
|
|
635
|
+
| `CommandPalette` | A Cmd/Ctrl+K command palette: an APG combobox in a modal dialog |
|
|
636
|
+
|
|
637
|
+
</details>
|
|
638
|
+
|
|
639
|
+
<details open>
|
|
640
|
+
<summary><strong>Text and rich fields</strong></summary>
|
|
641
|
+
|
|
642
|
+
| Component | Purpose |
|
|
643
|
+
|---|---|
|
|
644
|
+
| `Field` | The field shell the other fields are built on, for a control of your own |
|
|
645
|
+
| `Input` | A text field; every native input attribute passes through |
|
|
646
|
+
| `Search` | A search field with its icon and a clear button |
|
|
647
|
+
| `Textarea` | Grows from `rows` to 10 lines; Cmd/Ctrl+Enter submits |
|
|
648
|
+
| `NumberField` | A number as real text with `inputmode`, avoiding `type="number"`'s wheel and locale bugs |
|
|
649
|
+
| `Select` | A select Veneer draws everywhere: a popover on desktop, a sheet on phones, a search once the list is long |
|
|
650
|
+
| `CompactSelect` | The same list with no floating label, for table rows, pagers and toolbars |
|
|
651
|
+
| `CodeInput` | A code field coloured with the CSS Custom Highlight API, so a key press builds no spans |
|
|
652
|
+
| `JsonEditor` | CodeInput for JSON: parse and schema errors name their line; Format rewrites it |
|
|
653
|
+
| `KeyValueEditor` | Key, value and remove rows, with an optional Form/JSON switch |
|
|
654
|
+
| `MentionsInput` | A plain textarea with trigger characters; the list opens at the caret |
|
|
655
|
+
| `RichTextEditor` | A rich text field with an APG toolbar and Markdown shortcuts |
|
|
656
|
+
| `MarkdownEditor` | Source and preview side by side, tabs when narrow; Cmd+B, I and K wrap the selection |
|
|
657
|
+
| `SignaturePad` | A signature canvas with Undo and Clear; typing the name is the required alternative |
|
|
658
|
+
| `PaymentCardInput` | The field shell around a payment provider's hosted card field; Veneer never renders card inputs itself |
|
|
659
|
+
| `CardNumberText` | A saved card as `•••• 4242`, with its brand and MM/YY expiry |
|
|
660
|
+
| `PlaceLookupInput` | A place search; your app supplies `search()`, Veneer ships no geocoder |
|
|
661
|
+
| `AddressField` | An address whose fields follow the country, with optional autocomplete from a `provider` |
|
|
662
|
+
| `PhoneField` | A country button and a native tel input that formats as you type |
|
|
663
|
+
| `CountrySelect` | Countries named by `Intl.DisplayNames` in the UI locale, with `preferred` pinned |
|
|
664
|
+
| `LanguageSelect` | Languages, each shown with its own name in its own script |
|
|
665
|
+
| `CurrencySelect` | Currencies as "Euro · EUR · €" |
|
|
666
|
+
| `TimeZoneSelect` | Every IANA zone with its offset at a reference date; Local pinned first |
|
|
667
|
+
|
|
668
|
+
</details>
|
|
669
|
+
|
|
670
|
+
<details open>
|
|
671
|
+
<summary><strong>Date and time</strong></summary>
|
|
672
|
+
|
|
673
|
+
| Component | Purpose |
|
|
674
|
+
|---|---|
|
|
675
|
+
| `DateField` | Date segments with a calendar popover (a sheet on phones); fires only with a complete date |
|
|
676
|
+
| `DateRangeField` | Two segment groups, a two-month popover and a preset rail |
|
|
677
|
+
| `TimeField` | Time segments in the locale's order, with a slot list (wheels on phones) |
|
|
678
|
+
| `DateTimeField` | A date and a time in one control and one popover |
|
|
679
|
+
| `DurationField` | A spinbutton per unit with carry; the value is an ISO duration |
|
|
680
|
+
| `MonthPicker` | A 3×4 grid of month names with year arrows |
|
|
681
|
+
| `WeekPicker` | The month grid with week numbers; a pick covers the whole row |
|
|
682
|
+
| `PeriodPicker` | One grid whose granularity switches: year, quarter, month or week |
|
|
683
|
+
| `RecurrenceField` | An RRULE editor led by its plain-language summary; rules it can't edit stay untouched |
|
|
684
|
+
| `InlineCalendar` | A standalone calendar grid of 1–3 months in `single`, `multiple` or `range` mode |
|
|
685
|
+
|
|
686
|
+
</details>
|
|
687
|
+
|
|
688
|
+
<details open>
|
|
689
|
+
<summary><strong>Feedback and status</strong></summary>
|
|
690
|
+
|
|
691
|
+
| Component | Purpose |
|
|
692
|
+
|---|---|
|
|
693
|
+
| `Alert` | An inline alert; status is carried by icon and words, never colour alone |
|
|
694
|
+
| `Badge` | A status or count badge; a count says its unit to screen readers |
|
|
695
|
+
| `Tag` | User content as a tag; `onRemove` adds a named remove button |
|
|
696
|
+
| `Progress` | Linear or circular progress; indeterminate without a `value` |
|
|
697
|
+
| `Spinner` | A spinner; `label` makes it a named status, otherwise it is decorative |
|
|
698
|
+
| `Skeleton` | A loading placeholder; still under reduced motion |
|
|
699
|
+
| `Shape` | A skeleton shaped like the content a `<Boundary>` is waiting for |
|
|
700
|
+
| `Presence` | Shows and hides content with an entrance and an exit that plays out before it leaves |
|
|
701
|
+
| `Ticker` | A number that rolls digit by digit, writing one attribute per changed digit |
|
|
702
|
+
| `Toaster` | The toast region and its live regions; pair with `toast` |
|
|
703
|
+
|
|
704
|
+
</details>
|
|
705
|
+
|
|
706
|
+
<details open>
|
|
707
|
+
<summary><strong>Overlays</strong></summary>
|
|
708
|
+
|
|
709
|
+
| Component | Purpose |
|
|
710
|
+
|---|---|
|
|
711
|
+
| `Modal` | A modal dialog on native `<dialog>`; `alert` makes it an AlertDialog |
|
|
712
|
+
| `Drawer` | A sheet: at the side on wide screens, from the bottom on phones |
|
|
713
|
+
| `Popover` | A button that opens a non-modal dialog panel |
|
|
714
|
+
| `Tooltip` | A hint on hover and keyboard focus, never essential |
|
|
715
|
+
|
|
716
|
+
</details>
|
|
717
|
+
|
|
718
|
+
<details open>
|
|
719
|
+
<summary><strong>Navigation and app shell</strong></summary>
|
|
720
|
+
|
|
721
|
+
| Component | Purpose |
|
|
722
|
+
|---|---|
|
|
723
|
+
| `Shell` | The app shell: top bar and bottom tabs on a phone, a rail on a tablet, a collapsible sidebar on desktop, by its own width |
|
|
724
|
+
| `SideNav` | A docs sidebar whose sections fold and remember; docked from 900px, over the page on phones |
|
|
725
|
+
| `SideNavTitle` | The header brand, swapped for the SideNav's title while its panel is open on a phone |
|
|
726
|
+
| `Nav` | Links with a sliding bar that follows the route and the pointer |
|
|
727
|
+
| `Tabs` | `line`, `pill` or `enclosed` tabs with APG automatic activation |
|
|
728
|
+
| `Accordion` | Headers that are real buttons in headings, with arrow, Home and End keys |
|
|
729
|
+
| `HamburgerMenu` | A small-screen site menu: the bars become an X and open a full-screen menu |
|
|
730
|
+
| `PaginationBar` | Rows per page, range, page buttons and Go to; collapses when narrow |
|
|
731
|
+
| `LoadMore` | An infinite-scroll sentinel with a button that is always there as the fallback |
|
|
732
|
+
| `ScrollRail` | The page scrollbar, veneer's on every device (touch included) in place of the native one, drawn below a sticky header instead of over it; `below=".header"` follows that header's bottom edge as the page scrolls |
|
|
733
|
+
| `ScrollView` | A scroll area with Veneer's bars, in the DOM or on a canvas, by [`@kerf-js/scroll`](https://www.npmjs.com/package/@kerf-js/scroll): the browser scrolls, the thumb keeps up on the compositor |
|
|
734
|
+
|
|
735
|
+
</details>
|
|
736
|
+
|
|
737
|
+
<details open>
|
|
738
|
+
<summary><strong>Data</strong></summary>
|
|
739
|
+
|
|
740
|
+
| Component | Purpose |
|
|
741
|
+
|---|---|
|
|
742
|
+
| `Table` | A semantic data table: sort, filter, columns, resize, selection, bulk bar, phone cards |
|
|
743
|
+
| `DataGrid` | A Table as an ARIA grid or treegrid: one tab stop, arrow keys between cells, grouping and trees |
|
|
744
|
+
| `PivotTable` | Rows by columns by a measure, with heat cells and totals both ways |
|
|
745
|
+
| `VirtualList` | A long list with only nearby rows in the DOM; exact heights for text rows |
|
|
746
|
+
| `Feed` | A long activity feed on the APG feed pattern; Page Up and Down move between articles |
|
|
747
|
+
| `ScrollGrid` | A two-axis window: rows and columns virtualised on one scroller |
|
|
748
|
+
| `Markdown` | A small, safe Markdown renderer; raw HTML is escaped |
|
|
749
|
+
| `CodeBlock` | Code coloured on the server; hydrates to nothing |
|
|
750
|
+
| `Snippet` | One command to copy, with its `$` |
|
|
751
|
+
|
|
752
|
+
</details>
|
|
753
|
+
|
|
754
|
+
<details open>
|
|
755
|
+
<summary><strong>Charts</strong></summary>
|
|
756
|
+
|
|
757
|
+
Every chart shares one frame: head, legend, plot with tooltip, a data table and a summary. The plot is laid out on the
|
|
758
|
+
server, so the page arrives with a whole chart.
|
|
759
|
+
|
|
760
|
+
| Component | Purpose |
|
|
761
|
+
|---|---|
|
|
762
|
+
| `Chart` | The shared frame, for a chart of your own |
|
|
763
|
+
| `LineChart` | Lines over a shared x axis |
|
|
764
|
+
| `BarChart` | Bars, grouped or stacked |
|
|
765
|
+
| `ComboChart` | Bars and lines on one plot |
|
|
766
|
+
| `DonutChart` | A ring of parts of a whole |
|
|
767
|
+
| `RadialChart` | Concentric arcs, one per value |
|
|
768
|
+
| `FunnelChart` | Stages narrowing from first to last |
|
|
769
|
+
| `ScatterChart` | Dots at x and y |
|
|
770
|
+
| `BubbleChart` | Dots at x and y, sized by a third value |
|
|
771
|
+
| `Histogram` | Values binned into equal ranges |
|
|
772
|
+
| `HeatGrid` | A grid of cells coloured by value |
|
|
773
|
+
| `RadarChart` | Series on axes spread around a circle |
|
|
774
|
+
| `Treemap` | Nested rectangles sized by value |
|
|
775
|
+
| `Sunburst` | Nested rings sized by value |
|
|
776
|
+
| `SankeyChart` | Flows between stages; band width shows the amount |
|
|
777
|
+
| `CandlestickChart` | Open, high, low and close per period |
|
|
778
|
+
| `BoxPlot` | Quartiles and whiskers per group |
|
|
779
|
+
| `WaterfallChart` | A running total, each step a rise or a fall |
|
|
780
|
+
| `StreamChart` | A rolling live window; pausing holds it and shows it as a table |
|
|
781
|
+
| `BrushChart` | A long series with a window dragged over it |
|
|
782
|
+
| `TileMap` | Regions drawn as equal tiles |
|
|
783
|
+
| `GaugeChart` | One value on an arc between its bounds |
|
|
784
|
+
| `Sparkline` | A tiny trend line with no axes, for inside a labelled parent |
|
|
785
|
+
|
|
786
|
+
</details>
|
|
787
|
+
|
|
788
|
+
<details>
|
|
789
|
+
<summary><strong>Canvas and dither</strong></summary>
|
|
790
|
+
|
|
791
|
+
| Component | Purpose |
|
|
792
|
+
|---|---|
|
|
793
|
+
| `Canvas` | A canvas that handles pixel ratio, resize, off-screen and reduced motion |
|
|
794
|
+
| `CanvasStage` | A canvas that paints the page laid out inside it; elements keep their focus, typing and semantics |
|
|
795
|
+
| `StageSelect` | A select-only combobox drawn by a stage |
|
|
796
|
+
| `Dither` | A still image or gradient dithered to Veneer's inks |
|
|
797
|
+
| `DitherField` | A live dithered field: moves at vivid and balanced, still at quiet and under reduced motion |
|
|
798
|
+
| `DitherGlyph` | A word or logo woven out of a dithered field |
|
|
799
|
+
| `DitherStage` | A CanvasStage in the dither look |
|
|
800
|
+
|
|
801
|
+
`LEVEL` and `PAINTERS` are the dither tone levels and the built-in skins.
|
|
802
|
+
|
|
803
|
+
</details>
|
|
804
|
+
|
|
805
|
+
<details>
|
|
806
|
+
<summary><strong>AI chat (agent pack)</strong></summary>
|
|
807
|
+
|
|
808
|
+
| Component | Purpose |
|
|
809
|
+
|---|---|
|
|
810
|
+
| `Conversation` | The chat log: keyed turns, an optional app bar and the Prompt below |
|
|
811
|
+
| `UserMessage` | The user's turn, with edit and copy |
|
|
812
|
+
| `Assistant` | The assistant's turn, rendered from the folded answer; `aria-busy` until done |
|
|
813
|
+
| `Reasoning` | A native `<details>` that says "Thinking…" while streaming, then folds and keeps the duration |
|
|
814
|
+
| `ToolCall` | A tool call card: running, done, failed, or awaiting approval with editable arguments |
|
|
815
|
+
| `Cite` | A citation link with a preview on hover and focus |
|
|
816
|
+
| `Sources` | Numbered source cards matching the cites |
|
|
817
|
+
| `Prose` | Safe answer text: paragraphs, lists, code fences, inline code and cites |
|
|
818
|
+
| `AgentPlan` | The task list and the queue of messages sent during a run |
|
|
819
|
+
| `Prompt` | The composer: grows to 8 lines, Enter sends, Escape stops |
|
|
820
|
+
| `ModelPicker` | A model chip opening a listbox grouped by provider, with capabilities and cost |
|
|
821
|
+
| `MessageActions` | Copy, good and bad answer, regenerate and branch |
|
|
822
|
+
| `BranchSwitcher` | `‹ 2/2 ›` for a turn with more than one version |
|
|
823
|
+
| `Suggestions` | Starter prompts on an empty chat, chips after a turn |
|
|
824
|
+
| `Question` | The run pauses and asks: radios or checkboxes and optional free text |
|
|
825
|
+
| `Checkpoint` | A labelled hairline with Restore |
|
|
826
|
+
| `Shimmer` | Placeholder text with a light passing over it |
|
|
827
|
+
| `ContextMeter` | A ring showing context use, caution at 80% and critical at 95% |
|
|
828
|
+
| `TraceViewer` | Nested spans on a shared time axis, as an APG treegrid |
|
|
829
|
+
| `ArtifactPanel` | Preview, Code and Versions tabs for a generated artifact |
|
|
830
|
+
| `SpeechInput` | Mic picker, input level and Record/Stop on one button |
|
|
831
|
+
|
|
832
|
+
`foldAnswer` (from veneer-core) folds a stream of agent events into the answer `Assistant` renders.
|
|
833
|
+
|
|
834
|
+
</details>
|
|
835
|
+
|
|
836
|
+
<details>
|
|
837
|
+
<summary><strong>Scheduling (schedule pack)</strong></summary>
|
|
838
|
+
|
|
839
|
+
| Component | Purpose |
|
|
840
|
+
|---|---|
|
|
841
|
+
| `Calendar` | Month, Week, Day, Agenda, Timeline and Year views; drag to move, resize and create on a 15-minute snap |
|
|
842
|
+
| `EventPopover` | The event card, a non-modal dialog on the event |
|
|
843
|
+
| `EventEditor` | The event editor sheet: the fields path for every drag |
|
|
844
|
+
| `MoveSheet` | A bottom sheet with day, start and duration: the touch path for a drag |
|
|
845
|
+
| `Agenda` | The phone agenda: a week strip, swipeable day pages and free-time gaps |
|
|
846
|
+
| `AgendaDay` | One day's list of rows |
|
|
847
|
+
| `YearView` | Twelve mini months with density dots and one roving stop |
|
|
848
|
+
| `BookingCalendar` | A calendar plus slot buttons and a confirm step |
|
|
849
|
+
| `MeetingPlanner` | Attendees, an availability table and three suggested times |
|
|
850
|
+
| `AvailabilityEditor` | Weekly From/To ranges per weekday, with date overrides |
|
|
851
|
+
|
|
852
|
+
</details>
|
|
853
|
+
|
|
854
|
+
<details>
|
|
855
|
+
<summary><strong>Realtime and notifications (live pack)</strong></summary>
|
|
856
|
+
|
|
857
|
+
| Component | Purpose |
|
|
858
|
+
|---|---|
|
|
859
|
+
| `Bell` | An icon button with a count badge; its name says the count |
|
|
860
|
+
| `Inbox` | Notifications in tabs, grouped by day, patched in place by key |
|
|
861
|
+
| `ActivityFeed` | Actor, verb, object and time, grouped per day |
|
|
862
|
+
| `PushSoftAsk` | An in-app card before the browser's push permission prompt |
|
|
863
|
+
| `ConnectionPill` | One pill for a live connection's state, announced once per change |
|
|
864
|
+
| `ConnectionBanner` | A banner that appears only when reconnecting drags on or the app is offline |
|
|
865
|
+
| `LiveStatus` | The realtime pill: quiet while live, loud only in trouble |
|
|
866
|
+
| `NotificationPreferences` | Event by channel toggles in one APG grid, with tri-state group toggles |
|
|
867
|
+
| `TransportPicker` | A dev-only realtime sandbox for picking and testing the wire and bus |
|
|
868
|
+
| `MeetingRoom` | A video call: header, stage in four layouts, sidebar and controls |
|
|
869
|
+
| `ControlBar` | The call's controls as an APG toolbar |
|
|
870
|
+
| `Tile` | One participant tile with a name chip and level bars |
|
|
871
|
+
| `Prejoin` | Camera preview, mic meter and device selects before joining |
|
|
872
|
+
| `Lobby` | Waiting to be let in |
|
|
873
|
+
| `ScheduledLobby` | A countdown with Join disabled until the meeting can start |
|
|
874
|
+
| `Countdown` | A `role="timer"` countdown, announced once at one minute |
|
|
875
|
+
|
|
876
|
+
`notify()` applies the inbox's toast policy on top of `toast`.
|
|
877
|
+
|
|
878
|
+
</details>
|
|
879
|
+
|
|
880
|
+
<details>
|
|
881
|
+
<summary><strong>Collaboration (collab pack)</strong></summary>
|
|
882
|
+
|
|
883
|
+
| Component | Purpose |
|
|
884
|
+
|---|---|
|
|
885
|
+
| `Thread` | A chat channel on a virtual window, so 100,000 messages cost what 20 do |
|
|
886
|
+
| `Message` | One chat message with reactions, replies and delivery state |
|
|
887
|
+
| `Composer` | The chat composer with quote draft, attachments and @mentions |
|
|
888
|
+
| `TypingIndicator` | "Mei is typing…", still under reduced motion |
|
|
889
|
+
| `ConversationList` | Channels as a listbox with one tab stop |
|
|
890
|
+
| `Kanban` | A board whose columns are windows, with WIP limits; cards move by drag, keyboard or a Move menu |
|
|
891
|
+
| `CommentThread` | A comment thread with reply and Resolve |
|
|
892
|
+
| `CommentAnchor` | The highlighted range a thread hangs from |
|
|
893
|
+
| `CommentRail` | The margin rail of anchored threads; a bottom sheet on phones |
|
|
894
|
+
| `Cursors` | Peer cursors with name chips in each peer's colour |
|
|
895
|
+
| `PeerMark` | A peer's selected text, tinted in their colour |
|
|
896
|
+
| `PeerSelection` | A peer's selection on an object, outlined with their name |
|
|
897
|
+
| `PresenceStack` | Who is here, as avatars, with joins and leaves announced as one summary |
|
|
898
|
+
| `Following` | Wraps a surface that follows a peer's viewport until you scroll or press Escape |
|
|
899
|
+
| `ViewportRail` | A rail of the document with a box per peer's viewport |
|
|
900
|
+
| `SectionPeers` | Who is reading a section, beside its heading |
|
|
901
|
+
| `AutoTrack` | Follows the presenter's section; a manual scroll pauses it |
|
|
902
|
+
| `LockIndicator` | "Kofi is editing" on a field another peer holds |
|
|
903
|
+
| `LockedField` | A text field held by a peer: read-only, still readable and focusable |
|
|
904
|
+
| `SyncedForm` | Every named control inside is shared; a focused field is never overwritten |
|
|
905
|
+
| `SyncIndicator` | "Saved", "Saving…" or "Offline · changes kept" |
|
|
906
|
+
| `ConflictAlert` | Both versions side by side with Use theirs, Keep mine and Compare |
|
|
907
|
+
| `ShareDialog` | Invite people, set roles and link access, copy the link |
|
|
908
|
+
| `VersionHistory` | Named versions with a read-only preview and Restore |
|
|
909
|
+
| `DataIntegrity` | A dev-tools panel for a channel: duplicates, out-of-order and lag |
|
|
910
|
+
|
|
911
|
+
</details>
|
|
912
|
+
|
|
913
|
+
<details>
|
|
914
|
+
<summary><strong>Auth, onboarding and system pages (flow pack)</strong></summary>
|
|
915
|
+
|
|
916
|
+
| Component | Purpose |
|
|
917
|
+
|---|---|
|
|
918
|
+
| `Flow` | A step machine: the old step exits, the new one enters from its side, focus moves to its title |
|
|
919
|
+
| `AuthScreen` | The auth layout: full-bleed, card or split with a brand panel, by its own width |
|
|
920
|
+
| `SignIn` | Passkey and SSO, email and password, remember and Forgot |
|
|
921
|
+
| `SignUp` | Name, email, password with strength and rules, terms |
|
|
922
|
+
| `PasswordMeter` | Password strength and a rules list, each rule in words |
|
|
923
|
+
| `OtpField` | One real input painted into cells: one tab stop, paste and SMS autofill work |
|
|
924
|
+
| `OtpStep` | The MFA step: auto-submit on the last digit, resend with a countdown |
|
|
925
|
+
| `MagicLinkSent` | "Check your inbox" with resend on a countdown |
|
|
926
|
+
| `ResetPassword` | Email, link or code, then a new password; never reveals whether an account exists |
|
|
927
|
+
| `InviteAccept` | Who invited you, the org and role, Join and Decline |
|
|
928
|
+
| `AuthDone` | A done mark, then the flow continues |
|
|
929
|
+
| `ReauthDialog` | A password or passkey check before a sensitive action |
|
|
930
|
+
| `PasskeyButton` | Sign in with a passkey |
|
|
931
|
+
| `SsoButtons` | Provider buttons, each pending until the app redirects |
|
|
932
|
+
| `MfaSetup` | QR and key, confirm a code, backup codes |
|
|
933
|
+
| `SignGate` | A page behind a signature; the page is inert until signed |
|
|
934
|
+
| `SignGateBadge` | The gate's status |
|
|
935
|
+
| `Checklist` | An onboarding checklist with a counter and progress rail |
|
|
936
|
+
| `Tour` | A product tour with a spotlight; a missing target skips its step |
|
|
937
|
+
| `Coachmark` | One tip with a beacon and no scrim |
|
|
938
|
+
| `SystemPage` | A result page (404, 500, no access) inside the app shell |
|
|
939
|
+
| `ConnBanner` | Offline, reconnecting and stale-deploy banners under the header |
|
|
940
|
+
| `RateLimited` | A rate-limit notice with a draining rail |
|
|
941
|
+
| `ShortcutsOverlay` | `?` opens a filterable, platform-aware list of registered shortcuts |
|
|
942
|
+
|
|
943
|
+
`useCooldown(seconds, onDone)` counts a resend timer down to zero.
|
|
944
|
+
|
|
945
|
+
</details>
|
|
946
|
+
|
|
947
|
+
<details>
|
|
948
|
+
<summary><strong>Admin, billing and commerce (admin pack)</strong></summary>
|
|
949
|
+
|
|
950
|
+
| Component | Purpose |
|
|
951
|
+
|---|---|
|
|
952
|
+
| `SettingsLayout` | Settings sections with a nav that becomes a sticky column when wide |
|
|
953
|
+
| `SettingsSection` | A heading, a line and a bordered group of rows |
|
|
954
|
+
| `SettingRow` | Label and help at the start, the control at the end; stacks when narrow |
|
|
955
|
+
| `SaveBar` | A dock that rises when values differ from their snapshot |
|
|
956
|
+
| `DangerZone` | The one critical-bordered section |
|
|
957
|
+
| `ConfirmDialog` | A plain AlertDialog with focus on Cancel |
|
|
958
|
+
| `TypeToConfirm` | An AlertDialog that stays disabled until the right text is typed |
|
|
959
|
+
| `MembersTable` | Members with inline role select, bulk bar and pending invites |
|
|
960
|
+
| `SeatsMeter` | "7 of 10 seats used" |
|
|
961
|
+
| `RolesMatrix` | What each role can do; editable with `onToggle` |
|
|
962
|
+
| `InviteDialog` | Invite by email with a role, checked against the seats left |
|
|
963
|
+
| `TagsInput` | Enter, comma or a pasted list adds tags; invalid ones stay marked |
|
|
964
|
+
| `ApiKeys` | API keys: create behind re-auth, show the key once |
|
|
965
|
+
| `PlanPicker` | Plans as radio cards with Monthly/Annual and a proration preview |
|
|
966
|
+
| `UsageMeter` | A usage meter: caution from 80%, critical at 100% |
|
|
967
|
+
| `UsageMeters` | A group of usage meters |
|
|
968
|
+
| `Invoices` | Invoices, with a banner when a payment failed |
|
|
969
|
+
| `PaymentMethods` | Saved cards by last four; remove gives Undo |
|
|
970
|
+
| `PayFrame` | A styled slot for a payment provider's iframe |
|
|
971
|
+
| `AuditLog` | Who did what and when, filtered and exportable |
|
|
972
|
+
| `IntegrationsGrid` | Integration cards with status and one action each |
|
|
973
|
+
| `Webhooks` | Webhook endpoints with Send test and one-time signing secrets |
|
|
974
|
+
| `CsvImport` | Upload, map, review and import a CSV |
|
|
975
|
+
| `CartDrawer` | The cart as a sheet with subtotal and Checkout |
|
|
976
|
+
| `CartButton` | The cart button with a count badge, said in words |
|
|
977
|
+
| `LineItem` | One cart line with a quantity stepper |
|
|
978
|
+
| `Checkout` | Cart, address, shipping, payment, review and confirmation, guest first |
|
|
979
|
+
| `OrderConfirmation` | The order number, where the receipt went and the tracker |
|
|
980
|
+
| `OrderTracker` | Ordered, packed, shipped, delivered |
|
|
981
|
+
|
|
982
|
+
</details>
|
|
983
|
+
|
|
984
|
+
## Theming
|
|
985
|
+
|
|
986
|
+
The look comes from tokens, so every component follows the theme, the density and the expression dial with no change to
|
|
987
|
+
your code. There are three levels. Stop at the first that gets you there; each keeps the contrast check.
|
|
988
|
+
|
|
989
|
+
1. **`veneer({ … })` in `kerf.config.ts`.** Checked by D010 at build time.
|
|
990
|
+
2. **`src/theme.css`, unlayered.** `[data-scope]` and `[data-part]` rules beat Veneer with no `!important`.
|
|
991
|
+
3. **Your own component**, built on Veneer's tokens.
|
|
992
|
+
|
|
993
|
+
```ts
|
|
994
|
+
veneer({
|
|
995
|
+
seed: { accent: '#e8590c' }, // the hue; each theme solves lightness
|
|
996
|
+
dials: { expression: 'vivid', density: 'cozy' },
|
|
997
|
+
radius: 'round', // sharp, soft or round
|
|
998
|
+
fonts: { display: 'Fraunces, serif' },
|
|
999
|
+
colors: { brand: '#e8590c' }, // --veneer-color-brand, tone="brand"
|
|
1000
|
+
parts: { button: { radius: 999, case: 'uppercase' } },
|
|
1001
|
+
// a named theme, under data-palette="ocean"
|
|
1002
|
+
themes: { ocean: { seed: { accent: '#0b7285' } } },
|
|
1003
|
+
})
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
### Options
|
|
1007
|
+
|
|
1008
|
+
| Option | Type / values | Default | What it does |
|
|
1009
|
+
|---|---|---|---|
|
|
1010
|
+
| `seed.accent` | `#rrggbb`, a name from `colors`, or `{ hue, chroma }` | Veneer's accent | The hue family. Each theme solves its own lightness, and the build prints where it landed |
|
|
1011
|
+
| `seed.neutral` | `#rrggbb` or `{ hue, chroma }` | warm paper and ink | Tints pages, surfaces and text |
|
|
1012
|
+
| `dials.expression` | `quiet` · `balanced` · `vivid` | `balanced` | How much motion and colour the kit shows |
|
|
1013
|
+
| `dials.density` | `compact` · `cozy` · `comfortable` | `cozy` | Spacing and control height |
|
|
1014
|
+
| `dials.flair` | `sweep` · `none` | per expression | Where the sweep runs: `sweep` adds buttons and surfaces; `none` keeps it to inputs and controls |
|
|
1015
|
+
| `dials.theme` | `light` · `dark` | follows the OS | With `light`, dark isn't checked |
|
|
1016
|
+
| `dials.palette` | a name from `themes` | | The named theme a page shows by default |
|
|
1017
|
+
| `fields` | `floating` · `classic` | `floating` | Where field labels sit |
|
|
1018
|
+
| `radius` | `sharp` (2px) · `soft` · `round` | per expression | Replaces the radius each expression sets |
|
|
1019
|
+
| `fonts` | `{ body, display, mono }` | system stacks | A family name or a full CSS stack |
|
|
1020
|
+
| `tokens` | `{ '--veneer-…': value }` | | Any spec token, on every scope. Colours are `#rrggbb`, `oklch()`, `color-mix()` or `light-dark()` |
|
|
1021
|
+
| `colors` | `{ name: '#rrggbb' }` | | Named colours: `--veneer-color-<name>`, a tone (`tone="brand"`), and Tailwind's `bg-brand` |
|
|
1022
|
+
| `system` | `radius` `space` `pad` `control` `font` `shadow` `duration` `ease` `border` `icon` `text.<role>` | | Retunes the scales every part reads. Numbers are px, ms for durations |
|
|
1023
|
+
| `parts` | `{ part: { …props, hover, focus, press, active, open, disabled } }` | | Restyles one element, at rest and per state |
|
|
1024
|
+
| `themes` | `{ name: { seed, colors, system, parts, tokens } }` | | Named looks under `[data-palette="name"]` |
|
|
1025
|
+
|
|
1026
|
+
### Parts
|
|
1027
|
+
|
|
1028
|
+
Every part takes `bg text border borderWidth radius padding paddingX paddingY gap margin height minHeight width size
|
|
1029
|
+
shadow opacity scale duration easing font fontSize weight leading tracking case`. Numbers are px; names are system steps
|
|
1030
|
+
or names from `colors`.
|
|
1031
|
+
|
|
1032
|
+
| Part | For |
|
|
1033
|
+
|---|---|
|
|
1034
|
+
| `button`, `button.soft`, `button.outline`, `button.ghost`, `button.frame`, `button.link` | Button and ButtonLink, per emphasis |
|
|
1035
|
+
| `iconButton` | A button holding only an icon |
|
|
1036
|
+
| `copy`, `close` | CopyButton, and the close button of dialogs, sheets, alerts and side navs |
|
|
1037
|
+
| `link`, `link.underline` | Link and its drawn underline (`color` `width` `offset`) |
|
|
1038
|
+
| `nav`, `nav.item`, `nav.underline` | Nav and its sliding bar |
|
|
1039
|
+
| `tabs`, `tabs.tab`, `tabs.underline` | Tabs |
|
|
1040
|
+
| `pill`, `badge`, `chip` | Pill, Badge and Chip |
|
|
1041
|
+
| `card` | Card and Surface |
|
|
1042
|
+
| `field`, `field.label` | Text fields, selects and pickers |
|
|
1043
|
+
| `sweep` | The sweep stroke (`stroke` `base` `text` `width` `duration`) |
|
|
1044
|
+
| `dialog`, `sheet`, `popover`, `toast` | Overlay panels |
|
|
1045
|
+
|
|
1046
|
+
```ts
|
|
1047
|
+
veneer({
|
|
1048
|
+
colors: { brand: '#e8590c', ink: '#1b1b1f' },
|
|
1049
|
+
parts: {
|
|
1050
|
+
button: {
|
|
1051
|
+
bg: 'brand',
|
|
1052
|
+
text: 'ink',
|
|
1053
|
+
radius: 'pill',
|
|
1054
|
+
hover: { bg: 'ink', text: 'white' },
|
|
1055
|
+
},
|
|
1056
|
+
sweep: { stroke: 'brand', width: 2 },
|
|
1057
|
+
nav: {
|
|
1058
|
+
item: { hover: { text: 'brand' } },
|
|
1059
|
+
underline: { color: 'brand', width: 3 },
|
|
1060
|
+
},
|
|
1061
|
+
},
|
|
1062
|
+
themes: {
|
|
1063
|
+
ocean: {
|
|
1064
|
+
seed: { accent: '#0b7285' },
|
|
1065
|
+
colors: { brand: '#0b7285' },
|
|
1066
|
+
},
|
|
1067
|
+
},
|
|
1068
|
+
})
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
A solid's `bg` and `text` move its tone channels, so hover and sweep follow. Text set on a fill in the same part is
|
|
1072
|
+
checked like a seed: below 4.5:1 is D010.
|
|
1073
|
+
|
|
1074
|
+
### Switching at run time
|
|
1075
|
+
|
|
1076
|
+
```ts
|
|
1077
|
+
import { getDial, setDial, setPalette } from '@kerf-js/veneer'
|
|
1078
|
+
|
|
1079
|
+
// Kept for the next visit; see dialScript
|
|
1080
|
+
setDial('theme', 'dark', { persist: true })
|
|
1081
|
+
setDial('density', 'compact')
|
|
1082
|
+
// A theme from veneer({ themes }); 'auto' goes back to the default
|
|
1083
|
+
setPalette('ocean')
|
|
1084
|
+
getDial('expression') // 'balanced'
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
Dials are `expression`, `fields`, `theme`, `density`, `motion` and `flair`. Each change is announced as a `veneer:dial`
|
|
1088
|
+
event on the document. Any element can set a dial with a `data-*` attribute, and scopes nest:
|
|
1089
|
+
|
|
1090
|
+
```tsx
|
|
1091
|
+
<section data-theme="dark" data-density="compact">…</section>
|
|
1092
|
+
```
|
|
1093
|
+
|
|
1094
|
+
### An exact brand colour
|
|
1095
|
+
|
|
1096
|
+
A seed gives the hue, not the colour. To pin a brand fill, set it and its hover for both themes:
|
|
1097
|
+
|
|
1098
|
+
```ts
|
|
1099
|
+
veneer({
|
|
1100
|
+
seed: { accent: '#c8102e' },
|
|
1101
|
+
tokens: {
|
|
1102
|
+
'--veneer-color-accent-solid': 'light-dark(#c8102e, #e5484d)',
|
|
1103
|
+
'--veneer-color-accent-solid-hover':
|
|
1104
|
+
'light-dark(#a50d26, #f2666a)',
|
|
1105
|
+
},
|
|
1106
|
+
})
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
`kerf docs theme` prints every option, part and state, plus worked looks (brutalist, warm editorial) and Button's tone
|
|
1110
|
+
channels. Its source is
|
|
1111
|
+
[packages/cli/docs/theme.md](https://github.com/Ravonus/kerf/blob/main/packages/cli/docs/theme.md). `kerf tokens`
|
|
1112
|
+
writes the resolved tokens as DTCG 2025.10 for Figma, Style Dictionary or Terrazzo.
|
|
1113
|
+
|
|
1114
|
+
## The Theme studio
|
|
1115
|
+
|
|
1116
|
+
The docs site has a Theme studio at `/components/theme-studio` (Components → Theming → Theme studio). Every control
|
|
1117
|
+
writes a key of `veneer()`, and the preview runs Veneer's own theme compiler from `@kerf-js/veneer/theme`, so what you see is
|
|
1118
|
+
what your build ships.
|
|
1119
|
+
|
|
1120
|
+
- Start from a preset, then adjust colour, shape, type, space and motion with sliders and colour pickers.
|
|
1121
|
+
- Edit any part in any state, or any `--veneer-*` token, or the raw JSON.
|
|
1122
|
+
- Real components take the theme live, with their contrast ratios. Part text below 4.5:1 is flagged, as the build
|
|
1123
|
+
would flag it.
|
|
1124
|
+
- Copy the result as `kerf.config.ts`.
|
|
1125
|
+
|
|
1126
|
+
Source: [site/src/routes/components/theme-studio.tsx](https://github.com/Ravonus/kerf/blob/main/site/src/routes/components/theme-studio.tsx).
|
|
1127
|
+
|
|
1128
|
+
## Accessibility
|
|
1129
|
+
|
|
1130
|
+
What Veneer guarantees, and what checks it:
|
|
1131
|
+
|
|
1132
|
+
| Guarantee | How |
|
|
1133
|
+
|---|---|
|
|
1134
|
+
| **Every control has a name** | `label` is a required `string` on every field, `caption` on Table, and `label` on an icon-only Button. Badges say their unit in `srText`. Icons are `aria-hidden` unless given a `label` |
|
|
1135
|
+
| **Keyboard patterns** | Tabs, Menu, Accordion, Slider, RadioGroup, Select, CommandPalette, DataGrid, TraceViewer, ControlBar and the rest follow the WAI-ARIA Authoring Practices: one tab stop, arrows inside, Home and End, typeahead where it applies |
|
|
1136
|
+
| **Focus is managed** | Dialogs and sheets move focus in and return it to the opener on every close path. Layers stack, so Escape closes only the top one. Flow steps move focus to the new step's title |
|
|
1137
|
+
| **Status isn't colour alone** | Alerts, tool calls, password rules and meters carry an icon and words |
|
|
1138
|
+
| **Contrast is checked at build** | D010 fails a seed, colour, token or part that drops any text, control boundary or focus ring pair below WCAG at a theme × expression stop |
|
|
1139
|
+
| **Reduced motion** | The `motion` dial and `prefers-reduced-motion`: loops become an opacity pulse or stop, and entries run at most once |
|
|
1140
|
+
| **Live regions** | Toasts, connection state, presence changes and new messages announce once, summarised in bursts |
|
|
1141
|
+
|
|
1142
|
+
Behind those claims, in this repo:
|
|
1143
|
+
|
|
1144
|
+
- `pnpm run a11y` runs axe-core (WCAG 2.0–2.2 A/AA and best practice, colour contrast included) in Chromium over every
|
|
1145
|
+
component at all 12 dial stops: expression × theme × motion. At `motion: reduce` it also fails any loop that still
|
|
1146
|
+
moves anything but opacity. It measures contrast from pixels as well.
|
|
1147
|
+
- veneer-core's contrast checker resolves every colour token at each theme × expression and checks text, UI and focus-ring
|
|
1148
|
+
pairs. The plugin runs the same checker on your config.
|
|
1149
|
+
- In an app with Veneer, `kerf check` reports D001–D007 (raw values and browser-painted controls) and D030–D039 (missing
|
|
1150
|
+
labels and names, focus rings removed, positive `tabindex`, heading jumps). `kerf docs design` lists them.
|
|
1151
|
+
|
|
1152
|
+
## Tailwind
|
|
1153
|
+
|
|
1154
|
+
Veneer works with Tailwind v4. In an app that has Veneer, `kerf add tailwind` installs Tailwind and writes this at the top of
|
|
1155
|
+
`src/app.css`:
|
|
1156
|
+
|
|
1157
|
+
```css
|
|
1158
|
+
@layer veneer, theme, base, components, utilities;
|
|
1159
|
+
@import "tailwindcss/theme.css" layer(theme);
|
|
1160
|
+
@import "tailwindcss/utilities.css" layer(utilities);
|
|
1161
|
+
@import "@kerf-js/veneer/tailwind.css";
|
|
1162
|
+
```
|
|
1163
|
+
|
|
1164
|
+
Tailwind's reset is left out on purpose: its `base` layer comes after `veneer` and would override every component. Veneer
|
|
1165
|
+
brings its own base.
|
|
1166
|
+
|
|
1167
|
+
`@kerf-js/veneer/tailwind.css` maps Veneer's tokens to Tailwind theme values with `@theme inline`, so each utility stays on
|
|
1168
|
+
the `var()` and follows dials and scopes:
|
|
1169
|
+
|
|
1170
|
+
| Utility family | Values |
|
|
1171
|
+
|---|---|
|
|
1172
|
+
| Colours | `page` `surface` `surface-raised` `surface-sunken` `text` `text-subtle` `text-faint` `border` `border-strong` `focus` `accent` `accent-soft` `accent-text` `on-accent` `positive` `caution` `critical` `info` |
|
|
1173
|
+
| Fonts | `font-sans` `font-display` `font-mono` |
|
|
1174
|
+
| Spacing | `hair` `tight` `related` `group` `section` `page` (`p-related`, `gap-group`) |
|
|
1175
|
+
| Radius | `rounded-mark` `rounded-control` `rounded-surface` |
|
|
1176
|
+
|
|
1177
|
+
A numeric spacing class off that scale, such as `p-3`, is D002. Names from `veneer({ colors })` also become utilities
|
|
1178
|
+
(`bg-brand`) through `.kerf/tokens/veneer.tailwind.css`.
|
|
1179
|
+
|
|
1180
|
+
## Per-page cost
|
|
1181
|
+
|
|
1182
|
+
- **Per component CSS.** Each component imports only its own stylesheet from veneer-core's split CSS.
|
|
1183
|
+
`package.json` `sideEffects` lists only CSS and three modules, so an unused component tree-shakes away.
|
|
1184
|
+
- **Shared once per page.** What components share (the sweep, Kerf's spread helpers, Icon) is paid once per page, not
|
|
1185
|
+
per component.
|
|
1186
|
+
- **Measure it.** `pnpm run size` in this package builds each component alone with the Kerf plugin and reports brotli
|
|
1187
|
+
(q11) JS and CSS three ways: alone, ten on one page, and what it adds to a page that already renders every other
|
|
1188
|
+
component.
|
|
1189
|
+
- **App ceiling.** The release gate `evals/gates/veneer-exit.mjs` rebuilds the eval shop on Veneer and checks its JS and
|
|
1190
|
+
CSS together against a 50 KB brotli ceiling.
|
|
1191
|
+
- **Icons.** An icon you don't import costs nothing. See
|
|
1192
|
+
[`@kerf-js/veneer-icons`](https://www.npmjs.com/package/@kerf-js/veneer-icons) <sup>[source](https://github.com/Ravonus/kerf/tree/main/packages/veneer-icons)</sup>.
|
|
1193
|
+
- **Work per interaction.** `test/budget.test.tsx` caps the DOM mutations and reactive re-runs each component may spend
|
|
1194
|
+
on one interaction.
|
|
1195
|
+
|
|
1196
|
+
## API reference
|
|
1197
|
+
|
|
1198
|
+
### Entries
|
|
1199
|
+
|
|
1200
|
+
| Import | What it has |
|
|
1201
|
+
|---|---|
|
|
1202
|
+
| `@kerf-js/veneer` | Every component in the catalogue, plus `toast`, `setDial`, `getDial`, `setPalette`, `getPalette`, `sweep`, `compareRange`, `foldAnswer`, `notify`, `useCooldown`, `LEVEL`, `PAINTERS`, and the prop and data types |
|
|
1203
|
+
| `@kerf-js/veneer/plugin` | `veneer()` (also the default export), `dialScript`, `checkSeed`, `dtcg`, `classicCss`, `dialCss` |
|
|
1204
|
+
| `@kerf-js/veneer/theme` | The theme compiler without Node, used by both the plugin and the Theme studio: `themeOptions`, `themeCss`, `partContrast`, `checkTokens`, `normalizeSeed`, `seedByName`, `tailwindTheme`, `toneChannels`, `PARTS` |
|
|
1205
|
+
| `@kerf-js/veneer/theme-parts` | The table of parts, their states and where each property lands |
|
|
1206
|
+
| `@kerf-js/veneer/theme-context` | `themeContext()`: facts read from veneer-core's stylesheet. Node only |
|
|
1207
|
+
| `@kerf-js/veneer/skeleton` | The skeleton CSS, for a page that uses `<Boundary pending="shape">` without a `<Skeleton>` |
|
|
1208
|
+
| `@kerf-js/veneer/scenes` | `<Stage>` and `<Scene>`: one WebGL canvas pinned behind the page, a scene per section |
|
|
1209
|
+
| `@kerf-js/veneer/ui` | How Veneer draws an `interaction()` row. The Kerf plugin imports it where `ui=` is used |
|
|
1210
|
+
| `@kerf-js/veneer/tailwind.css` | Veneer's tokens as Tailwind v4 theme values |
|
|
1211
|
+
|
|
1212
|
+
### Non-component exports
|
|
1213
|
+
|
|
1214
|
+
| Export | What it does |
|
|
1215
|
+
|---|---|
|
|
1216
|
+
| `toast.show(input)` | Shows a toast; `input` is `{ title, description, tone, action, duration, id }`. Returns its id |
|
|
1217
|
+
| `toast.dismiss(id)` | Dismisses one toast |
|
|
1218
|
+
| `toast.promise(p, { pending, done, error })` | One toast through a promise's life. Returns the promise |
|
|
1219
|
+
| `setDial(name, value, { root, persist, transition })` | Writes a dial and announces `veneer:dial` |
|
|
1220
|
+
| `getDial(name, root?)` | Reads a dial |
|
|
1221
|
+
| `setPalette(name, { root, persist })` | Switches the named theme; `'auto'` returns to the default |
|
|
1222
|
+
| `getPalette(root?)` | Reads the named theme, or `'auto'` |
|
|
1223
|
+
| `sweep` | The sweep as an action, for a binding that wants to name it |
|
|
1224
|
+
| `compareRange(range, compare)` | The comparison range of a date range selection, for a dashboard's "vs" |
|
|
1225
|
+
| `foldAnswer(events)` / `foldAnswer(answer, event)` | Folds agent events into the answer `Assistant` renders |
|
|
1226
|
+
| `notify({ open })` | The inbox's toast policy on top of `toast` |
|
|
1227
|
+
| `useCooldown(seconds, onDone?)` | A countdown for resend buttons |
|
|
1228
|
+
|
|
1229
|
+
## Recipes
|
|
1230
|
+
|
|
1231
|
+
**A dark, compact admin region inside a light page**
|
|
1232
|
+
|
|
1233
|
+
```tsx
|
|
1234
|
+
;<Card
|
|
1235
|
+
title="Server logs"
|
|
1236
|
+
data-theme="dark"
|
|
1237
|
+
data-density="compact"
|
|
1238
|
+
>
|
|
1239
|
+
<Table
|
|
1240
|
+
caption="Recent requests"
|
|
1241
|
+
columns={columns}
|
|
1242
|
+
rows={rows}
|
|
1243
|
+
/>
|
|
1244
|
+
</Card>
|
|
1245
|
+
```
|
|
1246
|
+
|
|
1247
|
+
**Classic labels for one form only**
|
|
1248
|
+
|
|
1249
|
+
```tsx
|
|
1250
|
+
<Input label="Street" variant="classic" />
|
|
1251
|
+
```
|
|
1252
|
+
|
|
1253
|
+
**A theme switcher that remembers**
|
|
1254
|
+
|
|
1255
|
+
```tsx
|
|
1256
|
+
import { state } from '@kerf-js/core'
|
|
1257
|
+
import { Segmented, getDial, setDial } from '@kerf-js/veneer'
|
|
1258
|
+
|
|
1259
|
+
export function ThemeSwitch() {
|
|
1260
|
+
const theme = state(getDial('theme'))
|
|
1261
|
+
const choose = (v: string) => {
|
|
1262
|
+
theme.value = v
|
|
1263
|
+
setDial('theme', v, { persist: true })
|
|
1264
|
+
}
|
|
1265
|
+
return (
|
|
1266
|
+
<Segmented
|
|
1267
|
+
label="Theme"
|
|
1268
|
+
value={theme.value}
|
|
1269
|
+
onChange={choose}
|
|
1270
|
+
options={[
|
|
1271
|
+
{ value: 'auto', label: 'System' },
|
|
1272
|
+
{ value: 'light', label: 'Light' },
|
|
1273
|
+
{ value: 'dark', label: 'Dark' },
|
|
1274
|
+
]}
|
|
1275
|
+
/>
|
|
1276
|
+
)
|
|
1277
|
+
}
|
|
1278
|
+
```
|
|
1279
|
+
|
|
1280
|
+
Add `dialScript` to `site.head` so the saved choice applies before the first paint.
|
|
1281
|
+
|
|
1282
|
+
## Troubleshooting
|
|
1283
|
+
|
|
1284
|
+
**`D010 veneer colours fail contrast (n pairs): …`.** A seed, colour, token or part leaves a pair below WCAG at some
|
|
1285
|
+
dial stop. The message lists each pair with its ratio and the minimum. Change the named token or seed, or limit the
|
|
1286
|
+
stops with `dials` (for example `dials: { theme: 'light' }` stops dark from being checked). `kerf build` stops on it,
|
|
1287
|
+
because a refused config would ship Veneer's default look.
|
|
1288
|
+
|
|
1289
|
+
**`veneer: accent #… landed as … light, … dark`.** Not an error. A seed sets the hue family and each theme solves its own
|
|
1290
|
+
lightness to pass contrast. To pin an exact brand colour, set `--veneer-color-accent-solid` (see
|
|
1291
|
+
[An exact brand colour](#an-exact-brand-colour)).
|
|
1292
|
+
|
|
1293
|
+
**`unknown option \`…\`` or `must be one of …`.** `veneer()` validates every key and value and reports the path, such as
|
|
1294
|
+
`dials.expression`.
|
|
1295
|
+
|
|
1296
|
+
**My `:root { --veneer-color-… }` override disappears in some places.** A colour set in plain CSS on `:root` skips the
|
|
1297
|
+
check and is undone inside any scope that sets a dial, such as a Table's density. Put app-wide values in
|
|
1298
|
+
`veneer({ tokens })` instead.
|
|
1299
|
+
|
|
1300
|
+
**Toasts never appear.** `toast.show()` needs one mounted `<Toaster />`.
|
|
1301
|
+
|
|
1302
|
+
**Nothing animates on scroll.** Call `flow()` from `@kerf-js/veneer-core` once in `src/entry.client.ts`.
|
|
1303
|
+
|
|
1304
|
+
**Tailwind utilities override Veneer components.** Tailwind's full import includes its reset in a later layer. Use the
|
|
1305
|
+
layered imports from [Tailwind](#tailwind), which `kerf add tailwind` writes for you.
|
|
1306
|
+
|
|
1307
|
+
**D005 on a `<button>` or `<select>`.** In an app with Veneer, a browser-painted control is reported so the page keeps one
|
|
1308
|
+
look. Use the Veneer component; `kerf fix` applies the suggested edit for a button. To keep one site, put
|
|
1309
|
+
`// kerf-allow D005: <reason>` on the line above.
|
|
1310
|
+
|
|
1311
|
+
## Related packages
|
|
1312
|
+
|
|
1313
|
+
| Package | What it is |
|
|
1314
|
+
|---|---|
|
|
1315
|
+
| [`@kerf-js/core`](https://www.npmjs.com/package/@kerf-js/core) <sup>[source](https://github.com/Ravonus/kerf/tree/main/packages/core)</sup> | The runtime, compiler binding, Vite plugin and test utilities |
|
|
1316
|
+
| [`@kerf-js/start`](https://www.npmjs.com/package/@kerf-js/start) <sup>[source](https://github.com/Ravonus/kerf/tree/main/packages/start)</sup> | File routes, server functions, streaming SSR, a database and auth |
|
|
1317
|
+
| [`@kerf-js/cli`](https://www.npmjs.com/package/@kerf-js/cli) <sup>[source](https://github.com/Ravonus/kerf/tree/main/packages/cli)</sup> | The `kerf` command: `add`, `check`, `docs`, `tokens` and the rest |
|
|
1318
|
+
| [`@kerf-js/veneer-core`](https://www.npmjs.com/package/@kerf-js/veneer-core) <sup>[source](https://github.com/Ravonus/kerf/tree/main/packages/veneer-core)</sup> | Veneer's behaviour, tokens and CSS, with no framework |
|
|
1319
|
+
| [`@kerf-js/veneer-icons`](https://www.npmjs.com/package/@kerf-js/veneer-icons) <sup>[source](https://github.com/Ravonus/kerf/tree/main/packages/veneer-icons)</sup> | 651 original icons in Veneer's three expression tiers |
|
|
1320
|
+
| [`create-kerf`](https://www.npmjs.com/package/create-kerf) <sup>[source](https://github.com/Ravonus/kerf/tree/main/packages/create-kerf)</sup> | `npm create kerf`: a new app with Veneer by default |
|
|
1321
|
+
|
|
1322
|
+
## Contributing
|
|
1323
|
+
|
|
1324
|
+
See [CONTRIBUTING.md](https://github.com/Ravonus/kerf/blob/main/CONTRIBUTING.md). The repo is one pnpm workspace. In
|
|
1325
|
+
`packages/veneer`:
|
|
1326
|
+
|
|
1327
|
+
```bash
|
|
1328
|
+
# Vitest: markup, hydration, budgets, plugin and theme
|
|
1329
|
+
pnpm test
|
|
1330
|
+
pnpm run size # what each component costs, brotli
|
|
1331
|
+
pnpm run a11y # axe-core in Chromium at all 12 dial stops
|
|
1332
|
+
```
|
|
1333
|
+
|
|
1334
|
+
The design spec Veneer implements is in
|
|
1335
|
+
[docs/design/veneer](https://github.com/Ravonus/kerf/tree/main/docs/design/veneer).
|
|
1336
|
+
|
|
1337
|
+
## License
|
|
1338
|
+
|
|
1339
|
+
[MIT](https://github.com/Ravonus/kerf/blob/main/LICENSE)
|