@shopify/react-native-skia 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (364) 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/skia/types/Paint/Paint.d.ts +1 -0
  15. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  16. package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  17. package/lib/commonjs/skia/web/JsiSkPaint.js +3 -0
  18. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  19. package/lib/commonjs/sksg/Container.d.ts +3 -2
  20. package/lib/commonjs/sksg/Container.js +32 -26
  21. package/lib/commonjs/sksg/Container.js.map +1 -1
  22. package/lib/commonjs/sksg/HostConfig.d.ts +2 -2
  23. package/lib/commonjs/sksg/HostConfig.js +7 -25
  24. package/lib/commonjs/sksg/HostConfig.js.map +1 -1
  25. package/lib/commonjs/sksg/Node.d.ts +19 -0
  26. package/lib/commonjs/sksg/Node.js +78 -0
  27. package/lib/commonjs/sksg/Node.js.map +1 -0
  28. package/lib/commonjs/sksg/Reconciler.d.ts +1 -1
  29. package/lib/commonjs/sksg/Recorder/Core.d.ts +79 -0
  30. package/lib/commonjs/sksg/Recorder/Core.js +110 -0
  31. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -0
  32. package/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +18 -0
  33. package/lib/commonjs/sksg/Recorder/DrawingContext.js +105 -0
  34. package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -0
  35. package/lib/commonjs/sksg/Recorder/Player.d.ts +3 -0
  36. package/lib/commonjs/sksg/Recorder/Player.js +127 -0
  37. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -0
  38. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +50 -0
  39. package/lib/commonjs/sksg/Recorder/Recorder.js +288 -0
  40. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -0
  41. package/lib/commonjs/sksg/Recorder/Recording.d.ts +7 -0
  42. package/lib/commonjs/sksg/Recorder/Recording.js +12 -0
  43. package/lib/commonjs/sksg/Recorder/Recording.js.map +1 -0
  44. package/lib/commonjs/sksg/Recorder/Visitor.d.ts +5 -0
  45. package/lib/commonjs/sksg/Recorder/Visitor.js +293 -0
  46. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -0
  47. package/lib/commonjs/sksg/Recorder/commands/Box.d.ts +13 -0
  48. package/lib/commonjs/sksg/Recorder/commands/Box.js +71 -0
  49. package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -0
  50. package/lib/commonjs/sksg/Recorder/commands/CTM.d.ts +3 -0
  51. package/lib/commonjs/sksg/Recorder/commands/CTM.js +79 -0
  52. package/lib/commonjs/sksg/Recorder/commands/CTM.js.map +1 -0
  53. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  54. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js +76 -0
  55. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js.map +1 -0
  56. package/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +24 -0
  57. package/lib/commonjs/sksg/{nodes/drawings.js → Recorder/commands/Drawing.js} +5 -5
  58. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -0
  59. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  60. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +183 -0
  61. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -0
  62. package/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +4 -0
  63. package/lib/commonjs/sksg/Recorder/commands/Paint.js +70 -0
  64. package/lib/commonjs/sksg/Recorder/commands/Paint.js.map +1 -0
  65. package/lib/commonjs/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  66. package/lib/commonjs/sksg/Recorder/commands/PathEffects.js +137 -0
  67. package/lib/commonjs/sksg/Recorder/commands/PathEffects.js.map +1 -0
  68. package/lib/commonjs/sksg/Recorder/commands/Shaders.d.ts +5 -0
  69. package/lib/commonjs/sksg/{nodes/shaders.js → Recorder/commands/Shaders.js} +58 -15
  70. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -0
  71. package/lib/commonjs/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  72. package/lib/commonjs/sksg/{nodes/utils.js → utils.js} +12 -2
  73. package/lib/commonjs/sksg/utils.js.map +1 -0
  74. package/lib/module/dom/types/Common.d.ts +6 -4
  75. package/lib/module/dom/types/Common.js.map +1 -1
  76. package/lib/module/dom/types/ImageFilters.d.ts +1 -1
  77. package/lib/module/dom/types/ImageFilters.js.map +1 -1
  78. package/lib/module/dom/types/Node.d.ts +0 -2
  79. package/lib/module/dom/types/Node.js.map +1 -1
  80. package/lib/module/external/reanimated/index.d.ts +0 -1
  81. package/lib/module/external/reanimated/index.js +0 -1
  82. package/lib/module/external/reanimated/index.js.map +1 -1
  83. package/lib/module/external/reanimated/renderHelpers.d.ts +0 -1
  84. package/lib/module/external/reanimated/renderHelpers.js +4 -42
  85. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  86. package/lib/module/skia/types/Paint/Paint.d.ts +1 -0
  87. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  88. package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  89. package/lib/module/skia/web/JsiSkPaint.js +3 -0
  90. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  91. package/lib/module/sksg/Container.d.ts +3 -2
  92. package/lib/module/sksg/Container.js +30 -24
  93. package/lib/module/sksg/Container.js.map +1 -1
  94. package/lib/module/sksg/HostConfig.d.ts +2 -2
  95. package/lib/module/sksg/HostConfig.js +7 -25
  96. package/lib/module/sksg/HostConfig.js.map +1 -1
  97. package/lib/module/sksg/Node.d.ts +19 -0
  98. package/lib/module/sksg/Node.js +67 -0
  99. package/lib/module/sksg/Node.js.map +1 -0
  100. package/lib/module/sksg/Reconciler.d.ts +1 -1
  101. package/lib/module/sksg/Recorder/Core.d.ts +79 -0
  102. package/lib/module/sksg/Recorder/Core.js +101 -0
  103. package/lib/module/sksg/Recorder/Core.js.map +1 -0
  104. package/lib/module/sksg/Recorder/DrawingContext.d.ts +18 -0
  105. package/lib/module/sksg/Recorder/DrawingContext.js +98 -0
  106. package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -0
  107. package/lib/module/sksg/Recorder/Player.d.ts +3 -0
  108. package/lib/module/sksg/Recorder/Player.js +120 -0
  109. package/lib/module/sksg/Recorder/Player.js.map +1 -0
  110. package/lib/module/sksg/Recorder/Recorder.d.ts +50 -0
  111. package/lib/module/sksg/Recorder/Recorder.js +281 -0
  112. package/lib/module/sksg/Recorder/Recorder.js.map +1 -0
  113. package/lib/module/sksg/Recorder/Recording.d.ts +7 -0
  114. package/lib/module/sksg/Recorder/Recording.js +5 -0
  115. package/lib/module/sksg/Recorder/Recording.js.map +1 -0
  116. package/lib/module/sksg/Recorder/Visitor.d.ts +5 -0
  117. package/lib/module/sksg/Recorder/Visitor.js +285 -0
  118. package/lib/module/sksg/Recorder/Visitor.js.map +1 -0
  119. package/lib/module/sksg/Recorder/commands/Box.d.ts +13 -0
  120. package/lib/module/sksg/Recorder/commands/Box.js +63 -0
  121. package/lib/module/sksg/Recorder/commands/Box.js.map +1 -0
  122. package/lib/module/sksg/Recorder/commands/CTM.d.ts +3 -0
  123. package/lib/module/sksg/Recorder/commands/CTM.js +72 -0
  124. package/lib/module/sksg/Recorder/commands/CTM.js.map +1 -0
  125. package/lib/module/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  126. package/lib/module/sksg/Recorder/commands/ColorFilters.js +67 -0
  127. package/lib/module/sksg/Recorder/commands/ColorFilters.js.map +1 -0
  128. package/lib/module/sksg/Recorder/commands/Drawing.d.ts +24 -0
  129. package/lib/module/sksg/{nodes/drawings.js → Recorder/commands/Drawing.js} +5 -5
  130. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -0
  131. package/lib/module/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  132. package/lib/module/sksg/{nodes/imageFilters.js → Recorder/commands/ImageFilters.js} +87 -95
  133. package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -0
  134. package/lib/module/sksg/Recorder/commands/Paint.d.ts +4 -0
  135. package/lib/module/sksg/Recorder/commands/Paint.js +62 -0
  136. package/lib/module/sksg/Recorder/commands/Paint.js.map +1 -0
  137. package/lib/module/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  138. package/lib/module/sksg/Recorder/commands/PathEffects.js +128 -0
  139. package/lib/module/sksg/Recorder/commands/PathEffects.js.map +1 -0
  140. package/lib/module/sksg/Recorder/commands/Shaders.d.ts +5 -0
  141. package/lib/module/sksg/{nodes/shaders.js → Recorder/commands/Shaders.js} +63 -13
  142. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -0
  143. package/lib/module/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  144. package/lib/module/sksg/{nodes/utils.js → utils.js} +10 -1
  145. package/lib/module/sksg/utils.js.map +1 -0
  146. package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -1
  147. package/lib/typescript/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  148. package/lib/typescript/lib/commonjs/sksg/Container.d.ts +4 -0
  149. package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +1 -3
  150. package/lib/typescript/lib/commonjs/sksg/Node.d.ts +14 -0
  151. package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +5 -0
  152. package/lib/typescript/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +17 -0
  153. package/lib/typescript/lib/commonjs/sksg/Recorder/Player.d.ts +2 -0
  154. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +45 -0
  155. package/lib/typescript/lib/commonjs/sksg/Recorder/Recording.d.ts +5 -0
  156. package/lib/typescript/lib/commonjs/sksg/Recorder/Visitor.d.ts +27 -0
  157. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Box.d.ts +3 -0
  158. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/CTM.d.ts +2 -0
  159. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/ColorFilters.d.ts +4 -0
  160. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/ImageFilters.d.ts +6 -0
  161. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +14 -0
  162. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/PathEffects.d.ts +4 -0
  163. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Shaders.d.ts +3 -0
  164. package/lib/typescript/lib/commonjs/sksg/{nodes/utils.d.ts → utils.d.ts} +1 -0
  165. package/lib/typescript/lib/module/external/reanimated/index.d.ts +0 -1
  166. package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +0 -1
  167. package/lib/typescript/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  168. package/lib/typescript/lib/module/sksg/Container.d.ts +4 -0
  169. package/lib/typescript/lib/module/sksg/HostConfig.d.ts +1 -3
  170. package/lib/typescript/lib/module/sksg/Node.d.ts +13 -0
  171. package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +4 -0
  172. package/lib/typescript/lib/module/sksg/Recorder/DrawingContext.d.ts +16 -0
  173. package/lib/typescript/lib/module/sksg/Recorder/Player.d.ts +1 -0
  174. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +44 -0
  175. package/lib/typescript/lib/module/sksg/Recorder/Recording.d.ts +4 -0
  176. package/lib/typescript/lib/module/sksg/Recorder/Visitor.d.ts +26 -0
  177. package/lib/typescript/lib/module/sksg/Recorder/commands/Box.d.ts +2 -0
  178. package/lib/typescript/lib/module/sksg/Recorder/commands/CTM.d.ts +1 -0
  179. package/lib/typescript/lib/module/sksg/Recorder/commands/ColorFilters.d.ts +3 -0
  180. package/lib/typescript/lib/module/sksg/Recorder/commands/ImageFilters.d.ts +5 -0
  181. package/lib/typescript/lib/module/sksg/Recorder/commands/Paint.d.ts +13 -0
  182. package/lib/typescript/lib/module/sksg/Recorder/commands/PathEffects.d.ts +3 -0
  183. package/lib/typescript/lib/module/sksg/Recorder/commands/Shaders.d.ts +2 -0
  184. package/lib/typescript/lib/module/sksg/{nodes/utils.d.ts → utils.d.ts} +1 -0
  185. package/lib/typescript/src/dom/types/Common.d.ts +6 -4
  186. package/lib/typescript/src/dom/types/ImageFilters.d.ts +1 -1
  187. package/lib/typescript/src/dom/types/Node.d.ts +0 -2
  188. package/lib/typescript/src/external/reanimated/index.d.ts +0 -1
  189. package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +0 -1
  190. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +1 -0
  191. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  192. package/lib/typescript/src/sksg/Container.d.ts +3 -2
  193. package/lib/typescript/src/sksg/HostConfig.d.ts +2 -2
  194. package/lib/typescript/src/sksg/Node.d.ts +19 -0
  195. package/lib/typescript/src/sksg/Reconciler.d.ts +1 -1
  196. package/lib/typescript/src/sksg/Recorder/Core.d.ts +79 -0
  197. package/lib/typescript/src/sksg/Recorder/DrawingContext.d.ts +18 -0
  198. package/lib/typescript/src/sksg/Recorder/Player.d.ts +3 -0
  199. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +50 -0
  200. package/lib/typescript/src/sksg/Recorder/Recording.d.ts +7 -0
  201. package/lib/typescript/src/sksg/Recorder/Visitor.d.ts +5 -0
  202. package/lib/typescript/src/sksg/Recorder/commands/Box.d.ts +13 -0
  203. package/lib/typescript/src/sksg/Recorder/commands/CTM.d.ts +3 -0
  204. package/lib/typescript/src/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  205. package/lib/typescript/src/sksg/Recorder/commands/Drawing.d.ts +24 -0
  206. package/lib/typescript/src/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  207. package/lib/typescript/src/sksg/Recorder/commands/Paint.d.ts +4 -0
  208. package/lib/typescript/src/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  209. package/lib/typescript/src/sksg/Recorder/commands/Shaders.d.ts +5 -0
  210. package/lib/typescript/src/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  211. package/package.json +1 -1
  212. package/src/__tests__/snapshots/image-filter/test-shadow.png +0 -0
  213. package/src/dom/types/Common.ts +7 -5
  214. package/src/dom/types/ImageFilters.ts +2 -1
  215. package/src/dom/types/Node.ts +0 -4
  216. package/src/external/reanimated/index.ts +0 -1
  217. package/src/external/reanimated/renderHelpers.ts +4 -44
  218. package/src/renderer/__tests__/e2e/ColorFilters.spec.tsx +15 -0
  219. package/src/renderer/__tests__/e2e/Composition/ColorFilterComposition.spec.tsx +23 -2
  220. package/src/renderer/__tests__/e2e/ImageFilters.spec.tsx +91 -2
  221. package/src/renderer/__tests__/setup.tsx +1 -1
  222. package/src/skia/types/Paint/Paint.ts +2 -0
  223. package/src/skia/web/JsiSkPaint.ts +4 -0
  224. package/src/sksg/Container.ts +35 -29
  225. package/src/sksg/HostConfig.ts +5 -50
  226. package/src/sksg/Node.ts +105 -0
  227. package/src/sksg/Recorder/Core.ts +171 -0
  228. package/src/sksg/Recorder/DrawingContext.ts +130 -0
  229. package/src/sksg/Recorder/Player.ts +160 -0
  230. package/src/sksg/Recorder/Recorder.ts +259 -0
  231. package/src/sksg/Recorder/Recording.ts +13 -0
  232. package/src/sksg/Recorder/Visitor.ts +324 -0
  233. package/src/sksg/Recorder/commands/Box.ts +63 -0
  234. package/src/sksg/Recorder/commands/CTM.ts +72 -0
  235. package/src/sksg/Recorder/commands/ColorFilters.ts +87 -0
  236. package/src/sksg/{nodes/drawings.ts → Recorder/commands/Drawing.ts} +29 -65
  237. package/src/sksg/Recorder/commands/ImageFilters.ts +255 -0
  238. package/src/sksg/Recorder/commands/Paint.ts +77 -0
  239. package/src/sksg/Recorder/commands/PathEffects.ts +169 -0
  240. package/src/sksg/{nodes/shaders.ts → Recorder/commands/Shaders.ts} +100 -26
  241. package/src/sksg/{nodes/utils.ts → utils.ts} +14 -1
  242. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  243. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +0 -24
  244. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +0 -1
  245. package/lib/commonjs/sksg/DeclarationContext.d.ts +0 -56
  246. package/lib/commonjs/sksg/DeclarationContext.js +0 -77
  247. package/lib/commonjs/sksg/DeclarationContext.js.map +0 -1
  248. package/lib/commonjs/sksg/DrawingContext.d.ts +0 -13
  249. package/lib/commonjs/sksg/DrawingContext.js +0 -172
  250. package/lib/commonjs/sksg/DrawingContext.js.map +0 -1
  251. package/lib/commonjs/sksg/__tests__/Declarations.spec.d.ts +0 -1
  252. package/lib/commonjs/sksg/__tests__/MockDeclaration.d.ts +0 -57
  253. package/lib/commonjs/sksg/nodes/Node.d.ts +0 -7
  254. package/lib/commonjs/sksg/nodes/Node.js +0 -6
  255. package/lib/commonjs/sksg/nodes/Node.js.map +0 -1
  256. package/lib/commonjs/sksg/nodes/colorFilters.d.ts +0 -10
  257. package/lib/commonjs/sksg/nodes/colorFilters.js +0 -79
  258. package/lib/commonjs/sksg/nodes/colorFilters.js.map +0 -1
  259. package/lib/commonjs/sksg/nodes/context.d.ts +0 -3
  260. package/lib/commonjs/sksg/nodes/context.js +0 -394
  261. package/lib/commonjs/sksg/nodes/context.js.map +0 -1
  262. package/lib/commonjs/sksg/nodes/drawings.d.ts +0 -30
  263. package/lib/commonjs/sksg/nodes/drawings.js.map +0 -1
  264. package/lib/commonjs/sksg/nodes/imageFilters.d.ts +0 -17
  265. package/lib/commonjs/sksg/nodes/imageFilters.js +0 -197
  266. package/lib/commonjs/sksg/nodes/imageFilters.js.map +0 -1
  267. package/lib/commonjs/sksg/nodes/index.d.ts +0 -3
  268. package/lib/commonjs/sksg/nodes/index.js +0 -39
  269. package/lib/commonjs/sksg/nodes/index.js.map +0 -1
  270. package/lib/commonjs/sksg/nodes/paint.d.ts +0 -3
  271. package/lib/commonjs/sksg/nodes/paint.js +0 -81
  272. package/lib/commonjs/sksg/nodes/paint.js.map +0 -1
  273. package/lib/commonjs/sksg/nodes/pathEffects.d.ts +0 -11
  274. package/lib/commonjs/sksg/nodes/pathEffects.js +0 -111
  275. package/lib/commonjs/sksg/nodes/pathEffects.js.map +0 -1
  276. package/lib/commonjs/sksg/nodes/shaders.d.ts +0 -11
  277. package/lib/commonjs/sksg/nodes/shaders.js.map +0 -1
  278. package/lib/commonjs/sksg/nodes/utils.js.map +0 -1
  279. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  280. package/lib/module/external/reanimated/useDerivedValueOnJS.js +0 -16
  281. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +0 -1
  282. package/lib/module/sksg/DeclarationContext.d.ts +0 -56
  283. package/lib/module/sksg/DeclarationContext.js +0 -69
  284. package/lib/module/sksg/DeclarationContext.js.map +0 -1
  285. package/lib/module/sksg/DrawingContext.d.ts +0 -13
  286. package/lib/module/sksg/DrawingContext.js +0 -165
  287. package/lib/module/sksg/DrawingContext.js.map +0 -1
  288. package/lib/module/sksg/__tests__/Declarations.spec.d.ts +0 -1
  289. package/lib/module/sksg/__tests__/MockDeclaration.d.ts +0 -57
  290. package/lib/module/sksg/nodes/Node.d.ts +0 -7
  291. package/lib/module/sksg/nodes/Node.js +0 -2
  292. package/lib/module/sksg/nodes/Node.js.map +0 -1
  293. package/lib/module/sksg/nodes/colorFilters.d.ts +0 -10
  294. package/lib/module/sksg/nodes/colorFilters.js +0 -66
  295. package/lib/module/sksg/nodes/colorFilters.js.map +0 -1
  296. package/lib/module/sksg/nodes/context.d.ts +0 -3
  297. package/lib/module/sksg/nodes/context.js +0 -387
  298. package/lib/module/sksg/nodes/context.js.map +0 -1
  299. package/lib/module/sksg/nodes/drawings.d.ts +0 -30
  300. package/lib/module/sksg/nodes/drawings.js.map +0 -1
  301. package/lib/module/sksg/nodes/imageFilters.d.ts +0 -17
  302. package/lib/module/sksg/nodes/imageFilters.js.map +0 -1
  303. package/lib/module/sksg/nodes/index.d.ts +0 -3
  304. package/lib/module/sksg/nodes/index.js +0 -4
  305. package/lib/module/sksg/nodes/index.js.map +0 -1
  306. package/lib/module/sksg/nodes/paint.d.ts +0 -3
  307. package/lib/module/sksg/nodes/paint.js +0 -74
  308. package/lib/module/sksg/nodes/paint.js.map +0 -1
  309. package/lib/module/sksg/nodes/pathEffects.d.ts +0 -11
  310. package/lib/module/sksg/nodes/pathEffects.js +0 -97
  311. package/lib/module/sksg/nodes/pathEffects.js.map +0 -1
  312. package/lib/module/sksg/nodes/shaders.d.ts +0 -11
  313. package/lib/module/sksg/nodes/shaders.js.map +0 -1
  314. package/lib/module/sksg/nodes/utils.js.map +0 -1
  315. package/lib/typescript/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +0 -2
  316. package/lib/typescript/lib/commonjs/sksg/DeclarationContext.d.ts +0 -53
  317. package/lib/typescript/lib/commonjs/sksg/DrawingContext.d.ts +0 -22
  318. package/lib/typescript/lib/commonjs/sksg/nodes/Node.d.ts +0 -1
  319. package/lib/typescript/lib/commonjs/sksg/nodes/colorFilters.d.ts +0 -8
  320. package/lib/typescript/lib/commonjs/sksg/nodes/context.d.ts +0 -2
  321. package/lib/typescript/lib/commonjs/sksg/nodes/imageFilters.d.ts +0 -12
  322. package/lib/typescript/lib/commonjs/sksg/nodes/index.d.ts +0 -1
  323. package/lib/typescript/lib/commonjs/sksg/nodes/paint.d.ts +0 -2
  324. package/lib/typescript/lib/commonjs/sksg/nodes/pathEffects.d.ts +0 -9
  325. package/lib/typescript/lib/commonjs/sksg/nodes/shaders.d.ts +0 -10
  326. package/lib/typescript/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  327. package/lib/typescript/lib/module/sksg/DeclarationContext.d.ts +0 -52
  328. package/lib/typescript/lib/module/sksg/DrawingContext.d.ts +0 -21
  329. package/lib/typescript/lib/module/sksg/nodes/Node.d.ts +0 -1
  330. package/lib/typescript/lib/module/sksg/nodes/colorFilters.d.ts +0 -7
  331. package/lib/typescript/lib/module/sksg/nodes/context.d.ts +0 -1
  332. package/lib/typescript/lib/module/sksg/nodes/imageFilters.d.ts +0 -11
  333. package/lib/typescript/lib/module/sksg/nodes/index.d.ts +0 -3
  334. package/lib/typescript/lib/module/sksg/nodes/paint.d.ts +0 -1
  335. package/lib/typescript/lib/module/sksg/nodes/pathEffects.d.ts +0 -8
  336. package/lib/typescript/lib/module/sksg/nodes/shaders.d.ts +0 -9
  337. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  338. package/lib/typescript/src/sksg/DeclarationContext.d.ts +0 -56
  339. package/lib/typescript/src/sksg/DrawingContext.d.ts +0 -13
  340. package/lib/typescript/src/sksg/__tests__/Declarations.spec.d.ts +0 -1
  341. package/lib/typescript/src/sksg/__tests__/MockDeclaration.d.ts +0 -57
  342. package/lib/typescript/src/sksg/nodes/Node.d.ts +0 -7
  343. package/lib/typescript/src/sksg/nodes/colorFilters.d.ts +0 -10
  344. package/lib/typescript/src/sksg/nodes/context.d.ts +0 -3
  345. package/lib/typescript/src/sksg/nodes/drawings.d.ts +0 -30
  346. package/lib/typescript/src/sksg/nodes/imageFilters.d.ts +0 -17
  347. package/lib/typescript/src/sksg/nodes/index.d.ts +0 -3
  348. package/lib/typescript/src/sksg/nodes/paint.d.ts +0 -3
  349. package/lib/typescript/src/sksg/nodes/pathEffects.d.ts +0 -11
  350. package/lib/typescript/src/sksg/nodes/shaders.d.ts +0 -11
  351. package/src/external/reanimated/useDerivedValueOnJS.ts +0 -20
  352. package/src/sksg/DeclarationContext.ts +0 -85
  353. package/src/sksg/DrawingContext.ts +0 -226
  354. package/src/sksg/__tests__/Declarations.spec.tsx +0 -235
  355. package/src/sksg/__tests__/MockDeclaration.ts +0 -138
  356. package/src/sksg/nodes/Node.ts +0 -8
  357. package/src/sksg/nodes/colorFilters.ts +0 -79
  358. package/src/sksg/nodes/context.ts +0 -412
  359. package/src/sksg/nodes/imageFilters.ts +0 -235
  360. package/src/sksg/nodes/index.ts +0 -3
  361. package/src/sksg/nodes/paint.ts +0 -75
  362. package/src/sksg/nodes/pathEffects.ts +0 -118
  363. /package/lib/typescript/lib/commonjs/sksg/{nodes/drawings.d.ts → Recorder/commands/Drawing.d.ts} +0 -0
  364. /package/lib/typescript/lib/module/sksg/{nodes/drawings.d.ts → Recorder/commands/Drawing.d.ts} +0 -0
