@shopify/react-native-skia 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. package/android/CMakeLists.txt +38 -6
  2. package/android/build.gradle +1 -0
  3. package/android/cpp/jni/JniSkiaManager.cpp +1 -1
  4. package/android/cpp/jni/include/JniSkiaBaseView.h +0 -3
  5. package/android/cpp/jni/include/JniSkiaDomView.h +0 -6
  6. package/android/cpp/jni/include/JniSkiaPictureView.h +0 -5
  7. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.cpp +3 -3
  8. package/android/cpp/rnskia-android/GrAHardwareBufferUtils.h +2 -2
  9. package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -20
  10. package/android/cpp/rnskia-android/SkiaOpenGLHelper.h +2 -2
  11. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +3 -3
  12. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -72
  13. package/cpp/api/JsiSkSurface.h +1 -1
  14. package/cpp/rnskia/RNSkDomView.cpp +0 -79
  15. package/cpp/rnskia/RNSkDomView.h +1 -39
  16. package/cpp/rnskia/RNSkPictureView.h +0 -1
  17. package/cpp/rnskia/RNSkView.h +0 -17
  18. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.h +1 -1
  19. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +2 -2
  20. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.h +2 -2
  21. package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +1 -1
  22. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.h +1 -1
  23. package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +2 -2
  24. package/ios/RNSkia-iOS/SkiaUIView.mm +0 -51
  25. package/lib/commonjs/mock/index.js +0 -1
  26. package/lib/commonjs/mock/index.js.map +1 -1
  27. package/lib/commonjs/renderer/Canvas.d.ts +1 -2
  28. package/lib/commonjs/renderer/Canvas.js +0 -3
  29. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  30. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  31. package/lib/commonjs/views/SkiaBaseWebView.d.ts +2 -11
  32. package/lib/commonjs/views/SkiaBaseWebView.js +3 -31
  33. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  34. package/lib/commonjs/views/SkiaDomView.js +0 -12
  35. package/lib/commonjs/views/SkiaDomView.js.map +1 -1
  36. package/lib/commonjs/views/SkiaDomView.web.d.ts +2 -2
  37. package/lib/commonjs/views/SkiaDomView.web.js +1 -6
  38. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
  39. package/lib/commonjs/views/SkiaJSDomView.js +0 -12
  40. package/lib/commonjs/views/SkiaJSDomView.js.map +1 -1
  41. package/lib/commonjs/views/index.d.ts +0 -1
  42. package/lib/commonjs/views/index.js +0 -11
  43. package/lib/commonjs/views/index.js.map +1 -1
  44. package/lib/commonjs/views/types.d.ts +0 -26
  45. package/lib/commonjs/views/types.js +0 -8
  46. package/lib/commonjs/views/types.js.map +1 -1
  47. package/lib/module/mock/index.js +0 -1
  48. package/lib/module/mock/index.js.map +1 -1
  49. package/lib/module/renderer/Canvas.d.ts +1 -2
  50. package/lib/module/renderer/Canvas.js +0 -3
  51. package/lib/module/renderer/Canvas.js.map +1 -1
  52. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  53. package/lib/module/views/SkiaBaseWebView.d.ts +2 -11
  54. package/lib/module/views/SkiaBaseWebView.js +3 -31
  55. package/lib/module/views/SkiaBaseWebView.js.map +1 -1
  56. package/lib/module/views/SkiaDomView.js +0 -12
  57. package/lib/module/views/SkiaDomView.js.map +1 -1
  58. package/lib/module/views/SkiaDomView.web.d.ts +2 -2
  59. package/lib/module/views/SkiaDomView.web.js +1 -6
  60. package/lib/module/views/SkiaDomView.web.js.map +1 -1
  61. package/lib/module/views/SkiaJSDomView.js +0 -12
  62. package/lib/module/views/SkiaJSDomView.js.map +1 -1
  63. package/lib/module/views/index.d.ts +0 -1
  64. package/lib/module/views/index.js +0 -1
  65. package/lib/module/views/index.js.map +1 -1
  66. package/lib/module/views/types.d.ts +0 -26
  67. package/lib/module/views/types.js +1 -7
  68. package/lib/module/views/types.js.map +1 -1
  69. package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
  70. package/lib/typescript/lib/commonjs/views/SkiaBaseWebView.d.ts +0 -3
  71. package/lib/typescript/lib/commonjs/views/SkiaDomView.web.d.ts +1 -1
  72. package/lib/typescript/lib/commonjs/views/types.d.ts +0 -1
  73. package/lib/typescript/lib/module/mock/index.d.ts +0 -1
  74. package/lib/typescript/lib/module/views/SkiaBaseWebView.d.ts +0 -3
  75. package/lib/typescript/lib/module/views/SkiaDomView.web.d.ts +1 -1
  76. package/lib/typescript/lib/module/views/index.d.ts +0 -1
  77. package/lib/typescript/lib/module/views/types.d.ts +1 -1
  78. package/lib/typescript/src/renderer/Canvas.d.ts +1 -2
  79. package/lib/typescript/src/views/SkiaBaseWebView.d.ts +2 -11
  80. package/lib/typescript/src/views/SkiaDomView.web.d.ts +2 -2
  81. package/lib/typescript/src/views/index.d.ts +0 -1
  82. package/lib/typescript/src/views/types.d.ts +0 -26
  83. package/libs/ios/libskunicode_core.xcframework/Info.plist +46 -0
  84. package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
  85. package/libs/ios/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  86. package/libs/ios/libskunicode_libgrapheme.xcframework/Info.plist +46 -0
  87. package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  88. package/libs/ios/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  89. package/package.json +2 -8
  90. package/react-native-skia.podspec +5 -4
  91. package/src/mock/index.ts +0 -1
  92. package/src/renderer/Canvas.tsx +1 -5
  93. package/src/renderer/__tests__/setup.tsx +0 -2
  94. package/src/skia/web/JsiSkia.ts +1 -1
  95. package/src/views/SkiaBaseWebView.tsx +5 -42
  96. package/src/views/SkiaDomView.tsx +2 -14
  97. package/src/views/SkiaDomView.web.tsx +2 -9
  98. package/src/views/SkiaJSDomView.tsx +2 -14
  99. package/src/views/index.ts +0 -1
  100. package/src/views/types.ts +0 -32
  101. package/cpp/rnskia/RNSkInfoParameter.h +0 -92
  102. package/cpp/skia/include/gpu/GrBackendSemaphore.h +0 -8
  103. package/cpp/skia/include/gpu/GrBackendSurface.h +0 -8
  104. package/cpp/skia/include/gpu/GrContextOptions.h +0 -8
  105. package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +0 -8
  106. package/cpp/skia/include/gpu/GrDirectContext.h +0 -8
  107. package/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +0 -8
  108. package/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h +0 -6
  109. package/cpp/skia/include/gpu/GrRecordingContext.h +0 -8
  110. package/cpp/skia/include/gpu/GrTypes.h +0 -8
  111. package/cpp/skia/include/gpu/GrYUVABackendTextures.h +0 -8
  112. package/cpp/skia/include/gpu/d3d/GrD3DBackendContext.h +0 -8
  113. package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +0 -8
  114. package/cpp/skia/include/gpu/gl/GrGLAssembleHelpers.h +0 -8
  115. package/cpp/skia/include/gpu/gl/GrGLAssembleInterface.h +0 -8
  116. package/cpp/skia/include/gpu/gl/GrGLConfig.h +0 -8
  117. package/cpp/skia/include/gpu/gl/GrGLExtensions.h +0 -8
  118. package/cpp/skia/include/gpu/gl/GrGLFunctions.h +0 -8
  119. package/cpp/skia/include/gpu/gl/GrGLInterface.h +0 -8
  120. package/cpp/skia/include/gpu/gl/GrGLTypes.h +0 -8
  121. package/cpp/skia/include/gpu/mock/GrMockTypes.h +0 -8
  122. package/cpp/skia/include/gpu/vk/GrVkTypes.h +0 -8
  123. package/lib/commonjs/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
  124. package/lib/commonjs/views/useTouchHandler.d.ts +0 -22
  125. package/lib/commonjs/views/useTouchHandler.js +0 -83
  126. package/lib/commonjs/views/useTouchHandler.js.map +0 -1
  127. package/lib/module/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
  128. package/lib/module/views/useTouchHandler.d.ts +0 -22
  129. package/lib/module/views/useTouchHandler.js +0 -75
  130. package/lib/module/views/useTouchHandler.js.map +0 -1
  131. package/lib/typescript/lib/commonjs/views/useTouchHandler.d.ts +0 -12
  132. package/lib/typescript/lib/module/views/useTouchHandler.d.ts +0 -2
  133. package/lib/typescript/src/renderer/__tests__/TouchHandler.spec.d.ts +0 -1
  134. package/lib/typescript/src/views/useTouchHandler.d.ts +0 -22
  135. package/src/renderer/__tests__/TouchHandler.spec.tsx +0 -113
  136. package/src/views/useTouchHandler.ts +0 -107
@@ -177,55 +177,4 @@
177
177
  return _impl;
178
178
  }
179
179
 
