@shopify/react-native-skia 0.1.116 → 0.1.120

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. package/cpp/api/JsiSkApi.h +13 -9
  2. package/cpp/api/JsiSkCanvas.h +9 -1
  3. package/cpp/api/JsiSkPicture.h +71 -0
  4. package/cpp/api/JsiSkPictureFactory.h +50 -0
  5. package/cpp/api/JsiSkPictureRecorder.h +53 -0
  6. package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +3 -6
  7. package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +2 -4
  8. package/ios/RNSkia-iOS/SkiaDrawView.mm +3 -2
  9. package/lib/commonjs/renderer/Canvas.js +22 -36
  10. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  11. package/lib/commonjs/renderer/HostConfig.js +3 -25
  12. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  13. package/lib/commonjs/renderer/components/{Defs.js → Drawing.js} +13 -12
  14. package/lib/commonjs/renderer/components/Drawing.js.map +1 -0
  15. package/lib/commonjs/renderer/components/Group.js +7 -4
  16. package/lib/commonjs/renderer/components/Group.js.map +1 -1
  17. package/lib/commonjs/renderer/components/Paint.js +1 -21
  18. package/lib/commonjs/renderer/components/Paint.js.map +1 -1
  19. package/lib/commonjs/renderer/components/Picture.js +35 -0
  20. package/lib/commonjs/renderer/components/Picture.js.map +1 -0
  21. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +5 -34
  22. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  23. package/lib/commonjs/renderer/components/imageFilters/{DropShadow.js → Shadow.js} +19 -8
  24. package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -0
  25. package/lib/commonjs/renderer/components/imageFilters/index.js +4 -17
  26. package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
  27. package/lib/commonjs/renderer/components/index.js +17 -4
  28. package/lib/commonjs/renderer/components/index.js.map +1 -1
  29. package/lib/commonjs/renderer/components/maskFilters/Blur.js +1 -1
  30. package/lib/commonjs/renderer/components/maskFilters/Blur.js.map +1 -1
  31. package/lib/commonjs/renderer/components/shapes/Box.js +126 -0
  32. package/lib/commonjs/renderer/components/shapes/Box.js.map +1 -0
  33. package/lib/commonjs/renderer/components/shapes/index.js +13 -0
  34. package/lib/commonjs/renderer/components/shapes/index.js.map +1 -1
  35. package/lib/commonjs/renderer/index.js +13 -0
  36. package/lib/commonjs/renderer/index.js.map +1 -1
  37. package/lib/commonjs/renderer/nodes/Declaration.js +12 -1
  38. package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
  39. package/lib/commonjs/renderer/nodes/Drawing.js +9 -24
  40. package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
  41. package/lib/commonjs/renderer/nodes/Node.js +9 -16
  42. package/lib/commonjs/renderer/nodes/Node.js.map +1 -1
  43. package/lib/commonjs/renderer/processors/Paint.js +24 -26
  44. package/lib/commonjs/renderer/processors/Paint.js.map +1 -1
  45. package/lib/commonjs/renderer/processors/math/Math.js +19 -1
  46. package/lib/commonjs/renderer/processors/math/Math.js.map +1 -1
  47. package/lib/commonjs/renderer/processors/math/Matrix3.js +11 -5
  48. package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
  49. package/lib/commonjs/renderer/typeddash.js +26 -2
  50. package/lib/commonjs/renderer/typeddash.js.map +1 -1
  51. package/lib/commonjs/renderer/useContextBridge.js +35 -0
  52. package/lib/commonjs/renderer/useContextBridge.js.map +1 -0
  53. package/lib/commonjs/skia/Canvas.js.map +1 -1
  54. package/lib/commonjs/skia/Picture/Picture.js +6 -0
  55. package/lib/commonjs/skia/Picture/Picture.js.map +1 -0
  56. package/lib/commonjs/skia/Picture/PictureFactory.js +6 -0
  57. package/lib/commonjs/skia/Picture/PictureFactory.js.map +1 -0
  58. package/lib/commonjs/skia/Picture/PictureRecorder.js +6 -0
  59. package/lib/commonjs/skia/Picture/PictureRecorder.js.map +1 -0
  60. package/lib/commonjs/skia/Picture/index.js +58 -0
  61. package/lib/commonjs/skia/Picture/index.js.map +1 -0
  62. package/lib/commonjs/skia/Picture/usePicture.js +30 -0
  63. package/lib/commonjs/skia/Picture/usePicture.js.map +1 -0
  64. package/lib/commonjs/skia/Skia.js +2 -0
  65. package/lib/commonjs/skia/Skia.js.map +1 -1
  66. package/lib/commonjs/skia/index.js +14 -0
  67. package/lib/commonjs/skia/index.js.map +1 -1
  68. package/lib/commonjs/values/hooks/useDerivedValue.js +2 -2
  69. package/lib/commonjs/values/hooks/useDerivedValue.js.map +1 -1
  70. package/lib/commonjs/views/SkiaView.js +6 -5
  71. package/lib/commonjs/views/SkiaView.js.map +1 -1
  72. package/lib/commonjs/views/types.js.map +1 -1
  73. package/lib/module/renderer/Canvas.js +20 -32
  74. package/lib/module/renderer/Canvas.js.map +1 -1
  75. package/lib/module/renderer/HostConfig.js +2 -24
  76. package/lib/module/renderer/HostConfig.js.map +1 -1
  77. package/lib/module/renderer/components/Drawing.js +17 -0
  78. package/lib/module/renderer/components/Drawing.js.map +1 -0
  79. package/lib/module/renderer/components/Group.js +8 -6
  80. package/lib/module/renderer/components/Group.js.map +1 -1
  81. package/lib/module/renderer/components/Paint.js +2 -22
  82. package/lib/module/renderer/components/Paint.js.map +1 -1
  83. package/lib/module/renderer/components/Picture.js +21 -0
  84. package/lib/module/renderer/components/Picture.js.map +1 -0
  85. package/lib/module/renderer/components/imageFilters/InnerShadow.js +4 -26
  86. package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  87. package/lib/module/renderer/components/imageFilters/{DropShadow.js → Shadow.js} +16 -6
  88. package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -0
  89. package/lib/module/renderer/components/imageFilters/index.js +1 -2
  90. package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
  91. package/lib/module/renderer/components/index.js +2 -1
  92. package/lib/module/renderer/components/index.js.map +1 -1
  93. package/lib/module/renderer/components/maskFilters/Blur.js +1 -1
  94. package/lib/module/renderer/components/maskFilters/Blur.js.map +1 -1
  95. package/lib/module/renderer/components/shapes/Box.js +102 -0
  96. package/lib/module/renderer/components/shapes/Box.js.map +1 -0
  97. package/lib/module/renderer/components/shapes/index.js +1 -0
  98. package/lib/module/renderer/components/shapes/index.js.map +1 -1
  99. package/lib/module/renderer/index.js +1 -0
  100. package/lib/module/renderer/index.js.map +1 -1
  101. package/lib/module/renderer/nodes/Declaration.js +4 -0
  102. package/lib/module/renderer/nodes/Declaration.js.map +1 -1
  103. package/lib/module/renderer/nodes/Drawing.js +8 -21
  104. package/lib/module/renderer/nodes/Drawing.js.map +1 -1
  105. package/lib/module/renderer/nodes/Node.js +9 -15
  106. package/lib/module/renderer/nodes/Node.js.map +1 -1
  107. package/lib/module/renderer/processors/Paint.js +22 -21
  108. package/lib/module/renderer/processors/Paint.js.map +1 -1
  109. package/lib/module/renderer/processors/math/Math.js +15 -0
  110. package/lib/module/renderer/processors/math/Math.js.map +1 -1
  111. package/lib/module/renderer/processors/math/Matrix3.js +6 -2
  112. package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
  113. package/lib/module/renderer/typeddash.js +21 -0
  114. package/lib/module/renderer/typeddash.js.map +1 -1
  115. package/lib/module/renderer/useContextBridge.js +21 -0
  116. package/lib/module/renderer/useContextBridge.js.map +1 -0
  117. package/lib/module/skia/Canvas.js.map +1 -1
  118. package/lib/module/skia/Picture/Picture.js +2 -0
  119. package/lib/module/skia/Picture/Picture.js.map +1 -0
  120. package/lib/module/skia/Picture/PictureFactory.js +2 -0
  121. package/lib/module/skia/Picture/PictureFactory.js.map +1 -0
  122. package/lib/module/skia/Picture/PictureRecorder.js +2 -0
  123. package/lib/module/skia/Picture/PictureRecorder.js.map +1 -0
  124. package/lib/module/skia/Picture/index.js +5 -0
  125. package/lib/module/skia/Picture/index.js.map +1 -0
  126. package/lib/module/skia/Picture/usePicture.js +19 -0
  127. package/lib/module/skia/Picture/usePicture.js.map +1 -0
  128. package/lib/module/skia/Skia.js +2 -0
  129. package/lib/module/skia/Skia.js.map +1 -1
  130. package/lib/module/skia/index.js +1 -0
  131. package/lib/module/skia/index.js.map +1 -1
  132. package/lib/module/values/hooks/useDerivedValue.js +1 -1
  133. package/lib/module/values/hooks/useDerivedValue.js.map +1 -1
  134. package/lib/module/views/SkiaView.js +6 -5
  135. package/lib/module/views/SkiaView.js.map +1 -1
  136. package/lib/module/views/types.js.map +1 -1
  137. package/lib/typescript/src/renderer/Canvas.d.ts +5 -10
  138. package/lib/typescript/src/renderer/components/Drawing.d.ts +7 -0
  139. package/lib/typescript/src/renderer/components/Picture.d.ts +6 -0
  140. package/lib/typescript/src/renderer/components/imageFilters/InnerShadow.d.ts +3 -12
  141. package/lib/typescript/src/renderer/components/imageFilters/{DropShadow.d.ts → Shadow.d.ts} +3 -2
  142. package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -2
  143. package/lib/typescript/src/renderer/components/index.d.ts +2 -1
  144. package/lib/typescript/src/renderer/components/shapes/Box.d.ts +23 -0
  145. package/lib/typescript/src/renderer/components/shapes/index.d.ts +1 -0
  146. package/lib/typescript/src/renderer/index.d.ts +1 -0
  147. package/lib/typescript/src/renderer/nodes/Declaration.d.ts +3 -0
  148. package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
  149. package/lib/typescript/src/renderer/nodes/Node.d.ts +2 -2
  150. package/lib/typescript/src/renderer/processors/Paint.d.ts +2 -2
  151. package/lib/typescript/src/renderer/processors/math/Math.d.ts +14 -0
  152. package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -0
  153. package/lib/typescript/src/renderer/typeddash.d.ts +1 -0
  154. package/lib/typescript/src/renderer/useContextBridge.d.ts +5 -0
  155. package/lib/typescript/src/skia/Canvas.d.ts +6 -0
  156. package/lib/typescript/src/skia/Picture/Picture.d.ts +26 -0
  157. package/lib/typescript/src/skia/Picture/PictureFactory.d.ts +8 -0
  158. package/lib/typescript/src/skia/Picture/PictureRecorder.d.ts +15 -0
  159. package/lib/typescript/src/skia/Picture/index.d.ts +4 -0
  160. package/lib/typescript/src/skia/Picture/usePicture.d.ts +11 -0
  161. package/lib/typescript/src/skia/Skia.d.ts +5 -0
  162. package/lib/typescript/src/skia/index.d.ts +1 -0
  163. package/lib/typescript/src/views/SkiaView.d.ts +25 -1
  164. package/lib/typescript/src/views/types.d.ts +0 -24
  165. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  166. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  167. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  168. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  169. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  170. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  171. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  172. package/package.json +1 -1
  173. package/src/renderer/Canvas.tsx +14 -30
  174. package/src/renderer/HostConfig.ts +2 -20
  175. package/src/renderer/components/Drawing.tsx +16 -0
  176. package/src/renderer/components/Group.tsx +25 -15
  177. package/src/renderer/components/Paint.tsx +5 -35
  178. package/src/renderer/components/Picture.tsx +17 -0
  179. package/src/renderer/components/imageFilters/InnerShadow.tsx +33 -47
  180. package/src/renderer/components/imageFilters/Shadow.tsx +39 -0
  181. package/src/renderer/components/imageFilters/index.ts +1 -2
  182. package/src/renderer/components/index.ts +2 -1
  183. package/src/renderer/components/maskFilters/Blur.tsx +1 -1
  184. package/src/renderer/components/shapes/Box.tsx +98 -0
  185. package/src/renderer/components/shapes/index.ts +1 -0
  186. package/src/renderer/index.ts +1 -0
  187. package/src/renderer/nodes/Declaration.tsx +14 -0
  188. package/src/renderer/nodes/Drawing.tsx +16 -26
  189. package/src/renderer/nodes/Node.ts +9 -12
  190. package/src/renderer/processors/Paint.ts +34 -31
  191. package/src/renderer/processors/math/Math.ts +16 -0
  192. package/src/renderer/processors/math/Matrix3.ts +35 -31
  193. package/src/renderer/typeddash.ts +18 -0
  194. package/src/renderer/useContextBridge.tsx +21 -0
  195. package/src/skia/Canvas.ts +7 -0
  196. package/src/skia/Picture/Picture.ts +34 -0
  197. package/src/skia/Picture/PictureFactory.ts +9 -0
  198. package/src/skia/Picture/PictureRecorder.ts +18 -0
  199. package/src/skia/Picture/index.ts +4 -0
  200. package/src/skia/Picture/usePicture.ts +28 -0
  201. package/src/skia/Skia.ts +5 -0
  202. package/src/skia/index.ts +1 -0
  203. package/src/values/hooks/useDerivedValue.ts +1 -1
  204. package/src/views/SkiaView.tsx +27 -3
  205. package/src/views/types.ts +0 -25
  206. package/lib/commonjs/renderer/components/Defs.js.map +0 -1
  207. package/lib/commonjs/renderer/components/imageFilters/DropShadow.js.map +0 -1
  208. package/lib/module/renderer/components/Defs.js +0 -16
  209. package/lib/module/renderer/components/Defs.js.map +0 -1
  210. package/lib/module/renderer/components/imageFilters/DropShadow.js.map +0 -1
  211. package/lib/typescript/src/renderer/components/Defs.d.ts +0 -5
  212. package/src/renderer/components/Defs.tsx +0 -19
  213. package/src/renderer/components/imageFilters/DropShadow.tsx +0 -31