@@ -2,21 +2,26 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  import Rea from "../external/reanimated/ReanimatedProxy";
5
- import { HAS_REANIMATED, HAS_REANIMATED_3 } from "../external/reanimated/renderHelpers";
6
- import { createDrawingContext } from "./DrawingContext";
7
- import { draw, isSharedValue } from "./nodes";
8
- const drawOnscreen = (Skia, nativeId, root) => {
5
+ import { isSharedValue } from "./utils";
6
+ import { Recorder } from "./Recorder/Recorder";
7
+ import { visit } from "./Recorder/Visitor";
8
+ import { replay } from "./Recorder/Player";
9
+ import { createDrawingContext } from "./Recorder/DrawingContext";
10
+ import { createRecording } from "./Recorder/Recording";
11
+ const drawOnscreen = (Skia, nativeId, recording) => {
9
12
  "worklet";
10
13
 
11
14
  const rec = Skia.PictureRecorder();
12
15
  const canvas = rec.beginRecording();
13
- // TODO: This is only support from 3.15 and above (check the exact version)
14
- // This could be polyfilled in C++ if needed (or in JS via functions only?)
15
- const ctx = createDrawingContext(Skia, canvas);
16
- root.forEach(node => {
17
- draw(ctx, node);
18
- });
16
+ // const start = performance.now();
17
+
18
+ // TODO: because the pool is not a shared value here, it is copied on every frame
19
+ const ctx = createDrawingContext(Skia, recording.paintPool, canvas);
20
+ //console.log(recording.commands);
21
+ replay(ctx, recording.commands);
19
22
  const picture = rec.finishRecordingAsPicture();
23
+ //const end = performance.now();
24
+ //console.log("Recording time: ", end - start);
20
25
  SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
21
26
  };
22
27
  export class Container {
@@ -24,6 +29,7 @@ export class Container {
24
29
  this.Skia = Skia;
25
30
  this.nativeId = nativeId;
26
31
  _defineProperty(this, "_root", []);
32
+ _defineProperty(this, "_recording", null);
27
33
  _defineProperty(this, "unmounted", false);
28
34
  _defineProperty(this, "values", new Set());
29
35
  _defineProperty(this, "mapperId", null);
@@ -33,41 +39,39 @@ export class Container {
33
39
  }
34
40
  set root(root) {
35
41
  const isOnscreen = this.nativeId !== -1;
36
- if (HAS_REANIMATED && !HAS_REANIMATED_3) {
37
- throw new Error("React Native Skia only supports Reanimated 3 and above");
38
- }
39
42
  if (isOnscreen) {
40
43
  if (this.mapperId !== null) {
41
44
  Rea.stopMapper(this.mapperId);
42
45
  }
43
46
  const {
44
47
  nativeId,
45
- Skia
48
+ Skia,
49
+ _recording
46
50
  } = this;
47
51
  this.mapperId = Rea.startMapper(() => {
48
52
  "worklet";
49
53
 
50
- drawOnscreen(Skia, nativeId, root);
54
+ drawOnscreen(Skia, nativeId, _recording);
51
55
  }, Array.from(this.values));
52
56
  }
53
57
  this._root = root;
58
+ const recorder = new Recorder();
59
+ visit(recorder, root);
60
+ this._recording = createRecording(recorder.commands);
54
61
  }
55
62
  clear() {
56
63
  console.log("clear container");
57
64
  }
58
65
  redraw() {
59
66
  const isOnscreen = this.nativeId !== -1;
60
- if (HAS_REANIMATED && !HAS_REANIMATED_3) {
61
- throw new Error("React Native Skia only supports Reanimated 3 and above");
62
- }
63
67
  if (isOnscreen) {
64
68
  const {
65
69
  nativeId,
66
70
  Skia,
67
- root
71
+ _recording
68
72
  } = this;
69
73
  Rea.runOnUI(() => {
70
- drawOnscreen(Skia, nativeId, root);
74
+ drawOnscreen(Skia, nativeId, _recording);
71
75
  })();
72
76
  }
73
77
  }
@@ -85,10 +89,12 @@ export class Container {
85
89
  });
86
90
  }
87
91
  drawOnCanvas(canvas) {
88
- const ctx = createDrawingContext(this.Skia, canvas);
89
- this.root.forEach(node => {
90
- draw(ctx, node);
91
- });
92
+ if (!this._recording) {
93
+ throw new Error("No recording to draw");
94
+ }
95
+ const ctx = createDrawingContext(this.Skia, this._recording.paintPool, canvas);
96
+ //console.log(this._recording);
97
+ replay(ctx, this._recording.commands);
92
98
  }
93
99
  }