180
- #pragma mark Touch handling
181
-
182
- - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
183
- [self handleTouches:touches withEvent:event];
184
- }
185
-
186
- - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
187
- [self handleTouches:touches withEvent:event];
188
- }
189
-
190
- - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
191
- [self handleTouches:touches withEvent:event];
192
- }
193
-
194
- - (void)handleTouches:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
195
- if (event.type == UIEventTypeTouches) {
196
- std::vector<RNSkia::RNSkTouchInfo> nextTouches;
197
- for (UITouch *touch in touches) {
198
- auto position = [touch preciseLocationInView:self];
199
- RNSkia::RNSkTouchInfo nextTouch;
200
- nextTouch.x = position.x;
201
- nextTouch.y = position.y;
202
- nextTouch.force = [touch force];
203
- nextTouch.id = [touch hash];
204
- auto phase = [touch phase];
205
- switch (phase) {
206
- case UITouchPhaseBegan:
207
- nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Start;
208
- break;
209
- case UITouchPhaseMoved:
210
- nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
211
- break;
212
- case UITouchPhaseEnded:
213
- nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::End;
214
- break;
215
- case UITouchPhaseCancelled:
216
- nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Cancelled;
217
- break;
218
- default:
219
- nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
220
- break;
221
- }
222
-
223
- nextTouches.push_back(nextTouch);
224
- }
225
- if (_impl != nullptr) {
226
- _impl->getDrawView()->updateTouchState(nextTouches);
227
- }
228
- }
229
- }
230
-
231
180
  @end
