vlist 2.8.1 → 3.0.0-next.2

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.
@@ -7,10 +7,21 @@
7
7
  import type { VListItem } from "../types";
8
8
  import type { CreateVListConfig, VListPlugin, VList } from "./types";
9
9
  import type { SizeCache } from "./sizes";
10
- import { type BoundedScrollHandler, type BoundedScrollConfig } from "./runway";
11
- export declare function createVList<T extends VListItem = VListItem>(rawConfig: CreateVListConfig<T>, plugins?: VListPlugin<T>[],
12
- /** @internal Provided only by the opt-in scroll entry. */
10
+ import type { BoundedScrollHandler, BoundedScrollConfig } from "./runway";
11
+ import type { ScrollHandler, ScrollHandlerConfig } from "./scroll";
12
+ import { type Emitter } from "../events";
13
+ import type { VListEvents } from "../types";
14
+ /** Create a list with native scrolling. Opt into synthetic input via vlist/synthetic. */
15
+ export declare function createVList<T extends VListItem = VListItem>(config: CreateVListConfig<T>, plugins?: VListPlugin<T>[]): VList<T>;
16
+ /** @internal Shared factory; entries select the input handler. */
17
+ export declare function createCore<T extends VListItem = VListItem>(rawConfig: CreateVListConfig<T>, plugins?: VListPlugin<T>[],
18
+ /** @internal Omitted by the native entry. */
13
19
  logicalHandlerFactory?: (config: BoundedScrollConfig & {
14
20
  sizeCache: SizeCache;
15
- }) => BoundedScrollHandler): VList<T>;
21
+ }) => BoundedScrollHandler, nativeOptions?: {
22
+ native: (config: ScrollHandlerConfig) => ScrollHandler & {
23
+ commitScroll(pos?: number): void;
24
+ };
25
+ onContentSize: (size: number, emitter: Emitter<VListEvents<T>>) => void;
26
+ }): VList<T>;
16
27
  //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { ScrollHandler, ScrollHandlerConfig } from "./scroll";
2
+ export declare function createScrollSource(config: ScrollHandlerConfig): ScrollHandler & {
3
+ commitScroll(pos?: number): void;
4
+ };
5
+ //# sourceMappingURL=scroll-source.d.ts.map
@@ -28,5 +28,7 @@ export interface ScrollHandlerConfig {
28
28
  /** Called when scrolling becomes idle */
29
29
  readonly onIdle: () => void;
30
30
  }
31
- export declare function createScrollHandler(config: ScrollHandlerConfig): ScrollHandler;
31
+ export declare function createScrollHandler(config: ScrollHandlerConfig): ScrollHandler & {
32
+ commitScroll(pos?: number): void;
33
+ };
32
34
  //# sourceMappingURL=scroll.d.ts.map
@@ -79,11 +79,15 @@ export interface PluginContext<T extends VListItem = VListItem> {
79
79
  registerDestroyHandler(handler: () => void): void;
80
80
  enableListboxRole(): void;
81
81
  setSizeConfig(config: number | ((index: number) => number)): void;
82
- /** @deprecated Use setScrollSource in 3.0; removed in 3.0.
83
- * See https://vlist.io/docs/rfcs/RFC-014-Scroll-Input-Model */
84
- setScrollFns(get: () => number, set: (pos: number) => void): void;
82
+ /** Install an external writer and disable default scroll/wheel listeners. */
83
+ setScrollSource(source: {
84
+ write(px: number): void;
85
+ onContentSize?(px: number): void;
86
+ }): void;
87
+ /** Commit an external position, render synchronously and schedule configured idle. */
88
+ commitScroll(px: number): void;
85
89
  /** Request the bounded scroll handler in infinite-loop (wrap) mode (carousel). */
86
- setBoundedWrap(config: import("./runway").WrapConfig): void;
90
+ setBoundedWrap(config: import("./runway").WrapConfig, createHandler: (config: import("./runway").BoundedScrollConfig) => import("./runway").BoundedScrollHandler): void;
87
91
  setVirtualTotalFn(fn: () => number): void;
88
92
  setIndexMapFn(fn: (renderIndex: number) => number): void;
89
93
  getItems(): readonly T[];
@@ -104,9 +108,6 @@ export interface PluginContext<T extends VListItem = VListItem> {
104
108
  smoothScrollTo(target: number | (() => number), duration: number, easing?: (t: number) => number, onComplete?: () => void): void;
105
109
  /** Cancel any in-flight smooth-scroll animation on the active handler. */
106
110
  cancelScroll(): void;
107
- /** @deprecated Use setScrollSource in 3.0; removed in 3.0.
108
- * See https://vlist.io/docs/rfcs/RFC-014-Scroll-Input-Model */
109
- disableDefaultScroll(): void;
110
111
  disableDefaultResize(): void;
111
112
  setScrollTarget(target: EventTarget): void;
112
113
  setScrollToPosFn(fn: (index: number, sizeCache: import("./sizes").SizeCache, containerSize: number, totalItems: number, align: string) => number): void;
package/dist/index.d.ts CHANGED
@@ -39,11 +39,6 @@ export { search, DEFAULT_SEARCH_TEXT } from "./plugins/search";
39
39
  export type { SearchPluginConfig, SearchText } from "./plugins/search";
40
40
  export { carousel, registerPreset, getPreset, resolvePreset, full, hero, heroCenter, multi, uncontained } from "./plugins/carousel";
41
41
  export type { CarouselPluginConfig, CarouselVariant, CarouselDirection, CarouselState, SlotConfig, SlotConfigResolver, TextFade } from "./plugins/carousel";
42
- /** @deprecated Removed in 3.0. Use `scroll: { mode: "synthetic" }` from
43
- * `vlist/synthetic` (bounded remains available in 2.x).
44
- * See https://vlist.io/docs/rfcs/RFC-014-Scroll-Input-Model */
45
- export { scale } from "./plugins/scale";
46
- export type { ScalePluginConfig } from "./plugins/scale";
47
42
  export { createStats } from "./utils/stats";
48
43
  export type { Stats, StatsConfig, StatsState } from "./utils/stats";
49
44
  export { rebuild } from "./utils/rebuild";