vlist 2.7.2 → 3.0.0-next.1

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.
@@ -45,9 +45,11 @@ export interface ScrollAdapter {
45
45
  setLogical(pos: LogicalScrollPosition): void;
46
46
  /** Pixel-equivalent of the current position (for public API / events). */
47
47
  getPixelEquivalent(): number;
48
+ /** Origin subtracted from logical item offsets when positioning content. */
49
+ getRenderOrigin(): number;
48
50
  /** Move to a pixel-equivalent position. Out-of-range input is clamped. */
49
51
  setPixelEquivalent(px: number): void;
50
- /** Maximum scrollable pixel-equivalent (`totalSize - containerSize`, >= 0). */
52
+ /** Maximum scrollable pixel-equivalent (`totalSize + padding - containerSize`, >= 0). */
51
53
  getMaxPixelEquivalent(): number;
52
54
  /** Advance the position by a pixel delta (used by native/wheel input). */
53
55
  scrollByPx(delta: number): void;
@@ -58,10 +60,14 @@ export interface ScrollAdapterConfig {
58
60
  readonly sizeCache: SizeCache;
59
61
  /** Read the current pixel-equivalent position from the active scroll source. */
60
62
  readonly getPixel: () => number;
63
+ /** Read the origin owned by the active scroll source. */
64
+ readonly getRenderOrigin: () => number;
61
65
  /** Write a (clamped) pixel-equivalent position to the active scroll source. */
62
66
  readonly setPixel: (px: number) => void;
63
67
  /** Current viewport size along the main axis. */
64
68
  readonly getContainerSize: () => number;
69
+ /** Total start and end padding along the main axis. */
70
+ readonly padding: number;
65
71
  }
66
72
  /**
67
73
  * Convert a pixel offset into a logical position. The returned position is
@@ -7,10 +7,22 @@
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 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>;
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
+ wrap: (config: BoundedScrollConfig) => BoundedScrollHandler;
26
+ onContentSize: (size: number, emitter: Emitter<VListEvents<T>>) => void;
27
+ }): VList<T>;
16
28
  //# 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,7 +79,13 @@ 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
- 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;
83
89
  /** Request the bounded scroll handler in infinite-loop (wrap) mode (carousel). */
84
90
  setBoundedWrap(config: import("./runway").WrapConfig): void;
85
91
  setVirtualTotalFn(fn: () => number): void;
@@ -102,7 +108,6 @@ export interface PluginContext<T extends VListItem = VListItem> {
102
108
  smoothScrollTo(target: number | (() => number), duration: number, easing?: (t: number) => number, onComplete?: () => void): void;
103
109
  /** Cancel any in-flight smooth-scroll animation on the active handler. */
104
110
  cancelScroll(): void;
105
- disableDefaultScroll(): void;
106
111
  disableDefaultResize(): void;
107
112
  setScrollTarget(target: EventTarget): void;
108
113
  setScrollToPosFn(fn: (index: number, sizeCache: import("./sizes").SizeCache, containerSize: number, totalItems: number, align: string) => number): void;
package/dist/index.d.ts CHANGED
@@ -39,9 +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 Use `scroll: { mode: "bounded" }` instead. Will be removed in vlist 3.0. */
43
- export { scale } from "./plugins/scale";
44
- export type { ScalePluginConfig } from "./plugins/scale";
45
42
  export { createStats } from "./utils/stats";
46
43
  export type { Stats, StatsConfig, StatsState } from "./utils/stats";
47
44
  export { rebuild } from "./utils/rebuild";