@@ -32,7 +32,6 @@ const Mock = CanvasKit => {
32
32
  // Skia Animations
33
33
  useValue: NoopValue,
34
34
  useComputedValue: NoopValue,
35
- useTouchHandler: Noop,
36
35
  useTiming: NoopValue,
37
36
  useLoop: NoopValue,
38
37
  useSpring: NoopValue,
@@ -1 +1 @@
1
- {"version":3,"names":["_web","require","Noop","undefined","NoopValue","current","NoopSharedValue","value","Mock","CanvasKit","global","SkiaApi","JsiSkApi","Skia","Canvas","useValue","useComputedValue","useTouchHandler","useTiming","useLoop","useSpring","useClockValue","useValueEffect","useClock","usePathInterpolation","useImageAsTexture","useTextureValue","useTextureValueFromPicture","useRSXformBuffer","usePointBuffer","useColorBuffer","useRectBuffer","useBuffer","useRawData","useData","useFont","Font","useFonts","useTypeface","useImage","useSVG","useVideo","exports"],"sources":["index.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport { JsiSkApi } from \"../skia/web\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Noop: () => any = () => undefined;\nconst NoopValue = () => ({ current: 0 });\nconst NoopSharedValue = () => ({ value: 0 });\n\nexport const Mock = (CanvasKit: CanvasKit) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n global.SkiaApi = JsiSkApi(CanvasKit);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const Skia = global.SkiaApi;\n return {\n Skia,\n ...require(\"../renderer/components\"),\n ...require(\"../skia\"),\n ...require(\"../animation\"),\n ...require(\"../dom/types\"),\n ...require(\"../dom/nodes\"),\n // We could use the real Canvas if we mock the SkiaView component for node\n Canvas: Noop,\n // Skia Animations\n useValue: NoopValue,\n useComputedValue: NoopValue,\n useTouchHandler: Noop,\n useTiming: NoopValue,\n useLoop: NoopValue,\n useSpring: NoopValue,\n useClockValue: NoopValue,\n useValueEffect: Noop,\n // Reanimated hooks\n useClock: NoopSharedValue,\n usePathInterpolation: NoopSharedValue,\n useImageAsTexture: NoopSharedValue,\n useTextureValue: NoopSharedValue,\n useTextureValueFromPicture: NoopSharedValue,\n useRSXformBuffer: NoopSharedValue,\n usePointBuffer: NoopSharedValue,\n useColorBuffer: NoopSharedValue,\n useRectBuffer: NoopSharedValue,\n useBuffer: NoopSharedValue,\n useRawData: Noop,\n useData: Noop,\n useFont: () => Skia.Font(undefined, 0),\n useFonts: Noop,\n useTypeface: () => null,\n useImage: () => null,\n useSVG: () => null,\n useVideo: () => null,\n };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AAEA;AACA,MAAMC,IAAe,GAAGA,CAAA,KAAMC,SAAS;AACvC,MAAMC,SAAS,GAAGA,CAAA,MAAO;EAAEC,OAAO,EAAE;AAAE,CAAC,CAAC;AACxC,MAAMC,eAAe,GAAGA,CAAA,MAAO;EAAEC,KAAK,EAAE;AAAE,CAAC,CAAC;AAErC,MAAMC,IAAI,GAAIC,SAAoB,IAAK;EAC5C;EACA;EACAC,MAAM,CAACC,OAAO,GAAG,IAAAC,aAAQ,EAACH,SAAS,CAAC;EACpC;EACA;EACA,MAAMI,IAAI,GAAGH,MAAM,CAACC,OAAO;EAC3B,OAAO;IACLE,IAAI;IACJ,GAAGZ,OAAO,CAAC,wBAAwB,CAAC;IACpC,GAAGA,OAAO,CAAC,SAAS,CAAC;IACrB,GAAGA,OAAO,CAAC,cAAc,CAAC;IAC1B,GAAGA,OAAO,CAAC,cAAc,CAAC;IAC1B,GAAGA,OAAO,CAAC,cAAc,CAAC;IAC1B;IACAa,MAAM,EAAEZ,IAAI;IACZ;IACAa,QAAQ,EAAEX,SAAS;IACnBY,gBAAgB,EAAEZ,SAAS;IAC3Ba,eAAe,EAAEf,IAAI;IACrBgB,SAAS,EAAEd,SAAS;IACpBe,OAAO,EAAEf,SAAS;IAClBgB,SAAS,EAAEhB,SAAS;IACpBiB,aAAa,EAAEjB,SAAS;IACxBkB,cAAc,EAAEpB,IAAI;IACpB;IACAqB,QAAQ,EAAEjB,eAAe;IACzBkB,oBAAoB,EAAElB,eAAe;IACrCmB,iBAAiB,EAAEnB,eAAe;IAClCoB,eAAe,EAAEpB,eAAe;IAChCqB,0BAA0B,EAAErB,eAAe;IAC3CsB,gBAAgB,EAAEtB,eAAe;IACjCuB,cAAc,EAAEvB,eAAe;IAC/BwB,cAAc,EAAExB,eAAe;IAC/ByB,aAAa,EAAEzB,eAAe;IAC9B0B,SAAS,EAAE1B,eAAe;IAC1B2B,UAAU,EAAE/B,IAAI;IAChBgC,OAAO,EAAEhC,IAAI;IACbiC,OAAO,EAAEA,CAAA,KAAMtB,IAAI,CAACuB,IAAI,CAACjC,SAAS,EAAE,CAAC,CAAC;IACtCkC,QAAQ,EAAEnC,IAAI;IACdoC,WAAW,EAAEA,CAAA,KAAM,IAAI;IACvBC,QAAQ,EAAEA,CAAA,KAAM,IAAI;IACpBC,MAAM,EAAEA,CAAA,KAAM,IAAI;IAClBC,QAAQ,EAAEA,CAAA,KAAM;EAClB,CAAC;AACH,CAAC;AAACC,OAAA,CAAAlC,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_web","require","Noop","undefined","NoopValue","current","NoopSharedValue","value","Mock","CanvasKit","global","SkiaApi","JsiSkApi","Skia","Canvas","useValue","useComputedValue","useTiming","useLoop","useSpring","useClockValue","useValueEffect","useClock","usePathInterpolation","useImageAsTexture","useTextureValue","useTextureValueFromPicture","useRSXformBuffer","usePointBuffer","useColorBuffer","useRectBuffer","useBuffer","useRawData","useData","useFont","Font","useFonts","useTypeface","useImage","useSVG","useVideo","exports"],"sources":["index.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport { JsiSkApi } from \"../skia/web\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Noop: () => any = () => undefined;\nconst NoopValue = () => ({ current: 0 });\nconst NoopSharedValue = () => ({ value: 0 });\n\nexport const Mock = (CanvasKit: CanvasKit) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n global.SkiaApi = JsiSkApi(CanvasKit);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const Skia = global.SkiaApi;\n return {\n Skia,\n ...require(\"../renderer/components\"),\n ...require(\"../skia\"),\n ...require(\"../animation\"),\n ...require(\"../dom/types\"),\n ...require(\"../dom/nodes\"),\n // We could use the real Canvas if we mock the SkiaView component for node\n Canvas: Noop,\n // Skia Animations\n useValue: NoopValue,\n useComputedValue: NoopValue,\n useTiming: NoopValue,\n useLoop: NoopValue,\n useSpring: NoopValue,\n useClockValue: NoopValue,\n useValueEffect: Noop,\n // Reanimated hooks\n useClock: NoopSharedValue,\n usePathInterpolation: NoopSharedValue,\n useImageAsTexture: NoopSharedValue,\n useTextureValue: NoopSharedValue,\n useTextureValueFromPicture: NoopSharedValue,\n useRSXformBuffer: NoopSharedValue,\n usePointBuffer: NoopSharedValue,\n useColorBuffer: NoopSharedValue,\n useRectBuffer: NoopSharedValue,\n useBuffer: NoopSharedValue,\n useRawData: Noop,\n useData: Noop,\n useFont: () => Skia.Font(undefined, 0),\n useFonts: Noop,\n useTypeface: () => null,\n useImage: () => null,\n useSVG: () => null,\n useVideo: () => null,\n };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;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ACsB,IAAI,CAAChC,SAAS,EAAE,CAAC,CAAC;IACtCiC,QAAQ,EAAElC,IAAI;IACdmC,WAAW,EAAEA,CAAA,KAAM,IAAI;IACvBC,QAAQ,EAAEA,CAAA,KAAM,IAAI;IACpBC,MAAM,EAAEA,CAAA,KAAM,IAAI;IAClBC,QAAQ,EAAEA,CAAA,KAAM;EAClB,CAAC;AACH,CAAC;AAACC,OAAA,CAAAjC,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -1,11 +1,10 @@
1
1
  import React from "react";
2
2
  import type { RefObject, ReactNode, FunctionComponent } from "react";
3
3
  import { SkiaDomView } from "../views";
4
- import type { TouchHandler, SkiaBaseViewProps } from "../views";
4
+ import type { SkiaBaseViewProps } from "../views";
5
5
  export declare const useCanvasRef: () => React.RefObject<SkiaDomView>;
6
6
  export interface CanvasProps extends SkiaBaseViewProps {
7
7
  ref?: RefObject<SkiaDomView>;
8
8
  children: ReactNode;
9
- onTouch?: TouchHandler;
10
9
  }
11
10
  export declare const Canvas: FunctionComponent<CanvasProps & React.RefAttributes<SkiaDomView>>;
@@ -37,7 +37,6 @@ const Canvas = exports.Canvas = /*#__PURE__*/(0, _react.forwardRef)(({
37
37
  style,
38
38
  debug,
39
39
  mode,
40
- onTouch,
41
40
  onSize: _onSize,
42
41
  onLayout: _onLayout,
43
42
  ...props
@@ -70,7 +69,6 @@ const Canvas = exports.Canvas = /*#__PURE__*/(0, _react.forwardRef)(({
70
69
  ref: ref,
71
70
  style: style,
72
71
  root: root.dom,
73
- onTouch: onTouch,
74
72
  onLayout: onLayout,
75
73
  mode: mode,
76
74
  debug: debug
@@ -83,7 +81,6 @@ const Canvas = exports.Canvas = /*#__PURE__*/(0, _react.forwardRef)(({
83
81
  ref: ref,
84
82
  style: style,
85
83
  root: root.dom,
86
- onTouch: onTouch,
87
84
  onLayout: onLayout,
88
85
  mode: mode,
89
86
  debug: debug
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_views","_Skia","_SkiaJSDomView","_Reconciler","_HostComponents","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","useCanvasRef","useRef","exports","useOnSizeEvent","resultValue","onLayout","useCallback","event","width","height","nativeEvent","layout","value","Canvas","forwardRef","children","style","debug","mode","onTouch","onSize","_onSize","_onLayout","props","forwardedRef","innerRef","ref","useCombinedRefs","redraw","_innerRef$current","current","getNativeId","_innerRef$current$nat","_innerRef$current2","id","nativeId","root","useMemo","SkiaRoot","Skia","NATIVE_DOM","useEffect","render","unmount","createElement","SkiaDomView","dom","SkiaJSDomView","refs","targetRef","React","forEach"],"sources":["Canvas.tsx"],"sourcesContent":["import React, {\n useEffect,\n useCallback,\n useMemo,\n forwardRef,\n useRef,\n} from \"react\";\nimport type {\n RefObject,\n ReactNode,\n MutableRefObject,\n ForwardedRef,\n FunctionComponent,\n} from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nimport { SkiaDomView } from \"../views\";\nimport { Skia } from \"../skia/Skia\";\nimport type { TouchHandler, SkiaBaseViewProps } from \"../views\";\nimport { SkiaJSDomView } from \"../views/SkiaJSDomView\";\n\nimport { SkiaRoot } from \"./Reconciler\";\nimport { NATIVE_DOM } from \"./HostComponents\";\n\nexport const useCanvasRef = () => useRef<SkiaDomView>(null);\n\nexport interface CanvasProps extends SkiaBaseViewProps {\n ref?: RefObject<SkiaDomView>;\n children: ReactNode;\n onTouch?: TouchHandler;\n}\n\nconst useOnSizeEvent = (\n resultValue: SkiaBaseViewProps[\"onSize\"],\n onLayout?: (event: LayoutChangeEvent) => void\n) => {\n return useCallback(\n (event: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(event);\n }\n const { width, height } = event.nativeEvent.layout;\n\n if (resultValue) {\n resultValue.value = { width, height };\n }\n },\n [onLayout, resultValue]\n );\n};\n\nexport const Canvas = forwardRef<SkiaDomView, CanvasProps>(\n (\n {\n children,\n style,\n debug,\n mode,\n onTouch,\n onSize: _onSize,\n onLayout: _onLayout,\n ...props\n },\n forwardedRef\n ) => {\n const onLayout = useOnSizeEvent(_onSize, _onLayout);\n const innerRef = useCanvasRef();\n const ref = useCombinedRefs(forwardedRef, innerRef);\n const redraw = useCallback(() => {\n innerRef.current?.redraw();\n }, [innerRef]);\n const getNativeId = useCallback(() => {\n const id = innerRef.current?.nativeId ?? -1;\n return id;\n }, [innerRef]);\n\n const root = useMemo(\n () => new SkiaRoot(Skia, NATIVE_DOM, redraw, getNativeId),\n [redraw, getNativeId]\n );\n\n // Render effect\n useEffect(() => {\n root.render(children);\n }, [children, root, redraw]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n if (NATIVE_DOM) {\n return (\n <SkiaDomView\n ref={ref}\n style={style}\n root={root.dom}\n onTouch={onTouch}\n onLayout={onLayout}\n mode={mode}\n debug={debug}\n {...props}\n />\n );\n } else {\n return (\n <SkiaJSDomView\n Skia={Skia}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={ref as any}\n style={style}\n root={root.dom}\n onTouch={onTouch}\n onLayout={onLayout}\n mode={mode}\n debug={debug}\n {...props}\n />\n );\n }\n }\n) as FunctionComponent<CanvasProps & React.RefAttributes<SkiaDomView>>;\n\n/**\n * Combines a list of refs into a single ref. This can be used to provide\n * both a forwarded ref and an internal ref keeping the same functionality\n * on both of the refs.\n * @param refs Array of refs to combine\n * @returns A single ref that can be used in a ref prop.\n */\nconst useCombinedRefs = <T,>(\n ...refs: Array<MutableRefObject<T> | ForwardedRef<T>>\n) => {\n const targetRef = React.useRef<T>(null);\n React.useEffect(() => {\n refs.forEach((ref) => {\n if (ref) {\n if (typeof ref === \"function\") {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n }\n });\n }, [refs]);\n return targetRef;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA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,EAAAnD,QAAA;MACVgC,GAAG,EAAEA,GAAI;MACTV,KAAK,EAAEA,KAAM;MACboB,IAAI,EAAEA,IAAI,CAACU,GAAI;MACf3B,OAAO,EAAEA,OAAQ;MACjBd,QAAQ,EAAEA,QAAS;MACnBa,IAAI,EAAEA,IAAK;MACXD,KAAK,EAAEA;IAAM,GACTM,KAAK,CACV,CAAC;EAEN,CAAC,MAAM;IACL,oBACEzD,MAAA,CAAAc,OAAA,CAAAgE,aAAA,CAACzE,cAAA,CAAA4E,aAAa,EAAArD,QAAA;MACZ6C,IAAI,EAAEA;MACN;MAAA;MACAb,GAAG,EAAEA,GAAW;MAChBV,KAAK,EAAEA,KAAM;MACboB,IAAI,EAAEA,IAAI,CAACU,GAAI;MACf3B,OAAO,EAAEA,OAAQ;MACjBd,QAAQ,EAAEA,QAAS;MACnBa,IAAI,EAAEA,IAAK;MACXD,KAAK,EAAEA;IAAM,GACTM,KAAK,CACV,CAAC;EAEN;AACF,CACF,CAAsE;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,eAAe,GAAGA,CACtB,GAAGqB,IAAkD,KAClD;EACH,MAAMC,SAAS,GAAGC,cAAK,CAACjD,MAAM,CAAI,IAAI,CAAC;EACvCiD,cAAK,CAACT,SAAS,CAAC,MAAM;IACpBO,IAAI,CAACG,OAAO,CAAEzB,GAAG,IAAK;MACpB,IAAIA,GAAG,EAAE;QACP,IAAI,OAAOA,GAAG,KAAK,UAAU,EAAE;UAC7BA,GAAG,CAACuB,SAAS,CAACnB,OAAO,CAAC;QACxB,CAAC,MAAM;UACLJ,GAAG,CAACI,OAAO,GAAGmB,SAAS,CAACnB,OAAO;QACjC;MACF;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACkB,IAAI,CAAC,CAAC;EACV,OAAOC,SAAS;AAClB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_views","_Skia","_SkiaJSDomView","_Reconciler","_HostComponents","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","useCanvasRef","useRef","exports","useOnSizeEvent","resultValue","onLayout","useCallback","event","width","height","nativeEvent","layout","value","Canvas","forwardRef","children","style","debug","mode","onSize","_onSize","_onLayout","props","forwardedRef","innerRef","ref","useCombinedRefs","redraw","_innerRef$current","current","getNativeId","_innerRef$current$nat","_innerRef$current2","id","nativeId","root","useMemo","SkiaRoot","Skia","NATIVE_DOM","useEffect","render","unmount","createElement","SkiaDomView","dom","SkiaJSDomView","refs","targetRef","React","forEach"],"sources":["Canvas.tsx"],"sourcesContent":["import React, {\n useEffect,\n useCallback,\n useMemo,\n forwardRef,\n useRef,\n} from \"react\";\nimport type {\n RefObject,\n ReactNode,\n MutableRefObject,\n ForwardedRef,\n FunctionComponent,\n} from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nimport { SkiaDomView } from \"../views\";\nimport { Skia } from \"../skia/Skia\";\nimport type { SkiaBaseViewProps } from \"../views\";\nimport { SkiaJSDomView } from \"../views/SkiaJSDomView\";\n\nimport { SkiaRoot } from \"./Reconciler\";\nimport { NATIVE_DOM } from \"./HostComponents\";\n\nexport const useCanvasRef = () => useRef<SkiaDomView>(null);\n\nexport interface CanvasProps extends SkiaBaseViewProps {\n ref?: RefObject<SkiaDomView>;\n children: ReactNode;\n}\n\nconst useOnSizeEvent = (\n resultValue: SkiaBaseViewProps[\"onSize\"],\n onLayout?: (event: LayoutChangeEvent) => void\n) => {\n return useCallback(\n (event: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(event);\n }\n const { width, height } = event.nativeEvent.layout;\n\n if (resultValue) {\n resultValue.value = { width, height };\n }\n },\n [onLayout, resultValue]\n );\n};\n\nexport const Canvas = forwardRef<SkiaDomView, CanvasProps>(\n (\n {\n children,\n style,\n debug,\n mode,\n onSize: _onSize,\n onLayout: _onLayout,\n ...props\n },\n forwardedRef\n ) => {\n const onLayout = useOnSizeEvent(_onSize, _onLayout);\n const innerRef = useCanvasRef();\n const ref = useCombinedRefs(forwardedRef, innerRef);\n const redraw = useCallback(() => {\n innerRef.current?.redraw();\n }, [innerRef]);\n const getNativeId = useCallback(() => {\n const id = innerRef.current?.nativeId ?? -1;\n return id;\n }, [innerRef]);\n\n const root = useMemo(\n () => new SkiaRoot(Skia, NATIVE_DOM, redraw, getNativeId),\n [redraw, getNativeId]\n );\n\n // Render effect\n useEffect(() => {\n root.render(children);\n }, [children, root, redraw]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n if (NATIVE_DOM) {\n return (\n <SkiaDomView\n ref={ref}\n style={style}\n root={root.dom}\n onLayout={onLayout}\n mode={mode}\n debug={debug}\n {...props}\n />\n );\n } else {\n return (\n <SkiaJSDomView\n Skia={Skia}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={ref as any}\n style={style}\n root={root.dom}\n onLayout={onLayout}\n mode={mode}\n debug={debug}\n {...props}\n />\n );\n }\n }\n) as FunctionComponent<CanvasProps & React.RefAttributes<SkiaDomView>>;\n\n/**\n * Combines a list of refs into a single ref. This can be used to provide\n * both a forwarded ref and an internal ref keeping the same functionality\n * on both of the refs.\n * @param refs Array of refs to combine\n * @returns A single ref that can be used in a ref prop.\n */\nconst useCombinedRefs = <T,>(\n ...refs: Array<MutableRefObject<T> | ForwardedRef<T>>\n) => {\n const targetRef = React.useRef<T>(null);\n React.useEffect(() => {\n refs.forEach((ref) => {\n if (ref) {\n if (typeof ref === \"function\") {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n }\n });\n }, [refs]);\n return targetRef;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAgBA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AAEA,IA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EA,QAAS;MACnBa,IAAI,EAAEA,IAAK;MACXD,KAAK,EAAEA;IAAM,GACTK,KAAK,CACV,CAAC;EAEN,CAAC,MAAM;IACL,oBACExD,MAAA,CAAAc,OAAA,CAAA+D,aAAA,CAACxE,cAAA,CAAA2E,aAAa,EAAApD,QAAA;MACZ4C,IAAI,EAAEA;MACN;MAAA;MACAb,GAAG,EAAEA,GAAW;MAChBT,KAAK,EAAEA,KAAM;MACbmB,IAAI,EAAEA,IAAI,CAACU,GAAI;MACfxC,QAAQ,EAAEA,QAAS;MACnBa,IAAI,EAAEA,IAAK;MACXD,KAAK,EAAEA;IAAM,GACTK,KAAK,CACV,CAAC;EAEN;AACF,CACF,CAAsE;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,eAAe,GAAGA,CACtB,GAAGqB,IAAkD,KAClD;EACH,MAAMC,SAAS,GAAGC,cAAK,CAAChD,MAAM,CAAI,IAAI,CAAC;EACvCgD,cAAK,CAACT,SAAS,CAAC,MAAM;IACpBO,IAAI,CAACG,OAAO,CAAEzB,GAAG,IAAK;MACpB,IAAIA,GAAG,EAAE;QACP,IAAI,OAAOA,GAAG,KAAK,UAAU,EAAE;UAC7BA,GAAG,CAACuB,SAAS,CAACnB,OAAO,CAAC;QACxB,CAAC,MAAM;UACLJ,GAAG,CAACI,OAAO,GAAGmB,SAAS,CAACnB,OAAO;QACjC;MACF;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACkB,IAAI,CAAC,CAAC;EACV,OAAOC,SAAS;AAClB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_JsiSkPoint","require","_JsiSkPaint","_JsiSkRect","_JsiSkColor","_JsiSkSurfaceFactory","_JsiSkRRect","_JsiSkRSXform","_JsiSkContourMeasureIter","_JsiSkPictureRecorder","_JsiSkPictureFactory","_JsiSkPathFactory","_JsiSkMatrix","_JsiSkColorFilterFactory","_JsiSkTypefaceFactory","_JsiSkMaskFilterFactory","_JsiSkRuntimeEffectFactory","_JsiSkImageFilterFactory","_JsiSkShaderFactory","_JsiSkPathEffectFactory","_JsiSkDataFactory","_JsiSkImageFactory","_JsiSkSVGFactory","_JsiSkTextBlobFactory","_JsiSkFont","_JsiSkVerticesFactory","_JsiSkPath","_JsiSkTypeface","_JsiSkTypefaceFontProviderFactory","_JsiSkFontMgrFactory","_JsiSkAnimatedImageFactory","_JsiSkParagraphBuilderFactory","_JsiSkNativeBufferFactory","_JsiVideo","JsiSkApi","CanvasKit","Point","x","y","JsiSkPoint","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","JsiSkRRect","RSXform","scos","ssin","tx","ty","JsiSkRSXform","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","Color","ContourMeasureIter","path","forceClosed","resScale","JsiSkContourMeasureIter","JsiSkPath","fromValue","Paint","paint","JsiSkPaint","setAntiAlias","PictureRecorder","JsiSkPictureRecorder","Picture","JsiSkPictureFactory","Path","JsiSkPathFactory","Matrix","matrix","JsiSkMatrix","identity","ColorFilter","JsiSkColorFilterFactory","Font","typeface","size","JsiSkFont","undefined","JsiSkTypeface","Typeface","JsiSkTypefaceFactory","MaskFilter","JsiSkMaskFilterFactory","RuntimeEffect","JsiSkRuntimeEffectFactory","ImageFilter","JsiSkImageFilterFactory","Shader","JsiSkShaderFactory","PathEffect","JsiSkPathEffectFactory","MakeVertices","bind","Data","JsiSkDataFactory","Image","JsiSkImageFactory","AnimatedImage","JsiSkAnimatedImageFactory","SVG","JsiSkSVGFactory","TextBlob","JsiSkTextBlobFactory","XYWHRect","width","height","JsiSkRect","Surface","JsiSkSurfaceFactory","TypefaceFontProvider","JsiSkTypefaceFontProviderFactory","FontMgr","JsiSkFontMgrFactory","ParagraphBuilder","JsiSkParagraphBuilderFactory","NativeBuffer","JsiSkNativeBufferFactory","Video","createVideo","Context","_surface","_width","_height","exports"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n Context: (_surface: bigint, _width: number, _height: number) => {\n throw new Error(\"Not implemented on React Native Web\");\n }\n});\n"],"mappings":";;;;;;AAYA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,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IAAIC,oDAAyB,CAAChF,SAAS,CAAC;EACvDiF,GAAG,EAAE,IAAIC,gCAAe,CAAClF,SAAS,CAAC;EACnCmF,QAAQ,EAAE,IAAIC,0CAAoB,CAACpF,SAAS,CAAC;EAC7CqF,QAAQ,EAAEA,CAACnF,CAAS,EAAEC,CAAS,EAAEmF,KAAa,EAAEC,MAAc,KAAK;IACjE,OAAO,IAAIC,oBAAS,CAACxF,SAAS,EAAEA,SAAS,CAACqF,QAAQ,CAACnF,CAAC,EAAEC,CAAC,EAAEmF,KAAK,EAAEC,MAAM,CAAC,CAAC;EAC1E,CAAC;EACDE,OAAO,EAAE,IAAIC,wCAAmB,CAAC1F,SAAS,CAAC;EAC3C2F,oBAAoB,EAAE,IAAIC,kEAAgC,CAAC5F,SAAS,CAAC;EACrE6F,OAAO,EAAE,IAAIC,wCAAmB,CAAC9F,SAAS,CAAC;EAC3C+F,gBAAgB,EAAE,IAAIC,0DAA4B,CAAChG,SAAS,CAAC;EAC7DiG,YAAY,EAAE,IAAIC,kDAAwB,CAAClG,SAAS,CAAC;EACrDmG,KAAK,EAAEC,qBAAW,CAAC1B,IAAI,CAAC,IAAI,EAAE1E,SAAS,CAAC;EACxCqG,OAAO,EAAEA,CAACC,QAAgB,EAAEC,MAAc,EAAEC,OAAe,KAAK;IAC9D,MAAM,IAAI/F,KAAK,CAAC,qCAAqC,CAAC;EACxD;AACF,CAAC,CAAC;AAACgG,OAAA,CAAA1G,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_JsiSkPoint","require","_JsiSkPaint","_JsiSkRect","_JsiSkColor","_JsiSkSurfaceFactory","_JsiSkRRect","_JsiSkRSXform","_JsiSkContourMeasureIter","_JsiSkPictureRecorder","_JsiSkPictureFactory","_JsiSkPathFactory","_JsiSkMatrix","_JsiSkColorFilterFactory","_JsiSkTypefaceFactory","_JsiSkMaskFilterFactory","_JsiSkRuntimeEffectFactory","_JsiSkImageFilterFactory","_JsiSkShaderFactory","_JsiSkPathEffectFactory","_JsiSkDataFactory","_JsiSkImageFactory","_JsiSkSVGFactory","_JsiSkTextBlobFactory","_JsiSkFont","_JsiSkVerticesFactory","_JsiSkPath","_JsiSkTypeface","_JsiSkTypefaceFontProviderFactory","_JsiSkFontMgrFactory","_JsiSkAnimatedImageFactory","_JsiSkParagraphBuilderFactory","_JsiSkNativeBufferFactory","_JsiVideo","JsiSkApi","CanvasKit","Point","x","y","JsiSkPoint","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","JsiSkRRect","RSXform","scos","ssin","tx","ty","JsiSkRSXform","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","Color","ContourMeasureIter","path","forceClosed","resScale","JsiSkContourMeasureIter","JsiSkPath","fromValue","Paint","paint","JsiSkPaint","setAntiAlias","PictureRecorder","JsiSkPictureRecorder","Picture","JsiSkPictureFactory","Path","JsiSkPathFactory","Matrix","matrix","JsiSkMatrix","identity","ColorFilter","JsiSkColorFilterFactory","Font","typeface","size","JsiSkFont","undefined","JsiSkTypeface","Typeface","JsiSkTypefaceFactory","MaskFilter","JsiSkMaskFilterFactory","RuntimeEffect","JsiSkRuntimeEffectFactory","ImageFilter","JsiSkImageFilterFactory","Shader","JsiSkShaderFactory","PathEffect","JsiSkPathEffectFactory","MakeVertices","bind","Data","JsiSkDataFactory","Image","JsiSkImageFactory","AnimatedImage","JsiSkAnimatedImageFactory","SVG","JsiSkSVGFactory","TextBlob","JsiSkTextBlobFactory","XYWHRect","width","height","JsiSkRect","Surface","JsiSkSurfaceFactory","TypefaceFontProvider","JsiSkTypefaceFontProviderFactory","FontMgr","JsiSkFontMgrFactory","ParagraphBuilder","JsiSkParagraphBuilderFactory","NativeBuffer","JsiSkNativeBufferFactory","Video","createVideo","Context","_surface","_width","_height","exports"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect): SkRuntimeShaderBuilder => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(\n JsiSkPath.fromValue(path),\n forceClosed,\n resScale\n )\n ),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n Context: (_surface: bigint, _width: number, _height: number) => {\n throw new Error(\"Not implemented on React Native Web\");\n },\n});\n"],"mappings":";;;;;;AAYA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,wBAAA,GAAAP,OAAA;AACA,IAAAQ,qBAAA,GAAAR,OAAA;A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IAAIC,gCAAe,CAAClF,SAAS,CAAC;EACnCmF,QAAQ,EAAE,IAAIC,0CAAoB,CAACpF,SAAS,CAAC;EAC7CqF,QAAQ,EAAEA,CAACnF,CAAS,EAAEC,CAAS,EAAEmF,KAAa,EAAEC,MAAc,KAAK;IACjE,OAAO,IAAIC,oBAAS,CAACxF,SAAS,EAAEA,SAAS,CAACqF,QAAQ,CAACnF,CAAC,EAAEC,CAAC,EAAEmF,KAAK,EAAEC,MAAM,CAAC,CAAC;EAC1E,CAAC;EACDE,OAAO,EAAE,IAAIC,wCAAmB,CAAC1F,SAAS,CAAC;EAC3C2F,oBAAoB,EAAE,IAAIC,kEAAgC,CAAC5F,SAAS,CAAC;EACrE6F,OAAO,EAAE,IAAIC,wCAAmB,CAAC9F,SAAS,CAAC;EAC3C+F,gBAAgB,EAAE,IAAIC,0DAA4B,CAAChG,SAAS,CAAC;EAC7DiG,YAAY,EAAE,IAAIC,kDAAwB,CAAClG,SAAS,CAAC;EACrDmG,KAAK,EAAEC,qBAAW,CAAC1B,IAAI,CAAC,IAAI,EAAE1E,SAAS,CAAC;EACxCqG,OAAO,EAAEA,CAACC,QAAgB,EAAEC,MAAc,EAAEC,OAAe,KAAK;IAC9D,MAAM,IAAI/F,KAAK,CAAC,qCAAqC,CAAC;EACxD;AACF,CAAC,CAAC;AAACgG,OAAA,CAAA1G,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -1,13 +1,10 @@
1
1
  import React from "react";
2
- import type { PointerEvent } from "react";
3
2
  import type { SkRect, SkCanvas } from "../skia/types";
4
- import type { DrawMode, SkiaBaseViewProps, TouchInfo } from "./types";
5
- import { TouchType } from "./types";
3
+ import type { DrawMode, SkiaBaseViewProps } from "./types";
6
4
  export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps> extends React.Component<TProps> {
7
5
  constructor(props: TProps);
8
6
  private _surface;
9
7
  private _unsubscriptions;
10
- private _touches;
11
8
  private _canvas;
12
9
  private _canvasRef;
13
10
  private _mode;
@@ -33,7 +30,7 @@ export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps>
33
30
  /**
34
31
  * Override to render
35
32
  */
36
- protected abstract renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void;
33
+ protected abstract renderInCanvas(canvas: SkCanvas): void;
37
34
  /**
38
35
  * Sends a redraw request to the native SkiaView.
39
36
  */
@@ -49,12 +46,6 @@ export declare abstract class SkiaBaseWebView<TProps extends SkiaBaseViewProps>
49
46
  * @param mode Drawing mode to use.
50
47
  */
51
48
  setDrawMode(mode: DrawMode): void;
52
- private handleTouchEvent;
53
- createTouchHandler(touchType: TouchType): (evt: PointerEvent) => void;
54
- private onStart;
55
- private onActive;
56
- private onCancel;
57
- private onEnd;
58
49
  private onLayout;
59
50
  render(): React.JSX.Element;
60
51
  }
@@ -7,7 +7,6 @@ exports.SkiaBaseWebView = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _JsiSkSurface = require("../skia/web/JsiSkSurface");
9
9
  var _Platform = require("../Platform");
10
- var _types = require("./types");
11
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
11
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
13
12
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -20,7 +19,6 @@ class SkiaBaseWebView extends _react.default.Component {
20
19
  super(props);
21
20
  _defineProperty(this, "_surface", null);
22
21
  _defineProperty(this, "_unsubscriptions", []);
23
- _defineProperty(this, "_touches", []);
24
22
  _defineProperty(this, "_canvas", null);
25
23
  _defineProperty(this, "_canvasRef", /*#__PURE__*/_react.default.createRef());
26
24
  _defineProperty(this, "_mode", void 0);
@@ -28,10 +26,6 @@ class SkiaBaseWebView extends _react.default.Component {
28
26
  _defineProperty(this, "requestId", 0);
29
27
  _defineProperty(this, "width", 0);
30
28
  _defineProperty(this, "height", 0);
31
- _defineProperty(this, "onStart", this.createTouchHandler(_types.TouchType.Start));
32
- _defineProperty(this, "onActive", this.createTouchHandler(_types.TouchType.Active));
33
- _defineProperty(this, "onCancel", this.createTouchHandler(_types.TouchType.Cancelled));
34
- _defineProperty(this, "onEnd", this.createTouchHandler(_types.TouchType.End));
35
29
  _defineProperty(this, "onLayout", this.onLayoutEvent.bind(this));
36
30
  this._mode = (_props$mode = props.mode) !== null && _props$mode !== void 0 ? _props$mode : "default";
37
31
  }
@@ -97,7 +91,7 @@ class SkiaBaseWebView extends _react.default.Component {
97
91
  makeImageSnapshot(rect) {
98
92
  var _this$_surface, _this$_surface2;
99
93
  this._canvas.clear(CanvasKit.TRANSPARENT);
100
- this.renderInCanvas(this._canvas, []);
94
+ this.renderInCanvas(this._canvas);
101
95
  (_this$_surface = this._surface) === null || _this$_surface === void 0 || _this$_surface.ref.flush();
102
96
  return (_this$_surface2 = this._surface) === null || _this$_surface2 === void 0 ? void 0 : _this$_surface2.makeImageSnapshot(rect);
103
97
  }
@@ -114,13 +108,11 @@ class SkiaBaseWebView extends _react.default.Component {
114
108
  this._redrawRequests = 0;
115
109
  if (this._canvas) {
116
110
  var _this$_surface3;
117
- const touches = [...this._touches];
118
- this._touches = [];
119
111
  const canvas = this._canvas;
120
112
  canvas.clear(Float32Array.of(0, 0, 0, 0));
121
113
  canvas.save();
122
114
  canvas.scale(pd, pd);
123
- this.renderInCanvas(canvas, touches);
115
+ this.renderInCanvas(canvas);
124
116
  canvas.restore();
125
117
  (_this$_surface3 = this._surface) === null || _this$_surface3 === void 0 || _this$_surface3.ref.flush();
126
118
  }
@@ -144,20 +136,6 @@ class SkiaBaseWebView extends _react.default.Component {
144
136
  this._mode = mode;
145
137
  this.tick();
146
138
  }
147
- handleTouchEvent(evt, touchType) {
148
- this._touches.push({
149
- id: evt.pointerId,
150
- x: evt.clientX - evt.currentTarget.getClientRects()[0].left,
151
- y: evt.clientY - evt.currentTarget.getClientRects()[0].top,
152
- force: evt.pressure,
153
- type: touchType,
154
- timestamp: Date.now()
155
- });
156
- this.redraw();
157
- }
158
- createTouchHandler(touchType) {
159
- return evt => this.handleTouchEvent(evt, touchType);
160
- }
161
139
  render() {
162
140
  const {
163
141
  mode,
@@ -171,13 +149,7 @@ class SkiaBaseWebView extends _react.default.Component {
171
149
  style: {
172
150
  display: "flex",
173
151
  flex: 1
174
- },
175
- onPointerDown: this.onStart,
176
- onPointerMove: this.onActive,
177
- onPointerUp: this.onEnd,
178
- onPointerCancel: this.onCancel,
179
- onPointerLeave: this.onEnd,
180
- onPointerOut: this.onEnd
152
+ }
181
153
  }));
182
154
  }
183
155
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_JsiSkSurface","_Platform","_types","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","pd","Platform","PixelRatio","SkiaBaseWebView","React","Component","constructor","props","_props$mode","createRef","createTouchHandler","TouchType","Start","Active","Cancelled","End","onLayoutEvent","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","evt","CanvasKit","global","canvas","_canvasRef","current","width","clientWidth","height","clientHeight","surface","MakeWebGLCanvasSurface","Error","_surface","JsiSkSurface","_canvas","getCanvas","redraw","onLayout","getSize","componentDidMount","tick","componentDidUpdate","componentWillUnmount","cancelAnimationFrame","requestId","_this$_canvasRef$curr","getContext","getExtension","loseContext","makeImageSnapshot","rect","_this$_surface","_this$_surface2","clear","TRANSPARENT","renderInCanvas","ref","flush","_redrawRequests","_this$_surface3","touches","_touches","Float32Array","of","save","scale","restore","requestAnimationFrame","setDrawMode","handleTouchEvent","touchType","push","id","pointerId","x","clientX","currentTarget","getClientRects","left","y","clientY","top","force","pressure","type","timestamp","Date","now","render","debug","viewProps","createElement","View","style","display","flex","onPointerDown","onStart","onPointerMove","onActive","onPointerUp","onEnd","onPointerCancel","onCancel","onPointerLeave","onPointerOut","exports"],"sources":["SkiaBaseWebView.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { PointerEvent } from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\nimport { Platform } from \"../Platform\";\n\nimport type { DrawMode, SkiaBaseViewProps, TouchInfo } from \"./types\";\nimport { TouchType } from \"./types\";\n\nconst pd = Platform.PixelRatio;\n\nexport abstract class SkiaBaseWebView<\n TProps extends SkiaBaseViewProps\n> extends React.Component<TProps> {\n constructor(props: TProps) {\n super(props);\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _touches: Array<TouchInfo> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef = React.createRef<HTMLCanvasElement>();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private requestId = 0;\n\n protected width = 0;\n protected height = 0;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayoutEvent(evt: LayoutChangeEvent) {\n const { CanvasKit } = global;\n // Reset canvas / surface on layout change\n const canvas = this._canvasRef.current;\n if (canvas) {\n this.width = canvas.clientWidth;\n this.height = canvas.clientHeight;\n canvas.width = this.width * pd;\n canvas.height = this.height * pd;\n const surface = CanvasKit.MakeWebGLCanvasSurface(canvas);\n if (!surface) {\n throw new Error(\"Could not create surface\");\n }\n this._surface = new JsiSkSurface(CanvasKit, surface);\n this._canvas = this._surface.getCanvas();\n this.redraw();\n }\n // Call onLayout callback if it exists\n if (this.props.onLayout) {\n this.props.onLayout(evt);\n }\n }\n\n protected getSize() {\n return { width: this.width, height: this.height };\n }\n\n componentDidMount() {\n // Start render loop\n this.tick();\n }\n\n componentDidUpdate() {\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n cancelAnimationFrame(this.requestId);\n // eslint-disable-next-line max-len\n // https://stackoverflow.com/questions/23598471/how-do-i-clean-up-and-unload-a-webgl-canvas-context-from-gpu-after-use\n // https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context\n // We delete the context, only if the context has been intialized\n if (this._surface) {\n this._canvasRef.current\n ?.getContext(\"webgl2\")\n ?.getExtension(\"WEBGL_lose_context\")\n ?.loseContext();\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 this._canvas!.clear(CanvasKit.TRANSPARENT);\n this.renderInCanvas(this._canvas!, []);\n this._surface?.ref.flush();\n return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Override to render\n */\n protected abstract renderInCanvas(\n canvas: SkCanvas,\n touches: TouchInfo[]\n ): void;\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private tick() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (this._canvas) {\n const touches = [...this._touches];\n this._touches = [];\n const canvas = this._canvas!;\n canvas.clear(Float32Array.of(0, 0, 0, 0));\n canvas.save();\n canvas.scale(pd, pd);\n this.renderInCanvas(canvas, touches);\n canvas.restore();\n this._surface?.ref.flush();\n }\n }\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n\n public redraw() {\n this._redrawRequests++;\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 this._mode = mode;\n this.tick();\n }\n\n private handleTouchEvent(evt: PointerEvent, touchType: TouchType) {\n this._touches.push({\n id: evt.pointerId,\n x: evt.clientX - evt.currentTarget.getClientRects()[0].left,\n y: evt.clientY - evt.currentTarget.getClientRects()[0].top,\n force: evt.pressure,\n type: touchType,\n timestamp: Date.now(),\n });\n this.redraw();\n }\n\n createTouchHandler(touchType: TouchType) {\n return (evt: PointerEvent) => this.handleTouchEvent(evt, touchType);\n }\n\n private onStart = this.createTouchHandler(TouchType.Start);\n private onActive = this.createTouchHandler(TouchType.Active);\n private onCancel = this.createTouchHandler(TouchType.Cancelled);\n private onEnd = this.createTouchHandler(TouchType.End);\n private onLayout = this.onLayoutEvent.bind(this);\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <Platform.View {...viewProps} onLayout={this.onLayout}>\n <canvas\n ref={this._canvasRef}\n style={{ display: \"flex\", flex: 1 }}\n onPointerDown={this.onStart}\n onPointerMove={this.onActive}\n onPointerUp={this.onEnd}\n onPointerCancel={this.onCancel}\n onPointerLeave={this.onEnd}\n onPointerOut={this.onEnd}\n />\n </Platform.View>\n );\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAGA,IAAAG,MAAA,GAAAH,OAAA;AAAoC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,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A,CAAA0H,aAAA;MACEnC,GAAG,EAAE,IAAI,CAACjC,UAAW;MACrBsE,KAAK,EAAE;QAAEC,OAAO,EAAE,MAAM;QAAEC,IAAI,EAAE;MAAE,CAAE;MACpCC,aAAa,EAAE,IAAI,CAACC,OAAQ;MAC5BC,aAAa,EAAE,IAAI,CAACC,QAAS;MAC7BC,WAAW,EAAE,IAAI,CAACC,KAAM;MACxBC,eAAe,EAAE,IAAI,CAACC,QAAS;MAC/BC,cAAc,EAAE,IAAI,CAACH,KAAM;MAC3BI,YAAY,EAAE,IAAI,CAACJ;IAAM,CAC1B,CACY,CAAC;EAEpB;AACF;AAACK,OAAA,CAAA3G,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_JsiSkSurface","_Platform","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","pd","Platform","PixelRatio","SkiaBaseWebView","React","Component","constructor","props","_props$mode","createRef","onLayoutEvent","_mode","mode","unsubscribeAll","_unsubscriptions","forEach","u","evt","CanvasKit","global","canvas","_canvasRef","current","width","clientWidth","height","clientHeight","surface","MakeWebGLCanvasSurface","Error","_surface","JsiSkSurface","_canvas","getCanvas","redraw","onLayout","getSize","componentDidMount","tick","componentDidUpdate","componentWillUnmount","cancelAnimationFrame","requestId","_this$_canvasRef$curr","getContext","getExtension","loseContext","makeImageSnapshot","rect","_this$_surface","_this$_surface2","clear","TRANSPARENT","renderInCanvas","ref","flush","_redrawRequests","_this$_surface3","Float32Array","of","save","scale","restore","requestAnimationFrame","setDrawMode","render","debug","viewProps","createElement","View","style","display","flex","exports"],"sources":["SkiaBaseWebView.tsx"],"sourcesContent":["/* global HTMLCanvasElement */\nimport React from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nimport type { SkRect, SkCanvas } from \"../skia/types\";\nimport { JsiSkSurface } from \"../skia/web/JsiSkSurface\";\nimport { Platform } from \"../Platform\";\n\nimport type { DrawMode, SkiaBaseViewProps } from \"./types\";\n\nconst pd = Platform.PixelRatio;\n\nexport abstract class SkiaBaseWebView<\n TProps extends SkiaBaseViewProps\n> extends React.Component<TProps> {\n constructor(props: TProps) {\n super(props);\n this._mode = props.mode ?? \"default\";\n }\n\n private _surface: JsiSkSurface | null = null;\n private _unsubscriptions: Array<() => void> = [];\n private _canvas: SkCanvas | null = null;\n private _canvasRef = React.createRef<HTMLCanvasElement>();\n private _mode: DrawMode;\n private _redrawRequests = 0;\n private requestId = 0;\n\n protected width = 0;\n protected height = 0;\n\n private unsubscribeAll() {\n this._unsubscriptions.forEach((u) => u());\n this._unsubscriptions = [];\n }\n\n private onLayoutEvent(evt: LayoutChangeEvent) {\n const { CanvasKit } = global;\n // Reset canvas / surface on layout change\n const canvas = this._canvasRef.current;\n if (canvas) {\n this.width = canvas.clientWidth;\n this.height = canvas.clientHeight;\n canvas.width = this.width * pd;\n canvas.height = this.height * pd;\n const surface = CanvasKit.MakeWebGLCanvasSurface(canvas);\n if (!surface) {\n throw new Error(\"Could not create surface\");\n }\n this._surface = new JsiSkSurface(CanvasKit, surface);\n this._canvas = this._surface.getCanvas();\n this.redraw();\n }\n // Call onLayout callback if it exists\n if (this.props.onLayout) {\n this.props.onLayout(evt);\n }\n }\n\n protected getSize() {\n return { width: this.width, height: this.height };\n }\n\n componentDidMount() {\n // Start render loop\n this.tick();\n }\n\n componentDidUpdate() {\n this.redraw();\n }\n\n componentWillUnmount() {\n this.unsubscribeAll();\n cancelAnimationFrame(this.requestId);\n // eslint-disable-next-line max-len\n // https://stackoverflow.com/questions/23598471/how-do-i-clean-up-and-unload-a-webgl-canvas-context-from-gpu-after-use\n // https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context\n // We delete the context, only if the context has been intialized\n if (this._surface) {\n this._canvasRef.current\n ?.getContext(\"webgl2\")\n ?.getExtension(\"WEBGL_lose_context\")\n ?.loseContext();\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 this._canvas!.clear(CanvasKit.TRANSPARENT);\n this.renderInCanvas(this._canvas!);\n this._surface?.ref.flush();\n return this._surface?.makeImageSnapshot(rect);\n }\n\n /**\n * Override to render\n */\n protected abstract renderInCanvas(canvas: SkCanvas): void;\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n private tick() {\n if (this._mode === \"continuous\" || this._redrawRequests > 0) {\n this._redrawRequests = 0;\n if (this._canvas) {\n const canvas = this._canvas!;\n canvas.clear(Float32Array.of(0, 0, 0, 0));\n canvas.save();\n canvas.scale(pd, pd);\n this.renderInCanvas(canvas);\n canvas.restore();\n this._surface?.ref.flush();\n }\n }\n this.requestId = requestAnimationFrame(this.tick.bind(this));\n }\n\n public redraw() {\n this._redrawRequests++;\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 this._mode = mode;\n this.tick();\n }\n\n private onLayout = this.onLayoutEvent.bind(this);\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <Platform.View {...viewProps} onLayout={this.onLayout}>\n <canvas ref={this._canvasRef} style={{ display: \"flex\", flex: 1 }} />\n </Platform.View>\n );\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAuC,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,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GAAGC,IAAI;IACjB,IAAI,CAAC0B,IAAI,CAAC,CAAC;EACb;EAIA2B,MAAMA,CAAA,EAAG;IACP,MAAM;MAAErD,IAAI;MAAEsD,KAAK,GAAG,KAAK;MAAE,GAAGC;IAAU,CAAC,GAAG,IAAI,CAAC5D,KAAK;IACxD,oBACEzC,MAAA,CAAAO,OAAA,CAAA+F,aAAA,CAAClG,SAAA,CAAA+B,QAAQ,CAACoE,IAAI,EAAA/F,QAAA,KAAK6F,SAAS;MAAEhC,QAAQ,EAAE,IAAI,CAACA;IAAS,iBACpDrE,MAAA,CAAAO,OAAA,CAAA+F,aAAA;MAAQd,GAAG,EAAE,IAAI,CAACjC,UAAW;MAACiD,KAAK,EAAE;QAAEC,OAAO,EAAE,MAAM;QAAEC,IAAI,EAAE;MAAE;IAAE,CAAE,CACvD,CAAC;EAEpB;AACF;AAACC,OAAA,CAAAtE,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -24,19 +24,12 @@ class SkiaDomView extends _react.default.Component {
24
24
  this._nativeId = _SkiaViewNativeId.SkiaViewNativeId.current++;
25
25
  const {
26
26
  root,
27
- onTouch,
28
27
  onSize
29
28
  } = props;
30
29
  if (root) {
31
30
  assertSkiaViewApi();
32
31
  _api.SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
33
32
  }
34
- if (onTouch) {
35
- assertSkiaViewApi();
36
- console.warn(`The onTouch property is deprecated and will be removed in the next Skia release.
37
- See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
38
- _api.SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
39
- }
40
33
  if (onSize) {
41
34
  assertSkiaViewApi();
42
35
  _api.SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
@@ -48,17 +41,12 @@ See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
48
41
  componentDidUpdate(prevProps) {
49
42
  const {
50
43
  root,
51
- onTouch,
52
44
  onSize
53
45
  } = this.props;
54
46
  if (root !== prevProps.root) {
55
47
  assertSkiaViewApi();
56
48
  _api.SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
57
49
  }
58
- if (onTouch !== prevProps.onTouch) {
59
- assertSkiaViewApi();
60
- _api.SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
61
- }
62
50
  if (onSize !== prevProps.onSize) {
63
51
  assertSkiaViewApi();
64
52
  _api.SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_Platform","_SkiaDomViewNativeComponent","_api","_SkiaViewNativeId","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","NativeSkiaDomView","Platform","OS","SkiaDomViewNativeComponent","SkiaDomView","React","Component","constructor","props","_nativeId","SkiaViewNativeId","current","root","onTouch","onSize","assertSkiaViewApi","SkiaViewApi","setJsiProperty","console","warn","nativeId","componentDidUpdate","prevProps","makeImageSnapshot","rect","makeImageSnapshotAsync","redraw","requestRedraw","render","mode","debug","viewProps","createElement","collapsable","nativeID","exports","Error"],"sources":["SkiaDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaDomViewNativeComponent from \"../specs/SkiaDomViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaDomViewProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaDomView: HostComponent<SkiaDomViewProps> =\n Platform.OS !== \"web\"\n ? SkiaDomViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\nexport class SkiaDomView extends React.Component<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onTouch, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onTouch) {\n assertSkiaViewApi();\n console.warn(\n `The onTouch property is deprecated and will be removed in the next Skia release.\nSee: https://shopify.github.io/react-native-skia/docs/animations/gestures`\n );\n SkiaViewApi.setJsiProperty(this._nativeId, \"onTouch\", onTouch);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps) {\n const { root, onTouch, onSize } = this.props;\n if (root !== prevProps.root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onTouch !== prevProps.onTouch) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onTouch\", onTouch);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\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 assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\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 makeImageSnapshotAsync(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshotAsync(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaDomView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,IAAA,GAAAH,OAAA;AAEA,IAAAI,iBAAA,GAAAJ,OAAA;AAAsD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAAA,SAAAO,gBAAAf,CAAA,EAAAW,CAAA,EAAAD,CAAA,YAAAC,CAAA,GAAAK,cAAA,CAAAL,CAAA,MAAAX,CAAA,GAAAI,MAAA,CAAAa,cAAA,CAAAjB,CAAA,EAAAW,CAAA,IAAAO,KAAA,EAAAR,CAAA,EAAAS,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAArB,CAAA,CAAAW,CAAA,IAAAD,CAAA,EAAAV,CAAA;AAAA,SAAAgB,eAAAN,CAAA,QAAAY,CAAA,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AE,GAAGC;IAAU,CAAC,GAAG,IAAI,CAACvB,KAAK;IACxD,oBACE5C,MAAA,CAAAS,OAAA,CAAA2D,aAAA,CAAChC,iBAAiB,EAAA1B,QAAA;MAChB2D,WAAW,EAAE,KAAM;MACnBC,QAAQ,EAAE,GAAG,IAAI,CAACzB,SAAS,EAAG;MAC9BoB,IAAI,EAAEA,IAAK;MACXC,KAAK,EAAEA;IAAM,GACTC,SAAS,CACd,CAAC;EAEN;AACF;AAACI,OAAA,CAAA/B,WAAA,GAAAA,WAAA;AAED,MAAMW,iBAAiB,GAAGA,CAAA,KAAM;EAC9B,IACEC,gBAAW,KAAK,IAAI,IACpBA,gBAAW,CAACC,cAAc,KAAK,IAAI,IACnCD,gBAAW,CAACW,aAAa,KAAK,IAAI,IAClCX,gBAAW,CAACO,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMa,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_Platform","_SkiaDomViewNativeComponent","_api","_SkiaViewNativeId","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_defineProperty","_toPropertyKey","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","TypeError","String","Number","NativeSkiaDomView","Platform","OS","SkiaDomViewNativeComponent","SkiaDomView","React","Component","constructor","props","_nativeId","SkiaViewNativeId","current","root","onSize","assertSkiaViewApi","SkiaViewApi","setJsiProperty","nativeId","componentDidUpdate","prevProps","makeImageSnapshot","rect","makeImageSnapshotAsync","redraw","requestRedraw","render","mode","debug","viewProps","createElement","collapsable","nativeID","exports","Error"],"sources":["SkiaDomView.tsx"],"sourcesContent":["import React from \"react\";\nimport type { HostComponent } from \"react-native\";\n\nimport type { SkRect } from \"../skia/types\";\nimport { Platform } from \"../Platform\";\nimport SkiaDomViewNativeComponent from \"../specs/SkiaDomViewNativeComponent\";\n\nimport { SkiaViewApi } from \"./api\";\nimport type { SkiaDomViewProps } from \"./types\";\nimport { SkiaViewNativeId } from \"./SkiaViewNativeId\";\n\nconst NativeSkiaDomView: HostComponent<SkiaDomViewProps> =\n Platform.OS !== \"web\"\n ? SkiaDomViewNativeComponent\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (null as any);\n\nexport class SkiaDomView extends React.Component<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n this._nativeId = SkiaViewNativeId.current++;\n const { root, onSize } = props;\n if (root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\n }\n }\n\n private _nativeId: number;\n\n public get nativeId() {\n return this._nativeId;\n }\n\n componentDidUpdate(prevProps: SkiaDomViewProps) {\n const { root, onSize } = this.props;\n if (root !== prevProps.root) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"root\", root);\n }\n if (onSize !== prevProps.onSize) {\n assertSkiaViewApi();\n SkiaViewApi.setJsiProperty(this._nativeId, \"onSize\", onSize);\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 assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshot(this._nativeId, rect);\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 makeImageSnapshotAsync(rect?: SkRect) {\n assertSkiaViewApi();\n return SkiaViewApi.makeImageSnapshotAsync(this._nativeId, rect);\n }\n\n /**\n * Sends a redraw request to the native SkiaView.\n */\n public redraw() {\n assertSkiaViewApi();\n SkiaViewApi.requestRedraw(this._nativeId);\n }\n\n render() {\n const { mode, debug = false, ...viewProps } = this.props;\n return (\n <NativeSkiaDomView\n collapsable={false}\n nativeID={`${this._nativeId}`}\n mode={mode}\n debug={debug}\n {...viewProps}\n />\n );\n }\n}\n\nconst assertSkiaViewApi = () => {\n if (\n SkiaViewApi === null ||\n SkiaViewApi.setJsiProperty === null ||\n SkiaViewApi.requestRedraw === null ||\n SkiaViewApi.makeImageSnapshot === null\n ) {\n throw Error(\"Skia View Api was not found.\");\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,IAAA,GAAAH,OAAA;AAEA,IAAAI,iBAAA,GAAAJ,OAAA;AAAsD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAAA,SAAAO,gBAAAf,CAAA,EAAAW,CAAA,EAAAD,CAAA,YAAAC,CAAA,GAAAK,cAAA,CAAAL,CAAA,MAAAX,CAAA,GAAAI,MAAA,CAAAa,cAAA,CAAAjB,CAAA,EAAAW,CAAA,IAAAO,KAAA,EAAAR,CAAA,EAAAS,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAArB,CAAA,CAAAW,CAAA,IAAAD,CAAA,EAAAV,CAAA;AAAA,SAA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AAiB,GAAGA,CAAA,KAAM;EAC9B,IACEC,gBAAW,KAAK,IAAI,IACpBA,gBAAW,CAACC,cAAc,KAAK,IAAI,IACnCD,gBAAW,CAACS,aAAa,KAAK,IAAI,IAClCT,gBAAW,CAACK,iBAAiB,KAAK,IAAI,EACtC;IACA,MAAMa,KAAK,CAAC,8BAA8B,CAAC;EAC7C;AACF,CAAC","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import type { SkCanvas } from "../skia/types";
2
2
  import { SkiaBaseWebView } from "./SkiaBaseWebView";
3
- import type { SkiaDomViewProps, TouchInfo } from "./types";
3
+ import type { SkiaDomViewProps } from "./types";
4
4
  export declare class SkiaDomView extends SkiaBaseWebView<SkiaDomViewProps> {
5
5
  constructor(props: SkiaDomViewProps);
6
- protected renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void;
6
+ protected renderInCanvas(canvas: SkCanvas): void;
7
7
  }
@@ -11,12 +11,7 @@ class SkiaDomView extends _SkiaBaseWebView.SkiaBaseWebView {
11
11
  constructor(props) {
12
12
  super(props);
13
13
  }
14
- renderInCanvas(canvas, touches) {
15
- if (this.props.onTouch) {
16
- console.warn(`The onTouch property is deprecated and will be removed in the next Skia release.
17
- See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
18
- this.props.onTouch([touches]);
19
- }
14
+ renderInCanvas(canvas) {
20
15
  if (this.props.onSize) {
21
16
  const {
22
17
  width,
@@ -1 +1 @@
1
- {"version":3,"names":["_skia","require","_DrawingContext","_SkiaBaseWebView","SkiaDomView","SkiaBaseWebView","constructor","props","renderInCanvas","canvas","touches","onTouch","console","warn","onSize","width","height","getSize","value","root","ctx","JsiDrawingContext","Skia","render","exports"],"sources":["SkiaDomView.web.tsx"],"sourcesContent":["import { Skia } from \"../skia\";\nimport type { SkCanvas } from \"../skia/types\";\nimport { JsiDrawingContext } from \"../dom/types/DrawingContext\";\n\nimport { SkiaBaseWebView } from \"./SkiaBaseWebView\";\nimport type { SkiaDomViewProps, TouchInfo } from \"./types\";\n\nexport class SkiaDomView extends SkiaBaseWebView<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n }\n\n protected renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void {\n if (this.props.onTouch) {\n console.warn(\n `The onTouch property is deprecated and will be removed in the next Skia release.\nSee: https://shopify.github.io/react-native-skia/docs/animations/gestures`\n );\n this.props.onTouch([touches]);\n }\n if (this.props.onSize) {\n const { width, height } = this.getSize();\n this.props.onSize.value = { width, height };\n }\n if (this.props.root) {\n const ctx = new JsiDrawingContext(Skia, canvas);\n this.props.root.render(ctx);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAGO,MAAMG,WAAW,SAASC,gCAAe,CAAmB;EACjEC,WAAWA,CAACC,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,CAAC;EACd;EAEUC,cAAcA,CAACC,MAAgB,EAAEC,OAAoB,EAAQ;IACrE,IAAI,IAAI,CAACH,KAAK,CAACI,OAAO,EAAE;MACtBC,OAAO,CAACC,IAAI,CACV;AACR,0EACM,CAAC;MACD,IAAI,CAACN,KAAK,CAACI,OAAO,CAAC,CAACD,OAAO,CAAC,CAAC;IAC/B;IACA,IAAI,IAAI,CAACH,KAAK,CAACO,MAAM,EAAE;MACrB,MAAM;QAAEC,KAAK;QAAEC;MAAO,CAAC,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC;MACxC,IAAI,CAACV,KAAK,CAACO,MAAM,CAACI,KAAK,GAAG;QAAEH,KAAK;QAAEC;MAAO,CAAC;IAC7C;IACA,IAAI,IAAI,CAACT,KAAK,CAACY,IAAI,EAAE;MACnB,MAAMC,GAAG,GAAG,IAAIC,iCAAiB,CAACC,UAAI,EAAEb,MAAM,CAAC;MAC/C,IAAI,CAACF,KAAK,CAACY,IAAI,CAACI,MAAM,CAACH,GAAG,CAAC;IAC7B;EACF;AACF;AAACI,OAAA,CAAApB,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"names":["_skia","require","_DrawingContext","_SkiaBaseWebView","SkiaDomView","SkiaBaseWebView","constructor","props","renderInCanvas","canvas","onSize","width","height","getSize","value","root","ctx","JsiDrawingContext","Skia","render","exports"],"sources":["SkiaDomView.web.tsx"],"sourcesContent":["import { Skia } from \"../skia\";\nimport type { SkCanvas } from \"../skia/types\";\nimport { JsiDrawingContext } from \"../dom/types/DrawingContext\";\n\nimport { SkiaBaseWebView } from \"./SkiaBaseWebView\";\nimport type { SkiaDomViewProps } from \"./types\";\n\nexport class SkiaDomView extends SkiaBaseWebView<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n }\n\n protected renderInCanvas(canvas: SkCanvas): void {\n if (this.props.onSize) {\n const { width, height } = this.getSize();\n this.props.onSize.value = { width, height };\n }\n if (this.props.root) {\n const ctx = new JsiDrawingContext(Skia, canvas);\n this.props.root.render(ctx);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AAGO,MAAMG,WAAW,SAASC,gCAAe,CAAmB;EACjEC,WAAWA,CAACC,KAAuB,EAAE;IACnC,KAAK,CAACA,KAAK,CAAC;EACd;EAEUC,cAAcA,CAACC,MAAgB,EAAQ;IAC/C,IAAI,IAAI,CAACF,KAAK,CAACG,MAAM,EAAE;MACrB,MAAM;QAAEC,KAAK;QAAEC;MAAO,CAAC,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC;MACxC,IAAI,CAACN,KAAK,CAACG,MAAM,CAACI,KAAK,GAAG;QAAEH,KAAK;QAAEC;MAAO,CAAC;IAC7C;IACA,IAAI,IAAI,CAACL,KAAK,CAACQ,IAAI,EAAE;MACnB,MAAMC,GAAG,GAAG,IAAIC,iCAAiB,CAACC,UAAI,EAAET,MAAM,CAAC;MAC/C,IAAI,CAACF,KAAK,CAACQ,IAAI,CAACI,MAAM,CAACH,GAAG,CAAC;IAC7B;EACF;AACF;AAACI,OAAA,CAAAhB,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -25,19 +25,12 @@ class SkiaJSDomView extends _react.default.Component {
25
25
  this._nativeId = _SkiaViewNativeId.SkiaViewNativeId.current++;
26
26
  const {
27
27
  root,
28
- onTouch,
29
28
  onSize
30
29
  } = props;
31
30
  if (root) {
32
31
  assertSkiaViewApi();
33
32
  _api.SkiaViewApi.setJsiProperty(this._nativeId, "root", root);
34
33
  }
35
- if (onTouch) {
36
- assertSkiaViewApi();
37
- console.warn(`The onTouch property is deprecated and will be removed in the next Skia release.
38
- See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
39
- _api.SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
40
- }
41
34
  if (onSize) {
42
35
  assertSkiaViewApi();
43
36
  _api.SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
@@ -49,17 +42,12 @@ See: https://shopify.github.io/react-native-skia/docs/animations/gestures`);
49
42
  componentDidUpdate(prevProps) {
50
43
  const {
51
44
  root,
52
- onTouch,
53
45
  onSize
54
46
  } = this.props;
55
47
  if (root !== prevProps.root && root !== undefined) {
56
48
  assertSkiaViewApi();
57
49
  this.draw();
58
50
  }
59
- if (onTouch !== prevProps.onTouch) {
60
- assertSkiaViewApi();
61
- _api.SkiaViewApi.setJsiProperty(this._nativeId, "onTouch", onTouch);
62
- }
63
51
  if (onSize !== prevProps.onSize) {
64
52
  assertSkiaViewApi();
65
53
  _api.SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);