@ixfx/components 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/bundle/chunk-pbuEa-1d.js +13 -0
- package/bundle/index.d.ts +4702 -569
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +34929 -2800
- package/bundle/index.js.map +1 -1
- package/bundle/style.css +133 -0
- package/dist/ac-text.d.ts +97 -0
- package/dist/ac-text.d.ts.map +1 -0
- package/dist/ac-text.js +484 -0
- package/dist/ac-text.js.map +1 -0
- package/dist/button-DgKUzE5o.js +121 -0
- package/dist/button-DgKUzE5o.js.map +1 -0
- package/dist/button.d.ts +21 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +3 -0
- package/dist/checkbox.d.ts +34 -0
- package/dist/checkbox.d.ts.map +1 -0
- package/dist/checkbox.js +251 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chunk-pbuEa-1d.js +13 -0
- package/dist/colour-C3MQIjFJ-BJV-QC-3.js +4138 -0
- package/dist/colour-C3MQIjFJ-BJV-QC-3.js.map +1 -0
- package/dist/colour-picker-Bw-AZoWx.js +922 -0
- package/dist/colour-picker-Bw-AZoWx.js.map +1 -0
- package/dist/colour-picker.d.ts +2 -0
- package/dist/colour-picker.js +2 -0
- package/dist/crumbs.d.ts +92 -0
- package/dist/crumbs.d.ts.map +1 -0
- package/dist/crumbs.js +789 -0
- package/dist/crumbs.js.map +1 -0
- package/dist/data-display.d.ts +24 -12
- package/dist/data-display.d.ts.map +1 -1
- package/dist/data-display.js +96 -105
- package/dist/data-display.js.map +1 -1
- package/dist/decorate-BZbkqIhA.js +9 -0
- package/dist/defaults-FEZaGiYZ.js +38 -0
- package/dist/defaults-FEZaGiYZ.js.map +1 -0
- package/dist/dist-By5URG0Y.js +1290 -0
- package/dist/dist-By5URG0Y.js.map +1 -0
- package/dist/dist-D7kJgnSE.js +1039 -0
- package/dist/dist-D7kJgnSE.js.map +1 -0
- package/dist/editable-label.d.ts +71 -0
- package/dist/editable-label.d.ts.map +1 -0
- package/dist/editable-label.js +279 -0
- package/dist/editable-label.js.map +1 -0
- package/dist/hex-editor-Gib1Grg2.d.ts +131 -0
- package/dist/hex-editor-Gib1Grg2.d.ts.map +1 -0
- package/dist/hex-editor-Wd6ZtZA2.js +1147 -0
- package/dist/hex-editor-Wd6ZtZA2.js.map +1 -0
- package/dist/hex.d.ts +2 -0
- package/dist/hex.js +2 -0
- package/dist/highlight-CAjwQ4GE.js +50 -0
- package/dist/highlight-CAjwQ4GE.js.map +1 -0
- package/dist/icon-BR5aTIiP.js +100 -0
- package/dist/icon-BR5aTIiP.js.map +1 -0
- package/dist/icon-DQKdfR7U.d.ts +36 -0
- package/dist/icon-DQKdfR7U.d.ts.map +1 -0
- package/dist/icons.d.ts +3 -0
- package/dist/icons.js +9 -0
- package/dist/icons.js.map +1 -0
- package/dist/incr-search-BjCNClnC.js +311 -0
- package/dist/incr-search-BjCNClnC.js.map +1 -0
- package/dist/incr-search.d.ts +2 -0
- package/dist/incr-search.js +3 -0
- package/dist/index-B1hNR7Z9.d.ts +36 -0
- package/dist/index-B1hNR7Z9.d.ts.map +1 -0
- package/dist/index-C5dK8RZa.d.ts +23 -0
- package/dist/index-C5dK8RZa.d.ts.map +1 -0
- package/dist/index-C9iBN908.d.ts +160 -0
- package/dist/index-C9iBN908.d.ts.map +1 -0
- package/dist/index-CPVcTTXo.d.ts +396 -0
- package/dist/index-CPVcTTXo.d.ts.map +1 -0
- package/dist/index-CQxanqXF.d.ts +183 -0
- package/dist/index-CQxanqXF.d.ts.map +1 -0
- package/dist/index-CpbBI3n7.d.ts +1239 -0
- package/dist/index-CpbBI3n7.d.ts.map +1 -0
- package/dist/index.d.ts +422 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5729 -14
- package/dist/index.js.map +1 -1
- package/dist/interaction-CQDQJf2Q.js +1 -0
- package/dist/keyboard-De_vOHLg.js +20 -0
- package/dist/keyboard-De_vOHLg.js.map +1 -0
- package/dist/labelled-input-base-DS6-6C0r.js +155 -0
- package/dist/labelled-input-base-DS6-6C0r.js.map +1 -0
- package/dist/labelled-input-base-DnRh4reU.d.ts +43 -0
- package/dist/labelled-input-base-DnRh4reU.d.ts.map +1 -0
- package/dist/labelled-radial-input.d.ts +34 -0
- package/dist/labelled-radial-input.d.ts.map +1 -0
- package/dist/labelled-radial-input.js +188 -0
- package/dist/labelled-radial-input.js.map +1 -0
- package/dist/labelled-range-input.d.ts +2 -0
- package/dist/labelled-range-input.js +132 -0
- package/dist/labelled-range-input.js.map +1 -0
- package/dist/led.d.ts +25 -0
- package/dist/led.d.ts.map +1 -0
- package/dist/led.js +92 -0
- package/dist/led.js.map +1 -0
- package/dist/menu-BV6UFx_z.js +813 -0
- package/dist/menu-BV6UFx_z.js.map +1 -0
- package/dist/menu-item-Cikacp4F.d.ts +128 -0
- package/dist/menu-item-Cikacp4F.d.ts.map +1 -0
- package/dist/menu-item-DEzL_Yjk.js +766 -0
- package/dist/menu-item-DEzL_Yjk.js.map +1 -0
- package/dist/menu.d.ts +3 -0
- package/dist/menu.js +3 -0
- package/dist/miller.d.ts +324 -0
- package/dist/miller.d.ts.map +1 -0
- package/dist/miller.js +1343 -0
- package/dist/miller.js.map +1 -0
- package/dist/narrowed-text.d.ts +72 -0
- package/dist/narrowed-text.d.ts.map +1 -0
- package/dist/narrowed-text.js +571 -0
- package/dist/narrowed-text.js.map +1 -0
- package/dist/panel.d.ts +43 -0
- package/dist/panel.d.ts.map +1 -0
- package/dist/panel.js +408 -0
- package/dist/panel.js.map +1 -0
- package/dist/plots.d.ts +2 -0
- package/dist/plots.js +2 -0
- package/dist/polar-pad.d.ts +67 -0
- package/dist/polar-pad.d.ts.map +1 -0
- package/dist/polar-pad.js +537 -0
- package/dist/polar-pad.js.map +1 -0
- package/dist/popup-Ddx9LCzY.js +24 -0
- package/dist/popup-Ddx9LCzY.js.map +1 -0
- package/dist/prominence-CreDBdCs.js +98 -0
- package/dist/prominence-CreDBdCs.js.map +1 -0
- package/dist/radial-input-CNJ8asY2.js +849 -0
- package/dist/radial-input-CNJ8asY2.js.map +1 -0
- package/dist/radial-input-xSTd4kEz.d.ts +70 -0
- package/dist/radial-input-xSTd4kEz.d.ts.map +1 -0
- package/dist/radial-input.d.ts +2 -0
- package/dist/radial-input.js +2 -0
- package/dist/range-input.d.ts +43 -0
- package/dist/range-input.d.ts.map +1 -0
- package/dist/range-input.js +459 -0
- package/dist/range-input.js.map +1 -0
- package/dist/range.d.ts +28 -0
- package/dist/range.d.ts.map +1 -0
- package/dist/range.js +136 -0
- package/dist/range.js.map +1 -0
- package/dist/registry-CZEB1YI9.js +21 -0
- package/dist/registry-CZEB1YI9.js.map +1 -0
- package/dist/selecthorizontal.d.ts +13 -8
- package/dist/selecthorizontal.d.ts.map +1 -1
- package/dist/selecthorizontal.js +21 -25
- package/dist/selecthorizontal.js.map +1 -1
- package/dist/snap-container.d.ts +50 -0
- package/dist/snap-container.d.ts.map +1 -0
- package/dist/snap-container.js +297 -0
- package/dist/snap-container.js.map +1 -0
- package/dist/split-layout.d.ts +56 -0
- package/dist/split-layout.d.ts.map +1 -0
- package/dist/split-layout.js +545 -0
- package/dist/split-layout.js.map +1 -0
- package/dist/style.css +133 -0
- package/dist/swipe.d.ts +48 -0
- package/dist/swipe.d.ts.map +1 -0
- package/dist/swipe.js +204 -0
- package/dist/swipe.js.map +1 -0
- package/dist/tab-list-CFF7uSYH.d.ts +66 -0
- package/dist/tab-list-CFF7uSYH.d.ts.map +1 -0
- package/dist/tabs.d.ts +2 -0
- package/dist/tabs.js +203 -0
- package/dist/tabs.js.map +1 -0
- package/dist/tickled-controller-Cq1Va0rR.d.ts +218 -0
- package/dist/tickled-controller-Cq1Va0rR.d.ts.map +1 -0
- package/dist/tickled-styles-Bg3QbcrD.js +327 -0
- package/dist/tickled-styles-Bg3QbcrD.js.map +1 -0
- package/dist/timeline-DBWJsSjd.js +1748 -0
- package/dist/timeline-DBWJsSjd.js.map +1 -0
- package/dist/timeline.d.ts +2 -0
- package/dist/timeline.js +2 -0
- package/dist/tooltip-DMxmBNky.js +104 -0
- package/dist/tooltip-DMxmBNky.js.map +1 -0
- package/dist/tooltip-kfUBWYVB.d.ts +26 -0
- package/dist/tooltip-kfUBWYVB.d.ts.map +1 -0
- package/dist/tree-component-CQpoPo4s.d.ts +326 -0
- package/dist/tree-component-CQpoPo4s.d.ts.map +1 -0
- package/dist/tree-data-model-DGvRVOFY.js +190 -0
- package/dist/tree-data-model-DGvRVOFY.js.map +1 -0
- package/dist/tree.d.ts +100 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +1144 -0
- package/dist/tree.js.map +1 -0
- package/dist/types-BKaqnpwx.d.ts +8 -0
- package/dist/types-BKaqnpwx.d.ts.map +1 -0
- package/dist/xy-axis-BANbgrI5.js +6243 -0
- package/dist/xy-axis-BANbgrI5.js.map +1 -0
- package/dist/xy-axis-CIFok7MF.d.ts +141 -0
- package/dist/xy-axis-CIFok7MF.d.ts.map +1 -0
- package/dist/xy-pad.d.ts +81 -0
- package/dist/xy-pad.d.ts.map +1 -0
- package/dist/xy-pad.js +435 -0
- package/dist/xy-pad.js.map +1 -0
- package/package.json +48 -39
- package/README.md +0 -14
- package/dist/charts/frequency-histogram-plot.d.ts +0 -33
- package/dist/charts/frequency-histogram-plot.d.ts.map +0 -1
- package/dist/charts/frequency-histogram-plot.js +0 -54
- package/dist/charts/frequency-histogram-plot.js.map +0 -1
- package/dist/charts/histogram-vis.d.ts +0 -57
- package/dist/charts/histogram-vis.d.ts.map +0 -1
- package/dist/charts/histogram-vis.js +0 -222
- package/dist/charts/histogram-vis.js.map +0 -1
- package/dist/charts/plot.d.ts +0 -199
- package/dist/charts/plot.d.ts.map +0 -1
- package/dist/charts/plot.js +0 -914
- package/dist/charts/plot.js.map +0 -1
- package/dist/crumb-nav.d.ts +0 -41
- package/dist/crumb-nav.d.ts.map +0 -1
- package/dist/crumb-nav.js +0 -198
- package/dist/crumb-nav.js.map +0 -1
- package/dist/crumb-navigation.d.ts +0 -30
- package/dist/crumb-navigation.d.ts.map +0 -1
- package/dist/crumb-navigation.js +0 -307
- package/dist/crumb-navigation.js.map +0 -1
- package/dist/dial.d.ts +0 -89
- package/dist/dial.d.ts.map +0 -1
- package/dist/dial.js +0 -506
- package/dist/dial.js.map +0 -1
- package/dist/my-element.d.ts +0 -14
- package/dist/my-element.d.ts.map +0 -1
- package/dist/my-element.js +0 -44
- package/dist/my-element.js.map +0 -1
- package/dist/split-layout/split-layout.d.ts +0 -35
- package/dist/split-layout/split-layout.d.ts.map +0 -1
- package/dist/split-layout/split-layout.js +0 -220
- package/dist/split-layout/split-layout.js.map +0 -1
- package/dist/svg-edit-label.d.ts +0 -2
- package/dist/svg-edit-label.d.ts.map +0 -1
- package/dist/svg-edit-label.js +0 -110
- package/dist/svg-edit-label.js.map +0 -1
- package/dist/tabs/tab-layout-item.d.ts +0 -10
- package/dist/tabs/tab-layout-item.d.ts.map +0 -1
- package/dist/tabs/tab-layout-item.js +0 -20
- package/dist/tabs/tab-layout-item.js.map +0 -1
- package/dist/tabs/tab-layout.d.ts +0 -10
- package/dist/tabs/tab-layout.d.ts.map +0 -1
- package/dist/tabs/tab-layout.js +0 -25
- package/dist/tabs/tab-layout.js.map +0 -1
- package/dist/tabs/tab-list-item.d.ts +0 -18
- package/dist/tabs/tab-list-item.d.ts.map +0 -1
- package/dist/tabs/tab-list-item.js +0 -63
- package/dist/tabs/tab-list-item.js.map +0 -1
- package/dist/tabs/tab-list.d.ts +0 -21
- package/dist/tabs/tab-list.d.ts.map +0 -1
- package/dist/tabs/tab-list.js +0 -148
- package/dist/tabs/tab-list.js.map +0 -1
- package/dist/tabs/tab-panel.d.ts +0 -11
- package/dist/tabs/tab-panel.d.ts.map +0 -1
- package/dist/tabs/tab-panel.js +0 -30
- package/dist/tabs/tab-panel.js.map +0 -1
- package/dist/tabs/tab-panels.d.ts +0 -30
- package/dist/tabs/tab-panels.d.ts.map +0 -1
- package/dist/tabs/tab-panels.js +0 -80
- package/dist/tabs/tab-panels.js.map +0 -1
- package/dist/util/circle-arc.d.ts +0 -34
- package/dist/util/circle-arc.d.ts.map +0 -1
- package/dist/util/circle-arc.js +0 -77
- package/dist/util/circle-arc.js.map +0 -1
- package/dist/util/compare.d.ts +0 -53
- package/dist/util/compare.d.ts.map +0 -1
- package/dist/util/compare.js +0 -91
- package/dist/util/compare.js.map +0 -1
- package/dist/util/content-editable.d.ts +0 -2
- package/dist/util/content-editable.d.ts.map +0 -1
- package/dist/util/content-editable.js +0 -13
- package/dist/util/content-editable.js.map +0 -1
- package/dist/util/drag-controller.d.ts +0 -13
- package/dist/util/drag-controller.d.ts.map +0 -1
- package/dist/util/drag-controller.js +0 -21
- package/dist/util/drag-controller.js.map +0 -1
- package/dist/util/key-value.d.ts +0 -5
- package/dist/util/key-value.d.ts.map +0 -1
- package/dist/util/key-value.js +0 -30
- package/dist/util/key-value.js.map +0 -1
- package/dist/util/primitive-types.d.ts +0 -6
- package/dist/util/primitive-types.d.ts.map +0 -1
- package/dist/util/primitive-types.js +0 -2
- package/dist/util/primitive-types.js.map +0 -1
- package/dist/util/svg-editable-text.d.ts +0 -22
- package/dist/util/svg-editable-text.d.ts.map +0 -1
- package/dist/util/svg-editable-text.js +0 -121
- package/dist/util/svg-editable-text.js.map +0 -1
- package/dist/util/time.d.ts +0 -2
- package/dist/util/time.d.ts.map +0 -1
- package/dist/util/time.js +0 -2
- package/dist/util/time.js.map +0 -1
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
//#region src/common/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Canonical shared types for all tree-like components (ixfx-tree-list, ixfx-miller-list,
|
|
4
|
+
* ixfx-crumb-navigation). Import from here rather than from individual component packages.
|
|
5
|
+
*/
|
|
6
|
+
/** A single node's display data. */
|
|
7
|
+
type TreeItem = {
|
|
8
|
+
/** Unique identifier within the tree. */key: string; /** Visible label text. */
|
|
9
|
+
label: string; /** When true the node cannot have children and will not show an expand affordance. */
|
|
10
|
+
isLeaf?: boolean; /** Arbitrary application data associated with this node. */
|
|
11
|
+
data?: unknown; /** Icon name passed to an icon component, if icons are enabled. */
|
|
12
|
+
icon?: string; /** Tooltip text shown on hover. */
|
|
13
|
+
tooltip?: string; /** Optional string value, e.g. for use as a command/route. */
|
|
14
|
+
value?: string;
|
|
15
|
+
};
|
|
16
|
+
/** A node in the tree, potentially containing lazily-loaded children. */
|
|
17
|
+
type TreeNode = {
|
|
18
|
+
item: TreeItem;
|
|
19
|
+
/**
|
|
20
|
+
* Child nodes.
|
|
21
|
+
* - `undefined` = children not yet loaded (component will call loadChildren if set)
|
|
22
|
+
* - `[]` = confirmed leaf / empty branch
|
|
23
|
+
* - non-empty array = loaded children
|
|
24
|
+
*/
|
|
25
|
+
children?: TreeNode[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Callback invoked when a node's children need to be loaded.
|
|
29
|
+
* The AbortSignal is cancelled if the request is superseded (e.g. node collapsed before load completes).
|
|
30
|
+
*/
|
|
31
|
+
type LoadChildrenCallback = (node: TreeNode, depth: number, signal: AbortSignal) => TreeNode[] | Promise<TreeNode[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Predicate used by search/filter controllers to determine whether a node should be visible.
|
|
34
|
+
* Receives depth so column-scoped filtering (e.g. in ixfx-miller-list) is possible.
|
|
35
|
+
* Tree implementations that do not need depth can simply ignore the parameter.
|
|
36
|
+
*/
|
|
37
|
+
type TreeFilterPredicate = (node: TreeNode, depth: number) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Controls how expanding a node affects its siblings.
|
|
40
|
+
* - `'none'` — no constraint; any number of nodes may be expanded simultaneously
|
|
41
|
+
* - `'depth'` — only one sibling at the same depth may be expanded at a time (accordion)
|
|
42
|
+
* - `'global'` — only one node anywhere in the tree may be expanded at a time
|
|
43
|
+
*/
|
|
44
|
+
type TreeExclusivity = 'none' | 'depth' | 'global';
|
|
45
|
+
/**
|
|
46
|
+
* Restricts which kinds of nodes may enter the selection.
|
|
47
|
+
* Applied as a guard in all interaction modes.
|
|
48
|
+
* - `'none'` — no node can be selected (read-only / display-only)
|
|
49
|
+
* - `'leaf'` — only leaf nodes are selectable
|
|
50
|
+
* - `'branch'` — only branch nodes (nodes with children) are selectable
|
|
51
|
+
* - `'all'` — both leaf and branch nodes are selectable
|
|
52
|
+
*/
|
|
53
|
+
type TreeSelectionFilter = 'none' | 'leaf' | 'branch' | 'all';
|
|
54
|
+
/**
|
|
55
|
+
* Controls how pointer and keyboard gestures map to selection changes.
|
|
56
|
+
* - `'implicit'` — single selection that follows the click; clicking always selects + toggles expand
|
|
57
|
+
* - `'standard'` — single click selects+toggles; Ctrl/Cmd+click toggles item; Shift+click range-selects
|
|
58
|
+
* - `'manual'` — component never auto-selects; use `select()`/`deselect()`/`clearSelection()` to drive state
|
|
59
|
+
* - `'checked'` — checkboxes on every item; checkbox click toggles selection recursively; row click only expands/collapses
|
|
60
|
+
* - `'vscode'` — like `standard` for clicks; Shift+arrow uses snapshot-based toggle-range
|
|
61
|
+
*/
|
|
62
|
+
type TreeInteractionMode = 'implicit' | 'standard' | 'manual' | 'checked' | 'vscode';
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/common/tree-data-model.d.ts
|
|
65
|
+
type InvalidateEvent = {
|
|
66
|
+
type: 'invalidate';
|
|
67
|
+
key: string;
|
|
68
|
+
};
|
|
69
|
+
type RootEvent = {
|
|
70
|
+
type: 'root';
|
|
71
|
+
root: TreeNode;
|
|
72
|
+
};
|
|
73
|
+
type ModelEvent = InvalidateEvent | RootEvent;
|
|
74
|
+
type ModelSubscriber = (event: ModelEvent) => void;
|
|
75
|
+
type TreeDataModelOptions = {
|
|
76
|
+
/** The initial root node. Required. */root: TreeNode;
|
|
77
|
+
/**
|
|
78
|
+
* Optional callback for lazily loading children.
|
|
79
|
+
* If omitted, nodes with `children === undefined` are treated as empty branches.
|
|
80
|
+
*/
|
|
81
|
+
loadChildren?: LoadChildrenCallback;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Manages tree data for tree-like components.
|
|
85
|
+
*
|
|
86
|
+
* Handles two concerns:
|
|
87
|
+
* 1. **Lazy loading** — caches children fetched via `loadChildren` and can invalidate
|
|
88
|
+
* specific branches so they are re-fetched on next expand.
|
|
89
|
+
* 2. **Structural mutations** — convenience methods to add, remove, update, or move
|
|
90
|
+
* nodes. Each mutation produces a new immutable root and notifies connected components.
|
|
91
|
+
*
|
|
92
|
+
* Assign an instance to a component's `model` property instead of setting `root`/`loadChildren`
|
|
93
|
+
* directly. The same model instance can be shared across multiple components.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const model = new TreeDataModel({
|
|
98
|
+
* root: { item: { key: 'root', label: 'Root' }, children: [] },
|
|
99
|
+
* loadChildren: async (node, depth, signal) => fetchChildren(node.item.key),
|
|
100
|
+
* });
|
|
101
|
+
* myTreeList.model = model;
|
|
102
|
+
* myMillerList.model = model;
|
|
103
|
+
*
|
|
104
|
+
* // Later — invalidate a branch to force a re-fetch on next expand:
|
|
105
|
+
* model.invalidate('some-key');
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
declare class TreeDataModel {
|
|
109
|
+
#private;
|
|
110
|
+
constructor(options: TreeDataModelOptions);
|
|
111
|
+
/** The current immutable root snapshot. */
|
|
112
|
+
get root(): TreeNode;
|
|
113
|
+
/**
|
|
114
|
+
* Replace the entire root with a new immutable snapshot.
|
|
115
|
+
* All cached children are cleared. Connected components re-render.
|
|
116
|
+
*/
|
|
117
|
+
setRoot(root: TreeNode): void;
|
|
118
|
+
/**
|
|
119
|
+
* Returns children for the given node.
|
|
120
|
+
* If children are cached, they are returned immediately (as a resolved Promise).
|
|
121
|
+
* Otherwise the `loadChildren` callback is invoked and the result is cached.
|
|
122
|
+
* If no `loadChildren` is set and no cache entry exists, returns `[]`.
|
|
123
|
+
*
|
|
124
|
+
* Called by components internally — not typically called by application code.
|
|
125
|
+
*/
|
|
126
|
+
getChildren(node: TreeNode, depth: number, signal: AbortSignal): Promise<TreeNode[]>;
|
|
127
|
+
/**
|
|
128
|
+
* Clears the cached children for the node with the given key.
|
|
129
|
+
* Connected components will collapse that node (if currently expanded), so that
|
|
130
|
+
* the next expand triggers a fresh `loadChildren` call.
|
|
131
|
+
*/
|
|
132
|
+
invalidate(key: string): void;
|
|
133
|
+
/**
|
|
134
|
+
* Adds `node` as a child of the node identified by `parentKey`.
|
|
135
|
+
* Returns the new root (connected components are notified automatically).
|
|
136
|
+
*/
|
|
137
|
+
addNode(parentKey: string, node: TreeNode): TreeNode;
|
|
138
|
+
/**
|
|
139
|
+
* Removes the node with the given key and all its descendants.
|
|
140
|
+
* Returns the new root (connected components are notified automatically).
|
|
141
|
+
*/
|
|
142
|
+
removeNode(key: string): TreeNode;
|
|
143
|
+
/**
|
|
144
|
+
* Applies a partial update to the `item` of the node with the given key.
|
|
145
|
+
* Returns the new root (connected components are notified automatically).
|
|
146
|
+
*/
|
|
147
|
+
updateItem(key: string, patch: Partial<TreeItem>): TreeNode;
|
|
148
|
+
/**
|
|
149
|
+
* Moves the node with the given key to become a child of `newParentKey`.
|
|
150
|
+
* Returns the new root (connected components are notified automatically).
|
|
151
|
+
*/
|
|
152
|
+
moveNode(key: string, newParentKey: string): TreeNode;
|
|
153
|
+
/**
|
|
154
|
+
* Subscribe to model events. Returns an unsubscribe function.
|
|
155
|
+
* Components call this when the `model` property is set, and unsubscribe when it is unset.
|
|
156
|
+
*
|
|
157
|
+
* @internal
|
|
158
|
+
*/
|
|
159
|
+
_subscribe(callback: ModelSubscriber): () => void;
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/common/tree-component.d.ts
|
|
163
|
+
/**
|
|
164
|
+
* Fired when the selection set changes by any means (click, keyboard, programmatic).
|
|
165
|
+
* Event name: `select`
|
|
166
|
+
*/
|
|
167
|
+
type TreeSelectDetail = {
|
|
168
|
+
/** The new selection set. */readonly selected: ReadonlySet<TreeNode>; /** The previous selection set (empty set if there was no prior selection). */
|
|
169
|
+
readonly previous: ReadonlySet<TreeNode>;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Fired when an item enters cursor focus — either the pointer hovers over it, or
|
|
173
|
+
* the keyboard navigation cursor moves to it.
|
|
174
|
+
* Event name: `tickle`
|
|
175
|
+
*/
|
|
176
|
+
type TreeTickleDetail = {
|
|
177
|
+
readonly node: TreeNode;
|
|
178
|
+
readonly depth: number;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Fired when the user explicitly activates an item (Enter key or double-click).
|
|
182
|
+
* Event name: `activate`
|
|
183
|
+
*/
|
|
184
|
+
type TreeActivateDetail = {
|
|
185
|
+
readonly node: TreeNode;
|
|
186
|
+
readonly depth: number;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Fired when the user clicks an item (raw pointer event, before any selection change).
|
|
190
|
+
* Event name: `item-click`
|
|
191
|
+
*/
|
|
192
|
+
type TreeItemClickDetail = {
|
|
193
|
+
readonly node: TreeNode;
|
|
194
|
+
readonly depth: number;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Fired when a node or column is expanded.
|
|
198
|
+
* Event name: `expand`
|
|
199
|
+
*/
|
|
200
|
+
type TreeExpandDetail = {
|
|
201
|
+
readonly node: TreeNode;
|
|
202
|
+
readonly depth: number;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Fired when a node or column is collapsed.
|
|
206
|
+
* Event name: `collapse`
|
|
207
|
+
*/
|
|
208
|
+
type TreeCollapseDetail = {
|
|
209
|
+
readonly node: TreeNode;
|
|
210
|
+
readonly depth: number;
|
|
211
|
+
};
|
|
212
|
+
type TreeSelectEvent = CustomEvent<TreeSelectDetail>;
|
|
213
|
+
type TreeTickleEvent = CustomEvent<TreeTickleDetail>;
|
|
214
|
+
type TreeActivateEvent = CustomEvent<TreeActivateDetail>;
|
|
215
|
+
type TreeItemClickEvent = CustomEvent<TreeItemClickDetail>;
|
|
216
|
+
type TreeExpandEvent = CustomEvent<TreeExpandDetail>;
|
|
217
|
+
type TreeCollapseEvent = CustomEvent<TreeCollapseDetail>;
|
|
218
|
+
interface TreeComponentEventMap {
|
|
219
|
+
'select': TreeSelectEvent;
|
|
220
|
+
'tickle': TreeTickleEvent;
|
|
221
|
+
'activate': TreeActivateEvent;
|
|
222
|
+
'item-click': TreeItemClickEvent;
|
|
223
|
+
'expand': TreeExpandEvent;
|
|
224
|
+
'collapse': TreeCollapseEvent;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The common interface all tree-like components must implement.
|
|
228
|
+
*
|
|
229
|
+
* Use this interface when writing controllers or utilities that should work
|
|
230
|
+
* across different tree component implementations.
|
|
231
|
+
*
|
|
232
|
+
* @example Writing a controller that works with any tree component:
|
|
233
|
+
* ```typescript
|
|
234
|
+
* function attachMyController(component: TreeComponent) {
|
|
235
|
+
* component.addEventListener('select', e => console.log(e.detail.selected));
|
|
236
|
+
* }
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
interface TreeComponent extends EventTarget {
|
|
240
|
+
/**
|
|
241
|
+
* Root node of the tree.
|
|
242
|
+
* Set this directly for static/fully-known trees.
|
|
243
|
+
* Use `model` for lazy-loaded or programmatically mutated trees.
|
|
244
|
+
*/
|
|
245
|
+
root: TreeNode | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* Optional data model providing lazy loading, caching, and mutation helpers.
|
|
248
|
+
* When set, the component uses `model.getChildren()` instead of `loadChildren`,
|
|
249
|
+
* and re-renders when the model notifies of root or invalidation changes.
|
|
250
|
+
* `model` takes precedence over `loadChildren` when both are set.
|
|
251
|
+
*/
|
|
252
|
+
model: TreeDataModel | undefined;
|
|
253
|
+
/**
|
|
254
|
+
* Callback for lazily loading children of a node.
|
|
255
|
+
* Superseded by `model` when both are set.
|
|
256
|
+
* Kept for backwards compatibility and simple use-cases.
|
|
257
|
+
*/
|
|
258
|
+
loadChildren: LoadChildrenCallback | undefined;
|
|
259
|
+
/**
|
|
260
|
+
* The primary/most-recently selected node, or `undefined` if nothing is selected.
|
|
261
|
+
* In multi-selection modes (e.g. `interactionMode='standard'` with Ctrl+click) this is the most recently added node.
|
|
262
|
+
*/
|
|
263
|
+
selectedNode: TreeNode | undefined;
|
|
264
|
+
/**
|
|
265
|
+
* The full selection set. Always in sync with `selectedNode`.
|
|
266
|
+
* Empty set when nothing is selected.
|
|
267
|
+
*/
|
|
268
|
+
readonly selectedNodes: ReadonlySet<TreeNode>;
|
|
269
|
+
/**
|
|
270
|
+
* Restricts which kinds of nodes may be selected. Applied as a guard in all interaction modes.
|
|
271
|
+
* Reflected as the `selection-filter` attribute.
|
|
272
|
+
* @default 'leaf'
|
|
273
|
+
*/
|
|
274
|
+
selectionFilter: TreeSelectionFilter;
|
|
275
|
+
/**
|
|
276
|
+
* Predicate used by search/filter controllers.
|
|
277
|
+
* When set, nodes for which the predicate returns `false` (and which have no
|
|
278
|
+
* matching descendants) are hidden from the rendered output.
|
|
279
|
+
*/
|
|
280
|
+
filterPredicate: TreeFilterPredicate | undefined;
|
|
281
|
+
/**
|
|
282
|
+
* Controls how expanding one node affects other expanded nodes.
|
|
283
|
+
* Reflected as the `exclusivity` attribute.
|
|
284
|
+
* @default 'none'
|
|
285
|
+
*/
|
|
286
|
+
exclusivity: TreeExclusivity;
|
|
287
|
+
/** Select `node`, replacing any current selection. Respects `selectionFilter` — no-op if the node is not selectable. */
|
|
288
|
+
select(node: TreeNode): void;
|
|
289
|
+
/** Remove `node` from the selection. */
|
|
290
|
+
deselect(node: TreeNode): void;
|
|
291
|
+
/** Clear the entire selection. */
|
|
292
|
+
clearSelection(): void;
|
|
293
|
+
/**
|
|
294
|
+
* Expand ancestors and select the node reached by following `keys` from the root's children.
|
|
295
|
+
* Returns `true` if the path was found and applied.
|
|
296
|
+
*/
|
|
297
|
+
navigateTo(keys: readonly string[]): boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Expand ancestors and select the first node for which `predicate` returns `true`.
|
|
300
|
+
* Returns `true` if a matching node was found.
|
|
301
|
+
*/
|
|
302
|
+
navigateToNode(predicate: (node: TreeNode) => boolean): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Returns all nodes currently visible in the rendered output, in render order,
|
|
305
|
+
* with their depth (0-based, root's children are depth 0).
|
|
306
|
+
*/
|
|
307
|
+
getNodes(): ReadonlyArray<{
|
|
308
|
+
node: TreeNode;
|
|
309
|
+
depth: number;
|
|
310
|
+
}>;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Extended interface used by search/filter controllers.
|
|
314
|
+
* Both TreeBaseElement and MillerBaseElement implement this.
|
|
315
|
+
*
|
|
316
|
+
* Replaces the previous separate `TreeSearchHost` / `MillerSearchHost` types
|
|
317
|
+
* in `searchable.ts`. The unified `filterPredicate` signature (with `depth`)
|
|
318
|
+
* allows a single search controller implementation to work with all tree components.
|
|
319
|
+
*/
|
|
320
|
+
interface TreeSearchHost extends TreeComponent {
|
|
321
|
+
readonly shadowRoot: ShadowRoot | null;
|
|
322
|
+
readonly updateComplete: Promise<boolean>;
|
|
323
|
+
}
|
|
324
|
+
//#endregion
|
|
325
|
+
export { TreeNode as C, TreeItem as S, TreeDataModelOptions as _, TreeComponent as a, TreeFilterPredicate as b, TreeExpandEvent as c, TreeSearchHost as d, TreeSelectDetail as f, TreeDataModel as g, TreeTickleEvent as h, TreeCollapseEvent as i, TreeItemClickDetail as l, TreeTickleDetail as m, TreeActivateEvent as n, TreeComponentEventMap as o, TreeSelectEvent as p, TreeCollapseDetail as r, TreeExpandDetail as s, TreeActivateDetail as t, TreeItemClickEvent as u, LoadChildrenCallback as v, TreeSelectionFilter as w, TreeInteractionMode as x, TreeExclusivity as y };
|
|
326
|
+
//# sourceMappingURL=tree-component-CQpoPo4s.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,UAAA,EAAY,iBAAA;AAAA;;;;ADzFkC;;;;;;;;;AACD;UC4G9B,aAAA,SAAsB,WAAA;;;;AD3GM;;ECmH3C,IAAA,EAAM,QAAA;EDjHuB;;AA2D/B;;;;EC8DE,KAAA,EAAO,aAAA;ED5DD;;;;;ECmEN,YAAA,EAAc,oBAAA;ED9BU;;;;ECsCxB,YAAA,EAAc,QAAA;EDIU;;;;EAAA,SCEf,aAAA,EAAe,WAAA,CAAY,QAAA;EDmCQ;;;;;EC1B5C,eAAA,EAAiB,mBAAA;ED4EI;;;;;ECnErB,eAAA,EAAiB,mBAAA;EDxDL;;;;;ECiEZ,WAAA,EAAa,eAAA;ED7BP;ECkCN,MAAA,CAAO,IAAA,EAAM,QAAA;EDlCK;ECoClB,QAAA,CAAS,IAAA,EAAM,QAAA;EDpC0C;ECsCzD,cAAA;EDtCuE;;;;EC8CvE,UAAA,CAAW,IAAA;EDTH;;;;ECeR,cAAA,CAAe,SAAA,GAAY,IAAA,EAAM,QAAA;EDLtB;;;;ECaX,QAAA,IAAY,aAAA;IAAgB,IAAA,EAAM,QAAA;IAAU,KAAA;EAAA;AAAA;;;;;;;;;UAe7B,cAAA,SAAuB,aAAA;EAAA,SAC7B,UAAA,EAAY,UAAA;EAAA,SACZ,cAAA,EAAgB,OAAA;AAAA"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
//#region src/common/tree-data-model.ts
|
|
2
|
+
function findNode(root, key) {
|
|
3
|
+
if (root.item.key === key) return root;
|
|
4
|
+
if (!root.children) return void 0;
|
|
5
|
+
for (const child of root.children) {
|
|
6
|
+
const found = findNode(child, key);
|
|
7
|
+
if (found) return found;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** Return a new root with the node at `key` replaced by `replacer(node)`. */
|
|
11
|
+
function mapNode(root, key, replacer) {
|
|
12
|
+
if (root.item.key === key) return replacer(root);
|
|
13
|
+
if (!root.children) return root;
|
|
14
|
+
return {
|
|
15
|
+
item: root.item,
|
|
16
|
+
children: root.children.map((c) => mapNode(c, key, replacer))
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Return a new root with `newChild` appended to the children of the node at `parentKey`. */
|
|
20
|
+
function addChildTo(root, parentKey, newChild) {
|
|
21
|
+
return mapNode(root, parentKey, (parent) => ({
|
|
22
|
+
item: parent.item,
|
|
23
|
+
children: [...parent.children ?? [], newChild]
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
/** Return a new root with the node at `key` removed (along with all its descendants). */
|
|
27
|
+
function removeNodeFrom(root, key) {
|
|
28
|
+
if (!root.children) return root;
|
|
29
|
+
return {
|
|
30
|
+
item: root.item,
|
|
31
|
+
children: root.children.filter((c) => c.item.key !== key).map((c) => removeNodeFrom(c, key))
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Return a new root with the node at `key` moved to become a child of `newParentKey`. */
|
|
35
|
+
function moveNodeTo(root, key, newParentKey) {
|
|
36
|
+
const target = findNode(root, key);
|
|
37
|
+
if (!target) return root;
|
|
38
|
+
return addChildTo(removeNodeFrom(root, key), newParentKey, target);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Manages tree data for tree-like components.
|
|
42
|
+
*
|
|
43
|
+
* Handles two concerns:
|
|
44
|
+
* 1. **Lazy loading** — caches children fetched via `loadChildren` and can invalidate
|
|
45
|
+
* specific branches so they are re-fetched on next expand.
|
|
46
|
+
* 2. **Structural mutations** — convenience methods to add, remove, update, or move
|
|
47
|
+
* nodes. Each mutation produces a new immutable root and notifies connected components.
|
|
48
|
+
*
|
|
49
|
+
* Assign an instance to a component's `model` property instead of setting `root`/`loadChildren`
|
|
50
|
+
* directly. The same model instance can be shared across multiple components.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const model = new TreeDataModel({
|
|
55
|
+
* root: { item: { key: 'root', label: 'Root' }, children: [] },
|
|
56
|
+
* loadChildren: async (node, depth, signal) => fetchChildren(node.item.key),
|
|
57
|
+
* });
|
|
58
|
+
* myTreeList.model = model;
|
|
59
|
+
* myMillerList.model = model;
|
|
60
|
+
*
|
|
61
|
+
* // Later — invalidate a branch to force a re-fetch on next expand:
|
|
62
|
+
* model.invalidate('some-key');
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
var TreeDataModel = class {
|
|
66
|
+
#root;
|
|
67
|
+
#loadChildren;
|
|
68
|
+
#cache = /* @__PURE__ */ new Map();
|
|
69
|
+
#subscribers = /* @__PURE__ */ new Set();
|
|
70
|
+
constructor(options) {
|
|
71
|
+
this.#root = options.root;
|
|
72
|
+
this.#loadChildren = options.loadChildren;
|
|
73
|
+
}
|
|
74
|
+
/** The current immutable root snapshot. */
|
|
75
|
+
get root() {
|
|
76
|
+
return this.#root;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Replace the entire root with a new immutable snapshot.
|
|
80
|
+
* All cached children are cleared. Connected components re-render.
|
|
81
|
+
*/
|
|
82
|
+
setRoot(root) {
|
|
83
|
+
this.#root = root;
|
|
84
|
+
this.#cache.clear();
|
|
85
|
+
this.#notify({
|
|
86
|
+
type: "root",
|
|
87
|
+
root
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns children for the given node.
|
|
92
|
+
* If children are cached, they are returned immediately (as a resolved Promise).
|
|
93
|
+
* Otherwise the `loadChildren` callback is invoked and the result is cached.
|
|
94
|
+
* If no `loadChildren` is set and no cache entry exists, returns `[]`.
|
|
95
|
+
*
|
|
96
|
+
* Called by components internally — not typically called by application code.
|
|
97
|
+
*/
|
|
98
|
+
async getChildren(node, depth, signal) {
|
|
99
|
+
const key = node.item.key;
|
|
100
|
+
if (this.#cache.has(key)) return this.#cache.get(key);
|
|
101
|
+
if (!this.#loadChildren) return [];
|
|
102
|
+
const result = await this.#loadChildren(node, depth, signal);
|
|
103
|
+
if (!signal.aborted) this.#cache.set(key, result);
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Clears the cached children for the node with the given key.
|
|
108
|
+
* Connected components will collapse that node (if currently expanded), so that
|
|
109
|
+
* the next expand triggers a fresh `loadChildren` call.
|
|
110
|
+
*/
|
|
111
|
+
invalidate(key) {
|
|
112
|
+
this.#cache.delete(key);
|
|
113
|
+
this.#notify({
|
|
114
|
+
type: "invalidate",
|
|
115
|
+
key
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Adds `node` as a child of the node identified by `parentKey`.
|
|
120
|
+
* Returns the new root (connected components are notified automatically).
|
|
121
|
+
*/
|
|
122
|
+
addNode(parentKey, node) {
|
|
123
|
+
this.#root = addChildTo(this.#root, parentKey, node);
|
|
124
|
+
this.#notify({
|
|
125
|
+
type: "root",
|
|
126
|
+
root: this.#root
|
|
127
|
+
});
|
|
128
|
+
return this.#root;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Removes the node with the given key and all its descendants.
|
|
132
|
+
* Returns the new root (connected components are notified automatically).
|
|
133
|
+
*/
|
|
134
|
+
removeNode(key) {
|
|
135
|
+
this.#cache.delete(key);
|
|
136
|
+
this.#root = removeNodeFrom(this.#root, key);
|
|
137
|
+
this.#notify({
|
|
138
|
+
type: "root",
|
|
139
|
+
root: this.#root
|
|
140
|
+
});
|
|
141
|
+
return this.#root;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Applies a partial update to the `item` of the node with the given key.
|
|
145
|
+
* Returns the new root (connected components are notified automatically).
|
|
146
|
+
*/
|
|
147
|
+
updateItem(key, patch) {
|
|
148
|
+
this.#root = mapNode(this.#root, key, (n) => ({
|
|
149
|
+
item: {
|
|
150
|
+
...n.item,
|
|
151
|
+
...patch
|
|
152
|
+
},
|
|
153
|
+
children: n.children
|
|
154
|
+
}));
|
|
155
|
+
this.#notify({
|
|
156
|
+
type: "root",
|
|
157
|
+
root: this.#root
|
|
158
|
+
});
|
|
159
|
+
return this.#root;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Moves the node with the given key to become a child of `newParentKey`.
|
|
163
|
+
* Returns the new root (connected components are notified automatically).
|
|
164
|
+
*/
|
|
165
|
+
moveNode(key, newParentKey) {
|
|
166
|
+
this.#root = moveNodeTo(this.#root, key, newParentKey);
|
|
167
|
+
this.#notify({
|
|
168
|
+
type: "root",
|
|
169
|
+
root: this.#root
|
|
170
|
+
});
|
|
171
|
+
return this.#root;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Subscribe to model events. Returns an unsubscribe function.
|
|
175
|
+
* Components call this when the `model` property is set, and unsubscribe when it is unset.
|
|
176
|
+
*
|
|
177
|
+
* @internal
|
|
178
|
+
*/
|
|
179
|
+
_subscribe(callback) {
|
|
180
|
+
this.#subscribers.add(callback);
|
|
181
|
+
return () => this.#subscribers.delete(callback);
|
|
182
|
+
}
|
|
183
|
+
#notify(event) {
|
|
184
|
+
for (const sub of this.#subscribers) sub(event);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
//#endregion
|
|
188
|
+
export { TreeDataModel as t };
|
|
189
|
+
|
|
190
|
+
//# sourceMappingURL=tree-data-model-DGvRVOFY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-data-model-DGvRVOFY.js","names":["#root","#loadChildren","#cache","#notify","#subscribers"],"sources":["../src/common/tree-data-model.ts"],"sourcesContent":["import type { LoadChildrenCallback, TreeItem, TreeNode } from './types.js';\n\n// ---------------------------------------------------------------------------\n// Subscription event types (internal — not part of the public API)\n// ---------------------------------------------------------------------------\n\ntype InvalidateEvent = { type: 'invalidate'; key: string };\ntype RootEvent = { type: 'root'; root: TreeNode };\ntype ModelEvent = InvalidateEvent | RootEvent;\n\ntype ModelSubscriber = (event: ModelEvent) => void;\n\n// ---------------------------------------------------------------------------\n// Pure tree-mutation helpers (functional, produce new roots)\n// ---------------------------------------------------------------------------\n\nfunction cloneNode(node: TreeNode): TreeNode {\n if (node.children === undefined) return { item: { ...node.item } };\n return { item: { ...node.item }, children: node.children.map(cloneNode) };\n}\n\nfunction findNode(root: TreeNode, key: string): TreeNode | undefined {\n if (root.item.key === key) return root;\n if (!root.children) return undefined;\n for (const child of root.children) {\n const found = findNode(child, key);\n if (found) return found;\n }\n return undefined;\n}\n\n/** Return a new root with the node at `key` replaced by `replacer(node)`. */\nfunction mapNode(root: TreeNode, key: string, replacer: (n: TreeNode) => TreeNode): TreeNode {\n if (root.item.key === key) return replacer(root);\n if (!root.children) return root;\n return { item: root.item, children: root.children.map(c => mapNode(c, key, replacer)) };\n}\n\n/** Return a new root with `newChild` appended to the children of the node at `parentKey`. */\nfunction addChildTo(root: TreeNode, parentKey: string, newChild: TreeNode): TreeNode {\n return mapNode(root, parentKey, parent => ({\n item: parent.item,\n children: [...(parent.children ?? []), newChild],\n }));\n}\n\n/** Return a new root with the node at `key` removed (along with all its descendants). */\nfunction removeNodeFrom(root: TreeNode, key: string): TreeNode {\n if (!root.children) return root;\n return {\n item: root.item,\n children: root.children\n .filter(c => c.item.key !== key)\n .map(c => removeNodeFrom(c, key)),\n };\n}\n\n/** Return a new root with the node at `key` moved to become a child of `newParentKey`. */\nfunction moveNodeTo(root: TreeNode, key: string, newParentKey: string): TreeNode {\n const target = findNode(root, key);\n if (!target) return root;\n const withoutTarget = removeNodeFrom(root, key);\n return addChildTo(withoutTarget, newParentKey, target);\n}\n\n// ---------------------------------------------------------------------------\n// TreeDataModelOptions\n// ---------------------------------------------------------------------------\n\nexport type TreeDataModelOptions = {\n /** The initial root node. Required. */\n root: TreeNode;\n /**\n * Optional callback for lazily loading children.\n * If omitted, nodes with `children === undefined` are treated as empty branches.\n */\n loadChildren?: LoadChildrenCallback;\n};\n\n// ---------------------------------------------------------------------------\n// TreeDataModel\n// ---------------------------------------------------------------------------\n\n/**\n * Manages tree data for tree-like components.\n *\n * Handles two concerns:\n * 1. **Lazy loading** — caches children fetched via `loadChildren` and can invalidate\n * specific branches so they are re-fetched on next expand.\n * 2. **Structural mutations** — convenience methods to add, remove, update, or move\n * nodes. Each mutation produces a new immutable root and notifies connected components.\n *\n * Assign an instance to a component's `model` property instead of setting `root`/`loadChildren`\n * directly. The same model instance can be shared across multiple components.\n *\n * @example\n * ```typescript\n * const model = new TreeDataModel({\n * root: { item: { key: 'root', label: 'Root' }, children: [] },\n * loadChildren: async (node, depth, signal) => fetchChildren(node.item.key),\n * });\n * myTreeList.model = model;\n * myMillerList.model = model;\n *\n * // Later — invalidate a branch to force a re-fetch on next expand:\n * model.invalidate('some-key');\n * ```\n */\nexport class TreeDataModel {\n #root: TreeNode;\n #loadChildren: LoadChildrenCallback | undefined;\n #cache = new Map<string, TreeNode[]>();\n #subscribers = new Set<ModelSubscriber>();\n\n constructor(options: TreeDataModelOptions) {\n this.#root = options.root;\n this.#loadChildren = options.loadChildren;\n }\n\n // ---------------------------------------------------------------------------\n // Root\n // ---------------------------------------------------------------------------\n\n /** The current immutable root snapshot. */\n get root(): TreeNode {\n return this.#root;\n }\n\n /**\n * Replace the entire root with a new immutable snapshot.\n * All cached children are cleared. Connected components re-render.\n */\n setRoot(root: TreeNode): void {\n this.#root = root;\n this.#cache.clear();\n this.#notify({ type: 'root', root });\n }\n\n // ---------------------------------------------------------------------------\n // Child loading\n // ---------------------------------------------------------------------------\n\n /**\n * Returns children for the given node.\n * If children are cached, they are returned immediately (as a resolved Promise).\n * Otherwise the `loadChildren` callback is invoked and the result is cached.\n * If no `loadChildren` is set and no cache entry exists, returns `[]`.\n *\n * Called by components internally — not typically called by application code.\n */\n async getChildren(node: TreeNode, depth: number, signal: AbortSignal): Promise<TreeNode[]> {\n const key = node.item.key;\n if (this.#cache.has(key)) {\n return this.#cache.get(key)!;\n }\n if (!this.#loadChildren) {\n return [];\n }\n const result = await this.#loadChildren(node, depth, signal);\n if (!signal.aborted) {\n this.#cache.set(key, result);\n }\n return result;\n }\n\n // ---------------------------------------------------------------------------\n // Cache invalidation\n // ---------------------------------------------------------------------------\n\n /**\n * Clears the cached children for the node with the given key.\n * Connected components will collapse that node (if currently expanded), so that\n * the next expand triggers a fresh `loadChildren` call.\n */\n invalidate(key: string): void {\n this.#cache.delete(key);\n this.#notify({ type: 'invalidate', key });\n }\n\n // ---------------------------------------------------------------------------\n // Convenience mutators\n // ---------------------------------------------------------------------------\n\n /**\n * Adds `node` as a child of the node identified by `parentKey`.\n * Returns the new root (connected components are notified automatically).\n */\n addNode(parentKey: string, node: TreeNode): TreeNode {\n this.#root = addChildTo(this.#root, parentKey, node);\n this.#notify({ type: 'root', root: this.#root });\n return this.#root;\n }\n\n /**\n * Removes the node with the given key and all its descendants.\n * Returns the new root (connected components are notified automatically).\n */\n removeNode(key: string): TreeNode {\n this.#cache.delete(key);\n this.#root = removeNodeFrom(this.#root, key);\n this.#notify({ type: 'root', root: this.#root });\n return this.#root;\n }\n\n /**\n * Applies a partial update to the `item` of the node with the given key.\n * Returns the new root (connected components are notified automatically).\n */\n updateItem(key: string, patch: Partial<TreeItem>): TreeNode {\n this.#root = mapNode(this.#root, key, n => ({\n item: { ...n.item, ...patch },\n children: n.children,\n }));\n this.#notify({ type: 'root', root: this.#root });\n return this.#root;\n }\n\n /**\n * Moves the node with the given key to become a child of `newParentKey`.\n * Returns the new root (connected components are notified automatically).\n */\n moveNode(key: string, newParentKey: string): TreeNode {\n this.#root = moveNodeTo(this.#root, key, newParentKey);\n this.#notify({ type: 'root', root: this.#root });\n return this.#root;\n }\n\n // ---------------------------------------------------------------------------\n // Internal subscription (used by components — not part of the public API)\n // ---------------------------------------------------------------------------\n\n /**\n * Subscribe to model events. Returns an unsubscribe function.\n * Components call this when the `model` property is set, and unsubscribe when it is unset.\n *\n * @internal\n */\n _subscribe(callback: ModelSubscriber): () => void {\n this.#subscribers.add(callback);\n return () => this.#subscribers.delete(callback);\n }\n\n #notify(event: ModelEvent): void {\n for (const sub of this.#subscribers) {\n sub(event);\n }\n }\n}\n"],"mappings":";AAqBA,SAAS,SAAS,MA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AAA;GAAY,CAAC;AAChD,SAAO,MAAA;;;;;;;;CAaT,WAAW,UAAuC;AAChD,QAAA,YAAkB,IAAI,SAAS;AAC/B,eAAa,MAAA,YAAkB,OAAO,SAAS;;CAGjD,QAAQ,OAAyB;AAC/B,OAAK,MAAM,OAAO,MAAA,YAChB,KAAI,MAAM"}
|
package/dist/tree.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { n as TraversableTree, t as TickledController } from "./tickled-controller-Cq1Va0rR.js";
|
|
2
|
+
import { C as TreeNode, S as TreeItem, _ as TreeDataModelOptions, a as TreeComponent, b as TreeFilterPredicate, c as TreeExpandEvent, d as TreeSearchHost, f as TreeSelectDetail, g as TreeDataModel, h as TreeTickleEvent, i as TreeCollapseEvent, l as TreeItemClickDetail, m as TreeTickleDetail, n as TreeActivateEvent, o as TreeComponentEventMap, p as TreeSelectEvent, r as TreeCollapseDetail, s as TreeExpandDetail, t as TreeActivateDetail, u as TreeItemClickEvent, v as LoadChildrenCallback, w as TreeSelectionFilter, x as TreeInteractionMode, y as TreeExclusivity } from "./tree-component-CQpoPo4s.js";
|
|
3
|
+
import { t as TreeConfig } from "./types-BKaqnpwx.js";
|
|
4
|
+
import * as _$lit from "lit";
|
|
5
|
+
import { LitElement, PropertyValues, TemplateResult, nothing } from "lit";
|
|
6
|
+
|
|
7
|
+
//#region src/tree/tree-base.d.ts
|
|
8
|
+
declare class TreeBaseElement extends LitElement implements TreeComponent, TreeSearchHost {
|
|
9
|
+
#private;
|
|
10
|
+
root: TreeNode | undefined;
|
|
11
|
+
model: TreeDataModel | undefined;
|
|
12
|
+
/** Callback to lazily load children for a node. Superseded by `model` when both are set. */
|
|
13
|
+
loadChildren: LoadChildrenCallback | undefined;
|
|
14
|
+
exclusivity: TreeExclusivity;
|
|
15
|
+
selectionFilter: TreeSelectionFilter;
|
|
16
|
+
/** Controls how pointer/keyboard gestures map to selection changes. Default: `'standard'`. */
|
|
17
|
+
interactionMode: TreeInteractionMode;
|
|
18
|
+
selectedNode: TreeNode | undefined;
|
|
19
|
+
protected _selectedNodes: Set<TreeNode>;
|
|
20
|
+
get selectedNodes(): ReadonlySet<TreeNode>;
|
|
21
|
+
filterPredicate: TreeFilterPredicate | undefined;
|
|
22
|
+
disableKeyboardNavigation: boolean;
|
|
23
|
+
protected _expandedKeys: Set<string>;
|
|
24
|
+
protected tickled: TickledController<string>;
|
|
25
|
+
protected _focusedDepth: number;
|
|
26
|
+
updated(changedProps: PropertyValues): void;
|
|
27
|
+
connectedCallback(): void;
|
|
28
|
+
disconnectedCallback(): void;
|
|
29
|
+
getConfig(): TreeConfig;
|
|
30
|
+
setConfig(config: Partial<TreeConfig>): void;
|
|
31
|
+
select(node: TreeNode): void;
|
|
32
|
+
deselect(node: TreeNode): void;
|
|
33
|
+
clearSelection(): void;
|
|
34
|
+
navigateTo(keys: readonly string[]): boolean;
|
|
35
|
+
navigateToNode(predicate: (node: TreeNode) => boolean): boolean;
|
|
36
|
+
getNodes(): ReadonlyArray<{
|
|
37
|
+
node: TreeNode;
|
|
38
|
+
depth: number;
|
|
39
|
+
}>;
|
|
40
|
+
protected renderNodeContent(node: TreeNode, _depth: number): TemplateResult | typeof nothing;
|
|
41
|
+
protected _handleItemClick(node: TreeNode, depth: number, event?: MouseEvent): void;
|
|
42
|
+
protected _handleCheckboxClick(event: MouseEvent, node: TreeNode, _depth: number): void;
|
|
43
|
+
protected _isSelected(node: TreeNode): boolean;
|
|
44
|
+
protected _isFocused(node: TreeNode): boolean;
|
|
45
|
+
protected _isExpanded(node: TreeNode): boolean;
|
|
46
|
+
protected get _pendingNode(): TreeNode | undefined;
|
|
47
|
+
protected renderLoadingIndicator(): TemplateResult | typeof nothing;
|
|
48
|
+
protected render(): TemplateResult<1>;
|
|
49
|
+
protected _renderNode(node: TreeNode, depth: number): TemplateResult;
|
|
50
|
+
static styles: _$lit.CSSResult[];
|
|
51
|
+
}
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
'ixfx-tree-base': TreeBaseElement;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
interface TreeBaseElementEventMap extends TreeComponentEventMap {
|
|
58
|
+
'item-click': TreeItemClickEvent;
|
|
59
|
+
'expand': TreeExpandEvent;
|
|
60
|
+
'collapse': TreeCollapseEvent;
|
|
61
|
+
'select': TreeSelectEvent;
|
|
62
|
+
'tickle': TreeTickleEvent;
|
|
63
|
+
'activate': TreeActivateEvent;
|
|
64
|
+
}
|
|
65
|
+
interface TreeBaseElement {
|
|
66
|
+
addEventListener: (<K extends keyof TreeBaseElementEventMap>(type: K, listener: (this: TreeBaseElement, event: TreeBaseElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void);
|
|
67
|
+
removeEventListener: (<K extends keyof TreeBaseElementEventMap>(type: K, listener: (this: TreeBaseElement, event: TreeBaseElementEventMap[K]) => void, options?: boolean | EventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/tree/tree-controller.d.ts
|
|
71
|
+
type TreeControllerOptions<T> = {
|
|
72
|
+
valueToItem: (value: T, node: TraversableTree<T>) => TreeItem;
|
|
73
|
+
};
|
|
74
|
+
declare class TreeController<T> {
|
|
75
|
+
#private;
|
|
76
|
+
constructor(root: TraversableTree<T>, element: TreeBaseElement, options: TreeControllerOptions<T>);
|
|
77
|
+
connect(): void;
|
|
78
|
+
disconnect(): void;
|
|
79
|
+
navigateToValue(predicate: (value: T) => boolean): boolean;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/tree/tree-list.d.ts
|
|
83
|
+
declare class TreeListElement extends TreeBaseElement {
|
|
84
|
+
#private;
|
|
85
|
+
protected render(): TemplateResult<1>;
|
|
86
|
+
protected renderNodeContent(node: TreeNode, depth: number): TemplateResult;
|
|
87
|
+
protected _renderNode(node: TreeNode, depth: number): TemplateResult;
|
|
88
|
+
static styles: _$lit.CSSResult[];
|
|
89
|
+
}
|
|
90
|
+
declare global {
|
|
91
|
+
interface HTMLElementTagNameMap {
|
|
92
|
+
'ixfx-tree-list': TreeListElement;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
interface TreeListElement {
|
|
96
|
+
addEventListener: (<K extends keyof TreeBaseElementEventMap>(type: K, listener: (this: TreeListElement, event: TreeBaseElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void);
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { LoadChildrenCallback, TreeActivateDetail, TreeActivateEvent, TreeBaseElement, TreeBaseElementEventMap, TreeCollapseDetail, TreeCollapseEvent, TreeComponentEventMap, TreeConfig, TreeController, TreeControllerOptions, TreeDataModel, TreeDataModelOptions, TreeExclusivity, TreeExpandDetail, TreeExpandEvent, TreeFilterPredicate, TreeItem, TreeItemClickDetail, TreeItemClickEvent, TreeListElement, TreeNode, TreeSelectDetail, TreeSelectEvent, TreeSelectionFilter, TreeTickleDetail, TreeTickleEvent };
|
|
100
|
+
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.d.ts","names":[],"sources":["../src/tree/tree-base.ts","../src/tree/tree-controller.ts","../src/tree/tree-list.ts"],"mappings":";;;;;;;cAkCa,eAAA,SAAwB,UAAA,YAAsB,aAAA,EAAe,cAAA;EAAA;EAExE,IAAA,EAAM,QAAA;EAGN,KAAA,EAAO,aAAA;EAIO;EAAd,YAAA,EAAc,oBAAA;EAGd,WAAA,EAAa,eAAA;EAGb,eAAA,EAAiB,mBAAA;EAOH;EAHd,eAAA,EAAiB,mBAAA;EAGjB,YAAA,EAAc,QAAA;EAAA,UAGJ,cAAA,EAAc,GAAA,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