@shopify/react-native-skia 0.1.140 → 0.1.143

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) hide show
  1. package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +2 -2
  2. package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +1 -1
  3. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +15 -16
  4. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +2 -2
  5. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +69 -27
  6. package/cpp/api/JsiSkPathFactory.h +1 -1
  7. package/cpp/api/JsiSkPicture.h +7 -1
  8. package/cpp/rnskia/RNSkDrawView.cpp +66 -66
  9. package/cpp/rnskia/RNSkDrawView.h +22 -6
  10. package/cpp/rnskia/RNSkJsiViewApi.h +2 -2
  11. package/cpp/rnskia/values/RNSkComputedValue.h +10 -7
  12. package/cpp/rnskia/values/RNSkReadonlyValue.h +21 -2
  13. package/cpp/rnskia/values/RNSkValue.h +1 -0
  14. package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +1 -1
  15. package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +2 -2
  16. package/ios/RNSkia-iOS/SkiaDrawView.mm +4 -0
  17. package/lib/commonjs/mock/index.js +3 -1
  18. package/lib/commonjs/mock/index.js.map +1 -1
  19. package/lib/commonjs/renderer/DependencyManager.js +1 -1
  20. package/lib/commonjs/renderer/DependencyManager.js.map +1 -1
  21. package/lib/commonjs/renderer/components/Blend.js +20 -5
  22. package/lib/commonjs/renderer/components/Blend.js.map +1 -1
  23. package/lib/commonjs/renderer/components/imageFilters/Morphology.js +1 -1
  24. package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
  25. package/lib/commonjs/renderer/components/imageFilters/Shadow.js +1 -1
  26. package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -1
  27. package/lib/commonjs/renderer/processors/Animations/Animations.js +18 -5
  28. package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
  29. package/lib/commonjs/skia/core/Data.js +10 -22
  30. package/lib/commonjs/skia/core/Data.js.map +1 -1
  31. package/lib/commonjs/skia/core/Font.js +2 -3
  32. package/lib/commonjs/skia/core/Font.js.map +1 -1
  33. package/lib/commonjs/skia/core/Image.js.map +1 -1
  34. package/lib/commonjs/skia/core/SVG.js.map +1 -1
  35. package/lib/commonjs/skia/core/Typeface.js.map +1 -1
  36. package/lib/commonjs/skia/types/Data/Data.js +5 -0
  37. package/lib/commonjs/skia/types/Data/Data.js.map +1 -1
  38. package/lib/commonjs/skia/web/Host.js +12 -21
  39. package/lib/commonjs/skia/web/Host.js.map +1 -1
  40. package/lib/commonjs/skia/web/JsiSkCanvas.js +50 -28
  41. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  42. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +4 -4
  43. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  44. package/lib/commonjs/skia/web/JsiSkFont.js +7 -3
  45. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  46. package/lib/commonjs/skia/web/JsiSkImage.js +4 -2
  47. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  48. package/lib/commonjs/skia/web/JsiSkImageFactory.js +4 -2
  49. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  50. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +61 -19
  51. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  52. package/lib/commonjs/skia/web/JsiSkMatrix.js +1 -1
  53. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  54. package/lib/commonjs/skia/web/JsiSkPaint.js +15 -6
  55. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  56. package/lib/commonjs/skia/web/JsiSkPath.js +16 -60
  57. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  58. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +7 -3
  59. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  60. package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
  61. package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
  62. package/lib/commonjs/skia/web/JsiSkPicture.js +5 -1
  63. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  64. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +3 -1
  65. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  66. package/lib/commonjs/skia/web/JsiSkPoint.js +9 -1
  67. package/lib/commonjs/skia/web/JsiSkPoint.js.map +1 -1
  68. package/lib/commonjs/skia/web/JsiSkRRect.js +9 -1
  69. package/lib/commonjs/skia/web/JsiSkRRect.js.map +1 -1
  70. package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
  71. package/lib/commonjs/skia/web/JsiSkRect.js +3 -3
  72. package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
  73. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +4 -2
  74. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  75. package/lib/commonjs/skia/web/JsiSkShaderFactory.js +10 -6
  76. package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
  77. package/lib/commonjs/skia/web/JsiSkSurface.js +3 -1
  78. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  79. package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js +8 -4
  80. package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -1
  81. package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js +1 -1
  82. package/lib/commonjs/skia/web/JsiSkTypefaceFactory.js.map +1 -1
  83. package/lib/commonjs/skia/web/JsiSkia.js +12 -6
  84. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  85. package/lib/commonjs/values/hooks/useComputedValue.js +6 -2
  86. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
  87. package/lib/commonjs/values/index.js +13 -0
  88. package/lib/commonjs/values/index.js.map +1 -1
  89. package/lib/commonjs/values/selector.js +24 -0
  90. package/lib/commonjs/values/selector.js.map +1 -0
  91. package/lib/commonjs/values/web/RNSkComputedValue.js +8 -0
  92. package/lib/commonjs/values/web/RNSkComputedValue.js.map +1 -1
  93. package/lib/commonjs/values/web/RNSkReadonlyValue.js +4 -0
  94. package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -1
  95. package/lib/commonjs/views/useTouchHandler.js +13 -20
  96. package/lib/commonjs/views/useTouchHandler.js.map +1 -1
  97. package/lib/module/mock/index.js +2 -1
  98. package/lib/module/mock/index.js.map +1 -1
  99. package/lib/module/renderer/DependencyManager.js +2 -2
  100. package/lib/module/renderer/DependencyManager.js.map +1 -1
  101. package/lib/module/renderer/components/Blend.js +21 -5
  102. package/lib/module/renderer/components/Blend.js.map +1 -1
  103. package/lib/module/renderer/components/imageFilters/Morphology.js +1 -1
  104. package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
  105. package/lib/module/renderer/components/imageFilters/Shadow.js +1 -1
  106. package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -1
  107. package/lib/module/renderer/processors/Animations/Animations.js +13 -4
  108. package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
  109. package/lib/module/skia/core/Data.js +10 -20
  110. package/lib/module/skia/core/Data.js.map +1 -1
  111. package/lib/module/skia/core/Font.js +2 -3
  112. package/lib/module/skia/core/Font.js.map +1 -1
  113. package/lib/module/skia/core/Image.js.map +1 -1
  114. package/lib/module/skia/core/SVG.js.map +1 -1
  115. package/lib/module/skia/core/Typeface.js.map +1 -1
  116. package/lib/module/skia/types/Data/Data.js +1 -1
  117. package/lib/module/skia/types/Data/Data.js.map +1 -1
  118. package/lib/module/skia/web/Host.js +9 -9
  119. package/lib/module/skia/web/Host.js.map +1 -1
  120. package/lib/module/skia/web/JsiSkCanvas.js +40 -29
  121. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  122. package/lib/module/skia/web/JsiSkColorFilterFactory.js +5 -5
  123. package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  124. package/lib/module/skia/web/JsiSkFont.js +6 -4
  125. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  126. package/lib/module/skia/web/JsiSkImage.js +4 -3
  127. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  128. package/lib/module/skia/web/JsiSkImageFactory.js +4 -3
  129. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  130. package/lib/module/skia/web/JsiSkImageFilterFactory.js +61 -20
  131. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  132. package/lib/module/skia/web/JsiSkMatrix.js +2 -2
  133. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  134. package/lib/module/skia/web/JsiSkPaint.js +11 -7
  135. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  136. package/lib/module/skia/web/JsiSkPath.js +15 -62
  137. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  138. package/lib/module/skia/web/JsiSkPathEffectFactory.js +6 -4
  139. package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  140. package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
  141. package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
  142. package/lib/module/skia/web/JsiSkPicture.js +4 -2
  143. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  144. package/lib/module/skia/web/JsiSkPictureRecorder.js +3 -2
  145. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  146. package/lib/module/skia/web/JsiSkPoint.js +10 -2
  147. package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
  148. package/lib/module/skia/web/JsiSkRRect.js +10 -2
  149. package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
  150. package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
  151. package/lib/module/skia/web/JsiSkRect.js +4 -4
  152. package/lib/module/skia/web/JsiSkRect.js.map +1 -1
  153. package/lib/module/skia/web/JsiSkRuntimeEffect.js +4 -3
  154. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  155. package/lib/module/skia/web/JsiSkShaderFactory.js +9 -7
  156. package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
  157. package/lib/module/skia/web/JsiSkSurface.js +3 -2
  158. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  159. package/lib/module/skia/web/JsiSkTextBlobFactory.js +7 -5
  160. package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -1
  161. package/lib/module/skia/web/JsiSkTypefaceFactory.js +2 -2
  162. package/lib/module/skia/web/JsiSkTypefaceFactory.js.map +1 -1
  163. package/lib/module/skia/web/JsiSkia.js +10 -5
  164. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  165. package/lib/module/values/hooks/useComputedValue.js +7 -3
  166. package/lib/module/values/hooks/useComputedValue.js.map +1 -1
  167. package/lib/module/values/index.js +1 -0
  168. package/lib/module/values/index.js.map +1 -1
  169. package/lib/module/values/selector.js +15 -0
  170. package/lib/module/values/selector.js.map +1 -0
  171. package/lib/module/values/web/RNSkComputedValue.js +8 -0
  172. package/lib/module/values/web/RNSkComputedValue.js.map +1 -1
  173. package/lib/module/values/web/RNSkReadonlyValue.js +4 -0
  174. package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -1
  175. package/lib/module/views/useTouchHandler.js +12 -19
  176. package/lib/module/views/useTouchHandler.js.map +1 -1
  177. package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +7 -2
  178. package/lib/typescript/src/skia/core/Data.d.ts +3 -5
  179. package/lib/typescript/src/skia/core/Font.d.ts +2 -2
  180. package/lib/typescript/src/skia/core/Image.d.ts +2 -2
  181. package/lib/typescript/src/skia/core/SVG.d.ts +2 -2
  182. package/lib/typescript/src/skia/core/Typeface.d.ts +2 -2
  183. package/lib/typescript/src/skia/types/Data/Data.d.ts +10 -3
  184. package/lib/typescript/src/skia/types/Picture/Picture.d.ts +2 -1
  185. package/lib/typescript/src/skia/web/Host.d.ts +5 -7
  186. package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +8 -8
  187. package/lib/typescript/src/skia/web/JsiSkPoint.d.ts +3 -2
  188. package/lib/typescript/src/skia/web/JsiSkRRect.d.ts +3 -2
  189. package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +1 -2
  190. package/lib/typescript/src/skia/web/JsiSkRect.d.ts +3 -3
  191. package/lib/typescript/src/skia/web/JsiSkTextBlobFactory.d.ts +2 -1
  192. package/lib/typescript/src/values/index.d.ts +1 -0
  193. package/lib/typescript/src/values/selector.d.ts +14 -0
  194. package/lib/typescript/src/values/types.d.ts +4 -0
  195. package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +1 -0
  196. package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +1 -0
  197. package/package.json +6 -6
  198. package/src/mock/index.ts +2 -1
  199. package/src/renderer/DependencyManager.tsx +5 -2
  200. package/src/renderer/components/Blend.tsx +25 -5
  201. package/src/renderer/components/imageFilters/Morphology.tsx +2 -2
  202. package/src/renderer/components/imageFilters/Shadow.tsx +2 -2
  203. package/src/renderer/processors/Animations/Animations.ts +27 -5
  204. package/src/skia/core/Data.ts +20 -51
  205. package/src/skia/core/Font.ts +4 -5
  206. package/src/skia/core/Image.ts +2 -2
  207. package/src/skia/core/SVG.ts +2 -2
  208. package/src/skia/core/Typeface.ts +2 -2
  209. package/src/skia/types/Data/Data.ts +11 -1
  210. package/src/skia/types/Picture/Picture.ts +2 -1
  211. package/src/skia/web/Host.ts +11 -21
  212. package/src/skia/web/JsiSkCanvas.ts +99 -56
  213. package/src/skia/web/JsiSkColorFilterFactory.ts +15 -5
  214. package/src/skia/web/JsiSkFont.ts +11 -4
  215. package/src/skia/web/JsiSkImage.ts +4 -3
  216. package/src/skia/web/JsiSkImageFactory.ts +6 -3
  217. package/src/skia/web/JsiSkImageFilterFactory.ts +124 -52
  218. package/src/skia/web/JsiSkMatrix.ts +4 -2
  219. package/src/skia/web/JsiSkPaint.ts +11 -7
  220. package/src/skia/web/JsiSkPath.ts +30 -56
  221. package/src/skia/web/JsiSkPathEffectFactory.ts +10 -5
  222. package/src/skia/web/JsiSkPathFactory.ts +3 -3
  223. package/src/skia/web/JsiSkPicture.ts +5 -3
  224. package/src/skia/web/JsiSkPictureRecorder.ts +3 -2
  225. package/src/skia/web/JsiSkPoint.ts +12 -2
  226. package/src/skia/web/JsiSkRRect.ts +16 -2
  227. package/src/skia/web/JsiSkRSXform.ts +1 -1
  228. package/src/skia/web/JsiSkRect.ts +4 -7
  229. package/src/skia/web/JsiSkRuntimeEffect.ts +9 -4
  230. package/src/skia/web/JsiSkShaderFactory.ts +24 -15
  231. package/src/skia/web/JsiSkSurface.ts +7 -2
  232. package/src/skia/web/JsiSkTextBlobFactory.ts +14 -8
  233. package/src/skia/web/JsiSkTypefaceFactory.tsx +4 -2
  234. package/src/skia/web/JsiSkia.ts +17 -5
  235. package/src/values/hooks/useComputedValue.ts +6 -3
  236. package/src/values/index.ts +1 -0
  237. package/src/values/selector.ts +24 -0
  238. package/src/values/types.ts +4 -0
  239. package/src/values/web/RNSkComputedValue.ts +6 -0
  240. package/src/values/web/RNSkReadonlyValue.ts +4 -0
  241. package/src/views/useTouchHandler.ts +15 -21
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":["Stub","constructor","Proxy","get","apply","set","Noop","Skia","vec","x","y","Mock","BaseSkia","useDataCollection","useRawData","useData","useFont","useTypeface","useImage","useSVG","usePicture","rect","width","height","rrect","r","rx","ry","point","add","a","b","sub","neg","dist","Math","hypot","translate","translateX","translateY","bounds","topLeft","topRight","bottomLeft","bottomRight","center","processTransform2d","useSharedValueEffect","Values","ValuesHooks","timingFunctions","springFunctions","decayFunctions","interpolateFn","interpolatePathFn","interpolateVectorFn","interpolateColors","_value","_inputRange","_outputRange","Float32Array","of","mixColors","_v","_x","_y","ShaderLib","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8B,EAAAA,MAAM,EAAElC,IAnCJ;AAoCJmC,EAAAA,OAAO,EAAEnC,IApCL;AAqCJoC,EAAAA,QAAQ,EAAEpC,IArCN;AAsCJqC,EAAAA,UAAU,EAAErC,IAtCR;AAuCJsC,EAAAA,WAAW,EAAEtC,IAvCT;AAwCJuC,EAAAA,MAAM,EAAEvC,IAxCJ;AAyCJwC,EAAAA,kBAAkB,EAAExC,IAzChB;AA0CJ;AACAyC,EAAAA,oBAAoB,EAApBA,0CA3CI;AA4CJ;AACA,KAAGC,MA7CC;AA8CJ,KAAGC,WA9CC;AA+CJ;AACA,KAAGC,eAhDC;AAiDJ,KAAGC,eAjDC;AAkDJ,KAAGC,cAlDC;AAmDJ,KAAGC,aAnDC;AAoDJ,KAAGC,iBApDC;AAqDJ,KAAGC,mBArDC;AAsDJC,EAAAA,iBAAiB,EAAE,CACjBC,MADiB,EAEjBC,WAFiB,EAGjBC,YAHiB,KAIdC,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CA1DD;AA2DJC,EAAAA,SAAS,EAAE,CAACC,EAAD,EAAaC,EAAb,EAAwBC,EAAxB,KAAsCL,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CA3D7C;AA4DJK,EAAAA,SAAS,EAATA,oBA5DI;AA6DJC,EAAAA,aAAa,EAAE7D,IA7DX;AA8DJ8D,EAAAA,iBAAiB,EAAE9D;AA9Df,CAPC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Color, Skia as SkiaApi, SkRect, Vector } from \"../skia/types\";\nimport * as Values from \"../values/web\";\nimport * as ValuesHooks from \"../values/hooks\";\nimport * as BaseSkia from \"../skia/types\";\nimport type * as SkiaExports from \"../skia\";\nimport type * as ExternalExports from \"../external\";\nimport type * as ValueExports from \"../values\";\nimport type * as AnimationExports from \"../animation\";\nimport { useSharedValueEffect } from \"../external/reanimated/useSharedValueEffect\";\nimport * as timingFunctions from \"../animation/timing\";\nimport * as springFunctions from \"../animation/spring\";\nimport * as decayFunctions from \"../animation/decay\";\nimport * as interpolateFn from \"../animation/functions/interpolate\";\nimport * as interpolatePathFn from \"../animation/functions/interpolatePaths\";\nimport * as interpolateVectorFn from \"../animation/functions/interpolateVector\";\nimport { ShaderLib } from \"../renderer/components/shaders/ShaderLib\";\n\nclass Stub {\n constructor() {\n return new Proxy(() => {}, {\n get: () => new Stub(),\n apply: () => new Stub(),\n set: () => true,\n });\n }\n}\n\nconst Noop: () => any = () => {};\n\nexport const Skia: SkiaApi = new Stub() as any;\n\nexport const vec = (x?: number, y?: number) => ({ x: x ?? 0, y: y ?? x ?? 0 });\n\nexport const Mock: typeof SkiaExports &\n typeof ExternalExports &\n typeof ValueExports &\n typeof AnimationExports & {\n createDrawing: () => any;\n createDeclaration: () => any;\n ShaderLib: typeof ShaderLib;\n } = {\n // SkiaExports\n // 1. Skia API. BaseSkia contains the enums, and functions like isPaint etc\n Skia,\n ...BaseSkia,\n // 2. Hooks\n useDataCollection: Noop,\n useRawData: Noop,\n useData: Noop,\n useFont: Noop,\n useTypeface: Noop,\n useImage: Noop,\n useSVG: Noop,\n usePicture: Noop,\n // 3. Point/Rect/Transform utilities\n vec,\n rect: (x: number, y: number, width: number, height: number) => ({\n x,\n y,\n width,\n height,\n }),\n rrect: (r: SkRect, rx: number, ry: number) => ({\n rect: r,\n rx,\n ry,\n }),\n point: vec,\n add: (a: Vector, b: Vector) => vec(a.x + b.x, a.y + b.y),\n sub: (a: Vector, b: Vector) => vec(a.x - b.x, a.y - b.y),\n neg: (a: Vector) => vec(-a.x, -a.y),\n dist: (a: Vector, b: Vector) => Math.hypot(a.x - b.x, a.y - b.y),\n translate: ({ x, y }: Vector) =>\n [{ translateX: x }, { translateY: y }] as const,\n\n bounds: Noop,\n topLeft: Noop,\n topRight: Noop,\n bottomLeft: Noop,\n bottomRight: Noop,\n center: Noop,\n processTransform2d: Noop,\n // ExternalExports\n useSharedValueEffect,\n // ValueExports\n ...Values,\n ...ValuesHooks,\n // Animations\n ...timingFunctions,\n ...springFunctions,\n ...decayFunctions,\n ...interpolateFn,\n ...interpolatePathFn,\n ...interpolateVectorFn,\n interpolateColors: (\n _value: number,\n _inputRange: number[],\n _outputRange: Color[]\n ) => Float32Array.of(0, 0, 0, 0),\n mixColors: (_v: number, _x: Color, _y: Color) => Float32Array.of(0, 0, 0, 0),\n ShaderLib,\n createDrawing: Noop,\n createDeclaration: Noop,\n};\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":["Stub","constructor","Proxy","get","apply","set","Noop","Skia","vec","x","y","Mock","BaseSkia","useRawData","useData","useFont","useTypeface","useImage","useSVG","usePicture","rect","width","height","rrect","r","rx","ry","point","add","a","b","sub","neg","dist","Math","hypot","translate","translateX","translateY","bounds","topLeft","topRight","bottomLeft","bottomRight","center","processTransform2d","useSharedValueEffect","Values","ValuesHooks","Selector","timingFunctions","springFunctions","decayFunctions","interpolateFn","interpolatePathFn","interpolateVectorFn","interpolateColors","_value","_inputRange","_outputRange","Float32Array","of","mixColors","_v","_x","_y","ShaderLib","createDrawing","createDeclaration"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAlBA;AAoBA,MAAMA,IAAN,CAAW;AACTC,EAAAA,WAAW,GAAG;AACZ,WAAO,IAAIC,KAAJ,CAAU,MAAM,CAAE,CAAlB,EAAoB;AACzBC,MAAAA,GAAG,EAAE,MAAM,IAAIH,IAAJ,EADc;AAEzBI,MAAAA,KAAK,EAAE,MAAM,IAAIJ,IAAJ,EAFY;AAGzBK,MAAAA,GAAG,EAAE,MAAM;AAHc,KAApB,CAAP;AAKD;;AAPQ;;AAUX,MAAMC,IAAe,GAAG,MAAM,CAAE,CAAhC;;AAEO,MAAMC,IAAa,GAAG,IAAIP,IAAJ,EAAtB;;;AAEA,MAAMQ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DJC,EAAAA,iBAAiB,EAAE,CACjBC,MADiB,EAEjBC,WAFiB,EAGjBC,YAHiB,KAIdC,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CA1DD;AA2DJC,EAAAA,SAAS,EAAE,CAACC,EAAD,EAAaC,EAAb,EAAwBC,EAAxB,KAAsCL,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CA3D7C;AA4DJK,EAAAA,SAAS,EAATA,oBA5DI;AA6DJC,EAAAA,aAAa,EAAE7D,IA7DX;AA8DJ8D,EAAAA,iBAAiB,EAAE9D;AA9Df,CAPC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Color, Skia as SkiaApi, SkRect, Vector } from \"../skia/types\";\nimport * as Values from \"../values/web\";\nimport * as ValuesHooks from \"../values/hooks\";\nimport { Selector } from \"../values/selector\";\nimport * as BaseSkia from \"../skia/types\";\nimport type * as SkiaExports from \"../skia\";\nimport type * as ExternalExports from \"../external\";\nimport type * as ValueExports from \"../values\";\nimport type * as AnimationExports from \"../animation\";\nimport { useSharedValueEffect } from \"../external/reanimated/useSharedValueEffect\";\nimport * as timingFunctions from \"../animation/timing\";\nimport * as springFunctions from \"../animation/spring\";\nimport * as decayFunctions from \"../animation/decay\";\nimport * as interpolateFn from \"../animation/functions/interpolate\";\nimport * as interpolatePathFn from \"../animation/functions/interpolatePaths\";\nimport * as interpolateVectorFn from \"../animation/functions/interpolateVector\";\nimport { ShaderLib } from \"../renderer/components/shaders/ShaderLib\";\n\nclass Stub {\n constructor() {\n return new Proxy(() => {}, {\n get: () => new Stub(),\n apply: () => new Stub(),\n set: () => true,\n });\n }\n}\n\nconst Noop: () => any = () => {};\n\nexport const Skia: SkiaApi = new Stub() as any;\n\nexport const vec = (x?: number, y?: number) => ({ x: x ?? 0, y: y ?? x ?? 0 });\n\nexport const Mock: typeof SkiaExports &\n typeof ExternalExports &\n typeof ValueExports &\n typeof AnimationExports & {\n createDrawing: () => any;\n createDeclaration: () => any;\n ShaderLib: typeof ShaderLib;\n } = {\n // SkiaExports\n // 1. Skia API. BaseSkia contains the enums, and functions like isPaint etc\n Skia,\n ...BaseSkia,\n // 2. Hooks\n useRawData: Noop,\n useData: Noop,\n useFont: Noop,\n useTypeface: Noop,\n useImage: Noop,\n useSVG: Noop,\n usePicture: Noop,\n // 3. Point/Rect/Transform utilities\n vec,\n rect: (x: number, y: number, width: number, height: number) => ({\n x,\n y,\n width,\n height,\n }),\n rrect: (r: SkRect, rx: number, ry: number) => ({\n rect: r,\n rx,\n ry,\n }),\n point: vec,\n add: (a: Vector, b: Vector) => vec(a.x + b.x, a.y + b.y),\n sub: (a: Vector, b: Vector) => vec(a.x - b.x, a.y - b.y),\n neg: (a: Vector) => vec(-a.x, -a.y),\n dist: (a: Vector, b: Vector) => Math.hypot(a.x - b.x, a.y - b.y),\n translate: ({ x, y }: Vector) =>\n [{ translateX: x }, { translateY: y }] as const,\n\n bounds: Noop,\n topLeft: Noop,\n topRight: Noop,\n bottomLeft: Noop,\n bottomRight: Noop,\n center: Noop,\n processTransform2d: Noop,\n // ExternalExports\n useSharedValueEffect,\n // ValueExports\n ...Values,\n ...ValuesHooks,\n Selector,\n // Animations\n ...timingFunctions,\n ...springFunctions,\n ...decayFunctions,\n ...interpolateFn,\n ...interpolatePathFn,\n ...interpolateVectorFn,\n interpolateColors: (\n _value: number,\n _inputRange: number[],\n _outputRange: Color[]\n ) => Float32Array.of(0, 0, 0, 0),\n mixColors: (_v: number, _x: Color, _y: Color) => Float32Array.of(0, 0, 0, 0),\n ShaderLib,\n createDrawing: Noop,\n createDeclaration: Noop,\n};\n"]}
@@ -29,7 +29,7 @@ class DependencyManager {
29
29
  }