94
100
  //# sourceMappingURL=Container.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Rea","HAS_REANIMATED","HAS_REANIMATED_3","createDrawingContext","draw","isSharedValue","drawOnscreen","Skia","nativeId","root","rec","PictureRecorder","canvas","beginRecording","ctx","forEach","node","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","Container","constructor","_defineProperty","Set","_root","isOnscreen","Error","mapperId","stopMapper","startMapper","Array","from","values","clear","console","log","redraw","runOnUI","getNativeId","unregisterValues","Object","filter","value","delete","registerValues","add","drawOnCanvas"],"sources":["Container.ts"],"sourcesContent":["import { type SharedValue } from \"react-native-reanimated\";\n\nimport Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\nimport {\n HAS_REANIMATED,\n HAS_REANIMATED_3,\n} from \"../external/reanimated/renderHelpers\";\n\nimport { createDrawingContext } from \"./DrawingContext\";\nimport type { Node } from \"./nodes\";\nimport { draw, isSharedValue } from \"./nodes\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, root: Node[]) => {\n \"worklet\";\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n // TODO: This is only support from 3.15 and above (check the exact version)\n // This could be polyfilled in C++ if needed (or in JS via functions only?)\n const ctx = createDrawingContext(Skia, canvas);\n root.forEach((node) => {\n draw(ctx, node);\n });\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nexport class Container {\n public _root: Node[] = [];\n public unmounted = false;\n\n private values = new Set<SharedValue<unknown>>();\n private mapperId: number | null = null;\n\n constructor(public Skia: Skia, private nativeId: number) {}\n\n get root() {\n return this._root;\n }\n\n set root(root: Node[]) {\n const isOnscreen = this.nativeId !== -1;\n if (HAS_REANIMATED && !HAS_REANIMATED_3) {\n throw new Error(\"React Native Skia only supports Reanimated 3 and above\");\n }\n if (isOnscreen) {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n const { nativeId, Skia } = this;\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, root);\n }, Array.from(this.values));\n }\n this._root = root;\n }\n\n clear() {\n console.log(\"clear container\");\n }\n\n redraw() {\n const isOnscreen = this.nativeId !== -1;\n if (HAS_REANIMATED && !HAS_REANIMATED_3) {\n throw new Error(\"React Native Skia only supports Reanimated 3 and above\");\n }\n if (isOnscreen) {\n const { nativeId, Skia, root } = this;\n Rea.runOnUI(() => {\n drawOnscreen(Skia, nativeId, root);\n })();\n }\n }\n\n getNativeId() {\n return this.nativeId;\n }\n\n unregisterValues(values: object) {\n Object.values(values)\n .filter(isSharedValue)\n .forEach((value) => {\n this.values.delete(value);\n });\n }\n\n registerValues(values: object) {\n Object.values(values)\n .filter(isSharedValue)\n .forEach((value) => {\n this.values.add(value);\n });\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n const ctx = createDrawingContext(this.Skia, canvas);\n this.root.forEach((node) => {\n draw(ctx, node);\n });\n }\n}\n"],"mappings":";;;AAEA,OAAOA,GAAG,MAAM,wCAAwC;AAExD,SACEC,cAAc,EACdC,gBAAgB,QACX,sCAAsC;AAE7C,SAASC,oBAAoB,QAAQ,kBAAkB;AAEvD,SAASC,IAAI,EAAEC,aAAa,QAAQ,SAAS;AAE7C,MAAMC,YAAY,GAAGA,CAACC,IAAU,EAAEC,QAAgB,EAAEC,IAAY,KAAK;EACnE,SAAS;;EACT,MAAMC,GAAG,GAAGH,IAAI,CAACI,eAAe,CAAC,CAAC;EAClC,MAAMC,MAAM,GAAGF,GAAG,CAACG,cAAc,CAAC,CAAC;EACnC;EACA;EACA,MAAMC,GAAG,GAAGX,oBAAoB,CAACI,IAAI,EAAEK,MAAM,CAAC;EAC9CH,IAAI,CAACM,OAAO,CAAEC,IAAI,IAAK;IACrBZ,IAAI,CAACU,GAAG,EAAEE,IAAI,CAAC;EACjB,CAAC,CAAC;EACF,MAAMC,OAAO,GAAGP,GAAG,CAACQ,wBAAwB,CAAC,CAAC;EAC9CC,WAAW,CAACC,cAAc,CAACZ,QAAQ,EAAE,SAAS,EAAES,OAAO,CAAC;AAC1D,CAAC;AAED,OAAO,MAAMI,SAAS,CAAC;EAOrBC,WAAWA,CAAQf,IAAU,EAAUC,QAAgB,EAAE;IAAA,KAAtCD,IAAU,GAAVA,IAAU;IAAA,KAAUC,QAAgB,GAAhBA,QAAgB;IAAAe,eAAA,gBANhC,EAAE;IAAAA,eAAA,oBACN,KAAK;IAAAA,eAAA,iBAEP,IAAIC,GAAG,CAAuB,CAAC;IAAAD,eAAA,mBACd,IAAI;EAEoB;EAE1D,IAAId,IAAIA,CAAA,EAAG;I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OAAO,IAAI,CAAC/B,QAAQ;EACtB;EAEAgC,gBAAgBA,CAACP,MAAc,EAAE;IAC/BQ,MAAM,CAACR,MAAM,CAACA,MAAM,CAAC,CAClBS,MAAM,CAACrC,aAAa,CAAC,CACrBU,OAAO,CAAE4B,KAAK,IAAK;MAClB,IAAI,CAACV,MAAM,CAACW,MAAM,CAACD,KAAK,CAAC;IAC3B,CAAC,CAAC;EACN;EAEAE,cAAcA,CAACZ,MAAc,EAAE;IAC7BQ,MAAM,CAACR,MAAM,CAACA,MAAM,CAAC,CAClBS,MAAM,CAACrC,aAAa,CAAC,CACrBU,OAAO,CAAE4B,KAAK,IAAK;MAClB,IAAI,CAACV,MAAM,CAACa,GAAG,CAACH,KAAK,CAAC;IACxB,CAAC,CAAC;EACN;EAEAI,YAAYA,CAACnC,MAAgB,EAAE;IAC7B,MAAME,GAAG,GAAGX,oBAAoB,CAAC,IAAI,CAACI,IAAI,EAAEK,MAAM,CAAC;IACnD,IAAI,CAACH,IAAI,CAACM,OAAO,CAAEC,IAAI,IAAK;MAC1BZ,IAAI,CAACU,GAAG,EAAEE,IAAI,CAAC;IACjB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"names":["Rea","isSharedValue","Recorder","visit","replay","createDrawingContext","createRecording","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","paintPool","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","Container","constructor","_defineProperty","Set","root","_root","isOnscreen","mapperId","stopMapper","_recording","startMapper","Array","from","values","recorder","clear","console","log","redraw","runOnUI","getNativeId","unregisterValues","Object","filter","forEach","value","delete","registerValues","add","drawOnCanvas","Error"],"sources":["Container.ts"],"sourcesContent":["import { type SharedValue } from \"react-native-reanimated\";\n\nimport Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\n\nimport type { Node } from \"./Node\";\nimport { isSharedValue } from \"./utils\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\nimport { createRecording, type Recording } from \"./Recorder/Recording\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n // const start = performance.now();\n\n // TODO: because the pool is not a shared value here, it is copied on every frame\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n //console.log(recording.commands);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nexport class Container {\n private _root: Node[] = [];\n private _recording: Recording | null = null;\n public unmounted = false;\n\n private values = new Set<SharedValue<unknown>>();\n private mapperId: number | null = null;\n\n constructor(public Skia: Skia, private nativeId: number) {}\n\n get root() {\n return this._root;\n }\n\n set root(root: Node[]) {\n const isOnscreen = this.nativeId !== -1;\n if (isOnscreen) {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n const { nativeId, Skia, _recording } = this;\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, _recording!);\n }, Array.from(this.values));\n }\n this._root = root;\n const recorder = new Recorder();\n visit(recorder, root);\n this._recording = createRecording(recorder.commands);\n }\n\n clear() {\n console.log(\"clear container\");\n }\n\n redraw() {\n const isOnscreen = this.nativeId !== -1;\n if (isOnscreen) {\n const { nativeId, Skia, _recording } = this;\n Rea.runOnUI(() => {\n drawOnscreen(Skia, nativeId, _recording!);\n })();\n }\n }\n\n getNativeId() {\n return this.nativeId;\n }\n\n unregisterValues(values: object) {\n Object.values(values)\n .filter(isSharedValue)\n .forEach((value) => {\n this.values.delete(value);\n });\n }\n\n registerValues(values: object) {\n Object.values(values)\n .filter(isSharedValue)\n .forEach((value) => {\n this.values.add(value);\n });\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this._recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this._recording.paintPool,\n canvas\n );\n //console.log(this._recording);\n replay(ctx, this._recording.commands);\n }\n}\n"],"mappings":";;;AAEA,OAAOA,GAAG,MAAM,wCAAwC;AAIxD,SAASC,aAAa,QAAQ,SAAS;AACvC,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,eAAe,QAAwB,sBAAsB;AAEtE,MAAMC,YAAY,GAAGA,CAACC,IAAU,EAAEC,QAAgB,EAAEC,SAAoB,KAAK;EAC3E,SAAS;;EACT,MAAMC,GAAG,GAAGH,IAAI,CAACI,eAAe,CAAC,CAAC;EAClC,MAAMC,MAAM,GAAGF,GAAG,CAACG,cAAc,CAAC,CAAC;EACnC;;EAEA;EACA,MAAMC,GAAG,GAAGV,oBAAoB,CAACG,IAAI,EAAEE,SAAS,CAACM,SAAS,EAAEH,MAAM,CAAC;EACnE;EACAT,MAAM,CAACW,GAAG,EAAEL,SAAS,CAACO,QAAQ,CAAC;EAC/B,MAAMC,OAAO,GAAGP,GAAG,CAACQ,wBAAwB,CAAC,CAAC;EAC9C;EACA;EACAC,WAAW,CAACC,cAAc,CAACZ,QAAQ,EAAE,SAAS,EAAES,OAAO,CAAC;AAC1D,CAAC;AAED,OAAO,MAAMI,SAAS,CAAC;EAQrBC,WAAWA,CAAQf,IAAU,EAAUC,QAAgB,EAAE;IAAA,KAAtCD,IAAU,GAAVA,IAAU;IAAA,KAAUC,QAAgB,GAAhBA,QAAgB;IAAAe,eAAA,gBAP/B,EAAE;IAAAA,eAAA,qBACa,IAAI;IAAAA,eAAA,oBACxB,KAAK;IAAAA,eAAA,iBAEP,IAAIC,GAAG,CAAuB,CAAC;IAAA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AC,CAAC,CAAC;IACN;EACF;EAEAW,WAAWA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACjC,QAAQ;EACtB;EAEAkC,gBAAgBA,CAACR,MAAc,EAAE;IAC/BS,MAAM,CAACT,MAAM,CAACA,MAAM,CAAC,CAClBU,MAAM,CAAC5C,aAAa,CAAC,CACrB6C,OAAO,CAAEC,KAAK,IAAK;MAClB,IAAI,CAACZ,MAAM,CAACa,MAAM,CAACD,KAAK,CAAC;IAC3B,CAAC,CAAC;EACN;EAEAE,cAAcA,CAACd,MAAc,EAAE;IAC7BS,MAAM,CAACT,MAAM,CAACA,MAAM,CAAC,CAClBU,MAAM,CAAC5C,aAAa,CAAC,CACrB6C,OAAO,CAAEC,KAAK,IAAK;MAClB,IAAI,CAACZ,MAAM,CAACe,GAAG,CAACH,KAAK,CAAC;IACxB,CAAC,CAAC;EACN;EAEAI,YAAYA,CAACtC,MAAgB,EAAE;IAC7B,IAAI,CAAC,IAAI,CAACkB,UAAU,EAAE;MACpB,MAAM,IAAIqB,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,MAAMrC,GAAG,GAAGV,oBAAoB,CAC9B,IAAI,CAACG,IAAI,EACT,IAAI,CAACuB,UAAU,CAACf,SAAS,EACzBH,MACF,CAAC;IACD;IACAT,MAAM,CAACW,GAAG,EAAE,IAAI,CAACgB,UAAU,CAACd,QAAQ,CAAC;EACvC;AACF","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import type { HostConfig } from "react-reconciler";
