@kerfjs/ui 4.4.1 → 4.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +425 -42
- package/ai/application-ui-diagnostic-ids-v1.json +92 -0
- package/ai/application-ui-profile-sync.cjs +529 -0
- package/ai/application-ui-profile.d.mts +1 -0
- package/ai/application-ui-profile.d.ts +102 -0
- package/ai/application-ui-profile.defaults.json +41 -0
- package/ai/application-ui-profile.mjs +626 -0
- package/ai/application-ui-profile.schema.json +130 -0
- package/ai/catalog-authoring.json +25 -0
- package/ai/catalog-authoring.schema.json +61 -0
- package/ai/compile-time-contracts-v1.json +102 -0
- package/ai/compile-time-contracts-v1.schema.json +49 -0
- package/ai/component-catalog-extension-v2.d.ts +7 -0
- package/ai/component-catalog-extension-v2.schema.json +7 -0
- package/ai/component-catalog-extension.schema.json +79 -0
- package/ai/component-catalog-v2-overrides.json +319 -0
- package/ai/component-catalog-v2.d.ts +67 -0
- package/ai/component-catalog-v2.json +4675 -0
- package/ai/component-catalog-v2.schema.json +246 -0
- package/ai/component-catalog.json +5826 -0
- package/ai/component-catalog.schema.json +95 -0
- package/ai/public-api-signatures-v1.md +1719 -0
- package/ai/skill.md +129 -21
- package/ai/webawesome-jsx-signatures-v1.md +106 -0
- package/analyzer/cli.mjs +46 -0
- package/analyzer/index.d.mts +45 -0
- package/analyzer/index.mjs +737 -0
- package/analyzer/report.schema.json +66 -0
- package/dist/app-tab.d.ts +14 -2
- package/dist/app-tab.js +3 -1
- package/dist/browser/app-tab.js +3 -2
- package/dist/browser/disclosure-arrow.js +4 -0
- package/dist/browser/empty-state.js +3 -3
- package/dist/browser/floating-toolbar.js +3 -0
- package/dist/browser/list-action-row.js +4 -0
- package/dist/browser/list-header.js +6 -0
- package/dist/browser/list-inset-control.js +3 -0
- package/dist/browser/list-inset-text.js +3 -0
- package/dist/browser/list-item.js +4 -0
- package/dist/browser/list.js +3 -0
- package/dist/browser/loading-spinner.js +2 -2
- package/dist/browser/lucide-icon.js +2 -2
- package/dist/browser/pane.js +3 -0
- package/dist/browser/panel-header.js +7 -0
- package/dist/browser/resizable-region.js +2 -2
- package/dist/browser/segmented-control.js +3 -2
- package/dist/browser/select.js +4 -3
- package/dist/browser/skeleton.js +3 -0
- package/dist/browser/state-banner.js +3 -2
- package/dist/browser/sunken-panel.js +3 -0
- package/dist/browser/tab-bar.js +2 -2
- package/dist/browser/token-search-field.js +4 -0
- package/dist/browser/toolbar-control-group.js +2 -2
- package/dist/browser/toolbar-text.js +3 -2
- package/dist/browser/toolbar.js +2 -2
- package/dist/browser/value-table.js +3 -2
- package/dist/catalog-resources.d.ts +34 -0
- package/dist/catalog-resources.js +22 -0
- package/dist/catalog-resources.js.map +1 -0
- package/dist/catalog.d.ts +150 -0
- package/dist/catalog.js +377 -0
- package/dist/catalog.js.map +1 -0
- package/dist/chunk-5VTB2BKP.js +35 -0
- package/dist/chunk-5VTB2BKP.js.map +1 -0
- package/dist/chunk-6WTETUZ6.js +21 -0
- package/dist/chunk-6WTETUZ6.js.map +1 -0
- package/dist/chunk-7KEUJIIC.js +218 -0
- package/dist/chunk-7KEUJIIC.js.map +1 -0
- package/dist/chunk-7XRDUG4Y.js +58 -0
- package/dist/chunk-7XRDUG4Y.js.map +1 -0
- package/dist/chunk-B3A3IVO5.js +83 -0
- package/dist/chunk-B3A3IVO5.js.map +1 -0
- package/dist/chunk-DPDBVKNA.js +113 -0
- package/dist/chunk-DPDBVKNA.js.map +1 -0
- package/dist/chunk-FEAMR7S4.js +68 -0
- package/dist/chunk-FEAMR7S4.js.map +1 -0
- package/dist/chunk-FEY65TBV.js +15 -0
- package/dist/chunk-FEY65TBV.js.map +1 -0
- package/dist/{chunk-TRNBHPNW.js → chunk-IJBSZ4NX.js} +11 -8
- package/dist/chunk-IJBSZ4NX.js.map +1 -0
- package/dist/chunk-J5BFYY7Q.js +35 -0
- package/dist/chunk-J5BFYY7Q.js.map +1 -0
- package/dist/chunk-JRKSK2HX.js +79 -0
- package/dist/chunk-JRKSK2HX.js.map +1 -0
- package/dist/chunk-KWWR5VMS.js +45 -0
- package/dist/chunk-KWWR5VMS.js.map +1 -0
- package/dist/chunk-LPOMRC4C.js +25 -0
- package/dist/chunk-LPOMRC4C.js.map +1 -0
- package/dist/chunk-M7JBER5U.js +41 -0
- package/dist/chunk-M7JBER5U.js.map +1 -0
- package/dist/chunk-NENBUYX5.js +79 -0
- package/dist/chunk-NENBUYX5.js.map +1 -0
- package/dist/chunk-NWSEP5RT.js +117 -0
- package/dist/chunk-NWSEP5RT.js.map +1 -0
- package/dist/chunk-OJWWHFH3.js +426 -0
- package/dist/chunk-OJWWHFH3.js.map +1 -0
- package/dist/chunk-PSKN344N.js +114 -0
- package/dist/chunk-PSKN344N.js.map +1 -0
- package/dist/chunk-PX3YSS5C.js +32 -0
- package/dist/chunk-PX3YSS5C.js.map +1 -0
- package/dist/chunk-QO55FN2Y.js +20 -0
- package/dist/chunk-QO55FN2Y.js.map +1 -0
- package/dist/chunk-R7ZWUN64.js +38 -0
- package/dist/chunk-R7ZWUN64.js.map +1 -0
- package/dist/chunk-RKVQEH4J.js +61 -0
- package/dist/chunk-RKVQEH4J.js.map +1 -0
- package/dist/chunk-SRSJO5QE.js +40 -0
- package/dist/chunk-SRSJO5QE.js.map +1 -0
- package/dist/chunk-SYDMYBPG.js +31 -0
- package/dist/chunk-SYDMYBPG.js.map +1 -0
- package/dist/chunk-TB6DY7H5.js +25 -0
- package/dist/chunk-TB6DY7H5.js.map +1 -0
- package/dist/chunk-UFZKLBCF.js +108 -0
- package/dist/chunk-UFZKLBCF.js.map +1 -0
- package/dist/{chunk-MQIZAD4A.js → chunk-UKKSMZYT.js} +76 -22
- package/dist/chunk-UKKSMZYT.js.map +1 -0
- package/dist/chunk-W5L2JSBY.js +40 -0
- package/dist/chunk-W5L2JSBY.js.map +1 -0
- package/dist/chunk-Y45PPBDV.js +105 -0
- package/dist/chunk-Y45PPBDV.js.map +1 -0
- package/dist/chunk-Y6LYKFXY.js +43 -0
- package/dist/chunk-Y6LYKFXY.js.map +1 -0
- package/dist/collapsible-panel.d.ts +66 -0
- package/dist/collapsible-panel.js +63 -0
- package/dist/collapsible-panel.js.map +1 -0
- package/dist/device-class.d.ts +62 -0
- package/dist/device-class.js +103 -0
- package/dist/device-class.js.map +1 -0
- package/dist/disclosure-arrow.d.ts +14 -0
- package/dist/disclosure-arrow.js +4 -0
- package/dist/disclosure-arrow.js.map +1 -0
- package/dist/divider-sides-267FA7sY.d.ts +4 -0
- package/dist/empty-state.d.ts +1 -1
- package/dist/empty-state.js +1 -1
- package/dist/floating-toolbar.d.ts +28 -0
- package/dist/floating-toolbar.js +3 -0
- package/dist/floating-toolbar.js.map +1 -0
- package/dist/index.d.ts +20 -9
- package/dist/index.js +29 -18
- package/dist/list-action-row.d.ts +52 -0
- package/dist/list-action-row.js +5 -0
- package/dist/list-action-row.js.map +1 -0
- package/dist/list-header.d.ts +64 -0
- package/dist/list-header.js +7 -0
- package/dist/list-header.js.map +1 -0
- package/dist/list-inset-control.d.ts +16 -0
- package/dist/list-inset-control.js +3 -0
- package/dist/list-inset-control.js.map +1 -0
- package/dist/list-inset-text.d.ts +25 -0
- package/dist/list-inset-text.js +3 -0
- package/dist/list-inset-text.js.map +1 -0
- package/dist/list-item.d.ts +33 -0
- package/dist/list-item.js +5 -0
- package/dist/list-item.js.map +1 -0
- package/dist/list.d.ts +19 -0
- package/dist/list.js +3 -0
- package/dist/list.js.map +1 -0
- package/dist/loading-spinner.js +1 -1
- package/dist/nav-stack.d.ts +38 -0
- package/dist/nav-stack.js +5 -0
- package/dist/nav-stack.js.map +1 -0
- package/dist/pane.d.ts +49 -0
- package/dist/pane.js +4 -0
- package/dist/pane.js.map +1 -0
- package/dist/panel-header.d.ts +42 -0
- package/dist/panel-header.js +7 -0
- package/dist/panel-header.js.map +1 -0
- package/dist/resizable-region.d.ts +3 -1
- package/dist/resizable-region.js +1 -1
- package/dist/segmented-control.d.ts +8 -6
- package/dist/segmented-control.js +2 -1
- package/dist/select-register.d.ts +5 -1
- package/dist/select-register.js +3 -0
- package/dist/select-register.js.map +1 -1
- package/dist/select.d.ts +15 -6
- package/dist/select.js +2 -1
- package/dist/skeleton.d.ts +24 -0
- package/dist/skeleton.js +3 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/split-view.d.ts +42 -0
- package/dist/split-view.js +81 -0
- package/dist/split-view.js.map +1 -0
- package/dist/state-banner.d.ts +8 -3
- package/dist/state-banner.js +2 -1
- package/dist/styles/app-tab.css +152 -0
- package/dist/styles/catalog.css +575 -0
- package/dist/styles/collapsible-panel.css +146 -0
- package/dist/styles/disclosure-arrow.css +23 -0
- package/dist/styles/empty-state.css +47 -0
- package/dist/styles/floating-toolbar.css +38 -0
- package/dist/styles/foundation.css +362 -0
- package/dist/styles/layout.css +55 -0
- package/dist/styles/list-action-row.css +160 -0
- package/dist/styles/list-header.css +160 -0
- package/dist/styles/list-inset-control.css +7 -0
- package/dist/styles/list-inset-text.css +14 -0
- package/dist/styles/list-item.css +123 -0
- package/dist/styles/list.css +43 -0
- package/dist/styles/loading-spinner.css +21 -0
- package/dist/styles/lucide-icon.css +6 -0
- package/dist/styles/nav-stack.css +111 -0
- package/dist/styles/pane.css +62 -0
- package/dist/styles/panel-header.css +64 -0
- package/dist/styles/resizable-region.css +111 -0
- package/{src → dist/styles}/segmented-control.css +58 -31
- package/dist/styles/select.css +140 -0
- package/dist/styles/skeleton.css +31 -0
- package/dist/styles/split-view.css +35 -0
- package/dist/styles/state-banner.css +198 -0
- package/dist/styles/styles.css +24 -0
- package/dist/styles/sunken-panel.css +22 -0
- package/dist/styles/tab-bar.css +45 -0
- package/dist/styles/tab-scaffold.css +84 -0
- package/dist/styles/token-search-field.css +289 -0
- package/dist/styles/toolbar-control-group.css +225 -0
- package/dist/styles/toolbar-text.css +92 -0
- package/dist/styles/toolbar.css +97 -0
- package/dist/styles/value-table.css +75 -0
- package/dist/styles/webawesome.css +399 -0
- package/dist/styles/workbench.css +94 -0
- package/dist/sunken-panel.d.ts +19 -0
- package/dist/sunken-panel.js +3 -0
- package/dist/sunken-panel.js.map +1 -0
- package/dist/tab-bar.d.ts +10 -2
- package/dist/tab-bar.js +1 -1
- package/dist/tab-scaffold.d.ts +30 -0
- package/dist/tab-scaffold.js +51 -0
- package/dist/tab-scaffold.js.map +1 -0
- package/dist/token-search-field.d.ts +59 -0
- package/dist/token-search-field.js +4 -0
- package/dist/token-search-field.js.map +1 -0
- package/dist/toolbar-control-group.d.ts +11 -5
- package/dist/toolbar-control-group.js +1 -1
- package/dist/toolbar-text.d.ts +31 -4
- package/dist/toolbar-text.js +2 -1
- package/dist/toolbar.d.ts +5 -3
- package/dist/toolbar.js +1 -1
- package/dist/value-table.d.ts +13 -3
- package/dist/value-table.js +2 -1
- package/dist/webawesome.d.ts +100 -0
- package/dist/webawesome.js +3 -0
- package/dist/webawesome.js.map +1 -0
- package/dist/wire-catalog.d.ts +57 -0
- package/dist/wire-catalog.js +302 -0
- package/dist/wire-catalog.js.map +1 -0
- package/dist/wire-nav-stack.d.ts +15 -0
- package/dist/wire-nav-stack.js +103 -0
- package/dist/wire-nav-stack.js.map +1 -0
- package/dist/wire-resizable-regions.d.ts +1 -1
- package/dist/wire-resizable-regions.js +1 -1
- package/dist/wire-sidebar.d.ts +43 -0
- package/dist/wire-sidebar.js +128 -0
- package/dist/wire-sidebar.js.map +1 -0
- package/dist/wire-tab-bars.d.ts +18 -2
- package/dist/wire-tab-bars.js +1 -1
- package/dist/wire-tab-scaffold.d.ts +11 -0
- package/dist/wire-tab-scaffold.js +21 -0
- package/dist/wire-tab-scaffold.js.map +1 -0
- package/dist/wire-token-search-fields.d.ts +111 -0
- package/dist/wire-token-search-fields.js +5 -0
- package/dist/wire-token-search-fields.js.map +1 -0
- package/dist/workbench.d.ts +33 -0
- package/dist/workbench.js +64 -0
- package/dist/workbench.js.map +1 -0
- package/docs/accessibility.md +124 -4
- package/docs/app-layouts.md +61 -0
- package/docs/catalog.md +364 -0
- package/docs/collapsible-panel.md +129 -0
- package/docs/component-contract.md +312 -5
- package/docs/component-selection.md +219 -0
- package/docs/design/templates/empty-state/filtered-dark.svg +1 -0
- package/docs/design/templates/empty-state/filtered.svg +1 -0
- package/docs/design/templates/empty-state/with-action-dark.svg +1 -0
- package/docs/design/templates/empty-state/with-action.svg +1 -0
- package/docs/design/templates/empty-state-dark.svg +1 -0
- package/docs/design/templates/empty-state.svg +1 -0
- package/docs/design/templates/list/compact-dark.svg +1 -0
- package/docs/design/templates/list/compact.svg +1 -0
- package/docs/design/templates/list/stack-dark.svg +1 -0
- package/docs/design/templates/list/stack.svg +1 -0
- package/docs/design/templates/list-action-row/default-dark.svg +1 -0
- package/docs/design/templates/list-action-row/default.svg +1 -0
- package/docs/design/templates/list-action-row/selected-dark.svg +1 -0
- package/docs/design/templates/list-action-row/selected.svg +1 -0
- package/docs/design/templates/list-action-row-dark.svg +1 -0
- package/docs/design/templates/list-action-row.svg +1 -0
- package/docs/design/templates/list-dark.svg +1 -0
- package/docs/design/templates/list-header/action-dark.svg +1 -0
- package/docs/design/templates/list-header/action.svg +1 -0
- package/docs/design/templates/list-header/count-dark.svg +1 -0
- package/docs/design/templates/list-header/count.svg +1 -0
- package/docs/design/templates/list-header/toggle-collapsed-dark.svg +1 -0
- package/docs/design/templates/list-header/toggle-collapsed.svg +1 -0
- package/docs/design/templates/list-header/toggle-expanded-dark.svg +1 -0
- package/docs/design/templates/list-header/toggle-expanded.svg +1 -0
- package/docs/design/templates/list-header-dark.svg +1 -0
- package/docs/design/templates/list-header.svg +1 -0
- package/docs/design/templates/list-item/default-dark.svg +1 -0
- package/docs/design/templates/list-item/default.svg +1 -0
- package/docs/design/templates/list-item/multiline-dark.svg +1 -0
- package/docs/design/templates/list-item/multiline.svg +1 -0
- package/docs/design/templates/list-item/selected-dark.svg +1 -0
- package/docs/design/templates/list-item/selected.svg +1 -0
- package/docs/design/templates/list-item/trailing-dark.svg +1 -0
- package/docs/design/templates/list-item/trailing.svg +1 -0
- package/docs/design/templates/list-item-dark.svg +1 -0
- package/docs/design/templates/list-item.svg +1 -0
- package/docs/design/templates/list.svg +1 -0
- package/docs/design/templates/panel-header/icon-actions-dark.svg +1 -0
- package/docs/design/templates/panel-header/icon-actions.svg +1 -0
- package/docs/design/templates/panel-header/icon-summary-actions-dark.svg +1 -0
- package/docs/design/templates/panel-header/icon-summary-actions.svg +1 -0
- package/docs/design/templates/panel-header/no-icon-dark.svg +1 -0
- package/docs/design/templates/panel-header/no-icon.svg +1 -0
- package/docs/design/templates/panel-header/page-heading-dark.svg +1 -0
- package/docs/design/templates/panel-header/page-heading.svg +1 -0
- package/docs/design/templates/panel-header/title-only-dark.svg +1 -0
- package/docs/design/templates/panel-header/title-only.svg +1 -0
- package/docs/design/templates/panel-header-dark.svg +1 -0
- package/docs/design/templates/panel-header.svg +1 -0
- package/docs/design/templates/segmented-control/equal-dark.svg +1 -0
- package/docs/design/templates/segmented-control/equal.svg +1 -0
- package/docs/design/templates/segmented-control/pill-small-dark.svg +1 -0
- package/docs/design/templates/segmented-control/pill-small.svg +1 -0
- package/docs/design/templates/segmented-control-dark.svg +1 -0
- package/docs/design/templates/segmented-control.svg +1 -0
- package/docs/design/templates/skeleton/avatar-dark.svg +1 -0
- package/docs/design/templates/skeleton/avatar.svg +1 -0
- package/docs/design/templates/skeleton/block-dark.svg +1 -0
- package/docs/design/templates/skeleton/block.svg +1 -0
- package/docs/design/templates/skeleton/lines-dark.svg +1 -0
- package/docs/design/templates/skeleton/lines.svg +1 -0
- package/docs/design/templates/skeleton-dark.svg +1 -0
- package/docs/design/templates/skeleton.svg +1 -0
- package/docs/design/templates/state-banner/danger-dark.svg +1 -0
- package/docs/design/templates/state-banner/danger.svg +1 -0
- package/docs/design/templates/state-banner/info-badge-dark.svg +1 -0
- package/docs/design/templates/state-banner/info-badge.svg +1 -0
- package/docs/design/templates/state-banner/info-dark.svg +1 -0
- package/docs/design/templates/state-banner/info.svg +1 -0
- package/docs/design/templates/state-banner/success-dark.svg +1 -0
- package/docs/design/templates/state-banner/success.svg +1 -0
- package/docs/design/templates/state-banner/warning-dark.svg +1 -0
- package/docs/design/templates/state-banner/warning.svg +1 -0
- package/docs/design/templates/state-banner-dark.svg +1 -0
- package/docs/design/templates/state-banner.svg +1 -0
- package/docs/design/templates/tab-bar/workspace-tabs-dark.svg +1 -0
- package/docs/design/templates/tab-bar/workspace-tabs.svg +1 -0
- package/docs/design/templates/tab-bar-dark.svg +1 -0
- package/docs/design/templates/tab-bar.svg +1 -0
- package/docs/design/templates/token-search-field/empty-dark.svg +1 -0
- package/docs/design/templates/token-search-field/empty.svg +1 -0
- package/docs/design/templates/token-search-field/tokens-dark.svg +1 -0
- package/docs/design/templates/token-search-field/tokens.svg +1 -0
- package/docs/design/templates/token-search-field-dark.svg +1 -0
- package/docs/design/templates/token-search-field.svg +1 -0
- package/docs/design/templates/toolbar/title-and-actions-dark.svg +1 -0
- package/docs/design/templates/toolbar/title-and-actions.svg +1 -0
- package/docs/design/templates/toolbar-control-group/borderless-single-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group/borderless-single.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-buttons-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-buttons.svg +1 -0
- package/docs/design/templates/toolbar-control-group/push-buttons-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group/push-buttons.svg +1 -0
- package/docs/design/templates/toolbar-control-group/with-text-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group/with-text.svg +1 -0
- package/docs/design/templates/toolbar-control-group-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group.svg +1 -0
- package/docs/design/templates/toolbar-dark.svg +1 -0
- package/docs/design/templates/toolbar-text/default-dark.svg +1 -0
- package/docs/design/templates/toolbar-text/default.svg +1 -0
- package/docs/design/templates/toolbar-text/large-dark.svg +1 -0
- package/docs/design/templates/toolbar-text/large.svg +1 -0
- package/docs/design/templates/toolbar-text/small-dark.svg +1 -0
- package/docs/design/templates/toolbar-text/small.svg +1 -0
- package/docs/design/templates/toolbar-text-dark.svg +1 -0
- package/docs/design/templates/toolbar-text.svg +1 -0
- package/docs/design/templates/toolbar.svg +1 -0
- package/docs/design/templates/value-table/details-dark.svg +1 -0
- package/docs/design/templates/value-table/details.svg +1 -0
- package/docs/design/templates/value-table-dark.svg +1 -0
- package/docs/design/templates/value-table.svg +1 -0
- package/docs/design/templates.md +130 -0
- package/docs/design-philosophy.md +59 -1
- package/docs/device-class.md +54 -0
- package/docs/examples/application-ui-profile.json +60 -0
- package/docs/examples/command-palette-adapter.tsx +120 -0
- package/docs/examples/component-catalog-extension-v2.json +81 -0
- package/docs/examples/component-catalog-extension.json +45 -0
- package/docs/layout.md +150 -0
- package/docs/nav-stack.md +56 -0
- package/docs/recipes.md +167 -0
- package/docs/split-view.md +49 -0
- package/docs/sunken-panel.md +53 -0
- package/docs/tab-scaffold.md +50 -0
- package/docs/type-contracts.md +102 -0
- package/docs/ui-analyzer.md +86 -0
- package/docs/ui-doctor.md +84 -0
- package/docs/ui-evaluator.md +122 -0
- package/docs/ux-demo.md +23 -9
- package/docs/webawesome-theme.md +87 -7
- package/docs/workbench.md +73 -0
- package/doctor/cli.mjs +115 -0
- package/doctor/config.schema.json +68 -0
- package/doctor/eslint-diagnostics.d.mts +8 -0
- package/doctor/eslint-diagnostics.mjs +7 -0
- package/doctor/index.d.mts +116 -0
- package/doctor/index.mjs +1257 -0
- package/doctor/report.schema.json +118 -0
- package/evaluator/cli.mjs +89 -0
- package/evaluator/index.d.mts +90 -0
- package/evaluator/index.mjs +1138 -0
- package/evaluator/report.schema.json +152 -0
- package/llms.txt +197 -14
- package/package.json +228 -46
- package/traversal-exclusions.mjs +27 -0
- package/ux-demo/recipes/app-shell.tsx +228 -0
- package/ux-demo/recipes/collapsible-sidebar.tsx +223 -0
- package/ux-demo/recipes/compact-toolbar.tsx +145 -0
- package/ux-demo/recipes/composer-form.tsx +151 -0
- package/ux-demo/recipes/list-detail-dialog.tsx +181 -0
- package/ux-demo/recipes/list-workspace-states.tsx +183 -0
- package/ux-demo/recipes/loaders.ts +36 -0
- package/ux-demo/recipes/loading-inspector.tsx +164 -0
- package/ux-demo/recipes/mount-recipe.ts +64 -0
- package/ux-demo/recipes/navigation-sidebar.tsx +137 -0
- package/ux-demo/recipes/navigation-stack.tsx +118 -0
- package/ux-demo/recipes/recipes.css +448 -0
- package/ux-demo/recipes/types.ts +19 -0
- package/ux-demo/recipes/workspace-header.tsx +67 -0
- package/dist/browser/dialog-header.js +0 -3
- package/dist/browser/menu-header.js +0 -3
- package/dist/browser/menu-item.js +0 -3
- package/dist/browser/page-header.js +0 -3
- package/dist/chunk-2PES33HS.js +0 -13
- package/dist/chunk-2PES33HS.js.map +0 -1
- package/dist/chunk-3O7ZEUW2.js +0 -27
- package/dist/chunk-3O7ZEUW2.js.map +0 -1
- package/dist/chunk-4HHCYSGT.js +0 -79
- package/dist/chunk-4HHCYSGT.js.map +0 -1
- package/dist/chunk-55DATV3A.js +0 -10
- package/dist/chunk-55DATV3A.js.map +0 -1
- package/dist/chunk-723YNJBH.js +0 -17
- package/dist/chunk-723YNJBH.js.map +0 -1
- package/dist/chunk-DAFFDO33.js +0 -14
- package/dist/chunk-DAFFDO33.js.map +0 -1
- package/dist/chunk-GY5WH7TO.js +0 -10
- package/dist/chunk-GY5WH7TO.js.map +0 -1
- package/dist/chunk-MBR3TYNL.js +0 -14
- package/dist/chunk-MBR3TYNL.js.map +0 -1
- package/dist/chunk-MFKMHK5W.js +0 -10
- package/dist/chunk-MFKMHK5W.js.map +0 -1
- package/dist/chunk-MQIZAD4A.js.map +0 -1
- package/dist/chunk-NHXX4JI5.js +0 -28
- package/dist/chunk-NHXX4JI5.js.map +0 -1
- package/dist/chunk-OPCJRCYO.js +0 -19
- package/dist/chunk-OPCJRCYO.js.map +0 -1
- package/dist/chunk-T5XNMVOI.js +0 -24
- package/dist/chunk-T5XNMVOI.js.map +0 -1
- package/dist/chunk-TRNBHPNW.js.map +0 -1
- package/dist/chunk-VHW5YNIB.js +0 -17
- package/dist/chunk-VHW5YNIB.js.map +0 -1
- package/dist/chunk-VKH2JLDZ.js +0 -10
- package/dist/chunk-VKH2JLDZ.js.map +0 -1
- package/dist/chunk-WVPYVDXY.js +0 -15
- package/dist/chunk-WVPYVDXY.js.map +0 -1
- package/dist/chunk-WY4CAEPG.js +0 -14
- package/dist/chunk-WY4CAEPG.js.map +0 -1
- package/dist/dialog-header.d.ts +0 -14
- package/dist/dialog-header.js +0 -3
- package/dist/dialog-header.js.map +0 -1
- package/dist/menu-header.d.ts +0 -15
- package/dist/menu-header.js +0 -3
- package/dist/menu-header.js.map +0 -1
- package/dist/menu-item.d.ts +0 -22
- package/dist/menu-item.js +0 -3
- package/dist/menu-item.js.map +0 -1
- package/dist/page-header.d.ts +0 -9
- package/dist/page-header.js +0 -3
- package/dist/page-header.js.map +0 -1
- package/src/app-tab.css +0 -20
- package/src/dialog-header.css +0 -9
- package/src/empty-state.css +0 -6
- package/src/foundation.css +0 -106
- package/src/loading-spinner.css +0 -4
- package/src/lucide-icon.css +0 -1
- package/src/menu-header.css +0 -13
- package/src/menu-item.css +0 -12
- package/src/page-header.css +0 -3
- package/src/resizable-region.css +0 -19
- package/src/select.css +0 -18
- package/src/state-banner.css +0 -31
- package/src/styles.css +0 -18
- package/src/tab-bar.css +0 -4
- package/src/toolbar-control-group.css +0 -25
- package/src/toolbar-text.css +0 -4
- package/src/toolbar.css +0 -9
- package/src/value-table.css +0 -5
- package/src/webawesome.css +0 -178
|
@@ -0,0 +1,1719 @@
|
|
|
1
|
+
# Public API signatures for the UI authoring corpus
|
|
2
|
+
|
|
3
|
+
Generated from emitted declarations for `@kerfjs/ui@4.5.0-beta.1` and `kerfjs@4.5.0-beta.1`. This bounded reference covers only APIs used by the seven-task corpus. It is interface evidence, not an implementation or runtime guarantee.
|
|
4
|
+
|
|
5
|
+
## `@kerfjs/ui/disclosure-arrow`
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { SafeHtml } from 'kerfjs';
|
|
9
|
+
|
|
10
|
+
type DisclosureDirection = 'up' | 'down' | 'left' | 'right';
|
|
11
|
+
interface DisclosureArrowProps {
|
|
12
|
+
open: boolean;
|
|
13
|
+
openDirection?: DisclosureDirection;
|
|
14
|
+
closedDirection?: DisclosureDirection;
|
|
15
|
+
/** Replacement icons should use right as their unrotated orientation. */
|
|
16
|
+
icon?: SafeHtml;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
declare function DisclosureArrow({ open, openDirection, closedDirection, icon, className, }: DisclosureArrowProps): SafeHtml;
|
|
20
|
+
|
|
21
|
+
export { DisclosureArrow, type DisclosureArrowProps, type DisclosureDirection };
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## `@kerfjs/ui/toolbar`
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { SafeHtml } from 'kerfjs';
|
|
28
|
+
import { D as DividerSides } from './divider-sides-267FA7sY.js';
|
|
29
|
+
|
|
30
|
+
interface ToolbarProps {
|
|
31
|
+
leading?: SafeHtml;
|
|
32
|
+
center?: SafeHtml;
|
|
33
|
+
trailing?: SafeHtml;
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Physical divider edges in canonical top/right/bottom/left order. Defaults to bottom. */
|
|
36
|
+
dividerSides?: DividerSides;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
declare function Toolbar({ leading, center, trailing, label, dividerSides, className, }: ToolbarProps): SafeHtml;
|
|
40
|
+
|
|
41
|
+
export { DividerSides, Toolbar, type ToolbarProps };
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## `@kerfjs/ui/toolbar-text`
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import * as kerfjs from 'kerfjs';
|
|
48
|
+
|
|
49
|
+
type ToolbarTextSize = 'xlarge' | 'large' | 'default' | 'small';
|
|
50
|
+
/** ARIA heading level for a title exposed as a heading landmark. */
|
|
51
|
+
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
52
|
+
interface ToolbarTextBaseProps {
|
|
53
|
+
text: string;
|
|
54
|
+
size?: ToolbarTextSize;
|
|
55
|
+
className?: string;
|
|
56
|
+
/** Optional id, e.g. so a dialog can reference the title via aria-labelledby. */
|
|
57
|
+
id?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Expose heading semantics (`role="heading"` + `aria-level`) so the text acts as
|
|
60
|
+
* a heading landmark — e.g. a page's primary title. Omit to keep the plain span
|
|
61
|
+
* (the default), which suits a dialog title referenced via `aria-labelledby`.
|
|
62
|
+
*/
|
|
63
|
+
headingLevel?: HeadingLevel;
|
|
64
|
+
/** Render the text as an unanimated loading skeleton instead of its value. */
|
|
65
|
+
placeholder?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Show a trailing ellipsis (…) where the text is truncated — on the single line
|
|
68
|
+
* (default), or at the `maxLines` boundary when wrapping. Set false to hard-clip
|
|
69
|
+
* instead. Default true.
|
|
70
|
+
*/
|
|
71
|
+
ellipsis?: boolean;
|
|
72
|
+
}
|
|
73
|
+
type ToolbarTextWrappingProps = {
|
|
74
|
+
/** Wrap onto multiple lines; combine with `maxLines` to cap them. */
|
|
75
|
+
wrap: true;
|
|
76
|
+
maxLines?: number | null;
|
|
77
|
+
} | {
|
|
78
|
+
wrap?: false;
|
|
79
|
+
maxLines?: never;
|
|
80
|
+
};
|
|
81
|
+
type ToolbarTextProps = ToolbarTextBaseProps & ToolbarTextWrappingProps;
|
|
82
|
+
declare function ToolbarText({ text, size, className, id, headingLevel, placeholder, wrap, ellipsis, maxLines, }: ToolbarTextProps): kerfjs.SafeHtml;
|
|
83
|
+
|
|
84
|
+
export { type HeadingLevel, ToolbarText, type ToolbarTextProps, type ToolbarTextSize };
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## `@kerfjs/ui/toolbar-control-group`
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { SafeHtml } from 'kerfjs';
|
|
91
|
+
|
|
92
|
+
type ToolbarControlGroupAppearance = 'contained' | 'borderless';
|
|
93
|
+
type ToolbarControlGroupTone = 'default' | 'dark';
|
|
94
|
+
type ToolbarControlGroupButtonAppearance = 'plain' | 'push';
|
|
95
|
+
type ToolbarControlGroupShape = 'pill' | 'rounded';
|
|
96
|
+
interface ToolbarControlGroupProps {
|
|
97
|
+
children: SafeHtml | SafeHtml[];
|
|
98
|
+
label?: string;
|
|
99
|
+
className?: string;
|
|
100
|
+
expanded?: boolean;
|
|
101
|
+
single?: boolean;
|
|
102
|
+
appearance?: ToolbarControlGroupAppearance;
|
|
103
|
+
tone?: ToolbarControlGroupTone;
|
|
104
|
+
buttonAppearance?: ToolbarControlGroupButtonAppearance;
|
|
105
|
+
/** Corner shape: fully round `pill` (default) or a softer `rounded` rectangle. */
|
|
106
|
+
shape?: ToolbarControlGroupShape;
|
|
107
|
+
}
|
|
108
|
+
declare function ToolbarControlGroup({ children, label, className, expanded, single, appearance, tone, buttonAppearance, shape, }: ToolbarControlGroupProps): SafeHtml;
|
|
109
|
+
|
|
110
|
+
export { ToolbarControlGroup, type ToolbarControlGroupAppearance, type ToolbarControlGroupButtonAppearance, type ToolbarControlGroupProps, type ToolbarControlGroupShape, type ToolbarControlGroupTone };
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## `@kerfjs/ui/floating-toolbar`
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import { SafeHtml } from 'kerfjs';
|
|
117
|
+
|
|
118
|
+
/** Where a {@link FloatingToolbar} floats within its positioned container. */
|
|
119
|
+
type FloatingToolbarPosition = 'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end';
|
|
120
|
+
interface FloatingToolbarProps {
|
|
121
|
+
/** Toolbar contents — normally one or more `ToolbarControlGroup`s. */
|
|
122
|
+
children: SafeHtml | SafeHtml[];
|
|
123
|
+
/** Accessible name for the toolbar (required — it exposes `role="toolbar"`). */
|
|
124
|
+
label: string;
|
|
125
|
+
/**
|
|
126
|
+
* Corner or edge it floats to inside its nearest positioned ancestor.
|
|
127
|
+
* Default: `'bottom-end'`.
|
|
128
|
+
*/
|
|
129
|
+
position?: FloatingToolbarPosition;
|
|
130
|
+
className?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A toolbar that floats above the main content of its nearest positioned
|
|
134
|
+
* ancestor — a transparent, forced-dark cluster of controls (e.g. a drawer
|
|
135
|
+
* restore button) that sits over the content but NOT over dialogs or overlays
|
|
136
|
+
* (it is not in the top layer). It is inset from the container edges by
|
|
137
|
+
* `--kui-floating-toolbar-inset` (default `--kui-space-m`, i.e. 8px more than a
|
|
138
|
+
* top toolbar's own inset); override that token to move it. The app owns the
|
|
139
|
+
* controls and their behavior — wire them with `delegate()` as usual.
|
|
140
|
+
*/
|
|
141
|
+
declare function FloatingToolbar({ children, label, position, className, }: FloatingToolbarProps): SafeHtml;
|
|
142
|
+
|
|
143
|
+
export { FloatingToolbar, type FloatingToolbarPosition, type FloatingToolbarProps };
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## `@kerfjs/ui/list-header`
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
import { SafeHtml } from 'kerfjs';
|
|
150
|
+
|
|
151
|
+
type ListHeaderRootAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
152
|
+
'data-component'?: never;
|
|
153
|
+
'data-action'?: never;
|
|
154
|
+
'data-has-badge'?: never;
|
|
155
|
+
'data-has-count'?: never;
|
|
156
|
+
'data-toggle'?: never;
|
|
157
|
+
}>;
|
|
158
|
+
type ListHeaderTriggerAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
159
|
+
'data-action'?: never;
|
|
160
|
+
popoverTarget?: string;
|
|
161
|
+
popoverTargetAction?: 'toggle' | 'show' | 'hide';
|
|
162
|
+
'aria-controls'?: string;
|
|
163
|
+
'aria-haspopup'?: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid' | 'true';
|
|
164
|
+
}>;
|
|
165
|
+
interface ListHeaderBaseProps {
|
|
166
|
+
label: string;
|
|
167
|
+
/** Render as an unanimated loading skeleton: keep the label and action affordance, disable interaction. */
|
|
168
|
+
placeholder?: boolean;
|
|
169
|
+
rootAttributes?: ListHeaderRootAttributes;
|
|
170
|
+
triggerAttributes?: ListHeaderTriggerAttributes;
|
|
171
|
+
}
|
|
172
|
+
type ListHeaderModeProps = {
|
|
173
|
+
/** Render the title as a controlled disclosure trigger. */
|
|
174
|
+
toggle: true;
|
|
175
|
+
action: string;
|
|
176
|
+
expanded: boolean;
|
|
177
|
+
actionIcon?: SafeHtml;
|
|
178
|
+
actionLabel?: never;
|
|
179
|
+
actionDisabled?: boolean;
|
|
180
|
+
disabledReason?: string;
|
|
181
|
+
} | {
|
|
182
|
+
/** Render a separately named trailing action. */
|
|
183
|
+
toggle?: false;
|
|
184
|
+
action: string;
|
|
185
|
+
actionLabel: string;
|
|
186
|
+
actionIcon: SafeHtml;
|
|
187
|
+
expanded?: never;
|
|
188
|
+
actionDisabled?: boolean;
|
|
189
|
+
disabledReason?: string;
|
|
190
|
+
} | {
|
|
191
|
+
/** Render a passive section heading. */
|
|
192
|
+
toggle?: false;
|
|
193
|
+
action?: never;
|
|
194
|
+
actionLabel?: never;
|
|
195
|
+
actionIcon?: never;
|
|
196
|
+
expanded?: never;
|
|
197
|
+
actionDisabled?: never;
|
|
198
|
+
disabledReason?: never;
|
|
199
|
+
};
|
|
200
|
+
type ListHeaderIndicatorProps = {
|
|
201
|
+
count: number;
|
|
202
|
+
countLabel: string;
|
|
203
|
+
badge?: never;
|
|
204
|
+
} | {
|
|
205
|
+
count?: never;
|
|
206
|
+
countLabel?: never;
|
|
207
|
+
badge?: SafeHtml;
|
|
208
|
+
};
|
|
209
|
+
type ListHeaderProps = ListHeaderBaseProps & ListHeaderIndicatorProps & ListHeaderModeProps;
|
|
210
|
+
declare function ListHeader({ label, count, countLabel, badge, action, actionLabel, actionIcon, actionDisabled, disabledReason, expanded, toggle, placeholder, rootAttributes, triggerAttributes, }: ListHeaderProps): SafeHtml;
|
|
211
|
+
|
|
212
|
+
export { ListHeader, type ListHeaderProps };
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## `@kerfjs/ui/list-action-row`
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
import { SafeHtml } from 'kerfjs';
|
|
219
|
+
|
|
220
|
+
type ListActionRowRootAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
221
|
+
'data-component'?: never;
|
|
222
|
+
'data-action'?: never;
|
|
223
|
+
'data-item-id'?: never;
|
|
224
|
+
'data-has-icon'?: never;
|
|
225
|
+
'data-multiline'?: never;
|
|
226
|
+
'data-state'?: never;
|
|
227
|
+
'data-selected'?: never;
|
|
228
|
+
'data-pressed'?: never;
|
|
229
|
+
}>;
|
|
230
|
+
type ListActionRowTrailingAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
231
|
+
'data-component'?: never;
|
|
232
|
+
'data-action'?: never;
|
|
233
|
+
'data-item-id'?: never;
|
|
234
|
+
popoverTarget?: string;
|
|
235
|
+
popoverTargetAction?: 'toggle' | 'show' | 'hide';
|
|
236
|
+
'aria-controls'?: string;
|
|
237
|
+
'aria-haspopup'?: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid' | 'true';
|
|
238
|
+
}>;
|
|
239
|
+
interface ListActionRowProps {
|
|
240
|
+
/** Visible dormant content for the primary button. Must not contain interactive descendants. */
|
|
241
|
+
label: string | SafeHtml;
|
|
242
|
+
/** Decorative dormant content for the primary button. Must not contain interactive descendants. */
|
|
243
|
+
icon?: SafeHtml;
|
|
244
|
+
action: string;
|
|
245
|
+
itemId?: string;
|
|
246
|
+
selected?: boolean;
|
|
247
|
+
pressed?: boolean;
|
|
248
|
+
accessibleLabel?: string;
|
|
249
|
+
title?: string;
|
|
250
|
+
multiline?: boolean;
|
|
251
|
+
state?: string;
|
|
252
|
+
disabled?: boolean;
|
|
253
|
+
tabIndex?: number;
|
|
254
|
+
/** Render as an unanimated loading skeleton, disabling both actions. */
|
|
255
|
+
placeholder?: boolean;
|
|
256
|
+
trailingAction: string;
|
|
257
|
+
trailingActionLabel: string;
|
|
258
|
+
/** Decorative dormant content for the trailing button. Must not contain interactive descendants. */
|
|
259
|
+
trailingActionIcon: SafeHtml;
|
|
260
|
+
trailingActionDisabled?: boolean;
|
|
261
|
+
trailingActionTitle?: string;
|
|
262
|
+
className?: string;
|
|
263
|
+
style?: string;
|
|
264
|
+
rootAttributes?: ListActionRowRootAttributes;
|
|
265
|
+
trailingActionAttributes?: ListActionRowTrailingAttributes;
|
|
266
|
+
}
|
|
267
|
+
declare function ListActionRow({ label, icon, action, itemId, selected, pressed, accessibleLabel, title, multiline, state, disabled, tabIndex, placeholder, trailingAction, trailingActionLabel, trailingActionIcon, trailingActionDisabled, trailingActionTitle, className, style, rootAttributes, trailingActionAttributes, }: ListActionRowProps): SafeHtml;
|
|
268
|
+
|
|
269
|
+
export { ListActionRow, type ListActionRowProps };
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## `@kerfjs/ui/list-item`
|
|
273
|
+
|
|
274
|
+
```ts
|
|
275
|
+
import { SafeHtml } from 'kerfjs';
|
|
276
|
+
|
|
277
|
+
type ListItemRootAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
278
|
+
'data-component'?: never;
|
|
279
|
+
'data-action'?: never;
|
|
280
|
+
'data-item-id'?: never;
|
|
281
|
+
'data-has-icon'?: never;
|
|
282
|
+
'data-multiline'?: never;
|
|
283
|
+
'data-state'?: never;
|
|
284
|
+
}>;
|
|
285
|
+
interface ListItemProps {
|
|
286
|
+
label: string | SafeHtml;
|
|
287
|
+
icon?: SafeHtml;
|
|
288
|
+
trailing?: SafeHtml;
|
|
289
|
+
selected?: boolean;
|
|
290
|
+
action: string;
|
|
291
|
+
itemId?: string;
|
|
292
|
+
className?: string;
|
|
293
|
+
style?: string;
|
|
294
|
+
pressed?: boolean;
|
|
295
|
+
accessibleLabel?: string;
|
|
296
|
+
title?: string;
|
|
297
|
+
multiline?: boolean;
|
|
298
|
+
state?: string;
|
|
299
|
+
disabled?: boolean;
|
|
300
|
+
tabIndex?: number;
|
|
301
|
+
/** Render the row as an unanimated loading skeleton, disabling its action. */
|
|
302
|
+
placeholder?: boolean;
|
|
303
|
+
rootAttributes?: ListItemRootAttributes;
|
|
304
|
+
}
|
|
305
|
+
declare function ListItem({ label, icon, trailing, selected, action, itemId, className, style, pressed, accessibleLabel, title, multiline, state, disabled, tabIndex, placeholder, rootAttributes, }: ListItemProps): SafeHtml;
|
|
306
|
+
|
|
307
|
+
export { ListItem, type ListItemProps };
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## `@kerfjs/ui/list-inset-control`
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
import { SafeHtml } from 'kerfjs';
|
|
314
|
+
|
|
315
|
+
interface ListInsetControlProps {
|
|
316
|
+
/** Control(s) that own their own border and padding (e.g. an input, a `wa-*`). */
|
|
317
|
+
children: SafeHtml | SafeHtml[];
|
|
318
|
+
className?: string;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Insets a control into a pane/list content region: an 8px inline margin (so its
|
|
322
|
+
* edges line up with `.kui-content` items) and a stretch flex row with an 8px gap.
|
|
323
|
+
* Use it for controls that carry their own border and padding but no outer margin
|
|
324
|
+
* — the wrapper adds only the alignment margin and layout, not a second inset.
|
|
325
|
+
*/
|
|
326
|
+
declare function ListInsetControl({ children, className, }: ListInsetControlProps): SafeHtml;
|
|
327
|
+
|
|
328
|
+
export { ListInsetControl, type ListInsetControlProps };
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## `@kerfjs/ui/list-inset-text`
|
|
332
|
+
|
|
333
|
+
```ts
|
|
334
|
+
import { SafeHtml } from 'kerfjs';
|
|
335
|
+
|
|
336
|
+
interface ListInsetTextProps {
|
|
337
|
+
/** Text (or inline content) that carries no margin, border, or padding of its own. */
|
|
338
|
+
children: SafeHtml | SafeHtml[] | string;
|
|
339
|
+
/**
|
|
340
|
+
* Keep only the horizontal geometry (inline margin, left/right border, and
|
|
341
|
+
* left/right padding) and drop the vertical margin, border, and padding. Use it
|
|
342
|
+
* when the text edge must still align with bordered items but the line should not
|
|
343
|
+
* add its own vertical box space — tight text layout inside a content region.
|
|
344
|
+
*/
|
|
345
|
+
horizontalOnly?: boolean;
|
|
346
|
+
className?: string;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Gives bare text the content-item geometry — an 8px inline margin, a 1px
|
|
350
|
+
* transparent border, and 8px padding — so a plain string lines up with
|
|
351
|
+
* bordered `.kui-content` items (its text edge lands at the same 17px inset).
|
|
352
|
+
* Use it for text elements that have no margin, border, or padding of their own.
|
|
353
|
+
* Pass `horizontalOnly` to keep the horizontal inset but drop the vertical box
|
|
354
|
+
* space for tight text layout.
|
|
355
|
+
*/
|
|
356
|
+
declare function ListInsetText({ children, horizontalOnly, className, }: ListInsetTextProps): SafeHtml;
|
|
357
|
+
|
|
358
|
+
export { ListInsetText, type ListInsetTextProps };
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## `@kerfjs/ui/panel-header`
|
|
362
|
+
|
|
363
|
+
```ts
|
|
364
|
+
import { SafeHtml } from 'kerfjs';
|
|
365
|
+
import { HeadingLevel } from './toolbar-text.js';
|
|
366
|
+
|
|
367
|
+
interface PanelHeaderBaseProps {
|
|
368
|
+
title: string;
|
|
369
|
+
titleId: string;
|
|
370
|
+
icon?: SafeHtml;
|
|
371
|
+
iconClassName?: string;
|
|
372
|
+
actions?: SafeHtml;
|
|
373
|
+
/**
|
|
374
|
+
* Expose the title as a heading landmark (`role="heading"` + `aria-level`). Set it
|
|
375
|
+
* for a PAGE or view heading so screen-reader heading navigation works and the view
|
|
376
|
+
* has a primary heading; omit it (the default) for a dialog title, which is instead
|
|
377
|
+
* referenced via `aria-labelledby={titleId}` and needs no heading landmark.
|
|
378
|
+
*/
|
|
379
|
+
headingLevel?: HeadingLevel;
|
|
380
|
+
/** Render the title and summary as unanimated loading skeletons, keeping the icon and actions. */
|
|
381
|
+
placeholder?: boolean;
|
|
382
|
+
}
|
|
383
|
+
type PanelHeaderSummaryProps = {
|
|
384
|
+
summary: string;
|
|
385
|
+
summaryId?: string;
|
|
386
|
+
} | {
|
|
387
|
+
summary?: never;
|
|
388
|
+
summaryId?: never;
|
|
389
|
+
};
|
|
390
|
+
type PanelHeaderProps = PanelHeaderBaseProps & PanelHeaderSummaryProps;
|
|
391
|
+
/**
|
|
392
|
+
* The heading of a panel, dialog, or page: a plain `Toolbar` whose leading zone
|
|
393
|
+
* holds an optional icon control group and the title as extra-large `ToolbarText`,
|
|
394
|
+
* whose trailing zone holds the app's action controls, and with an optional
|
|
395
|
+
* subtitle on its own row, left-aligned with the title.
|
|
396
|
+
*
|
|
397
|
+
* PanelHeader overrides no Toolbar styles — it is just a Toolbar with an xl title.
|
|
398
|
+
* The only styling it adds is the icon group's fill/border color and the subtitle.
|
|
399
|
+
* When no icon is provided, the icon group is omitted entirely. The `actions` slot
|
|
400
|
+
* is passed straight into the toolbar's trailing zone; the app supplies whatever
|
|
401
|
+
* trailing controls it needs (typically a `ToolbarControlGroup`).
|
|
402
|
+
*/
|
|
403
|
+
declare function PanelHeader({ title, titleId, summary, summaryId, icon, iconClassName, actions, headingLevel, placeholder, }: PanelHeaderProps): SafeHtml;
|
|
404
|
+
|
|
405
|
+
export { PanelHeader, type PanelHeaderProps };
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## `@kerfjs/ui/value-table`
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
import { SafeHtml } from 'kerfjs';
|
|
412
|
+
|
|
413
|
+
interface ValueTableRowProps {
|
|
414
|
+
label: string | SafeHtml;
|
|
415
|
+
value: string | SafeHtml;
|
|
416
|
+
icon?: SafeHtml;
|
|
417
|
+
className?: string;
|
|
418
|
+
/** Render the value as an unanimated loading skeleton, keeping the field label. */
|
|
419
|
+
placeholder?: boolean;
|
|
420
|
+
}
|
|
421
|
+
declare function ValueTableRow({ label, value, icon, className, placeholder, }: ValueTableRowProps): SafeHtml;
|
|
422
|
+
|
|
423
|
+
interface ValueTableProps {
|
|
424
|
+
label: string;
|
|
425
|
+
className?: string;
|
|
426
|
+
children: SafeHtml | readonly SafeHtml[];
|
|
427
|
+
}
|
|
428
|
+
declare function ValueTable({ label, className, children, }: ValueTableProps): SafeHtml;
|
|
429
|
+
|
|
430
|
+
export { ValueTable, type ValueTableProps, ValueTableRow, type ValueTableRowProps };
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
## `@kerfjs/ui/app-tab`
|
|
434
|
+
|
|
435
|
+
```ts
|
|
436
|
+
import { SafeHtml } from 'kerfjs';
|
|
437
|
+
|
|
438
|
+
type AppTabRootAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
439
|
+
'data-component'?: never;
|
|
440
|
+
'data-action'?: never;
|
|
441
|
+
'data-tab-id'?: never;
|
|
442
|
+
'data-selected'?: never;
|
|
443
|
+
'data-tab-dragging'?: never;
|
|
444
|
+
'data-tab-drop-position'?: never;
|
|
445
|
+
}>;
|
|
446
|
+
interface AppTabProps {
|
|
447
|
+
id: string;
|
|
448
|
+
name: string;
|
|
449
|
+
selected?: boolean;
|
|
450
|
+
closable?: boolean;
|
|
451
|
+
draggable?: boolean;
|
|
452
|
+
leading?: SafeHtml;
|
|
453
|
+
trailing?: SafeHtml;
|
|
454
|
+
/** Decorative dormant content for the close button. Must not contain interactive descendants. */
|
|
455
|
+
closeIcon?: SafeHtml;
|
|
456
|
+
selectAction?: string;
|
|
457
|
+
closeAction?: string;
|
|
458
|
+
className?: string;
|
|
459
|
+
/** Render as an unanimated loading skeleton, disabling select/close and dragging. */
|
|
460
|
+
placeholder?: boolean;
|
|
461
|
+
rootAttributes?: AppTabRootAttributes;
|
|
462
|
+
}
|
|
463
|
+
declare function AppTab({ id, name, selected, closable, draggable, leading, trailing, closeIcon, selectAction, closeAction, className, placeholder, rootAttributes, }: AppTabProps): SafeHtml;
|
|
464
|
+
|
|
465
|
+
export { AppTab, type AppTabProps };
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
## `@kerfjs/ui/tab-bar`
|
|
469
|
+
|
|
470
|
+
```ts
|
|
471
|
+
import { SafeHtml } from 'kerfjs';
|
|
472
|
+
|
|
473
|
+
type TabActivation = 'automatic' | 'manual';
|
|
474
|
+
interface TabBarProps {
|
|
475
|
+
id: string;
|
|
476
|
+
label: string;
|
|
477
|
+
children: SafeHtml | readonly SafeHtml[];
|
|
478
|
+
leading?: SafeHtml;
|
|
479
|
+
trailing?: SafeHtml;
|
|
480
|
+
className?: string;
|
|
481
|
+
/**
|
|
482
|
+
* Keyboard activation mode for this strip, emitted as `data-tab-activation` for
|
|
483
|
+
* `wireTabBars` to read (overrides its `activation` option). `'automatic'` (default)
|
|
484
|
+
* selects on arrow / Home / End; `'manual'` moves roving focus only and the user
|
|
485
|
+
* selects with Enter / Space / click — use it when selecting a tab is a heavy action.
|
|
486
|
+
*/
|
|
487
|
+
activation?: TabActivation;
|
|
488
|
+
}
|
|
489
|
+
/** Render a controlled tab strip. The application owns selection, order, and persistence. */
|
|
490
|
+
declare function TabBar({ id, label, children, leading, trailing, className, activation, }: TabBarProps): SafeHtml;
|
|
491
|
+
|
|
492
|
+
export { type TabActivation, TabBar, type TabBarProps };
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## `@kerfjs/ui/wire-tab-bars`
|
|
496
|
+
|
|
497
|
+
```ts
|
|
498
|
+
import { TabActivation } from './tab-bar.js';
|
|
499
|
+
import 'kerfjs';
|
|
500
|
+
|
|
501
|
+
type TabReorderSource = 'pointer' | 'keyboard';
|
|
502
|
+
type TabDropPosition = 'before' | 'after';
|
|
503
|
+
interface TabReorder {
|
|
504
|
+
barId: string;
|
|
505
|
+
sourceId: string;
|
|
506
|
+
targetId: string;
|
|
507
|
+
position: TabDropPosition;
|
|
508
|
+
source: TabReorderSource;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
interface WireTabBarsOptions {
|
|
512
|
+
onReorder: (change: TabReorder) => void;
|
|
513
|
+
/**
|
|
514
|
+
* How arrow / Home / End keys activate tabs (default `'automatic'`):
|
|
515
|
+
* - `'automatic'` moves roving focus **and** selects the focused tab (clicks it).
|
|
516
|
+
* - `'manual'` moves roving focus only; the user selects with Enter / Space / click
|
|
517
|
+
* (the ARIA Tabs manual-activation pattern). Use this when activation is a heavy or
|
|
518
|
+
* side-effecting action (e.g. a tab that loads a project) so arrowing through the
|
|
519
|
+
* strip doesn't trigger it on every tab.
|
|
520
|
+
*
|
|
521
|
+
* A per-bar `data-tab-activation="manual" | "automatic"` attribute (see the `TabBar`
|
|
522
|
+
* `activation` prop) overrides this option for that strip.
|
|
523
|
+
*/
|
|
524
|
+
activation?: TabActivation;
|
|
525
|
+
}
|
|
526
|
+
declare function reorderTabs<T>(items: readonly T[], getId: (item: T) => string, sourceId: string, targetId: string, position: TabDropPosition): T[];
|
|
527
|
+
/** Wire reordering and keyboard navigation while leaving controlled state in the application. */
|
|
528
|
+
declare function wireTabBars(root: HTMLElement | Document, { onReorder, activation }: WireTabBarsOptions): () => void;
|
|
529
|
+
|
|
530
|
+
export { TabActivation, type TabDropPosition, type TabReorder, type TabReorderSource, type WireTabBarsOptions, reorderTabs, wireTabBars };
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
## `@kerfjs/ui/nav-stack`
|
|
534
|
+
|
|
535
|
+
```ts
|
|
536
|
+
import { SafeHtml } from 'kerfjs';
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* One entry in a {@link NavStack}. The app owns the stack as an array (usually a
|
|
540
|
+
* signal); `NavStack` renders it and `wireNavStack` animates the transitions.
|
|
541
|
+
*/
|
|
542
|
+
interface NavStackView {
|
|
543
|
+
/** Stable identity for keyed reconcile and transition direction. */
|
|
544
|
+
key: string;
|
|
545
|
+
content: SafeHtml;
|
|
546
|
+
/** Title shown in the top toolbar for this view. */
|
|
547
|
+
title?: string;
|
|
548
|
+
/** Trailing actions for this view's top toolbar. */
|
|
549
|
+
toolbar?: SafeHtml;
|
|
550
|
+
}
|
|
551
|
+
interface NavStackProps {
|
|
552
|
+
id: string;
|
|
553
|
+
/** Accessible name for the stack region. */
|
|
554
|
+
label: string;
|
|
555
|
+
/** The stack, root first; the last entry is the active top view. */
|
|
556
|
+
views: NavStackView[];
|
|
557
|
+
/** Accessible label for the back control (default "Back"). */
|
|
558
|
+
backLabel?: string;
|
|
559
|
+
/** Hide the top toolbar entirely (rare — a fully custom-chrome view). */
|
|
560
|
+
hideToolbar?: boolean;
|
|
561
|
+
/** Optional persistent bottom toolbar. */
|
|
562
|
+
bottomToolbar?: SafeHtml;
|
|
563
|
+
className?: string;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* A navigation stack (iOS-style push/pop). Renders every entry stacked, the last
|
|
567
|
+
* one active; `@kerfjs/ui/wire-nav-stack`'s `wireNavStack` slides the content and
|
|
568
|
+
* cross-fades the chrome across a change. A single-pane layout is a `NavStack`
|
|
569
|
+
* with one entry. See `docs/23-app-layouts.md` §3.1.
|
|
570
|
+
*/
|
|
571
|
+
declare function NavStack({ id, label, views, backLabel, hideToolbar, bottomToolbar, className, }: NavStackProps): SafeHtml;
|
|
572
|
+
|
|
573
|
+
export { NavStack, type NavStackProps, type NavStackView };
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
## `@kerfjs/ui/wire-nav-stack`
|
|
577
|
+
|
|
578
|
+
```ts
|
|
579
|
+
interface WireNavStackOptions {
|
|
580
|
+
/** Invoked when the back control is activated. The app pops its own stack. */
|
|
581
|
+
onBack?: () => void;
|
|
582
|
+
/** Transition duration in ms (default 200). Set 0 to disable animation. */
|
|
583
|
+
duration?: number;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Animate a `NavStack`'s push/pop transitions and wire its back control. The app
|
|
587
|
+
* owns the stack (a signal of `NavStackView[]`) and re-renders `NavStack` when it
|
|
588
|
+
* changes; this helper slides the content and settles the chrome across each
|
|
589
|
+
* change, and calls `onBack` when the back control is used. Returns a disposer.
|
|
590
|
+
*/
|
|
591
|
+
declare function wireNavStack(root: Element, options?: WireNavStackOptions): () => void;
|
|
592
|
+
|
|
593
|
+
export { type WireNavStackOptions, wireNavStack };
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
## `@kerfjs/ui/split-view`
|
|
597
|
+
|
|
598
|
+
```ts
|
|
599
|
+
import { SafeHtml } from 'kerfjs';
|
|
600
|
+
|
|
601
|
+
interface SplitViewResizable {
|
|
602
|
+
size: number;
|
|
603
|
+
min: number;
|
|
604
|
+
max: number;
|
|
605
|
+
}
|
|
606
|
+
interface SplitViewProps {
|
|
607
|
+
id: string;
|
|
608
|
+
label: string;
|
|
609
|
+
/** The list (primary) pane. */
|
|
610
|
+
list: SafeHtml;
|
|
611
|
+
/** The detail (secondary) pane. */
|
|
612
|
+
detail: SafeHtml;
|
|
613
|
+
/**
|
|
614
|
+
* Compact ("one pane at a time") classes — a handset or portrait tablet.
|
|
615
|
+
* Derive from `deviceClass().value.compact`. When true the split collapses to
|
|
616
|
+
* a `NavStack`: the list is the root and the detail is pushed over it.
|
|
617
|
+
*/
|
|
618
|
+
compact?: boolean;
|
|
619
|
+
/** In compact mode, whether the detail is currently pushed over the list. */
|
|
620
|
+
detailActive?: boolean;
|
|
621
|
+
/** Title/label for the list (compact NavStack root + region label). */
|
|
622
|
+
listTitle?: string;
|
|
623
|
+
/** Title/label for the detail (compact NavStack pushed view + region label). */
|
|
624
|
+
detailTitle?: string;
|
|
625
|
+
/** Back label for the compact NavStack (default "Back"). */
|
|
626
|
+
backLabel?: string;
|
|
627
|
+
/** A resizable separator on roomy classes (min/max px). Omit for a fixed split. */
|
|
628
|
+
resizable?: SplitViewResizable;
|
|
629
|
+
className?: string;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* A list-detail split. On roomy classes it shows both panes side
|
|
633
|
+
* by side with an optional resizable separator; on compact classes it collapses
|
|
634
|
+
* to a `NavStack` (list → detail). See `docs/23-app-layouts.md` §3.2. Compose the
|
|
635
|
+
* resizable wiring with `wireResizableRegions` and the compact back with
|
|
636
|
+
* `wireNavStack`.
|
|
637
|
+
*/
|
|
638
|
+
declare function SplitView({ id, label, list, detail, compact, detailActive, listTitle, detailTitle, backLabel, resizable, className, }: SplitViewProps): SafeHtml;
|
|
639
|
+
|
|
640
|
+
export { SplitView, type SplitViewProps, type SplitViewResizable };
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
## `@kerfjs/ui/pane`
|
|
644
|
+
|
|
645
|
+
```ts
|
|
646
|
+
import { SafeHtml } from 'kerfjs';
|
|
647
|
+
|
|
648
|
+
/** Logical sides that can show a {@link Pane} separator. */
|
|
649
|
+
type PaneSeparatorSide = 'block-start' | 'block-end' | 'inline-start' | 'inline-end';
|
|
650
|
+
/** Semantic root elements supported by {@link Pane}. */
|
|
651
|
+
type PaneElement = 'article' | 'aside' | 'div' | 'main' | 'section';
|
|
652
|
+
/** Semantic elements supported by the scrolling content slot. */
|
|
653
|
+
type PaneContentElement = 'div' | 'main' | 'nav' | 'section';
|
|
654
|
+
type PaneRootAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
655
|
+
'data-component'?: never;
|
|
656
|
+
'data-separator-block-start'?: never;
|
|
657
|
+
'data-separator-block-end'?: never;
|
|
658
|
+
'data-separator-inline-start'?: never;
|
|
659
|
+
'data-separator-inline-end'?: never;
|
|
660
|
+
}>;
|
|
661
|
+
interface PaneProps {
|
|
662
|
+
/** Optional fixed chrome above the scrolling content, arranged vertically. */
|
|
663
|
+
header?: SafeHtml | readonly SafeHtml[];
|
|
664
|
+
/** The pane's primary vertical, scrolling content stack. */
|
|
665
|
+
children?: SafeHtml | readonly SafeHtml[];
|
|
666
|
+
/** Optional fixed chrome below the scrolling content. */
|
|
667
|
+
footer?: SafeHtml | readonly SafeHtml[];
|
|
668
|
+
/** Root semantics. Defaults to `div`. */
|
|
669
|
+
element?: PaneElement;
|
|
670
|
+
/** Scrolling content semantics. Defaults to `div`. */
|
|
671
|
+
contentElement?: PaneContentElement;
|
|
672
|
+
/** Independent logical-edge separator lines. Defaults to none. */
|
|
673
|
+
separators?: readonly PaneSeparatorSide[];
|
|
674
|
+
id?: string;
|
|
675
|
+
/** Accessible name for a landmark root such as `aside` or `main`. */
|
|
676
|
+
label?: string;
|
|
677
|
+
/** Accessible name for a landmark scrolling slot such as `nav`. */
|
|
678
|
+
contentLabel?: string;
|
|
679
|
+
className?: string;
|
|
680
|
+
headerClassName?: string;
|
|
681
|
+
contentClassName?: string;
|
|
682
|
+
footerClassName?: string;
|
|
683
|
+
/** Safe `data-*` metadata; Pane-owned structural attributes remain protected. */
|
|
684
|
+
rootAttributes?: PaneRootAttributes;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* An unpadded application column with optional fixed header/footer slots and one
|
|
688
|
+
* scrolling vertical content owner. Separator lines are independently opt-in on
|
|
689
|
+
* each logical edge, so the same component works as a sidebar, main area,
|
|
690
|
+
* inspector, or dialog column.
|
|
691
|
+
*/
|
|
692
|
+
declare function Pane({ header, children, footer, element, contentElement, separators, id, label, contentLabel, className, headerClassName, contentClassName, footerClassName, rootAttributes, }: PaneProps): SafeHtml;
|
|
693
|
+
|
|
694
|
+
export { Pane, type PaneContentElement, type PaneElement, type PaneProps, type PaneSeparatorSide };
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
## `@kerfjs/ui/workbench`
|
|
698
|
+
|
|
699
|
+
```ts
|
|
700
|
+
import { SafeHtml } from 'kerfjs';
|
|
701
|
+
|
|
702
|
+
/** A collapsible Workbench panel — a side rail or the bottom drawer. */
|
|
703
|
+
interface WorkbenchPanel {
|
|
704
|
+
content: SafeHtml;
|
|
705
|
+
/** Whether the panel is currently collapsed (the app owns this). */
|
|
706
|
+
collapsed?: boolean;
|
|
707
|
+
/** Rail width, or drawer height, in px. Overrides the CSS default. */
|
|
708
|
+
size?: number;
|
|
709
|
+
/** Accessible name for the panel region. */
|
|
710
|
+
label?: string;
|
|
711
|
+
}
|
|
712
|
+
interface WorkbenchProps {
|
|
713
|
+
id: string;
|
|
714
|
+
label: string;
|
|
715
|
+
/** The central work area. */
|
|
716
|
+
main: SafeHtml;
|
|
717
|
+
leftRail?: WorkbenchPanel;
|
|
718
|
+
rightRail?: WorkbenchPanel;
|
|
719
|
+
bottomDrawer?: WorkbenchPanel;
|
|
720
|
+
className?: string;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* The Xcode-like multi-panel workspace: a collapsible left rail, right rail, and
|
|
724
|
+
* bottom drawer around a central work area (any absent). Collapsing snaps the
|
|
725
|
+
* panel's track to zero in one reflow while its fixed-size content slides out via
|
|
726
|
+
* a composited transform — the instant-width / sliding-content technique, so the
|
|
727
|
+
* work area relayouts once, not per frame. The app owns each `collapsed` flag;
|
|
728
|
+
* the collapse is pure CSS (no wire). See `docs/23-app-layouts.md` §3.3.
|
|
729
|
+
*/
|
|
730
|
+
declare function Workbench({ id, label, main, leftRail, rightRail, bottomDrawer, className, }: WorkbenchProps): SafeHtml;
|
|
731
|
+
|
|
732
|
+
export { Workbench, type WorkbenchPanel, type WorkbenchProps };
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
## `@kerfjs/ui/collapsible-panel`
|
|
736
|
+
|
|
737
|
+
```ts
|
|
738
|
+
import { SafeHtml } from 'kerfjs';
|
|
739
|
+
import { LucideIcon } from './lucide-icon.js';
|
|
740
|
+
import 'lucide';
|
|
741
|
+
|
|
742
|
+
/** Which edge a {@link CollapsiblePanel} docks to. */
|
|
743
|
+
type CollapsiblePanelSide = 'left' | 'right' | 'bottom';
|
|
744
|
+
/**
|
|
745
|
+
* The standard collapse/expand icon for a panel `side` and `collapsed` state,
|
|
746
|
+
* so every app's sidebars and drawers use one recognizable convention:
|
|
747
|
+
* `PanelLeft*` for a left rail, `PanelRight*` for a right rail, `PanelBottom*`
|
|
748
|
+
* for a bottom drawer — the `Close` glyph while open, the `Open` glyph while
|
|
749
|
+
* collapsed. Exposed so an app can render its own toggle affordance.
|
|
750
|
+
*/
|
|
751
|
+
declare function collapsiblePanelToggleIcon(side: CollapsiblePanelSide, collapsed: boolean): {
|
|
752
|
+
icon: Parameters<typeof LucideIcon>[0]['icon'];
|
|
753
|
+
name: string;
|
|
754
|
+
};
|
|
755
|
+
interface CollapsiblePanelToggleProps {
|
|
756
|
+
/** The panel this toggle controls. */
|
|
757
|
+
side: CollapsiblePanelSide;
|
|
758
|
+
/** The panel's current collapsed state (drives the icon direction). */
|
|
759
|
+
collapsed: boolean;
|
|
760
|
+
/** `data-action` the button carries so `wireSidebar` can delegate its click. */
|
|
761
|
+
action: string;
|
|
762
|
+
/** The panel id the button targets (`data-tab-panel`-style: `data-collapsible-panel`). */
|
|
763
|
+
panelId?: string;
|
|
764
|
+
/** Accessible label; defaults to "Collapse"/"Expand". */
|
|
765
|
+
label?: string;
|
|
766
|
+
className?: string;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* A standard collapse/expand toggle button for a {@link CollapsiblePanel}: the
|
|
770
|
+
* recognizable per-side icon (see {@link collapsiblePanelToggleIcon}) plus the
|
|
771
|
+
* `data-action` / `aria-expanded` `wireSidebar` reads. Placement is the app's —
|
|
772
|
+
* put it in the panel's own header (to collapse) and somewhere always-visible
|
|
773
|
+
* (to expand while collapsed).
|
|
774
|
+
*/
|
|
775
|
+
declare function CollapsiblePanelToggle({ side, collapsed, action, panelId, label, className, }: CollapsiblePanelToggleProps): SafeHtml;
|
|
776
|
+
interface CollapsiblePanelProps {
|
|
777
|
+
/** A stable id for the panel — `wireSidebar` targets it and toggles reference it. */
|
|
778
|
+
id: string;
|
|
779
|
+
/** Which edge the panel docks to: a left/right rail or a bottom drawer. */
|
|
780
|
+
side: CollapsiblePanelSide;
|
|
781
|
+
/** Whether the panel is currently collapsed (the app owns this signal). */
|
|
782
|
+
collapsed?: boolean;
|
|
783
|
+
/** Rail width or drawer height in px. Overrides the CSS default. */
|
|
784
|
+
size?: number;
|
|
785
|
+
/** Accessible label for the panel region. */
|
|
786
|
+
label?: string;
|
|
787
|
+
/** Panel content. */
|
|
788
|
+
children?: SafeHtml | readonly SafeHtml[];
|
|
789
|
+
className?: string;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* A standalone collapsible side rail or bottom drawer, outside the full
|
|
793
|
+
* {@link Workbench} shell. It owns only the presentation: a fixed-size content
|
|
794
|
+
* area that stays laid out while the panel's track snaps to zero and the content
|
|
795
|
+
* slides out via `transform` (one reflow, composited — the same technique
|
|
796
|
+
* `Workbench` and the catalog sidebar use). The app owns the `collapsed` signal;
|
|
797
|
+
* pair it with `wireSidebar` for the toggle, focus, compact-overlay, keyboard,
|
|
798
|
+
* and persistence semantics, and with `CollapsiblePanelToggle` for the standard
|
|
799
|
+
* affordance. See `docs/24-collapsible-panel.md`.
|
|
800
|
+
*/
|
|
801
|
+
declare function CollapsiblePanel({ id, side, collapsed, size, label, children, className, }: CollapsiblePanelProps): SafeHtml;
|
|
802
|
+
|
|
803
|
+
export { CollapsiblePanel, type CollapsiblePanelProps, type CollapsiblePanelSide, CollapsiblePanelToggle, type CollapsiblePanelToggleProps, collapsiblePanelToggleIcon };
|
|
804
|
+
```
|
|
805
|
+
|
|
806
|
+
## `@kerfjs/ui/wire-sidebar`
|
|
807
|
+
|
|
808
|
+
```ts
|
|
809
|
+
import { Signal, ReadonlySignal } from 'kerfjs';
|
|
810
|
+
import { DeviceClass } from './device-class.js';
|
|
811
|
+
|
|
812
|
+
/** Minimal `localStorage`-shaped store, so the persistence hook is testable. */
|
|
813
|
+
interface SidebarStorage {
|
|
814
|
+
getItem(key: string): string | null;
|
|
815
|
+
setItem(key: string, value: string): void;
|
|
816
|
+
}
|
|
817
|
+
interface WireSidebarPanel {
|
|
818
|
+
/** The panel id — matches `CollapsiblePanel`'s `id` and a toggle's `panelId`. */
|
|
819
|
+
id: string;
|
|
820
|
+
/** The app-owned collapsed signal. `wireSidebar` reads it (focus, overlay) and
|
|
821
|
+
* writes it (toggle, Escape, backdrop, persistence). */
|
|
822
|
+
collapsed: Signal<boolean>;
|
|
823
|
+
/** `data-action` value the panel's toggle button(s) carry. */
|
|
824
|
+
toggleAction: string;
|
|
825
|
+
/** When set, the collapsed state is loaded from and saved to `storage` under
|
|
826
|
+
* this key (a persistence hook), so the panel remembers its state. */
|
|
827
|
+
storageKey?: string;
|
|
828
|
+
}
|
|
829
|
+
interface WireSidebarOptions {
|
|
830
|
+
panels: readonly WireSidebarPanel[];
|
|
831
|
+
/**
|
|
832
|
+
* When provided, the sidebar adopts a compact **overlay** presentation while
|
|
833
|
+
* `deviceClass.compact` is true: an open panel floats over the content with a
|
|
834
|
+
* dismissable backdrop, Escape and backdrop-click collapse it, and focus is
|
|
835
|
+
* trapped within the open panel (the ARIA dialog pattern). Without it the panel
|
|
836
|
+
* is always inline.
|
|
837
|
+
*/
|
|
838
|
+
deviceClass?: ReadonlySignal<DeviceClass>;
|
|
839
|
+
/** Persistence store (default `globalThis.localStorage`, if present). */
|
|
840
|
+
storage?: SidebarStorage;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* The reusable sidebar-semantics layer for {@link CollapsiblePanel}s: toggle
|
|
844
|
+
* delegation with focus restore, focus-into on open, an optional compact overlay
|
|
845
|
+
* (backdrop + Escape + focus trap) driven by {@link deviceClass}, and an optional
|
|
846
|
+
* persistence hook. The app owns each `collapsed` signal and the layout; this wire
|
|
847
|
+
* owns the interaction. Returns a disposer. See `docs/24-collapsible-panel.md`.
|
|
848
|
+
*/
|
|
849
|
+
declare function wireSidebar(root: HTMLElement, { panels, deviceClass, storage }: WireSidebarOptions): () => void;
|
|
850
|
+
|
|
851
|
+
export { type SidebarStorage, type WireSidebarOptions, type WireSidebarPanel, wireSidebar };
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
## `@kerfjs/ui/tab-scaffold`
|
|
855
|
+
|
|
856
|
+
```ts
|
|
857
|
+
import { SafeHtml } from 'kerfjs';
|
|
858
|
+
|
|
859
|
+
interface TabScaffoldTab<Id extends string = string> {
|
|
860
|
+
id: Id;
|
|
861
|
+
label: string;
|
|
862
|
+
/** Decorative icon shown above the label in the bottom bar. */
|
|
863
|
+
icon?: SafeHtml;
|
|
864
|
+
/** The tab's content — typically a `NavStack` so each tab keeps its own stack. */
|
|
865
|
+
content: SafeHtml;
|
|
866
|
+
}
|
|
867
|
+
interface TabScaffoldProps<Id extends string = string> {
|
|
868
|
+
id: string;
|
|
869
|
+
/** Accessible name for the tab bar. */
|
|
870
|
+
label: string;
|
|
871
|
+
tabs: readonly TabScaffoldTab<Id>[];
|
|
872
|
+
/** The controlled active tab id (the app owns selection). */
|
|
873
|
+
active: NoInfer<Id>;
|
|
874
|
+
className?: string;
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* A mobile-first, iOS-like bottom tab scaffold: a bottom tab bar that switches
|
|
878
|
+
* between major sections, each tab keeping its own content (usually a `NavStack`)
|
|
879
|
+
* mounted so its stack and scroll survive a switch. Controlled — the app owns
|
|
880
|
+
* `active`; wire selection with `@kerfjs/ui/wire-tab-scaffold`'s `wireTabScaffold`.
|
|
881
|
+
* On larger classes, promote the tabs to a `Workbench` rail or sidebar instead of
|
|
882
|
+
* a bottom bar. See `docs/23-app-layouts.md` §3.4.
|
|
883
|
+
*/
|
|
884
|
+
declare function TabScaffold<Id extends string>({ id, label, tabs, active, className, }: TabScaffoldProps<Id>): SafeHtml;
|
|
885
|
+
|
|
886
|
+
export { TabScaffold, type TabScaffoldProps, type TabScaffoldTab };
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
## `@kerfjs/ui/wire-tab-scaffold`
|
|
890
|
+
|
|
891
|
+
```ts
|
|
892
|
+
interface WireTabScaffoldOptions {
|
|
893
|
+
/** Invoked with the selected tab id when a bottom-bar tab is activated. */
|
|
894
|
+
onSelect: (tabId: string) => void;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Wire a `TabScaffold`'s bottom tab bar: clicking a tab calls `onSelect` with its
|
|
898
|
+
* id (the app then updates its controlled `active`). Returns a disposer.
|
|
899
|
+
*/
|
|
900
|
+
declare function wireTabScaffold(root: Element, options: WireTabScaffoldOptions): () => void;
|
|
901
|
+
|
|
902
|
+
export { type WireTabScaffoldOptions, wireTabScaffold };
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
## `@kerfjs/ui/resizable-region`
|
|
906
|
+
|
|
907
|
+
```ts
|
|
908
|
+
import { SafeHtml } from 'kerfjs';
|
|
909
|
+
|
|
910
|
+
type ResizableRegionAxis = 'horizontal' | 'vertical';
|
|
911
|
+
type ResizableRegionEdge = 'start' | 'end';
|
|
912
|
+
interface ResizableRegionProps {
|
|
913
|
+
id: string;
|
|
914
|
+
label: string;
|
|
915
|
+
size: number;
|
|
916
|
+
min: number;
|
|
917
|
+
max: number;
|
|
918
|
+
axis?: ResizableRegionAxis;
|
|
919
|
+
edge?: ResizableRegionEdge;
|
|
920
|
+
collapsed?: boolean;
|
|
921
|
+
transitioning?: boolean;
|
|
922
|
+
/** Decorative dormant content for the separator handle. Must not contain interactive descendants. */
|
|
923
|
+
handleIcon?: SafeHtml;
|
|
924
|
+
children: SafeHtml | SafeHtml[];
|
|
925
|
+
}
|
|
926
|
+
declare const clampRegionSize: (size: number, min: number, max: number) => number;
|
|
927
|
+
declare const resizeRegionFromPointer: (startSize: number, delta: number, edge: ResizableRegionEdge) => number;
|
|
928
|
+
declare function ResizableRegion({ id, label, size, min, max, axis, edge, collapsed, transitioning, handleIcon, children, }: ResizableRegionProps): SafeHtml;
|
|
929
|
+
|
|
930
|
+
export { ResizableRegion, type ResizableRegionAxis, type ResizableRegionEdge, type ResizableRegionProps, clampRegionSize, resizeRegionFromPointer };
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
## `@kerfjs/ui/wire-resizable-regions`
|
|
934
|
+
|
|
935
|
+
```ts
|
|
936
|
+
interface ResizeCommit {
|
|
937
|
+
id: string;
|
|
938
|
+
size: number;
|
|
939
|
+
source: 'keyboard' | 'pointer';
|
|
940
|
+
}
|
|
941
|
+
interface WireResizableRegionsOptions {
|
|
942
|
+
step?: number;
|
|
943
|
+
largeStep?: number;
|
|
944
|
+
onPreview?: (change: ResizeCommit) => void;
|
|
945
|
+
onCommit: (change: ResizeCommit) => void;
|
|
946
|
+
}
|
|
947
|
+
/** Wire pointer and separator-keyboard behavior for every ResizableRegion below root. */
|
|
948
|
+
declare function wireResizableRegions(root: HTMLElement, { step, largeStep, onPreview, onCommit, }: WireResizableRegionsOptions): () => void;
|
|
949
|
+
|
|
950
|
+
export { type ResizeCommit, type WireResizableRegionsOptions, wireResizableRegions };
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
## `@kerfjs/ui/device-class`
|
|
954
|
+
|
|
955
|
+
```ts
|
|
956
|
+
import { ReadonlySignal } from 'kerfjs';
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Reactive device-class detection for `@kerfjs/ui` (see `docs/23-app-layouts.md`
|
|
960
|
+
* §2). `deviceClass()` returns a `ReadonlySignal<DeviceClass>` describing the
|
|
961
|
+
* current viewport as a size bucket × orientation × viewport-segment count, so a
|
|
962
|
+
* layout can pick its presentation reactively instead of hand-wiring `matchMedia`.
|
|
963
|
+
*
|
|
964
|
+
* One shared viewport source backs every reader; the pure `classifyViewport`
|
|
965
|
+
* core is DOM-free and directly unit-tested.
|
|
966
|
+
*/
|
|
967
|
+
type DeviceSize = 'xs-mobile' | 'mobile' | 'tablet' | 'desktop' | 'xl-desktop';
|
|
968
|
+
type DeviceOrientation = 'portrait' | 'landscape';
|
|
969
|
+
/** Minimum widths (px) at which each larger bucket begins. `xs-mobile` is 0. */
|
|
970
|
+
interface DeviceBreakpoints {
|
|
971
|
+
mobile: number;
|
|
972
|
+
tablet: number;
|
|
973
|
+
desktop: number;
|
|
974
|
+
'xl-desktop': number;
|
|
975
|
+
}
|
|
976
|
+
interface DeviceClass {
|
|
977
|
+
size: DeviceSize;
|
|
978
|
+
orientation: DeviceOrientation;
|
|
979
|
+
/** Horizontal viewport segments (foldables / dual-screen); 1 on ordinary devices. */
|
|
980
|
+
segments: number;
|
|
981
|
+
/** Vertical viewport segments; 1 on ordinary devices. */
|
|
982
|
+
verticalSegments: number;
|
|
983
|
+
/** Small phones — `xs-mobile` or `mobile`. */
|
|
984
|
+
handset: boolean;
|
|
985
|
+
/** "One pane at a time" — a handset or a portrait tablet. */
|
|
986
|
+
compact: boolean;
|
|
987
|
+
/** True when the current size is `size` or larger, e.g. `atLeast('tablet')`. */
|
|
988
|
+
atLeast(size: DeviceSize): boolean;
|
|
989
|
+
}
|
|
990
|
+
/** A raw viewport snapshot, before breakpoints are applied. */
|
|
991
|
+
interface Viewport {
|
|
992
|
+
width: number;
|
|
993
|
+
height: number;
|
|
994
|
+
segments: number;
|
|
995
|
+
verticalSegments: number;
|
|
996
|
+
}
|
|
997
|
+
interface DeviceClassOptions {
|
|
998
|
+
/** Override any of the default bucket thresholds. */
|
|
999
|
+
breakpoints?: Partial<DeviceBreakpoints>;
|
|
1000
|
+
/** The viewport assumed when there is no DOM (SSR). Defaults to 1024×768, one segment. */
|
|
1001
|
+
ssr?: Partial<Viewport>;
|
|
1002
|
+
}
|
|
1003
|
+
declare const DEFAULT_BREAKPOINTS: DeviceBreakpoints;
|
|
1004
|
+
/**
|
|
1005
|
+
* Classify a raw viewport into a {@link DeviceClass}. Pure and DOM-free — the
|
|
1006
|
+
* single source of truth for the bucketing rules.
|
|
1007
|
+
*/
|
|
1008
|
+
declare function classifyViewport(width: number, orientation: DeviceOrientation, segments?: number, verticalSegments?: number, breakpoints?: DeviceBreakpoints): DeviceClass;
|
|
1009
|
+
/**
|
|
1010
|
+
* A reactive signal of the current {@link DeviceClass}. Reading it inside an
|
|
1011
|
+
* `effect`/`computed` re-runs when the viewport crosses a breakpoint, rotates,
|
|
1012
|
+
* or changes its segment count. Without a DOM it resolves to `options.ssr`
|
|
1013
|
+
* (default 1024×768, landscape, one segment).
|
|
1014
|
+
*/
|
|
1015
|
+
declare function deviceClass(options?: DeviceClassOptions): ReadonlySignal<DeviceClass>;
|
|
1016
|
+
|
|
1017
|
+
export { DEFAULT_BREAKPOINTS, type DeviceBreakpoints, type DeviceClass, type DeviceClassOptions, type DeviceOrientation, type DeviceSize, type Viewport, classifyViewport, deviceClass };
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
## `@kerfjs/ui/catalog`
|
|
1021
|
+
|
|
1022
|
+
```ts
|
|
1023
|
+
import { SafeHtml } from 'kerfjs';
|
|
1024
|
+
|
|
1025
|
+
/** A reference link shown in the detail footer for the active entry. */
|
|
1026
|
+
interface CatalogResource {
|
|
1027
|
+
label: string;
|
|
1028
|
+
href: string;
|
|
1029
|
+
/** Optional monospace detail (e.g. a file path) shown after the label. */
|
|
1030
|
+
detail?: string;
|
|
1031
|
+
}
|
|
1032
|
+
/** A related entry offered in the detail footer's "Related entries" popup menu. */
|
|
1033
|
+
interface CatalogRelated {
|
|
1034
|
+
id: string;
|
|
1035
|
+
name: string;
|
|
1036
|
+
/** Group heading in the menu, e.g. "Uses" / "Used by". */
|
|
1037
|
+
group: string;
|
|
1038
|
+
}
|
|
1039
|
+
interface CatalogEntry {
|
|
1040
|
+
id: string;
|
|
1041
|
+
name: string;
|
|
1042
|
+
description?: string;
|
|
1043
|
+
/** Short metadata tags shown at the trailing edge of the sidebar row. */
|
|
1044
|
+
tags?: readonly string[];
|
|
1045
|
+
resources?: readonly CatalogResource[];
|
|
1046
|
+
related?: readonly CatalogRelated[];
|
|
1047
|
+
}
|
|
1048
|
+
interface CatalogSection {
|
|
1049
|
+
category: string;
|
|
1050
|
+
entries: readonly CatalogEntry[];
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* A secondary group of sections shown below the primary sidebar sections with a
|
|
1054
|
+
* quieter "ecosystem" treatment (e.g. third-party components). Optionally
|
|
1055
|
+
* collapsible — the app owns `expanded` and toggles it from `wireCatalog`'s
|
|
1056
|
+
* `onToggleSecondary`.
|
|
1057
|
+
*/
|
|
1058
|
+
interface CatalogSecondaryGroup {
|
|
1059
|
+
label: string;
|
|
1060
|
+
sections: readonly CatalogSection[];
|
|
1061
|
+
/** When true, the group's label is a disclosure toggle controlling `expanded`. */
|
|
1062
|
+
collapsible?: boolean;
|
|
1063
|
+
/** Whether the group is expanded (controlled). Ignored unless `collapsible`. */
|
|
1064
|
+
expanded?: boolean;
|
|
1065
|
+
}
|
|
1066
|
+
interface CatalogBrand {
|
|
1067
|
+
title: string;
|
|
1068
|
+
subtitle?: string;
|
|
1069
|
+
/** Logo image URL (rendered decorative). Omit for a text-only brand. */
|
|
1070
|
+
logoUrl?: string;
|
|
1071
|
+
}
|
|
1072
|
+
interface CatalogProps {
|
|
1073
|
+
brand: CatalogBrand;
|
|
1074
|
+
sections: readonly CatalogSection[];
|
|
1075
|
+
/** The controlled active entry id — the app owns this signal. */
|
|
1076
|
+
active: string;
|
|
1077
|
+
/** The rendered preview for the active entry; the app computes it from `active`. */
|
|
1078
|
+
content: SafeHtml;
|
|
1079
|
+
/** Whether the sidebar is collapsed (controlled). */
|
|
1080
|
+
collapsed?: boolean;
|
|
1081
|
+
/** Current theme; when set, a theme toggle is shown that switches to the opposite. Omit to hide it. */
|
|
1082
|
+
theme?: 'light' | 'dark';
|
|
1083
|
+
/** Extra header controls placed before the theme toggle (each a `ToolbarControlGroup`). */
|
|
1084
|
+
headerActions?: SafeHtml;
|
|
1085
|
+
/** A secondary "ecosystem" group of sections below the primary category groups. */
|
|
1086
|
+
secondarySections?: CatalogSecondaryGroup;
|
|
1087
|
+
/** Extra sidebar content below the category groups (and the secondary group). */
|
|
1088
|
+
sidebarFooter?: SafeHtml;
|
|
1089
|
+
/** Status line content shown at the start of the detail footer. */
|
|
1090
|
+
status?: SafeHtml;
|
|
1091
|
+
/**
|
|
1092
|
+
* Whether to highlight specimens' computed borders (or transparent outer
|
|
1093
|
+
* bounds) and non-zero margins. Pass a boolean (rather than omitting the
|
|
1094
|
+
* prop) when the active entry can switch between component and composition
|
|
1095
|
+
* previews; `wireCatalogGeometryOverlay` keeps the overlay synchronized.
|
|
1096
|
+
*/
|
|
1097
|
+
geometryOverlay?: boolean;
|
|
1098
|
+
selectAction?: string;
|
|
1099
|
+
toggleSidebarAction?: string;
|
|
1100
|
+
toggleThemeAction?: string;
|
|
1101
|
+
/** Action fired by the secondary group's disclosure toggle (when collapsible). */
|
|
1102
|
+
toggleSecondaryAction?: string;
|
|
1103
|
+
className?: string;
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* A reusable component-catalog shell: a collapsible category sidebar, a titled
|
|
1107
|
+
* detail stage that renders the active entry's preview, and a footer with
|
|
1108
|
+
* reference links and a related-entry popup menu. Built entirely from public
|
|
1109
|
+
* `@kerfjs/ui` primitives. Controlled and stateless — the app owns the `active`,
|
|
1110
|
+
* `collapsed`, and `theme` signals and computes `content` from `active` in its own
|
|
1111
|
+
* render; wire the sidebar/collapse/theme actions with `wireCatalog`.
|
|
1112
|
+
*/
|
|
1113
|
+
declare function Catalog({ brand, sections, active, content, collapsed, theme, headerActions, secondarySections, sidebarFooter, status, geometryOverlay, selectAction, toggleSidebarAction, toggleThemeAction, toggleSecondaryAction, className, }: CatalogProps): SafeHtml;
|
|
1114
|
+
/**
|
|
1115
|
+
* How a {@link CatalogExample}'s content aligns its visible left edge with the
|
|
1116
|
+
* example's `ListHeader` label (which sits 16px in — 8px title + 8px label):
|
|
1117
|
+
* - `'glyph'` — a bare glyph/text specimen with no inline geometry insets the full 16px.
|
|
1118
|
+
* - `'inline-control'` — a control that already carries ~8px of its own inline padding insets 8px so its content lands on the same line.
|
|
1119
|
+
* - `'none'` — a content-item / composition that owns its geometry and already aligns; no inset (default).
|
|
1120
|
+
*/
|
|
1121
|
+
type CatalogExampleAlign = 'glyph' | 'inline-control' | 'none';
|
|
1122
|
+
type CatalogExampleRootAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
1123
|
+
'data-catalog-example'?: never;
|
|
1124
|
+
'data-catalog-example-stack'?: never;
|
|
1125
|
+
'data-catalog-example-label'?: never;
|
|
1126
|
+
'data-catalog-example-note'?: never;
|
|
1127
|
+
'data-align'?: never;
|
|
1128
|
+
}>;
|
|
1129
|
+
type CatalogExampleStackRootAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
1130
|
+
'data-catalog-example'?: never;
|
|
1131
|
+
'data-catalog-example-stack'?: never;
|
|
1132
|
+
'data-catalog-example-label'?: never;
|
|
1133
|
+
'data-catalog-example-note'?: never;
|
|
1134
|
+
'data-align'?: never;
|
|
1135
|
+
}>;
|
|
1136
|
+
interface CatalogExampleProps {
|
|
1137
|
+
/** The example's label, shown as a `ListHeader` above the specimen. Omit for a bare specimen. */
|
|
1138
|
+
label?: string;
|
|
1139
|
+
/** Optional explanatory note between the label and the specimen. */
|
|
1140
|
+
note?: SafeHtml | string;
|
|
1141
|
+
/** Alignment inset for the specimen — see {@link CatalogExampleAlign}. Default `'none'`. */
|
|
1142
|
+
align?: CatalogExampleAlign;
|
|
1143
|
+
/** Safe authoring `data-*` metadata for the rendered section. Helper-owned structural attributes remain protected. */
|
|
1144
|
+
rootAttributes?: CatalogExampleRootAttributes;
|
|
1145
|
+
className?: string;
|
|
1146
|
+
children?: SafeHtml | readonly SafeHtml[];
|
|
1147
|
+
}
|
|
1148
|
+
/**
|
|
1149
|
+
* One labeled example in a catalog preview: a `ListHeader` label, an optional
|
|
1150
|
+
* note, and the specimen. `align` insets the specimen so its visible left edge
|
|
1151
|
+
* lines up with the label text, encoding the catalog's alignment rules as a
|
|
1152
|
+
* first-class prop instead of per-demo CSS. The inset is published as the
|
|
1153
|
+
* `--kui-catalog-example-align` custom property so a debug overlay can exclude it
|
|
1154
|
+
* from a specimen's measured margin.
|
|
1155
|
+
*/
|
|
1156
|
+
declare function CatalogExample({ label, note, align, rootAttributes, className, children, }: CatalogExampleProps): SafeHtml;
|
|
1157
|
+
interface CatalogExampleStackProps {
|
|
1158
|
+
/** Accessible label for the stack region. */
|
|
1159
|
+
label?: string;
|
|
1160
|
+
/** Safe authoring `data-*` metadata for the rendered stack. Helper-owned structural attributes remain protected. */
|
|
1161
|
+
rootAttributes?: CatalogExampleStackRootAttributes;
|
|
1162
|
+
className?: string;
|
|
1163
|
+
children?: SafeHtml | readonly SafeHtml[];
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* A vertically-stacked group of {@link CatalogExample}s with the catalog's
|
|
1167
|
+
* example rhythm. The semantic `section` becomes a named `region` when `label`
|
|
1168
|
+
* is supplied; an unlabeled stack remains an ordinary grouping.
|
|
1169
|
+
*/
|
|
1170
|
+
declare function CatalogExampleStack({ label, rootAttributes, className, children, }: CatalogExampleStackProps): SafeHtml;
|
|
1171
|
+
|
|
1172
|
+
export { Catalog, type CatalogBrand, type CatalogEntry, CatalogExample, type CatalogExampleAlign, type CatalogExampleProps, CatalogExampleStack, type CatalogExampleStackProps, type CatalogProps, type CatalogRelated, type CatalogResource, type CatalogSecondaryGroup, type CatalogSection };
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
## `@kerfjs/ui/catalog-resources`
|
|
1176
|
+
|
|
1177
|
+
```ts
|
|
1178
|
+
import { CatalogResource } from './catalog.js';
|
|
1179
|
+
import 'kerfjs';
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* Standard resource labels for a Kerf catalog detail footer. Keep these labels
|
|
1183
|
+
* stable across catalogs so people and AI-generated integrations see the same
|
|
1184
|
+
* choices in the same vocabulary.
|
|
1185
|
+
*/
|
|
1186
|
+
type CatalogResourceKind = 'demoSource' | 'componentSource' | 'designTemplate' | 'guidance' | 'integrationGuidance';
|
|
1187
|
+
type CatalogGuidanceKind = 'guidance' | 'integrationGuidance';
|
|
1188
|
+
interface CatalogResourceTarget {
|
|
1189
|
+
href: string;
|
|
1190
|
+
/** Optional monospace detail, normally the repository-relative source path. */
|
|
1191
|
+
detail?: string;
|
|
1192
|
+
}
|
|
1193
|
+
interface CatalogResourcesInput {
|
|
1194
|
+
/** Required source for the runnable demonstration. */
|
|
1195
|
+
demoSource: CatalogResourceTarget;
|
|
1196
|
+
/** Source for the production component; omit for recipes and integrations. */
|
|
1197
|
+
componentSource?: CatalogResourceTarget;
|
|
1198
|
+
/** Optional design-tool template associated with the component. */
|
|
1199
|
+
designTemplate?: CatalogResourceTarget;
|
|
1200
|
+
/** Required UI or integration guidance. */
|
|
1201
|
+
guidance: CatalogResourceTarget;
|
|
1202
|
+
/** Use `integrationGuidance` when the component implementation is upstream. */
|
|
1203
|
+
guidanceKind?: CatalogGuidanceKind;
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* Build the standard catalog resource group in its canonical order: demo,
|
|
1207
|
+
* component, optional design template, then guidance.
|
|
1208
|
+
*/
|
|
1209
|
+
declare function catalogResources(input: CatalogResourcesInput): CatalogResource[];
|
|
1210
|
+
|
|
1211
|
+
export { type CatalogGuidanceKind, type CatalogResourceKind, type CatalogResourceTarget, type CatalogResourcesInput, catalogResources };
|
|
1212
|
+
```
|
|
1213
|
+
|
|
1214
|
+
## `@kerfjs/ui/wire-catalog`
|
|
1215
|
+
|
|
1216
|
+
```ts
|
|
1217
|
+
interface WireCatalogOptions {
|
|
1218
|
+
/** Invoked with the entry id when a sidebar item or a related-entry option is chosen. */
|
|
1219
|
+
onSelect: (id: string) => void;
|
|
1220
|
+
/** Invoked when the sidebar collapse/expand control is activated. */
|
|
1221
|
+
onToggleSidebar?: () => void;
|
|
1222
|
+
/** Invoked when the theme toggle is activated. */
|
|
1223
|
+
onToggleTheme?: () => void;
|
|
1224
|
+
/** Invoked when the secondary (ecosystem) group's disclosure toggle is activated. */
|
|
1225
|
+
onToggleSecondary?: () => void;
|
|
1226
|
+
/** When set, `?<urlParam>=<id>` is written on select via `history.replaceState`. */
|
|
1227
|
+
urlParam?: string;
|
|
1228
|
+
/**
|
|
1229
|
+
* Reveal the chosen sidebar row after selection. `true` uses desktop-safe
|
|
1230
|
+
* defaults; pass options to customize scroll alignment or the media guard.
|
|
1231
|
+
*/
|
|
1232
|
+
revealSelection?: boolean | CatalogRevealOptions;
|
|
1233
|
+
selectAction?: string;
|
|
1234
|
+
toggleSidebarAction?: string;
|
|
1235
|
+
toggleThemeAction?: string;
|
|
1236
|
+
toggleSecondaryAction?: string;
|
|
1237
|
+
}
|
|
1238
|
+
interface CatalogRevealOptions {
|
|
1239
|
+
/** Scroll alignment within the sidebar. Default `'nearest'`. */
|
|
1240
|
+
block?: ScrollLogicalPosition;
|
|
1241
|
+
/** Cross-axis alignment. Default `'nearest'`. */
|
|
1242
|
+
inline?: ScrollLogicalPosition;
|
|
1243
|
+
/** Scroll behavior. Default `'auto'`. */
|
|
1244
|
+
behavior?: ScrollBehavior;
|
|
1245
|
+
/**
|
|
1246
|
+
* Only reveal when this media query matches. Defaults to the Catalog's
|
|
1247
|
+
* desktop layout; pass `false` to reveal at every viewport size.
|
|
1248
|
+
*/
|
|
1249
|
+
media?: string | false;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Reveal one Catalog sidebar entry after the controlled render settles without
|
|
1253
|
+
* moving focus. Returns a cancellation function for rapid selection changes.
|
|
1254
|
+
*/
|
|
1255
|
+
declare function revealCatalogEntry(root: HTMLElement, id: string, { block, inline, behavior, media, }?: CatalogRevealOptions): () => void;
|
|
1256
|
+
/**
|
|
1257
|
+
* Keep a Catalog's opt-in geometry overlay synchronized with its preview.
|
|
1258
|
+
* Specimens receive computed border highlights (or a dashed bound when they
|
|
1259
|
+
* have no border and are transparent), while positive computed margins use
|
|
1260
|
+
* devtools-style orange bands. CSS/stylesheet-only changes are observed too.
|
|
1261
|
+
* Returns a disposer.
|
|
1262
|
+
*/
|
|
1263
|
+
declare function wireCatalogGeometryOverlay(root: HTMLElement): () => void;
|
|
1264
|
+
/**
|
|
1265
|
+
* Wire a {@link Catalog}'s interactions with one delegated listener set: sidebar
|
|
1266
|
+
* item selection (and the related-entry popup menu), the sidebar collapse toggle, and
|
|
1267
|
+
* the theme toggle. The app owns the `active`/`collapsed`/`theme` signals and updates
|
|
1268
|
+
* them in the callbacks; optionally mirror the active id into the URL via `urlParam`.
|
|
1269
|
+
* Returns a disposer.
|
|
1270
|
+
*/
|
|
1271
|
+
declare function wireCatalog(root: HTMLElement, { onSelect, onToggleSidebar, onToggleTheme, onToggleSecondary, urlParam, revealSelection, selectAction, toggleSidebarAction, toggleThemeAction, toggleSecondaryAction, }: WireCatalogOptions): () => void;
|
|
1272
|
+
|
|
1273
|
+
export { type CatalogRevealOptions, type WireCatalogOptions, revealCatalogEntry, wireCatalog, wireCatalogGeometryOverlay };
|
|
1274
|
+
```
|
|
1275
|
+
|
|
1276
|
+
## `@kerfjs/ui/segmented-control`
|
|
1277
|
+
|
|
1278
|
+
```ts
|
|
1279
|
+
import { SafeHtml } from 'kerfjs';
|
|
1280
|
+
|
|
1281
|
+
type SegmentedControlAppearance = 'filled' | 'outlined' | 'toolbar';
|
|
1282
|
+
type SegmentedControlShape = 'rounded' | 'pill';
|
|
1283
|
+
type SegmentedControlSize = 'small' | 'default';
|
|
1284
|
+
type SegmentedControlLayout = 'content' | 'equal';
|
|
1285
|
+
interface SegmentedControlChoice<Value extends string = string> {
|
|
1286
|
+
value: Value;
|
|
1287
|
+
label: string;
|
|
1288
|
+
content?: SafeHtml;
|
|
1289
|
+
title?: string;
|
|
1290
|
+
disabled?: boolean;
|
|
1291
|
+
}
|
|
1292
|
+
interface SegmentedControlProps<Value extends string = string> {
|
|
1293
|
+
id: string;
|
|
1294
|
+
label: string;
|
|
1295
|
+
value: NoInfer<Value>;
|
|
1296
|
+
choices: readonly SegmentedControlChoice<Value>[];
|
|
1297
|
+
action?: string;
|
|
1298
|
+
appearance?: SegmentedControlAppearance;
|
|
1299
|
+
shape?: SegmentedControlShape;
|
|
1300
|
+
size?: SegmentedControlSize;
|
|
1301
|
+
layout?: SegmentedControlLayout;
|
|
1302
|
+
className?: string;
|
|
1303
|
+
/** Render as an unanimated loading skeleton, disabling every segment. */
|
|
1304
|
+
placeholder?: boolean;
|
|
1305
|
+
}
|
|
1306
|
+
declare function SegmentedControl<Value extends string>({ id, label, value, choices, action, appearance, shape, size, layout, className, placeholder, }: SegmentedControlProps<Value>): SafeHtml;
|
|
1307
|
+
|
|
1308
|
+
export { SegmentedControl, type SegmentedControlAppearance, type SegmentedControlChoice, type SegmentedControlLayout, type SegmentedControlProps, type SegmentedControlShape, type SegmentedControlSize };
|
|
1309
|
+
```
|
|
1310
|
+
|
|
1311
|
+
## `@kerfjs/ui/select`
|
|
1312
|
+
|
|
1313
|
+
```ts
|
|
1314
|
+
import { SafeHtml } from 'kerfjs';
|
|
1315
|
+
import { LucideNode } from './lucide-icon.js';
|
|
1316
|
+
import 'lucide';
|
|
1317
|
+
|
|
1318
|
+
interface SelectChoice<Value extends string = string> {
|
|
1319
|
+
value: Value;
|
|
1320
|
+
label: string;
|
|
1321
|
+
icon?: LucideNode;
|
|
1322
|
+
iconName?: string;
|
|
1323
|
+
color?: string;
|
|
1324
|
+
group?: string;
|
|
1325
|
+
separatorBefore?: boolean;
|
|
1326
|
+
}
|
|
1327
|
+
type SelectAccessibleName = {
|
|
1328
|
+
label: string;
|
|
1329
|
+
ariaLabel?: string;
|
|
1330
|
+
} | {
|
|
1331
|
+
label?: never;
|
|
1332
|
+
ariaLabel: string;
|
|
1333
|
+
};
|
|
1334
|
+
interface SelectBaseProps<Value extends string = string> {
|
|
1335
|
+
name: string;
|
|
1336
|
+
value: NoInfer<Value>;
|
|
1337
|
+
choices: readonly SelectChoice<Value>[];
|
|
1338
|
+
className?: string;
|
|
1339
|
+
/** Empty-value hint text shown in the closed control (the native select placeholder). */
|
|
1340
|
+
placeholderText?: string;
|
|
1341
|
+
disabled?: boolean;
|
|
1342
|
+
fitMenu?: boolean;
|
|
1343
|
+
renderSelected?: (choice: SelectChoice<Value>) => SafeHtml;
|
|
1344
|
+
/** Render as an unanimated loading skeleton: the label above a static, empty control box. */
|
|
1345
|
+
placeholder?: boolean;
|
|
1346
|
+
}
|
|
1347
|
+
type SelectProps<Value extends string = string> = SelectBaseProps<Value> & SelectAccessibleName;
|
|
1348
|
+
declare function Select<Value extends string>({ name, value, label, ariaLabel, choices, className, placeholderText, disabled, fitMenu, renderSelected, placeholder, }: SelectProps<Value>): SafeHtml;
|
|
1349
|
+
|
|
1350
|
+
export { Select, type SelectChoice, type SelectProps };
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
## `@kerfjs/ui/state-banner`
|
|
1354
|
+
|
|
1355
|
+
```ts
|
|
1356
|
+
import { SafeHtml } from 'kerfjs';
|
|
1357
|
+
|
|
1358
|
+
type StateBannerTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
1359
|
+
type StateBannerUrgency = 'status' | 'alert';
|
|
1360
|
+
interface StateBannerProps {
|
|
1361
|
+
title: string;
|
|
1362
|
+
detail?: string;
|
|
1363
|
+
/** Optional compact status or count shown beside the title. */
|
|
1364
|
+
badge?: string;
|
|
1365
|
+
icon?: SafeHtml;
|
|
1366
|
+
action?: SafeHtml;
|
|
1367
|
+
tone?: StateBannerTone;
|
|
1368
|
+
urgency?: StateBannerUrgency;
|
|
1369
|
+
className?: string;
|
|
1370
|
+
/** Render the title, badge, and detail as unanimated loading skeletons, keeping the icon and tone. */
|
|
1371
|
+
placeholder?: boolean;
|
|
1372
|
+
}
|
|
1373
|
+
declare function StateBanner({ title, detail, badge, icon, action, tone, urgency, className, placeholder, }: StateBannerProps): SafeHtml;
|
|
1374
|
+
|
|
1375
|
+
export { StateBanner, type StateBannerProps, type StateBannerTone, type StateBannerUrgency };
|
|
1376
|
+
```
|
|
1377
|
+
|
|
1378
|
+
## `@kerfjs/ui/empty-state`
|
|
1379
|
+
|
|
1380
|
+
```ts
|
|
1381
|
+
import { SafeHtml } from 'kerfjs';
|
|
1382
|
+
|
|
1383
|
+
interface EmptyStateProps {
|
|
1384
|
+
title: string;
|
|
1385
|
+
detail?: string;
|
|
1386
|
+
icon?: SafeHtml;
|
|
1387
|
+
action?: SafeHtml;
|
|
1388
|
+
busy?: boolean;
|
|
1389
|
+
className?: string;
|
|
1390
|
+
}
|
|
1391
|
+
declare function EmptyState({ title, detail, icon, action, busy, className, }: EmptyStateProps): SafeHtml;
|
|
1392
|
+
|
|
1393
|
+
export { EmptyState, type EmptyStateProps };
|
|
1394
|
+
```
|
|
1395
|
+
|
|
1396
|
+
## `@kerfjs/ui/loading-spinner`
|
|
1397
|
+
|
|
1398
|
+
```ts
|
|
1399
|
+
import * as kerfjs from 'kerfjs';
|
|
1400
|
+
|
|
1401
|
+
interface LoadingSpinnerProps {
|
|
1402
|
+
className?: string;
|
|
1403
|
+
label?: string;
|
|
1404
|
+
}
|
|
1405
|
+
/** Stable viewBox-centered progress ring based on svg-spinners' MIT-licensed 180-ring. */
|
|
1406
|
+
declare function LoadingSpinner({ className, label }: LoadingSpinnerProps): kerfjs.SafeHtml;
|
|
1407
|
+
|
|
1408
|
+
export { LoadingSpinner, type LoadingSpinnerProps };
|
|
1409
|
+
```
|
|
1410
|
+
|
|
1411
|
+
## `@kerfjs/ui/skeleton`
|
|
1412
|
+
|
|
1413
|
+
```ts
|
|
1414
|
+
import * as kerfjs from 'kerfjs';
|
|
1415
|
+
|
|
1416
|
+
interface SkeletonProps {
|
|
1417
|
+
/** Width as any browser CSS length (e.g. `7.5rem`, `60%`). Defaults to filling its slot. */
|
|
1418
|
+
width?: string;
|
|
1419
|
+
/** Height as any CSS length. Defaults to a single text line. */
|
|
1420
|
+
height?: string;
|
|
1421
|
+
/** Corner radius override (a CSS length). Defaults to the small radius token. */
|
|
1422
|
+
radius?: string;
|
|
1423
|
+
/** Render this many stacked lines (the last one shorter), for multi-line text. */
|
|
1424
|
+
lines?: number;
|
|
1425
|
+
/** Accessible label. Omit to keep the block decorative (`aria-hidden`). */
|
|
1426
|
+
label?: string;
|
|
1427
|
+
className?: string;
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* A subtle, deliberately **unanimated** loading placeholder block. Use it for a
|
|
1431
|
+
* value slot whose content is not yet known, on its own or via a component's
|
|
1432
|
+
* `placeholder` prop. Decorative by default (`aria-hidden`); pass `label` to
|
|
1433
|
+
* announce it. Sizes to its slot unless `width`/`height` are given.
|
|
1434
|
+
*/
|
|
1435
|
+
declare function Skeleton({ width, height, radius, lines, label, className, }: SkeletonProps): kerfjs.SafeHtml;
|
|
1436
|
+
|
|
1437
|
+
export { Skeleton, type SkeletonProps };
|
|
1438
|
+
```
|
|
1439
|
+
|
|
1440
|
+
## `@kerfjs/ui/sunken-panel`
|
|
1441
|
+
|
|
1442
|
+
```ts
|
|
1443
|
+
import { SafeHtml } from 'kerfjs';
|
|
1444
|
+
|
|
1445
|
+
type SunkenPanelShape = 'rounded' | 'square';
|
|
1446
|
+
interface SunkenPanelProps {
|
|
1447
|
+
children?: SafeHtml | readonly SafeHtml[];
|
|
1448
|
+
/** Optional accessible landmark name for a distinct application region. */
|
|
1449
|
+
ariaLabel?: string;
|
|
1450
|
+
/** Corner shape: a rounded rectangle (default) or square corners. */
|
|
1451
|
+
shape?: SunkenPanelShape;
|
|
1452
|
+
className?: string;
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* A lowered application surface with one compact inset and a vertical content
|
|
1456
|
+
* stack. The panel owns its background and padding; children own their own
|
|
1457
|
+
* borders and internal geometry.
|
|
1458
|
+
*/
|
|
1459
|
+
declare function SunkenPanel({ children, ariaLabel, shape, className, }: SunkenPanelProps): SafeHtml;
|
|
1460
|
+
|
|
1461
|
+
export { SunkenPanel, type SunkenPanelProps, type SunkenPanelShape };
|
|
1462
|
+
```
|
|
1463
|
+
|
|
1464
|
+
## `@kerfjs/ui/token-search-field`
|
|
1465
|
+
|
|
1466
|
+
```ts
|
|
1467
|
+
import { SafeHtml } from 'kerfjs';
|
|
1468
|
+
|
|
1469
|
+
interface TokenSearchToken {
|
|
1470
|
+
value: string;
|
|
1471
|
+
label: string;
|
|
1472
|
+
offset?: number;
|
|
1473
|
+
accessibleLabel?: string;
|
|
1474
|
+
}
|
|
1475
|
+
type TokenSearchEditorAttributes = Readonly<Record<`data-${string}`, string | undefined> & {
|
|
1476
|
+
'data-component'?: never;
|
|
1477
|
+
'data-key'?: never;
|
|
1478
|
+
'data-morph-skip'?: never;
|
|
1479
|
+
'data-token-search-editor'?: never;
|
|
1480
|
+
'data-token-count'?: never;
|
|
1481
|
+
'data-placeholder'?: never;
|
|
1482
|
+
}>;
|
|
1483
|
+
interface TokenSearchFieldBaseProps {
|
|
1484
|
+
id: string;
|
|
1485
|
+
label: string;
|
|
1486
|
+
query?: string;
|
|
1487
|
+
tokens?: readonly TokenSearchToken[];
|
|
1488
|
+
placeholder?: string;
|
|
1489
|
+
tokenPlaceholder?: string;
|
|
1490
|
+
disabled?: boolean;
|
|
1491
|
+
autofocus?: boolean;
|
|
1492
|
+
leading?: SafeHtml;
|
|
1493
|
+
trailing?: SafeHtml;
|
|
1494
|
+
editAction?: string;
|
|
1495
|
+
removeAction?: string;
|
|
1496
|
+
clearAction?: string;
|
|
1497
|
+
clearLabel?: string;
|
|
1498
|
+
className?: string;
|
|
1499
|
+
editorAttributes?: TokenSearchEditorAttributes;
|
|
1500
|
+
}
|
|
1501
|
+
type TokenSearchCollapsibleProps = {
|
|
1502
|
+
/** Allow an empty field to render as one iconic action. */
|
|
1503
|
+
collapsible: true;
|
|
1504
|
+
/** Keep an empty collapsible field open while the application owns focus. */
|
|
1505
|
+
expanded?: boolean;
|
|
1506
|
+
expandAction?: string;
|
|
1507
|
+
expandLabel?: string;
|
|
1508
|
+
} | {
|
|
1509
|
+
collapsible?: false;
|
|
1510
|
+
expanded?: never;
|
|
1511
|
+
expandAction?: never;
|
|
1512
|
+
expandLabel?: never;
|
|
1513
|
+
};
|
|
1514
|
+
type TokenSearchFieldProps = TokenSearchFieldBaseProps & TokenSearchCollapsibleProps;
|
|
1515
|
+
interface TokenSearchFieldValue {
|
|
1516
|
+
query: string;
|
|
1517
|
+
tokens: TokenSearchToken[];
|
|
1518
|
+
}
|
|
1519
|
+
declare function TokenSearchField({ id, label, query, tokens, placeholder, tokenPlaceholder, disabled, autofocus, collapsible, expanded, expandAction, expandLabel, leading, trailing, editAction, removeAction, clearAction, clearLabel, className, editorAttributes, }: TokenSearchFieldProps): SafeHtml;
|
|
1520
|
+
/** Read editable text and ordered token offsets from a rendered TokenSearchField editor. */
|
|
1521
|
+
declare function readTokenSearchField(editor: HTMLElement, knownTokens?: readonly TokenSearchToken[]): TokenSearchFieldValue;
|
|
1522
|
+
/** Focus an editor and place its caret at a text offset, skipping atomic token chips. */
|
|
1523
|
+
declare function placeTokenSearchCaret(editor: HTMLElement, offset?: number): void;
|
|
1524
|
+
|
|
1525
|
+
export { type TokenSearchEditorAttributes, TokenSearchField, type TokenSearchFieldProps, type TokenSearchFieldValue, type TokenSearchToken, placeTokenSearchCaret, readTokenSearchField };
|
|
1526
|
+
```
|
|
1527
|
+
|
|
1528
|
+
## `@kerfjs/ui/wire-token-search-fields`
|
|
1529
|
+
|
|
1530
|
+
```ts
|
|
1531
|
+
import { Signal } from 'kerfjs';
|
|
1532
|
+
|
|
1533
|
+
interface TokenSearchSubmit {
|
|
1534
|
+
id: string;
|
|
1535
|
+
editor: HTMLElement;
|
|
1536
|
+
}
|
|
1537
|
+
/** Reported to {@link WireTokenSearchFieldsOptions.onEdit} on every editor input. */
|
|
1538
|
+
interface TokenSearchEdit extends TokenSearchSubmit {
|
|
1539
|
+
/**
|
|
1540
|
+
* The `InputEvent` that mutated the editor — read `event.inputType` / `event.data`
|
|
1541
|
+
* to gate commit behavior (e.g. only parse a chip on whitespace-terminated input)
|
|
1542
|
+
* without keeping a separate `input` listener.
|
|
1543
|
+
*/
|
|
1544
|
+
event: InputEvent;
|
|
1545
|
+
}
|
|
1546
|
+
/** Reported when adjacent-token keyboard deletion asks the app to drop a chip. */
|
|
1547
|
+
interface TokenSearchTokenRemoval {
|
|
1548
|
+
id: string;
|
|
1549
|
+
/** The `data-token-value` of the token the app should remove from its state. */
|
|
1550
|
+
value: string;
|
|
1551
|
+
editor: HTMLElement;
|
|
1552
|
+
/** `'backward'` = the token before the caret (Backspace); `'forward'` = after (Delete). */
|
|
1553
|
+
direction: 'backward' | 'forward';
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* Opt-in keyboard behavior for the atomic token chips. Off unless `keyboard` is
|
|
1557
|
+
* set; each piece defaults on once opted in. The helper never mutates app state:
|
|
1558
|
+
* a removal is reported through {@link TokenSearchKeyboardOptions.onRemoveToken}
|
|
1559
|
+
* for the caller to apply, while caret movement past a chip is a pure ephemeral
|
|
1560
|
+
* mechanic the helper performs itself.
|
|
1561
|
+
*/
|
|
1562
|
+
interface TokenSearchKeyboardBaseOptions {
|
|
1563
|
+
/**
|
|
1564
|
+
* From a collapsed caret with no selection, Backspace removes the token
|
|
1565
|
+
* immediately before it and Delete the token immediately after — reported via
|
|
1566
|
+
* `onRemoveToken` — instead of deleting a character. Default: true.
|
|
1567
|
+
*/
|
|
1568
|
+
/**
|
|
1569
|
+
* ArrowRight moves the caret past a trailing atomic token so text typed next
|
|
1570
|
+
* lands after the chip. Default: true.
|
|
1571
|
+
*/
|
|
1572
|
+
moveCaretPastToken?: boolean;
|
|
1573
|
+
}
|
|
1574
|
+
type TokenSearchKeyboardOptions = TokenSearchKeyboardBaseOptions & ({
|
|
1575
|
+
removeAdjacentToken?: true;
|
|
1576
|
+
/** Apply the reported removal to your controlled state, then re-render. */
|
|
1577
|
+
onRemoveToken: (removal: TokenSearchTokenRemoval) => void;
|
|
1578
|
+
} | {
|
|
1579
|
+
removeAdjacentToken: false;
|
|
1580
|
+
onRemoveToken?: never;
|
|
1581
|
+
});
|
|
1582
|
+
/**
|
|
1583
|
+
* Managed collapsible behavior for the iconic TokenSearchField. Every piece is on
|
|
1584
|
+
* by default; disable a specific one to own it in the app. Provide `signals` to
|
|
1585
|
+
* drive app-owned `expanded` signals per field id instead of helper-created ones.
|
|
1586
|
+
*/
|
|
1587
|
+
interface TokenSearchCollapsibleOptions {
|
|
1588
|
+
/** Expand the field and focus its editor when the iconic trigger is activated. Default: true. */
|
|
1589
|
+
expandOnActivate?: boolean;
|
|
1590
|
+
/** Collapse the field when focus leaves it while it is empty. Default: true. */
|
|
1591
|
+
collapseOnEmptyBlur?: boolean;
|
|
1592
|
+
/** Collapse an empty field on Escape and restore focus to its trigger. Default: true. */
|
|
1593
|
+
collapseOnEscape?: boolean;
|
|
1594
|
+
/** Focus the editor on expand/controlled clear and the trigger on Escape-collapse. Default: true. */
|
|
1595
|
+
manageFocus?: boolean;
|
|
1596
|
+
/**
|
|
1597
|
+
* Keep an empty field expanded when focus moves to a caller-owned surface
|
|
1598
|
+
* rendered outside the field — a suggestions dropdown, date picker, or help
|
|
1599
|
+
* popover shown beside it. Return true for any focus target that must NOT
|
|
1600
|
+
* trigger collapse-on-empty-blur. An element carrying `data-token-search-keep-open`
|
|
1601
|
+
* (or any node inside one) is always exempt, so this predicate is only needed
|
|
1602
|
+
* for surfaces you cannot mark declaratively.
|
|
1603
|
+
*/
|
|
1604
|
+
keepOpenOn?: (target: Node | null) => boolean;
|
|
1605
|
+
/** App-owned `expanded` signals keyed by field id; adopted instead of helper-created. */
|
|
1606
|
+
signals?: Readonly<Record<string, Signal<boolean>>>;
|
|
1607
|
+
}
|
|
1608
|
+
interface WireTokenSearchFieldsOptions {
|
|
1609
|
+
onSubmit?: (submission: TokenSearchSubmit) => void;
|
|
1610
|
+
/** Fired on every editor `input`, after the browser mutates it, so a caller can drop its own `input` listener. */
|
|
1611
|
+
onEdit?: (edit: TokenSearchEdit) => void;
|
|
1612
|
+
/** Managed collapsible transient behavior. `true`/omitted = on with defaults; `false` = fully off. */
|
|
1613
|
+
collapsible?: boolean | TokenSearchCollapsibleOptions;
|
|
1614
|
+
/** Opt-in atomic-chip keyboard behavior (off by default). */
|
|
1615
|
+
keyboard?: false | TokenSearchKeyboardOptions;
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* The value returned from {@link wireTokenSearchFields}: call it (or `dispose()`) to
|
|
1619
|
+
* tear down. When collapsible behavior is managed, it also exposes the transient
|
|
1620
|
+
* `expanded` state per field id so the app can read it in render, hand in its own
|
|
1621
|
+
* signal, or drive it imperatively.
|
|
1622
|
+
*/
|
|
1623
|
+
interface TokenSearchFieldsHandle {
|
|
1624
|
+
(): void;
|
|
1625
|
+
dispose(): void;
|
|
1626
|
+
/** The managed `expanded` signal for a field id (adopted or helper-created); undefined when unmanaged. */
|
|
1627
|
+
expanded(id: string): Signal<boolean> | undefined;
|
|
1628
|
+
/** Expand the field (and, when focus is managed, focus its editor). */
|
|
1629
|
+
open(id: string): void;
|
|
1630
|
+
/** Collapse the field (and, when focus is managed, restore focus to its trigger). */
|
|
1631
|
+
close(id: string): void;
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Wire every TokenSearchField under `root`: submit on Enter, preserve the caret across
|
|
1635
|
+
* controlled token deletion, and (by default) manage the collapsible field's transient
|
|
1636
|
+
* expand/collapse/focus. Returns a {@link TokenSearchFieldsHandle} — a disposer that also
|
|
1637
|
+
* exposes the managed `expanded` state per field id.
|
|
1638
|
+
*/
|
|
1639
|
+
declare function wireTokenSearchFields(root: HTMLElement, { onSubmit, onEdit, collapsible, keyboard, }?: WireTokenSearchFieldsOptions): TokenSearchFieldsHandle;
|
|
1640
|
+
|
|
1641
|
+
export { type TokenSearchCollapsibleOptions, type TokenSearchEdit, type TokenSearchFieldsHandle, type TokenSearchKeyboardOptions, type TokenSearchSubmit, type TokenSearchTokenRemoval, type WireTokenSearchFieldsOptions, wireTokenSearchFields };
|
|
1642
|
+
```
|
|
1643
|
+
|
|
1644
|
+
## `kerfjs/actions`
|
|
1645
|
+
|
|
1646
|
+
```ts
|
|
1647
|
+
import { A as AttrSpec } from './attrSelector-Cmu2ZoGO.js';
|
|
1648
|
+
import { D as DelegateOptions } from './delegate-CL9VTZFb.js';
|
|
1649
|
+
|
|
1650
|
+
/**
|
|
1651
|
+
* `kerfjs/actions` — the delegated action-table helper.
|
|
1652
|
+
*
|
|
1653
|
+
* The most-reinvented idiom across real kerf apps: one table of `data-action`
|
|
1654
|
+
* attribute specs used as the single source of truth for BOTH the JSX attribute
|
|
1655
|
+
* and the delegate selector, plus a hand-rolled `switch (dataset.action)`
|
|
1656
|
+
* dispatcher. This subpath blesses it as two thin helpers over the existing
|
|
1657
|
+
* `attr()` + `delegate()` — it does NOT replace them.
|
|
1658
|
+
*
|
|
1659
|
+
* import { action, delegateActions } from 'kerfjs/actions';
|
|
1660
|
+
*
|
|
1661
|
+
* const A = {
|
|
1662
|
+
* select: action('select-file'),
|
|
1663
|
+
* remove: action('remove-file'),
|
|
1664
|
+
* };
|
|
1665
|
+
*
|
|
1666
|
+
* // JSX — spread the attr (rename-safe; no hardcoded attribute name):
|
|
1667
|
+
* // <button {...A.select.attrs} data-id={id}>…</button>
|
|
1668
|
+
*
|
|
1669
|
+
* // Wire the whole table with ONE delegated listener; returns a disposer:
|
|
1670
|
+
* const dispose = delegateActions(root, 'click', {
|
|
1671
|
+
* [A.select.value]: (_e, el) => selectFile(el.getAttribute('data-id')),
|
|
1672
|
+
* [A.remove.value]: (_e, el) => removeFile(el.getAttribute('data-id')),
|
|
1673
|
+
* });
|
|
1674
|
+
*
|
|
1675
|
+
* Contract: `delegateActions` returns a `() => void` disposer and holds no
|
|
1676
|
+
* per-instance state — the same shape as `delegate()`, which it builds on (so
|
|
1677
|
+
* it inherits the single-listener dispatch and the capture auto-promotion for
|
|
1678
|
+
* well-known non-bubbling event types). One event type per call, mirroring
|
|
1679
|
+
* `delegate()`; collect the disposers for a root that needs several.
|
|
1680
|
+
*/
|
|
1681
|
+
|
|
1682
|
+
/**
|
|
1683
|
+
* A handler in a {@link delegateActions} table. Receives the DOM event and the
|
|
1684
|
+
* matched element (walk-up `closest()` match by default) — the same shape as a
|
|
1685
|
+
* `delegate()` handler.
|
|
1686
|
+
*/
|
|
1687
|
+
type ActionHandler<E extends Element = Element> = (event: Event, el: E) => void;
|
|
1688
|
+
/**
|
|
1689
|
+
* `action(value)` — an {@link AttrSpec} on `data-action`. A thin specialization
|
|
1690
|
+
* of `attr('data-action', value)`: spread its `.attrs` in JSX and use its
|
|
1691
|
+
* `.value` as the handler-table key, so the action name lives in exactly one
|
|
1692
|
+
* place and can't drift between the markup and the dispatcher.
|
|
1693
|
+
*/
|
|
1694
|
+
declare function action<V extends string>(value: V): AttrSpec<'data-action', V>;
|
|
1695
|
+
/** Options for {@link delegateActions}. Extends {@link DelegateOptions}. */
|
|
1696
|
+
interface DelegateActionsOptions extends DelegateOptions {
|
|
1697
|
+
/**
|
|
1698
|
+
* The attribute the table keys on. Default `'data-action'`. Override it only
|
|
1699
|
+
* if you also author the specs with `attr(yourName, …)` instead of `action()`.
|
|
1700
|
+
*/
|
|
1701
|
+
attr?: string;
|
|
1702
|
+
}
|
|
1703
|
+
/**
|
|
1704
|
+
* Wire a whole table of action handlers with ONE delegated listener.
|
|
1705
|
+
*
|
|
1706
|
+
* On `eventType`, the nearest element carrying the action attribute (walk-up
|
|
1707
|
+
* `closest()` by default; pass `{ match: 'direct' }` for an exact-element match)
|
|
1708
|
+
* is looked up in `table` by its attribute value, and the matching handler
|
|
1709
|
+
* runs. An element whose action is absent from the table is ignored — the same
|
|
1710
|
+
* behavior as a `switch (dataset.action)` with no matching `case`.
|
|
1711
|
+
*
|
|
1712
|
+
* Returns a `() => void` disposer. One event type per call (the smallest
|
|
1713
|
+
* surface, mirroring `delegate()`); collect the disposers when a root needs
|
|
1714
|
+
* several event types.
|
|
1715
|
+
*/
|
|
1716
|
+
declare function delegateActions<E extends Element = Element>(root: HTMLElement, eventType: string, table: Readonly<Record<string, ActionHandler<E>>>, options?: DelegateActionsOptions): () => void;
|
|
1717
|
+
|
|
1718
|
+
export { type ActionHandler, type DelegateActionsOptions, action, delegateActions };
|
|
1719
|
+
```
|