@@ -1 +1 @@
1
- {"version":3,"sources":["Skia.ts"],"names":["processColor","Skia","Typeface","SkiaApi","MaskFilter","RuntimeEffect","Shader","ImageFilter","PathEffect","Data","SVG","FontMgr","TextBlob","Matrix","Font","Point","XYWHRect","RRectXY","Paint","Path","ColorFilter","ContourMeasureIter","Color","color","RSXform","MakeSurface","Surface","Make","MakeImageFromEncoded","Image","MakeImage","MakeVertices"],"mappings":"AAAA;AAcA,SAASA,YAAT,QAA6B,SAA7B;AAUA,OAAO,eAAP;;AA8DA;AACA;AACA;AACA,OAAO,MAAMC,IAAI,GAAG;AAClB;AACAC,EAAAA,QAAQ,EAAEC,OAAO,CAACD,QAFA;AAGlBE,EAAAA,UAAU,EAAED,OAAO,CAACC,UAHF;AAIlBC,EAAAA,aAAa,EAAEF,OAAO,CAACE,aAJL;AAKlBC,EAAAA,MAAM,EAAEH,OAAO,CAACG,MALE;AAMlBC,EAAAA,WAAW,EAAEJ,OAAO,CAACI,WANH;AAOlBC,EAAAA,UAAU,EAAEL,OAAO,CAACK,UAPF;AAQlBC,EAAAA,IAAI,EAAEN,OAAO,CAACM,IARI;AASlBC,EAAAA,GAAG,EAAEP,OAAO,CAACO,GATK;AAUlBC,EAAAA,OAAO,EAAER,OAAO,CAACQ,OAVC;AAWlBC,EAAAA,QAAQ,EAAET,OAAO,CAACS,QAXA;AAYlB;AACAC,EAAAA,MAAM,EAAEV,OAAO,CAACU,MAbE;AAclBC,EAAAA,IAAI,EAAEX,OAAO,CAACW,IAdI;AAelBC,EAAAA,KAAK,EAAEZ,OAAO,CAACY,KAfG;AAgBlBC,EAAAA,QAAQ,EAAEb,OAAO,CAACa,QAhBA;AAiBlBC,EAAAA,OAAO,EAAEd,OAAO,CAACc,OAjBC;AAkBlBC,EAAAA,KAAK,EAAEf,OAAO,CAACe,KAlBG;AAmBlBC,EAAAA,IAAI,EAAEhB,OAAO,CAACgB,IAnBI;AAoBlBC,EAAAA,WAAW,EAAEjB,OAAO,CAACiB,WApBH;AAqBlBC,EAAAA,kBAAkB,EAAElB,OAAO,CAACkB,kBArBV;AAsBlB;AACAC,EAAAA,KAAK,EAAGC,KAAD,IAA+CvB,YAAY,CAACuB,KAAD,EAAQ,CAAR,CAvBhD;AAwBlBC,EAAAA,OAAO,EAAErB,OAAO,CAACqB,OAxBC;AAyBlB;AACAC,EAAAA,WAAW,EAAEtB,OAAO,CAACuB,OAAR,CAAgBC,IA1BX;AA2BlBC,EAAAA,oBAAoB,EAAEzB,OAAO,CAAC0B,KAAR,CAAcD,oBA3BlB;AA4BlBE,EAAAA,SAAS,EAAE3B,OAAO,CAAC0B,KAAR,CAAcC,SA5BP;AA6BlBC,EAAAA,YAAY,EAAE5B,OAAO,CAAC4B;AA7BJ,CAAb","sourcesContent":["/*global SkiaApi*/\nimport type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type { RuntimeEffectFactory } from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkColor } from \"./Color\";\nimport { processColor } from \"./Color\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { FontMgrFactory } from \"./FontMgr/FontMgrFactory\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport \"./NativeSetup\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n Path: PathFactory;\n Matrix: () => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n FontMgr: FontMgrFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n\n/**\n * Declares the SkiaApi as an available object in the global scope\n */\ndeclare global {\n var SkiaApi: Skia;\n}\n\n/**\n * Declares the implemented API with overrides.\n */\nexport const Skia = {\n // Factories\n Typeface: SkiaApi.Typeface,\n MaskFilter: SkiaApi.MaskFilter,\n RuntimeEffect: SkiaApi.RuntimeEffect,\n Shader: SkiaApi.Shader,\n ImageFilter: SkiaApi.ImageFilter,\n PathEffect: SkiaApi.PathEffect,\n Data: SkiaApi.Data,\n SVG: SkiaApi.SVG,\n FontMgr: SkiaApi.FontMgr,\n TextBlob: SkiaApi.TextBlob,\n // Constructors\n Matrix: SkiaApi.Matrix,\n Font: SkiaApi.Font,\n Point: SkiaApi.Point,\n XYWHRect: SkiaApi.XYWHRect,\n RRectXY: SkiaApi.RRectXY,\n Paint: SkiaApi.Paint,\n Path: SkiaApi.Path,\n ColorFilter: SkiaApi.ColorFilter,\n ContourMeasureIter: SkiaApi.ContourMeasureIter,\n // Here are constructors for data types which are represented as typed arrays in CanvasKit\n Color: (color: Parameters<typeof processColor>[0]) => processColor(color, 1),\n RSXform: SkiaApi.RSXform,\n // For the following methods the factory symmetry is broken to be comptatible with CanvasKit\n MakeSurface: SkiaApi.Surface.Make,\n MakeImageFromEncoded: SkiaApi.Image.MakeImageFromEncoded,\n MakeImage: SkiaApi.Image.MakeImage,\n MakeVertices: SkiaApi.MakeVertices,\n};\n"]}
1
+ {"version":3,"sources":["Skia.ts"],"names":["processColor","Skia","Typeface","SkiaApi","MaskFilter","RuntimeEffect","Shader","ImageFilter","PathEffect","Data","SVG","FontMgr","TextBlob","Matrix","Font","Point","XYWHRect","RRectXY","Paint","PictureRecorder","Picture","Path","ColorFilter","ContourMeasureIter","Color","color","RSXform","MakeSurface","Surface","Make","MakeImageFromEncoded","Image","MakeImage","MakeVertices"],"mappings":"AAAA;AAcA,SAASA,YAAT,QAA6B,SAA7B;AAUA,OAAO,eAAP;;AAiEA;AACA;AACA;AACA,OAAO,MAAMC,IAAI,GAAG;AAClB;AACAC,EAAAA,QAAQ,EAAEC,OAAO,CAACD,QAFA;AAGlBE,EAAAA,UAAU,EAAED,OAAO,CAACC,UAHF;AAIlBC,EAAAA,aAAa,EAAEF,OAAO,CAACE,aAJL;AAKlBC,EAAAA,MAAM,EAAEH,OAAO,CAACG,MALE;AAMlBC,EAAAA,WAAW,EAAEJ,OAAO,CAACI,WANH;AAOlBC,EAAAA,UAAU,EAAEL,OAAO,CAACK,UAPF;AAQlBC,EAAAA,IAAI,EAAEN,OAAO,CAACM,IARI;AASlBC,EAAAA,GAAG,EAAEP,OAAO,CAACO,GATK;AAUlBC,EAAAA,OAAO,EAAER,OAAO,CAACQ,OAVC;AAWlBC,EAAAA,QAAQ,EAAET,OAAO,CAACS,QAXA;AAYlB;AACAC,EAAAA,MAAM,EAAEV,OAAO,CAACU,MAbE;AAclBC,EAAAA,IAAI,EAAEX,OAAO,CAACW,IAdI;AAelBC,EAAAA,KAAK,EAAEZ,OAAO,CAACY,KAfG;AAgBlBC,EAAAA,QAAQ,EAAEb,OAAO,CAACa,QAhBA;AAiBlBC,EAAAA,OAAO,EAAEd,OAAO,CAACc,OAjBC;AAkBlBC,EAAAA,KAAK,EAAEf,OAAO,CAACe,KAlBG;AAmBlBC,EAAAA,eAAe,EAAEhB,OAAO,CAACgB,eAnBP;AAoBlBC,EAAAA,OAAO,EAAEjB,OAAO,CAACiB,OApBC;AAqBlBC,EAAAA,IAAI,EAAElB,OAAO,CAACkB,IArBI;AAsBlBC,EAAAA,WAAW,EAAEnB,OAAO,CAACmB,WAtBH;AAuBlBC,EAAAA,kBAAkB,EAAEpB,OAAO,CAACoB,kBAvBV;AAwBlB;AACAC,EAAAA,KAAK,EAAGC,KAAD,IAA+CzB,YAAY,CAACyB,KAAD,EAAQ,CAAR,CAzBhD;AA0BlBC,EAAAA,OAAO,EAAEvB,OAAO,CAACuB,OA1BC;AA2BlB;AACAC,EAAAA,WAAW,EAAExB,OAAO,CAACyB,OAAR,CAAgBC,IA5BX;AA6BlBC,EAAAA,oBAAoB,EAAE3B,OAAO,CAAC4B,KAAR,CAAcD,oBA7BlB;AA8BlBE,EAAAA,SAAS,EAAE7B,OAAO,CAAC4B,KAAR,CAAcC,SA9BP;AA+BlBC,EAAAA,YAAY,EAAE9B,OAAO,CAAC8B;AA/BJ,CAAb","sourcesContent":["/*global SkiaApi*/\nimport type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type { RuntimeEffectFactory } from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkColor } from \"./Color\";\nimport { processColor } from \"./Color\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { FontMgrFactory } from \"./FontMgr/FontMgrFactory\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport \"./NativeSetup\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: () => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n FontMgr: FontMgrFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n\n/**\n * Declares the SkiaApi as an available object in the global scope\n */\ndeclare global {\n var SkiaApi: Skia;\n}\n\n/**\n * Declares the implemented API with overrides.\n */\nexport const Skia = {\n // Factories\n Typeface: SkiaApi.Typeface,\n MaskFilter: SkiaApi.MaskFilter,\n RuntimeEffect: SkiaApi.RuntimeEffect,\n Shader: SkiaApi.Shader,\n ImageFilter: SkiaApi.ImageFilter,\n PathEffect: SkiaApi.PathEffect,\n Data: SkiaApi.Data,\n SVG: SkiaApi.SVG,\n FontMgr: SkiaApi.FontMgr,\n TextBlob: SkiaApi.TextBlob,\n // Constructors\n Matrix: SkiaApi.Matrix,\n Font: SkiaApi.Font,\n Point: SkiaApi.Point,\n XYWHRect: SkiaApi.XYWHRect,\n RRectXY: SkiaApi.RRectXY,\n Paint: SkiaApi.Paint,\n PictureRecorder: SkiaApi.PictureRecorder,\n Picture: SkiaApi.Picture,\n Path: SkiaApi.Path,\n ColorFilter: SkiaApi.ColorFilter,\n ContourMeasureIter: SkiaApi.ContourMeasureIter,\n // Here are constructors for data types which are represented as typed arrays in CanvasKit\n Color: (color: Parameters<typeof processColor>[0]) => processColor(color, 1),\n RSXform: SkiaApi.RSXform,\n // For the following methods the factory symmetry is broken to be comptatible with CanvasKit\n MakeSurface: SkiaApi.Surface.Make,\n MakeImageFromEncoded: SkiaApi.Image.MakeImageFromEncoded,\n MakeImage: SkiaApi.Image.MakeImage,\n MakeVertices: SkiaApi.MakeVertices,\n};\n"]}
@@ -20,5 +20,6 @@ export * from "./Surface";
20
20
  export * from "./FontMgr";
