@shopify/react-native-skia 1.8.0 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (390) hide show
  1. package/cpp/api/JsiSkPaint.h +8 -1
  2. package/lib/commonjs/dom/types/Common.d.ts +6 -4
  3. package/lib/commonjs/dom/types/Common.js.map +1 -1
  4. package/lib/commonjs/dom/types/ImageFilters.d.ts +1 -1
  5. package/lib/commonjs/dom/types/ImageFilters.js.map +1 -1
  6. package/lib/commonjs/dom/types/Node.d.ts +0 -2
  7. package/lib/commonjs/dom/types/Node.js.map +1 -1
  8. package/lib/commonjs/external/reanimated/index.d.ts +0 -1
  9. package/lib/commonjs/external/reanimated/index.js +0 -11
  10. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  11. package/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -1
  12. package/lib/commonjs/external/reanimated/renderHelpers.js +5 -43
  13. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  14. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +1 -8
  15. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
  16. package/lib/commonjs/skia/core/AnimatedImage.d.ts +1 -1
  17. package/lib/commonjs/skia/core/AnimatedImage.js +1 -1
  18. package/lib/commonjs/skia/core/AnimatedImage.js.map +1 -1
  19. package/lib/commonjs/skia/core/Data.d.ts +1 -1
  20. package/lib/commonjs/skia/core/Data.js +2 -8
  21. package/lib/commonjs/skia/core/Data.js.map +1 -1
  22. package/lib/commonjs/skia/types/Paint/Paint.d.ts +1 -0
  23. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  24. package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  25. package/lib/commonjs/skia/web/JsiSkPaint.js +3 -0
  26. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  27. package/lib/commonjs/sksg/Container.d.ts +3 -2
  28. package/lib/commonjs/sksg/Container.js +32 -26
  29. package/lib/commonjs/sksg/Container.js.map +1 -1
  30. package/lib/commonjs/sksg/HostConfig.d.ts +2 -2
  31. package/lib/commonjs/sksg/HostConfig.js +7 -25
  32. package/lib/commonjs/sksg/HostConfig.js.map +1 -1
  33. package/lib/commonjs/sksg/Node.d.ts +19 -0
  34. package/lib/commonjs/sksg/Node.js +78 -0
  35. package/lib/commonjs/sksg/Node.js.map +1 -0
  36. package/lib/commonjs/sksg/Reconciler.d.ts +1 -1
  37. package/lib/commonjs/sksg/Recorder/Core.d.ts +79 -0
  38. package/lib/commonjs/sksg/Recorder/Core.js +110 -0
  39. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -0
  40. package/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +18 -0
  41. package/lib/commonjs/sksg/Recorder/DrawingContext.js +105 -0
  42. package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -0
  43. package/lib/commonjs/sksg/Recorder/Player.d.ts +3 -0
  44. package/lib/commonjs/sksg/Recorder/Player.js +127 -0
  45. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -0
  46. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +50 -0
  47. package/lib/commonjs/sksg/Recorder/Recorder.js +288 -0
  48. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -0
  49. package/lib/commonjs/sksg/Recorder/Recording.d.ts +7 -0
  50. package/lib/commonjs/sksg/Recorder/Recording.js +12 -0
  51. package/lib/commonjs/sksg/Recorder/Recording.js.map +1 -0
  52. package/lib/commonjs/sksg/Recorder/Visitor.d.ts +5 -0
  53. package/lib/commonjs/sksg/Recorder/Visitor.js +293 -0
  54. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -0
  55. package/lib/commonjs/sksg/Recorder/commands/Box.d.ts +13 -0
  56. package/lib/commonjs/sksg/Recorder/commands/Box.js +71 -0
  57. package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -0
  58. package/lib/commonjs/sksg/Recorder/commands/CTM.d.ts +3 -0
  59. package/lib/commonjs/sksg/Recorder/commands/CTM.js +79 -0
  60. package/lib/commonjs/sksg/Recorder/commands/CTM.js.map +1 -0
  61. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  62. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js +76 -0
  63. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js.map +1 -0
  64. package/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +24 -0
  65. package/lib/commonjs/sksg/{nodes/drawings.js → Recorder/commands/Drawing.js} +5 -5
  66. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -0
  67. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  68. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +183 -0
  69. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -0
  70. package/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +4 -0
  71. package/lib/commonjs/sksg/Recorder/commands/Paint.js +70 -0
  72. package/lib/commonjs/sksg/Recorder/commands/Paint.js.map +1 -0
  73. package/lib/commonjs/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  74. package/lib/commonjs/sksg/Recorder/commands/PathEffects.js +137 -0
  75. package/lib/commonjs/sksg/Recorder/commands/PathEffects.js.map +1 -0
  76. package/lib/commonjs/sksg/Recorder/commands/Shaders.d.ts +5 -0
  77. package/lib/commonjs/sksg/{nodes/shaders.js → Recorder/commands/Shaders.js} +58 -15
  78. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -0
  79. package/lib/commonjs/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  80. package/lib/commonjs/sksg/{nodes/utils.js → utils.js} +12 -2
  81. package/lib/commonjs/sksg/utils.js.map +1 -0
  82. package/lib/module/dom/types/Common.d.ts +6 -4
  83. package/lib/module/dom/types/Common.js.map +1 -1
  84. package/lib/module/dom/types/ImageFilters.d.ts +1 -1
  85. package/lib/module/dom/types/ImageFilters.js.map +1 -1
  86. package/lib/module/dom/types/Node.d.ts +0 -2
  87. package/lib/module/dom/types/Node.js.map +1 -1
  88. package/lib/module/external/reanimated/index.d.ts +0 -1
  89. package/lib/module/external/reanimated/index.js +0 -1
  90. package/lib/module/external/reanimated/index.js.map +1 -1
  91. package/lib/module/external/reanimated/renderHelpers.d.ts +0 -1
  92. package/lib/module/external/reanimated/renderHelpers.js +4 -42
  93. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  94. package/lib/module/external/reanimated/useAnimatedImageValue.js +1 -8
  95. package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
  96. package/lib/module/skia/core/AnimatedImage.d.ts +1 -1
  97. package/lib/module/skia/core/AnimatedImage.js +1 -1
  98. package/lib/module/skia/core/AnimatedImage.js.map +1 -1
  99. package/lib/module/skia/core/Data.d.ts +1 -1
  100. package/lib/module/skia/core/Data.js +2 -8
  101. package/lib/module/skia/core/Data.js.map +1 -1
  102. package/lib/module/skia/types/Paint/Paint.d.ts +1 -0
  103. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  104. package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  105. package/lib/module/skia/web/JsiSkPaint.js +3 -0
  106. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  107. package/lib/module/sksg/Container.d.ts +3 -2
  108. package/lib/module/sksg/Container.js +30 -24
  109. package/lib/module/sksg/Container.js.map +1 -1
  110. package/lib/module/sksg/HostConfig.d.ts +2 -2
  111. package/lib/module/sksg/HostConfig.js +7 -25
  112. package/lib/module/sksg/HostConfig.js.map +1 -1
  113. package/lib/module/sksg/Node.d.ts +19 -0
  114. package/lib/module/sksg/Node.js +67 -0
  115. package/lib/module/sksg/Node.js.map +1 -0
  116. package/lib/module/sksg/Reconciler.d.ts +1 -1
  117. package/lib/module/sksg/Recorder/Core.d.ts +79 -0
  118. package/lib/module/sksg/Recorder/Core.js +101 -0
  119. package/lib/module/sksg/Recorder/Core.js.map +1 -0
  120. package/lib/module/sksg/Recorder/DrawingContext.d.ts +18 -0
  121. package/lib/module/sksg/Recorder/DrawingContext.js +98 -0
  122. package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -0
  123. package/lib/module/sksg/Recorder/Player.d.ts +3 -0
  124. package/lib/module/sksg/Recorder/Player.js +120 -0
  125. package/lib/module/sksg/Recorder/Player.js.map +1 -0
  126. package/lib/module/sksg/Recorder/Recorder.d.ts +50 -0
  127. package/lib/module/sksg/Recorder/Recorder.js +281 -0
  128. package/lib/module/sksg/Recorder/Recorder.js.map +1 -0
  129. package/lib/module/sksg/Recorder/Recording.d.ts +7 -0
  130. package/lib/module/sksg/Recorder/Recording.js +5 -0
  131. package/lib/module/sksg/Recorder/Recording.js.map +1 -0
  132. package/lib/module/sksg/Recorder/Visitor.d.ts +5 -0
  133. package/lib/module/sksg/Recorder/Visitor.js +285 -0
  134. package/lib/module/sksg/Recorder/Visitor.js.map +1 -0
  135. package/lib/module/sksg/Recorder/commands/Box.d.ts +13 -0
  136. package/lib/module/sksg/Recorder/commands/Box.js +63 -0
  137. package/lib/module/sksg/Recorder/commands/Box.js.map +1 -0
  138. package/lib/module/sksg/Recorder/commands/CTM.d.ts +3 -0
  139. package/lib/module/sksg/Recorder/commands/CTM.js +72 -0
  140. package/lib/module/sksg/Recorder/commands/CTM.js.map +1 -0
  141. package/lib/module/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  142. package/lib/module/sksg/Recorder/commands/ColorFilters.js +67 -0
  143. package/lib/module/sksg/Recorder/commands/ColorFilters.js.map +1 -0
  144. package/lib/module/sksg/Recorder/commands/Drawing.d.ts +24 -0
  145. package/lib/module/sksg/{nodes/drawings.js → Recorder/commands/Drawing.js} +5 -5
  146. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -0
  147. package/lib/module/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  148. package/lib/module/sksg/{nodes/imageFilters.js → Recorder/commands/ImageFilters.js} +87 -95
  149. package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -0
  150. package/lib/module/sksg/Recorder/commands/Paint.d.ts +4 -0
  151. package/lib/module/sksg/Recorder/commands/Paint.js +62 -0
  152. package/lib/module/sksg/Recorder/commands/Paint.js.map +1 -0
  153. package/lib/module/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  154. package/lib/module/sksg/Recorder/commands/PathEffects.js +128 -0
  155. package/lib/module/sksg/Recorder/commands/PathEffects.js.map +1 -0
  156. package/lib/module/sksg/Recorder/commands/Shaders.d.ts +5 -0
  157. package/lib/module/sksg/{nodes/shaders.js → Recorder/commands/Shaders.js} +63 -13
  158. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -0
  159. package/lib/module/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  160. package/lib/module/sksg/{nodes/utils.js → utils.js} +10 -1
  161. package/lib/module/sksg/utils.js.map +1 -0
  162. package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -1
  163. package/lib/typescript/lib/commonjs/skia/core/AnimatedImage.d.ts +1 -1
  164. package/lib/typescript/lib/commonjs/skia/core/Data.d.ts +1 -1
  165. package/lib/typescript/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  166. package/lib/typescript/lib/commonjs/sksg/Container.d.ts +4 -0
  167. package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +1 -3
  168. package/lib/typescript/lib/commonjs/sksg/Node.d.ts +14 -0
  169. package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +5 -0
  170. package/lib/typescript/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +17 -0
  171. package/lib/typescript/lib/commonjs/sksg/Recorder/Player.d.ts +2 -0
  172. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +45 -0
  173. package/lib/typescript/lib/commonjs/sksg/Recorder/Recording.d.ts +5 -0
  174. package/lib/typescript/lib/commonjs/sksg/Recorder/Visitor.d.ts +27 -0
  175. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Box.d.ts +3 -0
  176. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/CTM.d.ts +2 -0
  177. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/ColorFilters.d.ts +4 -0
  178. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/ImageFilters.d.ts +6 -0
  179. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +14 -0
  180. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/PathEffects.d.ts +4 -0
  181. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Shaders.d.ts +3 -0
  182. package/lib/typescript/lib/commonjs/sksg/{nodes/utils.d.ts → utils.d.ts} +1 -0
  183. package/lib/typescript/lib/module/external/reanimated/index.d.ts +0 -1
  184. package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +0 -1
  185. package/lib/typescript/lib/module/mock/index.d.ts +1 -1
  186. package/lib/typescript/lib/module/skia/core/AnimatedImage.d.ts +1 -1
  187. package/lib/typescript/lib/module/skia/core/Data.d.ts +1 -1
  188. package/lib/typescript/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  189. package/lib/typescript/lib/module/sksg/Container.d.ts +4 -0
  190. package/lib/typescript/lib/module/sksg/HostConfig.d.ts +1 -3
  191. package/lib/typescript/lib/module/sksg/Node.d.ts +13 -0
  192. package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +4 -0
  193. package/lib/typescript/lib/module/sksg/Recorder/DrawingContext.d.ts +16 -0
  194. package/lib/typescript/lib/module/sksg/Recorder/Player.d.ts +1 -0
  195. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +44 -0
  196. package/lib/typescript/lib/module/sksg/Recorder/Recording.d.ts +4 -0
  197. package/lib/typescript/lib/module/sksg/Recorder/Visitor.d.ts +26 -0
  198. package/lib/typescript/lib/module/sksg/Recorder/commands/Box.d.ts +2 -0
  199. package/lib/typescript/lib/module/sksg/Recorder/commands/CTM.d.ts +1 -0
  200. package/lib/typescript/lib/module/sksg/Recorder/commands/ColorFilters.d.ts +3 -0
  201. package/lib/typescript/lib/module/sksg/Recorder/commands/ImageFilters.d.ts +5 -0
  202. package/lib/typescript/lib/module/sksg/Recorder/commands/Paint.d.ts +13 -0
  203. package/lib/typescript/lib/module/sksg/Recorder/commands/PathEffects.d.ts +3 -0
  204. package/lib/typescript/lib/module/sksg/Recorder/commands/Shaders.d.ts +2 -0
  205. package/lib/typescript/lib/module/sksg/{nodes/utils.d.ts → utils.d.ts} +1 -0
  206. package/lib/typescript/src/dom/types/Common.d.ts +6 -4
  207. package/lib/typescript/src/dom/types/ImageFilters.d.ts +1 -1
  208. package/lib/typescript/src/dom/types/Node.d.ts +0 -2
  209. package/lib/typescript/src/external/reanimated/index.d.ts +0 -1
  210. package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +0 -1
  211. package/lib/typescript/src/skia/core/AnimatedImage.d.ts +1 -1
  212. package/lib/typescript/src/skia/core/Data.d.ts +1 -1
  213. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +1 -0
  214. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  215. package/lib/typescript/src/sksg/Container.d.ts +3 -2
  216. package/lib/typescript/src/sksg/HostConfig.d.ts +2 -2
  217. package/lib/typescript/src/sksg/Node.d.ts +19 -0
  218. package/lib/typescript/src/sksg/Reconciler.d.ts +1 -1
  219. package/lib/typescript/src/sksg/Recorder/Core.d.ts +79 -0
  220. package/lib/typescript/src/sksg/Recorder/DrawingContext.d.ts +18 -0
  221. package/lib/typescript/src/sksg/Recorder/Player.d.ts +3 -0
  222. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +50 -0
  223. package/lib/typescript/src/sksg/Recorder/Recording.d.ts +7 -0
  224. package/lib/typescript/src/sksg/Recorder/Visitor.d.ts +5 -0
  225. package/lib/typescript/src/sksg/Recorder/commands/Box.d.ts +13 -0
  226. package/lib/typescript/src/sksg/Recorder/commands/CTM.d.ts +3 -0
  227. package/lib/typescript/src/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  228. package/lib/typescript/src/sksg/Recorder/commands/Drawing.d.ts +24 -0
  229. package/lib/typescript/src/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  230. package/lib/typescript/src/sksg/Recorder/commands/Paint.d.ts +4 -0
  231. package/lib/typescript/src/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  232. package/lib/typescript/src/sksg/Recorder/commands/Shaders.d.ts +5 -0
  233. package/lib/typescript/src/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  234. package/package.json +1 -1
  235. package/src/__tests__/snapshots/image-filter/test-shadow.png +0 -0
  236. package/src/dom/types/Common.ts +7 -5
  237. package/src/dom/types/ImageFilters.ts +2 -1
  238. package/src/dom/types/Node.ts +0 -4
  239. package/src/external/reanimated/index.ts +0 -1
  240. package/src/external/reanimated/renderHelpers.ts +4 -44
  241. package/src/external/reanimated/useAnimatedImageValue.ts +4 -15
  242. package/src/renderer/__tests__/e2e/ColorFilters.spec.tsx +15 -0
  243. package/src/renderer/__tests__/e2e/Composition/ColorFilterComposition.spec.tsx +23 -2
  244. package/src/renderer/__tests__/e2e/ImageFilters.spec.tsx +91 -2
  245. package/src/renderer/__tests__/setup.tsx +1 -1
  246. package/src/skia/core/AnimatedImage.ts +2 -3
  247. package/src/skia/core/Data.ts +3 -9
  248. package/src/skia/types/Paint/Paint.ts +2 -0
  249. package/src/skia/web/JsiSkPaint.ts +4 -0
  250. package/src/sksg/Container.ts +35 -29
  251. package/src/sksg/HostConfig.ts +5 -50
  252. package/src/sksg/Node.ts +105 -0
  253. package/src/sksg/Recorder/Core.ts +171 -0
  254. package/src/sksg/Recorder/DrawingContext.ts +130 -0
  255. package/src/sksg/Recorder/Player.ts +160 -0
  256. package/src/sksg/Recorder/Recorder.ts +259 -0
  257. package/src/sksg/Recorder/Recording.ts +13 -0
  258. package/src/sksg/Recorder/Visitor.ts +324 -0
  259. package/src/sksg/Recorder/commands/Box.ts +63 -0
  260. package/src/sksg/Recorder/commands/CTM.ts +72 -0
  261. package/src/sksg/Recorder/commands/ColorFilters.ts +87 -0
  262. package/src/sksg/{nodes/drawings.ts → Recorder/commands/Drawing.ts} +29 -65
  263. package/src/sksg/Recorder/commands/ImageFilters.ts +255 -0
  264. package/src/sksg/Recorder/commands/Paint.ts +77 -0
  265. package/src/sksg/Recorder/commands/PathEffects.ts +169 -0
  266. package/src/sksg/{nodes/shaders.ts → Recorder/commands/Shaders.ts} +100 -26
  267. package/src/sksg/{nodes/utils.ts → utils.ts} +14 -1
  268. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  269. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +0 -24
  270. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +0 -1
  271. package/lib/commonjs/sksg/DeclarationContext.d.ts +0 -56
  272. package/lib/commonjs/sksg/DeclarationContext.js +0 -77
  273. package/lib/commonjs/sksg/DeclarationContext.js.map +0 -1
  274. package/lib/commonjs/sksg/DrawingContext.d.ts +0 -13
  275. package/lib/commonjs/sksg/DrawingContext.js +0 -172
  276. package/lib/commonjs/sksg/DrawingContext.js.map +0 -1
  277. package/lib/commonjs/sksg/__tests__/Declarations.spec.d.ts +0 -1
  278. package/lib/commonjs/sksg/__tests__/MockDeclaration.d.ts +0 -57
  279. package/lib/commonjs/sksg/nodes/Node.d.ts +0 -7
  280. package/lib/commonjs/sksg/nodes/Node.js +0 -6
  281. package/lib/commonjs/sksg/nodes/Node.js.map +0 -1
  282. package/lib/commonjs/sksg/nodes/colorFilters.d.ts +0 -10
  283. package/lib/commonjs/sksg/nodes/colorFilters.js +0 -79
  284. package/lib/commonjs/sksg/nodes/colorFilters.js.map +0 -1
  285. package/lib/commonjs/sksg/nodes/context.d.ts +0 -3
  286. package/lib/commonjs/sksg/nodes/context.js +0 -394
  287. package/lib/commonjs/sksg/nodes/context.js.map +0 -1
  288. package/lib/commonjs/sksg/nodes/drawings.d.ts +0 -30
  289. package/lib/commonjs/sksg/nodes/drawings.js.map +0 -1
  290. package/lib/commonjs/sksg/nodes/imageFilters.d.ts +0 -17
  291. package/lib/commonjs/sksg/nodes/imageFilters.js +0 -197
  292. package/lib/commonjs/sksg/nodes/imageFilters.js.map +0 -1
  293. package/lib/commonjs/sksg/nodes/index.d.ts +0 -3
  294. package/lib/commonjs/sksg/nodes/index.js +0 -39
  295. package/lib/commonjs/sksg/nodes/index.js.map +0 -1
  296. package/lib/commonjs/sksg/nodes/paint.d.ts +0 -3
  297. package/lib/commonjs/sksg/nodes/paint.js +0 -81
  298. package/lib/commonjs/sksg/nodes/paint.js.map +0 -1
  299. package/lib/commonjs/sksg/nodes/pathEffects.d.ts +0 -11
  300. package/lib/commonjs/sksg/nodes/pathEffects.js +0 -111
  301. package/lib/commonjs/sksg/nodes/pathEffects.js.map +0 -1
  302. package/lib/commonjs/sksg/nodes/shaders.d.ts +0 -11
  303. package/lib/commonjs/sksg/nodes/shaders.js.map +0 -1
  304. package/lib/commonjs/sksg/nodes/utils.js.map +0 -1
  305. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  306. package/lib/module/external/reanimated/useDerivedValueOnJS.js +0 -16
  307. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +0 -1
  308. package/lib/module/sksg/DeclarationContext.d.ts +0 -56
  309. package/lib/module/sksg/DeclarationContext.js +0 -69
  310. package/lib/module/sksg/DeclarationContext.js.map +0 -1
  311. package/lib/module/sksg/DrawingContext.d.ts +0 -13
  312. package/lib/module/sksg/DrawingContext.js +0 -165
  313. package/lib/module/sksg/DrawingContext.js.map +0 -1
  314. package/lib/module/sksg/__tests__/Declarations.spec.d.ts +0 -1
  315. package/lib/module/sksg/__tests__/MockDeclaration.d.ts +0 -57
  316. package/lib/module/sksg/nodes/Node.d.ts +0 -7
  317. package/lib/module/sksg/nodes/Node.js +0 -2
  318. package/lib/module/sksg/nodes/Node.js.map +0 -1
  319. package/lib/module/sksg/nodes/colorFilters.d.ts +0 -10
  320. package/lib/module/sksg/nodes/colorFilters.js +0 -66
  321. package/lib/module/sksg/nodes/colorFilters.js.map +0 -1
  322. package/lib/module/sksg/nodes/context.d.ts +0 -3
  323. package/lib/module/sksg/nodes/context.js +0 -387
  324. package/lib/module/sksg/nodes/context.js.map +0 -1
  325. package/lib/module/sksg/nodes/drawings.d.ts +0 -30
  326. package/lib/module/sksg/nodes/drawings.js.map +0 -1
  327. package/lib/module/sksg/nodes/imageFilters.d.ts +0 -17
  328. package/lib/module/sksg/nodes/imageFilters.js.map +0 -1
  329. package/lib/module/sksg/nodes/index.d.ts +0 -3
  330. package/lib/module/sksg/nodes/index.js +0 -4
  331. package/lib/module/sksg/nodes/index.js.map +0 -1
  332. package/lib/module/sksg/nodes/paint.d.ts +0 -3
  333. package/lib/module/sksg/nodes/paint.js +0 -74
  334. package/lib/module/sksg/nodes/paint.js.map +0 -1
  335. package/lib/module/sksg/nodes/pathEffects.d.ts +0 -11
  336. package/lib/module/sksg/nodes/pathEffects.js +0 -97
  337. package/lib/module/sksg/nodes/pathEffects.js.map +0 -1
  338. package/lib/module/sksg/nodes/shaders.d.ts +0 -11
  339. package/lib/module/sksg/nodes/shaders.js.map +0 -1
  340. package/lib/module/sksg/nodes/utils.js.map +0 -1
  341. package/lib/typescript/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +0 -2
  342. package/lib/typescript/lib/commonjs/sksg/DeclarationContext.d.ts +0 -53
  343. package/lib/typescript/lib/commonjs/sksg/DrawingContext.d.ts +0 -22
  344. package/lib/typescript/lib/commonjs/sksg/nodes/Node.d.ts +0 -1
  345. package/lib/typescript/lib/commonjs/sksg/nodes/colorFilters.d.ts +0 -8
  346. package/lib/typescript/lib/commonjs/sksg/nodes/context.d.ts +0 -2
  347. package/lib/typescript/lib/commonjs/sksg/nodes/imageFilters.d.ts +0 -12
  348. package/lib/typescript/lib/commonjs/sksg/nodes/index.d.ts +0 -1
  349. package/lib/typescript/lib/commonjs/sksg/nodes/paint.d.ts +0 -2
  350. package/lib/typescript/lib/commonjs/sksg/nodes/pathEffects.d.ts +0 -9
  351. package/lib/typescript/lib/commonjs/sksg/nodes/shaders.d.ts +0 -10
  352. package/lib/typescript/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  353. package/lib/typescript/lib/module/sksg/DeclarationContext.d.ts +0 -52
  354. package/lib/typescript/lib/module/sksg/DrawingContext.d.ts +0 -21
  355. package/lib/typescript/lib/module/sksg/nodes/Node.d.ts +0 -1
  356. package/lib/typescript/lib/module/sksg/nodes/colorFilters.d.ts +0 -7
  357. package/lib/typescript/lib/module/sksg/nodes/context.d.ts +0 -1
  358. package/lib/typescript/lib/module/sksg/nodes/imageFilters.d.ts +0 -11
  359. package/lib/typescript/lib/module/sksg/nodes/index.d.ts +0 -3
  360. package/lib/typescript/lib/module/sksg/nodes/paint.d.ts +0 -1
  361. package/lib/typescript/lib/module/sksg/nodes/pathEffects.d.ts +0 -8
  362. package/lib/typescript/lib/module/sksg/nodes/shaders.d.ts +0 -9
  363. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  364. package/lib/typescript/src/sksg/DeclarationContext.d.ts +0 -56
  365. package/lib/typescript/src/sksg/DrawingContext.d.ts +0 -13
  366. package/lib/typescript/src/sksg/__tests__/Declarations.spec.d.ts +0 -1
  367. package/lib/typescript/src/sksg/__tests__/MockDeclaration.d.ts +0 -57
  368. package/lib/typescript/src/sksg/nodes/Node.d.ts +0 -7
  369. package/lib/typescript/src/sksg/nodes/colorFilters.d.ts +0 -10
  370. package/lib/typescript/src/sksg/nodes/context.d.ts +0 -3
  371. package/lib/typescript/src/sksg/nodes/drawings.d.ts +0 -30
  372. package/lib/typescript/src/sksg/nodes/imageFilters.d.ts +0 -17
  373. package/lib/typescript/src/sksg/nodes/index.d.ts +0 -3
  374. package/lib/typescript/src/sksg/nodes/paint.d.ts +0 -3
  375. package/lib/typescript/src/sksg/nodes/pathEffects.d.ts +0 -11
  376. package/lib/typescript/src/sksg/nodes/shaders.d.ts +0 -11
  377. package/src/external/reanimated/useDerivedValueOnJS.ts +0 -20
  378. package/src/sksg/DeclarationContext.ts +0 -85
  379. package/src/sksg/DrawingContext.ts +0 -226
  380. package/src/sksg/__tests__/Declarations.spec.tsx +0 -235
  381. package/src/sksg/__tests__/MockDeclaration.ts +0 -138
  382. package/src/sksg/nodes/Node.ts +0 -8
  383. package/src/sksg/nodes/colorFilters.ts +0 -79
  384. package/src/sksg/nodes/context.ts +0 -412
  385. package/src/sksg/nodes/imageFilters.ts +0 -235
  386. package/src/sksg/nodes/index.ts +0 -3
  387. package/src/sksg/nodes/paint.ts +0 -75
  388. package/src/sksg/nodes/pathEffects.ts +0 -118
  389. /package/lib/typescript/lib/commonjs/sksg/{nodes/drawings.d.ts → Recorder/commands/Drawing.d.ts} +0 -0
  390. /package/lib/typescript/lib/module/sksg/{nodes/drawings.d.ts → Recorder/commands/Drawing.d.ts} +0 -0
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pushPathEffect = exports.isPushPathEffect = exports.composePathEffects = void 0;
7
+ var _nodes = require("../../../dom/nodes");
8
+ var _types = require("../../../dom/types");
9
+ var _types2 = require("../../../skia/types");
10
+ var _utils = require("../../utils");
11
+ var _Core = require("../Core");
12
+ const declareDiscretePathEffect = (ctx, props) => {
13
+ "worklet";
14
+
15
+ const {
16
+ length,
17
+ deviation,
18
+ seed
19
+ } = props;
20
+ const pe = ctx.Skia.PathEffect.MakeDiscrete(length, deviation, seed);
21
+ ctx.pathEffects.push(pe);
22
+ };
23
+ const declarePath2DPathEffect = (ctx, props) => {
24
+ "worklet";
25
+
26
+ const {
27
+ matrix
28
+ } = props;
29
+ const path = (0, _nodes.processPath)(ctx.Skia, props.path);
30
+ const pe = ctx.Skia.PathEffect.MakePath2D(matrix, path);
31
+ if (pe === null) {
32
+ throw new Error("Path2DPathEffect: invalid path");
33
+ }
34
+ ctx.pathEffects.push(pe);
35
+ };
36
+ const declareDashPathEffect = (ctx, props) => {
37
+ "worklet";
38
+
39
+ const {
40
+ intervals,
41
+ phase
42
+ } = props;
43
+ const pe = ctx.Skia.PathEffect.MakeDash(intervals, phase);
44
+ ctx.pathEffects.push(pe);
45
+ };
46
+ const declareCornerPathEffect = (ctx, props) => {
47
+ "worklet";
48
+
49
+ const {
50
+ r
51
+ } = props;
52
+ const pe = ctx.Skia.PathEffect.MakeCorner(r);
53
+ if (pe === null) {
54
+ throw new Error("CornerPathEffect: couldn't create path effect");
55
+ }
56
+ ctx.pathEffects.push(pe);
57
+ };
58
+ const declareSumPathEffect = ctx => {
59
+ "worklet";
60
+
61
+ // Note: decorateChildren functionality needs to be handled differently
62
+ const pes = ctx.pathEffects.splice(0, ctx.pathEffects.length);
63
+ const pe = (0, _utils.composeDeclarations)(pes, ctx.Skia.PathEffect.MakeSum.bind(ctx.Skia.PathEffect));
64
+ ctx.pathEffects.push(pe);
65
+ };
66
+ const declareLine2DPathEffect = (ctx, props) => {
67
+ "worklet";
68
+
69
+ const {
70
+ width,
71
+ matrix
72
+ } = props;
73
+ const pe = ctx.Skia.PathEffect.MakeLine2D(width, matrix);
74
+ if (pe === null) {
75
+ throw new Error("Line2DPathEffect: could not create path effect");
76
+ }
77
+ ctx.pathEffects.push(pe);
78
+ };
79
+ const declarePath1DPathEffect = (ctx, props) => {
80
+ "worklet";
81
+
82
+ const {
83
+ advance,
84
+ phase,
85
+ style
86
+ } = props;
87
+ const path = (0, _nodes.processPath)(ctx.Skia, props.path);
88
+ const pe = ctx.Skia.PathEffect.MakePath1D(path, advance, phase, _types2.Path1DEffectStyle[(0, _nodes.enumKey)(style)]);
89
+ if (pe === null) {
90
+ throw new Error("Path1DPathEffect: could not create path effect");
91
+ }
92
+ ctx.pathEffects.push(pe);
93
+ };
94
+ const isPushPathEffect = command => {
95
+ "worklet";
96
+
97
+ return command.type === _Core.CommandType.PushPathEffect;
98
+ };
99
+ exports.isPushPathEffect = isPushPathEffect;
100
+ const isPathEffect = (command, type) => {
101
+ "worklet";
102
+
103
+ return command.pathEffectType === type;
104
+ };
105
+ const composePathEffects = ctx => {
106
+ "worklet";
107
+
108
+ if (ctx.pathEffects.length > 1) {
109
+ const outer = ctx.pathEffects.pop();
110
+ const inner = ctx.pathEffects.pop();
111
+ ctx.pathEffects.push(ctx.Skia.PathEffect.MakeCompose(outer, inner));
112
+ }
113
+ };
114
+ exports.composePathEffects = composePathEffects;
115
+ const pushPathEffect = (ctx, command) => {
116
+ "worklet";
117
+
118
+ if (isPathEffect(command, _types.NodeType.DiscretePathEffect)) {
119
+ declareDiscretePathEffect(ctx, command.props);
120
+ } else if (isPathEffect(command, _types.NodeType.DashPathEffect)) {
121
+ declareDashPathEffect(ctx, command.props);
122
+ } else if (isPathEffect(command, _types.NodeType.Path1DPathEffect)) {
123
+ declarePath1DPathEffect(ctx, command.props);
124
+ } else if (isPathEffect(command, _types.NodeType.Path2DPathEffect)) {
125
+ declarePath2DPathEffect(ctx, command.props);
126
+ } else if (isPathEffect(command, _types.NodeType.CornerPathEffect)) {
127
+ declareCornerPathEffect(ctx, command.props);
128
+ } else if (isPathEffect(command, _types.NodeType.SumPathEffect)) {
129
+ declareSumPathEffect(ctx);
130
+ } else if (isPathEffect(command, _types.NodeType.Line2DPathEffect)) {
131
+ declareLine2DPathEffect(ctx, command.props);
132
+ } else {
133
+ throw new Error("Invalid image filter type: " + command.imageFilterType);
134
+ }
135
+ };
136
+ exports.pushPathEffect = pushPathEffect;
137
+ //# sourceMappingURL=PathEffects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_nodes","require","_types","_types2","_utils","_Core","declareDiscretePathEffect","ctx","props","length","deviation","seed","pe","Skia","PathEffect","MakeDiscrete","pathEffects","push","declarePath2DPathEffect","matrix","path","processPath","MakePath2D","Error","declareDashPathEffect","intervals","phase","MakeDash","declareCornerPathEffect","r","MakeCorner","declareSumPathEffect","pes","splice","composeDeclarations","MakeSum","bind","declareLine2DPathEffect","width","MakeLine2D","declarePath1DPathEffect","advance","style","MakePath1D","Path1DEffectStyle","enumKey","isPushPathEffect","command","type","CommandType","PushPathEffect","exports","isPathEffect","pathEffectType","composePathEffects","outer","pop","inner","MakeCompose","pushPathEffect","NodeType","DiscretePathEffect","DashPathEffect","Path1DPathEffect","Path2DPathEffect","CornerPathEffect","SumPathEffect","Line2DPathEffect","imageFilterType"],"sources":["PathEffects.ts"],"sourcesContent":["import { enumKey, processPath } from \"../../../dom/nodes\";\nimport { NodeType } from \"../../../dom/types\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../../../dom/types\";\nimport { Path1DEffectStyle } from \"../../../skia/types\";\nimport { composeDeclarations } from \"../../utils\";\nimport type { Command } from \"../Core\";\nimport { CommandType } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nconst declareDiscretePathEffect = (\n ctx: DrawingContext,\n props: DiscretePathEffectProps\n) => {\n \"worklet\";\n const { length, deviation, seed } = props;\n const pe = ctx.Skia.PathEffect.MakeDiscrete(length, deviation, seed);\n ctx.pathEffects.push(pe);\n};\n\nconst declarePath2DPathEffect = (\n ctx: DrawingContext,\n props: Path2DPathEffectProps\n) => {\n \"worklet\";\n const { matrix } = props;\n const path = processPath(ctx.Skia, props.path);\n const pe = ctx.Skia.PathEffect.MakePath2D(matrix, path);\n if (pe === null) {\n throw new Error(\"Path2DPathEffect: invalid path\");\n }\n ctx.pathEffects.push(pe);\n};\n\nconst declareDashPathEffect = (\n ctx: DrawingContext,\n props: DashPathEffectProps\n) => {\n \"worklet\";\n const { intervals, phase } = props;\n const pe = ctx.Skia.PathEffect.MakeDash(intervals, phase);\n ctx.pathEffects.push(pe);\n};\n\nconst declareCornerPathEffect = (\n ctx: DrawingContext,\n props: CornerPathEffectProps\n) => {\n \"worklet\";\n const { r } = props;\n const pe = ctx.Skia.PathEffect.MakeCorner(r);\n if (pe === null) {\n throw new Error(\"CornerPathEffect: couldn't create path effect\");\n }\n ctx.pathEffects.push(pe);\n};\n\nconst declareSumPathEffect = (ctx: DrawingContext) => {\n \"worklet\";\n // Note: decorateChildren functionality needs to be handled differently\n const pes = ctx.pathEffects.splice(0, ctx.pathEffects.length);\n const pe = composeDeclarations(\n pes,\n ctx.Skia.PathEffect.MakeSum.bind(ctx.Skia.PathEffect)\n );\n ctx.pathEffects.push(pe);\n};\n\nconst declareLine2DPathEffect = (\n ctx: DrawingContext,\n props: Line2DPathEffectProps\n) => {\n \"worklet\";\n const { width, matrix } = props;\n const pe = ctx.Skia.PathEffect.MakeLine2D(width, matrix);\n if (pe === null) {\n throw new Error(\"Line2DPathEffect: could not create path effect\");\n }\n ctx.pathEffects.push(pe);\n};\n\nconst declarePath1DPathEffect = (\n ctx: DrawingContext,\n props: Path1DPathEffectProps\n) => {\n \"worklet\";\n const { advance, phase, style } = props;\n const path = processPath(ctx.Skia, props.path);\n const pe = ctx.Skia.PathEffect.MakePath1D(\n path,\n advance,\n phase,\n Path1DEffectStyle[enumKey(style)]\n );\n if (pe === null) {\n throw new Error(\"Path1DPathEffect: could not create path effect\");\n }\n ctx.pathEffects.push(pe);\n};\n\nexport const isPushPathEffect = (\n command: Command\n): command is Command<CommandType.PushPathEffect> => {\n \"worklet\";\n return command.type === CommandType.PushPathEffect;\n};\n\ntype Props = {\n [NodeType.DiscretePathEffect]: DiscretePathEffectProps;\n [NodeType.DashPathEffect]: DashPathEffectProps;\n [NodeType.Path1DPathEffect]: Path1DPathEffectProps;\n [NodeType.Path2DPathEffect]: Path2DPathEffectProps;\n [NodeType.CornerPathEffect]: CornerPathEffectProps;\n [NodeType.SumPathEffect]: Record<string, never>;\n [NodeType.Line2DPathEffect]: Line2DPathEffectProps;\n};\n\ninterface PushPathEffect<T extends keyof Props>\n extends Command<CommandType.PushPathEffect> {\n pathEffectType: T;\n props: Props[T];\n}\n\nconst isPathEffect = <T extends keyof Props>(\n command: Command<CommandType.PushPathEffect>,\n type: T\n): command is PushPathEffect<T> => {\n \"worklet\";\n return command.pathEffectType === type;\n};\n\nexport const composePathEffects = (ctx: DrawingContext) => {\n \"worklet\";\n if (ctx.pathEffects.length > 1) {\n const outer = ctx.pathEffects.pop()!;\n const inner = ctx.pathEffects.pop()!;\n ctx.pathEffects.push(ctx.Skia.PathEffect.MakeCompose(outer, inner));\n }\n};\n\nexport const pushPathEffect = (\n ctx: DrawingContext,\n command: Command<CommandType.PushPathEffect>\n) => {\n \"worklet\";\n if (isPathEffect(command, NodeType.DiscretePathEffect)) {\n declareDiscretePathEffect(ctx, command.props);\n } else if (isPathEffect(command, NodeType.DashPathEffect)) {\n declareDashPathEffect(ctx, command.props);\n } else if (isPathEffect(command, NodeType.Path1DPathEffect)) {\n declarePath1DPathEffect(ctx, command.props);\n } else if (isPathEffect(command, NodeType.Path2DPathEffect)) {\n declarePath2DPathEffect(ctx, command.props);\n } else if (isPathEffect(command, NodeType.CornerPathEffect)) {\n declareCornerPathEffect(ctx, command.props);\n } else if (isPathEffect(command, NodeType.SumPathEffect)) {\n declareSumPathEffect(ctx);\n } else if (isPathEffect(command, NodeType.Line2DPathEffect)) {\n declareLine2DPathEffect(ctx, command.props);\n } else {\n throw new Error(\"Invalid image filter type: \" + command.imageFilterType);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AASA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAGA,MAAMK,yBAAyB,GAAGA,CAChCC,GAAmB,EACnBC,KAA8B,KAC3B;EACH,SAAS;;EACT,MAAM;IAAEC,MAAM;IAAEC,SAAS;IAAEC;EAAK,CAAC,GAAGH,KAAK;EACzC,MAAMI,EAAE,GAAGL,GAAG,CAACM,IAAI,CAACC,UAAU,CAACC,YAAY,CAACN,MAAM,EAAEC,SAAS,EAAEC,IAAI,CAAC;EACp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vC,KAAK,CAAC;EAC3C,CAAC,MAAM,IAAI4C,YAAY,CAACL,OAAO,EAAEa,eAAQ,CAACG,gBAAgB,CAAC,EAAE;IAC3DvB,uBAAuB,CAACjC,GAAG,EAAEwC,OAAO,CAACvC,KAAK,CAAC;EAC7C,CAAC,MAAM,IAAI4C,YAAY,CAACL,OAAO,EAAEa,eAAQ,CAACI,gBAAgB,CAAC,EAAE;IAC3D9C,uBAAuB,CAACX,GAAG,EAAEwC,OAAO,CAACvC,KAAK,CAAC;EAC7C,CAAC,MAAM,IAAI4C,YAAY,CAACL,OAAO,EAAEa,eAAQ,CAACK,gBAAgB,CAAC,EAAE;IAC3DrC,uBAAuB,CAACrB,GAAG,EAAEwC,OAAO,CAACvC,KAAK,CAAC;EAC7C,CAAC,MAAM,IAAI4C,YAAY,CAACL,OAAO,EAAEa,eAAQ,CAACM,aAAa,CAAC,EAAE;IACxDnC,oBAAoB,CAACxB,GAAG,CAAC;EAC3B,CAAC,MAAM,IAAI6C,YAAY,CAACL,OAAO,EAAEa,eAAQ,CAACO,gBAAgB,CAAC,EAAE;IAC3D9B,uBAAuB,CAAC9B,GAAG,EAAEwC,OAAO,CAACvC,KAAK,CAAC;EAC7C,CAAC,MAAM;IACL,MAAM,IAAIe,KAAK,CAAC,6BAA6B,GAAGwB,OAAO,CAACqB,eAAe,CAAC;EAC1E;AACF,CAAC;AAACjB,OAAA,CAAAQ,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ import type { Command } from "../Core";
2
+ import { CommandType } from "../Core";
3
+ import type { DrawingContext } from "../DrawingContext";
4
+ export declare const isPushShader: (command: Command) => command is Command<CommandType.PushShader>;
5
+ export declare const pushShader: (ctx: DrawingContext, command: Command<CommandType.PushShader>) => void;
@@ -3,9 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.declareTwoPointConicalGradientShader = exports.declareTurbulenceShader = exports.declareSweepGradientShader = exports.declareShader = exports.declareRadialGradientShader = exports.declareLinearGradientShader = exports.declareImageShader = exports.declareFractalNoiseShader = exports.declareColorShader = void 0;
7
- var _nodes = require("../../dom/nodes");
8
- var _types = require("../../skia/types");
6
+ exports.pushShader = exports.isPushShader = void 0;
7
+ var _nodes = require("../../../dom/nodes");
8
+ var _types = require("../../../dom/types");
9
+ var _types2 = require("../../../skia/types");
10
+ var _utils = require("../../utils");
11
+ var _Core = require("../Core");
9
12
  const declareShader = (ctx, props) => {
10
13
  "worklet";
11
14
 
@@ -16,10 +19,9 @@ const declareShader = (ctx, props) => {
16
19
  } = props;
17
20
  const m3 = ctx.Skia.Matrix();
18
21
  (0, _nodes.processTransformProps)(m3, transform);
19
- const shader = source.makeShaderWithChildren((0, _types.processUniforms)(source, uniforms), ctx.shaders.popAll(), m3);
22
+ const shader = source.makeShaderWithChildren((0, _types2.processUniforms)(source, uniforms), ctx.shaders.splice(0, ctx.shaders.length), m3);
20
23
  ctx.shaders.push(shader);
21
24
  };
