@vokril/ui-solid 0.19.1 → 0.20.0

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 (87) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +38 -2
  3. package/dist/createResizableSidebar-A0F4JmSU.js +472 -0
  4. package/dist/createResizableSidebar-DwCuRuho.cjs +1 -0
  5. package/dist/createVirtualWindow-9T5ZJCQR.cjs +1 -0
  6. package/dist/createVirtualWindow-Dqm5jxZa.js +117 -0
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.js +108 -104
  9. package/dist/layout/createVirtualScroller.d.cts +8 -31
  10. package/dist/layout/createVirtualScroller.d.ts +8 -31
  11. package/dist/layout/createVirtualWindow.d.cts +64 -0
  12. package/dist/layout/createVirtualWindow.d.ts +64 -0
  13. package/dist/layout/index.cjs +1 -1
  14. package/dist/layout/index.d.cts +2 -0
  15. package/dist/layout/index.d.ts +2 -0
  16. package/dist/layout/index.js +7 -6
  17. package/dist/layout/virtualScrollerUtils.d.cts +58 -22
  18. package/dist/layout/virtualScrollerUtils.d.ts +58 -22
  19. package/dist/rowSource-BnUQ-LKT.cjs +1 -0
  20. package/dist/rowSource-CLEYuC95.js +1236 -0
  21. package/dist/server/createResizableSidebar-CZ0IGNm8.js +310 -0
  22. package/dist/server/createResizableSidebar-DDniLGSD.cjs +1 -0
  23. package/dist/server/createVirtualWindow-9T5ZJCQR.cjs +1 -0
  24. package/dist/server/createVirtualWindow-Dqm5jxZa.js +117 -0
  25. package/dist/server/index.cjs +1 -1
  26. package/dist/server/index.js +110 -106
  27. package/dist/server/layout/index.cjs +1 -1
  28. package/dist/server/layout/index.js +7 -6
  29. package/dist/server/rowSource-CdvoDIN7.cjs +1 -0
  30. package/dist/server/rowSource-D7lSI6LT.js +1122 -0
  31. package/dist/server/tree/index.cjs +1 -1
  32. package/dist/server/tree/index.js +11 -8
  33. package/dist/solid/layout/createVirtualScroller.js +17 -100
  34. package/dist/solid/layout/createVirtualWindow.js +129 -0
  35. package/dist/solid/layout/index.js +1 -0
  36. package/dist/solid/layout/virtualScrollerUtils.js +31 -32
  37. package/dist/solid/tree/TreeSurface.jsx +20 -13
  38. package/dist/solid/tree/createTreeController.js +110 -62
  39. package/dist/solid/tree/createTreeSurface.js +29 -12
  40. package/dist/solid/tree/index.js +1 -0
  41. package/dist/solid/tree/rowSource.js +93 -0
  42. package/dist/solid/tree/selectAllInScope.js +31 -25
  43. package/dist/solid/tree/stickyScroll.js +12 -10
  44. package/dist/solid/tree/treeAria.js +11 -30
  45. package/dist/solid/tree/treeKeymap.js +2 -24
  46. package/dist/solid/tree/viewportAnchor.js +23 -0
  47. package/dist/style.css +1 -1
  48. package/dist/tree/TreeStickyHeader.d.cts +1 -1
  49. package/dist/tree/TreeStickyHeader.d.ts +1 -1
  50. package/dist/tree/TreeSurface.d.cts +1 -1
  51. package/dist/tree/TreeSurface.d.ts +1 -1
  52. package/dist/tree/createTreeController.d.cts +19 -8
  53. package/dist/tree/createTreeController.d.ts +19 -8
  54. package/dist/tree/createTreeSurface.d.cts +8 -3
  55. package/dist/tree/createTreeSurface.d.ts +8 -3
  56. package/dist/tree/descriptor.d.cts +8 -9
  57. package/dist/tree/descriptor.d.ts +8 -9
  58. package/dist/tree/index.cjs +1 -1
  59. package/dist/tree/index.d.cts +1 -0
  60. package/dist/tree/index.d.ts +1 -0
  61. package/dist/tree/index.js +11 -8
  62. package/dist/tree/rowSource.d.cts +41 -0
  63. package/dist/tree/rowSource.d.ts +41 -0
  64. package/dist/tree/selectAllInScope.d.cts +20 -2
  65. package/dist/tree/selectAllInScope.d.ts +20 -2
  66. package/dist/tree/stickyScroll.d.cts +32 -5
  67. package/dist/tree/stickyScroll.d.ts +32 -5
  68. package/dist/tree/treeAria.d.cts +26 -10
  69. package/dist/tree/treeAria.d.ts +26 -10
  70. package/dist/tree/treeKeymap.d.cts +2 -16
  71. package/dist/tree/treeKeymap.d.ts +2 -16
  72. package/dist/tree/viewportAnchor.d.cts +21 -0
  73. package/dist/tree/viewportAnchor.d.ts +21 -0
  74. package/dist/ui.css +1 -1
  75. package/package.json +1 -1
  76. package/dist/createResizableSidebar-Dau7TIuH.cjs +0 -1
  77. package/dist/createResizableSidebar-gvf9me4K.js +0 -449
  78. package/dist/createVirtualScroller-CL49JE2P.cjs +0 -1
  79. package/dist/createVirtualScroller-vu-l4rVv.js +0 -93
  80. package/dist/descriptor-CaHgh9N_.cjs +0 -1
  81. package/dist/descriptor-eGtcBtpI.js +0 -1106
  82. package/dist/server/createResizableSidebar-BQG5elmd.js +0 -287
  83. package/dist/server/createResizableSidebar-tU8FO2MK.cjs +0 -1
  84. package/dist/server/createVirtualScroller-CL49JE2P.cjs +0 -1
  85. package/dist/server/createVirtualScroller-vu-l4rVv.js +0 -93
  86. package/dist/server/descriptor-CEGvvJZh.cjs +0 -1
  87. package/dist/server/descriptor-GLoKPx6x.js +0 -992
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * It lives OUTSIDE the scroll viewport, as an absolute child of TreeSurface's
5
5
  * host, for two independent reasons. Chrome inside the scroll area breaks the
