@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,67 @@
1
+ import { NodeType } from "../dom/types";
2
+ export const isColorFilter = type => {
3
+ "worklet";
4
+
5
+ return type === NodeType.BlendColorFilter || type === NodeType.MatrixColorFilter || type === NodeType.LerpColorFilter || type === NodeType.LumaColorFilter || type === NodeType.SRGBToLinearGammaColorFilter || type === NodeType.LinearToSRGBGammaColorFilter;
6
+ };
7
+ export const isPathEffect = type => {
8
+ "worklet";
9
+
10
+ return type === NodeType.DiscretePathEffect || type === NodeType.DashPathEffect || type === NodeType.Path1DPathEffect || type === NodeType.Path2DPathEffect || type === NodeType.CornerPathEffect || type === NodeType.SumPathEffect || type === NodeType.Line2DPathEffect;
11
+ };
12
+ export const isImageFilter = type => {
13
+ "worklet";
14
+
15
+ return type === NodeType.OffsetImageFilter || type === NodeType.DisplacementMapImageFilter || type === NodeType.BlurImageFilter || type === NodeType.DropShadowImageFilter || type === NodeType.MorphologyImageFilter || type === NodeType.BlendImageFilter || type === NodeType.RuntimeShaderImageFilter;
16
+ };
17
+ export const isShader = type => {
18
+ "worklet";
19
+
20
+ return type === NodeType.Shader || type === NodeType.ImageShader || type === NodeType.ColorShader || type === NodeType.Turbulence || type === NodeType.FractalNoise || type === NodeType.LinearGradient || type === NodeType.RadialGradient || type === NodeType.SweepGradient || type === NodeType.TwoPointConicalGradient;
21
+ };
22
+ export const sortNodeChildren = parent => {
23
+ "worklet";
24
+
25
+ const maskFilters = [];
26
+ const colorFilters = [];
27
+ const shaders = [];
28
+ const imageFilters = [];
29
+ const pathEffects = [];
30
+ const drawings = [];
31
+ const paints = [];
32
+ parent.children.forEach(node => {
33
+ if (isColorFilter(node.type)) {
34
+ colorFilters.push(node);
35
+ } else if (node.type === NodeType.BlurMaskFilter) {
36
+ maskFilters.push(node);
37
+ } else if (isPathEffect(node.type)) {
38
+ pathEffects.push(node);
39
+ } else if (isImageFilter(node.type)) {
40
+ imageFilters.push(node);
41
+ } else if (isShader(node.type)) {
42
+ shaders.push(node);
43
+ } else if (node.type === NodeType.Paint) {
44
+ paints.push(node);
45
+ } else if (node.type === NodeType.Blend) {
46
+ if (node.children[0] && isImageFilter(node.children[0].type)) {
47
+ node.type = NodeType.BlendImageFilter;
48
+ imageFilters.push(node);
49
+ } else {
50
+ node.type = NodeType.Blend;
51
+ shaders.push(node);
52
+ }
53
+ } else {
54
+ drawings.push(node);
55
+ }
56
+ });
57
+ return {
58
+ colorFilters,
59
+ drawings,
60
+ maskFilters,
61
+ shaders,
62
+ pathEffects,
63
+ imageFilters,
64
+ paints
65
+ };
66
+ };
67
+ //# sourceMappingURL=Node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NodeType","isColorFilter","type","BlendColorFilter","MatrixColorFilter","LerpColorFilter","LumaColorFilter","SRGBToLinearGammaColorFilter","LinearToSRGBGammaColorFilter","isPathEffect","DiscretePathEffect","DashPathEffect","Path1DPathEffect","Path2DPathEffect","CornerPathEffect","SumPathEffect","Line2DPathEffect","isImageFilter","OffsetImageFilter","DisplacementMapImageFilter","BlurImageFilter","DropShadowImageFilter","MorphologyImageFilter","BlendImageFilter","RuntimeShaderImageFilter","isShader","Shader","ImageShader","ColorShader","Turbulence","FractalNoise","LinearGradient","RadialGradient","SweepGradient","TwoPointConicalGradient","sortNodeChildren","parent","maskFilters","colorFilters","shaders","imageFilters","pathEffects","drawings","paints","children","forEach","node","push","BlurMaskFilter","Paint","Blend"],"sources":["Node.ts"],"sourcesContent":["import { NodeType } from \"../dom/types\";\n\nexport interface Node<Props = unknown> {\n type: NodeType;\n props: Props;\n children: Node[];\n}\n\nexport const isColorFilter = (type: NodeType) => {\n \"worklet\";\n return (\n type === NodeType.BlendColorFilter ||\n type === NodeType.MatrixColorFilter ||\n type === NodeType.LerpColorFilter ||\n type === NodeType.LumaColorFilter ||\n type === NodeType.SRGBToLinearGammaColorFilter ||\n type === NodeType.LinearToSRGBGammaColorFilter\n );\n};\n\nexport const isPathEffect = (type: NodeType) => {\n \"worklet\";\n return (\n type === NodeType.DiscretePathEffect ||\n type === NodeType.DashPathEffect ||\n type === NodeType.Path1DPathEffect ||\n type === NodeType.Path2DPathEffect ||\n type === NodeType.CornerPathEffect ||\n type === NodeType.SumPathEffect ||\n type === NodeType.Line2DPathEffect\n );\n};\n\nexport const isImageFilter = (type: NodeType) => {\n \"worklet\";\n return (\n type === NodeType.OffsetImageFilter ||\n type === NodeType.DisplacementMapImageFilter ||\n type === NodeType.BlurImageFilter ||\n type === NodeType.DropShadowImageFilter ||\n type === NodeType.MorphologyImageFilter ||\n type === NodeType.BlendImageFilter ||\n type === NodeType.RuntimeShaderImageFilter\n );\n};\n\nexport const isShader = (type: NodeType) => {\n \"worklet\";\n return (\n type === NodeType.Shader ||\n type === NodeType.ImageShader ||\n type === NodeType.ColorShader ||\n type === NodeType.Turbulence ||\n type === NodeType.FractalNoise ||\n type === NodeType.LinearGradient ||\n type === NodeType.RadialGradient ||\n type === NodeType.SweepGradient ||\n type === NodeType.TwoPointConicalGradient\n );\n};\n\nexport const sortNodeChildren = (parent: Node) => {\n \"worklet\";\n const maskFilters: Node[] = [];\n const colorFilters: Node[] = [];\n const shaders: Node[] = [];\n const imageFilters: Node[] = [];\n const pathEffects: Node[] = [];\n const drawings: Node[] = [];\n const paints: Node[] = [];\n parent.children.forEach((node) => {\n if (isColorFilter(node.type)) {\n colorFilters.push(node);\n } else if (node.type === NodeType.BlurMaskFilter) {\n maskFilters.push(node);\n } else if (isPathEffect(node.type)) {\n pathEffects.push(node);\n } else if (isImageFilter(node.type)) {\n imageFilters.push(node);\n } else if (isShader(node.type)) {\n shaders.push(node);\n } else if (node.type === NodeType.Paint) {\n paints.push(node);\n } else if (node.type === NodeType.Blend) {\n if (node.children[0] && isImageFilter(node.children[0].type)) {\n node.type = NodeType.BlendImageFilter;\n imageFilters.push(node);\n } else {\n node.type = NodeType.Blend;\n shaders.push(node);\n }\n } else {\n drawings.push(node);\n }\n });\n return {\n colorFilters,\n drawings,\n maskFilters,\n shaders,\n pathEffects,\n imageFilters,\n paints,\n };\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAQvC,OAAO,MAAMC,aAAa,GAAIC,IAAc,IAAK;EAC/C,SAAS;;EACT,OACEA,IAAI,KAAKF,QAAQ,CAACG,gBAAgB,IAClCD,IAAI,KAAKF,QAAQ,CAACI,iBAAiB,IACnCF,IAAI,KAAKF,QAAQ,CAACK,eAAe,IACjCH,IAAI,KAAKF,QAAQ,CAACM,eAAe,IACjCJ,IAAI,KAAKF,QAAQ,CAACO,4BAA4B,IAC9CL,IAAI,KAAKF,QAAQ,CAACQ,4BAA4B;AAElD,CAAC;AAED,OAAO,MAAMC,YAAY,GAAIP,IAAc,IAAK;EAC9C,SAAS;;EACT,OACEA,IAAI,KAAKF,QAAQ,CAACU,kBAAkB,IACpCR,IAAI,KAAKF,QAAQ,CAACW,cAAc,IAChCT,IAAI,KAAKF,QAAQ,CAACY,gBAAgB,IAClCV,IAAI,KAAKF,QAAQ,CAACa,gBAAgB,IAClCX,IAAI,KAAKF,QAAQ,CAACc,gBAAgB,IAClCZ,IAAI,KAAKF,QAAQ,CAACe,aAAa,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AAI,CAAC;IACrB;EACF,CAAC,CAAC;EACF,OAAO;IACLR,YAAY;IACZI,QAAQ;IACRL,WAAW;IACXE,OAAO;IACPE,WAAW;IACXD,YAAY;IACZG;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -9,7 +9,7 @@ export declare class SkiaSGRoot {
9
9
  get sg(): {
10
10
  type: NodeType;
11
11
  props: {};
12
- children: import("./nodes").Node<unknown>[];
12
+ children: import("./Node").Node<unknown>[];
13
13
  isDeclaration: boolean;
14
14
  };
