vlist 3.0.0-next.1 → 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.
Files changed (68) hide show
  1. package/README.github.md +111 -65
  2. package/README.md +70 -54
  3. package/dist/config.d.ts +105 -14
  4. package/dist/config.js +1 -1
  5. package/dist/core/create.d.ts +22 -5
  6. package/dist/core/dom.d.ts +1 -1
  7. package/dist/core/hooks.d.ts +1 -1
  8. package/dist/core/index.d.ts +1 -1
  9. package/dist/core/pipeline.d.ts +1 -1
  10. package/dist/core/pool.d.ts +1 -1
  11. package/dist/core/runway.d.ts +6 -2
  12. package/dist/core/scroll.d.ts +1 -1
  13. package/dist/core/sizes.d.ts +1 -1
  14. package/dist/core/state.d.ts +13 -1
  15. package/dist/core/types.d.ts +134 -62
  16. package/dist/core/velocity.d.ts +1 -1
  17. package/dist/index.d.ts +17 -2
  18. package/dist/index.js +1 -1
  19. package/dist/internals.d.ts +0 -1
  20. package/dist/internals.js +1 -1
  21. package/dist/native.d.ts +6 -10
  22. package/dist/native.js +1 -1
  23. package/dist/plugins/a11y/index.d.ts +1 -0
  24. package/dist/plugins/a11y/plugin.d.ts +1 -1
  25. package/dist/plugins/autosize/index.d.ts +2 -1
  26. package/dist/plugins/autosize/plugin.d.ts +13 -2
  27. package/dist/plugins/carousel/engine.d.ts +1 -1
  28. package/dist/plugins/carousel/index.d.ts +1 -0
  29. package/dist/plugins/carousel/plugin.d.ts +30 -2
  30. package/dist/plugins/carousel/presets.d.ts +1 -1
  31. package/dist/plugins/data/index.d.ts +1 -0
  32. package/dist/plugins/data/plugin.d.ts +15 -2
  33. package/dist/plugins/grid/index.d.ts +2 -1
  34. package/dist/plugins/grid/plugin.d.ts +14 -2
  35. package/dist/plugins/groups/index.d.ts +1 -0
  36. package/dist/plugins/groups/plugin.d.ts +11 -3
  37. package/dist/plugins/groups/types.d.ts +6 -1
  38. package/dist/plugins/masonry/index.d.ts +2 -1
  39. package/dist/plugins/masonry/plugin.d.ts +10 -2
  40. package/dist/plugins/masonry/renderer.d.ts +5 -1
  41. package/dist/plugins/page/plugin.d.ts +1 -1
  42. package/dist/plugins/scrollbar/index.d.ts +2 -1
  43. package/dist/plugins/scrollbar/plugin.d.ts +7 -2
  44. package/dist/plugins/search/index.d.ts +1 -0
  45. package/dist/plugins/search/plugin.d.ts +26 -1
  46. package/dist/plugins/selection/index.d.ts +2 -1
  47. package/dist/plugins/selection/plugin.d.ts +23 -2
  48. package/dist/plugins/snapshots/index.d.ts +1 -0
  49. package/dist/plugins/snapshots/plugin.d.ts +9 -2
  50. package/dist/plugins/sortable/index.d.ts +1 -0
  51. package/dist/plugins/sortable/plugin.d.ts +11 -3
  52. package/dist/plugins/table/index.d.ts +1 -0
  53. package/dist/plugins/table/plugin.d.ts +19 -3
  54. package/dist/plugins/transition/plugin.d.ts +1 -1
  55. package/dist/plugins/tree/index.d.ts +1 -0
  56. package/dist/plugins/tree/layout.d.ts +1 -1
  57. package/dist/plugins/tree/plugin.d.ts +37 -3
  58. package/dist/plugins/tree/types.d.ts +1 -1
  59. package/dist/rendering/sizes.d.ts +7 -1
  60. package/dist/size.json +1 -1
  61. package/dist/synthetic.d.ts +3 -3
  62. package/dist/synthetic.js +1 -1
  63. package/dist/types.d.ts +17 -21
  64. package/dist/utils/scroll-padding.d.ts +36 -0
  65. package/dist/utils/stats.d.ts +9 -1
  66. package/dist/vlist.css +1 -1
  67. package/package.json +6 -2
  68. package/dist/plugins/grid/renderer.d.ts +0 -68
