@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/src/flow/kit.tsx
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
// What the flow screens share (09 §1): the title, mark and rail parts, the step's form frame and its error surfaces.
|
|
2
|
+
// Internal, except what the barrel names.
|
|
3
|
+
import {
|
|
4
|
+
announce,
|
|
5
|
+
mapFlowError,
|
|
6
|
+
secondsClock,
|
|
7
|
+
type FlowError,
|
|
8
|
+
type FlowErrorOptions,
|
|
9
|
+
} from '@kerf-js/veneer-core'
|
|
10
|
+
import { derived, flush, onCleanup, onMount, state, untrack, watch } from '@kerf-js/core'
|
|
11
|
+
import { Alert } from '../Alert'
|
|
12
|
+
import { Button, type ButtonProps } from '../Button'
|
|
13
|
+
import { Banner } from '../parts'
|
|
14
|
+
import { toast } from '../Toast'
|
|
15
|
+
import '../styles'
|
|
16
|
+
import '@kerf-js/veneer-core/styles/flows/tokens.css'
|
|
17
|
+
import '@kerf-js/veneer-core/styles/flows/base.css'
|
|
18
|
+
import '@kerf-js/veneer-core/styles/flows/result.css' // the result mark
|
|
19
|
+
import '@kerf-js/veneer-core/styles/layout/stack.css'
|
|
20
|
+
|
|
21
|
+
export type Heading = 'h1' | 'h2' | 'h3'
|
|
22
|
+
|
|
23
|
+
/** A step's title: focus lands here on arrival (09 §1.1). */
|
|
24
|
+
export function Title({
|
|
25
|
+
as,
|
|
26
|
+
id,
|
|
27
|
+
children,
|
|
28
|
+
}: {
|
|
29
|
+
as?: Heading | undefined
|
|
30
|
+
id?: string
|
|
31
|
+
children?: unknown
|
|
32
|
+
}) {
|
|
33
|
+
const level = derived(() => as ?? 'h1')
|
|
34
|
+
return (
|
|
35
|
+
<>
|
|
36
|
+
{level.value === 'h3' ? (
|
|
37
|
+
<h3 data-part="title" data-part-title="" tabindex="-1" id={id}>
|
|
38
|
+
{children}
|
|
39
|
+
</h3>
|
|
40
|
+
) : level.value === 'h2' ? (
|
|
41
|
+
<h2 data-part="title" data-part-title="" tabindex="-1" id={id}>
|
|
42
|
+
{children}
|
|
43
|
+
</h2>
|
|
44
|
+
) : (
|
|
45
|
+
<h1 data-part="title" data-part-title="" tabindex="-1" id={id}>
|
|
46
|
+
{children}
|
|
47
|
+
</h1>
|
|
48
|
+
)}
|
|
49
|
+
</>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The result mark; `draw` strokes a check in. */
|
|
54
|
+
export function Mark({
|
|
55
|
+
tone,
|
|
56
|
+
draw,
|
|
57
|
+
children,
|
|
58
|
+
}: {
|
|
59
|
+
tone?: 'positive' | 'caution' | 'critical' | undefined
|
|
60
|
+
draw?: boolean
|
|
61
|
+
children?: unknown
|
|
62
|
+
}) {
|
|
63
|
+
return (
|
|
64
|
+
<span data-scope="result" data-tone={tone}>
|
|
65
|
+
{draw ? (
|
|
66
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
67
|
+
<path pathLength="1" data-draw="" d="m5 12.5 4.5 4.5L19 7.5" />
|
|
68
|
+
</svg>
|
|
69
|
+
) : (
|
|
70
|
+
children
|
|
71
|
+
)}
|
|
72
|
+
</span>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The flows rail: `value` in percent. */
|
|
77
|
+
export function Rail({
|
|
78
|
+
value,
|
|
79
|
+
on = true,
|
|
80
|
+
...rest
|
|
81
|
+
}: {
|
|
82
|
+
value: number
|
|
83
|
+
on?: boolean
|
|
84
|
+
[attr: string]: unknown
|
|
85
|
+
}) {
|
|
86
|
+
return (
|
|
87
|
+
<span data-part="rail" data-on={on ? '' : undefined} style={`--v:${value}%`} {...rest}>
|
|
88
|
+
<span data-part="rail-fill"></span>
|
|
89
|
+
</span>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Seconds counting down to zero while `seconds()` holds a number; a new number restarts it. Nothing runs on the server
|
|
95
|
+
* or before mount, so the first paint is the full count.
|
|
96
|
+
*/
|
|
97
|
+
export function useCooldown(seconds: () => number | undefined, onDone?: () => void) {
|
|
98
|
+
const left = state(untrack(seconds) ?? 0)
|
|
99
|
+
let stop: (() => void) | undefined
|
|
100
|
+
const start = (n: number | undefined) => {
|
|
101
|
+
stop?.()
|
|
102
|
+
stop = undefined
|
|
103
|
+
left.value = n ?? 0
|
|
104
|
+
if (n) stop = secondsClock(n, (s) => (left.value = s), onDone)
|
|
105
|
+
}
|
|
106
|
+
onMount(() => {
|
|
107
|
+
// a fresh object each run: a restart with the same seconds still restarts
|
|
108
|
+
watch(
|
|
109
|
+
() => ({ n: seconds() }),
|
|
110
|
+
(v) => start(v.n),
|
|
111
|
+
)
|
|
112
|
+
onCleanup(() => stop?.())
|
|
113
|
+
})
|
|
114
|
+
return left
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** What `<Form of={mutation}>` gives its children; a step reads it, so Veneer never imports the server's Form. */
|
|
118
|
+
export interface FormLike {
|
|
119
|
+
readonly pending: { readonly value: boolean }
|
|
120
|
+
readonly errors: { readonly value: Record<string, string> }
|
|
121
|
+
readonly message: { readonly value: string | undefined }
|
|
122
|
+
value?(name: string): unknown
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** How a screen is driven: inside `<Form of>` (pass `form`), or on its own with `onSubmit` and `errors`. */
|
|
126
|
+
export interface FlowForm<V> {
|
|
127
|
+
/** The `<Form of={mutation}>` render argument: the screen then renders no <form> of its own. */
|
|
128
|
+
form?: FormLike
|
|
129
|
+
/** Called with the form's values once its own checks pass. */
|
|
130
|
+
onSubmit?: (values: V, e: SubmitEvent) => void
|
|
131
|
+
/** Messages by field name. */
|
|
132
|
+
errors?: Record<string, string> | undefined
|
|
133
|
+
/** The failure: anything `mapFlowError` takes (a `FnError`, a typed error, a string). */
|
|
134
|
+
error?: unknown
|
|
135
|
+
/** Options for `mapFlowError`: copy by code, and `online`. */
|
|
136
|
+
errorOptions?: FlowErrorOptions | undefined
|
|
137
|
+
pending?: boolean | undefined
|
|
138
|
+
/** The Retry on a network failure's toast. */
|
|
139
|
+
onRetry?: (() => void) | undefined
|
|
140
|
+
/** The title's level (default h1: an auth step is the page). */
|
|
141
|
+
heading?: Heading
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function watchStepFailure<V>({
|
|
145
|
+
p,
|
|
146
|
+
failure,
|
|
147
|
+
root,
|
|
148
|
+
focusInvalid,
|
|
149
|
+
}: {
|
|
150
|
+
p: FlowForm<V>
|
|
151
|
+
failure: { readonly value: FlowError | undefined }
|
|
152
|
+
root: () => HTMLElement | undefined
|
|
153
|
+
focusInvalid: (say?: string) => void
|
|
154
|
+
}) {
|
|
155
|
+
onMount(() => {
|
|
156
|
+
watch(
|
|
157
|
+
() => failure.value,
|
|
158
|
+
(m: FlowError | undefined) => {
|
|
159
|
+
if (!m) return
|
|
160
|
+
if (m.surface === 'field') focusInvalid(m.summary)
|
|
161
|
+
if (m.surface === 'alert') {
|
|
162
|
+
flush()
|
|
163
|
+
root()?.querySelector<HTMLElement>('[data-part="formerr"]')?.focus()
|
|
164
|
+
}
|
|
165
|
+
if (m.surface === 'rate-limit')
|
|
166
|
+
announce(document, `${m.title} Try again in ${m.retryAfter}s.`)
|
|
167
|
+
if (m.surface === 'toast')
|
|
168
|
+
toast.show({
|
|
169
|
+
title: m.title,
|
|
170
|
+
description: m.description,
|
|
171
|
+
tone: 'critical',
|
|
172
|
+
action: p.onRetry && { label: 'Retry', onClick: () => p.onRetry!() },
|
|
173
|
+
})
|
|
174
|
+
},
|
|
175
|
+
)
|
|
176
|
+
let sent = 0
|
|
177
|
+
watch(
|
|
178
|
+
() => Object.keys(p.form ? p.form.errors.value : (p.errors ?? {})).length,
|
|
179
|
+
(n) => {
|
|
180
|
+
if (n && n !== sent) focusInvalid()
|
|
181
|
+
sent = n
|
|
182
|
+
},
|
|
183
|
+
)
|
|
184
|
+
})
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** One step's form state: errors from all three sources, the mapped failure and its cooldown, its surfaces' side effects. */
|
|
188
|
+
export function useStepForm<V>(
|
|
189
|
+
p: FlowForm<V>,
|
|
190
|
+
check?: (values: Record<string, string>) => Record<string, string | undefined>,
|
|
191
|
+
) {
|
|
192
|
+
const own = state<Record<string, string>>({})
|
|
193
|
+
const failure = derived(() => {
|
|
194
|
+
const e = p.form ? p.form.message.value : p.error
|
|
195
|
+
return e
|
|
196
|
+
? mapFlowError(
|
|
197
|
+
e,
|
|
198
|
+
untrack(() => p.errorOptions),
|
|
199
|
+
)
|
|
200
|
+
: undefined
|
|
201
|
+
})
|
|
202
|
+
const errors = derived<Record<string, string>>(() => ({
|
|
203
|
+
...own.value,
|
|
204
|
+
...failure.value?.fields,
|
|
205
|
+
...(p.form ? p.form.errors.value : p.errors),
|
|
206
|
+
}))
|
|
207
|
+
const pending = derived(() => !!(p.form ? p.form.pending.value : p.pending))
|
|
208
|
+
const cooling = useCooldown(
|
|
209
|
+
() => failure.value?.retryAfter,
|
|
210
|
+
() => announce(document, 'You can try again now.'),
|
|
211
|
+
)
|
|
212
|
+
let root: HTMLElement | undefined
|
|
213
|
+
const focusInvalid = (say?: string) => {
|
|
214
|
+
flush()
|
|
215
|
+
root?.querySelector<HTMLElement>('[aria-invalid="true"]')?.focus()
|
|
216
|
+
if (say) announce(document, say)
|
|
217
|
+
}
|
|
218
|
+
watchStepFailure({ p, failure, root: () => root, focusInvalid })
|
|
219
|
+
const submit = (e: SubmitEvent) => {
|
|
220
|
+
e.preventDefault()
|
|
221
|
+
const f = e.currentTarget as HTMLFormElement
|
|
222
|
+
const values = Object.fromEntries(new FormData(f)) as Record<string, string>
|
|
223
|
+
const bad = Object.fromEntries(
|
|
224
|
+
Object.entries(check?.(values) ?? {}).filter(([, m]) => m),
|
|
225
|
+
) as Record<string, string>
|
|
226
|
+
own.value = bad
|
|
227
|
+
const n = Object.keys(bad).length
|
|
228
|
+
if (n) return focusInvalid(n > 1 ? `${n} fields need attention` : undefined)
|
|
229
|
+
p.onSubmit?.(values as V, e)
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
errors,
|
|
233
|
+
failure,
|
|
234
|
+
pending,
|
|
235
|
+
cooling,
|
|
236
|
+
submit,
|
|
237
|
+
/** Set one field's message from the client (format on blur), or clear it. */
|
|
238
|
+
flag(name: string, message: string | undefined) {
|
|
239
|
+
const { [name]: _, ...rest } = own.value
|
|
240
|
+
own.value = message ? { ...rest, [name]: message } : rest
|
|
241
|
+
},
|
|
242
|
+
bind(n: HTMLElement) {
|
|
243
|
+
root = n
|
|
244
|
+
},
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
export type StepForm = ReturnType<typeof useStepForm>
|
|
248
|
+
|
|
249
|
+
/** The step's frame: a <form> of its own, or a plain stack inside `<Form of>`. */
|
|
250
|
+
export function StepFrame({
|
|
251
|
+
ctl,
|
|
252
|
+
embedded,
|
|
253
|
+
labelledby,
|
|
254
|
+
children,
|
|
255
|
+
}: {
|
|
256
|
+
ctl: StepForm
|
|
257
|
+
embedded: boolean
|
|
258
|
+
labelledby?: string
|
|
259
|
+
children?: unknown
|
|
260
|
+
}) {
|
|
261
|
+
const plain = derived(() => embedded)
|
|
262
|
+
return (
|
|
263
|
+
<>
|
|
264
|
+
{plain.value ? (
|
|
265
|
+
<div ref={(n) => ctl.bind(n)} data-scope="stack" role="group" aria-labelledby={labelledby}>
|
|
266
|
+
{children}
|
|
267
|
+
</div>
|
|
268
|
+
) : (
|
|
269
|
+
<form
|
|
270
|
+
ref={(n) => ctl.bind(n)}
|
|
271
|
+
data-scope="stack"
|
|
272
|
+
novalidate
|
|
273
|
+
aria-labelledby={labelledby}
|
|
274
|
+
onSubmit={ctl.submit}
|
|
275
|
+
>
|
|
276
|
+
{children}
|
|
277
|
+
</form>
|
|
278
|
+
)}
|
|
279
|
+
</>
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** The failure at the top of the step (09 §1.3): the Alert takes focus; a rate limit counts down; offline is a Banner. */
|
|
284
|
+
export function FormError({ ctl, actions }: { ctl: StepForm; actions?: unknown }) {
|
|
285
|
+
const m = derived(() => ctl.failure.value)
|
|
286
|
+
return (
|
|
287
|
+
<div data-part="formerr" tabindex="-1">
|
|
288
|
+
{m.value?.surface === 'alert' && (
|
|
289
|
+
<Alert tone="critical" live title={m.value.title} actions={actions}>
|
|
290
|
+
{m.value.description}
|
|
291
|
+
</Alert>
|
|
292
|
+
)}
|
|
293
|
+
{m.value?.surface === 'rate-limit' && (
|
|
294
|
+
<Alert tone="caution" title={m.value.title}>
|
|
295
|
+
{ctl.cooling.value > 0 ? `Try again in ${ctl.cooling.value}s.` : 'You can try again now.'}
|
|
296
|
+
</Alert>
|
|
297
|
+
)}
|
|
298
|
+
{m.value?.surface === 'banner' && (
|
|
299
|
+
<Banner tone="caution" live={m.value.live}>
|
|
300
|
+
<b>{m.value.title}</b> {m.value.description}
|
|
301
|
+
</Banner>
|
|
302
|
+
)}
|
|
303
|
+
</div>
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** The one solid: keeps its label while pending; a rate limit disables it and says why. */
|
|
308
|
+
export function Submit({
|
|
309
|
+
ctl,
|
|
310
|
+
disabled,
|
|
311
|
+
children,
|
|
312
|
+
...rest
|
|
313
|
+
}: { ctl: StepForm; disabled?: boolean | undefined; children?: unknown } & ButtonProps) {
|
|
314
|
+
const wait = derived(() => ctl.cooling.value)
|
|
315
|
+
return (
|
|
316
|
+
<Button
|
|
317
|
+
type="submit"
|
|
318
|
+
size="lg"
|
|
319
|
+
full
|
|
320
|
+
loading={ctl.pending.value}
|
|
321
|
+
disabled={disabled || wait.value > 0}
|
|
322
|
+
{...rest}
|
|
323
|
+
>
|
|
324
|
+
{wait.value > 0 ? `Try again in ${wait.value}s` : children}
|
|
325
|
+
</Button>
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** A text button in a step's row. */
|
|
330
|
+
export const TextLink = ({ children, ...rest }: ButtonProps) => (
|
|
331
|
+
<Button emphasis="link" data-hit="text" {...rest}>
|
|
332
|
+
{children}
|
|
333
|
+
</Button>
|
|
334
|
+
)
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// @kerf-js/veneer: the kerf binding of veneer. Each component renders the spec's specimen markup with kerf's compiled
|
|
2
|
+
// templates and attaches veneer-core's behaviour; each imports only its own CSS (veneer-core/styles, split per component).
|
|
3
|
+
export { Stack, Row, Grid, Split, Center, Cover, Frame, Spacer, Inset, type Step } from './Layout'
|
|
4
|
+
export { Heading, Text, Link } from './Type'
|
|
5
|
+
export { Button, type ButtonProps, type Tone, type Emphasis } from './Button'
|
|
6
|
+
export { Toggle, type ToggleProps } from './Toggle'
|
|
7
|
+
export { Field, Input, Search, Textarea, type FieldProps } from './Field'
|
|
8
|
+
export { NumberField, type NumberFieldProps } from './NumberField'
|
|
9
|
+
export { CompactSelect, Select, type Option, type OptionGroup } from './Select'
|
|
10
|
+
export { MultiSelect, type MultiSelectProps } from './MultiSelect'
|
|
11
|
+
export {
|
|
12
|
+
Switch,
|
|
13
|
+
Checkbox,
|
|
14
|
+
Radio,
|
|
15
|
+
RadioGroup,
|
|
16
|
+
Segmented,
|
|
17
|
+
type SegmentedOption,
|
|
18
|
+
type RadioOption,
|
|
19
|
+
} from './Choice'
|
|
20
|
+
export { Slider, type SliderProps } from './Slider'
|
|
21
|
+
export { Accordion, type AccordionItem, type AccordionProps } from './Accordion'
|
|
22
|
+
export { Ticker, type TickerProps } from './Ticker'
|
|
23
|
+
export { Menu, type MenuEntry as MenuItem, type MenuProps } from './Menu'
|
|
24
|
+
export { Chip } from './Chip'
|
|
25
|
+
export { Tabs, type TabOption } from './Tabs'
|
|
26
|
+
export { Nav } from './Nav'
|
|
27
|
+
export { Card } from './Card'
|
|
28
|
+
export { Badge } from './Badge'
|
|
29
|
+
export { Tag } from './Tag'
|
|
30
|
+
export { Kbd } from './Kbd'
|
|
31
|
+
export { Alert } from './Alert'
|
|
32
|
+
export { Progress } from './Progress'
|
|
33
|
+
export { Spinner } from './Spinner'
|
|
34
|
+
export { Skeleton } from './Skeleton'
|
|
35
|
+
export { Shape } from './Shape'
|
|
36
|
+
export { Tooltip } from './Tooltip'
|
|
37
|
+
export { Popover } from './Popover'
|
|
38
|
+
export { Modal } from './Modal'
|
|
39
|
+
export { Drawer } from './Drawer'
|
|
40
|
+
export { HamburgerMenu, type HamburgerLink, type HamburgerMenuProps } from './HamburgerMenu'
|
|
41
|
+
export { Toaster, toast } from './Toast'
|
|
42
|
+
export {
|
|
43
|
+
Table,
|
|
44
|
+
type Column,
|
|
45
|
+
type TableProps,
|
|
46
|
+
type TableSort,
|
|
47
|
+
type TableStatus,
|
|
48
|
+
type ListPage,
|
|
49
|
+
} from './Table'
|
|
50
|
+
export {
|
|
51
|
+
DataGrid,
|
|
52
|
+
PivotTable,
|
|
53
|
+
type DataGridProps,
|
|
54
|
+
type GridColumn,
|
|
55
|
+
type GridView,
|
|
56
|
+
type GridTree,
|
|
57
|
+
type GridPaste,
|
|
58
|
+
type PivotMeasure,
|
|
59
|
+
} from './DataGrid'
|
|
60
|
+
export { PaginationBar, LoadMore, type PaginationBarProps } from './Pagination'
|
|
61
|
+
export {
|
|
62
|
+
CommandPalette,
|
|
63
|
+
type Command,
|
|
64
|
+
type CommandMode,
|
|
65
|
+
type CommandSource,
|
|
66
|
+
type CommandPaletteProps,
|
|
67
|
+
} from './CommandPalette'
|
|
68
|
+
export { MentionsInput, type MentionsInputProps } from './MentionsInput'
|
|
69
|
+
export { CodeBlock, Code, Snippet, type CodeBlockProps } from './CodeBlock'
|
|
70
|
+
export { CodeInput, JsonEditor, type CodeInputProps, type JsonEditorProps } from './CodeInput'
|
|
71
|
+
export { KeyValueEditor, type KeyValue, type KeyValueEditorProps } from './KeyValueEditor'
|
|
72
|
+
export { RichTextEditor, type RichTextEditorProps, type SlashCommand } from './RichTextEditor'
|
|
73
|
+
export { Markdown, MarkdownEditor, type MarkdownEditorProps } from './Markdown'
|
|
74
|
+
export {
|
|
75
|
+
Shell,
|
|
76
|
+
type ShellProps,
|
|
77
|
+
type NavItem,
|
|
78
|
+
type NavGroup,
|
|
79
|
+
type NavIcon,
|
|
80
|
+
type Crumb,
|
|
81
|
+
type MenuEntry,
|
|
82
|
+
type Workspace,
|
|
83
|
+
} from './Shell'
|
|
84
|
+
/** A docs sidebar: one left panel whose sections fold and remember; docked from 900px, opened over the page on phones. */
|
|
85
|
+
export { SideNav, type SideNavProps, type SideNavSection, type SideNavLink } from './SideNav'
|
|
86
|
+
export { SideNavTitle, type SideNavTitleProps } from './SideNavTitle'
|
|
87
|
+
export { Presence, type PresenceMotion, type PresenceProps } from './Presence'
|
|
88
|
+
export { ScrollRail } from './ScrollRail'
|
|
89
|
+
export { TabBar, type TabBarItem } from './TabBar'
|
|
90
|
+
export { ScrollView, type ScrollViewProps } from './ScrollView'
|
|
91
|
+
export { Icon, type IconName, type IconRef } from './Icon'
|
|
92
|
+
export { Chart, type ChartFrame } from './Chart'
|
|
93
|
+
export {
|
|
94
|
+
LineChart,
|
|
95
|
+
BarChart,
|
|
96
|
+
ComboChart,
|
|
97
|
+
DonutChart,
|
|
98
|
+
RadialChart,
|
|
99
|
+
FunnelChart,
|
|
100
|
+
ScatterChart,
|
|
101
|
+
BubbleChart,
|
|
102
|
+
Histogram,
|
|
103
|
+
HeatGrid,
|
|
104
|
+
RadarChart,
|
|
105
|
+
Treemap,
|
|
106
|
+
Sunburst,
|
|
107
|
+
SankeyChart,
|
|
108
|
+
CandlestickChart,
|
|
109
|
+
BoxPlot,
|
|
110
|
+
WaterfallChart,
|
|
111
|
+
StreamChart,
|
|
112
|
+
BrushChart,
|
|
113
|
+
TileMap,
|
|
114
|
+
GaugeChart,
|
|
115
|
+
Sparkline,
|
|
116
|
+
} from './Charts'
|
|
117
|
+
export { type Bindable, type Openable } from './Picker'
|
|
118
|
+
export { InlineCalendar } from './Calendar'
|
|
119
|
+
export {
|
|
120
|
+
DateField,
|
|
121
|
+
DateRangeField,
|
|
122
|
+
compareRange,
|
|
123
|
+
type DateFieldProps,
|
|
124
|
+
type DateRangeFieldProps,
|
|
125
|
+
} from './DateField'
|
|
126
|
+
export { TimeField, DateTimeField, type TimeFieldProps, type DateTimeFieldProps } from './TimeField'
|
|
127
|
+
export {
|
|
128
|
+
MonthPicker,
|
|
129
|
+
WeekPicker,
|
|
130
|
+
PeriodPicker,
|
|
131
|
+
type MonthPickerProps,
|
|
132
|
+
type WeekPickerProps,
|
|
133
|
+
type PeriodPickerProps,
|
|
134
|
+
} from './MonthPicker'
|
|
135
|
+
export {
|
|
136
|
+
TimeZoneSelect,
|
|
137
|
+
CountrySelect,
|
|
138
|
+
LanguageSelect,
|
|
139
|
+
CurrencySelect,
|
|
140
|
+
PhoneField,
|
|
141
|
+
type TimeZoneSelectProps,
|
|
142
|
+
type PhoneFieldProps,
|
|
143
|
+
} from './RichSelect'
|
|
144
|
+
export { DurationField, type DurationFieldProps } from './DurationField'
|
|
145
|
+
export { RecurrenceField, type RecurrenceFieldProps } from './RecurrenceField'
|
|
146
|
+
export {
|
|
147
|
+
PlaceLookupInput,
|
|
148
|
+
AddressField,
|
|
149
|
+
type Place,
|
|
150
|
+
type PlaceBias,
|
|
151
|
+
type PlaceLookupInputProps,
|
|
152
|
+
type AddressFieldProps,
|
|
153
|
+
type AddressProvider,
|
|
154
|
+
} from './PlaceField'
|
|
155
|
+
export {
|
|
156
|
+
PaymentCardInput,
|
|
157
|
+
CardNumberText,
|
|
158
|
+
type PaymentCardInputProps,
|
|
159
|
+
type ProviderField,
|
|
160
|
+
type ProviderAppearance,
|
|
161
|
+
type CardNumberTextProps,
|
|
162
|
+
} from './PaymentCard'
|
|
163
|
+
export { SignaturePad, type SignaturePadProps, type SignatureValue } from './SignaturePad'
|
|
164
|
+
export {
|
|
165
|
+
Canvas,
|
|
166
|
+
CanvasStage,
|
|
167
|
+
StageSelect,
|
|
168
|
+
type CanvasProps,
|
|
169
|
+
type CanvasStageProps,
|
|
170
|
+
type StageOption,
|
|
171
|
+
type StageSelectProps,
|
|
172
|
+
type Frame as CanvasFrame,
|
|
173
|
+
type Press,
|
|
174
|
+
type Scene,
|
|
175
|
+
type Scroll,
|
|
176
|
+
type StageLayout,
|
|
177
|
+
type StagePainter,
|
|
178
|
+
type StagePiece,
|
|
179
|
+
type Word,
|
|
180
|
+
} from './Canvas'
|
|
181
|
+
export {
|
|
182
|
+
Dither,
|
|
183
|
+
DitherField,
|
|
184
|
+
DitherGlyph,
|
|
185
|
+
DitherStage,
|
|
186
|
+
LEVEL,
|
|
187
|
+
PAINTERS,
|
|
188
|
+
type DitherProps,
|
|
189
|
+
type DitherFieldProps,
|
|
190
|
+
type DitherGlyphProps,
|
|
191
|
+
type DitherStageProps,
|
|
192
|
+
type Algorithm,
|
|
193
|
+
type Brush,
|
|
194
|
+
type Cells,
|
|
195
|
+
type Line,
|
|
196
|
+
type DitherPainter,
|
|
197
|
+
type DitherPiece,
|
|
198
|
+
type FieldFn,
|
|
199
|
+
type FieldName,
|
|
200
|
+
type Gradient,
|
|
201
|
+
type MaskSource,
|
|
202
|
+
type Pattern,
|
|
203
|
+
type PointerMode,
|
|
204
|
+
type Ramp,
|
|
205
|
+
type Skin,
|
|
206
|
+
} from './Dither'
|
|
207
|
+
export * from './agent/index'
|
|
208
|
+
export * from './schedule/index'
|
|
209
|
+
export * from './live/index'
|
|
210
|
+
export * from './collab/index'
|
|
211
|
+
export { Thread, Kanban } from './collab/index' // the one chat and the one board: both are windows (VirtualList)
|
|
212
|
+
export * from './flow/index'
|
|
213
|
+
export * from './admin/index'
|
|
214
|
+
export { VirtualList, type VirtualListProps, type VirtualControl } from './VirtualList'
|
|
215
|
+
export { Feed, type FeedProps, type FeedItem } from './Feed'
|
|
216
|
+
export { ScrollGrid, type ScrollGridProps, type GridColumn as ScrollGridColumn } from './ScrollGrid'
|
|
217
|
+
export type { Address, MentionItem } from '@kerf-js/veneer-core'
|
|
218
|
+
export type {
|
|
219
|
+
Peer,
|
|
220
|
+
CursorPeer,
|
|
221
|
+
IntegrityStats,
|
|
222
|
+
ChatMessage,
|
|
223
|
+
MessageReaction,
|
|
224
|
+
} from '@kerf-js/veneer-core'
|
|
225
|
+
export type {
|
|
226
|
+
IsoDate,
|
|
227
|
+
IsoTime,
|
|
228
|
+
IsoDateTime,
|
|
229
|
+
IsoMonth,
|
|
230
|
+
IsoWeek,
|
|
231
|
+
IsoDuration,
|
|
232
|
+
IsoZoned,
|
|
233
|
+
TimeZoneId,
|
|
234
|
+
DateRange,
|
|
235
|
+
ChangeReason,
|
|
236
|
+
} from '@kerf-js/veneer-core'
|
|
237
|
+
export { sweep, setDial, getDial, setPalette, getPalette } from '@kerf-js/veneer-core'
|
package/src/layout.css
ADDED
package/src/links.css
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/* A bare `<a>` is never the browser's blue: veneer's link ink and hairline underline (05 §4), in veneer.base so every component's own link and app CSS win. */
|
|
2
|
+
@layer veneer.base {
|
|
3
|
+
:where(a:any-link) { color: var(--veneer-color-accent-text); text-decoration-thickness: var(--veneer-border-hairline); text-underline-offset: 0.22em; }
|
|
4
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { arrivals, groupByDay, uid } from '@kerf-js/veneer-core'
|
|
2
|
+
import { derived } from '@kerf-js/core'
|
|
3
|
+
import { Avatar, type LiveState } from '../parts'
|
|
4
|
+
import { use } from '@kerf-js/veneer-core/kerf'
|
|
5
|
+
import { avatarTint, G, val } from './shared'
|
|
6
|
+
import '../styles'
|
|
7
|
+
import '@kerf-js/veneer-core/styles/app/base.css'
|
|
8
|
+
import '@kerf-js/veneer-core/styles/app/activity.css'
|
|
9
|
+
import '@kerf-js/veneer-core/styles/app/activity-feed.css'
|
|
10
|
+
import '@kerf-js/veneer-core/styles/app/sync.css'
|
|
11
|
+
|
|
12
|
+
/** One line of the activity feed. */
|
|
13
|
+
export interface ActivityItem {
|
|
14
|
+
id: string
|
|
15
|
+
actor: string
|
|
16
|
+
verb: string
|
|
17
|
+
object?: string
|
|
18
|
+
detail?: string
|
|
19
|
+
time: string
|
|
20
|
+
datetime?: string
|
|
21
|
+
day?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Activity feed (07 §4.2): actor, verb, object, time, grouped per day on a hairline spine, the quiet sibling of the inbox
|
|
26
|
+
* row. The header shows a "Live" check while `live` is live; new ids arrive.
|
|
27
|
+
*/
|
|
28
|
+
export function ActivityFeed({
|
|
29
|
+
items,
|
|
30
|
+
live,
|
|
31
|
+
title = 'Activity',
|
|
32
|
+
level = 3,
|
|
33
|
+
}: {
|
|
34
|
+
items: ActivityItem[] | { value: ActivityItem[] } | (() => ActivityItem[])
|
|
35
|
+
live?: LiveState | { value: LiveState } | (() => LiveState) | undefined
|
|
36
|
+
title?: string
|
|
37
|
+
/** The title's heading level: one below the heading the feed sits under. */ level?:
|
|
38
|
+
| 2
|
|
39
|
+
| 3
|
|
40
|
+
| 4
|
|
41
|
+
| 5
|
|
42
|
+
| 6
|
|
43
|
+
}) {
|
|
44
|
+
const id = uid('activity')
|
|
45
|
+
const data = derived(() => val<ActivityItem[]>(items) ?? [])
|
|
46
|
+
const days = derived(() => groupByDay(data.value))
|
|
47
|
+
const many = derived(() => days.value.length > 1 || data.value.some((n) => n.day))
|
|
48
|
+
const on = derived(() => val<LiveState | undefined>(live) === 'live')
|
|
49
|
+
let root: HTMLElement | undefined
|
|
50
|
+
use(
|
|
51
|
+
arrivals,
|
|
52
|
+
() => root,
|
|
53
|
+
() => ({ items: '[data-scope="activity"] > li', ids: data.value.map((n) => n.id) }),
|
|
54
|
+
)
|
|
55
|
+
return (
|
|
56
|
+
<section ref={(n) => (root = n)} data-scope="activity-feed" aria-labelledby={`${id}-t`}>
|
|
57
|
+
<header>
|
|
58
|
+
<h3 id={`${id}-t`} aria-level={level === 3 ? undefined : level}>
|
|
59
|
+
{title}
|
|
60
|
+
</h3>
|
|
61
|
+
{on.value && (
|
|
62
|
+
<span data-scope="sync" data-state="saved">
|
|
63
|
+
<G name="check" /> Live
|
|
64
|
+
</span>
|
|
65
|
+
)}
|
|
66
|
+
</header>
|
|
67
|
+
{days.value.map((g) => (
|
|
68
|
+
<div key={g.day}>
|
|
69
|
+
{many.value && <span data-part="eyebrow">{g.day}</span>}
|
|
70
|
+
<ol data-scope="activity">
|
|
71
|
+
{g.rows.map((n) => (
|
|
72
|
+
<li key={n.id} data-id={n.id}>
|
|
73
|
+
<Avatar name={n.actor} size="sm" style={avatarTint(n.actor)} />
|
|
74
|
+
<span>
|
|
75
|
+
<b>{n.actor}</b> {n.verb}
|
|
76
|
+
{n.object ? ' ' : ''}
|
|
77
|
+
{n.object && <b>{n.object}</b>}
|
|
78
|
+
{n.detail ? ` ${n.detail}` : ''}
|
|
79
|
+
</span>
|
|
80
|
+
<time datetime={n.datetime}>{n.time}</time>
|
|
81
|
+
</li>
|
|
82
|
+
))}
|
|
83
|
+
</ol>
|
|
84
|
+
</div>
|
|
85
|
+
))}
|
|
86
|
+
</section>
|
|
87
|
+
)
|
|
88
|
+
}
|