react-native-worklets 0.3.0 → 0.4.0-bundle-mode-preview-1

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 (202) hide show
  1. package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.cpp +532 -0
  2. package/Common/cpp/worklets/NativeModules/JSIWorkletsModuleProxy.h +88 -0
  3. package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +40 -122
  4. package/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +16 -40
  5. package/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +2 -1
  6. package/Common/cpp/worklets/Resources/ValueUnpacker.cpp +1 -1
  7. package/Common/cpp/worklets/SharedItems/Shareables.cpp +200 -24
  8. package/Common/cpp/worklets/SharedItems/Shareables.h +108 -7
  9. package/Common/cpp/worklets/Tools/JSLogger.cpp +56 -4
  10. package/Common/cpp/worklets/Tools/JSLogger.h +17 -0
  11. package/Common/cpp/worklets/Tools/JSScheduler.cpp +12 -0
  12. package/Common/cpp/worklets/Tools/JSScheduler.h +10 -2
  13. package/Common/cpp/worklets/Tools/SingleInstanceChecker.h +3 -1
  14. package/Common/cpp/worklets/Tools/WorkletsJSIUtils.cpp +19 -1
  15. package/Common/cpp/worklets/Tools/WorkletsJSIUtils.h +12 -3
  16. package/Common/cpp/worklets/Tools/WorkletsSystraceSection.h +136 -0
  17. package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +4 -4
  18. package/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +1 -1
  19. package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.cpp +85 -0
  20. package/Common/cpp/worklets/WorkletRuntime/RuntimeManager.h +55 -0
  21. package/Common/cpp/worklets/WorkletRuntime/WorkletHermesRuntime.h +8 -4
  22. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +70 -24
  23. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +24 -4
  24. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +53 -1
  25. package/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +2 -1
  26. package/RNWorklets.podspec +9 -4
  27. package/android/CMakeLists.txt +14 -36
  28. package/android/build.gradle +16 -33
  29. package/android/src/experimentalBundling/com/swmansion/worklets/WorkletsModule.java +149 -0
  30. package/android/src/{main/java → legacyBundling}/com/swmansion/worklets/WorkletsModule.java +17 -2
  31. package/android/src/main/cpp/worklets/android/WorkletsModule.cpp +49 -8
  32. package/android/src/main/cpp/worklets/android/WorkletsModule.h +17 -2
  33. package/android/src/main/java/com/swmansion/worklets/WorkletsPackage.java +1 -1
  34. package/apple/worklets/apple/WorkletsMessageThread.mm +4 -0
  35. package/apple/worklets/apple/WorkletsModule.h +16 -1
  36. package/apple/worklets/apple/WorkletsModule.mm +29 -2
  37. package/bundleMode/index.d.ts +3 -0
  38. package/bundleMode/index.js +55 -0
  39. package/lib/module/PlatformChecker/PlatformChecker.js +8 -0
  40. package/lib/module/PlatformChecker/PlatformChecker.js.map +1 -0
  41. package/lib/module/PlatformChecker/index.js +17 -0
  42. package/lib/module/PlatformChecker/index.js.map +1 -0
  43. package/lib/module/WorkletsError.js +2 -1
  44. package/lib/module/WorkletsError.js.map +1 -1
  45. package/lib/module/WorkletsModule/JSWorklets.js +36 -4
  46. package/lib/module/WorkletsModule/JSWorklets.js.map +1 -1
  47. package/lib/module/WorkletsModule/NativeWorklets.js +35 -15
  48. package/lib/module/WorkletsModule/NativeWorklets.js.map +1 -1
  49. package/lib/module/WorkletsModule/workletsModuleInstance.js +2 -2
  50. package/lib/module/WorkletsModule/workletsModuleInstance.js.map +1 -1
  51. package/lib/module/bundleUnpacker.js +47 -0
  52. package/lib/module/bundleUnpacker.js.map +1 -0
  53. package/lib/module/callGuard.js +30 -0
  54. package/lib/module/callGuard.js.map +1 -0
  55. package/lib/module/errors.js +30 -11
  56. package/lib/module/errors.js.map +1 -1
  57. package/lib/module/index.js +10 -7
  58. package/lib/module/index.js.map +1 -1
  59. package/lib/module/initializers.js +123 -103
  60. package/lib/module/initializers.js.map +1 -1
  61. package/lib/module/logger.js +15 -0
  62. package/lib/module/logger.js.map +1 -0
  63. package/lib/module/privateGlobals.d.js +0 -1
  64. package/lib/module/privateGlobals.d.js.map +1 -1
  65. package/lib/module/publicGlobals.js +5 -0
  66. package/lib/module/publicGlobals.js.map +1 -0
  67. package/lib/module/runLoop/mockedRequestAnimationFrame.js.map +1 -0
  68. package/lib/module/runLoop/requestAnimationFrame.js +50 -0
  69. package/lib/module/runLoop/requestAnimationFrame.js.map +1 -0
  70. package/lib/module/runLoop/setImmediatePolyfill.js +15 -0
  71. package/lib/module/runLoop/setImmediatePolyfill.js.map +1 -0
  72. package/lib/module/runLoop/setIntervalPolyfill.js +26 -0
  73. package/lib/module/runLoop/setIntervalPolyfill.js.map +1 -0
  74. package/lib/module/runLoop/setTimeoutPolyfill.js +32 -0
  75. package/lib/module/runLoop/setTimeoutPolyfill.js.map +1 -0
  76. package/lib/module/runtimes.js +6 -10
  77. package/lib/module/runtimes.js.map +1 -1
  78. package/lib/module/shareableMappingCache.js +1 -3
  79. package/lib/module/shareableMappingCache.js.map +1 -1
  80. package/lib/module/shareables.js +116 -34
  81. package/lib/module/shareables.js.map +1 -1
  82. package/lib/module/specs/index.js +2 -2
  83. package/lib/module/specs/index.js.map +1 -1
  84. package/lib/module/threads.js +49 -54
  85. package/lib/module/threads.js.map +1 -1
  86. package/lib/module/valueUnpacker.js +3 -3
  87. package/lib/module/valueUnpacker.js.map +1 -1
  88. package/lib/module/workletRuntimeEntry.js +30 -0
  89. package/lib/module/workletRuntimeEntry.js.map +1 -0
  90. package/lib/typescript/PlatformChecker/PlatformChecker.d.ts +5 -0
  91. package/lib/typescript/PlatformChecker/PlatformChecker.d.ts.map +1 -0
  92. package/lib/typescript/PlatformChecker/index.d.ts +10 -0
  93. package/lib/typescript/PlatformChecker/index.d.ts.map +1 -0
  94. package/lib/typescript/WorkletsError.d.ts.map +1 -1
  95. package/lib/typescript/WorkletsModule/JSWorklets.d.ts.map +1 -1
  96. package/lib/typescript/WorkletsModule/NativeWorklets.d.ts +1 -3
  97. package/lib/typescript/WorkletsModule/NativeWorklets.d.ts.map +1 -1
  98. package/lib/typescript/WorkletsModule/workletsModuleInstance.d.ts +1 -1
  99. package/lib/typescript/WorkletsModule/workletsModuleInstance.d.ts.map +1 -1
  100. package/lib/typescript/WorkletsModule/workletsModuleInstance.web.d.ts +1 -1
  101. package/lib/typescript/WorkletsModule/workletsModuleInstance.web.d.ts.map +1 -1
  102. package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts +12 -2
  103. package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts.map +1 -1
  104. package/lib/typescript/bundleUnpacker.d.ts +7 -0
  105. package/lib/typescript/bundleUnpacker.d.ts.map +1 -0
  106. package/lib/typescript/callGuard.d.ts +4 -0
  107. package/lib/typescript/callGuard.d.ts.map +1 -0
  108. package/lib/typescript/errors.d.ts +13 -5
  109. package/lib/typescript/errors.d.ts.map +1 -1
  110. package/lib/typescript/index.d.ts +1 -2
  111. package/lib/typescript/index.d.ts.map +1 -1
  112. package/lib/typescript/initializers.d.ts +16 -5
  113. package/lib/typescript/initializers.d.ts.map +1 -1
  114. package/lib/typescript/logger.d.ts +5 -0
  115. package/lib/typescript/logger.d.ts.map +1 -0
  116. package/lib/typescript/publicGlobals.d.ts +22 -0
  117. package/lib/typescript/publicGlobals.d.ts.map +1 -0
  118. package/lib/typescript/runLoop/mockedRequestAnimationFrame.d.ts.map +1 -0
  119. package/lib/typescript/runLoop/requestAnimationFrame.d.ts.map +1 -0
  120. package/lib/typescript/runLoop/setImmediatePolyfill.d.ts +2 -0
  121. package/lib/typescript/runLoop/setImmediatePolyfill.d.ts.map +1 -0
  122. package/lib/typescript/runLoop/setIntervalPolyfill.d.ts +2 -0
  123. package/lib/typescript/runLoop/setIntervalPolyfill.d.ts.map +1 -0
  124. package/lib/typescript/runLoop/setTimeoutPolyfill.d.ts +2 -0
  125. package/lib/typescript/runLoop/setTimeoutPolyfill.d.ts.map +1 -0
  126. package/lib/typescript/runtimes.d.ts.map +1 -1
  127. package/lib/typescript/shareableMappingCache.d.ts.map +1 -1
  128. package/lib/typescript/shareables.d.ts +3 -2
  129. package/lib/typescript/shareables.d.ts.map +1 -1
  130. package/lib/typescript/specs/NativeWorkletsModule.d.ts +1 -1
  131. package/lib/typescript/specs/NativeWorkletsModule.d.ts.map +1 -1
  132. package/lib/typescript/specs/index.d.ts +2 -2
  133. package/lib/typescript/specs/index.d.ts.map +1 -1
  134. package/lib/typescript/threads.d.ts.map +1 -1
  135. package/lib/typescript/workletRuntimeEntry.d.ts +14 -0
  136. package/lib/typescript/workletRuntimeEntry.d.ts.map +1 -0
  137. package/lib/typescript/workletTypes.d.ts +14 -3
  138. package/lib/typescript/workletTypes.d.ts.map +1 -1
  139. package/package.json +17 -8
  140. package/plugin/index.js +145 -52
  141. package/scripts/worklets_utils.rb +9 -0
  142. package/src/PlatformChecker/PlatformChecker.ts +7 -0
  143. package/src/PlatformChecker/index.ts +29 -0
  144. package/src/WorkletsError.ts +2 -1
  145. package/src/WorkletsModule/JSWorklets.ts +71 -4
  146. package/src/WorkletsModule/NativeWorklets.ts +83 -21
  147. package/src/WorkletsModule/workletsModuleInstance.ts +2 -2
  148. package/src/WorkletsModule/workletsModuleProxy.ts +49 -1
  149. package/src/bundleUnpacker.ts +75 -0
  150. package/src/callGuard.ts +33 -0
  151. package/src/errors.ts +35 -18
  152. package/src/index.ts +12 -12
  153. package/src/initializers.ts +143 -113
  154. package/src/logger.ts +16 -0
  155. package/src/privateGlobals.d.ts +22 -6
  156. package/src/publicGlobals.ts +26 -0
  157. package/src/runLoop/requestAnimationFrame.ts +67 -0
  158. package/src/runLoop/setImmediatePolyfill.ts +20 -0
  159. package/src/runLoop/setIntervalPolyfill.ts +38 -0
  160. package/src/runLoop/setTimeoutPolyfill.ts +40 -0
  161. package/src/runtimes.ts +6 -11
  162. package/src/shareableMappingCache.ts +1 -3
  163. package/src/shareables.ts +179 -65
  164. package/src/specs/NativeWorkletsModule.ts +1 -1
  165. package/src/specs/index.ts +5 -2
  166. package/src/threads.ts +75 -65
  167. package/src/valueUnpacker.ts +3 -3
  168. package/src/workletRuntimeEntry.ts +30 -0
  169. package/src/workletTypes.ts +22 -5
  170. package/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +0 -139
  171. package/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +0 -61
  172. package/android/src/paper/com/swmansion/worklets/NativeWorkletsModuleSpec.java +0 -26
  173. package/lib/module/PlatformChecker.js +0 -26
  174. package/lib/module/PlatformChecker.js.map +0 -1
  175. package/lib/module/animationFrameQueue/mockedRequestAnimationFrame.js.map +0 -1
  176. package/lib/module/animationFrameQueue/requestAnimationFrame.js +0 -36
  177. package/lib/module/animationFrameQueue/requestAnimationFrame.js.map +0 -1
  178. package/lib/module/logger/LogBox.js +0 -15
  179. package/lib/module/logger/LogBox.js.map +0 -1
  180. package/lib/module/logger/index.js +0 -5
  181. package/lib/module/logger/index.js.map +0 -1
  182. package/lib/module/logger/logger.js +0 -137
  183. package/lib/module/logger/logger.js.map +0 -1
  184. package/lib/typescript/PlatformChecker.d.ts +0 -6
  185. package/lib/typescript/PlatformChecker.d.ts.map +0 -1
  186. package/lib/typescript/animationFrameQueue/mockedRequestAnimationFrame.d.ts.map +0 -1
  187. package/lib/typescript/animationFrameQueue/requestAnimationFrame.d.ts.map +0 -1
  188. package/lib/typescript/logger/LogBox.d.ts +0 -32
  189. package/lib/typescript/logger/LogBox.d.ts.map +0 -1
  190. package/lib/typescript/logger/index.d.ts +0 -3
  191. package/lib/typescript/logger/index.d.ts.map +0 -1
  192. package/lib/typescript/logger/logger.d.ts +0 -52
  193. package/lib/typescript/logger/logger.d.ts.map +0 -1
  194. package/src/PlatformChecker.ts +0 -30
  195. package/src/animationFrameQueue/requestAnimationFrame.ts +0 -41
  196. package/src/logger/LogBox.ts +0 -55
  197. package/src/logger/index.ts +0 -3
  198. package/src/logger/logger.ts +0 -155
  199. /package/lib/module/{animationFrameQueue → runLoop}/mockedRequestAnimationFrame.js +0 -0
  200. /package/lib/typescript/{animationFrameQueue → runLoop}/mockedRequestAnimationFrame.d.ts +0 -0
  201. /package/lib/typescript/{animationFrameQueue → runLoop}/requestAnimationFrame.d.ts +0 -0
  202. /package/src/{animationFrameQueue → runLoop}/mockedRequestAnimationFrame.ts +0 -0
