@shopify/react-native-skia 0.1.142 → 0.1.146

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. package/cpp/api/JsiSkContourMeasure.h +4 -4
  2. package/cpp/api/JsiSkDataFactory.h +3 -3
  3. package/cpp/api/JsiSkFont.h +1 -1
  4. package/cpp/api/JsiSkPaint.h +6 -0
  5. package/cpp/api/JsiSkPathFactory.h +2 -2
  6. package/cpp/api/JsiSkPicture.h +7 -1
  7. package/cpp/api/JsiSkPictureFactory.h +1 -1
  8. package/cpp/api/JsiSkRuntimeEffect.h +6 -6
  9. package/cpp/api/JsiSkRuntimeEffectFactory.h +1 -1
  10. package/cpp/jsi/JsiSimpleValueWrapper.h +27 -27
  11. package/cpp/jsi/JsiValueWrapper.h +127 -0
  12. package/cpp/rnskia/RNSkDrawView.cpp +44 -20
  13. package/cpp/rnskia/RNSkDrawView.h +18 -20
  14. package/cpp/rnskia/RNSkJsiViewApi.h +180 -166
  15. package/cpp/rnskia/values/RNSkComputedValue.h +11 -11
  16. package/cpp/rnskia/values/RNSkReadonlyValue.h +19 -19
  17. package/cpp/rnskia/values/RNSkValue.h +13 -13
  18. package/cpp/utils/RNSkLog.h +4 -4
  19. package/lib/commonjs/renderer/Canvas.js +17 -7
  20. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  21. package/lib/commonjs/renderer/DependencyManager.js +144 -36
  22. package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
  23. package/lib/commonjs/renderer/HostConfig.js +18 -2
  24. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  25. package/lib/commonjs/renderer/components/Blend.js +20 -5
  26. package/lib/commonjs/renderer/components/Blend.js.map +1 -1
  27. package/lib/commonjs/renderer/components/backdrop/BackdropFilter.js.map +1 -1
  28. package/lib/commonjs/renderer/components/imageFilters/Morphology.js +1 -1
  29. package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
  30. package/lib/commonjs/renderer/components/imageFilters/Shadow.js +1 -1
  31. package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
  32. package/lib/commonjs/renderer/nodes/Declaration.js +2 -3
  33. package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
  34. package/lib/commonjs/renderer/nodes/Drawing.js +3 -7
  35. package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
  36. package/lib/commonjs/renderer/nodes/Node.js +9 -7
  37. package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
  38. package/lib/commonjs/renderer/processors/Animations/Animations.js +3 -22
  39. package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
  40. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  41. package/lib/commonjs/skia/web/Host.js +12 -21
  42. package/lib/commonjs/skia/web/Host.js.map +1 -1
  43. package/lib/commonjs/skia/web/JsiSkCanvas.js +46 -26
  44. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  45. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +4 -4
  46. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  47. package/lib/commonjs/skia/web/JsiSkFont.js +7 -3
  48. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  49. package/lib/commonjs/skia/web/JsiSkImage.js +4 -2
  50. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  51. package/lib/commonjs/skia/web/JsiSkImageFactory.js +4 -2
  52. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  53. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +61 -19
  54. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  55. package/lib/commonjs/skia/web/JsiSkMatrix.js +1 -1
  56. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  57. package/lib/commonjs/skia/web/JsiSkPaint.js +19 -6
  58. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  59. package/lib/commonjs/skia/web/JsiSkPath.js +9 -55
  60. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  61. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +7 -3
  62. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  63. package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
  64. package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
  65. package/lib/commonjs/skia/web/JsiSkPicture.js +5 -1
  66. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  67. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +3 -1
  68. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  69. package/lib/commonjs/skia/web/JsiSkPoint.js +9 -1
  70. package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
  71. package/lib/commonjs/skia/web/JsiSkRRect.js +1 -1
  72. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
  73. package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
  74. package/lib/commonjs/skia/web/JsiSkRect.js +1 -1
  75. package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
  76. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +4 -2
  77. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  78. package/lib/commonjs/skia/web/JsiSkShaderFactory.js +10 -6
  79. package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
  80. package/lib/commonjs/skia/web/JsiSkSurface.js +3 -1
  81. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  82. package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js +8 -4
  83. package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -1
  84. package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js +1 -1
  85. package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js.map +1 -1
  86. package/lib/commonjs/skia/web/JsiSkia.js +12 -6
  87. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  88. package/lib/commonjs/views/SkiaView.js +11 -27
  89. package/lib/commonjs/views/SkiaView.js.map +1 -1
  90. package/lib/commonjs/views/types.js.map +1 -1
  91. package/lib/module/renderer/Canvas.js +17 -6
  92. package/lib/module/renderer/Canvas.js.map +1 -1
  93. package/lib/module/renderer/DependencyManager.js +140 -33
  94. package/lib/module/renderer/DependencyManager.js.map +1 -1
  95. package/lib/module/renderer/HostConfig.js +18 -2
  96. package/lib/module/renderer/HostConfig.js.map +1 -1
  97. package/lib/module/renderer/components/Blend.js +21 -5
  98. package/lib/module/renderer/components/Blend.js.map +1 -1
  99. package/lib/module/renderer/components/backdrop/BackdropFilter.js.map +1 -1
  100. package/lib/module/renderer/components/imageFilters/Morphology.js +1 -1
  101. package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
  102. package/lib/module/renderer/components/imageFilters/Shadow.js +1 -1
  103. package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
  104. package/lib/module/renderer/nodes/Declaration.js +3 -4
  105. package/lib/module/renderer/nodes/Declaration.js.map +1 -1
  106. package/lib/module/renderer/nodes/Drawing.js +3 -6
  107. package/lib/module/renderer/nodes/Drawing.js.map +1 -1
  108. package/lib/module/renderer/nodes/Node.js +9 -7
  109. package/lib/module/renderer/nodes/Node.js.map +1 -1
  110. package/lib/module/renderer/processors/Animations/Animations.js +1 -16
  111. package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
  112. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  113. package/lib/module/skia/web/Host.js +9 -9
  114. package/lib/module/skia/web/Host.js.map +1 -1
  115. package/lib/module/skia/web/JsiSkCanvas.js +37 -27
  116. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  117. package/lib/module/skia/web/JsiSkColorFilterFactory.js +5 -5
  118. package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  119. package/lib/module/skia/web/JsiSkFont.js +6 -4
  120. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  121. package/lib/module/skia/web/JsiSkImage.js +4 -3
  122. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  123. package/lib/module/skia/web/JsiSkImageFactory.js +4 -3
  124. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  125. package/lib/module/skia/web/JsiSkImageFilterFactory.js +61 -20
  126. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  127. package/lib/module/skia/web/JsiSkMatrix.js +2 -2
  128. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  129. package/lib/module/skia/web/JsiSkPaint.js +15 -7
  130. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  131. package/lib/module/skia/web/JsiSkPath.js +9 -57
  132. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  133. package/lib/module/skia/web/JsiSkPathEffectFactory.js +6 -4
  134. package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  135. package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
  136. package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
  137. package/lib/module/skia/web/JsiSkPicture.js +4 -2
  138. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  139. package/lib/module/skia/web/JsiSkPictureRecorder.js +3 -2
  140. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  141. package/lib/module/skia/web/JsiSkPoint.js +10 -2
  142. package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
  143. package/lib/module/skia/web/JsiSkRRect.js +2 -2
  144. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  145. package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
  146. package/lib/module/skia/web/JsiSkRect.js +2 -2
  147. package/lib/module/skia/web/JsiSkRect.js.map +1 -1
  148. package/lib/module/skia/web/JsiSkRuntimeEffect.js +4 -3
  149. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  150. package/lib/module/skia/web/JsiSkShaderFactory.js +9 -7
  151. package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
  152. package/lib/module/skia/web/JsiSkSurface.js +3 -2
  153. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  154. package/lib/module/skia/web/JsiSkTextBlobFactory.js +7 -5
  155. package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -1
  156. package/lib/module/skia/web/JsiSkTypefaceFactory.js +2 -2
  157. package/lib/module/skia/web/JsiSkTypefaceFactory.js.map +1 -1
  158. package/lib/module/skia/web/JsiSkia.js +10 -5
  159. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  160. package/lib/module/views/SkiaView.js +11 -26
  161. package/lib/module/views/SkiaView.js.map +1 -1
  162. package/lib/module/views/types.js.map +1 -1
  163. package/lib/typescript/src/renderer/Canvas.d.ts +1 -1
  164. package/lib/typescript/src/renderer/DependencyManager.d.ts +40 -14
  165. package/lib/typescript/src/renderer/nodes/Declaration.d.ts +2 -2
  166. package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
  167. package/lib/typescript/src/renderer/nodes/Node.d.ts +3 -2
  168. package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +0 -1
  169. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +5 -0
  170. package/lib/typescript/src/skia/types/Picture/Picture.d.ts +2 -1
  171. package/lib/typescript/src/skia/web/Host.d.ts +6 -8
  172. package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +8 -8
  173. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  174. package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +3 -2
  175. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +2 -2
  176. package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -2
  177. package/lib/typescript/src/skia/web/JsiSkRect.d.ts +2 -2
  178. package/lib/typescript/src/skia/web/JsiSkTextBlobFactory.d.ts +2 -1
  179. package/lib/typescript/src/views/SkiaView.d.ts +1 -11
  180. package/lib/typescript/src/views/types.d.ts +5 -5
  181. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  182. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  183. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  184. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  185. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  186. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  187. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  188. package/package.json +2 -2
  189. package/src/renderer/Canvas.tsx +19 -7
  190. package/src/renderer/DependencyManager.tsx +170 -39
  191. package/src/renderer/HostConfig.ts +12 -2
  192. package/src/renderer/components/Blend.tsx +25 -5
  193. package/src/renderer/components/backdrop/BackdropFilter.tsx +1 -1
  194. package/src/renderer/components/imageFilters/Morphology.tsx +2 -2
  195. package/src/renderer/components/imageFilters/Shadow.tsx +2 -2
  196. package/src/renderer/nodes/Declaration.tsx +6 -8
  197. package/src/renderer/nodes/Drawing.tsx +5 -7
  198. package/src/renderer/nodes/Node.ts +11 -9
  199. package/src/renderer/processors/Animations/Animations.ts +2 -15
  200. package/src/skia/types/Paint/Paint.ts +6 -0
  201. package/src/skia/types/Picture/Picture.ts +2 -1
  202. package/src/skia/web/Host.ts +12 -22
  203. package/src/skia/web/JsiSkCanvas.ts +78 -47
  204. package/src/skia/web/JsiSkColorFilterFactory.ts +15 -5
  205. package/src/skia/web/JsiSkFont.ts +11 -4
  206. package/src/skia/web/JsiSkImage.ts +4 -3
  207. package/src/skia/web/JsiSkImageFactory.ts +6 -3
  208. package/src/skia/web/JsiSkImageFilterFactory.ts +124 -52
  209. package/src/skia/web/JsiSkMatrix.ts +4 -2
  210. package/src/skia/web/JsiSkPaint.ts +15 -7
  211. package/src/skia/web/JsiSkPath.ts +16 -51
  212. package/src/skia/web/JsiSkPathEffectFactory.ts +10 -5
  213. package/src/skia/web/JsiSkPathFactory.ts +3 -3
  214. package/src/skia/web/JsiSkPicture.ts +5 -3
  215. package/src/skia/web/JsiSkPictureRecorder.ts +3 -2
  216. package/src/skia/web/JsiSkPoint.ts +12 -2
  217. package/src/skia/web/JsiSkRRect.ts +5 -2
  218. package/src/skia/web/JsiSkRSXform.ts +1 -1
  219. package/src/skia/web/JsiSkRect.ts +2 -2
  220. package/src/skia/web/JsiSkRuntimeEffect.ts +9 -4
  221. package/src/skia/web/JsiSkShaderFactory.ts +24 -15
  222. package/src/skia/web/JsiSkSurface.ts +7 -2
  223. package/src/skia/web/JsiSkTextBlobFactory.ts +14 -8
  224. package/src/skia/web/JsiSkTypefaceFactory.tsx +4 -2
  225. package/src/skia/web/JsiSkia.ts +17 -5
  226. package/src/views/SkiaView.tsx +17 -28
  227. package/src/views/types.ts +7 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["types.ts"],"names":["TouchType"],"mappings":"AAYA,WAAYA,SAAZ;;WAAYA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S","sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { SkImage, SkRect, SkCanvas } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n invalidateSkiaView: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n setDrawCallback: (\n nativeId: number,\n callback: RNSkiaDrawCallback | undefined\n ) => void;\n setDrawMode: (nativeId: number, mode: DrawMode) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaValue<unknown>[]\n ) => () => void;\n}\n\nexport interface SkiaViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n"]}
