@fiddle-digital/string-tune 1.1.45 → 1.1.47
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/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +75 -4
- package/dist/index.d.ts +75 -4
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -315,6 +315,11 @@ declare class EventManager {
|
|
|
315
315
|
private stateEvents;
|
|
316
316
|
private lastPayloads;
|
|
317
317
|
constructor();
|
|
318
|
+
/**
|
|
319
|
+
* Marks an event as stateful so the last payload is cached and replayed to new listeners.
|
|
320
|
+
* Optionally seeds the initial payload.
|
|
321
|
+
*/
|
|
322
|
+
registerStateEvent(eventName: string, initialPayload?: any): void;
|
|
318
323
|
/**
|
|
319
324
|
* Subscribes to an event.
|
|
320
325
|
* Optionally appends an `id` to the event name for namespacing.
|
|
@@ -1462,6 +1467,7 @@ declare class StringCursor extends StringModule {
|
|
|
1462
1467
|
private lastFrameTime;
|
|
1463
1468
|
constructor(context: StringContext);
|
|
1464
1469
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
1470
|
+
onResize(): void;
|
|
1465
1471
|
onMutate(data: StringData): void;
|
|
1466
1472
|
onObjectConnected(object: StringObject): void;
|
|
1467
1473
|
getCursorClass(object: StringObject): string | null;
|
|
@@ -1491,6 +1497,7 @@ declare class StringCursor extends StringModule {
|
|
|
1491
1497
|
private bindGlobalLifecycleListeners;
|
|
1492
1498
|
private unbindGlobalLifecycleListeners;
|
|
1493
1499
|
private setMouseCoordinates;
|
|
1500
|
+
private parseCursorVars;
|
|
1494
1501
|
private getFrameAdjustedLerp;
|
|
1495
1502
|
private getObjectDimensions;
|
|
1496
1503
|
private calculateOffset;
|
|
@@ -1643,7 +1650,16 @@ declare class StringGlide extends StringModule {
|
|
|
1643
1650
|
* based on current scroll velocity.
|
|
1644
1651
|
*/
|
|
1645
1652
|
declare class StringLerp extends StringModule {
|
|
1653
|
+
private hasInitializedCSS;
|
|
1646
1654
|
constructor(context: StringContext);
|
|
1655
|
+
/**
|
|
1656
|
+
* Initialize lerp value when object connects.
|
|
1657
|
+
*/
|
|
1658
|
+
onObjectConnected(object: StringObject): void;
|
|
1659
|
+
/**
|
|
1660
|
+
* Called on resize - use this to apply initial values after mirrors are created.
|
|
1661
|
+
*/
|
|
1662
|
+
onResize(): void;
|
|
1647
1663
|
/**
|
|
1648
1664
|
* Resets the `--lerp` value to 0 when scroll stops.
|
|
1649
1665
|
*/
|
|
@@ -1653,9 +1669,21 @@ declare class StringLerp extends StringModule {
|
|
|
1653
1669
|
*/
|
|
1654
1670
|
onFrame(data: StringData): void;
|
|
1655
1671
|
/**
|
|
1656
|
-
*
|
|
1672
|
+
* Computes the lerp value for the object.
|
|
1673
|
+
*/
|
|
1674
|
+
private recomputeLerp;
|
|
1675
|
+
/**
|
|
1676
|
+
* Applies the lerp value to the object and its mirrors.
|
|
1657
1677
|
*/
|
|
1658
|
-
|
|
1678
|
+
onMutate(): void;
|
|
1679
|
+
/**
|
|
1680
|
+
* Updates the CSS variable on the object and connected elements.
|
|
1681
|
+
*/
|
|
1682
|
+
private updateObjectLerp;
|
|
1683
|
+
/**
|
|
1684
|
+
* Cleans up the CSS variable when object is disconnected.
|
|
1685
|
+
*/
|
|
1686
|
+
onObjectDisconnected(object: StringObject): void;
|
|
1659
1687
|
}
|
|
1660
1688
|
|
|
1661
1689
|
declare class StringProgress extends StringModule {
|
|
@@ -1663,7 +1691,6 @@ declare class StringProgress extends StringModule {
|
|
|
1663
1691
|
constructor(context: StringContext);
|
|
1664
1692
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
1665
1693
|
private recomputeProgress;
|
|
1666
|
-
private applyProgressValue;
|
|
1667
1694
|
calculatePositions(object: StringObject, windowSize: number): void;
|
|
1668
1695
|
onScroll(data: StringData): void;
|
|
1669
1696
|
onObjectConnected(object: StringObject): void;
|
|
@@ -2035,6 +2062,8 @@ declare class StringSequence extends StringModule {
|
|
|
2035
2062
|
private elementIndex;
|
|
2036
2063
|
private triggerElements;
|
|
2037
2064
|
private globalSettings;
|
|
2065
|
+
private stateRegistered;
|
|
2066
|
+
private lastEnteredStep;
|
|
2038
2067
|
private defaultDuration;
|
|
2039
2068
|
private initialized;
|
|
2040
2069
|
private static readonly ALL_STATES;
|
|
@@ -2048,6 +2077,7 @@ declare class StringSequence extends StringModule {
|
|
|
2048
2077
|
private tryApplyPendingActiveStep;
|
|
2049
2078
|
canConnect(object: StringObject): boolean;
|
|
2050
2079
|
onObjectConnected(object: StringObject): void;
|
|
2080
|
+
private ensureStateEventRegistered;
|
|
2051
2081
|
private parseTriggerKey;
|
|
2052
2082
|
private getMaxStep;
|
|
2053
2083
|
private resolveDuration;
|
|
@@ -2065,6 +2095,12 @@ declare class StringSequence extends StringModule {
|
|
|
2065
2095
|
private setStepState;
|
|
2066
2096
|
private setState;
|
|
2067
2097
|
onFrame(data: StringData): void;
|
|
2098
|
+
private emitTransitionStart;
|
|
2099
|
+
private emitTransitionProgress;
|
|
2100
|
+
private emitTransitionEnd;
|
|
2101
|
+
private emitStepEnter;
|
|
2102
|
+
private emitStepLeave;
|
|
2103
|
+
private emitActiveState;
|
|
2068
2104
|
}
|
|
2069
2105
|
|
|
2070
2106
|
type FormField = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
@@ -2140,6 +2176,37 @@ declare class StyleTxn {
|
|
|
2140
2176
|
}
|
|
2141
2177
|
declare const styleTxn: StyleTxn;
|
|
2142
2178
|
|
|
2179
|
+
interface ModuleBatchContext {
|
|
2180
|
+
module: StringModule;
|
|
2181
|
+
object: StringObject;
|
|
2182
|
+
element: HTMLElement;
|
|
2183
|
+
attributes: Record<string, any>;
|
|
2184
|
+
globalId: number;
|
|
2185
|
+
windowSize: number;
|
|
2186
|
+
}
|
|
2187
|
+
declare class DOMBatcher {
|
|
2188
|
+
private readQueue;
|
|
2189
|
+
private writeQueue;
|
|
2190
|
+
private computeQueue;
|
|
2191
|
+
private isProcessing;
|
|
2192
|
+
private pendingFrame;
|
|
2193
|
+
private rectCache;
|
|
2194
|
+
private dimensionCache;
|
|
2195
|
+
scheduleRead(task: () => void, priority?: number): void;
|
|
2196
|
+
scheduleCompute(task: () => void, priority?: number): void;
|
|
2197
|
+
scheduleWrite(task: () => void, priority?: number): void;
|
|
2198
|
+
batchModuleInitialization(contexts: ModuleBatchContext[]): void;
|
|
2199
|
+
getCachedRect(element: HTMLElement): DOMRect | undefined;
|
|
2200
|
+
getCachedDimensions(element: HTMLElement): {
|
|
2201
|
+
width: number;
|
|
2202
|
+
height: number;
|
|
2203
|
+
} | undefined;
|
|
2204
|
+
private scheduleFlush;
|
|
2205
|
+
private flush;
|
|
2206
|
+
flushSync(): void;
|
|
2207
|
+
clear(): void;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2143
2210
|
declare class StringTune {
|
|
2144
2211
|
/** Bound handler for the scroll start event */
|
|
2145
2212
|
private onScrollStartBind;
|
|
@@ -2157,6 +2224,8 @@ declare class StringTune {
|
|
|
2157
2224
|
private onMouseMoveBind;
|
|
2158
2225
|
private onContainerTransitionEndBind;
|
|
2159
2226
|
private onResizeObserverBind;
|
|
2227
|
+
private pendingScroll;
|
|
2228
|
+
private lastScrollEmitted;
|
|
2160
2229
|
/** Singleton instance of StringTune */
|
|
2161
2230
|
private static i;
|
|
2162
2231
|
/** Root scrollable element (typically <body>) */
|
|
@@ -2240,6 +2309,8 @@ declare class StringTune {
|
|
|
2240
2309
|
set scrollMobileMode(mode: ScrollMode);
|
|
2241
2310
|
set FPSTrackerVisible(visible: boolean);
|
|
2242
2311
|
set PositionTrackerVisible(visible: boolean);
|
|
2312
|
+
set domBatcherEnabled(enabled: boolean);
|
|
2313
|
+
set intersectionObserverEnabled(enabled: boolean);
|
|
2243
2314
|
private debouncedResize;
|
|
2244
2315
|
private constructor();
|
|
2245
2316
|
/**
|
|
@@ -2398,4 +2469,4 @@ declare class StringTune {
|
|
|
2398
2469
|
destroy(): void;
|
|
2399
2470
|
}
|
|
2400
2471
|
|
|
2401
|
-
export { CursorReactiveModule, type ScrollMarkRule as ScrollTriggerRule, StringAnchor, type StringContext, StringCursor, StringData, StringDelayLerpTracker, StringFPSTracker, StringForm, StringGlide, StringImpulse, StringLazy, StringLerp, StringLerpTracker, StringLoading, StringMagnetic, StringModule, StringObject, StringParallax, StringPositionTracker, StringProgress, StringProgressPart, StringResponsive, StringScrollbar, StringScroller, StringSequence, StringSplit, StringSpotlight, StringTune, StringVideoAutoplay, StringTune as default, frameDOM, styleTxn };
|
|
2472
|
+
export { CursorReactiveModule, DOMBatcher, type ScrollMarkRule as ScrollTriggerRule, StringAnchor, type StringContext, StringCursor, StringData, StringDelayLerpTracker, StringFPSTracker, StringForm, StringGlide, StringImpulse, StringLazy, StringLerp, StringLerpTracker, StringLoading, StringMagnetic, StringModule, StringObject, StringParallax, StringPositionTracker, StringProgress, StringProgressPart, StringResponsive, StringScrollbar, StringScroller, StringSequence, StringSplit, StringSpotlight, StringTune, StringVideoAutoplay, StringTune as default, frameDOM, styleTxn };
|
package/dist/index.d.ts
CHANGED
|
@@ -315,6 +315,11 @@ declare class EventManager {
|
|
|
315
315
|
private stateEvents;
|
|
316
316
|
private lastPayloads;
|
|
317
317
|
constructor();
|
|
318
|
+
/**
|
|
319
|
+
* Marks an event as stateful so the last payload is cached and replayed to new listeners.
|
|
320
|
+
* Optionally seeds the initial payload.
|
|
321
|
+
*/
|
|
322
|
+
registerStateEvent(eventName: string, initialPayload?: any): void;
|
|
318
323
|
/**
|
|
319
324
|
* Subscribes to an event.
|
|
320
325
|
* Optionally appends an `id` to the event name for namespacing.
|
|
@@ -1462,6 +1467,7 @@ declare class StringCursor extends StringModule {
|
|
|
1462
1467
|
private lastFrameTime;
|
|
1463
1468
|
constructor(context: StringContext);
|
|
1464
1469
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
1470
|
+
onResize(): void;
|
|
1465
1471
|
onMutate(data: StringData): void;
|
|
1466
1472
|
onObjectConnected(object: StringObject): void;
|
|
1467
1473
|
getCursorClass(object: StringObject): string | null;
|
|
@@ -1491,6 +1497,7 @@ declare class StringCursor extends StringModule {
|
|
|
1491
1497
|
private bindGlobalLifecycleListeners;
|
|
1492
1498
|
private unbindGlobalLifecycleListeners;
|
|
1493
1499
|
private setMouseCoordinates;
|
|
1500
|
+
private parseCursorVars;
|
|
1494
1501
|
private getFrameAdjustedLerp;
|
|
1495
1502
|
private getObjectDimensions;
|
|
1496
1503
|
private calculateOffset;
|
|
@@ -1643,7 +1650,16 @@ declare class StringGlide extends StringModule {
|
|
|
1643
1650
|
* based on current scroll velocity.
|
|
1644
1651
|
*/
|
|
1645
1652
|
declare class StringLerp extends StringModule {
|
|
1653
|
+
private hasInitializedCSS;
|
|
1646
1654
|
constructor(context: StringContext);
|
|
1655
|
+
/**
|
|
1656
|
+
* Initialize lerp value when object connects.
|
|
1657
|
+
*/
|
|
1658
|
+
onObjectConnected(object: StringObject): void;
|
|
1659
|
+
/**
|
|
1660
|
+
* Called on resize - use this to apply initial values after mirrors are created.
|
|
1661
|
+
*/
|
|
1662
|
+
onResize(): void;
|
|
1647
1663
|
/**
|
|
1648
1664
|
* Resets the `--lerp` value to 0 when scroll stops.
|
|
1649
1665
|
*/
|
|
@@ -1653,9 +1669,21 @@ declare class StringLerp extends StringModule {
|
|
|
1653
1669
|
*/
|
|
1654
1670
|
onFrame(data: StringData): void;
|
|
1655
1671
|
/**
|
|
1656
|
-
*
|
|
1672
|
+
* Computes the lerp value for the object.
|
|
1673
|
+
*/
|
|
1674
|
+
private recomputeLerp;
|
|
1675
|
+
/**
|
|
1676
|
+
* Applies the lerp value to the object and its mirrors.
|
|
1657
1677
|
*/
|
|
1658
|
-
|
|
1678
|
+
onMutate(): void;
|
|
1679
|
+
/**
|
|
1680
|
+
* Updates the CSS variable on the object and connected elements.
|
|
1681
|
+
*/
|
|
1682
|
+
private updateObjectLerp;
|
|
1683
|
+
/**
|
|
1684
|
+
* Cleans up the CSS variable when object is disconnected.
|
|
1685
|
+
*/
|
|
1686
|
+
onObjectDisconnected(object: StringObject): void;
|
|
1659
1687
|
}
|
|
1660
1688
|
|
|
1661
1689
|
declare class StringProgress extends StringModule {
|
|
@@ -1663,7 +1691,6 @@ declare class StringProgress extends StringModule {
|
|
|
1663
1691
|
constructor(context: StringContext);
|
|
1664
1692
|
initializeObject(globalId: number, object: StringObject, element: HTMLElement, attributes: Record<string, any>): void;
|
|
1665
1693
|
private recomputeProgress;
|
|
1666
|
-
private applyProgressValue;
|
|
1667
1694
|
calculatePositions(object: StringObject, windowSize: number): void;
|
|
1668
1695
|
onScroll(data: StringData): void;
|
|
1669
1696
|
onObjectConnected(object: StringObject): void;
|
|
@@ -2035,6 +2062,8 @@ declare class StringSequence extends StringModule {
|
|
|
2035
2062
|
private elementIndex;
|
|
2036
2063
|
private triggerElements;
|
|
2037
2064
|
private globalSettings;
|
|
2065
|
+
private stateRegistered;
|
|
2066
|
+
private lastEnteredStep;
|
|
2038
2067
|
private defaultDuration;
|
|
2039
2068
|
private initialized;
|
|
2040
2069
|
private static readonly ALL_STATES;
|
|
@@ -2048,6 +2077,7 @@ declare class StringSequence extends StringModule {
|
|
|
2048
2077
|
private tryApplyPendingActiveStep;
|
|
2049
2078
|
canConnect(object: StringObject): boolean;
|
|
2050
2079
|
onObjectConnected(object: StringObject): void;
|
|
2080
|
+
private ensureStateEventRegistered;
|
|
2051
2081
|
private parseTriggerKey;
|
|
2052
2082
|
private getMaxStep;
|
|
2053
2083
|
private resolveDuration;
|
|
@@ -2065,6 +2095,12 @@ declare class StringSequence extends StringModule {
|
|
|
2065
2095
|
private setStepState;
|
|
2066
2096
|
private setState;
|
|
2067
2097
|
onFrame(data: StringData): void;
|
|
2098
|
+
private emitTransitionStart;
|
|
2099
|
+
private emitTransitionProgress;
|
|
2100
|
+
private emitTransitionEnd;
|
|
2101
|
+
private emitStepEnter;
|
|
2102
|
+
private emitStepLeave;
|
|
2103
|
+
private emitActiveState;
|
|
2068
2104
|
}
|
|
2069
2105
|
|
|
2070
2106
|
type FormField = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
@@ -2140,6 +2176,37 @@ declare class StyleTxn {
|
|
|
2140
2176
|
}
|
|
2141
2177
|
declare const styleTxn: StyleTxn;
|
|
2142
2178
|
|
|
2179
|
+
interface ModuleBatchContext {
|
|
2180
|
+
module: StringModule;
|
|
2181
|
+
object: StringObject;
|
|
2182
|
+
element: HTMLElement;
|
|
2183
|
+
attributes: Record<string, any>;
|
|
2184
|
+
globalId: number;
|
|
2185
|
+
windowSize: number;
|
|
2186
|
+
}
|
|
2187
|
+
declare class DOMBatcher {
|
|
2188
|
+
private readQueue;
|
|
2189
|
+
private writeQueue;
|
|
2190
|
+
private computeQueue;
|
|
2191
|
+
private isProcessing;
|
|
2192
|
+
private pendingFrame;
|
|
2193
|
+
private rectCache;
|
|
2194
|
+
private dimensionCache;
|
|
2195
|
+
scheduleRead(task: () => void, priority?: number): void;
|
|
2196
|
+
scheduleCompute(task: () => void, priority?: number): void;
|
|
2197
|
+
scheduleWrite(task: () => void, priority?: number): void;
|
|
2198
|
+
batchModuleInitialization(contexts: ModuleBatchContext[]): void;
|
|
2199
|
+
getCachedRect(element: HTMLElement): DOMRect | undefined;
|
|
2200
|
+
getCachedDimensions(element: HTMLElement): {
|
|
2201
|
+
width: number;
|
|
2202
|
+
height: number;
|
|
2203
|
+
} | undefined;
|
|
2204
|
+
private scheduleFlush;
|
|
2205
|
+
private flush;
|
|
2206
|
+
flushSync(): void;
|
|
2207
|
+
clear(): void;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2143
2210
|
declare class StringTune {
|
|
2144
2211
|
/** Bound handler for the scroll start event */
|
|
2145
2212
|
private onScrollStartBind;
|
|
@@ -2157,6 +2224,8 @@ declare class StringTune {
|
|
|
2157
2224
|
private onMouseMoveBind;
|
|
2158
2225
|
private onContainerTransitionEndBind;
|
|
2159
2226
|
private onResizeObserverBind;
|
|
2227
|
+
private pendingScroll;
|
|
2228
|
+
private lastScrollEmitted;
|
|
2160
2229
|
/** Singleton instance of StringTune */
|
|
2161
2230
|
private static i;
|
|
2162
2231
|
/** Root scrollable element (typically <body>) */
|
|
@@ -2240,6 +2309,8 @@ declare class StringTune {
|
|
|
2240
2309
|
set scrollMobileMode(mode: ScrollMode);
|
|
2241
2310
|
set FPSTrackerVisible(visible: boolean);
|
|
2242
2311
|
set PositionTrackerVisible(visible: boolean);
|
|
2312
|
+
set domBatcherEnabled(enabled: boolean);
|
|
2313
|
+
set intersectionObserverEnabled(enabled: boolean);
|
|
2243
2314
|
private debouncedResize;
|
|
2244
2315
|
private constructor();
|
|
2245
2316
|
/**
|
|
@@ -2398,4 +2469,4 @@ declare class StringTune {
|
|
|
2398
2469
|
destroy(): void;
|
|
2399
2470
|
}
|
|
2400
2471
|
|
|
2401
|
-
export { CursorReactiveModule, type ScrollMarkRule as ScrollTriggerRule, StringAnchor, type StringContext, StringCursor, StringData, StringDelayLerpTracker, StringFPSTracker, StringForm, StringGlide, StringImpulse, StringLazy, StringLerp, StringLerpTracker, StringLoading, StringMagnetic, StringModule, StringObject, StringParallax, StringPositionTracker, StringProgress, StringProgressPart, StringResponsive, StringScrollbar, StringScroller, StringSequence, StringSplit, StringSpotlight, StringTune, StringVideoAutoplay, StringTune as default, frameDOM, styleTxn };
|
|
2472
|
+
export { CursorReactiveModule, DOMBatcher, type ScrollMarkRule as ScrollTriggerRule, StringAnchor, type StringContext, StringCursor, StringData, StringDelayLerpTracker, StringFPSTracker, StringForm, StringGlide, StringImpulse, StringLazy, StringLerp, StringLerpTracker, StringLoading, StringMagnetic, StringModule, StringObject, StringParallax, StringPositionTracker, StringProgress, StringProgressPart, StringResponsive, StringScrollbar, StringScroller, StringSequence, StringSplit, StringSpotlight, StringTune, StringVideoAutoplay, StringTune as default, frameDOM, styleTxn };
|