@kerfjs/ui 5.0.0-beta.110 → 5.0.0-beta.112
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 +3 -0
- package/ai/component-catalog.json +161 -8
- package/ai/component-composition.json +119 -2
- package/ai/components/README.md +2 -0
- package/ai/components/backdrop-image.md +1 -0
- package/ai/components/button.md +5 -2
- package/ai/components/content-item.md +1 -0
- package/ai/components/editor-frame.md +80 -0
- package/ai/components/summary-row.md +5 -2
- package/ai/components/surface-scaffold.md +3 -0
- package/ai/components/value-preview.md +75 -0
- package/ai/public-api-signatures-v1.md +207 -50
- package/ai/skill.md +17 -0
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/dist/backdrop-image.d.ts +11 -0
- package/dist/backdrop-image.js +1 -1
- package/dist/browser/content-item.js +1 -0
- package/dist/browser/editor-frame.js +3 -0
- package/dist/browser/value-preview.js +3 -0
- package/dist/button.d.ts +4 -2
- package/dist/button.js +1 -1
- package/dist/catalog-resources.d.ts +2 -1
- package/dist/catalog.d.ts +2 -1
- package/dist/catalog.js +6 -4
- package/dist/catalog.js.map +1 -1
- package/dist/{chunk-JCCN3U6X.js → chunk-2J7XKAZX.js} +3 -2
- package/dist/chunk-2J7XKAZX.js.map +1 -0
- package/dist/chunk-3KFMLOTH.js +201 -0
- package/dist/chunk-3KFMLOTH.js.map +1 -0
- package/dist/{chunk-ATGAJVZ6.js → chunk-3OP66VXU.js} +64 -4
- package/dist/chunk-3OP66VXU.js.map +1 -0
- package/dist/{chunk-ZNROKDSZ.js → chunk-3V4OCDTL.js} +2 -8
- package/dist/chunk-3V4OCDTL.js.map +1 -0
- package/dist/{chunk-3GLYIIFR.js → chunk-3WWX2O4G.js} +3 -2
- package/dist/chunk-3WWX2O4G.js.map +1 -0
- package/dist/{chunk-SCDWURBO.js → chunk-5CLMV5YU.js} +21 -3
- package/dist/chunk-5CLMV5YU.js.map +1 -0
- package/dist/{chunk-P7EJ4CAD.js → chunk-ETFP7HAR.js} +2 -2
- package/dist/{chunk-P7EJ4CAD.js.map → chunk-ETFP7HAR.js.map} +1 -1
- package/dist/chunk-F653O57X.js +41 -0
- package/dist/chunk-F653O57X.js.map +1 -0
- package/dist/{chunk-SOFPUW3O.js → chunk-IIQ2XIMU.js} +4 -3
- package/dist/chunk-IIQ2XIMU.js.map +1 -0
- package/dist/chunk-IRC5N7FA.js +16 -0
- package/dist/chunk-IRC5N7FA.js.map +1 -0
- package/dist/{chunk-SQ5DH66U.js → chunk-ITENVZ6Q.js} +2 -15
- package/dist/chunk-ITENVZ6Q.js.map +1 -0
- package/dist/{chunk-4UB5Z3ZZ.js → chunk-K67XBCHG.js} +8 -4
- package/dist/chunk-K67XBCHG.js.map +1 -0
- package/dist/chunk-OK7FUK7U.js +9 -0
- package/dist/chunk-OK7FUK7U.js.map +1 -0
- package/dist/{chunk-WSEJ2FDE.js → chunk-OUCHU7JB.js} +2 -2
- package/dist/{chunk-WSEJ2FDE.js.map → chunk-OUCHU7JB.js.map} +1 -1
- package/dist/{chunk-KPINJHIC.js → chunk-PS24PVR6.js} +3 -1
- package/dist/chunk-PS24PVR6.js.map +1 -0
- package/dist/{chunk-6CDILXF4.js → chunk-S3DCRI2M.js} +31 -5
- package/dist/chunk-S3DCRI2M.js.map +1 -0
- package/dist/chunk-V6N3YLTM.js +56 -0
- package/dist/chunk-V6N3YLTM.js.map +1 -0
- package/dist/{chunk-HQZG3OFL.js → chunk-XRZSK2WC.js} +3 -2
- package/dist/chunk-XRZSK2WC.js.map +1 -0
- package/dist/{chunk-CPSGUGAY.js → chunk-YPAQFBMN.js} +4 -4
- package/dist/{chunk-CPSGUGAY.js.map → chunk-YPAQFBMN.js.map} +1 -1
- package/dist/collapsible-panel.d.ts +1 -0
- package/dist/collapsible-panel.js +3 -2
- package/dist/collapsible-panel.js.map +1 -1
- package/dist/content-item.d.ts +46 -2
- package/dist/content-item.js +4 -1
- package/dist/editor-frame.d.ts +41 -0
- package/dist/editor-frame.js +3 -0
- package/dist/editor-frame.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +27 -23
- package/dist/list-action-row.js +2 -1
- package/dist/list-detail-dialog.d.ts +2 -1
- package/dist/list-detail-dialog.js +5 -4
- package/dist/list-detail-dialog.js.map +1 -1
- package/dist/list-item.js +2 -1
- package/dist/{nav-stack-CU_0dKtI.d.ts → nav-stack-CrZF95VO.d.ts} +2 -1
- package/dist/nav-stack.d.ts +2 -1
- package/dist/nav-stack.js +2 -1
- package/dist/pane.d.ts +3 -23
- package/dist/pane.js +2 -1
- package/dist/split-view.d.ts +2 -1
- package/dist/split-view.js +2 -1
- package/dist/styles/backdrop-image.css +24 -1
- package/dist/styles/components/actions/popup-menu/popup-menu.css +1 -1
- package/dist/styles/components/collections/summary-row/summary-row.css +7 -3
- package/dist/styles/components/data-display/value-preview/value-preview.css +18 -0
- package/dist/styles/components/surfaces/backdrop-image/backdrop-image.css +24 -1
- package/dist/styles/components/surfaces/content-item/content-item.css +52 -0
- package/dist/styles/components/surfaces/editor-frame/editor-frame.css +121 -0
- package/dist/styles/components/surfaces/surface-scaffold/surface-scaffold.css +25 -1
- package/dist/styles/content-item.css +3 -168
- package/dist/styles/editor-frame.css +121 -0
- package/dist/styles/foundation.css +9 -4
- package/dist/styles/popup-menu.css +1 -1
- package/dist/styles/styles.css +2 -0
- package/dist/styles/summary-row.css +7 -3
- package/dist/styles/surface-scaffold.css +25 -1
- package/dist/styles/value-preview.css +18 -0
- package/dist/styles/webawesome.css +2 -2
- package/dist/summary-row.d.ts +20 -11
- package/dist/summary-row.js +2 -1
- package/dist/surface-scaffold-register.js +1 -1
- package/dist/surface-scaffold.d.ts +30 -2
- package/dist/surface-scaffold.js +2 -2
- package/dist/surface-tint-DQgYCaP9.d.ts +25 -0
- package/dist/tab-navigator.d.ts +2 -1
- package/dist/tab-navigator.js +2 -1
- package/dist/tab-navigator.js.map +1 -1
- package/dist/toolbar.d.ts +1 -0
- package/dist/value-preview.d.ts +21 -0
- package/dist/value-preview.js +3 -0
- package/dist/value-preview.js.map +1 -0
- package/dist/wire-catalog.d.ts +2 -1
- package/dist/wire-catalog.js +1 -1
- package/dist/wire-content-items.js +88 -0
- package/dist/wire-content-items.js.map +1 -1
- package/dist/workbench-dialog.d.ts +2 -1
- package/dist/workbench-dialog.js +4 -3
- package/dist/workbench-dialog.js.map +1 -1
- package/dist/workbench.d.ts +2 -1
- package/dist/workbench.js +2 -1
- package/docs/accessibility.md +6 -0
- package/docs/backdrop-image.md +4 -0
- package/docs/button.md +15 -0
- package/docs/component-contract.md +34 -4
- package/docs/component-selection.md +16 -1
- package/docs/design/templates/button/emphasis-dark.svg +1 -1
- package/docs/design/templates/button-dark.svg +1 -1
- package/docs/design/templates/checkbox/error-dark.svg +1 -1
- package/docs/design/templates/checkbox/states.svg +1 -1
- package/docs/design/templates/checkbox-dark.svg +1 -1
- package/docs/design/templates/checkbox-group/horizontal-dark.svg +1 -1
- package/docs/design/templates/checkbox-group/vertical.svg +1 -1
- package/docs/design/templates/checkbox-group-dark.svg +1 -1
- package/docs/design/templates/checkbox-group.svg +1 -1
- package/docs/design/templates/checkbox.svg +1 -1
- package/docs/design/templates/choice-chips/color-palette-dark.svg +1 -1
- package/docs/design/templates/choice-chips-dark.svg +1 -1
- package/docs/design/templates/color-field/error-dark.svg +1 -1
- package/docs/design/templates/color-field/hint.svg +1 -1
- package/docs/design/templates/color-field-dark.svg +1 -1
- package/docs/design/templates/color-field.svg +1 -1
- package/docs/design/templates/color-picker/gray.svg +1 -1
- package/docs/design/templates/color-picker/hsb.svg +1 -1
- package/docs/design/templates/color-picker/rgb.svg +1 -1
- package/docs/design/templates/color-picker.svg +1 -1
- package/docs/design/templates/color-swatches/palette-dark.svg +1 -1
- package/docs/design/templates/color-swatches-dark.svg +1 -1
- package/docs/design/templates/disclosure/embedded.svg +1 -1
- package/docs/design/templates/disclosure/framed-sunken.svg +1 -1
- package/docs/design/templates/disclosure/plain.svg +1 -1
- package/docs/design/templates/disclosure.svg +1 -1
- package/docs/design/templates/message-composer/chat.svg +1 -1
- package/docs/design/templates/message-composer.svg +1 -1
- package/docs/design/templates/progress-bar/determinate.svg +1 -1
- package/docs/design/templates/progress-bar/tones.svg +1 -1
- package/docs/design/templates/progress-bar.svg +1 -1
- package/docs/design/templates/radio-group/horizontal-dark.svg +1 -1
- package/docs/design/templates/radio-group/vertical.svg +1 -1
- package/docs/design/templates/radio-group-dark.svg +1 -1
- package/docs/design/templates/radio-group.svg +1 -1
- package/docs/design/templates/search-field/empty.svg +1 -1
- package/docs/design/templates/search-field/tokens.svg +1 -1
- package/docs/design/templates/search-field.svg +1 -1
- package/docs/design/templates/select/form.svg +1 -1
- package/docs/design/templates/select.svg +1 -1
- package/docs/design/templates/slider/compact.svg +1 -1
- package/docs/design/templates/slider/readout.svg +1 -1
- package/docs/design/templates/slider/ticks.svg +1 -1
- package/docs/design/templates/slider.svg +1 -1
- package/docs/design/templates/switch/states.svg +1 -1
- package/docs/design/templates/switch.svg +1 -1
- package/docs/design/templates/tag-field/error-dark.svg +1 -1
- package/docs/design/templates/tag-field/error.svg +1 -1
- package/docs/design/templates/tag-field/tags.svg +1 -1
- package/docs/design/templates/tag-field-dark.svg +1 -1
- package/docs/design/templates/tag-field.svg +1 -1
- package/docs/design/templates/text-field/error-dark.svg +1 -1
- package/docs/design/templates/text-field/labeled.svg +1 -1
- package/docs/design/templates/text-field/multiline.svg +1 -1
- package/docs/design/templates/text-field/search.svg +1 -1
- package/docs/design/templates/text-field-dark.svg +1 -1
- package/docs/design/templates/text-field.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-danger-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group-dark.svg +1 -1
- package/docs/design/templates.md +3 -1
- package/docs/editor-frame.md +47 -0
- package/docs/investigations/content-item-media-scroll-performance.md +26 -0
- package/docs/layout.md +34 -0
- package/docs/manual-test-plan.md +27 -1
- package/docs/recipes.md +9 -0
- package/docs/surface-scaffold.md +50 -1
- package/docs/value-preview.md +16 -0
- package/llms.txt +10 -1
- package/package.json +13 -1
- package/dist/chunk-3GLYIIFR.js.map +0 -1
- package/dist/chunk-4UB5Z3ZZ.js.map +0 -1
- package/dist/chunk-5USKCWGL.js +0 -113
- package/dist/chunk-5USKCWGL.js.map +0 -1
- package/dist/chunk-6CDILXF4.js.map +0 -1
- package/dist/chunk-ATGAJVZ6.js.map +0 -1
- package/dist/chunk-HQZG3OFL.js.map +0 -1
- package/dist/chunk-JCCN3U6X.js.map +0 -1
- package/dist/chunk-KPINJHIC.js.map +0 -1
- package/dist/chunk-SCDWURBO.js.map +0 -1
- package/dist/chunk-SOFPUW3O.js.map +0 -1
- package/dist/chunk-SQ5DH66U.js.map +0 -1
- package/dist/chunk-ZNROKDSZ.js.map +0 -1
package/docs/manual-test-plan.md
CHANGED
|
@@ -26,4 +26,30 @@ in `tests/browser/dialog-bottom-sheet.spec.ts`.
|
|
|
26
26
|
|
|
27
27
|
## Automated coverage summary
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The feed-card route `?component=content-item`, example "Image-Tinted Feed
|
|
30
|
+
Cards", has unit coverage for image state transitions and three-engine browser
|
|
31
|
+
coverage for independent timelines, reverse scrolling, image error/recovery,
|
|
32
|
+
light/dark tint contrast, reduced motion, increased contrast, and forced
|
|
33
|
+
colors. Wide and narrow light/dark captures were inspected for text, controls,
|
|
34
|
+
image clipping, and card spacing. A 50/200-card Chromium trace checks node and
|
|
35
|
+
listener growth; it uses repeated sample artwork, so a production feed with
|
|
36
|
+
unique high-resolution assets still needs its own image-cache profiling.
|
|
37
|
+
The composed BackdropImage card has browser checks for its edge geometry,
|
|
38
|
+
fade, scrim, and focusable overlay at wide and narrow sizes; inspect the same
|
|
39
|
+
states in both captured WebKit views.
|
|
40
|
+
|
|
41
|
+
The remaining device-only checks above require a real mobile keyboard.
|
|
42
|
+
The List View Transitions catalog example has unit coverage for its row edits,
|
|
43
|
+
pending-snapshot queue, and clip lifecycle, with browser coverage for real controls, fallback,
|
|
44
|
+
reduced motion, and wide/narrow layout. Its animation was visually inspected
|
|
45
|
+
at both widths; the browser tests verify names and state after each edit.
|
|
46
|
+
The real catalog scroll position is checked during and after all four List
|
|
47
|
+
transition actions at wide and narrow viewports. During motion, check that
|
|
48
|
+
named rows stay within the visible example and do not cover the catalog footer
|
|
49
|
+
or neighboring examples; the browser suite checks the computed transition
|
|
50
|
+
clip at wide and narrow viewports. Also check that the catalog header, sidebar,
|
|
51
|
+
and surrounding examples remain painted throughout the transition; browser
|
|
52
|
+
captures compare a header pixel before and during motion at narrow, medium,
|
|
53
|
+
and review-sized viewports.
|
|
54
|
+
The row viewport has a fixed height across Reorder, Insert Delta, Remove Last,
|
|
55
|
+
and Reset; inspect the disappearing last row within it at wide and narrow sizes.
|
package/docs/recipes.md
CHANGED
|
@@ -220,6 +220,15 @@ and [`backdrop-image.md`](backdrop-image.md) for the image.
|
|
|
220
220
|
|
|
221
221
|
## Rules shared by every recipe
|
|
222
222
|
|
|
223
|
+
An image-led feed composes `ContentItem` rows with `media` and a per-card
|
|
224
|
+
app-sampled `tint` inside one scrolling Pane. Each image reserves its size and
|
|
225
|
+
animates on its own view timeline as it crosses that Pane's top edge. Use
|
|
226
|
+
`wireContentItems` on the stable app root for image load/error as well as card
|
|
227
|
+
keyboard behavior. Put source links and actions inside static cards. Use
|
|
228
|
+
`ContentItem.media` composes `BackdropImage` for each feed row; use the public
|
|
229
|
+
`BackdropImage` directly for a page hero. See
|
|
230
|
+
[Content items](layout.md#content-items) and [BackdropImage](backdrop-image.md).
|
|
231
|
+
|
|
223
232
|
- Import `@kerfjs/ui/layout.css`; keep every pane unpadded and use exactly one
|
|
224
233
|
`.kui-pane__content` scroll owner for each real boundary.
|
|
225
234
|
- For direct `wa-*` JSX, import types from `@kerfjs/ui/webawesome`. Import only
|
package/docs/surface-scaffold.md
CHANGED
|
@@ -47,7 +47,10 @@ openDialog(document.getElementById('edit-workspace') as HTMLDialogElement);
|
|
|
47
47
|
copy in the body. `rootAttributes` takes only `data-*` attributes, so it can
|
|
48
48
|
never set or override `aria-describedby`.
|
|
49
49
|
- **Header.** The title, then `headerActions` and a close button (`closeLabel`,
|
|
50
|
-
default `Close`). `
|
|
50
|
+
default `Close`). Set `closeEmphasis="quiet"` for a smaller, softer X in the
|
|
51
|
+
same 40px button target; the default `"normal"` keeps the standard close
|
|
52
|
+
control. Both preserve the accessible name, keyboard focus, and close
|
|
53
|
+
request behavior. `withoutHeader` renders none, for content that owns its
|
|
51
54
|
heading and close control.
|
|
52
55
|
- **Body and footer.** `children` is the body; `footer` sits below it (or
|
|
53
56
|
floats over it, see [Chat dialogs](#chat-dialogs-a-floating-footer-over-a-filling-transcript)).
|
|
@@ -102,6 +105,52 @@ of wrapping it in an app `div`:
|
|
|
102
105
|
`rootAttributes` takes `data-*` identity only; the surface's own configuration
|
|
103
106
|
attributes (`data-size`, `data-presentation`, …) stay protected.
|
|
104
107
|
|
|
108
|
+
### Controlled modal stacks
|
|
109
|
+
|
|
110
|
+
For a reader stack, render one `DialogSurface` per reader with a stable `id` or
|
|
111
|
+
`data-key`, and pass each layer its controlled `stack` state:
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
<DialogSurface
|
|
115
|
+
id={`reader-${reader.id}`}
|
|
116
|
+
label={reader.title}
|
|
117
|
+
preferredWidth={remify(1024)}
|
|
118
|
+
height="viewport"
|
|
119
|
+
bodyInset="none"
|
|
120
|
+
bodyLayout="fill"
|
|
121
|
+
stack={{
|
|
122
|
+
open: reader.open,
|
|
123
|
+
active: reader.id === activeReaderId,
|
|
124
|
+
position: reader.position,
|
|
125
|
+
count: readers.length,
|
|
126
|
+
offset: remify(-10 * (readers.length - reader.position)),
|
|
127
|
+
}}
|
|
128
|
+
rootAttributes={{ 'data-key': reader.id }}
|
|
129
|
+
>
|
|
130
|
+
{reader.content}
|
|
131
|
+
</DialogSurface>;
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Call `wireDialogStack(container)` once on a stable ancestor after rendering and
|
|
135
|
+
call its returned cleanup when that ancestor unmounts; cleanup closes its open
|
|
136
|
+
layers. It observes subsequent
|
|
137
|
+
renders and calls `syncDialogStack(container)` to open layers back to front in
|
|
138
|
+
the browser's native top layer. `position` is a unique 1-based order within the
|
|
139
|
+
stack; `count` includes closed layers that remain rendered. Exactly one open
|
|
140
|
+
layer must be `active`, and it must have the highest open position. An inactive
|
|
141
|
+
layer has `aria-hidden` and `inert`, and only the active layer has
|
|
142
|
+
`aria-modal="true"`. The optional typed `offset` translates inactive layers on
|
|
143
|
+
roomy screens; compact screens stay aligned. Stacked modals default to a 24px
|
|
144
|
+
desktop and 16px phone viewport gutter, overridable with `viewportGutter`.
|
|
145
|
+
|
|
146
|
+
Handle `kui-request-close` by updating application state to close the top
|
|
147
|
+
layer; the stack controller then reconciles it. It never closes a controlled
|
|
148
|
+
layer on its own. A reorder may briefly close and reopen moved native dialogs
|
|
149
|
+
to establish browser top-layer order, so do not treat the native `close` event
|
|
150
|
+
as a user dismissal. Each dialog retains its own in-dialog overlay host for
|
|
151
|
+
popups and menus. The catalog's **Controlled Reader Stack** demonstrates push,
|
|
152
|
+
reorder, Escape, and close at desktop and phone widths.
|
|
153
|
+
|
|
105
154
|
### Modal viewport bounds
|
|
106
155
|
|
|
107
156
|
`viewportGutter` accepts a branded `CssLength` from `@kerfjs/ui/css-values`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# ValuePreview
|
|
2
|
+
|
|
3
|
+
`ValuePreview` displays a literal, read-only multiline string inside a bounded, keyboard-scrollable region. Use it for an existing value that may contain line breaks or long unbroken tokens, such as two versions in a conflict review. It owns compact text, pre-wrapping, anywhere wrapping, and a 48–96px default height window. It does not paint a background, border, or outer inset; compose it inside `SunkenPanel` when the value needs a lowered frame.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { SunkenPanel } from '@kerfjs/ui/sunken-panel';
|
|
7
|
+
import { ValuePreview } from '@kerfjs/ui/value-preview';
|
|
8
|
+
|
|
9
|
+
<SunkenPanel>
|
|
10
|
+
<ValuePreview label="Their Latest Version" value={remoteText} />
|
|
11
|
+
</SunkenPanel>;
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`label` gives the focusable output an accessible name. The string in `value` is rendered as text, not HTML; newlines remain visible and long tokens wrap instead of widening the pane. An empty string stays empty, so the application chooses any placeholder wording. `minHeight` and `maxHeight` take typed CSS lengths from `@kerfjs/ui/css-values` when a different scroll window is needed. The component itself scrolls long content; the containing `SunkenPanel` remains the sole owner of its surface.
|
|
15
|
+
|
|
16
|
+
Use `TextField multiline` when the person can edit the value. Use `ValueTable` for labelled short facts. `ValuePreview` is for one potentially long, read-only value.
|
package/llms.txt
CHANGED
|
@@ -717,6 +717,9 @@ headingLevel`, `SearchField clearIcon`, `ContentItem frame="framed"` for a
|
|
|
717
717
|
renders a native `aria-pressed` button whose pressed look draws on top of
|
|
718
718
|
its tone and emphasis; the app flips the state. Never wrap a
|
|
719
719
|
`ToolbarControlGroup` outside a toolbar or restyle a button to fake it.
|
|
720
|
+
- **Mark a current setup step with `Button.currentStep`.** It emits
|
|
721
|
+
`aria-current="step"` on a button or link, including a disabled current step.
|
|
722
|
+
The app owns the step label and which step is current. See `docs/button.md`.
|
|
720
723
|
- **Let an icon-state toggle skip selected chrome.** When a pressed toggle's
|
|
721
724
|
glyph already shows its state (an empty or filled star), set
|
|
722
725
|
`data-selected-chrome="none"` on that button, or `selectedChrome="none"` on
|
|
@@ -729,7 +732,10 @@ headingLevel`, `SearchField clearIcon`, `ContentItem frame="framed"` for a
|
|
|
729
732
|
per item as a list `row` or board `card`, with a state `rail`, a clamped
|
|
730
733
|
`title`, `trailingMeta`, a `metadata` line, `selected`, `dimmed`, and
|
|
731
734
|
`listEdge` rounding; the app owns the listbox and keyboard movement. Never
|
|
732
|
-
hand-roll ticket-row chrome.
|
|
735
|
+
hand-roll ticket-row chrome. For a non-option diagnostic with a nested
|
|
736
|
+
recovery button, set `semanticRole="group"` and `ariaLabel`; the root is not
|
|
737
|
+
a Tab stop and only the button activates. Set `draggable` on an option row or
|
|
738
|
+
card for a native drag source on that same selection root.
|
|
733
739
|
- **Group settings rows in `FramedList`.** For rows of arbitrary content in
|
|
734
740
|
one rounded frame with dividers between them (settings, account cards,
|
|
735
741
|
shortcut lists), compose `FramedListRow`s; `ValueTable` is the same frame for
|
|
@@ -916,6 +922,9 @@ created, input }`. Never use a hand-styled `<input list>` + `<datalist>`.
|
|
|
916
922
|
`data-kui-effects="static"`, or without scroll-driven animations, and ends on
|
|
917
923
|
a hard edge (overlay on a solid `fadeTo` band) under reduced transparency. Never hand-roll scroll listeners or
|
|
918
924
|
`background-attachment: fixed`.
|
|
925
|
+
In a dense image-led feed, opt into `ContentItem.media.deferOffscreen` (or
|
|
926
|
+
`BackdropImage.deferOffscreen` directly) to skip offscreen hero painting while
|
|
927
|
+
preserving card height and the shared scroll owner.
|
|
919
928
|
|
|
920
929
|
- **Use `MessageComposer` for a chat or prompt composer.** `@kerfjs/ui/message-composer`
|
|
921
930
|
renders a raised frame (standard border, large radius, `shadow-l`) whose
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kerfjs/ui",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.112",
|
|
4
4
|
"description": "Accessible, composable UI primitives for kerf applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -561,6 +561,16 @@
|
|
|
561
561
|
"browser": "./dist/browser/value-table.js",
|
|
562
562
|
"import": "./dist/value-table.js"
|
|
563
563
|
},
|
|
564
|
+
"./value-preview": {
|
|
565
|
+
"types": "./dist/value-preview.d.ts",
|
|
566
|
+
"browser": "./dist/browser/value-preview.js",
|
|
567
|
+
"import": "./dist/value-preview.js"
|
|
568
|
+
},
|
|
569
|
+
"./editor-frame": {
|
|
570
|
+
"types": "./dist/editor-frame.d.ts",
|
|
571
|
+
"browser": "./dist/browser/editor-frame.js",
|
|
572
|
+
"import": "./dist/editor-frame.js"
|
|
573
|
+
},
|
|
564
574
|
"./unstyled": {
|
|
565
575
|
"types": "./dist/index.d.ts",
|
|
566
576
|
"import": "./dist/index.js"
|
|
@@ -642,6 +652,8 @@
|
|
|
642
652
|
"./summary-row.css": "./dist/styles/summary-row.css",
|
|
643
653
|
"./empty-state.css": "./dist/styles/empty-state.css",
|
|
644
654
|
"./value-table.css": "./dist/styles/value-table.css",
|
|
655
|
+
"./value-preview.css": "./dist/styles/value-preview.css",
|
|
656
|
+
"./editor-frame.css": "./dist/styles/editor-frame.css",
|
|
645
657
|
"./ai/*": "./ai/*",
|
|
646
658
|
"./docs/*": "./docs/*"
|
|
647
659
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/collections/list-item/list-item.tsx"],"names":[],"mappings":";;;;;;;AAqBA,IAAM,8BAAA,uBAAqC,GAAA,CAAI;AAAA,EAC7C,gBAAA;AAAA,EACA,aAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,sBAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EACA,mBAAA;AAAA,EACA,iBAAA;AAAA,EACA,gBAAA;AAAA,EACA,qBAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAC,CAAA;AA4ED,SAAS,eAAA,CAAgB;AAAA,EACvB,KAAA;AAAA,EACA,WAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA,GAAO,KAAA;AAAA,EACP,SAAA,GAAY,KAAA;AAAA,EACZ,WAAA,GAAc;AAChB,CAAA,EAU+C;AAC7C,EAAA,MAAM,QAAA,GAAW,IAAA,EAAM,IAAA,GAAO,EAAA,GAAK,EAAA;AACnC,EAAA,uBACE,IAA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A,MACnC,WAAA,EAAW,WAAA,IAAe,IAAA,GAAO,MAAA,GAAS,MAAA;AAAA,MAC1C,IAAA;AAAA,MAEC,QAAA,EAAA,eAAA,CAAgB;AAAA,QACf,KAAA;AAAA,QACA,WAAA;AAAA,QACA,IAAA;AAAA,QACA,IAAA;AAAA,QACA,QAAA;AAAA,QACA,MAAA;AAAA,QACA,IAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA,OACD;AAAA;AAAA,GACH;AAEJ","file":"chunk-3GLYIIFR.js","sourcesContent":["import type { SafeHtml } from 'kerfjs';\n\nimport {\n type ListIconTile,\n type ListIconTilePresentation,\n listIconTilePresentation,\n} from '../../../shared/content/list-icon-tile.js';\nimport type { KerfUiContent } from '../../../shared/content/semantic-content.js';\nimport { nativeDraggable } from '../../../shared/dom/draggable.js';\nimport { filterDataAttributes } from '../../../shared/dom/extension-attributes.js';\nimport { em, remify } from '../../../shared/styles/css-values.js';\nimport { withWordBreaks } from '../../../shared/text/word-breaks.js';\nimport { LoadingSpinner } from '../../feedback/loading-spinner/loading-spinner.js';\nimport { Skeleton } from '../../feedback/skeleton/skeleton.js';\n\nexport type {\n ListIconTile,\n ListIconTileColor,\n ListIconTileTone,\n} from '../../../shared/content/list-icon-tile.js';\n\nconst PROTECTED_ROOT_DATA_ATTRIBUTES = new Set([\n 'data-component',\n 'data-action',\n 'data-item-id',\n 'data-has-icon',\n 'data-has-description',\n 'data-multiline',\n 'data-density',\n 'data-divider',\n 'data-busy',\n 'data-state',\n 'data-kui-disabled',\n 'data-icon-align',\n 'data-icon-tile',\n 'data-icon-tile-tone',\n 'data-dragging',\n 'data-drop-position',\n]);\n\ntype ListItemRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined> & {\n 'data-component'?: never;\n 'data-action'?: never;\n 'data-item-id'?: never;\n 'data-has-icon'?: never;\n 'data-has-description'?: never;\n 'data-multiline'?: never;\n 'data-density'?: never;\n 'data-divider'?: never;\n 'data-busy'?: never;\n 'data-state'?: never;\n 'data-kui-disabled'?: never;\n 'data-icon-align'?: never;\n 'data-icon-tile'?: never;\n 'data-icon-tile-tone'?: never;\n 'data-dragging'?: never;\n 'data-drop-position'?: never;\n }\n>;\n\nexport interface ListItemProps {\n label: string | SafeHtml;\n /** App-owned supporting text rendered in the component's stable label stack. */\n description?: string | SafeHtml;\n icon?: SafeHtml;\n /** Present `icon` in a filled 32px rounded tile with an 18px glyph: a quiet tone preset, or `{ color, foreground? }` for an application color. */\n iconTile?: ListIconTile;\n /** Dormant author content at the row's end; a placeholder renders it as a skeleton. */\n trailing?: KerfUiContent;\n /** Dormant status metadata rendered before trailing content; a placeholder renders it as a skeleton. */\n status?: string | SafeHtml;\n /** Show a progress indicator and expose the row as busy without replacing its content; a placeholder keeps the indicator. */\n busy?: boolean;\n density?: 'standard' | 'compact' | 'spacious';\n divider?: 'none' | 'before' | 'after' | 'both';\n selected?: boolean;\n action: string;\n itemId?: string;\n className?: string;\n pressed?: boolean;\n accessibleLabel?: string;\n title?: string;\n multiline?: boolean;\n /** Alignment of an icon beside a wrapped label. Defaults to its first line. */\n multilineIconAlign?: 'first-line' | 'center';\n state?: string;\n disabled?: boolean;\n tabIndex?: number;\n /** Render the row as an unanimated loading skeleton, disabling its action: label, description, icon, status, and trailing content become skeletons; the `busy` indicator stays live. */\n placeholder?: boolean;\n /** Native HTML drag source (`draggable=\"true\"`); a placeholder is never draggable. Pair with `wireListReorder` for pointer and keyboard reordering. */\n draggable?: boolean;\n /** Dim this row as one of the rows being dragged. */\n dragging?: boolean;\n /** Draw the insertion line at this row's leading (`before`) or trailing (`after`) block edge. */\n dropPosition?: 'before' | 'after';\n rootAttributes?: ListItemRootAttributes;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\nexport interface ListItemLinkProps extends Omit<\n ListItemProps,\n 'action' | 'pressed'\n> {\n /** Native destination for this navigation row. */\n href: string;\n /** Open in a new tab with a safe rel and announce that behavior. */\n external?: boolean;\n action?: never;\n pressed?: never;\n}\n\nfunction listItemContent({\n label,\n description,\n icon,\n tile,\n trailing,\n status,\n busy = false,\n multiline = false,\n placeholder = false,\n}: Pick<\n ListItemProps,\n | 'label'\n | 'description'\n | 'icon'\n | 'trailing'\n | 'status'\n | 'busy'\n | 'multiline'\n | 'placeholder'\n> & { tile: ListIconTilePresentation | null }) {\n const tileSize = tile?.tile ? 32 : 18;\n return (\n <>\n {icon && (\n <span\n class=\"kui-list-item__icon\"\n style={placeholder ? undefined : tile?.style}\n >\n {placeholder ? (\n <Skeleton\n block\n width={remify(tileSize)}\n height={remify(tileSize)}\n />\n ) : (\n icon\n )}\n </span>\n )}\n <span class=\"kui-list-item__label\">\n <span class=\"kui-list-item__primary-label\">\n {placeholder ? (\n <Skeleton width={em(9)} />\n ) : multiline ? (\n withWordBreaks(label)\n ) : (\n label\n )}\n </span>\n {description && (\n <span class=\"kui-list-item__description\">\n {placeholder ? <Skeleton width={em(11)} /> : description}\n </span>\n )}\n </span>\n {(busy || status || trailing) && (\n <span class=\"kui-list-item__trailing\">\n {/* The busy spinner is component-owned chrome drawn from a known\n prop, so a placeholder keeps it live. Status text and\n author-supplied trailing content are values: skeletons. */}\n {busy && <LoadingSpinner />}\n {status && (\n <span class=\"kui-list-item__status\">\n {placeholder ? <Skeleton width={em(3.5)} /> : status}\n </span>\n )}\n {trailing && (placeholder ? <Skeleton width={em(1.5)} /> : trailing)}\n </span>\n )}\n </>\n );\n}\n\nexport function ListItem({\n label,\n description,\n icon,\n iconTile,\n trailing,\n status,\n busy = false,\n density = 'standard',\n divider = 'none',\n selected = false,\n action,\n itemId,\n className = '',\n pressed,\n accessibleLabel,\n title,\n multiline = false,\n multilineIconAlign = 'first-line',\n state,\n disabled = false,\n tabIndex,\n placeholder = false,\n draggable,\n dragging = false,\n dropPosition,\n rootAttributes = {},\n slot,\n}: ListItemProps) {\n const extensionAttributes = filterDataAttributes(\n rootAttributes,\n PROTECTED_ROOT_DATA_ATTRIBUTES,\n );\n const tile = icon ? listIconTilePresentation(iconTile, 'list-item') : null;\n return (\n <button\n {...extensionAttributes}\n type=\"button\"\n class={`kui-list-item ${className}`.trim()}\n title={placeholder ? undefined : title}\n disabled={disabled || placeholder}\n tabindex={placeholder ? -1 : tabIndex}\n data-component=\"list-item\"\n data-action={placeholder ? undefined : action}\n data-item-id={itemId}\n data-has-icon={String(Boolean(icon))}\n data-has-description={String(Boolean(description))}\n data-multiline={multiline ? 'true' : undefined}\n data-icon-align={multiline ? multilineIconAlign : undefined}\n data-icon-tile={tile?.tile}\n data-icon-tile-tone={tile?.tone}\n data-density={density}\n data-divider={divider}\n data-busy={busy ? 'true' : undefined}\n data-state={state}\n data-kui-disabled={disabled ? 'true' : undefined}\n data-placeholder={placeholder ? 'true' : undefined}\n draggable={nativeDraggable(draggable, placeholder)}\n data-dragging={dragging ? 'true' : undefined}\n data-drop-position={dropPosition}\n aria-label={accessibleLabel}\n aria-current={selected ? 'page' : undefined}\n aria-pressed={pressed === undefined ? undefined : String(pressed)}\n aria-busy={placeholder || busy ? 'true' : undefined}\n slot={slot}\n >\n {listItemContent({\n label,\n description,\n icon,\n tile,\n trailing,\n status,\n busy,\n multiline,\n placeholder,\n })}\n </button>\n );\n}\n\n/** A navigation row with native link activation and ListItem geometry. */\nexport function ListItemLink({\n href,\n external = false,\n label,\n description,\n icon,\n iconTile,\n trailing,\n status,\n busy = false,\n density = 'standard',\n divider = 'none',\n selected = false,\n itemId,\n className = '',\n accessibleLabel,\n title,\n multiline = false,\n multilineIconAlign = 'first-line',\n state,\n disabled = false,\n tabIndex,\n placeholder = false,\n draggable,\n dragging = false,\n dropPosition,\n rootAttributes = {},\n slot,\n}: ListItemLinkProps) {\n const extensionAttributes = filterDataAttributes(\n rootAttributes,\n PROTECTED_ROOT_DATA_ATTRIBUTES,\n );\n const tile = icon ? listIconTilePresentation(iconTile, 'list-item') : null;\n const inactive = disabled || placeholder;\n const linkLabel =\n accessibleLabel ??\n (external && typeof label === 'string'\n ? `${label} (opens in new tab)`\n : undefined);\n return (\n <a\n {...extensionAttributes}\n class={`kui-list-item ${className}`.trim()}\n href={inactive ? undefined : href}\n target={inactive || !external ? undefined : '_blank'}\n rel={inactive || !external ? undefined : 'noopener noreferrer'}\n title={placeholder ? undefined : title}\n tabindex={inactive ? -1 : tabIndex}\n data-component=\"list-item-link\"\n data-item-id={itemId}\n data-has-icon={String(Boolean(icon))}\n data-has-description={String(Boolean(description))}\n data-multiline={multiline ? 'true' : undefined}\n data-icon-align={multiline ? multilineIconAlign : undefined}\n data-icon-tile={tile?.tile}\n data-icon-tile-tone={tile?.tone}\n data-density={density}\n data-divider={divider}\n data-busy={busy ? 'true' : undefined}\n data-state={state}\n data-kui-disabled={disabled ? 'true' : undefined}\n data-placeholder={placeholder ? 'true' : undefined}\n draggable={nativeDraggable(draggable, placeholder)}\n data-dragging={dragging ? 'true' : undefined}\n data-drop-position={dropPosition}\n aria-label={linkLabel}\n aria-current={selected ? 'page' : undefined}\n aria-disabled={inactive ? 'true' : undefined}\n aria-busy={placeholder || busy ? 'true' : undefined}\n slot={slot}\n >\n {listItemContent({\n label,\n description,\n icon,\n tile,\n trailing,\n status,\n busy,\n multiline,\n placeholder,\n })}\n </a>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/collections/summary-row/summary-row.tsx"],"names":[],"mappings":";;;AAWA,IAAM,mBAAA,uBAA0B,GAAA,CAAI;AAAA,EAClC,gBAAA;AAAA,EACA,mBAAA;AAAA,EACA,gBAAA;AAAA,EACA,WAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAC,CAAA;AAmDM,SAAS,UAAA,CAAW;AAAA,EACzB,KAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA,GAAe,KAAA;AAAA,EACf,UAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA,GAAW,KAAA;AAAA,EACX,MAAA,GAAS,KAAA;AAAA,EACT,QAAA;AAAA,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EAAK,KAAA,EAAM,0BAAA,EAA4B,QAAA,EAAA,OAAA,EAAQ,CAAA;AAAA,0BAC5D,IAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAM,0BAAA,EACT,QAAA,EAAA;AAAA,4BAAA,IAAA,CAAC,KAAA,EAAA,EAAI,OAAM,wBAAA,EACR,QAAA,EAAA;AAAA,cAAA,YAAA,KAAiB,MAAA,oBAChB,GAAA,CAAC,MAAA,EAAA,EAAK,KAAA,EAAM,6BAA6B,QAAA,EAAA,YAAA,EAAa,CAAA;AAAA,cAEvD;AAAA,aAAA,EACH,CAAA;AAAA,YACC,QAAA,oBAAY,GAAA,CAAC,KAAA,EAAA,EAAI,KAAA,EAAM,6BAA6B,QAAA,EAAA,QAAA,EAAS;AAAA,WAAA,EAChE;AAAA,SAAA,EACF;AAAA;AAAA;AAAA,GACF;AAEJ","file":"chunk-4UB5Z3ZZ.js","sourcesContent":["import type { SafeHtml } from 'kerfjs';\n\nimport type { KerfUiContent } from '../../../shared/content/semantic-content.js';\nimport { filterDataAttributes } from '../../../shared/dom/extension-attributes.js';\nimport type { SemanticTone } from '../../../shared/styles/semantic-tone.js';\n\n/** `row` for a list section; `card` for a board column. */\nexport type SummaryRowPresentation = 'row' | 'card';\n/** A row's place in a rounded list section, so its corners match. */\nexport type SummaryRowListEdge = 'start' | 'end' | 'only';\n\nconst summaryRowProtected = new Set([\n 'data-component',\n 'data-presentation',\n 'data-list-edge',\n 'data-rail',\n 'data-selected',\n 'data-dimmed',\n]);\n\ntype SummaryRowRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined> & {\n 'data-component'?: never;\n 'data-presentation'?: never;\n 'data-list-edge'?: never;\n 'data-rail'?: never;\n 'data-selected'?: never;\n 'data-dimmed'?: never;\n }\n>;\n\nexport interface SummaryRowProps {\n /** The identity line: an identifier, inline status glyphs, and the title. */\n title: KerfUiContent;\n /** Optional leading glyph, such as a category icon. */\n leading?: SafeHtml;\n /** Quiet text at the end of the title line, such as a relative time. */\n trailingMeta?: string | SafeHtml;\n /** A wrapping line of badges, chips, and quiet text below the title. */\n metadata?: KerfUiContent;\n /** `row` (default) or `card`. */\n presentation?: SummaryRowPresentation;\n /** Title lines before clipping; default 2 for a row and 4 for a card. */\n titleLines?: number;\n /** A leading state rail in a semantic tone (Up Next, blocked, …). */\n rail?: SemanticTone;\n /** Selected state, exposed as `aria-selected`. */\n selected?: boolean;\n /** Dim a finished or cut item; hover and selection restore it. */\n dimmed?: boolean;\n /** Round the corners that meet a rounded list section's edge. */\n listEdge?: SummaryRowListEdge;\n /** Skip rendering while off screen in long lists (`content-visibility`). */\n deferRendering?: boolean;\n /** Accessible name when the visible content is not a good one. */\n ariaLabel?: string;\n id?: string;\n className?: string;\n /** Safe `data-*` identity (an item id or delegated action) on the option. */\n rootAttributes?: SummaryRowRootAttributes;\n}\n\n/**\n * A selectable, keyboard-focusable summary of one item, as a list row or a\n * board card: an optional leading glyph and state rail, a clamped identity line\n * with trailing quiet metadata, and a wrapping metadata line. It is a\n * `role=\"option\"`; place rows in a labeled `role=\"listbox\"` and own selection\n * and keyboard movement in the application.\n */\nexport function SummaryRow({\n title,\n leading,\n trailingMeta,\n metadata,\n presentation = 'row',\n titleLines,\n rail,\n selected = false,\n dimmed = false,\n listEdge,\n deferRendering = false,\n ariaLabel,\n id,\n className = '',\n rootAttributes = {},\n}: SummaryRowProps) {\n if (\n titleLines !== undefined &&\n (!Number.isInteger(titleLines) || titleLines < 1)\n )\n throw new RangeError('SummaryRow titleLines must be a positive integer');\n return (\n <div\n {...filterDataAttributes(rootAttributes, summaryRowProtected)}\n id={id}\n class={`kui-summary-row ${className}`.trim()}\n data-component=\"summary-row\"\n data-presentation={presentation}\n data-list-edge={listEdge}\n data-rail={rail}\n data-selected={selected ? 'true' : undefined}\n data-dimmed={dimmed ? 'true' : undefined}\n data-defer={deferRendering ? 'true' : undefined}\n role=\"option\"\n tabindex=\"0\"\n aria-selected={selected ? 'true' : 'false'}\n aria-label={ariaLabel}\n style={\n titleLines === undefined\n ? undefined\n : `--_kui-summary-row-title-lines:${titleLines}`\n }\n >\n {rail && <span class=\"kui-summary-row__rail\" aria-hidden=\"true\" />}\n <div class=\"kui-summary-row__body\">\n {leading && <span class=\"kui-summary-row__leading\">{leading}</span>}\n <div class=\"kui-summary-row__content\">\n <div class=\"kui-summary-row__title\">\n {trailingMeta !== undefined && (\n <span class=\"kui-summary-row__trailing\">{trailingMeta}</span>\n )}\n {title}\n </div>\n {metadata && <div class=\"kui-summary-row__metadata\">{metadata}</div>}\n </div>\n </div>\n </div>\n );\n}\n"]}
|
package/dist/chunk-5USKCWGL.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { filterDataAttributes } from './chunk-KH4KEMSP.js';
|
|
2
|
-
import { jsx } from 'kerfjs/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
function roleForSelectionMode(mode) {
|
|
5
|
-
switch (mode) {
|
|
6
|
-
case "single":
|
|
7
|
-
return "option";
|
|
8
|
-
case "multiple":
|
|
9
|
-
return "row";
|
|
10
|
-
case "none":
|
|
11
|
-
case "toggle":
|
|
12
|
-
return "button";
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
var contentItemProtectedAttributes = /* @__PURE__ */ new Set([
|
|
16
|
-
"data-component",
|
|
17
|
-
"data-appearance",
|
|
18
|
-
"data-outlined",
|
|
19
|
-
"data-bubble",
|
|
20
|
-
"data-grid-row"
|
|
21
|
-
]);
|
|
22
|
-
var interactiveProtectedAttributes = /* @__PURE__ */ new Set([
|
|
23
|
-
"data-component",
|
|
24
|
-
"data-appearance",
|
|
25
|
-
"data-outlined",
|
|
26
|
-
"data-bubble",
|
|
27
|
-
"data-grid-row",
|
|
28
|
-
"data-action",
|
|
29
|
-
"data-item-id",
|
|
30
|
-
"data-interactive",
|
|
31
|
-
"data-selected",
|
|
32
|
-
"data-disabled",
|
|
33
|
-
"data-selection-mode",
|
|
34
|
-
"data-kui-pressed"
|
|
35
|
-
]);
|
|
36
|
-
function ContentItem({
|
|
37
|
-
appearance = "transparent",
|
|
38
|
-
children,
|
|
39
|
-
frame = "none",
|
|
40
|
-
flush = false,
|
|
41
|
-
shape = "rounded",
|
|
42
|
-
bubble,
|
|
43
|
-
title,
|
|
44
|
-
ariaLabel,
|
|
45
|
-
focusTarget = false,
|
|
46
|
-
outlined = false,
|
|
47
|
-
tabIndex,
|
|
48
|
-
gridRow = false,
|
|
49
|
-
interactive = false,
|
|
50
|
-
action,
|
|
51
|
-
itemId,
|
|
52
|
-
selectionMode = "none",
|
|
53
|
-
selected = false,
|
|
54
|
-
disabled = false,
|
|
55
|
-
className = "",
|
|
56
|
-
rootAttributes = {},
|
|
57
|
-
slot
|
|
58
|
-
}) {
|
|
59
|
-
const safeRootAttributes = filterDataAttributes(
|
|
60
|
-
rootAttributes,
|
|
61
|
-
interactive ? interactiveProtectedAttributes : contentItemProtectedAttributes
|
|
62
|
-
);
|
|
63
|
-
if (interactive && !action) {
|
|
64
|
-
throw new Error("Interactive ContentItem requires an action");
|
|
65
|
-
}
|
|
66
|
-
if (interactive && selected && selectionMode === "none") {
|
|
67
|
-
throw new Error("Selected ContentItem requires a selectionMode");
|
|
68
|
-
}
|
|
69
|
-
const cls = [
|
|
70
|
-
"kui-content-item",
|
|
71
|
-
shape === "pill" ? "kui-content-item--pill" : "",
|
|
72
|
-
frame === "framed" ? "kui-content-item--framed" : "",
|
|
73
|
-
flush ? "kui-content-item--flush" : "",
|
|
74
|
-
className
|
|
75
|
-
].filter(Boolean).join(" ");
|
|
76
|
-
const interactiveAttributes = interactive ? {
|
|
77
|
-
"data-interactive": "true",
|
|
78
|
-
"data-action": disabled ? void 0 : action,
|
|
79
|
-
"data-item-id": itemId,
|
|
80
|
-
"data-selection-mode": selectionMode,
|
|
81
|
-
"data-selected": selectionMode === "none" ? void 0 : String(selected),
|
|
82
|
-
"data-disabled": disabled ? "true" : void 0
|
|
83
|
-
} : {};
|
|
84
|
-
let role = ariaLabel ? "region" : void 0;
|
|
85
|
-
if (interactive) role = roleForSelectionMode(selectionMode);
|
|
86
|
-
else if (gridRow) role = "row";
|
|
87
|
-
return /* @__PURE__ */ jsx(
|
|
88
|
-
"div",
|
|
89
|
-
{
|
|
90
|
-
...safeRootAttributes,
|
|
91
|
-
...interactiveAttributes,
|
|
92
|
-
class: cls,
|
|
93
|
-
title,
|
|
94
|
-
"data-component": "content-item",
|
|
95
|
-
"data-appearance": appearance,
|
|
96
|
-
"data-outlined": outlined ? "true" : void 0,
|
|
97
|
-
"data-bubble": bubble,
|
|
98
|
-
"data-grid-row": !interactive && gridRow ? "true" : void 0,
|
|
99
|
-
role,
|
|
100
|
-
"aria-label": ariaLabel,
|
|
101
|
-
"aria-selected": interactive && (selectionMode === "single" || selectionMode === "multiple") ? String(selected) : void 0,
|
|
102
|
-
"aria-pressed": interactive && selectionMode === "toggle" ? String(selected) : void 0,
|
|
103
|
-
"aria-disabled": interactive && disabled ? "true" : void 0,
|
|
104
|
-
tabindex: interactive ? disabled ? "-1" : "0" : tabIndex ?? (focusTarget ? "-1" : void 0),
|
|
105
|
-
slot,
|
|
106
|
-
children: interactive && selectionMode === "multiple" || !interactive && gridRow ? /* @__PURE__ */ jsx("div", { role: "gridcell", children }) : children
|
|
107
|
-
}
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export { ContentItem };
|
|
112
|
-
|
|
113
|
-
//# sourceMappingURL=chunk-5USKCWGL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/surfaces/content-item/content-item.tsx"],"names":[],"mappings":";;;AA6BA,SAAS,qBACP,IAAA,EAC6B;AAC7B,EAAA,QAAQ,IAAA;AAAM,IACZ,KAAK,QAAA;AACH,MAAA,OAAO,QAAA;AAAA,IACT,KAAK,UAAA;AACH,MAAA,OAAO,KAAA;AAAA,IACT,KAAK,MAAA;AAAA,IACL,KAAK,QAAA;AACH,MAAA,OAAO,QAAA;AAAA;AAEb;AAEA,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A,KAAkB,QAAA,IAAY,kBAAkB,UAAA,CAAA,GAC7C,MAAA,CAAO,QAAQ,CAAA,GACf,MAAA;AAAA,MAEN,gBACE,WAAA,IAAe,aAAA,KAAkB,QAAA,GAAW,MAAA,CAAO,QAAQ,CAAA,GAAI,MAAA;AAAA,MAEjE,eAAA,EAAe,WAAA,IAAe,QAAA,GAAW,MAAA,GAAS,MAAA;AAAA,MAClD,UACE,WAAA,GACI,QAAA,GACE,OACA,GAAA,GACD,QAAA,KAAa,cAAc,IAAA,GAAO,MAAA,CAAA;AAAA,MAEzC,IAAA;AAAA,MAEE,QAAA,EAAA,WAAA,IAAe,aAAA,KAAkB,UAAA,IAClC,CAAC,WAAA,IAAe,OAAA,mBACf,GAAA,CAAC,KAAA,EAAA,EAAI,IAAA,EAAK,UAAA,EAAY,QAAA,EAAS,CAAA,GAE/B;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-5USKCWGL.js","sourcesContent":["import type { KerfUiContent } from '../../../shared/content/semantic-content.js';\nimport { filterDataAttributes } from '../../../shared/dom/extension-attributes.js';\nimport type { SemanticTone } from '../../../shared/styles/semantic-tone.js';\n\nexport type { SemanticTone } from '../../../shared/styles/semantic-tone.js';\n\n/**\n * Base surface treatment, semantic status colors, or `brand-loud`: the solid\n * brand fill with its on-loud foreground (a transcript's own messages).\n */\nexport type ContentItemAppearance =\n 'transparent' | 'surface' | 'brand-loud' | SemanticTone;\n\n/**\n * A chat-bubble layout for transcripts: the item fits its content up to 80%\n * of the row and sits at the `start` (other participants) or `end` (the\n * person's own messages) of the line.\n */\nexport type ContentItemBubble = 'start' | 'end';\n\n/** Whether the item's always-reserved 1px border is transparent or visible. */\nexport type ContentItemFrame = 'none' | 'framed';\n\n/** Corner shape: the 12px rounded rectangle or the 22px pill. */\nexport type ContentItemShape = 'rounded' | 'pill';\n/** `single` uses an option; `multiple` uses a grid row; `toggle` uses a pressed button. */\nexport type ContentItemSelectionMode =\n 'none' | 'single' | 'multiple' | 'toggle';\n\nfunction roleForSelectionMode(\n mode: ContentItemSelectionMode,\n): 'option' | 'row' | 'button' {\n switch (mode) {\n case 'single':\n return 'option';\n case 'multiple':\n return 'row';\n case 'none':\n case 'toggle':\n return 'button';\n }\n}\n\nconst contentItemProtectedAttributes = new Set([\n 'data-component',\n 'data-appearance',\n 'data-outlined',\n 'data-bubble',\n 'data-grid-row',\n]);\nconst interactiveProtectedAttributes = new Set([\n 'data-component',\n 'data-appearance',\n 'data-outlined',\n 'data-bubble',\n 'data-grid-row',\n 'data-action',\n 'data-item-id',\n 'data-interactive',\n 'data-selected',\n 'data-disabled',\n 'data-selection-mode',\n 'data-kui-pressed',\n]);\n\ntype ContentItemRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined> & {\n 'data-component'?: never;\n 'data-appearance'?: never;\n 'data-outlined'?: never;\n 'data-bubble'?: never;\n 'data-grid-row'?: never;\n }\n>;\n\ntype ContentItemInteractiveRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined> & {\n 'data-component'?: never;\n 'data-appearance'?: never;\n 'data-outlined'?: never;\n 'data-bubble'?: never;\n 'data-grid-row'?: never;\n 'data-action'?: never;\n 'data-item-id'?: never;\n 'data-interactive'?: never;\n 'data-selected'?: never;\n 'data-disabled'?: never;\n 'data-selection-mode'?: never;\n 'data-kui-pressed'?: never;\n }\n>;\n\ninterface ContentItemBaseProps {\n /**\n * Coordinated background, border, and foreground colors. `transparent`\n * preserves the surrounding surface; `surface` paints the base surface;\n * semantic values match StateBanner. Defaults to `transparent`.\n */\n appearance?: ContentItemAppearance;\n /** Item content; a plain string is allowed for bare copy. */\n children?: KerfUiContent | string;\n /**\n * `framed` paints the standard neutral border in the 1px the item always\n * reserves, so framing never changes geometry. Frame only an item that\n * marks a real distinction. Defaults to `none` (transparent border).\n */\n frame?: ContentItemFrame;\n /** Remove block padding and block borders while retaining inline geometry. */\n flush?: boolean;\n /** Corner shape. Defaults to `rounded`. */\n shape?: ContentItemShape;\n /**\n * Lay the item out as a chat bubble: content width up to 80% of the row,\n * at the `start` or `end` of the line. Pair `end` with `brand-loud` for the\n * person's own messages. Omit for an ordinary full-width item.\n */\n bubble?: ContentItemBubble;\n /** Native hover tooltip. */\n title?: string;\n /**\n * Names the item as a distinct region (`role=\"region\"`). Omit it for an\n * ordinary item, which stays a non-landmark grouping.\n */\n ariaLabel?: string;\n /**\n * Makes the item a programmatic focus target (`tabindex=\"-1\"`, never a tab\n * stop), for example the preferred initial focus of a NavStack view when\n * combined with `data-nav-focus` in `rootAttributes`.\n */\n focusTarget?: boolean;\n /** Keep the standard focus outline visible, such as for a drop target. */\n outlined?: boolean;\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\nexport type ContentItemProps = ContentItemBaseProps &\n (\n | {\n interactive?: false;\n action?: never;\n itemId?: never;\n selectionMode?: never;\n selected?: never;\n disabled?: never;\n /** Opt into keyboard (`0`) or programmatic (`-1`) focus. */\n tabIndex?: 0 | -1;\n /**\n * A non-selectable row of a multi-select `List` or `Grid`: renders\n * `role=\"row\"` around a `gridcell`, with no `aria-selected` and no\n * Tab stop of its own, for content between selectable rows (an\n * activity group, a \"messages skipped\" divider). Its controls stay\n * reachable by Tab; arrow keys skip it.\n */\n gridRow?: boolean;\n /** Existing static `data-*` metadata remains available. */\n rootAttributes?: ContentItemRootAttributes;\n }\n | {\n /** Enable a keyboard reachable card; wire `wireContentItems` once on its containing root. */\n interactive: true;\n /** Delegated action dispatched by pointer, Enter, or Space. */\n action: string;\n itemId?: string;\n selectionMode?: ContentItemSelectionMode;\n selected?: boolean;\n disabled?: boolean;\n tabIndex?: never;\n /** An interactive item is already a row in a multi-select grid. */\n gridRow?: never;\n /** Safe app metadata; interaction attributes are component-owned. */\n rootAttributes?: ContentItemInteractiveRootAttributes;\n }\n );\n\n/**\n * One self-contained `.kui-content` child: an 8px inline margin, a real 1px\n * border (transparent unless `framed`), 8px padding, and a rounded or pill\n * radius. It owns that whole geometry, so wrappers must not add more.\n */\nexport function ContentItem({\n appearance = 'transparent',\n children,\n frame = 'none',\n flush = false,\n shape = 'rounded',\n bubble,\n title,\n ariaLabel,\n focusTarget = false,\n outlined = false,\n tabIndex,\n gridRow = false,\n interactive = false,\n action,\n itemId,\n selectionMode = 'none',\n selected = false,\n disabled = false,\n className = '',\n rootAttributes = {},\n slot,\n}: ContentItemProps) {\n const safeRootAttributes = filterDataAttributes(\n rootAttributes,\n interactive\n ? interactiveProtectedAttributes\n : contentItemProtectedAttributes,\n );\n if (interactive && !action) {\n throw new Error('Interactive ContentItem requires an action');\n }\n if (interactive && selected && selectionMode === 'none') {\n throw new Error('Selected ContentItem requires a selectionMode');\n }\n const cls = [\n 'kui-content-item',\n shape === 'pill' ? 'kui-content-item--pill' : '',\n frame === 'framed' ? 'kui-content-item--framed' : '',\n flush ? 'kui-content-item--flush' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n const interactiveAttributes = interactive\n ? {\n 'data-interactive': 'true',\n 'data-action': disabled ? undefined : action,\n 'data-item-id': itemId,\n 'data-selection-mode': selectionMode,\n 'data-selected':\n selectionMode === 'none' ? undefined : String(selected),\n 'data-disabled': disabled ? 'true' : undefined,\n }\n : {};\n let role: 'option' | 'row' | 'button' | 'region' | undefined = ariaLabel\n ? 'region'\n : undefined;\n if (interactive) role = roleForSelectionMode(selectionMode);\n else if (gridRow) role = 'row';\n return (\n <div\n {...safeRootAttributes}\n {...interactiveAttributes}\n class={cls}\n title={title}\n data-component=\"content-item\"\n data-appearance={appearance}\n data-outlined={outlined ? 'true' : undefined}\n data-bubble={bubble}\n data-grid-row={!interactive && gridRow ? 'true' : undefined}\n role={role}\n aria-label={ariaLabel}\n aria-selected={\n interactive &&\n (selectionMode === 'single' || selectionMode === 'multiple')\n ? String(selected)\n : undefined\n }\n aria-pressed={\n interactive && selectionMode === 'toggle' ? String(selected) : undefined\n }\n aria-disabled={interactive && disabled ? 'true' : undefined}\n tabindex={\n interactive\n ? disabled\n ? '-1'\n : '0'\n : (tabIndex ?? (focusTarget ? '-1' : undefined))\n }\n slot={slot}\n >\n {(interactive && selectionMode === 'multiple') ||\n (!interactive && gridRow) ? (\n <div role=\"gridcell\">{children}</div>\n ) : (\n children\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/surfaces/surface-scaffold/surface-scaffold.tsx"],"names":[],"mappings":";;;;;AA+DA,IAAM,wBAAA,uBAA+B,GAAA,CAAI;AAAA,EACvC,gBAAA;AAAA,EACA,WAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA,iBAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA,iBAAA;AAAA,EACA,aAAA;AAAA,EACA,kBAAA;AAAA,EACA,0BAAA;AAAA,EACA,0BAAA;AAAA,EACA,iBAAA;AAAA,EACA,gBAAA;AAAA,EACA,mBAAA;AAAA,EACA,kBAAA;AAAA,EACA;AACF,CAAC,CAAA;AA+IM,SAAS,aAAA,CAAc;AAAA,EAC5B,EAAA;AAAA,EACA,KAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA,GAAQ,KAAA;AAAA,EACR,OAAA;AAAA,EACA,aAAA;AAAA,EACA,MAAA;AAAA,EACA,aAAA,GAAgB,KAAA;AAAA,EAChB,YAAA,GAAe,KAAA;AAAA,EACf,UAAA,GAAa,OAAA;AAAA,EACb,QAAA;AAAA,EACA,IAAA,GAAO,QAAA;AAAA,EACP,YAAA,GAAe,OAAA;AAAA,EACf,cAAA;AAAA,EACA,SAAA,GAAY,SAAA;AAAA,EACZ,WAAA,GAAc,aAAA;AAAA,EACd,cAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA,GAAY,KAAA;AAAA,EACZ,WAAA,GAAc,OAAA;AAAA,EACd,UAAA,GAAa,OAAA;AAAA,EACb,UAAA,GAAa,MAAA;AAAA,EACb,kBAAA,GAAqB,QAA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AA,GAAS,MAAA,GAAY,UAAA;AAAA,MACtD,OAAA,EAAS,YAAA,KAAiB,SAAA,GAAY,MAAA,GAAS,MAAA;AAAA,MAC/C,IAAA,EAAK,QAAA;AAAA,MACL,YAAA,EAAY,KAAA;AAAA,MACZ,iBAAA,EAAiB,UAAA;AAAA,MACjB,kBAAA,EAAkB,WAAA;AAAA,MAClB,OAAO,KAAA,IAAS,MAAA;AAAA,MAChB,IAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ;AAaO,SAAS,YAAA,CAAa;AAAA,EAC3B,QAAA;AAAA,EACA,KAAA,GAAQ,UAAA;AAAA,EACR,SAAA,GAAY,EAAA;AAAA,EACZ;AACF,CAAA,EAAsB;AACpB,EAAA,uBACE,GAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,CAAA,kBAAA,EAAqB,SAAS,CAAA,CAAA,CAAG,IAAA,EAAK;AAAA,MAC7C,gBAAA,EAAe,eAAA;AAAA,MACf,YAAA,EAAY,KAAA;AAAA,MACZ,IAAA;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ","file":"chunk-6CDILXF4.js","sourcesContent":["import { X } from 'lucide';\n\nimport type { KerfUiContent } from '../../../shared/content/semantic-content.js';\nimport { filterDataAttributes } from '../../../shared/dom/extension-attributes.js';\nimport type { CssLength } from '../../../shared/styles/css-values.js';\nimport { LucideIcon } from '../../media/lucide-icon/lucide-icon.js';\n\nexport {\n closeDialog,\n type DialogCloseSource,\n type DialogRequestCloseDetail,\n openDialog,\n} from './internal/dialog-surface-controller.js';\n\nexport type DialogSurfaceSize = 'small' | 'medium' | 'large';\n/**\n * How the dialog is presented: `modal` (default) centered on the screen,\n * `side-sheet` against the inline end, `fullscreen`, or `bottom-sheet`\n * attached to the bottom edge (square bottom corners, safe-area and\n * virtual-keyboard clearance, optionally user-resizable).\n */\nexport type DialogSurfacePresentation =\n 'modal' | 'side-sheet' | 'fullscreen' | 'bottom-sheet';\n/**\n * How a bottom sheet appears or leaves: `slide` (default) moves the panel in\n * from, or out to, the bottom edge; `standard` keeps the dialog's\n * scale-and-fade. Both honor `prefers-reduced-motion`.\n */\nexport type DialogSurfaceSheetMotion = 'slide' | 'standard';\nexport type SurfaceInset = 'none' | 'compact' | 'comfortable';\nexport type DialogSurfaceMaxHeight = CssLength | 'viewport';\n/** A definite modal height: a length or the full viewport, minus both gutters. */\nexport type DialogSurfaceHeight = CssLength | 'viewport';\n/**\n * How the dialog body lays out its children: `flow` (default) scrolls ordinary\n * content in the body; `fill` gives one child the body's whole height and\n * lets it own scrolling (a SplitView, a Pane, an editor); `fill-last` stacks\n * the leading children at their natural height and gives the last child the\n * remaining height to own its scrolling (a heading and notices above a\n * scrolling transcript).\n */\nexport type DialogSurfaceBodyLayout = 'flow' | 'fill' | 'fill-last';\n/**\n * Where the dialog footer sits: `docked` (default) below the body, or\n * `floating` over the body's block end, inset from the panel's inline and\n * block-end edges on a transparent background (a chat composer).\n */\nexport type DialogSurfaceFooterPresentation = 'docked' | 'floating';\n/**\n * Where the dialog header sits: `docked` (default) above the body, or\n * `floating` over the body's block-start edge on the translucent chrome\n * material, so content scrolls visibly beneath the title bar.\n */\nexport type DialogSurfaceHeaderPresentation = 'docked' | 'floating';\n\n/**\n * Application `data-*` identity on the DialogSurface root, such as\n * `data-key`; the surface's own configuration attributes stay protected.\n */\nexport type DialogSurfaceRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined>\n>;\n\nconst DIALOG_SURFACE_PROTECTED = new Set([\n 'data-component',\n 'data-size',\n 'data-presentation',\n 'data-preferred-width',\n 'data-body-inset',\n 'data-footer-inset',\n 'data-viewport-gutter',\n 'data-max-height',\n 'data-height',\n 'data-body-layout',\n 'data-footer-presentation',\n 'data-header-presentation',\n 'data-min-height',\n 'data-resizable',\n 'data-enter-motion',\n 'data-exit-motion',\n 'data-light-dismiss',\n]);\n\n/**\n * The dialog's accessible name: its `label` text (also the default title), or\n * the id of an element that names it, such as a `heading` ToolbarText.\n */\nexport type DialogSurfaceName =\n { label: string; labelledBy?: never } | { label?: never; labelledBy: string };\n\nexport type DialogSurfaceProps = DialogSurfaceName & DialogSurfaceOptions;\n\nexport interface DialogSurfaceOptions {\n /** The dialog's id, for `openDialog(document.getElementById(id))`. */\n id?: string;\n /**\n * Id of the element whose text is the dialog's accessible description,\n * such as the `heading` ToolbarText's `descriptionId` or app-owned summary\n * copy in the body; rendered as `aria-describedby` on the `<dialog>`.\n */\n describedBy?: string;\n /**\n * An alert dialog: a confirmation that interrupts the person to report\n * something urgent or ask before a destructive action (\"Delete this\n * topic?\"). Renders `role=\"alertdialog\"` on the `<dialog>`; set\n * `describedBy` to the element holding the message, and leave\n * `lightDismiss` off so the person answers it.\n */\n alert?: boolean;\n /** The body content. */\n children: KerfUiContent;\n /**\n * Header title content in place of the `label` text, such as an xl\n * `ToolbarText` with a description. The dialog keeps its `label` (or\n * `labelledBy`) name.\n */\n heading?: KerfUiContent;\n /** Controls before the close button in the header. */\n headerActions?: KerfUiContent;\n /** The footer, below the body (or floating over it); usually its buttons. */\n footer?: KerfUiContent;\n /**\n * Render no header: no title and no close button. The content then owns its\n * heading and a way to close (an element with `data-dialog-close`).\n */\n withoutHeader?: boolean;\n /** Close on a press on the backdrop; otherwise the panel pulses. */\n lightDismiss?: boolean;\n /** The close button's accessible name (default `Close`). */\n closeLabel?: string;\n size?: DialogSurfaceSize;\n presentation?: DialogSurfacePresentation;\n /** Modal preferred width. Takes precedence over size, within the viewport cap. */\n preferredWidth?: CssLength;\n bodyInset?: SurfaceInset;\n footerInset?: SurfaceInset;\n /** Modal edge clearance. Omit to retain Web Awesome's default viewport cap. */\n viewportGutter?: CssLength;\n /**\n * Modal height cap, bounded by the dynamic viewport minus both gutters. On a\n * bottom sheet, the cap (and the resize ceiling), bounded by the dynamic\n * viewport minus the top safe area and one gutter.\n */\n maxHeight?: DialogSurfaceMaxHeight;\n /**\n * Modal definite height, bounded the same way, so a filling child has a\n * height to fill. Takes precedence over `maxHeight`. On a bottom sheet, the\n * height it opens at (the visible height above the safe area or keyboard).\n */\n height?: DialogSurfaceHeight;\n /**\n * A resizable bottom sheet's resize floor (default 160px), the visible\n * height above the safe area or keyboard.\n */\n minHeight?: CssLength;\n /**\n * Let the person resize a bottom sheet by its top grabber (drag, or the\n * arrow, Page Up/Down, Home and End keys) between `minHeight` and the\n * sheet's cap. Needs the `/register` entry; each opening starts at `height`\n * (or the content height). Ignored by other presentations.\n */\n resizable?: boolean;\n /** How a bottom sheet appears (default `slide` up from the bottom edge). */\n enterMotion?: DialogSurfaceSheetMotion;\n /** How a bottom sheet is dismissed (default `slide` down off the bottom edge). */\n exitMotion?: DialogSurfaceSheetMotion;\n /**\n * Body layout (default `flow`); `fill` lets one child own the body and\n * `fill-last` stacks fixed rows above one filling last child.\n */\n bodyLayout?: DialogSurfaceBodyLayout;\n /**\n * Header placement (default `docked`); `floating` lays the dialog's header\n * (its title and close control) over the body's block-start edge on the\n * translucent chrome material (`--kui-chrome-material-raised`, opaque under\n * `prefers-reduced-transparency`, increased contrast, forced colors, or\n * without `backdrop-filter`). The `/register` entry measures the header;\n * the body reserves that height before its own inset, so its first content\n * rests below the title bar. A `fill`/`fill-last` child that is the body's\n * only child and opts into block-start `scrollClearance` (a `List` or\n * `Pane`) takes the clearance inside its own scroll area instead, published\n * as `--kui-scroll-clearance-block-start`, so its content scrolls visibly\n * beneath the header. Unmeasured (without the register), the header stays\n * docked. Keep header text in the normal text color: quiet text can fall\n * below AA over the content passing beneath it.\n */\n headerPresentation?: DialogSurfaceHeaderPresentation;\n /**\n * Footer placement (default `docked`); `floating` lays the footer over the\n * body's block end. The body reserves the footer's measured height so its\n * last content is never hidden beneath it. A `fill`/`fill-last` child that\n * opts into block-end `scrollClearance` (a `List` or `Pane`) takes that\n * clearance inside its own scroll area instead, published as\n * `--kui-scroll-clearance-block-end`, so its content scrolls visibly beneath\n * the transparent footer.\n */\n footerPresentation?: DialogSurfaceFooterPresentation;\n /**\n * A floating footer's clearance from the panel's inline and block-end edges\n * (default the 16px container inset). Choose a phone value such as\n * `remify(8)` from `deviceClass()`; the scaffold adds no breakpoint.\n */\n footerOffset?: CssLength;\n /**\n * Safe `data-*` identity on the root. Give sibling dialogs distinct\n * `data-key`s so a re-render morphs each surface into itself instead of\n * reusing one dialog's element for another (structurally identical roots\n * are otherwise matched by position).\n */\n rootAttributes?: DialogSurfaceRootAttributes;\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\n/**\n * A modal dialog: a native `<dialog>` with Kerf's header, body, and footer\n * chrome, sized and presented by its props. Render it closed, then open it\n * with `openDialog()` and close it with `closeDialog()`, the close button, an\n * element with `data-dialog-close`, Escape, or (with `lightDismiss`) a press\n * on the backdrop. Import `@kerfjs/ui/surface-scaffold/register` for the\n * floating header and footer measurement, the bottom sheet's keyboard\n * clearance and grabber, and re-render resilience while open.\n */\nexport function DialogSurface({\n id,\n label,\n labelledBy,\n describedBy,\n alert = false,\n heading,\n headerActions,\n footer,\n withoutHeader = false,\n lightDismiss = false,\n closeLabel = 'Close',\n children,\n size = 'medium',\n presentation = 'modal',\n preferredWidth,\n bodyInset = 'compact',\n footerInset = 'comfortable',\n viewportGutter,\n maxHeight,\n height,\n minHeight,\n resizable = false,\n enterMotion = 'slide',\n exitMotion = 'slide',\n bodyLayout = 'flow',\n headerPresentation = 'docked',\n footerPresentation = 'docked',\n footerOffset,\n rootAttributes = {},\n className = '',\n slot,\n}: DialogSurfaceProps) {\n const style = [\n preferredWidth === undefined\n ? ''\n : `--_kui-dialog-surface-preferred-width:${preferredWidth}`,\n viewportGutter === undefined\n ? ''\n : `--_kui-dialog-surface-gutter:${viewportGutter}`,\n maxHeight === undefined || maxHeight === 'viewport'\n ? ''\n : `--_kui-dialog-surface-max-height:${maxHeight}`,\n height === undefined || height === 'viewport'\n ? ''\n : `--_kui-dialog-surface-height:${height}`,\n footerOffset === undefined\n ? ''\n : `--_kui-dialog-surface-footer-offset:${footerOffset}`,\n minHeight === undefined\n ? ''\n : `--_kui-dialog-surface-min-height:${minHeight}`,\n ]\n .filter(Boolean)\n .join(';');\n return (\n <dialog\n {...filterDataAttributes(rootAttributes, DIALOG_SURFACE_PROTECTED)}\n id={id}\n class={`kui-dialog-surface ${className}`.trim()}\n role={alert ? 'alertdialog' : undefined}\n aria-label={label}\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n tabindex={-1}\n data-light-dismiss={lightDismiss ? '' : undefined}\n data-component=\"dialog-surface\"\n data-size={size}\n data-presentation={presentation}\n data-preferred-width={preferredWidth === undefined ? undefined : ''}\n data-body-inset={bodyInset}\n data-footer-inset={footerInset}\n data-viewport-gutter={viewportGutter === undefined ? undefined : ''}\n data-max-height={maxHeight === undefined ? undefined : ''}\n data-height={height === undefined ? undefined : ''}\n data-body-layout={bodyLayout === 'flow' ? undefined : bodyLayout}\n data-header-presentation={\n headerPresentation === 'floating' ? 'floating' : undefined\n }\n data-footer-presentation={\n footerPresentation === 'floating' ? 'floating' : undefined\n }\n data-min-height={minHeight === undefined ? undefined : ''}\n data-resizable={resizable ? '' : undefined}\n data-enter-motion={enterMotion === 'slide' ? undefined : enterMotion}\n data-exit-motion={exitMotion === 'slide' ? undefined : exitMotion}\n style={style || undefined}\n slot={slot}\n >\n {withoutHeader ? null : (\n <header class=\"kui-dialog-surface__header\">\n {heading === undefined ? (\n <h2 class=\"kui-dialog-surface__title\">{label}</h2>\n ) : (\n <div class=\"kui-dialog-surface__title\">{heading}</div>\n )}\n <div class=\"kui-dialog-surface__header-actions\">\n {headerActions}\n <button\n type=\"button\"\n class=\"kui-dialog-surface__close\"\n aria-label={closeLabel}\n data-dialog-close=\"\"\n >\n <LucideIcon icon={X} name=\"x\" size=\"l\" />\n </button>\n </div>\n </header>\n )}\n {presentation === 'bottom-sheet' && resizable ? (\n <div\n class=\"kui-dialog-surface__sheet-handle\"\n role=\"separator\"\n aria-orientation=\"horizontal\"\n aria-label=\"Resize sheet\"\n tabindex={0}\n />\n ) : null}\n <div class=\"kui-dialog-surface__body\">{children}</div>\n {footer === undefined ? null : (\n <footer class=\"kui-dialog-surface__footer\">{footer}</footer>\n )}\n {/* Where kerfjs/overlay hosts a popover or tooltip opened inside the\n modal dialog, so it stays interactive above the inert page. */}\n <div data-kerf-overlay-host data-morph-skip style=\"display:contents\" />\n </dialog>\n );\n}\n\n/** Where a PopoverDialogSurface appears: the top layer, or in flow. */\nexport type PopoverDialogSurfacePresentation = 'overlay' | 'embedded';\n\n/** Application `data-*` metadata on the surface root. */\nexport type PopoverDialogSurfaceDataAttributes = Readonly<\n Record<`data-${string}`, string>\n>;\n\ntype PopoverDialogSurfaceName =\n { label: string; labelledBy?: never } | { label?: never; labelledBy: string };\n\nexport type PopoverDialogSurfaceProps = PopoverDialogSurfaceName & {\n /** The root id: what an opening control's `popovertarget` names. */\n id?: string;\n /**\n * Id of the element whose text is the dialog's accessible description,\n * such as a title `ToolbarText`'s `descriptionId`; rendered as\n * `aria-describedby` on the `role=\"dialog\"` root.\n */\n describedBy?: string;\n children: KerfUiContent;\n /**\n * `overlay` (default) is a native `popover=\"auto\"` in the top layer:\n * non-modal, light dismiss (Escape or a press outside), nothing inert.\n * `embedded` renders the same surface in flow for a catalog or inline use.\n */\n presentation?: PopoverDialogSurfacePresentation;\n /** Preferred width preset: 400px, 560px (default), or 800px. */\n size?: DialogSurfaceSize;\n /** Preferred width; takes precedence over `size`, within the viewport cap. */\n preferredWidth?: CssLength;\n /** Definite height, bounded by the dynamic viewport minus both gutters. */\n height?: DialogSurfaceHeight;\n /** Height cap, bounded the same way, for a surface that sizes to content. */\n maxHeight?: DialogSurfaceMaxHeight;\n /** Edge clearance on each side of the viewport (default 16px). */\n viewportGutter?: CssLength;\n /**\n * Body layout (default `flow`); `fill` lets one child own the surface and\n * `fill-last` stacks fixed rows above one filling last child.\n */\n bodyLayout?: DialogSurfaceBodyLayout;\n rootAttributes?: PopoverDialogSurfaceDataAttributes;\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n};\n\nconst POPOVER_DIALOG_PROTECTED = new Set([\n 'data-component',\n 'data-presentation',\n 'data-size',\n 'data-height',\n 'data-max-height',\n 'data-body-layout',\n]);\n\n/**\n * A non-modal dialog surface on the native Popover API: Kerf's dialog chrome,\n * viewport-bounded size, and single-child fill without application CSS.\n * Open it with a `popovertarget` control or `showPopover()`; it light\n * dismisses and leaves the page interactive. Use `DialogSurface` when the\n * task must block the page.\n */\nexport function PopoverDialogSurface({\n id,\n children,\n label,\n labelledBy,\n describedBy,\n presentation = 'overlay',\n size = 'medium',\n preferredWidth,\n height,\n maxHeight,\n viewportGutter,\n bodyLayout = 'flow',\n rootAttributes = {},\n className = '',\n slot,\n}: PopoverDialogSurfaceProps) {\n const style = [\n preferredWidth === undefined\n ? ''\n : `--_kui-popover-dialog-surface-preferred-width:${preferredWidth}`,\n viewportGutter === undefined\n ? ''\n : `--_kui-popover-dialog-surface-gutter:${viewportGutter}`,\n height === undefined || height === 'viewport'\n ? ''\n : `--_kui-popover-dialog-surface-height:${height}`,\n maxHeight === undefined || maxHeight === 'viewport'\n ? ''\n : `--_kui-popover-dialog-surface-max-height:${maxHeight}`,\n ]\n .filter(Boolean)\n .join(';');\n return (\n <section\n {...filterDataAttributes(rootAttributes, POPOVER_DIALOG_PROTECTED)}\n id={id}\n class={`kui-popover-dialog-surface ${className}`.trim()}\n data-component=\"popover-dialog-surface\"\n data-presentation={presentation}\n data-size={size}\n data-height={height === undefined ? undefined : ''}\n data-max-height={maxHeight === undefined ? undefined : ''}\n data-body-layout={bodyLayout === 'flow' ? undefined : bodyLayout}\n popover={presentation === 'overlay' ? 'auto' : undefined}\n role=\"dialog\"\n aria-label={label}\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n style={style || undefined}\n slot={slot}\n >\n {children}\n </section>\n );\n}\n\nexport type PopupSurfaceInset = 'standard' | 'compact' | 'list-zero';\n\nexport interface PopupSurfaceProps {\n children: KerfUiContent;\n inset?: PopupSurfaceInset;\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\n/** Configure recurring Web Awesome dropdown-menu geometry without consumer ::part() CSS. */\nexport function PopupSurface({\n children,\n inset = 'standard',\n className = '',\n slot,\n}: PopupSurfaceProps) {\n return (\n <span\n class={`kui-popup-surface ${className}`.trim()}\n data-component=\"popup-surface\"\n data-inset={inset}\n slot={slot}\n >\n {children}\n </span>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/surfaces/surface-scaffold/internal/dialog-surface-controller.ts"],"names":[],"mappings":";;;AAUA,IAAM,OAAA,GAAU,2BAAA;AAGT,IAAM,uBAAA,GAA0B,wBAAA;AAGhC,IAAM,0BAAA,GACX,yCAAA;AAGK,IAAM,0BAAA,GACX,yCAAA;AAMK,IAAM,uBAAA,GAA0B,sCAAA;AAGhC,IAAM,qBAAA,GAAwB,oCAAA;AAG9B,IAAM,uBAAA,GAA0B,sCAAA;AAGvC,IAAM,aAAA,GAAgB,iDAAA;AAMtB,IAAM,gBAAA,GAAmB,CAAA;AAYzB,IAAM,MAAA,uBAAa,OAAA,EAAsC;AACzD,IAAM,SAAA,uBAAgB,OAAA,EAAkB;AAExC,IAAM,YAAY,CAAC,MAAA,KACjB,kBAAkB,OAAA,IAAW,MAAA,CAAO,QAAQ,OAAO,CAAA;AAQ9C,SAAS,aAAA,CACd,UACA,YAAA,EACQ;AACR,EAAA,IAAI,QAAA,CAAS,KAAA,GAAQ,IAAA,EAAM,OAAO,CAAA;AAClC,EAAA,MAAM,QAAQ,IAAA,CAAK,KAAA,CAAM,eAAe,QAAA,CAAS,MAAA,GAAS,SAAS,SAAS,CAAA;AAC5E,EAAA,OAAO,KAAA,GAAQ,IAAI,KAAA,GAAQ,CAAA;AAC7B;AAGA,SAAS,eAAe,MAAA,EAA6B;AACnD,EAAA,MAAM,KAAA,GAAQ,UAAA,CAAW,gBAAA,CAAiB,MAAM,CAAA;AAChD,EAAA,IAAI,CAA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M,CAAA,EAAG,MAAA,CAAO,MAAM,MAAM,CAAA;AAAA,IAClD,CAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-ATGAJVZ6.js","sourcesContent":["import { syncSheetHandleValues, wireSheetHandle } from './sheet-handle.js';\n\n/** What asked an open DialogSurface to close. */\nexport type DialogCloseSource = 'close-button' | 'escape' | 'backdrop';\n\n/** The detail of a DialogSurface's cancelable `kui-request-close` event. */\nexport interface DialogRequestCloseDetail {\n readonly source: DialogCloseSource;\n}\n\nconst SURFACE = 'dialog.kui-dialog-surface';\n\n/** The attribute marking a running enter, exit, or pulse animation. */\nexport const DIALOG_MOTION_ATTRIBUTE = 'data-kui-dialog-motion';\n\n/** The panel variable a floating header's body clearance reads. */\nexport const HEADER_BLOCK_SIZE_PROPERTY =\n '--_kui-dialog-surface-header-block-size';\n\n/** The panel variable a floating footer's body clearance reads. */\nexport const FOOTER_BLOCK_SIZE_PROPERTY =\n '--_kui-dialog-surface-footer-block-size';\n\n/**\n * The panel variable a floating header's divider reads: set while content\n * is scrolled away beneath the header, unset (no divider) otherwise.\n */\nexport const HEADER_DIVIDER_PROPERTY = '--_kui-dialog-surface-header-divider';\n\n/** The panel variable holding a resized sheet's visible height. */\nexport const SHEET_HEIGHT_PROPERTY = '--_kui-dialog-surface-sheet-height';\n\n/** The panel variable holding the virtual keyboard's overlap. */\nexport const KEYBOARD_INSET_PROPERTY = '--_kui-dialog-surface-keyboard-inset';\n\n/** The value published while the divider shows: the color the CSS owns. */\nconst DIVIDER_SHOWN = 'var(--_kui-dialog-surface-header-divider-color)';\n\n/**\n * Scroll distance, in px, that counts as \"away from the top\": a scroller at\n * rest can report a fractional offset.\n */\nconst SCROLL_THRESHOLD = 1;\n\ntype Motion = 'enter' | 'exit' | 'pulse';\n\ninterface OpenState {\n /** Panel variables the controller owns while open, restored after a morph. */\n readonly owned: Map<string, string>;\n readonly stop: (() => void)[];\n motionTimer: ReturnType<typeof globalThis.setTimeout> | undefined;\n closing: boolean;\n}\n\nconst states = new WeakMap<HTMLDialogElement, OpenState>();\nconst installed = new WeakSet<Document>();\n\nconst isSurface = (target: EventTarget | null): target is HTMLDialogElement =>\n target instanceof Element && target.matches(SURFACE);\n\n/**\n * The layout viewport's bottom band a virtual keyboard covers: what the\n * visual viewport no longer shows below itself. Zero while pinch-zoomed (the\n * visual viewport then shrinks for another reason) and wherever the keyboard\n * resizes the layout viewport instead (`interactive-widget=resizes-content`).\n */\nexport function keyboardInset(\n viewport: Pick<VisualViewport, 'height' | 'offsetTop' | 'scale'>,\n layoutHeight: number,\n): number {\n if (viewport.scale > 1.01) return 0;\n const inset = Math.round(layoutHeight - viewport.height - viewport.offsetTop);\n return inset > 0 ? inset : 0;\n}\n\n/** The longest running animation on the panel, in ms (0 when none runs). */\nfunction motionDuration(dialog: HTMLElement): number {\n const style = globalThis.getComputedStyle(dialog);\n if (!style.animationName || style.animationName === 'none') return 0;\n return Math.max(\n 0,\n ...style.animationDuration.split(',').map((part) => {\n const value = parseFloat(part);\n return part.trim().endsWith('ms') ? value : value * 1000;\n }),\n );\n}\n\n/**\n * Mark a motion while its keyframes run, then finish it. A timer, not\n * `animationend`, ends it, so an application re-render that drops the marker\n * mid-animation still closes the dialog.\n */\nfunction runMotion(\n dialog: HTMLDialogElement,\n motion: Motion,\n done?: () => void,\n): void {\n const state = states.get(dialog);\n if (state) globalThis.clearTimeout(state.motionTimer);\n dialog.setAttribute(DIALOG_MOTION_ATTRIBUTE, motion);\n const finish = () => {\n done?.();\n if (dialog.getAttribute(DIALOG_MOTION_ATTRIBUTE) === motion)\n dialog.removeAttribute(DIALOG_MOTION_ATTRIBUTE);\n };\n const duration = motionDuration(dialog);\n if (duration === 0 || !state) finish();\n else state.motionTimer = globalThis.setTimeout(finish, duration);\n}\n\n/** Set (or, with `null`, clear) a panel variable the controller owns. */\nfunction own(\n dialog: HTMLDialogElement,\n property: string,\n value: string | null,\n): void {\n const owned = states.get(dialog)?.owned;\n if (value === null) {\n owned?.delete(property);\n dialog.style.removeProperty(property);\n return;\n }\n owned?.set(property, value);\n if (dialog.style.getPropertyValue(property) !== value)\n dialog.style.setProperty(property, value);\n}\n\n/** Watch an open dialog: owned state, chrome sizes, divider, and sheet. */\nfunction follow(dialog: HTMLDialogElement, state: OpenState): void {\n const sheet = dialog.getAttribute('data-presentation') === 'bottom-sheet';\n // Layout sizes, not boxes: the panel opens scaled while its enter motion\n // runs. A resize observation reports the exact border box; until the first\n // one, `offsetHeight` stands in.\n const blockSizes = new WeakMap<Element, number>();\n const sizes = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const box = entry.borderBoxSize?.[0];\n if (box) blockSizes.set(entry.target, box.blockSize);\n }\n measure();\n });\n const blockSize = (element: HTMLElement) =>\n `${blockSizes.get(element) ?? element.offsetHeight}px`;\n let header: HTMLElement | null = null;\n let footer: HTMLElement | null = null;\n let handle: HTMLElement | null = null;\n let unwireHandle: (() => void) | undefined;\n const measure = () => {\n own(dialog, HEADER_BLOCK_SIZE_PROPERTY, header ? blockSize(header) : null);\n own(dialog, FOOTER_BLOCK_SIZE_PROPERTY, footer ? blockSize(footer) : null);\n };\n // The header, footer, and grabber the template renders; a re-render may\n // replace them.\n const track = () => {\n const nextHeader = dialog.querySelector<HTMLElement>(\n ':scope > .kui-dialog-surface__header',\n );\n const nextFooter = dialog.querySelector<HTMLElement>(\n ':scope > .kui-dialog-surface__footer',\n );\n if (nextHeader !== header || nextFooter !== footer) {\n sizes.disconnect();\n header = nextHeader;\n footer = nextFooter;\n for (const element of [header, footer])\n if (element) sizes.observe(element);\n measure();\n }\n const nextHandle = dialog.querySelector<HTMLElement>(\n ':scope > .kui-dialog-surface__sheet-handle',\n );\n if (nextHandle !== handle) {\n unwireHandle?.();\n unwireHandle = undefined;\n handle = nextHandle;\n if (handle) {\n unwireHandle = wireSheetHandle(handle, {\n panel: dialog,\n host: dialog,\n property: SHEET_HEIGHT_PROPERTY,\n enabled: () => true,\n publish: (value) => own(dialog, SHEET_HEIGHT_PROPERTY, value),\n });\n syncSheetHandleValues(handle, dialog);\n }\n }\n };\n track();\n // An application re-render morphs the panel back to its rendered\n // attributes and may replace its chrome: restore the owned variables and\n // follow the new elements.\n const restore = new MutationObserver(() => {\n for (const [property, value] of state.owned)\n if (dialog.style.getPropertyValue(property) !== value)\n dialog.style.setProperty(property, value);\n track();\n });\n restore.observe(dialog, {\n attributes: true,\n attributeFilter: ['style'],\n childList: true,\n });\n // A floating header's divider shows while a scroller reaching beneath it\n // is scrolled away from its top. `scroll` does not bubble: capture it.\n const scrolled = new Set<Element>();\n const onScroll = (event: Event) => {\n const scroller = event.target as Element;\n const floating =\n dialog.getAttribute('data-header-presentation') === 'floating';\n if (\n floating &&\n header &&\n scroller.scrollTop > SCROLL_THRESHOLD &&\n scroller.getBoundingClientRect().top <=\n header.getBoundingClientRect().bottom\n )\n scrolled.add(scroller);\n else scrolled.delete(scroller);\n for (const element of scrolled)\n if (!element.isConnected) scrolled.delete(element);\n own(\n dialog,\n HEADER_DIVIDER_PROPERTY,\n scrolled.size > 0 ? DIVIDER_SHOWN : null,\n );\n };\n dialog.addEventListener('scroll', onScroll, { capture: true, passive: true });\n state.stop.push(() => {\n sizes.disconnect();\n restore.disconnect();\n unwireHandle?.();\n dialog.removeEventListener('scroll', onScroll, { capture: true });\n });\n // A bottom sheet keeps its content above a virtual keyboard.\n const viewport = dialog.ownerDocument.defaultView?.visualViewport;\n if (sheet && viewport) {\n const publish = () => {\n const inset = keyboardInset(viewport, globalThis.innerHeight);\n own(dialog, KEYBOARD_INSET_PROPERTY, inset > 0 ? `${inset}px` : null);\n };\n viewport.addEventListener('resize', publish);\n viewport.addEventListener('scroll', publish);\n state.stop.push(() => {\n viewport.removeEventListener('resize', publish);\n viewport.removeEventListener('scroll', publish);\n });\n publish();\n }\n}\n\n/** Stop following a closed dialog and drop the state it owned. */\nfunction settle(dialog: HTMLDialogElement): void {\n const state = states.get(dialog);\n if (!state) return;\n states.delete(dialog);\n globalThis.clearTimeout(state.motionTimer);\n for (const stop of state.stop) stop();\n for (const property of state.owned.keys())\n dialog.style.removeProperty(property);\n dialog.removeAttribute(DIALOG_MOTION_ATTRIBUTE);\n}\n\n/**\n * Open a DialogSurface as a modal dialog: in the top layer, the rest of the\n * page inert, focus on its `autofocus` element or else the panel. It plays\n * its enter motion and, with the controller installed here, keeps its\n * measured chrome, sheet height, and keyboard clearance across application\n * re-renders. Opening an open dialog does nothing.\n */\nexport function openDialog(dialog: HTMLDialogElement): void {\n installDialogSurfaces(dialog.ownerDocument);\n const closing = states.get(dialog);\n if (closing?.closing) {\n // The latest request wins: reopening during the exit motion keeps it open.\n closing.closing = false;\n runMotion(dialog, 'enter');\n return;\n }\n if (dialog.open) return;\n dialog.showModal();\n const state: OpenState = {\n owned: new Map(),\n stop: [],\n motionTimer: undefined,\n closing: false,\n };\n states.set(dialog, state);\n if (!dialog.querySelector('[autofocus]'))\n dialog.focus({ preventScroll: true });\n follow(dialog, state);\n runMotion(dialog, 'enter');\n}\n\n/**\n * Close an open DialogSurface after its exit motion. The application's own\n * close is never refused: no `kui-request-close` is dispatched. The native\n * `close` event fires once it has closed.\n */\nexport function closeDialog(dialog: HTMLDialogElement): void {\n const state = states.get(dialog);\n if (!dialog.open) return;\n if (!state) {\n dialog.close();\n return;\n }\n if (state.closing) return;\n state.closing = true;\n runMotion(dialog, 'exit', () => dialog.close());\n}\n\n/**\n * A person asked to close the dialog: dispatch the cancelable\n * `kui-request-close`; refused, the panel pulses, otherwise it closes.\n */\nfunction requestClose(\n dialog: HTMLDialogElement,\n source: DialogCloseSource,\n): void {\n const allowed = dialog.dispatchEvent(\n new CustomEvent<DialogRequestCloseDetail>('kui-request-close', {\n bubbles: true,\n cancelable: true,\n detail: { source },\n }),\n );\n if (allowed) closeDialog(dialog);\n else runMotion(dialog, 'pulse');\n}\n\nconst outside = (dialog: HTMLElement, event: MouseEvent): boolean => {\n const box = dialog.getBoundingClientRect();\n return (\n event.clientX < box.left ||\n event.clientX > box.right ||\n event.clientY < box.top ||\n event.clientY > box.bottom\n );\n};\n\n/**\n * Wire every DialogSurface in `doc`: the close button and any element with\n * `data-dialog-close`, Escape, and a press on the backdrop (closing with\n * `lightDismiss`, pulsing without) ask to close through `kui-request-close`;\n * a closed dialog stops being followed. `openDialog` installs this itself;\n * the `surface-scaffold/register` entry installs it for the document.\n * Idempotent per document.\n */\nexport function installDialogSurfaces(doc: Document = document): void {\n if (installed.has(doc)) return;\n installed.add(doc);\n // A backdrop press starts and ends outside the panel; a drag out of the\n // panel (a text selection) is not one.\n let pressedOutside: HTMLDialogElement | null = null;\n doc.addEventListener(\n 'pointerdown',\n (event) => {\n pressedOutside =\n isSurface(event.target) && outside(event.target, event)\n ? event.target\n : null;\n },\n true,\n );\n doc.addEventListener(\n 'click',\n (event) => {\n const target = event.target as Element;\n const dialog = target.closest?.<HTMLDialogElement>(SURFACE);\n if (!dialog?.open) return;\n if (target === dialog) {\n if (pressedOutside !== dialog || !outside(dialog, event)) return;\n if (dialog.hasAttribute('data-light-dismiss'))\n requestClose(dialog, 'backdrop');\n else runMotion(dialog, 'pulse');\n return;\n }\n const closer = target.closest('[data-dialog-close]');\n if (closer && closer.closest(SURFACE) === dialog) {\n event.preventDefault();\n requestClose(dialog, 'close-button');\n }\n },\n true,\n );\n // Escape fires `cancel`; the dialog closes through the same request.\n doc.addEventListener(\n 'cancel',\n (event) => {\n if (!isSurface(event.target)) return;\n event.preventDefault();\n requestClose(event.target, 'escape');\n },\n true,\n );\n // However it closed (including an engine closing it past a refused\n // Escape), stop following it.\n doc.addEventListener(\n 'close',\n (event) => {\n if (isSurface(event.target)) settle(event.target);\n },\n true,\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/layout/pane/pane.tsx"],"names":[],"mappings":";;;;;AA4BA,IAAM,uBAAA,uBAA8B,GAAA,CAAI;AAAA,EACtC,gBAAA;AAAA,EACA,uBAAA;AAAA,EACA,qBAAA;AAAA,EACA,qBAAA;A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KACvC;AAAA,IACA,2BAAA,EAA6B,MAAA,CAAO,aAAA,CAAc,QAAA,CAAS,YAAY,CAAC,CAAA;AAAA,IACxE,YAAA,EAAc,KAAA;AAAA,IACd,QAAA,EAAU,QAAA;AAAA,IACV;AAAA,GACF;AAEA,EAAA,IAAI,YAAY,SAAA,EAAW,2BAAQ,SAAA,EAAA,EAAS,GAAG,YAAa,QAAA,EAAA,IAAA,EAAK,CAAA;AACjE,EAAA,IAAI,YAAY,OAAA,EAAS,2BAAQ,OAAA,EAAA,EAAO,GAAG,YAAa,QAAA,EAAA,IAAA,EAAK,CAAA;AAC7D,EAAA,IAAI,YAAY,MAAA,EAAQ,2BAAQ,MAAA,EAAA,EAAM,GAAG,YAAa,QAAA,EAAA,IAAA,EAAK,CAAA;AAC3D,EAAA,IAAI,YAAY,SAAA,EAAW,2BAAQ,SAAA,EAAA,EAAS,GAAG,YAAa,QAAA,EAAA,IAAA,EAAK,CAAA;AACjE,EAAA,uBAAO,GAAA,CAAC,KAAA,EAAA,EAAK,GAAG,UAAA,EAAa,QAAA,EAAA,IAAA,EAAK,CAAA;AACpC","file":"chunk-HQZG3OFL.js","sourcesContent":["import type { KerfUiContent } from '../../../shared/content/semantic-content.js';\nimport { filterDataAttributes } from '../../../shared/dom/extension-attributes.js';\nimport type { ScrollClearance } from '../../../shared/layout/scroll-clearance.js';\nimport {\n type ScrollEdge,\n scrollEdgeAttributes,\n} from '../../../shared/layout/scroll-edge.js';\nimport type { CssColor } from '../../../shared/styles/css-values.js';\nimport { ensureSunkenTexture } from '../../../shared/styles/sunken-texture.js';\nimport {\n joinStyles,\n type SurfaceTint,\n surfaceTintAttributes,\n} from '../../../shared/styles/surface-tint.js';\n\n/**\n * Logical pane sides: where a {@link Pane} can show a separator and where it can\n * compensate for a device safe-area inset.\n */\nexport type PaneSeparatorSide =\n 'block-start' | 'block-end' | 'inline-start' | 'inline-end';\n\n/** Semantic root elements supported by {@link Pane}. */\nexport type PaneElement = 'article' | 'aside' | 'div' | 'main' | 'section';\n\n/** Semantic elements supported by the scrolling content slot. */\nexport type PaneContentElement = 'div' | 'main' | 'nav' | 'section';\n\nconst paneProtectedAttributes = new Set([\n 'data-component',\n 'data-chrome-placement',\n 'data-compact-header',\n 'data-compact-footer',\n 'data-compact-header-open',\n 'data-compact-footer-open',\n 'data-chrome-dividers',\n 'data-appearance',\n 'data-background',\n 'data-kui-tint',\n 'data-kui-tint-accent',\n 'data-deep-inset',\n 'data-outlined',\n 'data-scroll-clearance',\n 'data-header-presentation',\n 'data-header-material',\n 'data-scroll-edge',\n 'data-scroll-edge-distance',\n 'data-header-overlay',\n 'data-separator-block-start',\n 'data-separator-block-end',\n 'data-separator-inline-start',\n 'data-separator-inline-end',\n 'data-safe-area-block-start',\n 'data-safe-area-block-end',\n 'data-safe-area-inline-start',\n 'data-safe-area-inline-end',\n]);\n\nconst allPaneSides: readonly PaneSeparatorSide[] = [\n 'block-start',\n 'block-end',\n 'inline-start',\n 'inline-end',\n];\n\ntype PaneRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined> & {\n 'data-component'?: never;\n 'data-separator-block-start'?: never;\n 'data-separator-block-end'?: never;\n 'data-separator-inline-start'?: never;\n 'data-separator-inline-end'?: never;\n 'data-safe-area-block-start'?: never;\n 'data-safe-area-block-end'?: never;\n 'data-safe-area-inline-start'?: never;\n 'data-safe-area-inline-end'?: never;\n 'data-chrome-placement'?: never;\n 'data-chrome-dividers'?: never;\n 'data-appearance'?: never;\n 'data-background'?: never;\n 'data-kui-tint'?: never;\n 'data-kui-tint-accent'?: never;\n 'data-deep-inset'?: never;\n 'data-outlined'?: never;\n 'data-scroll-clearance'?: never;\n 'data-header-presentation'?: never;\n 'data-header-material'?: never;\n 'data-scroll-edge'?: never;\n 'data-scroll-edge-distance'?: never;\n 'data-header-overlay'?: never;\n 'data-compact-header'?: never;\n 'data-compact-footer'?: never;\n 'data-compact-header-open'?: never;\n 'data-compact-footer-open'?: never;\n }\n>;\n\n/** How a Pane's header and footer relate to its scrolling content. */\nexport type PaneChromePlacement = 'fixed' | 'auto';\n\n/**\n * How a header or footer behaves when the pane's container presents\n * compactly (a `NavStack` view, a `TabNavigator` scene, a full-screen dialog,\n * or a compact `Workbench`): `fixed` stays docked and shrinks the content\n * area; `scroll` sits inline with the content (a footer settles at the end\n * and scrolls past when the content is longer); `overlay` lies over the\n * content on the chrome material, shown only while the app opens it.\n */\nexport type PaneCompactChrome = 'fixed' | 'scroll' | 'overlay';\n\n/** The compact chrome policy for a Pane's header and footer. */\nexport interface PaneCompactChromePolicy {\n header?: PaneCompactChrome;\n footer?: PaneCompactChrome;\n}\n\n/**\n * When a Pane draws the divider between its pinned header or footer and its\n * scrolling content: `scroll` while content is scrolled away beneath that\n * chrome, as `wireScrollDividers` reports; `always`; or `none`.\n */\nexport type PaneChromeDividers = 'scroll' | 'always' | 'none';\n\n/**\n * How a Pane's header relates to its scrolling content: `docked` in its own\n * row above the content, or `overlay` laid over the content's top edge on the\n * translucent chrome material, so content scrolls visibly beneath it.\n * `clear` lays it over\n * the same edge fully transparent, for chrome over imagery: legibility comes\n * from glass control groups or a scrim, and with `scrollEdge=\"material\"` the\n * chrome material fades in once content scrolls beneath it.\n */\nexport type PaneHeaderPresentation = 'docked' | 'overlay' | 'clear';\n\n/** Background treatment of the Pane's scrolling work surface. */\nexport type PaneAppearance = 'default' | 'sunken';\n\nexport interface PaneProps {\n /** Optional fixed chrome above the scrolling content, arranged vertically. */\n header?: KerfUiContent;\n /** The pane's primary vertical, scrolling content stack. */\n children?: KerfUiContent;\n /** Optional fixed chrome below the scrolling content. */\n footer?: KerfUiContent;\n /**\n * Whether the header and footer stay pinned around the scrolling content.\n * `fixed` (default) always pins them. `auto` pins them while the pane is\n * tall enough, and below 480px of height (30rem, so it scales with the text\n * size) lets the whole pane scroll as one column, so tall chrome can never\n * squeeze the content to nothing.\n */\n chromePlacement?: PaneChromePlacement;\n /**\n * The divider under the header and over the footer, where they meet the\n * scrolling content. Omitted defaults to `scroll` for a plain pane and\n * `always` for `appearance=\"sunken\"`. `scroll` shows the header's divider only\n * while the content is scrolled down, and the footer's only while more\n * content lies below — never when the content fits — once\n * `wireScrollDividers` (`@kerfjs/ui/wire-scroll-dividers`) is wired above\n * the pane; unwired, neither shows. `always` shows both; `none` neither.\n * The line is drawn inside the chrome, so no state moves the content.\n */\n chromeDividers?: PaneChromeDividers;\n /**\n * `docked` (default) gives the header its own row above the scrolling\n * content. `overlay` lays the header over the content's top edge on the\n * translucent chrome material (`--kui-chrome-material`, opaque under\n * `prefers-reduced-transparency`, forced colors, or without\n * `backdrop-filter`), so content scrolls visibly beneath it. Once\n * `wireScrollDividers` (`@kerfjs/ui/wire-scroll-dividers`) is wired above\n * the pane it measures the header and publishes its height as the\n * `--kui-scroll-clearance-block-start` context, which the content adds to\n * its block-start padding and `scroll-padding` without any\n * `scrollClearance` prop, so the first item, and anything focused or\n * scrolled into view, rests clear of the header. Until then, and with\n * `chromePlacement=\"auto\"`, the header stays docked. Keep overlay header\n * text in the normal text color: quiet text can fall below AA over the\n * content passing beneath it.\n */\n /**\n * What the header and footer do when the pane's container presents\n * compactly (default `fixed`); roomy containers ignore it. The container\n * interprets it, so set it on panes inside a `NavStack`, `TabNavigator`,\n * full-screen dialog, or `Workbench`.\n */\n compactChrome?: PaneCompactChromePolicy;\n /**\n * Which `overlay` compact chrome is showing. The app owns it and flips it\n * from a control the person can reach while the chrome is hidden.\n */\n compactChromeOpen?: { header?: boolean; footer?: boolean };\n headerPresentation?: PaneHeaderPresentation;\n /**\n * With `headerPresentation=\"clear\"`, `material` fades the chrome material\n * in behind the header once content scrolls beneath it (default `none`).\n */\n scrollEdge?: ScrollEdge;\n /**\n * The scroll distance, in CSS pixels, over which the scroll edge fades in\n * (default 60).\n */\n scrollEdgeDistance?: number;\n /** Paint the scrolling work surface with the shared lowered-surface color. */\n appearance?: PaneAppearance;\n /**\n * Paint the whole pane, header and footer included, in an app-chosen color\n * (`uiColor('surface-raised')`, `fillColor('#1f2a44')`, or `colorVar(…)`\n * from `@kerfjs/ui/css-values`). It replaces the appearance's fill: a sunken\n * pane drops its lowered color and grain. Omitted, the pane keeps its\n * default (transparent, or the sunken surface). Forced colors paint\n * `Canvas`. Keep text at AA over the color; a dark color needs a matching\n * tint or dark tones for its content.\n */\n background?: CssColor;\n /**\n * A scoped tint: `{ color, scheme }`, the app's color and the scheme it\n * belongs to. The pane paints the tinted surface (unless `background` is\n * set) and its whole subtree, chrome material and quiet fills included,\n * re-derives its surface and text tokens from the color with lightness\n * clamped to keep text at WCAG AA. Without relative color syntax, or under\n * `prefers-contrast: more`, the scope keeps the plain palette in the\n * declared scheme.\n */\n tint?: SurfaceTint;\n /**\n * Clear chrome that lies over the scrolling content's block-start and/or\n * block-end edge, such as a `DialogSurface` floating footer over a filling\n * Pane. The content scroller adds the inherited\n * `--kui-scroll-clearance-block-*` context that chrome publishes to its block\n * padding and `scroll-padding`, so content scrolls visibly beneath the chrome\n * while its first and last items (and anything focused or scrolled into\n * view) can still rest clear of it. Defaults to none.\n */\n scrollClearance?: ScrollClearance;\n /** Add 8px to every side of scrolling content (default: false). */\n deepInset?: boolean;\n /** Opt into keyboard (`0`) or programmatic (`-1`) focus on the Pane root. */\n tabIndex?: 0 | -1;\n /** Keep the standard focus outline visible, such as for a drop target. */\n outlined?: boolean;\n /** Root semantics. Defaults to `div`. */\n element?: PaneElement;\n /** Scrolling content semantics. Defaults to `div`. */\n contentElement?: PaneContentElement;\n /** Independent logical-edge separator lines. Defaults to none. */\n separators?: readonly PaneSeparatorSide[];\n /**\n * Sides on which the pane may compensate for a device safe-area inset.\n * Defaults to every side: the pane pads its slots for each side that still\n * reaches an unsafe screen edge, as its surrounding layout reports, while its\n * background and separators paint through. List only the sides an app-owned\n * layout places at a screen edge, or pass `[]` to opt out.\n */\n safeAreaEdges?: readonly PaneSeparatorSide[];\n id?: string;\n /** Accessible name for a landmark root such as `aside` or `main`. */\n label?: string;\n /** Accessible name for a landmark scrolling slot such as `nav`. */\n contentLabel?: string;\n className?: string;\n headerClassName?: string;\n contentClassName?: string;\n footerClassName?: string;\n /** Safe `data-*` metadata; Pane-owned structural attributes remain protected. */\n rootAttributes?: PaneRootAttributes;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\n/**\n * A pane's configuration, apart from its content and styling hooks: the props a\n * composite that renders a `Pane` for the app (a Workbench panel or work area,\n * or a CollapsiblePanel) forwards, so the app configures that pane instead of\n * styling it. An omitted or `undefined` field keeps the composite's default.\n */\nexport type PaneConfig = Pick<\n PaneProps,\n | 'contentElement'\n | 'contentLabel'\n | 'separators'\n | 'safeAreaEdges'\n | 'chromeDividers'\n | 'compactChrome'\n | 'compactChromeOpen'\n | 'headerPresentation'\n | 'scrollEdge'\n | 'scrollEdgeDistance'\n | 'appearance'\n | 'background'\n | 'tint'\n | 'deepInset'\n | 'scrollClearance'\n | 'tabIndex'\n | 'outlined'\n>;\n\nfunction paneContent(\n element: PaneContentElement,\n children: KerfUiContent,\n className: string,\n label: string | undefined,\n) {\n const attributes = {\n class: `kui-pane__content kui-content ${className}`.trim(),\n 'aria-label': label,\n };\n if (element === 'main') return <main {...attributes}>{children}</main>;\n if (element === 'nav') return <nav {...attributes}>{children}</nav>;\n if (element === 'section')\n return <section {...attributes}>{children}</section>;\n return <div {...attributes}>{children}</div>;\n}\n\n/**\n * An unpadded application column with optional fixed header/footer slots and one\n * scrolling vertical content owner. Separator lines are independently opt-in on\n * each logical edge, so the same component works as a sidebar, main area,\n * inspector, or dialog column.\n */\nexport function Pane({\n header,\n children,\n footer,\n chromePlacement = 'fixed',\n chromeDividers,\n compactChrome = {},\n compactChromeOpen = {},\n headerPresentation = 'docked',\n scrollEdge = 'none',\n scrollEdgeDistance,\n appearance = 'default',\n background,\n tint,\n deepInset = false,\n scrollClearance,\n tabIndex,\n outlined = false,\n element = 'div',\n contentElement = 'div',\n separators = [],\n safeAreaEdges = allPaneSides,\n id,\n label,\n contentLabel,\n className = '',\n headerClassName = '',\n contentClassName = '',\n footerClassName = '',\n rootAttributes = {},\n slot,\n}: PaneProps) {\n const safeRootAttributes = filterDataAttributes(\n rootAttributes,\n paneProtectedAttributes,\n );\n const content = paneContent(\n contentElement,\n children,\n contentClassName,\n contentLabel,\n );\n const resolvedChromeDividers =\n chromeDividers ?? (appearance === 'sunken' ? 'always' : 'scroll');\n if (appearance === 'sunken' && background === undefined)\n ensureSunkenTexture();\n const tinted = surfaceTintAttributes(tint);\n const clearHeader = headerPresentation === 'clear' && header !== undefined;\n const body = (\n <>\n {header === undefined ? null : (\n <header\n class={`kui-pane__header kui-pane__toolbar ${headerClassName}`.trim()}\n >\n {header}\n </header>\n )}\n {content}\n {footer === undefined ? null : (\n <footer class={`kui-pane__footer ${footerClassName}`.trim()}>\n {footer}\n </footer>\n )}\n </>\n );\n const attributes = {\n ...safeRootAttributes,\n class: `kui-pane ${tinted.className} ${className}`\n .replace(/\\s+/g, ' ')\n .trim(),\n id,\n 'data-component': 'pane',\n 'data-appearance': appearance === 'sunken' ? 'sunken' : undefined,\n 'data-background': background === undefined ? undefined : '',\n 'data-kui-tint': tinted['data-kui-tint'],\n 'data-kui-tint-accent': tinted['data-kui-tint-accent'],\n style: joinStyles(\n background === undefined\n ? undefined\n : `--_kui-pane-background:${background}`,\n tinted.style,\n ),\n 'data-deep-inset': deepInset ? 'true' : undefined,\n 'data-outlined': outlined ? 'true' : undefined,\n 'data-scroll-clearance': scrollClearance,\n 'data-header-presentation':\n headerPresentation !== 'docked' && header !== undefined\n ? 'overlay'\n : undefined,\n 'data-header-material': clearHeader ? 'clear' : undefined,\n ...scrollEdgeAttributes(scrollEdge, scrollEdgeDistance, clearHeader),\n 'data-chrome-placement': chromePlacement === 'auto' ? 'auto' : undefined,\n 'data-compact-header':\n header !== undefined && compactChrome.header !== 'fixed'\n ? compactChrome.header\n : undefined,\n 'data-compact-footer':\n footer !== undefined && compactChrome.footer !== 'fixed'\n ? compactChrome.footer\n : undefined,\n 'data-compact-header-open':\n compactChrome.header === 'overlay' && compactChromeOpen.header\n ? ''\n : undefined,\n 'data-compact-footer-open':\n compactChrome.footer === 'overlay' && compactChromeOpen.footer\n ? ''\n : undefined,\n 'data-chrome-dividers':\n resolvedChromeDividers === 'always' || resolvedChromeDividers === 'none'\n ? resolvedChromeDividers\n : undefined,\n 'data-separator-block-start': String(separators.includes('block-start')),\n 'data-separator-block-end': String(separators.includes('block-end')),\n 'data-separator-inline-start': String(separators.includes('inline-start')),\n 'data-separator-inline-end': String(separators.includes('inline-end')),\n 'data-safe-area-block-start': String(safeAreaEdges.includes('block-start')),\n 'data-safe-area-block-end': String(safeAreaEdges.includes('block-end')),\n 'data-safe-area-inline-start': String(\n safeAreaEdges.includes('inline-start'),\n ),\n 'data-safe-area-inline-end': String(safeAreaEdges.includes('inline-end')),\n 'aria-label': label,\n tabindex: tabIndex,\n slot,\n };\n\n if (element === 'article') return <article {...attributes}>{body}</article>;\n if (element === 'aside') return <aside {...attributes}>{body}</aside>;\n if (element === 'main') return <main {...attributes}>{body}</main>;\n if (element === 'section') return <section {...attributes}>{body}</section>;\n return <div {...attributes}>{body}</div>;\n}\n\nexport type { ScrollClearance } from '../../../shared/layout/scroll-clearance.js';\nexport type { ScrollEdge } from '../../../shared/layout/scroll-edge.js';\nexport type {\n SurfaceTint,\n SurfaceTintScheme,\n} from '../../../shared/styles/surface-tint.js';\n"]}
|