vlist 3.0.0-next.2 → 3.0.0-next.3
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/README.github.md +85 -38
- package/README.md +44 -27
- package/dist/config.d.ts +102 -10
- package/dist/config.js +1 -1
- package/dist/core/create.d.ts +22 -4
- package/dist/core/dom.d.ts +1 -1
- package/dist/core/hooks.d.ts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/pipeline.d.ts +1 -1
- package/dist/core/pool.d.ts +1 -1
- package/dist/core/runway.d.ts +6 -2
- package/dist/core/scroll.d.ts +1 -1
- package/dist/core/sizes.d.ts +1 -1
- package/dist/core/state.d.ts +13 -1
- package/dist/core/types.d.ts +133 -61
- package/dist/core/velocity.d.ts +1 -1
- package/dist/index.d.ts +17 -2
- package/dist/index.js +1 -1
- package/dist/internals.d.ts +0 -1
- package/dist/internals.js +1 -1
- package/dist/plugins/a11y/index.d.ts +1 -0
- package/dist/plugins/a11y/plugin.d.ts +1 -1
- package/dist/plugins/autosize/index.d.ts +2 -1
- package/dist/plugins/autosize/plugin.d.ts +13 -2
- package/dist/plugins/carousel/engine.d.ts +1 -1
- package/dist/plugins/carousel/index.d.ts +1 -0
- package/dist/plugins/carousel/plugin.d.ts +30 -2
- package/dist/plugins/carousel/presets.d.ts +1 -1
- package/dist/plugins/data/index.d.ts +1 -0
- package/dist/plugins/data/plugin.d.ts +15 -2
- package/dist/plugins/grid/index.d.ts +2 -1
- package/dist/plugins/grid/plugin.d.ts +14 -2
- package/dist/plugins/groups/index.d.ts +1 -0
- package/dist/plugins/groups/plugin.d.ts +11 -3
- package/dist/plugins/groups/types.d.ts +6 -1
- package/dist/plugins/masonry/index.d.ts +2 -1
- package/dist/plugins/masonry/plugin.d.ts +10 -2
- package/dist/plugins/masonry/renderer.d.ts +5 -1
- package/dist/plugins/page/plugin.d.ts +1 -1
- package/dist/plugins/scrollbar/index.d.ts +2 -1
- package/dist/plugins/scrollbar/plugin.d.ts +7 -2
- package/dist/plugins/search/index.d.ts +1 -0
- package/dist/plugins/search/plugin.d.ts +26 -1
- package/dist/plugins/selection/index.d.ts +2 -1
- package/dist/plugins/selection/plugin.d.ts +23 -2
- package/dist/plugins/snapshots/index.d.ts +1 -0
- package/dist/plugins/snapshots/plugin.d.ts +9 -2
- package/dist/plugins/sortable/index.d.ts +1 -0
- package/dist/plugins/sortable/plugin.d.ts +11 -3
- package/dist/plugins/table/index.d.ts +1 -0
- package/dist/plugins/table/plugin.d.ts +19 -3
- package/dist/plugins/transition/plugin.d.ts +1 -1
- package/dist/plugins/tree/index.d.ts +1 -0
- package/dist/plugins/tree/layout.d.ts +1 -1
- package/dist/plugins/tree/plugin.d.ts +37 -3
- package/dist/plugins/tree/types.d.ts +1 -1
- package/dist/rendering/sizes.d.ts +7 -1
- package/dist/size.json +1 -1
- package/dist/synthetic.d.ts +2 -2
- package/dist/synthetic.js +1 -1
- package/dist/types.d.ts +12 -19
- package/dist/utils/scroll-padding.d.ts +36 -0
- package/dist/utils/stats.d.ts +9 -1
- package/dist/vlist.css +1 -1
- package/package.json +6 -2
- package/dist/plugins/grid/renderer.d.ts +0 -68
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Phase 2 (server-side search via `data()`, column-aware, fuzzy, query syntax)
|
|
14
14
|
* is out of scope here.
|
|
15
|
+
*
|
|
16
|
+
* Restrictions:
|
|
17
|
+
* - Cannot be combined with `data()`. Filtering is client-side over the items
|
|
18
|
+
* the list holds, and with an adapter those are only the loaded window.
|
|
19
|
+
* Query the remote dataset through the adapter instead.
|
|
20
|
+
* - Cannot be combined with `tree()`. Filtering a tree means preserving the
|
|
21
|
+
* ancestors of each match, which belongs to the plugin that owns the layout;
|
|
22
|
+
* `tree()` provides no such hook.
|
|
15
23
|
*/
|
|
16
24
|
import type { VListItem } from "../../types";
|
|
17
25
|
import type { VListPlugin } from "../../core/types";
|
|
@@ -78,7 +86,24 @@ export interface SearchPluginConfig<T extends VListItem = VListItem> {
|
|
|
78
86
|
/** Consumer-supplied UI text / localization. Falls back to {@link DEFAULT_SEARCH_TEXT}. */
|
|
79
87
|
text?: SearchText;
|
|
80
88
|
}
|
|
81
|
-
|
|
89
|
+
/** Methods the search plugin adds to the list instance. */
|
|
90
|
+
export interface SearchMethods {
|
|
91
|
+
/** Show the search bar. */
|
|
92
|
+
openSearch(): void;
|
|
93
|
+
/** Hide the search bar and clear the query. */
|
|
94
|
+
closeSearch(): void;
|
|
95
|
+
/** Set the query, opening the bar when needed. */
|
|
96
|
+
setQuery(query: string): void;
|
|
97
|
+
/** The current query. */
|
|
98
|
+
getQuery(): string;
|
|
99
|
+
/** Move to the next match. */
|
|
100
|
+
nextMatch(): void;
|
|
101
|
+
/** Move to the previous match. */
|
|
102
|
+
prevMatch(): void;
|
|
103
|
+
/** Indices of the matching items. */
|
|
104
|
+
getMatches(): number[];
|
|
105
|
+
}
|
|
106
|
+
export interface SearchPluginInstance<T extends VListItem = VListItem> extends VListPlugin<T, SearchMethods> {
|
|
82
107
|
}
|
|
83
108
|
export declare function search<T extends VListItem = VListItem>(config?: SearchPluginConfig<T>): SearchPluginInstance<T>;
|
|
84
109
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist
|
|
2
|
+
* vlist — Selection Plugin
|
|
3
3
|
*/
|
|
4
4
|
export { selection, type SelectionPluginConfig } from "./plugin";
|
|
5
5
|
export { createSelectionState, selectOne, toggleOne, selectRange, selectRangeMut, selectAllItems, moveFocus, getSelectedArray, getSelectedItems, getSelectedItemsMut, type SelectionState, selectItems, deselectItems, toggleSelection, selectAll, clearSelection, isSelected, getSelectedIds, getSelectionCount, isSelectionEmpty, selectFocused, moveFocusUp, moveFocusDown, moveFocusToFirst, moveFocusToLast, moveFocusByPage, claimPlaceholderSelection, setFocusedIndex, } from "./state";
|
|
6
|
+
export type { SelectionMethods } from "./plugin";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist
|
|
2
|
+
* vlist — Selection Plugin
|
|
3
3
|
*
|
|
4
4
|
* Manages selection state, click/keyboard handlers, ARIA attributes.
|
|
5
5
|
* Adapted from v1 withSelection feature + a11y.ts to the v2 plugin interface.
|
|
@@ -19,5 +19,26 @@ export interface SelectionPluginConfig {
|
|
|
19
19
|
*/
|
|
20
20
|
keyboard?: boolean;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
/** Methods the selection plugin adds to the list instance. */
|
|
23
|
+
export interface SelectionMethods<T extends VListItem = VListItem> {
|
|
24
|
+
/** Select one or more items by id. */
|
|
25
|
+
select(...ids: Array<string | number>): void;
|
|
26
|
+
/** Deselect one or more items by id. */
|
|
27
|
+
deselect(...ids: Array<string | number>): void;
|
|
28
|
+
/** Toggle one item by id. */
|
|
29
|
+
toggleSelect(id: string | number): void;
|
|
30
|
+
/** Select every item (multiple mode only). */
|
|
31
|
+
selectAll(): void;
|
|
32
|
+
/** Clear the selection. */
|
|
33
|
+
clearSelection(): void;
|
|
34
|
+
/** Ids of the selected items. */
|
|
35
|
+
getSelected(): Array<string | number>;
|
|
36
|
+
/** The selected items. */
|
|
37
|
+
getSelectedItems(): T[];
|
|
38
|
+
/** Move the selection to the next item. */
|
|
39
|
+
selectNext(): void;
|
|
40
|
+
/** Move the selection to the previous item. */
|
|
41
|
+
selectPrevious(): void;
|
|
42
|
+
}
|
|
43
|
+
export declare function selection<T extends VListItem = VListItem>(config?: SelectionPluginConfig): VListPlugin<T, SelectionMethods<T>>;
|
|
23
44
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist
|
|
2
|
+
* vlist — Snapshots Plugin
|
|
3
3
|
*
|
|
4
4
|
* Scroll save/restore for SPA navigation and tab switching.
|
|
5
5
|
* Captures the first visible item index + sub-pixel offset,
|
|
@@ -13,5 +13,12 @@ export interface SnapshotsPluginConfig {
|
|
|
13
13
|
restore?: ScrollSnapshot;
|
|
14
14
|
autoSave?: string;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
/** Methods the snapshots plugin adds to the list instance. */
|
|
17
|
+
export interface SnapshotsMethods {
|
|
18
|
+
/** Capture the scroll position, anchor item and selection. */
|
|
19
|
+
getScrollSnapshot(): ScrollSnapshot;
|
|
20
|
+
/** Restore a snapshot; pass false to keep the current selection. */
|
|
21
|
+
restoreScroll(snapshot: ScrollSnapshot, restoreSelection?: boolean): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export declare function snapshots<T extends VListItem = VListItem>(config?: SnapshotsPluginConfig): VListPlugin<T, SnapshotsMethods>;
|
|
17
24
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist
|
|
2
|
+
* vlist — Sortable Plugin
|
|
3
3
|
*
|
|
4
4
|
* Drag-and-drop reordering for virtual lists.
|
|
5
5
|
* Priority 30 — runs after layout plugins and scrollbar, before selection.
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* The consumer reorders their data and calls `setItems()`.
|
|
18
18
|
*
|
|
19
19
|
* Restrictions:
|
|
20
|
-
* - Cannot be combined with grid, masonry, table
|
|
20
|
+
* - Cannot be combined with the grid, masonry, table or tree plugins
|
|
21
21
|
*/
|
|
22
22
|
import type { VListItem } from "../../types";
|
|
23
23
|
import type { VListPlugin } from "../../core/types";
|
|
@@ -28,7 +28,15 @@ export interface SortablePluginConfig {
|
|
|
28
28
|
edgeScrollZone?: number;
|
|
29
29
|
edgeScrollSpeed?: number;
|
|
30
30
|
dragThreshold?: number;
|
|
31
|
+
/** Touch/pen hold delay without a handle, in milliseconds (default 350).
|
|
32
|
+
* Moving dragThreshold pixels before this expires yields to scrolling. */
|
|
33
|
+
touchDelay?: number;
|
|
31
34
|
ghostContainer?: HTMLElement;
|
|
32
35
|
}
|
|
33
|
-
|
|
36
|
+
/** Methods the sortable plugin adds to the list instance. */
|
|
37
|
+
export interface SortableMethods {
|
|
38
|
+
/** Whether a drag or keyboard sort is in progress. */
|
|
39
|
+
isSorting(): boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function sortable<T extends VListItem = VListItem>(config?: SortablePluginConfig): VListPlugin<T, SortableMethods>;
|
|
34
42
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -7,4 +7,5 @@ export { createTableLayout } from "./layout";
|
|
|
7
7
|
export { createTableHeader } from "./header";
|
|
8
8
|
export { createTableRenderer, type TableRendererInstance } from "./renderer";
|
|
9
9
|
export type { TableConfig, TableColumn, TableFillMode, TableLayout, TableHeader, TableRenderer, ResolvedColumn, ColumnResizeEvent, ColumnSortEvent, ColumnClickEvent, } from "./types";
|
|
10
|
+
export type { TableMethods } from "./plugin";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist
|
|
2
|
+
* vlist — Table Plugin
|
|
3
3
|
*
|
|
4
4
|
* Switches from list layout to a data table with columns, resizable headers,
|
|
5
5
|
* sticky header row, and cell-based rendering.
|
|
@@ -13,8 +13,24 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { VListItem } from "../../types";
|
|
15
15
|
import type { VListPlugin } from "../../core/types";
|
|
16
|
-
import type { TableConfig } from "./types";
|
|
16
|
+
import type { TableConfig, TableColumn } from "./types";
|
|
17
17
|
export interface TablePluginConfig<T extends VListItem = VListItem> extends TableConfig<T> {
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
/** Methods the table plugin adds to the list instance. */
|
|
20
|
+
export interface TableMethods<T extends VListItem = VListItem> {
|
|
21
|
+
/** Replace the column definitions. */
|
|
22
|
+
updateColumns(columns: TableColumn<T>[]): void;
|
|
23
|
+
/** Resize one column by key or index. */
|
|
24
|
+
resizeColumn(keyOrIndex: string | number, width: number): void;
|
|
25
|
+
/** Current width of every column, by key. */
|
|
26
|
+
getColumnWidths(): Record<string, number>;
|
|
27
|
+
/** Set the sort column and direction. */
|
|
28
|
+
setSort(key: string | null, direction?: "asc" | "desc"): void;
|
|
29
|
+
/** Current sort column and direction. */
|
|
30
|
+
getSort(): {
|
|
31
|
+
key: string | null;
|
|
32
|
+
direction: "asc" | "desc";
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare function table<T extends VListItem = VListItem>(config: TablePluginConfig<T>): VListPlugin<T, TableMethods<T>>;
|
|
20
36
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vlist
|
|
2
|
+
* vlist — Tree Plugin
|
|
3
3
|
*
|
|
4
4
|
* Renders hierarchical data as a virtualized, collapsible tree view with
|
|
5
5
|
* WAI-ARIA treeview keyboard navigation. Owns the tree→flat conversion
|
|
@@ -10,9 +10,43 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Replaces the render pipeline (like groups/grid/table) to maintain full
|
|
12
12
|
* control over tree-specific ARIA, CSS classes, indent, and expand/collapse.
|
|
13
|
+
*
|
|
14
|
+
* Restrictions:
|
|
15
|
+
* - Cannot be combined with `groups()`, `grid()`, `masonry()` or `table()`:
|
|
16
|
+
* each of those owns the layout, and so does this one.
|
|
17
|
+
* - Cannot be combined with `data()`, which claims the same data-access hooks
|
|
18
|
+
* and would replace them. Use `loadChildren` for async tree data.
|
|
13
19
|
*/
|
|
14
20
|
import type { VListItem } from "../../types";
|
|
15
21
|
import type { VListPlugin } from "../../core/types";
|
|
16
|
-
import type { TreePluginConfig } from "./types";
|
|
17
|
-
|
|
22
|
+
import type { TreePluginConfig, FlatNode } from "./types";
|
|
23
|
+
/** Methods the tree plugin adds to the list instance. */
|
|
24
|
+
export interface TreeMethods<T extends VListItem = VListItem> {
|
|
25
|
+
/** Expand one node. */
|
|
26
|
+
expand(id: string | number): void;
|
|
27
|
+
/** Collapse one node. */
|
|
28
|
+
collapse(id: string | number): void;
|
|
29
|
+
/** Toggle one node. */
|
|
30
|
+
toggle(id: string | number): void;
|
|
31
|
+
/** Expand every node. */
|
|
32
|
+
expandAll(): void;
|
|
33
|
+
/** Collapse every node. */
|
|
34
|
+
collapseAll(): void;
|
|
35
|
+
/** Expand every ancestor of a node so it becomes visible. */
|
|
36
|
+
expandTo(id: string | number): void;
|
|
37
|
+
/** Ids of the expanded nodes. */
|
|
38
|
+
getExpanded(): (string | number)[];
|
|
39
|
+
/** Whether a node is expanded. */
|
|
40
|
+
isExpanded(id: string | number): boolean;
|
|
41
|
+
/** Add a child under a parent, or at the root when parentId is null. */
|
|
42
|
+
addChild(parentId: string | number | null, item: T, index?: number): void;
|
|
43
|
+
/** Move a node under a new parent. */
|
|
44
|
+
moveNode(id: string | number, newParentId: string | number | null, index?: number): void;
|
|
45
|
+
/** Visible node count and the flattened nodes. */
|
|
46
|
+
getTreeLayout(): {
|
|
47
|
+
totalVisible: number;
|
|
48
|
+
flatNodes: FlatNode<T>[];
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export declare function tree<T extends VListItem = VListItem>(config?: TreePluginConfig<T>): VListPlugin<T, TreeMethods<T>>;
|
|
18
52
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -31,8 +31,14 @@ export interface SizeCache {
|
|
|
31
31
|
*
|
|
32
32
|
* When size is a number, returns a zero-overhead fixed implementation.
|
|
33
33
|
* When size is a function, builds a prefix-sum array for efficient lookups.
|
|
34
|
+
*
|
|
35
|
+
* `gap` is the spacing already baked into each slot by the caller's size spec.
|
|
36
|
+
* The cache subtracts one trailing gap from the total, because the space after
|
|
37
|
+
* the last item is not content. Pass 0 when the spec carries no gap. Core,
|
|
38
|
+
* autosize and grid each re-implemented this correction, and a plugin that
|
|
39
|
+
* replaced the size config silently dropped whichever copy was installed.
|
|
34
40
|
*/
|
|
35
|
-
export declare const createSizeCache: (size: number | ((index: number) => number), initialTotal: number) => SizeCache;
|
|
41
|
+
export declare const createSizeCache: (size: number | ((index: number) => number), initialTotal: number, gap?: number) => SizeCache;
|
|
36
42
|
/**
|
|
37
43
|
* Count how many items fit in a given container size starting from startIndex
|
|
38
44
|
* Used for compressed mode visible range calculations
|
package/dist/size.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"base":{"minified":"
|
|
1
|
+
{"base":{"minified":"26.4","gzipped":"9.7","minBytes":27055,"gzBytes":9914},"synthetic":{"minified":"32.3","gzipped":"11.9","minBytes":33122,"gzBytes":12191},"synthetic + carousel":{"minified":"45.8","gzipped":"16.6","minBytes":46872,"gzBytes":17014},"synthetic + sortable":{"minified":"44.2","gzipped":"15.5","minBytes":45230,"gzBytes":15843},"createStats":{"minified":"27.0","gzipped":"9.9","minBytes":27657,"gzBytes":10147},"synthetic + createStats":{"minified":"32.9","gzipped":"12.1","minBytes":33724,"gzBytes":12424},"native":{"minified":"26.4","gzipped":"9.7","minBytes":27055,"gzBytes":9913},"a11y":{"minified":"29.7","gzipped":"10.9","minBytes":30387,"gzBytes":11153},"selection":{"minified":"35.8","gzipped":"12.5","minBytes":36614,"gzBytes":12807},"data":{"minified":"40.0","gzipped":"14.5","minBytes":41008,"gzBytes":14820},"scrollbar":{"minified":"34.6","gzipped":"12.5","minBytes":35428,"gzBytes":12846},"sortable":{"minified":"38.2","gzipped":"13.2","minBytes":39121,"gzBytes":13503},"groups":{"minified":"42.4","gzipped":"15.1","minBytes":43421,"gzBytes":15419},"page":{"minified":"29.0","gzipped":"10.6","minBytes":29657,"gzBytes":10852},"snapshots":{"minified":"29.7","gzipped":"10.8","minBytes":30422,"gzBytes":11075},"transition":{"minified":"33.1","gzipped":"11.7","minBytes":33934,"gzBytes":11951},"autosize":{"minified":"29.4","gzipped":"10.7","minBytes":30112,"gzBytes":10978},"grid":{"minified":"33.7","gzipped":"12.2","minBytes":34511,"gzBytes":12506},"table":{"minified":"44.8","gzipped":"15.6","minBytes":45926,"gzBytes":15960},"masonry":{"minified":"38.4","gzipped":"14.1","minBytes":39309,"gzBytes":14397},"tree":{"minified":"41.6","gzipped":"14.7","minBytes":42642,"gzBytes":15072},"search":{"minified":"35.6","gzipped":"12.9","minBytes":36432,"gzBytes":13188},"carousel":{"minified":"39.8","gzipped":"14.3","minBytes":40743,"gzBytes":14686}}
|
package/dist/synthetic.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CreateVListConfig, VList, VListPlugin } from "./core/types";
|
|
1
|
+
import type { CreateVListConfig, PluginMethods, VList, VListPlugin } from "./core/types";
|
|
2
2
|
import type { VListItem } from "./types";
|
|
3
3
|
export type { CreateVListConfig as SyntheticVListConfig } from "./core/types";
|
|
4
|
-
export declare function createVList<T extends VListItem = VListItem>(config: CreateVListConfig<T>, plugins?:
|
|
4
|
+
export declare function createVList<T extends VListItem = VListItem, const P extends readonly VListPlugin<T, any>[] = VListPlugin<T>[]>(config: CreateVListConfig<T>, plugins?: P): VList<T> & PluginMethods<P>;
|
|
5
5
|
//# sourceMappingURL=synthetic.d.ts.map
|
package/dist/synthetic.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Ie=3,ct="vlist";var ce=150;var Te=(e)=>e<0.5?2*e*e:1-(-2*e+2)**2/2,dt=300;var Le="__placeholder_";function mt(e){let{state:t,viewport:o,isX:l,onFrame:i,onIdle:u}=e,r=e.idleTimeout||ce,d=null,S=null;function E(L=l?o.scrollLeft:o.scrollTop){t.prevScrollPosition=t.scrollPosition,t.scrollPosition=L,t.scrollDirection=L>t.prevScrollPosition?1:L<t.prevScrollPosition?-1:0,i(),R()}function R(){if(d!==null)clearTimeout(d);d=setTimeout(()=>{d=null,t.scrollDirection=0,u()},r)}function I(){if(S!==null)cancelAnimationFrame(S),S=null}function v(L,H,O,p=Te,F){I();let h=t.scrollPosition,A=typeof L==="function"?L:()=>L,C=A();if(Math.abs(C-h)<1){if(O)O(C);else if(l)o.scrollLeft=C;else o.scrollTop=C;F?.();return}let a=performance.now();function b(M){C=A();let T=M-a,P=Math.min(T/H,1),m=h+(C-h)*p(P);if(O)O(m);else if(l)o.scrollLeft=m;else o.scrollTop=m;if(!O)E(m);if(P<1)S=requestAnimationFrame(b);else S=null,F?.()}S=requestAnimationFrame(b)}return{attach(){},detach(){if(I(),d!==null)clearTimeout(d),d=null},cancelScroll:I,smoothScrollTo:v,commitScroll:E}}var Ce={top:0,right:0,bottom:0,left:0},ft=(e)=>{if(e==null)return Ce;if(typeof e==="number")return e===0?Ce:{top:e,right:e,bottom:e,left:e};if(e.length===2){let[u,r]=e;return u===0&&r===0?Ce:{top:u,right:r,bottom:u,left:r}}let[t,o,l,i]=e;return t===0&&o===0&&l===0&&i===0?Ce:{top:t,right:o,bottom:l,left:i}},pt=(e,t)=>t?e.left+e.right:e.top+e.bottom,bt=(e,t)=>t?e.top+e.bottom:e.left+e.right;function vt(e){let t={visibleIndices:new Int32Array(e),visibleOffsets:new Float64Array(e),visibleSizes:new Float64Array(e),visibleCount:0,startIndex:0,totalSize:0,capacity:e,scrollPosition:0,prevScrollPosition:0,scrollDirection:0,baseOffset:0,prevBaseOffset:0,containerSize:0,crossSize:0,totalItems:0,prevRangeStart:0,prevRangeEnd:-1,renderPending:!1,initialized:!1,destroyed:!1,prevAriaTotal:-1,resizeCapacity(o,l,i=Ie){if(l<=0||o<=0)return;let u=Math.ceil(o/l)+i*2;if(u<=t.capacity)return;let r=u+8,d=new Int32Array(r),S=new Float64Array(r),E=new Float64Array(r);d.set(t.visibleIndices),S.set(t.visibleOffsets),E.set(t.visibleSizes),t.visibleIndices=d,t.visibleOffsets=S,t.visibleSizes=E,t.capacity=r},clear(){t.visibleCount=0,t.startIndex=0}};return t}var Dt=(e,t)=>{let o=t;return{getOffset:(l)=>l*e,getSize:(l)=>e,indexAtOffset:(l)=>{if(o===0||e===0)return 0;return Math.max(0,Math.min(Math.floor(l/e),o-1))},getTotalSize:()=>o*e,getTotal:()=>o,rebuild:(l)=>{o=l},isVariable:()=>!1}},Ft=(e,t)=>{let o=t,l=new Float64Array(0),i=(r)=>{o=r,l=new Float64Array(r+1),l[0]=0;for(let d=0;d<r;d++)l[d+1]=l[d]+e(d)};i(t);let u=(r)=>{if(o===0)return 0;if(r<=0)return 0;if(r>=l[o])return o-1;let d=0,S=o-1;while(d<S){let E=d+S+1>>>1;if(l[E]<=r)d=E;else S=E-1}return d};return{getOffset:(r)=>{if(r<=0)return 0;if(r>=o)return l[o];return l[r]},getSize:(r)=>e(r),indexAtOffset:(r)=>u(r),getTotalSize:()=>l[o]??0,getTotal:()=>o,rebuild:(r)=>i(r),isVariable:()=>!0}},Pe=(e,t)=>{if(typeof e==="number")return Dt(e,t);return Ft(e,t)};function gt(e){let t=[],o=`${e}-item`,l=document.createElement("div");return l.className=o,{acquire(){if(t.length>0)return t.pop();return l.cloneNode(!1)},release(i){if(i.className=o,i.removeAttribute("style"),i.removeAttribute("id"),i.removeAttribute("role"),i.removeAttribute("aria-selected"),i.removeAttribute("aria-posinset"),i.removeAttribute("aria-setsize"),i.removeAttribute("data-index"),i.removeAttribute("data-id"),i.textContent="",t.length<100)t.push(i)},get size(){return t.length},clear(){t.length=0}}}function Ne(e){let t=e.querySelectorAll("a[href],button,input,select,textarea,[tabindex]");for(let o=0;o<t.length;o++)t[o].setAttribute("tabindex","-1")}function Be(e){if(typeof e==="string"){let t=document.querySelector(e);if(!t)throw Error(`[vlist] Container not found: ${e}`);return t}return e}function ht(e,t,o,l){let i=o?`${t} ${t}--horizontal`:t,u=o?"overflow-x:auto;overflow-y:hidden;height:100%;width:100%":"overflow:auto;height:100%;width:100%",r=o?"position:relative;height:100%;overflow-anchor:none":"position:relative;width:100%;overflow-anchor:none",d=' role="list"';if(l)d+=` aria-label="${l.replace(/"/g,""")}"`;if(o)d+=' aria-orientation="horizontal"';e.insertAdjacentHTML("beforeend",`<div class="${i}"><div class="${t}-viewport" style="${u}" tabindex="-1"><div class="${t}-content" style="${r}"${d}></div></div></div>`);let S=e.lastElementChild,E=S.firstElementChild,R=E.firstElementChild,I=document.createElement("div");return I.className=`${t}-live`,I.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",I.setAttribute("aria-live","polite"),I.setAttribute("aria-atomic","true"),I.setAttribute("role","status"),S.appendChild(I),{root:S,viewport:E,content:R,liveRegion:I}}function Nt(e,t){if(e.getTotal()<=0)return{index:0,offsetPx:0};let l=t<=0?0:t,i=e.indexAtOffset(l),u=l-e.getOffset(i);return{index:i,offsetPx:u>0?u:0}}function Bt(e,t){let o=$t(e,t);return e.getOffset(o.index)+o.offsetPx}function $t(e,t){let o=e.getTotal();if(o<=0)return{index:0,offsetPx:0};let{index:l,offsetPx:i}=t;if(l<0)return{index:0,offsetPx:0};if(l>o-1)l=o-1;while(i>0&&l<o-1){let u=e.getSize(l);if(i<u)break;i-=u,l++}while(i<0&&l>0)l--,i+=e.getSize(l);if(i<0)i=0;return{index:l,offsetPx:i}}function St(e){let{sizeCache:t,getPixel:o,setPixel:l,getContainerSize:i}=e;function u(){let d=t.getTotalSize()+e.padding-i();return d>0?d:0}function r(d){if(d<=0)return 0;let S=u();return d>S?S:d}return{getLogical(){return Nt(t,o())},setLogical(d){l(r(Bt(t,d)))},getPixelEquivalent(){return o()},setPixelEquivalent(d){l(r(d))},getMaxPixelEquivalent:u,getRenderOrigin:e.getRenderOrigin,scrollByPx(d){l(r(o()+d))}}}var Se=[],Kt={calculate:Se,commit:Se,afterScroll:Se,idle:Se,resize:Se};function xt(e){if(e.length===0)return Kt;let t=[],o=[],l=[],i=[],u=[];for(let r=0;r<e.length;r++){let d=e[r].hooks;if(d===void 0)continue;if(d.onCalculate!==void 0)t.push(d.onCalculate);if(d.onCommit!==void 0)o.push(d.onCommit);if(d.onAfterScroll!==void 0)l.push(d.onAfterScroll);if(d.onIdle!==void 0)i.push(d.onIdle);if(d.onResize!==void 0)u.push(d.onResize)}return{calculate:t,commit:o,afterScroll:l,idle:i,resize:u}}function yt(e,t){for(let o=0;o<e.length;o++)e[o](t)}function Et(e,t){for(let o=0;o<e.length;o++)e[o](t)}function $e(e,t,o){for(let l=0;l<e.length;l++)e[l](t,o)}function It(e){for(let t=0;t<e.length;t++)e[t]()}function Tt(e,t,o){for(let l=0;l<e.length;l++)e[l](t,o)}function Lt(e,t,o,l,i,u,r,d){let S=l!==0||i!==0;return{prefix:e,selectedClass:`${e}-item--selected`,focusedClass:`${e}-item--focused`,placeholderClass:`${e}-item--placeholder`,replacedClass:`${e}-item--replaced`,translateProp:t?"translateX(":"translateY(",sizeProp:t?"width":"height",itemRole:"listitem",interactive:!1,startPadding:o,gap:r,hasCrossPad:S,crossStartProp:S?t?"top":"left":"",crossEndProp:S?t?"bottom":"right":"",crossStartVal:S?l+"px":"",crossEndVal:S?i+"px":"",oddClass:u,emitter:d??null,indexMap:null,ariaTotalFn:null}}function Ut(e,t,o,l,i){if(e.containerSize<=0||e.totalItems===0)return e.clear(),!0;let{scrollPosition:u,containerSize:r,totalItems:d}=e,S=i??0;e.totalSize=t.getTotalSize();let E=t.indexAtOffset(S>0?Math.max(0,u-S):u),R=t.indexAtOffset(u+r);if(R<d-1)R++;E=Math.max(0,E),R=Math.min(d-1,Math.max(0,R));let I=Math.max(0,E-o),v=Math.min(d-1,R+o),L=Math.ceil(r/1)+o*2+10,H=v-I+1,O=Math.min(H,e.capacity,L);if(I===e.prevRangeStart&&v===e.prevRangeEnd&&!e.renderPending&&e.baseOffset===e.prevBaseOffset)return!1;e.visibleCount=O,e.startIndex=I;for(let p=0;p<O;p++){let F=I+p;e.visibleIndices[p]=F,e.visibleOffsets[p]=t.getOffset(F),e.visibleSizes[p]=t.getSize(F)}return yt(l.calculate,e),e.prevRangeStart=I,e.prevRangeEnd=v,e.prevBaseOffset=e.baseOffset,e.renderPending=!1,!0}var G={selected:!1,focused:!1};function Gt(e,t,o){for(let l=0;l<t;l++)if(e[l]===o)return!0;return!1}function Wt(e,t){if(t<=1)return!0;let o=e[0];for(let l=1;l<t;l++){let i=e[l];if(i!==o+1)return!1;o=i}return!0}function qt(e,t,o,l,i,u,r,d,S,E){let R=S?null:i(),{visibleCount:I,visibleIndices:v}=e,L=r.ariaTotalFn?r.ariaTotalFn():e.totalItems,H=r.interactive?String(L):"",O=r.interactive&&L!==e.prevAriaTotal,p=null,F=r.indexMap;for(let h=0;h<I;h++){let A=v[h],C=F?F(A):A,a=e.visibleOffsets[h],b=e.visibleSizes[h],M=S?S(A):R[A];if(E)E(C,G);else G.selected=!1,G.focused=!1;let T=u.get(A),P=T;if(T===void 0){let m=t.acquire();if(M!==void 0){let g;try{g=l(M,C,G)}catch(w){if(r.emitter)r.emitter.emit("error",{error:w instanceof Error?w:Error(String(w)),context:`template:render:${C}`});t.release(m);continue}if(typeof g==="string")m.innerHTML=g;else m.textContent="",m.appendChild(g);Ne(m)}if(m.setAttribute("role",r.itemRole),m.setAttribute("data-index",String(C)),r.interactive)m.id=r.prefix+"-item-"+A,m.setAttribute("aria-posinset",String(C+1)),m.setAttribute("aria-setsize",H);if(M!==void 0){let g=String(M.id);if(m.setAttribute("data-id",g),g.startsWith(Le))m.classList.add(r.placeholderClass)}if(r.hasCrossPad)m.style.setProperty(r.crossStartProp,r.crossStartVal),m.style.setProperty(r.crossEndProp,r.crossEndVal);if(E){if(m.classList.toggle(r.selectedClass,G.selected),m.classList.toggle(r.focusedClass,G.focused),G.selected)m.setAttribute("aria-selected","true");else m.removeAttribute("aria-selected");m._lastSelected=G.selected,m._lastFocused=G.focused}if(r.oddClass)m.classList.toggle(r.oddClass,(A&1)===1);let W=a-e.baseOffset+r.startPadding;m.style.transform=r.translateProp+W+"px)",m._lastOffset=W;let x=b-r.gap;if(m.style[r.sizeProp]=x+"px",m._lastSize=x,m._lastItem=M,u.set(A,m),p===null)p=document.createDocumentFragment();p.appendChild(m)}else{if(O)T.setAttribute("aria-setsize",H);if(M!==void 0&&P._lastItem!==M){let x=T.getAttribute("data-id"),g=String(M.id),w;try{w=l(M,C,G)}catch(B){if(r.emitter)r.emitter.emit("error",{error:B instanceof Error?B:Error(String(B)),context:`template:render:${C}`});continue}if(typeof w==="string")T.innerHTML=w;else T.textContent="",T.appendChild(w);if(Ne(T),T.setAttribute("data-id",g),P._lastItem=M,x!==g){let B=x!==null&&x.startsWith(Le),y=g.startsWith(Le);if(B!==y)T.classList.toggle(r.placeholderClass,y);if(B&&!y)T.classList.add(r.replacedClass),setTimeout(()=>{T.classList.remove(r.replacedClass)},300)}}if(E){if(P._lastSelected!==G.selected){if(T.classList.toggle(r.selectedClass,G.selected),G.selected)T.setAttribute("aria-selected","true");else T.removeAttribute("aria-selected");P._lastSelected=G.selected}if(P._lastFocused!==G.focused)T.classList.toggle(r.focusedClass,G.focused),P._lastFocused=G.focused}let m=a-e.baseOffset+r.startPadding;if(P._lastOffset!==m)T.style.transform=r.translateProp+m+"px)",P._lastOffset=m;let W=b-r.gap;if(P._lastSize!==W)T.style[r.sizeProp]=W+"px",P._lastSize=W}}if(p!==null)o.appendChild(p);if(I>0&&Wt(v,I)){let h=v[0],A=v[I-1];for(let[C,a]of u)if(C<h||C>A)a.remove(),t.release(a),u.delete(C)}else for(let[h,A]of u)if(!Gt(v,I,h))A.remove(),t.release(A),u.delete(h);if(r.interactive)e.prevAriaTotal=e.totalItems;Et(d.commit,e)}function Ke(e,t,o,l,i,u,r,d,S,E,R,I){if(Ut(e,t,o,E,S.startPadding))qt(e,l,i,u,r,d,S,E,R,I)}var Ue=()=>{let e={},t=(u,r)=>{if(!e[u])e[u]=new Set;return e[u].add(r),()=>o(u,r)},o=(u,r)=>{e[u]?.delete(r)};return{on:t,off:o,emit:(u,r)=>{e[u]?.forEach((d)=>{try{d(r)}catch(S){console.error(`[vlist] Error in event handler for "${String(u)}":`,S)}})},clear:(u)=>{if(u)delete e[u];else for(let r in e)delete e[r]}}};var Ct=2,Pt=(e=0)=>({velocity:0,sampleCount:0}),At=(e,t)=>{let o=performance.now(),l=e._lt??o,i=e._lp??t,u=o-l;if(e._lp=t,e._lt=o,u===0)return e.sampleCount=Math.min(e.sampleCount+1,5),e;if(u>100)return e.velocity=0,e.sampleCount=1,e;return e.velocity=Math.abs(t-i)/u,e.sampleCount=Math.min(e.sampleCount+1,5),e};function Xt(e){let{item:t}=e;if(t.height!==void 0&&typeof t.height==="number"){if(!Number.isFinite(t.height)||t.height<=0)throw Error(`vlist: item.height must be a positive number, got ${t.height}`)}if(t.width!==void 0&&typeof t.width==="number"){if(!Number.isFinite(t.width)||t.width<=0)throw Error(`vlist: item.width must be a positive number, got ${t.width}`)}if(t.estimatedHeight!==void 0){if(!Number.isFinite(t.estimatedHeight)||t.estimatedHeight<=0)throw Error(`vlist: item.estimatedHeight must be a positive number, got ${t.estimatedHeight}`)}if(t.estimatedWidth!==void 0){if(!Number.isFinite(t.estimatedWidth)||t.estimatedWidth<=0)throw Error(`vlist: item.estimatedWidth must be a positive number, got ${t.estimatedWidth}`)}if(t.gap!==void 0){if(typeof t.gap!=="number"||!Number.isFinite(t.gap)||t.gap<0)throw Error(`vlist: item.gap must be a non-negative number, got ${t.gap}`)}if(e.overscan!==void 0){if(typeof e.overscan!=="number"||!Number.isFinite(e.overscan)||e.overscan<0)throw Error(`vlist: overscan must be a non-negative number, got ${e.overscan}`)}let o=e.scroll;if(o?.mode!==void 0||o?.runway!==void 0)throw Error('vlist 3.0: scroll.mode and scroll.runway were removed; bounded mode is gone. Use "vlist/synthetic" for huge lists or "vlist" for native scrolling.')}function Yt(e,t){let o=e==="horizontal"?"x":"y";if(t.some((i)=>i.name==="grid"))return{primary:o,cross:o==="x"?"y":"x"};return{primary:o}}function Zt(e,t){let o=Yt(e.orientation,t),l=o.primary==="x",i=ft(e.padding);return{axis:o,hasCrossAxis:o.cross!==void 0,overscan:e.overscan??Ie,reverse:e.reverse??!1,classPrefix:e.classPrefix??ct,mainAxisPadding:pt(i,l),crossAxisPadding:bt(i,l),startPadding:l?i.left:i.top,endPadding:l?i.right:i.bottom,crossPadStart:l?i.top:i.left,crossPadEnd:l?i.bottom:i.right,striped:e.item.striped||!1,gap:e.item.gap??0}}function jt(e,t){if(t)return e.item.width??e.item.estimatedWidth??100;return e.item.height??e.item.estimatedHeight??40}function Jt(e){let t=[...e];return t.sort((o,l)=>(o.priority??50)-(l.priority??50)),t}function Qt(e){let t=new Set;for(let o of e){if(t.has(o.name))throw Error(`[vlist] Duplicate plugin: ${o.name}`);t.add(o.name)}for(let o of e)if(o.conflicts){for(let l of o.conflicts)if(t.has(l))throw Error(`[vlist] Plugin "${o.name}" conflicts with "${l}"`)}}function zt(e,t=[],o,l){if(Xt(e),o){if(typeof e.scroll?.scrollbar==="string")throw Error('vlist 3.0: scroll.scrollbar strings require "vlist"; use the scrollbar() plugin with "vlist/synthetic".');if(e.orientation==="horizontal"&&getComputedStyle(Be(e.container)).direction==="rtl")throw Error('vlist: RTL horizontal lists require createVList from "vlist"');for(let c of t)if(c.name==="carousel"||c.name==="sortable")throw Error(`vlist: ${c.name} requires createVList from "vlist"`)}let i=Zt(e,t),u=i.axis.primary==="x",r=jt(e,u),d=i.gap,S=d>0?typeof r==="function"?(c)=>r(c)+d:r+d:r,E=typeof r==="number"?r:20,R=e.items?.length??0,I=i.striped?`${i.classPrefix}-item--odd`:"",v=Ue(),L=Lt(i.classPrefix,u,i.startPadding,i.crossPadStart,i.crossPadEnd,I,d,v),H=t.length>0?Jt(t):t;if(t.length>0)Qt(H);let O=Be(e.container),p=ht(O,i.classPrefix,u,e.ariaLabel);if(e.scroll?.scrollbar==="none")p.viewport.classList.add(`${i.classPrefix}-viewport--no-scrollbar`);if(e.scroll?.gutter==="stable")p.viewport.classList.add(`${i.classPrefix}-viewport--gutter-stable`);let h=Pe(S,R);if(d>0){let c=h.getTotalSize;h.getTotalSize=()=>{let n=c();return n>0?n-d:0}}let A=gt(i.classPrefix),C=Math.ceil(4096/E)+i.overscan*2+8,a=vt(C);a.totalItems=R;let b=e.items??[],M=()=>b,T=new Map,P=Pt(),m={velocity:0,reliable:!1},W={range:{start:0,end:-1}},x={scrollPosition:0,direction:"down"},g={scrollPosition:0},w=-1,B=-1,y=-1,k=null,N=xt(H),K=new Map,X=[],re=[],ie=[],Y=null,Q=null,de,se,ee=null,me=null,s=null,z=null,U=null,V=null,Z=null,fe=null,ae=!1,We=!1,pe=null,qe=0,Xe=0,Ye=null,Ze=null,je=null,ze=null,Me=null,we=null,xe=null,j=null,be=null,Je=null;a.containerSize=u?p.viewport.clientWidth:p.viewport.clientHeight,a.crossSize=u?p.viewport.clientHeight:p.viewport.clientWidth;function _e(c){if(Q)Q(c);else{if(u)p.viewport.scrollLeft=c;else p.viewport.scrollTop=c;se?.()}}let Qe=St({sizeCache:h,getPixel:()=>a.scrollPosition,setPixel:_e,getRenderOrigin:()=>a.baseOffset,getContainerSize:()=>a.containerSize,padding:i.mainAxisPadding});if(t.length>0){let c={dom:p,sizeCache:h,scroll:Qe,pool:A,config:i,emitter:v,template:e.item.template,registerMethod(n,f){K.set(n,f)},getMethod(n){return K.get(n)},registerClickHandler(n){X.push(n)},registerKeydownHandler(n){re.push(n)},registerDestroyHandler(n){ie.push(n)},enableListboxRole(){let n=p.content.getAttribute("role");if(!n||n==="list")p.content.setAttribute("role","listbox"),p.content.setAttribute("tabindex","0");L.itemRole="option",L.interactive=!0},setSizeConfig(n){let f=Pe(n,a.totalItems),_=K.get("_setSizeCacheBase");if(_){let D=h.rebuild;Object.assign(h,f),h.rebuild=D,_(f.rebuild)}else Object.assign(h,f)},setScrollSource(n){Q=n.write,de=n.onContentSize,ae=!0},commitScroll(n){se(n)},setBoundedWrap(n,f){be=n,Je=f},cancelScroll(){le?.cancelScroll()},setVirtualTotalFn(n){Y=n,L.ariaTotalFn=n},setIndexMapFn(n){L.indexMap=n},getItems:M,getItem(n){return s?s(n):b[n]},getState(){return a},rebuildSizeCache(){h.rebuild(a.totalItems)},updateContentSize:tt,setRenderFn(n,f){ee=n,me=f},renderIfNeeded(){ve()},forceRender(){ne()},setGetItemFn(n){s=n},setItemStateFn(n){z=n},getItemStateFn(){return z},get rawSizeSpec(){return r},scrollTo:_e,shiftScroll(n){if(j?.shiftBy)j.shiftBy(n);else c.scrollTo(a.scrollPosition+n)},smoothScrollTo(n,f,_,D){if(ze)ze(n,f,Q??void 0,_,D);else c.scrollTo(typeof n==="function"?n():n)},disableDefaultResize(){We=!0},setScrollTarget(n){pe=n},setScrollToPosFn(n){Me=n},setScrollToIndexFn(n){we=n},onScrollFrame:Oe,onScrollIdle:ye,removeItemById(n){if(U)return U(n);let f=b.findIndex((_)=>_.id===n);if(f===-1)return-1;return b.splice(f,1),a.totalItems=b.length,h.rebuild(a.totalItems),te(),f},insertItemAt(n,f){if(V){V(n,f);return}b.splice(f,0,n),a.totalItems=b.length,h.rebuild(a.totalItems),te()},setRemoveItemFn(n){U=n},setInsertItemFn(n){V=n},setUpdateItemFn(n){Z=n},setGetIndexByIdFn(n){fe=n},getRenderedElement(n){let f=K.get("_getRenderedElement");if(f)return f(n);return T.get(n)??null},setNavConfig(n){if(n.ud!==void 0)qe=n.ud;if(n.lr!==void 0)Xe=n.lr;if(n.scrollIndex)Ye=n.scrollIndex;if(n.navigate)Ze=n.navigate;if(n.total)je=n.total},getNavConfig:(()=>{let n={ud:0,lr:0,scrollIndex:null,navigate:null,total:null};return()=>(n.ud=qe,n.lr=Xe,n.scrollIndex=Ye,n.navigate=Ze,n.total=je,n)})()};for(let n of H)if(n.setup)try{n.setup(c)}catch(f){v.emit("error",{error:f instanceof Error?f:Error(String(f)),context:`plugin:setup:${n.name}`})}}let He=i.classPrefix+"--scrolling",ue=!1,Re=e.scroll?.idleTimeout??ce;function et(){if(x.scrollPosition=a.scrollPosition,u)x.direction=a.scrollDirection>0?"right":"left";else x.direction=a.scrollDirection>0?"down":"up";if(v.emit("scroll",x),At(P,a.scrollPosition),m.velocity=P.velocity,m.reliable=P.sampleCount>=Ct,v.emit("velocity:change",m),a.startIndex!==w||a.prevRangeEnd!==B)w=a.startIndex,B=a.prevRangeEnd,W.range.start=a.startIndex,W.range.end=a.prevRangeEnd,v.emit("range:change",W)}function tt(c,n=!0){if(j){if(n)j.refresh(c);return}a.totalSize=c;let f=c+i.mainAxisPadding;if(de?.(f),n)p.content.style[u?"width":"height"]=f+"px"}function te(){let c=ee?a.totalSize:h.getTotalSize();if(tt(c,!ee),j||ee)return;l?.onContentSize(c,v)}function nt(){if(!xe)return;if((Y?Y():b.length)===0)return;let n=xe;xe=null,De.scrollToIndex(n.index,n.alignOrOptions)}function ve(){if(nt(),ee)ee();else Ke(a,h,i.overscan,A,p.content,e.item.template,M,T,L,N,s,z)}function Oe(){if(!ue)ue=!0,p.root.classList.add(He);if(ve(),$e(N.afterScroll,a.scrollPosition,a.scrollDirection),a.scrollPosition!==y)y=a.scrollPosition,et()}function ye(){if(ue)ue=!1,p.root.classList.remove(He);a.scrollDirection=0,It(N.idle),m.velocity=0,m.reliable=!1,v.emit("velocity:change",m),g.scrollPosition=a.scrollPosition,v.emit("scroll:idle",g)}function ne(){if(nt(),a.renderPending=!0,me)me();else Ke(a,h,i.overscan,A,p.content,e.item.template,M,T,L,N,s,z);if($e(N.afterScroll,a.scrollPosition,a.scrollDirection),a.scrollPosition!==y){if(y=a.scrollPosition,et(),k!==null)clearTimeout(k);k=setTimeout(ye,Re)}}let ot=ae?!1:e.scroll?.wheel!==!1,le;if(ae&&be)throw Error("vlist: page() is not compatible with the carousel plugin — bounded page-mode scrolling is not implemented yet.");if(!ae&&(o||be))j=(o??Je)({state:a,sizeCache:h,viewport:p.viewport,content:p.content,isX:u,wheelEnabled:ot,idleTimeout:Re,...pe?{scrollTarget:pe}:{},mainAxisPadding:i.mainAxisPadding,...be?{wrap:be}:{},onFrame:Oe,onIdle:ye}),le=j,Q=(c)=>j.setLogical(c);else{let c=(ae?mt:l.native)({state:a,viewport:p.viewport,isX:u,wheelEnabled:ot,idleTimeout:Re,...pe?{scrollTarget:pe}:{},onFrame:Oe,onIdle:ye});le=c,se=c.commitScroll}ze=le.smoothScrollTo;function Ve(c){let f=c.target.closest("[data-index]");if(!f)return null;let _=parseInt(f.getAttribute("data-index"),10);if(Number.isNaN(_))return null;let D=K.get("_layoutToDataIndex"),q;if(D){let J=D(_);if(J<0)return null;let he=K.get("_getItem");q=he?he(J):s?s(J):b[J]}else q=s?s(_):b[_];if(q===void 0)return null;return{item:q,index:_}}function rt(c){for(let f=0;f<X.length;f++)X[f](c);let n=Ve(c);if(n)v.emit("item:click",{item:n.item,index:n.index,event:c})}function it(c){let n=Ve(c);if(n)v.emit("item:dblclick",{item:n.item,index:n.index,event:c})}function lt(c){let n=Ve(c);if(n)v.emit("item:contextmenu",{item:n.item,index:n.index,event:c})}function st(c){let n=c.target?.tagName;if((n==="INPUT"||n==="TEXTAREA"||n==="SELECT")&&!((c.ctrlKey||c.metaKey)&&(c.key==="f"||c.key==="F")))return;for(let f=0;f<re.length;f++)re[f](c)}if(p.content.addEventListener("click",rt),p.content.addEventListener("dblclick",it),p.content.addEventListener("contextmenu",lt),re.length>0)p.root.addEventListener("keydown",st);let ke=null;if(!We)setTimeout(()=>{if(a.destroyed)return;ke=new ResizeObserver((n)=>{for(let f of n){let{width:_,height:D}=f.contentRect,q=u?_:D,J=u?D:_;if(Math.abs(q-a.containerSize)<1&&Math.abs(J-a.crossSize)<1)continue;if(a.containerSize=q,a.crossSize=J,a.resizeCapacity(q,E,i.overscan),j)j.refresh(h.getTotalSize());ne(),Tt(N.resize,_,D),v.emit("resize",{width:_,height:D})}}),ke.observe(p.viewport)},0);a.resizeCapacity(a.containerSize,E,i.overscan),te(),a.initialized=!0;let ge=null;if(e.defer)ge=requestAnimationFrame(()=>{if(ge=null,!a.destroyed)ve()});else ve();if(!ae)le.attach();let De={get element(){return p.root},get items(){return b},get total(){return Y?Y():b.length},setItems(c){b=[...c],a.totalItems=b.length,h.rebuild(a.totalItems),te(),ne()},appendItems(c){b.push(...c),a.totalItems=b.length,h.rebuild(a.totalItems),te(),ne()},prependItems(c){b.unshift(...c),a.totalItems=b.length,h.rebuild(a.totalItems),te(),ne()},updateItem(c,n){if(Z){if(!Z(c,n))return}else{let f=b.findIndex((_)=>_.id===c);if(f===-1)return;b[f]={...b[f],...n}}ne()},insertItem(c,n){if(V)V(c,n??a.totalItems);else{if(n===void 0)b.push(c);else b.splice(n,0,c);a.totalItems=b.length,h.rebuild(a.totalItems),te()}ne()},removeItem(c){if(U){if(U(c)<0)return}else{let n=b.findIndex((f)=>f.id===c);if(n===-1)return;b.splice(n,1),a.totalItems=b.length,h.rebuild(a.totalItems),te()}ne()},removeItems(c){if(U){let D=0;for(let q of c)if(U(q)>=0)D++;if(D>0)ne();return D}let n=new Set(c),f=b.length;b=b.filter((D)=>!n.has(D.id));let _=f-b.length;if(_>0)a.totalItems=b.length,h.rebuild(a.totalItems),te(),a.renderPending=!0,ve();return _},getItemAt(c){if(L.indexMap)return b[c];return s?s(c):b[c]},getIndexById(c){if(fe)return fe(c);return b.findIndex((n)=>n.id===c)},scrollToIndex(c,n="start"){let f=Y?Y():b.length;if(f===0){xe={index:c,alignOrOptions:n};return}let _=Math.max(0,Math.min(c,f-1)),D=typeof n==="string"?n:n.align??"start",q=typeof n==="object"?n.behavior:void 0,J=typeof n==="object"?n.duration:void 0,he=typeof n==="object"?n.easing:void 0;if(we&&we(_,D,q,J,he)!==!1)return;let Fe=h.getOffset(_),at=h.getSize(_),Ee=a.containerSize,Ot=h.getTotalSize(),ut=i.mainAxisPadding,Vt=Math.max(0,Ot+ut-Ee),oe;if(Me)oe=Me(_,h,Ee,f,D);else{let kt=i.startPadding;switch(D){case"center":oe=kt+Fe-(Ee-at)/2;break;case"end":oe=Fe+at+ut-Ee;break;default:oe=Fe}oe=Math.max(0,Math.min(oe,Vt))}if(q==="smooth")le.smoothScrollTo(oe,J??dt,Q??void 0,he);else _e(oe)},getScrollPosition(){return Qe.getPixelEquivalent()},on:v.on.bind(v),off:v.off.bind(v),destroy(){if(a.destroyed)return;if(a.destroyed=!0,ue)ue=!1,p.root.classList.remove(He);if(ge!==null)cancelAnimationFrame(ge),ge=null;if(k!==null)clearTimeout(k),k=null;le.detach(),ke?.disconnect(),p.content.removeEventListener("click",rt),p.content.removeEventListener("dblclick",it),p.content.removeEventListener("contextmenu",lt),p.root.removeEventListener("keydown",st);let c=[];for(let n of ie)try{n()}catch(f){c.push(f instanceof Error?f:Error(String(f)))}for(let n of H)if(n.destroy)try{n.destroy()}catch(f){c.push(f instanceof Error?f:Error(String(f)))}for(let[,n]of T)n.remove();if(T.clear(),A.clear(),p.root.remove(),v.emit("destroy",void 0),v.clear(),c.length>0)for(let n of c)console.error("vlist: error during destroy:",n)}};for(let[c,n]of K)De[c]=n;return De}var wt=1,_t=2;var Mt=(e)=>1-(1-e)**3;function Ht({getMax:e,onChange:t=()=>{},onFinish:o,axis:l="y",reducedMotion:i}){let u=0,r=0,d=null,S=0,E=0,R=0,I=0,v=0,L=null,H=0,O=0,p=0,F=0,h=400,A=Mt,C=()=>p,a=0.006,b=(x)=>Math.max(0,Math.min(e(),x)),M=(x,g)=>l==="y"?g:x,T=(x,g)=>l==="y"?x:g;function P(x){let g=b(x);if(g!==u)u=g,t(u);return g!==x}function m(){v=0,r=d===null?0:5}function W(x){m(),P(x)}return{get position(){return u},get state(){return r},get velocity(){return v},get active(){return r===3||r===4},begin(x,g,w,B){if(d!==null){m();return}m(),d=x,S=R=M(g,w),E=T(g,w),I=B,r=1},move(x,g,w,B){if(x!==d||r!==1&&r!==2)return!1;let y=M(g,w);if(r===1){let K=Math.abs(y-S),X=Math.abs(T(g,w)-E);if(Math.max(K,X)<6)return!1;if(X>K*1.2)return m(),!1;if(K<X*1.2)return!1;r=2}let k=R-y,N=B-I;if(N>0){let K=Math.max(-3,Math.min(3,k/N));v=N>80?0:K*v<0?K:0.65*K+0.35*v}if(R=y,I=B,P(u+k))v=0;return!0},end(x,g){if(x!==d)return;if(d=null,r===2&&!i()&&g-I<=80&&Math.abs(v)>=0.02)L=null,r=3;else v=0,r=0},cancel:m,reset(){d=null,m()},jump:W,shiftBy(x){O+=x,F+=x,P(u+x)},by(x){m();let g=u;return P(u+x),u!==g},smooth(x,g=400,w=Mt){if(m(),F=0,C=typeof x==="function"?x:()=>x,d!==null||i()||g<=0){P(C());return}h=g,A=w,O=u,p=b(C()+F),L=null,r=4},resize(){m(),P(u)},tick(x){if(r!==3&&r!==4)return;if(L===null){if(L=x,r===4)H=x;return}let g=x-L;if(g<=0)return;if(L=x,g>100){if(r===4)P(b(C()+F)),r=0,o?.();else m();return}if(r===4){p=b(C()+F);let y=Math.min(1,(x-H)/h);if(P(O+(p-O)*A(y)),y===1)r=0,o?.();return}let w=Math.exp(-a*g),B=P(u+v*(1-w)/a);if(v*=w,B||Math.abs(v)<0.02)v=0,r=0}}}var Ae=(e)=>e.pointerType==="touch"||e.pointerType==="pen";function Ge(e){if(e.closest("textarea,select,[contenteditable]:not([contenteditable=false])"))return!0;let t=e.closest("input");return!!t&&!/^(button|submit|reset|checkbox|radio|image)$/.test(t.type)}function Rt(e){let{state:t,viewport:o,content:l,isX:i,onFrame:u,onIdle:r,mainAxisPadding:d}=e,S=o.parentElement??o,E=o.ownerDocument.defaultView,R=o.ownerDocument,I=E.matchMedia("(prefers-reduced-motion: reduce)"),v=0,L=null,H=null,O=!1,p=!1,F=-1,h=-1,A=null,C=null,a=!1,b=!1,M=!1,T=!1,P,m=new Set;function W(s){let z=t.scrollPosition;if(t.prevScrollPosition=z,t.scrollPosition=t.baseOffset=s,t.scrollDirection=s>z?1:s<z?-1:0,!p)u()}function x(){if(H=null,y.active||y.state===_t||y.state===wt)return;t.scrollDirection=0,r()}function g(){if(!O)return;if(H!==null)clearTimeout(H);H=setTimeout(x,e.idleTimeout||ce)}function w(){if(O&&L===null&&y.active)L=requestAnimationFrame(B)}function B(s){if(L=null,y.tick(s),y.active)w();else g()}let y=Ht({axis:i?"x":"y",getMax:()=>v,reducedMotion:()=>I.matches,onChange:W,onFinish(){let s=P;P=void 0,s?.()}});function k(){if(P=void 0,L!==null)cancelAnimationFrame(L),L=null;if(y.cancel(),H!==null)clearTimeout(H),H=null}function N(){if(k(),y.reset(),T&&A!==null&&o.hasPointerCapture(A))o.releasePointerCapture(A);T=!1,m.clear(),A=C=null,a=b=M=!1,g()}function K(s){if(!Ae(s))return;if(s.isPrimary){if(m.size)N();m.clear()}if(m.add(s.pointerId),m.size>1){M=!0,k();return}if(!(s.target instanceof Element)||Ge(s.target)){k();return}A=s.pointerId,a=!1,b=y.active,C=null,k(),y.begin(s.pointerId,s.clientX,s.clientY,s.timeStamp)}function X(s){if(!Ae(s)||s.target instanceof Node&&o.contains(s.target))return;if(s.isPrimary&&m.size)N();else if(m.size)m.add(s.pointerId),M=!0,k()}function re(s){if(!Ae(s)||M)return;if(y.move(s.pointerId,s.clientX,s.clientY,s.timeStamp)){if(a=!0,!T)o.setPointerCapture(s.pointerId),T=!0;if(s.cancelable)s.preventDefault()}}function ie(s){if(!Ae(s)||!m.has(s.pointerId))return;let z=s.type==="pointercancel";if(z)k();if(A===s.pointerId){if(!z&&!M&&(a||b))C=s.pointerId;if(T&&o.hasPointerCapture(s.pointerId))o.releasePointerCapture(s.pointerId);T=!1,A=null,a=b=!1}if(y.end(s.pointerId,s.timeStamp),m.delete(s.pointerId),!m.size){if(M||z)y.reset();M=!1}w(),g()}function Y(s){let z=s.pointerId;if(s.detail!==0&&C!==null&&(z===C||z===void 0))C=null,s.preventDefault(),s.stopImmediatePropagation()}function Q(s){if(s.ctrlKey||s.defaultPrevented||!(s.target instanceof Element)||Ge(s.target))return;let z=s.deltaMode===1?16:s.deltaMode===2?t.containerSize:1,U=i?s.deltaX:s.deltaY,V=i?s.deltaY:s.deltaX,Z=i?o.scrollHeight>o.clientHeight:o.scrollWidth>o.clientWidth;if(Z&&Math.abs(V)>Math.abs(U))return;if(Z&&V!==0)if(s.preventDefault(),i)o.scrollTop+=V*z;else o.scrollLeft+=V*z;let fe=i&&!Z&&U===0?V:U;if(k(),y.by(fe*z))s.preventDefault();g()}function de(s){if(s.defaultPrevented||s.ctrlKey||s.metaKey||s.altKey||!(s.target instanceof Element)||Ge(s.target))return;if((s.key===" "||s.key==="Enter")&&s.target.closest("button,summary,a,input"))return;let z=e.sizeCache,U=z.getSize(z.indexAtOffset(y.position)),V;if(s.key===(i?"ArrowRight":"ArrowDown"))V=y.position+U;if(s.key===(i?"ArrowLeft":"ArrowUp"))V=y.position-U;if(s.key==="PageDown"||s.key===" ")V=y.position+t.containerSize*(s.shiftKey&&s.key===" "?-1:1);if(s.key==="PageUp")V=y.position-t.containerSize;if(s.key==="Home")V=0;if(s.key==="End")V=v;if(V!==void 0)s.preventDefault(),ee(V)}function se(){if(R.hidden)N()}function ee(s){let z=y.position;if(k(),y.jump(s),z===y.position)W(y.position);g()}function me(s){let z=F!==t.containerSize||h!==t.crossSize,U=s!==t.totalSize||z;if(F=t.containerSize,h=t.crossSize,t.totalSize=s,v=Math.max(0,s+d-t.containerSize),U){if(p=!0,z)k(),y.resize();else y.shiftBy(0);W(y.position),p=!1}}return{setLogical:ee,refresh:me,shiftBy(s){if(t.totalSize=e.sizeCache.getTotalSize(),v=Math.max(0,t.totalSize+d-t.containerSize),y.shiftBy(s),!y.active)g()},cancelScroll(){k(),g()},getLogical:()=>t.scrollPosition,getMaxLogical:()=>v,smoothScrollTo(s,z,U,V=Te,Z){if(k(),y.smooth(s,z,V),P=Z,!y.active)P=void 0,Z?.(),g();else w()},attach(){if(O)return;if(O=!0,o.style.overflowX=i?"hidden":"auto",o.style.overflowY=i?"auto":"hidden",o.style.touchAction=i?"pan-y pinch-zoom":"pan-x pinch-zoom",o.style.overflowAnchor="none",l.style[i?"width":"height"]="100%",l.style.overflow="clip",l.style.overflowAnchor="none",o.addEventListener("pointerdown",K),E.addEventListener("pointerdown",X),o.addEventListener("pointermove",re,{passive:!1}),E.addEventListener("pointerup",ie),E.addEventListener("pointercancel",ie),o.addEventListener("click",Y,!0),e.wheelEnabled)o.addEventListener("wheel",Q,{passive:!1});S.addEventListener("keydown",de),E.addEventListener("blur",N),R.addEventListener("visibilitychange",se),I.addEventListener("change",N),w()},detach(){if(O=!1,N(),H!==null)clearTimeout(H),H=null;o.removeEventListener("pointerdown",K),E.removeEventListener("pointerdown",X),o.removeEventListener("pointermove",re),E.removeEventListener("pointerup",ie),E.removeEventListener("pointercancel",ie),o.removeEventListener("click",Y,!0),o.removeEventListener("wheel",Q),S.removeEventListener("keydown",de),E.removeEventListener("blur",N),R.removeEventListener("visibilitychange",se),I.removeEventListener("change",N),o.style.overflowX=o.style.overflowY=o.style.touchAction=o.style.overflowAnchor="",l.style.overflow=l.style.overflowAnchor=""}}}function Gn(e,t=[]){return zt(e,t,Rt)}export{Gn as createVList};
|
|
1
|
+
var Ae=3,ct="vlist";var fe=150;var we=(e)=>e<0.5?2*e*e:1-(-2*e+2)**2/2,mt=300;var ze="__placeholder_";function ft(e){let{state:t,viewport:o,isX:i,onFrame:r,onIdle:c}=e,l=e.idleTimeout||fe,u=null,g=null;function w(T=i?o.scrollLeft:o.scrollTop){t.prevScrollPosition=t.scrollPosition,t.scrollPosition=T,t.scrollDirection=T>t.prevScrollPosition?1:T<t.prevScrollPosition?-1:0,r(),C()}function C(){if(u!==null)clearTimeout(u);u=setTimeout(()=>{u=null,t.scrollDirection=0,c()},l)}function E(){if(g!==null)cancelAnimationFrame(g),g=null}function h(T,k,_,p=we,B){E();let S=t.scrollPosition,R=typeof T==="function"?T:()=>T,M=R();if(Math.abs(M-S)<1){if(_)_(M);else if(i)o.scrollLeft=M;else o.scrollTop=M;B?.();return}let a=performance.now();function v(H){M=R();let P=H-a,I=Math.min(P/k,1),f=S+(M-S)*p(I);if(_)_(f);else if(i)o.scrollLeft=f;else o.scrollTop=f;if(!_)w(f);if(I<1)g=requestAnimationFrame(v);else g=null,B?.()}g=requestAnimationFrame(v)}return{attach(){},detach(){if(E(),u!==null)clearTimeout(u),u=null},cancelScroll:E,smoothScrollTo:h,commitScroll:w}}var Me={top:0,right:0,bottom:0,left:0},pt=(e)=>{if(e==null)return Me;if(typeof e==="number")return e===0?Me:{top:e,right:e,bottom:e,left:e};if(e.length===2){let[c,l]=e;return c===0&&l===0?Me:{top:c,right:l,bottom:c,left:l}}let[t,o,i,r]=e;return t===0&&o===0&&i===0&&r===0?Me:{top:t,right:o,bottom:i,left:r}},bt=(e,t)=>t?e.left+e.right:e.top+e.bottom,vt=(e,t)=>t?e.top+e.bottom:e.left+e.right;function gt(e){let t={visibleIndices:new Int32Array(e),visibleOffsets:new Float64Array(e),visibleSizes:new Float64Array(e),visibleCount:0,startIndex:0,totalSize:0,capacity:e,scrollPosition:0,prevScrollPosition:0,scrollDirection:0,baseOffset:0,prevBaseOffset:0,containerSize:0,crossSize:0,totalItems:0,prevRangeStart:0,prevRangeEnd:-1,renderPending:!1,initialized:!1,destroyed:!1,windowClamped:!1,windowClampReported:!1,prevAriaTotal:-1,ensureCapacity(o){if(o<=t.capacity)return;let i=o+8,r=new Int32Array(i),c=new Float64Array(i),l=new Float64Array(i);r.set(t.visibleIndices),c.set(t.visibleOffsets),l.set(t.visibleSizes),t.visibleIndices=r,t.visibleOffsets=c,t.visibleSizes=l,t.capacity=i},resizeCapacity(o,i,r=Ae){if(i<=0||o<=0)return;t.ensureCapacity(Math.ceil(o/i)+r*2)},clear(){t.visibleCount=0,t.startIndex=0}};return t}var Ft=(e,t,o)=>{let i=t;return{getOffset:(r)=>r*e,getSize:(r)=>e,indexAtOffset:(r)=>{if(i===0||e===0)return 0;return Math.max(0,Math.min(Math.floor(r/e),i-1))},getTotalSize:()=>{let r=i*e;return r>0?r-o:0},getTotal:()=>i,rebuild:(r)=>{i=r},isVariable:()=>!1}},Dt=(e,t,o)=>{let i=t,r=new Float64Array(0),c=(u)=>{i=u,r=new Float64Array(u+1),r[0]=0;for(let g=0;g<u;g++)r[g+1]=r[g]+e(g)};c(t);let l=(u)=>{if(i===0)return 0;if(u<=0)return 0;if(u>=r[i])return i-1;let g=0,w=i-1;while(g<w){let C=g+w+1>>>1;if(r[C]<=u)g=C;else w=C-1}return g};return{getOffset:(u)=>{if(u<=0)return 0;if(u>=i)return r[i];return r[u]},getSize:(u)=>e(u),indexAtOffset:(u)=>l(u),getTotalSize:()=>{let u=r[i]??0;return u>0?u-o:0},getTotal:()=>i,rebuild:(u)=>c(u),isVariable:()=>!0}},_e=(e,t,o=0)=>{if(typeof e==="number")return Ft(e,t,o);return Dt(e,t,o)};function ht(e){let t=[],o=`${e}-item`,i=document.createElement("div");return i.className=o,{acquire(){if(t.length>0)return t.pop();return i.cloneNode(!1)},release(r){if(r.className=o,r.removeAttribute("style"),r.removeAttribute("id"),r.removeAttribute("role"),r.removeAttribute("aria-selected"),r.removeAttribute("aria-posinset"),r.removeAttribute("aria-setsize"),r.removeAttribute("data-index"),r.removeAttribute("data-id"),r.textContent="",t.length<100)t.push(r)},get size(){return t.length},clear(){t.length=0}}}function Ke(e){let t=e.querySelectorAll("a[href],button,input,select,textarea,[tabindex]");for(let o=0;o<t.length;o++)t[o].setAttribute("tabindex","-1")}function Ue(e){if(typeof e==="string"){let t=document.querySelector(e);if(!t)throw Error(`[vlist] Container not found: ${e}`);return t}return e}function St(e,t,o,i){let r=o?`${t} ${t}--horizontal`:t,c=o?"overflow-x:auto;overflow-y:hidden;height:100%;width:100%":"overflow:auto;height:100%;width:100%",l=o?"position:relative;height:100%;overflow-anchor:none":"position:relative;width:100%;overflow-anchor:none",u=' role="list"';if(i)u+=` aria-label="${i.replace(/"/g,""")}"`;if(o)u+=' aria-orientation="horizontal"';e.insertAdjacentHTML("beforeend",`<div class="${r}"><div class="${t}-viewport" style="${c}" tabindex="-1"><div class="${t}-content" style="${l}"${u}></div></div></div>`);let g=e.lastElementChild,w=g.firstElementChild,C=w.firstElementChild,E=document.createElement("div");return E.className=`${t}-live`,E.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",E.setAttribute("aria-live","polite"),E.setAttribute("aria-atomic","true"),E.setAttribute("role","status"),g.appendChild(E),{root:g,viewport:w,content:C,liveRegion:E}}function Nt(e,t){if(e.getTotal()<=0)return{index:0,offsetPx:0};let i=t<=0?0:t,r=e.indexAtOffset(i),c=i-e.getOffset(r);return{index:r,offsetPx:c>0?c:0}}function Bt(e,t){let o=$t(e,t);return e.getOffset(o.index)+o.offsetPx}function $t(e,t){let o=e.getTotal();if(o<=0)return{index:0,offsetPx:0};let{index:i,offsetPx:r}=t;if(i<0)return{index:0,offsetPx:0};if(i>o-1)i=o-1;while(r>0&&i<o-1){let c=e.getSize(i);if(r<c)break;r-=c,i++}while(r<0&&i>0)i--,r+=e.getSize(i);if(r<0)r=0;return{index:i,offsetPx:r}}function xt(e){let{sizeCache:t,getPixel:o,setPixel:i,getContainerSize:r}=e;function c(){let u=t.getTotalSize()+e.padding-r();return u>0?u:0}function l(u){if(u<=0)return 0;let g=c();return u>g?g:u}return{getLogical(){return Nt(t,o())},setLogical(u){i(l(Bt(t,u)))},getPixelEquivalent(){return o()},setPixelEquivalent(u){i(l(u))},getMaxPixelEquivalent:c,getRenderOrigin:e.getRenderOrigin,scrollByPx(u){i(l(o()+u))}}}var Ee=[],Kt={calculate:Ee,commit:Ee,afterScroll:Ee,idle:Ee,resize:Ee};function yt(e){if(e.length===0)return Kt;let t=[],o=[],i=[],r=[],c=[];for(let l=0;l<e.length;l++){let u=e[l].hooks;if(u===void 0)continue;if(u.onCalculate!==void 0)t.push(u.onCalculate);if(u.onCommit!==void 0)o.push(u.onCommit);if(u.onAfterScroll!==void 0)i.push(u.onAfterScroll);if(u.onIdle!==void 0)r.push(u.onIdle);if(u.onResize!==void 0)c.push(u.onResize)}return{calculate:t,commit:o,afterScroll:i,idle:r,resize:c}}function Et(e,t){for(let o=0;o<e.length;o++)e[o](t)}function Ie(e,t){for(let o=0;o<e.length;o++)e[o](t)}function Ge(e,t,o){for(let i=0;i<e.length;i++)e[i](t,o)}function It(e){for(let t=0;t<e.length;t++)e[t]()}function Tt(e,t,o){for(let i=0;i<e.length;i++)e[i](t,o)}function Lt(e,t,o,i,r,c,l,u){let g=i!==0||r!==0;return{prefix:e,selectedClass:`${e}-item--selected`,focusedClass:`${e}-item--focused`,placeholderClass:`${e}-item--placeholder`,replacedClass:`${e}-item--replaced`,translateProp:t?"translateX(":"translateY(",sizeProp:t?"width":"height",itemRole:"listitem",interactive:!1,startPadding:o,gap:l,hasCrossPad:g,crossStartProp:g?t?"top":"left":"",crossEndProp:g?t?"bottom":"right":"",crossStartVal:g?i+"px":"",crossEndVal:g?r+"px":"",oddClass:c,emitter:u??null,indexMap:null,ariaTotalFn:null}}function Ut(e,t,o,i,r){if(e.containerSize<=0||e.totalItems===0)return e.clear(),!0;let{scrollPosition:c,containerSize:l,totalItems:u}=e,g=r??0;e.totalSize=t.getTotalSize();let w=t.indexAtOffset(g>0?Math.max(0,c-g):c),C=t.indexAtOffset(c+l);if(C<u-1)C++;w=Math.max(0,w),C=Math.min(u-1,Math.max(0,C));let E=Math.max(0,w-o),h=Math.min(u-1,C+o),T=Math.ceil(l)+o*2;if(h-E+1>T)h=E+T-1,e.windowClamped=!0;let k=h-E+1;if(k>e.capacity)e.ensureCapacity(k);let _=Math.min(k,e.capacity);if(E===e.prevRangeStart&&h===e.prevRangeEnd&&!e.renderPending&&e.baseOffset===e.prevBaseOffset)return!1;e.visibleCount=_,e.startIndex=E;for(let p=0;p<_;p++){let B=E+p;e.visibleIndices[p]=B,e.visibleOffsets[p]=t.getOffset(B),e.visibleSizes[p]=t.getSize(B)}return Et(i.calculate,e),e.prevRangeStart=E,e.prevRangeEnd=h,e.prevBaseOffset=e.baseOffset,e.renderPending=!1,!0}var W={selected:!1,focused:!1};function Gt(e,t,o){for(let i=0;i<t;i++)if(e[i]===o)return!0;return!1}function Wt(e,t){if(t<=1)return!0;let o=e[0];for(let i=1;i<t;i++){let r=e[i];if(r!==o+1)return!1;o=r}return!0}function Xt(e,t,o,i,r,c,l,u,g,w){let C=g?null:r(),{visibleCount:E,visibleIndices:h}=e,T=l.ariaTotalFn?l.ariaTotalFn():e.totalItems,k=l.interactive?String(T):"",_=l.interactive&&T!==e.prevAriaTotal,p=null,B=l.indexMap;for(let S=0;S<E;S++){let R=h[S],M=B?B(R):R,a=e.visibleOffsets[S],v=e.visibleSizes[S],H=g?g(R):C[R];if(w)w(M,W);else W.selected=!1,W.focused=!1;let P=c.get(R),I=P;if(P===void 0){let f=t.acquire();if(H!==void 0){let y;try{y=i(H,M,W)}catch(F){if(l.emitter)l.emitter.emit("error",{error:F instanceof Error?F:Error(String(F)),context:`template:render:${M}`});t.release(f);continue}if(typeof y==="string")f.innerHTML=y;else f.textContent="",f.appendChild(y);Ke(f)}if(f.setAttribute("role",l.itemRole),f.setAttribute("data-index",String(M)),l.interactive)f.id=l.prefix+"-item-"+R,f.setAttribute("aria-posinset",String(M+1)),f.setAttribute("aria-setsize",k);if(H!==void 0){let y=String(H.id);if(f.setAttribute("data-id",y),y.startsWith(ze))f.classList.add(l.placeholderClass)}if(l.hasCrossPad)f.style.setProperty(l.crossStartProp,l.crossStartVal),f.style.setProperty(l.crossEndProp,l.crossEndVal);if(w){if(f.classList.toggle(l.selectedClass,W.selected),f.classList.toggle(l.focusedClass,W.focused),W.selected)f.setAttribute("aria-selected","true");else f.removeAttribute("aria-selected");f._lastSelected=W.selected,f._lastFocused=W.focused}if(l.oddClass)f.classList.toggle(l.oddClass,(R&1)===1);let K=a-e.baseOffset+l.startPadding;f.style.transform=l.translateProp+K+"px)",f._lastOffset=K;let b=v-l.gap;if(f.style[l.sizeProp]=b+"px",f._lastSize=b,f._lastItem=H,c.set(R,f),p===null)p=document.createDocumentFragment();p.appendChild(f)}else{if(_)P.setAttribute("aria-setsize",k);if(H!==void 0&&I._lastItem!==H){let b=P.getAttribute("data-id"),y=String(H.id),F;try{F=i(H,M,W)}catch(O){if(l.emitter)l.emitter.emit("error",{error:O instanceof Error?O:Error(String(O)),context:`template:render:${M}`});continue}if(typeof F==="string")P.innerHTML=F;else P.textContent="",P.appendChild(F);if(Ke(P),P.setAttribute("data-id",y),I._lastItem=H,b!==y){let O=b!==null&&b.startsWith(ze),N=y.startsWith(ze);if(O!==N)P.classList.toggle(l.placeholderClass,N);if(O&&!N)P.classList.add(l.replacedClass),setTimeout(()=>{P.classList.remove(l.replacedClass)},300)}}if(w){if(I._lastSelected!==W.selected){if(P.classList.toggle(l.selectedClass,W.selected),W.selected)P.setAttribute("aria-selected","true");else P.removeAttribute("aria-selected");I._lastSelected=W.selected}if(I._lastFocused!==W.focused)P.classList.toggle(l.focusedClass,W.focused),I._lastFocused=W.focused}let f=a-e.baseOffset+l.startPadding;if(I._lastOffset!==f)P.style.transform=l.translateProp+f+"px)",I._lastOffset=f;let K=v-l.gap;if(I._lastSize!==K)P.style[l.sizeProp]=K+"px",I._lastSize=K}}if(p!==null)o.appendChild(p);if(E>0&&Wt(h,E)){let S=h[0],R=h[E-1];for(let[M,a]of c)if(M<S||M>R)a.remove(),t.release(a),c.delete(M)}else for(let[S,R]of c)if(!Gt(h,E,S))R.remove(),t.release(R),c.delete(S);if(l.interactive)e.prevAriaTotal=e.totalItems;Ie(u.commit,e)}function We(e,t,o,i,r,c,l,u,g,w,C,E){let h=Ut(e,t,o,w,g.startPadding);if(e.windowClamped&&!e.windowClampReported)e.windowClampReported=!0,queueMicrotask(()=>{if(e.destroyed)return;g.emitter?.emit("error",{error:Error("[vlist] render window capped to the viewport: the item size spec reports sizes below 1px"),context:"render:window-ceiling"})});if(h)Xt(e,i,r,c,l,u,g,w,C,E)}var Xe=()=>{let e={},t=(c,l)=>{if(!e[c])e[c]=new Set;return e[c].add(l),()=>o(c,l)},o=(c,l)=>{e[c]?.delete(l)};return{on:t,off:o,emit:(c,l)=>{e[c]?.forEach((u)=>{try{u(l)}catch(g){}})},clear:(c)=>{if(c)delete e[c];else for(let l in e)delete e[l]}}};var Ct=2,Pt=(e=0)=>({velocity:0,sampleCount:0}),At=(e,t)=>{let o=performance.now(),i=e._lt??o,r=e._lp??t,c=o-i;if(e._lp=t,e._lt=o,c===0)return e.sampleCount=Math.min(e.sampleCount+1,5),e;if(c>100)return e.velocity=0,e.sampleCount=1,e;return e.velocity=Math.abs(t-r)/c,e.sampleCount=Math.min(e.sampleCount+1,5),e};function qt(e){let{item:t}=e;if(t.height!==void 0&&typeof t.height==="number"){if(!Number.isFinite(t.height)||t.height<=0)throw Error(`vlist: item.height must be a positive number, got ${t.height}`)}if(t.width!==void 0&&typeof t.width==="number"){if(!Number.isFinite(t.width)||t.width<=0)throw Error(`vlist: item.width must be a positive number, got ${t.width}`)}if(t.estimatedHeight!==void 0){if(!Number.isFinite(t.estimatedHeight)||t.estimatedHeight<=0)throw Error(`vlist: item.estimatedHeight must be a positive number, got ${t.estimatedHeight}`)}if(t.estimatedWidth!==void 0){if(!Number.isFinite(t.estimatedWidth)||t.estimatedWidth<=0)throw Error(`vlist: item.estimatedWidth must be a positive number, got ${t.estimatedWidth}`)}if(t.gap!==void 0){if(typeof t.gap!=="number"||!Number.isFinite(t.gap)||t.gap<0)throw Error(`vlist: item.gap must be a non-negative number, got ${t.gap}`)}if(e.overscan!==void 0){if(typeof e.overscan!=="number"||!Number.isFinite(e.overscan)||e.overscan<0)throw Error(`vlist: overscan must be a non-negative number, got ${e.overscan}`)}let o=e.scroll;if(o?.mode!==void 0||o?.runway!==void 0)throw Error('vlist 3.0: scroll.mode and scroll.runway were removed; bounded mode is gone. Use "vlist/synthetic" for huge lists or "vlist" for native scrolling.')}function Yt(e,t){let o=e==="horizontal"?"x":"y";if(t.some((r)=>r.name==="grid"))return{primary:o,cross:o==="x"?"y":"x"};return{primary:o}}function Zt(e,t){let o=Yt(e.orientation,t),i=o.primary==="x",r=pt(e.padding);return{axis:o,hasCrossAxis:o.cross!==void 0,overscan:e.overscan??Ae,reverse:e.reverse??!1,classPrefix:e.classPrefix??ct,mainAxisPadding:bt(r,i),crossAxisPadding:vt(r,i),startPadding:i?r.left:r.top,endPadding:i?r.right:r.bottom,crossPadStart:i?r.top:r.left,crossPadEnd:i?r.bottom:r.right,striped:e.item.striped||!1,gap:e.item.gap??0}}function jt(e,t){if(t)return e.item.width??e.item.estimatedWidth??100;return e.item.height??e.item.estimatedHeight??40}function Jt(e){let t=[...e];return t.sort((o,i)=>(o.priority??50)-(i.priority??50)),t}function Qt(e){let t=new Set;for(let o of e){if(t.has(o.name))throw Error(`[vlist] Duplicate plugin: ${o.name}`);t.add(o.name)}for(let o of e)if(o.conflicts){for(let i of o.conflicts)if(t.has(i))throw Error(`[vlist] Plugin "${o.name}" conflicts with "${i}"`)}}function en(e,t){for(let o of e)o.validateConfig?.(t)}function wt(e,t=[],o,i){if(qt(e),o&&typeof e.scroll?.scrollbar==="string")throw Error('vlist 3.0: scroll.scrollbar strings require "vlist"; use the scrollbar() plugin with "vlist/synthetic".');if(e.orientation==="horizontal"&&getComputedStyle(Ue(e.container)).direction==="rtl")throw Error("vlist: horizontal RTL lists are not supported; use a vertical list, or an LTR container");let r=Zt(e,t),c=r.axis.primary==="x",l=jt(e,c),u=r.gap,g=u>0?typeof l==="function"?(d)=>l(d)+u:l+u:l,w=typeof l==="number"?l:20,C=e.items?.length??0,E=r.striped?`${r.classPrefix}-item--odd`:"",h=Xe(),T=Lt(r.classPrefix,c,r.startPadding,r.crossPadStart,r.crossPadEnd,E,u,h),k=t.length>0?Jt(t):t;if(t.length>0)Qt(k),en(k,r);let _=Ue(e.container),p=St(_,r.classPrefix,c,e.ariaLabel);if(e.scroll?.scrollbar==="none")p.viewport.classList.add(`${r.classPrefix}-viewport--no-scrollbar`);if(e.scroll?.gutter==="stable")p.viewport.classList.add(`${r.classPrefix}-viewport--gutter-stable`);let S=_e(g,C,u),R=ht(r.classPrefix),M=Math.ceil(4096/w)+r.overscan*2+8,a=gt(M);a.totalItems=C;let v=e.items?[...e.items]:[],H=()=>v,P=new Map,I=Pt(),f={velocity:0,reliable:!1},K={range:{start:0,end:-1}},b={scrollPosition:0,direction:"down"},y={scrollPosition:0},F=-1,O=-1,N=-1,Z=null,x=yt(k),A=new Map,X=[],le=[],pe=[],J=null,j=null,be,ae,ee=null,ue=null,Y=null,de=null,s=null,z=null,G=null,D=null,U=!1,Te=!1,ve=null,Ye=0,Ze=0,je=null,Je=null,Qe=null,He=null,Oe=null,Ve=null,Le=null,Q=null,ge=null,et=null;a.containerSize=c?p.viewport.clientWidth:p.viewport.clientHeight,a.crossSize=c?p.viewport.clientHeight:p.viewport.clientWidth;function he(d){if(j)j(d);else{if(c)p.viewport.scrollLeft=d;else p.viewport.scrollTop=d;ae?.()}}let tt=xt({sizeCache:S,getPixel:()=>a.scrollPosition,setPixel:he,getRenderOrigin:()=>a.baseOffset,getContainerSize:()=>a.containerSize,padding:r.mainAxisPadding});if(t.length>0){let d={pool:R,config:r,emitter:h,template:e.item.template,getState(){return a},dom:{...p,renderedElement(n){let m=A.get("_getRenderedElement");if(m)return m(n);return P.get(n)??null},enableListbox(){let n=p.content.getAttribute("role");if(!n||n==="list")p.content.setAttribute("role","listbox"),p.content.setAttribute("tabindex","0");T.itemRole="option",T.interactive=!0}},scroll:{...tt,to:he,shiftBy(n){if(Q?.shiftBy)Q.shiftBy(n);else d.scroll.to(a.scrollPosition+n)},smoothTo(n,m,L,V){if(He)He(n,m,j??void 0,L,V);else d.scroll.to(typeof n==="function"?n():n)},cancel(){se?.cancelScroll()},commit(n){ae(n)},setSource(n){j=n.write,be=n.onContentSize,U=!0},setTarget(n){ve=n},setBoundedWrap(n,m){ge=n,et=m},setToPosFn(n){Oe=n},setToIndexFn(n){Ve=n},onFrame:De,onIdle:Ce,disableResize(){Te=!0}},items:{all:H,at(n){return Y?Y(n):v[n]},removeById(n){if(s)return s(n);let m=v.findIndex((L)=>L.id===n);if(m===-1)return-1;return v.splice(m,1),a.totalItems=v.length,S.rebuild(a.totalItems),te(),m},insertAt(n,m){if(z){z(n,m);return}v.splice(m,0,n),a.totalItems=v.length,S.rebuild(a.totalItems),te()},setGetFn(n){Y=n},setRemoveFn(n){s=n},setInsertFn(n){z=n},setUpdateFn(n){G=n},setIndexByIdFn(n){D=n},setTotalFn(n){J=n,T.ariaTotalFn=n},setIndexMapFn(n){T.indexMap=n}},sizes:{cache:S,get rawSpec(){return l},setConfig(n,m=0){let L=_e(n,a.totalItems,m),V=A.get("_setSizeCacheBase");if(V){let q=S.rebuild;Object.assign(S,L),S.rebuild=q,V(L.rebuild)}else Object.assign(S,L)},rebuild(){S.rebuild(a.totalItems)}},render:{force(){ne()},ifNeeded(){Se()},contentSize:ot,setFn(n,m){ee=()=>{let{prevRangeStart:L,prevRangeEnd:V}=a;if(n(),a.prevRangeStart!==L||a.prevRangeEnd!==V)Ie(x.commit,a)},ue=()=>{m(),Ie(x.commit,a)}},setStateFn(n){de=n},getStateFn(){return de}},hooks:{method(n,m){if(!n.startsWith("_")&&A.has(n))throw Error(`[vlist] duplicate method "${n}"; rename it or use a set*Fn hook`);A.set(n,m)},get(n){return A.get(n)},onClick(n){X.push(n)},onKeydown(n){le.push(n)},onDestroy(n){pe.push(n)}},nav:{set(n){if(n.ud!==void 0)Ye=n.ud;if(n.lr!==void 0)Ze=n.lr;if(n.scrollIndex)je=n.scrollIndex;if(n.navigate)Je=n.navigate;if(n.total)Qe=n.total},get:(()=>{let n={ud:0,lr:0,scrollIndex:null,navigate:null,total:null};return()=>(n.ud=Ye,n.lr=Ze,n.scrollIndex=je,n.navigate=Je,n.total=Qe,n)})()}};for(let n of k)if(n.setup)try{n.setup(d)}catch(m){let L=m instanceof Error?m:Error(String(m));h.emit("error",{error:L,context:`plugin:setup:${n.name}`})}}let ke=r.classPrefix+"--scrolling",ce=!1,Fe=e.scroll?.idleTimeout??fe;function nt(){if(b.scrollPosition=a.scrollPosition,c)b.direction=a.scrollDirection>0?"right":"left";else b.direction=a.scrollDirection>0?"down":"up";if(h.emit("scroll",b),At(I,a.scrollPosition),f.velocity=I.velocity,f.reliable=I.sampleCount>=Ct,h.emit("velocity:change",f),a.startIndex!==F||a.prevRangeEnd!==O)F=a.startIndex,O=a.prevRangeEnd,K.range.start=a.startIndex,K.range.end=a.prevRangeEnd,h.emit("range:change",K)}function ot(d,n=!0){if(Q){if(n)Q.refresh(d);return}a.totalSize=d;let m=d+r.mainAxisPadding;if(be?.(m),n)p.content.style[c?"width":"height"]=m+"px"}function te(){let d=ee?a.totalSize:S.getTotalSize();if(ot(d,!ee),Q||ee)return;i?.onContentSize(d,h)}function rt(){if(!Le)return;if((J?J():v.length)===0)return;let n=Le;Le=null,$e.scrollToIndex(n.index,n.alignOrOptions)}function Se(){if(ee)ee();else We(a,S,r.overscan,R,p.content,e.item.template,H,P,T,x,Y,de);rt()}function De(){if(!ce)ce=!0,p.root.classList.add(ke);if(Se(),Ge(x.afterScroll,a.scrollPosition,a.scrollDirection),a.scrollPosition!==N)N=a.scrollPosition,nt()}function Ce(){if(ce)ce=!1,p.root.classList.remove(ke);a.scrollDirection=0,It(x.idle),f.velocity=0,f.reliable=!1,h.emit("velocity:change",f),y.scrollPosition=a.scrollPosition,h.emit("scroll:idle",y)}function ne(){if(a.renderPending=!0,ue)ue();else We(a,S,r.overscan,R,p.content,e.item.template,H,P,T,x,Y,de);if(rt(),Ge(x.afterScroll,a.scrollPosition,a.scrollDirection),a.scrollPosition!==N){if(N=a.scrollPosition,nt(),Z!==null)clearTimeout(Z);Z=setTimeout(Ce,Fe)}}let it=U?!1:e.scroll?.wheel!==!1,se;if(U&&ge)throw Error("vlist: page() is not compatible with the carousel plugin — bounded page-mode scrolling is not implemented yet.");if(!U&&(o||ge))Q=(o??et)({state:a,sizeCache:S,viewport:p.viewport,content:p.content,isX:c,wheelEnabled:it,idleTimeout:Fe,...ve?{scrollTarget:ve}:{},mainAxisPadding:r.mainAxisPadding,...ge?{wrap:ge,onFold(d){let n=I;if(n._lp!==void 0)n._lp-=d;N-=d}}:{},onFrame:De,onIdle:Ce}),se=Q,j=(d)=>Q.setLogical(d);else{let d=(U?ft:i.native)({state:a,viewport:p.viewport,isX:c,wheelEnabled:it,idleTimeout:Fe,...ve?{scrollTarget:ve}:{},onFrame:De,onIdle:Ce});se=d,ae=d.commitScroll}He=se.smoothScrollTo;function Ne(d){let m=d.target.closest("[data-index]");if(!m)return null;let L=parseInt(m.getAttribute("data-index"),10);if(Number.isNaN(L))return null;let V=A.get("_layoutToDataIndex"),q,re=L;if(V){let oe=V(L);if(oe<0)return null;let me=A.get("_getItemAtLayout"),ye=A.get("_getItem");q=me?me(L):ye?ye(oe):Y?Y(oe):v[oe],re=oe}else q=Y?Y(L):v[L];if(q===void 0)return null;return{item:q,index:re}}function lt(d){for(let m=0;m<X.length;m++)X[m](d);let n=Ne(d);if(n)h.emit("item:click",{item:n.item,index:n.index,event:d})}function st(d){let n=Ne(d);if(n)h.emit("item:dblclick",{item:n.item,index:n.index,event:d})}function at(d){let n=Ne(d);if(n)h.emit("item:contextmenu",{item:n.item,index:n.index,event:d})}function ut(d){let n=d.target?.tagName;if((n==="INPUT"||n==="TEXTAREA"||n==="SELECT")&&!((d.ctrlKey||d.metaKey)&&(d.key==="f"||d.key==="F")))return;for(let m=0;m<le.length;m++)le[m](d)}if(p.content.addEventListener("click",lt),p.content.addEventListener("dblclick",st),p.content.addEventListener("contextmenu",at),le.length>0)p.root.addEventListener("keydown",ut);let Be=null;if(!Te)setTimeout(()=>{if(a.destroyed)return;Be=new ResizeObserver((n)=>{for(let m of n){let{width:L,height:V}=m.contentRect,q=c?L:V,re=c?V:L;if(Math.abs(q-a.containerSize)<1&&Math.abs(re-a.crossSize)<1)continue;if(a.containerSize=q,a.crossSize=re,a.resizeCapacity(q,w,r.overscan),Q)Q.refresh(S.getTotalSize());ne(),Tt(x.resize,L,V),h.emit("resize",{width:L,height:V})}}),Be.observe(p.viewport)},0);a.resizeCapacity(a.containerSize,w,r.overscan),te(),a.initialized=!0;let xe=null;if(e.defer)xe=requestAnimationFrame(()=>{if(xe=null,!a.destroyed)Se()});else Se();if(!U)se.attach();let $e={get element(){return p.root},get items(){return v},get total(){return J?J():v.length},setItems(d){v=[...d],a.totalItems=v.length,S.rebuild(a.totalItems),te(),ne()},appendItems(d){let n=()=>Math.max(0,S.getTotalSize()+r.mainAxisPadding-a.containerSize),m=r.reverse&&a.scrollPosition>=n()-1;if(v.push(...d),a.totalItems=v.length,S.rebuild(a.totalItems),te(),ne(),m)he(n())},prependItems(d){let n=a.totalItems>0,m=S.getTotalSize();if(v.unshift(...d),a.totalItems=v.length,S.rebuild(a.totalItems),te(),ne(),!r.reverse||!n)return;let L=S.getTotalSize()-m;if(L<=0)return;let V=Math.max(0,S.getTotalSize()+r.mainAxisPadding-a.containerSize);he(Math.min(a.scrollPosition+L,V))},updateItem(d,n){if(G){if(!G(d,n))return}else{let m=v.findIndex((L)=>L.id===d);if(m===-1)return;v[m]={...v[m],...n}}ne()},insertItem(d,n){if(z)z(d,n??a.totalItems);else{if(n===void 0)v.push(d);else v.splice(n,0,d);a.totalItems=v.length,S.rebuild(a.totalItems),te()}ne()},removeItem(d){if(s){if(s(d)<0)return}else{let n=v.findIndex((m)=>m.id===d);if(n===-1)return;v.splice(n,1),a.totalItems=v.length,S.rebuild(a.totalItems),te()}ne()},removeItems(d){if(s){let V=0;for(let q of d)if(s(q)>=0)V++;if(V>0)ne();return V}let n=new Set(d),m=v.length;v=v.filter((V)=>!n.has(V.id));let L=m-v.length;if(L>0)a.totalItems=v.length,S.rebuild(a.totalItems),te(),a.renderPending=!0,Se();return L},getItemAt(d){if(T.indexMap){let m=A.get("_getLoadedItem");return m?m(d):v[d]}let n=A.get("_getItemAtLayout");if(n){let m=A.get("_dataToLayoutIndex");return n(m?m(d):d)}return Y?Y(d):v[d]},getIndexById(d){if(D)return D(d);return v.findIndex((n)=>n.id===d)},scrollToIndex(d,n="start"){let m=J?J():v.length;if(m===0){Le={index:d,alignOrOptions:n};return}let L=typeof n==="string"?n:n.align??"start",V=typeof n==="object"?n.behavior:void 0,q=typeof n==="object"?n.duration:void 0,re=typeof n==="object"?n.easing:void 0;if(Ve&&Ve(d,L,V,q,re)!==!1)return;let oe=Math.max(0,Math.min(d,m-1)),me=S.getOffset(oe),ye=S.getSize(oe),Pe=a.containerSize,Ot=S.getTotalSize(),dt=r.mainAxisPadding,Vt=Math.max(0,Ot+dt-Pe),ie;if(Oe)ie=Oe(oe,S,Pe,m,L);else{let kt=r.startPadding;switch(L){case"center":ie=kt+me-(Pe-ye)/2;break;case"end":ie=me+ye+dt-Pe;break;default:ie=me}ie=Math.max(0,Math.min(ie,Vt))}if(V==="smooth")se.smoothScrollTo(ie,q??mt,j??void 0,re);else he(ie)},getScrollPosition(){return tt.getPixelEquivalent()},on:h.on.bind(h),off:h.off.bind(h),destroy(){if(a.destroyed)return;if(a.destroyed=!0,ce)ce=!1,p.root.classList.remove(ke);if(xe!==null)cancelAnimationFrame(xe),xe=null;if(Z!==null)clearTimeout(Z),Z=null;se.detach(),Be?.disconnect(),p.content.removeEventListener("click",lt),p.content.removeEventListener("dblclick",st),p.content.removeEventListener("contextmenu",at),p.root.removeEventListener("keydown",ut);let d=[];for(let n of pe)try{n()}catch(m){d.push(m instanceof Error?m:Error(String(m)))}for(let n of k)if(n.destroy)try{n.destroy()}catch(m){d.push(m instanceof Error?m:Error(String(m)))}for(let[,n]of P)n.remove();if(P.clear(),R.clear(),p.root.remove(),h.emit("destroy",void 0),h.clear(),d.length>0)for(let n of d)console.error("vlist: error during destroy:",n)}};for(let[d,n]of A){if(d.startsWith("_"))continue;$e[d]=n}return $e}var Mt=1,_t=2;var zt=(e)=>1-(1-e)**3;function Rt({getMax:e,onChange:t=()=>{},onFinish:o,axis:i="y",reducedMotion:r}){let c=0,l=0,u=null,g=0,w=0,C=0,E=0,h=0,T=null,k=0,_=0,p=0,B=0,S=400,R=zt,M=()=>p,a=0.006,v=(b)=>Math.max(0,Math.min(e(),b)),H=(b,y)=>i==="y"?y:b,P=(b,y)=>i==="y"?b:y;function I(b){let y=v(b);if(y!==c)c=y,t(c);return y!==b}function f(){h=0,l=u===null?0:5}function K(b){f(),I(b)}return{get position(){return c},get state(){return l},get velocity(){return h},get active(){return l===3||l===4},begin(b,y,F,O){if(u!==null){f();return}f(),u=b,g=C=H(y,F),w=P(y,F),E=O,l=1},move(b,y,F,O){if(b!==u||l!==1&&l!==2)return!1;let N=H(y,F);if(l===1){let A=Math.abs(N-g),X=Math.abs(P(y,F)-w);if(Math.max(A,X)<6)return!1;if(X>A*1.2)return f(),!1;if(A<X*1.2)return!1;l=2}let Z=C-N,x=O-E;if(x>0){let A=Math.max(-3,Math.min(3,Z/x));h=x>80?0:A*h<0?A:0.65*A+0.35*h}if(C=N,E=O,I(c+Z))h=0;return!0},end(b,y){if(b!==u)return;if(u=null,l===2&&!r()&&y-E<=80&&Math.abs(h)>=0.02)T=null,l=3;else h=0,l=0},cancel:f,reset(){u=null,f()},jump:K,shiftBy(b){_+=b,B+=b,I(c+b)},by(b){f();let y=c;return I(c+b),c!==y},smooth(b,y=400,F=zt){if(f(),B=0,M=typeof b==="function"?b:()=>b,u!==null||r()||y<=0){I(M());return}S=y,R=F,_=c,p=v(M()+B),T=null,l=4},resize(){f(),I(c)},tick(b){if(l!==3&&l!==4)return;if(T===null){if(T=b,l===4)k=b;return}let y=b-T;if(y<=0)return;if(T=b,y>100){if(l===4)I(v(M()+B)),l=0,o?.();else f();return}if(l===4){p=v(M()+B);let N=Math.min(1,(b-k)/S);if(I(_+(p-_)*R(N)),N===1)l=0,o?.();return}let F=Math.exp(-a*y),O=I(c+h*(1-F)/a);if(h*=F,O||Math.abs(h)<0.02)h=0,l=0}}}var Re=(e)=>e.pointerType==="touch"||e.pointerType==="pen";function qe(e){if(e.closest("textarea,select,[contenteditable]:not([contenteditable=false])"))return!0;let t=e.closest("input");return!!t&&!/^(button|submit|reset|checkbox|radio|image)$/.test(t.type)}function Ht(e){let{state:t,viewport:o,content:i,isX:r,onFrame:c,onIdle:l,mainAxisPadding:u,wrap:g}=e,w=o.parentElement??o,C=o.ownerDocument.defaultView,E=o.ownerDocument,h=C.matchMedia("(prefers-reduced-motion: reduce)"),T=0,k=null,_=null,p=!1,B=!1,S=!1,R=-1,M=-1,a=null,v=null,H=!1,P=!1,I=!1,f=!1,K,b=new Set;function y(s){let z=t.scrollPosition;if(g){let G=g.lapSize(),D=G>0?Math.trunc((s-g.home())/G):0;if(D!==0&&Math.abs(D)>=g.thresholdLaps){let U=D*G;S=!0,x.shiftBy(-U),S=!1,s=x.position,z-=U,e.onFold?.(U),g.onFold?.(U)}}if(t.prevScrollPosition=z,t.scrollPosition=t.baseOffset=s,t.scrollDirection=s>z?1:s<z?-1:0,!B)c()}function F(){if(_=null,x.active||x.state===_t||x.state===Mt)return;t.scrollDirection=0,l()}function O(){if(!p)return;if(_!==null)clearTimeout(_);_=setTimeout(F,e.idleTimeout||fe)}function N(){if(p&&k===null&&x.active)k=requestAnimationFrame(Z)}function Z(s){if(k=null,x.tick(s),x.active)N();else O()}let x=Rt({axis:r?"x":"y",getMax:()=>T,reducedMotion:()=>h.matches,onChange(s){if(!S)y(s)},onFinish(){let s=K;K=void 0,s?.()}});function A(){if(K=void 0,k!==null)cancelAnimationFrame(k),k=null;if(x.cancel(),_!==null)clearTimeout(_),_=null}function X(){if(A(),x.reset(),f&&a!==null&&o.hasPointerCapture(a))o.releasePointerCapture(a);f=!1,b.clear(),a=v=null,H=P=I=!1,O()}function le(s){if(!Re(s))return;if(s.isPrimary){if(b.size)X();b.clear()}if(b.add(s.pointerId),b.size>1){I=!0,A();return}if(!(s.target instanceof Element)||qe(s.target)){A();return}a=s.pointerId,H=!1,P=x.active,v=null,A(),x.begin(s.pointerId,s.clientX,s.clientY,s.timeStamp)}function pe(s){if(!Re(s)||s.target instanceof Node&&o.contains(s.target))return;if(s.isPrimary&&b.size)X();else if(b.size)b.add(s.pointerId),I=!0,A()}function J(s){if(!Re(s)||I)return;if(x.move(s.pointerId,s.clientX,s.clientY,s.timeStamp)){if(H=!0,!f)o.setPointerCapture(s.pointerId),f=!0;if(s.cancelable)s.preventDefault()}}function j(s){if(!Re(s)||!b.has(s.pointerId))return;let z=s.type==="pointercancel";if(z)A();if(a===s.pointerId){if(!z&&!I&&(H||P))v=s.pointerId;if(f&&o.hasPointerCapture(s.pointerId))o.releasePointerCapture(s.pointerId);f=!1,a=null,H=P=!1}if(x.end(s.pointerId,s.timeStamp),b.delete(s.pointerId),!b.size){if(I||z)x.reset();I=!1}N(),O()}function be(s){let z=s.pointerId;if(s.detail!==0&&v!==null&&(z===v||z===void 0))v=null,s.preventDefault(),s.stopImmediatePropagation()}function ae(s){if(s.ctrlKey||s.defaultPrevented||!(s.target instanceof Element)||qe(s.target))return;let z=s.deltaMode===1?16:s.deltaMode===2?t.containerSize:1,G=r?s.deltaX:s.deltaY,D=r?s.deltaY:s.deltaX,U=r?o.scrollHeight>o.clientHeight:o.scrollWidth>o.clientWidth;if(U&&Math.abs(D)>Math.abs(G))return;if(U&&D!==0)if(s.preventDefault(),r)o.scrollTop+=D*z;else o.scrollLeft+=D*z;let Te=r&&!U&&G===0?D:G;if(A(),x.by(Te*z))s.preventDefault();O()}function ee(s){if(s.defaultPrevented||s.ctrlKey||s.metaKey||s.altKey||!(s.target instanceof Element)||qe(s.target))return;if((s.key===" "||s.key==="Enter")&&s.target.closest("button,summary,a,input"))return;let z=e.sizeCache,G=z.getSize(z.indexAtOffset(x.position)),D;if(s.key===(r?"ArrowRight":"ArrowDown"))D=x.position+G;if(s.key===(r?"ArrowLeft":"ArrowUp"))D=x.position-G;if(s.key==="PageDown"||s.key===" ")D=x.position+t.containerSize*(s.shiftKey&&s.key===" "?-1:1);if(s.key==="PageUp")D=x.position-t.containerSize;if(s.key==="Home")D=0;if(s.key==="End")D=T;if(D!==void 0)s.preventDefault(),Y(D)}function ue(){if(E.hidden)X()}function Y(s){let z=x.position;if(A(),x.jump(s),z===Math.max(0,Math.min(T,s)))y(x.position);O()}function de(s){let z=R!==t.containerSize||M!==t.crossSize,G=s!==t.totalSize||z;if(R=t.containerSize,M=t.crossSize,t.totalSize=s,T=Math.max(0,s+u-t.containerSize),G){if(B=!0,z)A(),x.resize();else x.shiftBy(0);y(x.position),B=!1}}return{setLogical:Y,refresh:de,shiftBy(s){if(t.totalSize=e.sizeCache.getTotalSize(),T=Math.max(0,t.totalSize+u-t.containerSize),x.shiftBy(s),!x.active)O()},cancelScroll(){A(),O()},getLogical:()=>t.scrollPosition,getMaxLogical:()=>T,smoothScrollTo(s,z,G,D=we,U){if(A(),x.smooth(s,z,D),K=U,!x.active)K=void 0,U?.(),O();else N()},attach(){if(p)return;if(p=!0,o.style.overflowX=r?"hidden":"auto",o.style.overflowY=r?"auto":"hidden",o.style.touchAction=r?"pan-y pinch-zoom":"pan-x pinch-zoom",o.style.overflowAnchor="none",i.style[r?"width":"height"]="100%",i.style.overflow="clip",i.style.overflowAnchor="none",o.addEventListener("pointerdown",le),C.addEventListener("pointerdown",pe),o.addEventListener("pointermove",J,{passive:!1}),C.addEventListener("pointerup",j),C.addEventListener("pointercancel",j),o.addEventListener("click",be,!0),e.wheelEnabled)o.addEventListener("wheel",ae,{passive:!1});w.addEventListener("keydown",ee),C.addEventListener("blur",X),E.addEventListener("visibilitychange",ue),h.addEventListener("change",X),N()},detach(){if(p=!1,X(),_!==null)clearTimeout(_),_=null;o.removeEventListener("pointerdown",le),C.removeEventListener("pointerdown",pe),o.removeEventListener("pointermove",J),C.removeEventListener("pointerup",j),C.removeEventListener("pointercancel",j),o.removeEventListener("click",be,!0),o.removeEventListener("wheel",ae),w.removeEventListener("keydown",ee),C.removeEventListener("blur",X),E.removeEventListener("visibilitychange",ue),h.removeEventListener("change",X),o.style.overflowX=o.style.overflowY=o.style.touchAction=o.style.overflowAnchor="",i.style.overflow=i.style.overflowAnchor=""}}}function Wn(e,t=[]){return wt(e,t,Ht)}export{Wn as createVList};
|
package/dist/types.d.ts
CHANGED
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/** Base event map with index signature */
|
|
6
6
|
export type EventMap = Record<string, unknown>;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Base item interface: an item only has to carry an id. Plugins that read
|
|
9
|
+
* arbitrary fields (search, table, tree) narrow the item themselves, so an
|
|
10
|
+
* ordinary `interface Row { id: number; name: string }` satisfies this.
|
|
11
|
+
*/
|
|
8
12
|
export interface VListItem {
|
|
9
13
|
id: string | number;
|
|
10
|
-
[key: string]: unknown;
|
|
11
14
|
}
|
|
12
15
|
/** Groups configuration for createVList */
|
|
13
16
|
export interface GroupHeaderConfig {
|
|
@@ -341,20 +344,6 @@ export type ScrollbarPadding = number | {
|
|
|
341
344
|
bottom?: number;
|
|
342
345
|
left?: number;
|
|
343
346
|
};
|
|
344
|
-
/**
|
|
345
|
-
* Scrollbar configuration.
|
|
346
|
-
* @deprecated Use `scroll.scrollbar` in `ScrollConfig` instead.
|
|
347
|
-
*/
|
|
348
|
-
export interface ScrollbarConfig {
|
|
349
|
-
/** Enable scrollbar (default: true) */
|
|
350
|
-
enabled?: boolean;
|
|
351
|
-
/** Auto-hide scrollbar after idle (default: true) */
|
|
352
|
-
autoHide?: boolean;
|
|
353
|
-
/** Auto-hide delay in milliseconds (default: 1000) */
|
|
354
|
-
autoHideDelay?: number;
|
|
355
|
-
/** Minimum thumb size in pixels (default: 30) */
|
|
356
|
-
minThumbSize?: number;
|
|
357
|
-
}
|
|
358
347
|
/** Item template function */
|
|
359
348
|
export type ItemTemplate<T = VListItem> = (item: T, index: number, state: ItemState) => string | HTMLElement;
|
|
360
349
|
/** Tree-specific state available in templates when the tree plugin is active */
|
|
@@ -468,19 +457,23 @@ export interface ErrorViewportSnapshot {
|
|
|
468
457
|
}
|
|
469
458
|
/** Event types and their payloads */
|
|
470
459
|
export interface VListEvents<T extends VListItem = VListItem> extends EventMap {
|
|
471
|
-
/**
|
|
460
|
+
/**
|
|
461
|
+
* Item clicked. `index` is the DATA index — what `getItemAt`,
|
|
462
|
+
* `scrollToIndex` and `removeItem` take — not the layout index, which counts
|
|
463
|
+
* group headers and carousel laps as well.
|
|
464
|
+
*/
|
|
472
465
|
"item:click": {
|
|
473
466
|
item: T;
|
|
474
467
|
index: number;
|
|
475
468
|
event: MouseEvent;
|
|
476
469
|
};
|
|
477
|
-
/** Item double-clicked */
|
|
470
|
+
/** Item double-clicked. `index` is the data index, as for `item:click`. */
|
|
478
471
|
"item:dblclick": {
|
|
479
472
|
item: T;
|
|
480
473
|
index: number;
|
|
481
474
|
event: MouseEvent;
|
|
482
475
|
};
|
|
483
|
-
/** Item right-clicked */
|
|
476
|
+
/** Item right-clicked. `index` is the data index, as for `item:click`. */
|
|
484
477
|
"item:contextmenu": {
|
|
485
478
|
item: T;
|
|
486
479
|
index: number;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vlist/utils — Scroll Padding Protocol
|
|
3
|
+
*
|
|
4
|
+
* page() keeps a band of the window clear at each end of the main axis — a
|
|
5
|
+
* sticky site header, a floating toolbar — and applies it to every scroll it
|
|
6
|
+
* computes. Layout plugins take over those computations: groups() and
|
|
7
|
+
* masonry() both override `_scrollItemIntoView` and install their own
|
|
8
|
+
* `setToIndexFn`, because only they know where an entry actually sits.
|
|
9
|
+
*
|
|
10
|
+
* So the band is published through the `_getScrollPadding` hook rather than
|
|
11
|
+
* baked into page's own scroll code alone, and the plugins that displace page
|
|
12
|
+
* read it back and fold it into their geometry. Without the hook a caller's
|
|
13
|
+
* `scrollPadding` silently disappeared as soon as either plugin was seated.
|
|
14
|
+
*/
|
|
15
|
+
import type { PluginContext } from "../core/types";
|
|
16
|
+
import type { VListItem } from "../types";
|
|
17
|
+
/** Band to keep clear at each end of the main axis, in pixels. */
|
|
18
|
+
export interface ScrollPadding {
|
|
19
|
+
/** Top (vertical) or left (horizontal). */
|
|
20
|
+
readonly start: number;
|
|
21
|
+
/** Bottom (vertical) or right (horizontal). */
|
|
22
|
+
readonly end: number;
|
|
23
|
+
}
|
|
24
|
+
/** Internal hook name carrying the band across plugins. */
|
|
25
|
+
export declare const SCROLL_PADDING_HOOK = "_getScrollPadding";
|
|
26
|
+
/** No padding — the shape every list without page() sees. */
|
|
27
|
+
export declare const NO_SCROLL_PADDING: ScrollPadding;
|
|
28
|
+
/**
|
|
29
|
+
* Read the published scroll padding, or zero when no plugin publishes one.
|
|
30
|
+
*
|
|
31
|
+
* The hook is resolved on first read instead of during setup: the publisher is
|
|
32
|
+
* not guaranteed to be seated first. The band itself is read on every call,
|
|
33
|
+
* since page() accepts functions that measure a sticky header each time.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createScrollPaddingReader<T extends VListItem>(ctx: PluginContext<T>): () => ScrollPadding;
|
|
36
|
+
//# sourceMappingURL=scroll-padding.d.ts.map
|
package/dist/utils/stats.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface StatsConfig {
|
|
2
|
-
/** Returns the
|
|
2
|
+
/** Returns the unscaled logical position, normally list.getScrollPosition(). */
|
|
3
3
|
getScrollPosition: () => number;
|
|
4
4
|
/** Returns the total number of items */
|
|
5
5
|
getTotal: () => number;
|
|
@@ -33,6 +33,14 @@ export interface Stats {
|
|
|
33
33
|
*
|
|
34
34
|
* All inputs are provided via callbacks so the tracker always reflects
|
|
35
35
|
* the latest values without needing to be recreated when the list changes.
|
|
36
|
+
* Position is an unscaled logical offset on both native and synthetic entries,
|
|
37
|
+
* clamped to the declared content's real scroll range. Progress counts items up
|
|
38
|
+
* to the viewport end (including partial rows), rather than just scroll distance.
|
|
39
|
+
*
|
|
40
|
+
* Native content beyond the browser limit still uses its full declared size:
|
|
41
|
+
* a browser-clamped position is not expanded to the end, so progress may never
|
|
42
|
+
* reach 100%. Handle the core's `content:size:overflow` error and use
|
|
43
|
+
* `vlist/synthetic` when the full range must remain reachable.
|
|
36
44
|
*
|
|
37
45
|
* ```ts
|
|
38
46
|
* const stats = createStats({
|