@shopify/react-native-skia 2.6.9 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/android/cpp/jni/include/JniSkiaBaseView.h +6 -4
  2. package/android/cpp/jni/include/JniSkiaPictureView.h +8 -6
  3. package/android/cpp/rnskia-android/OpenGLContext.h +10 -1
  4. package/android/cpp/rnskia-android/RNSkAndroidView.h +8 -8
  5. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +9 -5
  6. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +4 -2
  7. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +48 -12
  8. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +5 -0
  9. package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureView.java +2 -2
  10. package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +11 -7
  11. package/apple/MetalContext.h +7 -6
  12. package/apple/MetalLayerColorSpace.mm +39 -0
  13. package/apple/MetalLayerColorSpaceUtils.h +34 -0
  14. package/apple/MetalWindowContext.h +3 -1
  15. package/apple/MetalWindowContext.mm +9 -8
  16. package/apple/RNSkAppleView.h +6 -0
  17. package/apple/RNSkMetalCanvasProvider.h +2 -0
  18. package/apple/RNSkMetalCanvasProvider.mm +15 -2
  19. package/apple/SkiaPictureView.mm +1 -0
  20. package/apple/SkiaPictureViewManager.mm +5 -0
  21. package/apple/SkiaUIView.h +1 -0
  22. package/apple/SkiaUIView.mm +9 -0
  23. package/cpp/api/JsiSkParagraph.h +114 -0
  24. package/cpp/api/JsiSkSurface.h +8 -2
  25. package/cpp/rnskia/RNDawnContext.h +4 -3
  26. package/cpp/rnskia/RNDawnUtils.h +25 -6
  27. package/cpp/rnskia/RNDawnWindowContext.h +44 -10
  28. package/cpp/rnskia/RNMetalLayerColorSpace.h +16 -0
  29. package/cpp/rnskia/RNSkJsiViewApi.h +46 -24
  30. package/cpp/rnwgpu/SurfaceRegistry.h +10 -4
  31. package/lib/commonjs/Platform/Platform.web.js +2 -90
  32. package/lib/commonjs/Platform/Platform.web.js.map +1 -1
  33. package/lib/commonjs/external/reanimated/useVideoLoading.js +11 -2
  34. package/lib/commonjs/external/reanimated/useVideoLoading.js.map +1 -1
  35. package/lib/commonjs/mock/index.js +1 -0
  36. package/lib/commonjs/mock/index.js.map +1 -1
  37. package/lib/commonjs/renderer/Canvas.d.ts +10 -1
  38. package/lib/commonjs/renderer/Canvas.js +2 -0
  39. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  40. package/lib/commonjs/skia/core/SVG.web.js +4 -5
  41. package/lib/commonjs/skia/core/SVG.web.js.map +1 -1
  42. package/lib/commonjs/skia/types/Paragraph/Paragraph.d.ts +62 -0
  43. package/lib/commonjs/skia/types/Paragraph/Paragraph.js.map +1 -1
  44. package/lib/commonjs/skia/types/Surface/Surface.d.ts +5 -1
  45. package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
  46. package/lib/commonjs/skia/web/Host.js +7 -0
  47. package/lib/commonjs/skia/web/Host.js.map +1 -1
  48. package/lib/commonjs/skia/web/JsiSkPaint.js +5 -0
  49. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  50. package/lib/commonjs/skia/web/JsiSkParagraph.d.ts +3 -1
  51. package/lib/commonjs/skia/web/JsiSkParagraph.js +6 -0
  52. package/lib/commonjs/skia/web/JsiSkParagraph.js.map +1 -1
  53. package/lib/commonjs/skia/web/JsiSkParagraphStyle.js +14 -3
  54. package/lib/commonjs/skia/web/JsiSkParagraphStyle.js.map +1 -1
  55. package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -1
  56. package/lib/commonjs/skia/web/JsiSkSurface.js +2 -1
  57. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  58. package/lib/commonjs/sksg/Container.native.d.ts +1 -0
  59. package/lib/commonjs/sksg/Container.native.js +11 -0
  60. package/lib/commonjs/sksg/Container.native.js.map +1 -1
  61. package/lib/commonjs/sksg/Container.web.d.ts +1 -0
  62. package/lib/commonjs/sksg/Container.web.js +45 -3
  63. package/lib/commonjs/sksg/Container.web.js.map +1 -1
  64. package/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +2 -0
  65. package/lib/commonjs/sksg/Recorder/DrawingContext.js +22 -6
  66. package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -1
  67. package/lib/commonjs/sksg/Recorder/FrameScope.d.ts +18 -0
  68. package/lib/commonjs/sksg/Recorder/FrameScope.js +66 -0
  69. package/lib/commonjs/sksg/Recorder/FrameScope.js.map +1 -0
  70. package/lib/commonjs/sksg/Recorder/FrameScope.native.d.ts +10 -0
  71. package/lib/commonjs/sksg/Recorder/FrameScope.native.js +26 -0
  72. package/lib/commonjs/sksg/Recorder/FrameScope.native.js.map +1 -0
  73. package/lib/commonjs/sksg/Recorder/Player.js +1 -2
  74. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  75. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +3 -1
  76. package/lib/commonjs/sksg/Recorder/Recorder.js +12 -1
  77. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
  78. package/lib/commonjs/sksg/Recorder/commands/Drawing.js +3 -3
  79. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
  80. package/lib/commonjs/sksg/Recorder/commands/Shaders.js +3 -3
  81. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -1
  82. package/lib/commonjs/sksg/StaticContainer.d.ts +1 -0
  83. package/lib/commonjs/sksg/StaticContainer.js +27 -1
  84. package/lib/commonjs/sksg/StaticContainer.js.map +1 -1
  85. package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +2 -0
  86. package/lib/commonjs/specs/NativeSkiaModule.web.js +32 -7
  87. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  88. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
  89. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  90. package/lib/commonjs/views/SkiaPictureView.js +2 -0
  91. package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
  92. package/lib/commonjs/views/SkiaPictureView.web.js +279 -94
  93. package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
  94. package/lib/commonjs/views/formats.d.ts +1 -0
  95. package/lib/commonjs/views/formats.js +28 -0
  96. package/lib/commonjs/views/formats.js.map +1 -0
  97. package/lib/commonjs/views/index.d.ts +1 -0
  98. package/lib/commonjs/views/index.js +11 -0
  99. package/lib/commonjs/views/index.js.map +1 -1
  100. package/lib/commonjs/views/types.d.ts +6 -0
  101. package/lib/commonjs/views/types.js.map +1 -1
  102. package/lib/module/Platform/Platform.web.js +3 -91
  103. package/lib/module/Platform/Platform.web.js.map +1 -1
  104. package/lib/module/external/reanimated/useVideoLoading.js +12 -2
  105. package/lib/module/external/reanimated/useVideoLoading.js.map +1 -1
  106. package/lib/module/mock/index.js +1 -0
  107. package/lib/module/mock/index.js.map +1 -1
  108. package/lib/module/renderer/Canvas.d.ts +10 -1
  109. package/lib/module/renderer/Canvas.js +2 -0
  110. package/lib/module/renderer/Canvas.js.map +1 -1
  111. package/lib/module/skia/core/SVG.web.js +4 -5
  112. package/lib/module/skia/core/SVG.web.js.map +1 -1
  113. package/lib/module/skia/types/Paragraph/Paragraph.d.ts +62 -0
  114. package/lib/module/skia/types/Paragraph/Paragraph.js.map +1 -1
  115. package/lib/module/skia/types/Surface/Surface.d.ts +5 -1
  116. package/lib/module/skia/types/Surface/Surface.js.map +1 -1
  117. package/lib/module/skia/web/Host.js +7 -0
  118. package/lib/module/skia/web/Host.js.map +1 -1
  119. package/lib/module/skia/web/JsiSkPaint.js +5 -0
  120. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  121. package/lib/module/skia/web/JsiSkParagraph.d.ts +3 -1
  122. package/lib/module/skia/web/JsiSkParagraph.js +7 -1
  123. package/lib/module/skia/web/JsiSkParagraph.js.map +1 -1
  124. package/lib/module/skia/web/JsiSkParagraphStyle.js +14 -3
  125. package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
  126. package/lib/module/skia/web/JsiSkSurface.d.ts +1 -1
  127. package/lib/module/skia/web/JsiSkSurface.js +2 -1
  128. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  129. package/lib/module/sksg/Container.native.d.ts +1 -0
  130. package/lib/module/sksg/Container.native.js +11 -0
  131. package/lib/module/sksg/Container.native.js.map +1 -1
  132. package/lib/module/sksg/Container.web.d.ts +1 -0
  133. package/lib/module/sksg/Container.web.js +46 -4
  134. package/lib/module/sksg/Container.web.js.map +1 -1
  135. package/lib/module/sksg/Recorder/DrawingContext.d.ts +2 -0
  136. package/lib/module/sksg/Recorder/DrawingContext.js +22 -6
  137. package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -1
  138. package/lib/module/sksg/Recorder/FrameScope.d.ts +18 -0
  139. package/lib/module/sksg/Recorder/FrameScope.js +59 -0
  140. package/lib/module/sksg/Recorder/FrameScope.js.map +1 -0
  141. package/lib/module/sksg/Recorder/FrameScope.native.d.ts +10 -0
  142. package/lib/module/sksg/Recorder/FrameScope.native.js +19 -0
  143. package/lib/module/sksg/Recorder/FrameScope.native.js.map +1 -0
  144. package/lib/module/sksg/Recorder/Player.js +1 -2
  145. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  146. package/lib/module/sksg/Recorder/Recorder.d.ts +3 -1
  147. package/lib/module/sksg/Recorder/Recorder.js +10 -0
  148. package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
  149. package/lib/module/sksg/Recorder/commands/Drawing.js +3 -3
  150. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
  151. package/lib/module/sksg/Recorder/commands/Shaders.js +3 -3
  152. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
  153. package/lib/module/sksg/StaticContainer.d.ts +1 -0
  154. package/lib/module/sksg/StaticContainer.js +28 -2
  155. package/lib/module/sksg/StaticContainer.js.map +1 -1
  156. package/lib/module/specs/NativeSkiaModule.web.d.ts +2 -0
  157. package/lib/module/specs/NativeSkiaModule.web.js +32 -7
  158. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  159. package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
  160. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  161. package/lib/module/views/SkiaPictureView.js +2 -0
  162. package/lib/module/views/SkiaPictureView.js.map +1 -1
  163. package/lib/module/views/SkiaPictureView.web.js +280 -95
  164. package/lib/module/views/SkiaPictureView.web.js.map +1 -1
  165. package/lib/module/views/formats.d.ts +1 -0
  166. package/lib/module/views/formats.js +22 -0
  167. package/lib/module/views/formats.js.map +1 -0
  168. package/lib/module/views/index.d.ts +1 -0
  169. package/lib/module/views/index.js +1 -0
  170. package/lib/module/views/index.js.map +1 -1
  171. package/lib/module/views/types.d.ts +6 -0
  172. package/lib/module/views/types.js.map +1 -1
  173. package/lib/typescript/lib/commonjs/Platform/Platform.web.d.ts +1 -2
  174. package/lib/typescript/lib/commonjs/mock/index.d.ts +1 -0
  175. package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -1
  176. package/lib/typescript/lib/commonjs/skia/web/JsiSkParagraph.d.ts +2 -0
  177. package/lib/typescript/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -1
  178. package/lib/typescript/lib/commonjs/sksg/Container.native.d.ts +1 -1
  179. package/lib/typescript/lib/commonjs/sksg/Container.web.d.ts +3 -3
  180. package/lib/typescript/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +2 -0
  181. package/lib/typescript/lib/commonjs/sksg/Recorder/FrameScope.d.ts +17 -0
  182. package/lib/typescript/lib/commonjs/sksg/Recorder/FrameScope.native.d.ts +13 -0
  183. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +1 -0
  184. package/lib/typescript/lib/commonjs/sksg/StaticContainer.d.ts +2 -2
  185. package/lib/typescript/lib/commonjs/views/formats.d.ts +2 -0
  186. package/lib/typescript/lib/module/Platform/Platform.web.d.ts +1 -3
  187. package/lib/typescript/lib/module/mock/index.d.ts +2 -2
  188. package/lib/typescript/lib/module/renderer/Canvas.d.ts +2 -1
  189. package/lib/typescript/lib/module/skia/web/JsiSkParagraph.d.ts +2 -0
  190. package/lib/typescript/lib/module/skia/web/JsiSkSurface.d.ts +1 -1
  191. package/lib/typescript/lib/module/sksg/Container.native.d.ts +1 -1
  192. package/lib/typescript/lib/module/sksg/Container.web.d.ts +3 -3
  193. package/lib/typescript/lib/module/sksg/Recorder/DrawingContext.d.ts +2 -0
  194. package/lib/typescript/lib/module/sksg/Recorder/FrameScope.d.ts +5 -0
  195. package/lib/typescript/lib/module/sksg/Recorder/FrameScope.native.d.ts +5 -0
  196. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +1 -0
  197. package/lib/typescript/lib/module/sksg/StaticContainer.d.ts +2 -2
  198. package/lib/typescript/lib/module/views/formats.d.ts +1 -0
  199. package/lib/typescript/lib/module/views/index.d.ts +1 -0
  200. package/lib/typescript/src/renderer/Canvas.d.ts +10 -1
  201. package/lib/typescript/src/skia/types/Paragraph/Paragraph.d.ts +62 -0
  202. package/lib/typescript/src/skia/types/Surface/Surface.d.ts +5 -1
  203. package/lib/typescript/src/skia/web/JsiSkParagraph.d.ts +3 -1
  204. package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -1
  205. package/lib/typescript/src/sksg/Container.native.d.ts +1 -0
  206. package/lib/typescript/src/sksg/Container.web.d.ts +1 -0
  207. package/lib/typescript/src/sksg/Recorder/DrawingContext.d.ts +2 -0
  208. package/lib/typescript/src/sksg/Recorder/FrameScope.d.ts +18 -0
  209. package/lib/typescript/src/sksg/Recorder/FrameScope.native.d.ts +10 -0
  210. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +3 -1
  211. package/lib/typescript/src/sksg/StaticContainer.d.ts +1 -0
  212. package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +2 -0
  213. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
  214. package/lib/typescript/src/views/formats.d.ts +1 -0
  215. package/lib/typescript/src/views/index.d.ts +1 -0
  216. package/lib/typescript/src/views/types.d.ts +6 -0
  217. package/package.json +4 -1
  218. package/react-native-skia.podspec +1 -0
  219. package/src/Platform/Platform.web.tsx +7 -99
  220. package/src/external/reanimated/useVideoLoading.ts +12 -2
  221. package/src/mock/index.ts +1 -0
  222. package/src/renderer/Canvas.tsx +11 -0
  223. package/src/skia/core/SVG.web.ts +5 -14
  224. package/src/skia/types/Paragraph/Paragraph.ts +67 -0
  225. package/src/skia/types/Surface/Surface.ts +5 -1
  226. package/src/skia/web/Host.ts +7 -0
  227. package/src/skia/web/JsiSkPaint.ts +5 -0
  228. package/src/skia/web/JsiSkParagraph.ts +9 -1
  229. package/src/skia/web/JsiSkParagraphStyle.ts +16 -2
  230. package/src/skia/web/JsiSkSurface.ts +2 -1
  231. package/src/sksg/Container.native.ts +12 -0
  232. package/src/sksg/Container.web.ts +43 -4
  233. package/src/sksg/Recorder/DrawingContext.ts +19 -6
  234. package/src/sksg/Recorder/FrameScope.native.ts +21 -0
  235. package/src/sksg/Recorder/FrameScope.ts +69 -0
  236. package/src/sksg/Recorder/Player.ts +1 -2
  237. package/src/sksg/Recorder/Recorder.ts +15 -1
  238. package/src/sksg/Recorder/commands/Drawing.ts +3 -3
  239. package/src/sksg/Recorder/commands/Shaders.ts +22 -16
  240. package/src/sksg/StaticContainer.ts +29 -2
  241. package/src/specs/NativeSkiaModule.web.ts +39 -7
  242. package/src/specs/SkiaPictureViewNativeComponent.ts +1 -0
  243. package/src/views/SkiaPictureView.tsx +2 -0
  244. package/src/views/SkiaPictureView.web.tsx +318 -106
  245. package/src/views/formats.ts +21 -0
  246. package/src/views/index.ts +1 -0
  247. package/src/views/types.ts +7 -0
