@vokril/ui-solid 0.19.0 → 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.
- package/CHANGELOG.md +14 -0
- package/README.md +38 -2
- package/dist/createResizableSidebar-A0F4JmSU.js +472 -0
- package/dist/createResizableSidebar-DwCuRuho.cjs +1 -0
- package/dist/createVirtualWindow-9T5ZJCQR.cjs +1 -0
- package/dist/createVirtualWindow-Dqm5jxZa.js +117 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +108 -104
- package/dist/layout/createVirtualScroller.d.cts +8 -31
- package/dist/layout/createVirtualScroller.d.ts +8 -31
- package/dist/layout/createVirtualWindow.d.cts +64 -0
- package/dist/layout/createVirtualWindow.d.ts +64 -0
- package/dist/layout/index.cjs +1 -1
- package/dist/layout/index.d.cts +2 -0
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.js +7 -6
- package/dist/layout/virtualScrollerUtils.d.cts +58 -22
- package/dist/layout/virtualScrollerUtils.d.ts +58 -22
- package/dist/rowSource-BnUQ-LKT.cjs +1 -0
- package/dist/rowSource-CLEYuC95.js +1236 -0
- package/dist/server/createResizableSidebar-CZ0IGNm8.js +310 -0
- package/dist/server/createResizableSidebar-DDniLGSD.cjs +1 -0
- package/dist/server/createVirtualWindow-9T5ZJCQR.cjs +1 -0
- package/dist/server/createVirtualWindow-Dqm5jxZa.js +117 -0
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +110 -106
- package/dist/server/layout/index.cjs +1 -1
- package/dist/server/layout/index.js +7 -6
- package/dist/server/rowSource-CdvoDIN7.cjs +1 -0
- package/dist/server/rowSource-D7lSI6LT.js +1122 -0
- package/dist/server/tree/index.cjs +1 -1
- package/dist/server/tree/index.js +11 -8
- package/dist/solid/layout/createVirtualScroller.js +17 -100
- package/dist/solid/layout/createVirtualWindow.js +129 -0
- package/dist/solid/layout/index.js +1 -0
- package/dist/solid/layout/virtualScrollerUtils.js +31 -32
- package/dist/solid/tree/TreeSurface.jsx +20 -13
- package/dist/solid/tree/createTreeController.js +110 -62
- package/dist/solid/tree/createTreeSurface.js +29 -12
- package/dist/solid/tree/index.js +1 -0
- package/dist/solid/tree/rowSource.js +93 -0
- package/dist/solid/tree/selectAllInScope.js +31 -25
- package/dist/solid/tree/stickyScroll.js +12 -10
- package/dist/solid/tree/treeAria.js +11 -30
- package/dist/solid/tree/treeKeymap.js +2 -24
- package/dist/solid/tree/viewportAnchor.js +23 -0
- package/dist/style.css +1 -1
- package/dist/tree/TreeStickyHeader.d.cts +1 -1
- package/dist/tree/TreeStickyHeader.d.ts +1 -1
- package/dist/tree/TreeSurface.d.cts +1 -1
- package/dist/tree/TreeSurface.d.ts +1 -1
- package/dist/tree/createTreeController.d.cts +19 -8
- package/dist/tree/createTreeController.d.ts +19 -8
- package/dist/tree/createTreeSurface.d.cts +8 -3
- package/dist/tree/createTreeSurface.d.ts +8 -3
- package/dist/tree/descriptor.d.cts +8 -9
- package/dist/tree/descriptor.d.ts +8 -9
- package/dist/tree/index.cjs +1 -1
- package/dist/tree/index.d.cts +1 -0
- package/dist/tree/index.d.ts +1 -0
- package/dist/tree/index.js +11 -8
- package/dist/tree/rowSource.d.cts +41 -0
- package/dist/tree/rowSource.d.ts +41 -0
- package/dist/tree/selectAllInScope.d.cts +20 -2
- package/dist/tree/selectAllInScope.d.ts +20 -2
- package/dist/tree/stickyScroll.d.cts +32 -5
- package/dist/tree/stickyScroll.d.ts +32 -5
- package/dist/tree/treeAria.d.cts +26 -10
- package/dist/tree/treeAria.d.ts +26 -10
- package/dist/tree/treeKeymap.d.cts +2 -16
- package/dist/tree/treeKeymap.d.ts +2 -16
- package/dist/tree/viewportAnchor.d.cts +21 -0
- package/dist/tree/viewportAnchor.d.ts +21 -0
- package/dist/ui.css +1 -1
- package/package.json +1 -1
- package/dist/createResizableSidebar-Dau7TIuH.cjs +0 -1
- package/dist/createResizableSidebar-gvf9me4K.js +0 -449
- package/dist/createVirtualScroller-CL49JE2P.cjs +0 -1
- package/dist/createVirtualScroller-vu-l4rVv.js +0 -93
- package/dist/descriptor-CaHgh9N_.cjs +0 -1
- package/dist/descriptor-eGtcBtpI.js +0 -1106
- package/dist/server/createResizableSidebar-BQG5elmd.js +0 -287
- package/dist/server/createResizableSidebar-tU8FO2MK.cjs +0 -1
- package/dist/server/createVirtualScroller-CL49JE2P.cjs +0 -1
- package/dist/server/createVirtualScroller-vu-l4rVv.js +0 -93
- package/dist/server/descriptor-CEGvvJZh.cjs +0 -1
- package/dist/server/descriptor-GLoKPx6x.js +0 -992
package/dist/tree/treeAria.d.cts
CHANGED
|
@@ -15,7 +15,14 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Note there is no `role=group`: a virtualized tree has no DOM nesting to hang
|
|
17
17
|
* it on. `aria-level` carries the depth instead, exactly as the reference editor does it.
|
|
18
|
+
*
|
|
19
|
+
* A row's attributes come in two parts that change for different reasons. Its
|
|
20
|
+
* STRUCTURE (role, id, level, position among its siblings, expanded, busy) changes
|
|
21
|
+
* only with the rows; its STATE (the tab stop, `aria-selected`) changes with every
|
|
22
|
+
* cursor move. They are built apart so a cursor move recomputes the two rows it
|
|
23
|
+
* left and entered, and nothing structural.
|
|
18
24
|
*/
|
|
25
|
+
import type { TreeRowSource } from './rowSource.cjs';
|
|
19
26
|
import type { TreeRow } from './types.cjs';
|
|
20
27
|
export type TreeFocusMode = 'roving-tabindex' | 'active-descendant';
|
|
21
28
|
export interface TreeContainerAriaProps {
|
|
@@ -25,17 +32,20 @@ export interface TreeContainerAriaProps {
|
|
|
25
32
|
'aria-multiselectable': boolean | undefined;
|
|
26
33
|
'aria-activedescendant': string | undefined;
|
|
27
34
|
}
|
|
28
|
-
|
|
35
|
+
/** The attributes that change only with the rows. */
|
|
36
|
+
export interface TreeRowStructureAria {
|
|
29
37
|
role: 'treeitem' | 'option';
|
|
30
38
|
id: string;
|
|
31
|
-
tabIndex: number;
|
|
32
39
|
'aria-level': number | undefined;
|
|
33
40
|
'aria-setsize': number;
|
|
34
41
|
'aria-posinset': number;
|
|
35
|
-
'aria-selected': boolean;
|
|
36
42
|
'aria-expanded': boolean | undefined;
|
|
37
43
|
'aria-busy': boolean | undefined;
|
|
38
44
|
}
|
|
45
|
+
export interface TreeRowAriaProps extends TreeRowStructureAria {
|
|
46
|
+
tabIndex: number;
|
|
47
|
+
'aria-selected': boolean;
|
|
48
|
+
}
|
|
39
49
|
export declare function treeRowDomId(treeId: string, key: string): string;
|
|
40
50
|
/**
|
|
41
51
|
* A flat surface is announced as a LISTBOX, not a tree. Telling a screen reader
|
|
@@ -52,17 +62,23 @@ export declare function buildTreeContainerAria(params: {
|
|
|
52
62
|
flat?: boolean;
|
|
53
63
|
}): TreeContainerAriaProps;
|
|
54
64
|
/**
|
|
55
|
-
* `aria-setsize` / `aria-posinset`
|
|
56
|
-
*
|
|
57
|
-
* 3 of 400 visible rows. Screen readers read this aloud; getting
|
|
58
|
-
* worse than omitting it.
|
|
65
|
+
* The structural attributes of row `index`. `aria-setsize` / `aria-posinset`
|
|
66
|
+
* count the SIBLINGS, not the whole flat list — "3 of 7" must mean 3 of 7
|
|
67
|
+
* children, not 3 of 400 visible rows. Screen readers read this aloud; getting
|
|
68
|
+
* it wrong is worse than omitting it. The source answers it in one lookup
|
|
69
|
+
* (`siblingPosition`): a root row of a list of a million announces its place
|
|
70
|
+
* without anyone counting the other 999,999.
|
|
59
71
|
*/
|
|
60
|
-
export declare function
|
|
72
|
+
export declare function buildTreeRowStructureAria(params: {
|
|
61
73
|
treeId: string;
|
|
62
|
-
rows:
|
|
74
|
+
rows: TreeRowSource<TreeRow>;
|
|
63
75
|
index: number;
|
|
76
|
+
flat?: boolean;
|
|
77
|
+
}): TreeRowStructureAria;
|
|
78
|
+
/** A row's full attribute set: its structure plus the cursor and selection state. */
|
|
79
|
+
export declare function buildTreeRowAria(params: {
|
|
80
|
+
structure: TreeRowStructureAria;
|
|
64
81
|
focusMode: TreeFocusMode;
|
|
65
82
|
isCursor: boolean;
|
|
66
83
|
isSelected: boolean;
|
|
67
|
-
flat?: boolean;
|
|
68
84
|
}): TreeRowAriaProps;
|
package/dist/tree/treeAria.d.ts
CHANGED
|
@@ -15,7 +15,14 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Note there is no `role=group`: a virtualized tree has no DOM nesting to hang
|
|
17
17
|
* it on. `aria-level` carries the depth instead, exactly as the reference editor does it.
|
|
18
|
+
*
|
|
19
|
+
* A row's attributes come in two parts that change for different reasons. Its
|
|
20
|
+
* STRUCTURE (role, id, level, position among its siblings, expanded, busy) changes
|
|
21
|
+
* only with the rows; its STATE (the tab stop, `aria-selected`) changes with every
|
|
22
|
+
* cursor move. They are built apart so a cursor move recomputes the two rows it
|
|
23
|
+
* left and entered, and nothing structural.
|
|
18
24
|
*/
|
|
25
|
+
import type { TreeRowSource } from './rowSource.js';
|
|
19
26
|
import type { TreeRow } from './types.js';
|
|
20
27
|
export type TreeFocusMode = 'roving-tabindex' | 'active-descendant';
|
|
21
28
|
export interface TreeContainerAriaProps {
|
|
@@ -25,17 +32,20 @@ export interface TreeContainerAriaProps {
|
|
|
25
32
|
'aria-multiselectable': boolean | undefined;
|
|
26
33
|
'aria-activedescendant': string | undefined;
|
|
27
34
|
}
|
|
28
|
-
|
|
35
|
+
/** The attributes that change only with the rows. */
|
|
36
|
+
export interface TreeRowStructureAria {
|
|
29
37
|
role: 'treeitem' | 'option';
|
|
30
38
|
id: string;
|
|
31
|
-
tabIndex: number;
|
|
32
39
|
'aria-level': number | undefined;
|
|
33
40
|
'aria-setsize': number;
|
|
34
41
|
'aria-posinset': number;
|
|
35
|
-
'aria-selected': boolean;
|
|
36
42
|
'aria-expanded': boolean | undefined;
|
|
37
43
|
'aria-busy': boolean | undefined;
|
|
38
44
|
}
|
|
45
|
+
export interface TreeRowAriaProps extends TreeRowStructureAria {
|
|
46
|
+
tabIndex: number;
|
|
47
|
+
'aria-selected': boolean;
|
|
48
|
+
}
|
|
39
49
|
export declare function treeRowDomId(treeId: string, key: string): string;
|
|
40
50
|
/**
|
|
41
51
|
* A flat surface is announced as a LISTBOX, not a tree. Telling a screen reader
|
|
@@ -52,17 +62,23 @@ export declare function buildTreeContainerAria(params: {
|
|
|
52
62
|
flat?: boolean;
|
|
53
63
|
}): TreeContainerAriaProps;
|
|
54
64
|
/**
|
|
55
|
-
* `aria-setsize` / `aria-posinset`
|
|
56
|
-
*
|
|
57
|
-
* 3 of 400 visible rows. Screen readers read this aloud; getting
|
|
58
|
-
* worse than omitting it.
|
|
65
|
+
* The structural attributes of row `index`. `aria-setsize` / `aria-posinset`
|
|
66
|
+
* count the SIBLINGS, not the whole flat list — "3 of 7" must mean 3 of 7
|
|
67
|
+
* children, not 3 of 400 visible rows. Screen readers read this aloud; getting
|
|
68
|
+
* it wrong is worse than omitting it. The source answers it in one lookup
|
|
69
|
+
* (`siblingPosition`): a root row of a list of a million announces its place
|
|
70
|
+
* without anyone counting the other 999,999.
|
|
59
71
|
*/
|
|
60
|
-
export declare function
|
|
72
|
+
export declare function buildTreeRowStructureAria(params: {
|
|
61
73
|
treeId: string;
|
|
62
|
-
rows:
|
|
74
|
+
rows: TreeRowSource<TreeRow>;
|
|
63
75
|
index: number;
|
|
76
|
+
flat?: boolean;
|
|
77
|
+
}): TreeRowStructureAria;
|
|
78
|
+
/** A row's full attribute set: its structure plus the cursor and selection state. */
|
|
79
|
+
export declare function buildTreeRowAria(params: {
|
|
80
|
+
structure: TreeRowStructureAria;
|
|
64
81
|
focusMode: TreeFocusMode;
|
|
65
82
|
isCursor: boolean;
|
|
66
83
|
isSelected: boolean;
|
|
67
|
-
flat?: boolean;
|
|
68
84
|
}): TreeRowAriaProps;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* DOM, a store, or a surface.
|
|
19
19
|
*/
|
|
20
20
|
import type { TreeCapabilities, TreeRow } from './types.cjs';
|
|
21
|
+
import type { TreeRowSource } from './rowSource.cjs';
|
|
21
22
|
/** Rows a PageUp/PageDown travels. */
|
|
22
23
|
export declare const TREE_PAGE_SIZE = 10;
|
|
23
24
|
export type TreeIntent =
|
|
@@ -72,21 +73,6 @@ export interface TreeKeyContext {
|
|
|
72
73
|
capabilities: TreeCapabilities;
|
|
73
74
|
}
|
|
74
75
|
export declare function resolveTreeIntent(event: KeyboardEvent, ctx: TreeKeyContext): TreeIntent | null;
|
|
75
|
-
/**
|
|
76
|
-
* The parent of `index`: the nearest preceding row with a smaller depth.
|
|
77
|
-
* Returns -1 for a root row.
|
|
78
|
-
*/
|
|
79
|
-
export declare function findParentIndex(rows: readonly Pick<TreeRow, 'depth'>[], index: number): number;
|
|
80
|
-
/**
|
|
81
|
-
* The contiguous run of DESCENDANT rows of `index` — every following row with a
|
|
82
|
-
* greater depth, stopping at the first row back at `index`'s depth or shallower.
|
|
83
|
-
* Returns `null` when the row has no children (the next row is not deeper).
|
|
84
|
-
* Mirror of {@link findParentIndex}; drives "Select All Child Objects".
|
|
85
|
-
*/
|
|
86
|
-
export declare function findChildRange(rows: readonly Pick<TreeRow, 'depth'>[], index: number): {
|
|
87
|
-
start: number;
|
|
88
|
-
end: number;
|
|
89
|
-
} | null;
|
|
90
76
|
/**
|
|
91
77
|
* Next row whose label starts with `needle`, searching forward from `from` and
|
|
92
78
|
* wrapping once. Type-ahead is the one place wrapping is right: you are
|
|
@@ -98,4 +84,4 @@ export declare function findChildRange(rows: readonly Pick<TreeRow, 'depth'>[],
|
|
|
98
84
|
* match the row you are already standing on, or typing `s` then `c` would skip
|
|
99
85
|
* past `scripts/` to the row after it — the classic type-ahead bug.
|
|
100
86
|
*/
|
|
101
|
-
export declare function findTypeAheadIndex(rows:
|
|
87
|
+
export declare function findTypeAheadIndex(rows: TreeRowSource<TreeRow>, from: number, needle: string, includeCurrent?: boolean): number;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* DOM, a store, or a surface.
|
|
19
19
|
*/
|
|
20
20
|
import type { TreeCapabilities, TreeRow } from './types.js';
|
|
21
|
+
import type { TreeRowSource } from './rowSource.js';
|
|
21
22
|
/** Rows a PageUp/PageDown travels. */
|
|
22
23
|
export declare const TREE_PAGE_SIZE = 10;
|
|
23
24
|
export type TreeIntent =
|
|
@@ -72,21 +73,6 @@ export interface TreeKeyContext {
|
|
|
72
73
|
capabilities: TreeCapabilities;
|
|
73
74
|
}
|
|
74
75
|
export declare function resolveTreeIntent(event: KeyboardEvent, ctx: TreeKeyContext): TreeIntent | null;
|
|
75
|
-
/**
|
|
76
|
-
* The parent of `index`: the nearest preceding row with a smaller depth.
|
|
77
|
-
* Returns -1 for a root row.
|
|
78
|
-
*/
|
|
79
|
-
export declare function findParentIndex(rows: readonly Pick<TreeRow, 'depth'>[], index: number): number;
|
|
80
|
-
/**
|
|
81
|
-
* The contiguous run of DESCENDANT rows of `index` — every following row with a
|
|
82
|
-
* greater depth, stopping at the first row back at `index`'s depth or shallower.
|
|
83
|
-
* Returns `null` when the row has no children (the next row is not deeper).
|
|
84
|
-
* Mirror of {@link findParentIndex}; drives "Select All Child Objects".
|
|
85
|
-
*/
|
|
86
|
-
export declare function findChildRange(rows: readonly Pick<TreeRow, 'depth'>[], index: number): {
|
|
87
|
-
start: number;
|
|
88
|
-
end: number;
|
|
89
|
-
} | null;
|
|
90
76
|
/**
|
|
91
77
|
* Next row whose label starts with `needle`, searching forward from `from` and
|
|
92
78
|
* wrapping once. Type-ahead is the one place wrapping is right: you are
|
|
@@ -98,4 +84,4 @@ export declare function findChildRange(rows: readonly Pick<TreeRow, 'depth'>[],
|
|
|
98
84
|
* match the row you are already standing on, or typing `s` then `c` would skip
|
|
99
85
|
* past `scripts/` to the row after it — the classic type-ahead bug.
|
|
100
86
|
*/
|
|
101
|
-
export declare function findTypeAheadIndex(rows:
|
|
87
|
+
export declare function findTypeAheadIndex(rows: TreeRowSource<TreeRow>, from: number, needle: string, includeCurrent?: boolean): number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TreeRowShape, TreeRowSource } from './rowSource.cjs';
|
|
2
|
+
export interface ViewportAnchor {
|
|
3
|
+
/** The first visible row. */
|
|
4
|
+
readonly key: string;
|
|
5
|
+
/** How far into that row the viewport starts, px. */
|
|
6
|
+
readonly offset: number;
|
|
7
|
+
/** The content scroll position the anchor was taken at. */
|
|
8
|
+
readonly contentTop: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The anchor for a scroll position. At the very top there is none: rows that
|
|
12
|
+
* arrive there should be seen, not scrolled away.
|
|
13
|
+
*/
|
|
14
|
+
export declare function viewportAnchorAt(rows: TreeRowSource<TreeRowShape>, contentTop: number, rowHeight: number): ViewportAnchor | null;
|
|
15
|
+
/**
|
|
16
|
+
* Where to scroll so the anchor row keeps its place in `rows`, or `null` to leave
|
|
17
|
+
* the scroll position alone: the row is gone, it did not move, or the scroll
|
|
18
|
+
* position changed since the anchor was taken — a caller that scrolled in the
|
|
19
|
+
* same turn (a reveal) meant it, and wins.
|
|
20
|
+
*/
|
|
21
|
+
export declare function anchoredContentTop(rows: TreeRowSource<TreeRowShape>, anchor: ViewportAnchor | null, currentTop: number, rowHeight: number): number | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TreeRowShape, TreeRowSource } from './rowSource.js';
|
|
2
|
+
export interface ViewportAnchor {
|
|
3
|
+
/** The first visible row. */
|
|
4
|
+
readonly key: string;
|
|
5
|
+
/** How far into that row the viewport starts, px. */
|
|
6
|
+
readonly offset: number;
|
|
7
|
+
/** The content scroll position the anchor was taken at. */
|
|
8
|
+
readonly contentTop: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The anchor for a scroll position. At the very top there is none: rows that
|
|
12
|
+
* arrive there should be seen, not scrolled away.
|
|
13
|
+
*/
|
|
14
|
+
export declare function viewportAnchorAt(rows: TreeRowSource<TreeRowShape>, contentTop: number, rowHeight: number): ViewportAnchor | null;
|
|
15
|
+
/**
|
|
16
|
+
* Where to scroll so the anchor row keeps its place in `rows`, or `null` to leave
|
|
17
|
+
* the scroll position alone: the row is gone, it did not move, or the scroll
|
|
18
|
+
* position changed since the anchor was taken — a caller that scrolled in the
|
|
19
|
+
* same turn (a reveal) meant it, and wins.
|
|
20
|
+
*/
|
|
21
|
+
export declare function anchoredContentTop(rows: TreeRowSource<TreeRowShape>, anchor: ViewportAnchor | null, currentTop: number, rowHeight: number): number | null;
|