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.
Files changed (132) hide show
  1. package/README.md +86 -21
  2. package/android/CMakeLists.txt +7 -0
  3. package/android/build.gradle +14 -2
  4. package/android/proguard-rules.pro +3 -3
  5. package/android/src/main/cpp/SmoothClipAndroid.h +10 -0
  6. package/android/src/main/cpp/SmoothClipBindings.cpp +896 -6
  7. package/android/src/main/cpp/SmoothClipRegistry.cpp +1067 -46
  8. package/android/src/main/cpp/SmoothClipTrace.h +25 -0
  9. package/android/src/main/java/com/smoothclipview/ClipGeometryNormalizer.kt +265 -0
  10. package/android/src/main/java/com/smoothclipview/SmoothClipBindings.kt +21 -0
  11. package/android/src/main/java/com/smoothclipview/SmoothClipModule.kt +283 -0
  12. package/android/src/main/java/com/smoothclipview/SmoothClipView.kt +385 -24
  13. package/android/src/main/java/com/smoothclipview/SmoothClipViewManager.kt +138 -24
  14. package/cpp/SmoothClipAnimationCurve.h +151 -122
  15. package/cpp/SmoothClipRegistry.h +102 -4
  16. package/cpp/SmoothClipSharedGeometry.h +146 -7
  17. package/cpp/SmoothClipVelocityTracker.h +13 -9
  18. package/ios/SmoothClipGeometry.h +184 -6
  19. package/ios/SmoothClipRegistry.mm +1033 -25
  20. package/ios/SmoothClipRegistrySnapshot.h +13 -0
  21. package/ios/SmoothClipTurboModule.cpp +857 -2
  22. package/ios/SmoothClipTurboModule.h +310 -0
  23. package/ios/SmoothClipView.mm +714 -183
  24. package/ios/SmoothClipViewRegistry.h +1 -0
  25. package/ios/reactnativesmoothclipview.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  26. package/ios/reactnativesmoothclipview.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  27. package/lib/module/NativeSmoothClipModule.js.map +1 -1
  28. package/lib/module/SmoothClipView.ios.js +22 -6
  29. package/lib/module/SmoothClipView.ios.js.map +1 -1
  30. package/lib/module/SmoothClipView.js +1 -46
  31. package/lib/module/SmoothClipView.js.map +1 -1
  32. package/lib/module/SmoothClipViewNativeComponent.ts +27 -1
  33. package/lib/module/capabilities.js +4 -0
  34. package/lib/module/capabilities.js.map +1 -0
  35. package/lib/module/capabilities.native.js +36 -0
  36. package/lib/module/capabilities.native.js.map +1 -0
  37. package/lib/module/capabilityTypes.js +11 -0
  38. package/lib/module/capabilityTypes.js.map +1 -0
  39. package/lib/module/driverState.js +0 -28
  40. package/lib/module/driverState.js.map +1 -1
  41. package/lib/module/drivers.js +1 -281
  42. package/lib/module/drivers.js.map +1 -1
  43. package/lib/module/drivers.native.js +340 -75
  44. package/lib/module/drivers.native.js.map +1 -1
  45. package/lib/module/geometry.js +147 -17
  46. package/lib/module/geometry.js.map +1 -1
  47. package/lib/module/groupDriverTypes.js +4 -0
  48. package/lib/module/groupDriverTypes.js.map +1 -0
  49. package/lib/module/groupDrivers.android.js +4 -0
  50. package/lib/module/groupDrivers.android.js.map +1 -0
  51. package/lib/module/groupDrivers.ios.js +4 -0
  52. package/lib/module/groupDrivers.ios.js.map +1 -0
  53. package/lib/module/groupDrivers.js +4 -0
  54. package/lib/module/groupDrivers.js.map +1 -0
  55. package/lib/module/groupDrivers.native.js +799 -0
  56. package/lib/module/groupDrivers.native.js.map +1 -0
  57. package/lib/module/index.js +3 -2
  58. package/lib/module/index.js.map +1 -1
  59. package/lib/module/presentationProtocol.js +15 -0
  60. package/lib/module/presentationProtocol.js.map +1 -0
  61. package/lib/typescript/src/NativeSmoothClipModule.d.ts +25 -0
  62. package/lib/typescript/src/NativeSmoothClipModule.d.ts.map +1 -1
  63. package/lib/typescript/src/SmoothClipView.d.ts +2 -10
  64. package/lib/typescript/src/SmoothClipView.d.ts.map +1 -1
  65. package/lib/typescript/src/SmoothClipView.ios.d.ts +133 -2
  66. package/lib/typescript/src/SmoothClipView.ios.d.ts.map +1 -1
  67. package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts +8 -0
  68. package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts.map +1 -1
  69. package/lib/typescript/src/capabilities.d.ts +3 -0
  70. package/lib/typescript/src/capabilities.d.ts.map +1 -0
  71. package/lib/typescript/src/capabilities.native.d.ts +3 -0
  72. package/lib/typescript/src/capabilities.native.d.ts.map +1 -0
  73. package/lib/typescript/src/capabilityTypes.d.ts +10 -0
  74. package/lib/typescript/src/capabilityTypes.d.ts.map +1 -0
  75. package/lib/typescript/src/driverState.d.ts +1 -6
  76. package/lib/typescript/src/driverState.d.ts.map +1 -1
  77. package/lib/typescript/src/driverTypes.d.ts +39 -11
  78. package/lib/typescript/src/driverTypes.d.ts.map +1 -1
  79. package/lib/typescript/src/drivers.d.ts +2 -4
  80. package/lib/typescript/src/drivers.d.ts.map +1 -1
  81. package/lib/typescript/src/drivers.native.d.ts.map +1 -1
  82. package/lib/typescript/src/geometry.d.ts +36 -2
  83. package/lib/typescript/src/geometry.d.ts.map +1 -1
  84. package/lib/typescript/src/groupDriverTypes.d.ts +66 -0
  85. package/lib/typescript/src/groupDriverTypes.d.ts.map +1 -0
  86. package/lib/typescript/src/groupDrivers.android.d.ts +2 -0
  87. package/lib/typescript/src/groupDrivers.android.d.ts.map +1 -0
  88. package/lib/typescript/src/groupDrivers.d.ts +2 -0
  89. package/lib/typescript/src/groupDrivers.d.ts.map +1 -0
  90. package/lib/typescript/src/groupDrivers.ios.d.ts +2 -0
  91. package/lib/typescript/src/groupDrivers.ios.d.ts.map +1 -0
  92. package/lib/typescript/src/groupDrivers.native.d.ts +4 -0
  93. package/lib/typescript/src/groupDrivers.native.d.ts.map +1 -0
  94. package/lib/typescript/src/index.d.ts +6 -3
  95. package/lib/typescript/src/index.d.ts.map +1 -1
  96. package/lib/typescript/src/presentationProtocol.d.ts +4 -0
  97. package/lib/typescript/src/presentationProtocol.d.ts.map +1 -0
  98. package/package.json +10 -11
  99. package/src/NativeSmoothClipModule.ts +275 -0
  100. package/src/SmoothClipView.ios.tsx +30 -11
  101. package/src/SmoothClipView.tsx +2 -76
  102. package/src/SmoothClipViewNativeComponent.ts +27 -1
  103. package/src/capabilities.native.ts +69 -0
  104. package/src/capabilities.ts +2 -0
  105. package/src/capabilityTypes.ts +17 -0
  106. package/src/driverState.ts +1 -41
  107. package/src/driverTypes.ts +56 -11
  108. package/src/drivers.native.ts +921 -151
  109. package/src/drivers.ts +2 -423
  110. package/src/geometry.ts +231 -27
  111. package/src/groupDriverTypes.ts +117 -0
  112. package/src/groupDrivers.android.ts +1 -0
  113. package/src/groupDrivers.ios.ts +1 -0
  114. package/src/groupDrivers.native.ts +1189 -0
  115. package/src/groupDrivers.ts +1 -0
  116. package/src/index.ts +30 -2
  117. package/src/presentationProtocol.ts +28 -0
  118. package/lib/module/SmoothClipView.web.js +0 -54
  119. package/lib/module/SmoothClipView.web.js.map +0 -1
  120. package/lib/module/index.web.js +0 -8
  121. package/lib/module/index.web.js.map +0 -1
  122. package/lib/module/webClipPath.js +0 -25
  123. package/lib/module/webClipPath.js.map +0 -1
  124. package/lib/typescript/src/SmoothClipView.web.d.ts +0 -10
  125. package/lib/typescript/src/SmoothClipView.web.d.ts.map +0 -1
  126. package/lib/typescript/src/index.web.d.ts +0 -9
  127. package/lib/typescript/src/index.web.d.ts.map +0 -1
  128. package/lib/typescript/src/webClipPath.d.ts +0 -7
  129. package/lib/typescript/src/webClipPath.d.ts.map +0 -1
  130. package/src/SmoothClipView.web.tsx +0 -66
  131. package/src/index.web.ts +0 -23
  132. package/src/webClipPath.ts +0 -30