1
+ {"version":3,"sources":["types.ts"],"names":["TouchType"],"mappings":"AAYA,WAAYA,SAAZ;;WAAYA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;AAAAA,EAAAA,S,CAAAA,S;GAAAA,S,KAAAA,S","sourcesContent":["import type { ViewProps } from \"react-native\";\n\nimport type { SkCanvas, SkImage, SkRect } from \"../skia/types\";\nimport type { SkiaValue } from \"../values\";\n\nexport type DrawMode = \"continuous\" | \"default\";\n\nexport type NativeSkiaViewProps = ViewProps & {\n mode?: DrawMode;\n debug?: boolean;\n};\n\nexport enum TouchType {\n Start,\n Active,\n End,\n Cancelled,\n}\n\nexport interface TouchInfo {\n x: number;\n y: number;\n force: number;\n type: TouchType;\n id: number;\n timestamp: number;\n}\n\nexport interface DrawingInfo {\n width: number;\n height: number;\n timestamp: number;\n touches: Array<Array<TouchInfo>>;\n}\n\nexport type ExtendedTouchInfo = TouchInfo & {\n // points per second\n velocityX: number;\n velocityY: number;\n};\n\nexport type TouchHandlers = {\n onStart?: (touchInfo: TouchInfo) => void;\n onActive?: (touchInfo: ExtendedTouchInfo) => void;\n onEnd?: (touchInfo: ExtendedTouchInfo) => void;\n};\n\nexport type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;\n\nexport type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;\n\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n\nexport interface ISkiaViewApi {\n setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;\n callJsiMethod: <T extends Array<unknown>>(\n nativeId: number,\n name: string,\n ...args: T\n ) => void;\n registerValuesInView: (\n nativeId: number,\n values: SkiaValue<unknown>[]\n ) => () => void;\n requestRedraw: (nativeId: number) => void;\n makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;\n}\n\nexport interface SkiaViewProps extends ViewProps {\n /**\n * Sets the drawing mode for the skia view. There are two drawing\n * modes, \"continuous\" and \"default\", where the continuous mode will\n * continuously redraw the view, and the default mode will only\n * redraw when any of the regular react properties are changed like\n * sizes and margins.\n */\n mode?: DrawMode;\n /**\n * When set to true the view will display information about the\n * average time it takes to render.\n */\n debug?: boolean;\n /**\n * Draw callback. Will be called whenever the view is invalidated and\n * needs to redraw. This is either caused by a change in a react\n * property, a touch event, or a call to redraw. If the view is in\n * continuous mode the callback will be called 60 frames per second\n * by the native view.\n */\n onDraw?: RNSkiaDrawCallback;\n}\n"]}
@@ -11,4 +11,4 @@ export interface CanvasProps extends ComponentProps<typeof SkiaView> {
11
11
  children: ReactNode;
12
12
  onTouch?: TouchHandler;
13
13
  }