@@ -1,18 +1,36 @@
1
1
  /**
2
- * vlist v2 — createVList()
2
+ * vlist — createVList()
3
3
  *
4
4
  * Factory function. Resolves config, creates DOM, compiles hooks from
5
5
  * plugins, wires the 2-phase pipeline, returns the public VList API.
6
6
  */
7
7
  import type { VListItem } from "../types";
8
- import type { CreateVListConfig, VListPlugin, VList } from "./types";
8
+ import type { CreateVListConfig, PluginMethods, VListPlugin, VList } from "./types";
9
9
  import type { SizeCache } from "./sizes";
10
10
  import type { BoundedScrollHandler, BoundedScrollConfig } from "./runway";
11
11
  import type { ScrollHandler, ScrollHandlerConfig } from "./scroll";
12
12
  import { type Emitter } from "../events";
13
13
  import type { VListEvents } from "../types";
14
- /** Create a list with synthetic input. Native input is available from vlist/native. */
15
- export declare function createVList<T extends VListItem = VListItem>(config: CreateVListConfig<T>, plugins?: VListPlugin<T>[]): VList<T>;
14
+ /**
15
+ * Create a list with native scrolling. Opt into synthetic input via vlist/synthetic.
16
+ *
17
+ * Let the item type be inferred from the config — its `items`, or the
18
+ * `template` parameter — rather than passing it as a type argument. The list's
19
+ * type carries exactly the methods its plugins add, and that inference needs
20
+ * the plugins tuple as the second type parameter; TypeScript allows no partial
21
+ * type-argument list, so `createVList<Row>(config, [selection()])` fills the
22
+ * tuple with its default and returns a bare `VList<Row>`, with every plugin
23
+ * method gone. It compiles, which is why it looks like the fix for a
24
+ * `VListItem` constraint error on `Row`. The fix is the constraint: give `Row`
25
+ * an `id`, and keep the argument list empty.
26
+ *
27
+ * @example
28
+ * // inferred: list has select(), getSelected() …
29
+ * const list = createVList({ container, items, item: { height: 40, template } }, [selection()]);
30
+ * // explicit: compiles, and list.select does not exist
31
+ * const bare = createVList<Row>({ container, items, item: { height: 40, template } }, [selection()]);
32
+ */
33
+ 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>;
16
34
  /** @internal Shared factory; entries select the input handler. */