21
21
  export * from "./Vertices";
22
22
  export * from "./Color";
23
+ export * from "./Picture";
23
24
  export * from "./Data";
24
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["Skia"],"mappings":"AAAA,SAASA,IAAT,QAAqB,QAArB;AACA,cAAc,UAAd;AACA,cAAc,SAAd;AACA,cAAc,QAAd;AACA,cAAc,SAAd;AACA,cAAc,SAAd;AACA,cAAc,QAAd;AACA,cAAc,QAAd;AACA,cAAc,YAAd;AACA,cAAc,cAAd;AACA,cAAc,eAAd;AACA,cAAc,eAAd;AACA,cAAc,cAAd;AACA,cAAc,iBAAd;AACA,cAAc,UAAd;AACA,cAAc,SAAd;AACA,cAAc,UAAd;AACA,cAAc,OAAd;AACA,cAAc,WAAd;AACA,cAAc,WAAd;AACA,cAAc,YAAd;AACA,cAAc,SAAd;AACA,cAAc,QAAd","sourcesContent":["export { Skia } from \"./Skia\";\nexport * from \"./Canvas\";\nexport * from \"./Paint\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./Point\";\nexport * from \"./Path\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./MaskFilter\";\nexport * from \"./ColorFilter\";\nexport * from \"./ImageFilter\";\nexport * from \"./PathEffect\";\nexport * from \"./RuntimeEffect\";\nexport * from \"./Shader\";\nexport * from \"./Image\";\nexport * from \"./Matrix\";\nexport * from \"./SVG\";\nexport * from \"./Surface\";\nexport * from \"./FontMgr\";\nexport * from \"./Vertices\";\nexport * from \"./Color\";\nexport * from \"./Data\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["Skia"],"mappings":"AAAA,SAASA,IAAT,QAAqB,QAArB;AACA,cAAc,UAAd;AACA,cAAc,SAAd;AACA,cAAc,QAAd;AACA,cAAc,SAAd;AACA,cAAc,SAAd;AACA,cAAc,QAAd;AACA,cAAc,QAAd;AACA,cAAc,YAAd;AACA,cAAc,cAAd;AACA,cAAc,eAAd;AACA,cAAc,eAAd;AACA,cAAc,cAAd;AACA,cAAc,iBAAd;AACA,cAAc,UAAd;AACA,cAAc,SAAd;AACA,cAAc,UAAd;AACA,cAAc,OAAd;AACA,cAAc,WAAd;AACA,cAAc,WAAd;AACA,cAAc,YAAd;AACA,cAAc,SAAd;AACA,cAAc,WAAd;AACA,cAAc,QAAd","sourcesContent":["export { Skia } from \"./Skia\";\nexport * from \"./Canvas\";\nexport * from \"./Paint\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./Point\";\nexport * from \"./Path\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./MaskFilter\";\nexport * from \"./ColorFilter\";\nexport * from \"./ImageFilter\";\nexport * from \"./PathEffect\";\nexport * from \"./RuntimeEffect\";\nexport * from \"./Shader\";\nexport * from \"./Image\";\nexport * from \"./Matrix\";\nexport * from \"./SVG\";\nexport * from \"./Surface\";\nexport * from \"./FontMgr\";\nexport * from \"./Vertices\";\nexport * from \"./Color\";\nexport * from \"./Picture\";\nexport * from \"./Data\";\n"]}
@@ -1,6 +1,6 @@
1
1
  import { useMemo } from "react";
