@kerfjs/ui 5.0.0-beta.56 → 5.0.0-beta.58
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 +81 -37
- package/ai/application-ui-diagnostic-ids-v1.json +9 -1
- package/ai/application-ui-profile-sync.cjs +1 -1
- package/ai/application-ui-profile.defaults.json +63 -8
- package/ai/application-ui-profile.mjs +1 -1
- package/ai/component-catalog.json +211 -33
- package/ai/component-catalog.schema.json +2 -0
- package/ai/component-class-owners.cjs +83 -0
- package/ai/component-composition-extension.d.ts +7 -0
- package/ai/component-composition-extension.schema.json +7 -0
- package/ai/{component-catalog-v2-overrides.json → component-composition-rules.json} +2 -1
- package/ai/{component-catalog-v2.d.ts → component-composition.d.ts} +9 -5
- package/ai/{component-catalog-v2.json → component-composition.json} +155 -24
- package/ai/{component-catalog-v2.schema.json → component-composition.schema.json} +21 -5
- package/ai/components/README.md +170 -0
- package/ai/components/application-tabs.md +65 -0
- package/ai/components/badge.md +72 -0
- package/ai/components/collapsible-panel.md +102 -0
- package/ai/components/content-item.md +90 -0
- package/ai/components/disclosure-arrow.md +77 -0
- package/ai/components/document-baseline.md +75 -0
- package/ai/components/empty-state.md +80 -0
- package/ai/components/feedback.md +71 -0
- package/ai/components/floating-toolbar.md +80 -0
- package/ai/components/foundation.md +65 -0
- package/ai/components/grid.md +93 -0
- package/ai/components/headers.md +63 -0
- package/ai/components/layout.md +75 -0
- package/ai/components/list-action-row.md +91 -0
- package/ai/components/list-header.md +89 -0
- package/ai/components/list-inset-control.md +74 -0
- package/ai/components/list-inset-text.md +72 -0
- package/ai/components/list-item.md +88 -0
- package/ai/components/list.md +103 -0
- package/ai/components/loading-spinner.md +72 -0
- package/ai/components/lucide-icon.md +66 -0
- package/ai/components/nav-stack.md +103 -0
- package/ai/components/pane.md +100 -0
- package/ai/components/popup-menu.md +82 -0
- package/ai/components/recipe-app-shell.md +57 -0
- package/ai/components/recipe-collapsible-sidebar.md +57 -0
- package/ai/components/recipe-compact-toolbar.md +57 -0
- package/ai/components/recipe-composer-form.md +57 -0
- package/ai/components/recipe-list-detail-dialog.md +57 -0
- package/ai/components/recipe-list-workspace-states.md +57 -0
- package/ai/components/recipe-loading-inspector.md +57 -0
- package/ai/components/recipe-navigation-sidebar.md +57 -0
- package/ai/components/recipe-navigation-stack.md +57 -0
- package/ai/components/recipe-workspace-header.md +57 -0
- package/ai/components/resize.md +101 -0
- package/ai/components/row.md +96 -0
- package/ai/components/segmented-control.md +82 -0
- package/ai/components/select.md +107 -0
- package/ai/components/skeleton.md +84 -0
- package/ai/components/spacer.md +86 -0
- package/ai/components/split-view.md +102 -0
- package/ai/components/state-banner.md +92 -0
- package/ai/components/sunken-panel.md +79 -0
- package/ai/components/surface-scaffold.md +78 -0
- package/ai/components/tab-bar.md +112 -0
- package/ai/components/tab-scaffold.md +94 -0
- package/ai/components/tabs.md +90 -0
- package/ai/components/text.md +82 -0
- package/ai/components/token-search-field.md +101 -0
- package/ai/components/toolbar-control-group.md +102 -0
- package/ai/components/toolbar-text.md +76 -0
- package/ai/components/toolbar.md +95 -0
- package/ai/components/value-table.md +72 -0
- package/ai/components/wa-accordion-item.md +55 -0
- package/ai/components/wa-accordion.md +65 -0
- package/ai/components/wa-animated-image.md +55 -0
- package/ai/components/wa-animation.md +55 -0
- package/ai/components/wa-avatar.md +55 -0
- package/ai/components/wa-badge.md +55 -0
- package/ai/components/wa-breadcrumb-item.md +53 -0
- package/ai/components/wa-breadcrumb.md +55 -0
- package/ai/components/wa-button-group.md +59 -0
- package/ai/components/wa-button.md +55 -0
- package/ai/components/wa-callout.md +58 -0
- package/ai/components/wa-card.md +59 -0
- package/ai/components/wa-carousel-item.md +53 -0
- package/ai/components/wa-carousel.md +55 -0
- package/ai/components/wa-checkbox-group.md +55 -0
- package/ai/components/wa-checkbox.md +55 -0
- package/ai/components/wa-color-picker.md +55 -0
- package/ai/components/wa-comparison.md +55 -0
- package/ai/components/wa-copy-button.md +55 -0
- package/ai/components/wa-details.md +61 -0
- package/ai/components/wa-dialog.md +59 -0
- package/ai/components/wa-divider.md +53 -0
- package/ai/components/wa-drawer.md +55 -0
- package/ai/components/wa-dropdown-item.md +60 -0
- package/ai/components/wa-dropdown.md +60 -0
- package/ai/components/wa-format-bytes.md +53 -0
- package/ai/components/wa-format-date.md +53 -0
- package/ai/components/wa-format-number.md +53 -0
- package/ai/components/wa-icon.md +58 -0
- package/ai/components/wa-include.md +53 -0
- package/ai/components/wa-input.md +59 -0
- package/ai/components/wa-intersection-observer.md +53 -0
- package/ai/components/wa-known-date.md +53 -0
- package/ai/components/wa-markdown.md +53 -0
- package/ai/components/wa-mutation-observer.md +53 -0
- package/ai/components/wa-number-input.md +55 -0
- package/ai/components/wa-option.md +59 -0
- package/ai/components/wa-otp-input.md +53 -0
- package/ai/components/wa-page.md +53 -0
- package/ai/components/wa-pagination.md +55 -0
- package/ai/components/wa-popover.md +55 -0
- package/ai/components/wa-popup.md +53 -0
- package/ai/components/wa-progress-bar.md +53 -0
- package/ai/components/wa-progress-ring.md +53 -0
- package/ai/components/wa-qr-code.md +53 -0
- package/ai/components/wa-radio-group.md +59 -0
- package/ai/components/wa-radio.md +55 -0
- package/ai/components/wa-random-content.md +53 -0
- package/ai/components/wa-rating.md +55 -0
- package/ai/components/wa-relative-time.md +53 -0
- package/ai/components/wa-resize-observer.md +53 -0
- package/ai/components/wa-scroller.md +53 -0
- package/ai/components/wa-select.md +63 -0
- package/ai/components/wa-skeleton.md +53 -0
- package/ai/components/wa-slider.md +55 -0
- package/ai/components/wa-spinner.md +58 -0
- package/ai/components/wa-split-panel.md +58 -0
- package/ai/components/wa-switch.md +53 -0
- package/ai/components/wa-tab-group.md +69 -0
- package/ai/components/wa-tab-panel.md +60 -0
- package/ai/components/wa-tab.md +59 -0
- package/ai/components/wa-tag.md +59 -0
- package/ai/components/wa-textarea.md +53 -0
- package/ai/components/wa-time-input.md +55 -0
- package/ai/components/wa-toast-item.md +60 -0
- package/ai/components/wa-toast.md +60 -0
- package/ai/components/wa-tooltip.md +55 -0
- package/ai/components/wa-tree-item.md +55 -0
- package/ai/components/wa-tree.md +55 -0
- package/ai/components/wa-zoomable-frame.md +55 -0
- package/ai/components/workbench.md +114 -0
- package/ai/public-api-signatures-v1.md +174 -43
- package/ai/skill.md +100 -48
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/analyzer/component-ownership.d.mts +56 -0
- package/analyzer/component-ownership.mjs +184 -0
- package/analyzer/index.d.mts +3 -0
- package/analyzer/index.mjs +274 -20
- package/analyzer/selectors.d.mts +21 -0
- package/analyzer/selectors.mjs +212 -0
- package/dist/browser/catalog.js +25 -0
- package/dist/browser/collapsible-panel.js +7 -0
- package/dist/browser/nav-stack.js +8 -0
- package/dist/browser/split-view.js +10 -0
- package/dist/browser/tab-scaffold.js +4 -0
- package/dist/browser/workbench.js +10 -0
- package/dist/catalog-resources.d.ts +2 -2
- package/dist/catalog.d.ts +3 -3
- package/dist/catalog.js +8 -7
- package/dist/catalog.js.map +1 -1
- package/dist/{chunk-QQOTQTDD.js → chunk-2CCMJTVY.js} +13 -10
- package/dist/chunk-2CCMJTVY.js.map +1 -0
- package/dist/{chunk-PK4N5QTO.js → chunk-553ASUK6.js} +2 -3
- package/dist/chunk-553ASUK6.js.map +1 -0
- package/dist/{chunk-G33XC2NB.js → chunk-6YFHCLHG.js} +2 -2
- package/dist/chunk-6YFHCLHG.js.map +1 -0
- package/dist/{chunk-ZIYOJFZD.js → chunk-7JUBXOIV.js} +17 -4
- package/dist/chunk-7JUBXOIV.js.map +1 -0
- package/dist/{chunk-T4UZTNZ4.js → chunk-EVYKTVBQ.js} +2 -11
- package/dist/chunk-EVYKTVBQ.js.map +1 -0
- package/dist/{chunk-AK67F6QN.js → chunk-EZVNC4J6.js} +4 -1
- package/dist/chunk-EZVNC4J6.js.map +1 -0
- package/dist/{chunk-MA6Z6EIM.js → chunk-F4QMLOXJ.js} +3 -2
- package/dist/chunk-F4QMLOXJ.js.map +1 -0
- package/dist/chunk-JCV4GXWB.js +249 -0
- package/dist/chunk-JCV4GXWB.js.map +1 -0
- package/dist/chunk-K47P7QZC.js +17 -0
- package/dist/chunk-K47P7QZC.js.map +1 -0
- package/dist/{chunk-MOBRFZH3.js → chunk-OUK6QRDR.js} +2 -12
- package/dist/chunk-OUK6QRDR.js.map +1 -0
- package/dist/{chunk-VNPQDCQZ.js → chunk-QOWG4ZCL.js} +3 -2
- package/dist/chunk-QOWG4ZCL.js.map +1 -0
- package/dist/{chunk-V65EOWNF.js → chunk-QPUPLNNB.js} +20 -8
- package/dist/chunk-QPUPLNNB.js.map +1 -0
- package/dist/{chunk-O3EXIBEZ.js → chunk-W4XKTST6.js} +8 -7
- package/dist/chunk-W4XKTST6.js.map +1 -0
- package/dist/{chunk-K6UNVKDK.js → chunk-XDKAYSVD.js} +3 -1
- package/dist/chunk-XDKAYSVD.js.map +1 -0
- package/dist/collapsible-panel.d.ts +9 -9
- package/dist/collapsible-panel.js +2 -2
- package/dist/collapsible-panel.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +11 -9
- package/dist/list-action-row.js +2 -1
- package/dist/list-header.js +1 -1
- package/dist/list-item.js +2 -1
- package/dist/nav-stack.d.ts +13 -1
- package/dist/nav-stack.js +1 -1
- package/dist/pane.d.ts +20 -3
- package/dist/pane.js +1 -1
- package/dist/{panel-toolbar-C8sF-YZC.d.ts → panel-toolbar-DqwtBxQL.d.ts} +13 -13
- package/dist/select.js +1 -1
- package/dist/split-view.d.ts +3 -3
- package/dist/split-view.js +3 -2
- package/dist/split-view.js.map +1 -1
- package/dist/state-banner.js +1 -1
- package/dist/styles/app-tab.css +31 -0
- package/dist/styles/badge.css +19 -11
- package/dist/styles/collapsible-panel.css +13 -9
- package/dist/styles/floating-toolbar.css +25 -6
- package/dist/styles/list-header.css +0 -12
- package/dist/styles/list.css +4 -4
- package/dist/styles/nav-stack.css +46 -19
- package/dist/styles/pane.css +50 -0
- package/dist/styles/popup-menu.css +151 -0
- package/dist/styles/resizable-region.css +22 -10
- package/dist/styles/select.css +28 -14
- package/dist/styles/skeleton.css +30 -3
- package/dist/styles/split-view.css +10 -7
- package/dist/styles/state-banner.css +0 -19
- package/dist/styles/surface-scaffold.css +8 -3
- package/dist/styles/tab-bar.css +79 -28
- package/dist/styles/tab-scaffold.css +25 -1
- package/dist/styles/text.css +16 -0
- package/dist/styles/toolbar-control-group.css +121 -66
- package/dist/styles/toolbar-text.css +21 -0
- package/dist/styles/toolbar.css +8 -32
- package/dist/styles/workbench.css +18 -18
- package/dist/tab-scaffold.d.ts +11 -1
- package/dist/tab-scaffold.js +2 -0
- package/dist/tab-scaffold.js.map +1 -1
- package/dist/toolbar-control-group.d.ts +3 -1
- package/dist/toolbar-control-group.js +1 -1
- package/dist/toolbar-text.d.ts +7 -1
- package/dist/toolbar-text.js +1 -1
- package/dist/toolbar.d.ts +8 -1
- package/dist/toolbar.js +1 -1
- package/dist/{types-DXAGogOS.d.ts → types-BuHELdXR.d.ts} +1 -1
- package/dist/wire-catalog.d.ts +3 -1
- package/dist/wire-catalog.js +2 -0
- package/dist/wire-catalog.js.map +1 -1
- package/dist/wire-scroll-dividers.d.ts +69 -0
- package/dist/wire-scroll-dividers.js +3 -0
- package/dist/wire-scroll-dividers.js.map +1 -0
- package/dist/workbench.d.ts +17 -16
- package/dist/workbench.js +1 -1
- package/docs/app-layouts.md +9 -1
- package/docs/catalog.md +10 -5
- package/docs/collapsible-panel.md +22 -13
- package/docs/component-contract.md +147 -21
- package/docs/component-selection.md +21 -8
- package/docs/design/templates/tab-bar/workspace-tabs-dark.svg +1 -1
- package/docs/design/templates/tab-bar/workspace-tabs.svg +1 -1
- package/docs/design/templates/tab-bar-dark.svg +1 -1
- package/docs/design/templates/tab-bar.svg +1 -1
- package/docs/design-philosophy.md +30 -3
- package/docs/examples/application-ui-profile.json +4 -4
- package/docs/examples/{component-catalog-extension-v2.json → component-composition-extension.json} +3 -3
- package/docs/layout.md +82 -3
- package/docs/nav-stack.md +33 -3
- package/docs/split-view.md +10 -5
- package/docs/tab-scaffold.md +23 -1
- package/docs/type-contracts.md +4 -3
- package/docs/ui-analyzer.md +99 -5
- package/docs/ui-doctor.md +10 -0
- package/docs/workbench.md +31 -20
- package/doctor/index.mjs +6 -1
- package/llms.txt +85 -20
- package/package.json +17 -5
- package/ux-demo/recipes/collapsible-sidebar.tsx +0 -1
- package/ux-demo/recipes/composer-form.tsx +0 -1
- package/ux-demo/recipes/list-detail-dialog.tsx +0 -2
- package/ux-demo/recipes/list-workspace-states.tsx +0 -1
- package/ux-demo/recipes/loading-inspector.tsx +0 -1
- package/ux-demo/recipes/workspace-header.tsx +0 -1
- package/ai/component-catalog-extension-v2.d.ts +0 -7
- package/ai/component-catalog-extension-v2.schema.json +0 -7
- package/dist/chunk-AK67F6QN.js.map +0 -1
- package/dist/chunk-G33XC2NB.js.map +0 -1
- package/dist/chunk-K6UNVKDK.js.map +0 -1
- package/dist/chunk-MA6Z6EIM.js.map +0 -1
- package/dist/chunk-MOBRFZH3.js.map +0 -1
- package/dist/chunk-O3EXIBEZ.js.map +0 -1
- package/dist/chunk-PK4N5QTO.js.map +0 -1
- package/dist/chunk-QQOTQTDD.js.map +0 -1
- package/dist/chunk-T4UZTNZ4.js.map +0 -1
- package/dist/chunk-V65EOWNF.js.map +0 -1
- package/dist/chunk-VNPQDCQZ.js.map +0 -1
- package/dist/chunk-ZIYOJFZD.js.map +0 -1
|
@@ -191,15 +191,11 @@
|
|
|
191
191
|
|
|
192
192
|
/* A region whose only child is a Pane or layout lets it fill the region, so a
|
|
193
193
|
composed toolbar's footer (or the app's own) sits at the region's bottom
|
|
194
|
-
edge rather than under short content.
|
|
194
|
+
edge rather than under short content. Each of those components fills the
|
|
195
|
+
region from its own stylesheet (pane.css, nav-stack.css, split-view.css,
|
|
196
|
+
tab-scaffold.css); a nested Workbench fills it here. */
|
|
195
197
|
:is(.kui-workbench__main, .kui-workbench__panel-content)
|
|
196
|
-
> :
|
|
197
|
-
[data-component="pane"],
|
|
198
|
-
[data-component="nav-stack"],
|
|
199
|
-
[data-component="split-view"],
|
|
200
|
-
[data-component="workbench"],
|
|
201
|
-
[data-component="tab-scaffold"]
|
|
202
|
-
):only-child {
|
|
198
|
+
> [data-component="workbench"]:only-child {
|
|
203
199
|
height: 100%;
|
|
204
200
|
}
|
|
205
201
|
|
|
@@ -777,12 +773,15 @@
|
|
|
777
773
|
--kui-workbench-restore-inset,
|
|
778
774
|
1rem
|
|
779
775
|
);
|
|
780
|
-
/* The corner owns the inset, so a FloatingToolbar composed here floats
|
|
781
|
-
from this point instead of adding its own inset on top. */
|
|
782
|
-
--kui-floating-toolbar-inset: 0px;
|
|
783
776
|
position: absolute;
|
|
784
777
|
/* Hidden while an open rail overlay covers the work area (see below). */
|
|
785
|
-
visibility: var(
|
|
778
|
+
visibility: var(
|
|
779
|
+
--_kui-workbench-covered,
|
|
780
|
+
var(
|
|
781
|
+
--_kui-collapsible-panel-covered,
|
|
782
|
+
var(--_kui-resizable-region-covered, inherit)
|
|
783
|
+
)
|
|
784
|
+
);
|
|
786
785
|
z-index: var(
|
|
787
786
|
--kui-workbench-restore-z,
|
|
788
787
|
calc(var(--kui-workbench-overlay-z, 41) - 2)
|
|
@@ -856,9 +855,10 @@
|
|
|
856
855
|
restore corner) are hidden, not merely stacked beneath it: they never paint
|
|
857
856
|
over the overlay whatever stacking context an app puts them in, and hidden
|
|
858
857
|
they leave the tab order and the accessibility tree. They come back as the
|
|
859
|
-
overlay closes. The
|
|
860
|
-
|
|
861
|
-
|
|
858
|
+
overlay closes. The Workbench's own covered context,
|
|
859
|
+
`--_kui-workbench-covered`, is set on the rail's siblings only (never on
|
|
860
|
+
the open rail), so the overlay's own floating controls stay; FloatingToolbar
|
|
861
|
+
and the layouts' restore corners read it. A direct child
|
|
862
862
|
resolves the Workbench's own container query, never a nested one's. */
|
|
863
863
|
.kui-workbench:has(
|
|
864
864
|
> .kui-workbench__rail[data-presentation="overlay"]:not(
|
|
@@ -866,7 +866,7 @@
|
|
|
866
866
|
)
|
|
867
867
|
)
|
|
868
868
|
> :is(.kui-workbench__center, .kui-workbench__restore) {
|
|
869
|
-
--_kui-
|
|
869
|
+
--_kui-workbench-covered: hidden;
|
|
870
870
|
}
|
|
871
871
|
|
|
872
872
|
@container kui-workbench (max-width: 44rem) {
|
|
@@ -876,7 +876,7 @@
|
|
|
876
876
|
)
|
|
877
877
|
)
|
|
878
878
|
> :is(.kui-workbench__center, .kui-workbench__restore) {
|
|
879
|
-
--_kui-
|
|
879
|
+
--_kui-workbench-covered: hidden;
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
882
|
|
|
@@ -887,7 +887,7 @@
|
|
|
887
887
|
)
|
|
888
888
|
)
|
|
889
889
|
> :is(.kui-workbench__center, .kui-workbench__restore) {
|
|
890
|
-
--_kui-
|
|
890
|
+
--_kui-workbench-covered: hidden;
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
893
|
|
package/dist/tab-scaffold.d.ts
CHANGED
|
@@ -50,6 +50,16 @@ interface TabScaffoldProps<Id extends string = string> {
|
|
|
50
50
|
tabs: readonly TabScaffoldTab<Id>[];
|
|
51
51
|
/** The controlled active tab id (the app owns selection). */
|
|
52
52
|
active: NoInfer<Id>;
|
|
53
|
+
/**
|
|
54
|
+
* The line over the tab bar, where it meets the active scene. `scroll`
|
|
55
|
+
* (default) shows it only while more of the scene's content lies below —
|
|
56
|
+
* never at the scroll end or when the content fits — once
|
|
57
|
+
* `wireScrollDividers` (`@kerfjs/ui/wire-scroll-dividers`) is wired above
|
|
58
|
+
* the scaffold; unwired, it does not show. `always` shows it without the
|
|
59
|
+
* wiring; `none` never, even when wired. The line is the bar's own 1px top
|
|
60
|
+
* border, so no state moves the bar or a tab.
|
|
61
|
+
*/
|
|
62
|
+
chromeDividers?: 'scroll' | 'always' | 'none';
|
|
53
63
|
className?: string;
|
|
54
64
|
/** Native named-slot assignment when composed inside a web component. */
|
|
55
65
|
slot?: string;
|
|
@@ -62,6 +72,6 @@ interface TabScaffoldProps<Id extends string = string> {
|
|
|
62
72
|
* On larger classes, promote the tabs to a `Workbench` rail or sidebar instead of
|
|
63
73
|
* a bottom bar. See `docs/23-app-layouts.md` §3.4.
|
|
64
74
|
*/
|
|
65
|
-
declare function TabScaffold<Id extends string>({ id, label, tabs, active, className, slot, }: TabScaffoldProps<Id>): SafeHtml;
|
|
75
|
+
declare function TabScaffold<Id extends string>({ id, label, tabs, active, chromeDividers, className, slot, }: TabScaffoldProps<Id>): SafeHtml;
|
|
66
76
|
|
|
67
77
|
export { TabScaffold, type TabScaffoldProps, type TabScaffoldTab };
|
package/dist/tab-scaffold.js
CHANGED
|
@@ -6,6 +6,7 @@ function TabScaffold({
|
|
|
6
6
|
label,
|
|
7
7
|
tabs,
|
|
8
8
|
active,
|
|
9
|
+
chromeDividers = "scroll",
|
|
9
10
|
className = "",
|
|
10
11
|
slot
|
|
11
12
|
}) {
|
|
@@ -16,6 +17,7 @@ function TabScaffold({
|
|
|
16
17
|
id,
|
|
17
18
|
"data-component": "tab-scaffold",
|
|
18
19
|
"data-tab-scaffold-id": id,
|
|
20
|
+
"data-chrome-dividers": chromeDividers === "always" || chromeDividers === "none" ? chromeDividers : void 0,
|
|
19
21
|
slot,
|
|
20
22
|
children: [
|
|
21
23
|
/* @__PURE__ */ jsx("div", { class: "kui-tab-scaffold__scenes", children: tabs.map((tab) => /* @__PURE__ */ jsx(
|
package/dist/tab-scaffold.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tab-scaffold.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/tab-scaffold.tsx"],"names":[],"mappings":";;;AAkFO,SAAS,WAAA,CAA+B;AAAA,EAC7C,EAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,cAAA,GAAiB,QAAA;AAAA,EACjB,SAAA,GAAY,EAAA;AAAA,EACZ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H,CAAA,GAEA,KAAA;AAAA,gCAEF,GAAA,CAAC,MAAA,EAAA,EAAK,KAAA,EAAM,6BAAA,EAA+B,cAAI,KAAA,EAAM;AAAA;AAAA;AAAA,WACvD;AAAA,QAEJ,CAAC,CAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ;AAEA,SAAS,eACP,KAAA,EACoB;AACpB,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA;AACnB,IAAA,OAAO,OAAO,QAAA,CAAS,KAAK,CAAA,GAAI,MAAA,CAAO,KAAK,CAAA,GAAI,MAAA;AAClD,EAAA,IAAI,OAAO,UAAU,QAAA,IAAY,KAAA,CAAM,MAAK,EAAG,OAAO,MAAM,IAAA,EAAK;AACjE,EAAA,OAAO,MAAA;AACT","file":"tab-scaffold.js","sourcesContent":["import type { SafeHtml } from 'kerfjs';\n\nimport { Badge } from './badge.js';\nimport type { KerfUiContent } from './semantic-content.js';\n\ninterface TabScaffoldTabBase<Id extends string> {\n id: Id;\n label: string;\n /** Decorative icon shown above the label in the bottom bar. */\n icon?: SafeHtml;\n /** The tab's content — typically a `NavStack` so each tab keeps its own stack. */\n content: KerfUiContent;\n}\n\n/** A tab with an optional count or short-status badge. */\ninterface TabScaffoldTabCountBadge {\n /**\n * Optional count or short status shown as a solid danger `Badge` at the\n * top-trailing corner of the tab icon (the iOS tab-bar badge). Omitted, `''`,\n * or non-finite numbers render no badge. The visual badge is `aria-hidden`;\n * its meaning reaches assistive technology through `badgeLabel`.\n *\n * Pass `true` instead for the text-free dot (new content without a count).\n */\n badge?: string | number;\n /**\n * Localized phrase folded into the tab's accessible name as\n * `\"<label>, <badgeLabel>\"` (for example `\"3 unread\"` → `\"Inbox, 3 unread\"`).\n * Defaults to the badge text itself. Ignored when no badge renders.\n */\n badgeLabel?: string;\n}\n\n/** A tab with the text-free dot badge (new content without a count). */\ninterface TabScaffoldTabDotBadge {\n /**\n * `true` shows a solid danger dot `Badge` at the top-trailing corner of the\n * tab icon — the iOS tab-bar dot for new content without a count.\n */\n badge: true;\n /**\n * Required localized phrase folded into the tab's accessible name as\n * `\"<label>, <badgeLabel>\"` (for example `\"New activity\"` →\n * `\"Feed, New activity\"`). A dot has no text, so this is its only meaning.\n */\n badgeLabel: string;\n}\n\n/** One bottom-bar destination: its label, optional icon and badge, and content. */\nexport type TabScaffoldTab<Id extends string = string> =\n TabScaffoldTabBase<Id> & (TabScaffoldTabCountBadge | TabScaffoldTabDotBadge);\n\nexport interface TabScaffoldProps<Id extends string = string> {\n id: string;\n /** Accessible name for the tab bar. */\n label: string;\n tabs: readonly TabScaffoldTab<Id>[];\n /** The controlled active tab id (the app owns selection). */\n active: NoInfer<Id>;\n /**\n * The line over the tab bar, where it meets the active scene. `scroll`\n * (default) shows it only while more of the scene's content lies below —\n * never at the scroll end or when the content fits — once\n * `wireScrollDividers` (`@kerfjs/ui/wire-scroll-dividers`) is wired above\n * the scaffold; unwired, it does not show. `always` shows it without the\n * wiring; `none` never, even when wired. The line is the bar's own 1px top\n * border, so no state moves the bar or a tab.\n */\n chromeDividers?: 'scroll' | 'always' | 'none';\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\n/**\n * A mobile-first, iOS-like bottom tab scaffold: a bottom tab bar that switches\n * between major sections, each tab keeping its own content (usually a `NavStack`)\n * mounted so its stack and scroll survive a switch. Controlled — the app owns\n * `active`; wire selection with `@kerfjs/ui/wire-tab-scaffold`'s `wireTabScaffold`.\n * On larger classes, promote the tabs to a `Workbench` rail or sidebar instead of\n * a bottom bar. See `docs/23-app-layouts.md` §3.4.\n */\nexport function TabScaffold<Id extends string>({\n id,\n label,\n tabs,\n active,\n chromeDividers = 'scroll',\n className = '',\n slot,\n}: TabScaffoldProps<Id>) {\n return (\n <section\n class={`kui-tab-scaffold ${className}`.trim()}\n id={id}\n data-component=\"tab-scaffold\"\n data-tab-scaffold-id={id}\n data-chrome-dividers={\n chromeDividers === 'always' || chromeDividers === 'none'\n ? chromeDividers\n : undefined\n }\n slot={slot}\n >\n <div class=\"kui-tab-scaffold__scenes\">\n {tabs.map((tab) => (\n <div\n class=\"kui-tab-scaffold__scene\"\n data-tab-scaffold-scene={tab.id}\n data-active={String(tab.id === active)}\n aria-hidden={String(tab.id !== active)}\n >\n {tab.content}\n </div>\n ))}\n </div>\n <nav class=\"kui-tab-scaffold__bar\" role=\"tablist\" aria-label={label}>\n {tabs.map((tab) => {\n const dot = tab.badge === true;\n const badgeText = dot ? undefined : normalizeBadge(tab.badge);\n const hasBadge = dot || badgeText !== undefined;\n const badge = hasBadge && (\n <span\n class=\"kui-tab-scaffold__tab-badge\"\n data-badge-kind={dot ? 'dot' : 'text'}\n >\n {badgeText === undefined ? (\n <Badge tone=\"danger\" size=\"dot\" ariaHidden />\n ) : (\n <Badge\n tone=\"danger\"\n appearance=\"solid\"\n size=\"compact\"\n ariaHidden\n >\n {badgeText}\n </Badge>\n )}\n </span>\n );\n // A dot has no text fallback: without a usable badgeLabel (reachable\n // only from untyped callers) the tab keeps its plain accessible name.\n const badgeLabel = hasBadge\n ? tab.badgeLabel?.trim() || badgeText\n : undefined;\n return (\n <button\n type=\"button\"\n class=\"kui-tab-scaffold__tab\"\n role=\"tab\"\n data-tab-scaffold-tab={tab.id}\n aria-selected={String(tab.id === active)}\n tabindex={tab.id === active ? '0' : '-1'}\n aria-label={\n badgeLabel === undefined\n ? undefined\n : `${tab.label}, ${badgeLabel}`\n }\n data-has-badge={hasBadge ? 'true' : undefined}\n >\n {tab.icon ? (\n <span class=\"kui-tab-scaffold__tab-icon\" aria-hidden=\"true\">\n {tab.icon}\n {badge}\n </span>\n ) : (\n badge\n )}\n <span class=\"kui-tab-scaffold__tab-label\">{tab.label}</span>\n </button>\n );\n })}\n </nav>\n </section>\n );\n}\n\nfunction normalizeBadge(\n badge: string | number | undefined,\n): string | undefined {\n if (typeof badge === 'number')\n return Number.isFinite(badge) ? String(badge) : undefined;\n if (typeof badge === 'string' && badge.trim()) return badge.trim();\n return undefined;\n}\n"]}
|
|
@@ -56,6 +56,8 @@ interface ToolbarControlGroupProps {
|
|
|
56
56
|
overflow?: ToolbarControlGroupOverflow;
|
|
57
57
|
/** Responsive visibility owned by the enclosing Toolbar container. */
|
|
58
58
|
visibility?: ToolbarControlGroupVisibility;
|
|
59
|
+
/** Move this group into the work-area toolbar when its panel collapses. */
|
|
60
|
+
relocateOnCollapse?: boolean;
|
|
59
61
|
/** Add contrast behind photo-backed avatar content. */
|
|
60
62
|
scrim?: boolean;
|
|
61
63
|
/**
|
|
@@ -66,6 +68,6 @@ interface ToolbarControlGroupProps {
|
|
|
66
68
|
/** Native named-slot assignment when composed inside a web component. */
|
|
67
69
|
slot?: string;
|
|
68
70
|
}
|
|
69
|
-
declare function ToolbarControlGroup({ children, label, className, expanded, single, appearance, tone, buttonAppearance, shape, size, density, content, focusRing, selectedChrome, selectedTone, nestedDropdown, menuInset, overflow, visibility, scrim, avatarImage, slot, }: ToolbarControlGroupProps): kerfjs.SafeHtml;
|
|
71
|
+
declare function ToolbarControlGroup({ children, label, className, expanded, single, appearance, tone, buttonAppearance, shape, size, density, content, focusRing, selectedChrome, selectedTone, nestedDropdown, menuInset, overflow, visibility, relocateOnCollapse, scrim, avatarImage, slot, }: ToolbarControlGroupProps): kerfjs.SafeHtml;
|
|
70
72
|
|
|
71
73
|
export { ToolbarActionLink, type ToolbarActionLinkProps, ToolbarControlGroup, type ToolbarControlGroupAppearance, type ToolbarControlGroupButtonAppearance, type ToolbarControlGroupContent, type ToolbarControlGroupDensity, type ToolbarControlGroupFocusRing, type ToolbarControlGroupMenuInset, type ToolbarControlGroupOverflow, type ToolbarControlGroupProps, type ToolbarControlGroupSelectedChrome, type ToolbarControlGroupSelectedTone, type ToolbarControlGroupShape, type ToolbarControlGroupSize, type ToolbarControlGroupTone, type ToolbarControlGroupVisibility };
|
package/dist/toolbar-text.d.ts
CHANGED
|
@@ -23,6 +23,12 @@ interface ToolbarTextBaseProps {
|
|
|
23
23
|
* instead. Default true.
|
|
24
24
|
*/
|
|
25
25
|
ellipsis?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Grow to fill the free space of the flex row it sits in (a Toolbar zone),
|
|
28
|
+
* truncating at the space left by its siblings instead of taking only its
|
|
29
|
+
* text's width. Default false.
|
|
30
|
+
*/
|
|
31
|
+
fill?: boolean;
|
|
26
32
|
/** Native named-slot assignment when composed inside a web component. */
|
|
27
33
|
slot?: string;
|
|
28
34
|
}
|
|
@@ -35,6 +41,6 @@ type ToolbarTextWrappingProps = {
|
|
|
35
41
|
maxLines?: never;
|
|
36
42
|
};
|
|
37
43
|
type ToolbarTextProps = ToolbarTextBaseProps & ToolbarTextWrappingProps;
|
|
38
|
-
declare function ToolbarText({ text, size, className, id, headingLevel, placeholder, wrap, ellipsis, maxLines, slot, }: ToolbarTextProps): kerfjs.SafeHtml;
|
|
44
|
+
declare function ToolbarText({ text, size, className, id, headingLevel, placeholder, wrap, ellipsis, maxLines, fill, slot, }: ToolbarTextProps): kerfjs.SafeHtml;
|
|
39
45
|
|
|
40
46
|
export { type HeadingLevel, ToolbarText, type ToolbarTextProps, type ToolbarTextSize };
|
package/dist/toolbar-text.js
CHANGED
package/dist/toolbar.d.ts
CHANGED
|
@@ -8,7 +8,14 @@ interface ToolbarProps {
|
|
|
8
8
|
center?: KerfUiContent;
|
|
9
9
|
trailing?: KerfUiContent;
|
|
10
10
|
label?: string;
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Physical divider edges in canonical top/right/bottom/left order, drawn
|
|
13
|
+
* always. Defaults to none: a toolbar pinned over or under scrolling content
|
|
14
|
+
* gets its divider from the scroll state instead — a `Pane` draws the line
|
|
15
|
+
* between its chrome and content while content is scrolled away beneath it,
|
|
16
|
+
* and `wireScrollDividers` `targets` can name a toolbar as chrome, which
|
|
17
|
+
* then draws its facing side the same way.
|
|
18
|
+
*/
|
|
12
19
|
dividerSides?: Sides;
|
|
13
20
|
/** Horizontal treatment of the center zone. Defaults to centered content. */
|
|
14
21
|
centerAlign?: 'center' | 'stretch';
|
package/dist/toolbar.js
CHANGED
|
@@ -56,7 +56,7 @@ interface CatalogSidebarConfig extends Pick<WorkbenchPanel, 'resizable' | 'separ
|
|
|
56
56
|
* `wireCatalog`'s `sidebarSize`, which writes each committed resize to it.
|
|
57
57
|
*/
|
|
58
58
|
size?: number;
|
|
59
|
-
/** The sidebar header toolbar's configuration (default:
|
|
59
|
+
/** The sidebar header toolbar's configuration (default: no divider; its pane draws one while scrolled). */
|
|
60
60
|
toolbar?: ToolbarConfig;
|
|
61
61
|
}
|
|
62
62
|
interface CatalogProps {
|
package/dist/wire-catalog.d.ts
CHANGED
|
@@ -73,7 +73,9 @@ declare function wireCatalogGeometryOverlay(root: HTMLElement): () => void;
|
|
|
73
73
|
* item selection (and the related-entry popup menu), the sidebar collapse toggle, and
|
|
74
74
|
* the theme toggle. The app owns the `active`/`collapsed`/`theme` signals and updates
|
|
75
75
|
* them in the callbacks; optionally mirror the active id into the URL via `urlParam`.
|
|
76
|
-
*
|
|
76
|
+
* It also wires the scroll dividers below root (`wireScrollDividers`), so the
|
|
77
|
+
* catalog's panes and every example in it show their chrome dividers only
|
|
78
|
+
* while scrolled. Returns a disposer.
|
|
77
79
|
*/
|
|
78
80
|
declare function wireCatalog(root: HTMLElement, { onSelect, onToggleSidebar, onToggleTheme, onToggleSecondary, urlParam, revealSelection, selectAction, toggleSidebarAction, toggleThemeAction, toggleSecondaryAction, collapsed, sidebarSize, sidebarStorageKey, id: catalogId, }: WireCatalogOptions): () => void;
|
|
79
81
|
|
package/dist/wire-catalog.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { wireWorkbench } from './chunk-KH6VUGHU.js';
|
|
2
|
+
import { wireScrollDividers } from './chunk-JCV4GXWB.js';
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
|
|
@@ -259,6 +260,7 @@ function wireCatalog(root, {
|
|
|
259
260
|
}
|
|
260
261
|
};
|
|
261
262
|
const disposers = [
|
|
263
|
+
wireScrollDividers(root),
|
|
262
264
|
// Sidebar items AND the footer's related-entry popup-menu items both carry
|
|
263
265
|
// `data-action={selectAction}` + `data-item-id`, so one delegated click covers both.
|
|
264
266
|
delegate(
|
package/dist/wire-catalog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/wire-catalog.ts"],"names":[],"mappings":";;;;;;AA8DA,IAAM,mBAAA,GAAsB,uBAAA;AAMrB,SAAS,kBAAA,CACd,MACA,EAAA,EACA;AAAA,EACE,KAAA,GAAQ,SAAA;AAAA,EACR,MAAA,GAAS,SAAA;AAAA,EACT,QAAA,GAAW,MAAA;AAAA,EACX,KAAA,GAAQ;AACV,CAAA,GAA0B,EAAC,EACf;AACZ,EAAA,MAAM,IAAA,GAAO,KAAK,aAAA,CAAc,WAAA;AAChC,EAAA,IAAI,CAAC,IAAA,IAAS,KAAA,IAAS,CAAC,IAAA,CAAK,WAAW,KAAK,CAAA,CAAE,OAAA,EAAU,OAAO,MAAM;AAAA,EAAC,CAAA;AACvE,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,qBAAA,CAAsB,MAAM;AAC7C,IAAA,KAAA,MAAW,IAAA,IAAQ,IAAA,CAAK,gBAAA,CAA8B,gBAAgB,CAAA,EAAG;AACvE,MAAA,IAAI,IAAA,CAAK,OAAA,CAAQ,MAAA,KAAW,EAAA,EAAI;AAChC,MAAA,IAAA,CAAK,cAAA,CAAe,EAAE,KAAA,EAAO,MAAA,EAAQ,UAAU,CAAA;AAC/C,MAAA;AAAA,IACF;AAAA,EACF,CAAC,CAAA;AACD,EAAA,OAAO,MAAM,IAAA,CAAK,oBAAA,CAAqB,KAAK,CAAA;AAC9C;AAEA,SAAS,OAAO,KAAA,EAAuB;AACrC,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,UAAA,CAAW,KAAK,CAAA;AACtC,EAAA,IAAI,CAAC,MAAA,CAAO,QAAA,CAAS,MAAM,GAAG,OAAO,CAAA;AACrC,E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A;AAAA,YACN,UAAA,EAAY;AAAA;AACd;AACF,OACD;AAAA,KACH;AACF,EAAA,OAAO,MAAM;AACX,IAAA,YAAA,IAAe;AACf,IAAA,KAAA,MAAW,OAAA,IAAW,SAAA,CAAU,MAAA,CAAO,CAAC,GAAG,OAAA,EAAQ;AAAA,EACrD,CAAA;AACF","file":"wire-catalog.js","sourcesContent":["import { delegate, type Signal } from 'kerfjs';\n\nimport { wireWorkbench } from './wire-workbench.js';\n\nexport interface WireCatalogOptions {\n /** Invoked with the entry id when a sidebar item or a related-entry option is chosen. */\n onSelect: (id: string) => void;\n /** Invoked when the sidebar collapse/expand control is activated. */\n onToggleSidebar?: () => void;\n /** Invoked when the theme toggle is activated. */\n onToggleTheme?: () => void;\n /** Invoked when the secondary (ecosystem) group's disclosure toggle is activated. */\n onToggleSecondary?: () => void;\n /** When set, `?<urlParam>=<id>` is written on select via `history.replaceState`. */\n urlParam?: string;\n /**\n * Reveal the chosen sidebar row after selection. `true` uses desktop-safe\n * defaults; pass options to customize scroll alignment or the media guard.\n */\n revealSelection?: boolean | CatalogRevealOptions;\n selectAction?: string;\n toggleSidebarAction?: string;\n toggleThemeAction?: string;\n toggleSecondaryAction?: string;\n /**\n * The sidebar's app-owned collapsed flag. With it, the catalog's Workbench\n * sidebar is wired like any Workbench rail: it becomes a transient overlay\n * on a small screen (collapsed as the breakpoint applies, closed on Escape\n * or a press outside, focus handed back), and choosing an entry from the\n * open overlay closes it.\n */\n collapsed?: Signal<boolean>;\n /**\n * The app-owned sidebar width signal for a Catalog rendered with\n * `sidebar={{ resizable: true, size: sidebarSize.value }}`. Each committed\n * drag or keyboard resize is written to it.\n */\n sidebarSize?: Signal<number>;\n /**\n * With `sidebarSize`, load and save the width under this storage key so the\n * catalog remembers the user's sidebar width.\n */\n sidebarStorageKey?: string;\n /** The Catalog's `id`, when it is not the default `kui-catalog`. */\n id?: string;\n}\n\nexport interface CatalogRevealOptions {\n /** Scroll alignment within the sidebar. Default `'nearest'`. */\n block?: ScrollLogicalPosition;\n /** Cross-axis alignment. Default `'nearest'`. */\n inline?: ScrollLogicalPosition;\n /** Scroll behavior. Default `'auto'`. */\n behavior?: ScrollBehavior;\n /**\n * Only reveal when this media query matches. Defaults to the Catalog's\n * desktop layout; pass `false` to reveal at every viewport size.\n */\n media?: string | false;\n}\n\n// The Workbench keeps the sidebar inline above its `narrow` breakpoint (704px).\nconst catalogDesktopMedia = '(min-width: 44.01rem)';\n\n/**\n * Reveal one Catalog sidebar entry after the controlled render settles without\n * moving focus. Returns a cancellation function for rapid selection changes.\n */\nexport function revealCatalogEntry(\n root: HTMLElement,\n id: string,\n {\n block = 'nearest',\n inline = 'nearest',\n behavior = 'auto',\n media = catalogDesktopMedia,\n }: CatalogRevealOptions = {},\n): () => void {\n const view = root.ownerDocument.defaultView;\n if (!view || (media && !view.matchMedia(media).matches)) return () => {};\n const frame = view.requestAnimationFrame(() => {\n for (const item of root.querySelectorAll<HTMLElement>('[data-item-id]')) {\n if (item.dataset.itemId !== id) continue;\n item.scrollIntoView({ block, inline, behavior });\n break;\n }\n });\n return () => view.cancelAnimationFrame(frame);\n}\n\nfunction pixels(value: string): number {\n const number = Number.parseFloat(value);\n if (!Number.isFinite(number)) return 0;\n return value.trim().endsWith('rem') ? number * 16 : number;\n}\n\nfunction isTransparent(color: string): boolean {\n const normalized = color.replace(/\\s+/g, '');\n return (\n normalized === 'transparent' || /(?:,|\\/)0(?:\\.0+)?\\)$/.test(normalized)\n );\n}\n\nfunction geometrySpecimens(canvas: HTMLElement): Element[] {\n const result: Element[] = [];\n for (const example of canvas.querySelectorAll<HTMLElement>(\n '[data-catalog-example]',\n )) {\n if (example.closest('[data-catalog-geometry-overlay-skip]')) continue;\n for (const child of example.children) {\n if (\n child.matches('[data-catalog-geometry-overlay]') ||\n child.matches('[data-catalog-example-label]') ||\n child.matches('[data-catalog-example-note]')\n )\n continue;\n result.push(child);\n }\n }\n for (const element of canvas.querySelectorAll<HTMLElement>(\n '[data-component]',\n )) {\n if (\n element.closest('[data-catalog-geometry-overlay]') ||\n element.closest('[data-catalog-geometry-overlay-skip]') ||\n element.closest('.kui-catalog-example')\n )\n continue;\n const parent =\n element.parentElement?.closest<HTMLElement>('[data-component]');\n if (parent && canvas.contains(parent)) continue;\n result.push(element);\n }\n return result;\n}\n\nfunction geometryBox(\n document: Document,\n className: string,\n left: number,\n top: number,\n width: number,\n height: number,\n): HTMLElement {\n const element = document.createElement('div');\n element.className = className;\n element.style.transform = `translate(${left}px, ${top}px)`;\n element.style.width = `${Math.max(0, width)}px`;\n element.style.height = `${Math.max(0, height)}px`;\n return element;\n}\n\nfunction effectiveBorderWidth(width: string, style: string): number {\n return style === 'none' || style === 'hidden' ? 0 : pixels(width);\n}\n\n/**\n * Keep a Catalog's opt-in geometry overlay synchronized with its preview.\n * Specimens receive computed border highlights (or a dashed bound when they\n * have no border and are transparent), while positive computed margins use\n * devtools-style orange bands. CSS/stylesheet-only changes are observed too.\n * Returns a disposer.\n */\nexport function wireCatalogGeometryOverlay(root: HTMLElement): () => void {\n const catalog = root.matches('[data-component=\"catalog\"]')\n ? root\n : root.querySelector<HTMLElement>('[data-component=\"catalog\"]');\n const canvas = catalog?.querySelector<HTMLElement>('.kui-catalog__canvas');\n const layer = catalog?.querySelector<HTMLElement>(\n '[data-catalog-geometry-overlay]',\n );\n const view = root.ownerDocument.defaultView;\n if (!catalog || !canvas || !layer || !view) return () => {};\n\n let frame = 0;\n const render = (): void => {\n frame = 0;\n layer.replaceChildren();\n if (catalog.dataset.geometryOverlay !== 'true') {\n syncObservedSpecimens([]);\n return;\n }\n const base = canvas.getBoundingClientRect();\n const specimens = geometrySpecimens(canvas);\n syncObservedSpecimens(specimens);\n for (const [specimenIndex, element] of specimens.entries()) {\n const rect = element.getBoundingClientRect();\n const style = view.getComputedStyle(element);\n const align = pixels(\n style.getPropertyValue('--kui-catalog-example-align'),\n );\n const top = pixels(style.marginTop);\n const right = Math.max(\n 0,\n pixels(style.marginRight) - (style.direction === 'rtl' ? align : 0),\n );\n const bottom = pixels(style.marginBottom);\n const left = Math.max(\n 0,\n pixels(style.marginLeft) - (style.direction === 'rtl' ? 0 : align),\n );\n const x = rect.left - base.left + canvas.scrollLeft;\n const y = rect.top - base.top + canvas.scrollTop;\n const borderWidths = [\n effectiveBorderWidth(style.borderTopWidth, style.borderTopStyle),\n effectiveBorderWidth(style.borderRightWidth, style.borderRightStyle),\n effectiveBorderWidth(style.borderBottomWidth, style.borderBottomStyle),\n effectiveBorderWidth(style.borderLeftWidth, style.borderLeftStyle),\n ];\n if (borderWidths.some((width) => width > 0)) {\n const border = geometryBox(\n root.ownerDocument,\n 'kui-catalog__geometry-border',\n x,\n y,\n rect.width,\n rect.height,\n );\n border.dataset.catalogGeometrySpecimen = String(specimenIndex);\n border.style.borderTopWidth = `${borderWidths[0]}px`;\n border.style.borderRightWidth = `${borderWidths[1]}px`;\n border.style.borderBottomWidth = `${borderWidths[2]}px`;\n border.style.borderLeftWidth = `${borderWidths[3]}px`;\n border.style.borderRadius = style.borderRadius;\n layer.append(border);\n } else if (isTransparent(style.backgroundColor)) {\n const bound = geometryBox(\n root.ownerDocument,\n 'kui-catalog__geometry-bound',\n x,\n y,\n rect.width,\n rect.height,\n );\n bound.dataset.catalogGeometrySpecimen = String(specimenIndex);\n layer.append(bound);\n }\n const margins: Array<\n readonly [string, number, number, number, number, number]\n > = [\n ['top', top, x - left, y - top, rect.width + left + right, top],\n [\n 'bottom',\n bottom,\n x - left,\n y + rect.height,\n rect.width + left + right,\n bottom,\n ],\n ['left', left, x - left, y, left, rect.height],\n ['right', right, x + rect.width, y, right, rect.height],\n ];\n for (const [side, size, marginX, marginY, width, height] of margins) {\n if (size <= 0) continue;\n const margin = geometryBox(\n root.ownerDocument,\n 'kui-catalog__geometry-margin',\n marginX,\n marginY,\n width,\n height,\n );\n margin.dataset.catalogGeometrySpecimen = String(specimenIndex);\n margin.dataset.catalogGeometrySide = side;\n layer.append(margin);\n }\n }\n };\n const schedule = (): void => {\n if (!frame) frame = view.requestAnimationFrame(render);\n };\n const resizeObserver = new view.ResizeObserver(schedule);\n resizeObserver.observe(canvas);\n const observedSpecimens = new Set<Element>();\n const syncObservedSpecimens = (specimens: Element[]): void => {\n const next = new Set(specimens);\n for (const specimen of observedSpecimens) {\n if (next.has(specimen)) continue;\n resizeObserver.unobserve(specimen);\n observedSpecimens.delete(specimen);\n }\n for (const specimen of next) {\n if (observedSpecimens.has(specimen)) continue;\n resizeObserver.observe(specimen);\n observedSpecimens.add(specimen);\n }\n };\n const mutationObserver = new view.MutationObserver((records) => {\n if (\n records.some(\n ({ target }) => target !== layer && !layer.contains(target as Node),\n )\n )\n schedule();\n });\n mutationObserver.observe(catalog, {\n attributes: true,\n childList: true,\n subtree: true,\n });\n mutationObserver.observe(root.ownerDocument.documentElement, {\n attributes: true,\n });\n const documentHead = root.ownerDocument.head;\n if (documentHead)\n mutationObserver.observe(documentHead, {\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n });\n const stylesheetLoaded = (): void => schedule();\n documentHead?.addEventListener('load', stylesheetLoaded, true);\n view.addEventListener('resize', schedule);\n render();\n return () => {\n if (frame) view.cancelAnimationFrame(frame);\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n documentHead?.removeEventListener('load', stylesheetLoaded, true);\n view.removeEventListener('resize', schedule);\n layer.replaceChildren();\n };\n}\n\n/**\n * Wire a {@link Catalog}'s interactions with one delegated listener set: sidebar\n * item selection (and the related-entry popup menu), the sidebar collapse toggle, and\n * the theme toggle. The app owns the `active`/`collapsed`/`theme` signals and updates\n * them in the callbacks; optionally mirror the active id into the URL via `urlParam`.\n * Returns a disposer.\n */\nexport function wireCatalog(\n root: HTMLElement,\n {\n onSelect,\n onToggleSidebar,\n onToggleTheme,\n onToggleSecondary,\n urlParam,\n revealSelection,\n selectAction = 'catalog-select',\n toggleSidebarAction = 'catalog-toggle-sidebar',\n toggleThemeAction = 'catalog-toggle-theme',\n toggleSecondaryAction = 'catalog-toggle-secondary',\n collapsed,\n sidebarSize,\n sidebarStorageKey,\n id: catalogId = 'kui-catalog',\n }: WireCatalogOptions,\n): () => void {\n let cancelReveal: (() => void) | undefined;\n const select = (id: string) => {\n onSelect(id);\n const view = root.ownerDocument.defaultView;\n if (urlParam && view) {\n const url = new URL(view.location.href);\n url.searchParams.set(urlParam, id);\n view.history.replaceState(null, '', url);\n }\n // An open overlay sidebar gives way to the entry just chosen from it.\n const rail = root.ownerDocument.getElementById(`${catalogId}-left-rail`);\n if (\n collapsed &&\n !collapsed.peek() &&\n rail &&\n root.ownerDocument.defaultView?.getComputedStyle(rail).position ===\n 'absolute'\n )\n collapsed.value = true;\n if (revealSelection) {\n cancelReveal?.();\n cancelReveal = revealCatalogEntry(\n root,\n id,\n revealSelection === true ? undefined : revealSelection,\n );\n }\n };\n\n const disposers: Array<() => void> = [\n // Sidebar items AND the footer's related-entry popup-menu items both carry\n // `data-action={selectAction}` + `data-item-id`, so one delegated click covers both.\n delegate(\n root,\n 'click',\n `[data-action=\"${selectAction}\"]`,\n (_event, element) => {\n const id = (element as HTMLElement).dataset.itemId;\n if (id) select(id);\n },\n ),\n ];\n if (onToggleSidebar) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleSidebarAction}\"]`, () =>\n onToggleSidebar(),\n ),\n );\n }\n if (onToggleTheme) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleThemeAction}\"]`, () =>\n onToggleTheme(),\n ),\n );\n }\n if (onToggleSecondary) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleSecondaryAction}\"]`, () =>\n onToggleSecondary(),\n ),\n );\n }\n if (collapsed || sidebarSize)\n disposers.push(\n wireWorkbench(root, {\n id: catalogId,\n panels: {\n leftRail: {\n collapsed,\n size: sidebarSize,\n storageKey: sidebarStorageKey,\n },\n },\n }),\n );\n return () => {\n cancelReveal?.();\n for (const dispose of disposers.splice(0)) dispose();\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/wire-cat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,EAAQ;AAAA,EACrD,CAAA;AACF","file":"wire-catalog.js","sourcesContent":["import { delegate, type Signal } from 'kerfjs';\n\nimport { wireScrollDividers } from './wire-scroll-dividers.js';\nimport { wireWorkbench } from './wire-workbench.js';\n\nexport interface WireCatalogOptions {\n /** Invoked with the entry id when a sidebar item or a related-entry option is chosen. */\n onSelect: (id: string) => void;\n /** Invoked when the sidebar collapse/expand control is activated. */\n onToggleSidebar?: () => void;\n /** Invoked when the theme toggle is activated. */\n onToggleTheme?: () => void;\n /** Invoked when the secondary (ecosystem) group's disclosure toggle is activated. */\n onToggleSecondary?: () => void;\n /** When set, `?<urlParam>=<id>` is written on select via `history.replaceState`. */\n urlParam?: string;\n /**\n * Reveal the chosen sidebar row after selection. `true` uses desktop-safe\n * defaults; pass options to customize scroll alignment or the media guard.\n */\n revealSelection?: boolean | CatalogRevealOptions;\n selectAction?: string;\n toggleSidebarAction?: string;\n toggleThemeAction?: string;\n toggleSecondaryAction?: string;\n /**\n * The sidebar's app-owned collapsed flag. With it, the catalog's Workbench\n * sidebar is wired like any Workbench rail: it becomes a transient overlay\n * on a small screen (collapsed as the breakpoint applies, closed on Escape\n * or a press outside, focus handed back), and choosing an entry from the\n * open overlay closes it.\n */\n collapsed?: Signal<boolean>;\n /**\n * The app-owned sidebar width signal for a Catalog rendered with\n * `sidebar={{ resizable: true, size: sidebarSize.value }}`. Each committed\n * drag or keyboard resize is written to it.\n */\n sidebarSize?: Signal<number>;\n /**\n * With `sidebarSize`, load and save the width under this storage key so the\n * catalog remembers the user's sidebar width.\n */\n sidebarStorageKey?: string;\n /** The Catalog's `id`, when it is not the default `kui-catalog`. */\n id?: string;\n}\n\nexport interface CatalogRevealOptions {\n /** Scroll alignment within the sidebar. Default `'nearest'`. */\n block?: ScrollLogicalPosition;\n /** Cross-axis alignment. Default `'nearest'`. */\n inline?: ScrollLogicalPosition;\n /** Scroll behavior. Default `'auto'`. */\n behavior?: ScrollBehavior;\n /**\n * Only reveal when this media query matches. Defaults to the Catalog's\n * desktop layout; pass `false` to reveal at every viewport size.\n */\n media?: string | false;\n}\n\n// The Workbench keeps the sidebar inline above its `narrow` breakpoint (704px).\nconst catalogDesktopMedia = '(min-width: 44.01rem)';\n\n/**\n * Reveal one Catalog sidebar entry after the controlled render settles without\n * moving focus. Returns a cancellation function for rapid selection changes.\n */\nexport function revealCatalogEntry(\n root: HTMLElement,\n id: string,\n {\n block = 'nearest',\n inline = 'nearest',\n behavior = 'auto',\n media = catalogDesktopMedia,\n }: CatalogRevealOptions = {},\n): () => void {\n const view = root.ownerDocument.defaultView;\n if (!view || (media && !view.matchMedia(media).matches)) return () => {};\n const frame = view.requestAnimationFrame(() => {\n for (const item of root.querySelectorAll<HTMLElement>('[data-item-id]')) {\n if (item.dataset.itemId !== id) continue;\n item.scrollIntoView({ block, inline, behavior });\n break;\n }\n });\n return () => view.cancelAnimationFrame(frame);\n}\n\nfunction pixels(value: string): number {\n const number = Number.parseFloat(value);\n if (!Number.isFinite(number)) return 0;\n return value.trim().endsWith('rem') ? number * 16 : number;\n}\n\nfunction isTransparent(color: string): boolean {\n const normalized = color.replace(/\\s+/g, '');\n return (\n normalized === 'transparent' || /(?:,|\\/)0(?:\\.0+)?\\)$/.test(normalized)\n );\n}\n\nfunction geometrySpecimens(canvas: HTMLElement): Element[] {\n const result: Element[] = [];\n for (const example of canvas.querySelectorAll<HTMLElement>(\n '[data-catalog-example]',\n )) {\n if (example.closest('[data-catalog-geometry-overlay-skip]')) continue;\n for (const child of example.children) {\n if (\n child.matches('[data-catalog-geometry-overlay]') ||\n child.matches('[data-catalog-example-label]') ||\n child.matches('[data-catalog-example-note]')\n )\n continue;\n result.push(child);\n }\n }\n for (const element of canvas.querySelectorAll<HTMLElement>(\n '[data-component]',\n )) {\n if (\n element.closest('[data-catalog-geometry-overlay]') ||\n element.closest('[data-catalog-geometry-overlay-skip]') ||\n element.closest('.kui-catalog-example')\n )\n continue;\n const parent =\n element.parentElement?.closest<HTMLElement>('[data-component]');\n if (parent && canvas.contains(parent)) continue;\n result.push(element);\n }\n return result;\n}\n\nfunction geometryBox(\n document: Document,\n className: string,\n left: number,\n top: number,\n width: number,\n height: number,\n): HTMLElement {\n const element = document.createElement('div');\n element.className = className;\n element.style.transform = `translate(${left}px, ${top}px)`;\n element.style.width = `${Math.max(0, width)}px`;\n element.style.height = `${Math.max(0, height)}px`;\n return element;\n}\n\nfunction effectiveBorderWidth(width: string, style: string): number {\n return style === 'none' || style === 'hidden' ? 0 : pixels(width);\n}\n\n/**\n * Keep a Catalog's opt-in geometry overlay synchronized with its preview.\n * Specimens receive computed border highlights (or a dashed bound when they\n * have no border and are transparent), while positive computed margins use\n * devtools-style orange bands. CSS/stylesheet-only changes are observed too.\n * Returns a disposer.\n */\nexport function wireCatalogGeometryOverlay(root: HTMLElement): () => void {\n const catalog = root.matches('[data-component=\"catalog\"]')\n ? root\n : root.querySelector<HTMLElement>('[data-component=\"catalog\"]');\n const canvas = catalog?.querySelector<HTMLElement>('.kui-catalog__canvas');\n const layer = catalog?.querySelector<HTMLElement>(\n '[data-catalog-geometry-overlay]',\n );\n const view = root.ownerDocument.defaultView;\n if (!catalog || !canvas || !layer || !view) return () => {};\n\n let frame = 0;\n const render = (): void => {\n frame = 0;\n layer.replaceChildren();\n if (catalog.dataset.geometryOverlay !== 'true') {\n syncObservedSpecimens([]);\n return;\n }\n const base = canvas.getBoundingClientRect();\n const specimens = geometrySpecimens(canvas);\n syncObservedSpecimens(specimens);\n for (const [specimenIndex, element] of specimens.entries()) {\n const rect = element.getBoundingClientRect();\n const style = view.getComputedStyle(element);\n const align = pixels(\n style.getPropertyValue('--kui-catalog-example-align'),\n );\n const top = pixels(style.marginTop);\n const right = Math.max(\n 0,\n pixels(style.marginRight) - (style.direction === 'rtl' ? align : 0),\n );\n const bottom = pixels(style.marginBottom);\n const left = Math.max(\n 0,\n pixels(style.marginLeft) - (style.direction === 'rtl' ? 0 : align),\n );\n const x = rect.left - base.left + canvas.scrollLeft;\n const y = rect.top - base.top + canvas.scrollTop;\n const borderWidths = [\n effectiveBorderWidth(style.borderTopWidth, style.borderTopStyle),\n effectiveBorderWidth(style.borderRightWidth, style.borderRightStyle),\n effectiveBorderWidth(style.borderBottomWidth, style.borderBottomStyle),\n effectiveBorderWidth(style.borderLeftWidth, style.borderLeftStyle),\n ];\n if (borderWidths.some((width) => width > 0)) {\n const border = geometryBox(\n root.ownerDocument,\n 'kui-catalog__geometry-border',\n x,\n y,\n rect.width,\n rect.height,\n );\n border.dataset.catalogGeometrySpecimen = String(specimenIndex);\n border.style.borderTopWidth = `${borderWidths[0]}px`;\n border.style.borderRightWidth = `${borderWidths[1]}px`;\n border.style.borderBottomWidth = `${borderWidths[2]}px`;\n border.style.borderLeftWidth = `${borderWidths[3]}px`;\n border.style.borderRadius = style.borderRadius;\n layer.append(border);\n } else if (isTransparent(style.backgroundColor)) {\n const bound = geometryBox(\n root.ownerDocument,\n 'kui-catalog__geometry-bound',\n x,\n y,\n rect.width,\n rect.height,\n );\n bound.dataset.catalogGeometrySpecimen = String(specimenIndex);\n layer.append(bound);\n }\n const margins: Array<\n readonly [string, number, number, number, number, number]\n > = [\n ['top', top, x - left, y - top, rect.width + left + right, top],\n [\n 'bottom',\n bottom,\n x - left,\n y + rect.height,\n rect.width + left + right,\n bottom,\n ],\n ['left', left, x - left, y, left, rect.height],\n ['right', right, x + rect.width, y, right, rect.height],\n ];\n for (const [side, size, marginX, marginY, width, height] of margins) {\n if (size <= 0) continue;\n const margin = geometryBox(\n root.ownerDocument,\n 'kui-catalog__geometry-margin',\n marginX,\n marginY,\n width,\n height,\n );\n margin.dataset.catalogGeometrySpecimen = String(specimenIndex);\n margin.dataset.catalogGeometrySide = side;\n layer.append(margin);\n }\n }\n };\n const schedule = (): void => {\n if (!frame) frame = view.requestAnimationFrame(render);\n };\n const resizeObserver = new view.ResizeObserver(schedule);\n resizeObserver.observe(canvas);\n const observedSpecimens = new Set<Element>();\n const syncObservedSpecimens = (specimens: Element[]): void => {\n const next = new Set(specimens);\n for (const specimen of observedSpecimens) {\n if (next.has(specimen)) continue;\n resizeObserver.unobserve(specimen);\n observedSpecimens.delete(specimen);\n }\n for (const specimen of next) {\n if (observedSpecimens.has(specimen)) continue;\n resizeObserver.observe(specimen);\n observedSpecimens.add(specimen);\n }\n };\n const mutationObserver = new view.MutationObserver((records) => {\n if (\n records.some(\n ({ target }) => target !== layer && !layer.contains(target as Node),\n )\n )\n schedule();\n });\n mutationObserver.observe(catalog, {\n attributes: true,\n childList: true,\n subtree: true,\n });\n mutationObserver.observe(root.ownerDocument.documentElement, {\n attributes: true,\n });\n const documentHead = root.ownerDocument.head;\n if (documentHead)\n mutationObserver.observe(documentHead, {\n attributes: true,\n characterData: true,\n childList: true,\n subtree: true,\n });\n const stylesheetLoaded = (): void => schedule();\n documentHead?.addEventListener('load', stylesheetLoaded, true);\n view.addEventListener('resize', schedule);\n render();\n return () => {\n if (frame) view.cancelAnimationFrame(frame);\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n documentHead?.removeEventListener('load', stylesheetLoaded, true);\n view.removeEventListener('resize', schedule);\n layer.replaceChildren();\n };\n}\n\n/**\n * Wire a {@link Catalog}'s interactions with one delegated listener set: sidebar\n * item selection (and the related-entry popup menu), the sidebar collapse toggle, and\n * the theme toggle. The app owns the `active`/`collapsed`/`theme` signals and updates\n * them in the callbacks; optionally mirror the active id into the URL via `urlParam`.\n * It also wires the scroll dividers below root (`wireScrollDividers`), so the\n * catalog's panes and every example in it show their chrome dividers only\n * while scrolled. Returns a disposer.\n */\nexport function wireCatalog(\n root: HTMLElement,\n {\n onSelect,\n onToggleSidebar,\n onToggleTheme,\n onToggleSecondary,\n urlParam,\n revealSelection,\n selectAction = 'catalog-select',\n toggleSidebarAction = 'catalog-toggle-sidebar',\n toggleThemeAction = 'catalog-toggle-theme',\n toggleSecondaryAction = 'catalog-toggle-secondary',\n collapsed,\n sidebarSize,\n sidebarStorageKey,\n id: catalogId = 'kui-catalog',\n }: WireCatalogOptions,\n): () => void {\n let cancelReveal: (() => void) | undefined;\n const select = (id: string) => {\n onSelect(id);\n const view = root.ownerDocument.defaultView;\n if (urlParam && view) {\n const url = new URL(view.location.href);\n url.searchParams.set(urlParam, id);\n view.history.replaceState(null, '', url);\n }\n // An open overlay sidebar gives way to the entry just chosen from it.\n const rail = root.ownerDocument.getElementById(`${catalogId}-left-rail`);\n if (\n collapsed &&\n !collapsed.peek() &&\n rail &&\n root.ownerDocument.defaultView?.getComputedStyle(rail).position ===\n 'absolute'\n )\n collapsed.value = true;\n if (revealSelection) {\n cancelReveal?.();\n cancelReveal = revealCatalogEntry(\n root,\n id,\n revealSelection === true ? undefined : revealSelection,\n );\n }\n };\n\n const disposers: Array<() => void> = [\n wireScrollDividers(root),\n // Sidebar items AND the footer's related-entry popup-menu items both carry\n // `data-action={selectAction}` + `data-item-id`, so one delegated click covers both.\n delegate(\n root,\n 'click',\n `[data-action=\"${selectAction}\"]`,\n (_event, element) => {\n const id = (element as HTMLElement).dataset.itemId;\n if (id) select(id);\n },\n ),\n ];\n if (onToggleSidebar) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleSidebarAction}\"]`, () =>\n onToggleSidebar(),\n ),\n );\n }\n if (onToggleTheme) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleThemeAction}\"]`, () =>\n onToggleTheme(),\n ),\n );\n }\n if (onToggleSecondary) {\n disposers.push(\n delegate(root, 'click', `[data-action=\"${toggleSecondaryAction}\"]`, () =>\n onToggleSecondary(),\n ),\n );\n }\n if (collapsed || sidebarSize)\n disposers.push(\n wireWorkbench(root, {\n id: catalogId,\n panels: {\n leftRail: {\n collapsed,\n size: sidebarSize,\n storageKey: sidebarStorageKey,\n },\n },\n }),\n );\n return () => {\n cancelReveal?.();\n for (const dispose of disposers.splice(0)) dispose();\n };\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An app-owned scroll arrangement outside a `Pane`: the `id` of the element
|
|
3
|
+
* that scrolls and the `id`s of the pinned chrome on each physical side of it.
|
|
4
|
+
* Each named chrome element shows its divider on the side facing the scroller
|
|
5
|
+
* while content is scrolled away beyond that side. Ids are resolved below the
|
|
6
|
+
* wired root on every refresh, so a re-render that replaces an element keeps
|
|
7
|
+
* the pairing.
|
|
8
|
+
*/
|
|
9
|
+
interface ScrollDividerTarget {
|
|
10
|
+
/** The `id` of the scrolling element. */
|
|
11
|
+
scroller: string;
|
|
12
|
+
/** Chrome above the scroller: shows its bottom divider once scrolled down. */
|
|
13
|
+
top?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Chrome right of the scroller: shows its left divider while content is
|
|
16
|
+
* hidden beyond the scroller's right edge (never when nothing overflows).
|
|
17
|
+
*/
|
|
18
|
+
right?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Chrome below the scroller: shows its top divider while content is hidden
|
|
21
|
+
* beyond the scroller's bottom edge (never when nothing overflows).
|
|
22
|
+
*/
|
|
23
|
+
bottom?: string;
|
|
24
|
+
/** Chrome left of the scroller: shows its right divider once scrolled right. */
|
|
25
|
+
left?: string;
|
|
26
|
+
}
|
|
27
|
+
interface WireScrollDividersOptions {
|
|
28
|
+
/**
|
|
29
|
+
* App-owned scroll arrangements to pair beyond the ones found by structure
|
|
30
|
+
* (every `Pane`'s header and footer around its content, every `NavStack`'s
|
|
31
|
+
* and `TabScaffold`'s chrome around its active region, and every `TabBar`
|
|
32
|
+
* strip).
|
|
33
|
+
*/
|
|
34
|
+
targets?: readonly ScrollDividerTarget[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Wire scroll dividers below `root`: a divider between pinned chrome and the
|
|
38
|
+
* content that scrolls beside it shows only while content is scrolled away
|
|
39
|
+
* from that edge. Near edges (top, left) hide at the scroll start; far edges
|
|
40
|
+
* (bottom, right) hide at the scroll end and whenever nothing overflows.
|
|
41
|
+
*
|
|
42
|
+
* The wiring only reports scroll state; each component draws its own divider
|
|
43
|
+
* from it. It writes `data-scroll-overflow` (the edges with hidden content, in
|
|
44
|
+
* canonical `t`/`r`/`b`/`l` order) on each scroller, and `data-scroll-divider`
|
|
45
|
+
* (the sides to draw) on each paired chrome element:
|
|
46
|
+
*
|
|
47
|
+
* - every `Pane` with a header or footer: its header shows a bottom divider and
|
|
48
|
+
* its footer a top divider (drawn by the Pane, per its `chromeDividers`);
|
|
49
|
+
* - every `NavStack`'s top chrome and bottom toolbar around its active view,
|
|
50
|
+
* and every `TabScaffold`'s bar under its active scene: the chrome shows a
|
|
51
|
+
* bottom (top chrome) or top (bottom toolbar, bar) divider. The scroller is
|
|
52
|
+
* whichever element actually scrolls there: the view or scene itself, or,
|
|
53
|
+
* through a sole child with no chrome of its own on that edge, a `Pane`'s
|
|
54
|
+
* content or a nested `NavStack` / `TabScaffold` region (a Pane's own header
|
|
55
|
+
* or footer draws that boundary instead);
|
|
56
|
+
* - every `TabBar` strip: the bar draws a divider on each side of the strip
|
|
57
|
+
* whose tabs are scrolled out of view;
|
|
58
|
+
* - each app-owned `targets` pairing: a `Toolbar` or `List` named as chrome
|
|
59
|
+
* draws the divider on its facing side.
|
|
60
|
+
*
|
|
61
|
+
* Structure is re-read after every DOM change below root (a re-render that
|
|
62
|
+
* drops the attributes gets them back before paint), scroll is tracked with
|
|
63
|
+
* one capturing listener, and size changes of each scroller and its children
|
|
64
|
+
* with a `ResizeObserver`. Returns a disposer that removes every attribute it
|
|
65
|
+
* wrote. See `docs/23-app-layouts.md` §3.7.
|
|
66
|
+
*/
|
|
67
|
+
declare function wireScrollDividers(root: HTMLElement | Document, { targets }?: WireScrollDividersOptions): () => void;
|
|
68
|
+
|
|
69
|
+
export { type ScrollDividerTarget, type WireScrollDividersOptions, wireScrollDividers };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"wire-scroll-dividers.js"}
|
package/dist/workbench.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ListConfig } from './list.js';
|
|
|
3
3
|
import { PaneConfig } from './pane.js';
|
|
4
4
|
import { ResizableRegionSeparator, ResizableRegionCollapseMotion, ResizableRegionContentOverflow, ResizableRegionPresentation, ResizableRegionRestorePosition } from './resizable-region.js';
|
|
5
5
|
import { K as KerfUiContent } from './semantic-content-BbzjvSu9.js';
|
|
6
|
-
import { a as PanelToolbar, b as PanelToggle } from './panel-toolbar-
|
|
6
|
+
import { a as PanelToolbar, b as PanelToggle } from './panel-toolbar-DqwtBxQL.js';
|
|
7
7
|
import { ToolbarConfig } from './toolbar.js';
|
|
8
8
|
import './css-values.js';
|
|
9
9
|
import './flex-alignment-4ms8ZbV8.js';
|
|
@@ -16,7 +16,7 @@ type WorkbenchPanelToggle = PanelToggle;
|
|
|
16
16
|
/**
|
|
17
17
|
* A Workbench panel's top toolbar, composed by the Workbench so its groups can
|
|
18
18
|
* follow the panel's open state (see {@link PanelToolbar} for the roles).
|
|
19
|
-
* A collapsed rail's
|
|
19
|
+
* A collapsed rail's marked groups and toggle go to the leading edge of
|
|
20
20
|
* `mainToolbar` (left rail) or its trailing edge (right rail); a collapsed
|
|
21
21
|
* drawer's go to the trailing edge of `mainBottomToolbar`, else to a
|
|
22
22
|
* `FloatingToolbar` in the work area's bottom-end corner.
|
|
@@ -24,9 +24,9 @@ type WorkbenchPanelToggle = PanelToggle;
|
|
|
24
24
|
type WorkbenchPanelToolbar = PanelToolbar;
|
|
25
25
|
/**
|
|
26
26
|
* The work area's top toolbar; collapsed rails add their groups to it. Its
|
|
27
|
-
* configuration forwards to its `Toolbar`.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* configuration forwards to its `Toolbar`. It draws no divider of its own by
|
|
28
|
+
* default: the work area's `Pane` draws one under its header chrome, wherever
|
|
29
|
+
* that chrome ends, while `main` is scrolled (`mainPane.chromeDividers`).
|
|
30
30
|
*/
|
|
31
31
|
interface WorkbenchMainToolbar extends ToolbarConfig {
|
|
32
32
|
label: string;
|
|
@@ -40,9 +40,9 @@ interface WorkbenchMainToolbar extends ToolbarConfig {
|
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* The work area's bottom toolbar; a collapsed drawer adds its groups to it.
|
|
43
|
-
* Its configuration forwards to its `Toolbar`.
|
|
44
|
-
*
|
|
45
|
-
* `
|
|
43
|
+
* Its configuration forwards to its `Toolbar`. It draws no divider of its own
|
|
44
|
+
* by default: the work area's `Pane` draws one over its footer chrome while
|
|
45
|
+
* more of `main` lies below (`mainPane.chromeDividers`).
|
|
46
46
|
*/
|
|
47
47
|
interface WorkbenchMainBottomToolbar extends ToolbarConfig {
|
|
48
48
|
label: string;
|
|
@@ -83,7 +83,7 @@ interface WorkbenchPanelResizable {
|
|
|
83
83
|
interface WorkbenchPanel {
|
|
84
84
|
content: KerfUiContent;
|
|
85
85
|
/**
|
|
86
|
-
* The panel's top toolbar, composed by the Workbench: its
|
|
86
|
+
* The panel's top toolbar, composed by the Workbench: its marked groups
|
|
87
87
|
* and standard `toggle` move to the work area's toolbar while the panel is
|
|
88
88
|
* collapsed. With it, `content` renders in a `Pane` below the toolbar.
|
|
89
89
|
*/
|
|
@@ -92,7 +92,7 @@ interface WorkbenchPanel {
|
|
|
92
92
|
footer?: KerfUiContent;
|
|
93
93
|
/**
|
|
94
94
|
* Configuration for a `toolbar` panel's `Pane` (`contentElement`,
|
|
95
|
-
* `contentLabel`, `separators`, `safeAreaEdges`) — for example
|
|
95
|
+
* `contentLabel`, `separators`, `safeAreaEdges`, `chromeDividers`) — for example
|
|
96
96
|
* `{ contentElement: 'nav', contentLabel: 'Sections' }` for a navigation
|
|
97
97
|
* rail. Omitted or `undefined` fields keep the `Pane` defaults. Ignored
|
|
98
98
|
* without a `toolbar`, where `content` renders as given.
|
|
@@ -154,7 +154,7 @@ interface WorkbenchProps {
|
|
|
154
154
|
/** The central work area. */
|
|
155
155
|
main: KerfUiContent;
|
|
156
156
|
/**
|
|
157
|
-
* The work area's top toolbar. A collapsed left rail's
|
|
157
|
+
* The work area's top toolbar. A collapsed left rail's marked groups
|
|
158
158
|
* and toggle lead it; a collapsed right rail's trail it. With it, `main`
|
|
159
159
|
* renders in a `Pane` below the toolbar.
|
|
160
160
|
*/
|
|
@@ -170,7 +170,7 @@ interface WorkbenchProps {
|
|
|
170
170
|
*/
|
|
171
171
|
mainFooter?: KerfUiContent;
|
|
172
172
|
/**
|
|
173
|
-
* The work area's bottom toolbar. A collapsed drawer's
|
|
173
|
+
* The work area's bottom toolbar. A collapsed drawer's marked groups and
|
|
174
174
|
* toggle trail it; without it they float in the work area's corner.
|
|
175
175
|
*/
|
|
176
176
|
mainBottomToolbar?: WorkbenchMainBottomToolbar;
|
|
@@ -185,7 +185,7 @@ interface WorkbenchProps {
|
|
|
185
185
|
mainFooterPlacement?: WorkbenchChromePlacement;
|
|
186
186
|
/**
|
|
187
187
|
* Configuration for the work area's `Pane` (`contentElement`,
|
|
188
|
-
* `contentLabel`, `separators`, `safeAreaEdges`), which it has whenever it
|
|
188
|
+
* `contentLabel`, `separators`, `safeAreaEdges`, `chromeDividers`), which it has whenever it
|
|
189
189
|
* has a toolbar, `mainHeader`, or `mainFooter`; without that chrome, `main`
|
|
190
190
|
* renders as given and this is ignored. Omitted or `undefined` fields keep
|
|
191
191
|
* the `Pane` defaults.
|
|
@@ -194,12 +194,13 @@ interface WorkbenchProps {
|
|
|
194
194
|
/**
|
|
195
195
|
* Configuration for the `List` that holds `mainHeader` (`gap`, `hAlign`,
|
|
196
196
|
* `vAlign`, `dividerSides`, `textInsets`, `controlInsets`). Omitted or
|
|
197
|
-
* `undefined` fields keep the defaults
|
|
197
|
+
* `undefined` fields keep the defaults (no divider: the work area's
|
|
198
|
+
* `Pane` draws the line under its header chrome).
|
|
198
199
|
*/
|
|
199
200
|
mainHeaderList?: ListConfig;
|
|
200
201
|
/**
|
|
201
|
-
* The same for the `List` that holds `mainFooter
|
|
202
|
-
*
|
|
202
|
+
* The same for the `List` that holds `mainFooter` (no divider by default:
|
|
203
|
+
* the work area's `Pane` draws the line over its footer chrome).
|
|
203
204
|
*/
|
|
204
205
|
mainFooterList?: ListConfig;
|
|
205
206
|
leftRail?: WorkbenchPanel;
|
package/dist/workbench.js
CHANGED
package/docs/app-layouts.md
CHANGED
|
@@ -44,7 +44,9 @@ the layouts handle the insets for you. There is nothing to configure:
|
|
|
44
44
|
not inset on that edge. Collapse the rail and the center picks up the edge.
|
|
45
45
|
- **No double inset.** Whichever region applies an inset clears it for its
|
|
46
46
|
descendants. A layout region whose only child is a `Pane` or another layout
|
|
47
|
-
lets that child own the insets.
|
|
47
|
+
lets that child own the insets. That child fills the region — a `Workbench`
|
|
48
|
+
area or panel, a `NavStack` view, a `TabScaffold` scene — so a sole `Pane`'s
|
|
49
|
+
header stays pinned while its own content scrolls. A `Pane` header or footer whose only child is
|
|
48
50
|
a `Toolbar` hands the inline insets to the toolbar, so the toolbar's dividers
|
|
49
51
|
still reach the edge.
|
|
50
52
|
|
|
@@ -131,6 +133,12 @@ device in tests.
|
|
|
131
133
|
`content` a `NavStack`. On a tablet/desktop, render the same sections as a
|
|
132
134
|
`Workbench` left rail instead of a bottom bar.
|
|
133
135
|
|
|
136
|
+
Whatever the layout, call `wireScrollDividers(appRoot)` from
|
|
137
|
+
`@kerfjs/ui/wire-scroll-dividers` once: every `Pane` a layout renders, every
|
|
138
|
+
`NavStack`'s top chrome and bottom toolbar, and every `TabScaffold` bar then
|
|
139
|
+
draw the line between the pinned chrome and the scrolling content only while
|
|
140
|
+
content is scrolled beneath them, and toolbars need no divider of their own. See [Scroll dividers](layout.md#scroll-dividers).
|
|
141
|
+
|
|
134
142
|
## Dialogs
|
|
135
143
|
|
|
136
144
|
Pick the dialog's inner layout by the same complexity axis, then apply the device
|