vlist 1.9.1 → 2.0.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/README.github.md +104 -97
- package/README.md +46 -33
- package/dist/constants.d.ts +11 -6
- package/dist/constants.js +83 -0
- package/dist/core/create.d.ts +10 -0
- package/dist/core/create.js +740 -0
- package/dist/core/dom.d.ts +8 -0
- package/dist/core/dom.js +47 -0
- package/dist/core/hooks.d.ts +16 -0
- package/dist/core/hooks.js +67 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.js +13 -0
- package/dist/core/pipeline.d.ts +51 -0
- package/dist/core/pipeline.js +307 -0
- package/dist/core/pool.d.ts +9 -0
- package/dist/core/pool.js +42 -0
- package/dist/core/scroll.d.ts +32 -0
- package/dist/core/scroll.js +137 -0
- package/dist/core/sizes.d.ts +8 -0
- package/dist/core/sizes.js +6 -0
- package/dist/core/state.d.ts +47 -0
- package/dist/core/state.js +56 -0
- package/dist/core/types.d.ts +187 -0
- package/dist/core/types.js +7 -0
- package/dist/{builder → core}/velocity.d.ts +1 -1
- package/dist/core/velocity.js +33 -0
- package/dist/events/emitter.js +60 -0
- package/dist/events/index.js +6 -0
- package/dist/index.d.ts +28 -19
- package/dist/index.js +28 -1
- package/dist/internals.d.ts +11 -7
- package/dist/internals.js +60 -1
- package/dist/plugins/a11y/index.d.ts +2 -0
- package/dist/plugins/a11y/index.js +1 -0
- package/dist/plugins/a11y/plugin.d.ts +13 -0
- package/dist/plugins/a11y/plugin.js +259 -0
- package/dist/{features → plugins}/async/index.d.ts +1 -1
- package/dist/plugins/async/index.js +12 -0
- package/dist/{features → plugins}/async/manager.d.ts +5 -1
- package/dist/plugins/async/manager.js +568 -0
- package/dist/plugins/async/placeholder.js +154 -0
- package/dist/plugins/async/plugin.d.ts +48 -0
- package/dist/plugins/async/plugin.js +311 -0
- package/dist/plugins/async/sparse.js +540 -0
- package/dist/plugins/autosize/index.d.ts +5 -0
- package/dist/plugins/autosize/index.js +4 -0
- package/dist/plugins/autosize/plugin.d.ts +19 -0
- package/dist/plugins/autosize/plugin.js +185 -0
- package/dist/plugins/grid/index.d.ts +7 -0
- package/dist/plugins/grid/index.js +5 -0
- package/dist/plugins/grid/layout.js +275 -0
- package/dist/plugins/grid/plugin.d.ts +23 -0
- package/dist/plugins/grid/plugin.js +347 -0
- package/dist/plugins/grid/renderer.js +525 -0
- package/dist/plugins/grid/types.js +11 -0
- package/dist/plugins/groups/async-bridge.js +246 -0
- package/dist/{features → plugins}/groups/index.d.ts +1 -1
- package/dist/plugins/groups/index.js +13 -0
- package/dist/plugins/groups/layout.js +294 -0
- package/dist/plugins/groups/plugin.d.ts +22 -0
- package/dist/plugins/groups/plugin.js +571 -0
- package/dist/plugins/groups/sticky.js +255 -0
- package/dist/plugins/groups/types.js +12 -0
- package/dist/plugins/masonry/index.d.ts +8 -0
- package/dist/plugins/masonry/index.js +6 -0
- package/dist/plugins/masonry/layout.js +261 -0
- package/dist/plugins/masonry/plugin.d.ts +32 -0
- package/dist/plugins/masonry/plugin.js +381 -0
- package/dist/plugins/masonry/renderer.js +354 -0
- package/dist/plugins/masonry/types.js +9 -0
- package/dist/plugins/page/index.d.ts +5 -0
- package/dist/plugins/page/index.js +5 -0
- package/dist/plugins/page/plugin.d.ts +21 -0
- package/dist/plugins/page/plugin.js +166 -0
- package/dist/plugins/scale/index.d.ts +5 -0
- package/dist/plugins/scale/index.js +4 -0
- package/dist/plugins/scale/plugin.d.ts +24 -0
- package/dist/plugins/scale/plugin.js +507 -0
- package/dist/plugins/scrollbar/controller.js +574 -0
- package/dist/plugins/scrollbar/index.d.ts +7 -0
- package/dist/plugins/scrollbar/index.js +6 -0
- package/dist/plugins/scrollbar/plugin.d.ts +20 -0
- package/dist/plugins/scrollbar/plugin.js +93 -0
- package/dist/plugins/scrollbar/scrollbar.js +556 -0
- package/dist/plugins/selection/index.d.ts +6 -0
- package/dist/plugins/selection/index.js +7 -0
- package/dist/plugins/selection/plugin.d.ts +16 -0
- package/dist/plugins/selection/plugin.js +601 -0
- package/dist/{features → plugins}/selection/state.d.ts +8 -0
- package/dist/plugins/selection/state.js +332 -0
- package/dist/plugins/snapshots/index.d.ts +5 -0
- package/dist/plugins/snapshots/index.js +5 -0
- package/dist/plugins/snapshots/plugin.d.ts +17 -0
- package/dist/plugins/snapshots/plugin.js +301 -0
- package/dist/plugins/sortable/index.d.ts +6 -0
- package/dist/plugins/sortable/index.js +6 -0
- package/dist/plugins/sortable/plugin.d.ts +34 -0
- package/dist/plugins/sortable/plugin.js +753 -0
- package/dist/plugins/table/header.js +501 -0
- package/dist/{features → plugins}/table/index.d.ts +1 -1
- package/dist/plugins/table/index.js +12 -0
- package/dist/plugins/table/layout.js +211 -0
- package/dist/plugins/table/plugin.d.ts +20 -0
- package/dist/plugins/table/plugin.js +391 -0
- package/dist/plugins/table/renderer.js +625 -0
- package/dist/plugins/table/types.js +12 -0
- package/dist/plugins/transition/index.d.ts +5 -0
- package/dist/plugins/transition/index.js +5 -0
- package/dist/plugins/transition/plugin.d.ts +22 -0
- package/dist/plugins/transition/plugin.js +405 -0
- package/dist/rendering/aria.js +23 -0
- package/dist/rendering/index.js +18 -0
- package/dist/rendering/measured.js +98 -0
- package/dist/rendering/renderer.js +586 -0
- package/dist/rendering/scale.js +267 -0
- package/dist/rendering/scroll.js +71 -0
- package/dist/rendering/sizes.js +193 -0
- package/dist/rendering/sort.js +65 -0
- package/dist/rendering/viewport.js +268 -0
- package/dist/size.json +1 -1
- package/dist/types.js +5 -0
- package/dist/utils/padding.d.ts +2 -4
- package/dist/utils/padding.js +49 -0
- package/dist/utils/stats.js +124 -0
- package/dist/vlist-grid.css +1 -1
- package/dist/vlist-masonry.css +1 -1
- package/dist/vlist-table.css +1 -1
- package/dist/vlist.css +1 -1
- package/package.json +9 -4
- package/dist/builder/a11y.d.ts +0 -16
- package/dist/builder/api.d.ts +0 -21
- package/dist/builder/context.d.ts +0 -36
- package/dist/builder/core.d.ts +0 -16
- package/dist/builder/data.d.ts +0 -71
- package/dist/builder/dom.d.ts +0 -15
- package/dist/builder/index.d.ts +0 -25
- package/dist/builder/materialize.d.ts +0 -166
- package/dist/builder/pool.d.ts +0 -10
- package/dist/builder/range.d.ts +0 -10
- package/dist/builder/scroll.d.ts +0 -24
- package/dist/builder/types.d.ts +0 -512
- package/dist/features/async/feature.d.ts +0 -72
- package/dist/features/autosize/feature.d.ts +0 -34
- package/dist/features/autosize/index.d.ts +0 -2
- package/dist/features/grid/feature.d.ts +0 -48
- package/dist/features/grid/index.d.ts +0 -9
- package/dist/features/groups/feature.d.ts +0 -75
- package/dist/features/masonry/feature.d.ts +0 -45
- package/dist/features/masonry/index.d.ts +0 -9
- package/dist/features/page/feature.d.ts +0 -109
- package/dist/features/page/index.d.ts +0 -9
- package/dist/features/scale/feature.d.ts +0 -42
- package/dist/features/scale/index.d.ts +0 -10
- package/dist/features/scrollbar/feature.d.ts +0 -81
- package/dist/features/scrollbar/index.d.ts +0 -8
- package/dist/features/selection/feature.d.ts +0 -91
- package/dist/features/selection/index.d.ts +0 -7
- package/dist/features/snapshots/feature.d.ts +0 -79
- package/dist/features/snapshots/index.d.ts +0 -9
- package/dist/features/sortable/feature.d.ts +0 -101
- package/dist/features/sortable/index.d.ts +0 -6
- package/dist/features/table/feature.d.ts +0 -67
- package/dist/features/transition/feature.d.ts +0 -30
- package/dist/features/transition/index.d.ts +0 -9
- /package/dist/{features → plugins}/async/placeholder.d.ts +0 -0
- /package/dist/{features → plugins}/async/sparse.d.ts +0 -0
- /package/dist/{features → plugins}/grid/layout.d.ts +0 -0
- /package/dist/{features → plugins}/grid/renderer.d.ts +0 -0
- /package/dist/{features → plugins}/grid/types.d.ts +0 -0
- /package/dist/{features → plugins}/groups/async-bridge.d.ts +0 -0
- /package/dist/{features → plugins}/groups/layout.d.ts +0 -0
- /package/dist/{features → plugins}/groups/sticky.d.ts +0 -0
- /package/dist/{features → plugins}/groups/types.d.ts +0 -0
- /package/dist/{features → plugins}/masonry/layout.d.ts +0 -0
- /package/dist/{features → plugins}/masonry/renderer.d.ts +0 -0
- /package/dist/{features → plugins}/masonry/types.d.ts +0 -0
- /package/dist/{features → plugins}/scrollbar/controller.d.ts +0 -0
- /package/dist/{features → plugins}/scrollbar/scrollbar.d.ts +0 -0
- /package/dist/{features → plugins}/table/header.d.ts +0 -0
- /package/dist/{features → plugins}/table/layout.d.ts +0 -0
- /package/dist/{features → plugins}/table/renderer.d.ts +0 -0
- /package/dist/{features → plugins}/table/types.d.ts +0 -0
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vlist/sortable - Builder Feature
|
|
3
|
-
* Drag-and-drop reordering for virtual lists.
|
|
4
|
-
*
|
|
5
|
-
* Priority: 55 (runs after selection at 50, before scrollbar at 60)
|
|
6
|
-
*
|
|
7
|
-
* What it wires:
|
|
8
|
-
* - Pointer event handlers on the items container for drag initiation
|
|
9
|
-
* - Creates a drag ghost element that follows the pointer
|
|
10
|
-
* - Items shift via CSS transforms to make room (like iOS list reordering)
|
|
11
|
-
* - Auto-scrolls when dragging near viewport edges
|
|
12
|
-
* - Keyboard reordering: Space to grab, arrows to move, Space to drop, Escape to cancel
|
|
13
|
-
* - ARIA attributes (aria-roledescription, aria-describedby) and live region announcements
|
|
14
|
-
* - Emits sort:start, sort:end, and sort:cancel events
|
|
15
|
-
*
|
|
16
|
-
* The feature is purely visual during drag — it does NOT reorder data.
|
|
17
|
-
* On drop, it emits a `sort:end` event with `{ fromIndex, toIndex }`.
|
|
18
|
-
* The consumer is responsible for reordering their data array and
|
|
19
|
-
* calling `setItems()` with the new order.
|
|
20
|
-
*
|
|
21
|
-
* Keyboard reordering emits `sort:end` per arrow key press (incremental moves).
|
|
22
|
-
* On Escape, it emits `sort:cancel` with `{ originalItems }` so the consumer
|
|
23
|
-
* can restore the original order via `setItems(originalItems)`.
|
|
24
|
-
*
|
|
25
|
-
* When composed with withSelection, Space is intercepted for grab/drop.
|
|
26
|
-
* Use Enter to toggle selection on focused items.
|
|
27
|
-
*
|
|
28
|
-
* IMPORTANT: vlist positions items via `style.transform: translateY(offset)`.
|
|
29
|
-
* The shift must ADD to that existing offset, not replace it.
|
|
30
|
-
*
|
|
31
|
-
* Added methods: isSorting
|
|
32
|
-
* Added events: sort:start, sort:end, sort:cancel
|
|
33
|
-
*/
|
|
34
|
-
import type { VListItem } from "../../types";
|
|
35
|
-
import type { VListFeature } from "../../builder/types";
|
|
36
|
-
/** Sortable feature configuration */
|
|
37
|
-
export interface SortableConfig {
|
|
38
|
-
/**
|
|
39
|
-
* CSS selector for the drag handle within each item.
|
|
40
|
-
* When set, only elements matching this selector initiate a drag.
|
|
41
|
-
* When omitted, the entire item is draggable.
|
|
42
|
-
*
|
|
43
|
-
* ```ts
|
|
44
|
-
* withSortable({ handle: '.drag-handle' })
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
handle?: string;
|
|
48
|
-
/**
|
|
49
|
-
* CSS class added to the drag ghost element (default: 'vlist-sort-ghost').
|
|
50
|
-
* The ghost is a clone of the dragged item that follows the pointer.
|
|
51
|
-
*/
|
|
52
|
-
ghostClass?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Transition duration for item shift animations in milliseconds (default: 150).
|
|
55
|
-
* Set to 0 for instant shifts.
|
|
56
|
-
*/
|
|
57
|
-
shiftDuration?: number;
|
|
58
|
-
/**
|
|
59
|
-
* Size of the auto-scroll zone at viewport edges in pixels (default: 40).
|
|
60
|
-
* When the pointer enters this zone during drag, the list auto-scrolls.
|
|
61
|
-
*/
|
|
62
|
-
edgeScrollZone?: number;
|
|
63
|
-
/**
|
|
64
|
-
* Auto-scroll speed in pixels per frame (default: 8).
|
|
65
|
-
*/
|
|
66
|
-
edgeScrollSpeed?: number;
|
|
67
|
-
/**
|
|
68
|
-
* Minimum distance in pixels the pointer must move before drag starts (default: 5).
|
|
69
|
-
* Prevents accidental drags on click.
|
|
70
|
-
*/
|
|
71
|
-
dragThreshold?: number;
|
|
72
|
-
/**
|
|
73
|
-
* Container element for the drag ghost (default: document.body).
|
|
74
|
-
* Set this to keep the ghost inside a specific ancestor so it inherits
|
|
75
|
-
* scoped CSS (e.g. theme variables, list-specific item styles).
|
|
76
|
-
*/
|
|
77
|
-
ghostContainer?: HTMLElement;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Create a sortable feature for the builder.
|
|
81
|
-
*
|
|
82
|
-
* Enables drag-and-drop reordering of items in the virtual list.
|
|
83
|
-
*
|
|
84
|
-
* ```ts
|
|
85
|
-
* import { vlist } from 'vlist'
|
|
86
|
-
* import { withSortable } from 'vlist/sortable'
|
|
87
|
-
*
|
|
88
|
-
* const list = vlist({ ... })
|
|
89
|
-
* .use(withSortable({ handle: '.drag-handle' }))
|
|
90
|
-
* .build()
|
|
91
|
-
*
|
|
92
|
-
* list.on('sort:end', ({ fromIndex, toIndex }) => {
|
|
93
|
-
* const reordered = [...items]
|
|
94
|
-
* const [moved] = reordered.splice(fromIndex, 1)
|
|
95
|
-
* reordered.splice(toIndex, 0, moved)
|
|
96
|
-
* list.setItems(reordered)
|
|
97
|
-
* })
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
export declare const withSortable: <T extends VListItem = VListItem>(config?: SortableConfig) => VListFeature<T>;
|
|
101
|
-
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vlist/table - Builder Feature
|
|
3
|
-
* Switches from list layout to a data table with columns, resizable headers,
|
|
4
|
-
* sticky header row, and cell-based rendering.
|
|
5
|
-
*
|
|
6
|
-
* Priority: 10 (runs first — replaces the renderer before anything else renders)
|
|
7
|
-
*
|
|
8
|
-
* What it wires:
|
|
9
|
-
* - Replaces render functions — swaps the core render loop with table-aware rendering
|
|
10
|
-
* - Sticky header — creates a fixed header row above the viewport
|
|
11
|
-
* - Column layout — manages column widths, offsets, and resize logic
|
|
12
|
-
* - Resize interaction — drag handles on header column borders
|
|
13
|
-
* - Sort events — click on sortable header emits column:sort
|
|
14
|
-
* - Horizontal scroll sync — header scrolls in sync with the viewport
|
|
15
|
-
* - CSS class — adds .vlist--table to the root element
|
|
16
|
-
* - Variable row heights — supports fixed and function-based heights
|
|
17
|
-
*
|
|
18
|
-
* Critical design: This feature uses ctx.setRenderFns() to completely replace
|
|
19
|
-
* the core's render loop, NOT ctx.replaceRenderer() which is a no-op in the
|
|
20
|
-
* materialize context. This follows the same pattern as withGrid.
|
|
21
|
-
*
|
|
22
|
-
* Restrictions:
|
|
23
|
-
* - Cannot be combined with withGrid or withMasonry (conflicting layout modes)
|
|
24
|
-
* - Cannot be combined with orientation: 'horizontal' (tables are always vertical)
|
|
25
|
-
*
|
|
26
|
-
* Can be combined with:
|
|
27
|
-
* - withSelection (row selection works as-is)
|
|
28
|
-
* - withScrollbar (custom scrollbar)
|
|
29
|
-
* - withAsync (async data loading)
|
|
30
|
-
* - withSnapshots (scroll position save/restore)
|
|
31
|
-
* - withScale (large dataset compression)
|
|
32
|
-
*/
|
|
33
|
-
import type { VListItem } from "../../types";
|
|
34
|
-
import type { VListFeature } from "../../builder/types";
|
|
35
|
-
import type { TableConfig } from "./types";
|
|
36
|
-
/** Table feature configuration — re-exported as TableFeatureConfig */
|
|
37
|
-
export type TableFeatureConfig<T extends VListItem = VListItem> = TableConfig<T>;
|
|
38
|
-
/**
|
|
39
|
-
* Create a table feature for the builder.
|
|
40
|
-
*
|
|
41
|
-
* Switches from list layout to a data table with column headers, resizable
|
|
42
|
-
* columns, and cell-based row rendering.
|
|
43
|
-
*
|
|
44
|
-
* ```ts
|
|
45
|
-
* import { vlist } from 'vlist/builder'
|
|
46
|
-
* import { withTable } from 'vlist/table'
|
|
47
|
-
*
|
|
48
|
-
* const table = vlist({
|
|
49
|
-
* container: '#my-table',
|
|
50
|
-
* item: { height: 40, template: () => '' },
|
|
51
|
-
* items: users,
|
|
52
|
-
* })
|
|
53
|
-
* .use(withTable({
|
|
54
|
-
* columns: [
|
|
55
|
-
* { key: 'name', label: 'Name', width: 200 },
|
|
56
|
-
* { key: 'email', label: 'Email', width: 300 },
|
|
57
|
-
* { key: 'role', label: 'Role', width: 120 },
|
|
58
|
-
* ],
|
|
59
|
-
* rowHeight: 40,
|
|
60
|
-
* headerHeight: 44,
|
|
61
|
-
* resizable: true,
|
|
62
|
-
* }))
|
|
63
|
-
* .build()
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export declare const withTable: <T extends VListItem = VListItem>(config: TableFeatureConfig<T>) => VListFeature<T>;
|
|
67
|
-
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* withTransition — FLIP-based enter/exit animations for insertItem and removeItem.
|
|
3
|
-
*
|
|
4
|
-
* Opt-in feature that replaces the immediate insert/remove with animated versions:
|
|
5
|
-
* - removeItem: clone collapses via scaleY(0), siblings slide up
|
|
6
|
-
* - insertItem: new element expands in, siblings slide down
|
|
7
|
-
*
|
|
8
|
-
* Without this feature, insert/remove are instantaneous.
|
|
9
|
-
*/
|
|
10
|
-
import type { VListItem } from "../../types";
|
|
11
|
-
import type { VListFeature } from "../../builder/types";
|
|
12
|
-
/** Per-animation timing overrides. */
|
|
13
|
-
export interface TransitionTiming {
|
|
14
|
-
/** Duration in ms */
|
|
15
|
-
duration?: number;
|
|
16
|
-
/** CSS easing function */
|
|
17
|
-
easing?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface TransitionConfig {
|
|
20
|
-
/** Shared duration in ms (default: 200). Overridden by add/remove sub-configs. */
|
|
21
|
-
duration?: number;
|
|
22
|
-
/** Shared CSS easing (default: MD3 emphasized). Overridden by add/remove sub-configs. */
|
|
23
|
-
easing?: string;
|
|
24
|
-
/** Insert animation config, or `false` to disable. */
|
|
25
|
-
insert?: TransitionTiming | false;
|
|
26
|
-
/** Remove animation config, or `false` to disable. */
|
|
27
|
-
remove?: TransitionTiming | false;
|
|
28
|
-
}
|
|
29
|
-
export declare function withTransition<T extends VListItem = VListItem>(config?: TransitionConfig): VListFeature<T>;
|
|
30
|
-
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vlist/transition — FLIP-based enter/exit animations
|
|
3
|
-
* Opt-in animated add/remove for smooth list transitions
|
|
4
|
-
*
|
|
5
|
-
* Usage: import { withTransition } from 'vlist'
|
|
6
|
-
*/
|
|
7
|
-
export { withTransition } from "./feature";
|
|
8
|
-
export type { TransitionConfig, TransitionTiming } from "./feature";
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|