react-native-smooth-clip-view 0.2.8 → 0.3.0
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 +86 -21
- package/android/CMakeLists.txt +7 -0
- package/android/build.gradle +14 -2
- package/android/proguard-rules.pro +3 -3
- package/android/src/main/cpp/SmoothClipAndroid.h +10 -0
- package/android/src/main/cpp/SmoothClipBindings.cpp +896 -6
- package/android/src/main/cpp/SmoothClipRegistry.cpp +1067 -46
- package/android/src/main/cpp/SmoothClipTrace.h +25 -0
- package/android/src/main/java/com/smoothclipview/ClipGeometryNormalizer.kt +265 -0
- package/android/src/main/java/com/smoothclipview/SmoothClipBindings.kt +21 -0
- package/android/src/main/java/com/smoothclipview/SmoothClipModule.kt +283 -0
- package/android/src/main/java/com/smoothclipview/SmoothClipView.kt +385 -24
- package/android/src/main/java/com/smoothclipview/SmoothClipViewManager.kt +138 -24
- package/cpp/SmoothClipAnimationCurve.h +151 -122
- package/cpp/SmoothClipRegistry.h +102 -4
- package/cpp/SmoothClipSharedGeometry.h +146 -7
- package/cpp/SmoothClipVelocityTracker.h +13 -9
- package/ios/SmoothClipGeometry.h +184 -6
- package/ios/SmoothClipRegistry.mm +1033 -25
- package/ios/SmoothClipRegistrySnapshot.h +13 -0
- package/ios/SmoothClipTurboModule.cpp +857 -2
- package/ios/SmoothClipTurboModule.h +310 -0
- package/ios/SmoothClipView.mm +714 -183
- package/ios/SmoothClipViewRegistry.h +1 -0
- package/ios/reactnativesmoothclipview.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/reactnativesmoothclipview.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/lib/module/NativeSmoothClipModule.js.map +1 -1
- package/lib/module/SmoothClipView.ios.js +22 -6
- package/lib/module/SmoothClipView.ios.js.map +1 -1
- package/lib/module/SmoothClipView.js +1 -46
- package/lib/module/SmoothClipView.js.map +1 -1
- package/lib/module/SmoothClipViewNativeComponent.ts +27 -1
- package/lib/module/capabilities.js +4 -0
- package/lib/module/capabilities.js.map +1 -0
- package/lib/module/capabilities.native.js +36 -0
- package/lib/module/capabilities.native.js.map +1 -0
- package/lib/module/capabilityTypes.js +11 -0
- package/lib/module/capabilityTypes.js.map +1 -0
- package/lib/module/driverState.js +0 -28
- package/lib/module/driverState.js.map +1 -1
- package/lib/module/drivers.js +1 -281
- package/lib/module/drivers.js.map +1 -1
- package/lib/module/drivers.native.js +340 -75
- package/lib/module/drivers.native.js.map +1 -1
- package/lib/module/geometry.js +147 -17
- package/lib/module/geometry.js.map +1 -1
- package/lib/module/groupDriverTypes.js +4 -0
- package/lib/module/groupDriverTypes.js.map +1 -0
- package/lib/module/groupDrivers.android.js +4 -0
- package/lib/module/groupDrivers.android.js.map +1 -0
- package/lib/module/groupDrivers.ios.js +4 -0
- package/lib/module/groupDrivers.ios.js.map +1 -0
- package/lib/module/groupDrivers.js +4 -0
- package/lib/module/groupDrivers.js.map +1 -0
- package/lib/module/groupDrivers.native.js +799 -0
- package/lib/module/groupDrivers.native.js.map +1 -0
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/presentationProtocol.js +15 -0
- package/lib/module/presentationProtocol.js.map +1 -0
- package/lib/typescript/src/NativeSmoothClipModule.d.ts +25 -0
- package/lib/typescript/src/NativeSmoothClipModule.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipView.d.ts +2 -10
- package/lib/typescript/src/SmoothClipView.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipView.ios.d.ts +133 -2
- package/lib/typescript/src/SmoothClipView.ios.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts +8 -0
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/capabilities.d.ts +3 -0
- package/lib/typescript/src/capabilities.d.ts.map +1 -0
- package/lib/typescript/src/capabilities.native.d.ts +3 -0
- package/lib/typescript/src/capabilities.native.d.ts.map +1 -0
- package/lib/typescript/src/capabilityTypes.d.ts +10 -0
- package/lib/typescript/src/capabilityTypes.d.ts.map +1 -0
- package/lib/typescript/src/driverState.d.ts +1 -6
- package/lib/typescript/src/driverState.d.ts.map +1 -1
- package/lib/typescript/src/driverTypes.d.ts +39 -11
- package/lib/typescript/src/driverTypes.d.ts.map +1 -1
- package/lib/typescript/src/drivers.d.ts +2 -4
- package/lib/typescript/src/drivers.d.ts.map +1 -1
- package/lib/typescript/src/drivers.native.d.ts.map +1 -1
- package/lib/typescript/src/geometry.d.ts +36 -2
- package/lib/typescript/src/geometry.d.ts.map +1 -1
- package/lib/typescript/src/groupDriverTypes.d.ts +66 -0
- package/lib/typescript/src/groupDriverTypes.d.ts.map +1 -0
- package/lib/typescript/src/groupDrivers.android.d.ts +2 -0
- package/lib/typescript/src/groupDrivers.android.d.ts.map +1 -0
- package/lib/typescript/src/groupDrivers.d.ts +2 -0
- package/lib/typescript/src/groupDrivers.d.ts.map +1 -0
- package/lib/typescript/src/groupDrivers.ios.d.ts +2 -0
- package/lib/typescript/src/groupDrivers.ios.d.ts.map +1 -0
- package/lib/typescript/src/groupDrivers.native.d.ts +4 -0
- package/lib/typescript/src/groupDrivers.native.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/presentationProtocol.d.ts +4 -0
- package/lib/typescript/src/presentationProtocol.d.ts.map +1 -0
- package/package.json +10 -11
- package/src/NativeSmoothClipModule.ts +275 -0
- package/src/SmoothClipView.ios.tsx +30 -11
- package/src/SmoothClipView.tsx +2 -76
- package/src/SmoothClipViewNativeComponent.ts +27 -1
- package/src/capabilities.native.ts +69 -0
- package/src/capabilities.ts +2 -0
- package/src/capabilityTypes.ts +17 -0
- package/src/driverState.ts +1 -41
- package/src/driverTypes.ts +56 -11
- package/src/drivers.native.ts +921 -151
- package/src/drivers.ts +2 -423
- package/src/geometry.ts +231 -27
- package/src/groupDriverTypes.ts +117 -0
- package/src/groupDrivers.android.ts +1 -0
- package/src/groupDrivers.ios.ts +1 -0
- package/src/groupDrivers.native.ts +1189 -0
- package/src/groupDrivers.ts +1 -0
- package/src/index.ts +30 -2
- package/src/presentationProtocol.ts +28 -0
- package/lib/module/SmoothClipView.web.js +0 -54
- package/lib/module/SmoothClipView.web.js.map +0 -1
- package/lib/module/index.web.js +0 -8
- package/lib/module/index.web.js.map +0 -1
- package/lib/module/webClipPath.js +0 -25
- package/lib/module/webClipPath.js.map +0 -1
- package/lib/typescript/src/SmoothClipView.web.d.ts +0 -10
- package/lib/typescript/src/SmoothClipView.web.d.ts.map +0 -1
- package/lib/typescript/src/index.web.d.ts +0 -9
- package/lib/typescript/src/index.web.d.ts.map +0 -1
- package/lib/typescript/src/webClipPath.d.ts +0 -7
- package/lib/typescript/src/webClipPath.d.ts.map +0 -1
- package/src/SmoothClipView.web.tsx +0 -66
- package/src/index.web.ts +0 -23
- package/src/webClipPath.ts +0 -30
package/src/driverTypes.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { SharedValue } from 'react-native-reanimated';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
CanonicalSmoothClipPresentation,
|
|
4
|
+
SmoothClipPresentation,
|
|
5
|
+
} from './geometry';
|
|
3
6
|
|
|
4
7
|
export type ClipReduceMotion = 'system' | 'always' | 'never';
|
|
5
8
|
|
|
@@ -13,12 +16,11 @@ type ClipAnimationBase = Readonly<{
|
|
|
13
16
|
* reached native — a gated per-frame reaction may not have flushed it.
|
|
14
17
|
* Also re-grabs from a running animation (which an implicit interactive
|
|
15
18
|
* start would silently skip). Non-finite `from` rejects the whole call.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* applies `from`, and starts the replacement from that native value.
|
|
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.
|
|
22
24
|
*
|
|
23
25
|
* Keyframes interpolate absolutely, so pass `frames[0].presentation` —
|
|
24
26
|
* the seed renders it before the first animation frame, making the
|
|
@@ -69,10 +71,24 @@ export type ClipAnimationResult = Readonly<{
|
|
|
69
71
|
export type SmoothClipDriverOptions = Readonly<{
|
|
70
72
|
reduceMotion?: ClipReduceMotion;
|
|
71
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;
|
|
72
88
|
}>;
|
|
73
89
|
|
|
74
90
|
export type SmoothClipUIControls = Readonly<{
|
|
75
|
-
beginInteraction():
|
|
91
|
+
beginInteraction(): CanonicalSmoothClipPresentation;
|
|
76
92
|
set(presentation: SmoothClipPresentation): void;
|
|
77
93
|
/**
|
|
78
94
|
* Per-frame hot path: writes geometry straight to native without touching
|
|
@@ -95,6 +111,24 @@ export type SmoothClipUIControls = Readonly<{
|
|
|
95
111
|
contentTranslateX: number,
|
|
96
112
|
contentTranslateY: number
|
|
97
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;
|
|
98
132
|
animateTo(
|
|
99
133
|
presentation: SmoothClipPresentation,
|
|
100
134
|
animation: SmoothClipAnimation
|
|
@@ -102,11 +136,11 @@ export type SmoothClipUIControls = Readonly<{
|
|
|
102
136
|
cancel(
|
|
103
137
|
animationId?: number,
|
|
104
138
|
behavior?: 'current' | 'target'
|
|
105
|
-
):
|
|
139
|
+
): CanonicalSmoothClipPresentation;
|
|
106
140
|
}>;
|
|
107
141
|
|
|
108
142
|
export type SmoothClipReactControls = Readonly<{
|
|
109
|
-
beginInteraction(): Promise<
|
|
143
|
+
beginInteraction(): Promise<CanonicalSmoothClipPresentation>;
|
|
110
144
|
set(presentation: SmoothClipPresentation): Promise<void>;
|
|
111
145
|
animateTo(
|
|
112
146
|
presentation: SmoothClipPresentation,
|
|
@@ -115,7 +149,16 @@ export type SmoothClipReactControls = Readonly<{
|
|
|
115
149
|
cancel(
|
|
116
150
|
animationId?: number,
|
|
117
151
|
behavior?: 'current' | 'target'
|
|
118
|
-
): Promise<
|
|
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>;
|
|
119
162
|
}>;
|
|
120
163
|
|
|
121
164
|
export type SmoothClipDriver = Readonly<{
|
|
@@ -123,4 +166,6 @@ export type SmoothClipDriver = Readonly<{
|
|
|
123
166
|
presentation: SharedValue<SmoothClipPresentation>;
|
|
124
167
|
ui: SmoothClipUIControls;
|
|
125
168
|
react: SmoothClipReactControls;
|
|
169
|
+
/** @internal Do not read or mutate directly. */
|
|
170
|
+
__smoothClipHandle?: SmoothClipDriverHandle;
|
|
126
171
|
}>;
|