@kerfjs/ui 5.0.0-beta.126 → 5.0.0-beta.127

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.
Files changed (51) hide show
  1. package/ai/component-props.json +20 -0
  2. package/ai/public-api-signatures-v1.md +7 -5
  3. package/ai/webawesome-jsx-signatures-v1.md +1 -1
  4. package/dist/browser/editor.js +3 -1
  5. package/dist/{chunk-NR3ZO4LK.js → chunk-7U65KLDL.js} +1 -1
  6. package/dist/chunk-7U65KLDL.js.map +1 -0
  7. package/dist/chunk-BMOZSNDU.js +133 -0
  8. package/dist/chunk-BMOZSNDU.js.map +1 -0
  9. package/dist/chunk-GHV36C6I.js +94 -0
  10. package/dist/chunk-GHV36C6I.js.map +1 -0
  11. package/dist/{chunk-Z3BT2SZE.js → chunk-GQUDCWOD.js} +8 -2
  12. package/dist/chunk-GQUDCWOD.js.map +1 -0
  13. package/dist/{chunk-3SCGTP5O.js → chunk-HD7ZLISK.js} +137 -11
  14. package/dist/chunk-HD7ZLISK.js.map +1 -0
  15. package/dist/column-explorer.d.ts +1 -1
  16. package/dist/column-explorer.js +16 -138
  17. package/dist/column-explorer.js.map +1 -1
  18. package/dist/editor.js +838 -115
  19. package/dist/editor.js.map +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/list-detail-dialog.js +1 -1
  22. package/dist/styles/components/surfaces/editor-frame/editor-frame.css +8 -1
  23. package/dist/styles/components/surfaces/surface-scaffold/surface-scaffold.css +32 -0
  24. package/dist/styles/editor/editor.css +23 -0
  25. package/dist/styles/editor-frame.css +8 -1
  26. package/dist/styles/surface-scaffold.css +32 -0
  27. package/dist/surface-scaffold.d.ts +3 -1
  28. package/dist/surface-scaffold.js +1 -1
  29. package/dist/tree-list.d.ts +2 -2
  30. package/dist/tree-list.js +2 -2
  31. package/dist/{tree-rows-eHnnGLGM.d.ts → tree-rows-Bms5QJvG.d.ts} +3 -0
  32. package/dist/wire-column-explorer.js +1 -92
  33. package/dist/wire-column-explorer.js.map +1 -1
  34. package/dist/workbench-dialog.js +1 -1
  35. package/docs/view.md +19 -0
  36. package/package.json +4 -2
  37. package/ux-demo/recipes/app-shell.tsx +48 -141
  38. package/ux-demo/recipes/collapsible-sidebar.tsx +43 -169
  39. package/ux-demo/recipes/compact-toolbar.tsx +22 -114
  40. package/ux-demo/recipes/composer-form.tsx +14 -104
  41. package/ux-demo/recipes/list-detail-dialog.tsx +38 -84
  42. package/ux-demo/recipes/list-workspace-states.tsx +29 -152
  43. package/ux-demo/recipes/loading-inspector.tsx +30 -174
  44. package/ux-demo/recipes/media-detail.tsx +29 -146
  45. package/ux-demo/recipes/navigation-sidebar.tsx +24 -113
  46. package/ux-demo/recipes/navigation-stack.tsx +7 -43
  47. package/ux-demo/recipes/workspace-header.tsx +2 -66
  48. package/view/generate.mjs +34 -14
  49. package/dist/chunk-3SCGTP5O.js.map +0 -1
  50. package/dist/chunk-NR3ZO4LK.js.map +0 -1
  51. package/dist/chunk-Z3BT2SZE.js.map +0 -1
@@ -164,7 +164,9 @@ var PINNABLE_POPOVER_PROTECTED = /* @__PURE__ */ new Set([
164
164
  "data-max-height",
165
165
  "data-body-layout",
166
166
  "data-pinned",
167
- "data-placed"
167
+ "data-placed",
168
+ "data-scrolled",
169
+ "data-resize-from-bottom"
168
170
  ]);
169
171
  var DEFAULT_MOVE_DESCRIPTION = "Drag the title or press the arrow keys to move it; hold Shift to move farther. Moving it pins it.";
170
172
  function PinnablePopoverSurface({
@@ -181,6 +183,7 @@ function PinnablePopoverSurface({
181
183
  maxHeight,
182
184
  viewportGutter,
183
185
  bodyLayout = "flow",
186
+ resizeFromBottom = false,
184
187
  pinLabel = "Pin",
185
188
  closeLabel = "Close",
186
189
  moveDescription = DEFAULT_MOVE_DESCRIPTION,
@@ -207,6 +210,7 @@ function PinnablePopoverSurface({
207
210
  "data-height": height === void 0 ? void 0 : "",
208
211
  "data-max-height": maxHeight === void 0 ? void 0 : "",
209
212
  "data-body-layout": bodyLayout === "flow" ? void 0 : bodyLayout,
213
+ "data-resize-from-bottom": resizeFromBottom ? "" : void 0,
210
214
  "data-pinned": pinned ? "" : void 0,
211
215
  popover: overlay ? "manual" : void 0,
212
216
  role: "dialog",
@@ -252,7 +256,16 @@ function PinnablePopoverSurface({
252
256
  )
253
257
  ] })
254
258
  ] }),
255
- /* @__PURE__ */ jsx("div", { class: "kui-pinnable-popover-surface__body", children })
259
+ /* @__PURE__ */ jsx("div", { class: "kui-pinnable-popover-surface__body", children }),
260
+ resizeFromBottom && overlay ? /* @__PURE__ */ jsx(
261
+ "button",
262
+ {
263
+ type: "button",
264
+ class: "kui-pinnable-popover-surface__bottom-resize",
265
+ "aria-label": `Resize ${label} vertically`,
266
+ title: `Resize ${label} vertically`
267
+ }
268
+ ) : void 0
256
269
  ]
257
270
  }
258
271
  );
@@ -373,6 +386,7 @@ var GUTTER_PROPERTY = "--_kui-pinnable-popover-surface-gutter-px";
373
386
  var DEFAULT_GUTTER = 16;
374
387
  var ANCHOR_GAP = 4;
375
388
  var DRAG_THRESHOLD = 3;
