import { M as TreeDataModel, P as ListDragDataTransferWriter } from "./tree-component-BE7OEIiH.js"; import { o as TreeNode, r as TreeFilterPredicate, t as LoadChildrenCallback } from "./types-6hpXRKt7.js"; import { a as ListDropTarget, i as ListDropPositions, n as ListCanReorder, t as ListCanDrop, u as ListResolveInternalDrag } from "./list-drop-types-Bye1r3Ub.js"; import { a as ViewStateBase, t as GetViewStateOptions } from "./types-16GC5k1z.js"; import { r as VerticalListElement, v as ListItemEffect } from "./vertical-list-DPWHc6w1.js"; import { h as ListSelectionMode, i as ListInteractionMode } from "./list-selection-types-CKTt7Rrw.js"; import "./index-Cdcek1Oj.js"; import "./crumb-navigation-9DCfAlTC.js"; import "./icon-YIyJDwM9.js"; import { LitElement, PropertyValues } from "lit"; /** How branches and leaves are ordered within one level. */ type FlatListBranchOrder = `first` | `mixed`; type FlatListNavigateDetail = { /** Key path (excluding the root) of the level now shown. */ readonly path: readonly string[]; /** Key path of the level shown before. */ readonly previousPath: readonly string[]; /** The node whose children are now listed (the root when `path` is empty). */ readonly node: TreeNode; /** `into` = descended, `up` = moved to an ancestor, `jump` = anything else (crumb, API). */ readonly direction: `into` | `up` | `jump`; }; type FlatListSelectDetail = { readonly selected: ReadonlySet; readonly selectedKeys: ReadonlySet; readonly previous: ReadonlySet; }; type FlatListActivateDetail = { readonly node: TreeNode; }; type FlatListDropDetail = { /** The row dropped on — a branch is *not* entered — or the current level's node for empty space or a gap between rows. */ readonly node: TreeNode; readonly dataTransfer: DataTransfer; /** What the drop resolved to: `on` a row, `between` two rows of the current level, or `empty` space. */ readonly target: ListDropTarget; }; type FlatListContextMenuDetail = { /** The row the menu was requested on (already selected). */ readonly node: TreeNode; /** The whole selection, `node` included. */ readonly nodes: readonly TreeNode[]; readonly x: number; readonly y: number; }; type FlatListEditCommitDetail = { readonly node: TreeNode; readonly value: string; }; type FlatListEditCancelDetail = { readonly node: TreeNode; }; /** * `ixfx-flat-list` view state. `selected`, `focus` and `scroll` belong to the * level at `path`; they are held until that level is shown, then handed to * the inner list. */ type FlatListViewState = ViewStateBase & { /** Keys from the root (excluded) to the level shown — the `path` property. */ readonly path?: readonly string[]; }; type FlatListNavigateEvent = CustomEvent; type FlatListSelectEvent = CustomEvent; type FlatListActivateEvent = CustomEvent; type FlatListDropEvent = CustomEvent; type FlatListContextMenuEvent = CustomEvent; type FlatListEditCommitEvent = CustomEvent; type FlatListEditCancelEvent = CustomEvent; interface FlatListElementEventMap { 'flat-list-navigate': FlatListNavigateEvent; 'flat-list-select': FlatListSelectEvent; 'flat-list-activate': FlatListActivateEvent; 'flat-list-drop': FlatListDropEvent; 'flat-list-context-menu': FlatListContextMenuEvent; 'flat-list-edit-commit': FlatListEditCommitEvent; 'flat-list-edit-cancel': FlatListEditCancelEvent; } /** * Navigates a tree inside one flat list. Each level shows its branches and * leaves together in an `ixfx-vertical-list`; entering a branch swaps the list * for that branch's children, and an `ixfx-crumb-navigation` pinned above the * scroll area shows the path and jumps back up. * * Uses the same `TreeNode` / `TreeDataModel` data as `ixfx-crumb-navigation` * and `ixfx-tree-list`. As in crumb-navigation, lazily loaded children are * written back to `node.children`. * * Selection and keyboard behaviour is the inner list's. On top of that: * double-click / Enter / ArrowRight enter the cursor branch; * ArrowLeft / Backspace go up. Selection is cleared on every level change. * * Events (all bubble, composed) * - `flat-list-navigate` `{ path, previousPath, node, direction }` * - `flat-list-select` `{ selected: Set, selectedKeys, previous }` * - `flat-list-activate` `{ node }` — a leaf was double-clicked / Enter pressed * The inner list's own `list-*` events also cross the shadow boundary. * * CSS variables (others, e.g. `--list-item-height`, pass through to the list) * --flat-list-bg: var(--list-bg, var(--surface-3)); * --flat-list-text: var(--list-text, var(--surface-3-text)); * --flat-list-border: var(--list-border, var(--border)); * --flat-list-radius: var(--list-radius, var(--radius-s)); * --flat-list-crumb-padding: var(--space-xs); * --flat-list-crumb-font-size: var(--text-s); * --flat-list-toolbar-gap: var(--space-xs); // between the crumbs and slotted toolbar items * --flat-list-chevron-gap: 0.4em; // space after the branch chevron * --flat-list-marked-bg / --flat-list-marked-bar: the `marked-key` row * --flat-list-empty-text: var(--surface-muted-text); */ declare class FlatListElement extends LitElement { #private; root: TreeNode | undefined; model: TreeDataModel | undefined; /** Keys from the root (excluded) to the level being shown. */ path: readonly string[]; /** Lazily loads a branch's children when `node.children` is `undefined`. */ loadChildren: LoadChildrenCallback | undefined; filterPredicate: TreeFilterPredicate | undefined; /** Orders nodes within the level (within each half when `branchOrder` is `first`). */ sort: ((a: TreeNode, b: TreeNode) => number) | undefined; branchOrder: FlatListBranchOrder; selectionMode: ListSelectionMode; interactionMode: ListInteractionMode; /** * Row keys shown as *partially* selected (see `ixfx-vertical-list`'s * `partialKeys`). Independent of the selection; a key in both counts as selected. */ partialKeys: ReadonlySet; itemWrap: `stop` | `wrap`; searchModes: string | undefined; itemsDraggable: boolean; /** Write an application payload onto the drag's `DataTransfer`. Forwarded to the inner list. */ writeDataTransfer: ListDragDataTransferWriter | undefined; /** Rows (and empty space) accept native drops. See `flat-list-drop`. */ itemsDroppable: boolean; /** * Which targets a drag can resolve to: onto a row (`on`, the default), into the gap between two rows * (`between`), or both. Forwarded to the inner `ixfx-vertical-list`; `flat-list-drop` reports the target. */ dropPositions: ListDropPositions; /** * A drag that starts in this list and ends between its own rows is a reorder: the inner list's * `list-reorder` (keys are node keys, in display order) bubbles out of this element. The list never * reorders anything — the host owns the order (see `applyListReorder`). Implies `items-draggable`. */ itemsReorderable: boolean; /** * Refuse a drop before it is highlighted or reported, given the resolved target: `on` a row, * `between` two rows of the current level, or `empty` space (the current level itself). */ canDrop: ListCanDrop | undefined; /** Sync gate for internal moves (e.g. nothing may go above a pinned row). */ canReorder: ListCanReorder | undefined; /** * For a host that cancels the browser drag in `list-native-drag-start` and starts an OS drag in its * place: say which node keys a drag carries, so a drop inside the list is still a reorder. */ resolveInternalDrag: ListResolveInternalDrag | undefined; /** * Opt in to in-place rename. Called with the typed text and the node when * the user commits; return `false` to reject it. Without it nothing can be * renamed and rows are plain text. Rows must also have `item.editable`. */ validateEdit: ((value: string, node: TreeNode) => boolean) | undefined; /** Key of a node to keep visibly marked across level changes (unlike selection). */ markedKey: string | undefined; /** Only render the visible rows. Needs `itemHeight`. See `ixfx-vertical-list`. */ virtualize: boolean; /** Fixed row height in px, required for `virtualize`. */ itemHeight: number; /** Show an Up button in the crumb bar. Off by default: clicking the last crumb goes up too. */ /** Row entry / exit effect when the level changes (`sweep`, or `none`). See `ixfx-vertical-list`. */ itemEffect: ListItemEffect; withUp: boolean; hideRoot: boolean; /** * Hide the breadcrumb navigation (and its Up button). Navigation still works * by keyboard, double-click and the `navigate*()` methods. A slotted toolbar * stays visible; with nothing slotted the whole bar goes. */ hideNav: boolean; /** Shown when the current level has no children. */ emptyText: string; /** Mirrors the inner list's `:focus-visible`, so the ring can go round the whole component. */ private _focusVisible; /** Whether anything is slotted into the toolbar; an empty toolbar takes no space. */ private _hasToolbar; private _rows; private _loading; /** The inner list, for registry / search commands and other advanced use. */ get list(): VerticalListElement | undefined; /** Command registry carrying the inner list's `list.search.*` commands. */ get registry(): VerticalListElement[`registry`]; /** Run a command on the inner list, e.g. `dispatch('list.search.filter')`. */ dispatch(commandId: string, args?: Record): void; /** * Rename a row in place. Needs `validateEdit`, and only rows whose * `item.editable` is true can be edited. Ends with `flat-list-edit-commit` or `flat-list-edit-cancel`; the * label is not rewritten — update the tree in response. Returns false if * the row is unknown, not editable, or not on screen. */ beginEdit(key: string): boolean; /** The node whose children are listed. */ get currentNode(): TreeNode | undefined; get selectedNodes(): ReadonlySet; /** Show the children of the node at this key path. Returns false if the path does not resolve. */ navigateTo(keys: readonly string[]): boolean; /** Enter the child branch with this key. */ navigateInto(key: string): boolean; /** Move to the parent level. Returns false at the root. */ navigateUp(): boolean; /** * Snapshot the level shown (`path`) and, from the inner list, its selection, * cursor and scroll. Includes a saved level not reached yet. */ getViewState(options?: GetViewStateOptions): FlatListViewState; /** * Go to a saved level. Keys not loaded yet are reached as they load (the * level shown is always loaded); `selected` / `focus` / `scroll` apply once * that level is shown. */ setViewState(state: Partial): void; clearPendingViewState(): void; disconnectedCallback(): void; protected willUpdate(changed: PropertyValues): void; protected updated(changed: PropertyValues): void; protected render(): import("lit").TemplateResult<1>; static styles: import("lit").CSSResult[]; } declare global { interface HTMLElementTagNameMap { 'ixfx-flat-list': FlatListElement; } } interface FlatListElement { addEventListener(type: K, listener: (this: FlatListElement, event: FlatListElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; } export { FlatListSelectEvent as _, FlatListContextMenuDetail as a, FlatListDropEvent as c, FlatListEditCommitDetail as d, FlatListEditCommitEvent as f, FlatListSelectDetail as g, FlatListNavigateEvent as h, FlatListBranchOrder as i, FlatListEditCancelDetail as l, FlatListNavigateDetail as m, FlatListActivateDetail as n, FlatListContextMenuEvent as o, FlatListElementEventMap as p, FlatListActivateEvent as r, FlatListDropDetail as s, FlatListElement as t, FlatListEditCancelEvent as u, FlatListViewState as v };