2
- import { NodeType } from "../dom/types";
3
- import type { Node } from "./nodes/Node";
2
+ import type { NodeType } from "../dom/types";
3
+ import type { Node } from "./Node";
4
4
  import type { Container } from "./Container";
5
5
  export declare const debug: (message?: any, ...optionalParams: any[]) => void;
6
6
  type Instance = Node;
@@ -1,7 +1,6 @@
1
1
  /*global NodeJS*/
2
2
 
3
3
  import { DefaultEventPriority } from "react-reconciler/constants";
4
- import { NodeType } from "../dom/types";
5
4
  import { shallowEq } from "../renderer/typeddash";
6
5
  const DEBUG = false;
7
6
  export const debug = (...args) => {
@@ -9,26 +8,6 @@ export const debug = (...args) => {
9
8
  console.log(...args);
10
9
  }
11
10
  };
12
- const isDeclaration = type => {
13
- "worklet";
14
-
15
- return (
16
- // BlurMaskFilters
17
- type === NodeType.BlurMaskFilter ||
18
- // ImageFilters
19
- type === NodeType.BlendImageFilter || type === NodeType.BlurImageFilter || type === NodeType.OffsetImageFilter || type === NodeType.DropShadowImageFilter || type === NodeType.MorphologyImageFilter || type === NodeType.DisplacementMapImageFilter || type === NodeType.RuntimeShaderImageFilter ||
20
- // ColorFilters
21
- type === NodeType.MatrixColorFilter || type === NodeType.BlendColorFilter || type === NodeType.LumaColorFilter || type === NodeType.LinearToSRGBGammaColorFilter || type === NodeType.SRGBToLinearGammaColorFilter || type === NodeType.LerpColorFilter ||
22
- // Shaders
23
- 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 ||
24
- // Path Effects
25
- type === NodeType.CornerPathEffect || type === NodeType.DiscretePathEffect || type === NodeType.DashPathEffect || type === NodeType.Path1DPathEffect || type === NodeType.Path2DPathEffect || type === NodeType.SumPathEffect || type === NodeType.Line2DPathEffect ||
26
- // Mixed
27
- type === NodeType.Blend ||
28
- // Paint
29
- type === NodeType.Paint
30
- );
31
- };
32
11
  export const sksgHostConfig = {
33
12
  /**
34
13
  * This function is used by the reconciler in order to calculate current time for prioritising work.
@@ -57,12 +36,16 @@ export const sksgHostConfig = {
57
36
  // return SpanNode({}, text) as SkNode;
58
37
  throw new Error("Text nodes are not supported yet");
59
38
  },
60
- createInstance(type, props, container, _hostContext, _internalInstanceHandle) {
39
+ createInstance(type, propsWithChildren, container, _hostContext, _internalInstanceHandle) {
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+ const {
42
+ children,
43
+ ...props
44
+ } = propsWithChildren;
61
45
  debug("createInstance", type);
62
46
  container.registerValues(props);
63
47
  const instance = {
64
48
  type,
65
- isDeclaration: isDeclaration(type),
66
49
  props,
67
50
  children: []
68
51
  };
@@ -116,8 +99,7 @@ export const sksgHostConfig = {
116
99
  return {
117
100
  type: instance.type,
118
101
  props: newProps,
119
- children: keepChildren ? [...instance.children] : [],
120
- isDeclaration: instance.isDeclaration
102
+ children: keepChildren ? [...instance.children] : []
121
103
  };
122
104
  },
123
105
  createContainerChildSet() {
@@ -1 +1 @@
1
- {"version":3,"names":["DefaultEventPriority","NodeType","shallowEq","DEBUG","debug","args","console","log","isDeclaration","type","BlurMaskFilter","BlendImageFilter","BlurImageFilter","OffsetImageFilter","DropShadowImageFilter","MorphologyImageFilter","DisplacementMapImageFilter","RuntimeShaderImageFilter","MatrixColorFilter","BlendColorFilter","LumaColorFilter","LinearToSRGBGammaColorFilter","SRGBToLinearGammaColorFilter","LerpColorFilter","Shader","ImageShader","ColorShader","Turbulence","FractalNoise","LinearGradient","RadialGradient","SweepGradient","TwoPointConicalGradient","CornerPathEffect","DiscretePathEffect","DashPathEffect","Path1DPathEffect","Path2DPathEffect","SumPathEffect","Line2DPathEffect","Blend","Paint","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","props","container","registerValues","instance","children","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","resetAfterCommit","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","clear","prepareUpdate","_instance","oldProps","newProps","propsAreEqual","unregisterValues","preparePortalMount","cloneInstance","_updatePayload","_oldProps","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","getInstanceFromNode","_node","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.ts"],"sourcesContent":["/*global NodeJS*/\nimport type { Fiber, HostConfig } from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants\";\n\nimport { NodeType } from \"../dom/types\";\nimport { shallowEq } from \"../renderer/typeddash\";\n\nimport type { Node } from \"./nodes/Node\";\nimport type { Container } from \"./Container\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\nconst isDeclaration = (type: NodeType) => {\n \"worklet\";\n return (\n // BlurMaskFilters\n type === NodeType.BlurMaskFilter ||\n // ImageFilters\n type === NodeType.BlendImageFilter ||\n type === NodeType.BlurImageFilter ||\n type === NodeType.OffsetImageFilter ||\n type === NodeType.DropShadowImageFilter ||\n type === NodeType.MorphologyImageFilter ||\n type === NodeType.DisplacementMapImageFilter ||\n type === NodeType.RuntimeShaderImageFilter ||\n // ColorFilters\n type === NodeType.MatrixColorFilter ||\n type === NodeType.BlendColorFilter ||\n type === NodeType.LumaColorFilter ||\n type === NodeType.LinearToSRGBGammaColorFilter ||\n type === NodeType.SRGBToLinearGammaColorFilter ||\n type === NodeType.LerpColorFilter ||\n // Shaders\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 // Path Effects\n type === NodeType.CornerPathEffect ||\n type === NodeType.DiscretePathEffect ||\n type === NodeType.DashPathEffect ||\n type === NodeType.Path1DPathEffect ||\n type === NodeType.Path2DPathEffect ||\n type === NodeType.SumPathEffect ||\n type === NodeType.Line2DPathEffect ||\n // Mixed\n type === NodeType.Blend ||\n // Paint\n type === NodeType.Paint\n );\n};\n\ntype Instance = Node;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nexport const sksgHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n supportsMutation: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n getRootHostContext: (_rootContainerInstance: Container) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n props,\n container,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createInstance\", type);\n container.registerValues(props);\n const instance = {\n type,\n isDeclaration: isDeclaration(type),\n props,\n children: [],\n };\n return instance;\n },\n\n appendInitialChild(parentInstance: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_containerInfo) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (container) => {\n debug(\"clearContainer\");\n container.clear();\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n container.unregisterValues(oldProps);\n container.registerValues(newProps);\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _updatePayload,\n _type,\n _oldProps,\n newProps,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n\n return {\n type: instance.type,\n props: newProps,\n children: keepChildren ? [...instance.children] : [],\n isDeclaration: instance.isDeclaration,\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"replaceContainerChildren\");\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: () => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n throw new Error(\"Function not implemented.\");\n },\n};\n"],"mappings":"AAAA;;AAEA,SAASA,oBAAoB,QAAQ,4BAA4B;AAEjE,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,SAAS,QAAQ,uBAAuB;AAKjD,MAAMC,KAAK,GAAG,KAAK;AACnB,OAAO,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AAED,MAAMG,aAAa,GAAIC,IAAc,IAAK;EACxC,SAAS;;EACT;IACE;IACAA,IAAI,KAAKR,QAAQ,CAACS,cAAc;IAChC;IACAD,IAAI,KAAKR,QAAQ,CAACU,gBAAgB,IAClCF,IAAI,KAAKR,QAAQ,CAACW,eAAe,IACjCH,IAAI,KAAKR,QAAQ,CAACY,iBAAiB,IACnCJ,IAAI,KAAKR,QAAQ,CAACa,qBAAqB,IACvCL,IAAI,KAAKR,QAAQ,CAACc,qBAAqB,IACvCN,IAAI,KAAKR,QAAQ,CAACe,0BAA0B,IAC5CP,IAAI,KAAKR,QAAQ,CAACgB,wBAAwB;IAC1C;IACAR,IAAI,KAAKR,QAAQ,CAACiB,iBAAiB,IACnCT,IAAI,KAAKR,QAAQ,CAACkB,gBAAgB,IAClCV,IAAI,KAAKR,QAAQ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AAA,CAAUC,cAAc,EAAE3B,SAAS,EAAQ;IAC7D,MAAM,IAAI1B,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDsD,oBAAoB,EAAE,SAAAA,CAAUD,cAAc,EAAmB;IAC/D,MAAM,IAAIrD,KAAK,CAAC,2BAA2B,CAAC;EAC9C;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["DefaultEventPriority","shallowEq","DEBUG","debug","args","console","log","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","container","children","props","registerValues","instance","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","resetAfterCommit","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","clear","prepareUpdate","_instance","oldProps","newProps","propsAreEqual","unregisterValues","preparePortalMount","cloneInstance","_updatePayload","_oldProps","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","getInstanceFromNode","_node","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.ts"],"sourcesContent":["/*global NodeJS*/\nimport type { Fiber, HostConfig } from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants\";\n\nimport type { NodeType } from \"../dom/types\";\nimport { shallowEq } from \"../renderer/typeddash\";\n\nimport type { Node } from \"./Node\";\nimport type { Container } from \"./Container\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ntype Instance = Node;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nexport const sksgHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n supportsMutation: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n getRootHostContext: (_rootContainerInstance: Container) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n propsWithChildren,\n container,\n _hostContext,\n _internalInstanceHandle\n ) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { children, ...props } = propsWithChildren as any;\n debug(\"createInstance\", type);\n container.registerValues(props);\n const instance = {\n type,\n props,\n children: [],\n };\n return instance;\n },\n\n appendInitialChild(parentInstance: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_containerInfo) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (container) => {\n debug(\"clearContainer\");\n container.clear();\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n container.unregisterValues(oldProps);\n container.registerValues(newProps);\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _updatePayload,\n _type,\n _oldProps,\n newProps,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n\n return {\n type: instance.type,\n props: newProps,\n children: keepChildren ? [...instance.children] : [],\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"replaceContainerChildren\");\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: () => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n throw new Error(\"Function not implemented.\");\n },\n};\n"],"mappings":"AAAA;;AAEA,SAASA,oBAAoB,QAAQ,4BAA4B;AAGjE,SAASC,SAAS,QAAQ,uBAAuB;AAKjD,MAAMC,KAAK,GAAG,KAAK;AACnB,OAAO,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AA+BD,OAAO,MAAMG,cAA8B,GAAG;EAC5C;AACF;AACA;EACEC,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,KAAK;EACxBC,mBAAmB,EAAE,IAAI;EACzBC,iBAAiB,EAAE,KAAK;EACxB;EACAC,eAAe,EAAEC,UAAU;EAC3BC,aAAa,EAAEC,YAAY;EAC3BC,SAAS,EAAE,CAAC,CAAC;EAEbC,kBAAkB,EAAGC,sBAAiC,IAAK;IACzDf,KAAK,CAAC,oBAAoB,CAAC;IAC3B,OAAO,IAAI;EACb,CAAC;EAEDgB,mBAAmBA,CAACC,kBAAkB,EAAEC,KAAK,EAAEH,sBAAsB,EAAE;IACrEf,KAAK,CAAC,qBAAqB,CAAC;IAC5B,OAAO,IAAI;EACb,CAAC;EAEDmB,oBAAoBA,CAACD,KAAK,EAAEE,MAAM,EAAE;IAClC,OAAO,KAAK;EACd,CAAC;EAEDC,kBAAkBA,CAChBC,KAAK,EACLP,sBAAsB,EACtBQ,YAAY,E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AAK,CAAC,2BAA2B,CAAC;IAClC6B,SAAS,CAACwC,IAAI,GAAGD,WAAW;EAC9B,CAAC;EAEDE,wBAAwBA,CAACzC,SAAoB,EAAEuC,WAAqB,EAAE;IACpEpE,KAAK,CAAC,0BAA0B,CAAC;IACjC6B,SAAS,CAACwC,IAAI,GAAGD,WAAW;EAC9B,CAAC;EAEDG,mBAAmBA,CACjBlB,SAAmB,EACnBnC,KAAa,EACbE,MAAa,EACH;IACVpB,KAAK,CAAC,qBAAqB,CAAC;IAC5B,MAAM,IAAIyB,KAAK,CAAC,sBAAsB,CAAC;EACzC,CAAC;EAED+C,uBAAuBA,CAACnB,SAAmB,EAAE/B,KAAa,EAAgB;IACxEtB,KAAK,CAAC,yBAAyB,CAAC;IAChC,MAAM,IAAIyB,KAAK,CAAC,sBAAsB,CAAC;EACzC,CAAC;EACD;EACAgD,uBAAuB,EAAEA,CAAA,KAAM5E,oBAAoB;EACnD6E,wBAAwB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClCC,uBAAuB,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjCC,qBAAqB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC/BC,mBAAmB,EAAE,SAAAA,CAAUC,KAAK,EAA4B;IAC9D,MAAM,IAAIrD,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDsD,kBAAkB,EAAE,SAAAA,CAAUC,cAAc,EAAE3B,SAAS,EAAQ;IAC7D,MAAM,IAAI5B,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDwD,oBAAoB,EAAE,SAAAA,CAAUD,cAAc,EAAmB;IAC/D,MAAM,IAAIvD,KAAK,CAAC,2BAA2B,CAAC;EAC9C;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ import { NodeType } from "../dom/types";
2
+ export interface Node<Props = unknown> {
3
+ type: NodeType;
4
+ props: Props;
5
+ children: Node[];
6
+ }
7
+ export declare const isColorFilter: (type: NodeType) => type is NodeType.MatrixColorFilter | NodeType.BlendColorFilter | NodeType.LinearToSRGBGammaColorFilter | NodeType.SRGBToLinearGammaColorFilter | NodeType.LumaColorFilter | NodeType.LerpColorFilter;
8
+ export declare const isPathEffect: (type: NodeType) => type is NodeType.DiscretePathEffect | NodeType.DashPathEffect | NodeType.Path1DPathEffect | NodeType.Path2DPathEffect | NodeType.CornerPathEffect | NodeType.SumPathEffect | NodeType.Line2DPathEffect;
9
+ export declare const isImageFilter: (type: NodeType) => type is NodeType.OffsetImageFilter | NodeType.DisplacementMapImageFilter | NodeType.BlurImageFilter | NodeType.DropShadowImageFilter | NodeType.MorphologyImageFilter | NodeType.BlendImageFilter | NodeType.RuntimeShaderImageFilter;
10
+ export declare const isShader: (type: NodeType) => type is NodeType.Shader | NodeType.ImageShader | NodeType.ColorShader | NodeType.Turbulence | NodeType.FractalNoise | NodeType.LinearGradient | NodeType.RadialGradient | NodeType.SweepGradient | NodeType.TwoPointConicalGradient;
11
+ export declare const sortNodeChildren: (parent: Node) => {
12
+ colorFilters: Node<unknown>[];
13
+ drawings: Node<unknown>[];
14
+ maskFilters: Node<unknown>[];
15
+ shaders: Node<unknown>[];
16
+ pathEffects: Node<unknown>[];
17
+ imageFilters: Node<unknown>[];
18
+ paints: Node<unknown>[];
19
+ };
@@ -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;;E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I,GAAGF,QAAQ,CAACuB,gBAAgB;QACrCiB,YAAY,CAACO,IAAI,CAACD,IAAI,CAAC;MACzB,CAAC,MAAM;QACLA,IAAI,CAAC5C,IAAI,GAAGF,QAAQ,CAACkD,KAAK;QAC1BX,OAAO,CAACQ,IAAI,CAACD,IAAI,CAAC;MACpB;IACF,CAAC,MAAM;MACLJ,QAAQ,CAACK,IAAI,CAACD,IAAI,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 Dr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;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AA+CvB,OAAO,MAAMC,gBAAgB,GAAIC,OAGhC,IAAK;EACJ,SAAS;;EACT,IAAIA,OAAO,CAACC,aAAa,EAAE;IACzB,KAAK,MAAMC,GAAG,IAAIF,OAAO,CAACC,aAAa,EAAE;MACvCD,OAAO,CAACG,KAAK,CAACD,GAAG,CAAC,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>;