6
- * virtual scroller's `scrollTop` arithmetic (the database panel's connection
6
+ * virtual window's `scrollTop` arithmetic (the database panel's connection
7
7
  * header sits outside for exactly this reason, and says so). And
8
8
  * `OverlayScrollArea` watches its viewport with a MutationObserver over
9
9
  * `{childList, subtree}` — a widget that re-renders on every scroll frame in
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * It lives OUTSIDE the scroll viewport, as an absolute child of TreeSurface's
5
5
  * host, for two independent reasons. Chrome inside the scroll area breaks the
6
- * virtual scroller's `scrollTop` arithmetic (the database panel's connection
6
+ * virtual window's `scrollTop` arithmetic (the database panel's connection
7
7
  * header sits outside for exactly this reason, and says so). And
8
8
  * `OverlayScrollArea` watches its viewport with a MutationObserver over
9
9
  * `{childList, subtree}` — a widget that re-renders on every scroll frame in
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * TreeSurface — the shared DOM base under every tree in the app.
3
3
  *
4
- * It owns the scroll container (exactly one, and it is the virtual scroller's:
4
+ * It owns the scroll container (exactly one, and it is the virtual window's:
5
5
  * a tree nested inside someone else's scroller is a dead tree), the `role=tree`
6
6
  * semantics, the keyboard entry point, and the row stack. It owns no surface
7
7
  * knowledge whatsoever — no `if` in this file may ask which tree it is drawing.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * TreeSurface — the shared DOM base under every tree in the app.
3
3
  *
4
- * It owns the scroll container (exactly one, and it is the virtual scroller's:
4
+ * It owns the scroll container (exactly one, and it is the virtual window's:
5
5
  * a tree nested inside someone else's scroller is a dead tree), the `role=tree`
6
6
  * semantics, the keyboard entry point, and the row stack. It owns no surface
7
7
  * knowledge whatsoever — no `if` in this file may ask which tree it is drawing.
@@ -2,20 +2,27 @@
2
2
  * createTreeController — the headless brain every tree surface shares.
3
3
  *
4
4
  * It owns the cursor, the selection, the keyboard, and the a11y wiring; it owns
5
- * no DOM and knows no surface. A surface hands it rows and callbacks and gets
6
- * back state plus a keydown handler. What the rows LOOK like is none of its
5
+ * no DOM and knows no surface. A surface hands it a row source and callbacks and
6
+ * gets back state plus a keydown handler. What the rows LOOK like is none of its
7
7
  * business — that belongs to `<TreeRow>` and the surface descriptor.
8
8
  *
9
9
  * The cursor and the selection are two different things, and keeping them apart
10
10
  * is the point. Arrow keys move the cursor and leave the selection alone; Enter
11
- * and clicks change the selection. Three of our four surfaces conflated them —
12
- * in git, a plain click actively CLEARED the selection — which is why holding
13
- * Shift and arrowing never worked anywhere but the database tree.
11
+ * and clicks change the selection. Surfaces that conflated them — one where a
12
+ * plain click actively CLEARED the selection — never got Shift+Arrow right.
13
+ *
14
+ * The cursor and the range anchor are held by KEY, not by index. An index means
15
+ * "the row that happens to be there": expanding a folder above the cursor used
16
+ * to move the cursor onto a different row, without the user touching it. A key
17
+ * follows its row; a row that disappears (its parent collapsed) hands the cursor
18
+ * to its nearest surviving ancestor, as the reference tree does, and only with
19
+ * none left does the old index stand in.
14
20
  */
15
21
  import { type Accessor } from 'solid-js';
16
22
  import { type SelectionModifier, type TreeCapabilities, type TreePoint, type TreeRow } from './types.cjs';
23
+ import type { TreeRowSource } from './rowSource.cjs';
17
24
  export interface TreeControllerOptions {
18
- rows: Accessor<readonly TreeRow[]>;
25
+ rows: Accessor<TreeRowSource<TreeRow>>;
19
26
  capabilities?: Partial<TreeCapabilities>;
20
27
  /** Expand or collapse the row. The surface owns what that means. */
21
28
  onToggle?: (row: TreeRow) => void;
@@ -48,8 +55,12 @@ export interface TreeController {
48
55
  capabilities: TreeCapabilities;
49
56
  /** Move the cursor without touching the selection. */
50
57
  focusIndex: (index: number) => void;
58
+ /** Move the cursor to the row with this key, without touching the selection; nothing when no row has it. */
59
+ focusKey: (key: string) => void;
51
60
  /** Click path. `replace` also moves the cursor and resets the range anchor. */
52
61
  selectIndex: (index: number, modifier: SelectionModifier) => void;
62
+ /** The click path for the row with this key; nothing when no row has it. */
63
+ selectKey: (key: string, modifier: SelectionModifier) => void;
53
64
  /**
54
65
  * Drop the selection without moving the cursor. For after a bulk action has
55
66
  * consumed it — a cherry-pick of five commits must not leave those five looking
@@ -59,8 +70,8 @@ export interface TreeController {
59
70
  /** Select the DIRECT children of `index`, kind-locked ("Select All Child Objects"). */
60
71
  selectChildren: (index: number) => void;
61
72
  /**
62
- * `list.selectAll` (`Ctrl/Cmd+A`, `keybindings/surfaces/list.ts`): the reference's tree Select All — the cursor
63
- * row's scope, widening one level per press (`selectAllInScope`). Does nothing on a single-selection tree.
73
+ * `list.selectAll` (`Ctrl/Cmd+A`): the reference's tree Select All — the cursor row's scope, widening one level per
74
+ * press (`selectAllInScope`). Does nothing on a single-selection tree.
64
75
  */
65
76
  selectAll: () => void;
66
77
  /** Whether `index`'s selectable direct children all share one kind (the enablement gate). */
@@ -2,20 +2,27 @@
2
2
  * createTreeController — the headless brain every tree surface shares.
3
3
  *
4
4
  * It owns the cursor, the selection, the keyboard, and the a11y wiring; it owns
5
- * no DOM and knows no surface. A surface hands it rows and callbacks and gets
6
- * back state plus a keydown handler. What the rows LOOK like is none of its
5
+ * no DOM and knows no surface. A surface hands it a row source and callbacks and
6
+ * gets back state plus a keydown handler. What the rows LOOK like is none of its
7
7
  * business — that belongs to `<TreeRow>` and the surface descriptor.
8
8
  *
9
9
  * The cursor and the selection are two different things, and keeping them apart
10
10
  * is the point. Arrow keys move the cursor and leave the selection alone; Enter
11
- * and clicks change the selection. Three of our four surfaces conflated them —
12
- * in git, a plain click actively CLEARED the selection — which is why holding
13
- * Shift and arrowing never worked anywhere but the database tree.
11
+ * and clicks change the selection. Surfaces that conflated them — one where a
12
+ * plain click actively CLEARED the selection — never got Shift+Arrow right.
13
+ *
14
+ * The cursor and the range anchor are held by KEY, not by index. An index means
15
+ * "the row that happens to be there": expanding a folder above the cursor used
16
+ * to move the cursor onto a different row, without the user touching it. A key
17
+ * follows its row; a row that disappears (its parent collapsed) hands the cursor
18
+ * to its nearest surviving ancestor, as the reference tree does, and only with
19
+ * none left does the old index stand in.
14
20
  */
15
21
  import { type Accessor } from 'solid-js';
16
22
  import { type SelectionModifier, type TreeCapabilities, type TreePoint, type TreeRow } from './types.js';
23
+ import type { TreeRowSource } from './rowSource.js';
17
24
  export interface TreeControllerOptions {
18
- rows: Accessor<readonly TreeRow[]>;
25
+ rows: Accessor<TreeRowSource<TreeRow>>;
19
26
  capabilities?: Partial<TreeCapabilities>;
20
27
  /** Expand or collapse the row. The surface owns what that means. */
21
28
  onToggle?: (row: TreeRow) => void;
@@ -48,8 +55,12 @@ export interface TreeController {
48
55
  capabilities: TreeCapabilities;
49
56
  /** Move the cursor without touching the selection. */
50
57
  focusIndex: (index: number) => void;
58
+ /** Move the cursor to the row with this key, without touching the selection; nothing when no row has it. */
59
+ focusKey: (key: string) => void;
51
60
  /** Click path. `replace` also moves the cursor and resets the range anchor. */
52
61
  selectIndex: (index: number, modifier: SelectionModifier) => void;
62
+ /** The click path for the row with this key; nothing when no row has it. */
63
+ selectKey: (key: string, modifier: SelectionModifier) => void;
53
64
  /**
54
65
  * Drop the selection without moving the cursor. For after a bulk action has
55
66
  * consumed it — a cherry-pick of five commits must not leave those five looking
@@ -59,8 +70,8 @@ export interface TreeController {
59
70
  /** Select the DIRECT children of `index`, kind-locked ("Select All Child Objects"). */
60
71
  selectChildren: (index: number) => void;
61
72
  /**
62
- * `list.selectAll` (`Ctrl/Cmd+A`, `keybindings/surfaces/list.ts`): the reference's tree Select All — the cursor
63
- * row's scope, widening one level per press (`selectAllInScope`). Does nothing on a single-selection tree.
73
+ * `list.selectAll` (`Ctrl/Cmd+A`): the reference's tree Select All — the cursor row's scope, widening one level per
74
+ * press (`selectAllInScope`). Does nothing on a single-selection tree.
64
75
  */
65
76
  selectAll: () => void;
66
77
  /** Whether `index`'s selectable direct children all share one kind (the enablement gate). */
@@ -1,13 +1,18 @@
1
- import { type VirtualScrollerResult } from '../layout/createVirtualScroller.cjs';
1
+ import { type VirtualWindow } from '../layout/createVirtualWindow.cjs';
2
2
  import { type TreeController } from './createTreeController.cjs';
3
3
  import { type StickyTreeState } from './stickyScroll.cjs';
4
4
  import type { TreeSurfaceDescriptor, TreeSurfaceRow } from './descriptor.cjs';
5
+ import type { TreeRowSource } from './rowSource.cjs';
5
6
  import type { TreePoint } from './types.cjs';
6
7
  export interface TreeSurfaceApi<TNode> {
7
8
  descriptor: TreeSurfaceDescriptor<TNode>;
8
9
  controller: TreeController;
9
- scroller: VirtualScrollerResult<TreeSurfaceRow<TNode>>;
10
- rows: () => readonly TreeSurfaceRow<TNode>[];
10
+ /** The virtual window: which row indices are rendered, and the scroll geometry. */
11
+ scroller: VirtualWindow;
12
+ /** The current row source — the descriptor's, memoised. */
13
+ source: () => TreeRowSource<TreeSurfaceRow<TNode>>;
14
+ /** The row under the cursor; none before the tree is first focused. */
15
+ cursorRow: () => TreeSurfaceRow<TNode> | undefined;
11
16
  /** The pinned ancestor chain for the current scroll position. Empty when off. */
12
17
  stickyState: () => StickyTreeState<TNode>;
13
18
  /**
@@ -1,13 +1,18 @@
1
- import { type VirtualScrollerResult } from '../layout/createVirtualScroller.js';
1
+ import { type VirtualWindow } from '../layout/createVirtualWindow.js';
2
2
  import { type TreeController } from './createTreeController.js';
3
3
  import { type StickyTreeState } from './stickyScroll.js';
4
4
  import type { TreeSurfaceDescriptor, TreeSurfaceRow } from './descriptor.js';
5
+ import type { TreeRowSource } from './rowSource.js';
5
6
  import type { TreePoint } from './types.js';
6
7
  export interface TreeSurfaceApi<TNode> {
7
8
  descriptor: TreeSurfaceDescriptor<TNode>;
8
9
  controller: TreeController;
9
- scroller: VirtualScrollerResult<TreeSurfaceRow<TNode>>;
10
- rows: () => readonly TreeSurfaceRow<TNode>[];
10
+ /** The virtual window: which row indices are rendered, and the scroll geometry. */
11
+ scroller: VirtualWindow;
12
+ /** The current row source — the descriptor's, memoised. */
13
+ source: () => TreeRowSource<TreeSurfaceRow<TNode>>;
14
+ /** The row under the cursor; none before the tree is first focused. */
15
+ cursorRow: () => TreeSurfaceRow<TNode> | undefined;
11
16
  /** The pinned ancestor chain for the current scroll position. Empty when off. */
12
17
  stickyState: () => StickyTreeState<TNode>;
13
18
  /**
@@ -13,10 +13,11 @@
13
13
  * What is deliberately NOT here: the data source. Each surface already owns a
14
14
  * working state machine — git watches a repo, the filesystem watches a disk, the
15
15
  * database queries a catalog — and the engine has no business replacing them. It
16
- * asks only for the flattened result, in render order.
16
+ * asks only for the result as a row source (`rowSource.ts`), in render order.
17
17
  */
18
18
  import type { Accessor, JSX } from 'solid-js';
19
19
  import type { DesktopContextMenuEntry } from '../context/DesktopContextMenuContext.cjs';
20
+ import type { TreeRowSource } from './rowSource.cjs';
20
21
  import type { TreeCapabilities, TreeRow } from './types.cjs';
21
22
  /** A row plus the surface's own payload, which the engine never looks inside. */
22
23
  export interface TreeSurfaceRow<TNode> extends TreeRow {
@@ -67,16 +68,14 @@ export interface TreeSurfaceDescriptor<TNode> {
67
68
  * list mode and tree mode are the same descriptor with this one field flipped.
68
69
  */
69
70
  capabilities?: Partial<TreeCapabilities>;
70
- /** The flattened tree, in render order. The surface owns the flattening. */
71
- rows: Accessor<readonly TreeSurfaceRow<TNode>[]>;
72
71
  /**
73
- * Labels that precede depth-0 rows in the object PATH (Copy Object Path). The
74
- * database tree's connection root is sticky chrome, NOT a row, so its name
75
- * lives here; `treeRowPath` prepends it. Omit when the tree's roots already
76
- * carry the full path.
72
+ * The tree's rows, in render order — a new source for every structural
73
+ * change. A surface that keeps an array wraps it with `treeRowsFrom`; one that
74
+ * computes rows on demand implements the source itself. The engine memoises
75
+ * this accessor, so building the source here runs once per change.
77
76
  */
78
- pathPrefix?: Accessor<readonly string[]>;
79
- /** Fixed, and equal to the CSS row height — the virtual scroller does arithmetic with it. */
77
+ rows: Accessor<TreeRowSource<TreeSurfaceRow<TNode>>>;
78
+ /** Fixed, and equal to the CSS row height — the virtual window does arithmetic with it. */
80
79
  rowHeight: number;
81
80
  overscan?: number;
82
81
  /**
@@ -13,10 +13,11 @@
13
13
  * What is deliberately NOT here: the data source. Each surface already owns a
14
14
  * working state machine — git watches a repo, the filesystem watches a disk, the
15
15
  * database queries a catalog — and the engine has no business replacing them. It
16
- * asks only for the flattened result, in render order.
16
+ * asks only for the result as a row source (`rowSource.ts`), in render order.
17
17
  */
18
18
  import type { Accessor, JSX } from 'solid-js';
19
19
  import type { DesktopContextMenuEntry } from '../context/DesktopContextMenuContext.js';
20
+ import type { TreeRowSource } from './rowSource.js';
20
21
  import type { TreeCapabilities, TreeRow } from './types.js';
21
22
  /** A row plus the surface's own payload, which the engine never looks inside. */
22
23
  export interface TreeSurfaceRow<TNode> extends TreeRow {
@@ -67,16 +68,14 @@ export interface TreeSurfaceDescriptor<TNode> {
67
68
  * list mode and tree mode are the same descriptor with this one field flipped.
68
69
  */
69
70
  capabilities?: Partial<TreeCapabilities>;
70
- /** The flattened tree, in render order. The surface owns the flattening. */
71
- rows: Accessor<readonly TreeSurfaceRow<TNode>[]>;
72
71
  /**
73
- * Labels that precede depth-0 rows in the object PATH (Copy Object Path). The
74
- * database tree's connection root is sticky chrome, NOT a row, so its name
75
- * lives here; `treeRowPath` prepends it. Omit when the tree's roots already
76
- * carry the full path.
72
+ * The tree's rows, in render order — a new source for every structural
73
+ * change. A surface that keeps an array wraps it with `treeRowsFrom`; one that
74
+ * computes rows on demand implements the source itself. The engine memoises
75
+ * this accessor, so building the source here runs once per change.
77
76
  */
78
- pathPrefix?: Accessor<readonly string[]>;
79
- /** Fixed, and equal to the CSS row height — the virtual scroller does arithmetic with it. */
77
+ rows: Accessor<TreeRowSource<TreeSurfaceRow<TNode>>>;
78
+ /** Fixed, and equal to the CSS row height — the virtual window does arithmetic with it. */
80
79
  rowHeight: number;
81
80
  overscan?: number;
82
81
  /**
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../descriptor-CaHgh9N_.cjs");exports.DEFAULT_TREE_CAPABILITIES=e.DEFAULT_TREE_CAPABILITIES;exports.TREE_INDENT_STEP_REM=e.TREE_INDENT_STEP_REM;exports.TreeHighlight=e.TreeHighlight;exports.TreeRow=e.TreeRow;exports.TreeSurface=e.TreeSurface;exports.buildTreeContainerAria=e.buildTreeContainerAria;exports.buildTreeRowAria=e.buildTreeRowAria;exports.createTreeController=e.createTreeController;exports.createTreeSurface=e.createTreeSurface;exports.selectAllInScope=e.selectAllInScope;exports.treeRowDomId=e.treeRowDomId;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../rowSource-BnUQ-LKT.cjs");exports.DEFAULT_TREE_CAPABILITIES=e.DEFAULT_TREE_CAPABILITIES;exports.TREE_INDENT_STEP_REM=e.TREE_INDENT_STEP_REM;exports.TreeHighlight=e.TreeHighlight;exports.TreeRow=e.TreeRow;exports.TreeSurface=e.TreeSurface;exports.assertRowIndex=e.assertRowIndex;exports.buildTreeContainerAria=e.buildTreeContainerAria;exports.buildTreeRowAria=e.buildTreeRowAria;exports.buildTreeRowStructureAria=e.buildTreeRowStructureAria;exports.createTreeController=e.createTreeController;exports.createTreeSurface=e.createTreeSurface;exports.selectAllInScope=e.selectAllInScope;exports.treeRowDomId=e.treeRowDomId;exports.treeRowsFrom=e.treeRowsFrom;
@@ -6,3 +6,4 @@ export { DEFAULT_TREE_CAPABILITIES, type TreeRow as TreeRowModel, type TreeCapab
6
6
  export * from './treeAria.cjs';
7
7
  export { createTreeController, type TreeControllerOptions } from './createTreeController.cjs';
8
8
  export { selectAllInScope, type SelectAllRow } from './selectAllInScope.cjs';
9
+ export { assertRowIndex, treeRowsFrom, type TreeRowShape, type TreeRowSource, type TreeSiblingPosition, } from './rowSource.cjs';
@@ -6,3 +6,4 @@ export { DEFAULT_TREE_CAPABILITIES, type TreeRow as TreeRowModel, type TreeCapab
6
6
  export * from './treeAria.js';
7
7
  export { createTreeController, type TreeControllerOptions } from './createTreeController.js';
8
8
  export { selectAllInScope, type SelectAllRow } from './selectAllInScope.js';
9
+ export { assertRowIndex, treeRowsFrom, type TreeRowShape, type TreeRowSource, type TreeSiblingPosition, } from './rowSource.js';
@@ -1,14 +1,17 @@
1
- import { D as r, T, a as s, b as o, c as t, d as E, e as l, f as c, g as i, s as A, t as I } from "../descriptor-eGtcBtpI.js";
1
+ import { D as a, T as s, a as T, b as o, c as t, d as i, e as l, f as E, g as R, h as c, i as u, s as A, t as I, j as d } from "../rowSource-CLEYuC95.js";
2
2
  export {
3
- r as DEFAULT_TREE_CAPABILITIES,
4
- T as TREE_INDENT_STEP_REM,
5
- s as TreeHighlight,
3
+ a as DEFAULT_TREE_CAPABILITIES,
4
+ s as TREE_INDENT_STEP_REM,
5
+ T as TreeHighlight,
6
6
  o as TreeRow,
7
7
  t as TreeSurface,
8
- E as buildTreeContainerAria,
9
- l as buildTreeRowAria,
8
+ i as assertRowIndex,
9
+ l as buildTreeContainerAria,
10
+ E as buildTreeRowAria,
11
+ R as buildTreeRowStructureAria,
10
12
  c as createTreeController,
11
- i as createTreeSurface,
13
+ u as createTreeSurface,
12
14
  A as selectAllInScope,
13
- I as treeRowDomId
15
+ I as treeRowDomId,
16
+ d as treeRowsFrom
14
17
  };
@@ -0,0 +1,41 @@
1
+ import type { TreeRow } from './types.cjs';
2
+ /** What the structural questions read of a row: its identity and its depth. */
3
+ export type TreeRowShape = Pick<TreeRow, 'key' | 'depth'>;
4
+ /** `aria-posinset` / `aria-setsize`: 1-based position among the siblings, and their count. */
5
+ export interface TreeSiblingPosition {
6
+ readonly posInSet: number;
7
+ readonly setSize: number;
8
+ }
9
+ export interface TreeRowSource<TRow extends TreeRowShape = TreeRow> {
10
+ /** Number of rendered rows. */
11
+ readonly length: number;
12
+ /**
13
+ * The row at `index`. Type-ahead may read every row through this, so a source
14
+ * that builds rows lazily keeps it cheap — or its surface turns
15
+ * `canTypeAhead` off.
16
+ */
17
+ at(index: number): TRow;
18
+ /** The nearest preceding row with a smaller depth; -1 for a root. */
19
+ parentIndex(index: number): number;
20
+ /** The last row of `index`'s rendered subtree — `index` itself when it shows no children. */
21
+ subtreeEnd(index: number): number;
22
+ /**
23
+ * Position among the siblings: the rows with the same parent AND the same
24
+ * depth. "3 of 7" means 3 of 7 children, never 3 of 400 visible rows.
25
+ */
26
+ siblingPosition(index: number): TreeSiblingPosition;
27
+ /** The index of the row with this key, or -1. */
28
+ indexOfKey(key: string): number;
29
+ }
30
+ /**
31
+ * A structural question about a row that does not exist is a caller's bug, not
32
+ * an empty answer: an engine that silently got `-1` back would walk the wrong
33
+ * row instead of failing where the mistake is.
34
+ */
35
+ export declare function assertRowIndex(source: Pick<TreeRowSource<TreeRowShape>, 'length'>, index: number): void;
36
+ /**
37
+ * The source of an array of rows, in render order. The source keeps its own
38
+ * copy, so a caller that mutates its array afterwards changes nothing here; the
39
+ * parent, subtree-end and sibling tables and the key index are built at once.
40
+ */
41
+ export declare function treeRowsFrom<TRow extends TreeRowShape>(input: readonly TRow[]): TreeRowSource<TRow>;
@@ -0,0 +1,41 @@
1
+ import type { TreeRow } from './types.js';
2
+ /** What the structural questions read of a row: its identity and its depth. */
3
+ export type TreeRowShape = Pick<TreeRow, 'key' | 'depth'>;
4
+ /** `aria-posinset` / `aria-setsize`: 1-based position among the siblings, and their count. */
5
+ export interface TreeSiblingPosition {
6
+ readonly posInSet: number;
7
+ readonly setSize: number;
8
+ }
9
+ export interface TreeRowSource<TRow extends TreeRowShape = TreeRow> {
10
+ /** Number of rendered rows. */
11
+ readonly length: number;
12
+ /**
13
+ * The row at `index`. Type-ahead may read every row through this, so a source
14
+ * that builds rows lazily keeps it cheap — or its surface turns
15
+ * `canTypeAhead` off.
16
+ */
17
+ at(index: number): TRow;
18
+ /** The nearest preceding row with a smaller depth; -1 for a root. */
19
+ parentIndex(index: number): number;
20
+ /** The last row of `index`'s rendered subtree — `index` itself when it shows no children. */
21
+ subtreeEnd(index: number): number;
22
+ /**
23
+ * Position among the siblings: the rows with the same parent AND the same
24
+ * depth. "3 of 7" means 3 of 7 children, never 3 of 400 visible rows.
25
+ */
26
+ siblingPosition(index: number): TreeSiblingPosition;
27
+ /** The index of the row with this key, or -1. */
28
+ indexOfKey(key: string): number;
29
+ }
30
+ /**
31
+ * A structural question about a row that does not exist is a caller's bug, not
32
+ * an empty answer: an engine that silently got `-1` back would walk the wrong
33
+ * row instead of failing where the mistake is.
34
+ */
35
+ export declare function assertRowIndex(source: Pick<TreeRowSource<TreeRowShape>, 'length'>, index: number): void;
36
+ /**
37
+ * The source of an array of rows, in render order. The source keeps its own
38
+ * copy, so a caller that mutates its array afterwards changes nothing here; the
39
+ * parent, subtree-end and sibling tables and the key index are built at once.
40
+ */
41
+ export declare function treeRowsFrom<TRow extends TreeRowShape>(input: readonly TRow[]): TreeRowSource<TRow>;
@@ -1,5 +1,23 @@
1
+ /**
2
+ * "Select All" in a tree — the reference's `list.selectAll` on a tree (`listCommands.ts`), over the row source.
3
+ *
4
+ * The reference does not select the whole tree. It selects the row's SCOPE: every visible row under the parent of the
5
+ * row the user is on (the cursor, or the first selected row when the cursor is part of the selection). A press that
6
+ * finds the scope already selected climbs one level — the scope row joins the selection, and the next press starts
7
+ * from it, so repeated presses widen the selection out to the whole tree.
8
+ *
9
+ * Two rules ride on top, because the engine enforces them on every other selection path:
10
+ * - furniture (`selectable: false`: headers, "Loading…", a grouping folder) is never selected. A scope row that is
11
+ * furniture cannot join the selection, so that press climbs straight past it;
12
+ * - the kind lock: one kind only, so a tree's "drop 5 tables" cannot sweep in a view. The kind is the starting
13
+ * row's, or — when the starting row is furniture — the next selectable row's.
14
+ *
15
+ * The reference compares selection LENGTHS to decide that the scope is already selected; this compares the sets, so
16
+ * three rows picked across folders do not count as "this folder is selected".
17
+ */
18
+ import type { TreeRowSource } from './rowSource.cjs';
1
19
  import type { TreeRow } from './types.cjs';
2
- /** What the rule reads of a row — a tree row, or a list's own row with its depth (the search results). */
20
+ /** What the rule reads of a row — a tree row, or a list's own row with its depth (wrapped with `treeRowsFrom`). */
3
21
  export type SelectAllRow = Pick<TreeRow, 'key' | 'depth' | 'kind' | 'selectable'>;
4
22
  /** The new selection, in row order — a climbed scope row first, as the reference puts it. */
5
- export declare function selectAllInScope(rows: readonly SelectAllRow[], cursor: number, selection: Iterable<string>): string[];
23
+ export declare function selectAllInScope(rows: TreeRowSource<SelectAllRow>, cursor: number, selection: Iterable<string>): string[];
@@ -1,5 +1,23 @@
1
+ /**
2
+ * "Select All" in a tree — the reference's `list.selectAll` on a tree (`listCommands.ts`), over the row source.
3
+ *
4
+ * The reference does not select the whole tree. It selects the row's SCOPE: every visible row under the parent of the
5
+ * row the user is on (the cursor, or the first selected row when the cursor is part of the selection). A press that
6
+ * finds the scope already selected climbs one level — the scope row joins the selection, and the next press starts
7
+ * from it, so repeated presses widen the selection out to the whole tree.
8
+ *
9
+ * Two rules ride on top, because the engine enforces them on every other selection path:
10
+ * - furniture (`selectable: false`: headers, "Loading…", a grouping folder) is never selected. A scope row that is
11
+ * furniture cannot join the selection, so that press climbs straight past it;
12
+ * - the kind lock: one kind only, so a tree's "drop 5 tables" cannot sweep in a view. The kind is the starting
13
+ * row's, or — when the starting row is furniture — the next selectable row's.
14
+ *
15
+ * The reference compares selection LENGTHS to decide that the scope is already selected; this compares the sets, so
16
+ * three rows picked across folders do not count as "this folder is selected".
17
+ */
18
+ import type { TreeRowSource } from './rowSource.js';
1
19
  import type { TreeRow } from './types.js';
2
- /** What the rule reads of a row — a tree row, or a list's own row with its depth (the search results). */
20
+ /** What the rule reads of a row — a tree row, or a list's own row with its depth (wrapped with `treeRowsFrom`). */
3
21
  export type SelectAllRow = Pick<TreeRow, 'key' | 'depth' | 'kind' | 'selectable'>;
4
22
  /** The new selection, in row order — a climbed scope row first, as the reference puts it. */
5
- export declare function selectAllInScope(rows: readonly SelectAllRow[], cursor: number, selection: Iterable<string>): string[];
23
+ export declare function selectAllInScope(rows: TreeRowSource<SelectAllRow>, cursor: number, selection: Iterable<string>): string[];
@@ -1,6 +1,32 @@
1
+ /**
2
+ * Sticky ancestor headers — the whole behaviour, as arithmetic.
3
+ *
4
+ * Scrolling down a tree, the chain of ancestors above the first visible row
5
+ * pins itself to the top, so "which folder am I in" survives the scroll
6
+ * position. The chain is live: as a parent's last child scrolls up past the
7
+ * stack, the parent is PUSHED OUT behind the rows above it rather than snapping
8
+ * away — that push is the entire feel of the thing, and §push-out below is where
9
+ * it happens.
10
+ *
11
+ * Nothing here touches Solid or the DOM: the behaviour is a pure function of the
12
+ * row source and the scroll position, tested as one.
13
+ *
14
+ * The reference implementation measures the DOM on every frame. Three facts
15
+ * about these trees delete all of that:
16
+ *
17
+ * 1. `rowHeight` is FIXED and lives in the descriptor, because the virtual
18
+ * window already does arithmetic with it. The top of row `i` is
19
+ * `i × rowHeight` in content space — measured by no one, also past the
20
+ * browser's height limit.
21
+ * 2. Trees do not scroll horizontally, so there is no `scrollLeft` to sync.
22
+ * 3. The row source answers the two structural questions directly — a row's
23
+ * parent (`parentIndex`) and where its subtree ends (`subtreeEnd`) — so the
24
+ * chain costs one step per pinned row, however many rows the tree has.
25
+ */
26
+ import type { TreeRowSource } from './rowSource.cjs';
1
27
  import type { TreeSurfaceRow } from './descriptor.cjs';
2
28
  export interface StickyTreeRow<TNode> {
3
- /** Index into the FULL row list — a click on the clone acts on the real row. */
29
+ /** Index into the row source — a click on the clone acts on the real row. */
4
30
  index: number;
5
31
  row: TreeSurfaceRow<TNode>;
6
32
  /** Top within the widget, px. While being pushed out it slides UP, behind the row above. */
@@ -13,10 +39,10 @@ export interface StickyTreeState<TNode> {
13
39
  }
14
40
  /**
15
41
  * The sticky stack for a scroll position: which ancestors are pinned, and where
16
- * each sits inside the widget.
42
+ * each sits inside the widget. `scrollTop` is in content space.
17
43
  */
18
44
  export declare function computeStickyTreeState<TNode>(params: {
19
- rows: readonly TreeSurfaceRow<TNode>[];
45
+ rows: TreeRowSource<TreeSurfaceRow<TNode>>;
20
46
  scrollTop: number;
21
47
  rowHeight: number;
22
48
  viewportHeight: number;
@@ -28,6 +54,7 @@ export declare function computeStickyTreeState<TNode>(params: {
28
54
  *
29
55
  * Derived from the TARGET's ancestors, not from the widget currently on screen:
30
56
  * scrolling to a row is what CHANGES the widget, so measuring the old one aims
31
- * at where the stack used to be.
57
+ * at where the stack used to be. The walk stops at `maxCount` ancestors — no
58
+ * more than that can pin.
32
59
  */
33
- export declare function stickyInsetForIndex<TNode>(rows: readonly TreeSurfaceRow<TNode>[], index: number, rowHeight: number, maxCount: number): number;
60
+ export declare function stickyInsetForIndex<TNode>(rows: TreeRowSource<TreeSurfaceRow<TNode>>, index: number, rowHeight: number, maxCount: number): number;
@@ -1,6 +1,32 @@
1
+ /**
2
+ * Sticky ancestor headers — the whole behaviour, as arithmetic.
3
+ *
4
+ * Scrolling down a tree, the chain of ancestors above the first visible row
5
+ * pins itself to the top, so "which folder am I in" survives the scroll
6
+ * position. The chain is live: as a parent's last child scrolls up past the
7
+ * stack, the parent is PUSHED OUT behind the rows above it rather than snapping
8
+ * away — that push is the entire feel of the thing, and §push-out below is where
9
+ * it happens.
10
+ *
11
+ * Nothing here touches Solid or the DOM: the behaviour is a pure function of the
12
+ * row source and the scroll position, tested as one.
13
+ *
14
+ * The reference implementation measures the DOM on every frame. Three facts
15
+ * about these trees delete all of that:
16
+ *
17
+ * 1. `rowHeight` is FIXED and lives in the descriptor, because the virtual
18
+ * window already does arithmetic with it. The top of row `i` is
19
+ * `i × rowHeight` in content space — measured by no one, also past the
20
+ * browser's height limit.
21
+ * 2. Trees do not scroll horizontally, so there is no `scrollLeft` to sync.
22
+ * 3. The row source answers the two structural questions directly — a row's
23
+ * parent (`parentIndex`) and where its subtree ends (`subtreeEnd`) — so the
24
+ * chain costs one step per pinned row, however many rows the tree has.
25
+ */
26
+ import type { TreeRowSource } from './rowSource.js';
1
27
  import type { TreeSurfaceRow } from './descriptor.js';
2
28
  export interface StickyTreeRow<TNode> {
3
- /** Index into the FULL row list — a click on the clone acts on the real row. */
29
+ /** Index into the row source — a click on the clone acts on the real row. */
4
30
  index: number;
5
31
  row: TreeSurfaceRow<TNode>;
6
32
  /** Top within the widget, px. While being pushed out it slides UP, behind the row above. */
@@ -13,10 +39,10 @@ export interface StickyTreeState<TNode> {
13
39
  }
14
40
  /**
15
41
  * The sticky stack for a scroll position: which ancestors are pinned, and where
16
- * each sits inside the widget.
42
+ * each sits inside the widget. `scrollTop` is in content space.
17
43
  */
18
44
  export declare function computeStickyTreeState<TNode>(params: {
19
- rows: readonly TreeSurfaceRow<TNode>[];
45
+ rows: TreeRowSource<TreeSurfaceRow<TNode>>;
20
46
  scrollTop: number;
21
47
  rowHeight: number;
22
48
  viewportHeight: number;
@@ -28,6 +54,7 @@ export declare function computeStickyTreeState<TNode>(params: {
28
54
  *
29
55
  * Derived from the TARGET's ancestors, not from the widget currently on screen:
30
56
  * scrolling to a row is what CHANGES the widget, so measuring the old one aims
31
- * at where the stack used to be.
57
+ * at where the stack used to be. The walk stops at `maxCount` ancestors — no
58
+ * more than that can pin.
32
59
  */
33
- export declare function stickyInsetForIndex<TNode>(rows: readonly TreeSurfaceRow<TNode>[], index: number, rowHeight: number, maxCount: number): number;
60
+ export declare function stickyInsetForIndex<TNode>(rows: TreeRowSource<TreeSurfaceRow<TNode>>, index: number, rowHeight: number, maxCount: number): number;