2
2
  import { ValueApi } from "../api";
3
- import { isValue } from "../../renderer";
3
+ import { isValue } from "../../renderer/processors";
4
4
  /**
5
5
  * Creates a new derived value - a value that will calculate its value depending
6
6
  * on other values.
@@ -1 +1 @@
1
- {"version":3,"sources":["useDerivedValue.ts"],"names":["useMemo","ValueApi","isValue","useDerivedValue","cb","values","createDerivedValue","filter"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,QAAT,QAAyB,QAAzB;AACA,SAASC,OAAT,QAAwB,gBAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,eAAe,GAAG,CAAIC,EAAJ,EAAiBC,MAAjB,KAC7BL,OAAO,CACL,MAAMC,QAAQ,CAACK,kBAAT,CAA+BF,EAA/B,EAAmCC,MAAM,CAACE,MAAP,CAAcL,OAAd,CAAnC,CADD,EAEL;AACAG,MAHK,CADF","sourcesContent":["import { useMemo } from \"react\";\n\nimport { ValueApi } from \"../api\";\nimport { isValue } from \"../../renderer\";\n\n/**\n * Creates a new derived value - a value that will calculate its value depending\n * on other values.\n * @param cb Callback to calculate new value\n * @param values Dependant values\n * @returns A readonly value\n */\nexport const useDerivedValue = <R>(cb: () => R, values: unknown[]) =>\n useMemo(\n () => ValueApi.createDerivedValue<R>(cb, values.filter(isValue)),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n values\n );\n"]}
1
+ {"version":3,"sources":["useDerivedValue.ts"],"names":["useMemo","ValueApi","isValue","useDerivedValue","cb","values","createDerivedValue","filter"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,QAAT,QAAyB,QAAzB;AACA,SAASC,OAAT,QAAwB,2BAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,eAAe,GAAG,CAAIC,EAAJ,EAAiBC,MAAjB,KAC7BL,OAAO,CACL,MAAMC,QAAQ,CAACK,kBAAT,CAA+BF,EAA/B,EAAmCC,MAAM,CAACE,MAAP,CAAcL,OAAd,CAAnC,CADD,EAEL;AACAG,MAHK,CADF","sourcesContent":["import { useMemo } from \"react\";\n\nimport { ValueApi } from \"../api\";\nimport { isValue } from \"../../renderer/processors\";\n\n/**\n * Creates a new derived value - a value that will calculate its value depending\n * on other values.\n * @param cb Callback to calculate new value\n * @param values Dependant values\n * @returns A readonly value\n */\nexport const useDerivedValue = <R>(cb: () => R, values: unknown[]) =>\n useMemo(\n () => ValueApi.createDerivedValue<R>(cb, values.filter(isValue)),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n values\n );\n"]}
@@ -1,3 +1,5 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
4
 
3
5
  import React from "react";
