@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
@@ -1,16 +1,6 @@
1
1
  import '@kerfjs/ui/layout.css';
2
2
 
3
- import { List } from '@kerfjs/ui/list';
4
- import { ListInsetText } from '@kerfjs/ui/list-inset-text';
5
- import { StateBanner } from '@kerfjs/ui/state-banner';
6
- import { Text } from '@kerfjs/ui/text';
7
- import { Toolbar } from '@kerfjs/ui/toolbar';
8
- import {
9
- ToolbarButton,
10
- ToolbarControlGroup,
11
- } from '@kerfjs/ui/toolbar-control-group';
12
- import { ToolbarText } from '@kerfjs/ui/toolbar-text';
13
-
3
+ import { renderRecipeWorkspaceHeader } from '../views/recipe-workspace-header.view.js';
14
4
  import type { RecipeFactory, RecipePresentation } from './types.js';
15
5
 
16
6
  export const presentation: RecipePresentation = {
@@ -30,61 +20,7 @@ export const createRecipe: RecipeFactory = (announce) => ({
30
20
  data-recipe="recipe-workspace-header"
31
21
  aria-labelledby="recipe-workspace-title"
32
22
  >
33
- <List gap="l" controlInsets="tb">
34
- <List>
35
- <ListInsetText sides="rl">
36
- <Text variant="span" tone="quiet" size="compact">
37
- Northstar workspace · Product planning
38
- </Text>
39
- </ListInsetText>
40
- <Toolbar
41
- label="Workspace Heading"
42
- responsive="stack"
43
- responsiveAt="compact"
44
- leading={
45
- <ToolbarText
46
- text="Accessibility Readiness and Responsive Navigation Rollout"
47
- size="xlarge"
48
- id="recipe-workspace-title"
49
- headingLevel={1}
50
- wrap
51
- maxLines={2}
52
- />
53
- }
54
- trailing={
55
- <ToolbarControlGroup
56
- appearance="borderless"
57
- buttonAppearance="push"
58
- content="text"
59
- >
60
- <ToolbarButton
61
- action="recipe-action"
62
- rootAttributes={{ 'data-recipe-command': 'share' }}
63
- >
64
- Share
65
- </ToolbarButton>
66
- <ToolbarButton
67
- action="recipe-action"
68
- rootAttributes={{ 'data-recipe-command': 'more' }}
69
- >
70
- More Actions
71
- </ToolbarButton>
72
- <ToolbarButton
73
- action="recipe-action"
74
- rootAttributes={{ 'data-recipe-command': 'publish' }}
75
- >
76
- Publish Update
77
- </ToolbarButton>
78
- </ToolbarControlGroup>
79
- }
80
- />
81
- </List>
82
- <StateBanner
83
- title="Ready for Review"
84
- detail="All required checks passed 18 minutes ago."
85
- tone="success"
86
- />
87
- </List>
23
+ {renderRecipeWorkspaceHeader()}
88
24
  </section>
89
25
  ),
90
26
  action(command) {
package/view/generate.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  // generateView: turns a valid view document into its read-only view module
2
2
  // (docs/26-ui-editor.md §4). Output is plain TypeScript (or JavaScript plus a
3
- // .d.ts) that calls component functions directly — no JSX, no compiler in the
4
- // consumer's build. Same document and catalogs in, byte-identical code out.
3
+ // .d.ts) that invokes component functions through a small typed call boundary
4
+ // — no JSX compiler in the consumer's build. Same document and catalogs in,
5
+ // byte-identical code out.
5
6
  import {
6
7
  canonicalJson,
7
8
  contractDigest,
@@ -208,6 +209,7 @@ function createImports() {
208
209
  }
209
210
 
210
211
  function createEmitter(document, catalog, imports, importFrom) {
212
+ let usesKerfComponent = false;
211
213
  const value = (input, scope) => {
212
214
  // A field zone's children, in the content field it fills (KF-PD6QC5).
213
215
  if (input instanceof ZoneFill) return children(input.children, scope);
@@ -454,10 +456,17 @@ function createEmitter(document, catalog, imports, importFrom) {
454
456
  moduleSpecifier(definition.import, importFrom),
455
457
  definition.export,
456
458
  );
457
- return call(`${definition.export}(`, obj(entries));
459
+ // Rollup's effect analysis recursively walks direct component calls in
460
+ // large generated trees. A curried typed boundary preserves the exact
461
+ // call while keeping that analysis linear for the catalog bundle.
462
+ usesKerfComponent = true;
463
+ return call(`kuiComponent(${definition.export})(`, obj(entries));
458
464
  };
459
465
 
460
- return { root: (node) => nodeExpr(node, new Map(), ROOT_KEY, undefined) };
466
+ return {
467
+ root: (node) => nodeExpr(node, new Map(), ROOT_KEY, undefined),
468
+ usesKerfComponent: () => usesKerfComponent,
469
+ };
461
470
  }
462
471
 
463
472
  function typesBlock(name, contract, inputType = (input) => input.type) {
@@ -660,16 +669,16 @@ export function generateView(document, catalog, options = {}) {
660
669
  collectViews(document.root);
661
670
 
662
671
  let rootExpr;
672
+ let usesKerfComponent = false;
663
673
  if (!options.declarationsOnly) {
664
- rootExpr = printDoc(
665
- createEmitter(
666
- { ...document, views },
667
- catalog,
668
- imports,
669
- options.importFrom,
670
- ).root(document.root),
671
- 2,
674
+ const emitter = createEmitter(
675
+ { ...document, views },
676
+ catalog,
677
+ imports,
678
+ options.importFrom,
672
679
  );
680
+ rootExpr = printDoc(emitter.root(document.root), 2);
681
+ usesKerfComponent = emitter.usesKerfComponent();
673
682
  }
674
683
  const digest = contractDigest(contract);
675
684
  const sourceDigest = viewDigest(canonicalJson(document));
@@ -686,6 +695,11 @@ export function generateView(document, catalog, options = {}) {
686
695
  return `Parameters<typeof ${owner.export}>[0][${literal(input.shape.prop)}]`;
687
696
  });
688
697
  const contractLine = `export const ${camel}Contract = ${literal(digest)};`;
698
+ const componentHelper = usesKerfComponent
699
+ ? target === 'ts'
700
+ ? 'function kuiComponent<P>(component: (props: P) => SafeHtml): (props: P) => SafeHtml {\n return (props) => component(props);\n}'
701
+ : 'function kuiComponent(component) {\n return (props) => component(props);\n}'
702
+ : undefined;
689
703
 
690
704
  const assemble = (body) =>
691
705
  `${header(sourceName, contract, sourceDigest, body)}\n${body}`;
@@ -694,15 +708,21 @@ export function generateView(document, catalog, options = {}) {
694
708
  imports.render(true),
695
709
  types,
696
710
  contractLine,
711
+ componentHelper,
697
712
  functionsBlock(name, contract, rootExpr, true),
698
- ].join('\n\n');
713
+ ]
714
+ .filter(Boolean)
715
+ .join('\n\n');
699
716
  return { code: assemble(`${body}\n`), contract, digest };
700
717
  }
701
718
  const code = [
702
719
  imports.render(false),
703
720
  contractLine,
721
+ componentHelper,
704
722
  functionsBlock(name, contract, rootExpr, false),
705
- ].join('\n\n');
723
+ ]
724
+ .filter(Boolean)
725
+ .join('\n\n');
706
726
  const dts = [
707
727
  `import type { SafeHtml } from 'kerfjs';`,
708
728
  types,
@@ -1 +0,0 @@
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"],"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,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,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,IAAI,YAAY,GAAA,CAAI,OAAO,MAAM,UAAA,EAAY,WAAA,CAAY,OAAO,OAAO,CAAA;AAAA,EACzE,CAAA;AACF","file":"chunk-3SCGTP5O.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 /** 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]);\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 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-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 </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;\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 onToggle = (event: Event) => {\n if ((event as ToggleEvent).newState === 'open') layout();\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 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 }\n | undefined;\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Element;\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 (!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 drag.moving = true;\n setPinned(true);\n place(drag.left + dx, drag.top + dy);\n };\n const onPointerEnd = (event: PointerEvent) => {\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({ x: box.left, y: 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 = () => layout();\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 if (isOpen()) {\n applySize();\n layout();\n }\n const restore = watchOwnedStyles(surface, owned, {\n attributes: ['data-pinned', 'data-placed', 'aria-pressed'],\n childList: true,\n subtree: true,\n beforeRestore: adoptResize,\n afterRestore: syncAttributes,\n });\n surface.addEventListener('beforetoggle', onBeforeToggle);\n surface.addEventListener('toggle', onToggle);\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('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 if (controllers.get(surface) === controller) controllers.delete(surface);\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/collections/tree-list/model/tree-rows.ts"],"names":[],"mappings":";AA8CO,SAAS,aAAa,IAAA,EAA6B;AACxD,EAAA,OAAO,IAAA,CAAK,QAAA,KAAa,MAAA,IAAa,IAAA,CAAK,WAAA,KAAgB,IAAA;AAC7D;AAMO,SAAS,YAAA,CACd,OACA,QAAA,EACe;AACf,EAAA,MAAM,OAAO,QAAA,YAAoB,GAAA,GAAM,QAAA,GAAW,IAAI,IAAI,QAAQ,CAAA;AAClE,EAAA,MAAM,OAAsB,EAAC;AAC7B,EAAA,MAAM,KAAA,GAAQ,CACZ,QAAA,EACA,KAAA,EACA,QAAA,KACG;AACH,IAAA,QAAA,CAAS,OAAA,CAAQ,CAAC,IAAA,EAAM,KAAA,KAAU;AAChC,MAAA,MAAM,UAAA,GAAa,aAAa,IAAI,CAAA;AACpC,MAAA,MAAM,MAAA,GAAS,UAAA,IAAc,IAAA,CAAK,GAAA,CAAI,KAAK,EAAE,CAAA;AAC7C,MAAA,IAAA,CAAK,IAAA,CAAK;AAAA,QACR,IAAA;AAAA,QACA,KAAA;AAAA,QACA,UAAU,KAAA,GAAQ,CAAA;AAAA,QAClB,SAAS,QAAA,CAAS,MAAA;AAAA,QAClB,GAAI,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAS;AAAA,QAC7C,UAAA;AAAA,QACA,QAAA,EAAU;AAAA,OACX,CAAA;AACD,MAAA,IAAI,MAAA,IAAU,KAAK,QAAA,EAAU,KAAA,CAAM,KAAK,QAAA,EAAU,KAAA,GAAQ,CAAA,EAAG,IAAA,CAAK,EAAE,CAAA;AAAA,IACtE,CAAC,CAAA;AAAA,EACH,CAAA;AACA,EAAA,KAAA,CAAM,KAAA,EAAO,GAAG,MAAS,CAAA;AACzB,EAAA,OAAO,IAAA;AACT;A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AQ,CAAC,IAAA,KACb,IAAA,CAAK,OAAA,CAAQ,CAAC,IAAA,KAAS;AACrB,IAAA,IAAI,IAAA,CAAK,EAAA,KAAO,MAAA,CAAO,EAAA,EAAI;AACzB,MAAA,QAAQ,OAAO,QAAA;AAAU,QACvB,KAAK,QAAA;AACH,UAAA,OAAO,CAAC,OAAQ,IAAI,CAAA;AAAA,QACtB,KAAK,OAAA;AACH,UAAA,OAAO,CAAC,MAAM,KAAM,CAAA;AAAA,QACtB,KAAK,QAAA;AACH,UAAA,OAAO,CAAC,EAAE,GAAG,IAAA,EAAM,QAAA,EAAU,CAAC,GAAI,IAAA,CAAK,QAAA,IAAY,EAAC,EAAI,KAAM,GAAG,CAAA;AAAA;AACrE,IACF;AACA,IAAA,OAAO,IAAA,CAAK,QAAA,GACR,CAAC,EAAE,GAAG,IAAA,EAAM,QAAA,EAAU,KAAA,CAAM,IAAA,CAAK,QAAQ,CAAA,EAAG,CAAA,GAC5C,CAAC,IAAI,CAAA;AAAA,EACX,CAAC,CAAA;AACH,EAAA,OAAO,MAAM,IAAI,CAAA;AACnB","file":"chunk-NR3ZO4LK.js","sourcesContent":["// KF-ECR4XG: the visible rows of a hierarchy. TreeList renders them, and a\n// column explorer can walk the same nodes, so the model stays DOM-free.\nimport type { SafeHtml } from 'kerfjs';\n\nimport type { KerfUiContent } from '../../../../shared/content/semantic-content.js';\n\n/** One node of a hierarchy the application owns. */\nexport interface TreeListNode {\n /** Stable id: the row's `data-item-id` and its key across re-renders. */\n readonly id: string;\n readonly label: string | SafeHtml;\n readonly description?: string | SafeHtml;\n /** A leading icon, normally an unsized LucideIcon. */\n readonly icon?: SafeHtml;\n /** Trailing content, such as a count Badge. */\n readonly trailing?: KerfUiContent;\n readonly disabled?: boolean;\n /** Drags with `wireTreeList`'s `onMove` (KF-WXP6AB). */\n readonly draggable?: boolean;\n /** Child nodes. An empty array is an expandable node with no children yet. */\n readonly children?: readonly TreeListNode[];\n /**\n * Marks a node expandable before its children are loaded. The application\n * loads them when its `toggleAction` handler expands the node.\n */\n readonly hasChildren?: boolean;\n}\n\n/** One visible row: a node with its place in the hierarchy. */\nexport interface TreeListRow {\n readonly node: TreeListNode;\n /** 1 for a top-level node. */\n readonly level: number;\n /** 1-based position among its siblings. */\n readonly position: number;\n /** How many siblings it has, itself included. */\n readonly setSize: number;\n /** The parent's id, or undefined at the top level. */\n readonly parentId?: string;\n /** Whether the node can expand: it has children or `hasChildren`. */\n readonly expandable: boolean;\n /** Whether it is expanded (always false when not expandable). */\n readonly expanded: boolean;\n}\n\n/** Whether a node can expand: it has a children array or `hasChildren`. */\nexport function isExpandable(node: TreeListNode): boolean {\n return node.children !== undefined || node.hasChildren === true;\n}\n\n/**\n * The rows a tree shows: every top-level node, and the children of each\n * expanded node, depth first in order.\n */\nexport function treeListRows(\n nodes: readonly TreeListNode[],\n expanded: ReadonlySet<string> | readonly string[],\n): TreeListRow[] {\n const open = expanded instanceof Set ? expanded : new Set(expanded);\n const rows: TreeListRow[] = [];\n const visit = (\n siblings: readonly TreeListNode[],\n level: number,\n parentId: string | undefined,\n ) => {\n siblings.forEach((node, index) => {\n const expandable = isExpandable(node);\n const isOpen = expandable && open.has(node.id);\n rows.push({\n node,\n level,\n position: index + 1,\n setSize: siblings.length,\n ...(parentId === undefined ? {} : { parentId }),\n expandable,\n expanded: isOpen,\n });\n if (isOpen && node.children) visit(node.children, level + 1, node.id);\n });\n };\n visit(nodes, 1, undefined);\n return rows;\n}\n\n/** The ids on the path from the top level down to `id`, or [] when absent. */\nexport function treeListPath(\n nodes: readonly TreeListNode[],\n id: string,\n): string[] {\n for (const node of nodes) {\n if (node.id === id) return [id];\n const below = node.children ? treeListPath(node.children, id) : [];\n if (below.length) return [node.id, ...below];\n }\n return [];\n}\n\n/**\n * `nodes` with node `sourceId` moved before or after node `target.id`, or\n * appended inside it (KF-WXP6AB): the change `wireTreeList`'s `onMove`\n * reports, applied to a plain node tree. Returns a new tree; an unknown\n * node, a move onto itself, or a move into its own subtree leaves the tree\n * as it is.\n */\nexport function moveTreeListNode(\n nodes: readonly TreeListNode[],\n move: {\n readonly sourceId: string;\n readonly target: {\n readonly id: string;\n readonly position: 'before' | 'after' | 'inside';\n };\n },\n): TreeListNode[] {\n const { sourceId, target } = move;\n const path = treeListPath(nodes, target.id);\n if (!path.length || path.includes(sourceId)) return [...nodes];\n let moved: TreeListNode | undefined;\n const without = (list: readonly TreeListNode[]): TreeListNode[] =>\n list.flatMap((node) => {\n if (node.id === sourceId) {\n moved = node;\n return [];\n }\n return node.children\n ? [{ ...node, children: without(node.children) }]\n : [node];\n });\n const rest = without(nodes);\n if (!moved) return [...nodes];\n const place = (list: readonly TreeListNode[]): TreeListNode[] =>\n list.flatMap((node) => {\n if (node.id === target.id) {\n switch (target.position) {\n case 'before':\n return [moved!, node];\n case 'after':\n return [node, moved!];\n case 'inside':\n return [{ ...node, children: [...(node.children ?? []), moved!] }];\n }\n }\n return node.children\n ? [{ ...node, children: place(node.children) }]\n : [node];\n });\n return place(rest);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/collections/list-item/parts/tree-item.tsx","../src/components/collections/tree-list/tree-list.tsx"],"names":["jsx"],"mappings":";;;;;;;AAuCO,SAAS,YAAA,CAAa;AAAA,EAC3B,MAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,GAAW,KAAA;AAAA,EACX,SAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAsB;AACpB,EAAA,uBACE,IAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAK,QAAA;AAAA,MACL,IAAA,EAAK,UAAA;AAAA,MACL,KAAA,EAAM,eAAA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,gBAAA,EAAe,WAAA;AAAA,MACf,mBAAA,EAAmB,EAAA;AAAA,MACnB,IAAA;AAAA,MAEC,QAAA,EAAA,IAAA,CAAK,GAAA,CAAI,CAAC,GAAA,qBACTA,GAAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,MAAA,EAAQ,IAAI,IAAA,CAAK,EAAA;AAAA,UACjB,KAAA,EAAO,IAAI,IAAA,CAAK,KAAA;AAAA,UAChB,WAAA,EAAa,IAAI,IAAA,CAAK,WAAA;AAAA,UACtB,IAAA,EAAM,IAAI,IAAA,CAAK,IAAA;AAAA,UACf,QAAA,EAAU,IAAI,IAAA,CAAK,QAAA;AAAA,UACnB,OAAO,GAAA,CAAI,KAAA;AAAA,UACX,UAAU,GAAA,CAAI,QAAA;AAAA,UACd,SAAS,GAAA,CAAI,OAAA;AAAA,UACb,YAAY,GAAA,CAAI,UAAA;AAAA,UAChB,UAAU,GAAA,CAAI,QAAA;AAAA,UACd,QAAA,EAAU,GAAA,CAAI,IAAA,CAAK,EAAA,KAAO,QAAA;AAAA,UAC1B,SAAA,EAAW,GAAA,CAAI,IAAA,CAAK,EAAA,KAAO,OAAA;AAAA,UAC3B,QAAA,EAAU,IAAI,IAAA,CAAK,QAAA;AAAA,UACnB,SAAA,EAAW,IAAI,IAAA,CAAK,SAAA;AAAA,UACpB,OAAA;AAAA,UACA,MAAA;AAAA,UACA;AAAA;AAAA,OAEH;AAAA;AAAA,GACH;AAEJ","file":"chunk-Z3BT2SZE.js","sourcesContent":["// KF-ECR4XG: ListItem's treeitem form, the row TreeList renders. It is a\n// ListItem (same geometry, hover, selected tint) that also carries its tree\n// position, an indent for its level, and a disclosure arrow. Internal: the\n// `@kerfjs/ui/list-item` facade does not re-export it.\nimport type { SafeHtml } from 'kerfjs';\n\nimport type { KerfUiContent } from '../../../../shared/content/semantic-content.js';\nimport { remify } from '../../../../shared/styles/css-values.js';\nimport { DisclosureArrow } from '../../../navigation/disclosure-arrow/disclosure-arrow.js';\nimport { listItemContent } from '../internal/list-item-content.js';\n\nexport interface ListTreeItemProps {\n readonly itemId: string;\n readonly label: string | SafeHtml;\n readonly description?: string | SafeHtml;\n readonly icon?: SafeHtml;\n readonly trailing?: KerfUiContent;\n readonly level: number;\n readonly position: number;\n readonly setSize: number;\n readonly expandable: boolean;\n readonly expanded: boolean;\n readonly selected: boolean;\n /** The one row in the tree's Tab order (roving tabindex). */\n readonly focusable: boolean;\n readonly disabled?: boolean;\n /** A native drag source for TreeList drag-and-drop. */\n readonly draggable?: boolean;\n readonly density: 'default' | 'compact' | 'standard';\n /** Delegated action for choosing the row. */\n readonly action: string;\n /** Delegated action for its disclosure arrow. */\n readonly toggleAction: string;\n}\n\n/**\n * A `role=\"treeitem\"` ListItem. A disabled row stays focusable for keyboard\n * navigation (`aria-disabled`) but carries no actions.\n */\nexport function ListTreeItem({\n itemId,\n label,\n description,\n icon,\n trailing,\n level,\n position,\n setSize,\n expandable,\n expanded,\n selected,\n focusable,\n disabled = false,\n draggable,\n density,\n action,\n toggleAction,\n}: ListTreeItemProps) {\n return (\n <button\n type=\"button\"\n role=\"treeitem\"\n class=\"kui-list-item\"\n style={`--_kui-list-item-tree-level:${level}`}\n tabindex={focusable ? 0 : -1}\n data-component=\"list-item\"\n data-key={itemId}\n data-action={disabled ? undefined : action}\n data-item-id={itemId}\n data-has-icon={String(Boolean(icon))}\n data-has-description={String(Boolean(description))}\n data-density={density === 'standard' ? 'default' : density}\n data-divider=\"none\"\n data-kui-disabled={disabled ? 'true' : undefined}\n draggable={draggable && !disabled ? 'true' : undefined}\n aria-level={String(level)}\n aria-posinset={String(position)}\n aria-setsize={String(setSize)}\n aria-expanded={expandable ? String(expanded) : undefined}\n aria-selected={String(selected)}\n aria-disabled={disabled ? 'true' : undefined}\n >\n <span\n class=\"kui-list-item__disclosure\"\n aria-hidden=\"true\"\n data-action={expandable && !disabled ? toggleAction : undefined}\n data-item-id={expandable ? itemId : undefined}\n >\n {expandable ? (\n <DisclosureArrow open={expanded} size={remify(16)} />\n ) : null}\n </span>\n {listItemContent({ label, description, icon, trailing, tile: null })}\n </button>\n );\n}\n","import {\n filterDataAttributes,\n type RootDataAttributes,\n} from '../../../shared/dom/extension-attributes.js';\nimport { ListTreeItem } from '../list-item/parts/tree-item.js';\nimport {\n type TreeListNode,\n treeListPath,\n treeListRows,\n} from './model/tree-rows.js';\n\nexport {\n isExpandable,\n moveTreeListNode,\n type TreeListNode,\n treeListPath,\n type TreeListRow,\n treeListRows,\n} from './model/tree-rows.js';\n\nconst TREE_LIST_PROTECTED = new Set(['data-component', 'data-tree-list-id']);\n\nexport interface TreeListProps {\n /** Identifies the tree for `wireTreeList` and in tests. */\n id: string;\n /** The tree's accessible name, such as \"Document outline\". */\n label: string;\n /** The hierarchy. The application owns it. */\n nodes: readonly TreeListNode[];\n /** Ids of the expanded nodes. The application owns this state. */\n expanded: ReadonlySet<string> | readonly string[];\n /** The selected node's id. */\n selected?: string;\n /** Delegated action for choosing a row; the row's `data-item-id` names it. */\n action: string;\n /**\n * Delegated action for expanding or collapsing a row, from its disclosure\n * arrow or the keyboard (Right and Left). Flip the id in `expanded`.\n */\n toggleAction: string;\n /** Row density: `default` (44px rows) or `compact` (36px). */\n density?: 'default' | 'compact' | /** @deprecated Use default. */ 'standard';\n className?: string;\n /** Safe `data-*` metadata for the tree element. */\n rootAttributes?: RootDataAttributes;\n /** Native named-slot assignment when composed inside a web component. */\n slot?: string;\n}\n\n/**\n * A hierarchical list: ListItem rows indented by depth, with a disclosure\n * arrow on each row that has children. The tree is an ARIA `tree` of flat\n * `treeitem` rows; the application owns the nodes, which are expanded, and\n * which is selected, and handles `action` and `toggleAction`. Wire keyboard\n * navigation with `wireTreeList`.\n */\nexport function TreeList({\n id,\n label,\n nodes,\n expanded,\n selected,\n action,\n toggleAction,\n density = 'default',\n className = '',\n rootAttributes = {},\n slot,\n}: TreeListProps) {\n const rows = treeListRows(nodes, expanded);\n const visible = new Set(rows.map((row) => row.node.id));\n // The Tab stop: the selected row, or the nearest visible ancestor of a\n // selection inside a collapsed node, or else the first row.\n const focusId =\n (selected === undefined\n ? undefined\n : treeListPath(nodes, selected)\n .reverse()\n .find((pathId) => visible.has(pathId))) ?? rows[0]?.node.id;\n return (\n <div\n {...filterDataAttributes(rootAttributes, TREE_LIST_PROTECTED)}\n id={id}\n role=\"tree\"\n class={`kui-tree-list ${className}`.trim()}\n aria-label={label}\n data-component=\"tree-list\"\n data-tree-list-id={id}\n slot={slot}\n >\n {rows.map((row) => (\n <ListTreeItem\n itemId={row.node.id}\n label={row.node.label}\n description={row.node.description}\n icon={row.node.icon}\n trailing={row.node.trailing}\n level={row.level}\n position={row.position}\n setSize={row.setSize}\n expandable={row.expandable}\n expanded={row.expanded}\n selected={row.node.id === selected}\n focusable={row.node.id === focusId}\n disabled={row.node.disabled}\n draggable={row.node.draggable}\n density={density}\n action={action}\n toggleAction={toggleAction}\n />\n ))}\n </div>\n );\n}\n"]}