15
15
  render(element: ReactNode): void;
@@ -0,0 +1,79 @@
1
+ import type { SharedValue } from "react-native-reanimated";
2
+ import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, DrawingNodeProps } from "../../dom/types";
3
+ export declare enum CommandType {
4
+ SavePaint = 0,
5
+ RestorePaint = 1,
6
+ SaveCTM = 2,
7
+ RestoreCTM = 3,
8
+ PushColorFilter = 4,
9
+ PushBlurMaskFilter = 5,
10
+ PushImageFilter = 6,
11
+ PushPathEffect = 7,
12
+ PushShader = 8,
13
+ ComposeColorFilter = 9,
14
+ ComposeImageFilter = 10,
15
+ ComposePathEffect = 11,
16
+ MaterializePaint = 12,
17
+ SaveBackdropFilter = 13,
18
+ SaveLayer = 14,
19
+ RestorePaintDeclaration = 15,
20
+ DrawBox = 16,
21
+ DrawImage = 17,
22
+ DrawCircle = 18,
23
+ DrawPaint = 19,
24
+ DrawPoints = 20,
25
+ DrawPath = 21,
26
+ DrawRect = 22,
27
+ DrawRRect = 23,
28
+ DrawOval = 24,
29
+ DrawLine = 25,
30
+ DrawPatch = 26,
31
+ DrawVertices = 27,
32
+ DrawDiffRect = 28,
33
+ DrawText = 29,
34
+ DrawTextPath = 30,
35
+ DrawTextBlob = 31,
36
+ DrawGlyphs = 32,
37
+ DrawPicture = 33,
38
+ DrawImageSVG = 34,
39
+ DrawParagraph = 35,
40
+ DrawAtlas = 36
41
+ }
42
+ export type Command<T extends CommandType = CommandType> = {
43
+ type: T;
44
+ [key: string]: unknown;
45
+ };
46
+ export declare const materializeProps: (command: {
47
+ props: Record<string, unknown>;
48
+ animatedProps?: Record<string, SharedValue<unknown>>;
49
+ }) => void;
50
+ export declare const isCommand: <T extends CommandType>(command: Command, type: T) => command is Command<T>;
51
+ interface Props {
52
+ [CommandType.DrawImage]: ImageProps;
53
+ [CommandType.DrawCircle]: CircleProps;
54
+ [CommandType.SaveCTM]: CTMProps;
55
+ [CommandType.SavePaint]: DrawingNodeProps;
56
+ [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;
57
+ [CommandType.DrawPoints]: PointsProps;
58
+ [CommandType.DrawPath]: PathProps;
59
+ [CommandType.DrawRect]: RectProps;
60
+ [CommandType.DrawRRect]: RoundedRectProps;
61
+ [CommandType.DrawOval]: OvalProps;
62
+ [CommandType.DrawLine]: LineProps;
63
+ [CommandType.DrawPatch]: PatchProps;
64
+ [CommandType.DrawVertices]: VerticesProps;
65
+ [CommandType.DrawDiffRect]: DiffRectProps;
66
+ [CommandType.DrawText]: TextProps;
67
+ [CommandType.DrawTextPath]: TextPathProps;
68
+ [CommandType.DrawTextBlob]: TextBlobProps;
69
+ [CommandType.DrawGlyphs]: GlyphsProps;
70
+ [CommandType.DrawPicture]: PictureProps;
71
+ [CommandType.DrawImageSVG]: ImageSVGProps;
72
+ [CommandType.DrawParagraph]: ParagraphProps;
73
+ [CommandType.DrawAtlas]: AtlasProps;
74
+ }
75
+ interface DrawCommand<T extends CommandType> extends Command<T> {
76
+ props: T extends keyof Props ? Props[T] : never;
77
+ }
78
+ export declare const isDrawCommand: <T extends keyof Props>(command: Command, type: T) => command is DrawCommand<T>;
79
+ export {};
@@ -0,0 +1,101 @@
1
+ // export enum CommandType {
2
+ // // Context
3
+ // SavePaint = "SavePaint",
4
+ // RestorePaint = "RestorePaint",
5
+ // SaveCTM = "SaveCTM",
6
+ // RestoreCTM = "RestoreCTM",
7
+ // PushColorFilter = "PushColorFilter",
8
+ // PushBlurMaskFilter = "PushBlurMaskFilter",
9
+ // PushImageFilter = "PushImageFilter",
10
+ // PushPathEffect = "PushPathEffect",
11
+ // PushShader = "PushShader",
12
+ // ComposeColorFilter = "ComposeColorFilter",
13
+ // ComposeImageFilter = "ComposeImageFilter",
14
+ // ComposePathEffect = "ComposePathEffect",
15
+ // MaterializePaint = "MaterializePaint",
16
+ // SaveBackdropFilter = "SaveBackdropFilter",
17
+ // SaveLayer = "SaveLayer",
18
+ // RestorePaintDeclaration = "RestorePaintDeclaration",
19
+ // // Drawing
20
+ // DrawBox = "DrawBox",
21
+ // DrawImage = "DrawImage",
22
+ // DrawCircle = "DrawCircle",
23
+ // DrawPaint = "DrawPaint",
24
+ // DrawPoints = "DrawPoints",
25
+ // DrawPath = "DrawPath",
26
+ // DrawRect = "DrawRect",
27
+ // DrawRRect = "DrawRRect",
28
+ // DrawOval = "DrawOval",
29
+ // DrawLine = "DrawLine",
30
+ // DrawPatch = "DrawPatch",
31
+ // DrawVertices = "DrawVertices",
32
+ // DrawDiffRect = "DrawDiffRect",
33
+ // DrawText = "DrawText",
34
+ // DrawTextPath = "DrawTextPath",
35
+ // DrawTextBlob = "DrawTextBlob",
36
+ // DrawGlyphs = "DrawGlyphs",
37
+ // DrawPicture = "DrawPicture",
38
+ // DrawImageSVG = "DrawImageSVG",
39
+ // DrawParagraph = "DrawParagraph",
40
+ // DrawAtlas = "DrawAtlas",
41
+ // }
42
+ export let CommandType = /*#__PURE__*/function (CommandType) {
43
+ CommandType[CommandType["SavePaint"] = 0] = "SavePaint";
44
+ CommandType[CommandType["RestorePaint"] = 1] = "RestorePaint";
45
+ CommandType[CommandType["SaveCTM"] = 2] = "SaveCTM";
46
+ CommandType[CommandType["RestoreCTM"] = 3] = "RestoreCTM";
47
+ CommandType[CommandType["PushColorFilter"] = 4] = "PushColorFilter";
48
+ CommandType[CommandType["PushBlurMaskFilter"] = 5] = "PushBlurMaskFilter";
49
+ CommandType[CommandType["PushImageFilter"] = 6] = "PushImageFilter";
50
+ CommandType[CommandType["PushPathEffect"] = 7] = "PushPathEffect";
51
+ CommandType[CommandType["PushShader"] = 8] = "PushShader";
52
+ CommandType[CommandType["ComposeColorFilter"] = 9] = "ComposeColorFilter";
53
+ CommandType[CommandType["ComposeImageFilter"] = 10] = "ComposeImageFilter";
54
+ CommandType[CommandType["ComposePathEffect"] = 11] = "ComposePathEffect";
55
+ CommandType[CommandType["MaterializePaint"] = 12] = "MaterializePaint";
56
+ CommandType[CommandType["SaveBackdropFilter"] = 13] = "SaveBackdropFilter";
57
+ CommandType[CommandType["SaveLayer"] = 14] = "SaveLayer";
58
+ CommandType[CommandType["RestorePaintDeclaration"] = 15] = "RestorePaintDeclaration";
59
+ CommandType[CommandType["DrawBox"] = 16] = "DrawBox";
60
+ CommandType[CommandType["DrawImage"] = 17] = "DrawImage";
61
+ CommandType[CommandType["DrawCircle"] = 18] = "DrawCircle";
62
+ CommandType[CommandType["DrawPaint"] = 19] = "DrawPaint";
63
+ CommandType[CommandType["DrawPoints"] = 20] = "DrawPoints";
64
+ CommandType[CommandType["DrawPath"] = 21] = "DrawPath";
65
+ CommandType[CommandType["DrawRect"] = 22] = "DrawRect";
66
+ CommandType[CommandType["DrawRRect"] = 23] = "DrawRRect";
67
+ CommandType[CommandType["DrawOval"] = 24] = "DrawOval";
68
+ CommandType[CommandType["DrawLine"] = 25] = "DrawLine";
69
+ CommandType[CommandType["DrawPatch"] = 26] = "DrawPatch";
70
+ CommandType[CommandType["DrawVertices"] = 27] = "DrawVertices";
71
+ CommandType[CommandType["DrawDiffRect"] = 28] = "DrawDiffRect";
72
+ CommandType[CommandType["DrawText"] = 29] = "DrawText";
73
+ CommandType[CommandType["DrawTextPath"] = 30] = "DrawTextPath";
74
+ CommandType[CommandType["DrawTextBlob"] = 31] = "DrawTextBlob";
75
+ CommandType[CommandType["DrawGlyphs"] = 32] = "DrawGlyphs";
76
+ CommandType[CommandType["DrawPicture"] = 33] = "DrawPicture";
77
+ CommandType[CommandType["DrawImageSVG"] = 34] = "DrawImageSVG";
78
+ CommandType[CommandType["DrawParagraph"] = 35] = "DrawParagraph";
79
+ CommandType[CommandType["DrawAtlas"] = 36] = "DrawAtlas";
80
+ return CommandType;
81
+ }({});
82
+ export const materializeProps = command => {
83
+ "worklet";
84
+
85
+ if (command.animatedProps) {
86
+ for (const key in command.animatedProps) {
87
+ command.props[key] = command.animatedProps[key].value;
88
+ }
89
+ }
90
+ };
91
+ export const isCommand = (command, type) => {
92
+ "worklet";
93
+
94
+ return command.type === type;
95
+ };
96
+ export const isDrawCommand = (command, type) => {
97
+ "worklet";
98
+
99
+ return command.type === type;
100
+ };
101
+ //# sourceMappingURL=Core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CommandType","materializeProps","command","animatedProps","key","props","value","isCommand","type","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\nexport const materializeProps = (command: {\n props: Record<string, unknown>;\n animatedProps?: Record<string, SharedValue<unknown>>;\n}) => {\n \"worklet\";\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n command.props[key] = command.animatedProps[key].value;\n }\n }\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":"AA2BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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,GAAGF,OAAO,CAACC,aAAa,CAACC,GAAG,CAAC,CAACE,KAAK;IACvD;EACF;AACF,CAAC;AAED,OAAO,MAAMC,SAAS,GAAGA,CACvBL,OAAgB,EAChBM,IAAO,KACmB;EAC1B,SAAS;;EACT,OAAON,OAAO,CAACM,IAAI,KAAKA,IAAI;AAC9B,CAAC;AA+BD,OAAO,MAAMC,aAAa,GAAGA,CAC3BP,OAAgB,EAChBM,IAAO,KACuB;EAC9B,SAAS;;EACT,OAAON,OAAO,CAACM,IAAI,KAAKA,IAAI;AAC9B,CAAC","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import type { Skia, SkCanvas, SkColorFilter, SkPaint, SkShader, SkImageFilter, SkPathEffect } from "../../skia/types";
2
+ export declare const createDrawingContext: (Skia: Skia, paintPool: SkPaint[], canvas: SkCanvas) => {
3
+ Skia: Skia;
4
+ canvas: SkCanvas;
5
+ paints: SkPaint[];
6
+ colorFilters: SkColorFilter[];
7
+ shaders: SkShader[];
8
+ imageFilters: SkImageFilter[];
9
+ pathEffects: SkPathEffect[];
10
+ paintDeclarations: SkPaint[];
11
+ paintPool: SkPaint[];
12
+ savePaint: () => void;
13
+ saveBackdropFilter: () => void;
14
+ readonly paint: SkPaint;
15
+ restorePaint: () => SkPaint | undefined;
16
+ materializePaint: () => void;
17
+ };
18
+ export type DrawingContext = ReturnType<typeof createDrawingContext>;
@@ -0,0 +1,98 @@
1
+ export const createDrawingContext = (Skia, paintPool, canvas) => {
2
+ "worklet";
3
+
4
+ // State (formerly class fields)
5
+ const paints = [];
6
+ const colorFilters = [];
7
+ const shaders = [];
8
+ const imageFilters = [];
9
+ const pathEffects = [];
10
+ const paintDeclarations = [];
11
+ let nextPaintIndex = 1;
12
+
13
+ // Initialize first paint
14
+ paintPool[0] = Skia.Paint();
15
+ paints.push(paintPool[0]);
16
+
17
+ // Methods (formerly class methods)
18
+ const savePaint = () => {
19
+ // Get next available paint from pool or create new one if needed
20
+ if (nextPaintIndex >= paintPool.length) {
21
+ paintPool.push(Skia.Paint());
22
+ }
23
+ const nextPaint = paintPool[nextPaintIndex];
24
+ nextPaint.assign(getCurrentPaint()); // Reuse allocation by copying properties
25
+ paints.push(nextPaint);
26
+ nextPaintIndex++;
27
+ };
28
+ const saveBackdropFilter = () => {
29
+ let imageFilter = null;
30
+ const imgf = imageFilters.pop();
31
+ if (imgf) {
32
+ imageFilter = imgf;
33
+ } else {
34
+ const cf = colorFilters.pop();
35
+ if (cf) {
36
+ imageFilter = Skia.ImageFilter.MakeColorFilter(cf, null);
37
+ }
38
+ }
39
+ canvas.saveLayer(undefined, null, imageFilter);
40
+ canvas.restore();
41
+ };
42
+
43
+ // Equivalent to the `get paint()` getter in the original class
44
+ const getCurrentPaint = () => {
45
+ return paints[paints.length - 1];
46
+ };
47
+ const restorePaint = () => {
48
+ return paints.pop();
49
+ };
50
+ const materializePaint = () => {
51
+ // Color Filters
52
+ if (colorFilters.length > 0) {
53
+ getCurrentPaint().setColorFilter(colorFilters.reduceRight((inner, outer) => inner ? Skia.ColorFilter.MakeCompose(outer, inner) : outer));
54
+ }
55
+ // Shaders
56
+ if (shaders.length > 0) {
57
+ getCurrentPaint().setShader(shaders[shaders.length - 1]);
58
+ }
59
+ // Image Filters
60
+ if (imageFilters.length > 0) {
61
+ getCurrentPaint().setImageFilter(imageFilters.reduceRight((inner, outer) => inner ? Skia.ImageFilter.MakeCompose(outer, inner) : outer));
62
+ }
63
+ // Path Effects
64
+ if (pathEffects.length > 0) {
65
+ getCurrentPaint().setPathEffect(pathEffects.reduceRight((inner, outer) => inner ? Skia.PathEffect.MakeCompose(outer, inner) : outer));
66
+ }
67
+
68
+ // Clear arrays
69
+ colorFilters.length = 0;
70
+ shaders.length = 0;
71
+ imageFilters.length = 0;
72
+ pathEffects.length = 0;
73
+ };
74
+
75
+ // Return an object containing the Skia reference, the canvas, and the methods
76
+ return {
77
+ // Public fields
78
+ Skia,
79
+ canvas,
80
+ paints,
81
+ colorFilters,
82
+ shaders,
83
+ imageFilters,
84
+ pathEffects,
85
+ paintDeclarations,
86
+ paintPool,
87
+ // Public methods
88
+ savePaint,
89
+ saveBackdropFilter,
90
+ get paint() {
91
+ return paints[paints.length - 1];
92
+ },
93
+ // the "getter" for the current paint
94
+ restorePaint,
95
+ materializePaint
96
+ };
97
+ };
98
+ //# sourceMappingURL=DrawingContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createDrawingContext","Skia","paintPool","canvas","paints","colorFilters","shaders","imageFilters","pathEffects","paintDeclarations","nextPaintIndex","Paint","push","savePaint","length","nextPaint","assign","getCurrentPaint","saveBackdropFilter","imageFilter","imgf","pop","cf","ImageFilter","MakeColorFilter","saveLayer","undefined","restore","restorePaint","materializePaint","setColorFilter","reduceRight","inner","outer","ColorFilter","MakeCompose","setShader","setImageFilter","setPathEffect","PathEffect","paint"],"sources":["DrawingContext.ts"],"sourcesContent":["import type {\n Skia,\n SkCanvas,\n SkColorFilter,\n SkPaint,\n SkShader,\n SkImageFilter,\n SkPathEffect,\n} from \"../../skia/types\";\n\nexport const createDrawingContext = (\n Skia: Skia,\n paintPool: SkPaint[],\n canvas: SkCanvas\n) => {\n \"worklet\";\n\n // State (formerly class fields)\n const paints: SkPaint[] = [];\n const colorFilters: SkColorFilter[] = [];\n const shaders: SkShader[] = [];\n const imageFilters: SkImageFilter[] = [];\n const pathEffects: SkPathEffect[] = [];\n const paintDeclarations: SkPaint[] = [];\n\n let nextPaintIndex = 1;\n\n // Initialize first paint\n paintPool[0] = Skia.Paint();\n paints.push(paintPool[0]);\n\n // Methods (formerly class methods)\n const savePaint = () => {\n // Get next available paint from pool or create new one if needed\n if (nextPaintIndex >= paintPool.length) {\n paintPool.push(Skia.Paint());\n }\n\n const nextPaint = paintPool[nextPaintIndex];\n nextPaint.assign(getCurrentPaint()); // Reuse allocation by copying properties\n paints.push(nextPaint);\n nextPaintIndex++;\n };\n\n const saveBackdropFilter = () => {\n let imageFilter: SkImageFilter | null = null;\n const imgf = imageFilters.pop();\n if (imgf) {\n imageFilter = imgf;\n } else {\n const cf = colorFilters.pop();\n if (cf) {\n imageFilter = Skia.ImageFilter.MakeColorFilter(cf, null);\n }\n }\n canvas.saveLayer(undefined, null, imageFilter);\n canvas.restore();\n };\n\n // Equivalent to the `get paint()` getter in the original class\n const getCurrentPaint = () => {\n return paints[paints.length - 1];\n };\n\n const restorePaint = () => {\n return paints.pop();\n };\n\n const materializePaint = () => {\n // Color Filters\n if (colorFilters.length > 0) {\n getCurrentPaint().setColorFilter(\n colorFilters.reduceRight((inner, outer) =>\n inner ? Skia.ColorFilter.MakeCompose(outer, inner) : outer\n )\n );\n }\n // Shaders\n if (shaders.length > 0) {\n getCurrentPaint().setShader(shaders[shaders.length - 1]);\n }\n // Image Filters\n if (imageFilters.length > 0) {\n getCurrentPaint().setImageFilter(\n imageFilters.reduceRight((inner, outer) =>\n inner ? Skia.ImageFilter.MakeCompose(outer, inner) : outer\n )\n );\n }\n // Path Effects\n if (pathEffects.length > 0) {\n getCurrentPaint().setPathEffect(\n pathEffects.reduceRight((inner, outer) =>\n inner ? Skia.PathEffect.MakeCompose(outer, inner) : outer\n )\n );\n }\n\n // Clear arrays\n colorFilters.length = 0;\n shaders.length = 0;\n imageFilters.length = 0;\n pathEffects.length = 0;\n };\n\n // Return an object containing the Skia reference, the canvas, and the methods\n return {\n // Public fields\n Skia,\n canvas,\n paints,\n colorFilters,\n shaders,\n imageFilters,\n pathEffects,\n paintDeclarations,\n paintPool,\n\n // Public methods\n savePaint,\n saveBackdropFilter,\n get paint() {\n return paints[paints.length - 1];\n }, // the \"getter\" for the current paint\n restorePaint,\n materializePaint,\n };\n};\n\nexport type DrawingContext = ReturnType<typeof createDrawingContext>;\n"],"mappings":"AAUA,OAAO,MAAMA,oBAAoB,GAAGA,CAClCC,IAAU,EACVC,SAAoB,EACpBC,MAAgB,KACb;EACH,SAAS;;EAET;EACA,MAAMC,MAAiB,GAAG,EAAE;EAC5B,MAAMC,YAA6B,GAAG,EAAE;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AM,GAAG,CAAC;IAClBP,YAAY,CAACO,MAAM,GAAG,CAAC;IACvBN,WAAW,CAACM,MAAM,GAAG,CAAC;EACxB,CAAC;;EAED;EACA,OAAO;IACL;IACAb,IAAI;IACJE,MAAM;IACNC,MAAM;IACNC,YAAY;IACZC,OAAO;IACPC,YAAY;IACZC,WAAW;IACXC,iBAAiB;IACjBP,SAAS;IAET;IACAW,SAAS;IACTK,kBAAkB;IAClB,IAAIsB,KAAKA,CAAA,EAAG;MACV,OAAOpC,MAAM,CAACA,MAAM,CAACU,MAAM,GAAG,CAAC,CAAC;IAClC,CAAC;IAAE;IACHc,YAAY;IACZC;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import { type Command } from "./Core";
2
+ import type { DrawingContext } from "./DrawingContext";
3
+ export declare const replay: (ctx: DrawingContext, commands: Command[]) => void;
@@ -0,0 +1,120 @@
1
+ import { drawCircle, drawImage, drawOval, drawPath, drawPoints, drawRect, drawRRect, drawLine, drawAtlas, drawParagraph, drawImageSVG, drawPicture, drawGlyphs, drawTextBlob, drawTextPath, drawText, drawDiffRect, drawVertices, drawPatch } from "./commands/Drawing";
2
+ import { drawBox, isBoxCommand } from "./commands/Box";
3
+ import { composeColorFilters, isPushColorFilter, pushColorFilter } from "./commands/ColorFilters";
4
+ import { saveCTM } from "./commands/CTM";
5
+ import { setBlurMaskFilter, isPushImageFilter, pushImageFilter, composeImageFilters } from "./commands/ImageFilters";
6
+ import { setPaintProperties } from "./commands/Paint";
7
+ import { composePathEffects, isPushPathEffect, pushPathEffect } from "./commands/PathEffects";
8
+ import { isPushShader, pushShader } from "./commands/Shaders";
9
+ import { CommandType, isCommand, isDrawCommand, materializeProps } from "./Core";
10
+ const play = (ctx, command) => {
11
+ "worklet";
12
+
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ materializeProps(command);
15
+ if (isCommand(command, CommandType.SaveBackdropFilter)) {
16
+ ctx.saveBackdropFilter();
17
+ } else if (isCommand(command, CommandType.SaveLayer)) {
18
+ ctx.materializePaint();
19
+ const paint = ctx.paintDeclarations.pop();
20
+ ctx.canvas.saveLayer(paint);
21
+ } else if (isDrawCommand(command, CommandType.SavePaint)) {
22
+ if (command.props.paint) {
23
+ ctx.paints.push(command.props.paint);
24
+ } else {
25
+ ctx.savePaint();
26
+ setPaintProperties(ctx.Skia, ctx.paint, command.props);
27
+ }
28
+ } else if (isCommand(command, CommandType.RestorePaint)) {
29
+ ctx.restorePaint();
30
+ } else if (isCommand(command, CommandType.ComposeColorFilter)) {
31
+ composeColorFilters(ctx);
32
+ } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {
33
+ ctx.materializePaint();
34
+ const paint = ctx.restorePaint();
35
+ if (!paint) {
36
+ throw new Error("No paint declaration to push");
37
+ }
38
+ ctx.paintDeclarations.push(paint);
39
+ } else if (isCommand(command, CommandType.MaterializePaint)) {
40
+ ctx.materializePaint();
41
+ } else if (isPushColorFilter(command)) {
42
+ pushColorFilter(ctx, command);
43
+ } else if (isPushShader(command)) {
44
+ pushShader(ctx, command);
45
+ } else if (isPushImageFilter(command)) {
46
+ pushImageFilter(ctx, command);
47
+ } else if (isPushPathEffect(command)) {
48
+ pushPathEffect(ctx, command);
49
+ } else if (isCommand(command, CommandType.ComposePathEffect)) {
50
+ composePathEffects(ctx);
51
+ } else if (isCommand(command, CommandType.ComposeImageFilter)) {
52
+ composeImageFilters(ctx);
53
+ } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {
54
+ setBlurMaskFilter(ctx, command.props);
55
+ } else if (isDrawCommand(command, CommandType.SaveCTM)) {
56
+ saveCTM(ctx, command.props);
57
+ } else if (isCommand(command, CommandType.RestoreCTM)) {
58
+ ctx.canvas.restore();
59
+ } else {
60
+ const paints = [ctx.paint, ...ctx.paintDeclarations];
61
+ ctx.paintDeclarations = [];
62
+ paints.forEach(p => {
63
+ ctx.paints.push(p);
64
+ if (isBoxCommand(command)) {
65
+ drawBox(ctx, command);
66
+ } else if (isCommand(command, CommandType.DrawPaint)) {
67
+ ctx.canvas.drawPaint(ctx.paint);
68
+ } else if (isDrawCommand(command, CommandType.DrawImage)) {
69
+ drawImage(ctx, command.props);
70
+ } else if (isDrawCommand(command, CommandType.DrawCircle)) {
71
+ drawCircle(ctx, command.props);
72
+ } else if (isDrawCommand(command, CommandType.DrawPoints)) {
73
+ drawPoints(ctx, command.props);
74
+ } else if (isDrawCommand(command, CommandType.DrawPath)) {
75
+ drawPath(ctx, command.props);
76
+ } else if (isDrawCommand(command, CommandType.DrawRect)) {
77
+ drawRect(ctx, command.props);
78
+ } else if (isDrawCommand(command, CommandType.DrawRRect)) {
79
+ drawRRect(ctx, command.props);
80
+ } else if (isDrawCommand(command, CommandType.DrawOval)) {
81
+ drawOval(ctx, command.props);
82
+ } else if (isDrawCommand(command, CommandType.DrawLine)) {
83
+ drawLine(ctx, command.props);
84
+ } else if (isDrawCommand(command, CommandType.DrawPatch)) {
85
+ drawPatch(ctx, command.props);
86
+ } else if (isDrawCommand(command, CommandType.DrawVertices)) {
87
+ drawVertices(ctx, command.props);
88
+ } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {
89
+ drawDiffRect(ctx, command.props);
90
+ } else if (isDrawCommand(command, CommandType.DrawText)) {
91
+ drawText(ctx, command.props);
92
+ } else if (isDrawCommand(command, CommandType.DrawTextPath)) {
93
+ drawTextPath(ctx, command.props);
94
+ } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {
95
+ drawTextBlob(ctx, command.props);
96
+ } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {
97
+ drawGlyphs(ctx, command.props);
98
+ } else if (isDrawCommand(command, CommandType.DrawPicture)) {
99
+ drawPicture(ctx, command.props);
100
+ } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {
101
+ drawImageSVG(ctx, command.props);
102
+ } else if (isDrawCommand(command, CommandType.DrawParagraph)) {
103
+ drawParagraph(ctx, command.props);
104
+ } else if (isDrawCommand(command, CommandType.DrawAtlas)) {
105
+ drawAtlas(ctx, command.props);
106
+ } else {
107
+ console.warn(`Unknown command: ${command.type}`);
108
+ }
109
+ ctx.paints.pop();
110
+ });
111
+ }
112
+ };
113
+ export const replay = (ctx, commands) => {
114
+ "worklet";
115
+
116
+ commands.forEach(command => {
117
+ play(ctx, command);
118
+ });
119
+ };
120
+ //# sourceMappingURL=Player.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","materializeProps","play","ctx","command","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","props","paints","push","savePaint","Skia","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","forEach","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n materializeProps,\n type Command,\n} from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nconst play = (ctx: DrawingContext, command: Command) => {\n \"worklet\";\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n materializeProps(command as any);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(ctx.Skia, ctx.paint, command.props);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n const paints = [ctx.paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n};\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,SAAS,QACJ,oBAAoB;AAC3B,SAASC,OAAO,EAAEC,YAAY,QAAQ,gBAAgB;AACtD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,eAAe,QACV,yBAAyB;AAChC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,mBAAmB,QACd,yBAAyB;AAChC,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,QACT,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,UAAU,QAAQ,oBAAoB;AAC7D,SACEC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,gBAAgB,QAEX,QAAQ;AAGf,MAAMC,IAAI,GAAGA,CAACC,GAAmB,EAAEC,OAAgB,KAAK;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AAC","ignoreList":[]}
@@ -0,0 +1,50 @@
1
+ import type { SharedValue } from "react-native-reanimated";
2
+ import { NodeType } from "../../dom/types";
3
+ import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PaintProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, BoxProps, BoxShadowProps } from "../../dom/types";
4
+ import type { AnimatedProps } from "../../renderer";
5
+ import type { Command } from "./Core";
6
+ export declare class Recorder {
7
+ commands: Command[];
8
+ private processProps;
9
+ private add;
10
+ savePaint(props: AnimatedProps<PaintProps>): void;
11
+ restorePaint(): void;
12
+ restorePaintDeclaration(): void;
13
+ materializePaint(): void;
14
+ pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;
15
+ pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>): void;
16
+ pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>): void;
17
+ pushShader(shaderType: NodeType, props: AnimatedProps<unknown>): void;
18
+ pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;
19
+ composePathEffect(): void;
20
+ composeColorFilter(): void;
21
+ composeImageFilter(): void;
22
+ saveCTM(props: AnimatedProps<CTMProps>): void;
23
+ restoreCTM(): void;
24
+ drawPaint(): void;
25
+ saveLayer(): void;
26
+ saveBackdropFilter(): void;
27
+ drawBox(boxProps: AnimatedProps<BoxProps>, shadows: {
28
+ props: BoxShadowProps;
29
+ animatedProps?: Record<string, SharedValue<unknown>>;
30
+ }[]): void;
31
+ drawImage(props: AnimatedProps<ImageProps>): void;
32
+ drawCircle(props: AnimatedProps<CircleProps>): void;
33
+ drawPoints(props: AnimatedProps<PointsProps>): void;
34
+ drawPath(props: AnimatedProps<PathProps>): void;
35
+ drawRect(props: AnimatedProps<RectProps>): void;
36
+ drawRRect(props: AnimatedProps<RoundedRectProps>): void;
37
+ drawOval(props: AnimatedProps<OvalProps>): void;
38
+ drawLine(props: AnimatedProps<LineProps>): void;
39
+ drawPatch(props: AnimatedProps<PatchProps>): void;
40
+ drawVertices(props: AnimatedProps<VerticesProps>): void;
41
+ drawDiffRect(props: AnimatedProps<DiffRectProps>): void;
42
+ drawText(props: AnimatedProps<TextProps>): void;
43
+ drawTextPath(props: AnimatedProps<TextPathProps>): void;
44
+ drawTextBlob(props: AnimatedProps<TextBlobProps>): void;
45
+ drawGlyphs(props: AnimatedProps<GlyphsProps>): void;
46
+ drawPicture(props: AnimatedProps<PictureProps>): void;
47
+ drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;
48
+ drawParagraph(props: AnimatedProps<ParagraphProps>): void;
49
+ drawAtlas(props: AnimatedProps<AtlasProps>): void;
50
+ }