@@ -87,17 +89,16 @@ export class SkiaView extends React.Component {
87
89
 
88
90
  render() {
89
91
  const {
90
- style,
91
92
  mode,
92
- debug = false
93
+ debug = false,
94
+ ...viewProps
93
95
  } = this.props;
94
- return /*#__PURE__*/React.createElement(NativeSkiaView, {
95
- style: style,
96
+ return /*#__PURE__*/React.createElement(NativeSkiaView, _extends({
96
97
  collapsable: false,
97
98
  nativeID: `${this._nativeId}`,
98
99
  mode: mode,
99
100
  debug: debug
100
- });
101
+ }, viewProps));
101
102
  }
102
103
 
103
104
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["SkiaView.tsx"],"names":["React","requireNativeComponent","SkiaViewNativeId","NativeSkiaView","SkiaViewApi","global","SkiaView","Component","constructor","props","_nativeId","onDraw","assertDrawCallbacksEnabled","setDrawCallback","nativeId","componentDidUpdate","prevProps","makeImageSnapshot","rect","redraw","invalidateSkiaView","setDrawMode","mode","registerValues","values","registerValuesInView","render","style","debug","Error"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,sBAAT,QAAuC,cAAvC;AAYA,IAAIC,gBAAgB,GAAG,IAAvB;AAEA,MAAMC,cAAc,GAAGF,sBAAsB,CAC3C,qBAD2C,CAA7C;AAoBA,MAAM;AAAEG,EAAAA;AAAF,IAAkBC,MAAxB;AAEA,OAAO,MAAMC,QAAN,SAAuBN,KAAK,CAACO,SAA7B,CAAsD;AAC3DC,EAAAA,WAAW,CAACC,KAAD,EAAuB;AAChC,UAAMA,KAAN;;AADgC;;AAEhC,SAAKC,SAAL,GAAiBR,gBAAgB,EAAjC;AACA,UAAM;AAAES,MAAAA;AAAF,QAAaF,KAAnB;;AACA,QAAIE,MAAJ,EAAY;AACVC,MAAAA,0BAA0B;AAC1BR,MAAAA,WAAW,CAACS,eAAZ,CAA4B,KAAKH,SAAjC,EAA4CC,MAA5C;AACD;AACF;;AAIkB,MAARG,QAAQ,GAAG;AACpB,WAAO,KAAKJ,SAAZ;AACD;;AAEDK,EAAAA,kBAAkB,CAACC,SAAD,EAA2B;AAC3C,UAAM;AAAEL,MAAAA;AAAF,QAAa,KAAKF,KAAxB;;AACA,QAAIE,MAAM,KAAKK,SAAS,CAACL,MAAzB,EAAiC;AAC/BC,MAAAA,0BAA0B;AAC1BR,MAAAA,WAAW,CAACS,eAAZ,CAA4B,KAAKH,SAAjC,EAA4CC,MAA5C;AACD;AACF;AAED;AACF;AACA;AACA;AACA;;;AACSM,EAAAA,iBAAiB,CAACC,IAAD,EAAgB;AACtCN,IAAAA,0BAA0B;AAC1B,WAAOR,WAAW,CAACa,iBAAZ,CAA8B,KAAKP,SAAnC,EAA8CQ,IAA9C,CAAP;AACD;AAED;AACF;AACA;;;AACSC,EAAAA,MAAM,GAAG;AACdP,IAAAA,0BAA0B;AAC1BR,IAAAA,WAAW,CAACgB,kBAAZ,CAA+B,KAAKV,SAApC;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACSW,EAAAA,WAAW,CAACC,IAAD,EAAiB;AACjCV,IAAAA,0BAA0B;AAC1BR,IAAAA,WAAW,CAACiB,WAAZ,CAAwB,KAAKX,SAA7B,EAAwCY,IAAxC;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSC,EAAAA,cAAc,CAACC,MAAD,EAAuC;AAC1DZ,IAAAA,0BAA0B;AAC1B,WAAOR,WAAW,CAACqB,oBAAZ,CAAiC,KAAKf,SAAtC,EAAiDc,MAAjD,CAAP;AACD;;AAEDE,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEC,MAAAA,KAAF;AAASL,MAAAA,IAAT;AAAeM,MAAAA,KAAK,GAAG;AAAvB,QAAiC,KAAKnB,KAA5C;AACA,wBACE,oBAAC,cAAD;AACE,MAAA,KAAK,EAAEkB,KADT;AAEE,MAAA,WAAW,EAAE,KAFf;AAGE,MAAA,QAAQ,EAAG,GAAE,KAAKjB,SAAU,EAH9B;AAIE,MAAA,IAAI,EAAEY,IAJR;AAKE,MAAA,KAAK,EAAEM;AALT,MADF;AASD;;AA9E0D;;AAiF7D,MAAMhB,0BAA0B,GAAG,MAAM;AACvC,MACER,WAAW,KAAK,IAAhB,IACAA,WAAW,CAACS,eAAZ,IAA+B,IAD/B,IAEAT,WAAW,CAACgB,kBAAZ,IAAkC,IAHpC,EAIE;AACA,UAAMS,KAAK,CAAC,0BAAD,CAAX;AACD;AACF,CARD","sourcesContent":["import React from \"react\";\nimport { requireNativeComponent } from \"react-native\";\n\nimport type { SkImage, SkRect } from \"../skia\";\nimport type { SkiaReadonlyValue } from \"../values\";\n\nimport type {\n DrawMode,\n SkiaViewProps,\n RNSkiaDrawCallback,\n NativeSkiaViewProps,\n} from \"./types\";\n\nlet SkiaViewNativeId = 1000;\n\nconst NativeSkiaView = requireNativeComponent<NativeSkiaViewProps>(\n \"ReactNativeSkiaView\"\n);\n\ndeclare global {\n var SkiaViewApi: {\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: SkiaReadonlyValue<unknown>[]\n ) => () => void;\n };\n}\n\nconst { SkiaViewApi } = global;\n\nexport class SkiaView extends React.Component<SkiaViewProps> {\n constructor(props: SkiaViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId++;\n const { onDraw } = props;\n if (onDraw) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawCallback(this._nativeId, onDraw);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaViewProps) {\n const { onDraw } = this.props;\n if (onDraw !== prevProps.onDraw) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawCallback(this._nativeId, onDraw);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertDrawCallbacksEnabled();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertDrawCallbacksEnabled();\n SkiaViewApi.invalidateSkiaView(this._nativeId);\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawMode(this._nativeId, mode);\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(values: SkiaReadonlyValue<unknown>[]) {\n assertDrawCallbacksEnabled();\n return SkiaViewApi.registerValuesInView(this._nativeId, values);\n }\n\n render() {\n const { style, mode, debug = false } = this.props;\n return (\n <NativeSkiaView\n style={style}\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n />\n );\n }\n}\n\nconst assertDrawCallbacksEnabled = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setDrawCallback == null ||\n SkiaViewApi.invalidateSkiaView == null\n ) {\n throw Error(\"Skia Api is not enabled.\");\n }\n};\n"]}
1
+ {"version":3,"sources":["SkiaView.tsx"],"names":["React","requireNativeComponent","SkiaViewNativeId","NativeSkiaView","SkiaViewApi","global","SkiaView","Component","constructor","props","_nativeId","onDraw","assertDrawCallbacksEnabled","setDrawCallback","nativeId","componentDidUpdate","prevProps","makeImageSnapshot","rect","redraw","invalidateSkiaView","setDrawMode","mode","registerValues","values","registerValuesInView","render","debug","viewProps","Error"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,sBAAT,QAAuC,cAAvC;AAWA,IAAIC,gBAAgB,GAAG,IAAvB;AAEA,MAAMC,cAAc,GAAGF,sBAAsB,CAC3C,qBAD2C,CAA7C;AAoBA,MAAM;AAAEG,EAAAA;AAAF,IAAkBC,MAAxB;AA0BA,OAAO,MAAMC,QAAN,SAAuBN,KAAK,CAACO,SAA7B,CAAsD;AAC3DC,EAAAA,WAAW,CAACC,KAAD,EAAuB;AAChC,UAAMA,KAAN;;AADgC;;AAEhC,SAAKC,SAAL,GAAiBR,gBAAgB,EAAjC;AACA,UAAM;AAAES,MAAAA;AAAF,QAAaF,KAAnB;;AACA,QAAIE,MAAJ,EAAY;AACVC,MAAAA,0BAA0B;AAC1BR,MAAAA,WAAW,CAACS,eAAZ,CAA4B,KAAKH,SAAjC,EAA4CC,MAA5C;AACD;AACF;;AAIkB,MAARG,QAAQ,GAAG;AACpB,WAAO,KAAKJ,SAAZ;AACD;;AAEDK,EAAAA,kBAAkB,CAACC,SAAD,EAA2B;AAC3C,UAAM;AAAEL,MAAAA;AAAF,QAAa,KAAKF,KAAxB;;AACA,QAAIE,MAAM,KAAKK,SAAS,CAACL,MAAzB,EAAiC;AAC/BC,MAAAA,0BAA0B;AAC1BR,MAAAA,WAAW,CAACS,eAAZ,CAA4B,KAAKH,SAAjC,EAA4CC,MAA5C;AACD;AACF;AAED;AACF;AACA;AACA;AACA;;;AACSM,EAAAA,iBAAiB,CAACC,IAAD,EAAgB;AACtCN,IAAAA,0BAA0B;AAC1B,WAAOR,WAAW,CAACa,iBAAZ,CAA8B,KAAKP,SAAnC,EAA8CQ,IAA9C,CAAP;AACD;AAED;AACF;AACA;;;AACSC,EAAAA,MAAM,GAAG;AACdP,IAAAA,0BAA0B;AAC1BR,IAAAA,WAAW,CAACgB,kBAAZ,CAA+B,KAAKV,SAApC;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACSW,EAAAA,WAAW,CAACC,IAAD,EAAiB;AACjCV,IAAAA,0BAA0B;AAC1BR,IAAAA,WAAW,CAACiB,WAAZ,CAAwB,KAAKX,SAA7B,EAAwCY,IAAxC;AACD;AAED;AACF;AACA;AACA;AACA;;;AACSC,EAAAA,cAAc,CAACC,MAAD,EAAuC;AAC1DZ,IAAAA,0BAA0B;AAC1B,WAAOR,WAAW,CAACqB,oBAAZ,CAAiC,KAAKf,SAAtC,EAAiDc,MAAjD,CAAP;AACD;;AAEDE,EAAAA,MAAM,GAAG;AACP,UAAM;AAAEJ,MAAAA,IAAF;AAAQK,MAAAA,KAAK,GAAG,KAAhB;AAAuB,SAAGC;AAA1B,QAAwC,KAAKnB,KAAnD;AACA,wBACE,oBAAC,cAAD;AACE,MAAA,WAAW,EAAE,KADf;AAEE,MAAA,QAAQ,EAAG,GAAE,KAAKC,SAAU,EAF9B;AAGE,MAAA,IAAI,EAAEY,IAHR;AAIE,MAAA,KAAK,EAAEK;AAJT,OAKMC,SALN,EADF;AASD;;AA9E0D;;AAiF7D,MAAMhB,0BAA0B,GAAG,MAAM;AACvC,MACER,WAAW,KAAK,IAAhB,IACAA,WAAW,CAACS,eAAZ,IAA+B,IAD/B,IAEAT,WAAW,CAACgB,kBAAZ,IAAkC,IAHpC,EAIE;AACA,UAAMS,KAAK,CAAC,0BAAD,CAAX;AACD;AACF,CARD","sourcesContent":["import React from \"react\";\nimport type { ViewProps } from \"react-native\";\nimport { requireNativeComponent } from \"react-native\";\n\nimport type { SkImage, SkRect } from \"../skia\";\nimport type { SkiaReadonlyValue } from \"../values\";\n\nimport type {\n DrawMode,\n RNSkiaDrawCallback,\n NativeSkiaViewProps,\n} from \"./types\";\n\nlet SkiaViewNativeId = 1000;\n\nconst NativeSkiaView = requireNativeComponent<NativeSkiaViewProps>(\n \"ReactNativeSkiaView\"\n);\n\ndeclare global {\n var SkiaViewApi: {\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: SkiaReadonlyValue<unknown>[]\n ) => () => void;\n };\n}\n\nconst { SkiaViewApi } = global;\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\nexport class SkiaView extends React.Component<SkiaViewProps> {\n constructor(props: SkiaViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId++;\n const { onDraw } = props;\n if (onDraw) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawCallback(this._nativeId, onDraw);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaViewProps) {\n const { onDraw } = this.props;\n if (onDraw !== prevProps.onDraw) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawCallback(this._nativeId, onDraw);\n }\n }\n\n /**\n * Creates a snapshot from the canvas in the surface\n * @param rect Rect to use as bounds. Optional.\n * @returns An Image object.\n */\n public makeImageSnapshot(rect?: SkRect) {\n assertDrawCallbacksEnabled();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertDrawCallbacksEnabled();\n SkiaViewApi.invalidateSkiaView(this._nativeId);\n }\n\n /**\n * Updates the drawing mode for the skia view. This is the same\n * as declaratively setting the mode property on the SkiaView.\n * There are two drawing modes, \"continuous\" and \"default\",\n * where the continuous mode will continuously redraw the view and\n * the default mode will only redraw when any of the regular react\n * properties are changed like size and margins.\n * @param mode Drawing mode to use.\n */\n public setDrawMode(mode: DrawMode) {\n assertDrawCallbacksEnabled();\n SkiaViewApi.setDrawMode(this._nativeId, mode);\n }\n\n /**\n * Registers one or move values as a dependant value of the Skia View. The view will\n * The view will redraw itself when any of the values change.\n * @param values Values to register\n */\n public registerValues(values: SkiaReadonlyValue<unknown>[]) {\n assertDrawCallbacksEnabled();\n return SkiaViewApi.registerValuesInView(this._nativeId, values);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertDrawCallbacksEnabled = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setDrawCallback == null ||\n SkiaViewApi.invalidateSkiaView == null\n ) {\n throw Error(\"Skia Api is not enabled.\");\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["types.ts"],"names":["TouchType"],"mappings":"AAWA,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 } from \"../skia/Canvas\";\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 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\nexport type SkiaViewProps = {\n style?: ViewProps[\"style\"];\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\n/**\n * Listener interface for value changes\n */\nexport interface ValueListener {\n addListener: (callback: () => void) => number;\n removeListener: (id: number) => void;\n}\n"]}
1
+ {"version":3,"sources":["types.ts"],"names":["TouchType"],"mappings":"AAWA,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 } from \"../skia/Canvas\";\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 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"]}
@@ -1,19 +1,15 @@
1
1
  import React from "react";
