Skip to content

Commit ef51ffd

Browse files
authored
v0.8.0 (#16)
* Use node.moveBefore if available. * Update build process, export lib only as ES modules. * Bump version to 0.8.0. * Update docs. * Remove legacy benchmark. * Update deps.
1 parent 843c9c9 commit ef51ffd

File tree

277 files changed

+36604
-95542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+36604
-95542
lines changed

dist/auto-scroll-Drw3BB1r.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-scroll-Drw3BB1r.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-scroll-JoquSmSR.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-scroll-JoquSmSR.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auto-scroll-U9tXUxGI.d.ts

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
import { Point, Rect } from "./types-Cmt4yuYh.js";
2+
3+
//#region src/utils/classic-object-pool.d.ts
4+
declare class ClassicObjectPool<Item extends NonNullable<any>, ItemArgs extends any[] = []> {
5+
protected _batchSize: number;
6+
protected _maxSize: number;
7+
protected _minSize: number;
8+
protected _shrinkThreshold: number;
9+
protected _data: Item[];
10+
protected _index: number;
11+
protected _getItem: (item?: Item, ...args: ItemArgs) => Item;
12+
protected _onRelease: ((item: Item) => void) | undefined;
13+
constructor(getItem: (item?: Item, ...args: ItemArgs) => Item, {
14+
batchSize,
15+
minBatchCount,
16+
maxBatchCount,
17+
initialBatchCount,
18+
shrinkThreshold,
19+
onRelease
20+
}?: {
21+
batchSize?: number;
22+
minBatchCount?: number;
23+
maxBatchCount?: number;
24+
initialBatchCount?: number;
25+
shrinkThreshold?: number;
26+
onRelease?: (object: Item) => void;
27+
});
28+
get(...args: ItemArgs): Item;
29+
release(object: Item): void;
30+
destroy(): void;
31+
}
32+
//#endregion
33+
//#region src/auto-scroll/auto-scroll.d.ts
34+
declare const AUTO_SCROLL_AXIS: {
35+
readonly x: 1;
36+
readonly y: 2;
37+
};
38+
declare const AUTO_SCROLL_AXIS_DIRECTION: {
39+
readonly forward: 4;
40+
readonly reverse: 8;
41+
};
42+
declare const AUTO_SCROLL_DIRECTION_X: {
43+
readonly none: 0;
44+
readonly left: 9;
45+
readonly right: 5;
46+
};
47+
declare const AUTO_SCROLL_DIRECTION_Y: {
48+
readonly none: 0;
49+
readonly up: 10;
50+
readonly down: 6;
51+
};
52+
declare const AUTO_SCROLL_DIRECTION: {
53+
readonly none: 0;
54+
readonly up: 10;
55+
readonly down: 6;
56+
readonly left: 9;
57+
readonly right: 5;
58+
};
59+
declare function getDirectionAsString(direction: number): "none" | "left" | "right" | "up" | "down";
60+
type AutoScrollAxis = (typeof AUTO_SCROLL_AXIS)[keyof typeof AUTO_SCROLL_AXIS];
61+
type AutoScrollDirectionX = (typeof AUTO_SCROLL_DIRECTION_X)[keyof typeof AUTO_SCROLL_DIRECTION_X];
62+
type AutoScrollDirectionY = (typeof AUTO_SCROLL_DIRECTION_Y)[keyof typeof AUTO_SCROLL_DIRECTION_Y];
63+
type AutoScrollDirection = (typeof AUTO_SCROLL_DIRECTION)[keyof typeof AUTO_SCROLL_DIRECTION];
64+
interface AutoScrollSpeedData {
65+
direction: ReturnType<typeof getDirectionAsString>;
66+
threshold: number;
67+
distance: number;
68+
value: number;
69+
maxValue: number;
70+
duration: number;
71+
speed: number;
72+
deltaTime: number;
73+
isEnding: boolean;
74+
}
75+
type AutoScrollTargetPadding = {
76+
left?: number;
77+
right?: number;
78+
top?: number;
79+
bottom?: number;
80+
};
81+
interface AutoScrollItem {
82+
readonly targets: AutoScrollItemTarget[];
83+
readonly clientRect: Rect;
84+
readonly position: Point;
85+
readonly inertAreaSize: number;
86+
readonly smoothStop: boolean;
87+
readonly speed: number | AutoScrollItemSpeedCallback;
88+
readonly onStart?: AutoScrollItemEventCallback | null;
89+
readonly onStop?: AutoScrollItemEventCallback | null;
90+
}
91+
interface AutoScrollSettings {
92+
overlapCheckInterval: number;
93+
}
94+
interface AutoScrollOptions extends Partial<AutoScrollSettings> {}
95+
interface AutoScrollItemTarget {
96+
element: Window | Element;
97+
axis?: 'x' | 'y' | 'xy';
98+
priority?: number;
99+
threshold?: number;
100+
padding?: AutoScrollTargetPadding;
101+
scrollPadding?: AutoScrollTargetPadding;
102+
}
103+
type AutoScrollItemEventCallback = (scrollElement: Window | Element, scrollDirection: ReturnType<typeof getDirectionAsString>) => void;
104+
type AutoScrollItemEffectCallback = () => void;
105+
type AutoScrollItemSpeedCallback = (scrollElement: Window | Element, scrollData: AutoScrollSpeedData) => number;
106+
declare class AutoScrollItemData {
107+
positionX: number;
108+
positionY: number;
109+
directionX: AutoScrollDirectionX;
110+
directionY: AutoScrollDirectionY;
111+
overlapCheckRequestTime: number;
112+
constructor();
113+
}
114+
declare class AutoScrollAction {
115+
element: Element | Window | null;
116+
requestX: AutoScrollRequest | null;
117+
requestY: AutoScrollRequest | null;
118+
scrollLeft: number;
119+
scrollTop: number;
120+
constructor();
121+
reset(): void;
122+
addRequest(request: AutoScrollRequest): void;
123+
removeRequest(request: AutoScrollRequest): void;
124+
computeScrollValues(): void;
125+
scroll(): void;
126+
}
127+
declare class AutoScrollRequest {
128+
item: AutoScrollItem | null;
129+
element: Element | Window | null;
130+
isActive: boolean;
131+
isEnding: boolean;
132+
direction: AutoScrollDirection;
133+
value: number;
134+
maxValue: number;
135+
threshold: number;
136+
distance: number;
137+
deltaTime: number;
138+
speed: number;
139+
duration: number;
140+
action: AutoScrollAction | null;
141+
constructor();
142+
reset(): void;
143+
hasReachedEnd(): boolean;
144+
computeCurrentScrollValue(): number;
145+
computeNextScrollValue(): number;
146+
computeSpeed(): number;
147+
tick(deltaTime: number): number;
148+
onStart(): void;
149+
onStop(): void;
150+
}
151+
declare function autoScrollSmoothSpeed(maxSpeed?: number, accelerationFactor?: number, decelerationFactor?: number): AutoScrollItemSpeedCallback;
152+
declare class AutoScroll {
153+
readonly items: AutoScrollItem[];
154+
readonly settings: AutoScrollSettings;
155+
protected _isDestroyed: boolean;
156+
protected _isTicking: boolean;
157+
protected _tickTime: number;
158+
protected _tickDeltaTime: number;
159+
protected _itemData: Map<AutoScrollItem, AutoScrollItemData>;
160+
protected _actions: AutoScrollAction[];
161+
protected _requests: {
162+
[AUTO_SCROLL_AXIS.x]: Map<AutoScrollItem, AutoScrollRequest>;
163+
[AUTO_SCROLL_AXIS.y]: Map<AutoScrollItem, AutoScrollRequest>;
164+
};
165+
protected _requestPool: ClassicObjectPool<AutoScrollRequest>;
166+
protected _actionPool: ClassicObjectPool<AutoScrollAction>;
167+
constructor(options?: AutoScrollOptions);
168+
protected _frameRead(time: number): void;
169+
protected _frameWrite(): void;
170+
protected _startTicking(): void;
171+
protected _stopTicking(): void;
172+
protected _requestItemScroll(item: AutoScrollItem, axis: AutoScrollAxis, element: Window | Element, direction: AutoScrollDirection, threshold: number, distance: number, maxValue: number): void;
173+
protected _cancelItemScroll(item: AutoScrollItem, axis: AutoScrollAxis): void;
174+
protected _checkItemOverlap(item: AutoScrollItem, checkX: boolean, checkY: boolean): void;
175+
protected _updateScrollRequest(scrollRequest: AutoScrollRequest): boolean;
176+
protected _updateItems(): void;
177+
protected _updateRequests(): void;
178+
protected _requestAction(request: AutoScrollRequest, axis: AutoScrollAxis): void;
179+
protected _updateActions(): void;
180+
protected _applyActions(): void;
181+
addItem(item: AutoScrollItem): void;
182+
removeItem(item: AutoScrollItem): void;
183+
isDestroyed(): boolean;
184+
isItemScrollingX(item: AutoScrollItem): boolean;
185+
isItemScrollingY(item: AutoScrollItem): boolean;
186+
isItemScrolling(item: AutoScrollItem): boolean;
187+
updateSettings(options?: AutoScrollOptions): void;
188+
destroy(): void;
189+
}
190+
//#endregion
191+
export { AUTO_SCROLL_AXIS, AUTO_SCROLL_AXIS_DIRECTION, AUTO_SCROLL_DIRECTION, AutoScroll, AutoScrollItem, AutoScrollItemEffectCallback, AutoScrollItemEventCallback, AutoScrollItemSpeedCallback, AutoScrollItemTarget, AutoScrollOptions, AutoScrollSettings, autoScrollSmoothSpeed };
192+
//# sourceMappingURL=auto-scroll-U9tXUxGI.d.ts.map

0 commit comments

Comments
 (0)