cineview 0.0.1-beta
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/LICENSE +21 -0
- package/README.md +102 -0
- package/README.zh-CN.md +102 -0
- package/dist/animations/animationParser.d.ts +24 -0
- package/dist/animations/composer.d.ts +13 -0
- package/dist/animations/presets/blink.d.ts +18 -0
- package/dist/animations/presets/blur.d.ts +18 -0
- package/dist/animations/presets/bounce.d.ts +18 -0
- package/dist/animations/presets/elastic.d.ts +23 -0
- package/dist/animations/presets/fade.d.ts +18 -0
- package/dist/animations/presets/flip.d.ts +18 -0
- package/dist/animations/presets/index.d.ts +38 -0
- package/dist/animations/presets/rotate.d.ts +23 -0
- package/dist/animations/presets/shake.d.ts +28 -0
- package/dist/animations/presets/slide.d.ts +23 -0
- package/dist/animations/presets/special.d.ts +38 -0
- package/dist/animations/presets/zoom.d.ts +23 -0
- package/dist/animations/registry.d.ts +51 -0
- package/dist/artifacts.json +40 -0
- package/dist/blink-BGmsrTwW.mjs +81 -0
- package/dist/blur-CQoB_VWp.mjs +52 -0
- package/dist/bounce-B_QJxgOq.mjs +64 -0
- package/dist/cineview-dev.css +2 -0
- package/dist/cineview-dev.es.mjs +2 -0
- package/dist/cineview-drag.umd.js +2 -0
- package/dist/cineview-scroll.umd.js +2 -0
- package/dist/cineview.es.mjs +2 -0
- package/dist/cineview.umd.js +2 -0
- package/dist/components/Animate/Animate.d.ts +67 -0
- package/dist/components/Animate/AnimateRenderBridge.d.ts +16 -0
- package/dist/components/Animate/AnimateVideo.d.ts +59 -0
- package/dist/components/Animate/StaggerContainer.d.ts +35 -0
- package/dist/components/Animate/__fixtures__/animate-media-public-path.fixture.d.ts +1 -0
- package/dist/components/Animate/animateInterpolation.d.ts +41 -0
- package/dist/components/Animate/animateRenderState.d.ts +23 -0
- package/dist/components/Animate/animateSemantics.d.ts +38 -0
- package/dist/components/Animate/animateTimeline.d.ts +14 -0
- package/dist/components/Animate/dragVisualState.d.ts +26 -0
- package/dist/components/Animate/index.d.ts +6 -0
- package/dist/components/Animate/useAnimateArrival.d.ts +35 -0
- package/dist/components/Animate/useAnimateDrag.d.ts +34 -0
- package/dist/components/Animate/useAnimatePublicTimeline.d.ts +16 -0
- package/dist/components/Animate/useAnimateScroll.d.ts +83 -0
- package/dist/components/Animate/useAnimatedPropertyLanes.d.ts +30 -0
- package/dist/components/Animate/visibilityScheduler.d.ts +12 -0
- package/dist/components/Cineview/Cineview.d.ts +46 -0
- package/dist/components/Cineview/CineviewDispatch.d.ts +2 -0
- package/dist/components/Cineview/DirectScrollCineview.d.ts +8 -0
- package/dist/components/Cineview/DragSceneStack.d.ts +55 -0
- package/dist/components/Cineview/ScrollSceneSlot.d.ts +42 -0
- package/dist/components/Cineview/ScrollSceneStack.d.ts +13 -0
- package/dist/components/Cineview/ScrollbarOverlay.d.ts +24 -0
- package/dist/components/Cineview/directScrollHelpers.d.ts +77 -0
- package/dist/components/Cineview/index.d.ts +5 -0
- package/dist/components/Cineview/preloadTargets.d.ts +18 -0
- package/dist/components/Cineview/regroupCallbacks.d.ts +10 -0
- package/dist/components/Cineview/useCineviewImperativeApi.d.ts +21 -0
- package/dist/components/Cineview/useNativeScrollController.d.ts +38 -0
- package/dist/components/Cineview/useScrollInputBindings.d.ts +9 -0
- package/dist/components/Cineview/useScrollSceneLayout.d.ts +24 -0
- package/dist/components/Cineview/useScrollSceneSnapshots.d.ts +32 -0
- package/dist/components/Cineview/useScrollViewport.d.ts +20 -0
- package/dist/components/Cineview/useScrollZoneRegistry.d.ts +35 -0
- package/dist/components/Container/Container.d.ts +2 -0
- package/dist/components/Container/index.d.ts +1 -0
- package/dist/components/Image/Image.d.ts +12 -0
- package/dist/components/Image/index.d.ts +2 -0
- package/dist/components/Position/Position.d.ts +13 -0
- package/dist/components/Position/index.d.ts +1 -0
- package/dist/components/Scene/Scene.d.ts +10 -0
- package/dist/components/Scene/SceneFixedLayer.d.ts +14 -0
- package/dist/components/Scene/__fixtures__/scene-grouped-public-path.fixture.d.ts +1 -0
- package/dist/components/Scene/dragPreparedState.d.ts +49 -0
- package/dist/components/Scene/helpers.d.ts +101 -0
- package/dist/components/Scene/index.d.ts +1 -0
- package/dist/components/Scene/sceneScrollBudget.d.ts +38 -0
- package/dist/components/Scene/sceneScrollRuntime.d.ts +65 -0
- package/dist/components/Scene/types.d.ts +189 -0
- package/dist/components/Scene/useDragSceneEngine.d.ts +67 -0
- package/dist/components/Scene/useElementTrack.d.ts +82 -0
- package/dist/components/Scene/useNativePointerDrag.d.ts +25 -0
- package/dist/components/Scene/useSceneAnimationRegistry.d.ts +56 -0
- package/dist/components/Scene/useScenePointerInput.d.ts +28 -0
- package/dist/components/Scene/useSceneRuntimeState.d.ts +17 -0
- package/dist/components/Scene/useSceneScrollTakeover.d.ts +13 -0
- package/dist/components/Scene/useScrollSceneEngine.d.ts +28 -0
- package/dist/components/runtime/runtimeContext.d.ts +14 -0
- package/dist/components/runtime/scrollExternalStore.d.ts +13 -0
- package/dist/components/runtime/scrollSceneFrameStore.d.ts +29 -0
- package/dist/context/CineviewContext.d.ts +25 -0
- package/dist/dev/PerfPanel.d.ts +16 -0
- package/dist/dev/index.d.ts +14 -0
- package/dist/dev/usePerfMonitor.d.ts +9 -0
- package/dist/drag-scene-engine-y8Wj9ivV.mjs +270 -0
- package/dist/elastic-CBP_FdRv.mjs +129 -0
- package/dist/element-track-Du10P12_.mjs +316 -0
- package/dist/entry-drag.d.ts +14 -0
- package/dist/entry-scroll.d.ts +14 -0
- package/dist/fade-DXxFsgxR.mjs +22 -0
- package/dist/flip-CrCoNIws.mjs +49 -0
- package/dist/hooks/imagePreloadCache.d.ts +4 -0
- package/dist/hooks/mediaPreloadCache.d.ts +31 -0
- package/dist/hooks/useFirstSceneEnter.d.ts +65 -0
- package/dist/hooks/useImagePreloader.d.ts +31 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +12 -0
- package/dist/hooks/useSceneManager.d.ts +79 -0
- package/dist/index.d.ts +17 -0
- package/dist/media/VideoFrameRenderer.d.ts +48 -0
- package/dist/media/videoPlaybackOwnership.d.ts +63 -0
- package/dist/performance-monitor-AlOOwzY_.mjs +73 -0
- package/dist/public-api.d.ts +12 -0
- package/dist/rotate-BMEBKDk5.mjs +69 -0
- package/dist/scene-animation-registry-8b0m_IaZ.mjs +422 -0
- package/dist/shake-BV6SdR9O.mjs +171 -0
- package/dist/slide-DWmVtj0L.mjs +63 -0
- package/dist/special-DDz8BopB.mjs +224 -0
- package/dist/types/index.d.ts +552 -0
- package/dist/utils/animationHelpers.d.ts +15 -0
- package/dist/utils/debounce.d.ts +18 -0
- package/dist/utils/devLog.d.ts +16 -0
- package/dist/utils/dragTimelineMapping.d.ts +30 -0
- package/dist/utils/gestureDetector.d.ts +67 -0
- package/dist/utils/performanceMonitor.d.ts +66 -0
- package/dist/utils/styleConvert.d.ts +7 -0
- package/dist/utils/useIsomorphicLayoutEffect.d.ts +22 -0
- package/dist/utils/useStructurallyStableValue.d.ts +5 -0
- package/dist/zoom-CuAthpqd.mjs +63 -0
- package/package.json +171 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface SceneScrollAnimationRegistration {
|
|
2
|
+
animateId: string;
|
|
3
|
+
delay: number;
|
|
4
|
+
enterDuration: number;
|
|
5
|
+
exitDuration: number;
|
|
6
|
+
after?: string;
|
|
7
|
+
phase?: {
|
|
8
|
+
start?: number;
|
|
9
|
+
end?: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface SceneScrollAnimationBudget {
|
|
13
|
+
animateId: string;
|
|
14
|
+
startMs: number;
|
|
15
|
+
enterStartMs: number;
|
|
16
|
+
enterEndMs: number;
|
|
17
|
+
exitStartMs: number | null;
|
|
18
|
+
exitEndMs: number | null;
|
|
19
|
+
totalEndMs: number;
|
|
20
|
+
startPx: number;
|
|
21
|
+
enterStartPx: number;
|
|
22
|
+
enterEndPx: number;
|
|
23
|
+
exitStartPx: number | null;
|
|
24
|
+
exitEndPx: number | null;
|
|
25
|
+
totalEndPx: number;
|
|
26
|
+
phaseStartPx?: number;
|
|
27
|
+
phaseEndPx?: number;
|
|
28
|
+
hasExit: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ResolvedSceneScrollSequence {
|
|
31
|
+
budgets: Record<string, SceneScrollAnimationBudget>;
|
|
32
|
+
totalDurationMs: number;
|
|
33
|
+
totalBudgetPx: number;
|
|
34
|
+
/** Phase declarations ignored because their dependency timing has no finite solution. */
|
|
35
|
+
invalidPhaseIds?: string[];
|
|
36
|
+
}
|
|
37
|
+
export declare function resolveSceneScrollAnimationBudgets(registrations: Map<string, SceneScrollAnimationRegistration>): ResolvedSceneScrollSequence;
|
|
38
|
+
export declare function areResolvedSceneScrollSequencesEqual(left: ResolvedSceneScrollSequence, right: ResolvedSceneScrollSequence): boolean;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ResolvedSceneScrollSequence, SceneScrollAnimationRegistration } from './sceneScrollBudget';
|
|
2
|
+
import { KeyedScrollExternalStore } from '../runtime/scrollExternalStore';
|
|
3
|
+
/**
|
|
4
|
+
* Scroll-offset residency of a zone's segment, quantized with a Schmitt trigger
|
|
5
|
+
* (task-flow 2026-08-14, Plan A "release when far / preload when near"):
|
|
6
|
+
* the near→far (release) transition fires beyond RELEASE margin past the
|
|
7
|
+
* segment; the far→near (preload) transition fires once the viewer returns
|
|
8
|
+
* within PRELOAD margin. The release margin is intentionally the *larger* of
|
|
9
|
+
* the two — a Schmitt trigger is only stable when the return threshold sits
|
|
10
|
+
* strictly inside the leave threshold, otherwise hovering between them flaps
|
|
11
|
+
* release/preload every frame. The timeline store still publishes continuous
|
|
12
|
+
* progress, so its listeners run during scrolling; selecting this discrete band
|
|
13
|
+
* keeps approach consumers render-silent until a threshold crossing. Consumed by
|
|
14
|
+
* AnimateVideo's `releaseOnLeave` to drop decoded video frames once the viewer
|
|
15
|
+
* has scrolled well past the zone.
|
|
16
|
+
*/
|
|
17
|
+
export type SceneScrollZoneApproach = 'inside' | 'near' | 'far';
|
|
18
|
+
/** Beyond this distance past the segment the band flips to 'far' (release). */
|
|
19
|
+
export declare const SCENE_SCROLL_APPROACH_FAR_VH = 1.5;
|
|
20
|
+
/** Within this distance of the segment a 'far' band flips back to 'near' (preload). */
|
|
21
|
+
export declare const SCENE_SCROLL_APPROACH_NEAR_VH = 1;
|
|
22
|
+
export declare function resolveZoneApproachBand(distancePx: number, viewportSpan: number, previous: SceneScrollZoneApproach): SceneScrollZoneApproach;
|
|
23
|
+
export interface SceneScrollTimelineState {
|
|
24
|
+
zoneId: string;
|
|
25
|
+
sceneIndex: number;
|
|
26
|
+
progressPx: number;
|
|
27
|
+
totalBudgetPx: number;
|
|
28
|
+
active: boolean;
|
|
29
|
+
direction: 'forward' | 'backward' | null;
|
|
30
|
+
sequence: ResolvedSceneScrollSequence;
|
|
31
|
+
approach: SceneScrollZoneApproach;
|
|
32
|
+
}
|
|
33
|
+
export interface SceneScrollRuntimeContextValue {
|
|
34
|
+
registerZone: (zoneId: string, config: {
|
|
35
|
+
sceneIndex: number;
|
|
36
|
+
}) => void;
|
|
37
|
+
unregisterZone: (zoneId: string, sceneIndex: number) => void;
|
|
38
|
+
setZoneElement: (zoneId: string, sceneIndex: number, element: HTMLElement | null) => void;
|
|
39
|
+
registerZoneAnimation: (zoneId: string, animation: SceneScrollAnimationRegistration) => SceneScrollAnimationRegistration;
|
|
40
|
+
unregisterZoneAnimation: (zoneId: string, animateId: string, owner: SceneScrollAnimationRegistration) => void;
|
|
41
|
+
}
|
|
42
|
+
export interface SceneScrollZoneTimelineSnapshot {
|
|
43
|
+
version?: number;
|
|
44
|
+
zoneStates: Record<string, SceneScrollTimelineState>;
|
|
45
|
+
}
|
|
46
|
+
export type SceneScrollTimelineStore = KeyedScrollExternalStore<Record<string, SceneScrollTimelineState>, string, SceneScrollTimelineState>;
|
|
47
|
+
export interface SceneScrollZoneTimeline {
|
|
48
|
+
version?: number;
|
|
49
|
+
zoneStates?: Record<string, SceneScrollTimelineState>;
|
|
50
|
+
store?: SceneScrollTimelineStore;
|
|
51
|
+
}
|
|
52
|
+
export type SceneScrollZoneRuntime = SceneScrollRuntimeContextValue & SceneScrollZoneTimelineSnapshot & {
|
|
53
|
+
/** Stable keyed store for continuous progress consumers. */
|
|
54
|
+
store?: SceneScrollTimelineStore;
|
|
55
|
+
};
|
|
56
|
+
export declare const SceneScrollRuntimeContext: import('react').Context<SceneScrollRuntimeContextValue | null>;
|
|
57
|
+
export declare const SceneScrollTimelineContext: import('react').Context<SceneScrollZoneTimeline | null>;
|
|
58
|
+
export declare const SceneScrollTakeoverContext: import('react').Context<string | null>;
|
|
59
|
+
export declare function useSceneScrollZoneSelection<T>(zoneId: string | null, enabled: boolean, select: (state: SceneScrollTimelineState | null) => T): T;
|
|
60
|
+
/**
|
|
61
|
+
* Read only the discrete residency band. The keyed store still receives
|
|
62
|
+
* continuous progress snapshots, but React compares this primitive selection
|
|
63
|
+
* and skips consumer renders until the band actually changes.
|
|
64
|
+
*/
|
|
65
|
+
export declare function useSceneScrollZoneApproach(zoneId: string | null, enabled?: boolean): SceneScrollZoneApproach | null;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { AnimationType, DragThresholdConfig, DragTimelineUnit, SceneAnchor, SceneProps, SceneStackMode, ScrollMode, ScrollTimelineState } from '../../types';
|
|
2
|
+
import { DragRelease, DragReleaseInput, ScrollTransitionSnapshot } from '../../hooks/useSceneManager';
|
|
3
|
+
import { DragSceneTransaction, PreparedSceneInvalidation, PreparedSceneSnapshot } from './dragPreparedState';
|
|
4
|
+
import { ScrollSceneFrameStore } from '../runtime/scrollSceneFrameStore';
|
|
5
|
+
export type SceneState = 'initial' | 'entering' | 'active' | 'exiting';
|
|
6
|
+
/**
|
|
7
|
+
* The single global render-lane slot (D-F1/D-F7). At most ONE render-lane
|
|
8
|
+
* tween (settle page-slide or bounce) exists at a time — renderProgress has
|
|
9
|
+
* one owner. The slot lets ANY scene's drag engine take over the in-flight
|
|
10
|
+
* lane on a new pointerdown, even when the lane was created by a DIFFERENT
|
|
11
|
+
* scene's engine (a rush re-grab mid-slide lands on whichever scene covers
|
|
12
|
+
* the touch point — usually the incoming one — while the lane still belongs
|
|
13
|
+
* to the releasing engine). CineView owns one shared ref; a standalone Scene
|
|
14
|
+
* falls back to an engine-local slot.
|
|
15
|
+
*/
|
|
16
|
+
export interface DragRenderLane {
|
|
17
|
+
kind: 'settle' | 'bounce';
|
|
18
|
+
/** The sceneIndex of the engine that created this lane (unmount cleanup). */
|
|
19
|
+
ownerSceneIndex: number;
|
|
20
|
+
/** Permanently stop this continuation. Used by teardown and superseding lanes. */
|
|
21
|
+
stop: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Reversibly pause at the current render position. A pointer-down candidate
|
|
24
|
+
* uses this before public drag ownership exists, so commit cannot race the
|
|
25
|
+
* direction/readiness gate.
|
|
26
|
+
*/
|
|
27
|
+
suspend?: () => void;
|
|
28
|
+
/** Resume a previously suspended continuation from its frozen position. */
|
|
29
|
+
resume?: () => void;
|
|
30
|
+
/** Permanently discard a suspension after a candidate acquires ownership. */
|
|
31
|
+
preempt?: () => void;
|
|
32
|
+
/** Latest frozen/rendered progress, used to seed ownership without a stale React frame. */
|
|
33
|
+
getCurrent?: () => number;
|
|
34
|
+
}
|
|
35
|
+
/** Synchronous rush re-grab baseline shared across the render and element lanes. */
|
|
36
|
+
export interface DragTakeoverSnapshot {
|
|
37
|
+
readonly token: number;
|
|
38
|
+
readonly sceneIndices: readonly number[];
|
|
39
|
+
readonly staleRatio: number;
|
|
40
|
+
readonly baseRatio: number | null;
|
|
41
|
+
}
|
|
42
|
+
export interface SceneLegacyCompatProps {
|
|
43
|
+
mode?: ScrollMode;
|
|
44
|
+
slideDirection?: 'x' | 'y';
|
|
45
|
+
slideDuration?: number;
|
|
46
|
+
sceneTransitionDuration?: number;
|
|
47
|
+
enterAnimation?: AnimationType;
|
|
48
|
+
exitAnimation?: AnimationType;
|
|
49
|
+
exitDuration?: number;
|
|
50
|
+
sceneWidth?: number | string;
|
|
51
|
+
sceneHeight?: number | string;
|
|
52
|
+
sceneAnchor?: SceneAnchor;
|
|
53
|
+
sceneZIndex?: number;
|
|
54
|
+
sceneOverflow?: 'hidden' | 'visible';
|
|
55
|
+
sceneStackMode?: SceneStackMode;
|
|
56
|
+
scrollSpeed?: number;
|
|
57
|
+
scrollControlled?: boolean;
|
|
58
|
+
scrollCommitThreshold?: number;
|
|
59
|
+
scrollReleaseDuration?: number;
|
|
60
|
+
scrollLockToSingleScene?: boolean;
|
|
61
|
+
scrollEnterLength?: number;
|
|
62
|
+
scrollHoldLength?: number;
|
|
63
|
+
scrollExitLength?: number;
|
|
64
|
+
onVisibilityChange?: (visible: boolean, progress: number) => void;
|
|
65
|
+
preloadImages?: string[];
|
|
66
|
+
}
|
|
67
|
+
export type SceneActivationKind = 'ready' | 'static' | 'commit' | 'programmatic';
|
|
68
|
+
export interface SceneActivationRecord {
|
|
69
|
+
token: number;
|
|
70
|
+
kind: SceneActivationKind;
|
|
71
|
+
}
|
|
72
|
+
export interface SceneInternalProps extends SceneProps, SceneLegacyCompatProps {
|
|
73
|
+
runtimeMode?: ScrollMode;
|
|
74
|
+
runtimeDirection?: 'x' | 'y';
|
|
75
|
+
isActive?: boolean;
|
|
76
|
+
sceneIndex?: number;
|
|
77
|
+
totalScenes?: number;
|
|
78
|
+
currentSceneIndex?: number;
|
|
79
|
+
sceneRuntime?: {
|
|
80
|
+
mode?: ScrollMode;
|
|
81
|
+
direction?: 'x' | 'y';
|
|
82
|
+
isActive?: boolean;
|
|
83
|
+
sceneIndex?: number;
|
|
84
|
+
totalScenes?: number;
|
|
85
|
+
currentSceneIndex?: number;
|
|
86
|
+
transitionDirection?: 'forward' | 'backward' | null;
|
|
87
|
+
isSceneAnimating?: boolean;
|
|
88
|
+
sharedElapsedMs?: number;
|
|
89
|
+
sharedTimelineDurationMs?: number;
|
|
90
|
+
/** Monotonic formal-arrival token for this Scene in drag mode. */
|
|
91
|
+
activationToken?: number;
|
|
92
|
+
activationKind?: SceneActivationKind | null;
|
|
93
|
+
viewportWidth?: number;
|
|
94
|
+
viewportHeight?: number;
|
|
95
|
+
firstSceneEnterGateKnown?: boolean;
|
|
96
|
+
firstSceneEnterActive?: boolean;
|
|
97
|
+
firstSceneEnterReady?: boolean;
|
|
98
|
+
};
|
|
99
|
+
dragRuntime?: {
|
|
100
|
+
progress?: number;
|
|
101
|
+
renderProgress?: number;
|
|
102
|
+
timelineProgress?: number;
|
|
103
|
+
/** Shared per-frame render lane; the drag engine is its only writer. */
|
|
104
|
+
renderProgressMotion?: import('framer-motion').MotionValue<number>;
|
|
105
|
+
/** Shared per-frame ratio consumed by each Scene-owned element-track writer. */
|
|
106
|
+
timelineProgressMotion?: import('framer-motion').MotionValue<number>;
|
|
107
|
+
isDragging?: boolean;
|
|
108
|
+
release?: DragRelease | null;
|
|
109
|
+
threshold?: DragThresholdConfig;
|
|
110
|
+
/** Root/Scene-resolved mapping; omitted only for standalone legacy callers. */
|
|
111
|
+
dragMappingConfig?: {
|
|
112
|
+
unit: DragTimelineUnit;
|
|
113
|
+
scale: number;
|
|
114
|
+
};
|
|
115
|
+
/** Frozen playback data for the target scene; null when no transaction exists. */
|
|
116
|
+
transaction?: DragSceneTransaction | null;
|
|
117
|
+
/** Publishes only fully stable Scene preparation to the CineView owner. */
|
|
118
|
+
onPrepared?: (snapshot: PreparedSceneSnapshot) => void;
|
|
119
|
+
/** Exact instance/revision invalidation; stale cleanups are ignored by the owner. */
|
|
120
|
+
onPreparedInvalidated?: (invalidation: PreparedSceneInvalidation) => void;
|
|
121
|
+
/**
|
|
122
|
+
* Synchronous candidate preflight. Ownership is granted only after the root
|
|
123
|
+
* validates the target Scene's business flag and prepared snapshot, creates
|
|
124
|
+
* the driving transaction, and emits the directional drag-start callback.
|
|
125
|
+
*/
|
|
126
|
+
onOwnershipRequest?: (direction: 'forward' | 'backward') => boolean;
|
|
127
|
+
/** Internal re-grab candidate state; never exposed as a public drag session. */
|
|
128
|
+
candidateSuspended?: boolean;
|
|
129
|
+
/** Returns true when an in-flight render/element continuation was suspended. */
|
|
130
|
+
onCandidateSuspensionChange?: (suspended: boolean) => boolean;
|
|
131
|
+
/** Synchronously registers whether this Scene owns a resumable element continuation. */
|
|
132
|
+
onElementContinuationChange?: (active: boolean) => void;
|
|
133
|
+
/** Authoritative cross-lane rush re-grab baseline, written at ownership. */
|
|
134
|
+
takeoverSnapshot?: import('react').MutableRefObject<DragTakeoverSnapshot | null>;
|
|
135
|
+
/** Internal pointer-session boundary used for callback de-duplication. */
|
|
136
|
+
onPointerSessionStart?: () => void;
|
|
137
|
+
onCommit?: (direction: 'forward' | 'backward', progressRatio: number, elapsedMs: number, timelineDuration?: number) => void;
|
|
138
|
+
onReset?: () => void;
|
|
139
|
+
onActivationComplete?: () => void;
|
|
140
|
+
/** Releases only the matching frozen playback transaction. */
|
|
141
|
+
onTransactionComplete?: (transactionId: symbol) => void;
|
|
142
|
+
onProgressChange?: (progress: number) => void;
|
|
143
|
+
onRenderProgressChange?: (progress: number) => void;
|
|
144
|
+
onTimelineProgressChange?: (progress: number) => void;
|
|
145
|
+
onSharedElapsedMsChange?: (elapsedMs: number) => void;
|
|
146
|
+
onDraggingChange?: (dragging: boolean) => void;
|
|
147
|
+
onSharedTimelineDurationChange?: (duration: number) => void;
|
|
148
|
+
onRelease?: (release: DragReleaseInput | null) => void;
|
|
149
|
+
/**
|
|
150
|
+
* CineView-owned shared render-lane slot (see {@link DragRenderLane}).
|
|
151
|
+
* Stable ref for the lifetime of the CineView instance.
|
|
152
|
+
*/
|
|
153
|
+
renderLane?: import('react').MutableRefObject<DragRenderLane | null>;
|
|
154
|
+
};
|
|
155
|
+
scrollRuntime?: {
|
|
156
|
+
progress?: number;
|
|
157
|
+
isScrolling?: boolean;
|
|
158
|
+
direction?: 'forward' | 'backward' | null;
|
|
159
|
+
transitionSnapshot?: ScrollTransitionSnapshot | null;
|
|
160
|
+
backdropActive?: boolean;
|
|
161
|
+
timelineState?: ScrollTimelineState | null;
|
|
162
|
+
activeSceneIndex?: number;
|
|
163
|
+
viewportOffset?: number;
|
|
164
|
+
onProgressChange?: (progress: number) => void;
|
|
165
|
+
onDirectionChange?: (direction: 'forward' | 'backward' | null) => void;
|
|
166
|
+
onScrollingChange?: (scrolling: boolean) => void;
|
|
167
|
+
onCommit?: (direction: 'forward' | 'backward', progressRatio: number) => void;
|
|
168
|
+
onReset?: () => void;
|
|
169
|
+
/** Stable imperative frame lane; continuous scroll values never enter React props. */
|
|
170
|
+
frameStore?: ScrollSceneFrameStore;
|
|
171
|
+
sceneIndex?: number;
|
|
172
|
+
};
|
|
173
|
+
onDragGestureEnd?: (direction: 'forward' | 'backward', progressRatio: number, elapsedMs: number, timelineDuration?: number) => void;
|
|
174
|
+
onDragReset?: () => void;
|
|
175
|
+
onActivationComplete?: () => void;
|
|
176
|
+
onDragProgressChange?: (progress: number) => void;
|
|
177
|
+
onRenderProgressChange?: (progress: number) => void;
|
|
178
|
+
onDragTimelineProgressChange?: (progress: number) => void;
|
|
179
|
+
onSharedElapsedMsChange?: (elapsedMs: number) => void;
|
|
180
|
+
onDraggingChange?: (dragging: boolean) => void;
|
|
181
|
+
onSharedTimelineDurationChange?: (duration: number) => void;
|
|
182
|
+
onDragRelease?: (release: DragReleaseInput | null) => void;
|
|
183
|
+
onScrollProgressChange?: (progress: number) => void;
|
|
184
|
+
onScrollDirectionChange?: (direction: 'forward' | 'backward' | null) => void;
|
|
185
|
+
onScrollingChange?: (scrolling: boolean) => void;
|
|
186
|
+
onScrollCommit?: (direction: 'forward' | 'backward', progressRatio: number) => void;
|
|
187
|
+
onScrollReset?: () => void;
|
|
188
|
+
onSceneChange?: (direction: 'forward' | 'backward') => void;
|
|
189
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Dispatch, MutableRefObject, SetStateAction } from 'react';
|
|
2
|
+
import { useAnimation, MotionValue, PanInfo } from 'framer-motion';
|
|
3
|
+
import { DragReleaseInput } from '../../hooks/useSceneManager';
|
|
4
|
+
import { DragThresholdConfig, ScrollMode } from '../../types';
|
|
5
|
+
import { DragRenderLane, DragTakeoverSnapshot, SceneState } from './types';
|
|
6
|
+
type LegacyAnimationControls = ReturnType<typeof useAnimation>;
|
|
7
|
+
export declare function calculateThreshold(velocity: number, config?: DragThresholdConfig): number;
|
|
8
|
+
interface UseDragSceneEngineParams {
|
|
9
|
+
slideMode: ScrollMode;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
sceneIndex: number;
|
|
12
|
+
currentSceneIndex: number;
|
|
13
|
+
totalScenes: number;
|
|
14
|
+
slideDirection: 'x' | 'y';
|
|
15
|
+
slideDuration: number;
|
|
16
|
+
sceneTransitionDuration: number;
|
|
17
|
+
sceneOffset: number;
|
|
18
|
+
sceneState: SceneState;
|
|
19
|
+
thresholdConfig?: DragThresholdConfig;
|
|
20
|
+
globalDirection: 'forward' | 'backward' | null;
|
|
21
|
+
globalRenderProgress: number;
|
|
22
|
+
globalIsDragging: boolean;
|
|
23
|
+
globalDragProgress: number;
|
|
24
|
+
globalDragTimelineProgress: number;
|
|
25
|
+
controls: LegacyAnimationControls;
|
|
26
|
+
dragProgressMotion: MotionValue<number>;
|
|
27
|
+
setSceneState: Dispatch<SetStateAction<SceneState>>;
|
|
28
|
+
setIsAnimating: Dispatch<SetStateAction<boolean>>;
|
|
29
|
+
resolveDragProgress: (rawProgress: number) => number;
|
|
30
|
+
getTimelineDuration: () => number;
|
|
31
|
+
onDragProgressChange?: (progress: number) => void;
|
|
32
|
+
onRenderProgressChange?: (progress: number) => void;
|
|
33
|
+
onDragTimelineProgressChange?: (progress: number) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Synchronous candidate preflight. The owner must atomically validate the
|
|
36
|
+
* direction and establish any frozen transaction before returning true.
|
|
37
|
+
*/
|
|
38
|
+
onOwnershipRequest?: (direction: 'forward' | 'backward') => boolean;
|
|
39
|
+
/** Internal-only reversible candidate suspension state. Returns whether an element continuation exists. */
|
|
40
|
+
onCandidateSuspensionChange?: (suspended: boolean) => boolean;
|
|
41
|
+
/** Authoritative rush re-grab baseline shared with the target element track. */
|
|
42
|
+
takeoverSnapshot?: MutableRefObject<DragTakeoverSnapshot | null>;
|
|
43
|
+
onDraggingChange?: (dragging: boolean) => void;
|
|
44
|
+
onDragRelease?: (release: DragReleaseInput | null) => void;
|
|
45
|
+
/**
|
|
46
|
+
* CineView-owned shared render-lane slot (D-F1/D-F7). When provided, the
|
|
47
|
+
* settle page-slide / bounce tween this engine creates is registered globally
|
|
48
|
+
* so a NEW gesture starting on any other scene's engine can take it over (a
|
|
49
|
+
* rush re-grab mid-slide lands the pointerdown on whichever scene covers the
|
|
50
|
+
* touch point — usually the INCOMING one — which is a different engine than
|
|
51
|
+
* the one that owns the in-flight lane). Falls back to an engine-local slot
|
|
52
|
+
* for standalone scenes.
|
|
53
|
+
*/
|
|
54
|
+
renderLaneRef?: MutableRefObject<DragRenderLane | null>;
|
|
55
|
+
completeReleaseImmediately?: boolean;
|
|
56
|
+
onDragEnd?: (direction: 'forward' | 'backward', progressRatio: number, elapsedMs: number, timelineDuration?: number) => void;
|
|
57
|
+
onDragReset?: () => void;
|
|
58
|
+
}
|
|
59
|
+
interface UseDragSceneEngineResult {
|
|
60
|
+
handleCandidateSuspend: () => boolean;
|
|
61
|
+
handleCandidateResume: () => void;
|
|
62
|
+
handleDragStart: (direction: 'forward' | 'backward') => boolean;
|
|
63
|
+
handlePan: (_event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => void;
|
|
64
|
+
handlePanEnd: (_event: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => void;
|
|
65
|
+
}
|
|
66
|
+
export declare function useDragSceneEngine({ slideMode, isActive, sceneIndex, currentSceneIndex, totalScenes, slideDirection, slideDuration, sceneTransitionDuration, sceneOffset, sceneState, globalDirection, globalRenderProgress, globalIsDragging, globalDragProgress, globalDragTimelineProgress, controls, dragProgressMotion, setSceneState, setIsAnimating, resolveDragProgress, getTimelineDuration, onDragProgressChange, onRenderProgressChange, onDragTimelineProgressChange, onOwnershipRequest, onCandidateSuspensionChange, takeoverSnapshot, onDraggingChange, onDragRelease, renderLaneRef, completeReleaseImmediately, onDragEnd, onDragReset, thresholdConfig, }: UseDragSceneEngineParams): UseDragSceneEngineResult;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { MotionValue } from 'framer-motion';
|
|
3
|
+
import { ScrollMode } from '../../types';
|
|
4
|
+
import { DragRelease } from '../../hooks/useSceneManager';
|
|
5
|
+
import { ResolvedDragTimelineConfig } from '../../utils/dragTimelineMapping';
|
|
6
|
+
import { DragSceneTransaction, PreparedSceneSnapshot } from './dragPreparedState';
|
|
7
|
+
import { DragTakeoverSnapshot } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* useElementTrack — the per-scene element-timeline driver (two-track model,
|
|
10
|
+
* 2026-06-25).
|
|
11
|
+
*
|
|
12
|
+
* SINGLE WRITER invariant: the scene's element track (`elementElapsedMotion`,
|
|
13
|
+
* elapsed ms of ITS OWN enter timeline T = delay + duration) is written ONLY by
|
|
14
|
+
* this hook, for this scene. There is no global element scalar and no cross-scene
|
|
15
|
+
* write path. Across a drag commit the Scene instance is stable (`key={index}`,
|
|
16
|
+
* window current±1), so an in-flight `animate()` on the track survives the commit
|
|
17
|
+
* and continues uninterrupted — continuous completion, never a replay, never a
|
|
18
|
+
* freeze.
|
|
19
|
+
*
|
|
20
|
+
* Four driver sources, mutually exclusive in time, all routed through one
|
|
21
|
+
* controls ref so a new source preempts the previous one:
|
|
22
|
+
* - follow-finger: while dragging and this scene is incoming, elapsed = r * T.
|
|
23
|
+
* - release-settle: on a switch release targeting this scene, continue
|
|
24
|
+
* current -> T at NATURAL rate, in PARALLEL with the render lane.
|
|
25
|
+
* - release-bounce: on a non-switch release targeting this scene, return -> 0.
|
|
26
|
+
* - cold-start: scene 0's one-shot first-screen enter, 0 -> T at real-time rate,
|
|
27
|
+
* with extend-on-growth as the local registry duration grows.
|
|
28
|
+
*
|
|
29
|
+
* StrictMode/double-invoke safe: every animate()/stop() is token-guarded via
|
|
30
|
+
* `releaseTokenRef`, and the cold-start runs at most once via `coldStartRanRef`.
|
|
31
|
+
*/
|
|
32
|
+
interface UseElementTrackParams {
|
|
33
|
+
slideMode: ScrollMode;
|
|
34
|
+
isActive: boolean;
|
|
35
|
+
sceneIndex: number;
|
|
36
|
+
sceneOffset: number;
|
|
37
|
+
globalDirection: 'forward' | 'backward' | null;
|
|
38
|
+
globalIsDragging: boolean;
|
|
39
|
+
/** Internal re-grab candidate hold; no public drag session exists yet. */
|
|
40
|
+
candidateSuspended?: boolean;
|
|
41
|
+
/** Signed render position; its sign gives the live drag direction mid-drag. */
|
|
42
|
+
globalRenderProgress: number;
|
|
43
|
+
renderProgressMotion?: MotionValue<number>;
|
|
44
|
+
/** r — the drag timeline ratio in [0, 1] (abs of the drag fraction). */
|
|
45
|
+
globalDragTimelineProgress: number;
|
|
46
|
+
dragTimelineProgressMotion?: MotionValue<number>;
|
|
47
|
+
/** The single read-only release directive published by the outgoing scene. */
|
|
48
|
+
dragRelease: DragRelease | null;
|
|
49
|
+
/**
|
|
50
|
+
* Cold-start START trigger for scene 0: turns true once first-screen priority
|
|
51
|
+
* assets are ready (or are forced ready). Distinct from the window flag
|
|
52
|
+
* `firstSceneEnterActive` (which holds the scene at its initial frame and is
|
|
53
|
+
* read by useAnimateDrag): a true window with a false ready means "held at
|
|
54
|
+
* initial, not yet entering" (pre-load and the preventDefault path).
|
|
55
|
+
*/
|
|
56
|
+
firstSceneEnterReady: boolean;
|
|
57
|
+
elementElapsedMotion: MotionValue<number>;
|
|
58
|
+
getTimelineDuration: () => number;
|
|
59
|
+
/** Registry-aware timeline duration trigger; retained for legacy direct hook callers. */
|
|
60
|
+
timelineDurationState: number;
|
|
61
|
+
/** CineView-owned immutable playback transaction for this target scene. */
|
|
62
|
+
dragTransaction?: DragSceneTransaction | null;
|
|
63
|
+
/** Latest stable local snapshot; captured once for cold-start/standalone playback. */
|
|
64
|
+
preparedSnapshot?: PreparedSceneSnapshot | null;
|
|
65
|
+
/** Scene calls require a prepared snapshot; direct legacy tests may omit it. */
|
|
66
|
+
requirePreparedSnapshot?: boolean;
|
|
67
|
+
/** Legacy mapping fallback used only when no frozen playback source exists. */
|
|
68
|
+
dragMappingConfig?: ResolvedDragTimelineConfig;
|
|
69
|
+
/** Authoritative rush re-grab baseline written synchronously at ownership. */
|
|
70
|
+
takeoverSnapshot?: MutableRefObject<DragTakeoverSnapshot | null>;
|
|
71
|
+
/** Synchronously reports whether a settle/bounce continuation can be suspended. */
|
|
72
|
+
onElementContinuationChange?: (active: boolean) => void;
|
|
73
|
+
/** Fired when the element track reaches T (settle / cold-start complete). */
|
|
74
|
+
onSettleComplete?: () => void;
|
|
75
|
+
onColdStartComplete?: () => void;
|
|
76
|
+
}
|
|
77
|
+
export interface ElementTrackCommands {
|
|
78
|
+
completeImmediately: () => void;
|
|
79
|
+
resetImmediately: () => void;
|
|
80
|
+
}
|
|
81
|
+
export declare function useElementTrack({ slideMode, isActive, sceneIndex, sceneOffset, globalDirection, globalIsDragging, candidateSuspended, globalRenderProgress, globalDragTimelineProgress, renderProgressMotion, dragTimelineProgressMotion, dragRelease, firstSceneEnterReady, elementElapsedMotion, getTimelineDuration, timelineDurationState, dragTransaction, preparedSnapshot, requirePreparedSnapshot, dragMappingConfig, takeoverSnapshot, onElementContinuationChange, onSettleComplete, onColdStartComplete, }: UseElementTrackParams): ElementTrackCommands;
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MutableRefObject, PointerEvent as ReactPointerEvent } from 'react';
|
|
2
|
+
import { PanInfo } from 'framer-motion';
|
|
3
|
+
interface UseNativePointerDragParams {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
axis: 'x' | 'y';
|
|
6
|
+
/** Reversibly pauses an in-flight continuation for this pointer candidate. */
|
|
7
|
+
onCandidateStart?: () => boolean;
|
|
8
|
+
/** Restores a paused continuation when the candidate ends without ownership. */
|
|
9
|
+
onCandidateEnd?: () => void;
|
|
10
|
+
/** Marks a fresh physical pointer session for root-level callback de-duplication. */
|
|
11
|
+
onPointerSessionStart?: () => void;
|
|
12
|
+
/** Returns true only when the direction gate grants drag ownership. */
|
|
13
|
+
onStart: (direction: 'forward' | 'backward') => boolean;
|
|
14
|
+
onPan: (event: PointerEvent, info: PanInfo) => void;
|
|
15
|
+
onEnd: (event: PointerEvent, info: PanInfo) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface NativePointerDragHandlers {
|
|
18
|
+
onPointerDown: (event: ReactPointerEvent<HTMLElement>) => void;
|
|
19
|
+
onPointerMove: (event: ReactPointerEvent<HTMLElement>) => void;
|
|
20
|
+
onPointerUp: (event: ReactPointerEvent<HTMLElement>) => void;
|
|
21
|
+
onPointerCancel: (event: ReactPointerEvent<HTMLElement>) => void;
|
|
22
|
+
isActiveRef: MutableRefObject<boolean>;
|
|
23
|
+
}
|
|
24
|
+
export declare function useNativePointerDrag({ enabled, axis, onCandidateStart, onCandidateEnd, onPointerSessionStart, onStart, onPan, onEnd, }: UseNativePointerDragParams): NativePointerDragHandlers;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AnimateRegistrationInfo, AnimateTimelineLane, FrozenAnimationRegistrySnapshot } from '../../animations/registry';
|
|
2
|
+
import { ParsedAnimationVariant } from '../../types';
|
|
3
|
+
import { CineviewRuntimeContextValue } from '../runtime/runtimeContext';
|
|
4
|
+
interface UseSceneAnimationRegistryParams {
|
|
5
|
+
sceneIndex: number;
|
|
6
|
+
baseDuration: number;
|
|
7
|
+
reportError?: CineviewRuntimeContextValue['reportError'];
|
|
8
|
+
onStableSnapshot?: (snapshot: FrozenAnimationRegistrySnapshot, revision: number, enterVariantsByAnimateId: ReadonlyMap<string, ParsedAnimationVariant>) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface ScenePreparationLease {
|
|
11
|
+
/** Publish synchronously when this generation parsed and registered successfully. */
|
|
12
|
+
complete: () => void;
|
|
13
|
+
/** Release a superseded/unmounted generation without publishing a transient snapshot. */
|
|
14
|
+
cancel: () => void;
|
|
15
|
+
}
|
|
16
|
+
export type AfterInvalidReason = 'missing' | 'cycle' | 'duplicate' | 'leader-unregistered' | 'incompatible-lane';
|
|
17
|
+
export type AfterOutcome = {
|
|
18
|
+
kind: 'pending';
|
|
19
|
+
leaderId: string;
|
|
20
|
+
generation?: number;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'satisfied';
|
|
23
|
+
source: 'none' | 'completed';
|
|
24
|
+
leaderId?: string;
|
|
25
|
+
generation?: number;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'invalid';
|
|
28
|
+
leaderId: string;
|
|
29
|
+
reason: AfterInvalidReason;
|
|
30
|
+
};
|
|
31
|
+
export interface SceneAnimationRegistrationLease {
|
|
32
|
+
readonly animateId: string;
|
|
33
|
+
readonly generation: number;
|
|
34
|
+
getCalculatedDelay: () => number;
|
|
35
|
+
setEnterVariant?: (variant: ParsedAnimationVariant) => void;
|
|
36
|
+
observeAfter: (listener: (outcome: AfterOutcome) => void) => () => void;
|
|
37
|
+
publishEnterCompleted: () => void;
|
|
38
|
+
dispose: () => void;
|
|
39
|
+
}
|
|
40
|
+
export interface SceneAnimationLaneDeclarationLease {
|
|
41
|
+
dispose: () => void;
|
|
42
|
+
}
|
|
43
|
+
export interface SceneAnimationRegistryPort {
|
|
44
|
+
timelineDuration: number;
|
|
45
|
+
isStable: boolean;
|
|
46
|
+
beginPreparation: () => ScenePreparationLease;
|
|
47
|
+
registerAnimate: (id: string, info: AnimateRegistrationInfo) => SceneAnimationRegistrationLease;
|
|
48
|
+
/** Declare a non-scene lane for dependency diagnostics without extending T_self. */
|
|
49
|
+
declareAnimateLane: (id: string, lane: AnimateTimelineLane) => SceneAnimationLaneDeclarationLease;
|
|
50
|
+
/** Legacy registration adapter for callers not yet migrated to lease.dispose(). */
|
|
51
|
+
unregisterAnimate: (id: string) => void;
|
|
52
|
+
getCalculatedDelay: (animateId: string) => number;
|
|
53
|
+
getTimelineDuration: () => number;
|
|
54
|
+
}
|
|
55
|
+
export declare function useSceneAnimationRegistry({ sceneIndex, baseDuration, reportError, onStableSnapshot, }: UseSceneAnimationRegistryParams): SceneAnimationRegistryPort;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PointerEventHandler } from 'react';
|
|
2
|
+
import { PanInfo } from 'framer-motion';
|
|
3
|
+
type PanEvent = MouseEvent | TouchEvent | PointerEvent;
|
|
4
|
+
interface UseScenePointerInputParams {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
axis: 'x' | 'y';
|
|
7
|
+
onCandidateStart?: () => boolean;
|
|
8
|
+
onCandidateEnd?: () => void;
|
|
9
|
+
onPointerSessionStart?: () => void;
|
|
10
|
+
onDragStart: (direction: 'forward' | 'backward') => boolean;
|
|
11
|
+
onPan: (event: PanEvent, info: PanInfo) => void;
|
|
12
|
+
onPanEnd: (event: PanEvent, info: PanInfo) => void;
|
|
13
|
+
authoredPointerDown?: PointerEventHandler<HTMLDivElement>;
|
|
14
|
+
authoredPointerMove?: PointerEventHandler<HTMLDivElement>;
|
|
15
|
+
authoredPointerUp?: PointerEventHandler<HTMLDivElement>;
|
|
16
|
+
authoredPointerCancel?: PointerEventHandler<HTMLDivElement>;
|
|
17
|
+
}
|
|
18
|
+
export interface ScenePointerInput {
|
|
19
|
+
onPointerDown: PointerEventHandler<HTMLDivElement>;
|
|
20
|
+
onPointerMove: PointerEventHandler<HTMLDivElement>;
|
|
21
|
+
onPointerUp: PointerEventHandler<HTMLDivElement>;
|
|
22
|
+
onPointerCancel: PointerEventHandler<HTMLDivElement>;
|
|
23
|
+
onFramerPanStart: () => void;
|
|
24
|
+
onFramerPan: (event: PanEvent, info: PanInfo) => void;
|
|
25
|
+
onFramerPanEnd: (event: PanEvent, info: PanInfo) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function useScenePointerInput({ enabled, axis, onCandidateStart, onCandidateEnd, onPointerSessionStart, onDragStart, onPan, onPanEnd, authoredPointerDown, authoredPointerMove, authoredPointerUp, authoredPointerCancel, }: UseScenePointerInputParams): ScenePointerInput;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SceneRuntimeState } from '../Animate/Animate';
|
|
2
|
+
import { ScrollMode, ScrollTimelineState } from '../../types';
|
|
3
|
+
import { SceneState } from './types';
|
|
4
|
+
interface UseSceneRuntimeStateParams {
|
|
5
|
+
slideMode: ScrollMode;
|
|
6
|
+
sceneState: SceneState;
|
|
7
|
+
isActive: boolean;
|
|
8
|
+
sceneOffset: number;
|
|
9
|
+
globalScrollProgress: number;
|
|
10
|
+
globalScrollDirection: 'forward' | 'backward' | null;
|
|
11
|
+
globalIsScrolling: boolean;
|
|
12
|
+
globalScrollBackdropActive: boolean;
|
|
13
|
+
hasExitAnimation: boolean;
|
|
14
|
+
scrollTimelineState?: ScrollTimelineState | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function useSceneRuntimeState({ slideMode, sceneState, isActive, sceneOffset, globalScrollProgress, globalScrollDirection, globalIsScrolling, globalScrollBackdropActive, hasExitAnimation, scrollTimelineState, }: UseSceneRuntimeStateParams): SceneRuntimeState;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { ScrollMode } from '../../types';
|
|
3
|
+
interface SceneScrollTakeoverConfig {
|
|
4
|
+
sceneId?: string;
|
|
5
|
+
sceneIndex: number;
|
|
6
|
+
mode: ScrollMode;
|
|
7
|
+
scroll?: {
|
|
8
|
+
zoneId?: string;
|
|
9
|
+
};
|
|
10
|
+
elementRef: RefObject<HTMLElement | null>;
|
|
11
|
+
}
|
|
12
|
+
export declare function useSceneScrollTakeover({ sceneId, sceneIndex, mode, scroll, elementRef, }: SceneScrollTakeoverConfig): string | null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { useAnimation } from 'framer-motion';
|
|
3
|
+
import { ScrollMode, ScrollTimelineState } from '../../types';
|
|
4
|
+
import { PresetAnimation } from '../../animations/presets';
|
|
5
|
+
import { ScrollTransitionSnapshot } from '../../hooks/useSceneManager';
|
|
6
|
+
import { SceneState } from './types';
|
|
7
|
+
import { ScrollSceneFrameStore } from '../runtime/scrollSceneFrameStore';
|
|
8
|
+
type LegacyAnimationControls = ReturnType<typeof useAnimation>;
|
|
9
|
+
interface UseScrollSceneEngineParams {
|
|
10
|
+
slideMode: ScrollMode;
|
|
11
|
+
isActive: boolean;
|
|
12
|
+
sceneOffset: number;
|
|
13
|
+
sceneStackMode: 'replace' | 'cover';
|
|
14
|
+
controls: LegacyAnimationControls;
|
|
15
|
+
enterVariant: PresetAnimation | null;
|
|
16
|
+
exitVariant: PresetAnimation | null;
|
|
17
|
+
globalIsScrolling: boolean;
|
|
18
|
+
globalScrollProgress: number;
|
|
19
|
+
globalScrollDirection: 'forward' | 'backward' | null;
|
|
20
|
+
globalScrollTransitionSnapshot: ScrollTransitionSnapshot | null;
|
|
21
|
+
globalScrollBackdropActive: boolean;
|
|
22
|
+
globalScrollTimelineState: ScrollTimelineState | null;
|
|
23
|
+
scrollFrameStore?: ScrollSceneFrameStore;
|
|
24
|
+
scrollFrameSceneIndex?: number;
|
|
25
|
+
setSceneState: Dispatch<SetStateAction<SceneState>>;
|
|
26
|
+
}
|
|
27
|
+
export declare function useScrollSceneEngine({ slideMode, isActive, sceneOffset, sceneStackMode, controls, enterVariant, exitVariant, globalIsScrolling, globalScrollProgress, globalScrollDirection, globalScrollTransitionSnapshot, globalScrollBackdropActive, globalScrollTimelineState, scrollFrameStore, scrollFrameSceneIndex, setSceneState, }: UseScrollSceneEngineParams): void;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ScrollMode } from '../../types';
|
|
2
|
+
export interface CineviewRuntimeContextValue {
|
|
3
|
+
mode: ScrollMode;
|
|
4
|
+
reportError?: (detail: {
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
context?: Record<string, unknown>;
|
|
8
|
+
}) => void;
|
|
9
|
+
scrollEnterMargin?: number;
|
|
10
|
+
scrollExitMargin?: number;
|
|
11
|
+
prefersReducedMotion?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const CineviewRuntimeContext: import('react').Context<CineviewRuntimeContextValue | null>;
|
|
14
|
+
export declare function useCineviewRuntimeContext(): CineviewRuntimeContextValue | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ScrollExternalStore<T> {
|
|
2
|
+
getSnapshot: () => T;
|
|
3
|
+
subscribe: (listener: () => void) => () => void;
|
|
4
|
+
setSnapshot: (next: T) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface KeyedScrollExternalStore<T, K extends PropertyKey, V> {
|
|
7
|
+
getSnapshot: () => T;
|
|
8
|
+
setSnapshot: (next: T) => void;
|
|
9
|
+
getKeySnapshot: (key: K) => V | undefined;
|
|
10
|
+
subscribeKey: (key: K, listener: () => void) => () => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createScrollExternalStore<T>(initialSnapshot: T): ScrollExternalStore<T>;
|
|
13
|
+
export declare function createKeyedScrollExternalStore<T, K extends PropertyKey, V>(initialSnapshot: T, selectValue: (snapshot: T, key: K) => V | undefined): KeyedScrollExternalStore<T, K, V>;
|