@@ -29,7 +29,7 @@ export type WorkletStackDetails = [
29
29
  columnOffset: number,
30
30
  ];
31
31
 
32
- type WorkletClosure = Record<string, unknown>;
32
+ export type WorkletClosure = Record<string, unknown>;
33
33
 
34
34
  interface WorkletInitData {
35
35
  code: string;
@@ -41,7 +41,7 @@ interface WorkletInitData {
41
41
  version?: string;
42
42
  }
43
43
 
44
- export interface WorkletProps {
44
+ interface WorkletProps {
45
45
  __closure: WorkletClosure;
46
46
  __workletHash: number;
47
47
  __initData: WorkletInitData;
@@ -52,11 +52,28 @@ export interface WorkletProps {
52
52
  }
53
53
 
54
54
  export type WorkletFunction<
55
- Args extends unknown[] = unknown[],
56
- ReturnValue = unknown,
57
- > = ((...args: Args) => ReturnValue) & WorkletProps;
55
+ TArgs extends unknown[] = unknown[],
56
+ TReturn = unknown,
57
+ > = ((...args: TArgs) => TReturn) & WorkletProps;
58
+
59
+ export interface WorkletFactory<
60
+ TArgs extends unknown[] = unknown[],
61
+ TReturn = unknown,
62
+ TClosureVariables extends Record<string, unknown> = Record<string, unknown>,
63
+ > {
64
+ (closureVariables: TClosureVariables): WorkletFunction<TArgs, TReturn>;
65
+ }
58
66
 
59
67
  export type ValueUnpacker = WorkletFunction<
60
68
  [objectToUnpack: unknown, category?: string],
61
69
  unknown
62
70
  >;
71
+
72
+ export interface WorkletImport {
73
+ __bundleData: {
74
+ /** Name of the module which is the source of the import. */
75
+ source: string;
76
+ /** The name of the imported value. */
77
+ imported: string;
78
+ };
79
+ }
@@ -1,139 +0,0 @@
1
- #include <jsi/jsi.h>
2
- #include <worklets/NativeModules/WorkletsModuleProxySpec.h>
3
-
4
- #include <utility>
5
-
6
- #define WORKLETS_SPEC_PREFIX(FN_NAME) \
7
- __hostFunction_WorkletsModuleProxySpec_##FN_NAME
8
-
9
- namespace worklets {
10
-
11
- static jsi::Value WORKLETS_SPEC_PREFIX(makeShareableClone)(
12
- jsi::Runtime &rt,
13
- TurboModule &turboModule,
14
- const jsi::Value *args,
15
- size_t) {
16
- return static_cast<WorkletsModuleProxySpec *>(&turboModule)
17
- ->makeShareableClone(
18
- rt, std::move(args[0]), std::move(args[1]), std::move(args[2]));
19
- }
20
-
21
- static jsi::Value WORKLETS_SPEC_PREFIX(makeShareableString)(
22
- jsi::Runtime &rt,
23
- TurboModule &turboModule,
24
- const jsi::Value *args,
25
- size_t) {
26
- return static_cast<WorkletsModuleProxySpec *>(&turboModule)
27
- ->makeShareableString(rt, std::move(args[0]).asString(rt));
28
- }
29
-
30
- static jsi::Value WORKLETS_SPEC_PREFIX(makeShareableNumber)(
31
- jsi::Runtime &rt,
32
- TurboModule &turboModule,
33
- const jsi::Value *args,
34
- size_t) {
35
- return static_cast<WorkletsModuleProxySpec *>(&turboModule)
36
- ->makeShareableNumber(rt, std::move(args[0]).asNumber());
37
- }
38
-
39
- static jsi::Value WORKLETS_SPEC_PREFIX(makeShareableBoolean)(
40
- jsi::Runtime &rt,
41
- TurboModule &turboModule,
42
- const jsi::Value *args,
43
- size_t) {
44
- return static_cast<WorkletsModuleProxySpec *>(&turboModule)
45
- ->makeShareableBoolean(rt, std::move(args[0]).asBool());
46
- }
47
-
48
- static jsi::Value WORKLETS_SPEC_PREFIX(makeShareableBigInt)(
49
- jsi::Runtime &rt,
50
- TurboModule &turboModule,
51
- const jsi::Value *args,
52
- size_t) {
53
- return static_cast<WorkletsModuleProxySpec *>(&turboModule)
54
- ->makeShareableBigInt(rt, std::move(args[0]).asBigInt(rt));
55
- }
56
-
57
- static jsi::Value WORKLETS_SPEC_PREFIX(makeShareableUndefined)(
58
- jsi::Runtime &rt,
59
- TurboModule &turboModule,
60
- const jsi::Value *args,
61
- size_t) {
62
- return static_cast<WorkletsModuleProxySpec *>(&turboModule)
63
- ->makeShareableUndefined(rt);
64
- }
65
-
66
- static jsi::Value WORKLETS_SPEC_PREFIX(makeShareableNull)(
67
- jsi::Runtime &rt,
68
- TurboModule &turboModule,
69
- const jsi::Value *args,
70
- size_t) {
71
- return static_cast<WorkletsModuleProxySpec *>(&turboModule)
72
- ->makeShareableNull(rt);
73
- }
74
-
75
- static jsi::Value WORKLETS_SPEC_PREFIX(scheduleOnUI)(
76
- jsi::Runtime &rt,
77
- TurboModule &turboModule,
78
- const jsi::Value *args,
79
- size_t) {
80
- static_cast<WorkletsModuleProxySpec *>(&turboModule)
81
- ->scheduleOnUI(rt, std::move(args[0]));
82
- return jsi::Value::undefined();
83
- }
84
-
85
- static jsi::Value WORKLETS_SPEC_PREFIX(executeOnUIRuntimeSync)(
86
- jsi::Runtime &rt,
87
- TurboModule &turboModule,
88
- const jsi::Value *args,
89
- size_t) {
90
- return static_cast<WorkletsModuleProxySpec *>(&turboModule)
91
- ->executeOnUIRuntimeSync(rt, std::move(args[0]));
92
- }
93
-
94
- static jsi::Value WORKLETS_SPEC_PREFIX(createWorkletRuntime)(
95
- jsi::Runtime &rt,
96
- TurboModule &turboModule,
97
- const jsi::Value *args,
98
- size_t) {
99
- return static_cast<WorkletsModuleProxySpec *>(&turboModule)
100
- ->createWorkletRuntime(rt, std::move(args[0]), std::move(args[1]));
101
- }
102
-
103
- static jsi::Value WORKLETS_SPEC_PREFIX(scheduleOnRuntime)(
104
- jsi::Runtime &rt,
105
- TurboModule &turboModule,
106
- const jsi::Value *args,
107
- size_t) {
108
- return static_cast<WorkletsModuleProxySpec *>(&turboModule)
109
- ->scheduleOnRuntime(rt, std::move(args[0]), std::move(args[1]));
110
- }
111
-
112
- WorkletsModuleProxySpec::WorkletsModuleProxySpec(
113
- const std::shared_ptr<CallInvoker> jsInvoker)
114
- : TurboModule("NativeWorklets", jsInvoker) {
115
- methodMap_["makeShareableClone"] =
116
- MethodMetadata{2, WORKLETS_SPEC_PREFIX(makeShareableClone)};
117
- methodMap_["makeShareableString"] =
118
- MethodMetadata{1, WORKLETS_SPEC_PREFIX(makeShareableString)};
119
- methodMap_["makeShareableNumber"] =
120
- MethodMetadata{1, WORKLETS_SPEC_PREFIX(makeShareableNumber)};
121
- methodMap_["makeShareableBoolean"] =
122
- MethodMetadata{1, WORKLETS_SPEC_PREFIX(makeShareableBoolean)};
123
- methodMap_["makeShareableBigInt"] =
124
- MethodMetadata{1, WORKLETS_SPEC_PREFIX(makeShareableBigInt)};
125
- methodMap_["makeShareableUndefined"] =
126
- MethodMetadata{0, WORKLETS_SPEC_PREFIX(makeShareableUndefined)};
127
- methodMap_["makeShareableNull"] =
128
- MethodMetadata{0, WORKLETS_SPEC_PREFIX(makeShareableNull)};
129
- methodMap_["scheduleOnUI"] =
130
- MethodMetadata{1, WORKLETS_SPEC_PREFIX(scheduleOnUI)};
131
- methodMap_["executeOnUIRuntimeSync"] =
132
- MethodMetadata{1, WORKLETS_SPEC_PREFIX(executeOnUIRuntimeSync)};
133
- methodMap_["createWorkletRuntime"] =
134
- MethodMetadata{2, WORKLETS_SPEC_PREFIX(createWorkletRuntime)};
135
- methodMap_["scheduleOnRuntime"] =
136
- MethodMetadata{2, WORKLETS_SPEC_PREFIX(scheduleOnRuntime)};
137
- }
138
-
139
- } // namespace worklets
@@ -1,61 +0,0 @@
1
- #pragma once
2
-
3
- #include <ReactCommon/CallInvoker.h>
4
- #include <ReactCommon/TurboModule.h>
5
- #include <memory>
6
- #include <string>
7
-
8
- using namespace facebook;
9
- using namespace react;
10
-
11
- namespace worklets {
12
-
13
- class JSI_EXPORT WorkletsModuleProxySpec : public TurboModule {
14
- protected:
15
- explicit WorkletsModuleProxySpec(
16
- const std::shared_ptr<CallInvoker> jsInvoker);
17
-
18
- public:
19
- // Shareables
20
- virtual jsi::Value makeShareableClone(
21
- jsi::Runtime &rt,
22
- const jsi::Value &value,
23
- const jsi::Value &shouldRetainRemote,
24
- const jsi::Value &nativeStateSource) = 0;
25
-
26
- virtual jsi::Value makeShareableString(
27
- jsi::Runtime &rt,
28
- const jsi::String &string) = 0;
29
-
30
- virtual jsi::Value makeShareableNumber(jsi::Runtime &rt, double number) = 0;
31
-
32
- virtual jsi::Value makeShareableBoolean(jsi::Runtime &rt, bool boolean) = 0;
33
-
34
- virtual jsi::Value makeShareableBigInt(
35
- jsi::Runtime &rt,
36
- const jsi::BigInt &bigint) = 0;
37
-
38
- virtual jsi::Value makeShareableUndefined(jsi::Runtime &rt) = 0;
39
-
40
- virtual jsi::Value makeShareableNull(jsi::Runtime &rt) = 0;
41
-
42
- // Scheduling
43
- virtual void scheduleOnUI(jsi::Runtime &rt, const jsi::Value &worklet) = 0;
44
-
45
- virtual jsi::Value executeOnUIRuntimeSync(
46
- jsi::Runtime &rt,
47
- const jsi::Value &worklet) = 0;
48
-
49
- // Worklet runtime
50
- virtual jsi::Value createWorkletRuntime(
51
- jsi::Runtime &rt,
52
- const jsi::Value &name,
53
- const jsi::Value &initializer) = 0;
54
-
55
- virtual jsi::Value scheduleOnRuntime(
56
- jsi::Runtime &rt,
57
- const jsi::Value &workletRuntimeValue,
58
- const jsi::Value &shareableWorkletValue) = 0;
59
- };
60
-
61
- } // namespace worklets
@@ -1,26 +0,0 @@
1
- package com.swmansion.worklets;
2
-
3
- import com.facebook.proguard.annotations.DoNotStrip;
4
- import com.facebook.react.bridge.ReactApplicationContext;
5
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
6
- import com.facebook.react.bridge.ReactMethod;
7
- import com.facebook.react.turbomodule.core.interfaces.TurboModule;
8
- import javax.annotation.Nonnull;
9
-
10
- public abstract class NativeWorkletsModuleSpec extends ReactContextBaseJavaModule
11
- implements TurboModule {
12
- public static final String NAME = "WorkletsModule";
13
-
14
- public NativeWorkletsModuleSpec(ReactApplicationContext reactContext) {
15
- super(reactContext);
16
- }
17
-
18
- @Override
19
- public @Nonnull String getName() {
20
- return NAME;
21
- }
22
-
23
- @ReactMethod(isBlockingSynchronousMethod = true)
24
- @DoNotStrip
25
- public abstract boolean installTurboModule();
26
- }
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- import { Platform } from 'react-native';
4
- export function isJest() {
5
- return !!process.env.JEST_WORKER_ID;
6
- }
7
- export function isWeb() {
8
- return Platform.OS === 'web';
9
- }
10
- export function isAndroid() {
11
- return Platform.OS === 'android';
12
- }
13
- function isWindows() {
14
- return Platform.OS === 'windows';
15
- }
16
- export function shouldBeUseWeb() {
17
- return isJest() || isWeb() || isWindows();
18
- }
19
- export function isWindowAvailable() {
20
- // the window object is unavailable when building the server portion of a site that uses SSG
21
- // this function shouldn't be used to conditionally render components
22
- // https://www.joshwcomeau.com/react/the-perils-of-rehydration/
23
- // @ts-ignore Fallback if `window` is undefined.
24
- return typeof window !== 'undefined';
25
- }
26
- //# sourceMappingURL=PlatformChecker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Platform","isJest","process","env","JEST_WORKER_ID","isWeb","OS","isAndroid","isWindows","shouldBeUseWeb","isWindowAvailable","window"],"sourceRoot":"../../src","sources":["PlatformChecker.ts"],"mappings":"AAAA,YAAY;;AACZ,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,SAASC,MAAMA,CAAA,EAAY;EAChC,OAAO,CAAC,CAACC,OAAO,CAACC,GAAG,CAACC,cAAc;AACrC;AAEA,OAAO,SAASC,KAAKA,CAAA,EAAY;EAC/B,OAAOL,QAAQ,CAACM,EAAE,KAAK,KAAK;AAC9B;AAEA,OAAO,SAASC,SAASA,CAAA,EAAY;EACnC,OAAOP,QAAQ,CAACM,EAAE,KAAK,SAAS;AAClC;AAEA,SAASE,SAASA,CAAA,EAAY;EAC5B,OAAOR,QAAQ,CAACM,EAAE,KAAK,SAAS;AAClC;AAEA,OAAO,SAASG,cAAcA,CAAA,EAAG;EAC/B,OAAOR,MAAM,CAAC,CAAC,IAAII,KAAK,CAAC,CAAC,IAAIG,SAAS,CAAC,CAAC;AAC3C;AAEA,OAAO,SAASE,iBAAiBA,CAAA,EAAG;EAClC;EACA;EACA;EACA;EACA,OAAO,OAAOC,MAAM,KAAK,WAAW;AACtC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["mockedRequestAnimationFrame","callback","setTimeout","performance","now"],"sourceRoot":"../../../src","sources":["animationFrameQueue/mockedRequestAnimationFrame.ts"],"mappings":"AAAA,YAAY;;AAEZ;AACA;AACA;AACA;AACA,OAAO,SAASA,2BAA2BA,CACzCC,QAAqC,EACN;EAC/B,OAAOC,UAAU,CAAC,MAAMD,QAAQ,CAACE,WAAW,CAACC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACzD","ignoreList":[]}
@@ -1,36 +0,0 @@
1
- 'use strict';
2
-
3
- import { callMicrotasks } from "../threads.js";
4
- export function setupRequestAnimationFrame() {
5
- 'worklet';
6
-
7
- // Jest mocks requestAnimationFrame API and it does not like if that mock gets overridden
8
- // so we avoid doing requestAnimationFrame batching in Jest environment.
9
- const nativeRequestAnimationFrame = global.requestAnimationFrame;
10
- let animationFrameCallbacks = [];
11
- let flushRequested = false;
12
- global.__flushAnimationFrame = frameTimestamp => {
13
- const currentCallbacks = animationFrameCallbacks;
14
- animationFrameCallbacks = [];
15
- currentCallbacks.forEach(f => f(frameTimestamp));
16
- callMicrotasks();
17
- };
18
- global.requestAnimationFrame = callback => {
19
- animationFrameCallbacks.push(callback);
20
- if (!flushRequested) {
21
- flushRequested = true;
22
- nativeRequestAnimationFrame(timestamp => {
23
- flushRequested = false;
24
- global.__frameTimestamp = timestamp;
25
- global.__flushAnimationFrame(timestamp);
26
- global.__frameTimestamp = undefined;
27
- });
28
- }
29
- // Reanimated currently does not support cancelling callbacks requested with
30
- // requestAnimationFrame. We return -1 as identifier which isn't in line
31
- // with the spec but it should give users better clue in case they actually
32
- // attempt to store the value returned from rAF and use it for cancelling.
33
- return -1;
34
- };
35
- }
36
- //# sourceMappingURL=requestAnimationFrame.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["callMicrotasks","setupRequestAnimationFrame","nativeRequestAnimationFrame","global","requestAnimationFrame","animationFrameCallbacks","flushRequested","__flushAnimationFrame","frameTimestamp","currentCallbacks","forEach","f","callback","push","timestamp","__frameTimestamp","undefined"],"sourceRoot":"../../../src","sources":["animationFrameQueue/requestAnimationFrame.ts"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,cAAc,QAAQ,eAAY;AAE3C,OAAO,SAASC,0BAA0BA,CAAA,EAAG;EAC3C,SAAS;;EAET;EACA;EACA,MAAMC,2BAA2B,GAAGC,MAAM,CAACC,qBAAqB;EAEhE,IAAIC,uBAA2D,GAAG,EAAE;EACpE,IAAIC,cAAc,GAAG,KAAK;EAE1BH,MAAM,CAACI,qBAAqB,GAAIC,cAAsB,IAAK;IACzD,MAAMC,gBAAgB,GAAGJ,uBAAuB;IAChDA,uBAAuB,GAAG,EAAE;IAC5BI,gBAAgB,CAACC,OAAO,CAAEC,CAAC,IAAKA,CAAC,CAACH,cAAc,CAAC,CAAC;IAClDR,cAAc,CAAC,CAAC;EAClB,CAAC;EAEDG,MAAM,CAACC,qBAAqB,GAC1BQ,QAAqC,IAC1B;IACXP,uBAAuB,CAACQ,IAAI,CAACD,QAAQ,CAAC;IACtC,IAAI,CAACN,cAAc,EAAE;MACnBA,cAAc,GAAG,IAAI;MACrBJ,2BAA2B,CAAEY,SAAS,IAAK;QACzCR,cAAc,GAAG,KAAK;QACtBH,MAAM,CAACY,gBAAgB,GAAGD,SAAS;QACnCX,MAAM,CAACI,qBAAqB,CAACO,SAAS,CAAC;QACvCX,MAAM,CAACY,gBAAgB,GAAGC,SAAS;MACrC,CAAC,CAAC;IACJ;IACA;IACA;IACA;IACA;IACA,OAAO,CAAC,CAAC;EACX,CAAC;AACH","ignoreList":[]}
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Copied from: react-native/Libraries/LogBox/Data/LogBoxData.js
5
- * react-native/Libraries/LogBox/Data/parseLogBoxLog.js
6
- */
7
- import { LogBox as RNLogBox } from 'react-native';
8
- const LogBox = RNLogBox;
9
- const noop = () => {
10
- // do nothing
11
- };
12
-
13
- // Do nothing when addLogBoxLog is called if LogBox is not available
14
- export const addLogBoxLog = LogBox?.addLog?.bind(LogBox) ?? noop;
15
- //# sourceMappingURL=LogBox.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["LogBox","RNLogBox","noop","addLogBoxLog","addLog","bind"],"sourceRoot":"../../../src","sources":["logger/LogBox.ts"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AAGA,SAASA,MAAM,IAAIC,QAAQ,QAAQ,cAAc;AAwCjD,MAAMD,MAAM,GAAGC,QAA0B;AAEzC,MAAMC,IAAI,GAAGA,CAAA,KAAM;EACjB;AAAA,CACD;;AAED;AACA,OAAO,MAAMC,YAAY,GAAGH,MAAM,EAAEI,MAAM,EAAEC,IAAI,CAACL,MAAM,CAAC,IAAIE,IAAI","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- export * from "./LogBox.js";
4
- export * from "./logger.js";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["logger/index.ts"],"mappings":"AAAA,YAAY;;AACZ,cAAc,aAAU;AACxB,cAAc,aAAU","ignoreList":[]}
@@ -1,137 +0,0 @@
1
- 'use strict';
2
-
3
- import { addLogBoxLog } from "./LogBox.js";
4
- const DOCS_URL = 'https://docs.swmansion.com/react-native-reanimated/docs/debugging/logger-configuration';
5
- const DOCS_REFERENCE = `If you don't want to see this message, you can disable the \`strict\` mode. Refer to:\n${DOCS_URL} for more details.`;
6
- export let LogLevel = /*#__PURE__*/function (LogLevel) {
7
- LogLevel[LogLevel["warn"] = 1] = "warn";
8
- LogLevel[LogLevel["error"] = 2] = "error";
9
- return LogLevel;
10
- }({});
11
- function logToConsole(data) {
12
- 'worklet';
13
-
14
- switch (data.level) {
15
- case 'warn':
16
- console.warn(data.message.content);
17
- break;
18
- case 'error':
19
- case 'fatal':
20
- case 'syntax':
21
- console.error(data.message.content);
22
- break;
23
- }
24
- }
25
- export const DEFAULT_LOGGER_CONFIG = {
26
- logFunction: logToConsole,
27
- level: LogLevel.warn,
28
- strict: true
29
- };
30
- function formatMessage(message) {
31
- 'worklet';
32
-
33
- return `[Worklets] ${message}`;
34
- }
35
- function createLog(level, message) {
36
- 'worklet';
37
-
38
- const formattedMessage = formatMessage(message);
39
- return {
40
- level,
41
- message: {
42
- content: formattedMessage,
43
- substitutions: []
44
- },
45
- category: formattedMessage,
46
- componentStack: [],
47
- componentStackType: null,
48
- // eslint-disable-next-line reanimated/use-worklets-error
49
- stack: new Error().stack
50
- };
51
- }
52
-
53
- /**
54
- * Function that logs to LogBox and console. Used to replace the default console
55
- * logging with logging to LogBox on the UI thread when runOnJS is available.
56
- *
57
- * @param data - The details of the log.
58
- */
59
- export function logToLogBoxAndConsole(data) {
60
- addLogBoxLog(data);
61
- logToConsole(data);
62
- }
63
-
64
- /**
65
- * Registers the logger configuration. use it only for Worklet runtimes.
66
- *
67
- * @param config - The config to register.
68
- */
69
- export function registerLoggerConfig(config) {
70
- 'worklet';
71
-
72
- global.__workletsLoggerConfig = config;
73
- }
74
-
75
- /**
76
- * Replaces the default log function with a custom implementation.
77
- *
78
- * @param logFunction - The custom log function.
79
- */
80
- export function replaceLoggerImplementation(logFunction) {
81
- 'worklet';
82
-
83
- registerLoggerConfig({
84
- ...global.__workletsLoggerConfig,
85
- logFunction
86
- });
87
- }
88
-
89
- /**
90
- * Updates logger configuration.
91
- *
92
- * @param options - The new logger configuration to apply.
93
- *
94
- * - Level: The minimum log level to display.
95
- * - Strict: Whether to log warnings and errors that are not strict. Defaults to
96
- * false.
97
- */
98
- export function updateLoggerConfig(options) {
99
- 'worklet';
100
-
101
- registerLoggerConfig({
102
- ...global.__workletsLoggerConfig,
103
- // Don't reuse previous level and strict values from the global config
104
- level: options?.level ?? DEFAULT_LOGGER_CONFIG.level,
105
- strict: options?.strict ?? DEFAULT_LOGGER_CONFIG.strict
106
- });
107
- }
108
- function handleLog(level, message, options) {
109
- 'worklet';
110
-
111
- const config = global.__workletsLoggerConfig;
112
- if (
113
- // Don't log if the log is marked as strict-only and the config doesn't
114
- // enable strict logging
115
- options.strict && !config.strict ||
116
- // Don't log if the log level is below the minimum configured level
117
- LogLevel[level] < config.level) {
118
- return;
119
- }
120
- if (options.strict) {
121
- message += `\n\n${DOCS_REFERENCE}`;
122
- }
123
- config.logFunction(createLog(level, message));
124
- }
125
- export const logger = {
126
- warn(message, options = {}) {
127
- 'worklet';
128
-
129
- handleLog('warn', message, options);
130
- },
131
- error(message, options = {}) {
132
- 'worklet';
133
-
134
- handleLog('error', message, options);
135
- }
136
- };
137
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["addLogBoxLog","DOCS_URL","DOCS_REFERENCE","LogLevel","logToConsole","data","level","console","warn","message","content","error","DEFAULT_LOGGER_CONFIG","logFunction","strict","formatMessage","createLog","formattedMessage","substitutions","category","componentStack","componentStackType","stack","Error","logToLogBoxAndConsole","registerLoggerConfig","config","global","__workletsLoggerConfig","replaceLoggerImplementation","updateLoggerConfig","options","handleLog","logger"],"sourceRoot":"../../../src","sources":["logger/logger.ts"],"mappings":"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","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- export declare function isJest(): boolean;
2
- export declare function isWeb(): boolean;
3
- export declare function isAndroid(): boolean;
4
- export declare function shouldBeUseWeb(): boolean;
5
- export declare function isWindowAvailable(): boolean;
6
- //# sourceMappingURL=PlatformChecker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlatformChecker.d.ts","sourceRoot":"","sources":["../../src/PlatformChecker.ts"],"names":[],"mappings":"AAGA,wBAAgB,MAAM,IAAI,OAAO,CAEhC;AAED,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAMD,wBAAgB,cAAc,YAE7B;AAED,wBAAgB,iBAAiB,YAMhC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mockedRequestAnimationFrame.d.ts","sourceRoot":"","sources":["../../../src/animationFrameQueue/mockedRequestAnimationFrame.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GACpC,UAAU,CAAC,OAAO,UAAU,CAAC,CAE/B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"requestAnimationFrame.d.ts","sourceRoot":"","sources":["../../../src/animationFrameQueue/requestAnimationFrame.ts"],"names":[],"mappings":"AAIA,wBAAgB,0BAA0B,SAoCzC"}
@@ -1,32 +0,0 @@
1
- export type LogBoxLogLevel = 'warn' | 'error' | 'fatal' | 'syntax';
2
- type Message = {
3
- content: string;
4
- substitutions: {
5
- length: number;
6
- offset: number;
7
- }[];
8
- };
9
- type Category = string;
10
- interface Location {
11
- row: number;
12
- column: number;
13
- }
14
- interface CodeFrame {
15
- content: string;
16
- location?: Location | null;
17
- fileName: string;
18
- collapse?: boolean;
19
- }
20
- type ComponentStack = CodeFrame[];
21
- type ComponentStackType = 'legacy' | 'stack';
22
- export type LogData = {
23
- level: LogBoxLogLevel;
24
- message: Message;
25
- category: Category;
26
- componentStack: ComponentStack;
27
- componentStackType: ComponentStackType | null;
28
- stack?: string;
29
- };
30
- export declare const addLogBoxLog: (data: LogData) => void;
31
- export {};
32
- //# sourceMappingURL=LogBox.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogBox.d.ts","sourceRoot":"","sources":["../../../src/logger/LogBox.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEnE,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACrD,CAAC;AAEF,KAAK,QAAQ,GAAG,MAAM,CAAC;AAEvB,UAAU,QAAQ;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,SAAS;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,KAAK,cAAc,GAAG,SAAS,EAAE,CAAC;AAElC,KAAK,kBAAkB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7C,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;IAC/B,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAaF,eAAO,MAAM,YAAY,SAVV,OAAO,KAAG,IAUuC,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from './LogBox';
2
- export * from './logger';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/logger/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -1,52 +0,0 @@
1
- import type { LogData } from './LogBox';
2
- type LogFunction = (data: LogData) => void;
3
- export declare enum LogLevel {
4
- warn = 1,
5
- error = 2
6
- }
7
- export type LoggerConfig = {
8
- level?: LogLevel;
9
- strict?: boolean;
10
- };
11
- export type LoggerConfigInternal = {
12
- logFunction: LogFunction;
13
- } & Required<LoggerConfig>;
14
- export declare const DEFAULT_LOGGER_CONFIG: LoggerConfigInternal;
15
- /**
16
- * Function that logs to LogBox and console. Used to replace the default console
17
- * logging with logging to LogBox on the UI thread when runOnJS is available.
18
- *
19
- * @param data - The details of the log.
20
- */
21
- export declare function logToLogBoxAndConsole(data: LogData): void;
22
- /**
23
- * Registers the logger configuration. use it only for Worklet runtimes.
24
- *
25
- * @param config - The config to register.
26
- */
27
- export declare function registerLoggerConfig(config: LoggerConfigInternal): void;
28
- /**
29
- * Replaces the default log function with a custom implementation.
30
- *
31
- * @param logFunction - The custom log function.
32
- */
33
- export declare function replaceLoggerImplementation(logFunction: LogFunction): void;
34
- /**
35
- * Updates logger configuration.
36
- *
37
- * @param options - The new logger configuration to apply.
38
- *
39
- * - Level: The minimum log level to display.
40
- * - Strict: Whether to log warnings and errors that are not strict. Defaults to
41
- * false.
42
- */
43
- export declare function updateLoggerConfig(options?: Partial<LoggerConfig>): void;
44
- type LogOptions = {
45
- strict?: boolean;
46
- };
47
- export declare const logger: {
48
- warn(message: string, options?: LogOptions): void;
49
- error(message: string, options?: LogOptions): void;
50
- };
51
- export {};
52
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/logger/logger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,OAAO,EAAE,MAAM,UAAU,CAAC;AAOxD,KAAK,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;AAE3C,oBAAY,QAAQ;IAClB,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,WAAW,CAAC;CAC1B,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;AAgB3B,eAAO,MAAM,qBAAqB,EAAE,oBAInC,CAAC;AAyBF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,QAGlD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,QAGhE;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,QAGnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,QAQjE;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AA0BF,eAAO,MAAM,MAAM;kBACH,MAAM,YAAW,UAAU;mBAI1B,MAAM,YAAW,UAAU;CAI3C,CAAC"}