14
- export declare const Canvas: React.ForwardRefExoticComponent<Pick<CanvasProps, "children" | "mode" | "debug" | "onDraw" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "onTouch"> & React.RefAttributes<SkiaView>>;
14
+ export declare const Canvas: React.ForwardRefExoticComponent<Pick<CanvasProps, "mode" | "debug" | "onDraw" | "children" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "onTouch"> & React.RefAttributes<SkiaView>>;
@@ -1,21 +1,47 @@
1
- import type { RefObject } from "react";
2
- import type { SkiaView } from "../views";
3
1
  import type { SkiaValue } from "../values";
4
2
  import type { Node } from "./nodes";
3
+ import type { AnimatedProps } from "./processors";
5
4
  declare type Unsubscribe = () => void;
6
- declare type Props = {
7
- [key: string]: unknown;
5
+ declare type Mutator = (value: unknown) => void;
6
+ declare type SubscriptionState = {
7
+ nodes: Map<Node, Mutator[]>;
8
+ unsubscribe: null | Unsubscribe;
8
9
  };
9
10
  export declare class DependencyManager {
10
- ref: RefObject<SkiaView>;
11
- subscriptions: Map<Node, {
12
- values: SkiaValue<unknown>[];
13
- unsubscribe: null | Unsubscribe;
14
- }>;
15
- constructor(ref: RefObject<SkiaView>);
16
- unSubscribeNode(node: Node): void;
17
- subscribeNode(node: Node, props: Props): void;
18
- subscribe(): void;
19
- unsubscribe(): void;
11
+ registerValues: (values: Array<SkiaValue<unknown>>) => () => void;
12
+ subscriptions: Map<SkiaValue<unknown>, SubscriptionState>;
13
+ unregisterDependantValues: null | Unsubscribe;
14
+ constructor(registerValues: (values: Array<SkiaValue<unknown>>) => () => void);
15
+ /**
16
+ * Call to unsubscribe all value listeners from the given node based
17
+ * on the current list of subscriptions for the node. This function
18
+ * is typically called when the node is unmounted or when one or more
19
+ * properties have changed.
20
+ * @param node Node to unsubscribe value listeners from
21
+ */
22
+ unsubscribeNode(node: Node): void;
23
+ /**
24
+ * Adds listeners to the provided values so that the node is notified
25
+ * when a value changes. This is done in an optimized way so that this
26
+ * class only needs to listen to the value once and then forwards the
27
+ * change to the node and its listener. This method is typically called
28
+ * when the node is mounted and when one or more props on the node changes.
29
+ * @param node Node to subscribe to value changes for
30
+ * @param props Node's properties
31
+ * @param onResolveProp Callback when a property value changes
32
+ */
33
+ subscribeNode<P extends Record<string, unknown>>(node: Node, props: AnimatedProps<P>): void;
34
+ /**
35
+ * Called when the hosting container is mounted or updated. This ensures that we have
36
+ * a ref to the underlying SkiaView so that we can registers redraw listeners
37
+ * on values used in the current View automatically.
38
+ */
39
+ update(): void;
40
+ /**
41
+ * Called when the hosting container is unmounted or recreated. This ensures that we remove
42
+ * all subscriptions to Skia values so that we don't have any listeners left after
43
+ * the component is removed.
44
+ */
45
+ remove(): void;
20
46
  }
21
47
  export {};
@@ -8,7 +8,7 @@ export declare type DeclarationResult = SkJSIInstance<string> | null;
8
8
  declare type DeclarationCallback<T> = (props: T, children: DeclarationResult[], ctx: DrawingContext) => DeclarationResult;
9
9
  export declare const createDeclaration: <T>(cb: DeclarationCallback<T>) => DeclarationCallback<T>;
10
10
  export declare const useDeclaration: <P>(cb: DeclarationCallback<P>, deps?: DependencyList | undefined) => DeclarationCallback<P>;
11
- export declare const isDeclarationNode: (node: Node) => node is DeclarationNode<unknown>;
11
+ export declare const isDeclarationNode: <P>(node: Node) => node is DeclarationNode<P>;
12
12
  export interface DeclarationProps<P> {
13
13
  onDeclare: DeclarationCallback<P>;
14
14
  }
@@ -16,7 +16,7 @@ export declare class DeclarationNode<P> extends Node<P> {
16
16
  private onDeclare;
17
17
  constructor(depMgr: DependencyManager, onDeclare: DeclarationCallback<P>, props: AnimatedProps<P>);
18
18
  set props(props: AnimatedProps<P>);
19
- get props(): AnimatedProps<P>;
19
+ get props(): P;
20
20
  draw(ctx: DrawingContext): DeclarationResult;
21
21
  }
22
22
  export {};
@@ -7,8 +7,8 @@ declare type DrawingCallback<P> = (ctx: DrawingContext, props: P, node: Node<P>)
7
7
  declare type OnDrawCallback<P> = (ctx: DrawingContext, props: P, node: Node<P>) => void;
8
8
  export declare const createDrawing: <P>(cb: OnDrawCallback<P>) => DrawingCallback<P>;
9
9
  export declare const useDrawing: <P>(cb: OnDrawCallback<P>, deps?: DependencyList | undefined) => OnDrawCallback<P>;
10
- export declare type DrawingProps<T> = {
11
- onDraw: DrawingCallback<T>;
10
+ export declare type DrawingProps<P> = {
11
+ onDraw: DrawingCallback<P>;
12
12
  skipProcessing?: boolean;
13
13
  children?: ReactNode | ReactNode[];
14
14
  };
@@ -9,15 +9,16 @@ export declare enum NodeType {
9
9
  declare type DeclarationResult = SkJSIInstance<string> | null;
10
10
  export declare abstract class Node<P = unknown> {
11
11
  readonly children: Node[];
12
- _props: AnimatedProps<P>;
12
+ resolvedProps: P;
13
13
  memoizable: boolean;
14
14
  memoized: DeclarationResult | null;
15
15
  parent?: Node;
16
16
  depMgr: DependencyManager;
17
17
  constructor(depMgr: DependencyManager, props: AnimatedProps<P>);
18
18
  abstract draw(ctx: DrawingContext): void | DeclarationResult;
19
+ updatePropSubscriptions(props: AnimatedProps<P>): void;
19
20
  set props(props: AnimatedProps<P>);
20
- get props(): AnimatedProps<P>;
21
+ get props(): P;
21
22
  visit(ctx: DrawingContext, children?: Node[]): SkJSIInstance<string>[];
22
23
  }
23
24
  export {};
@@ -5,7 +5,6 @@ export declare const isSelector: <T, R>(value: unknown) => value is {
5
5
  value: SkiaValue<T>;
6
6
  };
7
7
  export declare const isAnimated: <T>(props: AnimatedProps<T>) => boolean;
8
- export declare const materialize: <T>(props: AnimatedProps<T>) => T;
9
8
  export declare type AnimatedProp<T, P = any> = T | SkiaValue<T> | SkiaSelector<T, P>;
10
9
  export declare type AnimatedProps<T> = {
11
10
  [K in keyof T]: AnimatedProp<T[K]>;
@@ -26,6 +26,11 @@ export interface SkPaint extends SkJSIInstance<"Paint"> {
26
26
  * Returns a copy of this paint.
27
27
  */
28
28
  copy(): SkPaint;
29
+ /**
30
+ * Sets all SkPaint contents to their initial values. This is equivalent to replacing
31
+ SkPaint with the result of SkPaint().
32
+ */
33
+ reset(): void;
29
34
  /**
30
35
  * Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values
31
36
  * (sRGB gamut, and encoded with the sRGB transfer function).
@@ -3,7 +3,8 @@ import type { TileMode } from "../ImageFilter";
3
3
  import type { SkRect } from "../Rect";
4
4
  import type { SkShader } from "../Shader";
5
5
  import type { SkMatrix } from "../Matrix";
6
- export interface SkPicture {
6
+ import type { SkJSIInstance } from "../JsiInstance";
7
+ export interface SkPicture extends SkJSIInstance<"Picture"> {
7
8
  /**
8
9
  * Returns a new shader that will draw with this picture.
9
10
  *
@@ -1,21 +1,19 @@
1
1
  import type { CanvasKit, EmbindEnumEntity } from "canvaskit-wasm";
2
2
  import type { SkJSIInstance } from "../types";
3
3
  export declare class NotImplementedOnRNWeb extends Error {
4
- constructor();
4
+ constructor(msg?: string);
5
5
  }
6
6
  export declare abstract class Host {
7
7
  readonly CanvasKit: CanvasKit;
8
8
  constructor(CanvasKit: CanvasKit);
9
9
  }
10
- export declare abstract class HostObject<T, N extends string> extends Host implements SkJSIInstance<N> {
10
+ export declare abstract class BaseHostObject<T, N extends string> extends Host implements SkJSIInstance<N> {
11
11
  readonly __typename__: N;
12
- readonly ref: T;
12
+ ref: T;
13
13
  constructor(CanvasKit: CanvasKit, ref: T, typename: N);
14
14
  }
15
- export declare type NonNullish = {};
16
- export declare const toOptionalValue: <T>(value: NonNullish | undefined | null) => T | null | undefined;
17
- export declare const toUndefinedableValue: <T>(value: NonNullish | undefined) => T | undefined;
18
- export declare const toNullableValue: <T>(value: NonNullish | null) => T | null;
19
- export declare const toValue: <T>(value: NonNullish) => T;
15
+ export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
16
+ static fromValue<T>(value: SkJSIInstance<string>): T;
17
+ }
20
18
  export declare const ckEnum: (value: number) => EmbindEnumEntity;
21
19
  export declare const optEnum: (value: number | undefined) => EmbindEnumEntity | undefined;
@@ -4,16 +4,16 @@ import { Host } from "./Host";
4
4
  import { JsiSkImageFilter } from "./JsiSkImageFilter";
5
5
  export declare class JsiSkImageFilterFactory extends Host implements ImageFilterFactory {
6
6
  constructor(CanvasKit: CanvasKit);
7
- MakeOffset(_dx: number, _dy: number, _input: SkImageFilter | null): SkImageFilter;
8
- MakeDisplacementMap(_channelX: ColorChannel, _channelY: ColorChannel, _scale: number, _in1: SkImageFilter, _input: SkImageFilter | null): SkImageFilter;
9
- MakeShader(_shader: SkShader, _input: SkImageFilter | null): SkImageFilter;
7
+ MakeOffset(dx: number, dy: number, input: SkImageFilter | null): JsiSkImageFilter;
8
+ MakeDisplacementMap(channelX: ColorChannel, channelY: ColorChannel, scale: number, in1: SkImageFilter, input: SkImageFilter | null): SkImageFilter;
9
+ MakeShader(shader: SkShader, _input: SkImageFilter | null): SkImageFilter;
10
10
  MakeBlur(sigmaX: number, sigmaY: number, mode: TileMode, input: SkImageFilter | null): JsiSkImageFilter;
11
11
  MakeColorFilter(cf: SkColorFilter, input: SkImageFilter | null): JsiSkImageFilter;
12
12
  MakeCompose(outer: SkImageFilter | null, inner: SkImageFilter | null): JsiSkImageFilter;
13
- MakeDropShadow(_dx: number, _dy: number, _sigmaX: number, _sigmaY: number, _color: SkColor, _input: SkImageFilter | null, _cropRect?: SkRect): SkImageFilter;
14
- MakeDropShadowOnly(_dx: number, _dy: number, _sigmaX: number, _sigmaY: number, _color: SkColor, _input: SkImageFilter | null, _cropRect?: SkRect): SkImageFilter;
15
- MakeErode(_rx: number, _ry: number, _input: SkImageFilter | null, _cropRect?: SkRect): SkImageFilter;
16
- MakeDilate(_rx: number, _ry: number, _input: SkImageFilter | null, _cropRect?: SkRect): SkImageFilter;
17
- MakeBlend(_mode: BlendMode, _background: SkImageFilter, _foreground: SkImageFilter | null, _cropRect?: SkRect): SkImageFilter;
13
+ MakeDropShadow(dx: number, dy: number, sigmaX: number, sigmaY: number, color: SkColor, input: SkImageFilter | null, cropRect?: SkRect): SkImageFilter;
14
+ MakeDropShadowOnly(dx: number, dy: number, sigmaX: number, sigmaY: number, color: SkColor, input: SkImageFilter | null, cropRect?: SkRect): SkImageFilter;
15
+ MakeErode(rx: number, ry: number, input: SkImageFilter | null, cropRect?: SkRect): SkImageFilter;
16
+ MakeDilate(rx: number, ry: number, input: SkImageFilter | null, cropRect?: SkRect): SkImageFilter;
17
+ MakeBlend(mode: BlendMode, background: SkImageFilter, foreground: SkImageFilter | null, cropRect?: SkRect): SkImageFilter;
18
18
  MakeRuntimeShader(_builder: SkRuntimeShaderBuilder, _childShaderName: string | null, _input: SkImageFilter | null): SkImageFilter;
19
19
  }
@@ -4,6 +4,7 @@ import { HostObject } from "./Host";
4
4
  export declare class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
5
5
  constructor(CanvasKit: CanvasKit, ref: Paint);
6
6
  copy(): JsiSkPaint;
7
+ reset(): void;
7
8
  getColor(): Float32Array;
8
9
  getStrokeCap(): number;
9
10
  getStrokeJoin(): number;
@@ -1,7 +1,8 @@
1
1
  import type { CanvasKit, Point } from "canvaskit-wasm";
2
2
  import type { SkPoint } from "../types";
3
- import { HostObject } from "./Host";
4
- export declare class JsiSkPoint extends HostObject<Point, "Point"> implements SkPoint {
3
+ import { BaseHostObject } from "./Host";
4
+ export declare class JsiSkPoint extends BaseHostObject<Point, "Point"> implements SkPoint {
5
+ static fromValue(point: SkPoint): Float32Array;
5
6
  constructor(CanvasKit: CanvasKit, ref: Point);
6
7
  get x(): number;
7
8
  get y(): number;
@@ -1,8 +1,8 @@
1
1
  import type { CanvasKit, RRect } from "canvaskit-wasm";
2
2
  import type { SkRRect } from "../types";
3
- import { HostObject } from "./Host";
3
+ import { BaseHostObject } from "./Host";
4
4
  import { JsiSkRect } from "./JsiSkRect";
5
- export declare class JsiSkRRect extends HostObject<RRect, "RRect"> implements SkRRect {
5
+ export declare class JsiSkRRect extends BaseHostObject<RRect, "RRect"> implements SkRRect {
6
6
  static fromValue(CanvasKit: CanvasKit, rect: SkRRect): Float32Array;
7
7
  constructor(CanvasKit: CanvasKit, ref: RRect);
8
8
  get rx(): number;
@@ -1,8 +1,7 @@
1
1
  import type { CanvasKit } from "canvaskit-wasm";
2
2
  import type { SkRSXform } from "../types";
3
3
  import { HostObject } from "./Host";
4
- declare type RSXform = Float32Array;
4
+ export declare type RSXform = Float32Array;
5
5
  export declare class JsiSkRSXform extends HostObject<RSXform, "RSXform"> implements SkRSXform {
6
6
  constructor(CanvasKit: CanvasKit, ref: RSXform);
7
7
  }
8
- export {};
@@ -1,7 +1,7 @@
1
1
  import type { CanvasKit, Rect } from "canvaskit-wasm";
2
2
  import type { SkRect } from "../types";
3
- import { HostObject } from "./Host";
4
- export declare class JsiSkRect extends HostObject<Rect, "Rect"> implements SkRect {
3
+ import { BaseHostObject } from "./Host";
4
+ export declare class JsiSkRect extends BaseHostObject<Rect, "Rect"> implements SkRect {
5
5
  static fromValue(CanvasKit: CanvasKit, rect: SkRect): Float32Array;
6
6
  constructor(CanvasKit: CanvasKit, ref: Rect);
7
7
  get x(): number;
@@ -1,6 +1,7 @@
1
1
  import type { CanvasKit } from "canvaskit-wasm";
2
- import type { SkFont, SkRSXform } from "../types";
2
+ import type { SkFont } from "../types";
3
3
  import type { TextBlobFactory } from "../types/TextBlob";
4
+ import type { SkRSXform } from "../types/RSXform";
4
5
  import { Host } from "./Host";
5
6
  import { JsiSkTextBlob } from "./JsiSkTextBlob";
6
7
  export declare class JsiSkTextBlobFactory extends Host implements TextBlobFactory {
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import type { SkRect } from "../skia/types";
3
3
  import type { SkiaValue } from "../values";
4
- import type { DrawMode, SkiaViewProps } from "./types";
4
+ import type { SkiaViewProps } from "./types";
5
5
  export declare class SkiaView extends React.Component<SkiaViewProps> {
6
6
  constructor(props: SkiaViewProps);
7
7
  private _nativeId;
@@ -17,16 +17,6 @@ export declare class SkiaView extends React.Component<SkiaViewProps> {
17
17
  * Sends a redraw request to the native SkiaView.
18
18
  */
19
19
  redraw(): void;
20
- /**
21
- * Updates the drawing mode for the skia view. This is the same
22
- * as declaratively setting the mode property on the SkiaView.
23
- * There are two drawing modes, "continuous" and "default",
24
- * where the continuous mode will continuously redraw the view and
25
- * the default mode will only redraw when any of the regular react
26
- * properties are changed like size and margins.
27
- * @param mode Drawing mode to use.
28
- */
29
- setDrawMode(mode: DrawMode): void;
30
20
  /**
31
21
  * Registers one or move values as a dependant value of the Skia View. The view will
32
22
  * The view will redraw itself when any of the values change.
@@ -1,5 +1,5 @@
1
1
  import type { ViewProps } from "react-native";
2
- import type { SkImage, SkRect, SkCanvas } from "../skia/types";
2
+ import type { SkCanvas, SkImage, SkRect } from "../skia/types";
3
3
  import type { SkiaValue } from "../values";
4
4
  export declare type DrawMode = "continuous" | "default";
5
5
  export declare type NativeSkiaViewProps = ViewProps & {
@@ -45,11 +45,11 @@ export interface ValueListener {
45
45
  removeListener: (id: number) => void;
46
46
  }
47
47
  export interface ISkiaViewApi {
48
- invalidateSkiaView: (nativeId: number) => void;
49
- makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
50
- setDrawCallback: (nativeId: number, callback: RNSkiaDrawCallback | undefined) => void;
51
- setDrawMode: (nativeId: number, mode: DrawMode) => void;
48
+ setJsiProperty: <T>(nativeId: number, name: string, value: T) => void;
49
+ callJsiMethod: <T extends Array<unknown>>(nativeId: number, name: string, ...args: T) => void;
52
50
  registerValuesInView: (nativeId: number, values: SkiaValue<unknown>[]) => () => void;
51
+ requestRedraw: (nativeId: number) => void;
52
+ makeImageSnapshot: (nativeId: number, rect?: SkRect) => SkImage;
53
53
  }
54
54
  export interface SkiaViewProps extends ViewProps {
55
55
  /**
@@ -6,32 +6,32 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_arm64e_x86_64-simulator</string>
9
+ <string>ios-arm64_arm64e</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>libskia.a</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
15
  <string>arm64e</string>
16
- <string>x86_64</string>
17
16
  </array>
18
17
  <key>SupportedPlatform</key>
19
18
  <string>ios</string>
20
- <key>SupportedPlatformVariant</key>
21
- <string>simulator</string>
22
19
  </dict>
23
20
  <dict>
24
21
  <key>LibraryIdentifier</key>
25
- <string>ios-arm64_arm64e</string>
22
+ <string>ios-arm64_arm64e_x86_64-simulator</string>
26
23
  <key>LibraryPath</key>
27
24
  <string>libskia.a</string>
28
25
  <key>SupportedArchitectures</key>
29
26
  <array>
30
27
  <string>arm64</string>
31
28
  <string>arm64e</string>
29
+ <string>x86_64</string>
32
30
  </array>
33
31
  <key>SupportedPlatform</key>
34
32
  <string>ios</string>
33
+ <key>SupportedPlatformVariant</key>
34
+ <string>simulator</string>
35
35
  </dict>
36
36
  </array>
37
37
  <key>CFBundlePackageType</key>
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "0.1.142",
10
+ "version": "0.1.146",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "files": [
@@ -89,7 +89,7 @@
89
89
  "typescript": "^4.6.4"
90
90
  },
91
91
  "dependencies": {
92
- "canvaskit-wasm": "^0.35.0",
92
+ "canvaskit-wasm": "^0.36.0",
93
93
  "react-reconciler": "^0.26.2"
94
94
  },
95
95
  "eslintIgnore": [
@@ -20,6 +20,7 @@ import { SkiaView, useDrawCallback } from "../views";
20
20
  import type { TouchHandler } from "../views";
21
21
  import { useValue } from "../values/hooks/useValue";
22
22
  import { Skia } from "../skia/Skia";
23
+ import type { SkiaValue } from "../values";
23
24
 
24
25
  import { debug as hostDebug, skHostConfig } from "./HostConfig";
25
26
  // import { debugTree } from "./nodes";
@@ -38,8 +39,7 @@ skiaReconciler.injectIntoDevTools({
38
39
  const render = (element: ReactNode, root: OpaqueRoot, container: Container) => {
39
40
  skiaReconciler.updateContainer(element, root, null, () => {
40
41
  hostDebug("updateContainer");
41
-
42
- container.depMgr.subscribe();
42
+ container.depMgr.update();
43
43
  });
44
44
  };
45
45
 
@@ -60,9 +60,19 @@ export const Canvas = forwardRef<SkiaView, CanvasProps>(
60
60
  const [tick, setTick] = useState(0);
61
61
  const redraw = useCallback(() => setTick((t) => t + 1), []);
62
62
 
63
+ const registerValues = useCallback(
64
+ (values: Array<SkiaValue<unknown>>) => {
65
+ if (ref.current === null) {
66
+ throw new Error("Canvas ref is not set");
67
+ }
68
+ return ref.current.registerValues(values);
69
+ },
70
+ [ref]
71
+ );
72
+
63
73
  const container = useMemo(
64
- () => new Container(new DependencyManager(ref), redraw),
65
- [redraw, ref]
74
+ () => new Container(new DependencyManager(registerValues), redraw),
75
+ [redraw, registerValues]
66
76
  );
67
77
 
68
78
  const root = useMemo(
@@ -78,6 +88,8 @@ export const Canvas = forwardRef<SkiaView, CanvasProps>(
78
88
  );
79
89
  }, [children, root, redraw, container, canvasCtx]);
80
90
 
91
+ const paint = useMemo(() => Skia.Paint(), []);
92
+
81
93
  // Draw callback
82
94
  const onDraw = useDrawCallback(
83
95
  (canvas, info) => {
@@ -92,7 +104,7 @@ export const Canvas = forwardRef<SkiaView, CanvasProps>(
92
104
  ) {
93
105
  canvasCtx.size.current = { width, height };
94
106
  }
95
- const paint = Skia.Paint();
107
+ paint.reset();
96
108
  const ctx = {
97
109
  width,
98
110
  height,
@@ -101,7 +113,7 @@ export const Canvas = forwardRef<SkiaView, CanvasProps>(
101
113
  paint,
102
114
  opacity: 1,
103
115
  ref,
104
- center: Skia.Point(width / 2, height / 2),
116
+ center: { x: width / 2, y: height / 2 },
105
117
  Skia,
106
118
  };
107
119
  container.draw(ctx);
@@ -112,7 +124,7 @@ export const Canvas = forwardRef<SkiaView, CanvasProps>(
112
124
  useEffect(() => {
113
125
  return () => {
114
126
  skiaReconciler.updateContainer(null, root, null, () => {
115
- container.depMgr.unsubscribe();
127
+ container.depMgr.remove();
116
128
  });
117
129
  };
118
130
  }, [container, root]);