@@ -1,6 +1,10 @@
1
1
  import type { SkCanvas } from "../Canvas";
2
+ import type { SkFont } from "../Font";
2
3
  import type { SkJSIInstance } from "../JsiInstance";
4
+ import type { SkPath } from "../Path";
5
+ import type { SkPoint } from "../Point";
3
6
  import type { SkRect } from "../Rect";
7
+ import type { SkSize } from "../Size";
4
8
  import type { TextDirection } from "./ParagraphStyle";
5
9
  export interface LineMetrics {
6
10
  /** The index in the text buffer the line begins. */
@@ -36,6 +40,42 @@ export interface SkRectWithDirection {
36
40
  rect: SkRect;
37
41
  direction: TextDirection;
38
42
  }
43
+ /**
44
+ * Information about a run of glyphs passed to the visitor of
45
+ * `SkParagraph.extendedVisit`. All glyphs in a run share the same font: for
46
+ * text shaped through font fallback, each fallback font produces its own
47
+ * run(s).
48
+ */
49
+ export interface ParagraphVisitorInfo {
50
+ /** The font used to shape this run (the resolved fallback font, if any). */
51
+ font: SkFont;
52
+ /** Origin of the run within the paragraph (baseline corrected). */
53
+ origin: SkPoint;
54
+ /** Advance of the run. */
55
+ advance: SkSize;
56
+ /** The glyph ids of the run. */
57
+ glyphs: number[];
58
+ /**
59
+ * The position of each glyph, relative to the run `origin`. Add `origin`
60
+ * to obtain paragraph coordinates: for a run shaped through font fallback,
61
+ * the run placement is carried by `origin`, not by the positions.
62
+ */
63
+ positions: SkPoint[];
64
+ /**
65
+ * The tight ink bounds of each glyph, relative to the glyph's origin.
66
+ * Combine with `positions` to compute the exact painted bounds of the run.
67
+ */
68
+ bounds: SkRect[];
69
+ /** The UTF-8 text index of the cluster each glyph belongs to. */
70
+ utf8Starts: number[];
71
+ /** Reserved flags (currently always 0). */
72
+ flags: number;
73
+ }
74
+ /**
75
+ * Visitor for `SkParagraph.extendedVisit`. Called once per run of glyphs;
76
+ * `info` is null to signal the end of a line.
77
+ */
78
+ export type ParagraphExtendedVisitor = (lineNumber: number, info: ParagraphVisitorInfo | null) => void;
39
79
  export interface SkParagraph extends SkJSIInstance<"Paragraph"> {
40
80
  /**
41
81
  * Calculates the position of the the glyphs in the paragraph
@@ -106,4 +146,26 @@ export interface SkParagraph extends SkJSIInstance<"Paragraph"> {
106
146
  * to the paragraph.
107
147
  */
108
148
  getRectsForPlaceholders(): SkRectWithDirection[];
149
+ /**
150
+ * Converts the glyphs of the given line into an SkPath, with all font
151
+ * fallbacks already applied. Use `computeTightBounds()` on the resulting
152
+ * path to measure the exact ink bounds of the rendered text (as opposed to
153
+ * the font-metrics based bounds returned by `getRectsForRange`).
154
+ * Note that color glyphs (e.g. emojis) cannot be converted to a path and
155
+ * are skipped. Returns null if the line number is out of bounds.
156
+ * This method requires the layout method to have been called first.
157
+ * Not implemented on React Native Web.
158
+ * @param lineNumber The line number (zero indexed, see `getLineMetrics`)
159
+ */
160
+ getPath(lineNumber: number): SkPath | null;
161
+ /**
162
+ * Visits the laid out paragraph, calling the visitor once for every run of
163
+ * glyphs with the resolved font, glyph ids, positions and per-glyph tight
164
+ * ink bounds. The visitor is called with a null info to signal the end of
165
+ * each line. This exposes the exact layout that would be painted.
166
+ * This method requires the layout method to have been called first.
167
+ * Not implemented on React Native Web.
168
+ * @param visitor Called once per glyph run, and once per line end
169
+ */
170
+ extendedVisit(visitor: ParagraphExtendedVisitor): void;
109
171
  }
@@ -35,8 +35,12 @@ export interface SkSurface extends SkJSIInstance<"Surface"> {
35
35
  makeImageSnapshot(bounds?: SkRect, outputImage?: SkImage): SkImage;
36
36
  /**
37
37
  * Make sure any queued draws are sent to the screen or the GPU.
38
+ * @param sync - When true, block until the GPU has finished executing the
39
+ * submitted work. Use this before reading the surface's texture from a native
40
+ * consumer on a different command queue (see {@link getNativeTextureUnstable}).
41
+ * Defaults to false.
38
42
  */
39
- flush(): void;
43
+ flush(sync?: boolean): void;
40
44
  /**
41
45
  * Returns the possibly scaled width of the surface.
42
46
  */
@@ -1,5 +1,5 @@
1
1
  import type { CanvasKit, Paragraph } from "canvaskit-wasm";
2
- import type { SkRect, SkRectWithDirection, SkParagraph, LineMetrics } from "../types";
2
+ import type { SkRect, SkRectWithDirection, SkParagraph, SkPath, LineMetrics, ParagraphExtendedVisitor } from "../types";
3
3
  import { HostObject } from "./Host";
4
4
  import type { JsiSkCanvas } from "./JsiSkCanvas";
5
5
  export declare class JsiSkParagraph extends HostObject<Paragraph, "Paragraph"> implements SkParagraph {
@@ -15,4 +15,6 @@ export declare class JsiSkParagraph extends HostObject<Paragraph, "Paragraph"> i
15
15
  getRectsForPlaceholders(): SkRectWithDirection[];
16
16
  getRectsForRange(start: number, end: number): SkRect[];
17
17
  getLineMetrics(): LineMetrics[];
18
+ getPath(_lineNumber: number): SkPath | null;
19
+ extendedVisit(_visitor: ParagraphExtendedVisitor): void;
18
20
  }
@@ -5,7 +5,7 @@ import { JsiSkImage } from "./JsiSkImage";
5
5
  export declare class JsiSkSurface extends HostObject<Surface, "Surface"> implements SkSurface {
6
6
  constructor(CanvasKit: CanvasKit, ref: Surface);
7
7
  [Symbol.dispose](): void;
8
- flush(): void;
8
+ flush(_sync?: boolean): void;
9
9
  width(): number;
10
10
  height(): number;
11
11
  getCanvas(): SkCanvas;
@@ -7,6 +7,7 @@ declare class NativeReanimatedContainer extends Container {
7
7
  private mapperId;
8
8
  private picture;
9
9
  constructor(Skia: Skia, nativeId: number);
10
+ unmount(): void;
10
11
  redraw(): void;
11
12
  }
12
13
  export declare const createContainer: (Skia: Skia, nativeId: number) => StaticContainer | NativeReanimatedContainer;
@@ -6,6 +6,7 @@ declare class ReanimatedContainer extends Container {
6
6
  private nativeId;
7
7
  private mapperId;
8
8
  constructor(Skia: Skia, nativeId: number);
9
+ unmount(): void;
9
10
  redraw(): void;
10
11
  }
11
12
  export declare const createContainer: (Skia: Skia, nativeId: number) => StaticContainer | ReanimatedContainer;
@@ -2,6 +2,8 @@ import type { Skia, SkCanvas, SkColorFilter, SkPaint, SkShader, SkImageFilter, S
2
2
  export declare const createDrawingContext: (Skia: Skia, paintPool: SkPaint[], canvas: SkCanvas) => {
3
3
  Skia: Skia;
4
4
  canvas: SkCanvas;
5
+ track: <T>(value: T) => T;
6
+ dispose: () => void;
5
7
  paints: SkPaint[];
6
8
  colorFilters: SkColorFilter[];
7
9
  shaders: SkShader[];
@@ -0,0 +1,18 @@
1
+ import type { Skia } from "../../skia/types";
2
+ export interface FrameScope {
3
+ Skia: Skia;
4
+ track: <T>(value: T) => T;
5
+ dispose: () => void;
6
+ }
7
+ /**
8
+ * Wraps a Skia instance so that every object created through its factories is
9
+ * collected and deleted when the scope is disposed. The renderer only keeps
10
+ * the objects it creates alive for the duration of a frame: once the frame
11
+ * has been recorded they can be deleted. This is required on Web where
12
+ * CanvasKit objects live in WASM memory that the JS garbage collector does
13
+ * not perceive, so it (almost) never reclaims them on its own.
14
+ *
15
+ * Objects passed in via props are user-owned: they are not created through
16
+ * this facade and are therefore never tracked nor disposed.
17
+ */
18
+ export declare const createFrameScope: (Skia: Skia) => FrameScope;
@@ -0,0 +1,10 @@
1
+ import type { Skia } from "../../skia/types";
2
+ import type { FrameScope } from "./FrameScope";
3
+ /**
4
+ * No-op on native. The JSI wrappers report the size of the native objects
5
+ * they hold to the garbage collector (setExternalMemoryPressure), so the GC
6
+ * is aware of the real cost of the objects the renderer creates and reclaims
7
+ * them on its own. The tracking scope is only needed on Web, where CanvasKit
8
+ * objects live in WASM memory the GC cannot see (see FrameScope.ts).
9
+ */
10
+ export declare const createFrameScope: (Skia: Skia) => FrameScope;
@@ -2,12 +2,14 @@ import type { SharedValue } from "react-native-reanimated";
2
2
  import { NodeType } from "../../dom/types";
3
3
  import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PaintProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, BoxProps, BoxShadowProps, SkottieProps, DrawingNodeProps } from "../../dom/types";
4
4
  import type { AnimatedProps } from "../../renderer";
5
- import type { SkPaint, BaseRecorder } from "../../skia/types";
5
+ import type { SkPaint, SkPicture, BaseRecorder } from "../../skia/types";
6
6
  import type { Command } from "./Core";
7
7
  export interface Recording {
8
8
  commands: Command[];
9
9
  paintPool: SkPaint[];
10
+ lastPicture?: SkPicture | null;
10
11
  }
12
+ export declare const disposeRecording: (recording: Recording) => void;
11
13
  interface AnimationValues {
12
14
  animationValues: Set<SharedValue<unknown>>;
13
15
  }
@@ -18,5 +18,6 @@ export declare abstract class Container {
18
18
  export declare class StaticContainer extends Container {
19
19
  private nativeId;
20
20
  constructor(Skia: Skia, nativeId: number);
21
+ unmount(): void;
21
22
  redraw(): void;
22
23
  }
@@ -4,7 +4,9 @@ import type { SkiaPictureViewHandle } from "../views/SkiaPictureView.web";
4
4
  export type ISkiaViewApiWeb = ISkiaViewApi & {
5
5
  views: Record<string, SkiaPictureViewHandle>;
6
6
  deferedPictures: Record<string, SkPicture>;
7
+ unregisteredViews: Set<string>;
7
8
  registerView(nativeId: string, view: SkiaPictureViewHandle): void;
9
+ unregisterView(nativeId: string): void;
8
10
  };
9
11
  declare const _default: {};
10
12
  export default _default;
@@ -4,6 +4,7 @@ export interface NativeProps extends ViewProps {
4
4
  debug?: boolean;
5
5
  opaque?: boolean;
6
6
  colorSpace?: string;
7
+ highBitDepth?: boolean;
7
8
  androidWarmup?: boolean;
8
9
  pointerEvents?: WithDefault<"auto" | "none" | "box-none" | "box-only", "auto">;
9
10
  }
@@ -0,0 +1 @@
1
+ export declare const getPreferredHighBitDepthCanvasFormat: () => GPUTextureFormat;
@@ -1,3 +1,4 @@
1
1
  export * from "./SkiaPictureView";
2
2
  export * from "./types";
3
3
  export * from "./WebGPUCanvas";
4
+ export * from "./formats";
@@ -26,6 +26,12 @@ export interface SkiaBaseViewProps extends ViewProps {
26
26
  */
27
27
  onSize?: SharedValue<SkSize>;
28
28
  opaque?: boolean;
29
+ /**
30
+ * Renders into a surface with more than 8 bits per channel (16-bit float on
31
+ * iOS, 10-bit on Android) to avoid banding in subtle gradients. On Android
32
+ * the extra precision survives composition only when combined with `opaque`.
33
+ */
34
+ highBitDepth?: boolean;
29
35
  __destroyWebGLContextAfterRender?: boolean;
30
36
  }
31
37
  export interface SkiaPictureViewNativeProps extends SkiaBaseViewProps {
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "setup-skia-web": "scripts/setup-canvaskit.js"
9
9
  },
10
10
  "title": "React Native Skia",
11
- "version": "2.6.9",
11
+ "version": "2.8.0",
12
12
  "description": "High-performance React Native Graphics using Skia",
13
13
  "main": "lib/module/index.js",
14
14
  "react-native": "src/index.ts",
@@ -104,6 +104,7 @@
104
104
  "@types/jest": "30.0.0",
105
105
  "@types/pngjs": "6.0.1",
106
106
  "@types/react": "^19.0.0",
107
+ "@types/react-dom": "^19.0.0",
107
108
  "@types/react-reconciler": "0.28.9",
108
109
  "@types/ws": "8.5.3",
109
110
  "eslint": "9.36.0",
@@ -112,10 +113,12 @@
112
113
  "eslint-plugin-react-hooks": "^5.2.0",
113
114
  "jest": "30.0.0",
114
115
  "jest-diff": "29.7.0",
116
+ "jest-environment-jsdom": "30.0.0",
115
117
  "merge-dirs": "0.2.1",
116
118
  "pngjs": "6.0.0",
117
119
  "prettier": "2.8.7",
118
120
  "react": "19.0.0",
121
+ "react-dom": "19.0.0",
119
122
  "react-native": "0.83.1",
120
123
  "react-native-builder-bob": "0.18.2",
121
124
  "react-native-reanimated": "4.3.1",
@@ -143,6 +143,7 @@ Pod::Spec.new do |s|
143
143
  graphite_exclusions = [
144
144
  'cpp/rnskia/RNDawnContext.h',
145
145
  'cpp/rnskia/RNDawnUtils.h',
146
+ 'cpp/rnskia/RNMetalLayerColorSpace.h',
146
147
  'cpp/rnskia/RNDawnWindowContext.h',
147
148
  'cpp/rnskia/RNDawnWindowContext.cpp',
148
149
  'cpp/rnskia/RNImageProvider.h',
@@ -1,104 +1,16 @@
1
- import type { RefObject, CSSProperties } from "react";
2
- import React, { useLayoutEffect, useMemo, useRef } from "react";
3
- import type { LayoutChangeEvent, ViewComponent, ViewProps } from "react-native";
1
+ import type { CSSProperties } from "react";
2
+ import React, { useMemo } from "react";
3
+ import type { ViewComponent, ViewProps } from "react-native";
4
4
 
5
5
  import type { DataModule } from "../skia/types";
6
6
  import { isRNModule } from "../skia/types";
7
7
 
8
8
  import type { IPlatform } from "./IPlatform";
9
9
 
10
- // https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/modules/useElementLayout/index.js
11
- const DOM_LAYOUT_HANDLER_NAME = "__reactLayoutHandler";
12
- type OnLayout = ((event: LayoutChangeEvent) => void) | undefined;
13
- type Div = HTMLDivElement & {
14
- __reactLayoutHandler: OnLayout;
15
- };
16
-
17
- let resizeObserver: ResizeObserver | null = null;
18
-
19
- const getObserver = () => {
20
- if (resizeObserver == null) {
21
- resizeObserver = new window.ResizeObserver(function (entries) {
22
- entries.forEach((entry) => {
23
- const node = entry.target as Div;
24
- const { left, top, width, height } = entry.contentRect;
25
- const onLayout = node[DOM_LAYOUT_HANDLER_NAME];
26
- if (typeof onLayout === "function") {
27
- // setTimeout 0 is taken from react-native-web (UIManager)
28
- setTimeout(
29
- () =>
30
- onLayout({
31
- timeStamp: Date.now(),
32
- nativeEvent: { layout: { x: left, y: top, width, height } },
33
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
34
- // @ts-expect-error
35
- currentTarget: 0,
36
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
37
- // @ts-expect-error
38
- target: 0,
39
- bubbles: false,
40
- cancelable: false,
41
- defaultPrevented: false,
42
- eventPhase: 0,
43
- isDefaultPrevented() {
44
- throw new Error("Method not supported on web.");
45
- },
46
- isPropagationStopped() {
47
- throw new Error("Method not supported on web.");
48
- },
49
- persist() {
50
- throw new Error("Method not supported on web.");
51
- },
52
- preventDefault() {
53
- throw new Error("Method not supported on web.");
54
- },
55
- stopPropagation() {
56
- throw new Error("Method not supported on web.");
57
- },
58
- isTrusted: true,
59
- type: "",
60
- }),
61
- 0
62
- );
63
- }
64
- });
65
- });
66
- }
67
- return resizeObserver;
68
- };
69
-
70
- const useElementLayout = (ref: RefObject<Div>, onLayout: OnLayout) => {
71
- const observer = getObserver();
72
-
73
- useLayoutEffect(() => {
74
- const node = ref.current;
75
- if (node !== null) {
76
- node[DOM_LAYOUT_HANDLER_NAME] = onLayout;
77
- }
78
- }, [ref, onLayout]);
79
-
80
- useLayoutEffect(() => {
81
- const node = ref.current;
82
- if (node != null && observer != null) {
83
- if (typeof node[DOM_LAYOUT_HANDLER_NAME] === "function") {
84
- observer.observe(node);
85
- } else {
86
- observer.unobserve(node);
87
- }
88
- }
89
- return () => {
90
- if (node != null && observer != null) {
91
- observer.unobserve(node);
92
- }
93
- };
94
- }, [observer, ref]);
95
- };
96
-
97
- const View = (({ children, onLayout, style: rawStyle }: ViewProps) => {
10
+ // Layout is observed by the views themselves (see SkiaPictureView.web.tsx):
11
+ // this shim only reproduces react-native-web's default View styling.
12
+ const View = (({ children, style: rawStyle }: ViewProps) => {
98
13
  const style = useMemo(() => (rawStyle ?? {}) as CSSProperties, [rawStyle]);
99
- const ref = useRef<Div>(null);
100
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
101
- useElementLayout(ref as any, onLayout);
102
14
  const cssStyles = useMemo(() => {
103
15
  return {
104
16
  alignItems: "stretch" as const,
@@ -121,11 +33,7 @@ const View = (({ children, onLayout, style: rawStyle }: ViewProps) => {
121
33
  };
122
34
  }, [style]);
123
35
 
124
- return (
125
- <div ref={ref} style={cssStyles}>
126
- {children}
127
- </div>
128
- );
36
+ return <div style={cssStyles}>{children}</div>;
129
37
  }) as unknown as typeof ViewComponent;
130
38
 
131
39
  export const Platform: IPlatform = {
@@ -1,11 +1,21 @@
1
1
  import { useCallback, useEffect, useState } from "react";
2
+ import type { WorkletRuntime } from "react-native-reanimated";
2
3
 
3
4
  import type { Video } from "../../skia/types";
4
5
  import { Skia } from "../../skia";
5
6
 
6
7
  import Rea from "./ReanimatedProxy";
7
8
 
8
- const runtime = Rea.createWorkletRuntime("video-metadata-runtime");
9
+ // Created lazily: accessing the proxy at module scope would require
10
+ // react-native-reanimated as soon as the package is imported, and would spawn
11
+ // the runtime even for apps that never load a video.
12
+ let runtime: WorkletRuntime | undefined;
13
+ const getRuntime = () => {
14
+ if (runtime === undefined) {
15
+ runtime = Rea.createWorkletRuntime("video-metadata-runtime");
16
+ }
17
+ return runtime;
18
+ };
9
19
 
10
20
  type VideoSource = string | null;
11
21
 
@@ -22,7 +32,7 @@ export const useVideoLoading = (source: VideoSource) => {
22
32
  );
23
33
  useEffect(() => {
24
34
  if (source) {
25
- Rea.runOnRuntime(runtime, cb)(source);
35
+ Rea.runOnRuntime(getRuntime(), cb)(source);
26
36
  }
27
37
  }, [cb, source]);
28
38
  return video;
package/src/mock/index.ts CHANGED
@@ -24,6 +24,7 @@ export const Mock = (CanvasKit: CanvasKit) => {
24
24
  ...require("../dom/nodes"),
25
25
  Canvas: require("react-native").View,
26
26
  WebGPUCanvas: require("react-native").View,
27
+ getPreferredHighBitDepthCanvasFormat: () => "rgba16float",
27
28
  SkiaPictureView: require("react-native").View,
28
29
  JsiSkImage: JsiSkImage,
29
30
  drawAsPicture: Noop,
@@ -69,6 +69,15 @@ export interface CanvasProps extends Omit<ViewProps, "onLayout"> {
69
69
  opaque?: boolean;
70
70
  onSize?: SharedValue<SkSize>;
71
71
  colorSpace?: "p3" | "srgb";
72
+ /**
73
+ * Renders into a surface with more than 8 bits per channel (16-bit float on
74
+ * iOS, 10-bit on Android) to avoid banding in subtle gradients. Colors are
75
+ * identical to the default 8-bit surface, only with more precision (this is
76
+ * about bit depth, not HDR). On Android the extra precision survives
77
+ * composition only when combined with `opaque`, and the prop must be set
78
+ * before the canvas is mounted.
79
+ */
80
+ highBitDepth?: boolean;
72
81
  ref?: React.Ref<CanvasRef>;
73
82
  androidWarmup?: boolean;
74
83
  __destroyWebGLContextAfterRender?: boolean;
@@ -80,6 +89,7 @@ export const Canvas = ({
80
89
  children,
81
90
  onSize,
82
91
  colorSpace = "p3",
92
+ highBitDepth = false,
83
93
  androidWarmup = false,
84
94
  ref,
85
95
  onLayout,
@@ -180,6 +190,7 @@ export const Canvas = ({
180
190
  debug={debug}
181
191
  opaque={opaque}
182
192
  colorSpace={colorSpace}
193
+ highBitDepth={highBitDepth}
183
194
  androidWarmup={androidWarmup}
184
195
  onLayout={
185
196
  Platform.OS === "web" && (onSize || onLayout) ? onLayoutWeb : onLayout
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
2
2
 
3
3
  import { Skia } from "../Skia";
4
4
  import type { DataSourceParam, SkSVG } from "../types";
5
+ import { Platform } from "../../Platform";
5
6
 
6
7
  export const useSVG = (
7
8
  source: DataSourceParam,
@@ -16,22 +17,12 @@ export const useSVG = (
16
17
  let src: string;
17
18
  if (typeof source === "string") {
18
19
  src = source;
19
- } else if (
20
- typeof source === "object" &&
21
- "default" in source &&
22
- typeof source.default === "string"
23
- ) {
24
- src = source.default;
25
- } else if (typeof source === "object" && "uri" in source) {
26
- src = source.uri;
27
- } else {
20
+ } else if (source instanceof Uint8Array) {
28
21
  throw new Error(
29
- `Invalid svg data source. Make sure that the source resolves to a string. Got: ${JSON.stringify(
30
- source,
31
- null,
32
- 2
33
- )}`
22
+ `Invalid svg data source. Make sure that the source resolves to a string. Got: ${source}`
34
23
  );
24
+ } else {
25
+ src = Platform.resolveAsset(source);
35
26
  }
36
27
  const result = await fetch(src);
37
28
  const svgStr = await result.text();
@@ -1,6 +1,10 @@
1
1
  import type { SkCanvas } from "../Canvas";
2
+ import type { SkFont } from "../Font";
2
3
  import type { SkJSIInstance } from "../JsiInstance";
4
+ import type { SkPath } from "../Path";
5
+ import type { SkPoint } from "../Point";
3
6
  import type { SkRect } from "../Rect";
7
+ import type { SkSize } from "../Size";
4
8
 
5
9
  import type { TextDirection } from "./ParagraphStyle";
6
10
 
@@ -40,6 +44,47 @@ export interface SkRectWithDirection {
40
44
  direction: TextDirection;
41
45
  }
42
46
 
47
+ /**
48
+ * Information about a run of glyphs passed to the visitor of
49
+ * `SkParagraph.extendedVisit`. All glyphs in a run share the same font: for
50
+ * text shaped through font fallback, each fallback font produces its own
51
+ * run(s).
52
+ */
53
+ export interface ParagraphVisitorInfo {
54
+ /** The font used to shape this run (the resolved fallback font, if any). */
55
+ font: SkFont;
56
+ /** Origin of the run within the paragraph (baseline corrected). */
57
+ origin: SkPoint;
58
+ /** Advance of the run. */
59
+ advance: SkSize;
60
+ /** The glyph ids of the run. */
61
+ glyphs: number[];
62
+ /**
63
+ * The position of each glyph, relative to the run `origin`. Add `origin`
64
+ * to obtain paragraph coordinates: for a run shaped through font fallback,
65
+ * the run placement is carried by `origin`, not by the positions.
66
+ */
67
+ positions: SkPoint[];
68
+ /**
69
+ * The tight ink bounds of each glyph, relative to the glyph's origin.
70
+ * Combine with `positions` to compute the exact painted bounds of the run.
71
+ */
72
+ bounds: SkRect[];
73
+ /** The UTF-8 text index of the cluster each glyph belongs to. */
74
+ utf8Starts: number[];
75
+ /** Reserved flags (currently always 0). */
76
+ flags: number;
77
+ }
78
+
79
+ /**
80
+ * Visitor for `SkParagraph.extendedVisit`. Called once per run of glyphs;
81
+ * `info` is null to signal the end of a line.
82
+ */
83
+ export type ParagraphExtendedVisitor = (
84
+ lineNumber: number,
85
+ info: ParagraphVisitorInfo | null
86
+ ) => void;
87
+
43
88
  export interface SkParagraph extends SkJSIInstance<"Paragraph"> {
44
89
  /**
45
90
  * Calculates the position of the the glyphs in the paragraph
@@ -112,4 +157,26 @@ export interface SkParagraph extends SkJSIInstance<"Paragraph"> {
112
157
  * to the paragraph.
113
158
  */
114
159
  getRectsForPlaceholders(): SkRectWithDirection[];
160
+ /**
161
+ * Converts the glyphs of the given line into an SkPath, with all font
162
+ * fallbacks already applied. Use `computeTightBounds()` on the resulting
163
+ * path to measure the exact ink bounds of the rendered text (as opposed to
164
+ * the font-metrics based bounds returned by `getRectsForRange`).
165
+ * Note that color glyphs (e.g. emojis) cannot be converted to a path and
166
+ * are skipped. Returns null if the line number is out of bounds.
167
+ * This method requires the layout method to have been called first.
168
+ * Not implemented on React Native Web.
169
+ * @param lineNumber The line number (zero indexed, see `getLineMetrics`)
170
+ */
171
+ getPath(lineNumber: number): SkPath | null;
172
+ /**
173
+ * Visits the laid out paragraph, calling the visitor once for every run of
174
+ * glyphs with the resolved font, glyph ids, positions and per-glyph tight
175
+ * ink bounds. The visitor is called with a null info to signal the end of
176
+ * each line. This exposes the exact layout that would be painted.
177
+ * This method requires the layout method to have been called first.
178
+ * Not implemented on React Native Web.
179
+ * @param visitor Called once per glyph run, and once per line end
180
+ */
181
+ extendedVisit(visitor: ParagraphExtendedVisitor): void;
115
182
  }
@@ -39,8 +39,12 @@ export interface SkSurface extends SkJSIInstance<"Surface"> {
39
39
 
40
40
  /**
41
41
  * Make sure any queued draws are sent to the screen or the GPU.
42
+ * @param sync - When true, block until the GPU has finished executing the
43
+ * submitted work. Use this before reading the surface's texture from a native
44
+ * consumer on a different command queue (see {@link getNativeTextureUnstable}).
45
+ * Defaults to false.
42
46
  */
43
- flush(): void;
47
+ flush(sync?: boolean): void;
44
48
 
45
49
  /**
46
50
  * Returns the possibly scaled width of the surface.
@@ -41,6 +41,13 @@ export abstract class BaseHostObject<T, N extends string>
41
41
  "delete" in this.ref &&
42
42
  typeof this.ref.delete === "function"
43
43
  ) {
44
+ // Renderer-owned and user-owned disposal can overlap (and emscripten
45
+ // throws on double delete) — make disposing an already-deleted object
46
+ // a no-op.
47
+ const ref = this.ref as unknown as { isDeleted?: () => boolean };
48
+ if (typeof ref.isDeleted === "function" && ref.isDeleted()) {
49
+ return;
50
+ }
44
51
  this.ref.delete();
45
52
  }
46
53
  }
@@ -76,11 +76,16 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
76
76
  }
77
77
 
78
78
  assign(paint: JsiSkPaint) {
79
+ const previous = this.ref;
79
80
  this.ref = paint.ref.copy();
81
+ // The replaced ref is a WASM object the GC will not reclaim.
82
+ previous.delete();
80
83
  }
81
84
 
82
85
  reset() {
86
+ const previous = this.ref;
83
87
  this.ref = new this.CanvasKit.Paint();
88
+ previous.delete();
84
89
  }
85
90
 
86
91
  getAlphaf() {