react-native-smooth-clip-view 0.2.9 → 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 +60 -21
- package/android/build.gradle +6 -2
- package/android/proguard-rules.pro +3 -3
- package/android/src/main/cpp/SmoothClipAndroid.h +10 -0
- package/android/src/main/cpp/SmoothClipBindings.cpp +890 -4
- package/android/src/main/cpp/SmoothClipRegistry.cpp +1056 -44
- 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 +371 -18
- package/android/src/main/java/com/smoothclipview/SmoothClipViewManager.kt +138 -24
- package/cpp/SmoothClipAnimationCurve.h +151 -122
- package/cpp/SmoothClipRegistry.h +95 -3
- package/cpp/SmoothClipSharedGeometry.h +146 -7
- package/cpp/SmoothClipVelocityTracker.h +13 -9
- package/ios/SmoothClipGeometry.h +184 -6
- package/ios/SmoothClipRegistry.mm +1028 -22
- 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 +263 -63
- 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 +25 -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 +42 -11
- package/src/drivers.native.ts +824 -124
- 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
|
|
@@ -86,7 +88,7 @@ export type SmoothClipDriverOptions = Readonly<{
|
|
|
86
88
|
}>;
|
|
87
89
|
|
|
88
90
|
export type SmoothClipUIControls = Readonly<{
|
|
89
|
-
beginInteraction():
|
|
91
|
+
beginInteraction(): CanonicalSmoothClipPresentation;
|
|
90
92
|
set(presentation: SmoothClipPresentation): void;
|
|
91
93
|
/**
|
|
92
94
|
* Per-frame hot path: writes geometry straight to native without touching
|
|
@@ -109,6 +111,24 @@ export type SmoothClipUIControls = Readonly<{
|
|
|
109
111
|
contentTranslateX: number,
|
|
110
112
|
contentTranslateY: number
|
|
111
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;
|
|
112
132
|
animateTo(
|
|
113
133
|
presentation: SmoothClipPresentation,
|
|
114
134
|
animation: SmoothClipAnimation
|
|
@@ -116,11 +136,11 @@ export type SmoothClipUIControls = Readonly<{
|
|
|
116
136
|
cancel(
|
|
117
137
|
animationId?: number,
|
|
118
138
|
behavior?: 'current' | 'target'
|
|
119
|
-
):
|
|
139
|
+
): CanonicalSmoothClipPresentation;
|
|
120
140
|
}>;
|
|
121
141
|
|
|
122
142
|
export type SmoothClipReactControls = Readonly<{
|
|
123
|
-
beginInteraction(): Promise<
|
|
143
|
+
beginInteraction(): Promise<CanonicalSmoothClipPresentation>;
|
|
124
144
|
set(presentation: SmoothClipPresentation): Promise<void>;
|
|
125
145
|
animateTo(
|
|
126
146
|
presentation: SmoothClipPresentation,
|
|
@@ -129,7 +149,16 @@ export type SmoothClipReactControls = Readonly<{
|
|
|
129
149
|
cancel(
|
|
130
150
|
animationId?: number,
|
|
131
151
|
behavior?: 'current' | 'target'
|
|
132
|
-
): 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>;
|
|
133
162
|
}>;
|
|
134
163
|
|
|
135
164
|
export type SmoothClipDriver = Readonly<{
|
|
@@ -137,4 +166,6 @@ export type SmoothClipDriver = Readonly<{
|
|
|
137
166
|
presentation: SharedValue<SmoothClipPresentation>;
|
|
138
167
|
ui: SmoothClipUIControls;
|
|
139
168
|
react: SmoothClipReactControls;
|
|
169
|
+
/** @internal Do not read or mutate directly. */
|
|
170
|
+
__smoothClipHandle?: SmoothClipDriverHandle;
|
|
140
171
|
}>;
|