react-native-smooth-clip-view 0.2.9 → 0.4.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 (193) hide show
  1. package/README.md +132 -349
  2. package/android/build.gradle +8 -4
  3. package/android/proguard-rules.pro +3 -3
  4. package/android/src/main/cpp/SmoothClipAndroid.h +13 -6
  5. package/android/src/main/cpp/SmoothClipBindings.cpp +605 -123
  6. package/android/src/main/cpp/SmoothClipRegistry.cpp +975 -209
  7. package/android/src/main/java/com/smoothclipview/ClipGeometryNormalizer.kt +192 -118
  8. package/android/src/main/java/com/smoothclipview/SmoothClipBindings.kt +22 -4
  9. package/android/src/main/java/com/smoothclipview/SmoothClipModule.kt +81 -56
  10. package/android/src/main/java/com/smoothclipview/SmoothClipView.kt +449 -240
  11. package/android/src/main/java/com/smoothclipview/SmoothClipViewManager.kt +150 -38
  12. package/cpp/SmoothClipAnimationCurve.h +317 -397
  13. package/cpp/SmoothClipRegistry.h +84 -20
  14. package/cpp/SmoothClipSharedGeometry.h +131 -22
  15. package/cpp/SmoothClipVelocityTracker.h +16 -12
  16. package/ios/SmoothClipGeometry.h +188 -21
  17. package/ios/SmoothClipRegistry.mm +869 -368
  18. package/ios/SmoothClipRegistrySnapshot.h +13 -0
  19. package/ios/SmoothClipTurboModule.cpp +513 -156
  20. package/ios/SmoothClipTurboModule.h +123 -56
  21. package/ios/SmoothClipView.mm +1074 -449
  22. package/ios/SmoothClipViewRegistry.h +3 -7
  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 +94 -11
  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 +32 -12
  31. package/lib/module/capabilities.js +4 -0
  32. package/lib/module/capabilities.js.map +1 -0
  33. package/lib/module/capabilities.native.js +18 -0
  34. package/lib/module/capabilities.native.js.map +1 -0
  35. package/lib/module/capabilityTypes.js +2 -0
  36. package/lib/module/capabilityTypes.js.map +1 -0
  37. package/lib/module/controllerInternals.js +28 -0
  38. package/lib/module/controllerInternals.js.map +1 -0
  39. package/lib/module/controllerLifecycle.js +9 -0
  40. package/lib/module/controllerLifecycle.js.map +1 -0
  41. package/lib/module/controllerTypes.js +4 -0
  42. package/lib/module/controllerTypes.js.map +1 -0
  43. package/lib/module/controllers.android.js +4 -0
  44. package/lib/module/controllers.android.js.map +1 -0
  45. package/lib/module/controllers.ios.js +4 -0
  46. package/lib/module/controllers.ios.js.map +1 -0
  47. package/lib/module/controllers.js +4 -0
  48. package/lib/module/controllers.js.map +1 -0
  49. package/lib/module/controllers.native.js +89 -0
  50. package/lib/module/controllers.native.js.map +1 -0
  51. package/lib/module/geometry.js +180 -30
  52. package/lib/module/geometry.js.map +1 -1
  53. package/lib/module/groupTypes.js +4 -0
  54. package/lib/module/groupTypes.js.map +1 -0
  55. package/lib/module/groups.android.js +4 -0
  56. package/lib/module/groups.android.js.map +1 -0
  57. package/lib/module/groups.ios.js +4 -0
  58. package/lib/module/groups.ios.js.map +1 -0
  59. package/lib/module/groups.js +4 -0
  60. package/lib/module/groups.js.map +1 -0
  61. package/lib/module/groups.native.js +399 -0
  62. package/lib/module/groups.native.js.map +1 -0
  63. package/lib/module/ids.js +8 -0
  64. package/lib/module/ids.js.map +1 -0
  65. package/lib/module/index.js +4 -3
  66. package/lib/module/index.js.map +1 -1
  67. package/lib/module/nativeCompletion.js +37 -16
  68. package/lib/module/nativeCompletion.js.map +1 -1
  69. package/lib/module/presentationCodec.js +81 -0
  70. package/lib/module/presentationCodec.js.map +1 -0
  71. package/lib/typescript/src/NativeSmoothClipModule.d.ts +20 -4
  72. package/lib/typescript/src/NativeSmoothClipModule.d.ts.map +1 -1
  73. package/lib/typescript/src/SmoothClipView.d.ts +2 -10
  74. package/lib/typescript/src/SmoothClipView.d.ts.map +1 -1
  75. package/lib/typescript/src/SmoothClipView.ios.d.ts +139 -4
  76. package/lib/typescript/src/SmoothClipView.ios.d.ts.map +1 -1
  77. package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts +16 -3
  78. package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts.map +1 -1
  79. package/lib/typescript/src/capabilities.d.ts +3 -0
  80. package/lib/typescript/src/capabilities.d.ts.map +1 -0
  81. package/lib/typescript/src/capabilities.native.d.ts +3 -0
  82. package/lib/typescript/src/capabilities.native.d.ts.map +1 -0
  83. package/lib/typescript/src/capabilityTypes.d.ts +4 -0
  84. package/lib/typescript/src/capabilityTypes.d.ts.map +1 -0
  85. package/lib/typescript/src/controllerInternals.d.ts +14 -0
  86. package/lib/typescript/src/controllerInternals.d.ts.map +1 -0
  87. package/lib/typescript/src/controllerLifecycle.d.ts +3 -0
  88. package/lib/typescript/src/controllerLifecycle.d.ts.map +1 -0
  89. package/lib/typescript/src/controllerTypes.d.ts +62 -0
  90. package/lib/typescript/src/controllerTypes.d.ts.map +1 -0
  91. package/lib/typescript/src/controllers.android.d.ts +2 -0
  92. package/lib/typescript/src/controllers.android.d.ts.map +1 -0
  93. package/lib/typescript/src/controllers.d.ts +2 -0
  94. package/lib/typescript/src/controllers.d.ts.map +1 -0
  95. package/lib/typescript/src/controllers.ios.d.ts +2 -0
  96. package/lib/typescript/src/controllers.ios.d.ts.map +1 -0
  97. package/lib/typescript/src/controllers.native.d.ts +3 -0
  98. package/lib/typescript/src/controllers.native.d.ts.map +1 -0
  99. package/lib/typescript/src/geometry.d.ts +49 -5
  100. package/lib/typescript/src/geometry.d.ts.map +1 -1
  101. package/lib/typescript/src/groupTypes.d.ts +31 -0
  102. package/lib/typescript/src/groupTypes.d.ts.map +1 -0
  103. package/lib/typescript/src/groups.android.d.ts +2 -0
  104. package/lib/typescript/src/groups.android.d.ts.map +1 -0
  105. package/lib/typescript/src/groups.d.ts +2 -0
  106. package/lib/typescript/src/groups.d.ts.map +1 -0
  107. package/lib/typescript/src/groups.ios.d.ts +2 -0
  108. package/lib/typescript/src/groups.ios.d.ts.map +1 -0
  109. package/lib/typescript/src/groups.native.d.ts +3 -0
  110. package/lib/typescript/src/groups.native.d.ts.map +1 -0
  111. package/lib/typescript/src/ids.d.ts +2 -0
  112. package/lib/typescript/src/ids.d.ts.map +1 -0
  113. package/lib/typescript/src/index.d.ts +8 -5
  114. package/lib/typescript/src/index.d.ts.map +1 -1
  115. package/lib/typescript/src/nativeCompletion.d.ts +16 -6
  116. package/lib/typescript/src/nativeCompletion.d.ts.map +1 -1
  117. package/lib/typescript/src/presentationCodec.d.ts +10 -0
  118. package/lib/typescript/src/presentationCodec.d.ts.map +1 -0
  119. package/package.json +17 -13
  120. package/src/NativeSmoothClipModule.ts +80 -56
  121. package/src/SmoothClipView.ios.tsx +142 -16
  122. package/src/SmoothClipView.tsx +6 -76
  123. package/src/SmoothClipViewNativeComponent.ts +32 -12
  124. package/src/capabilities.native.ts +19 -0
  125. package/src/capabilities.ts +2 -0
  126. package/src/capabilityTypes.ts +3 -0
  127. package/src/controllerInternals.ts +52 -0
  128. package/src/controllerLifecycle.ts +6 -0
  129. package/src/controllerTypes.ts +87 -0
  130. package/src/controllers.android.ts +1 -0
  131. package/src/controllers.ios.ts +1 -0
  132. package/src/controllers.native.ts +104 -0
  133. package/src/controllers.ts +1 -0
  134. package/src/geometry.ts +293 -45
  135. package/src/groupTypes.ts +53 -0
  136. package/src/groups.android.ts +1 -0
  137. package/src/groups.ios.ts +1 -0
  138. package/src/groups.native.ts +604 -0
  139. package/src/groups.ts +1 -0
  140. package/src/ids.ts +6 -0
  141. package/src/index.ts +32 -12
  142. package/src/nativeCompletion.ts +67 -32
  143. package/src/presentationCodec.ts +134 -0
  144. package/lib/module/SmoothClipView.web.js +0 -54
  145. package/lib/module/SmoothClipView.web.js.map +0 -1
  146. package/lib/module/driverState.js +0 -110
  147. package/lib/module/driverState.js.map +0 -1
  148. package/lib/module/driverTypes.js +0 -4
  149. package/lib/module/driverTypes.js.map +0 -1
  150. package/lib/module/drivers.android.js +0 -6
  151. package/lib/module/drivers.android.js.map +0 -1
  152. package/lib/module/drivers.ios.js +0 -6
  153. package/lib/module/drivers.ios.js.map +0 -1
  154. package/lib/module/drivers.js +0 -284
  155. package/lib/module/drivers.js.map +0 -1
  156. package/lib/module/drivers.native.js +0 -556
  157. package/lib/module/drivers.native.js.map +0 -1
  158. package/lib/module/index.web.js +0 -8
  159. package/lib/module/index.web.js.map +0 -1
  160. package/lib/module/reactRequests.js +0 -56
  161. package/lib/module/reactRequests.js.map +0 -1
  162. package/lib/module/webClipPath.js +0 -25
  163. package/lib/module/webClipPath.js.map +0 -1
  164. package/lib/typescript/src/SmoothClipView.web.d.ts +0 -10
  165. package/lib/typescript/src/SmoothClipView.web.d.ts.map +0 -1
  166. package/lib/typescript/src/driverState.d.ts +0 -31
  167. package/lib/typescript/src/driverState.d.ts.map +0 -1
  168. package/lib/typescript/src/driverTypes.d.ts +0 -107
  169. package/lib/typescript/src/driverTypes.d.ts.map +0 -1
  170. package/lib/typescript/src/drivers.android.d.ts +0 -3
  171. package/lib/typescript/src/drivers.android.d.ts.map +0 -1
  172. package/lib/typescript/src/drivers.d.ts +0 -5
  173. package/lib/typescript/src/drivers.d.ts.map +0 -1
  174. package/lib/typescript/src/drivers.ios.d.ts +0 -3
  175. package/lib/typescript/src/drivers.ios.d.ts.map +0 -1
  176. package/lib/typescript/src/drivers.native.d.ts +0 -5
  177. package/lib/typescript/src/drivers.native.d.ts.map +0 -1
  178. package/lib/typescript/src/index.web.d.ts +0 -9
  179. package/lib/typescript/src/index.web.d.ts.map +0 -1
  180. package/lib/typescript/src/reactRequests.d.ts +0 -9
  181. package/lib/typescript/src/reactRequests.d.ts.map +0 -1
  182. package/lib/typescript/src/webClipPath.d.ts +0 -7
  183. package/lib/typescript/src/webClipPath.d.ts.map +0 -1
  184. package/src/SmoothClipView.web.tsx +0 -66
  185. package/src/driverState.ts +0 -158
  186. package/src/driverTypes.ts +0 -140
  187. package/src/drivers.android.ts +0 -8
  188. package/src/drivers.ios.ts +0 -8
  189. package/src/drivers.native.ts +0 -899
  190. package/src/drivers.ts +0 -427
  191. package/src/index.web.ts +0 -23
  192. package/src/reactRequests.ts +0 -76
  193. package/src/webClipPath.ts +0 -30