2
- import type { RefObject, ReactNode, ComponentProps, Context } from "react";
2
+ import type { RefObject, ReactNode, ComponentProps } from "react";
3
3
  import ReactReconciler from "react-reconciler";
4
4
  import { SkiaView } from "../views";
5
5
  import type { TouchHandler } from "../views";
6
6
  import type { FontMgr } from "../skia/FontMgr/FontMgr";
7
+ import type { SkiaReadonlyValue } from "../values/types";
7
8
  import { Container } from "./nodes";
8
- export declare const useContextBridge: (...contexts: Context<any>[]) => ({ children }: {
9
- children: ReactNode;
10
- }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
11
- interface CanvasContext {
9
+ export declare const useCanvasSize: () => SkiaReadonlyValue<{
12
10
  width: number;
13
11
  height: number;
14
- }
15
- declare const CanvasContext: React.Context<CanvasContext | null>;
16
- export declare const useCanvas: () => CanvasContext;
12
+ }>;
17
13
  export declare const skiaReconciler: ReactReconciler.Reconciler<Container, import("./nodes").Node<unknown>, import("./nodes").Node<unknown>, import("./nodes").Node<unknown>, import("./nodes").Node<unknown>>;
18
14
  export declare const useCanvasRef: () => React.RefObject<SkiaView>;
19
15
  export interface CanvasProps extends ComponentProps<typeof SkiaView> {
@@ -22,5 +18,4 @@ export interface CanvasProps extends ComponentProps<typeof SkiaView> {
22
18
  onTouch?: TouchHandler;
23
19
  fontMgr?: FontMgr;
24
20
  }
25
- export declare const Canvas: React.ForwardRefExoticComponent<Pick<CanvasProps, "style" | "mode" | "debug" | "onDraw" | "children" | "onTouch" | "fontMgr"> & React.RefAttributes<SkiaView>>;
26
- export {};
21
+ export declare const Canvas: React.ForwardRefExoticComponent<Pick<CanvasProps, "children" | "style" | "mode" | "debug" | "onDraw" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "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" | "fontMgr"> & React.RefAttributes<SkiaView>>;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import type { DrawingContext } from "../DrawingContext";
3
+ interface DrawingProps {
4
+ drawing: (ctx: DrawingContext) => void;
5
+ }
6
+ export declare const Drawing: (props: DrawingProps) => JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import type { SkPicture } from "../../skia";
3
+ export interface PictureProps {
4
+ picture: SkPicture;
5
+ }
6
+ export declare const Picture: (props: PictureProps) => JSX.Element;
@@ -1,12 +1,3 @@
1
- /// <reference types="react" />
2
- import type { AnimatedProps } from "../../processors";
3
- import type { Color } from "../../../skia";
4
- export interface InnerShadowProps {
5
- dx: number;
6
- dy: number;
7
- blur: number;
8
- color: Color;
9
- shadowOnly?: boolean;
10
- inner?: boolean;
11
- }
12
- export declare const InnerShadow: (props: AnimatedProps<InnerShadowProps>) => JSX.Element;
1
+ import type { SkColor } from "../../../skia";
2
+ import type { SkImageFilter } from "../../../skia/ImageFilter/ImageFilter";
3
+ export declare const MakeInnerShadow: (shadowOnly: boolean | undefined, dx: number, dy: number, sigmaX: number, sigmaY: number, color: SkColor, input: SkImageFilter | null) => SkImageFilter;
@@ -1,11 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import type { AnimatedProps } from "../../processors/Animations/Animations";
3
3
  import type { Color } from "../../../skia/Color";
4
- export interface DropShadowProps {
4
+ export interface ShadowProps {
5
5
  dx: number;
6
6
  dy: number;
7
7
  blur: number;
8
8
  color: Color;
9
+ inner?: boolean;
9
10
  shadowOnly?: boolean;
10
11
  }
11
- export declare const DropShadow: (props: AnimatedProps<DropShadowProps>) => JSX.Element;
12
+ export declare const Shadow: (props: AnimatedProps<ShadowProps>) => JSX.Element;
@@ -1,6 +1,5 @@
1
1
  export * from "./Blur";
2
2
  export * from "./Offset";
3
3
  export * from "./DisplacementMap";
4
- export * from "./DropShadow";
5
- export * from "./InnerShadow";
4
+ export * from "./Shadow";
6
5
  export * from "./Morphology";
@@ -8,9 +8,10 @@ export * from "./maskFilters";
8
8
  export * from "./imageFilters";
9
9
  export * from "./pathEffects";
10
10
  export * from "../processors";
11
+ export * from "./Picture";
11
12
  export * from "./Group";
12
13
  export * from "./Mask";
13
14
  export * from "./Paint";
14
15
  export * from "./Compose";
15
16
  export * from "./Blend";
16
- export * from "./Defs";
17
+ export * from "./Drawing";
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import type { Color, SkRRect } from "../../../skia";
3
+ import type { AnimatedProps, CustomPaintProps } from "../../processors";
4
+ import type { SkRect } from "../../../skia/Rect";
5
+ interface BoxShadowProps {
6
+ dx?: number;
7
+ dy?: number;
8
+ spread?: number;
9
+ blur: number;
10
+ color?: Color;
11
+ inner?: boolean;
12
+ }
13
+ export declare const BoxShadow: (props: AnimatedProps<BoxShadowProps>) => JSX.Element;
14
+ interface BoxProps extends CustomPaintProps {
15
+ box: SkRRect | SkRect;
16
+ }
17
+ export declare const Box: {
18
+ (props: AnimatedProps<BoxProps>): JSX.Element;
19
+ defaultProps: {
20
+ shadows: never[];
21
+ };
22
+ };
23
+ export {};
@@ -10,3 +10,4 @@ export * from "./Patch";
10
10
  export * from "./Vertices";
11
11
  export * from "./Fill";
12
12
  export * from "./FitBox";
13
+ export * from "./Box";
@@ -1,3 +1,4 @@
1
1
  export * from "./Canvas";
2
2
  export * from "./components";
3
3
  export * from "./nodes";
4
+ export * from "./useContextBridge";
@@ -1,3 +1,4 @@
1
+ import type { DependencyList } from "react";
1
2
  import type { DrawingContext } from "../DrawingContext";
2
3
  import type { SkJSIInstance } from "../../skia/JsiInstance";
3
4
  import type { AnimatedProps } from "../processors";
@@ -6,6 +7,8 @@ import { Node } from "./Node";
6
7
  export declare type DeclarationResult = SkJSIInstance<string> | null;
7
8
  declare type DeclarationCallback<T> = (props: T, children: DeclarationResult[], ctx: DrawingContext) => DeclarationResult;
8
9
  export declare const createDeclaration: <T>(cb: DeclarationCallback<T>) => DeclarationCallback<T>;
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>;
9
12
  export interface DeclarationProps<P> {
10
13
  onDeclare: DeclarationCallback<P>;
11
14
  }
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import type { DependencyList, ReactNode } from "react";
2
2
  import type { DrawingContext } from "../DrawingContext";
3
3
  import type { AnimatedProps } from "../processors/Animations/Animations";
4
4
  import type { DependencyManager } from "../DependencyManager";
@@ -6,12 +6,12 @@ import { Node } from "./Node";
6
6
  declare type DrawingCallback<P> = (ctx: DrawingContext, props: P, node: Node<P>) => void;
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
+ export declare const useDrawing: <P>(cb: OnDrawCallback<P>, deps?: DependencyList | undefined) => OnDrawCallback<P>;
9
10
  export declare type DrawingProps<T> = {
10
11
  onDraw: DrawingCallback<T>;
11
12
  skipProcessing?: boolean;
12
13
  children?: ReactNode | ReactNode[];
13
14
  };
14
- export declare const Drawing: <P>(props: DrawingProps<P>) => JSX.Element;
15
15
  export declare class DrawingNode<P> extends Node<P> {
16
16
  onDraw: DrawingCallback<P>;
17
17
  skipProcessing: boolean;
@@ -11,13 +11,13 @@ export declare abstract class Node<P = unknown> {
11
11
  readonly children: Node[];
12
12
  _props: AnimatedProps<P>;
13
13
  memoizable: boolean;
14
- memoized: boolean;
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
19
  set props(props: AnimatedProps<P>);
20
20
  get props(): AnimatedProps<P>;
21
- visit(ctx: DrawingContext): SkJSIInstance<string>[];
21
+ visit(ctx: DrawingContext, children?: Node[]): SkJSIInstance<string>[];
22
22
  }
23
23
  export {};
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode, RefObject } from "react";
2
2
  import { BlendMode, PaintStyle, StrokeJoin, StrokeCap } from "../../skia";
3
3
  import type { SkPaint, Color } from "../../skia";
4
+ import type { DeclarationResult } from "../nodes";
4
5
  export declare type SkEnum<T> = Uncapitalize<keyof T extends string ? keyof T : never>;
5
6
  export interface ChildrenProps {
6
7
  children?: ReactNode | ReactNode[];
@@ -17,5 +18,4 @@ export interface CustomPaintProps extends ChildrenProps {
17
18
  opacity?: number;
18
19
  }
19
20
  export declare const enumKey: <K extends string>(k: K) => Capitalize<K>;
20
- export declare const processPaint: (paint: SkPaint, currentOpacity: number, { color, blendMode, style, strokeWidth, strokeJoin, strokeCap, strokeMiter, opacity, }: CustomPaintProps) => void;
21
- export declare const selectPaint: (currentPaint: SkPaint, { paint, color: cl, blendMode, style: paintStyle, strokeWidth, strokeJoin, strokeCap, strokeMiter, opacity, }: CustomPaintProps) => SkPaint;
21
+ export declare const processPaint: (paint: SkPaint, currentOpacity: number, { paint: paintRef, color, blendMode, style, strokeWidth, strokeJoin, strokeCap, strokeMiter, opacity, }: CustomPaintProps, children: DeclarationResult[]) => SkPaint;
@@ -1 +1,15 @@
1
+ /**
2
+ * Linear interpolation
3
+ * @param value
4
+ * @param x
5
+ * @param y
6
+ */
1
7
  export declare const mix: (value: number, x: number, y: number) => number;
8
+ /**
9
+ * @summary Clamps a node with a lower and upper bound.
10
+ * @example
11
+ clamp(-1, 0, 100); // 0
12
+ clamp(1, 0, 100); // 1
13
+ clamp(101, 0, 100); // 100
14
+ */
15
+ export declare const clamp: (value: number, lowerBound: number, upperBound: number) => number;
@@ -9,5 +9,6 @@ declare type Transformations = {
9
9
  readonly [Name in Transform2dName]: number;
10
10
  };
11
11
  export declare type Transforms2d = readonly (Pick<Transformations, "translateX"> | Pick<Transformations, "translateY"> | Pick<Transformations, "scale"> | Pick<Transformations, "scaleX"> | Pick<Transformations, "scaleY"> | Pick<Transformations, "skewX"> | Pick<Transformations, "skewY"> | Pick<Transformations, "rotate">)[];
12
+ export declare const matrixVecMul3: (m: Matrix3, v: Vec3) => readonly [number, number, number];
12
13
  export declare const processTransform2d: (transforms: Transforms2d) => SkMatrix;
13
14
  export {};
@@ -1,2 +1,3 @@
1
1
  export declare const mapKeys: <T>(obj: T) => (keyof T)[];
2
2
  export declare const exhaustiveCheck: (a: never) => never;
3
+ export declare const shallowEq: <P>(p1: P, p2: P) => boolean;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import type { ReactNode, Context } from "react";
3
+ export declare const useContextBridge: (...contexts: Context<any>[]) => ({ children }: {
4
+ children: ReactNode;
5
+ }) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
@@ -12,6 +12,7 @@ import type { SkMatrix } from "./Matrix";
12
12
  import type { SkImageFilter } from "./ImageFilter";
13
13
  import type { SkVertices } from "./Vertices";
14
14
  import type { SkTextBlob } from "./TextBlob";
15
+ import type { SkPicture } from "./Picture";
15
16
  export declare enum ClipOp {
16
17
  Difference = 0,
17
18
  Intersect = 1
@@ -372,4 +373,9 @@ export interface SkCanvas {
372
373
  * @param m
373
374
  */
374
375
  concat(m: SkMatrix): void;
376
+ /**
377
+ * Draws the given picture using the current clip, current matrix, and the provided paint.
378
+ * @param skp
379
+ */
380
+ drawPicture(skp: SkPicture): void;
375
381
  }
@@ -0,0 +1,26 @@
1
+ import type { InputColorMatrix } from "../ColorFilter";
2
+ import type { FilterMode } from "../Image";
3
+ import type { TileMode } from "../ImageFilter";
4
+ import type { SkRect } from "../Rect";
5
+ import type { IShader } from "../Shader";
6
+ export interface SkPicture {
7
+ /**
8
+ * Returns a new shader that will draw with this picture.
9
+ *
10
+ * @param tmx The tiling mode to use when sampling in the x-direction.
11
+ * @param tmy The tiling mode to use when sampling in the y-direction.
12
+ * @param mode How to filter the tiles
13
+ * @param localMatrix Optional matrix used when sampling
14
+ * @param tileRect The tile rectangle in picture coordinates: this represents the subset
15
+ * (or superset) of the picture used when building a tile. It is not
16
+ * affected by localMatrix and does not imply scaling (only translation
17
+ * and cropping). If null, the tile rect is considered equal to the picture
18
+ * bounds.
19
+ */
20
+ makeShader(tmx: TileMode, tmy: TileMode, mode: FilterMode, localMatrix?: InputColorMatrix, tileRect?: SkRect): IShader;
21
+ /**
22
+ * Returns the serialized format of this SkPicture. The format may change at anytime and
23
+ * no promises are made for backwards or forward compatibility.
24
+ */
25
+ serialize(): Uint8Array | null;
26
+ }
@@ -0,0 +1,8 @@
1
+ import type { SkPicture } from "./Picture";
2
+ export interface PictureFactory {
3
+ /**
4
+ * Returns an SkPicture which has been serialized previously to the given bytes.
5
+ * @param bytes
6
+ */
7
+ MakePicture(bytes: Uint8Array | ArrayBuffer): SkPicture | null;
8
+ }
@@ -0,0 +1,15 @@
1
+ import type { SkCanvas } from "../Canvas";
2
+ import type { SkRect } from "../Rect";
3
+ import type { SkPicture } from "./Picture";
4
+ export interface SkPictureRecorder {
5
+ /**
6
+ * Returns a canvas on which to draw. When done drawing, call finishRecordingAsPicture()
7
+ *
8
+ * @param bounds - a rect to cull the results.
9
+ */
10
+ beginRecording(bounds: SkRect): SkCanvas;
11
+ /**
12
+ * Returns the captured draw commands as a picture and invalidates the canvas returned earlier.
13
+ */
14
+ finishRecordingAsPicture(): SkPicture;
15
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./Picture";
2
+ export * from "./PictureRecorder";
3
+ export * from "./usePicture";
4
+ export * from "./PictureFactory";
@@ -0,0 +1,11 @@
1
+ import type { DependencyList } from "react";
2
+ import type { SkCanvas } from "../Canvas";
3
+ import type { SkRect } from "../Rect";
4
+ import type { SkPicture } from "./Picture";
5
+ /**
6
+ * Memoizes and returns an SkPicture that can be drawn to another canvas.
7
+ * @param rect Picture bounds
8
+ * @param cb Callback for drawing to the canvas
9
+ * @returns SkPicture
10
+ */
11
+ export declare const usePicture: (rect: SkRect, cb: (canvas: SkCanvas) => void, deps?: DependencyList) => SkPicture;
@@ -25,6 +25,7 @@ import "./NativeSetup";
25
25
  import type { SkRSXform } from "./RSXform";
26
26
  import type { SkPath } from "./Path/Path";
27
27
  import type { SkContourMeasureIter } from "./ContourMeasure";
28
+ import type { PictureFactory, SkPictureRecorder } from "./Picture";
28
29
  /**
29
30
  * Declares the interface for the native Skia API
30
31
  */
@@ -35,6 +36,8 @@ export interface Skia {
35
36
  RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;
36
37
  ContourMeasureIter: (path: SkPath, forceClosed: boolean, resScale: number) => SkContourMeasureIter;
37
38
  Paint: () => SkPaint;
39
+ PictureRecorder: () => SkPictureRecorder;
40
+ Picture: PictureFactory;
38
41
  Path: PathFactory;
39
42
  Matrix: () => SkMatrix;
40
43
  ColorFilter: ColorFilterFactory;
@@ -89,6 +92,8 @@ export declare const Skia: {
89
92
  XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;
90
93
  RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;
91
94
  Paint: () => SkPaint;
95
+ PictureRecorder: () => SkPictureRecorder;
96
+ Picture: PictureFactory;
92
97
  Path: PathFactory;
93
98
  ColorFilter: ColorFilterFactory;
94
99
  ContourMeasureIter: (path: SkPath, forceClosed: boolean, resScale: number) => SkContourMeasureIter;
@@ -20,4 +20,5 @@ export * from "./Surface";
20
20
  export * from "./FontMgr";
21
21
  export * from "./Vertices";
22
22
  export * from "./Color";
23
+ export * from "./Picture";
23
24
  export * from "./Data";
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
+ import type { ViewProps } from "react-native";
2
3
  import type { SkImage, SkRect } from "../skia";
3
4
  import type { SkiaReadonlyValue } from "../values";
4
- import type { DrawMode, SkiaViewProps, RNSkiaDrawCallback } from "./types";
5
+ import type { DrawMode, RNSkiaDrawCallback } from "./types";
5
6
  declare global {
6
7
  var SkiaViewApi: {
7
8
  invalidateSkiaView: (nativeId: number) => void;
@@ -11,6 +12,29 @@ declare global {
11
12
  registerValuesInView: (nativeId: number, values: SkiaReadonlyValue<unknown>[]) => () => void;
12
13
  };
13
14
  }
15
+ export interface SkiaViewProps extends ViewProps {
16
+ /**
17
+ * Sets the drawing mode for the skia view. There are two drawing
18
+ * modes, "continuous" and "default", where the continuous mode will
19
+ * continuously redraw the view, and the default mode will only
20
+ * redraw when any of the regular react properties are changed like
21
+ * sizes and margins.
22
+ */
23
+ mode?: DrawMode;
24
+ /**
25
+ * When set to true the view will display information about the
26
+ * average time it takes to render.
27
+ */
28
+ debug?: boolean;
29
+ /**
30
+ * Draw callback. Will be called whenever the view is invalidated and
31
+ * needs to redraw. This is either caused by a change in a react
32
+ * property, a touch event, or a call to redraw. If the view is in
33
+ * continuous mode the callback will be called 60 frames per second
34
+ * by the native view.
35
+ */
36
+ onDraw?: RNSkiaDrawCallback;
37
+ }
14
38
  export declare class SkiaView extends React.Component<SkiaViewProps> {
15
39
  constructor(props: SkiaViewProps);
16
40
  private _nativeId;
@@ -35,30 +35,6 @@ export declare type TouchHandlers = {
35
35
  };
36
36
  export declare type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;
37
37
  export declare type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;
38
- export declare type SkiaViewProps = {
39
- style?: ViewProps["style"];
40
- /**
41
- * Sets the drawing mode for the skia view. There are two drawing
42
- * modes, "continuous" and "default", where the continuous mode will
43
- * continuously redraw the view, and the default mode will only
44
- * redraw when any of the regular react properties are changed like
45
- * sizes and margins.
46
- */
47
- mode?: DrawMode;
48
- /**
49
- * When set to true the view will display information about the
50
- * average time it takes to render.
51
- */
52
- debug?: boolean;
53
- /**
54
- * Draw callback. Will be called whenever the view is invalidated and
55
- * needs to redraw. This is either caused by a change in a react
56
- * property, a touch event, or a call to redraw. If the view is in
57
- * continuous mode the callback will be called 60 frames per second
58
- * by the native view.
59
- */
60
- onDraw?: RNSkiaDrawCallback;
61
- };
62
38
  /**
63
39
  * Listener interface for value changes
64
40
  */