import { C as TreeItemDblClickEvent, D as TreeSelectAllOptions, E as TreeSearchHost, M as TreeDataModel, R as ListDragPreviewRenderer, V as ListNativeDragStartDetail, _ as TreeDropTarget, a as TreeComponent, c as TreeDragContext, d as TreeDragStartEvent, h as TreeDropEvent, i as TreeCollapseEvent, j as TreeTickleEvent, k as TreeSelectEvent, l as TreeDragEndEvent, m as TreeDropDetail, n as TreeActivateEvent, o as TreeComponentEventMap, p as TreeDropContext, s as TreeDndMode, u as TreeDragOverEvent, w as TreeNavigateOptions, x as TreeItemClickEvent, y as TreeExpandEvent, z as ListDragPreviewSourceResolver } from "./tree-component-BE7OEIiH.js"; import { a as TreeItem, i as TreeInteractionMode, n as TreeExclusivity, o as TreeNode, r as TreeFilterPredicate, s as TreeSelectionFilter, t as LoadChildrenCallback } from "./types-6hpXRKt7.js"; import { a as ViewStateBase, t as GetViewStateOptions } from "./types-16GC5k1z.js"; import { m as ListSelectKeysDetail, p as ListSelectIntentSource, u as ListSelectIntentDetail } from "./list-selection-types-CKTt7Rrw.js"; import "./index-Cdcek1Oj.js"; import { S as ListSearchController } from "./index-C3N2TOmf.js"; import { t as ListNativeDragController } from "./list-native-drag-controller-BgGnS04E.js"; import { n as TickledController } from "./tickled-controller-B4Tql3HN.js"; import { LitElement, PropertyValues, ReactiveController, ReactiveControllerHost, TemplateResult, nothing } from "lit"; import { CommandRegistry } from "@clinth/ui-commands"; import { TraversableTree } from "@ixfx/collections"; /** Tree layout/display configuration (tree-specific, not shared). */ type TreeConfig = { indent: number; }; /** `ixfx-tree-list` view state. All fields are the shared base fields. */ type TreeListViewState = ViewStateBase; /** * `auto` windows the list once it has more than `virtualizeThreshold` visible * rows; `on` / `off` force it. */ type TreeVirtualize = `auto` | `on` | `off`; /** * Controls whether row enter/leave animations run. * - `'auto'` (default): Animate normally, respecting `prefers-reduced-motion` and the `MAX_ANIMATED_ROWS` threshold * - `'always'`: Always animate, even above `MAX_ANIMATED_ROWS` * - `'never'`: Never animate row enter/leave */ type TreeAnimation = `auto` | `always` | `never`; declare class TreeBaseElement extends LitElement implements TreeComponent, TreeSearchHost { #private; root: TreeNode | undefined; model: TreeDataModel | undefined; /** Callback to lazily load children for a node. Superseded by `model` when both are set. */ loadChildren: LoadChildrenCallback | undefined; exclusivity: TreeExclusivity; selectionFilter: TreeSelectionFilter; /** Controls how pointer/keyboard gestures map to selection changes. Default: `'standard'`. */ interactionMode: TreeInteractionMode; selectedNode: TreeNode | undefined; protected _selectedNodes: Set; get selectedNodes(): ReadonlySet; filterPredicate: TreeFilterPredicate | undefined; disableKeyboardNavigation: boolean; /** * Let hover follow rows that scroll beneath a stationary pointer. Off by * default: while a scroll gesture is active, row `pointerenter` is ignored so * the hover cursor holds still instead of trailing the content. Hover resumes * on the next real pointer movement, or when the pointer leaves the tree. */ scrollHoverTickle: boolean; registry: CommandRegistry | undefined; /** * Space-separated subset of `navigate select filter` — limits which * incremental-search modes are offered. Unset ⇒ all three; empty ⇒ search * disabled. See `docs/infra-incremental.md`. */ searchModes: string | undefined; itemDnd: TreeDndMode; acceptDropTypes: string | undefined; dndExpandHoverMs: number; /** * Whether a drag that only reorders siblings (no dragged node changes parent) * is honoured. Default `true`. Set `reorderable="false"` for models with no * meaningful child order (e.g. a filesystem) — pure-reorder drags then get no * drop indicator and emit no `tree-drop`. Reparenting is unaffected. */ reorderable: boolean; /** * VS Code-style sticky headers: while scrolling vertically, the ancestors of * the top-visible row stick to the top of the list. Clicking a stuck header * selects that ancestor and scrolls it into view; clicking its caret toggles * expansion. On by default — set `sticky-headers="false"` to opt out. */ stickyHeaders: boolean; /** * Windowed rendering: only the rows near the viewport exist in the DOM, so a * node with tens of thousands of children stays fast. `auto` (default) * switches on above `virtualizeThreshold` visible rows; `on` / `off` force it. * While windowed, rows are a fixed `--tree-item-height` tall and expand / * collapse rows do not animate. */ virtualize: TreeVirtualize; /** Visible-row count above which `virtualize="auto"` windows the list. */ virtualizeThreshold: number; /** * Controls whether row enter/leave animations run. * - `'auto'` (default): Animate normally, respecting `prefers-reduced-motion` and `MAX_ANIMATED_ROWS` * - `'always'`: Always animate, even when many rows change at once * - `'never'`: Skip all row enter/leave animations */ animation: TreeAnimation; dragPreviewRenderer: ListDragPreviewRenderer | undefined; dragPreviewSource: ListDragPreviewSourceResolver | undefined; canDrag: ((ctx: TreeDragContext) => boolean) | undefined; canDrop: ((ctx: TreeDropContext) => boolean) | undefined; parseExternalDrop: ((dt: DataTransfer) => TreeNode[] | undefined) | undefined; applyInternalDrop: boolean; /** Immutable: replace via `#setExpanded` so the flat-row cache is invalidated. */ protected _expandedKeys: ReadonlySet; /** * Whether restoring view state may call `loadChildren` / `model` to open * saved branches that aren't loaded yet (one at a time, cascading down the * saved path). Default `true`. */ restoreLoads: boolean; /** Bumped whenever `_selectedNodes` content may have changed. */ protected _selectionVersion: number; /** * Call after editing `node.children` / `node.item` in place (outside * `TreeDataModel`). Drops the cached whole-tree indexes and re-renders. */ invalidateStructure(): void; /** Scroll offset used for the last render; kept in sync with the container's. */ private _scrollTop; /** Structure version for cache keys in subclasses (bumped on root / model change and lazy loads). */ protected get _structureVersion(): number; /** Depths at which any loaded node carries an icon (stable across expansion). */ protected get _depthsWithIcons(): ReadonlySet; protected tickled: TickledController; /** * Row `pointerenter` funnel: moves the hover cursor unless a scroll gesture * is sliding rows beneath a stationary pointer (see `scrollHoverTickle`). * Subclasses rendering their own rows should call this rather than the * tickled controller directly. */ protected _handleRowPointerEnter(node: TreeNode, depth: number): void; protected _focusedDepth: number; /** Incremental search (navigate / select / filter). See `docs/infra-incremental.md`. */ readonly search: ListSearchController<{ node: TreeNode; depth: number; }>; /** * Ancestor keys currently stuck to the top of the list (root-ward order). * Recomputed on scroll and structural updates; empty when nothing is stuck. */ protected _stickyKeys: string[]; protected get nativeDrag(): ListNativeDragController; protected get dropState(): TreeDropTarget | undefined; /** Keys of the nodes currently being dragged out of this tree. */ protected get nativeDragKeys(): ReadonlySet; willUpdate(changedProps: PropertyValues): void; /** True while `node` is a fading ghost row (removed / collapsed, still animating out). */ protected _isLeaving(node: TreeNode): boolean; /** * Kept for subclass compatibility. Filtered-out rows are no longer rendered * at all (they are omitted from the flat list), so this is `false` for every * rendered row. */ protected _isFilteredOut(_node: TreeNode, _depth: number): boolean; updated(changedProps: PropertyValues): void; connectedCallback(): void; disconnectedCallback(): void; getConfig(): TreeConfig; setConfig(config: Partial): void; /** * Snapshot selection, expansion, cursor and scroll as plain JSON, keyed by * `item.key`. Includes pending state for keys not currently loaded. */ getViewState(options?: GetViewStateOptions): TreeListViewState; /** * Apply saved view state. Fields present replace the current ones; keys * that aren't loaded yet are applied as they appear — including via * `loadChildren` / `model` for saved-open branches when `restoreLoads`. */ setViewState(state: Partial): void; clearPendingViewState(): void; select(node: TreeNode): void; deselect(node: TreeNode): void; clearSelection(): void; /** * Select every selectable node in the tree, or only the matches while a * `filterPredicate` is active. Nodes inside collapsed branches are included; * unloaded (lazy) children are not. With `visibleOnly`, only rows that are * showing are selected (Ctrl+A). In `checked` mode checking a row checks its * descendants, so `visibleOnly` makes no difference there. */ selectAll(options?: TreeSelectAllOptions): void; /** Mirror of {@link selectAll}: deselect the same set of nodes it would select. */ deselectAll(options?: TreeSelectAllOptions): void; /** * Expand every already-loaded branch in a single update. With `maxDepth`, * only branches at depth < `maxDepth` are expanded (the root's children are * depth 0), so rows at depth `maxDepth` become visible but stay collapsed. * * Unloaded (lazy) branches are not fetched — call again once their children * have loaded to expand further. Bulk expansion ignores `exclusivity`. Fires * one `expand` event per branch that actually opens — none for branches that * were already expanded, including ones opened by filter auto-expansion. * * @param maxDepth - Maximum depth to expand to * @param animate - Whether to animate row enter/leave. When omitted, uses the `animation` property value. */ expandAll(maxDepth?: number, animate?: boolean): void; /** * Collapse expanded branches in a single update. With `maxDepth`, only * branches at depth >= `maxDepth` are collapsed, leaving the tree open down * to depth `maxDepth - 1` (`collapseAll(0)` is a full collapse). Fires one * `collapse` event per branch that actually closes. * * @param maxDepth - Maximum depth to collapse from * @param animate - Whether to animate row enter/leave. When omitted, uses the `animation` property value. */ collapseAll(maxDepth?: number, animate?: boolean): void; navigateTo(keys: readonly string[], options?: TreeNavigateOptions): boolean; navigateToNode(predicate: (node: TreeNode) => boolean, animate?: boolean): boolean; /** Expand ancestors + move the cursor to `key`, without touching the selection (search "navigate" mode). */ revealKey(key: string, animate?: boolean): boolean; /** Replace the selection with `nodes` (subject to `selectionFilter`) — search "select" mode. */ selectMany(nodes: Iterable): void; getNodes(): ReadonlyArray<{ node: TreeNode; depth: number; }>; protected renderNodeContent(node: TreeNode, depth: number): TemplateResult | typeof nothing; protected _handleItemClick(node: TreeNode, depth: number, event?: MouseEvent): void; protected _handleCheckboxClick(event: MouseEvent, node: TreeNode, _depth: number, source?: ListSelectIntentSource): void; protected _isSelected(node: TreeNode): boolean; protected _isFocused(node: TreeNode): boolean; protected _isExpanded(node: TreeNode, _depth?: number): boolean; protected get _pendingNode(): TreeNode | undefined; protected renderLoadingIndicator(): TemplateResult | typeof nothing; protected render(): TemplateResult<1>; /** * `{ posinset, setsize }` for `aria-posinset` / `aria-setsize`. A windowed * list has most siblings out of the DOM, so assistive tech cannot count them. */ protected _ariaSetInfo(node: TreeNode): { posInSet: number; setSize: number; } | undefined; /** Shared drag-and-drop render state for a row, used by every `_renderNode` variant. */ protected _dndRowState(node: TreeNode): { draggable: boolean; dragging: boolean; dropTarget: boolean; dropPosition?: TreeDropTarget[`position`]; dropDepth?: number; }; protected _renderNode(node: TreeNode, depth: number): TemplateResult; static styles: import("lit").CSSResult[]; } declare global { interface HTMLElementTagNameMap { 'ixfx-tree-base': TreeBaseElement; } } interface TreeBaseElementEventMap extends TreeComponentEventMap { 'item-click': TreeItemClickEvent; 'item-dblclick': TreeItemDblClickEvent; 'expand': TreeExpandEvent; 'collapse': TreeCollapseEvent; 'select': TreeSelectEvent; 'list-select': CustomEvent; }>; 'list-select-intent': CustomEvent; 'tickle': TreeTickleEvent; 'activate': TreeActivateEvent; 'list-native-drag-start': CustomEvent>; 'tree-drag-start': TreeDragStartEvent; 'tree-drag-over': TreeDragOverEvent; 'tree-drop': TreeDropEvent; 'tree-drag-end': TreeDragEndEvent; } interface TreeBaseElement { addEventListener: ((type: K, listener: (this: TreeBaseElement, event: TreeBaseElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void); removeEventListener: ((type: K, listener: (this: TreeBaseElement, event: TreeBaseElementEventMap[K]) => void, options?: boolean | EventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void); } /** Checkbox tri-state in `checked` interactionMode: a branch node is `indeterminate` when some but not all of its descendants are selected. */ type TreeCheckboxState = `checked` | `unchecked` | `indeterminate`; declare class TreeListElement extends TreeBaseElement { #private; /** * Optional renderer for the checkbox shown in `checked` interactionMode. * Receives the node's current tri-state (`checked` / `unchecked` / `indeterminate`, * the latter when some but not all descendants are selected) and returns a Lit * template. * * When set, the checkbox becomes a `` whose contents are * whatever this returns. When unset, a native `` is used. * * @example * list.checkboxRenderer = (state) => state === `unchecked` * ? html`` * : html` * * `; */ checkboxRenderer: ((state: TreeCheckboxState) => unknown) | undefined; /** * In `checked` mode, whether unselectable rows (`item.selectable === false`) * keep the space their checkbox would occupy, so their carets and labels line * up with selectable siblings. When off (default) they reserve no space. */ alignCheckboxes: boolean; private _partialKeys; /** * Nodes shown as *partially* selected (a part of the resource is selected): * `data-partial`, an indeterminate checkbox in `checked` mode, and an * accessible description otherwise. Independent of the selection — a key in * both counts as selected. In `checked` mode it combines with the state * derived from loaded descendants: a node is indeterminate if either says so. * Replace-on-set. */ get partialKeys(): ReadonlySet; set partialKeys(keys: Iterable); willUpdate(changedProps: PropertyValues): void; protected renderNodeContent(node: TreeNode, depth: number): TemplateResult; protected _renderNode(node: TreeNode, depth: number): TemplateResult; static styles: import("lit").CSSResult[]; } declare global { interface HTMLElementTagNameMap { 'ixfx-tree-list': TreeListElement; } } interface TreeListElement { addEventListener: ((type: K, listener: (this: TreeListElement, event: TreeBaseElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void); } type TreeControllerOptions = { valueToItem: (value: T, node: TraversableTree) => TreeItem; }; declare class TreeController { #private; constructor(root: TraversableTree, element: TreeBaseElement, options: TreeControllerOptions); connect(): void; disconnect(): void; /** * Re-derive children for every already-materialised node from the source tree * and patch them in place. Existing `TreeNode` objects are reused by key, so * expansion and selection survive; only added and removed nodes change. Calls * `invalidateStructure()` once. */ sync(): void; /** The source node whose item key is `key`, if it has been materialised. */ lookupByKey(key: string): TraversableTree | undefined; /** Navigate using item keys (root excluded), without searching the source tree. */ navigateToKeyPath(keys: readonly string[], options?: TreeNavigateOptions): boolean; /** Navigate to the source node with this identity, walking up via `getParent()`. */ navigateToIdentity(identity: unknown, options?: TreeNavigateOptions): boolean; navigateToValue(predicate: (value: T) => boolean, options?: TreeNavigateOptions): boolean; } interface TreeDropVisibleRow { readonly key: string; readonly node: TreeNode; readonly depth: number; /** Index of this row in the full flat (visible) list — not in the `rows` array. */ readonly index: number; readonly rect: DOMRect; } /** Structural facts about a visible row, independent of geometry. */ interface TreeDropRowInfo { readonly node: TreeNode; readonly depth: number; /** Parent key, or `undefined` for a root-level row. */ readonly parentKey: string | undefined; } /** What a `dragover` / `drop` DataTransfer resolved to for this tree. */ interface TreeDropResolvedDrag { readonly source: `internal` | `external`; /** Keys of the dragged nodes (empty for external). */ readonly keys: readonly string[]; /** The dragged nodes — live nodes for internal, parsed payload for external. */ readonly nodes: readonly TreeNode[]; } type TreeDropControllerConfig = { getDndMode: () => `none` | `internal` | `external` | `both`; getExpandHoverMs: () => number; /** * Measured rows in display order, each with a fresh viewport rect. May be * limited to the rows intersecting the scroll container — ancestors and * siblings are resolved through `getRowInfo` / `getChildren`, not from here. * Host may cache. */ getVisibleRows: () => TreeDropVisibleRow[]; /** Flat-list info for a visible key (no geometry), or `undefined` if not visible. */ getRowInfo: (key: string) => TreeDropRowInfo | undefined; /** Children of `parentKey`, or the root's children when undefined. */ getChildren: (parentKey: string | undefined) => readonly TreeNode[]; getIndentPx: () => number; getScrollContainer: () => HTMLElement | undefined; /** True when `key` is `ancestorKey` or a descendant of it. */ isSelfOrDescendant: (ancestorKey: string, key: string) => boolean; /** True when the node is currently expanded in the UI. */ isExpanded: (key: string) => boolean; /** * When `false`, an internal drop that would not change any dragged node's * parent (pure sibling reorder, or dropping back into the current parent) is * rejected outright — no indicator, no `tree-drop`. */ isReorderAllowed: () => boolean; /** Current parent key of `key`, or `undefined` for a root-level node. */ getParentKey: (key: string) => string | undefined; /** * Decide whether this DataTransfer is acceptable and resolve the dragged set. * `phase` is `hover` during dragenter/dragover (DataTransfer is read-protected — * resolve internal drags from the drag registry) and `drop` during drop * (getData is readable; external payloads may be parsed here). Return * `undefined` to reject (the tree will not become a drop target). */ resolveDrag: (dataTransfer: DataTransfer, phase: `hover` | `drop`) => TreeDropResolvedDrag | undefined; vet: (ctx: TreeDropContext) => boolean; expandKey: (key: string) => void; /** Fired whenever the resolved drop target changes (undefined = none / rejected). */ onDropStateChange: (state: TreeDropTarget | undefined) => void; /** Fired when a drag enters / leaves this tree. */ onActiveChange: (active: boolean) => void; commitDrop: (detail: TreeDropDetail) => boolean; onDragEnd: (dropped: boolean) => void; }; declare class TreeDropController implements ReactiveController { #private; constructor(host: ReactiveControllerHost & HTMLElement, config: TreeDropControllerConfig); /** A drag is currently over this tree. */ get isDragging(): boolean; /** A drag is over this tree but the current position is not a valid drop. */ get isRejected(): boolean; get dropState(): TreeDropTarget | undefined; hostConnected(): void; /** Bind once the shadow `#container` exists (it does not yet at `hostConnected`). */ hostUpdated(): void; hostDisconnected(): void; } export { TreeDropVisibleRow as a, TreeListElement as c, TreeBaseElement as d, TreeBaseElementEventMap as f, TreeConfig as h, TreeDropRowInfo as i, TreeCheckboxState as l, TreeListViewState as m, TreeDropControllerConfig as n, TreeController as o, TreeVirtualize as p, TreeDropResolvedDrag as r, TreeControllerOptions as s, TreeDropController as t, TreeAnimation as u };