@kerfjs/ui 5.0.0-beta.122 → 5.0.0-beta.123
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/ai/component-catalog.json +3 -6
- package/ai/component-composition.json +0 -2
- package/ai/components/README.md +1 -1
- package/ai/components/tabs.md +3 -4
- package/ai/public-api-signatures-v1.md +3 -6
- package/ai/skill.md +3 -3
- package/ai/webawesome-jsx-signatures-v1.md +1 -1
- package/dist/{chunk-BSNKDW4X.js → chunk-ROEBKSIY.js} +1 -4
- package/dist/chunk-ROEBKSIY.js.map +1 -0
- package/dist/{chunk-HJWFHJ3Z.js → chunk-WPP5Q4A5.js} +10 -82
- package/dist/chunk-WPP5Q4A5.js.map +1 -0
- package/dist/{chunk-7AK5I7U7.js → chunk-YWLDLNAV.js} +1 -1
- package/dist/{chunk-7AK5I7U7.js.map → chunk-YWLDLNAV.js.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/styles/components/collections/list-header/list-header.css +11 -25
- package/dist/styles/components/navigation/tab-bar/tab-bar.css +15 -17
- package/dist/styles/components/navigation/tab-bar-item/tab-bar-item.css +1 -58
- package/dist/styles/list-header.css +11 -25
- package/dist/styles/tab-bar-item.css +1 -58
- package/dist/styles/tab-bar.css +15 -17
- package/dist/tab-bar-item.d.ts +1 -4
- package/dist/tab-bar-item.js +1 -1
- package/dist/tab-bar.d.ts +1 -1
- package/dist/tab-bar.js +1 -1
- package/dist/wire-tab-bars.js +1 -1
- package/docs/component-contract.md +6 -7
- package/docs/component-selection.md +11 -19
- package/docs/design/sketch/Kerf-UI.sketch +0 -0
- package/docs/design/sketch/README.md +73 -0
- package/docs/design/sketch/advanced/README.md +75 -0
- package/docs/design/sketch/button/README.md +270 -0
- package/docs/design/sketch/content/README.md +70 -0
- package/docs/design/sketch/coverage.md +157 -0
- package/docs/design/sketch/forms/README.md +97 -0
- package/docs/design/sketch/lists/README.md +65 -0
- package/docs/design/sketch/toolbar/README.md +73 -0
- package/docs/design/sketch/unified/README.md +69 -0
- package/docs/design/sketch/unified/pages/advanced.png +0 -0
- package/docs/design/sketch/unified/pages/button.png +0 -0
- package/docs/design/sketch/unified/pages/content.png +0 -0
- package/docs/design/sketch/unified/pages/forms.png +0 -0
- package/docs/design/sketch/unified/pages/lists.png +0 -0
- package/docs/design/sketch/unified/pages/toolbar.png +0 -0
- package/docs/design/sketch-runner.md +87 -0
- package/docs/design/templates/list-header/action-dark.svg +1 -1
- package/docs/design/templates/list-header/action.svg +1 -1
- package/docs/design/templates/list-header/toggle-collapsed-dark.svg +1 -1
- package/docs/design/templates/list-header/toggle-collapsed.svg +1 -1
- package/docs/design/templates/list-header/toggle-expanded-dark.svg +1 -1
- package/docs/design/templates/list-header/toggle-expanded.svg +1 -1
- package/docs/design/templates/list-header-dark.svg +1 -1
- package/docs/design/templates/list-header.svg +1 -1
- package/docs/design/templates/tab-bar/workspace-tabs-dark.svg +1 -1
- package/docs/design/templates/tab-bar/workspace-tabs.svg +1 -1
- package/docs/design/templates/tab-bar-dark.svg +1 -1
- package/docs/design/templates/tab-bar.svg +1 -1
- package/docs/design/templates.md +9 -0
- package/docs/interaction-conventions.md +1 -1
- package/docs/layout.md +7 -6
- package/docs/ux-demo.md +1 -1
- package/llms.txt +3 -3
- package/package.json +17 -6
- package/dist/chunk-BSNKDW4X.js.map +0 -1
- package/dist/chunk-HJWFHJ3Z.js.map +0 -1
|
@@ -5314,11 +5314,11 @@
|
|
|
5314
5314
|
"category": "Navigation",
|
|
5315
5315
|
"kind": "component",
|
|
5316
5316
|
"source": "kerf",
|
|
5317
|
-
"description": "Roving-tabindex-ready tabs with typed compact, segmented, icon-only, drop-target,
|
|
5317
|
+
"description": "Roving-tabindex-ready tabs with typed compact, segmented, icon-only, drop-target, and name-overflow presentations.",
|
|
5318
5318
|
"uses": [
|
|
5319
5319
|
"lucide-icon"
|
|
5320
5320
|
],
|
|
5321
|
-
"purpose": "Render a controlled application tab with compact or icon-only presentation, a visible drop target, optional full-name display
|
|
5321
|
+
"purpose": "Render a controlled application tab with compact or icon-only presentation, a visible drop target, and optional full-name display.",
|
|
5322
5322
|
"publicExports": [
|
|
5323
5323
|
"TabBarItem"
|
|
5324
5324
|
],
|
|
@@ -5357,7 +5357,6 @@
|
|
|
5357
5357
|
"icon-only accessible presentation",
|
|
5358
5358
|
"label maximum width and ellipsis or visible name overflow",
|
|
5359
5359
|
"drop-target highlight",
|
|
5360
|
-
"pinned leading position within a scrolling tablist",
|
|
5361
5360
|
"attention name color",
|
|
5362
5361
|
"named disabled tab and explicit tab/panel association"
|
|
5363
5362
|
],
|
|
@@ -5396,8 +5395,6 @@
|
|
|
5396
5395
|
"--kui-tab-bar-item-drop-target-color",
|
|
5397
5396
|
"--kui-tab-bar-item-drop-target-ring",
|
|
5398
5397
|
"--kui-tab-bar-item-hover-background",
|
|
5399
|
-
"--kui-tab-bar-item-pinned-background",
|
|
5400
|
-
"--kui-tab-bar-item-pinned-hover-background",
|
|
5401
5398
|
"--kui-tab-bar-item-selected-background",
|
|
5402
5399
|
"--kui-tab-bar-item-selected-border",
|
|
5403
5400
|
"--kui-tab-bar-item-selected-color",
|
|
@@ -5481,7 +5478,7 @@
|
|
|
5481
5478
|
],
|
|
5482
5479
|
"accessibility": [
|
|
5483
5480
|
"Keep exactly one selected tab at tabindex 0 and preserve the wiring keyboard model.",
|
|
5484
|
-
"Call wireTabBars for keyboard focus
|
|
5481
|
+
"Call wireTabBars for keyboard focus, selection reveal, and whole-tab snapping; put fixed controls in the outer leading, trailing, or end zones."
|
|
5485
5482
|
],
|
|
5486
5483
|
"geometry": {
|
|
5487
5484
|
"margin": "none",
|
|
@@ -4444,8 +4444,6 @@
|
|
|
4444
4444
|
"--kui-tab-bar-item-drop-target-color",
|
|
4445
4445
|
"--kui-tab-bar-item-drop-target-ring",
|
|
4446
4446
|
"--kui-tab-bar-item-hover-background",
|
|
4447
|
-
"--kui-tab-bar-item-pinned-background",
|
|
4448
|
-
"--kui-tab-bar-item-pinned-hover-background",
|
|
4449
4447
|
"--kui-tab-bar-item-selected-background",
|
|
4450
4448
|
"--kui-tab-bar-item-selected-border",
|
|
4451
4449
|
"--kui-tab-bar-item-selected-color",
|
package/ai/components/README.md
CHANGED
|
@@ -57,7 +57,7 @@ Exact prop and callback types live in [`public-api-signatures-v1.md`](../public-
|
|
|
57
57
|
- [ListActionRow](./list-action-row.md) — Keep a selectable primary row action and an independently named trailing action as sibling native controls inside one noninteractive visual row.
|
|
58
58
|
- [ListItem](./list-item.md) — Selectable, disabled, trailing, and multiline action or link rows.
|
|
59
59
|
- [Application Tabs](./application-tabs.md) — Show TabBarItem and TabBar in a complete controlled composition.
|
|
60
|
-
- [TabBarItem](./tabs.md) — Render a controlled application tab with compact or icon-only presentation, a visible drop target, optional full-name display
|
|
60
|
+
- [TabBarItem](./tabs.md) — Render a controlled application tab with compact or icon-only presentation, a visible drop target, and optional full-name display.
|
|
61
61
|
- [TabBar](./tab-bar.md) — Controlled tab strips whose tabs shrink and scroll while fixed leading, trailing, and far-edge end actions remain visible.
|
|
62
62
|
|
|
63
63
|
## Kerf UI — Controls
|
package/ai/components/tabs.md
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
`@kerfjs/ui:tabs` · Kerf UI · component · Navigation
|
|
6
6
|
|
|
7
|
-
Roving-tabindex-ready tabs with typed compact, segmented, icon-only, drop-target,
|
|
7
|
+
Roving-tabindex-ready tabs with typed compact, segmented, icon-only, drop-target, and name-overflow presentations.
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
10
10
|
|
|
11
|
-
Render a controlled application tab with compact or icon-only presentation, a visible drop target, optional full-name display
|
|
11
|
+
Render a controlled application tab with compact or icon-only presentation, a visible drop target, and optional full-name display.
|
|
12
12
|
|
|
13
13
|
- Render one controlled application tab inside TabBar.
|
|
14
14
|
|
|
@@ -44,7 +44,6 @@ Exact prop names and types: [`@kerfjs/ui/tab-bar-item`](../public-api-signatures
|
|
|
44
44
|
- icon-only accessible presentation
|
|
45
45
|
- label maximum width and ellipsis or visible name overflow
|
|
46
46
|
- drop-target highlight
|
|
47
|
-
- pinned leading position within a scrolling tablist
|
|
48
47
|
- attention name color
|
|
49
48
|
- named disabled tab and explicit tab/panel association
|
|
50
49
|
|
|
@@ -86,7 +85,7 @@ Public class hooks (select for layout placement only, never to change the compon
|
|
|
86
85
|
|
|
87
86
|
Never put `kui-tab-bar-item`, `kui-tab-bar-item__close`, `kui-tab-bar-item__close-icon`, `kui-tab-bar-item__name`, `kui-tab-bar-item__select`, `kui-tab-bar-item__trailing` on an element you write; render `TabBarItem` instead (`KUI-L103`).
|
|
88
87
|
|
|
89
|
-
Public tokens it reads: `--kui-tab-bar-item-attention-color`, `--kui-tab-bar-item-color`, `--kui-tab-bar-item-drop-indicator`, `--kui-tab-bar-item-drop-target-background`, `--kui-tab-bar-item-drop-target-color`, `--kui-tab-bar-item-drop-target-ring`, `--kui-tab-bar-item-hover-background`, `--kui-tab-bar-item-
|
|
88
|
+
Public tokens it reads: `--kui-tab-bar-item-attention-color`, `--kui-tab-bar-item-color`, `--kui-tab-bar-item-drop-indicator`, `--kui-tab-bar-item-drop-target-background`, `--kui-tab-bar-item-drop-target-color`, `--kui-tab-bar-item-drop-target-ring`, `--kui-tab-bar-item-hover-background`, `--kui-tab-bar-item-selected-background`, `--kui-tab-bar-item-selected-border`, `--kui-tab-bar-item-selected-color`, `--kui-color-brand-border-normal`, `--kui-color-brand-on-quiet`, `--kui-color-neutral-border-normal`, `--kui-color-neutral-on-quiet`, `--kui-color-surface`, `--kui-color-text`, `--kui-focus-ring`, `--kui-font-xs`, `--kui-radius-pill`, `--kui-shadow-s`, `--kui-space-2xs`, `--kui-space-xs`. Set a token only where its public contract allows; prefer a prop.
|
|
90
89
|
|
|
91
90
|
Everything else is internal: `kerf-ui-analyze` reports private or unknown `.kui-*` selectors (`KUI-L001`, `KUI-L010`), unknown or private tokens (`KUI-L002`, `KUI-L012`), and any application rule that restyles the component, forced dimensions included (`KUI-L019`).
|
|
92
91
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Public API signatures for the UI authoring corpus
|
|
2
2
|
|
|
3
|
-
Generated from emitted declarations for `@kerfjs/ui@5.0.0-beta.
|
|
3
|
+
Generated from emitted declarations for `@kerfjs/ui@5.0.0-beta.123` and `kerfjs@5.0.0-beta.123`. This bounded reference covers only APIs used by the seven-task corpus. It is interface evidence, not an implementation or runtime guarantee.
|
|
4
4
|
|
|
5
5
|
## `@kerfjs/ui/css-values`
|
|
6
6
|
|
|
@@ -1435,7 +1435,6 @@ type TabBarItemRootAttributes = Readonly<Record<`data-${string}`, string | undef
|
|
|
1435
1435
|
'data-attention'?: never;
|
|
1436
1436
|
'data-drop-target'?: never;
|
|
1437
1437
|
'data-name-overflow'?: never;
|
|
1438
|
-
'data-pinned'?: never;
|
|
1439
1438
|
'data-disabled'?: never;
|
|
1440
1439
|
}>;
|
|
1441
1440
|
type TabBarItemPresentation = 'pill' | 'segmented' | 'icon-only';
|
|
@@ -1455,8 +1454,6 @@ interface TabBarItemProps {
|
|
|
1455
1454
|
attention?: boolean;
|
|
1456
1455
|
/** Highlight this tab as the target of a drag over its content. */
|
|
1457
1456
|
dropTarget?: boolean;
|
|
1458
|
-
/** Keep the leading tab visible within its TabBar tablist while peers scroll. */
|
|
1459
|
-
pinned?: boolean;
|
|
1460
1457
|
closable?: boolean;
|
|
1461
1458
|
draggable?: boolean;
|
|
1462
1459
|
leading?: KerfUiContent;
|
|
@@ -1491,7 +1488,7 @@ interface TabBarItemProps {
|
|
|
1491
1488
|
/** Native named-slot assignment when composed inside a web component. */
|
|
1492
1489
|
slot?: string;
|
|
1493
1490
|
}
|
|
1494
|
-
declare function TabBarItem({ id, name, selected, disabled, tabId, panelId, attention, dropTarget,
|
|
1491
|
+
declare function TabBarItem({ id, name, selected, disabled, tabId, panelId, attention, dropTarget, closable, draggable, leading, trailing, presentation, size, labelMaxWidth, nameOverflow, closeIcon, selectAction, closeAction, className, placeholder, pending, rootAttributes, slot, }: TabBarItemProps): SafeHtml;
|
|
1495
1492
|
|
|
1496
1493
|
export { TabBarItem, type TabBarItemNameOverflow, type TabBarItemPresentation, type TabBarItemProps, type TabBarItemSize };
|
|
1497
1494
|
```
|
|
@@ -1537,7 +1534,7 @@ interface TabBarProps {
|
|
|
1537
1534
|
iconOnlyAt?: TabBarIconOnlyAt;
|
|
1538
1535
|
/** Keep a trailing action beside the final tab or at the far edge of the bar. */
|
|
1539
1536
|
trailingPlacement?: TabBarTrailingPlacement;
|
|
1540
|
-
/** Settle scrolling peers at whole-tab starts;
|
|
1537
|
+
/** Settle scrolling peers at whole-tab starts; the first visible tab aligns with the strip edge. */
|
|
1541
1538
|
snapTabs?: boolean;
|
|
1542
1539
|
/** Native named-slot assignment when composed inside a web component. */
|
|
1543
1540
|
slot?: string;
|
package/ai/skill.md
CHANGED
|
@@ -408,13 +408,13 @@ Hard rules:
|
|
|
408
408
|
7. Decorative icons are hidden; controls are named; focus is visible; state never relies on color alone; reduced motion and increased contrast remain usable. When the app detects a low-power device, it sets `data-kui-effects="static"` on the root element to turn backdrop materials opaque and stop scroll-driven animations; `@media (update: slow)` does the same automatically. `DisclosureArrow` defaults to an 18px root-scaled visual; size it with its typed `size` prop (`size={remify(24)}`); it never becomes the interaction or accessible-name owner. Put it in an owning native control with a stable accessible name and controlled `aria-expanded`. `ListHeader` toggle mode supplies it when `actionIcon` is omitted, but the app must reveal matching content; a custom icon replaces it. Author replacement icon content facing right before its configured direction transform is applied. Direction changes take the shortest rotation path, with counterclockwise chosen for a 180-degree closed-to-open tie. Kerf `Select` separately keeps its intrinsic Web Awesome expand glyph at `--kui-disclosure-icon-scale: .5`; an icon-only toolbar Select may set `caret={false}` for a round trigger while preserving its help tag and keyboard listbox, and a custom `renderSelected` icon stays centered.
|
|
409
409
|
8. `ResizableRegion` uses `wireResizableRegions()` for Arrow, Shift+Arrow, Home/End, and pointer behavior. The app owns size persistence. `handleIcon` replaces decorative dormant glyph content only. Set `responsiveFillAt="narrow"` or `"compact"` when a responsive composition exposes the pane as its only inline track; the component fills that track and hides its dormant separator. For compact overlays, set `presentation="overlay"` and the overlay maximum variables. A lone child (normally a `Pane`) fills the region and owns scrolling; several children stack at natural height. Do not add descendant width/height overrides.
|
|
410
410
|
9. Use controlled `SegmentedControl` for a small exclusive choice set. Select `appearance="toolbar"` when nesting it inside `ToolbarControlGroup`; use rounded or pill shapes for standalone contexts. The package derives inset hover/selection radii from the owning outer shape through `--kui-layout-highlight-inset`; do not restyle an inner highlight to an independent radius. Handle its action, update `value`, keep meaningful choice labels, and preserve every enabled native button in sequential Tab order. Set `disabled` to make the whole control unavailable (its selection stays visible); a choice's own `disabled` disables just that segment.
|
|
411
|
-
10. Compose `TabBarItem` inside controlled `TabBar`; call `wireTabBars()` once and retain its disposer. It owns same-bar drag mechanics, including proximity-based horizontal edge autoscroll, while the app applies `onReorder` and owns order, selection, panels, close policy, routing, and persistence. For a tab-local action followed by a separately pinned workspace action, set `trailingPlacement="adjacent"`, put the local action in `trailing`, and the workspace action in `end`; each action zone accepts one `ToolbarControlGroup`, a standalone Kerf `Button`, or a standalone `wa-button` for an exceptional Web Awesome use. TabBar owns the shrinking/scrolling tabs and fixed action geometry, so do not add descendant flex overrides. Arrow/Home/End select on move by default and restore focus by bar/tab identity when controlled activation replaces the strip; pass `activation: 'manual'` (or `TabBar activation="manual"` per strip) so arrow keys move focus only and the user selects with Enter/Space/click — use it when selecting a tab is a heavy action. Use runtime-filtered `rootAttributes` for domain metadata and keep an optional `closeIcon` decorative and noninteractive.
|
|
411
|
+
10. Compose `TabBarItem` inside controlled `TabBar`; call `wireTabBars()` once and retain its disposer. It owns same-bar drag mechanics, including proximity-based horizontal edge autoscroll, while the app applies `onReorder` and owns order, selection, panels, close policy, routing, and persistence. For a tab-local action followed by a separately pinned workspace action, set `trailingPlacement="adjacent"`, put the local action in `trailing`, and the workspace action in `end`; each action zone accepts one `ToolbarControlGroup`, a standalone Kerf `Button`, or a standalone `wa-button` for an exceptional Web Awesome use. TabBar owns the shrinking/scrolling tabs and fixed action geometry, so do not add descendant flex overrides. Arrow/Home/End select on move by default and restore focus by bar/tab identity when controlled activation replaces the strip; pass `activation: 'manual'` (or `TabBar activation="manual"` per strip) so arrow keys move focus only and the user selects with Enter/Space/click — use it when selecting a tab is a heavy action. Put fixed controls in the outer `leading`, `trailing`, or `end` zones, outside the scrolling tablist. `snapTabs` aligns ordinary tabs with the strip edge in LTR and RTL. Use runtime-filtered `rootAttributes` for domain metadata and keep an optional `closeIcon` decorative and noninteractive.
|
|
412
412
|
11. Use token-controlled `SearchField` when free text and removable structured filters share one editor. Editable text stays DOM-owned between token changes; to replace the text programmatically (reseeding a persistent dialog's field on reopen, applying a saved search) change the field's `revision` along with `query` for an unmanaged field, or call `model.replace({ query, tokens })` for a model-managed field; never re-key a wrapper. The leading icon, first text line, clear action, and trailing slot share one fixed row when content wraps. For automatic parsing, chips, suggestions, and evaluation, use createSearchFieldModel with grammar rules, pass it as SearchField.model, and register it in wireSearchFields models; a rule's `suggest(input, state)` receives committed tokens so it can exclude selected values. The field subscribes only to `model.structure` (committed tokens, empty or non-empty text, editor revision), so plain typing never re-runs the host render; in the host's own render read `model.state.peek()` and bind `model.result` (or a `computed`) as a signal hole — reading `model.state.value` there re-renders the host on every keystroke. Otherwise the app owns parsing and suggestions; call `readSearchField()` on input, empty `textContent` on clear, use `placeSearchFieldCaret()` after explicit controlled focus changes, and call `wireSearchFields()` once so Enter submits without inserting a line break and keyboard chip deletion restores focus plus the text-relative caret after controlled replacement. `clearIcon` replaces the clear action's glyph (its `clearLabel` still names it). For a compact icon button beside the clear button (a search-syntax help glyph), pass `trailingAction: { icon, label, action, expanded?, pressed?, controls?, haspopup?, attributes? }` — it matches the clear button's size, hover, focus, and cursor in every presentation; set `expanded` for a disclosure or `pressed` for a toggle, never both, and never hand-style a button into `trailing`. Enable `collapsible` for an animated iconic closed state, standalone or inside `ToolbarControlGroup`; the field keeps text or tokens expanded, and `wireSearchFields()` manages the transient expand/collapse/focus by default (activate to reveal + focus, Escape or empty blur to collapse). Bind the field's `expanded` to the returned handle's `expanded(id)` signal or adopt your own via `collapsible.signals`; opt a behavior out only when the app must own it. Do not hand-roll the open handler, the focusout collapse, a clear-button mousedown guard, or reopening after controlled clear or Select All deletion — the helper keeps the replacement editor open and focused. Clear and deletion restoration finish at the replacement mutation checkpoint before the next input task, so shortcut-letter typing cannot escape to the page and delayed animation frames cannot overwrite a later selection. Persist both query and tokens returned by the DOM read. For real-app adoption it also provides a focusout keep-open exception (`data-search-field-keep-open` regions or `collapsible.keepOpenOn(target)`, so a sibling suggestions/date/help surface does not collapse an empty field), opt-in atomic-chip keyboard (`keyboard`: Backspace/Delete remove the adjacent chip via `onRemoveToken`, ArrowRight moves the caret past a trailing chip), and an `onEdit({id, editor, event})` input callback (the `InputEvent` lets you gate on `inputType`/`data`) — reach for these instead of re-adding hand-rolled keydown/input handlers around the field.
|
|
413
413
|
An application helper can call `model.commit(value)` for the active `name:` prefix when it computes a valid value outside suggestions; invalid values and missing prefixes leave the query unchanged.
|
|
414
414
|
12. Demo work uses public production component subpaths and their browser-selected CSS. Focused demos and recipes have no local stylesheet, inline style, or styling-only class; use public components and `CatalogExample.viewport` for unavoidable specimen constraints (a recipe declares its frame through its exported `presentation`). To preview a top-layer specimen that production anchors with CSS anchor positioning, name the frame with `viewport.anchorName` (a dashed-ident such as `"--app-shell-main"`) and center in-flow content with `viewport.contentWidth` + `contentAlign: "center"` instead of wrapping the specimen in a stage element. When a recipe needs a capability no component offers, report the component gap instead of adding CSS. Use exactly three demo kinds: a `component` is one component with variants/states, a `composition` is a focused container of components commonly used together, and a `recipe` is the recommended production approach to a task. Organize catalog routes into product-important functional groups; within each group put all components before compositions, order each kind by importance with display-name alphabetical tie-breaking, and put recipes after every component/composition group. Show `Composition` as an entry tag instead of repeating the word in its name. Give every public visual component its own category-grouped catalog route; list themed third-party components under a clearly labeled collapsible ecosystem section, with a focused route for each. For the complete taxonomy, focused/composition decision, `CatalogExample` / `CatalogExampleStack` row/group nesting, specimen structure and metadata ownership, follow the single [Catalog demo authoring contract](../docs/catalog.md#catalog-demo-authoring-contract), discovered machine-readably through [`catalog-authoring.json`](./catalog-authoring.json). Never infer structure from private `kui-catalog-*` classes. Project each component's deterministic repository-relative demo source and existing documentation path so the detail can expose `View demo source` and `Read guidance` links without a runtime export; also derive first-party component implementation paths from their canonical browser imports, and label Web Awesome documentation as Kerf integration guidance. Declare direct `uses` relationships so `Used by` stays derivable, and theme shell chrome through the same semantic tokens as the stage instead of drawing a substitute. Enable `wireCatalog({ revealSelection: true })` for long desktop sidebars so controlled selections remain visible without moving focus; keep its default compact media guard unless compact scrolling is an explicit product behavior, and use `revealCatalogEntry` for an initial deep link.
|
|
415
415
|
13. The Web Awesome theme makes Tooltip and Popover arrowless by default. Keep that default unless a pointer materially clarifies the anchor; opt back in with `--wa-tooltip-arrow-size`, `--kui-wa-popover-arrow-size`, or a popover's public `--arrow-size`, and use `without-arrow` when local no-arrow intent should survive theme changes. Its non-field chrome uses `--kui-wa-control-inset` (8px controls/items), `--kui-wa-surface-margin` / `--kui-wa-surface-inset` (8px around/inside Accordion, Card, Details, Callout, and Include), and `--kui-wa-container-inset` (16px Tab Panel content and framed disclosure regions). Plain Details use the 8px surface inset on the trigger and keep the body flush; plain Accordion items use it on both trigger and body. Outlined and sunken Details use the 16px container inset on the trigger and 8px on the body; framed Accordion items use 16px on both. Dialog maps its body to the 8px surface tier and its footer to the 16px container tier independently of `--spacing`. Override those tiers instead of restyling individual parts. Filled badges use each variant's quiet fill with normal text so their compact copy stays WCAG-AA readable; override the pair with `--kui-wa-badge-filled-background` / `--kui-wa-badge-filled-foreground`, not host selectors. The theme draws a dialog's or drawer's built-in close control as the same 40px borderless circle a single `ToolbarControlGroup` button uses, so do not restyle it. When a dialog provides another dismissal affordance, put `hide-actions` on the `wa-dialog` host to hide its directly exported `header-actions` part; never chain `::part()` selectors through internal parts. Checkbox and Radio Group option regions and the Color Picker trigger stay flush, so each box, circle, or swatch sits on the host's inline-start edge like Kerf's `Checkbox`, `RadioGroup`, and `ColorField`, with the label and hint on the 9px text column. Bordered fields and Switch draw their border or track on that same edge like `TextField`, `Select`, and `Switch`, so place a Web Awesome field exactly where the Kerf field would go. Slider's complete interactive region receives the shared 8px logical inline outer inset. Known Date field captions and bordered text-like field hints align with values at the 9px border-plus-padding inset. OTP Input's label uses the same uppercase xs/650 treatment as other field labels, and both its label and hint use that 9px inset.
|
|
416
416
|
14. Kerf UI needs no Web Awesome. Treat the Web Awesome catalog as optional integration coverage, not a recommendation list; its UX sidebar marks every element a Kerf component replaces `Discouraged`, and `../docs/webawesome-migration.md` maps each to its Kerf replacement. Use `openAnchoredSurface` from `@kerfjs/ui/anchored-surface` for arbitrary interactive help or popup content beside a control, or `openAnchoredSurfaceAt` at pointer coordinates; pass an accessible label and let the app own content/actions. For a popup anchored to dark media chrome (a `ToolbarControlGroup tone="dark"`), pass `tone: 'dark'` instead of styling an app-owned dark panel: the surface takes that group's inverse tone and its content (a `ListItem`, a `wa-slider`) inherits the inverse text, border, and focus colors. It stays interactive inside a native `<dialog>`, `wa-dialog`, or `wa-drawer` (no host markup needed for the Web Awesome ones) and closes with that dialog. In an integration application, consider Popup only when its lower-level behavior is specifically needed, and use Tree/Tree Item, Animated Image, and Comparison only for a specific required behavior; avoid Zoomable Frame. Never render a `Discouraged` element in application, demo, or recipe markup; use the Kerf component that replaces it (`Button`, `TextField`, `Checkbox`, `RadioGroup`, `Switch`, `Select`, `PopupMenu`, `DialogSurface`, `SegmentedControl`, `TabBar`, `Chip`, `Badge`, `LucideIcon`, `ResizableRegion`), and treat a Kerf component gap as a request to file, not a reason to drop to the raw element.
|
|
417
|
-
15. Build sidebars, main areas, inspectors, and dialogs by rendering `Pane` (`@kerfjs/ui/pane`): an unpadded `.kui-pane` root, an optional `header`, one scrolling `.kui-pane__content`, and an optional `footer`; pick landmarks with `element` / `contentElement`. Never write a component's anatomy classes (`kui-pane`, `kui-toolbar`, `kui-list-item`, …) onto your own element to recreate it — render the component (`KUI-L103`). Only the catalog's `placeableClasses` (the `.kui-content` / `.kui-scroll-owner` / `.kui-control-cluster` / `.kui-inline-metadata` layout utilities, `.kui-app-root`, and `.kui-content-item` geometry on a non-div carrier) belong on elements you write. Use `Row` instead of a hand-written flex-row wrapper, `List` instead of a hand-written flex-column wrapper, and `Grid` instead of repeated equal-track CSS when children need a fixed positive count of evenly distributed columns. `Row` defaults to left/full with an `xs` gap and no wrapping; Grid defaults to an `xs` gap and keeps each track at `minmax(0, 1fr)`; List retains full/top and zero-gap defaults. The app owns Grid's responsive column-count changes. When a Row, List, or Grid is the layout root of a definite-height parent (an app root or a fixed-height frame), pass `fill` so it takes that full height, and put route/test/recipe `data-*` markers in its `rootAttributes`; never wrap a layout in a frame `Pane` just for height or a root attribute, because its content slot becomes a scroll owner that never scrolls. Inside a flex layout use `flex`, not `fill`. Use `List` when rows or sections also need flex growth, one vertical scroll owner, or physical-edge dividers. `dividerSides`, `textInsets`, and `controlInsets` use canonical physical `t`/`r`/`b`/`l` order; text geometry wins where text and control selections overlap. `ListInsetText` and `ListInsetControl` inset all four sides by default and accept the same `sides` grammar for selective edges. A dialog body is generally a `List`: set `DialogSurface bodyInset="none"` when its list children own geometry, and wrap bare dialog prose in `ListInsetText` so it aligns with bordered siblings without a second inset. Add `.kui-content` for 24px major vertical separation and render each ordinary surface-like child as `ContentItem` (`@kerfjs/ui/content-item`) for a child-owned 8px inline margin, 1px border, 8px padding, and 12px radius. For a chat transcript, set `bubble="start"` (other participants) or `bubble="end"` with `appearance="brand-loud"` (the person's own messages) instead of app width, alignment, or color CSS; the item fits its message up to 80% of the row. Choose `frame="framed"` (neutral border in the always-reserved 1px, same geometry) only for a real distinction and `shape="pill"` for 22px; do not hand-write `<div class="kui-content-item">` or its modifier classes. There is no filled variant: a lowered filled surface is `SunkenPanel`. Do not pad pane shells, duplicate item geometry in wrappers, or create nested scroll owners. Align text to text and icons to icons across a pane — a title, a row label, and bare prose share the same text column (`ListInsetText` puts bare text on it); a border is decoration and never the alignment anchor, so a bordered surface extends to the pane gutter instead of being indented to line its border up with a heading's text.
|
|
417
|
+
15. Build sidebars, main areas, inspectors, and dialogs by rendering `Pane` (`@kerfjs/ui/pane`): an unpadded `.kui-pane` root, an optional `header`, one scrolling `.kui-pane__content`, and an optional `footer`; pick landmarks with `element` / `contentElement`. Never write a component's anatomy classes (`kui-pane`, `kui-toolbar`, `kui-list-item`, …) onto your own element to recreate it — render the component (`KUI-L103`). Only the catalog's `placeableClasses` (the `.kui-content` / `.kui-scroll-owner` / `.kui-control-cluster` / `.kui-inline-metadata` layout utilities, `.kui-app-root`, and `.kui-content-item` geometry on a non-div carrier) belong on elements you write. Use `Row` instead of a hand-written flex-row wrapper, `List` instead of a hand-written flex-column wrapper, and `Grid` instead of repeated equal-track CSS when children need a fixed positive count of evenly distributed columns. `Row` defaults to left/full with an `xs` gap and no wrapping; Grid defaults to an `xs` gap and keeps each track at `minmax(0, 1fr)`; List retains full/top and zero-gap defaults. The app owns Grid's responsive column-count changes. When a Row, List, or Grid is the layout root of a definite-height parent (an app root or a fixed-height frame), pass `fill` so it takes that full height, and put route/test/recipe `data-*` markers in its `rootAttributes`; never wrap a layout in a frame `Pane` just for height or a root attribute, because its content slot becomes a scroll owner that never scrolls. Inside a flex layout use `flex`, not `fill`. Use `List` when rows or sections also need flex growth, one vertical scroll owner, or physical-edge dividers. `dividerSides`, `textInsets`, and `controlInsets` use canonical physical `t`/`r`/`b`/`l` order; text geometry wins where text and control selections overlap. `ListInsetText` and `ListInsetControl` inset all four sides by default and accept the same `sides` grammar for selective edges. A dialog body is generally a `List`: set `DialogSurface bodyInset="none"` when its list children own geometry, and wrap bare dialog prose in `ListInsetText` so it aligns with bordered siblings without a second inset. Add `.kui-content` for 24px major vertical separation and render each ordinary surface-like child as `ContentItem` (`@kerfjs/ui/content-item`) for a child-owned 8px inline margin, 1px border, 8px padding, and 12px radius. For a chat transcript, set `bubble="start"` (other participants) or `bubble="end"` with `appearance="brand-loud"` (the person's own messages) instead of app width, alignment, or color CSS; the item fits its message up to 80% of the row. Choose `frame="framed"` (neutral border in the always-reserved 1px, same geometry) only for a real distinction and `shape="pill"` for 22px; do not hand-write `<div class="kui-content-item">` or its modifier classes. There is no filled variant: a lowered filled surface is `SunkenPanel`. Do not pad pane shells, duplicate item geometry in wrappers, or create nested scroll owners. Align text to text and icons to icons across a pane — a title, a row label, and bare prose share the same text column (`ListInsetText` puts bare text on it); a border is decoration and never the alignment anchor, so a bordered surface extends to the pane gutter instead of being indented to line its border up with a heading's text; bordered elements in one column instead align their outer edges with each other (a `ListHeader` action ends on a selected `ListItem`'s edge), and a borderless nested glyph aligns with their nested content.
|
|
418
418
|
15a. Use `Text` from `@kerfjs/ui/text` for ordinary headings, paragraphs, and inline secondary text outside toolbar title zones. Omit `variant` for the default `p`, pass `h1`–`h6` according to the document outline, or use `variant="span"` inside a row, label, or table cell; ordinary native attributes pass through. Express supporting, error, compact, or code text with the independent finite `tone="quiet|danger"`, `size="compact"`, and `font="monospace"` props instead of global utility classes or appearance-only heading choices. Block Text variants own a transparent 1px border and the standard item padding; `span` owns no box geometry. Keep toolbar identity/title content on `ToolbarText` and list-aligned bare prose on `ListInsetText`. `ToolbarText` below `xlarge` is intentionally quiet identity text in default tone; a normal-color subsection title is `Text` with an `h2`–`h6` variant (or `ListHeader` for a list or menu section), never a recolored `ToolbarText`. Use `controlMargins` with canonical physical Sides for an exterior 8px control gutter without a Row wrapper; avoid stacking parent insets, and remember spans retain native inline margin behavior.
|
|
419
419
|
|
|
420
420
|
16. Keep a visible collapsible pane's collapse control in its own toolbar. When hidden, move its restore control into the adjacent main toolbar on the corresponding logical edge: leading for an inline-start sidebar and trailing for an inline-end inspector. Collapse the pane completely; do not preserve an empty icon-only rail.
|
|
@@ -483,7 +483,7 @@ For application tabs, `TabBarItem presentation="icon-only"` retains its accessib
|
|
|
483
483
|
|
|
484
484
|
Set `TabBarItem dropTarget` while content is dragged over a tab to highlight the target without changing selection. Use `nameOverflow="visible"` for an inline loading treatment that needs the full visible name; the default is an ellipsis.
|
|
485
485
|
|
|
486
|
-
|
|
486
|
+
Put fixed controls in TabBar's `leading`, `trailing`, or `end` zones outside the scrolling tablist. Use `snapTabs` for whole-tab settling at the strip edge; individual tabs have no pinned positioning mode.
|
|
487
487
|
|
|
488
488
|
Use `--kui-resizable-region-background` for a region surface and `contentOverflow="visible"` while its anchored popup needs to escape. Choose a top or bottom `restorePosition`, typed `restoreInset`, or `restorePlacement="inline"` for its collapsed restore control. `FloatingToolbar placement="inline"` stays in normal flow; its per-edge inset tokens and `safeAreaInsets` configure floating placement.
|
|
489
489
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Web Awesome JSX signatures for the UI authoring corpus
|
|
2
2
|
|
|
3
|
-
Generated from the emitted `@kerfjs/ui@5.0.0-beta.
|
|
3
|
+
Generated from the emitted `@kerfjs/ui@5.0.0-beta.123` declaration boundary. Import `@kerfjs/ui/webawesome` for type effects when authoring direct `wa-*` JSX. The module emits no runtime behavior and does not register custom elements.
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
import { KerfCustomElement } from 'kerfjs/jsx-runtime';
|
|
@@ -13,7 +13,6 @@ var PROTECTED_ROOT_DATA_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
13
13
|
"data-attention",
|
|
14
14
|
"data-drop-target",
|
|
15
15
|
"data-name-overflow",
|
|
16
|
-
"data-pinned",
|
|
17
16
|
"data-disabled"
|
|
18
17
|
]);
|
|
19
18
|
function CloseIcon() {
|
|
@@ -42,7 +41,6 @@ function TabBarItem({
|
|
|
42
41
|
panelId,
|
|
43
42
|
attention = false,
|
|
44
43
|
dropTarget = false,
|
|
45
|
-
pinned = false,
|
|
46
44
|
closable = true,
|
|
47
45
|
draggable = false,
|
|
48
46
|
leading,
|
|
@@ -82,7 +80,6 @@ function TabBarItem({
|
|
|
82
80
|
"data-selected": String(selected),
|
|
83
81
|
"data-attention": attention ? "true" : void 0,
|
|
84
82
|
"data-drop-target": dropTarget ? "true" : void 0,
|
|
85
|
-
"data-pinned": pinned ? "true" : void 0,
|
|
86
83
|
"data-name-overflow": nameOverflow,
|
|
87
84
|
"data-presentation": presentation,
|
|
88
85
|
"data-size": size,
|
|
@@ -144,4 +141,4 @@ function TabBarItem({
|
|
|
144
141
|
|
|
145
142
|
export { TabBarItem };
|
|
146
143
|
|
|
147
|
-
//# sourceMappingURL=chunk-
|
|
144
|
+
//# sourceMappingURL=chunk-ROEBKSIY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/navigation/tab-bar-item/tab-bar-item.tsx"],"names":[],"mappings":";;;;;AAOA,IAAM,8BAAA,uBAAqC,GAAA,CAAI;AAAA,EAC7C,gBAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,eAAA;AAAA,EACA,mBAAA;AAAA,EACA,wBAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,oBAAA;AAAA,EACA;AACF,CAAC,CAAA;AAsED,SAAS,SAAA,GAAY;AACnB,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAY,MAAA;AAAA,MACZ,OAAA,EAAQ,WAAA;AAAA,MACR,IAAA,EAAK,MAAA;AAAA,MACL,MAAA,EAAO,cAAA;AAAA,MACP,cAAA,EAAa,MAAA;AAAA,MACb,gBAAA,EAAe,OAAA;AAAA,MAEf,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,GAAE,YAAA,EAAa,CAAA;AAAA,wBACrB,GAAA,CAAC,MAAA,EAAA,EAAK,CAAA,EAAE,YAAA,EAAa;AAAA;AAAA;AAAA,GACvB;AAEJ;AAEO,SAAS,UAAA,CAAW;AAAA,EACzB,EAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA,GAAW,KAAA;AAA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AAA,YACC,IAAA,EAAK,QAAA;AAAA,YACL,KAAA,EAAM,0BAAA;AAAA,YACN,IAAA,EAAK,KAAA;AAAA,YACL,EAAA,EAAI,KAAA;AAAA,YACJ,eAAA,EAAe,OAAA;AAAA,YACf,eAAA,EAAe,OAAO,QAAQ,CAAA;AAAA,YAC9B,YAAA,EAAY,YAAA,KAAiB,WAAA,IAAe,KAAA,GAAQ,IAAA,GAAO,MAAA;AAAA,YAC3D,qBAAmB,YAAA,IAAgB,MAAA;AAAA,YACnC,aAAA,EAAa,cAAc,MAAA,GAAY,YAAA;AAAA,YACvC,aAAA,EAAa,EAAA;AAAA,YACb,UAAU,WAAA,IAAe,MAAA;AAAA,YACzB,QAAA,EAAU,CAAC,WAAA,IAAe,QAAA,GAAW,GAAA,GAAM,IAAA;AAAA,YAE1C,QAAA,EAAA;AAAA,cAAA,OAAA;AAAA,8BACD,GAAA;AAAA,gBAAC,MAAA;AAAA,gBAAA;AAAA,kBACC,KAAA,EAAM,wBAAA;AAAA,kBACN,aAAA,EAAa,YAAA,KAAiB,WAAA,GAAc,MAAA,GAAS,MAAA;AAAA,kBAEpD,wCAAc,GAAA,CAAC,QAAA,EAAA,EAAS,OAAO,EAAA,CAAG,CAAC,GAAG,CAAA,GAAK;AAAA;AAAA,eAC9C;AAAA,cACC,YAAY,QAAA,mBACX,GAAA,CAAC,UAAK,KAAA,EAAM,4BAAA,EAA8B,oBAAS,CAAA,GACjD;AAAA;AAAA;AAAA;AACN;AAAA;AAAA,GACF;AAEJ","file":"chunk-ROEBKSIY.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 { em } from '../../../shared/styles/css-values.js';\nimport { Skeleton } from '../../feedback/skeleton/skeleton.js';\n\nconst PROTECTED_ROOT_DATA_ATTRIBUTES = new Set([\n 'data-component',\n 'data-action',\n 'data-tab-id',\n 'data-selected',\n 'data-tab-dragging',\n 'data-tab-drop-position',\n 'data-attention',\n 'data-drop-target',\n 'data-name-overflow',\n 'data-disabled',\n]);\n\ntype TabBarItemRootAttributes = Readonly<\n Record<`data-${string}`, string | undefined> & {\n 'data-component'?: never;\n 'data-action'?: never;\n 'data-tab-id'?: never;\n 'data-selected'?: never;\n 'data-tab-dragging'?: never;\n 'data-tab-drop-position'?: never;\n 'data-attention'?: never;\n 'data-drop-target'?: never;\n 'data-name-overflow'?: never;\n 'data-disabled'?: never;\n }\n>;\n\nexport type TabBarItemPresentation = 'pill' | 'segmented' | 'icon-only';\nexport type TabBarItemSize = 'default' | 'compact';\nexport type TabBarItemNameOverflow = 'ellipsis' | 'visible';\n\nexport interface TabBarItemProps {\n id: string;\n name: string;\n selected?: boolean;\n /** Keep the visible name while excluding the tab from selection, focus, closing, and reordering. */\n disabled?: boolean;\n /** DOM ID of the role=tab button, for an application-owned tabpanel's aria-labelledby. */\n tabId?: string;\n /** DOM ID of the application-owned tabpanel controlled by this tab. */\n panelId?: string;\n /** Emphasize the visible tab name with the attention color token. */\n attention?: boolean;\n /** Highlight this tab as the target of a drag over its content. */\n dropTarget?: boolean;\n closable?: boolean;\n draggable?: boolean;\n leading?: KerfUiContent;\n trailing?: KerfUiContent;\n /** Visual treatment within a TabBar. Icon-only tabs retain `name` as their accessible name. */\n presentation?: TabBarItemPresentation;\n /** Compact tabs use the 32px application-rail height. */\n size?: TabBarItemSize;\n /** Maximum visible label width in CSS pixels before ellipsis. */\n labelMaxWidth?: number;\n /** Keep the full name visible for an inline loading treatment. */\n nameOverflow?: TabBarItemNameOverflow;\n /** Decorative dormant content for the close button. Must not contain interactive descendants. */\n closeIcon?: SafeHtml;\n selectAction?: string;\n closeAction?: string;\n className?: string;\n /** Render as an unanimated loading skeleton, disabling select/close and dragging. */\n placeholder?: boolean;\n /**\n * Named and still opening: the tab is known but its content is loading.\n * Keeps `name` visible in the quiet text color and as the tab's accessible\n * name, shows `trailing` (for example a `LoadingSpinner`), and marks the\n * tab `aria-busy`. Unlike `placeholder` it stays selectable — the\n * application shows placeholder content in its panel until loading\n * completes — while close and dragging stay disabled. Same pill geometry\n * as the live tab, so swapping it in place does not shift the bar.\n * `placeholder` wins when both are set.\n */\n pending?: boolean;\n rootAttributes?: TabBarItemRootAttributes;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\nfunction CloseIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2.25\"\n stroke-linecap=\"round\"\n >\n <path d=\"m7 7 10 10\" />\n <path d=\"M17 7 7 17\" />\n </svg>\n );\n}\n\nexport function TabBarItem({\n id,\n name,\n selected = false,\n disabled = false,\n tabId,\n panelId,\n attention = false,\n dropTarget = false,\n closable = true,\n draggable = false,\n leading,\n trailing,\n presentation = 'pill',\n size = 'default',\n labelMaxWidth,\n nameOverflow = 'ellipsis',\n closeIcon,\n selectAction = 'select-tab',\n closeAction = 'close-tab',\n className = '',\n placeholder = false,\n pending = false,\n rootAttributes = {},\n slot,\n}: TabBarItemProps) {\n // Both loading states disable close and dragging; a `placeholder` (unknown\n // tab) is also unselectable and hides its name, while a `pending` (known,\n // still opening) tab stays selectable so its panel can show placeholders.\n const dormant = placeholder || pending;\n const unavailable = disabled || placeholder;\n const closeUnavailable = disabled || dormant;\n const named = pending && !placeholder;\n const keyshortcuts = [\n closable && !closeUnavailable ? 'Delete Backspace' : '',\n draggable && !closeUnavailable\n ? 'Alt+Shift+ArrowLeft Alt+Shift+ArrowRight'\n : '',\n ]\n .filter(Boolean)\n .join(' ');\n const extensionAttributes = filterDataAttributes(\n rootAttributes,\n PROTECTED_ROOT_DATA_ATTRIBUTES,\n );\n return (\n <div\n {...extensionAttributes}\n class={`kui-tab-bar-item ${className}`.trim()}\n data-component=\"tab-bar-item\"\n data-tab-id={id}\n data-selected={String(selected)}\n data-attention={attention ? 'true' : undefined}\n data-drop-target={dropTarget ? 'true' : undefined}\n data-name-overflow={nameOverflow}\n data-presentation={presentation}\n data-size={size}\n data-placeholder={placeholder ? 'true' : undefined}\n data-pending={named ? 'true' : undefined}\n data-disabled={disabled ? 'true' : undefined}\n draggable={closeUnavailable ? 'false' : draggable ? 'true' : 'false'}\n aria-busy={dormant ? 'true' : undefined}\n style={\n labelMaxWidth === undefined\n ? undefined\n : `--kui-tab-bar-item-label-max-width:${labelMaxWidth}px`\n }\n slot={slot}\n >\n {closable && (\n <button\n type=\"button\"\n tabindex=\"-1\"\n class=\"kui-tab-bar-item__close\"\n data-action={closeUnavailable ? undefined : closeAction}\n data-tab-id={id}\n disabled={closeUnavailable || undefined}\n aria-label={`Close ${name}`}\n title={`Close ${name}`}\n >\n <span class=\"kui-tab-bar-item__close-icon\" aria-hidden=\"true\">\n {closeIcon ?? <CloseIcon />}\n </span>\n </button>\n )}\n <button\n type=\"button\"\n class=\"kui-tab-bar-item__select\"\n role=\"tab\"\n id={tabId}\n aria-controls={panelId}\n aria-selected={String(selected)}\n aria-label={presentation === 'icon-only' || named ? name : undefined}\n aria-keyshortcuts={keyshortcuts || undefined}\n data-action={unavailable ? undefined : selectAction}\n data-tab-id={id}\n disabled={unavailable || undefined}\n tabindex={!unavailable && selected ? '0' : '-1'}\n >\n {leading}\n <span\n class=\"kui-tab-bar-item__name\"\n aria-hidden={presentation === 'icon-only' ? 'true' : undefined}\n >\n {placeholder ? <Skeleton width={em(7)} /> : name}\n </span>\n {closable || trailing ? (\n <span class=\"kui-tab-bar-item__trailing\">{trailing}</span>\n ) : undefined}\n </button>\n </div>\n );\n}\n"]}
|
|
@@ -40,8 +40,6 @@ function tabsIn(bar) {
|
|
|
40
40
|
}
|
|
41
41
|
function reveal(tab) {
|
|
42
42
|
tab?.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
43
|
-
if (tab?.closest("[data-kui-tab-list]")?.querySelector(':scope > .kui-tab-bar-item[data-pinned="true"]'))
|
|
44
|
-
revealInStrip(tab);
|
|
45
43
|
}
|
|
46
44
|
function revealInStrip(tab) {
|
|
47
45
|
const strip = tab.closest("[data-kui-tab-list]");
|
|
@@ -49,20 +47,15 @@ function revealInStrip(tab) {
|
|
|
49
47
|
const bounds = strip.getBoundingClientRect();
|
|
50
48
|
const snap = strip.dataset.snapTabs === "true";
|
|
51
49
|
const box = snap ? tab.closest(".kui-tab-bar-item")?.getBoundingClientRect() ?? tab.getBoundingClientRect() : tab.getBoundingClientRect();
|
|
52
|
-
const pinned = strip.querySelector(
|
|
53
|
-
':scope > .kui-tab-bar-item[data-pinned="true"]'
|
|
54
|
-
);
|
|
55
|
-
if (pinned?.contains(tab)) return;
|
|
56
|
-
const pinnedBox = pinned?.getBoundingClientRect();
|
|
57
50
|
if (strip.ownerDocument.defaultView?.getComputedStyle(strip).direction === "rtl") {
|
|
58
|
-
const right =
|
|
51
|
+
const right = bounds.right;
|
|
59
52
|
if (snap) strip.scrollLeft += box.right - right;
|
|
60
53
|
else if (box.right > right) strip.scrollLeft += box.right - right;
|
|
61
54
|
else if (box.left < bounds.left)
|
|
62
55
|
strip.scrollLeft -= Math.min(bounds.left - box.left, right - box.right);
|
|
63
56
|
return;
|
|
64
57
|
}
|
|
65
|
-
const left =
|
|
58
|
+
const left = bounds.left;
|
|
66
59
|
if (snap) strip.scrollLeft += box.left - left;
|
|
67
60
|
else if (box.left < left) strip.scrollLeft -= left - box.left;
|
|
68
61
|
else if (box.right > bounds.right)
|
|
@@ -106,8 +99,6 @@ function touchedBars(records) {
|
|
|
106
99
|
function wireTabBars(root, { onReorder, activation = "automatic" }) {
|
|
107
100
|
const ownerDocument = root.nodeType === 9 ? root : root.ownerDocument;
|
|
108
101
|
const view = ownerDocument.defaultView;
|
|
109
|
-
const pinnedOffsets = /* @__PURE__ */ new WeakMap();
|
|
110
|
-
const adjustedPinned = /* @__PURE__ */ new Set();
|
|
111
102
|
const snapExtras = /* @__PURE__ */ new WeakMap();
|
|
112
103
|
const snapStrips = /* @__PURE__ */ new Set();
|
|
113
104
|
const snapObserved = /* @__PURE__ */ new Set();
|
|
@@ -119,30 +110,22 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
|
|
|
119
110
|
if (!disposed) syncSnapInRoot();
|
|
120
111
|
});
|
|
121
112
|
};
|
|
122
|
-
const pinnedObserved = /* @__PURE__ */ new Set();
|
|
123
113
|
const resizeObserver = view.ResizeObserver ? new view.ResizeObserver((entries) => {
|
|
124
114
|
if (disposed) return;
|
|
125
115
|
let snap = false;
|
|
126
116
|
for (const { target } of entries) {
|
|
127
|
-
if (pinnedObserved.has(target))
|
|
128
|
-
syncPinned(target);
|
|
129
117
|
if (snapObserved.has(target)) snap = true;
|
|
130
118
|
}
|
|
131
119
|
if (snap) scheduleSnapSync();
|
|
132
120
|
}) : void 0;
|
|
133
|
-
const observe = (element) => {
|
|
134
|
-
if (!snapObserved.has(element) && !pinnedObserved.has(element))
|
|
135
|
-
resizeObserver?.observe(element);
|
|
136
|
-
};
|
|
137
121
|
const observeSnap = (element) => {
|
|
138
122
|
if (snapObserved.has(element)) return;
|
|
139
|
-
observe(element);
|
|
123
|
+
resizeObserver?.observe(element);
|
|
140
124
|
snapObserved.add(element);
|
|
141
125
|
};
|
|
142
126
|
const syncSnap = (strip) => {
|
|
143
127
|
const previousExtra = snapExtras.get(strip) ?? 0;
|
|
144
128
|
if (strip.dataset.snapTabs !== "true") {
|
|
145
|
-
strip.style.removeProperty("--kui-tab-bar-snap-inset");
|
|
146
129
|
strip.style.removeProperty("--kui-tab-bar-snap-end-extra");
|
|
147
130
|
snapExtras.delete(strip);
|
|
148
131
|
snapStrips.delete(strip);
|
|
@@ -154,26 +137,17 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
|
|
|
154
137
|
...strip.querySelectorAll(":scope > .kui-tab-bar-item")
|
|
155
138
|
];
|
|
156
139
|
tabs.forEach(observeSnap);
|
|
157
|
-
const pinned = tabs.find(
|
|
158
|
-
(candidate) => candidate.dataset.pinned === "true"
|
|
159
|
-
);
|
|
160
140
|
const last = tabs.at(-1);
|
|
161
141
|
const bounds = strip.getBoundingClientRect();
|
|
162
|
-
const pinnedBox = pinned?.getBoundingClientRect();
|
|
163
142
|
const rtl = view.getComputedStyle(strip).direction === "rtl";
|
|
164
|
-
const inset = pinnedBox ? rtl ? bounds.right - pinnedBox.left : pinnedBox.right - bounds.left : 0;
|
|
165
|
-
strip.style.setProperty(
|
|
166
|
-
"--kui-tab-bar-snap-inset",
|
|
167
|
-
`${Math.max(0, inset)}px`
|
|
168
|
-
);
|
|
169
143
|
const baseMaximum = Math.max(
|
|
170
144
|
0,
|
|
171
145
|
strip.scrollWidth - strip.clientWidth - previousExtra
|
|
172
146
|
);
|
|
173
147
|
let extra = 0;
|
|
174
|
-
if (baseMaximum > 0 && last
|
|
148
|
+
if (baseMaximum > 0 && last) {
|
|
175
149
|
const lastBox = last.getBoundingClientRect();
|
|
176
|
-
const desired = rtl ? -(strip.scrollLeft + lastBox.right -
|
|
150
|
+
const desired = rtl ? -(strip.scrollLeft + lastBox.right - bounds.right) : strip.scrollLeft + lastBox.left - bounds.left;
|
|
177
151
|
extra = Math.max(0, desired - baseMaximum);
|
|
178
152
|
}
|
|
179
153
|
if (Math.abs(extra - previousExtra) >= 0.5) {
|
|
@@ -183,15 +157,13 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
|
|
|
183
157
|
}
|
|
184
158
|
};
|
|
185
159
|
const releaseDetached = () => {
|
|
186
|
-
for (const element of
|
|
160
|
+
for (const element of snapObserved)
|
|
187
161
|
if (!root.contains(element)) {
|
|
188
162
|
resizeObserver?.unobserve(element);
|
|
189
|
-
pinnedObserved.delete(element);
|
|
190
163
|
snapObserved.delete(element);
|
|
191
164
|
}
|
|
192
165
|
for (const strip of snapStrips)
|
|
193
166
|
if (!root.contains(strip)) {
|
|
194
|
-
strip.style.removeProperty("--kui-tab-bar-snap-inset");
|
|
195
167
|
strip.style.removeProperty("--kui-tab-bar-snap-end-extra");
|
|
196
168
|
snapStrips.delete(strip);
|
|
197
169
|
}
|
|
@@ -200,53 +172,17 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
|
|
|
200
172
|
releaseDetached();
|
|
201
173
|
root.querySelectorAll(TAB_LIST).forEach(syncSnap);
|
|
202
174
|
};
|
|
203
|
-
const syncPinned = (strip) => {
|
|
204
|
-
const pinned = strip.querySelector(
|
|
205
|
-
':scope > .kui-tab-bar-item[data-pinned="true"]'
|
|
206
|
-
);
|
|
207
|
-
if (!pinned) return;
|
|
208
|
-
if (!pinnedObserved.has(strip)) {
|
|
209
|
-
observe(strip);
|
|
210
|
-
pinnedObserved.add(strip);
|
|
211
|
-
}
|
|
212
|
-
const previous = pinned.style.translate ? pinnedOffsets.get(pinned) ?? 0 : 0;
|
|
213
|
-
const style = view.getComputedStyle(strip);
|
|
214
|
-
if (style.direction !== "rtl" || strip.scrollWidth <= strip.clientWidth) {
|
|
215
|
-
if (previous !== 0) pinned.style.translate = "";
|
|
216
|
-
pinnedOffsets.set(pinned, 0);
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
const targetRight = strip.getBoundingClientRect().right - (Number.parseFloat(style.borderRightWidth) || 0) - (Number.parseFloat(style.paddingRight) || 0);
|
|
220
|
-
const rawRight = pinned.getBoundingClientRect().right - previous;
|
|
221
|
-
const delta = targetRight - rawRight;
|
|
222
|
-
const next = Math.abs(delta) < 0.5 ? 0 : delta;
|
|
223
|
-
if (next !== previous) pinned.style.translate = next ? `${next}px 0` : "";
|
|
224
|
-
pinnedOffsets.set(pinned, next);
|
|
225
|
-
adjustedPinned.add(pinned);
|
|
226
|
-
};
|
|
227
|
-
const syncPinnedInRoot = () => root.querySelectorAll("[data-kui-tab-list]").forEach(syncPinned);
|
|
228
|
-
const onStripScroll = (event) => {
|
|
229
|
-
const target = event.target;
|
|
230
|
-
if (target instanceof HTMLElement && target.matches("[data-kui-tab-list]"))
|
|
231
|
-
syncPinned(target);
|
|
232
|
-
};
|
|
233
175
|
const onStripScrollEnd = (event) => {
|
|
234
176
|
const strip = event.target;
|
|
235
177
|
if (!(strip instanceof HTMLElement) || !strip.matches('[data-kui-tab-list][data-snap-tabs="true"]') || Math.abs(strip.scrollLeft) < 0.5)
|
|
236
178
|
return;
|
|
237
179
|
const peers = [
|
|
238
|
-
...strip.querySelectorAll(
|
|
239
|
-
':scope > .kui-tab-bar-item:not([data-pinned="true"])'
|
|
240
|
-
)
|
|
180
|
+
...strip.querySelectorAll(":scope > .kui-tab-bar-item")
|
|
241
181
|
];
|
|
242
182
|
if (!peers.length) return;
|
|
243
183
|
const bounds = strip.getBoundingClientRect();
|
|
244
|
-
const pinned = strip.querySelector(
|
|
245
|
-
':scope > .kui-tab-bar-item[data-pinned="true"]'
|
|
246
|
-
);
|
|
247
|
-
const pinnedBox = pinned?.getBoundingClientRect();
|
|
248
184
|
const rtl = view.getComputedStyle(strip).direction === "rtl";
|
|
249
|
-
const edge = rtl ?
|
|
185
|
+
const edge = rtl ? bounds.right : bounds.left;
|
|
250
186
|
const distances = peers.map((peer) => {
|
|
251
187
|
const box = peer.getBoundingClientRect();
|
|
252
188
|
return rtl ? box.right - edge : box.left - edge;
|
|
@@ -481,7 +417,6 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
|
|
|
481
417
|
root.addEventListener("dragend", clear);
|
|
482
418
|
root.addEventListener("keydown", onKeyDown);
|
|
483
419
|
root.addEventListener("focusin", onFocusIn);
|
|
484
|
-
root.addEventListener("scroll", onStripScroll, true);
|
|
485
420
|
root.addEventListener("scrollend", onStripScrollEnd, true);
|
|
486
421
|
syncSnapInRoot();
|
|
487
422
|
root.querySelectorAll(
|
|
@@ -502,7 +437,6 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
|
|
|
502
437
|
return changed;
|
|
503
438
|
};
|
|
504
439
|
recordSelection([root]);
|
|
505
|
-
syncPinnedInRoot();
|
|
506
440
|
const selectionObserver = new view.MutationObserver((records) => {
|
|
507
441
|
if (disposed) return;
|
|
508
442
|
if (records.some((record) => record.removedNodes.length)) releaseDetached();
|
|
@@ -514,22 +448,19 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
|
|
|
514
448
|
strips.forEach(syncSnap);
|
|
515
449
|
for (const button of recordSelection(bars))
|
|
516
450
|
if (ownerDocument.activeElement !== button) revealInStrip(button);
|
|
517
|
-
strips.forEach(syncPinned);
|
|
518
451
|
});
|
|
519
452
|
selectionObserver.observe(root, {
|
|
520
453
|
subtree: true,
|
|
521
454
|
childList: true,
|
|
522
455
|
attributes: true,
|
|
523
|
-
attributeFilter: ["aria-selected", "dir", "data-snap-tabs"
|
|
456
|
+
attributeFilter: ["aria-selected", "dir", "data-snap-tabs"]
|
|
524
457
|
});
|
|
525
458
|
return () => {
|
|
526
459
|
disposed = true;
|
|
527
460
|
if (snapFrame !== void 0) view.cancelAnimationFrame(snapFrame);
|
|
528
461
|
selectionObserver.disconnect();
|
|
529
462
|
resizeObserver?.disconnect();
|
|
530
|
-
pinnedObserved.clear();
|
|
531
463
|
for (const strip of snapStrips) {
|
|
532
|
-
strip.style.removeProperty("--kui-tab-bar-snap-inset");
|
|
533
464
|
strip.style.removeProperty("--kui-tab-bar-snap-end-extra");
|
|
534
465
|
}
|
|
535
466
|
snapStrips.clear();
|
|
@@ -541,13 +472,10 @@ function wireTabBars(root, { onReorder, activation = "automatic" }) {
|
|
|
541
472
|
root.removeEventListener("dragend", clear);
|
|
542
473
|
root.removeEventListener("keydown", onKeyDown);
|
|
543
474
|
root.removeEventListener("focusin", onFocusIn);
|
|
544
|
-
root.removeEventListener("scroll", onStripScroll, true);
|
|
545
475
|
root.removeEventListener("scrollend", onStripScrollEnd, true);
|
|
546
|
-
for (const pinned of adjustedPinned) pinned.style.translate = "";
|
|
547
|
-
adjustedPinned.clear();
|
|
548
476
|
};
|
|
549
477
|
}
|
|
550
478
|
|
|
551
479
|
export { reorderTabs, wireTabBars };
|
|
552
480
|
|
|
553
|
-
//# sourceMappingURL=chunk-
|
|
481
|
+
//# sourceMappingURL=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AAA;AAED,EAAA,OAAO,MAAM;AACX,IAAA,QAAA,GAAW,IAAA;AACX,IAAA,IAAI,SAAA,KAAc,MAAA,EAAW,IAAA,CAAK,oBAAA,CAAqB,SAAS,CAAA;AAChE,IAAA,iBAAA,CAAkB,UAAA,EAAW;AAC7B,IAAA,cAAA,EAAgB,UAAA,EAAW;AAC3B,IAAA,KAAA,MAAW,SAAS,UAAA,EAAY;AAC9B,MAAA,KAAA,CAAM,KAAA,CAAM,eAAe,8BAA8B,CAAA;AAAA,IAC3D;AACA,IAAA,UAAA,CAAW,KAAA,EAAM;AACjB,IAAA,YAAA,CAAa,KAAA,EAAM;AACnB,IAAA,KAAA,EAAM;AACN,IAAA,IAAA,CAAK,mBAAA,CAAoB,aAAa,WAAW,CAAA;AACjD,IAAA,IAAA,CAAK,mBAAA,CAAoB,YAAY,UAAU,CAAA;AAC/C,IAAA,IAAA,CAAK,mBAAA,CAAoB,QAAQ,MAAM,CAAA;AACvC,IAAA,IAAA,CAAK,mBAAA,CAAoB,WAAW,KAAK,CAAA;AACzC,IAAA,IAAA,CAAK,mBAAA,CAAoB,WAAW,SAAS,CAAA;AAC7C,IAAA,IAAA,CAAK,mBAAA,CAAoB,WAAW,SAAS,CAAA;AAC7C,IAAA,IAAA,CAAK,mBAAA,CAAoB,WAAA,EAAa,gBAAA,EAAkB,IAAI,CAAA;AAAA,EAC9D,CAAA;AACF","file":"chunk-WPP5Q4A5.js","sourcesContent":["import type { TabActivation } from '../tab-bar.js';\n\nexport type TabReorderSource = 'pointer' | 'keyboard';\nexport type TabDropPosition = 'before' | 'after';\n\nexport interface TabReorder {\n barId: string;\n sourceId: string;\n targetId: string;\n position: TabDropPosition;\n source: TabReorderSource;\n}\n\nexport type { TabActivation } from '../tab-bar.js';\n\nexport interface WireTabBarsOptions {\n onReorder: (change: TabReorder) => void;\n /**\n * How arrow / Home / End keys activate tabs (default `'automatic'`):\n * - `'automatic'` moves roving focus **and** selects the focused tab (clicks it).\n * - `'manual'` moves roving focus only; the user selects with Enter / Space / click\n * (the ARIA Tabs manual-activation pattern). Use this when activation is a heavy or\n * side-effecting action (e.g. a tab that loads a project) so arrowing through the\n * strip doesn't trigger it on every tab.\n *\n * A per-bar `data-tab-activation=\"manual\" | \"automatic\"` attribute (see the `TabBar`\n * `activation` prop) overrides this option for that strip.\n */\n activation?: TabActivation;\n}\n\ntype TabRoot = HTMLElement;\ntype TabBarRoot = HTMLElement;\n\nconst AUTO_SCROLL_EDGE_PX = 56;\nconst AUTO_SCROLL_MIN_PX_PER_SECOND = 180;\nconst AUTO_SCROLL_MAX_PX_PER_SECOND = 900;\n\nexport function reorderTabs<T>(\n items: readonly T[],\n getId: (item: T) => string,\n sourceId: string,\n targetId: string,\n position: TabDropPosition,\n): T[] {\n if (sourceId === targetId) return [...items];\n const source = items.find((item) => getId(item) === sourceId);\n if (!source || !items.some((item) => getId(item) === targetId))\n return [...items];\n const remaining = items.filter((item) => getId(item) !== sourceId);\n const targetIndex = remaining.findIndex((item) => getId(item) === targetId);\n remaining.splice(targetIndex + (position === 'after' ? 1 : 0), 0, source);\n return remaining;\n}\n\nfunction tabRoot(target: EventTarget | null): TabRoot | undefined {\n return target instanceof Element\n ? (target.closest<TabRoot>('[data-component=\"tab-bar-item\"]') ?? undefined)\n : undefined;\n}\n\nfunction tabBar(tab: TabRoot): TabBarRoot | undefined {\n return tab.closest<TabBarRoot>('[data-component=\"tab-bar\"]') ?? undefined;\n}\n\nfunction tabId(tab: TabRoot): string | undefined {\n return tab.dataset.tabId || undefined;\n}\n\nfunction tabEnabled(tab: TabRoot): boolean {\n return (\n tab.querySelector<HTMLButtonElement>('[role=\"tab\"]')?.disabled === false\n );\n}\n\nfunction barId(bar: TabBarRoot): string | undefined {\n return bar.dataset.tabBarId || undefined;\n}\n\nfunction positionFor(event: DragEvent, tab: TabRoot): TabDropPosition {\n const bounds = tab.getBoundingClientRect();\n return event.clientX < bounds.left + bounds.width / 2 ? 'before' : 'after';\n}\n\nfunction tabsIn(bar: TabBarRoot): HTMLButtonElement[] {\n return [\n ...bar.querySelectorAll<HTMLButtonElement>(\n '[data-kui-tab-list] [role=\"tab\"]:not(:disabled)',\n ),\n ];\n}\n\nfunction reveal(tab: HTMLElement | null | undefined): void {\n tab?.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n}\n\n/**\n * Scroll a tab's own strip, and nothing else, so the tab is fully visible.\n * Used for selection changes the application makes without focus (adding and\n * selecting a tab): unlike `scrollIntoView`, it never scrolls the page to a\n * bar that is out of view.\n */\nfunction revealInStrip(tab: HTMLElement): void {\n const strip = tab.closest<HTMLElement>('[data-kui-tab-list]');\n if (!strip || strip.scrollWidth <= strip.clientWidth) return;\n const bounds = strip.getBoundingClientRect();\n const snap = strip.dataset.snapTabs === 'true';\n const box = snap\n ? (tab.closest<HTMLElement>('.kui-tab-bar-item')?.getBoundingClientRect() ??\n tab.getBoundingClientRect())\n : tab.getBoundingClientRect();\n if (\n strip.ownerDocument.defaultView?.getComputedStyle(strip).direction === 'rtl'\n ) {\n const right = bounds.right;\n if (snap) strip.scrollLeft += box.right - right;\n else if (box.right > right) strip.scrollLeft += box.right - right;\n else if (box.left < bounds.left)\n strip.scrollLeft -= Math.min(bounds.left - box.left, right - box.right);\n return;\n }\n const left = bounds.left;\n if (snap) strip.scrollLeft += box.left - left;\n else if (box.left < left) strip.scrollLeft -= left - box.left;\n else if (box.right > bounds.right)\n strip.scrollLeft += Math.min(box.right - bounds.right, box.left - left);\n}\n\nconst TAB_BAR = '[data-component=\"tab-bar\"]';\nconst TAB_LIST = '[data-kui-tab-list]';\n\n/** The selected tab button of every bar below each scope, keyed by bar. */\nfunction selectedTabs(scopes: Iterable<ParentNode>) {\n const selected = new Map<TabBarRoot, HTMLElement>();\n for (const scope of scopes)\n scope\n .querySelectorAll<HTMLElement>(\n `${TAB_LIST} [role=\"tab\"][aria-selected=\"true\"]`,\n )\n .forEach((button) => {\n const tab = tabRoot(button);\n const bar = tab && tabBar(tab);\n if (bar && !selected.has(bar)) selected.set(bar, button);\n });\n return selected;\n}\n\n/** `node` itself when it matches `selector`, plus its matching descendants. */\nfunction selfAndBelow<T extends Element>(node: Node, selector: string): T[] {\n if (!(node instanceof Element)) return [];\n const found = [...node.querySelectorAll<T>(selector)];\n if (node.matches(selector)) found.unshift(node as T);\n return found;\n}\n\n/**\n * The tab bars a batch of mutation records can have changed. A mutation\n * inside a bar touches that bar; an inserted subtree touches the bars it\n * brings; a `dir` change touches every bar below its element. Mutations\n * elsewhere in the root — terminal output, list morphs, streamed content —\n * touch nothing and cost one `closest` per record.\n */\nfunction touchedBars(records: readonly MutationRecord[]) {\n const bars = new Set<TabBarRoot>();\n for (const record of records) {\n const target =\n record.target instanceof Element\n ? record.target\n : record.target.parentElement;\n const owner = target?.closest<TabBarRoot>(TAB_BAR);\n if (owner) bars.add(owner);\n else if (record.attributeName === 'dir' && target)\n for (const bar of selfAndBelow<TabBarRoot>(target, TAB_BAR))\n bars.add(bar);\n record.addedNodes.forEach((node) => {\n for (const bar of selfAndBelow<TabBarRoot>(node, TAB_BAR)) bars.add(bar);\n });\n }\n return bars;\n}\n\n/** Wire reordering and keyboard navigation while leaving controlled state in the application. */\nexport function wireTabBars(\n root: HTMLElement | Document,\n { onReorder, activation = 'automatic' }: WireTabBarsOptions,\n): () => void {\n const ownerDocument = (\n root.nodeType === 9 ? (root as Document) : root.ownerDocument\n )!;\n const view = ownerDocument.defaultView!;\n const snapExtras = new WeakMap<HTMLElement, number>();\n const snapStrips = new Set<HTMLElement>();\n const snapObserved = new Set<HTMLElement>();\n let snapFrame: number | undefined;\n const scheduleSnapSync = () => {\n if (disposed || snapFrame !== undefined) return;\n snapFrame = view.requestAnimationFrame(() => {\n snapFrame = undefined;\n if (!disposed) syncSnapInRoot();\n });\n };\n const resizeObserver = view.ResizeObserver\n ? new view.ResizeObserver((entries: ResizeObserverEntry[]) => {\n if (disposed) return;\n let snap = false;\n for (const { target } of entries) {\n if (snapObserved.has(target as HTMLElement)) snap = true;\n }\n if (snap) scheduleSnapSync();\n })\n : undefined;\n const observeSnap = (element: HTMLElement) => {\n if (snapObserved.has(element)) return;\n resizeObserver?.observe(element);\n snapObserved.add(element);\n };\n const syncSnap = (strip: HTMLElement) => {\n const previousExtra = snapExtras.get(strip) ?? 0;\n if (strip.dataset.snapTabs !== 'true') {\n strip.style.removeProperty('--kui-tab-bar-snap-end-extra');\n snapExtras.delete(strip);\n snapStrips.delete(strip);\n return;\n }\n snapStrips.add(strip);\n observeSnap(strip);\n const tabs = [\n ...strip.querySelectorAll<HTMLElement>(':scope > .kui-tab-bar-item'),\n ];\n tabs.forEach(observeSnap);\n const last = tabs.at(-1);\n const bounds = strip.getBoundingClientRect();\n const rtl = view.getComputedStyle(strip).direction === 'rtl';\n const baseMaximum = Math.max(\n 0,\n strip.scrollWidth - strip.clientWidth - previousExtra,\n );\n let extra = 0;\n if (baseMaximum > 0 && last) {\n const lastBox = last.getBoundingClientRect();\n const desired = rtl\n ? -(strip.scrollLeft + lastBox.right - bounds.right)\n : strip.scrollLeft + lastBox.left - bounds.left;\n extra = Math.max(0, desired - baseMaximum);\n }\n if (Math.abs(extra - previousExtra) >= 0.5) {\n strip.style.setProperty('--kui-tab-bar-snap-end-extra', `${extra}px`);\n snapExtras.set(strip, extra);\n // The room is scroll content after the last tab, so writing it never\n // resizes the strip and no ResizeObserver notification follows. A room\n // measured during layout is re-measured next frame until it holds.\n scheduleSnapSync();\n }\n };\n /** Release observers and inline geometry of strips that left the root. */\n const releaseDetached = () => {\n for (const element of snapObserved)\n if (!root.contains(element)) {\n resizeObserver?.unobserve(element);\n snapObserved.delete(element);\n }\n for (const strip of snapStrips)\n if (!root.contains(strip)) {\n strip.style.removeProperty('--kui-tab-bar-snap-end-extra');\n snapStrips.delete(strip);\n }\n };\n const syncSnapInRoot = () => {\n releaseDetached();\n root.querySelectorAll<HTMLElement>(TAB_LIST).forEach(syncSnap);\n };\n // CSS snap settles direct gestures in most engines. WebKit can leave a\n // programmatic smooth scroll between snap points, so normalize its final\n // position to the nearest whole tab at the strip edge.\n const onStripScrollEnd = (event: Event) => {\n const strip = event.target;\n if (\n !(strip instanceof HTMLElement) ||\n !strip.matches('[data-kui-tab-list][data-snap-tabs=\"true\"]') ||\n Math.abs(strip.scrollLeft) < 0.5\n )\n return;\n const peers = [\n ...strip.querySelectorAll<HTMLElement>(':scope > .kui-tab-bar-item'),\n ];\n if (!peers.length) return;\n const bounds = strip.getBoundingClientRect();\n const rtl = view.getComputedStyle(strip).direction === 'rtl';\n const edge = rtl ? bounds.right : bounds.left;\n const distances = peers.map((peer) => {\n const box = peer.getBoundingClientRect();\n return rtl ? box.right - edge : box.left - edge;\n });\n const closest = distances.reduce((best, distance) =>\n Math.abs(distance) < Math.abs(best) ? distance : best,\n );\n if (Math.abs(closest) > 0.5) strip.scrollLeft += closest;\n };\n let autoScroll:\n | {\n strip: HTMLElement;\n velocity: number;\n frame: number | undefined;\n previousTime: number | undefined;\n }\n | undefined;\n const stopAutoScroll = () => {\n if (!autoScroll) return;\n if (autoScroll.frame !== undefined)\n view.cancelAnimationFrame(autoScroll.frame);\n delete autoScroll.strip.dataset.tabAutoscroll;\n autoScroll = undefined;\n };\n const runAutoScroll = (time: number) => {\n const current = autoScroll;\n if (!current) return;\n current.frame = undefined;\n const elapsed =\n current.previousTime === undefined\n ? 1000 / 60\n : Math.min(40, Math.max(1, time - current.previousTime));\n current.previousTime = time;\n const maximum = Math.max(\n 0,\n current.strip.scrollWidth - current.strip.clientWidth,\n );\n const previous = current.strip.scrollLeft;\n current.strip.scrollLeft = Math.max(\n 0,\n Math.min(maximum, previous + (current.velocity * elapsed) / 1000),\n );\n if (current.strip.scrollLeft === previous) {\n stopAutoScroll();\n return;\n }\n current.frame = view.requestAnimationFrame(runAutoScroll);\n };\n const updateAutoScroll = (event: DragEvent, strip: HTMLElement) => {\n if (strip.scrollWidth <= strip.clientWidth) {\n stopAutoScroll();\n return;\n }\n const bounds = strip.getBoundingClientRect();\n const edge = Math.min(AUTO_SCROLL_EDGE_PX, bounds.width / 3);\n const startDistance = event.clientX - bounds.left;\n const endDistance = bounds.right - event.clientX;\n let direction = 0;\n let strength = 0;\n if (startDistance >= 0 && startDistance < edge) {\n direction = -1;\n strength = 1 - startDistance / edge;\n } else if (endDistance >= 0 && endDistance < edge) {\n direction = 1;\n strength = 1 - endDistance / edge;\n }\n if (direction === 0) {\n stopAutoScroll();\n return;\n }\n const maximum = Math.max(0, strip.scrollWidth - strip.clientWidth);\n if (\n (direction < 0 && strip.scrollLeft <= 0) ||\n (direction > 0 && strip.scrollLeft >= maximum)\n ) {\n stopAutoScroll();\n return;\n }\n const speed =\n AUTO_SCROLL_MIN_PX_PER_SECOND +\n (AUTO_SCROLL_MAX_PX_PER_SECOND - AUTO_SCROLL_MIN_PX_PER_SECOND) *\n strength *\n strength;\n if (autoScroll?.strip !== strip) stopAutoScroll();\n autoScroll ??= {\n strip,\n velocity: 0,\n frame: undefined,\n previousTime: undefined,\n };\n autoScroll.velocity = direction * speed;\n strip.dataset.tabAutoscroll = direction < 0 ? 'start' : 'end';\n autoScroll.frame ??= view.requestAnimationFrame(runAutoScroll);\n };\n let dragged: { barId: string; tabId: string; tab: TabRoot } | undefined;\n const clearDropPositions = () =>\n root\n .querySelectorAll<HTMLElement>('[data-tab-drop-position]')\n .forEach((tab) => delete tab.dataset.tabDropPosition);\n const clear = () => {\n stopAutoScroll();\n dragged = undefined;\n root\n .querySelectorAll<HTMLElement>(\n '[data-tab-dragging], [data-tab-drop-position]',\n )\n .forEach((tab) => {\n delete tab.dataset.tabDragging;\n delete tab.dataset.tabDropPosition;\n });\n };\n let disposed = false;\n const afterControlledRender = (sourceBarId: string, sourceTabId: string) =>\n globalThis.queueMicrotask(() => {\n if (disposed) return;\n const tab = [\n ...root.querySelectorAll<TabRoot>('[data-component=\"tab-bar-item\"]'),\n ].find((candidate) => {\n const candidateBar = tabBar(candidate);\n return (\n tabId(candidate) === sourceTabId &&\n candidateBar !== undefined &&\n barId(candidateBar) === sourceBarId\n );\n });\n const button = tab?.querySelector<HTMLButtonElement>('[role=\"tab\"]');\n if (button && !button.disabled) {\n button.focus();\n reveal(button);\n }\n });\n\n const onDragStart = (event: Event) => {\n const dragEvent = event as DragEvent;\n const tab = tabRoot(event.target);\n const bar = tab && tabBar(tab);\n const sourceId = tab && tabId(tab);\n const sourceBarId = bar && barId(bar);\n if (\n !tab ||\n !tabEnabled(tab) ||\n tab.getAttribute('draggable') !== 'true' ||\n !sourceId ||\n !sourceBarId\n )\n return;\n dragged = { barId: sourceBarId, tabId: sourceId, tab };\n tab.dataset.tabDragging = 'true';\n if (dragEvent.dataTransfer) {\n dragEvent.dataTransfer.effectAllowed = 'move';\n dragEvent.dataTransfer.setData(\n 'application/x-kerf-tab',\n `${sourceBarId}:${sourceId}`,\n );\n }\n };\n const onDragOver = (event: Event) => {\n const dragEvent = event as DragEvent;\n const tab = tabRoot(event.target);\n const bar =\n event.target instanceof Element\n ? (event.target.closest<TabBarRoot>('[data-component=\"tab-bar\"]') ??\n undefined)\n : undefined;\n const targetId = tab && tabId(tab);\n const targetBarId = bar && barId(bar);\n if (!dragged || !bar || targetBarId !== dragged.barId) {\n stopAutoScroll();\n clearDropPositions();\n return;\n }\n dragEvent.preventDefault();\n const strip = bar.querySelector<HTMLElement>('[data-kui-tab-list]');\n if (strip) updateAutoScroll(dragEvent, strip);\n else stopAutoScroll();\n clearDropPositions();\n if (!tab || !tabEnabled(tab) || !targetId || targetId === dragged.tabId)\n return;\n tab.dataset.tabDropPosition = positionFor(dragEvent, tab);\n if (dragEvent.dataTransfer) dragEvent.dataTransfer.dropEffect = 'move';\n };\n const onDrop = (event: Event) => {\n const dragEvent = event as DragEvent;\n const tab = tabRoot(event.target);\n const bar = tab && tabBar(tab);\n const targetId = tab && tabId(tab);\n const targetBarId = bar && barId(bar);\n if (\n !dragged ||\n !dragged.tab.isConnected ||\n !tabEnabled(dragged.tab) ||\n !tab ||\n !tabEnabled(tab) ||\n !targetId ||\n targetId === dragged.tabId ||\n targetBarId !== dragged.barId\n ) {\n clear();\n return;\n }\n dragEvent.preventDefault();\n const change: TabReorder = {\n barId: dragged.barId,\n sourceId: dragged.tabId,\n targetId,\n position: positionFor(dragEvent, tab),\n source: 'pointer',\n };\n clear();\n onReorder(change);\n afterControlledRender(change.barId, change.sourceId);\n };\n const onKeyDown = (event: Event) => {\n const keyboardEvent = event as KeyboardEvent;\n const button =\n event.target instanceof Element\n ? event.target.closest<HTMLButtonElement>('[role=\"tab\"]')\n : null;\n const tab = button && tabRoot(button);\n const bar = tab && tabBar(tab);\n if (!button || button.disabled || !tab || !bar) return;\n if (keyboardEvent.key === 'Delete' || keyboardEvent.key === 'Backspace') {\n const close = tab.querySelector<HTMLButtonElement>(\n '.kui-tab-bar-item__close',\n );\n if (!close) return;\n keyboardEvent.preventDefault();\n close.click();\n return;\n }\n const tabs = tabsIn(bar);\n const current = tabs.indexOf(button);\n if (current < 0) return;\n if (\n keyboardEvent.altKey &&\n keyboardEvent.shiftKey &&\n (keyboardEvent.key === 'ArrowLeft' || keyboardEvent.key === 'ArrowRight')\n ) {\n const target =\n tabs[current + (keyboardEvent.key === 'ArrowLeft' ? -1 : 1)];\n const sourceId = tabId(tab);\n const targetRoot = target && tabRoot(target);\n const targetId = targetRoot && tabId(targetRoot);\n const sourceBarId = barId(bar);\n if (\n !target ||\n !sourceId ||\n !targetId ||\n !sourceBarId ||\n tab.getAttribute('draggable') !== 'true'\n )\n return;\n keyboardEvent.preventDefault();\n onReorder({\n barId: sourceBarId,\n sourceId,\n targetId,\n position: keyboardEvent.key === 'ArrowLeft' ? 'before' : 'after',\n source: 'keyboard',\n });\n afterControlledRender(sourceBarId, sourceId);\n return;\n }\n let next: number | undefined;\n if (keyboardEvent.key === 'ArrowRight') next = (current + 1) % tabs.length;\n else if (keyboardEvent.key === 'ArrowLeft')\n next = (current - 1 + tabs.length) % tabs.length;\n else if (keyboardEvent.key === 'Home') next = 0;\n else if (keyboardEvent.key === 'End') next = tabs.length - 1;\n if (next === undefined) return;\n keyboardEvent.preventDefault();\n // A per-bar data-tab-activation attribute overrides the wireTabBars option.\n const perBar = bar.dataset.tabActivation;\n const mode: TabActivation =\n perBar === 'manual' || perBar === 'automatic' ? perBar : activation;\n const target = tabs[next]!;\n target.focus();\n // Manual activation moves roving focus only; the user selects with Enter / Space\n // (native on the tab <button>) or click. Automatic also selects the focused tab.\n if (mode === 'automatic') {\n target.click();\n // Activation can synchronously replace the controlled strip. Resolve the\n // logical tab again after rendering instead of leaving focus on a dead node.\n if (!target.isConnected)\n afterControlledRender(\n bar.dataset.tabBarId!,\n tabRoot(target)!.dataset.tabId!,\n );\n }\n reveal(target);\n };\n const onFocusIn = (event: Event) => {\n const tab =\n event.target instanceof HTMLElement &&\n event.target.matches('[role=\"tab\"]')\n ? event.target\n : undefined;\n reveal(tab);\n };\n\n root.addEventListener('dragstart', onDragStart);\n root.addEventListener('dragover', onDragOver);\n root.addEventListener('drop', onDrop);\n root.addEventListener('dragend', clear);\n root.addEventListener('keydown', onKeyDown);\n root.addEventListener('focusin', onFocusIn);\n root.addEventListener('scrollend', onStripScrollEnd, true);\n syncSnapInRoot();\n root\n .querySelectorAll<HTMLElement>(\n '[data-kui-tab-list] [role=\"tab\"][aria-selected=\"true\"]',\n )\n .forEach(reveal);\n\n // Reveal a tab the application selects without focus (for example a tab it\n // adds and selects) once its controlled render lands. Only a change of a\n // bar's selected tab reveals, so a re-render that keeps the selection never\n // pulls a strip the user scrolled back to it.\n const selectedIds = new Map<string, string>();\n const recordSelection = (scopes: Iterable<ParentNode>) => {\n const changed: HTMLElement[] = [];\n for (const [bar, button] of selectedTabs(scopes)) {\n const id = barId(bar);\n const tab = tabRoot(button);\n const selectedId = tab && tabId(tab);\n if (!id || !selectedId) continue;\n if (selectedIds.has(id) && selectedIds.get(id) !== selectedId)\n changed.push(button);\n selectedIds.set(id, selectedId);\n }\n return changed;\n };\n recordSelection([root]);\n // Only the bars the records touched are re-measured: this observer watches\n // the whole application root, so most of its batches are unrelated content.\n const selectionObserver = new view.MutationObserver((records) => {\n if (disposed) return;\n // A removal anywhere may have taken a strip with it; releasing walks only\n // the few strips and tabs this wiring tracks.\n if (records.some((record) => record.removedNodes.length)) releaseDetached();\n const bars = touchedBars(records);\n if (!bars.size) return;\n const strips = [...bars].flatMap((bar) =>\n selfAndBelow<HTMLElement>(bar, TAB_LIST),\n );\n strips.forEach(syncSnap);\n for (const button of recordSelection(bars))\n if (ownerDocument.activeElement !== button) revealInStrip(button);\n });\n selectionObserver.observe(root, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['aria-selected', 'dir', 'data-snap-tabs'],\n });\n\n return () => {\n disposed = true;\n if (snapFrame !== undefined) view.cancelAnimationFrame(snapFrame);\n selectionObserver.disconnect();\n resizeObserver?.disconnect();\n for (const strip of snapStrips) {\n strip.style.removeProperty('--kui-tab-bar-snap-end-extra');\n }\n snapStrips.clear();\n snapObserved.clear();\n clear();\n root.removeEventListener('dragstart', onDragStart);\n root.removeEventListener('dragover', onDragOver);\n root.removeEventListener('drop', onDrop);\n root.removeEventListener('dragend', clear);\n root.removeEventListener('keydown', onKeyDown);\n root.removeEventListener('focusin', onFocusIn);\n root.removeEventListener('scrollend', onStripScrollEnd, true);\n };\n}\n"]}
|