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
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- import { deferDriverCompletions, releaseDriverCompletions } from "./driverState.js";
4
- const requests = new Map();
5
- const requestsByDriver = new Map();
6
- let nextRequestId = 0;
7
- export function createReactRequest(driverId, deferCompletions = false, teardownResolution) {
8
- nextRequestId = nextRequestId % 0x7ffffffe + 1;
9
- const requestId = nextRequestId;
10
- let resolveRequest;
11
- let rejectRequest;
12
- const promise = new Promise((resolve, reject) => {
13
- resolveRequest = resolve;
14
- rejectRequest = reject;
15
- });
16
- requests.set(requestId, {
17
- resolve: resolveRequest,
18
- reject: rejectRequest,
19
- teardownResolution
20
- });
21
- const driverRequests = requestsByDriver.get(driverId) ?? new Set();
22
- driverRequests.add(requestId);
23
- requestsByDriver.set(driverId, driverRequests);
24
- if (deferCompletions) deferDriverCompletions(driverId);
25
- return {
26
- requestId,
27
- promise
28
- };
29
- }
30
- export function resolveReactRequest(driverId, requestId, value, releaseCompletions = false) {
31
- const request = requests.get(requestId);
32
- requests.delete(requestId);
33
- const driverRequests = requestsByDriver.get(driverId);
34
- driverRequests?.delete(requestId);
35
- if (driverRequests?.size === 0) requestsByDriver.delete(driverId);
36
- request?.resolve(value);
37
- if (releaseCompletions) {
38
- queueMicrotask(() => releaseDriverCompletions(driverId));
39
- }
40
- }
41
- export function rejectDriverRequests(driverId) {
42
- const driverRequests = requestsByDriver.get(driverId);
43
- if (!driverRequests) return;
44
- for (const requestId of driverRequests) {
45
- const request = requests.get(requestId);
46
- requests.delete(requestId);
47
- if (!request) continue;
48
- if (request.teardownResolution) {
49
- request.resolve(request.teardownResolution.value);
50
- } else {
51
- request.reject(new Error('[SmoothClipView] Driver was destroyed.'));
52
- }
53
- }
54
- requestsByDriver.delete(driverId);
55
- }
56
- //# sourceMappingURL=reactRequests.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["deferDriverCompletions","releaseDriverCompletions","requests","Map","requestsByDriver","nextRequestId","createReactRequest","driverId","deferCompletions","teardownResolution","requestId","resolveRequest","rejectRequest","promise","Promise","resolve","reject","set","driverRequests","get","Set","add","resolveReactRequest","value","releaseCompletions","request","delete","size","queueMicrotask","rejectDriverRequests","Error"],"sourceRoot":"../../src","sources":["reactRequests.ts"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,wBAAwB,QACnB,kBAAe;AAYtB,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAAyB,CAAC;AAClD,MAAMC,gBAAgB,GAAG,IAAID,GAAG,CAAsB,CAAC;AACvD,IAAIE,aAAa,GAAG,CAAC;AAErB,OAAO,SAASC,kBAAkBA,CAChCC,QAAgB,EAChBC,gBAAgB,GAAG,KAAK,EACxBC,kBAAuC,EACK;EAC5CJ,aAAa,GAAIA,aAAa,GAAG,UAAU,GAAI,CAAC;EAChD,MAAMK,SAAS,GAAGL,aAAa;EAC/B,IAAIM,cAAmC;EACvC,IAAIC,aAAsC;EAC1C,MAAMC,OAAO,GAAG,IAAIC,OAAO,CAAI,CAACC,OAAO,EAAEC,MAAM,KAAK;IAClDL,cAAc,GAAGI,OAAO;IACxBH,aAAa,GAAGI,MAAM;EACxB,CAAC,CAAC;EACFd,QAAQ,CAACe,GAAG,CAACP,SAAS,EAAE;IACtBK,OAAO,EAAEJ,cAA0C;IACnDK,MAAM,EAAEJ,aAAa;IACrBH;EACF,CAAC,CAAC;EACF,MAAMS,cAAc,GAAGd,gBAAgB,CAACe,GAAG,CAACZ,QAAQ,CAAC,IAAI,IAAIa,GAAG,CAAS,CAAC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AAK,CAAC;IACnD,CAAC,MAAM;MACLE,OAAO,CAACT,MAAM,CAAC,IAAIc,KAAK,CAAC,wCAAwC,CAAC,CAAC;IACrE;EACF;EACA1B,gBAAgB,CAACsB,MAAM,CAACnB,QAAQ,CAAC;AACnC","ignoreList":[]}
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- function px(value) {
4
- 'worklet';
5
-
6
- return `${value}px`;
7
- }
8
-
9
- /**
10
- * Creates a fixed-host CSS clip. Percentage/right/bottom anchored descendants
11
- * continue resolving against the host because this never changes its layout.
12
- */
13
- export function createWebClipPath(geometry) {
14
- 'worklet';
15
-
16
- const width = Math.max(0, geometry.width);
17
- const height = Math.max(0, geometry.height);
18
- const left = Math.max(0, geometry.x);
19
- const top = Math.max(0, geometry.y);
20
- const rightEdge = Math.max(0, geometry.x + width);
21
- const bottomEdge = Math.max(0, geometry.y + height);
22
- const radius = Math.min(Math.max(0, geometry.radius), Math.min(width, height) / 2);
23
- return `inset(${px(top)} max(0px, calc(100% - ${px(rightEdge)})) max(0px, calc(100% - ${px(bottomEdge)})) ${px(left)} round ${px(radius)})`;
24
- }
25
- //# sourceMappingURL=webClipPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["px","value","createWebClipPath","geometry","width","Math","max","height","left","x","top","y","rightEdge","bottomEdge","radius","min"],"sourceRoot":"../../src","sources":["webClipPath.ts"],"mappings":";;AAEA,SAASA,EAAEA,CAACC,KAAa,EAAU;EACjC,SAAS;;EACT,OAAO,GAAGA,KAAK,IAAI;AACrB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,QAAsB,EAAU;EAChE,SAAS;;EACT,MAAMC,KAAK,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,QAAQ,CAACC,KAAK,CAAC;EACzC,MAAMG,MAAM,GAAGF,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,QAAQ,CAACI,MAAM,CAAC;EAC3C,MAAMC,IAAI,GAAGH,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,QAAQ,CAACM,CAAC,CAAC;EACpC,MAAMC,GAAG,GAAGL,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,QAAQ,CAACQ,CAAC,CAAC;EACnC,MAAMC,SAAS,GAAGP,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,QAAQ,CAACM,CAAC,GAAGL,KAAK,CAAC;EACjD,MAAMS,UAAU,GAAGR,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,QAAQ,CAACQ,CAAC,GAAGJ,MAAM,CAAC;EACnD,MAAMO,MAAM,GAAGT,IAAI,CAACU,GAAG,CACrBV,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,QAAQ,CAACW,MAAM,CAAC,EAC5BT,IAAI,CAACU,GAAG,CAACX,KAAK,EAAEG,MAAM,CAAC,GAAG,CAC5B,CAAC;EAED,OAAO,SAASP,EAAE,CAACU,GAAG,CAAC,yBAAyBV,EAAE,CAChDY,SACF,CAAC,2BAA2BZ,EAAE,CAACa,UAAU,CAAC,MAAMb,EAAE,CAChDQ,IACF,CAAC,UAAUR,EAAE,CAACc,MAAM,CAAC,GAAG;AAC1B","ignoreList":[]}
@@ -1,10 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import { type ViewProps } from 'react-native';
3
- import type { SmoothClipDriver } from './driverTypes.js';
4
- export type SmoothClipViewProps = ViewProps & {
5
- driver: SmoothClipDriver;
6
- children?: ReactNode;
7
- };
8
- /** Fixed-layout CSS fallback. */
9
- export declare function SmoothClipView({ driver, children, style, ...viewProps }: SmoothClipViewProps): import("react").JSX.Element;
10
- //# sourceMappingURL=SmoothClipView.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SmoothClipView.web.d.ts","sourceRoot":"","sources":["../../../src/SmoothClipView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,KAAK,SAAS,EAAkB,MAAM,cAAc,CAAC;AAM9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAe,CAAC;AAKtD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG;IAC5C,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,iCAAiC;AACjC,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,QAAQ,EACR,KAAK,EACL,GAAG,SAAS,EACb,EAAE,mBAAmB,+BA0CrB"}
@@ -1,31 +0,0 @@
1
- import type { SharedValue } from 'react-native-reanimated';
2
- import type { ClipAnimationResult, SmoothClipDriver } from './driverTypes.js';
3
- import type { SmoothClipPresentation } from './geometry.js';
4
- export type DriverState = {
5
- driverId: number;
6
- initialPresentation: SmoothClipPresentation;
7
- source: SharedValue<SmoothClipPresentation>;
8
- activeAnimationId?: SharedValue<number>;
9
- ownership?: SharedValue<number>;
10
- onAnimationComplete: {
11
- current: ((result: ClipAnimationResult) => void) | undefined;
12
- };
13
- mountedViews: Set<object>;
14
- animationParticipants: Map<number, Set<object>>;
15
- failedAnimations: Set<number>;
16
- completionDeferrals: number;
17
- deferredCompletions: ClipAnimationResult[];
18
- };
19
- export declare function allocateDriverId(): number;
20
- export declare function setDriverState(driver: SmoothClipDriver, state: DriverState): void;
21
- export declare function attachDriverState(state: DriverState): void;
22
- export declare function detachDriverState(state: DriverState): void;
23
- export declare function createDriverState(driverId: number, initialPresentation: SmoothClipPresentation, source: SharedValue<SmoothClipPresentation>, onAnimationComplete: DriverState['onAnimationComplete'], activeAnimationId?: SharedValue<number>, ownership?: SharedValue<number>): DriverState;
24
- export declare function registerDriverView(driver: SmoothClipDriver): () => void;
25
- export declare function snapshotDriverViews(driverId: number, animationId: number): void;
26
- export declare function finishDriverAnimation(driverId: number, animationId: number, finished: boolean): boolean;
27
- export declare function deliverDriverCompletion(driverId: number, animationId: number, finished: boolean): void;
28
- export declare function deferDriverCompletions(driverId: number): void;
29
- export declare function releaseDriverCompletions(driverId: number): void;
30
- export declare function getDriverState(driver: SmoothClipDriver): DriverState;
31
- //# sourceMappingURL=driverState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"driverState.d.ts","sourceRoot":"","sources":["../../../src/driverState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,kBAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAY,CAAC;AAEzD,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,sBAAsB,CAAC;IAC5C,MAAM,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAC5C,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,mBAAmB,EAAE;QACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;KAC9D,CAAC;IACF,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,mBAAmB,EAAE,CAAC;CAC5C,CAAC;AAMF,wBAAgB,gBAAgB,IAAI,MAAM,CAIzC;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,WAAW,GACjB,IAAI,CAIN;AAKD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAE1D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAY1D;AAED,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,mBAAmB,EAAE,sBAAsB,EAC3C,MAAM,EAAE,WAAW,CAAC,sBAAsB,CAAC,EAC3C,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAAC,EACvD,iBAAiB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EACvC,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC9B,WAAW,CAcb;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,IAAI,CAUvE;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,IAAI,CAKN;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,OAAO,GAChB,OAAO,CAOT;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,OAAO,GAChB,IAAI,CASN;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAG7D;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAS/D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,gBAAgB,GAAG,WAAW,CAQpE"}
@@ -1,107 +0,0 @@
1
- import type { SharedValue } from 'react-native-reanimated';
2
- import type { SmoothClipPresentation } from './geometry.js';
3
- export type ClipReduceMotion = 'system' | 'always' | 'never';
4
- /** Options shared by every animation kind. */
5
- type ClipAnimationBase = Readonly<{
6
- /**
7
- * Explicit start: fuses a `setScalars(from…)` take-ownership hot write
8
- * immediately before the animation, so native starts from exactly this
9
- * presentation instead of its last delivered value. Use at a gesture
10
- * release when the freshest sample (e.g. the UP event's position) never
11
- * reached native — a gated per-frame reaction may not have flushed it.
12
- * Also re-grabs from a running animation (which an implicit interactive
13
- * start would silently skip). Non-finite `from` rejects the whole call.
14
- * On the native drivers `driver.presentation.value` is not written from
15
- * `from` (it stays stale until success sets it to the target); the web
16
- * fallback does write it — its presentation SharedValue is the render
17
- * channel itself. Against a held pending-animation latch, explicit `from`
18
- * is newer intent: the fused write cancels that latch once unfinished,
19
- * applies `from`, and starts the replacement from that native value.
20
- *
21
- * Keyframes interpolate absolutely, so pass `frames[0].presentation` —
22
- * the seed renders it before the first animation frame, making the
23
- * handoff continuous.
24
- *
25
- * iOS note: keyframes start exactly at `from` (frame 0 travels in-band);
26
- * timing/spring sample their Core Animation from-value off the
27
- * presentation layer — the last committed frame, at most one frame behind
28
- * `from` — identical to the two-call pattern this option desugars to.
29
- */
30
- from?: SmoothClipPresentation;
31
- }>;
32
- export type TimingClipAnimation = ClipAnimationBase & Readonly<{
33
- type: 'timing';
34
- duration: number;
35
- controlPoints: readonly [number, number, number, number];
36
- }>;
37
- export type SpringClipAnimation = ClipAnimationBase & Readonly<{
38
- type: 'spring';
39
- mass?: number;
40
- stiffness?: number;
41
- damping?: number;
42
- initialVelocity?: number | 'inherit';
43
- }>;
44
- export type KeyframedClipAnimation = ClipAnimationBase & Readonly<{
45
- type: 'keyframes';
46
- duration: number;
47
- frames: readonly Readonly<{
48
- offset: number;
49
- presentation: SmoothClipPresentation;
50
- }>[];
51
- }>;
52
- export type SmoothClipAnimation = TimingClipAnimation | SpringClipAnimation | KeyframedClipAnimation;
53
- export type ClipAnimationResult = Readonly<{
54
- animationId: number;
55
- finished: boolean;
56
- }>;
57
- export type SmoothClipDriverOptions = Readonly<{
58
- reduceMotion?: ClipReduceMotion;
59
- onAnimationComplete?: (result: ClipAnimationResult) => void;
60
- /**
61
- * Android only; captured at driver creation. Records two-sample velocity
62
- * history on `setScalars` hot writes so a spring `initialVelocity: 'inherit'`
63
- * can project its launch speed from the live drag. Off by default: the
64
- * recording (a clock read plus channel copies) rides the per-frame
65
- * `setScalars` hot path, and drivers that never hand off into an inherit
66
- * spring should not pay it. Without this flag, `'inherit'` inherits 0 after
67
- * a `setScalars` drag on Android (each skipped write also invalidates older
68
- * samples, so stale pre-drag motion never leaks in). `set()`, the fused
69
- * `animateTo` `from` seed, and the declarative `presentation.value` channel
70
- * always record regardless of the flag. iOS always records; the flag is a
71
- * no-op there.
72
- */
73
- velocityTracking?: boolean;
74
- }>;
75
- export type SmoothClipUIControls = Readonly<{
76
- beginInteraction(): SmoothClipPresentation;
77
- set(presentation: SmoothClipPresentation): void;
78
- /**
79
- * Per-frame hot path: writes geometry straight to native without touching
80
- * `driver.presentation`. Skips SharedValue bookkeeping (dirty marking, RN
81
- * mirror sync, listener dispatch) for high-frequency streams such as
82
- * gestures. `driver.presentation.value` is stale after hot writes by design;
83
- * `beginInteraction()` remains the source of truth for visible geometry.
84
- * Do not interleave with `presentation.value` writes on the same driver —
85
- * the listener's duplicate suppression may skip a later equal value.
86
- * To hand off into an animation from a fresher value than the last hot
87
- * write, pass the geometry as `animation.from` to `animateTo` — it fuses
88
- * this call and the handoff into one.
89
- */
90
- setScalars(x: number, y: number, width: number, height: number, radius: number, contentTranslateX: number, contentTranslateY: number): void;
91
- animateTo(presentation: SmoothClipPresentation, animation: SmoothClipAnimation): number;
92
- cancel(animationId?: number, behavior?: 'current' | 'target'): SmoothClipPresentation;
93
- }>;
94
- export type SmoothClipReactControls = Readonly<{
95
- beginInteraction(): Promise<SmoothClipPresentation>;
96
- set(presentation: SmoothClipPresentation): Promise<void>;
97
- animateTo(presentation: SmoothClipPresentation, animation: SmoothClipAnimation): Promise<number>;
98
- cancel(animationId?: number, behavior?: 'current' | 'target'): Promise<SmoothClipPresentation>;
99
- }>;
100
- export type SmoothClipDriver = Readonly<{
101
- kind: 'hybrid';
102
- presentation: SharedValue<SmoothClipPresentation>;
103
- ui: SmoothClipUIControls;
104
- react: SmoothClipReactControls;
105
- }>;
106
- export {};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,OAAO,CAAC,MAAM,CAAC,CAAC;IACnB,MAAM,CACJ,WAAW,CAAC,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,SAAS,GAAG,QAAQ,GAC9B,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAClD,EAAE,EAAE,oBAAoB,CAAC;IACzB,KAAK,EAAE,uBAAuB,CAAC;CAChC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- export { useSmoothClipDriver } from './drivers.native.js';
2
- export type { KeyframedClipAnimation, SpringClipAnimation, TimingClipAnimation, } from './drivers.native.js';
3
- //# sourceMappingURL=drivers.android.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drivers.android.d.ts","sourceRoot":"","sources":["../../../src/drivers.android.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAkB,CAAC;AACvD,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAkB,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { KeyframedClipAnimation, SmoothClipDriver, SmoothClipDriverOptions, SpringClipAnimation, TimingClipAnimation } from './driverTypes.js';
2
- import { type ClipGeometry, type SmoothClipPresentation } from './geometry.js';
3
- export declare function useSmoothClipDriver(initialValue: ClipGeometry | SmoothClipPresentation, options?: SmoothClipDriverOptions): SmoothClipDriver;
4
- export type { KeyframedClipAnimation, SpringClipAnimation, TimingClipAnimation, };
5
- //# sourceMappingURL=drivers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drivers.d.ts","sourceRoot":"","sources":["../../../src/drivers.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAEV,sBAAsB,EAEtB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAe,CAAC;AAYvB,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC5B,MAAM,eAAY,CAAC;AA6FpB,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,YAAY,GAAG,sBAAsB,EACnD,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CA+RlB;AAED,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC"}
@@ -1,3 +0,0 @@
1
- export { useSmoothClipDriver } from './drivers.native.js';
2
- export type { KeyframedClipAnimation, SpringClipAnimation, TimingClipAnimation, } from './drivers.native.js';
3
- //# sourceMappingURL=drivers.ios.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drivers.ios.d.ts","sourceRoot":"","sources":["../../../src/drivers.ios.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAkB,CAAC;AACvD,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAkB,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { KeyframedClipAnimation, SmoothClipDriver, SmoothClipDriverOptions, SpringClipAnimation, TimingClipAnimation } from './driverTypes.js';
2
- import { type ClipGeometry, type SmoothClipPresentation } from './geometry.js';
3
- export declare function useSmoothClipDriver(initialValue: ClipGeometry | SmoothClipPresentation, options?: SmoothClipDriverOptions): SmoothClipDriver;
4
- export type { KeyframedClipAnimation, SpringClipAnimation, TimingClipAnimation, };
5
- //# sourceMappingURL=drivers.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drivers.native.d.ts","sourceRoot":"","sources":["../../../src/drivers.native.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,sBAAsB,EAEtB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAe,CAAC;AAavB,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC5B,MAAM,eAAY,CAAC;AAuMpB,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,YAAY,GAAG,sBAAsB,EACnD,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CA6oBlB;AAED,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC"}
@@ -1,9 +0,0 @@
1
- export { SmoothClipView } from './SmoothClipView.web.js';
2
- export type { SmoothClipViewProps } from './SmoothClipView.web.js';
3
- export { useSmoothClipDriver } from './drivers';
4
- export type { ClipAnimationResult, ClipReduceMotion, KeyframedClipAnimation, SmoothClipDriver, SmoothClipDriverOptions, SmoothClipReactControls, SmoothClipUIControls, SmoothClipAnimation, SpringClipAnimation, TimingClipAnimation, } from './driverTypes.js';
5
- export { ClipEasings } from './easings.js';
6
- export { normalizeClipGeometry } from './geometry.js';
7
- export { createClipPresentation } from './geometry.js';
8
- export type { ClipBounds, ClipGeometry, SmoothClipPresentation, } from './geometry.js';
9
- //# sourceMappingURL=index.web.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAsB,CAAC;AACtD,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAsB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAW,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAY,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAY,CAAC;AACpD,YAAY,EACV,UAAU,EACV,YAAY,EACZ,sBAAsB,GACvB,MAAM,eAAY,CAAC"}
@@ -1,9 +0,0 @@
1
- export declare function createReactRequest<T>(driverId: number, deferCompletions?: boolean, teardownResolution?: {
2
- value: unknown;
3
- }): {
4
- requestId: number;
5
- promise: Promise<T>;
6
- };
7
- export declare function resolveReactRequest(driverId: number, requestId: number, value: unknown, releaseCompletions?: boolean): void;
8
- export declare function rejectDriverRequests(driverId: number): void;
9
- //# sourceMappingURL=reactRequests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reactRequests.d.ts","sourceRoot":"","sources":["../../../src/reactRequests.ts"],"names":[],"mappings":"AAmBA,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,UAAQ,EACxB,kBAAkB,CAAC,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GACtC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;CAAE,CAmB5C;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,OAAO,EACd,kBAAkB,UAAQ,GACzB,IAAI,CAUN;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAc3D"}
@@ -1,7 +0,0 @@
1
- import type { ClipGeometry } from './geometry.js';
2
- /**
3
- * Creates a fixed-host CSS clip. Percentage/right/bottom anchored descendants
4
- * continue resolving against the host because this never changes its layout.
5
- */
6
- export declare function createWebClipPath(geometry: ClipGeometry): string;
7
- //# sourceMappingURL=webClipPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webClipPath.d.ts","sourceRoot":"","sources":["../../../src/webClipPath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAY,CAAC;AAO/C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAkBhE"}
@@ -1,66 +0,0 @@
1
- import { type ReactNode, useEffect } from 'react';
2
- import { type ViewProps, type ViewStyle } from 'react-native';
3
- import Animated, {
4
- useAnimatedReaction,
5
- useAnimatedStyle,
6
- useSharedValue,
7
- } from 'react-native-reanimated';
8
- import type { SmoothClipDriver } from './driverTypes';
9
- import { getDriverState, registerDriverView } from './driverState';
10
- import { clipPresentationEquals, isFiniteClipPresentation } from './geometry';
11
- import { createWebClipPath } from './webClipPath';
12
-
13
- export type SmoothClipViewProps = ViewProps & {
14
- driver: SmoothClipDriver;
15
- children?: ReactNode;
16
- };
17
-
18
- /** Fixed-layout CSS fallback. */
19
- export function SmoothClipView({
20
- driver,
21
- children,
22
- style,
23
- ...viewProps
24
- }: SmoothClipViewProps) {
25
- const { initialPresentation, source } = getDriverState(driver);
26
- useEffect(() => registerDriverView(driver), [driver]);
27
- const acceptedPresentation = useSharedValue(initialPresentation);
28
- const initialClipStyle = {
29
- clipPath: createWebClipPath(initialPresentation.clip),
30
- overflow: 'hidden',
31
- } as unknown as ViewStyle;
32
-
33
- useAnimatedReaction(
34
- () => source.value,
35
- (presentation, previousPresentation) => {
36
- if (
37
- isFiniteClipPresentation(presentation) &&
38
- !clipPresentationEquals(previousPresentation, presentation)
39
- ) {
40
- acceptedPresentation.value = presentation;
41
- }
42
- },
43
- [source, acceptedPresentation]
44
- );
45
-
46
- const clipStyle = useAnimatedStyle(() => {
47
- const clip = acceptedPresentation.value.clip;
48
- return {
49
- clipPath: createWebClipPath(clip),
50
- overflow: 'hidden',
51
- };
52
- });
53
-
54
- const contentStyle = useAnimatedStyle(() => ({
55
- transform: [
56
- { translateX: acceptedPresentation.value.contentTranslateX },
57
- { translateY: acceptedPresentation.value.contentTranslateY },
58
- ],
59
- }));
60
-
61
- return (
62
- <Animated.View {...viewProps} style={[style, initialClipStyle, clipStyle]}>
63
- <Animated.View style={contentStyle}>{children}</Animated.View>
64
- </Animated.View>
65
- );
66
- }
@@ -1,158 +0,0 @@
1
- import type { SharedValue } from 'react-native-reanimated';
2
- import type { ClipAnimationResult, SmoothClipDriver } from './driverTypes';
3
- import type { SmoothClipPresentation } from './geometry';
4
-
5
- export type DriverState = {
6
- driverId: number;
7
- initialPresentation: SmoothClipPresentation;
8
- source: SharedValue<SmoothClipPresentation>;
9
- activeAnimationId?: SharedValue<number>;
10
- ownership?: SharedValue<number>;
11
- onAnimationComplete: {
12
- current: ((result: ClipAnimationResult) => void) | undefined;
13
- };
14
- mountedViews: Set<object>;
15
- animationParticipants: Map<number, Set<object>>;
16
- failedAnimations: Set<number>;
17
- completionDeferrals: number;
18
- deferredCompletions: ClipAnimationResult[];
19
- };
20
-
21
- const states = new WeakMap<SmoothClipDriver, DriverState>();
22
- const statesById = new Map<number, DriverState>();
23
- let nextDriverId = Date.now() * 1024;
24
-
25
- export function allocateDriverId(): number {
26
- nextDriverId += 1;
27
- if (!Number.isSafeInteger(nextDriverId)) nextDriverId = 1;
28
- return nextDriverId;
29
- }
30
-
31
- export function setDriverState(
32
- driver: SmoothClipDriver,
33
- state: DriverState
34
- ): void {
35
- // WeakMap-only: safe to call from render (discarded renders leave nothing
36
- // reachable) and survives effect replays so getDriverState keeps working.
37
- states.set(driver, state);
38
- }
39
-
40
- // The strong by-id index is attached in the driver hook's effect and detached
41
- // in its cleanup, so discarded renders never leak entries and StrictMode /
42
- // <Activity> effect replays can re-attach the same state.
43
- export function attachDriverState(state: DriverState): void {
44
- statesById.set(state.driverId, state);
45
- }
46
-
47
- export function detachDriverState(state: DriverState): void {
48
- if (statesById.get(state.driverId) === state) {
49
- statesById.delete(state.driverId);
50
- }
51
- // Requests pending at teardown were settled by rejectDriverRequests, but
52
- // their completion deferrals can no longer be released: the late-scheduled
53
- // resolver's releaseDriverCompletions no-ops against a detached state. An
54
- // effect replay reattaches THIS same object, so a stale positive count
55
- // would queue every future completion forever. The deferrals died with
56
- // their requests — reset them.
57
- state.completionDeferrals = 0;
58
- state.deferredCompletions.length = 0;
59
- }
60
-
61
- export function createDriverState(
62
- driverId: number,
63
- initialPresentation: SmoothClipPresentation,
64
- source: SharedValue<SmoothClipPresentation>,
65
- onAnimationComplete: DriverState['onAnimationComplete'],
66
- activeAnimationId?: SharedValue<number>,
67
- ownership?: SharedValue<number>
68
- ): DriverState {
69
- return {
70
- driverId,
71
- initialPresentation,
72
- source,
73
- activeAnimationId,
74
- ownership,
75
- onAnimationComplete,
76
- mountedViews: new Set(),
77
- animationParticipants: new Map(),
78
- failedAnimations: new Set(),
79
- completionDeferrals: 0,
80
- deferredCompletions: [],
81
- };
82
- }
83
-
84
- export function registerDriverView(driver: SmoothClipDriver): () => void {
85
- const state = getDriverState(driver);
86
- const token = {};
87
- state.mountedViews.add(token);
88
- return () => {
89
- state.mountedViews.delete(token);
90
- for (const [animationId, participants] of state.animationParticipants) {
91
- if (participants.has(token)) state.failedAnimations.add(animationId);
92
- }
93
- };
94
- }
95
-
96
- export function snapshotDriverViews(
97
- driverId: number,
98
- animationId: number
99
- ): void {
100
- const state = statesById.get(driverId);
101
- if (state) {
102
- state.animationParticipants.set(animationId, new Set(state.mountedViews));
103
- }
104
- }
105
-
106
- export function finishDriverAnimation(
107
- driverId: number,
108
- animationId: number,
109
- finished: boolean
110
- ): boolean {
111
- const state = statesById.get(driverId);
112
- if (!state) return finished;
113
- const result = finished && !state.failedAnimations.has(animationId);
114
- state.animationParticipants.delete(animationId);
115
- state.failedAnimations.delete(animationId);
116
- return result;
117
- }
118
-
119
- export function deliverDriverCompletion(
120
- driverId: number,
121
- animationId: number,
122
- finished: boolean
123
- ): void {
124
- const state = statesById.get(driverId);
125
- if (!state) return;
126
- const result = { animationId, finished };
127
- if (state.completionDeferrals > 0) {
128
- state.deferredCompletions.push(result);
129
- return;
130
- }
131
- state.onAnimationComplete.current?.(result);
132
- }
133
-
134
- export function deferDriverCompletions(driverId: number): void {
135
- const state = statesById.get(driverId);
136
- if (state) state.completionDeferrals += 1;
137
- }
138
-
139
- export function releaseDriverCompletions(driverId: number): void {
140
- const state = statesById.get(driverId);
141
- if (!state || state.completionDeferrals === 0) return;
142
- state.completionDeferrals -= 1;
143
- if (state.completionDeferrals !== 0) return;
144
- const deferred = state.deferredCompletions.splice(0);
145
- for (const result of deferred) {
146
- state.onAnimationComplete.current?.(result);
147
- }
148
- }
149
-
150
- export function getDriverState(driver: SmoothClipDriver): DriverState {
151
- const state = states.get(driver);
152
- if (!state) {
153
- throw new Error(
154
- '[SmoothClipView] Drivers must be created by useSmoothClipDriver.'
155
- );
156
- }
157
- return state;
158
- }