@@ -2,6 +2,8 @@
2
2
 
3
3
  #include <SmoothClipViewSpecJSI.h>
4
4
 
5
+ #include <vector>
6
+
5
7
  namespace facebook::react {
6
8
 
7
9
  struct SmoothClipAnimationCompletion {
@@ -10,6 +12,13 @@ struct SmoothClipAnimationCompletion {
10
12
  bool finished;
11
13
  };
12
14
 
15
+ struct SmoothClipGroupAnimationCompletion {
16
+ double controllerId;
17
+ int32_t groupId;
18
+ bool finished;
19
+ std::vector<double> driverIds;
20
+ };
21
+
13
22
  template <>
14
23
  struct Bridging<SmoothClipAnimationCompletion> {
15
24
  static SmoothClipAnimationCompletion fromJs(
@@ -33,12 +42,113 @@ struct Bridging<SmoothClipAnimationCompletion> {
33
42
  }
34
43
  };
35
44
 
45
+ template <>
46
+ struct Bridging<SmoothClipGroupAnimationCompletion> {
47
+ static SmoothClipGroupAnimationCompletion fromJs(
48
+ jsi::Runtime &runtime,
49
+ const jsi::Object &value) {
50
+ const jsi::Array ids =
51
+ value.getProperty(runtime, "driverIds").asObject(runtime).asArray(runtime);
52
+ std::vector<double> driverIds;
53
+ driverIds.reserve(ids.size(runtime));
54
+ for (size_t index = 0; index < ids.size(runtime); index += 1) {
55
+ driverIds.push_back(ids.getValueAtIndex(runtime, index).asNumber());
56
+ }
57
+ return {
58
+ value.getProperty(runtime, "controllerId").asNumber(),
59
+ static_cast<int32_t>(
60
+ value.getProperty(runtime, "groupId").asNumber()),
61
+ value.getProperty(runtime, "finished").getBool(),
62
+ std::move(driverIds),
63
+ };
64
+ }
65
+
66
+ static jsi::Object toJs(
67
+ jsi::Runtime &runtime,
68
+ const SmoothClipGroupAnimationCompletion &value) {
69
+ jsi::Object result(runtime);
70
+ result.setProperty(runtime, "controllerId", value.controllerId);
71
+ result.setProperty(runtime, "groupId", value.groupId);
72
+ result.setProperty(runtime, "finished", value.finished);
73
+ jsi::Array driverIds(runtime, value.driverIds.size());
74
+ for (size_t index = 0; index < value.driverIds.size(); index += 1) {
75
+ driverIds.setValueAtIndex(runtime, index, value.driverIds[index]);
76
+ }
77
+ result.setProperty(runtime, "driverIds", std::move(driverIds));
78
+ return result;
79
+ }
80
+ };
81
+
36
82
  class SmoothClipTurboModule final
37
83
  : public NativeSmoothClipModuleCxxSpec<SmoothClipTurboModule> {
38
84
  public:
39
85
  explicit SmoothClipTurboModule(std::shared_ptr<CallInvoker> jsInvoker);
40
86
  ~SmoothClipTurboModule() override;
41
87
 
88
+ int32_t getPresentationProtocolVersion(jsi::Runtime &runtime);
89
+ bool supportsAutonomousComplexPathAnimation(jsi::Runtime &runtime);
90
+ jsi::Array beginGroupInteractionV2(
91
+ jsi::Runtime &runtime,
92
+ jsi::Array driverIds);
93
+ jsi::Array snapshotGroupV2(
94
+ jsi::Runtime &runtime,
95
+ jsi::Array driverIds);
96
+ bool setClipPresentationBatchV2(
97
+ jsi::Runtime &runtime,
98
+ jsi::Array entries);
99
+ int32_t animateTimingGroupV2(
100
+ jsi::Runtime &runtime,
101
+ double controllerId,
102
+ jsi::Array entries,
103
+ double durationMs,
104
+ double controlPoint1X,
105
+ double controlPoint1Y,
106
+ double controlPoint2X,
107
+ double controlPoint2Y,
108
+ int32_t reduceMotion,
109
+ int32_t suspensionPolicy);
110
+ int32_t animateSpringGroupV2(
111
+ jsi::Runtime &runtime,
112
+ double controllerId,
113
+ jsi::Array entries,
114
+ double mass,
115
+ double stiffness,
116
+ double damping,
117
+ double initialVelocity,
118
+ bool inheritVelocity,
119
+ int32_t reduceMotion,
120
+ int32_t suspensionPolicy);
121
+ int32_t animateKeyframesGroupV2(
122
+ jsi::Runtime &runtime,
123
+ double controllerId,
124
+ jsi::Array entries,
125
+ double durationMs,
126
+ int32_t reduceMotion,
127
+ int32_t suspensionPolicy);
128
+ jsi::Array cancelAnimationGroupV2(
129
+ jsi::Runtime &runtime,
130
+ int32_t groupId,
131
+ int32_t behavior);
132
+ void setClipPresentationV2(
133
+ jsi::Runtime &runtime,
134
+ double driverId,
135
+ double x,
136
+ double y,
137
+ double width,
138
+ double height,
139
+ double topLeftRadius,
140
+ double topRightRadius,
141
+ double bottomRightRadius,
142
+ double bottomLeftRadius,
143
+ int32_t curveCode,
144
+ double contentTranslateX,
145
+ double contentTranslateY,
146
+ double contentScale,
147
+ bool takeOwnership,
148
+ bool overridePendingAnimation);
149
+ jsi::Array beginInteractionV2(jsi::Runtime &runtime, double driverId);
150
+ jsi::Array snapshotCurrentV2(jsi::Runtime &runtime, double driverId);
151
+
42
152
  void setClipPresentation(
43
153
  jsi::Runtime &runtime,
44
154
  double driverId,
@@ -76,6 +186,40 @@ class SmoothClipTurboModule final
76
186
  double controlPoint2X,
77
187
  double controlPoint2Y,
78
188
  int32_t reduceMotion);
189
+ int32_t animateTimingV2(
190
+ jsi::Runtime &runtime,
191
+ double driverId,
192
+ bool hasInteractiveStart,
193
+ double startX,
194
+ double startY,
195
+ double startWidth,
196
+ double startHeight,
197
+ double startTopLeftRadius,
198
+ double startTopRightRadius,
199
+ double startBottomRightRadius,
200
+ double startBottomLeftRadius,
201
+ int32_t startCurveCode,
202
+ double startContentTranslateX,
203
+ double startContentTranslateY,
204
+ double startContentScale,
205
+ double x,
206
+ double y,
207
+ double width,
208
+ double height,
209
+ double topLeftRadius,
210
+ double topRightRadius,
211
+ double bottomRightRadius,
212
+ double bottomLeftRadius,
213
+ int32_t curveCode,
214
+ double contentTranslateX,
215
+ double contentTranslateY,
216
+ double contentScale,
217
+ double durationMs,
218
+ double controlPoint1X,
219
+ double controlPoint1Y,
220
+ double controlPoint2X,
221
+ double controlPoint2Y,
222
+ int32_t reduceMotion);
79
223
  int32_t animateSpring(
80
224
  jsi::Runtime &runtime,
81
225
  double driverId,
@@ -100,6 +244,40 @@ class SmoothClipTurboModule final
100
244
  double initialVelocity,
101
245
  bool inheritVelocity,
102
246
  int32_t reduceMotion);
247
+ int32_t animateSpringV2(
248
+ jsi::Runtime &runtime,
249
+ double driverId,
250
+ bool hasInteractiveStart,
251
+ double startX,
252
+ double startY,
253
+ double startWidth,
254
+ double startHeight,
255
+ double startTopLeftRadius,
256
+ double startTopRightRadius,
257
+ double startBottomRightRadius,
258
+ double startBottomLeftRadius,
259
+ int32_t startCurveCode,
260
+ double startContentTranslateX,
261
+ double startContentTranslateY,
262
+ double startContentScale,
263
+ double x,
264
+ double y,
265
+ double width,
266
+ double height,
267
+ double topLeftRadius,
268
+ double topRightRadius,
269
+ double bottomRightRadius,
270
+ double bottomLeftRadius,
271
+ int32_t curveCode,
272
+ double contentTranslateX,
273
+ double contentTranslateY,
274
+ double contentScale,
275
+ double mass,
276
+ double stiffness,
277
+ double damping,
278
+ double initialVelocity,
279
+ bool inheritVelocity,
280
+ int32_t reduceMotion);
103
281
  int32_t animateKeyframes(
104
282
  jsi::Runtime &runtime,
105
283
  double driverId,
@@ -121,12 +299,144 @@ class SmoothClipTurboModule final
121
299
  double durationMs,
122
300
  jsi::Array frames,
123
301
  int32_t reduceMotion);
302
+ int32_t animateKeyframesV2(
303
+ jsi::Runtime &runtime,
304
+ double driverId,
305
+ bool hasInteractiveStart,
306
+ double startX,
307
+ double startY,
308
+ double startWidth,
309
+ double startHeight,
310
+ double startTopLeftRadius,
311
+ double startTopRightRadius,
312
+ double startBottomRightRadius,
313
+ double startBottomLeftRadius,
314
+ int32_t startCurveCode,
315
+ double startContentTranslateX,
316
+ double startContentTranslateY,
317
+ double startContentScale,
318
+ double x,
319
+ double y,
320
+ double width,
321
+ double height,
322
+ double topLeftRadius,
323
+ double topRightRadius,
324
+ double bottomRightRadius,
325
+ double bottomLeftRadius,
326
+ int32_t curveCode,
327
+ double contentTranslateX,
328
+ double contentTranslateY,
329
+ double contentScale,
330
+ double durationMs,
331
+ jsi::Array frames,
332
+ int32_t reduceMotion);
333
+ int32_t animateTimingFromV2(
334
+ jsi::Runtime &runtime,
335
+ double driverId,
336
+ double startX,
337
+ double startY,
338
+ double startWidth,
339
+ double startHeight,
340
+ double startTopLeftRadius,
341
+ double startTopRightRadius,
342
+ double startBottomRightRadius,
343
+ double startBottomLeftRadius,
344
+ int32_t startCurveCode,
345
+ double startContentTranslateX,
346
+ double startContentTranslateY,
347
+ double startContentScale,
348
+ double x,
349
+ double y,
350
+ double width,
351
+ double height,
352
+ double topLeftRadius,
353
+ double topRightRadius,
354
+ double bottomRightRadius,
355
+ double bottomLeftRadius,
356
+ int32_t curveCode,
357
+ double contentTranslateX,
358
+ double contentTranslateY,
359
+ double contentScale,
360
+ double durationMs,
361
+ double controlPoint1X,
362
+ double controlPoint1Y,
363
+ double controlPoint2X,
364
+ double controlPoint2Y,
365
+ int32_t reduceMotion);
366
+ int32_t animateSpringFromV2(
367
+ jsi::Runtime &runtime,
368
+ double driverId,
369
+ double startX,
370
+ double startY,
371
+ double startWidth,
372
+ double startHeight,
373
+ double startTopLeftRadius,
374
+ double startTopRightRadius,
375
+ double startBottomRightRadius,
376
+ double startBottomLeftRadius,
377
+ int32_t startCurveCode,
378
+ double startContentTranslateX,
379
+ double startContentTranslateY,
380
+ double startContentScale,
381
+ double x,
382
+ double y,
383
+ double width,
384
+ double height,
385
+ double topLeftRadius,
386
+ double topRightRadius,
387
+ double bottomRightRadius,
388
+ double bottomLeftRadius,
389
+ int32_t curveCode,
390
+ double contentTranslateX,
391
+ double contentTranslateY,
392
+ double contentScale,
393
+ double mass,
394
+ double stiffness,
395
+ double damping,
396
+ double initialVelocity,
397
+ bool inheritVelocity,
398
+ int32_t reduceMotion);
399
+ int32_t animateKeyframesFromV2(
400
+ jsi::Runtime &runtime,
401
+ double driverId,
402
+ double startX,
403
+ double startY,
404
+ double startWidth,
405
+ double startHeight,
406
+ double startTopLeftRadius,
407
+ double startTopRightRadius,
408
+ double startBottomRightRadius,
409
+ double startBottomLeftRadius,
410
+ int32_t startCurveCode,
411
+ double startContentTranslateX,
412
+ double startContentTranslateY,
413
+ double startContentScale,
414
+ double x,
415
+ double y,
416
+ double width,
417
+ double height,
418
+ double topLeftRadius,
419
+ double topRightRadius,
420
+ double bottomRightRadius,
421
+ double bottomLeftRadius,
422
+ int32_t curveCode,
423
+ double contentTranslateX,
424
+ double contentTranslateY,
425
+ double contentScale,
426
+ double durationMs,
427
+ jsi::Array frames,
428
+ int32_t reduceMotion);
124
429
  int32_t rejectAnimation(jsi::Runtime &runtime, double driverId);
125
430
  jsi::Array cancelAnimation(
126
431
  jsi::Runtime &runtime,
127
432
  double driverId,
128
433
  int32_t animationId,
129
434
  int32_t behavior);
435
+ jsi::Array cancelAnimationV2(
436
+ jsi::Runtime &runtime,
437
+ double driverId,
438
+ int32_t animationId,
439
+ int32_t behavior);
130
440
  void destroyDriver(jsi::Runtime &runtime, double driverId);
131
441
  };
132
442