react-native-smooth-clip-view 0.3.0 → 0.4.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.
- package/README.md +135 -386
- package/android/build.gradle +4 -7
- package/android/proguard-rules.pro +2 -2
- package/android/src/main/cpp/SmoothClipAndroid.h +9 -12
- package/android/src/main/cpp/SmoothClipBindings.cpp +300 -704
- package/android/src/main/cpp/SmoothClipRegistry.cpp +348 -594
- package/android/src/main/java/com/smoothclipview/ClipGeometryNormalizer.kt +36 -227
- package/android/src/main/java/com/smoothclipview/SmoothClipBindings.kt +16 -19
- package/android/src/main/java/com/smoothclipview/SmoothClipModule.kt +36 -294
- package/android/src/main/java/com/smoothclipview/SmoothClipView.kt +369 -486
- package/android/src/main/java/com/smoothclipview/SmoothClipViewManager.kt +75 -77
- package/cpp/SmoothClipAnimationCurve.h +237 -346
- package/cpp/SmoothClipRegistry.h +24 -52
- package/cpp/SmoothClipSharedGeometry.h +64 -94
- package/cpp/SmoothClipVelocityTracker.h +5 -5
- package/ios/SmoothClipGeometry.h +23 -34
- package/ios/SmoothClipRegistry.mm +206 -711
- package/ios/SmoothClipTurboModule.cpp +217 -715
- package/ios/SmoothClipTurboModule.h +54 -297
- package/ios/SmoothClipView.mm +599 -505
- package/ios/SmoothClipViewRegistry.h +2 -7
- package/lib/module/NativeSmoothClipModule.js.map +1 -1
- package/lib/module/SmoothClipView.ios.js +84 -17
- package/lib/module/SmoothClipView.ios.js.map +1 -1
- package/lib/module/SmoothClipView.js +1 -1
- package/lib/module/SmoothClipView.js.map +1 -1
- package/lib/module/SmoothClipViewNativeComponent.ts +20 -26
- package/lib/module/capabilities.native.js +1 -19
- package/lib/module/capabilities.native.js.map +1 -1
- package/lib/module/capabilityTypes.js +0 -9
- package/lib/module/capabilityTypes.js.map +1 -1
- package/lib/module/controllerInternals.js +28 -0
- package/lib/module/controllerInternals.js.map +1 -0
- package/lib/module/controllerLifecycle.js +9 -0
- package/lib/module/controllerLifecycle.js.map +1 -0
- package/lib/module/controllerTypes.js +4 -0
- package/lib/module/controllerTypes.js.map +1 -0
- package/lib/module/controllers.android.js +4 -0
- package/lib/module/controllers.android.js.map +1 -0
- package/lib/module/controllers.ios.js +4 -0
- package/lib/module/controllers.ios.js.map +1 -0
- package/lib/module/controllers.js +4 -0
- package/lib/module/controllers.js.map +1 -0
- package/lib/module/controllers.native.js +89 -0
- package/lib/module/controllers.native.js.map +1 -0
- package/lib/module/geometry.js +71 -51
- package/lib/module/geometry.js.map +1 -1
- package/lib/module/groupTypes.js +4 -0
- package/lib/module/{groupDriverTypes.js.map → groupTypes.js.map} +1 -1
- package/lib/module/groups.android.js +4 -0
- package/lib/module/groups.android.js.map +1 -0
- package/lib/module/groups.ios.js +4 -0
- package/lib/module/groups.ios.js.map +1 -0
- package/lib/module/groups.js +4 -0
- package/lib/module/groups.js.map +1 -0
- package/lib/module/groups.native.js +399 -0
- package/lib/module/groups.native.js.map +1 -0
- package/lib/module/ids.js +8 -0
- package/lib/module/ids.js.map +1 -0
- package/lib/module/index.js +3 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeCompletion.js +37 -16
- package/lib/module/nativeCompletion.js.map +1 -1
- package/lib/module/presentationCodec.js +81 -0
- package/lib/module/presentationCodec.js.map +1 -0
- package/lib/typescript/src/NativeSmoothClipModule.d.ts +14 -23
- package/lib/typescript/src/NativeSmoothClipModule.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipView.d.ts +1 -1
- package/lib/typescript/src/SmoothClipView.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipView.ios.d.ts +18 -14
- package/lib/typescript/src/SmoothClipView.ios.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts +10 -5
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/capabilities.native.d.ts +1 -1
- package/lib/typescript/src/capabilities.native.d.ts.map +1 -1
- package/lib/typescript/src/capabilityTypes.d.ts +0 -6
- package/lib/typescript/src/capabilityTypes.d.ts.map +1 -1
- package/lib/typescript/src/controllerInternals.d.ts +14 -0
- package/lib/typescript/src/controllerInternals.d.ts.map +1 -0
- package/lib/typescript/src/controllerLifecycle.d.ts +3 -0
- package/lib/typescript/src/controllerLifecycle.d.ts.map +1 -0
- package/lib/typescript/src/controllerTypes.d.ts +62 -0
- package/lib/typescript/src/controllerTypes.d.ts.map +1 -0
- package/lib/typescript/src/controllers.android.d.ts +2 -0
- package/lib/typescript/src/controllers.android.d.ts.map +1 -0
- package/lib/typescript/src/controllers.d.ts +2 -0
- package/lib/typescript/src/controllers.d.ts.map +1 -0
- package/lib/typescript/src/controllers.ios.d.ts +2 -0
- package/lib/typescript/src/controllers.ios.d.ts.map +1 -0
- package/lib/typescript/src/controllers.native.d.ts +3 -0
- package/lib/typescript/src/controllers.native.d.ts.map +1 -0
- package/lib/typescript/src/geometry.d.ts +22 -12
- package/lib/typescript/src/geometry.d.ts.map +1 -1
- package/lib/typescript/src/groupTypes.d.ts +31 -0
- package/lib/typescript/src/groupTypes.d.ts.map +1 -0
- package/lib/typescript/src/groups.android.d.ts +2 -0
- package/lib/typescript/src/groups.android.d.ts.map +1 -0
- package/lib/typescript/src/groups.d.ts +2 -0
- package/lib/typescript/src/groups.d.ts.map +1 -0
- package/lib/typescript/src/groups.ios.d.ts +2 -0
- package/lib/typescript/src/groups.ios.d.ts.map +1 -0
- package/lib/typescript/src/groups.native.d.ts +3 -0
- package/lib/typescript/src/groups.native.d.ts.map +1 -0
- package/lib/typescript/src/ids.d.ts +2 -0
- package/lib/typescript/src/ids.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeCompletion.d.ts +16 -6
- package/lib/typescript/src/nativeCompletion.d.ts.map +1 -1
- package/lib/typescript/src/presentationCodec.d.ts +10 -0
- package/lib/typescript/src/presentationCodec.d.ts.map +1 -0
- package/package.json +8 -3
- package/src/NativeSmoothClipModule.ts +41 -292
- package/src/SmoothClipView.ios.tsx +130 -23
- package/src/SmoothClipView.tsx +5 -1
- package/src/SmoothClipViewNativeComponent.ts +20 -26
- package/src/capabilities.native.ts +2 -52
- package/src/capabilityTypes.ts +0 -14
- package/src/controllerInternals.ts +52 -0
- package/src/controllerLifecycle.ts +6 -0
- package/src/controllerTypes.ts +87 -0
- package/src/controllers.android.ts +1 -0
- package/src/controllers.ios.ts +1 -0
- package/src/controllers.native.ts +104 -0
- package/src/controllers.ts +1 -0
- package/src/geometry.ts +118 -74
- package/src/groupTypes.ts +53 -0
- package/src/groups.android.ts +1 -0
- package/src/groups.ios.ts +1 -0
- package/src/groups.native.ts +604 -0
- package/src/groups.ts +1 -0
- package/src/ids.ts +6 -0
- package/src/index.ts +20 -28
- package/src/nativeCompletion.ts +67 -32
- package/src/presentationCodec.ts +134 -0
- package/lib/module/driverState.js +0 -82
- package/lib/module/driverState.js.map +0 -1
- package/lib/module/driverTypes.js +0 -4
- package/lib/module/driverTypes.js.map +0 -1
- package/lib/module/drivers.android.js +0 -6
- package/lib/module/drivers.android.js.map +0 -1
- package/lib/module/drivers.ios.js +0 -6
- package/lib/module/drivers.ios.js.map +0 -1
- package/lib/module/drivers.js +0 -4
- package/lib/module/drivers.js.map +0 -1
- package/lib/module/drivers.native.js +0 -756
- package/lib/module/drivers.native.js.map +0 -1
- package/lib/module/groupDriverTypes.js +0 -4
- package/lib/module/groupDrivers.android.js +0 -4
- package/lib/module/groupDrivers.android.js.map +0 -1
- package/lib/module/groupDrivers.ios.js +0 -4
- package/lib/module/groupDrivers.ios.js.map +0 -1
- package/lib/module/groupDrivers.js +0 -4
- package/lib/module/groupDrivers.js.map +0 -1
- package/lib/module/groupDrivers.native.js +0 -799
- package/lib/module/groupDrivers.native.js.map +0 -1
- package/lib/module/presentationProtocol.js +0 -15
- package/lib/module/presentationProtocol.js.map +0 -1
- package/lib/module/reactRequests.js +0 -56
- package/lib/module/reactRequests.js.map +0 -1
- package/lib/typescript/src/driverState.d.ts +0 -26
- package/lib/typescript/src/driverState.d.ts.map +0 -1
- package/lib/typescript/src/driverTypes.d.ts +0 -121
- package/lib/typescript/src/driverTypes.d.ts.map +0 -1
- package/lib/typescript/src/drivers.android.d.ts +0 -3
- package/lib/typescript/src/drivers.android.d.ts.map +0 -1
- package/lib/typescript/src/drivers.d.ts +0 -3
- package/lib/typescript/src/drivers.d.ts.map +0 -1
- package/lib/typescript/src/drivers.ios.d.ts +0 -3
- package/lib/typescript/src/drivers.ios.d.ts.map +0 -1
- package/lib/typescript/src/drivers.native.d.ts +0 -5
- package/lib/typescript/src/drivers.native.d.ts.map +0 -1
- package/lib/typescript/src/groupDriverTypes.d.ts +0 -66
- package/lib/typescript/src/groupDriverTypes.d.ts.map +0 -1
- package/lib/typescript/src/groupDrivers.android.d.ts +0 -2
- package/lib/typescript/src/groupDrivers.android.d.ts.map +0 -1
- package/lib/typescript/src/groupDrivers.d.ts +0 -2
- package/lib/typescript/src/groupDrivers.d.ts.map +0 -1
- package/lib/typescript/src/groupDrivers.ios.d.ts +0 -2
- package/lib/typescript/src/groupDrivers.ios.d.ts.map +0 -1
- package/lib/typescript/src/groupDrivers.native.d.ts +0 -4
- package/lib/typescript/src/groupDrivers.native.d.ts.map +0 -1
- package/lib/typescript/src/presentationProtocol.d.ts +0 -4
- package/lib/typescript/src/presentationProtocol.d.ts.map +0 -1
- package/lib/typescript/src/reactRequests.d.ts +0 -9
- package/lib/typescript/src/reactRequests.d.ts.map +0 -1
- package/src/driverState.ts +0 -118
- package/src/driverTypes.ts +0 -171
- package/src/drivers.android.ts +0 -8
- package/src/drivers.ios.ts +0 -8
- package/src/drivers.native.ts +0 -1599
- package/src/drivers.ts +0 -6
- package/src/groupDriverTypes.ts +0 -117
- package/src/groupDrivers.android.ts +0 -1
- package/src/groupDrivers.ios.ts +0 -1
- package/src/groupDrivers.native.ts +0 -1189
- package/src/groupDrivers.ts +0 -1
- package/src/presentationProtocol.ts +0 -28
- package/src/reactRequests.ts +0 -76
package/src/driverTypes.ts
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import type { SharedValue } from 'react-native-reanimated';
|
|
2
|
-
import type {
|
|
3
|
-
CanonicalSmoothClipPresentation,
|
|
4
|
-
SmoothClipPresentation,
|
|
5
|
-
} from './geometry';
|
|
6
|
-
|
|
7
|
-
export type ClipReduceMotion = 'system' | 'always' | 'never';
|
|
8
|
-
|
|
9
|
-
/** Options shared by every animation kind. */
|
|
10
|
-
type ClipAnimationBase = Readonly<{
|
|
11
|
-
/**
|
|
12
|
-
* Explicit start: fuses a `setScalars(from…)` take-ownership hot write
|
|
13
|
-
* immediately before the animation, so native starts from exactly this
|
|
14
|
-
* presentation instead of its last delivered value. Use at a gesture
|
|
15
|
-
* release when the freshest sample (e.g. the UP event's position) never
|
|
16
|
-
* reached native — a gated per-frame reaction may not have flushed it.
|
|
17
|
-
* Also re-grabs from a running animation (which an implicit interactive
|
|
18
|
-
* start would silently skip). Non-finite `from` rejects the whole call.
|
|
19
|
-
* `driver.presentation.value` is not written from `from`; it stays stale
|
|
20
|
-
* until success sets it to the target. Against a held pending-animation
|
|
21
|
-
* latch, explicit `from` is newer intent: the fused write cancels that latch
|
|
22
|
-
* once unfinished, applies `from`, and starts the replacement from that
|
|
23
|
-
* native value.
|
|
24
|
-
*
|
|
25
|
-
* Keyframes interpolate absolutely, so pass `frames[0].presentation` —
|
|
26
|
-
* the seed renders it before the first animation frame, making the
|
|
27
|
-
* handoff continuous.
|
|
28
|
-
*
|
|
29
|
-
* iOS note: keyframes start exactly at `from` (frame 0 travels in-band);
|
|
30
|
-
* timing/spring sample their Core Animation from-value off the
|
|
31
|
-
* presentation layer — the last committed frame, at most one frame behind
|
|
32
|
-
* `from` — identical to the two-call pattern this option desugars to.
|
|
33
|
-
*/
|
|
34
|
-
from?: SmoothClipPresentation;
|
|
35
|
-
}>;
|
|
36
|
-
|
|
37
|
-
export type TimingClipAnimation = ClipAnimationBase &
|
|
38
|
-
Readonly<{
|
|
39
|
-
type: 'timing';
|
|
40
|
-
duration: number;
|
|
41
|
-
controlPoints: readonly [number, number, number, number];
|
|
42
|
-
}>;
|
|
43
|
-
|
|
44
|
-
export type SpringClipAnimation = ClipAnimationBase &
|
|
45
|
-
Readonly<{
|
|
46
|
-
type: 'spring';
|
|
47
|
-
mass?: number;
|
|
48
|
-
stiffness?: number;
|
|
49
|
-
damping?: number;
|
|
50
|
-
initialVelocity?: number | 'inherit';
|
|
51
|
-
}>;
|
|
52
|
-
|
|
53
|
-
export type KeyframedClipAnimation = ClipAnimationBase &
|
|
54
|
-
Readonly<{
|
|
55
|
-
type: 'keyframes';
|
|
56
|
-
duration: number;
|
|
57
|
-
frames: readonly Readonly<{
|
|
58
|
-
offset: number;
|
|
59
|
-
presentation: SmoothClipPresentation;
|
|
60
|
-
}>[];
|
|
61
|
-
}>;
|
|
62
|
-
|
|
63
|
-
export type SmoothClipAnimation =
|
|
64
|
-
TimingClipAnimation | SpringClipAnimation | KeyframedClipAnimation;
|
|
65
|
-
|
|
66
|
-
export type ClipAnimationResult = Readonly<{
|
|
67
|
-
animationId: number;
|
|
68
|
-
finished: boolean;
|
|
69
|
-
}>;
|
|
70
|
-
|
|
71
|
-
export type SmoothClipDriverOptions = Readonly<{
|
|
72
|
-
reduceMotion?: ClipReduceMotion;
|
|
73
|
-
onAnimationComplete?: (result: ClipAnimationResult) => void;
|
|
74
|
-
/**
|
|
75
|
-
* Android only; captured at driver creation. Records two-sample velocity
|
|
76
|
-
* history on `setScalars` hot writes so a spring `initialVelocity: 'inherit'`
|
|
77
|
-
* can project its launch speed from the live drag. Off by default: the
|
|
78
|
-
* recording (a clock read plus channel copies) rides the per-frame
|
|
79
|
-
* `setScalars` hot path, and drivers that never hand off into an inherit
|
|
80
|
-
* spring should not pay it. Without this flag, `'inherit'` inherits 0 after
|
|
81
|
-
* a `setScalars` drag on Android (each skipped write also invalidates older
|
|
82
|
-
* samples, so stale pre-drag motion never leaks in). `set()`, the fused
|
|
83
|
-
* `animateTo` `from` seed, and the declarative `presentation.value` channel
|
|
84
|
-
* always record regardless of the flag. iOS always records; the flag is a
|
|
85
|
-
* no-op there.
|
|
86
|
-
*/
|
|
87
|
-
velocityTracking?: boolean;
|
|
88
|
-
}>;
|
|
89
|
-
|
|
90
|
-
export type SmoothClipUIControls = Readonly<{
|
|
91
|
-
beginInteraction(): CanonicalSmoothClipPresentation;
|
|
92
|
-
set(presentation: SmoothClipPresentation): void;
|
|
93
|
-
/**
|
|
94
|
-
* Per-frame hot path: writes geometry straight to native without touching
|
|
95
|
-
* `driver.presentation`. Skips SharedValue bookkeeping (dirty marking, RN
|
|
96
|
-
* mirror sync, listener dispatch) for high-frequency streams such as
|
|
97
|
-
* gestures. `driver.presentation.value` is stale after hot writes by design;
|
|
98
|
-
* `beginInteraction()` remains the source of truth for visible geometry.
|
|
99
|
-
* Do not interleave with `presentation.value` writes on the same driver —
|
|
100
|
-
* the listener's duplicate suppression may skip a later equal value.
|
|
101
|
-
* To hand off into an animation from a fresher value than the last hot
|
|
102
|
-
* write, pass the geometry as `animation.from` to `animateTo` — it fuses
|
|
103
|
-
* this call and the handoff into one.
|
|
104
|
-
*/
|
|
105
|
-
setScalars(
|
|
106
|
-
x: number,
|
|
107
|
-
y: number,
|
|
108
|
-
width: number,
|
|
109
|
-
height: number,
|
|
110
|
-
radius: number,
|
|
111
|
-
contentTranslateX: number,
|
|
112
|
-
contentTranslateY: number
|
|
113
|
-
): void;
|
|
114
|
-
/**
|
|
115
|
-
* V2 per-frame hot path. Curve code is 0 for circular and 1 for continuous;
|
|
116
|
-
* invalid codes reject the complete write.
|
|
117
|
-
*/
|
|
118
|
-
setPresentationScalars(
|
|
119
|
-
x: number,
|
|
120
|
-
y: number,
|
|
121
|
-
width: number,
|
|
122
|
-
height: number,
|
|
123
|
-
topLeftRadius: number,
|
|
124
|
-
topRightRadius: number,
|
|
125
|
-
bottomRightRadius: number,
|
|
126
|
-
bottomLeftRadius: number,
|
|
127
|
-
curveCode: number,
|
|
128
|
-
contentTranslateX: number,
|
|
129
|
-
contentTranslateY: number,
|
|
130
|
-
contentScale: number
|
|
131
|
-
): void;
|
|
132
|
-
animateTo(
|
|
133
|
-
presentation: SmoothClipPresentation,
|
|
134
|
-
animation: SmoothClipAnimation
|
|
135
|
-
): number;
|
|
136
|
-
cancel(
|
|
137
|
-
animationId?: number,
|
|
138
|
-
behavior?: 'current' | 'target'
|
|
139
|
-
): CanonicalSmoothClipPresentation;
|
|
140
|
-
}>;
|
|
141
|
-
|
|
142
|
-
export type SmoothClipReactControls = Readonly<{
|
|
143
|
-
beginInteraction(): Promise<CanonicalSmoothClipPresentation>;
|
|
144
|
-
set(presentation: SmoothClipPresentation): Promise<void>;
|
|
145
|
-
animateTo(
|
|
146
|
-
presentation: SmoothClipPresentation,
|
|
147
|
-
animation: SmoothClipAnimation
|
|
148
|
-
): Promise<number>;
|
|
149
|
-
cancel(
|
|
150
|
-
animationId?: number,
|
|
151
|
-
behavior?: 'current' | 'target'
|
|
152
|
-
): Promise<CanonicalSmoothClipPresentation>;
|
|
153
|
-
}>;
|
|
154
|
-
|
|
155
|
-
/** @internal Worklet-serializable driver identity used by atomic groups. */
|
|
156
|
-
export type SmoothClipDriverHandle = Readonly<{
|
|
157
|
-
driverId: number;
|
|
158
|
-
presentation: SharedValue<SmoothClipPresentation>;
|
|
159
|
-
ownership: SharedValue<number>;
|
|
160
|
-
activeAnimationId: SharedValue<number>;
|
|
161
|
-
disposed: SharedValue<number>;
|
|
162
|
-
}>;
|
|
163
|
-
|
|
164
|
-
export type SmoothClipDriver = Readonly<{
|
|
165
|
-
kind: 'hybrid';
|
|
166
|
-
presentation: SharedValue<SmoothClipPresentation>;
|
|
167
|
-
ui: SmoothClipUIControls;
|
|
168
|
-
react: SmoothClipReactControls;
|
|
169
|
-
/** @internal Do not read or mutate directly. */
|
|
170
|
-
__smoothClipHandle?: SmoothClipDriverHandle;
|
|
171
|
-
}>;
|
package/src/drivers.android.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Platform re-export only — the implementation is shared with iOS.
|
|
2
|
-
// Edit drivers.native.ts, not this file.
|
|
3
|
-
export { useSmoothClipDriver } from './drivers.native';
|
|
4
|
-
export type {
|
|
5
|
-
KeyframedClipAnimation,
|
|
6
|
-
SpringClipAnimation,
|
|
7
|
-
TimingClipAnimation,
|
|
8
|
-
} from './drivers.native';
|
package/src/drivers.ios.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Platform re-export only — the implementation is shared with Android.
|
|
2
|
-
// Edit drivers.native.ts, not this file.
|
|
3
|
-
export { useSmoothClipDriver } from './drivers.native';
|
|
4
|
-
export type {
|
|
5
|
-
KeyframedClipAnimation,
|
|
6
|
-
SpringClipAnimation,
|
|
7
|
-
TimingClipAnimation,
|
|
8
|
-
} from './drivers.native';
|