17
35
  export declare function createCore<T extends VListItem = VListItem>(rawConfig: CreateVListConfig<T>, plugins?: VListPlugin<T>[],
18
36
  /** @internal Omitted by the native entry. */
@@ -22,7 +40,6 @@ logicalHandlerFactory?: (config: BoundedScrollConfig & {
22
40
  native: (config: ScrollHandlerConfig) => ScrollHandler & {
23
41
  commitScroll(pos?: number): void;
24
42
  };
25
- wrap: (config: BoundedScrollConfig) => BoundedScrollHandler;
26
43
  onContentSize: (size: number, emitter: Emitter<VListEvents<T>>) => void;
27
44
  }): VList<T>;
28
45
  //# sourceMappingURL=create.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vlist v2 — DOM Structure
2
+ * vlist — DOM Structure
3
3
  * Container resolution and DOM scaffold creation.
4
4
  */
5
5
  import type { DOMStructure } from "./types";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vlist v2 — Build-Time Compiled Hooks
2
+ * vlist — Build-Time Compiled Hooks
3
3
  *
4
4
  * Hooks are collected during createVList() and frozen into plain arrays.
5
5
  * On the hot path they are iterated with a for-loop — no closures,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vlist v2 — Core Public API
2
+ * vlist — Core Public API
3
3
  */
4
4
  export { createVList } from "./create";
5
5
  export { createEngineState } from "./state";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vlist v2 — 2-Phase Pipeline
2
+ * vlist — 2-Phase Pipeline
3
3
  *
4
4
  * Phase 1: Calculate & Reconcile — zero allocation hot path.
5
5
  * Reads scroll position + size cache, writes into EngineState TypedArrays.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vlist v2 — Element Pool
2
+ * vlist — Element Pool
3
3
  *
4
4
  * acquire() = pop or create, release() = reset + push.
5
5
  * Max pool size: 100.
@@ -6,8 +6,8 @@
6
6
  *
7
7
  * The content element is sized to a bounded *runway* (a multiple of the
8
8
  * viewport, capped at the real virtual size) instead of `totalItems × itemSize`.
9
- * This sidesteps the browser's ~16.7M px element-size limit without the scale
10
- * plugin's compression — no compression ratio leaks into offsets or hit-testing.
9
+ * This sidesteps the browser's ~16.7M px element-size limit without compressing
10
+ * the coordinate space — no compression ratio leaks into offsets or hit-testing.
11
11
  *
12
12
  * Coordinates:
13
13
  * logical = baseOffset + scrollTop (absolute virtual pixel position)
@@ -60,6 +60,8 @@ export interface WrapConfig {
60
60
  readonly home: () => number;
61
61
  /** Fold the logical position back toward `home` once it drifts this many laps away. */
62
62
  readonly thresholdLaps: number;
63
+ /** @internal Notify the wrap owner when its logical coordinates fold. */
64
+ readonly onFold?: (shift: number) => void;
63
65
  }
64
66
  export interface BoundedScrollConfig {
65
67
  /** Logical row geometry for opt-in input providers (keyboard row steps). */
@@ -78,6 +80,8 @@ export interface BoundedScrollConfig {
78
80
  /** Infinite-loop config (carousel). When set, the logical position wraps by
79
81
  * whole laps toward `home` instead of clamping to a maximum. */
80
82
  readonly wrap?: WrapConfig;
83
+ /** @internal Coordinate fold: shift core telemetry references before rendering. */
84
+ readonly onFold?: (shift: number) => void;
81
85
  /** Called synchronously per frame — triggers the 2-phase pipeline. */
82
86
  readonly onFrame: () => void;
83
87
  /** Called when scrolling becomes idle. */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vlist v2 — Scroll Handling
2
+ * vlist — Scroll Handling
3
3
  *
4
4
  * Wheel interception for synchronous rendering, scroll idle detection,
5
5
  * and smooth scroll animation.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vlist v2 — Size Cache
2
+ * vlist — Size Cache
3
3
  *
4
4
  * Float64Array prefix sums with O(1) offset lookups and O(log n) binary search.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vlist v2 — EngineState
2
+ * vlist — EngineState
3
3
  *
4
4
  * Persistent singleton instantiated once during createVList().
5
5
  * All hot-path state lives in pre-allocated TypedArrays.
@@ -40,11 +40,23 @@ export interface EngineState {
40
40
  renderPending: boolean;
41
41
  initialized: boolean;
42
42
  destroyed: boolean;
43
+ /** Set when the render window hit its ceiling, which only a degenerate size spec does. */
44
+ windowClamped: boolean;
45
+ /** Latch, so the ceiling is reported once rather than once per frame. */
46
+ windowClampReported: boolean;
43
47
  prevAriaTotal: number;
44
48
  /**
45
49
  * Resize buffers when container changes. Cold path only.
46
50
  * Heuristic: capacity = ceil(containerSize / minItemSize) + overscan * 2
47
51
  */
52
+ /**
53
+ * Grow buffers to hold at least `needed` entries. Cold path only.
54
+ *
55
+ * The render window is the authority on how many entries are required. The
56
+ * container/minItemSize heuristic below is only an estimate, and for a size
57
+ * function there is no knowable minimum to estimate from.
58
+ */
59
+ ensureCapacity(needed: number): void;
48
60
  resizeCapacity(containerSize: number, minItemSize: number, overscan?: number): void;
49
61
  /** Reset to empty range sentinel. */
50
62
  clear(): void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vlist v2 — Core Type Definitions
2
+ * vlist — Core Type Definitions
3
3
  *
4
4
  * Zero-allocation pipeline types. All hot-path state lives in TypedArrays
5
5
  * on the EngineState singleton — no intermediate object allocation.
@@ -58,77 +58,102 @@ export interface ElementPool {
58
58
  readonly size: number;
59
59
  clear(): void;
60
60
  }
61
- export interface PluginContext<T extends VListItem = VListItem> {
62
- readonly dom: DOMStructure;
63
- readonly sizeCache: SizeCache;
64
- /**
65
- * Logical scroll model boundary (RFC-012). Plugins read and write scroll
66
- * position through this adapter rather than touching `getState().scrollPosition`
67
- * or raw `scrollTop`/`scrollLeft`. Its pixel-equivalent view keeps existing
68
- * pixel-based code paths working during the migration.
69
- */
70
- readonly scroll: ScrollAdapter;
71
- readonly pool: ElementPool;
72
- readonly config: ResolvedConfig;
73
- readonly emitter: Emitter<import("../types").VListEvents<T>>;
74
- readonly template: ItemTemplate<T>;
75
- registerMethod(name: string, fn: Function): void;
76
- getMethod(name: string): Function | undefined;
77
- registerClickHandler(handler: (event: MouseEvent) => void): void;
78
- registerKeydownHandler(handler: (event: KeyboardEvent) => void): void;
79
- registerDestroyHandler(handler: () => void): void;
80
- enableListboxRole(): void;
81
- setSizeConfig(config: number | ((index: number) => number)): void;
61
+ /**
62
+ * DOM structure, plus the element and role helpers that act on it.
63
+ */
64
+ export interface DomCapability extends DOMStructure {
65
+ /** The rendered element for a layout index, honouring a plugin's override. */
66
+ renderedElement(index: number): HTMLElement | null;
67
+ /** Adopt the WAI-ARIA listbox roles. Selection and a11y call this; a list
68
+ * with neither stays a display-only `role="list"`. */
69
+ enableListbox(): void;
70
+ }
71
+ /**
72
+ * Logical scroll model boundary (RFC-012): the adapter's reads, plus the
73
+ * controls that write. Plugins go through this rather than touching
74
+ * `getState().scrollPosition` or raw `scrollTop`/`scrollLeft`.
75
+ */
76
+ export interface ScrollCapability extends ScrollAdapter {
77
+ to(position: number): void;
78
+ /** Preserve synthetic motion during a measurement/anchor correction. */
79
+ shiftBy(delta: number): void;
80
+ smoothTo(target: number | (() => number), duration: number, easing?: (t: number) => number, onComplete?: () => void): void;
81
+ /** Cancel any in-flight smooth-scroll animation on the active handler. */
82
+ cancel(): void;
83
+ /** Commit an external position, render synchronously and schedule idle. */
84
+ commit(px: number): void;
82
85
  /** Install an external writer and disable default scroll/wheel listeners. */
83
- setScrollSource(source: {
86
+ setSource(source: {
84
87
  write(px: number): void;
85
88
  onContentSize?(px: number): void;
86
89
  }): void;
87
- /** Commit an external position, render synchronously and schedule configured idle. */
88
- commitScroll(px: number): void;
90
+ setTarget(target: EventTarget): void;
89
91
  /** Request the bounded scroll handler in infinite-loop (wrap) mode (carousel). */
90
- setBoundedWrap(config: import("./runway").WrapConfig): void;
91
- setVirtualTotalFn(fn: () => number): void;
92
+ setBoundedWrap(config: import("./runway").WrapConfig, createHandler: (config: import("./runway").BoundedScrollConfig) => import("./runway").BoundedScrollHandler): void;
93
+ setToPosFn(fn: (index: number, sizeCache: import("./sizes").SizeCache, containerSize: number, totalItems: number, align: string) => number): void;
94
+ setToIndexFn(fn: (index: number, align: string, behavior?: string, duration?: number, easing?: (t: number) => number) => void | false): void;
95
+ onFrame(): void;
96
+ onIdle(): void;
97
+ disableResize(): void;
98
+ }
99
+ /**
100
+ * The item space: reads, mutations, and the inversion hooks a plugin installs
101
+ * to own them. One owner per hook — two plugins claiming the same one is how
102
+ * tree with data rendered nothing.
103
+ */
104
+ export interface ItemsCapability<T extends VListItem = VListItem> {
105
+ all(): readonly T[];
106
+ at(index: number): T | undefined;
107
+ removeById(id: string | number): number;
108
+ insertAt(item: T, index: number): void;
109
+ setGetFn(fn: (index: number) => T | undefined): void;
110
+ setRemoveFn(fn: (id: string | number) => number): void;
111
+ setInsertFn(fn: (item: T, index: number) => void): void;
112
+ setUpdateFn(fn: (id: string | number, updates: Partial<T>) => boolean): void;
113
+ setIndexByIdFn(fn: (id: string | number) => number): void;
114
+ /** The public total. Also feeds `aria-setsize`. */
115
+ setTotalFn(fn: () => number): void;
92
116
  setIndexMapFn(fn: (renderIndex: number) => number): void;
93
- getItems(): readonly T[];
94
- getItem(index: number): T | undefined;
95
- getState(): EngineState;
96
- rebuildSizeCache(): void;
97
- updateContentSize(size: number): void;
98
- setRenderFn(renderIfNeeded: () => void, forceRender: () => void): void;
99
- renderIfNeeded(): void;
100
- forceRender(): void;
101
- setGetItemFn(fn: (index: number) => T | undefined): void;
102
- setItemStateFn(fn: (index: number, state: ItemState) => void): void;
103
- getItemStateFn(): ((index: number, state: ItemState) => void) | null;
104
- readonly rawSizeSpec: number | ((index: number, ...args: unknown[]) => number);
105
- scrollTo(position: number): void;
106
- /** Preserve synthetic motion during a measurement/anchor correction. */
107
- shiftScroll(delta: number): void;
108
- smoothScrollTo(target: number | (() => number), duration: number, easing?: (t: number) => number, onComplete?: () => void): void;
109
- /** Cancel any in-flight smooth-scroll animation on the active handler. */
110
- cancelScroll(): void;
111
- disableDefaultResize(): void;
112
- setScrollTarget(target: EventTarget): void;
113
- setScrollToPosFn(fn: (index: number, sizeCache: import("./sizes").SizeCache, containerSize: number, totalItems: number, align: string) => number): void;
114
- setScrollToIndexFn(fn: (index: number, align: string, behavior?: string, duration?: number, easing?: (t: number) => number) => void | false): void;
115
- onScrollFrame(): void;
116
- onScrollIdle(): void;
117
- removeItemById(id: string | number): number;
118
- insertItemAt(item: T, index: number): void;
119
- setRemoveItemFn(fn: (id: string | number) => number): void;
120
- setInsertItemFn(fn: (item: T, index: number) => void): void;
121
- setUpdateItemFn(fn: (id: string | number, updates: Partial<T>) => boolean): void;
122
- setGetIndexByIdFn(fn: (id: string | number) => number): void;
123
- getRenderedElement(index: number): HTMLElement | null;
124
- setNavConfig(config: {
117
+ }
118
+ /** The size cache and the spec behind it. */
119
+ export interface SizesCapability {
120
+ readonly cache: SizeCache;
121
+ readonly rawSpec: number | ((index: number, ...args: unknown[]) => number);
122
+ /** Replace the size spec. `gap` is the spacing baked into the spec, so the
123
+ * cache can keep excluding one trailing gap from the total; omit it when the
124
+ * spec carries none (table's fixed row height, for instance). */
125
+ setConfig(config: number | ((index: number) => number), gap?: number): void;
126
+ rebuild(): void;
127
+ }
128
+ /** The render pipeline: run it, replace it, or describe item state to it. */
129
+ export interface RenderCapability {
130
+ force(): void;
131
+ ifNeeded(): void;
132
+ contentSize(size: number): void;
133
+ setFn(renderIfNeeded: () => void, forceRender: () => void): void;
134
+ setStateFn(fn: (index: number, state: ItemState) => void): void;
135
+ getStateFn(): ((index: number, state: ItemState) => void) | null;
136
+ }
137
+ /** The cross-plugin method bus and the shared event handlers. */
138
+ export interface HooksCapability {
139
+ /** Register a public method on the list. Public names are a contract:
140
+ * a second claimant throws. Underscore names are the internal protocol. */
141
+ method(name: string, fn: Function): void;
142
+ get(name: string): Function | undefined;
143
+ onClick(handler: (event: MouseEvent) => void): void;
144
+ onKeydown(handler: (event: KeyboardEvent) => void): void;
145
+ onDestroy(handler: () => void): void;
146
+ }
147
+ /** Keyboard navigation geometry, shared between layout plugins and selection. */
148
+ export interface NavCapability {
149
+ set(config: {
125
150
  total?: () => number;
126
151
  ud?: number;
127
152
  lr?: number;
128
153
  scrollIndex?: (itemIndex: number) => number;
129
154
  navigate?: (currentIndex: number, key: string, total: number) => number;
130
155
  }): void;
131
- getNavConfig(): {
156
+ get(): {
132
157
  ud: number;
133
158
  lr: number;
134
159
  scrollIndex: ((itemIndex: number) => number) | null;
@@ -136,10 +161,39 @@ export interface PluginContext<T extends VListItem = VListItem> {
136
161
  total: (() => number) | null;
137
162
  };
138
163
  }
139
- export interface VListPlugin<T extends VListItem = VListItem> {
164
+ /**
165
+ * What a plugin receives in `setup()`. Grouped by capability rather than laid
166
+ * out flat: the flat form had fifty members with no map from a member to the
167
+ * part of the engine it reached.
168
+ */
169
+ export interface PluginContext<T extends VListItem = VListItem> {
170
+ readonly dom: DomCapability;
171
+ readonly scroll: ScrollCapability;
172
+ readonly items: ItemsCapability<T>;
173
+ readonly sizes: SizesCapability;
174
+ readonly render: RenderCapability;
175
+ readonly hooks: HooksCapability;
176
+ readonly nav: NavCapability;
177
+ readonly pool: ElementPool;
178
+ readonly config: ResolvedConfig;
179
+ readonly emitter: Emitter<import("../types").VListEvents<T>>;
180
+ readonly template: ItemTemplate<T>;
181
+ getState(): EngineState;
182
+ }
183
+ export interface VListPlugin<T extends VListItem = VListItem, M = {}> {
140
184
  readonly name: string;
141
185
  readonly priority?: number;
142
186
  readonly conflicts?: readonly string[];
187
+ /**
188
+ * Cold path: reject a list configuration this plugin cannot support.
189
+ *
190
+ * Runs before setup and outside its catch, so throwing here reaches the
191
+ * caller. A throw from `setup()` cannot: it is reported as an `error` event
192
+ * so that one plugin's failure does not stop the others, which is the right
193
+ * behaviour for a fault and the wrong one for a configuration the plugin has
194
+ * already decided it cannot serve.
195
+ */
196
+ validateConfig?(config: ResolvedConfig): void;
143
197
  /** Cold path: one-time wiring during createVList(). */
144
198
  setup?(ctx: PluginContext<T>): void;
145
199
  /** Hot path: compiled into linear arrays, iterated per frame. */
@@ -152,7 +206,25 @@ export interface VListPlugin<T extends VListItem = VListItem> {
152
206
  };
153
207
  /** Cleanup on destroy. */
154
208
  destroy?(): void;
209
+ /**
210
+ * Phantom marker: the methods this plugin adds to the list instance.
211
+ * Never set at runtime; `createVList` reads it to type the returned list.
212
+ */
213
+ readonly __methods?: M;
155
214
  }
215
+ /** @internal Turns a union into an intersection. */
216
+ type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
217
+ /**
218
+ * @internal The method map a single plugin declares. The item type is matched
219
+ * loosely: a plugin typed for a specific item is not assignable to
220
+ * `VListPlugin<VListItem, ...>` under strict function types.
221
+ */
222
+ type MethodsOf<P> = P extends VListPlugin<any, infer M> ? M : {};
223
+ /**
224
+ * The methods a plugin array adds to the list instance. A plugin that declares
225
+ * no methods contributes nothing, so `createVList(config)` stays exactly `VList<T>`.
226
+ */
227
+ export type PluginMethods<P extends readonly unknown[]> = UnionToIntersection<MethodsOf<P[number]>>;
156
228
  export interface VList<T extends VListItem = VListItem> {
157
229
  readonly element: HTMLElement;
158
230
  readonly items: readonly T[];
@@ -176,7 +248,6 @@ export interface VList<T extends VListItem = VListItem> {
176
248
  on<K extends keyof import("../types").VListEvents<T>>(event: K, handler: import("../types").EventHandler<import("../types").VListEvents<T>[K]>): import("../types").Unsubscribe;
177
249
  off<K extends keyof import("../types").VListEvents<T>>(event: K, handler: import("../types").EventHandler<import("../types").VListEvents<T>[K]>): void;
178
250
  destroy(): void;
179
- [key: string]: unknown;
180
251
  }
181
252
  export interface CreateVListConfig<T extends VListItem = VListItem> {
182
253
  container: HTMLElement | string;
@@ -192,4 +263,5 @@ export interface CreateVListConfig<T extends VListItem = VListItem> {
192
263
  /** Defer initial render to the next animation frame. */
193
264
  defer?: boolean;
194
265
  }
266
+ export {};
195
267
  //# sourceMappingURL=types.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * vlist v2 — Velocity Tracking
2
+ * vlist — Velocity Tracking
3
3
  * Lightweight 2-sample velocity tracker for scroll momentum detection.
4
4
  */
5
5
  export declare const MIN_RELIABLE_SAMPLES = 2;
package/dist/index.d.ts CHANGED
@@ -12,7 +12,9 @@ export { createVList } from "./core/create";
12
12
  export { scrollbar } from "./plugins/scrollbar";
13
13
  export type { ScrollbarPluginConfig } from "./plugins/scrollbar";
14
14
  export { grid } from "./plugins/grid";
15
+ export type { GridPluginConfig } from "./plugins/grid";
15
16
  export { a11y } from "./plugins/a11y";
17
+ export type { A11yPluginConfig } from "./plugins/a11y";
16
18
  export { selection } from "./plugins/selection";
17
19
  export type { SelectionPluginConfig } from "./plugins/selection";
18
20
  export { page } from "./plugins/page";
@@ -39,10 +41,23 @@ export { search, DEFAULT_SEARCH_TEXT } from "./plugins/search";
39
41
  export type { SearchPluginConfig, SearchText } from "./plugins/search";
40
42
  export { carousel, registerPreset, getPreset, resolvePreset, full, hero, heroCenter, multi, uncontained } from "./plugins/carousel";
41
43
  export type { CarouselPluginConfig, CarouselVariant, CarouselDirection, CarouselState, SlotConfig, SlotConfigResolver, TextFade } from "./plugins/carousel";
44
+ export type { AutosizeMethods } from "./plugins/autosize";
45
+ export type { CarouselMethods } from "./plugins/carousel";
46
+ export type { DataMethods } from "./plugins/data";
47
+ export type { GridMethods } from "./plugins/grid";
48
+ export type { GroupsMethods } from "./plugins/groups";
49
+ export type { MasonryMethods } from "./plugins/masonry";
50
+ export type { ScrollbarMethods } from "./plugins/scrollbar";
51
+ export type { SearchMethods } from "./plugins/search";
52
+ export type { SelectionMethods } from "./plugins/selection";
53
+ export type { SnapshotsMethods } from "./plugins/snapshots";
54
+ export type { SortableMethods } from "./plugins/sortable";
55
+ export type { TableMethods } from "./plugins/table";
56
+ export type { TreeMethods } from "./plugins/tree";
42
57
  export { createStats } from "./utils/stats";
43
58
  export type { Stats, StatsConfig, StatsState } from "./utils/stats";
44
59
  export { rebuild } from "./utils/rebuild";
45
60
  export type { RebuildOptions } from "./utils/rebuild";
46
- export type { VListItem, VListEvents, ItemConfig, ItemTemplate, ItemState, SelectionMode, SelectionConfig, SelectionState, ScrollbarConfig, ScrollbarPadding, ScrollbarOptions, ScrollConfig, ScrollToOptions, ScrollSnapshot, VListAdapter, AdapterParams, AdapterResponse, Range, ViewportState, EventHandler, Unsubscribe, GridConfig, MasonryConfig, GroupsConfig, GroupHeaderConfig, GridSizeContext, GridHeightContext, TreeState, } from "./types";
47
- export type { Axis, AxisConfig, VList, VListPlugin, PluginContext, CreateVListConfig, CompiledHooks, ResolvedConfig, DOMStructure, ElementPool, } from "./core/types";
61
+ export type { VListItem, VListEvents, ItemConfig, ItemTemplate, ItemState, SelectionMode, SelectionConfig, SelectionState, ScrollbarPadding, ScrollbarOptions, ScrollConfig, ScrollToOptions, ScrollSnapshot, VListAdapter, AdapterParams, AdapterResponse, Range, ViewportState, EventHandler, Unsubscribe, GridConfig, MasonryConfig, GroupsConfig, GroupHeaderConfig, GridSizeContext, GridHeightContext, TreeState, } from "./types";
62
+ export type { Axis, AxisConfig, VList, VListPlugin, PluginMethods, PluginContext, CreateVListConfig, CompiledHooks, ResolvedConfig, DOMStructure, ElementPool, } from "./core/types";
48
63
  //# sourceMappingURL=index.d.ts.map