@@ -2,12 +2,23 @@
2
2
 
3
3
  #include <SmoothClipViewSpecJSI.h>
4
4
 
5
+ #include <vector>
6
+
5
7
  namespace facebook::react {
6
8
 
7
9
  struct SmoothClipAnimationCompletion {
8
10
  double driverId;
9
11
  int32_t animationId;
12
+ int32_t completionTag;
13
+ bool finished;
14
+ };
15
+
16
+ struct SmoothClipGroupAnimationCompletion {
17
+ double controllerId;
18
+ int32_t groupId;
19
+ int32_t completionTag;
10
20
  bool finished;
21
+ std::vector<double> snapshots;
11
22
  };
12
23
 
13
24
  template <>
@@ -19,6 +30,8 @@ struct Bridging<SmoothClipAnimationCompletion> {
19
30
  value.getProperty(runtime, "driverId").asNumber(),
20
31
  static_cast<int32_t>(
21
32
  value.getProperty(runtime, "animationId").asNumber()),
33
+ static_cast<int32_t>(
34
+ value.getProperty(runtime, "completionTag").asNumber()),
22
35
  value.getProperty(runtime, "finished").getBool()};
23
36
  }
24
37
 
@@ -28,7 +41,48 @@ struct Bridging<SmoothClipAnimationCompletion> {
28
41
  jsi::Object result(runtime);
29
42
  result.setProperty(runtime, "driverId", value.driverId);
30
43
  result.setProperty(runtime, "animationId", value.animationId);
44
+ result.setProperty(runtime, "completionTag", value.completionTag);
45
+ result.setProperty(runtime, "finished", value.finished);
46
+ return result;
47
+ }
48
+ };
49
+
50
+ template <>
51
+ struct Bridging<SmoothClipGroupAnimationCompletion> {
52
+ static SmoothClipGroupAnimationCompletion fromJs(
53
+ jsi::Runtime &runtime,
54
+ const jsi::Object &value) {
55
+ const jsi::Array ids =
56
+ value.getProperty(runtime, "snapshots").asObject(runtime).asArray(runtime);
57
+ std::vector<double> snapshots;
58
+ snapshots.reserve(ids.size(runtime));
59
+ for (size_t index = 0; index < ids.size(runtime); index += 1) {
60
+ snapshots.push_back(ids.getValueAtIndex(runtime, index).asNumber());
61
+ }
62
+ return {
63
+ value.getProperty(runtime, "controllerId").asNumber(),
64
+ static_cast<int32_t>(
65
+ value.getProperty(runtime, "groupId").asNumber()),
66
+ static_cast<int32_t>(
67
+ value.getProperty(runtime, "completionTag").asNumber()),
68
+ value.getProperty(runtime, "finished").getBool(),
69
+ std::move(snapshots),
70
+ };
71
+ }
72
+
73
+ static jsi::Object toJs(
74
+ jsi::Runtime &runtime,
75
+ const SmoothClipGroupAnimationCompletion &value) {
76
+ jsi::Object result(runtime);
77
+ result.setProperty(runtime, "controllerId", value.controllerId);
78
+ result.setProperty(runtime, "groupId", value.groupId);
79
+ result.setProperty(runtime, "completionTag", value.completionTag);
31
80
  result.setProperty(runtime, "finished", value.finished);
81
+ jsi::Array snapshots(runtime, value.snapshots.size());
82
+ for (size_t index = 0; index < value.snapshots.size(); index += 1) {
83
+ snapshots.setValueAtIndex(runtime, index, value.snapshots[index]);
84
+ }
85
+ result.setProperty(runtime, "snapshots", std::move(snapshots));
32
86
  return result;
33
87
  }
34
88
  };