389
+ var MIN_RESIZE_HEIGHT = 160;
376
390
  var ARROWS = {
377
391
  ArrowLeft: [-1, 0],
378
392
  ArrowRight: [1, 0],
@@ -522,8 +536,23 @@ function wirePinnablePopover(surface, options = {}) {
522
536
  view.cancelAnimationFrame(frame);
523
537
  frame = view.requestAnimationFrame(layout);
524
538
  };
539
+ const scrollOwner = () => surface.querySelector(
540
+ ":scope > .kui-pinnable-popover-surface__body > :last-child"
541
+ );
542
+ const syncScrollDivider = () => {
543
+ surface.toggleAttribute(
544
+ "data-scrolled",
545
+ surface.dataset.bodyLayout === "fill-last" && (scrollOwner()?.scrollTop ?? 0) > 1
546
+ );
547
+ };
525
548
  const onToggle = (event) => {
526
- if (event.newState === "open") layout();
549
+ if (event.newState === "open") {
550
+ layout();
551
+ syncScrollDivider();
552
+ }
553
+ };
554
+ const onSurfaceScroll = (event) => {
555
+ if (event.target === scrollOwner()) syncScrollDivider();
527
556
  };
528
557
  const onClick = (event) => {
529
558
  const pin = event.target.closest(
@@ -532,6 +561,30 @@ function wirePinnablePopover(surface, options = {}) {
532
561
  if (pin && surface.contains(pin)) setPinned(!pinned);
533
562
  };
534
563
  const onKeyDown = (event) => {
564
+ const resizeHandle = event.target.closest(
565
+ ".kui-pinnable-popover-surface__bottom-resize"
566
+ );
567
+ if (resizeHandle?.parentElement === surface && (event.key === "ArrowUp" || event.key === "ArrowDown") && !event.altKey && !event.ctrlKey && !event.metaKey) {
568
+ event.preventDefault();
569
+ setPinned(true);
570
+ const box2 = surface.getBoundingClientRect();
571
+ const distance2 = event.shiftKey ? largeStep : step;
572
+ const maxHeight = Math.max(0, viewport().height - gutter() - box2.top);
573
+ const height = Math.min(
574
+ Math.max(
575
+ MIN_RESIZE_HEIGHT,
576
+ box2.height + (event.key === "ArrowDown" ? distance2 : -distance2)
577
+ ),
578
+ maxHeight
579
+ );
580
+ own("height", `${Math.round(height)}px`);
581
+ requested = {
582
+ ...requested ?? { x: box2.left, y: box2.top },
583
+ height: Math.round(height)
584
+ };
585
+ report("resize");
586
+ return;
587
+ }
535
588
  const handle = event.target.closest(
536
589
  ".kui-pinnable-popover-surface__handle"
537
590
  );
@@ -548,8 +601,25 @@ function wirePinnablePopover(surface, options = {}) {
548
601
  report("move");
549
602
  };
550
603
  let drag;
604
+ let resizeDrag;
551
605
  const onPointerDown = (event) => {
552
606
  const target = event.target;
607
+ const resizeHandle = target.closest(
608
+ ".kui-pinnable-popover-surface__bottom-resize"
609
+ );
610
+ if (resizeHandle?.parentElement === surface && event.button === 0) {
611
+ const box2 = surface.getBoundingClientRect();
612
+ setPinned(true);
613
+ resizeDrag = {
614
+ id: event.pointerId,
615
+ handle: resizeHandle,
616
+ startY: event.clientY,
617
+ height: box2.height
618
+ };
619
+ resizeHandle.setPointerCapture?.(event.pointerId);
620
+ event.preventDefault();
621
+ return;
622
+ }
553
623
  const header = target.closest(
554
624
  ".kui-pinnable-popover-surface__header"
555
625
  );
@@ -568,15 +638,55 @@ function wirePinnablePopover(surface, options = {}) {
568
638
  header.setPointerCapture?.(event.pointerId);
569
639
  };
570
640
  const onPointerMove = (event) => {
641
+ if (resizeDrag && event.pointerId === resizeDrag.id) {
642
+ const box = surface.getBoundingClientRect();
643
+ const maxHeight = Math.max(0, viewport().height - gutter() - box.top);
644
+ const height = Math.min(
645
+ Math.max(
646
+ MIN_RESIZE_HEIGHT,
647
+ resizeDrag.height + event.clientY - resizeDrag.startY
648
+ ),
649
+ maxHeight
650
+ );
651
+ own("height", `${Math.round(height)}px`);
652
+ return;
653
+ }
571
654
  if (!drag || event.pointerId !== drag.id) return;
572
655
  const dx = event.clientX - drag.startX;
573
656
  const dy = event.clientY - drag.startY;
574
657
  if (!drag.moving && Math.hypot(dx, dy) < DRAG_THRESHOLD) return;
575
- drag.moving = true;
576
- setPinned(true);
577
- place(drag.left + dx, drag.top + dy);
658
+ const firstMove = !drag.bounds;
659
+ if (!drag.bounds) {
660
+ drag.moving = true;
661
+ setPinned(true);
662
+ const box = surface.getBoundingClientRect();
663
+ const min2 = gutter();
664
+ const viewSize = viewport();
665
+ drag.bounds = {
666
+ min: min2,
667
+ maxX: viewSize.width - min2 - box.width,
668
+ maxY: viewSize.height - min2 - box.height
669
+ };
670
+ }
671
+ const { min, maxX, maxY } = drag.bounds;
672
+ own(X_PROPERTY, `${Math.max(min, Math.min(drag.left + dx, maxX))}px`);
673
+ own(Y_PROPERTY, `${Math.max(min, Math.min(drag.top + dy, maxY))}px`);
674
+ if (firstMove) syncAttributes();
578
675
  };
579
676
  const onPointerEnd = (event) => {
677
+ if (resizeDrag && event.pointerId === resizeDrag.id) {
678
+ const { handle } = resizeDrag;
679
+ resizeDrag = void 0;
680
+ if (handle.hasPointerCapture?.(event.pointerId))
681
+ handle.releasePointerCapture(event.pointerId);
682
+ const box2 = surface.getBoundingClientRect();
683
+ requested = {
684
+ ...requested ?? { x: box2.left, y: box2.top },
685
+ height: Math.round(box2.height)
686
+ };
687
+ report("resize");
688
+ return;
689
+ }
580
690
  if (!drag || event.pointerId !== drag.id) return;
581
691
  const { header, moving } = drag;
582
692
  drag = void 0;
@@ -584,7 +694,7 @@ function wirePinnablePopover(surface, options = {}) {
584
694
  header.releasePointerCapture(event.pointerId);
585
695
  if (!moving) return;
586
696
  const box = surface.getBoundingClientRect();
587
- settle({ x: box.left, y: box.top });
697
+ settle(place(box.left, box.top));
588
698
  report("move");
589
699
  };
590
700
  const onDocumentPointerDown = (event) => {
@@ -609,7 +719,13 @@ function wirePinnablePopover(surface, options = {}) {
609
719
  event.preventDefault();
610
720
  surface.hidePopover();
611
721
  };
612
- const onResize = () => layout();
722
+ const onResize = () => {
723
+ if (drag?.moving) {
724
+ drag.bounds = void 0;
725
+ return;
726
+ }
727
+ layout();
728
+ };
613
729
  const onScroll = () => {
614
730
  if (!pinned) layout();
615
731
  };
@@ -632,19 +748,27 @@ function wirePinnablePopover(surface, options = {}) {
632
748
  }
633
749
  };
634
750
  if (pinned) syncAttributes();
751
+ syncScrollDivider();
635
752
  if (isOpen()) {
636
753
  applySize();
637
754
  layout();
638
755
  }
639
756
  const restore = watchOwnedStyles(surface, owned, {
640
- attributes: ["data-pinned", "data-placed", "aria-pressed"],
757
+ attributes: ["data-pinned", "data-placed", "data-scrolled", "aria-pressed"],
641
758
  childList: true,
642
759
  subtree: true,
643
760
  beforeRestore: adoptResize,
644
- afterRestore: syncAttributes
761
+ afterRestore: () => {
762
+ syncAttributes();
763
+ syncScrollDivider();
764
+ }
645
765
  });
646
766
  surface.addEventListener("beforetoggle", onBeforeToggle);
647
767
  surface.addEventListener("toggle", onToggle);
768
+ surface.addEventListener("scroll", onSurfaceScroll, {
769
+ capture: true,
770
+ passive: true
771
+ });
648
772
  surface.addEventListener("click", onClick);
649
773
  surface.addEventListener("keydown", onKeyDown);
650
774
  surface.addEventListener("pointerdown", onPointerDown);
@@ -660,6 +784,7 @@ function wirePinnablePopover(surface, options = {}) {
660
784
  restore.disconnect();
661
785
  surface.removeEventListener("beforetoggle", onBeforeToggle);
662
786
  surface.removeEventListener("toggle", onToggle);
787
+ surface.removeEventListener("scroll", onSurfaceScroll, { capture: true });
663
788
  surface.removeEventListener("click", onClick);
664
789
  surface.removeEventListener("keydown", onKeyDown);
665
790
  surface.removeEventListener("pointerdown", onPointerDown);
@@ -673,10 +798,11 @@ function wirePinnablePopover(surface, options = {}) {
673
798
  for (const property of owned.keys()) surface.style.removeProperty(property);
674
799
  owned.clear();
675
800
  surface.removeAttribute("data-placed");
801
+ surface.removeAttribute("data-scrolled");
676
802
  if (controllers.get(surface) === controller) controllers.delete(surface);
677
803
  };
678
804
  }
679
805
 
680
806
  export { DialogSurface, PinnablePopoverSurface, PopoverDialogSurface, PopupSurface, isPopoverPinned, pinPopover, wirePinnablePopover };
681
807
 
682
- //# sourceMappingURL=chunk-3SCGTP5O.js.map
808
+ //# sourceMappingURL=chunk-HD7ZLISK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/surfaces/surface-scaffold/internal/dialog-surface.tsx","../src/components/surfaces/surface-scaffold/internal/pinnable-popover-surface.tsx","../src/components/surfaces/surface-scaffold/internal/popover-dialog-surface.tsx","../src/components/surfaces/surface-scaffold/internal/popup-surface.tsx","../src/components/surfaces/surface-scaffold/wiring/wire-pinnable-popover.ts"],"names":["jsxs","jsx","X","box","distance","min"],"mappings":";;;;;;;AA2EA,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,oBAAA;AAAA,EACA,iBAAA;AAAA,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CAAoB,eAAe,aAAa,CAAA;AACxD,IAAA,OAAA,CAAQ,mBAAA,CAAoB,eAAe,aAAa,CAAA;AACxD,IAAA,OAAA,CAAQ,mBAAA,CAAoB,aAAa,YAAY,CAAA;AACrD,IAAA,OAAA,CAAQ,mBAAA,CAAoB,iBAAiB,YAAY,CAAA;AACzD,IAAA,GAAA,CAAI,mBAAA,CAAoB,aAAA,EAAe,qBAAA,EAAuB,IAAI,CAAA;AAClE,IAAA,GAAA,CAAI,mBAAA,CAAoB,WAAW,iBAAiB,CAAA;AACpD,IAAA,IAAA,CAAK,mBAAA,CAAoB,UAAU,QAAQ,CAAA;AAC3C,IAAA,GAAA,CAAI,oBAAoB,QAAA,EAAU,QAAA,EAAU,EAAE,OAAA,EAAS,MAAM,CAAA;AAC7D,IAAA,KAAA,MAAW,YAAY,KAAA,CAAM,IAAA,IAAQ,OAAA,CAAQ,KAAA,CAAM,eAAe,QAAQ,CAAA;AAC1E,IAAA,KAAA,CAAM,KAAA,EAAM;AACZ,IAAA,OAAA,CAAQ,gBAAgB,aAAa,CAAA;AACrC,IAAA,OAAA,CAAQ,gBAAgB,eAAe,CAAA;AACvC,IAAA,IAAI,YAAY,GAAA,CAAI,OAAO,MAAM,UAAA,EAAY,WAAA,CAAY,OAAO,OAAO,CAAA;AAAA,EACzE,CAAA;AACF","file":"chunk-HD7ZLISK.js","sourcesContent":["// KF-0MY6JQ: DialogSurface, one of the four surfaces the\n// `@kerfjs/ui/surface-scaffold` facade re-exports.\nimport { 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 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'\n | 'side-sheet'\n | 'fullscreen'\n | 'bottom-sheet'\n /**\n * In flow, always shown: the same panel without the top layer or a\n * backdrop, never wider than its container. For a catalog, a design\n * canvas, or a document; `openDialog` / `closeDialog` leave it alone and\n * `data-dialog-close` does not hide it.\n */\n | 'embedded';\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 =\n | 'none'\n | 'default'\n | 'comfortable'\n | /** @deprecated Use default; this legacy compact value retains its 8px inset. */ 'compact';\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/** The built-in close control's visual weight; `normal` keeps the default. */\nexport type DialogSurfaceCloseEmphasis = 'normal' | 'quiet';\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 'data-stack-open',\n 'data-stack-active',\n 'data-stack-position',\n 'data-stack-count',\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\n/** Controlled state of one native modal layer inside a `wireDialogStack` root. */\nexport interface DialogSurfaceStack {\n /** Whether this layer belongs in the native top layer. */\n open: boolean;\n /** The one frontmost open layer; it owns modal focus and accessibility. */\n active: boolean;\n /** One-based order from the back to the front. */\n position: number;\n /** Number of layers in the stack, including closed layers still rendered. */\n count: number;\n /** Optional vertical offset for an inactive layer; omitted on phones. */\n offset?: CssLength;\n}\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 /** Controlled modal stack state; call `wireDialogStack` on the containing root. */\n stack?: DialogSurfaceStack;\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 /** Soften the built-in close control without changing its 40px target. */\n closeEmphasis?: DialogSurfaceCloseEmphasis;\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 closeEmphasis = 'normal',\n children,\n stack,\n size = 'medium',\n presentation = 'modal',\n preferredWidth,\n bodyInset = 'default',\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 if (\n stack &&\n (!Number.isInteger(stack.position) ||\n !Number.isInteger(stack.count) ||\n stack.count < 1 ||\n stack.position < 1 ||\n stack.position > stack.count ||\n (stack.active && !stack.open))\n )\n throw new RangeError(\n 'DialogSurface stack needs a valid frontmost active layer',\n );\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 stack?.offset === undefined\n ? ''\n : `--_kui-dialog-surface-stack-offset:${stack.offset}`,\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 open={presentation === 'embedded' ? true : undefined}\n role={alert ? 'alertdialog' : undefined}\n aria-label={label}\n aria-labelledby={labelledBy}\n aria-describedby={describedBy}\n aria-modal={\n stack ? (stack.open && stack.active ? 'true' : 'false') : undefined\n }\n aria-hidden={\n stack ? (stack.open && stack.active ? 'false' : 'true') : undefined\n }\n inert={stack && (!stack.open || !stack.active) ? true : undefined}\n tabindex={-1}\n data-light-dismiss={lightDismiss ? '' : undefined}\n data-component=\"dialog-surface\"\n data-stack-open={stack ? String(stack.open) : undefined}\n data-stack-active={stack ? String(stack.active) : undefined}\n data-stack-position={stack?.position}\n data-stack-count={stack?.count}\n data-size={size}\n data-presentation={presentation}\n data-preferred-width={preferredWidth === undefined ? undefined : ''}\n data-body-inset={bodyInset === 'compact' ? 'default' : bodyInset}\n data-footer-inset={footerInset === 'compact' ? 'default' : footerInset}\n data-viewport-gutter={\n viewportGutter === undefined && !stack ? undefined : ''\n }\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-emphasis={closeEmphasis === 'quiet' ? 'quiet' : undefined}\n data-dialog-close=\"\"\n >\n <LucideIcon\n icon={X}\n name=\"x\"\n size={closeEmphasis === 'quiet' ? 'm' : 'l'}\n />\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","// KF-0MY6JQ: PinnablePopoverSurface, one of the four surfaces the\n// `@kerfjs/ui/surface-scaffold` facade re-exports.\nimport { Pin, 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';\nimport type {\n DialogSurfaceBodyLayout,\n DialogSurfaceHeight,\n DialogSurfaceMaxHeight,\n DialogSurfaceSize,\n} from './dialog-surface.js';\nimport type { PopoverDialogSurfaceDataAttributes } from './popover-dialog-surface.js';\nimport type { SurfacePresentation } from './surface-presentation.js';\n\n/**\n * Where a PinnablePopoverSurface appears: the top layer, or in flow. An alias\n * of the shared {@link SurfacePresentation}.\n */\nexport type PinnablePopoverSurfacePresentation = SurfacePresentation;\n\nexport interface PinnablePopoverSurfaceProps {\n /**\n * The root id: what an opening control's `popoverTarget` names. The title\n * and the move description derive their ids from it.\n */\n id: string;\n /** The title text: the surface's accessible name and its move handle's. */\n label: string;\n /**\n * Id of the element whose text describes the surface, rendered as\n * `aria-describedby` on the `role=\"dialog\"` root.\n */\n describedBy?: string;\n /** The body content, below the header. */\n children: KerfUiContent;\n /** Controls before the Pin and Close buttons in the header. */\n headerActions?: KerfUiContent;\n /**\n * `overlay` (default) is a native `popover=\"manual\"` in the top layer that\n * `wirePinnablePopover` places, dismisses, and moves; `embedded` renders\n * the same surface in flow for a catalog or a design canvas.\n */\n presentation?: PinnablePopoverSurfacePresentation;\n /**\n * Render it pinned: an `embedded` preview of the pinned state. An\n * overlay's pinned state belongs to `wirePinnablePopover`; pass `pinned`\n * there to restore it.\n */\n pinned?: boolean;\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 /**\n * Edge clearance on each side of the viewport (default 16px): the surface\n * is placed, dragged, and moved inside it.\n */\n viewportGutter?: CssLength;\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 /** Add a bottom-edge handle that pins and resizes an overlay by drag or arrow key. */\n resizeFromBottom?: boolean;\n /** The Pin toggle's accessible name (default `Pin`). */\n pinLabel?: string;\n /** The close button's accessible name (default `Close`). */\n closeLabel?: string;\n /** The move handle's accessible description of the pointer and keyboard move. */\n moveDescription?: string;\n rootAttributes?: PopoverDialogSurfaceDataAttributes;\n className?: string;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\nconst PINNABLE_POPOVER_PROTECTED = new Set([\n 'data-component',\n 'data-presentation',\n 'data-size',\n 'data-height',\n 'data-max-height',\n 'data-body-layout',\n 'data-pinned',\n 'data-placed',\n 'data-scrolled',\n 'data-resize-from-bottom',\n]);\n\nconst DEFAULT_MOVE_DESCRIPTION =\n 'Drag the title or press the arrow keys to move it; hold Shift to move farther. Moving it pins it.';\n\n/**\n * A non-modal surface a person can pin and move. Transient by default: it\n * opens below the control that opened it and closes on Escape or a press\n * outside. Pinned (by its header Pin toggle or `pinPopover()`), it stays\n * open while the page is used, drags by its title, moves with the arrow\n * keys, resizes, and stays inside the viewport gutter. Open it with a\n * `popoverTarget` control or `showPopover()`, and call `wirePinnablePopover()`\n * once for its placement, dismissal, and movement; the application stores\n * what `onChange` reports. Use `PopoverDialogSurface` for a dialog that only\n * ever light-dismisses.\n */\nexport function PinnablePopoverSurface({\n id,\n label,\n describedBy,\n children,\n headerActions,\n presentation = 'overlay',\n pinned = false,\n size = 'medium',\n preferredWidth,\n height,\n maxHeight,\n viewportGutter,\n bodyLayout = 'flow',\n resizeFromBottom = false,\n pinLabel = 'Pin',\n closeLabel = 'Close',\n moveDescription = DEFAULT_MOVE_DESCRIPTION,\n rootAttributes = {},\n className = '',\n slot,\n}: PinnablePopoverSurfaceProps) {\n const style = [\n preferredWidth === undefined\n ? ''\n : `--_kui-pinnable-popover-surface-preferred-width:${preferredWidth}`,\n viewportGutter === undefined\n ? ''\n : `--_kui-pinnable-popover-surface-gutter:${viewportGutter}`,\n height === undefined || height === 'viewport'\n ? ''\n : `--_kui-pinnable-popover-surface-height:${height}`,\n maxHeight === undefined || maxHeight === 'viewport'\n ? ''\n : `--_kui-pinnable-popover-surface-max-height:${maxHeight}`,\n ]\n .filter(Boolean)\n .join(';');\n const overlay = presentation === 'overlay';\n return (\n <section\n {...filterDataAttributes(rootAttributes, PINNABLE_POPOVER_PROTECTED)}\n id={id}\n class={`kui-pinnable-popover-surface ${className}`.trim()}\n data-component=\"pinnable-popover-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 data-resize-from-bottom={resizeFromBottom ? '' : undefined}\n data-pinned={pinned ? '' : undefined}\n popover={overlay ? 'manual' : undefined}\n role=\"dialog\"\n aria-labelledby={`${id}-title`}\n aria-describedby={describedBy}\n style={style || undefined}\n slot={slot}\n >\n <header class=\"kui-pinnable-popover-surface__header\">\n <button\n type=\"button\"\n class=\"kui-pinnable-popover-surface__handle\"\n aria-describedby={`${id}-move-description`}\n >\n <span id={`${id}-title`} class=\"kui-pinnable-popover-surface__title\">\n {label}\n </span>\n </button>\n <span id={`${id}-move-description`} hidden>\n {moveDescription}\n </span>\n <div class=\"kui-pinnable-popover-surface__header-actions\">\n {headerActions}\n <button\n type=\"button\"\n class=\"kui-pinnable-popover-surface__control\"\n aria-label={pinLabel}\n aria-pressed={String(pinned)}\n data-pinnable-popover-pin=\"\"\n >\n <LucideIcon icon={Pin} name=\"pin\" size=\"m\" />\n </button>\n <button\n type=\"button\"\n class=\"kui-pinnable-popover-surface__control\"\n aria-label={closeLabel}\n popoverTarget={overlay ? id : undefined}\n popoverTargetAction={overlay ? 'hide' : undefined}\n >\n <LucideIcon icon={X} name=\"x\" size=\"l\" />\n </button>\n </div>\n </header>\n <div class=\"kui-pinnable-popover-surface__body\">{children}</div>\n {resizeFromBottom && overlay ? (\n <button\n type=\"button\"\n class=\"kui-pinnable-popover-surface__bottom-resize\"\n aria-label={`Resize ${label} vertically`}\n title={`Resize ${label} vertically`}\n />\n ) : undefined}\n </section>\n );\n}\n","// KF-0MY6JQ: PopoverDialogSurface, one of the four surfaces the\n// `@kerfjs/ui/surface-scaffold` facade re-exports.\nimport type { KerfUiContent } from '../../../../shared/content/semantic-content.js';\nimport { filterDataAttributes } from '../../../../shared/dom/extension-attributes.js';\nimport {\n type AnchorName,\n checkedAnchorName,\n} from '../../../../shared/styles/anchor-name.js';\nimport type { CssLength } from '../../../../shared/styles/css-values.js';\nimport type {\n DialogSurfaceBodyLayout,\n DialogSurfaceHeight,\n DialogSurfaceMaxHeight,\n DialogSurfaceSize,\n} from './dialog-surface.js';\nimport type { SurfacePresentation } from './surface-presentation.js';\n\n/**\n * Where a PopoverDialogSurface appears: the top layer, or in flow. An alias\n * of the shared {@link SurfacePresentation}.\n */\nexport type PopoverDialogSurfacePresentation = SurfacePresentation;\n\n/** How an overlay PopoverDialogSurface closes: light dismiss, or its own controls. */\nexport type PopoverDialogSurfaceDismiss = 'light' | 'manual';\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 /**\n * How an overlay closes. `light` (default) is `popover=\"auto\"`: Escape or a\n * press outside closes it. `manual` is `popover=\"manual\"`: only its own\n * controls (`popovertargetaction=\"hide\"`) or `hidePopover()` close it, for a\n * request the person must answer. Ignored when `embedded`.\n */\n dismiss?: PopoverDialogSurfaceDismiss;\n /**\n * KF-T1V86Q: a CSS anchor name (a dashed ident such as `--app-main`) the\n * open overlay docks to: centered on the bottom edge of the element whose\n * `anchor-name` it is, inset by `viewportGutter`. The application names\n * that element (its shell's main column). Engines without CSS anchor\n * positioning keep the centered top-layer placement. Ignored when\n * `embedded`.\n */\n anchorName?: AnchorName;\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-anchored',\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 dismiss = 'light',\n anchorName,\n size = 'medium',\n preferredWidth,\n height,\n maxHeight,\n viewportGutter,\n bodyLayout = 'flow',\n rootAttributes = {},\n className = '',\n slot,\n}: PopoverDialogSurfaceProps) {\n if (anchorName !== undefined)\n checkedAnchorName(anchorName, 'PopoverDialogSurface anchorName');\n const anchored = anchorName !== undefined && presentation === 'overlay';\n const style = [\n anchored ? `position-anchor:${anchorName}` : '',\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 data-anchored={anchored ? '' : undefined}\n popover={\n presentation !== 'overlay'\n ? undefined\n : dismiss === 'manual'\n ? 'manual'\n : 'auto'\n }\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","// KF-0MY6JQ: PopupSurface, one of the four surfaces the\n// `@kerfjs/ui/surface-scaffold` facade re-exports.\nimport type { KerfUiContent } from '../../../../shared/content/semantic-content.js';\nimport {\n filterDataAttributes,\n type RootDataAttributes,\n} from '../../../../shared/dom/extension-attributes.js';\n\nexport type PopupSurfaceInset =\n | 'none'\n | 'compact'\n | 'default'\n | /** @deprecated Use default. */ 'standard'\n | /** @deprecated Use none. */ '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 /** Application `data-*` metadata on the root, such as a row key or an\n * editor node marker; the component's own markers stay protected. */\n rootAttributes?: RootDataAttributes;\n}\n\nconst POPUP_SURFACE_PROTECTED = new Set([\n 'data-body-inset',\n 'data-body-layout',\n 'data-component',\n 'data-dialog-close',\n 'data-emphasis',\n 'data-enter-motion',\n 'data-exit-motion',\n 'data-footer-inset',\n 'data-footer-presentation',\n 'data-header-presentation',\n 'data-height',\n 'data-inset',\n 'data-light-dismiss',\n 'data-max-height',\n 'data-min-height',\n 'data-preferred-width',\n 'data-presentation',\n 'data-resizable',\n 'data-size',\n 'data-stack-active',\n 'data-stack-count',\n 'data-stack-open',\n 'data-stack-position',\n 'data-viewport-gutter',\n]);\n\n/** Configure recurring Web Awesome dropdown-menu geometry without consumer ::part() CSS. */\nexport function PopupSurface({\n children,\n inset = 'default',\n className = '',\n slot,\n rootAttributes = {},\n}: PopupSurfaceProps) {\n return (\n <span\n {...filterDataAttributes(rootAttributes, POPUP_SURFACE_PROTECTED)}\n class={`kui-popup-surface ${className}`.trim()}\n data-component=\"popup-surface\"\n data-inset={\n inset === 'standard'\n ? 'default'\n : inset === 'list-zero'\n ? 'none'\n : inset\n }\n slot={slot}\n >\n {children}\n </span>\n );\n}\n","import { watchOwnedStyles } from '../../../../shared/dom/owned-styles.js';\n\n/**\n * Where a pinned PinnablePopoverSurface sits: its top-left corner in viewport\n * px, and the size the person resized it to (omitted until they do).\n */\nexport interface PinnablePopoverPlacement {\n readonly x: number;\n readonly y: number;\n readonly width?: number;\n readonly height?: number;\n}\n\n/** What changed a PinnablePopoverSurface's pinned state or placement. */\nexport type PinnablePopoverChangeReason = 'pin' | 'unpin' | 'move' | 'resize';\n\n/** What `wirePinnablePopover`'s `onChange` reports. */\nexport interface PinnablePopoverChange {\n readonly pinned: boolean;\n /** The pinned placement; `null` while transient. */\n readonly placement: PinnablePopoverPlacement | null;\n readonly reason: PinnablePopoverChangeReason;\n}\n\nexport interface PinnablePopoverOptions {\n /**\n * The element a transient surface opens below (or above, without room\n * below). Default: the first control whose `popovertarget` names the\n * surface. Without one, a transient surface opens centered.\n */\n anchor?: Element | (() => Element | null);\n /** Start pinned, as the application last stored it. */\n pinned?: boolean;\n /** The pinned placement to restore, as `onChange` last reported it. */\n placement?: PinnablePopoverPlacement;\n /** An arrow key's move, in px (default 8). */\n step?: number;\n /** A Shift+arrow move, in px (default 40). */\n largeStep?: number;\n /**\n * Called when the person (or `pinPopover`) pins, unpins, moves, or resizes\n * the surface. A clamp after a window resize is not reported: the surface\n * returns to the reported placement when the window has room again.\n */\n onChange?: (change: PinnablePopoverChange) => void;\n}\n\ninterface Controller {\n readonly pinned: boolean;\n setPinned(pinned: boolean): void;\n}\n\nconst controllers = new WeakMap<HTMLElement, Controller>();\n\n/** The surface variables that place it, and the registered resolved gutter. */\nconst X_PROPERTY = '--_kui-pinnable-popover-surface-x';\nconst Y_PROPERTY = '--_kui-pinnable-popover-surface-y';\nconst GUTTER_PROPERTY = '--_kui-pinnable-popover-surface-gutter-px';\nconst DEFAULT_GUTTER = 16;\n/** Space between the anchor and a transient surface. */\nconst ANCHOR_GAP = 4;\n/** Pointer travel, in px, before a press on the header becomes a drag. */\nconst DRAG_THRESHOLD = 3;\nconst MIN_RESIZE_HEIGHT = 160;\n\nconst ARROWS: Readonly<Record<string, readonly [number, number]>> = {\n ArrowLeft: [-1, 0],\n ArrowRight: [1, 0],\n ArrowUp: [0, -1],\n ArrowDown: [0, 1],\n};\n\n/** Whether `surface` is pinned (its rendered state when it is not wired). */\nexport function isPopoverPinned(surface: HTMLElement): boolean {\n return (\n controllers.get(surface)?.pinned ?? surface.hasAttribute('data-pinned')\n );\n}\n\n/**\n * Pin (or, with `false`, unpin) a wired PinnablePopoverSurface, as its\n * header Pin toggle does. Pinned, it no longer closes on a press outside\n * and keeps where it is; unpinned, it returns below its anchor. Reported\n * through `onChange`. Does nothing to a surface that is not wired.\n */\nexport function pinPopover(surface: HTMLElement, pinned = true): void {\n controllers.get(surface)?.setPinned(pinned);\n}\n\n/**\n * Give an overlay PinnablePopoverSurface its behavior: placement below its\n * anchor while transient, a press outside or Escape closing it; the Pin\n * toggle; a drag by the header and the arrow keys on the focused title\n * (Shift for `largeStep`) moving it, which pins it; a pinned surface's\n * resize; and a clamp inside the viewport gutter, kept after a window\n * resize. Pinned, it closes only by Escape (with focus inside it), its Close\n * button, or `hidePopover()`. The state survives application re-renders and\n * closing; `onChange` reports it for the application to store. An\n * `embedded` surface is left alone. Returns a disposer.\n */\nexport function wirePinnablePopover(\n surface: HTMLElement,\n options: PinnablePopoverOptions = {},\n): () => void {\n if (surface.dataset.presentation === 'embedded') return () => {};\n const doc = surface.ownerDocument;\n const view = doc.defaultView ?? globalThis;\n const step = options.step ?? 8;\n const largeStep = options.largeStep ?? 40;\n let pinned = options.pinned ?? false;\n let requested: PinnablePopoverPlacement | null =\n pinned && options.placement ? options.placement : null;\n /** Inline styles the controller owns, restored after a re-render. */\n const owned = new Map<string, string>();\n let frame = 0;\n\n const isOpen = () => surface.matches(':popover-open');\n const report = (reason: PinnablePopoverChangeReason) =>\n options.onChange?.({ pinned, placement: requested, reason });\n\n const own = (property: string, value: string | null) => {\n if (value === null) {\n owned.delete(property);\n surface.style.removeProperty(property);\n } else {\n owned.set(property, value);\n if (surface.style.getPropertyValue(property) !== value)\n surface.style.setProperty(property, value);\n }\n };\n const syncAttributes = () => {\n surface.toggleAttribute('data-pinned', pinned);\n surface.toggleAttribute('data-placed', owned.has(X_PROPERTY));\n const pin = surface.querySelector('[data-pinnable-popover-pin]');\n if (pin && pin.getAttribute('aria-pressed') !== String(pinned))\n pin.setAttribute('aria-pressed', String(pinned));\n };\n\n const gutter = () => {\n const value = parseFloat(\n view.getComputedStyle(surface).getPropertyValue(GUTTER_PROPERTY),\n );\n return Number.isFinite(value) ? value : DEFAULT_GUTTER;\n };\n const viewport = () => ({\n width: doc.documentElement.clientWidth || view.innerWidth,\n height: view.innerHeight,\n });\n /** Keep the box inside the viewport gutter; its leading edge wins. */\n const clamp = (x: number, y: number) => {\n const box = surface.getBoundingClientRect();\n const g = gutter();\n const { width, height } = viewport();\n return {\n x: Math.max(g, Math.min(x, width - g - box.width)),\n y: Math.max(g, Math.min(y, height - g - box.height)),\n };\n };\n const place = (x: number, y: number) => {\n const at = clamp(x, y);\n own(X_PROPERTY, `${at.x}px`);\n own(Y_PROPERTY, `${at.y}px`);\n syncAttributes();\n return at;\n };\n const applySize = () => {\n own(\n 'width',\n requested?.width === undefined ? null : `${requested.width}px`,\n );\n own(\n 'height',\n requested?.height === undefined ? null : `${requested.height}px`,\n );\n };\n\n const resolveAnchor = (): Element | null => {\n const anchor =\n typeof options.anchor === 'function' ? options.anchor() : options.anchor;\n if (anchor) return anchor;\n if (!surface.id) return null;\n // The opener outside the surface, not its own Close button.\n for (const invoker of doc.querySelectorAll(\n `[popovertarget=\"${CSS.escape(surface.id)}\"]`,\n ))\n if (!surface.contains(invoker)) return invoker;\n return null;\n };\n /** Below the anchor, start-aligned, or above it without room below. */\n const placeAtAnchor = () => {\n const anchor = resolveAnchor();\n if (!anchor) {\n own(X_PROPERTY, null);\n own(Y_PROPERTY, null);\n syncAttributes();\n return;\n }\n const target = anchor.getBoundingClientRect();\n const box = surface.getBoundingClientRect();\n const rtl = view.getComputedStyle(surface).direction === 'rtl';\n let y = target.bottom + ANCHOR_GAP;\n if (\n y + box.height > viewport().height - gutter() &&\n target.top - ANCHOR_GAP - box.height >= gutter()\n )\n y = target.top - ANCHOR_GAP - box.height;\n place(rtl ? target.right - box.width : target.left, y);\n };\n /** Where an open surface belongs now. */\n const layout = () => {\n if (!isOpen()) return;\n if (!pinned) placeAtAnchor();\n else if (requested) place(requested.x, requested.y);\n else if (owned.has(X_PROPERTY)) {\n const box = surface.getBoundingClientRect();\n place(box.left, box.top);\n }\n };\n /** The pinned placement after a move, keeping any resized size. */\n const settle = (at: { x: number; y: number }) => {\n requested = {\n ...(requested ?? {}),\n x: at.x,\n y: at.y,\n };\n };\n\n const setPinned = (next: boolean) => {\n if (next === pinned) return;\n pinned = next;\n if (pinned) {\n if (isOpen()) {\n const box = surface.getBoundingClientRect();\n settle(place(box.left, box.top));\n }\n } else {\n requested = null;\n applySize();\n layout();\n }\n syncAttributes();\n report(pinned ? 'pin' : 'unpin');\n };\n const controller: Controller = {\n get pinned() {\n return pinned;\n },\n setPinned,\n };\n controllers.set(surface, controller);\n\n const onBeforeToggle = (event: Event) => {\n if ((event as ToggleEvent).newState !== 'open') return;\n applySize();\n view.cancelAnimationFrame(frame);\n // Laid out by the next frame, placed before it paints.\n frame = view.requestAnimationFrame(layout);\n };\n const scrollOwner = () =>\n surface.querySelector<HTMLElement>(\n ':scope > .kui-pinnable-popover-surface__body > :last-child',\n );\n const syncScrollDivider = () => {\n surface.toggleAttribute(\n 'data-scrolled',\n surface.dataset.bodyLayout === 'fill-last' &&\n (scrollOwner()?.scrollTop ?? 0) > 1,\n );\n };\n const onToggle = (event: Event) => {\n if ((event as ToggleEvent).newState === 'open') {\n layout();\n syncScrollDivider();\n }\n };\n const onSurfaceScroll = (event: Event) => {\n if (event.target === scrollOwner()) syncScrollDivider();\n };\n\n const onClick = (event: MouseEvent) => {\n const pin = (event.target as Element).closest(\n '[data-pinnable-popover-pin]',\n );\n if (pin && surface.contains(pin)) setPinned(!pinned);\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n const resizeHandle = (event.target as Element).closest(\n '.kui-pinnable-popover-surface__bottom-resize',\n );\n if (\n resizeHandle?.parentElement === surface &&\n (event.key === 'ArrowUp' || event.key === 'ArrowDown') &&\n !event.altKey &&\n !event.ctrlKey &&\n !event.metaKey\n ) {\n event.preventDefault();\n setPinned(true);\n const box = surface.getBoundingClientRect();\n const distance = event.shiftKey ? largeStep : step;\n const maxHeight = Math.max(0, viewport().height - gutter() - box.top);\n const height = Math.min(\n Math.max(\n MIN_RESIZE_HEIGHT,\n box.height + (event.key === 'ArrowDown' ? distance : -distance),\n ),\n maxHeight,\n );\n own('height', `${Math.round(height)}px`);\n requested = {\n ...(requested ?? { x: box.left, y: box.top }),\n height: Math.round(height),\n };\n report('resize');\n return;\n }\n const handle = (event.target as Element).closest(\n '.kui-pinnable-popover-surface__handle',\n );\n const delta = ARROWS[event.key];\n if (!handle || !delta || event.altKey || event.ctrlKey || event.metaKey)\n return;\n event.preventDefault();\n setPinned(true);\n const distance = event.shiftKey ? largeStep : step;\n const box = surface.getBoundingClientRect();\n settle(\n place(box.left + delta[0] * distance, box.top + delta[1] * distance),\n );\n report('move');\n };\n\n let drag:\n | {\n id: number;\n header: HTMLElement;\n startX: number;\n startY: number;\n left: number;\n top: number;\n moving: boolean;\n bounds?: { min: number; maxX: number; maxY: number };\n }\n | undefined;\n let resizeDrag:\n | { id: number; handle: HTMLElement; startY: number; height: number }\n | undefined;\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Element;\n const resizeHandle = target.closest<HTMLElement>(\n '.kui-pinnable-popover-surface__bottom-resize',\n );\n if (resizeHandle?.parentElement === surface && event.button === 0) {\n const box = surface.getBoundingClientRect();\n setPinned(true);\n resizeDrag = {\n id: event.pointerId,\n handle: resizeHandle,\n startY: event.clientY,\n height: box.height,\n };\n resizeHandle.setPointerCapture?.(event.pointerId);\n event.preventDefault();\n return;\n }\n const header = target.closest<HTMLElement>(\n '.kui-pinnable-popover-surface__header',\n );\n if (\n !header ||\n header.parentElement !== surface ||\n event.button !== 0 ||\n target.closest('.kui-pinnable-popover-surface__header-actions')\n )\n return;\n const box = surface.getBoundingClientRect();\n drag = {\n id: event.pointerId,\n header,\n startX: event.clientX,\n startY: event.clientY,\n left: box.left,\n top: box.top,\n moving: false,\n };\n header.setPointerCapture?.(event.pointerId);\n };\n const onPointerMove = (event: PointerEvent) => {\n if (resizeDrag && event.pointerId === resizeDrag.id) {\n const box = surface.getBoundingClientRect();\n const maxHeight = Math.max(0, viewport().height - gutter() - box.top);\n const height = Math.min(\n Math.max(\n MIN_RESIZE_HEIGHT,\n resizeDrag.height + event.clientY - resizeDrag.startY,\n ),\n maxHeight,\n );\n own('height', `${Math.round(height)}px`);\n return;\n }\n if (!drag || event.pointerId !== drag.id) return;\n const dx = event.clientX - drag.startX;\n const dy = event.clientY - drag.startY;\n if (!drag.moving && Math.hypot(dx, dy) < DRAG_THRESHOLD) return;\n const firstMove = !drag.bounds;\n if (!drag.bounds) {\n drag.moving = true;\n setPinned(true);\n const box = surface.getBoundingClientRect();\n const min = gutter();\n const viewSize = viewport();\n drag.bounds = {\n min,\n maxX: viewSize.width - min - box.width,\n maxY: viewSize.height - min - box.height,\n };\n }\n const { min, maxX, maxY } = drag.bounds;\n own(X_PROPERTY, `${Math.max(min, Math.min(drag.left + dx, maxX))}px`);\n own(Y_PROPERTY, `${Math.max(min, Math.min(drag.top + dy, maxY))}px`);\n if (firstMove) syncAttributes();\n };\n const onPointerEnd = (event: PointerEvent) => {\n if (resizeDrag && event.pointerId === resizeDrag.id) {\n const { handle } = resizeDrag;\n resizeDrag = undefined;\n if (handle.hasPointerCapture?.(event.pointerId))\n handle.releasePointerCapture(event.pointerId);\n const box = surface.getBoundingClientRect();\n requested = {\n ...(requested ?? { x: box.left, y: box.top }),\n height: Math.round(box.height),\n };\n report('resize');\n return;\n }\n if (!drag || event.pointerId !== drag.id) return;\n const { header, moving } = drag;\n drag = undefined;\n if (header.hasPointerCapture?.(event.pointerId))\n header.releasePointerCapture(event.pointerId);\n if (!moving) return;\n const box = surface.getBoundingClientRect();\n settle(place(box.left, box.top));\n report('move');\n };\n\n // A transient surface closes on a press outside it and its openers.\n const onDocumentPointerDown = (event: PointerEvent) => {\n if (pinned || !isOpen()) return;\n const path = event.composedPath();\n if (path.includes(surface)) return;\n const anchor = resolveAnchor();\n if (anchor && path.includes(anchor)) return;\n if (\n path.some(\n (node) =>\n node instanceof Element &&\n node.getAttribute('popovertarget') === surface.id,\n )\n )\n return;\n surface.hidePopover();\n };\n // Escape closes it: always while transient, from inside it while pinned.\n // An open light-dismiss popover or modal dialog takes Escape first.\n const onDocumentKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || event.defaultPrevented || !isOpen()) return;\n if (pinned && !surface.contains(doc.activeElement)) return;\n if (\n doc.querySelector(\n ':is([popover=\"\"], [popover=\"auto\"]):popover-open, dialog:modal',\n )\n )\n return;\n event.preventDefault();\n surface.hidePopover();\n };\n\n const onResize = () => {\n if (drag?.moving) {\n drag.bounds = undefined;\n return;\n }\n layout();\n };\n const onScroll = () => {\n if (!pinned) layout();\n };\n\n // An application re-render morphs the surface back to its template: restore\n // what the controller owns. A person resizing a pinned surface writes its\n // inline width and height: take those as the pinned size.\n const adoptResize = () => {\n if (pinned) {\n const width = surface.style.width;\n const height = surface.style.height;\n const resized =\n (width !== '' && width !== owned.get('width')) ||\n (height !== '' && height !== owned.get('height'));\n if (resized) {\n const box = surface.getBoundingClientRect();\n requested = {\n ...(requested ?? { x: box.left, y: box.top }),\n width: Math.round(box.width),\n height: Math.round(box.height),\n };\n if (width !== '') owned.set('width', width);\n if (height !== '') owned.set('height', height);\n report('resize');\n }\n }\n };\n\n if (pinned) syncAttributes();\n syncScrollDivider();\n if (isOpen()) {\n applySize();\n layout();\n }\n const restore = watchOwnedStyles(surface, owned, {\n attributes: ['data-pinned', 'data-placed', 'data-scrolled', 'aria-pressed'],\n childList: true,\n subtree: true,\n beforeRestore: adoptResize,\n afterRestore: () => {\n syncAttributes();\n syncScrollDivider();\n },\n });\n surface.addEventListener('beforetoggle', onBeforeToggle);\n surface.addEventListener('toggle', onToggle);\n surface.addEventListener('scroll', onSurfaceScroll, {\n capture: true,\n passive: true,\n });\n surface.addEventListener('click', onClick);\n surface.addEventListener('keydown', onKeyDown);\n surface.addEventListener('pointerdown', onPointerDown);\n surface.addEventListener('pointermove', onPointerMove);\n surface.addEventListener('pointerup', onPointerEnd);\n surface.addEventListener('pointercancel', onPointerEnd);\n doc.addEventListener('pointerdown', onDocumentPointerDown, true);\n doc.addEventListener('keydown', onDocumentKeyDown);\n view.addEventListener('resize', onResize);\n doc.addEventListener('scroll', onScroll, { capture: true, passive: true });\n\n return () => {\n view.cancelAnimationFrame(frame);\n restore.disconnect();\n surface.removeEventListener('beforetoggle', onBeforeToggle);\n surface.removeEventListener('toggle', onToggle);\n surface.removeEventListener('scroll', onSurfaceScroll, { capture: true });\n surface.removeEventListener('click', onClick);\n surface.removeEventListener('keydown', onKeyDown);\n surface.removeEventListener('pointerdown', onPointerDown);\n surface.removeEventListener('pointermove', onPointerMove);\n surface.removeEventListener('pointerup', onPointerEnd);\n surface.removeEventListener('pointercancel', onPointerEnd);\n doc.removeEventListener('pointerdown', onDocumentPointerDown, true);\n doc.removeEventListener('keydown', onDocumentKeyDown);\n view.removeEventListener('resize', onResize);\n doc.removeEventListener('scroll', onScroll, { capture: true });\n for (const property of owned.keys()) surface.style.removeProperty(property);\n owned.clear();\n surface.removeAttribute('data-placed');\n surface.removeAttribute('data-scrolled');\n if (controllers.get(surface) === controller) controllers.delete(surface);\n };\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { SafeHtml } from 'kerfjs';
2
2
  import { R as RootDataAttributes } from './extension-attributes-IJ4decoa.js';
3
3
  import { CssLength } from './css-values.js';
4
- import { T as TreeListNode } from './tree-rows-eHnnGLGM.js';
4
+ import { T as TreeListNode } from './tree-rows-Bms5QJvG.js';
5
5
  import './semantic-content-BbzjvSu9.js';
6
6
 
7
7
  /** One column: the children of the node chosen in the column before it. */
@@ -1,140 +1,18 @@
1
- import { isExpandable } from './chunk-NR3ZO4LK.js';
2
- import { ColumnTrack } from './chunk-34FWYJX6.js';
3
- import { ListItem } from './chunk-4UWLHKNU.js';
4
-
5
-
6
-
7
-
8
-
9
- import { List } from './chunk-WVQDIOD7.js';
10
-
11
-
12
-
13
- import { LucideIcon } from './chunk-CMG4OZPV.js';
14
-
15
- import { filterDataAttributes } from './chunk-COQI4OMZ.js';
16
- import { ChevronRight } from 'lucide';
17
- import { jsx, jsxs, Fragment } from 'kerfjs/jsx-runtime';
18
-
19
- // src/components/collections/column-explorer/model/columns.ts
20
- function explorerColumns(nodes, path) {
21
- const columns = [];
22
- let siblings = nodes;
23
- let parent;
24
- for (let level = 0; ; level += 1) {
25
- const chosen = siblings.find((node) => node.id === path[level]);
26
- columns.push({
27
- level,
28
- ...parent ? { parent } : {},
29
- nodes: siblings,
30
- ...chosen ? { chosen: chosen.id } : {}
31
- });
32
- if (!chosen || !isExpandable(chosen)) return columns;
33
- parent = chosen;
34
- siblings = chosen.children ?? [];
35
- }
36
- }
37
- function explorerChosen(nodes, path) {
38
- let siblings = nodes;
39
- let node;
40
- for (const id of path) {
41
- node = siblings.find((candidate) => candidate.id === id);
42
- if (!node) return void 0;
43
- siblings = node.children ?? [];
44
- }
45
- return node;
46
- }
47
- var COLUMN_EXPLORER_PROTECTED = /* @__PURE__ */ new Set([
48
- "data-component",
49
- "data-column-explorer-id"
50
- ]);
51
- var chevron = LucideIcon({ icon: ChevronRight, name: "chevron-right" });
52
- function ColumnExplorer({
53
- id,
54
- label,
55
- nodes,
56
- path,
57
- action,
58
- preview,
59
- layout,
60
- minColumnWidth,
61
- peek,
62
- density = "default",
63
- className = "",
64
- rootAttributes = {},
65
- slot
66
- }) {
67
- const columns = explorerColumns(nodes, path);
68
- const chosen = explorerChosen(nodes, path);
69
- const showPreview = preview !== void 0 && chosen !== void 0 && !isExpandable(chosen);
70
- return /* @__PURE__ */ jsx(
71
- "div",
72
- {
73
- ...filterDataAttributes(rootAttributes, COLUMN_EXPLORER_PROTECTED),
74
- id,
75
- role: "region",
76
- class: `kui-column-explorer ${className}`.trim(),
77
- "aria-label": label,
78
- "data-component": "column-explorer",
79
- "data-column-explorer-id": id,
80
- slot,
81
- children: /* @__PURE__ */ jsxs(ColumnTrack, { layout, minColumnWidth, peek, children: [
82
- columns.map((column) => {
83
- const stop = column.chosen ?? column.nodes[0]?.id;
84
- return /* @__PURE__ */ jsx(
85
- List,
86
- {
87
- scrollable: true,
88
- fill: true,
89
- rootAttributes: {
90
- role: "group",
91
- "aria-label": column.parent ? String(column.parent.label) : label,
92
- "data-column-explorer-level": String(column.level)
93
- },
94
- children: column.nodes.map((node) => /* @__PURE__ */ jsx(
95
- ListItem,
96
- {
97
- action,
98
- itemId: node.id,
99
- label: node.label,
100
- description: node.description,
101
- icon: node.icon,
102
- trailing: isExpandable(node) ? /* @__PURE__ */ jsxs(Fragment, { children: [
103
- node.trailing,
104
- chevron
105
- ] }) : node.trailing,
106
- selected: node.id === column.chosen,
107
- disabled: node.disabled,
108
- density,
109
- tabIndex: node.id === stop ? 0 : -1,
110
- rootAttributes: {
111
- "data-key": node.id,
112
- "data-column-explorer-level": String(column.level),
113
- "data-expandable": isExpandable(node) ? "true" : void 0
114
- }
115
- }
116
- ))
117
- }
118
- );
119
- }),
120
- showPreview ? /* @__PURE__ */ jsx(
121
- List,
122
- {
123
- scrollable: true,
124
- fill: true,
125
- rootAttributes: {
126
- role: "group",
127
- "aria-label": `${String(chosen.label)} preview`,
128
- "data-column-explorer-preview": "true"
129
- },
130
- children: preview
131
- }
132
- ) : null
133
- ] })
134
- }
135
- );
136
- }
137
-
138
- export { ColumnExplorer, explorerChosen, explorerColumns };
1
+ export { ColumnExplorer, explorerChosen, explorerColumns } from './chunk-BMOZSNDU.js';
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
139
17
 
140
18
  //# sourceMappingURL=column-explorer.js.map