22
- exports.declareShader = declareShader;
23
25
  const declareColorShader = (ctx, props) => {
24
26
  "worklet";
25
27
 
@@ -29,7 +31,6 @@ const declareColorShader = (ctx, props) => {
29
31
  const shader = ctx.Skia.Shader.MakeColor(ctx.Skia.Color(color));
30
32
  ctx.shaders.push(shader);
31
33
  };
32
- exports.declareColorShader = declareColorShader;
33
34
  const declareFractalNoiseShader = (ctx, props) => {
34
35
  "worklet";
35
36
 
@@ -44,7 +45,6 @@ const declareFractalNoiseShader = (ctx, props) => {
44
45
  const shader = ctx.Skia.Shader.MakeFractalNoise(freqX, freqY, octaves, seed, tileWidth, tileHeight);
45
46
  ctx.shaders.push(shader);
46
47
  };
47
- exports.declareFractalNoiseShader = declareFractalNoiseShader;
48
48
  const declareTwoPointConicalGradientShader = (ctx, props) => {
49
49
  "worklet";
50
50
 
@@ -64,7 +64,6 @@ const declareTwoPointConicalGradientShader = (ctx, props) => {
64
64
  const shader = ctx.Skia.Shader.MakeTwoPointConicalGradient(start, startR, end, endR, colors, positions, mode, localMatrix, flags);
65
65
  ctx.shaders.push(shader);
66
66
  };
67
- exports.declareTwoPointConicalGradientShader = declareTwoPointConicalGradientShader;
68
67
  const declareRadialGradientShader = (ctx, props) => {
69
68
  "worklet";
70
69
 
@@ -82,7 +81,6 @@ const declareRadialGradientShader = (ctx, props) => {
82
81
  const shader = ctx.Skia.Shader.MakeRadialGradient(c, r, colors, positions, mode, localMatrix, flags);
83
82
  ctx.shaders.push(shader);
84
83
  };
85
- exports.declareRadialGradientShader = declareRadialGradientShader;
86
84
  const declareSweepGradientShader = (ctx, props) => {
87
85
  "worklet";
88
86
 
@@ -101,7 +99,6 @@ const declareSweepGradientShader = (ctx, props) => {
101
99
  const shader = ctx.Skia.Shader.MakeSweepGradient(c.x, c.y, colors, positions, mode, localMatrix, flags, start, end);
102
100
  ctx.shaders.push(shader);
103
101
  };
104
- exports.declareSweepGradientShader = declareSweepGradientShader;
105
102
  const declareLinearGradientShader = (ctx, props) => {
106
103
  "worklet";
107
104
 
@@ -119,7 +116,6 @@ const declareLinearGradientShader = (ctx, props) => {
119
116
  const shader = ctx.Skia.Shader.MakeLinearGradient(start, end, colors, positions !== null && positions !== void 0 ? positions : null, mode, localMatrix, flags);
120
117
  ctx.shaders.push(shader);
121
118
  };
122
- exports.declareLinearGradientShader = declareLinearGradientShader;
123
119
  const declareTurbulenceShader = (ctx, props) => {
124
120
  "worklet";
125
121
 
@@ -134,7 +130,6 @@ const declareTurbulenceShader = (ctx, props) => {
134
130
  const shader = ctx.Skia.Shader.MakeTurbulence(freqX, freqY, octaves, seed, tileWidth, tileHeight);
135
131
  ctx.shaders.push(shader);
136
132
  };
137
- exports.declareTurbulenceShader = declareTurbulenceShader;
138
133
  const declareImageShader = (ctx, props) => {
139
134
  "worklet";
140
135
 
@@ -166,8 +161,56 @@ const declareImageShader = (ctx, props) => {
166
161
  const lm = ctx.Skia.Matrix();
167
162
  lm.concat(m3);
168
163
  (0, _nodes.processTransformProps)(lm, imageShaderProps);
169
- const shader = image.makeShaderOptions(_types.TileMode[(0, _nodes.enumKey)(tx)], _types.TileMode[(0, _nodes.enumKey)(ty)], _types.FilterMode[(0, _nodes.enumKey)(fm)], _types.MipmapMode[(0, _nodes.enumKey)(mm)], lm);
164
+ const shader = image.makeShaderOptions(_types2.TileMode[(0, _nodes.enumKey)(tx)], _types2.TileMode[(0, _nodes.enumKey)(ty)], _types2.FilterMode[(0, _nodes.enumKey)(fm)], _types2.MipmapMode[(0, _nodes.enumKey)(mm)], lm);
170
165
  ctx.shaders.push(shader);
171
166
  };
172
- exports.declareImageShader = declareImageShader;
173
- //# sourceMappingURL=shaders.js.map
167
+ const declareBlend = (ctx, props) => {
168
+ "worklet";
169
+
170
+ const blend = _types2.BlendMode[(0, _nodes.enumKey)(props.mode)];
171
+ const shaders = ctx.shaders.splice(0, ctx.shaders.length);
172
+ if (shaders.length > 0) {
173
+ const composer = ctx.Skia.Shader.MakeBlend.bind(ctx.Skia.Shader, blend);
174
+ ctx.shaders.push((0, _utils.composeDeclarations)(shaders, composer));
175
+ }
176
+ };
177
+ const isPushShader = command => {
178
+ "worklet";
179
+
180
+ return command.type === _Core.CommandType.PushShader;
181
+ };
182
+ exports.isPushShader = isPushShader;
183
+ const isShader = (command, type) => {
184
+ "worklet";
185
+
186
+ return command.shaderType === type;
187
+ };
188
+ const pushShader = (ctx, command) => {
189
+ "worklet";
190
+
191
+ if (isShader(command, _types.NodeType.Shader)) {
192
+ declareShader(ctx, command.props);
193
+ } else if (isShader(command, _types.NodeType.ImageShader)) {
194
+ declareImageShader(ctx, command.props);
195
+ } else if (isShader(command, _types.NodeType.ColorShader)) {
196
+ declareColorShader(ctx, command.props);
197
+ } else if (isShader(command, _types.NodeType.Turbulence)) {
198
+ declareTurbulenceShader(ctx, command.props);
199
+ } else if (isShader(command, _types.NodeType.FractalNoise)) {
200
+ declareFractalNoiseShader(ctx, command.props);
201
+ } else if (isShader(command, _types.NodeType.LinearGradient)) {
202
+ declareLinearGradientShader(ctx, command.props);
203
+ } else if (isShader(command, _types.NodeType.RadialGradient)) {
204
+ declareRadialGradientShader(ctx, command.props);
205
+ } else if (isShader(command, _types.NodeType.SweepGradient)) {
206
+ declareSweepGradientShader(ctx, command.props);
207
+ } else if (isShader(command, _types.NodeType.TwoPointConicalGradient)) {
208
+ declareTwoPointConicalGradientShader(ctx, command.props);
209
+ } else if (isShader(command, _types.NodeType.Blend)) {
210
+ declareBlend(ctx, command.props);
211
+ } else {
212
+ throw new Error(`Unknown shader type: ${command.shaderType}`);
213
+ }
214
+ };
215
+ exports.pushShader = pushShader;
216
+ //# sourceMappingURL=Shaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_nodes","require","_types","_types2","_utils","_Core","declareShader","ctx","props","source","uniforms","transform","m3","Skia","Matrix","processTransformProps","shader","makeShaderWithChildren","processUniforms","shaders","splice","length","push","declareColorShader","color","Shader","MakeColor","Color","declareFractalNoiseShader","freqX","freqY","octaves","seed","tileWidth","tileHeight","MakeFractalNoise","declareTwoPointConicalGradientShader","startR","endR","start","end","colors","positions","mode","localMatrix","flags","processGradientProps","MakeTwoPointConicalGradient","declareRadialGradientShader","c","r","MakeRadialGradient","declareSweepGradientShader","MakeSweepGradient","x","y","declareLinearGradientShader","MakeLinearGradient","declareTurbulenceShader","MakeTurbulence","declareImageShader","fit","image","tx","ty","fm","mm","imageShaderProps","rct","getRect","rects","fitRects","width","height","sx","sy","rect2rect","src","dst","translate","translateX","translateY","scale","scaleX","scaleY","lm","concat","makeShaderOptions","TileMode","enumKey","FilterMode","MipmapMode","declareBlend","blend","BlendMode","composer","MakeBlend","bind","composeDeclarations","isPushShader","command","type","CommandType","PushShader","exports","isShader","shaderType","pushShader","NodeType","ImageShader","ColorShader","Turbulence","FractalNoise","LinearGradient","RadialGradient","SweepGradient","TwoPointConicalGradient","Blend","Error"],"sources":["Shaders.ts"],"sourcesContent":["import {\n enumKey,\n fitRects,\n getRect,\n processGradientProps,\n processTransformProps,\n rect2rect,\n} from \"../../../dom/nodes\";\nimport { NodeType } from \"../../../dom/types\";\nimport type {\n BlendProps,\n ColorProps,\n FractalNoiseProps,\n ImageShaderProps,\n LinearGradientProps,\n RadialGradientProps,\n ShaderProps,\n SweepGradientProps,\n TurbulenceProps,\n TwoPointConicalGradientProps,\n} from \"../../../dom/types\";\nimport {\n BlendMode,\n FilterMode,\n MipmapMode,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport { composeDeclarations } from \"../../utils\";\nimport type { Command } from \"../Core\";\nimport { CommandType } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nconst declareShader = (ctx: DrawingContext, props: ShaderProps) => {\n \"worklet\";\n const { source, uniforms, ...transform } = props;\n const m3 = ctx.Skia.Matrix();\n processTransformProps(m3, transform);\n const shader = source.makeShaderWithChildren(\n processUniforms(source, uniforms),\n ctx.shaders.splice(0, ctx.shaders.length),\n m3\n );\n ctx.shaders.push(shader);\n};\n\nconst declareColorShader = (ctx: DrawingContext, props: ColorProps) => {\n \"worklet\";\n const { color } = props;\n const shader = ctx.Skia.Shader.MakeColor(ctx.Skia.Color(color));\n ctx.shaders.push(shader);\n};\n\nconst declareFractalNoiseShader = (\n ctx: DrawingContext,\n props: FractalNoiseProps\n) => {\n \"worklet\";\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = props;\n const shader = ctx.Skia.Shader.MakeFractalNoise(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n ctx.shaders.push(shader);\n};\n\nconst declareTwoPointConicalGradientShader = (\n ctx: DrawingContext,\n props: TwoPointConicalGradientProps\n) => {\n \"worklet\";\n const { startR, endR, start, end } = props;\n const { colors, positions, mode, localMatrix, flags } = processGradientProps(\n ctx.Skia,\n props\n );\n const shader = ctx.Skia.Shader.MakeTwoPointConicalGradient(\n start,\n startR,\n end,\n endR,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n ctx.shaders.push(shader);\n};\n\nconst declareRadialGradientShader = (\n ctx: DrawingContext,\n props: RadialGradientProps\n) => {\n \"worklet\";\n const { c, r } = props;\n const { colors, positions, mode, localMatrix, flags } = processGradientProps(\n ctx.Skia,\n props\n );\n const shader = ctx.Skia.Shader.MakeRadialGradient(\n c,\n r,\n colors,\n positions,\n mode,\n localMatrix,\n flags\n );\n ctx.shaders.push(shader);\n};\n\nconst declareSweepGradientShader = (\n ctx: DrawingContext,\n props: SweepGradientProps\n) => {\n \"worklet\";\n const { c, start, end } = props;\n const { colors, positions, mode, localMatrix, flags } = processGradientProps(\n ctx.Skia,\n props\n );\n const shader = ctx.Skia.Shader.MakeSweepGradient(\n c.x,\n c.y,\n colors,\n positions,\n mode,\n localMatrix,\n flags,\n start,\n end\n );\n ctx.shaders.push(shader);\n};\n\nconst declareLinearGradientShader = (\n ctx: DrawingContext,\n props: LinearGradientProps\n) => {\n \"worklet\";\n const { start, end } = props;\n const { colors, positions, mode, localMatrix, flags } = processGradientProps(\n ctx.Skia,\n props\n );\n const shader = ctx.Skia.Shader.MakeLinearGradient(\n start,\n end,\n colors,\n positions ?? null,\n mode,\n localMatrix,\n flags\n );\n ctx.shaders.push(shader);\n};\n\nconst declareTurbulenceShader = (\n ctx: DrawingContext,\n props: TurbulenceProps\n) => {\n \"worklet\";\n const { freqX, freqY, octaves, seed, tileWidth, tileHeight } = props;\n const shader = ctx.Skia.Shader.MakeTurbulence(\n freqX,\n freqY,\n octaves,\n seed,\n tileWidth,\n tileHeight\n );\n ctx.shaders.push(shader);\n};\n\nconst declareImageShader = (ctx: DrawingContext, props: ImageShaderProps) => {\n \"worklet\";\n const { fit, image, tx, ty, fm, mm, ...imageShaderProps } = props;\n if (!image) {\n return;\n }\n\n const rct = getRect(ctx.Skia, imageShaderProps);\n const m3 = ctx.Skia.Matrix();\n if (rct) {\n const rects = fitRects(\n fit,\n { x: 0, y: 0, width: image.width(), height: image.height() },\n rct\n );\n const [x, y, sx, sy] = rect2rect(rects.src, rects.dst);\n m3.translate(x.translateX, y.translateY);\n m3.scale(sx.scaleX, sy.scaleY);\n }\n const lm = ctx.Skia.Matrix();\n lm.concat(m3);\n processTransformProps(lm, imageShaderProps);\n const shader = image.makeShaderOptions(\n TileMode[enumKey(tx)],\n TileMode[enumKey(ty)],\n FilterMode[enumKey(fm)],\n MipmapMode[enumKey(mm)],\n lm\n );\n ctx.shaders.push(shader);\n};\n\nconst declareBlend = (ctx: DrawingContext, props: BlendProps) => {\n \"worklet\";\n const blend = BlendMode[enumKey(props.mode as BlendProps[\"mode\"])];\n const shaders = ctx.shaders.splice(0, ctx.shaders.length);\n if (shaders.length > 0) {\n const composer = ctx.Skia.Shader.MakeBlend.bind(ctx.Skia.Shader, blend);\n ctx.shaders.push(composeDeclarations(shaders, composer));\n }\n};\n\nexport const isPushShader = (\n command: Command\n): command is Command<CommandType.PushShader> => {\n \"worklet\";\n return command.type === CommandType.PushShader;\n};\n\ntype Props = {\n [NodeType.Shader]: ShaderProps;\n [NodeType.ImageShader]: ImageShaderProps;\n [NodeType.ColorShader]: ColorProps;\n [NodeType.Turbulence]: TurbulenceProps;\n [NodeType.FractalNoise]: FractalNoiseProps;\n [NodeType.LinearGradient]: LinearGradientProps;\n [NodeType.RadialGradient]: RadialGradientProps;\n [NodeType.SweepGradient]: SweepGradientProps;\n [NodeType.TwoPointConicalGradient]: TwoPointConicalGradientProps;\n [NodeType.Blend]: BlendProps;\n};\n\ninterface PushShader<T extends keyof Props>\n extends Command<CommandType.PushShader> {\n shaderType: T;\n props: Props[T];\n}\n\nconst isShader = <T extends keyof Props>(\n command: Command<CommandType.PushShader>,\n type: T\n): command is PushShader<T> => {\n \"worklet\";\n return command.shaderType === type;\n};\n\nexport const pushShader = (\n ctx: DrawingContext,\n command: Command<CommandType.PushShader>\n) => {\n \"worklet\";\n if (isShader(command, NodeType.Shader)) {\n declareShader(ctx, command.props);\n } else if (isShader(command, NodeType.ImageShader)) {\n declareImageShader(ctx, command.props);\n } else if (isShader(command, NodeType.ColorShader)) {\n declareColorShader(ctx, command.props);\n } else if (isShader(command, NodeType.Turbulence)) {\n declareTurbulenceShader(ctx, command.props);\n } else if (isShader(command, NodeType.FractalNoise)) {\n declareFractalNoiseShader(ctx, command.props);\n } else if (isShader(command, NodeType.LinearGradient)) {\n declareLinearGradientShader(ctx, command.props);\n } else if (isShader(command, NodeType.RadialGradient)) {\n declareRadialGradientShader(ctx, command.props);\n } else if (isShader(command, NodeType.SweepGradient)) {\n declareSweepGradientShader(ctx, command.props);\n } else if (isShader(command, NodeType.TwoPointConicalGradient)) {\n declareTwoPointConicalGradientShader(ctx, command.props);\n } else if (isShader(command, NodeType.Blend)) {\n declareBlend(ctx, command.props);\n } else {\n throw new Error(`Unknown shader type: ${command.shaderType}`);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AAaA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAGA,MAAMK,aAAa,GAAGA,CAACC,GAAmB,EAAEC,KAAkB,KAAK;EACjE,SAAS;;EACT,MAAM;IAAEC,MAAM;IAAEC,QAAQ;IAAE,GAAGC;EAAU,CAAC,GAAGH,KAAK;EAChD,MAAMI,EAAE,GAAGL,GAAG,CAACM,IAAI,CAACC,MAAM,CAAC,CAAC;EAC5B,IAAAC,4BAAqB,EAACH,EAAE,EAAED,SAAS,CAAC;EACpC,MAAMK,MAAM,GAAGP,MAAM,CAACQ,sBAAsB,CAC1C,IAAAC,uBAAe,EAACT,MAAM,EAAEC,QAAQ,CAAC,EACjCH,GAAG,CAACY,OAAO,CAACC,MAAM,CAAC,CAAC,EAAEb,GAAG,CAACY,OAAO,CAACE,MAAM,CAAC,EACzCT,EACF,CAAC;EACDL,GAAG,CAACY,OAAO,CAACG,IAAI,CAACN,MAAM,CAAC;AAC1B,CAAC;AAED,MAAMO,kBAAkB,GAAGA,CAAChB,GAAmB,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,CAAC,wBAAwBlB,OAAO,CAACM,UAAU,EAAE,CAAC;EAC/D;AACF,CAAC;AAACF,OAAA,CAAAG,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -1,3 +1,6 @@
1
1
  import type { SharedValue } from "react-native-reanimated";
2
2
  export declare const isSharedValue: <T = unknown>(value: unknown) => value is SharedValue<T>;
3
3
  export declare const materialize: <T extends object>(props: T) => T;
4
+ type Composer<T> = (outer: T, inner: T) => T;
5
+ export declare const composeDeclarations: <T>(filters: T[], composer: Composer<T>) => T;
6
+ export {};
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.materialize = exports.isSharedValue = void 0;
7
- var _typeddash = require("../../renderer/typeddash");
6
+ exports.materialize = exports.isSharedValue = exports.composeDeclarations = void 0;
7
+ var _typeddash = require("../renderer/typeddash");
8
8
  const isSharedValue = value => {
9
9
  "worklet";
10
10
 
@@ -25,4 +25,14 @@ const materialize = props => {
25
25
  return result;
26
26
  };
27
27
  exports.materialize = materialize;
28
+ const composeDeclarations = (filters, composer) => {
29
+ "worklet";
30
+
31
+ const len = filters.length;
32
+ if (len <= 1) {
33
+ return filters[0];
34
+ }
35
+ return filters.reduceRight((inner, outer) => inner ? composer(outer, inner) : outer);
36
+ };
37
+ exports.composeDeclarations = composeDeclarations;
28
38
  //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_typeddash","require","isSharedValue","value","_isReanimatedSharedValue","exports","materialize","props","result","Object","assign","mapKeys","forEach","key","composeDeclarations","filters","composer","len","length","reduceRight","inner","outer"],"sources":["utils.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport { mapKeys } from \"../renderer/typeddash\";\n\nexport const isSharedValue = <T = unknown>(\n value: unknown\n): value is SharedValue<T> => {\n \"worklet\";\n // We cannot use `in` operator here because `value` could be a HostObject and therefore we cast.\n return (value as Record<string, unknown>)?._isReanimatedSharedValue === true;\n};\n\nexport const materialize = <T extends object>(props: T) => {\n \"worklet\";\n const result: T = Object.assign({}, props);\n mapKeys(result).forEach((key) => {\n const value = result[key];\n if (isSharedValue(value)) {\n result[key] = value.value as never;\n }\n });\n return result;\n};\n\ntype Composer<T> = (outer: T, inner: T) => T;\n\nexport const composeDeclarations = <T>(filters: T[], composer: Composer<T>) => {\n \"worklet\";\n const len = filters.length;\n if (len <= 1) {\n return filters[0];\n }\n return filters.reduceRight((inner, outer) =>\n inner ? composer(outer, inner) : outer\n );\n};\n"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAEO,MAAMC,aAAa,GACxBC,KAAc,IACc;EAC5B,SAAS;;EACT;EACA,OAAO,CAACA,KAAK,aAALA,KAAK,uBAALA,KAAK,CAA8BC,wBAAwB,MAAK,IAAI;AAC9E,CAAC;AAACC,OAAA,CAAAH,aAAA,GAAAA,aAAA;AAEK,MAAMI,WAAW,GAAsBC,KAAQ,IAAK;EACzD,SAAS;;EACT,MAAMC,MAAS,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEH,KAAK,CAAC;EAC1C,IAAAI,kBAAO,EAACH,MAAM,CAAC,CAACI,OAAO,CAAEC,GAAG,IAAK;IAC/B,MAAMV,KAAK,GAAGK,MAAM,CAACK,GAAG,CAAC;IACzB,IAAIX,aAAa,CAACC,KAAK,CAAC,EAAE;MACxBK,MAAM,CAACK,GAAG,CAAC,GAAGV,KAAK,CAACA,KAAc;IACpC;EACF,CAAC,CAAC;EACF,OAAOK,MAAM;AACf,CAAC;AAACH,OAAA,CAAAC,WAAA,GAAAA,WAAA;AAIK,MAAMQ,mBAAmB,GAAGA,CAAIC,OAAY,EAAEC,QAAqB,KAAK;EAC7E,SAAS;;EACT,MAAMC,GAAG,GAAGF,OAAO,CAACG,MAAM;EAC1B,IAAID,GAAG,IAAI,CAAC,EAAE;IACZ,OAAOF,OAAO,CAAC,CAAC,CAAC;EACnB;EACA,OAAOA,OAAO,CAACI,WAAW,CAAC,CAACC,KAAK,EAAEC,KAAK,KACtCD,KAAK,GAAGJ,QAAQ,CAACK,KAAK,EAAED,KAAK,CAAC,GAAGC,KACnC,CAAC;AACH,CAAC;AAAChB,OAAA,CAAAS,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -38,6 +38,11 @@ export interface TransformProps {
38
38
  origin?: Vector;
39
39
  matrix?: InputMatrix;
40
40
  }
41
+ export interface CTMProps extends TransformProps {
42
+ clip?: ClipDef;
43
+ invertClip?: boolean;
44
+ layer?: SkPaint | boolean;
45
+ }
41
46
  export interface PaintProps extends ChildrenProps {
42
47
  color?: Color;
43
48
  strokeWidth?: number;
@@ -50,8 +55,5 @@ export interface PaintProps extends ChildrenProps {
50
55
  antiAlias?: boolean;
51
56
  dither?: boolean;
52
57
  }
53
- export interface GroupProps extends PaintProps, TransformProps {
54
- clip?: ClipDef;
55
- invertClip?: boolean;
56
- layer?: SkPaint | boolean;
58
+ export interface GroupProps extends PaintProps, CTMProps {
57
59
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type {\n BlendMode,\n Color,\n InputMatrix,\n InputRRect,\n PaintStyle,\n SkPaint,\n SkPath,\n SkRect,\n SkRRect,\n StrokeCap,\n StrokeJoin,\n Transforms3d,\n Vector,\n} from \"../../skia/types\";\n\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport type PathDef = string | SkPath;\n\nexport type ClipDef = SkRRect | SkRect | PathDef;\n\nexport type Fit =\n | \"cover\"\n | \"contain\"\n | \"fill\"\n | \"fitHeight\"\n | \"fitWidth\"\n | \"none\"\n | \"scaleDown\";\n\nexport type Radius = number | Vector;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\nexport interface RectCtor {\n x?: number;\n y?: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r?: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: InputRRect };\n\nexport interface PointCircleDef {\n c?: Vector;\n r: number;\n}\n\nexport interface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nexport interface TransformProps {\n transform?: Transforms3d;\n origin?: Vector;\n matrix?: InputMatrix;\n}\n\nexport interface PaintProps extends ChildrenProps {\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n dither?: boolean;\n}\n\nexport interface GroupProps extends PaintProps, TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: SkPaint | boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["Common.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type {\n BlendMode,\n Color,\n InputMatrix,\n InputRRect,\n PaintStyle,\n SkPaint,\n SkPath,\n SkRect,\n SkRRect,\n StrokeCap,\n StrokeJoin,\n Transforms3d,\n Vector,\n} from \"../../skia/types\";\n\nexport type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;\n\nexport type PathDef = string | SkPath;\n\nexport type ClipDef = SkRRect | SkRect | PathDef;\n\nexport type Fit =\n | \"cover\"\n | \"contain\"\n | \"fill\"\n | \"fitHeight\"\n | \"fitWidth\"\n | \"none\"\n | \"scaleDown\";\n\nexport type Radius = number | Vector;\n\nexport interface ChildrenProps {\n children?: ReactNode | ReactNode[];\n}\n\nexport interface RectCtor {\n x?: number;\n y?: number;\n width: number;\n height: number;\n}\n\nexport interface RRectCtor extends RectCtor {\n r?: Radius;\n}\n\nexport type RectDef = RectCtor | { rect: SkRect };\nexport type RRectDef = RRectCtor | { rect: InputRRect };\n\nexport interface PointCircleDef {\n c?: Vector;\n r: number;\n}\n\nexport interface ScalarCircleDef {\n cx: number;\n cy: number;\n r: number;\n}\n\nexport type CircleDef = PointCircleDef | ScalarCircleDef;\n\nexport interface TransformProps {\n transform?: Transforms3d;\n origin?: Vector;\n matrix?: InputMatrix;\n}\n\nexport interface CTMProps extends TransformProps {\n clip?: ClipDef;\n invertClip?: boolean;\n layer?: SkPaint | boolean;\n}\n\nexport interface PaintProps extends ChildrenProps {\n color?: Color;\n strokeWidth?: number;\n blendMode?: SkEnum<typeof BlendMode>;\n style?: SkEnum<typeof PaintStyle>;\n strokeJoin?: SkEnum<typeof StrokeJoin>;\n strokeCap?: SkEnum<typeof StrokeCap>;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n dither?: boolean;\n}\n\nexport interface GroupProps extends PaintProps, CTMProps {}\n"],"mappings":"","ignoreList":[]}
@@ -13,7 +13,7 @@ export interface RuntimeShaderImageFilterProps extends ChildrenProps {
13
13
  uniforms?: Uniforms;
14
14
  }
15
15
  export interface BlendImageFilterProps extends ChildrenProps {
16
- mode: BlendMode;
16
+ mode: SkEnum<typeof BlendMode>;
17
17
  }
18
18
  export interface MorphologyImageFilterProps extends ChildrenProps {
19
19
  operator: "erode" | "dilate";
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["ImageFilters.ts"],"sourcesContent":["import type {\n BlendMode,\n Color,\n ColorChannel,\n SkRuntimeEffect,\n TileMode,\n Uniforms,\n} from \"../../skia/types\";\n\nimport type { Radius, SkEnum, ChildrenProps } from \"./Common\";\n\nexport interface BlurImageFilterProps extends ChildrenProps {\n blur: Radius;\n mode: SkEnum<typeof TileMode>;\n}\n\nexport interface OffsetImageFilterProps extends ChildrenProps {\n x: number;\n y: number;\n}\n\nexport interface RuntimeShaderImageFilterProps extends ChildrenProps {\n source: SkRuntimeEffect;\n uniforms?: Uniforms;\n}\n\nexport interface BlendImageFilterProps extends ChildrenProps {\n mode: BlendMode;\n}\n\nexport interface MorphologyImageFilterProps extends ChildrenProps {\n operator: \"erode\" | \"dilate\";\n radius: Radius;\n}\n\nexport interface DropShadowImageFilterProps extends ChildrenProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n inner?: boolean;\n shadowOnly?: boolean;\n}\n\nexport interface DisplacementMapImageFilterProps extends ChildrenProps {\n channelX: SkEnum<typeof ColorChannel>;\n channelY: SkEnum<typeof ColorChannel>;\n scale: number;\n}\n\nexport interface BlendProps extends ChildrenProps {\n mode: SkEnum<typeof BlendMode>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["ImageFilters.ts"],"sourcesContent":["import type {\n BlendMode,\n Color,\n ColorChannel,\n SkRuntimeEffect,\n TileMode,\n Uniforms,\n} from \"../../skia/types\";\n\nimport type { Radius, SkEnum, ChildrenProps } from \"./Common\";\n\nexport interface BlurImageFilterProps extends ChildrenProps {\n blur: Radius;\n mode: SkEnum<typeof TileMode>;\n}\n\nexport interface OffsetImageFilterProps extends ChildrenProps {\n x: number;\n y: number;\n}\n\nexport interface RuntimeShaderImageFilterProps extends ChildrenProps {\n source: SkRuntimeEffect;\n uniforms?: Uniforms;\n}\n\n// TODO: delete\nexport interface BlendImageFilterProps extends ChildrenProps {\n mode: SkEnum<typeof BlendMode>;\n}\n\nexport interface MorphologyImageFilterProps extends ChildrenProps {\n operator: \"erode\" | \"dilate\";\n radius: Radius;\n}\n\nexport interface DropShadowImageFilterProps extends ChildrenProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n inner?: boolean;\n shadowOnly?: boolean;\n}\n\nexport interface DisplacementMapImageFilterProps extends ChildrenProps {\n channelX: SkEnum<typeof ColorChannel>;\n channelY: SkEnum<typeof ColorChannel>;\n scale: number;\n}\n\nexport interface BlendProps extends ChildrenProps {\n mode: SkEnum<typeof BlendMode>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1,6 +1,5 @@
1
1
  import type { GroupProps } from "./Common";
2
2
  import type { NodeType } from "./NodeType";
3
- import type { DeclarationContext } from "../../sksg/DeclarationContext";
4
3
  export interface Node<P> {
5
4
  type: NodeType;
6
5
  setProps(props: P): void;
@@ -13,7 +12,6 @@ export interface Node<P> {
13
12
  }
14
13
  export type Invalidate = () => void;
15
14
  export interface DeclarationNode<P> extends Node<P> {
16
- decorate(ctx: DeclarationContext): void;
17
15
  setInvalidate(invalidate: Invalidate): void;
18
16
  }
19
17
  export type RenderNode<P extends GroupProps> = Node<P>;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Node.ts"],"sourcesContent":["import type { GroupProps } from \"./Common\";\nimport type { NodeType } from \"./NodeType\";\nimport type { DeclarationContext } from \"../../sksg/DeclarationContext\";\n\nexport interface Node<P> {\n type: NodeType;\n\n setProps(props: P): void;\n setProp<K extends keyof P>(name: K, v: P[K]): boolean;\n getProps(): P;\n\n children(): Node<unknown>[];\n addChild(child: Node<unknown>): void;\n removeChild(child: Node<unknown>): void;\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;\n}\n\nexport type Invalidate = () => void;\n\nexport interface DeclarationNode<P> extends Node<P> {\n //declarationType: DeclarationType;\n decorate(ctx: DeclarationContext): void;\n\n setInvalidate(invalidate: Invalidate): void;\n}\n\nexport type RenderNode<P extends GroupProps> = Node<P>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["Node.ts"],"sourcesContent":["import type { GroupProps } from \"./Common\";\nimport type { NodeType } from \"./NodeType\";\n\nexport interface Node<P> {\n type: NodeType;\n\n setProps(props: P): void;\n setProp<K extends keyof P>(name: K, v: P[K]): boolean;\n getProps(): P;\n\n children(): Node<unknown>[];\n addChild(child: Node<unknown>): void;\n removeChild(child: Node<unknown>): void;\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;\n}\n\nexport type Invalidate = () => void;\n\nexport interface DeclarationNode<P> extends Node<P> {\n setInvalidate(invalidate: Invalidate): void;\n}\n\nexport type RenderNode<P extends GroupProps> = Node<P>;\n"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,4 @@
1
1
  export * from "./useAnimatedImageValue";
2
- export * from "./useDerivedValueOnJS";
3
2
  export * from "./renderHelpers";
4
3
  export * from "./interpolators";
5
4
  export * from "./textures";
@@ -1,5 +1,4 @@
1
1
  export * from "./useAnimatedImageValue";
2
- export * from "./useDerivedValueOnJS";
3
2
  export * from "./renderHelpers";
4
3
  export * from "./interpolators";
5
4
  export * from "./textures";
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useAnimatedImageValue\";\nexport * from \"./useDerivedValueOnJS\";\nexport * from \"./renderHelpers\";\nexport * from \"./interpolators\";\nexport * from \"./textures\";\nexport * from \"./buffers\";\nexport * from \"./useVideo\";\n"],"mappings":"AAAA,cAAc,yBAAyB;AACvC,cAAc,uBAAuB;AACrC,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,YAAY","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useAnimatedImageValue\";\nexport * from \"./renderHelpers\";\nexport * from \"./interpolators\";\nexport * from \"./textures\";\nexport * from \"./buffers\";\nexport * from \"./useVideo\";\n"],"mappings":"AAAA,cAAc,yBAAyB;AACvC,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,YAAY","ignoreList":[]}
@@ -1,7 +1,6 @@
1
1
  import type { Container } from "../../renderer/Container";
2
2
  import type { AnimatedProps } from "../../renderer/processors";
3
3
  import type { Node } from "../../dom/types";
4
- export declare let HAS_REANIMATED: boolean;
5
4
  export declare let HAS_REANIMATED_3: boolean;
6
5
  export declare const unbindReanimatedNode: (node: Node<unknown>) => void;
7
6
  export declare function extractReanimatedProps(props: AnimatedProps<any>): AnimatedProps<any, never>[];
@@ -1,7 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
 
3
3
  import Rea from "./ReanimatedProxy";
4
- export let HAS_REANIMATED = false;
5
4
  export let HAS_REANIMATED_3 = false;
6
5
  try {
7
6
  // This logic is convoluted but necessary
@@ -10,16 +9,15 @@ try {
10
9
  // So it will not throw an error and we need to check the version to know if it's there.
11
10
  const reanimatedVersion = require("react-native-reanimated/package.json").version;
12
11
  require("react-native-reanimated");
13
- HAS_REANIMATED = !!reanimatedVersion;
14
12
  if (reanimatedVersion && (reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))) {
15
13
  HAS_REANIMATED_3 = true;
16
14
  }
17
15
  } catch (e) {
18
- HAS_REANIMATED = false;
16
+ // do nothing
19
17
  }
20
18
  const _bindings = new WeakMap();
21
19
  export const unbindReanimatedNode = node => {
22
- if (!HAS_REANIMATED) {
20
+ if (!HAS_REANIMATED_3) {
23
21
  return;
24
22
  }
25
23
  const previousMapperId = _bindings.get(node);
@@ -28,7 +26,7 @@ export const unbindReanimatedNode = node => {
28
26
  }
29
27
  };
30
28
  export function extractReanimatedProps(props) {
31
- if (!HAS_REANIMATED) {
29
+ if (!HAS_REANIMATED_3) {
32
30
  return [props, {}];
33
31
  }
34
32
  const reanimatedProps = {};
@@ -47,44 +45,8 @@ export function extractReanimatedProps(props) {
47
45
  }
48
46
  return [otherProps, reanimatedProps];
49
47
  }
50
- function bindReanimatedProps2(container, node, reanimatedProps) {
51
- const sharedValues = Object.values(reanimatedProps);
52
- const previousMapperId = _bindings.get(node);
53
- if (previousMapperId !== undefined) {
54
- Rea.stopMapper(previousMapperId);
55
- }
56
- if (sharedValues.length > 0) {
57
- const viewId = container.getNativeId();
58
- const {
59
- SkiaViewApi
60
- } = global;
61
- const updateProps = () => {
62
- for (const propName in reanimatedProps) {
63
- node && node.setProp(propName, reanimatedProps[propName].value);
64
- }
65
- // On React Native we use the SkiaViewApi to redraw because it can
66
- // run on the worklet thread (container.redraw can't)
67
- // if SkiaViewApi is undefined, we are on web and container.redraw()
68
- // can safely be invoked
69
- if (SkiaViewApi) {
70
- SkiaViewApi.requestRedraw(viewId);
71
- } else {
72
- container.redraw();
73
- }
74
- };
75
- const mapperId = Rea.startMapper(() => {
76
- "worklet";
77
-
78
- Rea.runOnJS(updateProps)();
79
- }, sharedValues);
80
- _bindings.set(node, mapperId);
81
- }
82
- }
83
48
  export function bindReanimatedProps(container, node, reanimatedProps) {
84
- if (HAS_REANIMATED && !HAS_REANIMATED_3) {
85
- return bindReanimatedProps2(container, node, reanimatedProps);
86
- }
87
- if (!HAS_REANIMATED) {
49
+ if (!HAS_REANIMATED_3) {
88
50
  return;
89
51
  }
90
52
  const sharedValues = Object.values(reanimatedProps);
@@ -1 +1 @@
1
- {"version":3,"names":["Rea","HAS_REANIMATED","HAS_REANIMATED_3","reanimatedVersion","require","version","includes","e","_bindings","WeakMap","unbindReanimatedNode","node","previousMapperId","get","undefined","stopMapper","extractReanimatedProps","props","reanimatedProps","otherProps","propName","propValue","isSharedValue","value","bindReanimatedProps2","container","sharedValues","Object","values","length","viewId","getNativeId","SkiaViewApi","global","updateProps","setProp","requestRedraw","redraw","mapperId","startMapper","runOnJS","set","bindReanimatedProps"],"sources":["renderHelpers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Container } from \"../../renderer/Container\";\nimport type { AnimatedProps } from \"../../renderer/processors\";\nimport type { Node } from \"../../dom/types\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nexport let HAS_REANIMATED = false;\nexport let HAS_REANIMATED_3 = false;\ntry {\n // This logic is convoluted but necessary\n // In most systems, `require(\"react-native-reanimated\")` throws an error, all is well.\n // In webpack, in some configuration it will return an empty object.\n // So it will not throw an error and we need to check the version to know if it's there.\n const reanimatedVersion =\n require(\"react-native-reanimated/package.json\").version;\n require(\"react-native-reanimated\");\n HAS_REANIMATED = !!reanimatedVersion;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n HAS_REANIMATED_3 = true;\n }\n} catch (e) {\n HAS_REANIMATED = false;\n}\n\nconst _bindings = new WeakMap<Node<unknown>, unknown>();\n\nexport const unbindReanimatedNode = (node: Node<unknown>) => {\n if (!HAS_REANIMATED) {\n return;\n }\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n Rea.stopMapper(previousMapperId as number);\n }\n};\n\nexport function extractReanimatedProps(props: AnimatedProps<any>) {\n if (!HAS_REANIMATED) {\n return [props, {}];\n }\n const reanimatedProps = {} as AnimatedProps<any>;\n const otherProps = {} as AnimatedProps<any>;\n for (const propName in props) {\n if (propName === \"children\") {\n continue;\n }\n const propValue = props[propName];\n if (Rea.isSharedValue(propValue)) {\n reanimatedProps[propName] = propValue;\n otherProps[propName] = propValue.value;\n } else {\n otherProps[propName] = propValue;\n }\n }\n return [otherProps, reanimatedProps];\n}\n\nfunction bindReanimatedProps2(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n Rea.stopMapper(previousMapperId as number);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const updateProps = () => {\n for (const propName in reanimatedProps) {\n node && node.setProp(propName, reanimatedProps[propName].value);\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n };\n const mapperId = Rea.startMapper(() => {\n \"worklet\";\n Rea.runOnJS(updateProps)();\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n\nexport function bindReanimatedProps(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n if (HAS_REANIMATED && !HAS_REANIMATED_3) {\n return bindReanimatedProps2(container, node, reanimatedProps);\n }\n if (!HAS_REANIMATED) {\n return;\n }\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n Rea.stopMapper(previousMapperId as number);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const mapperId = Rea.startMapper(() => {\n \"worklet\";\n if (node) {\n for (const propName in reanimatedProps) {\n node.setProp(propName, reanimatedProps[propName].value);\n }\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n"],"mappings":"AAAA;;AAMA,OAAOA,GAAG,MAAM,mBAAmB;AAEnC,OAAO,IAAIC,cAAc,GAAG,KAAK;AACjC,OAAO,IAAIC,gBAAgB,GAAG,KAAK;AACnC,IAAI;EACF;EACA;EACA;EACA;EACA,MAAMC,iBAAiB,GACrBC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;EACzDD,OAAO,CAAC,yBAAyB,CAAC;EAClCH,cAAc,GAAG,CAAC,CAACE,iBAAiB;EACpC,IACEA,iBAAiB,KAChBA,iBAAiB,IAAI,OAAO,IAAIA,iBAAiB,CAACG,QAAQ,CAAC,QAAQ,CAAC,CAAC,EACtE;IACAJ,gBAAgB,GAAG,IAAI;EACzB;AACF,CAAC,CAAC,OAAOK,CAAC,EAAE;EACVN,cAAc,GAAG,KAAK;AACxB;AAEA,MAAMO,SAAS,GAAG,IAAIC,OAAO,CAAyB,CAAC;AAEvD,OAAO,MAAMC,oBAAoB,GAAIC,IAAmB,IAAK;EAC3D,IAAI,CAACV,cAAc,EAAE;IACnB;EACF;EACA,MAAMW,gBAAgB,GAAGJ,SAAS,CAACK,GAAG,CAACF,IAAI,CAAC;EAC5C,IAAIC,gBAAgB,K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;QACR,KAAK,MAAMS,QAAQ,IAAIF,eAAe,EAAE;UACtCP,IAAI,CAACwB,OAAO,CAACf,QAAQ,EAAEF,eAAe,CAACE,QAAQ,CAAC,CAACG,KAAK,CAAC;QACzD;MACF;MACA;MACA;MACA;MACA;MACA,IAAIS,WAAW,EAAE;QACfA,WAAW,CAACI,aAAa,CAACN,MAAM,CAAC;MACnC,CAAC,MAAM;QACLL,SAAS,CAACY,MAAM,CAAC,CAAC;MACpB;IACF,CAAC,EAAEX,YAAY,CAAC;IAChBlB,SAAS,CAACiC,GAAG,CAAC9B,IAAI,EAAE2B,QAAQ,CAAC;EAC/B;AACF","ignoreList":[]}
1
+ {"version":3,"names":["Rea","HAS_REANIMATED_3","reanimatedVersion","require","version","includes","e","_bindings","WeakMap","unbindReanimatedNode","node","previousMapperId","get","undefined","stopMapper","extractReanimatedProps","props","reanimatedProps","otherProps","propName","propValue","isSharedValue","value","bindReanimatedProps","container","sharedValues","Object","values","length","viewId","getNativeId","SkiaViewApi","global","mapperId","startMapper","setProp","requestRedraw","redraw","set"],"sources":["renderHelpers.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Container } from \"../../renderer/Container\";\nimport type { AnimatedProps } from \"../../renderer/processors\";\nimport type { Node } from \"../../dom/types\";\n\nimport Rea from \"./ReanimatedProxy\";\n\nexport let HAS_REANIMATED_3 = false;\ntry {\n // This logic is convoluted but necessary\n // In most systems, `require(\"react-native-reanimated\")` throws an error, all is well.\n // In webpack, in some configuration it will return an empty object.\n // So it will not throw an error and we need to check the version to know if it's there.\n const reanimatedVersion =\n require(\"react-native-reanimated/package.json\").version;\n require(\"react-native-reanimated\");\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n HAS_REANIMATED_3 = true;\n }\n} catch (e) {\n // do nothing\n}\n\nconst _bindings = new WeakMap<Node<unknown>, unknown>();\n\nexport const unbindReanimatedNode = (node: Node<unknown>) => {\n if (!HAS_REANIMATED_3) {\n return;\n }\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n Rea.stopMapper(previousMapperId as number);\n }\n};\n\nexport function extractReanimatedProps(props: AnimatedProps<any>) {\n if (!HAS_REANIMATED_3) {\n return [props, {}];\n }\n const reanimatedProps = {} as AnimatedProps<any>;\n const otherProps = {} as AnimatedProps<any>;\n for (const propName in props) {\n if (propName === \"children\") {\n continue;\n }\n const propValue = props[propName];\n if (Rea.isSharedValue(propValue)) {\n reanimatedProps[propName] = propValue;\n otherProps[propName] = propValue.value;\n } else {\n otherProps[propName] = propValue;\n }\n }\n return [otherProps, reanimatedProps];\n}\n\nexport function bindReanimatedProps(\n container: Container,\n node: Node<any>,\n reanimatedProps: AnimatedProps<any>\n) {\n if (!HAS_REANIMATED_3) {\n return;\n }\n const sharedValues = Object.values(reanimatedProps);\n const previousMapperId = _bindings.get(node);\n if (previousMapperId !== undefined) {\n Rea.stopMapper(previousMapperId as number);\n }\n if (sharedValues.length > 0) {\n const viewId = container.getNativeId();\n const { SkiaViewApi } = global;\n const mapperId = Rea.startMapper(() => {\n \"worklet\";\n if (node) {\n for (const propName in reanimatedProps) {\n node.setProp(propName, reanimatedProps[propName].value);\n }\n }\n // On React Native we use the SkiaViewApi to redraw because it can\n // run on the worklet thread (container.redraw can't)\n // if SkiaViewApi is undefined, we are on web and container.redraw()\n // can safely be invoked\n if (SkiaViewApi) {\n SkiaViewApi.requestRedraw(viewId);\n } else {\n container.redraw();\n }\n }, sharedValues);\n _bindings.set(node, mapperId);\n }\n}\n"],"mappings":"AAAA;;AAMA,OAAOA,GAAG,MAAM,mBAAmB;AAEnC,OAAO,IAAIC,gBAAgB,GAAG,KAAK;AACnC,IAAI;EACF;EACA;EACA;EACA;EACA,MAAMC,iBAAiB,GACrBC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;EACzDD,OAAO,CAAC,yBAAyB,CAAC;EAClC,IACED,iBAAiB,KAChB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