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.
Files changed (130) hide show
  1. package/README.md +60 -21
  2. package/android/build.gradle +6 -2
  3. package/android/proguard-rules.pro +3 -3
  4. package/android/src/main/cpp/SmoothClipAndroid.h +10 -0
  5. package/android/src/main/cpp/SmoothClipBindings.cpp +890 -4
  6. package/android/src/main/cpp/SmoothClipRegistry.cpp +1056 -44
  7. package/android/src/main/java/com/smoothclipview/ClipGeometryNormalizer.kt +265 -0
  8. package/android/src/main/java/com/smoothclipview/SmoothClipBindings.kt +21 -0
  9. package/android/src/main/java/com/smoothclipview/SmoothClipModule.kt +283 -0
  10. package/android/src/main/java/com/smoothclipview/SmoothClipView.kt +371 -18
  11. package/android/src/main/java/com/smoothclipview/SmoothClipViewManager.kt +138 -24
  12. package/cpp/SmoothClipAnimationCurve.h +151 -122
  13. package/cpp/SmoothClipRegistry.h +95 -3
  14. package/cpp/SmoothClipSharedGeometry.h +146 -7
  15. package/cpp/SmoothClipVelocityTracker.h +13 -9
  16. package/ios/SmoothClipGeometry.h +184 -6
  17. package/ios/SmoothClipRegistry.mm +1028 -22
  18. package/ios/SmoothClipRegistrySnapshot.h +13 -0
  19. package/ios/SmoothClipTurboModule.cpp +857 -2
  20. package/ios/SmoothClipTurboModule.h +310 -0
  21. package/ios/SmoothClipView.mm +714 -183
  22. package/ios/SmoothClipViewRegistry.h +1 -0
  23. package/ios/reactnativesmoothclipview.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  24. package/ios/reactnativesmoothclipview.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  25. package/lib/module/NativeSmoothClipModule.js.map +1 -1
  26. package/lib/module/SmoothClipView.ios.js +22 -6
  27. package/lib/module/SmoothClipView.ios.js.map +1 -1
  28. package/lib/module/SmoothClipView.js +1 -46
  29. package/lib/module/SmoothClipView.js.map +1 -1
  30. package/lib/module/SmoothClipViewNativeComponent.ts +27 -1
  31. package/lib/module/capabilities.js +4 -0
  32. package/lib/module/capabilities.js.map +1 -0
  33. package/lib/module/capabilities.native.js +36 -0
  34. package/lib/module/capabilities.native.js.map +1 -0
  35. package/lib/module/capabilityTypes.js +11 -0
  36. package/lib/module/capabilityTypes.js.map +1 -0
  37. package/lib/module/driverState.js +0 -28
  38. package/lib/module/driverState.js.map +1 -1
  39. package/lib/module/drivers.js +1 -281
  40. package/lib/module/drivers.js.map +1 -1
  41. package/lib/module/drivers.native.js +263 -63
  42. package/lib/module/drivers.native.js.map +1 -1
  43. package/lib/module/geometry.js +147 -17
  44. package/lib/module/geometry.js.map +1 -1
  45. package/lib/module/groupDriverTypes.js +4 -0
  46. package/lib/module/groupDriverTypes.js.map +1 -0
  47. package/lib/module/groupDrivers.android.js +4 -0
  48. package/lib/module/groupDrivers.android.js.map +1 -0
  49. package/lib/module/groupDrivers.ios.js +4 -0
  50. package/lib/module/groupDrivers.ios.js.map +1 -0
  51. package/lib/module/groupDrivers.js +4 -0
  52. package/lib/module/groupDrivers.js.map +1 -0
  53. package/lib/module/groupDrivers.native.js +799 -0
  54. package/lib/module/groupDrivers.native.js.map +1 -0
  55. package/lib/module/index.js +3 -2
  56. package/lib/module/index.js.map +1 -1
  57. package/lib/module/presentationProtocol.js +15 -0
  58. package/lib/module/presentationProtocol.js.map +1 -0
  59. package/lib/typescript/src/NativeSmoothClipModule.d.ts +25 -0
  60. package/lib/typescript/src/NativeSmoothClipModule.d.ts.map +1 -1
  61. package/lib/typescript/src/SmoothClipView.d.ts +2 -10
  62. package/lib/typescript/src/SmoothClipView.d.ts.map +1 -1
  63. package/lib/typescript/src/SmoothClipView.ios.d.ts +133 -2
  64. package/lib/typescript/src/SmoothClipView.ios.d.ts.map +1 -1
  65. package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts +8 -0
  66. package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts.map +1 -1
  67. package/lib/typescript/src/capabilities.d.ts +3 -0
  68. package/lib/typescript/src/capabilities.d.ts.map +1 -0
  69. package/lib/typescript/src/capabilities.native.d.ts +3 -0
  70. package/lib/typescript/src/capabilities.native.d.ts.map +1 -0
  71. package/lib/typescript/src/capabilityTypes.d.ts +10 -0
  72. package/lib/typescript/src/capabilityTypes.d.ts.map +1 -0
  73. package/lib/typescript/src/driverState.d.ts +1 -6
  74. package/lib/typescript/src/driverState.d.ts.map +1 -1
  75. package/lib/typescript/src/driverTypes.d.ts +25 -11
  76. package/lib/typescript/src/driverTypes.d.ts.map +1 -1
  77. package/lib/typescript/src/drivers.d.ts +2 -4
  78. package/lib/typescript/src/drivers.d.ts.map +1 -1
  79. package/lib/typescript/src/drivers.native.d.ts.map +1 -1
  80. package/lib/typescript/src/geometry.d.ts +36 -2
  81. package/lib/typescript/src/geometry.d.ts.map +1 -1
  82. package/lib/typescript/src/groupDriverTypes.d.ts +66 -0
  83. package/lib/typescript/src/groupDriverTypes.d.ts.map +1 -0
  84. package/lib/typescript/src/groupDrivers.android.d.ts +2 -0
  85. package/lib/typescript/src/groupDrivers.android.d.ts.map +1 -0
  86. package/lib/typescript/src/groupDrivers.d.ts +2 -0
  87. package/lib/typescript/src/groupDrivers.d.ts.map +1 -0
  88. package/lib/typescript/src/groupDrivers.ios.d.ts +2 -0
  89. package/lib/typescript/src/groupDrivers.ios.d.ts.map +1 -0
  90. package/lib/typescript/src/groupDrivers.native.d.ts +4 -0
  91. package/lib/typescript/src/groupDrivers.native.d.ts.map +1 -0
  92. package/lib/typescript/src/index.d.ts +6 -3
  93. package/lib/typescript/src/index.d.ts.map +1 -1
  94. package/lib/typescript/src/presentationProtocol.d.ts +4 -0
  95. package/lib/typescript/src/presentationProtocol.d.ts.map +1 -0
  96. package/package.json +10 -11
  97. package/src/NativeSmoothClipModule.ts +275 -0
  98. package/src/SmoothClipView.ios.tsx +30 -11
  99. package/src/SmoothClipView.tsx +2 -76
  100. package/src/SmoothClipViewNativeComponent.ts +27 -1
  101. package/src/capabilities.native.ts +69 -0
  102. package/src/capabilities.ts +2 -0
  103. package/src/capabilityTypes.ts +17 -0
  104. package/src/driverState.ts +1 -41
  105. package/src/driverTypes.ts +42 -11
  106. package/src/drivers.native.ts +824 -124
  107. package/src/drivers.ts +2 -423
  108. package/src/geometry.ts +231 -27
  109. package/src/groupDriverTypes.ts +117 -0
  110. package/src/groupDrivers.android.ts +1 -0
  111. package/src/groupDrivers.ios.ts +1 -0
  112. package/src/groupDrivers.native.ts +1189 -0
  113. package/src/groupDrivers.ts +1 -0
  114. package/src/index.ts +30 -2
  115. package/src/presentationProtocol.ts +28 -0
  116. package/lib/module/SmoothClipView.web.js +0 -54
  117. package/lib/module/SmoothClipView.web.js.map +0 -1
  118. package/lib/module/index.web.js +0 -8
  119. package/lib/module/index.web.js.map +0 -1
  120. package/lib/module/webClipPath.js +0 -25
  121. package/lib/module/webClipPath.js.map +0 -1
  122. package/lib/typescript/src/SmoothClipView.web.d.ts +0 -10
  123. package/lib/typescript/src/SmoothClipView.web.d.ts.map +0 -1
  124. package/lib/typescript/src/index.web.d.ts +0 -9
  125. package/lib/typescript/src/index.web.d.ts.map +0 -1
  126. package/lib/typescript/src/webClipPath.d.ts +0 -7
  127. package/lib/typescript/src/webClipPath.d.ts.map +0 -1
  128. package/src/SmoothClipView.web.tsx +0 -66
  129. package/src/index.web.ts +0 -23
  130. package/src/webClipPath.ts +0 -30
@@ -1,5 +1,8 @@
1
1
  import type { SharedValue } from 'react-native-reanimated';
2
- import type { SmoothClipPresentation } from './geometry';
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
- * On the native drivers `driver.presentation.value` is not written from
17
- * `from` (it stays stale until success sets it to the target); the web
18
- * fallback does write it — its presentation SharedValue is the render
19
- * channel itself. Against a held pending-animation latch, explicit `from`
20
- * is newer intent: the fused write cancels that latch once unfinished,
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(): SmoothClipPresentation;
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
- ): SmoothClipPresentation;
139
+ ): CanonicalSmoothClipPresentation;
120
140
  }>;
121
141
 
122
142
  export type SmoothClipReactControls = Readonly<{
123
- beginInteraction(): Promise<SmoothClipPresentation>;
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<SmoothClipPresentation>;
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
  }>;