@@ -39,88 +93,101 @@ class SmoothClipTurboModule final
39
93
  explicit SmoothClipTurboModule(std::shared_ptr<CallInvoker> jsInvoker);
40
94
  ~SmoothClipTurboModule() override;
41
95
 
96
+ bool supportsAutonomousComplexPathAnimation(jsi::Runtime &runtime);
97
+ jsi::Array beginGroupInteraction(
98
+ jsi::Runtime &runtime,
99
+ jsi::Array driverIds);
100
+ jsi::Array snapshotGroup(
101
+ jsi::Runtime &runtime,
102
+ jsi::Array driverIds);
103
+ bool setClipPresentationBatch(
104
+ jsi::Runtime &runtime,
105
+ jsi::Array entries);
106
+ int32_t animateTimingGroup(
107
+ jsi::Runtime &runtime,
108
+ double controllerId,
109
+ jsi::Array entries,
110
+ double durationMs,
111
+ double controlPoint1X,
112
+ double controlPoint1Y,
113
+ double controlPoint2X,
114
+ double controlPoint2Y,
115
+ int32_t reduceMotion,
116
+ int32_t completionTag,
117
+ double startTimestamp);
118
+ int32_t animateSpringGroup(
119
+ jsi::Runtime &runtime,
120
+ double controllerId,
121
+ jsi::Array entries,
122
+ double mass,
123
+ double stiffness,
124
+ double damping,
125
+ double velocity,
126
+ double energyThreshold,
127
+ int32_t reduceMotion,
128
+ int32_t completionTag,
129
+ double startTimestamp);
130
+ jsi::Array cancelAnimationGroup(
131
+ jsi::Runtime &runtime,
132
+ int32_t groupId,
133
+ int32_t behavior);
42
134
  void setClipPresentation(
43
135
  jsi::Runtime &runtime,
44
136
  double driverId,
45
- double x,
46
- double y,
47
- double width,
48
- double height,
49
- double radius,
50
- double contentTranslateX,
51
- double contentTranslateY,
137
+ jsi::Array presentation,
52
138
  bool takeOwnership,
53
139
  bool overridePendingAnimation);