30
30
 
31
31
  subscribeNode(node, props) {
32
- const values = Object.values(props).filter(_processors.isValue);
32
+ const values = Object.values(props).filter(v => (0, _processors.isValue)(v) || (0, _processors.isSelector)(v)).map(v => (0, _processors.isSelector)(v) ? v.value : v);
33
33
 
34
34
  if (values.length > 0) {
35
35
  this.subscriptions.set(node, {
@@ -1 +1 @@
1
- {"version":3,"sources":["DependencyManager.tsx"],"names":["DependencyManager","constructor","ref","Map","unSubscribeNode","node","subscription","subscriptions","get","unsubscribe","delete","subscribeNode","props","values","Object","filter","isValue","length","set","subscribe","current","Error","forEach","registerValues","clear"],"mappings":";;;;;;;AAKA;;;;AAMO,MAAMA,iBAAN,CAAwB;AAO7BC,EAAAA,WAAW,CAACC,GAAD,EAA2B;AAAA;;AAAA,2CAFlC,IAAIC,GAAJ,EAEkC;;AACpC,SAAKD,GAAL,GAAWA,GAAX;AACD;;AAEDE,EAAAA,eAAe,CAACC,IAAD,EAAa;AAC1B,UAAMC,YAAY,GAAG,KAAKC,aAAL,CAAmBC,GAAnB,CAAuBH,IAAvB,CAArB;;AACA,QAAIC,YAAY,IAAIA,YAAY,CAACG,WAAjC,EAA8C;AAC5CH,MAAAA,YAAY,CAACG,WAAb;AACD;;AACD,SAAKF,aAAL,CAAmBG,MAAnB,CAA0BL,IAA1B;AACD;;AAEDM,EAAAA,aAAa,CAACN,IAAD,EAAaO,KAAb,EAA2B;AACtC,UAAMC,MAAM,GAAGC,MAAM,CAACD,MAAP,CAAcD,KAAd,EAAqBG,MAArB,CAA4BC,mBAA5B,CAAf;;AACA,QAAIH,MAAM,CAACI,MAAP,GAAgB,CAApB,EAAuB;AACrB,WAAKV,aAAL,CAAmBW,GAAnB,CAAuBb,IAAvB,EAA6B;AAAEQ,QAAAA,MAAF;AAAUJ,QAAAA,WAAW,EAAE;AAAvB,OAA7B;AACD;AACF;;AAEDU,EAAAA,SAAS,GAAG;AACV,QAAI,KAAKjB,GAAL,CAASkB,OAAT,KAAqB,IAAzB,EAA+B;AAC7B,YAAM,IAAIC,KAAJ,CAAU,uBAAV,CAAN;AACD;;AACD,SAAKd,aAAL,CAAmBe,OAAnB,CAA4BhB,YAAD,IAAkB;AAC3C,UAAIA,YAAY,CAACG,WAAb,KAA6B,IAAjC,EAAuC;AACrCH,QAAAA,YAAY,CAACG,WAAb,GAA2B,KAAKP,GAAL,CAASkB,OAAT,CAAkBG,cAAlB,CACzBjB,YAAY,CAACO,MADY,CAA3B;AAGD;AACF,KAND;AAOD;;AAEDJ,EAAAA,WAAW,GAAG;AACZ,SAAKF,aAAL,CAAmBe,OAAnB,CAA2B,QAAqB;AAAA,UAApB;AAAEb,QAAAA;AAAF,OAAoB;;AAC9C,UAAIA,WAAJ,EAAiB;AACfA,QAAAA,WAAW;AACZ;AACF,KAJD;AAKA,SAAKF,aAAL,CAAmBiB,KAAnB;AACD;;AA9C4B","sourcesContent":["import type { RefObject } from \"react\";\n\nimport type { SkiaView } from \"../views\";\nimport type { SkiaValue } from \"../values\";\n\nimport { isValue } from \"./processors\";\nimport type { Node } from \"./nodes\";\n\ntype Unsubscribe = () => void;\ntype Props = { [key: string]: unknown };\n\nexport class DependencyManager {\n ref: RefObject<SkiaView>;\n subscriptions: Map<\n Node,\n { values: SkiaValue<unknown>[]; unsubscribe: null | Unsubscribe }\n > = new Map();\n\n constructor(ref: RefObject<SkiaView>) {\n this.ref = ref;\n }\n\n unSubscribeNode(node: Node) {\n const subscription = this.subscriptions.get(node);\n if (subscription && subscription.unsubscribe) {\n subscription.unsubscribe();\n }\n this.subscriptions.delete(node);\n }\n\n subscribeNode(node: Node, props: Props) {\n const values = Object.values(props).filter(isValue);\n if (values.length > 0) {\n this.subscriptions.set(node, { values, unsubscribe: null });\n }\n }\n\n subscribe() {\n if (this.ref.current === null) {\n throw new Error(\"Canvas ref is not set\");\n }\n this.subscriptions.forEach((subscription) => {\n if (subscription.unsubscribe === null) {\n subscription.unsubscribe = this.ref.current!.registerValues(\n subscription.values\n );\n }\n });\n }\n\n unsubscribe() {\n this.subscriptions.forEach(({ unsubscribe }) => {\n if (unsubscribe) {\n unsubscribe();\n }\n });\n this.subscriptions.clear();\n }\n}\n"]}
1
+ {"version":3,"sources":["DependencyManager.tsx"],"names":["DependencyManager","constructor","ref","Map","unSubscribeNode","node","subscription","subscriptions","get","unsubscribe","delete","subscribeNode","props","values","Object","filter","v","map","value","length","set","subscribe","current","Error","forEach","registerValues","clear"],"mappings":";;;;;;;AAKA;;;;AAMO,MAAMA,iBAAN,CAAwB;AAO7BC,EAAAA,WAAW,CAACC,GAAD,EAA2B;AAAA;;AAAA,2CAFlC,IAAIC,GAAJ,EAEkC;;AACpC,SAAKD,GAAL,GAAWA,GAAX;AACD;;AAEDE,EAAAA,eAAe,CAACC,IAAD,EAAa;AAC1B,UAAMC,YAAY,GAAG,KAAKC,aAAL,CAAmBC,GAAnB,CAAuBH,IAAvB,CAArB;;AACA,QAAIC,YAAY,IAAIA,YAAY,CAACG,WAAjC,EAA8C;AAC5CH,MAAAA,YAAY,CAACG,WAAb;AACD;;AACD,SAAKF,aAAL,CAAmBG,MAAnB,CAA0BL,IAA1B;AACD;;AAEDM,EAAAA,aAAa,CAACN,IAAD,EAAaO,KAAb,EAA2B;AACtC,UAAMC,MAAM,GAAGC,MAAM,CAACD,MAAP,CAAcD,KAAd,EACZG,MADY,CACJC,CAAD,IAAO,yBAAQA,CAAR,KAAc,4BAAWA,CAAX,CADhB,EAEZC,GAFY,CAEPD,CAAD,IAAQ,4BAAWA,CAAX,IAAgBA,CAAC,CAACE,KAAlB,GAA2BF,CAF3B,CAAf;;AAIA,QAAIH,MAAM,CAACM,MAAP,GAAgB,CAApB,EAAuB;AACrB,WAAKZ,aAAL,CAAmBa,GAAnB,CAAuBf,IAAvB,EAA6B;AAAEQ,QAAAA,MAAF;AAAUJ,QAAAA,WAAW,EAAE;AAAvB,OAA7B;AACD;AACF;;AAEDY,EAAAA,SAAS,GAAG;AACV,QAAI,KAAKnB,GAAL,CAASoB,OAAT,KAAqB,IAAzB,EAA+B;AAC7B,YAAM,IAAIC,KAAJ,CAAU,uBAAV,CAAN;AACD;;AACD,SAAKhB,aAAL,CAAmBiB,OAAnB,CAA4BlB,YAAD,IAAkB;AAC3C,UAAIA,YAAY,CAACG,WAAb,KAA6B,IAAjC,EAAuC;AACrCH,QAAAA,YAAY,CAACG,WAAb,GAA2B,KAAKP,GAAL,CAASoB,OAAT,CAAkBG,cAAlB,CACzBnB,YAAY,CAACO,MADY,CAA3B;AAGD;AACF,KAND;AAOD;;AAEDJ,EAAAA,WAAW,GAAG;AACZ,SAAKF,aAAL,CAAmBiB,OAAnB,CAA2B,QAAqB;AAAA,UAApB;AAAEf,QAAAA;AAAF,OAAoB;;AAC9C,UAAIA,WAAJ,EAAiB;AACfA,QAAAA,WAAW;AACZ;AACF,KAJD;AAKA,SAAKF,aAAL,CAAmBmB,KAAnB;AACD;;AAjD4B","sourcesContent":["import type { RefObject } from \"react\";\n\nimport type { SkiaView } from \"../views\";\nimport type { SkiaValue } from \"../values\";\n\nimport { isSelector, isValue } from \"./processors\";\nimport type { Node } from \"./nodes\";\n\ntype Unsubscribe = () => void;\ntype Props = { [key: string]: unknown };\n\nexport class DependencyManager {\n ref: RefObject<SkiaView>;\n subscriptions: Map<\n Node,\n { values: SkiaValue<unknown>[]; unsubscribe: null | Unsubscribe }\n > = new Map();\n\n constructor(ref: RefObject<SkiaView>) {\n this.ref = ref;\n }\n\n unSubscribeNode(node: Node) {\n const subscription = this.subscriptions.get(node);\n if (subscription && subscription.unsubscribe) {\n subscription.unsubscribe();\n }\n this.subscriptions.delete(node);\n }\n\n subscribeNode(node: Node, props: Props) {\n const values = Object.values(props)\n .filter((v) => isValue(v) || isSelector(v))\n .map((v) => (isSelector(v) ? v.value : (v as SkiaValue<unknown>)));\n\n if (values.length > 0) {\n this.subscriptions.set(node, { values, unsubscribe: null });\n }\n }\n\n subscribe() {\n if (this.ref.current === null) {\n throw new Error(\"Canvas ref is not set\");\n }\n this.subscriptions.forEach((subscription) => {\n if (subscription.unsubscribe === null) {\n subscription.unsubscribe = this.ref.current!.registerValues(\n subscription.values\n );\n }\n });\n }\n\n unsubscribe() {\n this.subscriptions.forEach(({ unsubscribe }) => {\n if (unsubscribe) {\n unsubscribe();\n }\n });\n this.subscriptions.clear();\n }\n}\n"]}
@@ -17,6 +17,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
 
18
18
  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); }
19
19
 
20
+ const childrenAreImageFilters = children => children.every(child => (0, _types.isImageFilter)(child));
21
+
22
+ const childrenAreShaders = children => children.every(child => (0, _types.isShader)(child));
23
+
20
24
  const onDeclare = (0, _nodes.createDeclaration)((_ref, children, _ref2) => {
21
25
  let {
22
26
  mode
@@ -24,14 +28,25 @@ const onDeclare = (0, _nodes.createDeclaration)((_ref, children, _ref2) => {
24
28
  let {
25
29
  Skia
26
30
  } = _ref2;
27
- const [inner, outer] = children;
28
31
 
29
32
  const blend = _types.BlendMode[(0, _Paint.enumKey)(mode)];
30
33
 
31
- if ((0, _types.isImageFilter)(outer) && (0, _types.isImageFilter)(inner)) {
32
- return Skia.ImageFilter.MakeBlend(blend, outer, inner);
33
- } else if ((0, _types.isShader)(outer) && (0, _types.isShader)(inner)) {
34
- return Skia.Shader.MakeBlend(blend, outer, inner);
34
+ if (childrenAreImageFilters(children)) {
35
+ return children.reverse().reduce((inner, outer) => {
36
+ if (inner === null) {
37
+ return outer;
38
+ }
39
+
40
+ return Skia.ImageFilter.MakeBlend(blend, outer, inner);
41
+ }, null);
42
+ } else if (childrenAreShaders(children)) {
43
+ return children.reverse().reduce((inner, outer) => {
44
+ if (inner === null) {
45
+ return outer;
46
+ }
47
+
48
+ return Skia.Shader.MakeBlend(blend, outer, inner);
49
+ }, null);
35
50
  }
36
51
 
37
52
  throw new Error("<Blend /> can only blend Shaders or ImageFilters");
@@ -1 +1 @@
1
- {"version":3,"sources":["Blend.tsx"],"names":["onDeclare","children","mode","Skia","inner","outer","blend","BlendMode","ImageFilter","MakeBlend","Shader","Error","Blend","props"],"mappings":";;;;;;;AACA;;AAEA;;AACA;;AAEA;;;;;;AAOA,MAAMA,SAAS,GAAG,8BAChB,OAAWC,QAAX,YAAkC;AAAA,MAAjC;AAAEC,IAAAA;AAAF,GAAiC;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAChC,QAAM,CAACC,KAAD,EAAQC,KAAR,IAAiBJ,QAAvB;;AACA,QAAMK,KAAK,GAAGC,iBAAU,oBAAQL,IAAR,CAAV,CAAd;;AACA,MAAI,0BAAcG,KAAd,KAAwB,0BAAcD,KAAd,CAA5B,EAAkD;AAChD,WAAOD,IAAI,CAACK,WAAL,CAAiBC,SAAjB,CAA2BH,KAA3B,EAAkCD,KAAlC,EAAyCD,KAAzC,CAAP;AACD,GAFD,MAEO,IAAI,qBAASC,KAAT,KAAmB,qBAASD,KAAT,CAAvB,EAAwC;AAC7C,WAAOD,IAAI,CAACO,MAAL,CAAYD,SAAZ,CAAsBH,KAAtB,EAA6BD,KAA7B,EAAoCD,KAApC,CAAP;AACD;;AACD,QAAM,IAAIO,KAAJ,CAAU,kDAAV,CAAN;AACD,CAVe,CAAlB;;AAaO,MAAMC,KAAK,GAAIC,KAAD,IAAsC;AACzD,sBAAO;AAAe,IAAA,SAAS,EAAEb;AAA1B,KAAyCa,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport { isImageFilter, BlendMode, isShader } from \"../../skia/types\";\nimport { createDeclaration } from \"../nodes\";\nimport type { AnimatedProps, SkEnum } from \"../processors\";\nimport { enumKey } from \"../processors/Paint\";\n\ninterface BlendProps {\n mode: SkEnum<typeof BlendMode>;\n children?: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<BlendProps>(\n ({ mode }, children, { Skia }) => {\n const [inner, outer] = children;\n const blend = BlendMode[enumKey(mode)];\n if (isImageFilter(outer) && isImageFilter(inner)) {\n return Skia.ImageFilter.MakeBlend(blend, outer, inner);\n } else if (isShader(outer) && isShader(inner)) {\n return Skia.Shader.MakeBlend(blend, outer, inner);\n }\n throw new Error(\"<Blend /> can only blend Shaders or ImageFilters\");\n }\n);\n\nexport const Blend = (props: AnimatedProps<BlendProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
1
+ {"version":3,"sources":["Blend.tsx"],"names":["childrenAreImageFilters","children","every","child","childrenAreShaders","onDeclare","mode","Skia","blend","BlendMode","reverse","reduce","inner","outer","ImageFilter","MakeBlend","Shader","Error","Blend","props"],"mappings":";;;;;;;AACA;;AAGA;;AACA;;AAEA;;;;;;AAGA,MAAMA,uBAAuB,GAC3BC,QAD8B,IAG9BA,QAAQ,CAACC,KAAT,CAAgBC,KAAD,IAAW,0BAAcA,KAAd,CAA1B,CAHF;;AAKA,MAAMC,kBAAkB,GACtBH,QADyB,IAEEA,QAAQ,CAACC,KAAT,CAAgBC,KAAD,IAAW,qBAASA,KAAT,CAA1B,CAF7B;;AASA,MAAME,SAAS,GAAG,8BAChB,OAAWJ,QAAX,YAAkC;AAAA,MAAjC;AAAEK,IAAAA;AAAF,GAAiC;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;;AAChC,QAAMC,KAAK,GAAGC,iBAAU,oBAAQH,IAAR,CAAV,CAAd;;AACA,MAAIN,uBAAuB,CAACC,QAAD,CAA3B,EAAuC;AACrC,WAAOA,QAAQ,CAACS,OAAT,GAAmBC,MAAnB,CAAgD,CAACC,KAAD,EAAQC,KAAR,KAAkB;AACvE,UAAID,KAAK,KAAK,IAAd,EAAoB;AAClB,eAAOC,KAAP;AACD;;AACD,aAAON,IAAI,CAACO,WAAL,CAAiBC,SAAjB,CAA2BP,KAA3B,EAAkCK,KAAlC,EAAyCD,KAAzC,CAAP;AACD,KALM,EAKJ,IALI,CAAP;AAMD,GAPD,MAOO,IAAIR,kBAAkB,CAACH,QAAD,CAAtB,EAAkC;AACvC,WAAOA,QAAQ,CAACS,OAAT,GAAmBC,MAAnB,CAA2C,CAACC,KAAD,EAAQC,KAAR,KAAkB;AAClE,UAAID,KAAK,KAAK,IAAd,EAAoB;AAClB,eAAOC,KAAP;AACD;;AACD,aAAON,IAAI,CAACS,MAAL,CAAYD,SAAZ,CAAsBP,KAAtB,EAA6BK,KAA7B,EAAoCD,KAApC,CAAP;AACD,KALM,EAKJ,IALI,CAAP;AAMD;;AACD,QAAM,IAAIK,KAAJ,CAAU,kDAAV,CAAN;AACD,CAnBe,CAAlB;;AAsBO,MAAMC,KAAK,GAAIC,KAAD,IAAsC;AACzD,sBAAO;AAAe,IAAA,SAAS,EAAEd;AAA1B,KAAyCc,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import type { ReactNode } from \"react\";\nimport React from \"react\";\n\nimport type { SkImageFilter, SkShader } from \"../../skia/types\";\nimport { isImageFilter, BlendMode, isShader } from \"../../skia/types\";\nimport { createDeclaration } from \"../nodes\";\nimport type { AnimatedProps, SkEnum } from \"../processors\";\nimport { enumKey } from \"../processors/Paint\";\nimport type { DeclarationResult } from \"../nodes/Declaration\";\n\nconst childrenAreImageFilters = (\n children: DeclarationResult[]\n): children is SkImageFilter[] =>\n children.every((child) => isImageFilter(child));\n\nconst childrenAreShaders = (\n children: DeclarationResult[]\n): children is SkShader[] => children.every((child) => isShader(child));\n\ninterface BlendProps {\n mode: SkEnum<typeof BlendMode>;\n children?: ReactNode | ReactNode[];\n}\n\nconst onDeclare = createDeclaration<BlendProps>(\n ({ mode }, children, { Skia }) => {\n const blend = BlendMode[enumKey(mode)];\n if (childrenAreImageFilters(children)) {\n return children.reverse().reduce<SkImageFilter | null>((inner, outer) => {\n if (inner === null) {\n return outer;\n }\n return Skia.ImageFilter.MakeBlend(blend, outer, inner);\n }, null);\n } else if (childrenAreShaders(children)) {\n return children.reverse().reduce<SkShader | null>((inner, outer) => {\n if (inner === null) {\n return outer;\n }\n return Skia.Shader.MakeBlend(blend, outer, inner);\n }, null);\n }\n throw new Error(\"<Blend /> can only blend Shaders or ImageFilters\");\n }\n);\n\nexport const Blend = (props: AnimatedProps<BlendProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
@@ -27,7 +27,7 @@ const onDeclare = (0, _Declaration.createDeclaration)((_ref, children, _ref2) =>
27
27
  } = _ref2;
28
28
  const input = (0, _getInput.getInput)(Skia, children);
29
29
  const r = (0, _Radius.processRadius)(Skia, radius);
30
- const factory = operator === "dilate" ? Skia.ImageFilter.MakeDilate : Skia.ImageFilter.MakeErode;
30
+ const factory = operator === "dilate" ? Skia.ImageFilter.MakeDilate.bind(Skia.ImageFilter) : Skia.ImageFilter.MakeErode.bind(Skia.ImageFilter);
31
31
  return factory(r.x, r.y, input);
32
32
  });
33
33
 
@@ -1 +1 @@
1
- {"version":3,"sources":["Morphology.tsx"],"names":["onDeclare","children","radius","operator","Skia","input","r","factory","ImageFilter","MakeDilate","MakeErode","x","y","Morphology","props","defaultProps"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA;;;;;;AAQA,MAAMA,SAAS,GAAG,oCAChB,OAAuBC,QAAvB,YAA8C;AAAA,MAA7C;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAA6C;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAC5C,QAAMC,KAAK,GAAG,wBAASD,IAAT,EAAeH,QAAf,CAAd;AACA,QAAMK,CAAC,GAAG,2BAAcF,IAAd,EAAoBF,MAApB,CAAV;AACA,QAAMK,OAAO,GACXJ,QAAQ,KAAK,QAAb,GACIC,IAAI,CAACI,WAAL,CAAiBC,UADrB,GAEIL,IAAI,CAACI,WAAL,CAAiBE,SAHvB;AAIA,SAAOH,OAAO,CAACD,CAAC,CAACK,CAAH,EAAML,CAAC,CAACM,CAAR,EAAWP,KAAX,CAAd;AACD,CATe,CAAlB;;AAYO,MAAMQ,UAAU,GAAIC,KAAD,IAA2C;AACnE,sBAAO;AAAe,IAAA,SAAS,EAAEd;AAA1B,KAAyCc,KAAzC,EAAP;AACD,CAFM;;;AAIPD,UAAU,CAACE,YAAX,GAA0B;AACxBZ,EAAAA,QAAQ,EAAE;AADc,CAA1B","sourcesContent":["import React from \"react\";\n\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps, Radius } from \"../../processors\";\nimport { processRadius } from \"../../processors/Radius\";\n\nimport { getInput } from \"./getInput\";\n\nexport interface MorphologyProps {\n operator: \"erode\" | \"dilate\";\n radius: Radius;\n children?: React.ReactNode | React.ReactNode[];\n}\n\nconst onDeclare = createDeclaration<MorphologyProps>(\n ({ radius, operator }, children, { Skia }) => {\n const input = getInput(Skia, children);\n const r = processRadius(Skia, radius);\n const factory =\n operator === \"dilate\"\n ? Skia.ImageFilter.MakeDilate\n : Skia.ImageFilter.MakeErode;\n return factory(r.x, r.y, input);\n }\n);\n\nexport const Morphology = (props: AnimatedProps<MorphologyProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n\nMorphology.defaultProps = {\n operator: \"dilate\",\n};\n"]}
1
+ {"version":3,"sources":["Morphology.tsx"],"names":["onDeclare","children","radius","operator","Skia","input","r","factory","ImageFilter","MakeDilate","bind","MakeErode","x","y","Morphology","props","defaultProps"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAEA;;;;;;AAQA,MAAMA,SAAS,GAAG,oCAChB,OAAuBC,QAAvB,YAA8C;AAAA,MAA7C;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAA6C;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAC5C,QAAMC,KAAK,GAAG,wBAASD,IAAT,EAAeH,QAAf,CAAd;AACA,QAAMK,CAAC,GAAG,2BAAcF,IAAd,EAAoBF,MAApB,CAAV;AACA,QAAMK,OAAO,GACXJ,QAAQ,KAAK,QAAb,GACIC,IAAI,CAACI,WAAL,CAAiBC,UAAjB,CAA4BC,IAA5B,CAAiCN,IAAI,CAACI,WAAtC,CADJ,GAEIJ,IAAI,CAACI,WAAL,CAAiBG,SAAjB,CAA2BD,IAA3B,CAAgCN,IAAI,CAACI,WAArC,CAHN;AAIA,SAAOD,OAAO,CAACD,CAAC,CAACM,CAAH,EAAMN,CAAC,CAACO,CAAR,EAAWR,KAAX,CAAd;AACD,CATe,CAAlB;;AAYO,MAAMS,UAAU,GAAIC,KAAD,IAA2C;AACnE,sBAAO;AAAe,IAAA,SAAS,EAAEf;AAA1B,KAAyCe,KAAzC,EAAP;AACD,CAFM;;;AAIPD,UAAU,CAACE,YAAX,GAA0B;AACxBb,EAAAA,QAAQ,EAAE;AADc,CAA1B","sourcesContent":["import React from \"react\";\n\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps, Radius } from \"../../processors\";\nimport { processRadius } from \"../../processors/Radius\";\n\nimport { getInput } from \"./getInput\";\n\nexport interface MorphologyProps {\n operator: \"erode\" | \"dilate\";\n radius: Radius;\n children?: React.ReactNode | React.ReactNode[];\n}\n\nconst onDeclare = createDeclaration<MorphologyProps>(\n ({ radius, operator }, children, { Skia }) => {\n const input = getInput(Skia, children);\n const r = processRadius(Skia, radius);\n const factory =\n operator === \"dilate\"\n ? Skia.ImageFilter.MakeDilate.bind(Skia.ImageFilter)\n : Skia.ImageFilter.MakeErode.bind(Skia.ImageFilter);\n return factory(r.x, r.y, input);\n }\n);\n\nexport const Morphology = (props: AnimatedProps<MorphologyProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n\nMorphology.defaultProps = {\n operator: \"dilate\",\n};\n"]}
@@ -39,7 +39,7 @@ const onDeclare = (0, _Declaration.createDeclaration)((_ref, children, _ref2) =>
39
39
  if (inner) {
40
40
  factory = _InnerShadow.MakeInnerShadow.bind(null, Skia, shadowOnly);
41
41
  } else {
42
- factory = shadowOnly ? Skia.ImageFilter.MakeDropShadowOnly : Skia.ImageFilter.MakeDropShadow;
42
+ factory = shadowOnly ? Skia.ImageFilter.MakeDropShadowOnly.bind(Skia.ImageFilter) : Skia.ImageFilter.MakeDropShadow.bind(Skia.ImageFilter);
43
43
  }
44
44
 
45
45
  return factory(dx, dy, blur, blur, color, input);
@@ -1 +1 @@
1
- {"version":3,"sources":["Shadow.tsx"],"names":["onDeclare","children","dx","dy","blur","color","cl","shadowOnly","inner","opacity","Skia","input","factory","MakeInnerShadow","bind","ImageFilter","MakeDropShadowOnly","MakeDropShadow","Shadow","props"],"mappings":";;;;;;;AAAA;;AAEA;;AAGA;;AAEA;;AACA;;;;;;AAWA,MAAMA,SAAS,GAAG,oCAChB,OAEEC,QAFF,YAIK;AAAA,MAHH;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAK,EAAEC,EAAvB;AAA2BC,IAAAA,UAA3B;AAAuCC,IAAAA;AAAvC,GAGG;AAAA,MADH;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GACG;AACH,QAAMC,KAAK,GAAG,wBAASD,IAAT,EAAeT,QAAf,CAAd;AACA,QAAMI,KAAK,GAAG,yBAAaK,IAAb,EAAmBJ,EAAnB,EAAuBG,OAAvB,CAAd;AACA,MAAIG,OAAJ;;AACA,MAAIJ,KAAJ,EAAW;AACTI,IAAAA,OAAO,GAAGC,6BAAgBC,IAAhB,CAAqB,IAArB,EAA2BJ,IAA3B,EAAiCH,UAAjC,CAAV;AACD,GAFD,MAEO;AACLK,IAAAA,OAAO,GAAGL,UAAU,GAChBG,IAAI,CAACK,WAAL,CAAiBC,kBADD,GAEhBN,IAAI,CAACK,WAAL,CAAiBE,cAFrB;AAGD;;AACD,SAAOL,OAAO,CAACV,EAAD,EAAKC,EAAL,EAASC,IAAT,EAAeA,IAAf,EAAqBC,KAArB,EAA4BM,KAA5B,CAAd;AACD,CAjBe,CAAlB;;AAoBO,MAAMO,MAAM,GAAIC,KAAD,IAAuC;AAC3D,sBAAO;AAAe,IAAA,SAAS,EAAEnB;AAA1B,KAAyCmB,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport type { Color } from \"../../../skia/types\";\nimport { processColor } from \"../../processors/Color\";\n\nimport { getInput } from \"./getInput\";\nimport { MakeInnerShadow } from \"./InnerShadow\";\n\nexport interface ShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n inner?: boolean;\n shadowOnly?: boolean;\n}\n\nconst onDeclare = createDeclaration<ShadowProps>(\n (\n { dx, dy, blur, color: cl, shadowOnly, inner },\n children,\n { opacity, Skia }\n ) => {\n const input = getInput(Skia, children);\n const color = processColor(Skia, cl, opacity);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? Skia.ImageFilter.MakeDropShadowOnly\n : Skia.ImageFilter.MakeDropShadow;\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n);\n\nexport const Shadow = (props: AnimatedProps<ShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
1
+ {"version":3,"sources":["Shadow.tsx"],"names":["onDeclare","children","dx","dy","blur","color","cl","shadowOnly","inner","opacity","Skia","input","factory","MakeInnerShadow","bind","ImageFilter","MakeDropShadowOnly","MakeDropShadow","Shadow","props"],"mappings":";;;;;;;AAAA;;AAEA;;AAGA;;AAEA;;AACA;;;;;;AAWA,MAAMA,SAAS,GAAG,oCAChB,OAEEC,QAFF,YAIK;AAAA,MAHH;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAK,EAAEC,EAAvB;AAA2BC,IAAAA,UAA3B;AAAuCC,IAAAA;AAAvC,GAGG;AAAA,MADH;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GACG;AACH,QAAMC,KAAK,GAAG,wBAASD,IAAT,EAAeT,QAAf,CAAd;AACA,QAAMI,KAAK,GAAG,yBAAaK,IAAb,EAAmBJ,EAAnB,EAAuBG,OAAvB,CAAd;AACA,MAAIG,OAAJ;;AACA,MAAIJ,KAAJ,EAAW;AACTI,IAAAA,OAAO,GAAGC,6BAAgBC,IAAhB,CAAqB,IAArB,EAA2BJ,IAA3B,EAAiCH,UAAjC,CAAV;AACD,GAFD,MAEO;AACLK,IAAAA,OAAO,GAAGL,UAAU,GAChBG,IAAI,CAACK,WAAL,CAAiBC,kBAAjB,CAAoCF,IAApC,CAAyCJ,IAAI,CAACK,WAA9C,CADgB,GAEhBL,IAAI,CAACK,WAAL,CAAiBE,cAAjB,CAAgCH,IAAhC,CAAqCJ,IAAI,CAACK,WAA1C,CAFJ;AAGD;;AACD,SAAOH,OAAO,CAACV,EAAD,EAAKC,EAAL,EAASC,IAAT,EAAeA,IAAf,EAAqBC,KAArB,EAA4BM,KAA5B,CAAd;AACD,CAjBe,CAAlB;;AAoBO,MAAMO,MAAM,GAAIC,KAAD,IAAuC;AAC3D,sBAAO;AAAe,IAAA,SAAS,EAAEnB;AAA1B,KAAyCmB,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport type { Color } from \"../../../skia/types\";\nimport { processColor } from \"../../processors/Color\";\n\nimport { getInput } from \"./getInput\";\nimport { MakeInnerShadow } from \"./InnerShadow\";\n\nexport interface ShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n inner?: boolean;\n shadowOnly?: boolean;\n}\n\nconst onDeclare = createDeclaration<ShadowProps>(\n (\n { dx, dy, blur, color: cl, shadowOnly, inner },\n children,\n { opacity, Skia }\n ) => {\n const input = getInput(Skia, children);\n const color = processColor(Skia, cl, opacity);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? Skia.ImageFilter.MakeDropShadowOnly.bind(Skia.ImageFilter)\n : Skia.ImageFilter.MakeDropShadow.bind(Skia.ImageFilter);\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n);\n\nexport const Shadow = (props: AnimatedProps<ShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.materialize = exports.isValue = exports.isAnimated = void 0;
6
+ exports.materialize = exports.isValue = exports.isSelector = exports.isAnimated = void 0;
7
7
 
8
8
  var _typeddash = require("../../typeddash");
9
9
 
@@ -23,6 +23,16 @@ const isValue = value => {
23
23
 
24
24
  exports.isValue = isValue;
25
25
 
26
+ const isSelector = value => {
27
+ if (value) {
28
+ return typeof value === "object" && "selector" in value && "value" in value && value.selector !== undefined && value.value !== undefined;
29
+ }
30
+
31
+ return false;
32
+ };
33
+
34
+ exports.isSelector = isSelector;
35
+
26
36
  const isAnimated = props => {
27
37
  for (const value of Object.values(props)) {
28
38
  if (isValue(value)) {
@@ -39,14 +49,17 @@ const materialize = props => {
39
49
  const result = { ...props
40
50
  };
41
51
  (0, _typeddash.mapKeys)(props).forEach(key => {
42
- const value = props[key];
52
+ const prop = props[key];
43
53
 
44
- if (isValue(value)) {
45
- result[key] = value.current;
54
+ if (isValue(prop)) {
55
+ result[key] = prop.current;
56
+ } else if (isSelector(prop)) {
57
+ result[key] = prop.selector(prop.value.current);
46
58
  }
47
59
  });
48
60
  return result;
49
- };
61
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
+
50
63
 
51
64
  exports.materialize = materialize;
52
65
  //# sourceMappingURL=Animations.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Animations.ts"],"names":["isValue","value","undefined","__typename__","isAnimated","props","Object","values","materialize","result","forEach","key","current"],"mappings":";;;;;;;AACA;;AAEO,MAAMA,OAAO,GAAIC,KAAD,IAAiD;AACtE,MAAIA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAArC,EAA2C;AACzC,WAAO,KAAP;AACD;;AACD,MAAI;AACF,QACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,kBAAkBA,KADlB,IAECA,KAAD,CAAyCE,YAAzC,KAA0D,WAH5D,EAIE;AACA,aAAO,IAAP;AACD;AACF,GARD,CAQE,MAAM,CAAE;;AACV,SAAO,KAAP;AACD,CAdM;;;;AAgBA,MAAMC,UAAU,GAAOC,KAAJ,IAAgC;AACxD,OAAK,MAAMJ,KAAX,IAAoBK,MAAM,CAACC,MAAP,CAAcF,KAAd,CAApB,EAA0C;AACxC,QAAIL,OAAO,CAACC,KAAD,CAAX,EAAoB;AAClB,aAAO,IAAP;AACD;AACF;;AACD,SAAO,KAAP;AACD,CAPM;;;;AASA,MAAMO,WAAW,GAAOH,KAAJ,IAAgC;AACzD,QAAMI,MAAM,GAAG,EAAE,GAAGJ;AAAL,GAAf;AACA,0BAAQA,KAAR,EAAeK,OAAf,CAAwBC,GAAD,IAAS;AAC9B,UAAMV,KAAK,GAAGI,KAAK,CAACM,GAAD,CAAnB;;AACA,QAAIX,OAAO,CAACC,KAAD,CAAX,EAAoB;AAClBQ,MAAAA,MAAM,CAACE,GAAD,CAAN,GAAeV,KAAD,CAAoCW,OAAlD;AACD;AACF,GALD;AAMA,SAAOH,MAAP;AACD,CATM","sourcesContent":["import type { SkiaValue } from \"../../../values\";\nimport { mapKeys } from \"../../typeddash\";\n\nexport const isValue = (value: unknown): value is SkiaValue<unknown> => {\n if (value === undefined || value === null) {\n return false;\n }\n try {\n if (\n typeof value === \"object\" &&\n \"__typename__\" in value &&\n (value as unknown as SkiaValue<unknown>).__typename__ === \"RNSkValue\"\n ) {\n return true;\n }\n } catch {}\n return false;\n};\n\nexport const isAnimated = <T>(props: AnimatedProps<T>) => {\n for (const value of Object.values(props)) {\n if (isValue(value)) {\n return true;\n }\n }\n return false;\n};\n\nexport const materialize = <T>(props: AnimatedProps<T>) => {\n const result = { ...props };\n mapKeys(props).forEach((key) => {\n const value = props[key];\n if (isValue(value)) {\n result[key] = (value as SkiaValue<T[typeof key]>).current;\n }\n });\n return result as T;\n};\n\nexport type AnimatedProps<T> = {\n [K in keyof T]: T[K] | SkiaValue<T[K]>;\n};\n"]}
1
+ {"version":3,"sources":["Animations.ts"],"names":["isValue","value","undefined","__typename__","isSelector","selector","isAnimated","props","Object","values","materialize","result","forEach","key","prop","current"],"mappings":";;;;;;;AACA;;AAEO,MAAMA,OAAO,GAAIC,KAAD,IAAiD;AACtE,MAAIA,KAAK,KAAKC,SAAV,IAAuBD,KAAK,KAAK,IAArC,EAA2C;AACzC,WAAO,KAAP;AACD;;AACD,MAAI;AACF,QACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,kBAAkBA,KADlB,IAECA,KAAD,CAAyCE,YAAzC,KAA0D,WAH5D,EAIE;AACA,aAAO,IAAP;AACD;AACF,GARD,CAQE,MAAM,CAAE;;AACV,SAAO,KAAP;AACD,CAdM;;;;AAgBA,MAAMC,UAAU,GACrBH,KADwB,IAKrB;AACH,MAAIA,KAAJ,EAAW;AACT,WACE,OAAOA,KAAP,KAAiB,QAAjB,IACA,cAAcA,KADd,IAEA,WAAWA,KAFX,IAGCA,KAAD,CAAmCI,QAAnC,KAAgDH,SAHhD,IAICD,KAAD,CAAmCA,KAAnC,KAA6CC,SAL/C;AAOD;;AACD,SAAO,KAAP;AACD,CAhBM;;;;AAkBA,MAAMI,UAAU,GAAOC,KAAJ,IAAgC;AACxD,OAAK,MAAMN,KAAX,IAAoBO,MAAM,CAACC,MAAP,CAAcF,KAAd,CAApB,EAA0C;AACxC,QAAIP,OAAO,CAACC,KAAD,CAAX,EAAoB;AAClB,aAAO,IAAP;AACD;AACF;;AACD,SAAO,KAAP;AACD,CAPM;;;;AASA,MAAMS,WAAW,GAAOH,KAAJ,IAAgC;AACzD,QAAMI,MAAM,GAAG,EAAE,GAAGJ;AAAL,GAAf;AACA,0BAAQA,KAAR,EAAeK,OAAf,CAAwBC,GAAD,IAAS;AAC9B,UAAMC,IAAI,GAAGP,KAAK,CAACM,GAAD,CAAlB;;AACA,QAAIb,OAAO,CAACc,IAAD,CAAX,EAAmB;AACjBH,MAAAA,MAAM,CAACE,GAAD,CAAN,GAAeC,IAAD,CAAmCC,OAAjD;AACD,KAFD,MAEO,IAAIX,UAAU,CAACU,IAAD,CAAd,EAAsB;AAC3BH,MAAAA,MAAM,CAACE,GAAD,CAAN,GAAcC,IAAI,CAACT,QAAL,CAAcS,IAAI,CAACb,KAAL,CAAWc,OAAzB,CAAd;AACD;AACF,GAPD;AAQA,SAAOJ,MAAP;AACD,CAXM,C,CAaP","sourcesContent":["import type { SkiaSelector, SkiaValue } from \"../../../values\";\nimport { mapKeys } from \"../../typeddash\";\n\nexport const isValue = (value: unknown): value is SkiaValue<unknown> => {\n if (value === undefined || value === null) {\n return false;\n }\n try {\n if (\n typeof value === \"object\" &&\n \"__typename__\" in value &&\n (value as unknown as SkiaValue<unknown>).__typename__ === \"RNSkValue\"\n ) {\n return true;\n }\n } catch {}\n return false;\n};\n\nexport const isSelector = <T, R>(\n value: unknown\n): value is {\n selector: (v: T) => R;\n value: SkiaValue<T>;\n} => {\n if (value) {\n return (\n typeof value === \"object\" &&\n \"selector\" in value &&\n \"value\" in value &&\n (value as Record<string, unknown>).selector !== undefined &&\n (value as Record<string, unknown>).value !== undefined\n );\n }\n return false;\n};\n\nexport const isAnimated = <T>(props: AnimatedProps<T>) => {\n for (const value of Object.values(props)) {\n if (isValue(value)) {\n return true;\n }\n }\n return false;\n};\n\nexport const materialize = <T>(props: AnimatedProps<T>) => {\n const result = { ...props };\n mapKeys(props).forEach((key) => {\n const prop = props[key];\n if (isValue(prop)) {\n result[key] = (prop as SkiaValue<T[typeof key]>).current;\n } else if (isSelector(prop)) {\n result[key] = prop.selector(prop.value.current) as T[typeof key];\n }\n });\n return result as T;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnimatedProp<T, P = any> = T | SkiaValue<T> | SkiaSelector<T, P>;\nexport type AnimatedProps<T> = {\n [K in keyof T]: AnimatedProp<T[K]>;\n};\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useRawData = exports.useDataCollection = exports.useData = void 0;
6
+ exports.useRawData = exports.useData = void 0;
7
7
 
8
8
  var _react = require("react");
9
9
 
@@ -11,8 +11,10 @@ var _reactNative = require("react-native");
11
11
 
12
12
  var _Skia = require("../Skia");
13
13
 
14
+ var _types = require("../types");
15
+
14
16
  const resolveAsset = source => {
15
- return _reactNative.Platform.OS === "web" ? source.default : _reactNative.Image.resolveAssetSource(source).uri;
17
+ return (0, _types.isRNModule)(source) ? _reactNative.Image.resolveAssetSource(source).uri : source.default;
16
18
  };
17
19
 
18
20
  const factoryWrapper = (data2, factory, onError) => {
@@ -26,10 +28,8 @@ const factoryWrapper = (data2, factory, onError) => {
26
28
  }
27
29
  };
28
30
 
29
- const loadDataCollection = (sources, factory, onError) => Promise.all(sources.map(source => loadData(source, factory, onError)));
30
-
31
31
  const loadData = (source, factory, onError) => {
32
- if (source === null) {
32
+ if (source === null || source === undefined) {
33
33
  return new Promise(resolve => resolve(null));
34
34
  } else if (source instanceof Uint8Array) {
35
35
  return new Promise(resolve => resolve(factoryWrapper(_Skia.Skia.Data.fromBytes(source), factory, onError)));
@@ -39,33 +39,21 @@ const loadData = (source, factory, onError) => {
39
39
  }
40
40
  };
41
41
 
42
- const useLoading = function (source, loader) {
43
- let deps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
42
+ const useLoading = (source, loader) => {
44
43
  const [data, setData] = (0, _react.useState)(null);
45
- const prevSourceRef = (0, _react.useRef)();
46
44
  (0, _react.useEffect)(() => {
47
- if (prevSourceRef.current !== source) {
48
- prevSourceRef.current = source;
49
- loader().then(setData);
50
- } else {
51
- setData(null);
52
- } // eslint-disable-next-line react-hooks/exhaustive-deps
53
-
54
- }, deps);
45
+ loader().then(setData); // eslint-disable-next-line react-hooks/exhaustive-deps
46
+ }, [source]);
55
47
  return data;
56
48
  };
57
49
 
58
- const useDataCollection = (sources, factory, onError, deps) => useLoading(sources, () => loadDataCollection(sources, factory, onError), deps);
59
-
60
- exports.useDataCollection = useDataCollection;
61
-
62
- const useRawData = (source, factory, onError, deps) => useLoading(source, () => loadData(source, factory, onError), deps);
50
+ const useRawData = (source, factory, onError) => useLoading(source, () => loadData(source, factory, onError));
63
51
 
64
52
  exports.useRawData = useRawData;
65
53
 
66
54
  const identity = data => data;
67
55
 
68
- const useData = (source, onError, deps) => useRawData(source, identity, onError, deps);
56
+ const useData = (source, onError) => useRawData(source, identity, onError);
69
57
 
70
58
  exports.useData = useData;
71
59
  //# sourceMappingURL=Data.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Data.ts"],"names":["resolveAsset","source","Platform","OS","default","Image","resolveAssetSource","uri","factoryWrapper","data2","factory","onError","factoryResult","Error","loadDataCollection","sources","Promise","all","map","loadData","resolve","Uint8Array","Skia","Data","fromBytes","fromURI","then","d","useLoading","loader","deps","data","setData","prevSourceRef","current","useDataCollection","useRawData","identity","useData"],"mappings":";;;;;;;AACA;;AACA;;AAEA;;AAGA,MAAMA,YAAY,GAAIC,MAAD,IAAwC;AAC3D,SAAOC,sBAASC,EAAT,KAAgB,KAAhB,GACHF,MAAM,CAACG,OADJ,GAEHC,mBAAMC,kBAAN,CAAyBL,MAAzB,EAAiCM,GAFrC;AAGD,CAJD;;AAMA,MAAMC,cAAc,GAAG,CACrBC,KADqB,EAErBC,OAFqB,EAGrBC,OAHqB,KAIlB;AACH,QAAMC,aAAa,GAAGF,OAAO,CAACD,KAAD,CAA7B;;AACA,MAAIG,aAAa,KAAK,IAAtB,EAA4B;AAC1BD,IAAAA,OAAO,IAAIA,OAAO,CAAC,IAAIE,KAAJ,CAAU,qBAAV,CAAD,CAAlB;AACA,WAAO,IAAP;AACD,GAHD,MAGO;AACL,WAAOD,aAAP;AACD;AACF,CAZD;;AAcA,MAAME,kBAAkB,GAAG,CACzBC,OADyB,EAE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d;AACD,KAHD,MAGO;AACLA,MAAAA,OAAO,CAAC,IAAD,CAAP;AACD,KANa,CAOd;;AACD,GARD,EAQGF,IARH;AASA,SAAOC,IAAP;AACD,CAjBD;;AAmBO,MAAMI,iBAAiB,GAAG,CAC/BpB,OAD+B,EAE/BL,OAF+B,EAG/BC,OAH+B,EAI/BmB,IAJ+B,KAM/BF,UAAU,CACRb,OADQ,EAER,MAAMD,kBAAkB,CAACC,OAAD,EAAUL,OAAV,EAAmBC,OAAnB,CAFhB,EAGRmB,IAHQ,CANL;;;;AAYA,MAAMM,UAAU,GAAG,CACxBnC,MADwB,EAExBS,OAFwB,EAGxBC,OAHwB,EAIxBmB,IAJwB,KAKrBF,UAAU,CAAC3B,MAAD,EAAS,MAAMkB,QAAQ,CAAClB,MAAD,EAASS,OAAT,EAAkBC,OAAlB,CAAvB,EAAmDmB,IAAnD,CALR;;;;AAOP,MAAMO,QAAQ,GAAIN,IAAD,IAAkBA,IAAnC;;AAEO,MAAMO,OAAO,GAAG,CACrBrC,MADqB,EAErBU,OAFqB,EAGrBmB,IAHqB,KAIlBM,UAAU,CAACnC,MAAD,EAASoC,QAAT,EAAmB1B,OAAnB,EAA4BmB,IAA5B,CAJR","sourcesContent":["import type { DependencyList } from \"react\";\nimport { useRef, useEffect, useState } from \"react\";\nimport { Image, Platform } from \"react-native\";\n\nimport { Skia } from \"../Skia\";\nimport type { SkData, DataSource } from \"../types\";\n\nconst resolveAsset = (source: ReturnType<typeof require>) => {\n return Platform.OS === \"web\"\n ? source.default\n : Image.resolveAssetSource(source).uri;\n};\n\nconst factoryWrapper = <T>(\n data2: SkData,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => {\n const factoryResult = factory(data2);\n if (factoryResult === null) {\n onError && onError(new Error(\"Could not load data\"));\n return null;\n } else {\n return factoryResult;\n }\n};\n\nconst loadDataCollection = <T>(\n sources: DataSource[],\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<(T | null)[]> =>\n Promise.all(sources.map((source) => loadData(source, factory, onError)));\n\nconst loadData = <T>(\n source: DataSource,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<T | null> => {\n if (source === null) {\n return new Promise((resolve) => resolve(null));\n } else if (source instanceof Uint8Array) {\n return new Promise((resolve) =>\n resolve(factoryWrapper(Skia.Data.fromBytes(source), factory, onError))\n );\n } else {\n const uri = typeof source === \"string\" ? source : resolveAsset(source);\n return Skia.Data.fromURI(uri).then((d) =>\n factoryWrapper(d, factory, onError)\n );\n }\n};\n\ntype Source = DataSource | null | undefined;\n\nconst useLoading = <T>(\n source: Source,\n loader: () => Promise<T | null>,\n deps: DependencyList = []\n) => {\n const [data, setData] = useState<T | null>(null);\n const prevSourceRef = useRef<Source>();\n useEffect(() => {\n if (prevSourceRef.current !== source) {\n prevSourceRef.current = source;\n loader().then(setData);\n } else {\n setData(null);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n return data;\n};\n\nexport const useDataCollection = <T>(\n sources: DataSource[],\n factory: (data: SkData) => T,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) =>\n useLoading(\n sources,\n () => loadDataCollection(sources, factory, onError),\n deps\n );\n\nexport const useRawData = <T>(\n source: DataSource | null | undefined,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) => useLoading(source, () => loadData(source, factory, onError), deps);\n\nconst identity = (data: SkData) => data;\n\nexport const useData = (\n source: DataSource | null | undefined,\n onError?: (err: Error) => void,\n deps?: DependencyList\n) => useRawData(source, identity, onError, deps);\n"]}
1
+ {"version":3,"sources":["Data.ts"],"names":["resolveAsset","source","Image","resolveAssetSource","uri","default","factoryWrapper","data2","factory","onError","factoryResult","Error","loadData","undefined","Promise","resolve","Uint8Array","Skia","Data","fromBytes","fromURI","then","d","useLoading","loader","data","setData","useRawData","identity","useData"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAGA,MAAMA,YAAY,GAAIC,MAAD,IAAwB;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CAACC,IAAD,EAAOC,OAAP,IAAkB,qBAAmB,IAAnB,CAAxB;AACA,wBAAU,MAAM;AACdF,IAAAA,MAAM,GAAGH,IAAT,CAAcK,OAAd,EADc,CAEd;AACD,GAHD,EAGG,CAACzB,MAAD,CAHH;AAIA,SAAOwB,IAAP;AACD,CAVD;;AAYO,MAAME,UAAU,GAAG,CACxB1B,MADwB,EAExBO,OAFwB,EAGxBC,OAHwB,KAIrBc,UAAU,CAACtB,MAAD,EAAS,MAAMW,QAAQ,CAACX,MAAD,EAASO,OAAT,EAAkBC,OAAlB,CAAvB,CAJR;;;;AAMP,MAAMmB,QAAQ,GAAIH,IAAD,IAAkBA,IAAnC;;AAEO,MAAMI,OAAO,GAAG,CACrB5B,MADqB,EAErBQ,OAFqB,KAGlBkB,UAAU,CAAC1B,MAAD,EAAS2B,QAAT,EAAmBnB,OAAnB,CAHR","sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Image } from \"react-native\";\n\nimport { Skia } from \"../Skia\";\nimport { isRNModule } from \"../types\";\nimport type { SkData, DataModule, DataSourceParam } from \"../types\";\n\nconst resolveAsset = (source: DataModule) => {\n return isRNModule(source)\n ? Image.resolveAssetSource(source).uri\n : source.default;\n};\n\nconst factoryWrapper = <T>(\n data2: SkData,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => {\n const factoryResult = factory(data2);\n if (factoryResult === null) {\n onError && onError(new Error(\"Could not load data\"));\n return null;\n } else {\n return factoryResult;\n }\n};\n\nconst loadData = <T>(\n source: DataSourceParam,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n): Promise<T | null> => {\n if (source === null || source === undefined) {\n return new Promise((resolve) => resolve(null));\n } else if (source instanceof Uint8Array) {\n return new Promise((resolve) =>\n resolve(factoryWrapper(Skia.Data.fromBytes(source), factory, onError))\n );\n } else {\n const uri = typeof source === \"string\" ? source : resolveAsset(source);\n return Skia.Data.fromURI(uri).then((d) =>\n factoryWrapper(d, factory, onError)\n );\n }\n};\nconst useLoading = <T>(\n source: DataSourceParam,\n loader: () => Promise<T | null>\n) => {\n const [data, setData] = useState<T | null>(null);\n useEffect(() => {\n loader().then(setData);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [source]);\n return data;\n};\n\nexport const useRawData = <T>(\n source: DataSourceParam,\n factory: (data: SkData) => T,\n onError?: (err: Error) => void\n) => useLoading(source, () => loadData(source, factory, onError));\n\nconst identity = (data: SkData) => data;\n\nexport const useData = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, identity, onError);\n"]}
@@ -25,9 +25,8 @@ const useFont = (font, size, onError) => {
25
25
  return _Skia.Skia.Font(typeface);
26
26
  } else {
27
27
  return null;
28
- } // eslint-disable-next-line react-hooks/exhaustive-deps
29
-
30
- }, [typeface]);
28
+ }
29
+ }, [size, typeface]);
31
30
  };
32
31
 
33
32
  exports.useFont = useFont;
@@ -1 +1 @@
1
- {"version":3,"sources":["Font.ts"],"names":["useFont","font","size","onError","typeface","Skia","Font"],"mappings":";;;;;;;AACA;;AAEA;;AAGA;;AANA;;AAQA;AACA;AACA;AACO,MAAMA,OAAO,GAAG,CACrBC,IADqB,EAErBC,IAFqB,EAGrBC,OAHqB,KAIH;AAClB,QAAMC,QAAQ,GAAG,2BAAYH,IAAZ,EAAkBE,OAAlB,CAAjB;AACA,SAAO,oBAAQ,MAAM;AACnB,QAAIC,QAAQ,IAAIF,IAAhB,EAAsB;AACpB,aAAOG,WAAKC,IAAL,CAAUF,QAAV,EAAoBF,IAApB,CAAP;AACD,KAFD,MAEO,IAAIE,QAAQ,IAAI,CAACF,IAAjB,EAAuB;AAC5B,aAAOG,WAAKC,IAAL,CAAUF,QAAV,CAAP;AACD,KAFM,MAEA;AACL,aAAO,IAAP;AACD,KAPkB,CAQnB;;AACD,GATM,EASJ,CAACA,QAAD,CATI,CAAP;AAUD,CAhBM","sourcesContent":["/*global SkiaApi*/\nimport { useMemo } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport type { DataSource, SkFont } from \"../types\";\n\nimport { useTypeface } from \"./Typeface\";\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSource | null | undefined,\n size?: number,\n onError?: (err: Error) => void\n): SkFont | null => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface && size) {\n return Skia.Font(typeface, size);\n } else if (typeface && !size) {\n return Skia.Font(typeface);\n } else {\n return null;\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [typeface]);\n};\n"]}
1
+ {"version":3,"sources":["Font.ts"],"names":["useFont","font","size","onError","typeface","Skia","Font"],"mappings":";;;;;;;AACA;;AAEA;;AAGA;;AANA;;AAQA;AACA;AACA;AACO,MAAMA,OAAO,GAAG,CACrBC,IADqB,EAErBC,IAFqB,EAGrBC,OAHqB,KAIlB;AACH,QAAMC,QAAQ,GAAG,2BAAYH,IAAZ,EAAkBE,OAAlB,CAAjB;AACA,SAAO,oBAAQ,MAAM;AACnB,QAAIC,QAAQ,IAAIF,IAAhB,EAAsB;AACpB,aAAOG,WAAKC,IAAL,CAAUF,QAAV,EAAoBF,IAApB,CAAP;AACD,KAFD,MAEO,IAAIE,QAAQ,IAAI,CAACF,IAAjB,EAAuB;AAC5B,aAAOG,WAAKC,IAAL,CAAUF,QAAV,CAAP;AACD,KAFM,MAEA;AACL,aAAO,IAAP;AACD;AACF,GARM,EAQJ,CAACF,IAAD,EAAOE,QAAP,CARI,CAAP;AASD,CAfM","sourcesContent":["/*global SkiaApi*/\nimport { useMemo } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useTypeface } from \"./Typeface\";\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSourceParam,\n size?: number,\n onError?: (err: Error) => void\n) => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface && size) {\n return Skia.Font(typeface, size);\n } else if (typeface && !size) {\n return Skia.Font(typeface);\n } else {\n return null;\n }\n }, [size, typeface]);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Image.ts"],"names":["imgFactory","Skia","Image","MakeImageFromEncoded","bind","useImage","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,UAAU,GAAGC,WAAKC,KAAL,CAAWC,oBAAX,CAAgCC,IAAhC,CAAqCH,WAAKC,KAA1C,CAAnB;AAEA;AACA;AACA;;;AACO,MAAMG,QAAQ,GAAG,CACtBC,MADsB,EAEtBC,OAFsB,KAGnB,sBAAWD,MAAX,EAAmBN,UAAnB,EAA+BO,OAA/B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSource } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst imgFactory = Skia.Image.MakeImageFromEncoded.bind(Skia.Image);\n\n/**\n * Returns a Skia Image object\n * */\nexport const useImage = (\n source: DataSource | null | undefined,\n onError?: (err: Error) => void\n) => useRawData(source, imgFactory, onError);\n"]}
1
+ {"version":3,"sources":["Image.ts"],"names":["imgFactory","Skia","Image","MakeImageFromEncoded","bind","useImage","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,UAAU,GAAGC,WAAKC,KAAL,CAAWC,oBAAX,CAAgCC,IAAhC,CAAqCH,WAAKC,KAA1C,CAAnB;AAEA;AACA;AACA;;;AACO,MAAMG,QAAQ,GAAG,CACtBC,MADsB,EAEtBC,OAFsB,KAGnB,sBAAWD,MAAX,EAAmBN,UAAnB,EAA+BO,OAA/B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst imgFactory = Skia.Image.MakeImageFromEncoded.bind(Skia.Image);\n\n/**\n * Returns a Skia Image object\n * */\nexport const useImage = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, imgFactory, onError);\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["SVG.ts"],"names":["svgFactory","Skia","SVG","MakeFromData","bind","useSVG","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,UAAU,GAAGC,WAAKC,GAAL,CAASC,YAAT,CAAsBC,IAAtB,CAA2BH,WAAKC,GAAhC,CAAnB;;AAEO,MAAMG,MAAM,GAAG,CACpBC,MADoB,EAEpBC,OAFoB,KAGjB,sBAAWD,MAAX,EAAmBN,UAAnB,EAA+BO,OAA/B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSource } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst svgFactory = Skia.SVG.MakeFromData.bind(Skia.SVG);\n\nexport const useSVG = (\n source: DataSource | null | undefined,\n onError?: (err: Error) => void\n) => useRawData(source, svgFactory, onError);\n"]}
1
+ {"version":3,"sources":["SVG.ts"],"names":["svgFactory","Skia","SVG","MakeFromData","bind","useSVG","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,UAAU,GAAGC,WAAKC,GAAL,CAASC,YAAT,CAAsBC,IAAtB,CAA2BH,WAAKC,GAAhC,CAAnB;;AAEO,MAAMG,MAAM,GAAG,CACpBC,MADoB,EAEpBC,OAFoB,KAGjB,sBAAWD,MAAX,EAAmBN,UAAnB,EAA+BO,OAA/B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst svgFactory = Skia.SVG.MakeFromData.bind(Skia.SVG);\n\nexport const useSVG = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, svgFactory, onError);\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Typeface.ts"],"names":["tfFactory","Skia","Typeface","MakeFreeTypeFaceFromData","bind","useTypeface","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,SAAS,GAAGC,WAAKC,QAAL,CAAcC,wBAAd,CAAuCC,IAAvC,CAA4CH,WAAKC,QAAjD,CAAlB;AAEA;AACA;AACA;;;AACO,MAAMG,WAAW,GAAG,CACzBC,MADyB,EAEzBC,OAFyB,KAGtB,sBAAWD,MAAX,EAAmBN,SAAnB,EAA8BO,OAA9B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSource } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst tfFactory = Skia.Typeface.MakeFreeTypeFaceFromData.bind(Skia.Typeface);\n\n/**\n * Returns a Skia Typeface object\n * */\nexport const useTypeface = (\n source: DataSource | null | undefined,\n onError?: (err: Error) => void\n) => useRawData(source, tfFactory, onError);\n"]}
1
+ {"version":3,"sources":["Typeface.ts"],"names":["tfFactory","Skia","Typeface","MakeFreeTypeFaceFromData","bind","useTypeface","source","onError"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA,MAAMA,SAAS,GAAGC,WAAKC,QAAL,CAAcC,wBAAd,CAAuCC,IAAvC,CAA4CH,WAAKC,QAAjD,CAAlB;AAEA;AACA;AACA;;;AACO,MAAMG,WAAW,GAAG,CACzBC,MADyB,EAEzBC,OAFyB,KAGtB,sBAAWD,MAAX,EAAmBN,SAAnB,EAA8BO,OAA9B,CAHE","sourcesContent":["import { Skia } from \"../Skia\";\nimport type { DataSourceParam } from \"../types\";\n\nimport { useRawData } from \"./Data\";\n\nconst tfFactory = Skia.Typeface.MakeFreeTypeFaceFromData.bind(Skia.Typeface);\n\n/**\n * Returns a Skia Typeface object\n * */\nexport const useTypeface = (\n source: DataSourceParam,\n onError?: (err: Error) => void\n) => useRawData(source, tfFactory, onError);\n"]}
@@ -3,4 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.isRNModule = void 0;
7
+
8
+ const isRNModule = mod => typeof mod === "number";
9
+
10
+ exports.isRNModule = isRNModule;
6
11
  //# sourceMappingURL=Data.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"sources":["Data.ts"],"names":["isRNModule","mod"],"mappings":";;;;;;;AAaO,MAAMA,UAAU,GAAIC,GAAD,IACxB,OAAOA,GAAP,KAAe,QADV","sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\n\nexport type SkData = SkJSIInstance<\"Data\">;\n\ntype RNModule = number;\ntype ESModule = {\n __esModule: true;\n default: string;\n};\nexport type DataModule = RNModule | ESModule;\nexport type DataSource = DataModule | string | Uint8Array;\nexport type DataSourceParam = DataSource | null | undefined;\n\nexport const isRNModule = (mod: DataModule): mod is RNModule =>\n typeof mod === \"number\";\n"]}
@@ -3,14 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.toValue = exports.toUndefinedableValue = exports.toOptionalValue = exports.toNullableValue = exports.optEnum = exports.ckEnum = exports.NotImplementedOnRNWeb = exports.HostObject = exports.Host = void 0;
6
+ exports.optEnum = exports.ckEnum = exports.NotImplementedOnRNWeb = exports.HostObject = exports.Host = exports.BaseHostObject = void 0;
7
7
 
8
8
  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; }
9
9
 
10
- /* eslint-disable no-nested-ternary */
11
10
  class NotImplementedOnRNWeb extends Error {
12
- constructor() {
13
- super("Not implemented on React Native Web");
11
+ constructor(msg) {
12
+ super(msg !== null && msg !== void 0 ? msg : "Not implemented on React Native Web");
14
13
  }
15
14
 
16
15
  }
@@ -28,7 +27,7 @@ class Host {
28
27
 
29
28
  exports.Host = Host;
30
29
 
31
- class HostObject extends Host {
30
+ class BaseHostObject extends Host {
32
31
  constructor(CanvasKit, ref, typename) {
33
32
  super(CanvasKit);
34
33
 
@@ -40,26 +39,18 @@ class HostObject extends Host {
40
39
  this.__typename__ = typename;
41
40
  }
42
41
 
43
- } // eslint-disable-next-line @typescript-eslint/ban-types
44
-
45
-
46
- exports.HostObject = HostObject;
47
-
48
- const toOptionalValue = value => value === undefined ? undefined : value === null ? null : toValue(value);
49
-
50
- exports.toOptionalValue = toOptionalValue;
51
-
52
- const toUndefinedableValue = value => value === undefined ? undefined : toValue(value);
53
-
54
- exports.toUndefinedableValue = toUndefinedableValue;
42
+ }
55
43
 
56
- const toNullableValue = value => value === null ? null : toValue(value);
44
+ exports.BaseHostObject = BaseHostObject;
57
45
 
58
- exports.toNullableValue = toNullableValue;
46
+ class HostObject extends BaseHostObject {
47
+ static fromValue(value) {
48
+ return value.ref;
49
+ }
59
50
 
60
- const toValue = value => value.ref;
51
+ }
61
52
 
62
- exports.toValue = toValue;
53
+ exports.HostObject = HostObject;
63
54
 
64
55
  const ckEnum = value => ({
65
56
  value
@@ -1 +1 @@
1
- {"version":3,"sources":["Host.ts"],"names":["NotImplementedOnRNWeb","Error","constructor","Host","CanvasKit","HostObject","ref","typename","__typename__","toOptionalValue","value","undefined","toValue","toUndefinedableValue","toNullableValue","ckEnum","optEnum"],"mappings":";;;;;;;;;AAAA;AAKO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;AAC/CC,EAAAA,WAAW,GAAG;AACZ,UAAM,qCAAN;AACD;;AAH8C;;;;AAM1C,MAAeC,IAAf,CAAoB;AAGzBD,EAAAA,WAAW,CAACE,SAAD,EAAuB;AAAA;;AAChC,SAAKA,SAAL,GAAiBA,SAAjB;AACD;;AALwB;;;;AAQpB,MAAeC,UAAf,SACGF,IADH,CAGP;AAIED,EAAAA,WAAW,CAACE,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;AACrD,UAAMH,SAAN;;AADqD;;AAAA;;AAErD,SAAKE,GAAL,GAAWA,GAAX;AACA,SAAKE,YAAL,GAAoBD,QAApB;AACD;;AARH,C,CAWA;;;;;AAGO,MAAME,eAAe,GAC1BC,KAD6B,IAG7BA,KAAK,KAAKC,SAAV,GAAsBA,SAAtB,GAAkCD,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwBE,OAAO,CAACF,KAAD,CAH5D;;;;AAKA,MAAMG,oBAAoB,GAC/BH,KADkC,IAEfA,KAAK,KAAKC,SAAV,GAAsBA,SAAtB,GAAkCC,OAAO,CAACF,KAAD,CAFvD;;;;AAIA,MAAMI,eAAe,GAAOJ,KAAJ,IAC7BA,KAAK,KAAK,IAAV,GAAiB,IAAjB,GAAwBE,OAAO,CAACF,KAAD,CAD1B;;;;AAGA,MAAME,OAAO,GAAOF,KAAJ,IACpBA,KAAD,CAAiCJ,GAD5B;;;;AAGA,MAAMS,MAAM,GAAIL,KAAD,KAAsC;AAAEA,EAAAA;AAAF,CAAtC,CAAf;;;;AACA,MAAMM,OAAO,GAClBN,KADqB,IAGrBA,KAAK,KAAKC,SAAV,GAAsBA,SAAtB,GAAkC;AAAED,EAAAA;AAAF,CAH7B","sourcesContent":["/* eslint-disable no-nested-ternary */\nimport type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor() {\n super(\"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class HostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n readonly ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type NonNullish = {};\n\nexport const toOptionalValue = <T>(\n value: NonNullish | undefined | null\n): T | undefined | null =>\n value === undefined ? undefined : value === null ? null : toValue(value);\n\nexport const toUndefinedableValue = <T>(\n value: NonNullish | undefined\n): T | undefined => (value === undefined ? undefined : toValue(value));\n\nexport const toNullableValue = <T>(value: NonNullish | null): T | null =>\n value === null ? null : toValue(value);\n\nexport const toValue = <T>(value: NonNullish): T =>\n (value as HostObject<T, string>).ref;\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"]}
1
+ {"version":3,"sources":["Host.ts"],"names":["NotImplementedOnRNWeb","Error","constructor","msg","Host","CanvasKit","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","ckEnum","optEnum","undefined"],"mappings":";;;;;;;;;AAIO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;AAC/CC,EAAAA,WAAW,CAACC,GAAD,EAAe;AACxB,UAAMA,GAAN,aAAMA,GAAN,cAAMA,GAAN,GAAa,qCAAb;AACD;;AAH8C;;;;AAM1C,MAAeC,IAAf,CAAoB;AAGzBF,EAAAA,WAAW,CAACG,SAAD,EAAuB;AAAA;;AAChC,SAAKA,SAAL,GAAiBA,SAAjB;AACD;;AALwB;;;;AAQpB,MAAeC,cAAf,SACGF,IADH,CAGP;AAIEF,EAAAA,WAAW,CAACG,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;AACrD,UAAMH,SAAN;;AADqD;;AAAA;;AAErD,SAAKE,GAAL,GAAWA,GAAX;AACA,SAAKE,YAAL,GAAoBD,QAApB;AACD;;AARH;;;;AAWO,MAAeE,UAAf,SAAuDJ,cAAvD,CAGL;AACgB,SAATK,SAAS,CAAIC,KAAJ,EAAkC;AAChD,WAAQA,KAAD,CAAiCL,GAAxC;AACD;;AAHD;;;;AAMK,MAAMM,MAAM,GAAID,KAAD,KAAsC;AAAEA,EAAAA;AAAF,CAAtC,CAAf;;;;AACA,MAAME,OAAO,GAClBF,KADqB,IAGrBA,KAAK,KAAKG,SAAV,GAAsBA,SAAtB,GAAkC;AAAEH,EAAAA;AAAF,CAH7B","sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor(msg?: string) {\n super(msg ?? \"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n readonly ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n}\n\nexport abstract class HostObject<T, N extends string> extends BaseHostObject<\n T,\n N\n> {\n static fromValue<T>(value: SkJSIInstance<string>) {\n return (value as HostObject<T, string>).ref;\n }\n}\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"]}