54
- jsi::Array beginInteraction(jsi::Runtime &runtime, double driverId);
55
- int32_t animateTiming(
140
+ void setClipFrameScalars(
56
141
  jsi::Runtime &runtime,
57
142
  double driverId,
58
- bool hasInteractiveStart,
59
- double startX,
60
- double startY,
61
- double startWidth,
62
- double startHeight,
63
- double startRadius,
64
- double startContentTranslateX,
65
- double startContentTranslateY,
66
143
  double x,
67
144
  double y,
68
145
  double width,
69
146
  double height,
70
- double radius,
147
+ double topLeftRadius,
148
+ double topRightRadius,
149
+ double bottomRightRadius,
150
+ double bottomLeftRadius,
151
+ int32_t curveCode,
71
152
  double contentTranslateX,
72
153
  double contentTranslateY,
154
+ double contentScale,
155
+ bool shadowEnabled,
156
+ double shadowRed,
157
+ double shadowGreen,
158
+ double shadowBlue,
159
+ double shadowAlpha,
160
+ double shadowOffsetX,
161
+ double shadowOffsetY,
162
+ double shadowBlurRadius,
163
+ double shadowSpreadDistance);
164
+ jsi::Array beginInteraction(jsi::Runtime &runtime, double driverId);
165
+ jsi::Array snapshotCurrent(jsi::Runtime &runtime, double driverId);
166
+
167
+ int32_t animateTiming(
168
+ jsi::Runtime &runtime,
169
+ double driverId,
170
+ jsi::Array start,
171
+ jsi::Array target,
73
172
  double durationMs,
74
173
  double controlPoint1X,
75
174
  double controlPoint1Y,
76
175
  double controlPoint2X,
77
176
  double controlPoint2Y,
78
- int32_t reduceMotion);
177
+ int32_t reduceMotion,
178
+ int32_t completionTag);
79
179
  int32_t animateSpring(
80
180
  jsi::Runtime &runtime,
81
181
  double driverId,
82
- bool hasInteractiveStart,
83
- double startX,
84
- double startY,
85
- double startWidth,
86
- double startHeight,
87
- double startRadius,
88
- double startContentTranslateX,
89
- double startContentTranslateY,
90
- double x,
91
- double y,
92
- double width,
93
- double height,
94
- double radius,
95
- double contentTranslateX,
96
- double contentTranslateY,
182
+ jsi::Array start,
183
+ jsi::Array target,
97
184
  double mass,
98
185
  double stiffness,
99
186
  double damping,
100
187
  double initialVelocity,
101
188
  bool inheritVelocity,
102
- int32_t reduceMotion);
103
- int32_t animateKeyframes(
104
- jsi::Runtime &runtime,
105
- double driverId,
106
- bool hasInteractiveStart,
107
- double startX,
108
- double startY,
109
- double startWidth,
110
- double startHeight,
111
- double startRadius,
112
- double startContentTranslateX,
113
- double startContentTranslateY,
114
- double x,
115
- double y,
116
- double width,
117
- double height,
118
- double radius,
119
- double contentTranslateX,
120
- double contentTranslateY,
121
- double durationMs,
122
- jsi::Array frames,
123
- int32_t reduceMotion);
189
+ int32_t reduceMotion,
190
+ int32_t completionTag);
124
191
  int32_t rejectAnimation(jsi::Runtime &runtime, double driverId);
125
192
  jsi::Array cancelAnimation(
126
193
  jsi::Runtime &runtime,