@shopify/react-native-skia 0.1.202 → 0.1.204

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. package/android/CMakeLists.txt +9 -9
  2. package/android/cpp/jni/include/JniSkiaBaseView.h +0 -56
  3. package/android/cpp/jni/include/JniSkiaDomView.h +12 -20
  4. package/android/cpp/jni/include/JniSkiaDrawView.h +14 -20
  5. package/android/cpp/jni/include/JniSkiaPictureView.h +15 -24
  6. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +11 -0
  7. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +32 -77
  8. package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseViewManager.java +1 -0
  9. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +0 -3
  10. package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +0 -3
  11. package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureView.java +0 -4
  12. package/cpp/api/JsiSkApi.h +8 -0
  13. package/cpp/api/JsiSkFontMgr.h +54 -0
  14. package/cpp/api/JsiSkFontMgrFactory.h +40 -0
  15. package/cpp/api/JsiSkFontStyle.h +61 -0
  16. package/cpp/api/JsiSkTypeFaceFontProvider.h +80 -0
  17. package/cpp/api/JsiSkTypeFaceFontProviderFactory.h +32 -0
  18. package/cpp/rnskia/RNSkPlatformContext.h +6 -0
  19. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +1 -0
  20. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +7 -0
  21. package/lib/commonjs/skia/core/Data.d.ts +2 -0
  22. package/lib/commonjs/skia/core/Data.js +29 -1
  23. package/lib/commonjs/skia/core/Data.js.map +1 -1
  24. package/lib/commonjs/skia/core/Font.d.ts +14 -1
  25. package/lib/commonjs/skia/core/Font.js +93 -1
  26. package/lib/commonjs/skia/core/Font.js.map +1 -1
  27. package/lib/commonjs/skia/types/Font/FontMgr.d.ts +8 -0
  28. package/lib/commonjs/skia/types/Font/FontMgr.js +6 -0
  29. package/lib/commonjs/skia/types/Font/FontMgr.js.map +1 -0
  30. package/lib/commonjs/skia/types/Font/FontMgrFactory.d.ts +4 -0
  31. package/lib/commonjs/skia/types/Font/FontMgrFactory.js +6 -0
  32. package/lib/commonjs/skia/types/Font/FontMgrFactory.js.map +1 -0
  33. package/lib/commonjs/skia/types/Font/index.d.ts +2 -0
  34. package/lib/commonjs/skia/types/Font/index.js +26 -0
  35. package/lib/commonjs/skia/types/Font/index.js.map +1 -1
  36. package/lib/commonjs/skia/types/Paragraph/TypefaceFontProvider.d.ts +10 -0
  37. package/lib/commonjs/skia/types/Paragraph/TypefaceFontProvider.js +6 -0
  38. package/lib/commonjs/skia/types/Paragraph/TypefaceFontProvider.js.map +1 -0
  39. package/lib/commonjs/skia/types/Paragraph/TypefaceFontProviderFactory.d.ts +4 -0
  40. package/lib/commonjs/skia/types/Paragraph/TypefaceFontProviderFactory.js +6 -0
  41. package/lib/commonjs/skia/types/Paragraph/TypefaceFontProviderFactory.js.map +1 -0
  42. package/lib/commonjs/skia/types/Skia.d.ts +4 -1
  43. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  44. package/lib/commonjs/skia/web/Host.d.ts +1 -1
  45. package/lib/commonjs/skia/web/Host.js +0 -2
  46. package/lib/commonjs/skia/web/Host.js.map +1 -1
  47. package/lib/commonjs/skia/web/JsiSkFontMgr.d.ts +10 -0
  48. package/lib/commonjs/skia/web/JsiSkFontMgr.js +34 -0
  49. package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -0
  50. package/lib/commonjs/skia/web/JsiSkFontMgrFactory.d.ts +8 -0
  51. package/lib/commonjs/skia/web/JsiSkFontMgrFactory.js +32 -0
  52. package/lib/commonjs/skia/web/JsiSkFontMgrFactory.js.map +1 -0
  53. package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.d.ts +13 -0
  54. package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js +90 -0
  55. package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js.map +1 -0
  56. package/lib/commonjs/skia/web/JsiSkTypefaceFontProviderFactory.d.ts +7 -0
  57. package/lib/commonjs/skia/web/JsiSkTypefaceFontProviderFactory.js +25 -0
  58. package/lib/commonjs/skia/web/JsiSkTypefaceFontProviderFactory.js.map +1 -0
  59. package/lib/commonjs/skia/web/JsiSkia.js +7 -1
  60. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  61. package/lib/module/skia/core/Data.d.ts +2 -0
  62. package/lib/module/skia/core/Data.js +24 -1
  63. package/lib/module/skia/core/Data.js.map +1 -1
  64. package/lib/module/skia/core/Font.d.ts +14 -1
  65. package/lib/module/skia/core/Font.js +83 -1
  66. package/lib/module/skia/core/Font.js.map +1 -1
  67. package/lib/module/skia/types/Font/FontMgr.d.ts +8 -0
  68. package/lib/module/skia/types/Font/FontMgr.js +2 -0
  69. package/lib/module/skia/types/Font/FontMgr.js.map +1 -0
  70. package/lib/module/skia/types/Font/FontMgrFactory.d.ts +4 -0
  71. package/lib/module/skia/types/Font/FontMgrFactory.js +2 -0
  72. package/lib/module/skia/types/Font/FontMgrFactory.js.map +1 -0
  73. package/lib/module/skia/types/Font/index.d.ts +2 -0
  74. package/lib/module/skia/types/Font/index.js +2 -0
  75. package/lib/module/skia/types/Font/index.js.map +1 -1
  76. package/lib/module/skia/types/Paragraph/TypefaceFontProvider.d.ts +10 -0
  77. package/lib/module/skia/types/Paragraph/TypefaceFontProvider.js +2 -0
  78. package/lib/module/skia/types/Paragraph/TypefaceFontProvider.js.map +1 -0
  79. package/lib/module/skia/types/Paragraph/TypefaceFontProviderFactory.d.ts +4 -0
  80. package/lib/module/skia/types/Paragraph/TypefaceFontProviderFactory.js +2 -0
  81. package/lib/module/skia/types/Paragraph/TypefaceFontProviderFactory.js.map +1 -0
  82. package/lib/module/skia/types/Skia.d.ts +4 -1
  83. package/lib/module/skia/types/Skia.js.map +1 -1
  84. package/lib/module/skia/web/Host.d.ts +1 -1
  85. package/lib/module/skia/web/Host.js +0 -2
  86. package/lib/module/skia/web/Host.js.map +1 -1
  87. package/lib/module/skia/web/JsiSkFontMgr.d.ts +10 -0
  88. package/lib/module/skia/web/JsiSkFontMgr.js +24 -0
  89. package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -0
  90. package/lib/module/skia/web/JsiSkFontMgrFactory.d.ts +8 -0
  91. package/lib/module/skia/web/JsiSkFontMgrFactory.js +21 -0
  92. package/lib/module/skia/web/JsiSkFontMgrFactory.js.map +1 -0
  93. package/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +13 -0
  94. package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +80 -0
  95. package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -0
  96. package/lib/module/skia/web/JsiSkTypefaceFontProviderFactory.d.ts +7 -0
  97. package/lib/module/skia/web/JsiSkTypefaceFontProviderFactory.js +14 -0
  98. package/lib/module/skia/web/JsiSkTypefaceFontProviderFactory.js.map +1 -0
  99. package/lib/module/skia/web/JsiSkia.js +5 -1
  100. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  101. package/lib/typescript/src/skia/core/Data.d.ts +2 -0
  102. package/lib/typescript/src/skia/core/Font.d.ts +14 -1
  103. package/lib/typescript/src/skia/types/Font/FontMgr.d.ts +8 -0
  104. package/lib/typescript/src/skia/types/Font/FontMgrFactory.d.ts +4 -0
  105. package/lib/typescript/src/skia/types/Font/index.d.ts +2 -0
  106. package/lib/typescript/src/skia/types/Paragraph/TypefaceFontProvider.d.ts +10 -0
  107. package/lib/typescript/src/skia/types/Paragraph/TypefaceFontProviderFactory.d.ts +4 -0
  108. package/lib/typescript/src/skia/types/Skia.d.ts +4 -1
  109. package/lib/typescript/src/skia/web/Host.d.ts +1 -1
  110. package/lib/typescript/src/skia/web/JsiSkFontMgr.d.ts +10 -0
  111. package/lib/typescript/src/skia/web/JsiSkFontMgrFactory.d.ts +8 -0
  112. package/lib/typescript/src/skia/web/JsiSkTypefaceFontProvider.d.ts +13 -0
  113. package/lib/typescript/src/skia/web/JsiSkTypefaceFontProviderFactory.d.ts +7 -0
  114. package/libs/android/arm64-v8a/libskia.a +0 -0
  115. package/libs/android/arm64-v8a/libskottie.a +0 -0
  116. package/libs/android/arm64-v8a/libskparagraph.a +0 -0
  117. package/libs/android/arm64-v8a/libskshaper.a +0 -0
  118. package/libs/android/arm64-v8a/libskunicode.a +0 -0
  119. package/libs/android/armeabi-v7a/libskia.a +0 -0
  120. package/libs/android/armeabi-v7a/libskottie.a +0 -0
  121. package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
  122. package/libs/android/armeabi-v7a/libskshaper.a +0 -0
  123. package/libs/android/armeabi-v7a/libskunicode.a +0 -0
  124. package/libs/android/x86/libskia.a +0 -0
  125. package/libs/android/x86/libskottie.a +0 -0
  126. package/libs/android/x86/libskparagraph.a +0 -0
  127. package/libs/android/x86/libskshaper.a +0 -0
  128. package/libs/android/x86/libskunicode.a +0 -0
  129. package/libs/android/x86_64/libskia.a +0 -0
  130. package/libs/android/x86_64/libskottie.a +0 -0
  131. package/libs/android/x86_64/libskparagraph.a +0 -0
  132. package/libs/android/x86_64/libskshaper.a +0 -0
  133. package/libs/android/x86_64/libskunicode.a +0 -0
  134. package/libs/ios/libskia.xcframework/Info.plist +5 -5
  135. package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  136. package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  137. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  138. package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  139. package/libs/ios/libskparagraph.xcframework/Info.plist +42 -0
  140. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  141. package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  142. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  143. package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  144. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  145. package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  146. package/libs/ios/libskunicode.xcframework/Info.plist +42 -0
  147. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
  148. package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
  149. package/libs/ios/libsvg.xcframework/Info.plist +5 -5
  150. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  151. package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  152. package/package.json +3 -1
  153. package/react-native-skia.podspec +2 -2
  154. package/src/skia/core/Data.ts +31 -1
  155. package/src/skia/core/Font.ts +109 -2
  156. package/src/skia/types/Font/FontMgr.ts +10 -0
  157. package/src/skia/types/Font/FontMgrFactory.ts +5 -0
  158. package/src/skia/types/Font/index.ts +2 -0
  159. package/src/skia/types/Paragraph/TypefaceFontProvider.ts +11 -0
  160. package/src/skia/types/Paragraph/TypefaceFontProviderFactory.ts +5 -0
  161. package/src/skia/types/Skia.ts +4 -2
  162. package/src/skia/web/Host.ts +1 -1
  163. package/src/skia/web/JsiSkFontMgr.ts +26 -0
  164. package/src/skia/web/JsiSkFontMgrFactory.ts +22 -0
  165. package/src/skia/web/JsiSkTypefaceFontProvider.ts +89 -0
  166. package/src/skia/web/JsiSkTypefaceFontProviderFactory.ts +18 -0
  167. package/src/skia/web/JsiSkia.ts +4 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TypefaceFontProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["TypefaceFontProvider.ts"],"sourcesContent":["import type { SkFontMgr } from \"../Font\";\nimport type { SkTypeface } from \"../Typeface\";\n\nexport interface SkTypefaceFontProvider extends SkFontMgr {\n /**\n * Registers a given typeface with the given family name.\n * @param typeface - Typeface.\n * @param family\n */\n registerFont(typeface: SkTypeface, familyName: string): void;\n}\n"],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { SkTypefaceFontProvider } from "./TypefaceFontProvider";
2
+ export interface TypefaceFontProviderFactory {
3
+ Make(): SkTypefaceFontProvider;
4
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TypefaceFontProviderFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["TypefaceFontProviderFactory.ts"],"sourcesContent":["import type { SkTypefaceFontProvider } from \"./TypefaceFontProvider\";\n\nexport interface TypefaceFontProviderFactory {\n Make(): SkTypefaceFontProvider;\n}\n"],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import type { ImageFilterFactory } from "./ImageFilter";
2
2
  import type { PathFactory } from "./Path";
3
3
  import type { ColorFilterFactory } from "./ColorFilter";
4
- import type { SkFont } from "./Font";
4
+ import type { SkFont, FontMgrFactory } from "./Font";
5
5
  import type { SkTypeface, TypefaceFactory } from "./Typeface";
6
6
  import type { ImageFactory } from "./Image";
7
7
  import type { MaskFilterFactory } from "./MaskFilter";
@@ -23,6 +23,7 @@ import type { SkPath } from "./Path/Path";
23
23
  import type { SkContourMeasureIter } from "./ContourMeasure";
24
24
  import type { PictureFactory, SkPictureRecorder } from "./Picture";
25
25
  import type { Color, SkColor } from "./Color";
26
+ import type { TypefaceFontProviderFactory } from "./Paragraph/TypefaceFontProviderFactory";
26
27
  /**
27
28
  * Declares the interface for the native Skia API
28
29
  */
@@ -42,6 +43,8 @@ export interface Skia {
42
43
  ColorFilter: ColorFilterFactory;
43
44
  Font: (typeface?: SkTypeface, size?: number) => SkFont;
44
45
  Typeface: TypefaceFactory;
46
+ TypefaceFontProvider: TypefaceFontProviderFactory;
47
+ FontMgr: FontMgrFactory;
45
48
  MaskFilter: MaskFilterFactory;
46
49
  RuntimeEffect: RuntimeEffectFactory;
47
50
  ImageFilter: ImageFilterFactory;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n"],"mappings":""}
@@ -11,7 +11,7 @@ export declare abstract class BaseHostObject<T, N extends string> extends Host i
11
11
  readonly __typename__: N;
12
12
  ref: T;
13
13
  constructor(CanvasKit: CanvasKit, ref: T, typename: N);
14
- abstract dispose: () => void;
14
+ abstract dispose(): void;
15
15
  }
16
16
  export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
17
17
  static fromValue<T>(value: SkJSIInstance<string>): T;
@@ -22,8 +22,6 @@ export class BaseHostObject extends Host {
22
22
 
23
23
  _defineProperty(this, "ref", void 0);
24
24
 
25
- _defineProperty(this, "dispose", void 0);
26
-
27
25
  this.ref = ref;
28
26
  this.__typename__ = typename;
29
27
  }
@@ -1 +1 @@
1
- {"version":3,"names":["NotImplementedOnRNWeb","Error","constructor","msg","Host","CanvasKit","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","ckEnum","optEnum","undefined"],"sources":["Host.ts"],"sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor(msg?: string) {\n super(msg ?? \"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n\n abstract dispose: () => void;\n}\n\nexport abstract class HostObject<T, N extends string> extends BaseHostObject<\n T,\n N\n> {\n static fromValue<T>(value: SkJSIInstance<string>) {\n return (value as HostObject<T, string>).ref;\n }\n}\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"],"mappings":";;AAIA,OAAO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;EAC/CC,WAAW,CAACC,GAAD,EAAe;IACxB,MAAMA,GAAN,aAAMA,GAAN,cAAMA,GAAN,GAAa,qCAAb;EACD;;AAH8C;AAMjD,OAAO,MAAeC,IAAf,CAAoB;EAGzBF,WAAW,CAACG,SAAD,EAAuB;IAAA;;IAChC,KAAKA,SAAL,GAAiBA,SAAjB;EACD;;AALwB;AAQ3B,OAAO,MAAeC,cAAf,SACGF,IADH,CAGP;EAIEF,WAAW,CAACG,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;IACrD,MAAMH,SAAN;;IADqD;;IAAA;;IAAA;;IAErD,KAAKE,GAAL,GAAWA,GAAX;IACA,KAAKE,YAAL,GAAoBD,QAApB;EACD;;AARH;AAaA,OAAO,MAAeE,UAAf,SAAuDJ,cAAvD,CAGL;EACgB,OAATK,SAAS,CAAIC,KAAJ,EAAkC;IAChD,OAAQA,KAAD,CAAiCL,GAAxC;EACD;;AAHD;AAMF,OAAO,MAAMM,MAAM,GAAID,KAAD,KAAsC;EAAEA;AAAF,CAAtC,CAAf;AACP,OAAO,MAAME,OAAO,GAClBF,KADqB,IAGrBA,KAAK,KAAKG,SAAV,GAAsBA,SAAtB,GAAkC;EAAEH;AAAF,CAH7B"}
1
+ {"version":3,"names":["NotImplementedOnRNWeb","Error","constructor","msg","Host","CanvasKit","BaseHostObject","ref","typename","__typename__","HostObject","fromValue","value","ckEnum","optEnum","undefined"],"sources":["Host.ts"],"sourcesContent":["import type { CanvasKit, EmbindEnumEntity } from \"canvaskit-wasm\";\n\nimport type { SkJSIInstance } from \"../types\";\n\nexport class NotImplementedOnRNWeb extends Error {\n constructor(msg?: string) {\n super(msg ?? \"Not implemented on React Native Web\");\n }\n}\n\nexport abstract class Host {\n readonly CanvasKit: CanvasKit;\n\n constructor(CanvasKit: CanvasKit) {\n this.CanvasKit = CanvasKit;\n }\n}\n\nexport abstract class BaseHostObject<T, N extends string>\n extends Host\n implements SkJSIInstance<N>\n{\n readonly __typename__: N;\n ref: T;\n\n constructor(CanvasKit: CanvasKit, ref: T, typename: N) {\n super(CanvasKit);\n this.ref = ref;\n this.__typename__ = typename;\n }\n\n abstract dispose(): void;\n}\n\nexport abstract class HostObject<T, N extends string> extends BaseHostObject<\n T,\n N\n> {\n static fromValue<T>(value: SkJSIInstance<string>) {\n return (value as HostObject<T, string>).ref;\n }\n}\n\nexport const ckEnum = (value: number): EmbindEnumEntity => ({ value });\nexport const optEnum = (\n value: number | undefined\n): EmbindEnumEntity | undefined =>\n value === undefined ? undefined : { value };\n"],"mappings":";;AAIA,OAAO,MAAMA,qBAAN,SAAoCC,KAApC,CAA0C;EAC/CC,WAAW,CAACC,GAAD,EAAe;IACxB,MAAMA,GAAN,aAAMA,GAAN,cAAMA,GAAN,GAAa,qCAAb;EACD;;AAH8C;AAMjD,OAAO,MAAeC,IAAf,CAAoB;EAGzBF,WAAW,CAACG,SAAD,EAAuB;IAAA;;IAChC,KAAKA,SAAL,GAAiBA,SAAjB;EACD;;AALwB;AAQ3B,OAAO,MAAeC,cAAf,SACGF,IADH,CAGP;EAIEF,WAAW,CAACG,SAAD,EAAuBE,GAAvB,EAA+BC,QAA/B,EAA4C;IACrD,MAAMH,SAAN;;IADqD;;IAAA;;IAErD,KAAKE,GAAL,GAAWA,GAAX;IACA,KAAKE,YAAL,GAAoBD,QAApB;EACD;;AARH;AAaA,OAAO,MAAeE,UAAf,SAAuDJ,cAAvD,CAGL;EACgB,OAATK,SAAS,CAAIC,KAAJ,EAAkC;IAChD,OAAQA,KAAD,CAAiCL,GAAxC;EACD;;AAHD;AAMF,OAAO,MAAMM,MAAM,GAAID,KAAD,KAAsC;EAAEA;AAAF,CAAtC,CAAf;AACP,OAAO,MAAME,OAAO,GAClBF,KADqB,IAGrBA,KAAK,KAAKG,SAAV,GAAsBA,SAAtB,GAAkC;EAAEH;AAAF,CAH7B"}
@@ -0,0 +1,10 @@
1
+ import type { CanvasKit, FontMgr } from "canvaskit-wasm";
2
+ import type { FontStyle, SkFontMgr, SkTypeface } from "../types";
3
+ import { HostObject } from "./Host";
4
+ export declare class JsiSkFontMgr extends HostObject<FontMgr, "FontMgr"> implements SkFontMgr {
5
+ constructor(CanvasKit: CanvasKit, ref: FontMgr);
6
+ dispose(): void;
7
+ countFamilies(): number;
8
+ getFamilyName(index: number): string;
9
+ matchFamilyStyle(_familyName: string, _fontStyle: FontStyle): SkTypeface;
10
+ }
@@ -0,0 +1,24 @@
1
+ import { HostObject, NotImplementedOnRNWeb } from "./Host";
2
+ export class JsiSkFontMgr extends HostObject {
3
+ constructor(CanvasKit, ref) {
4
+ super(CanvasKit, ref, "FontMgr");
5
+ }
6
+
7
+ dispose() {
8
+ this.ref.delete();
9
+ }
10
+
11
+ countFamilies() {
12
+ return this.ref.countFamilies();
13
+ }
14
+
15
+ getFamilyName(index) {
16
+ return this.ref.getFamilyName(index);
17
+ }
18
+
19
+ matchFamilyStyle(_familyName, _fontStyle) {
20
+ throw new NotImplementedOnRNWeb();
21
+ }
22
+
23
+ }
24
+ //# sourceMappingURL=JsiSkFontMgr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["HostObject","NotImplementedOnRNWeb","JsiSkFontMgr","constructor","CanvasKit","ref","dispose","delete","countFamilies","getFamilyName","index","matchFamilyStyle","_familyName","_fontStyle"],"sources":["JsiSkFontMgr.ts"],"sourcesContent":["import type { CanvasKit, FontMgr } from \"canvaskit-wasm\";\n\nimport type { FontStyle, SkFontMgr, SkTypeface } from \"../types\";\n\nimport { HostObject, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkFontMgr\n extends HostObject<FontMgr, \"FontMgr\">\n implements SkFontMgr\n{\n constructor(CanvasKit: CanvasKit, ref: FontMgr) {\n super(CanvasKit, ref, \"FontMgr\");\n }\n dispose() {\n this.ref.delete();\n }\n countFamilies() {\n return this.ref.countFamilies();\n }\n getFamilyName(index: number) {\n return this.ref.getFamilyName(index);\n }\n matchFamilyStyle(_familyName: string, _fontStyle: FontStyle): SkTypeface {\n throw new NotImplementedOnRNWeb();\n }\n}\n"],"mappings":"AAIA,SAASA,UAAT,EAAqBC,qBAArB,QAAkD,QAAlD;AAEA,OAAO,MAAMC,YAAN,SACGF,UADH,CAGP;EACEG,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAqC;IAC9C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,SAAtB;EACD;;EACDC,OAAO,GAAG;IACR,KAAKD,GAAL,CAASE,MAAT;EACD;;EACDC,aAAa,GAAG;IACd,OAAO,KAAKH,GAAL,CAASG,aAAT,EAAP;EACD;;EACDC,aAAa,CAACC,KAAD,EAAgB;IAC3B,OAAO,KAAKL,GAAL,CAASI,aAAT,CAAuBC,KAAvB,CAAP;EACD;;EACDC,gBAAgB,CAACC,WAAD,EAAsBC,UAAtB,EAAyD;IACvE,MAAM,IAAIZ,qBAAJ,EAAN;EACD;;AAfH"}
@@ -0,0 +1,8 @@
1
+ import type { CanvasKit } from "canvaskit-wasm";
2
+ import type { FontMgrFactory } from "../types";
3
+ import { Host } from "./Host";
4
+ import { JsiSkFontMgr } from "./JsiSkFontMgr";
5
+ export declare class JsiSkFontMgrFactory extends Host implements FontMgrFactory {
6
+ constructor(CanvasKit: CanvasKit);
7
+ System(): JsiSkFontMgr;
8
+ }
@@ -0,0 +1,21 @@
1
+ import { Host } from "./Host";
2
+ import { JsiSkFontMgr } from "./JsiSkFontMgr";
3
+ export class JsiSkFontMgrFactory extends Host {
4
+ constructor(CanvasKit) {
5
+ super(CanvasKit);
6
+ }
7
+
8
+ System() {
9
+ const fontMgr = this.CanvasKit.TypefaceFontProvider.Make();
10
+
11
+ if (!fontMgr) {
12
+ throw new Error("Couldn't create system font manager");
13
+ } // eslint-disable-next-line @typescript-eslint/ban-ts-comment
14
+ // @ts-expect-error
15
+
16
+
17
+ return new JsiSkFontMgr(this.CanvasKit, fontMgr);
18
+ }
19
+
20
+ }
21
+ //# sourceMappingURL=JsiSkFontMgrFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Host","JsiSkFontMgr","JsiSkFontMgrFactory","constructor","CanvasKit","System","fontMgr","TypefaceFontProvider","Make","Error"],"sources":["JsiSkFontMgrFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { FontMgrFactory } from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkFontMgr } from \"./JsiSkFontMgr\";\n\nexport class JsiSkFontMgrFactory extends Host implements FontMgrFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n System() {\n const fontMgr = this.CanvasKit.TypefaceFontProvider.Make();\n if (!fontMgr) {\n throw new Error(\"Couldn't create system font manager\");\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n return new JsiSkFontMgr(this.CanvasKit, fontMgr);\n }\n}\n"],"mappings":"AAIA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA,OAAO,MAAMC,mBAAN,SAAkCF,IAAlC,CAAiE;EACtEG,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,MAAM,GAAG;IACP,MAAMC,OAAO,GAAG,KAAKF,SAAL,CAAeG,oBAAf,CAAoCC,IAApC,EAAhB;;IACA,IAAI,CAACF,OAAL,EAAc;MACZ,MAAM,IAAIG,KAAJ,CAAU,qCAAV,CAAN;IACD,CAJM,CAKP;IACA;;;IACA,OAAO,IAAIR,YAAJ,CAAiB,KAAKG,SAAtB,EAAiCE,OAAjC,CAAP;EACD;;AAbqE"}
@@ -0,0 +1,13 @@
1
+ import type { CanvasKit, TypefaceFontProvider } from "canvaskit-wasm";
2
+ import type { SkTypefaceFontProvider } from "../types/Paragraph/TypefaceFontProvider";
3
+ import type { FontStyle, SkTypeface } from "../types";
4
+ import { HostObject } from "./Host";
5
+ export declare class JsiSkTypefaceFontProvider extends HostObject<TypefaceFontProvider, "FontMgr"> implements SkTypefaceFontProvider {
6
+ private allocatedPointers;
7
+ constructor(CanvasKit: CanvasKit, ref: TypefaceFontProvider);
8
+ matchFamilyStyle(_name: string, _style: FontStyle): SkTypeface;
9
+ countFamilies(): any;
10
+ getFamilyName(index: number): any;
11
+ registerFont(typeface: SkTypeface, familyName: string): void;
12
+ dispose(): void;
13
+ }
@@ -0,0 +1,80 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { HostObject, NotImplementedOnRNWeb } from "./Host";
4
+ export class JsiSkTypefaceFontProvider extends HostObject {
5
+ constructor(CanvasKit, ref) {
6
+ super(CanvasKit, ref, "FontMgr");
7
+
8
+ _defineProperty(this, "allocatedPointers", []);
9
+ }
10
+
11
+ matchFamilyStyle(_name, _style) {
12
+ throw new NotImplementedOnRNWeb();
13
+ }
14
+
15
+ countFamilies() {
16
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
17
+ // @ts-expect-error
18
+ return this.ref.countFamilies();
19
+ }
20
+
21
+ getFamilyName(index) {
22
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23
+ // @ts-expect-error
24
+ return this.ref.getFamilyName(index);
25
+ }
26
+
27
+ registerFont(typeface, familyName) {
28
+ const strLen = lengthBytesUTF8(familyName) + 1; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
29
+ // @ts-expect-error
30
+
31
+ const strPtr = this.CanvasKit._malloc(strLen);
32
+
33
+ stringToUTF8(this.CanvasKit, familyName, strPtr, strLen); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
34
+ // @ts-expect-error
35
+
36
+ this.ref._registerFont(typeface.ref, strPtr);
37
+ }
38
+
39
+ dispose() {
40
+ for (const ptr of this.allocatedPointers) {
41
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
+ // @ts-expect-error
43
+ this.CanvasKit._free(ptr);
44
+ }
45
+
46
+ this.ref.delete();
47
+ }
48
+
49
+ }
50
+
51
+ const lengthBytesUTF8 = str => {
52
+ // TextEncoder will give us the byte length in UTF8 form
53
+ const encoder = new TextEncoder();
54
+ const utf8 = encoder.encode(str);
55
+ return utf8.length;
56
+ };
57
+
58
+ const stringToUTF8 = (CanvasKit, str, outPtr, maxBytesToWrite) => {
59
+ // TextEncoder will give us the byte array in UTF8 form
60
+ const encoder = new TextEncoder();
61
+ const utf8 = encoder.encode(str); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
62
+ // @ts-expect-error
63
+
64
+ const heap = CanvasKit.HEAPU8; // Check if there's enough space
65
+
66
+ if (utf8.length > maxBytesToWrite) {
67
+ throw new Error("Not enough space to write UTF8 encoded string");
68
+ } // Copy the bytes
69
+
70
+
71
+ for (let i = 0; i < utf8.length; i++) {
72
+ heap[outPtr + i] = utf8[i];
73
+ } // Null terminate
74
+
75
+
76
+ if (utf8.length < maxBytesToWrite) {
77
+ heap[outPtr + utf8.length] = 0;
78
+ }
79
+ };
80
+ //# sourceMappingURL=JsiSkTypefaceFontProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["HostObject","NotImplementedOnRNWeb","JsiSkTypefaceFontProvider","constructor","CanvasKit","ref","matchFamilyStyle","_name","_style","countFamilies","getFamilyName","index","registerFont","typeface","familyName","strLen","lengthBytesUTF8","strPtr","_malloc","stringToUTF8","_registerFont","dispose","ptr","allocatedPointers","_free","delete","str","encoder","TextEncoder","utf8","encode","length","outPtr","maxBytesToWrite","heap","HEAPU8","Error","i"],"sources":["JsiSkTypefaceFontProvider.ts"],"sourcesContent":["import type { CanvasKit, TypefaceFontProvider } from \"canvaskit-wasm\";\n\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\nimport type { FontStyle, SkTypeface } from \"../types\";\n\nimport { HostObject, NotImplementedOnRNWeb } from \"./Host\";\n\nexport class JsiSkTypefaceFontProvider\n extends HostObject<TypefaceFontProvider, \"FontMgr\">\n implements SkTypefaceFontProvider\n{\n private allocatedPointers: number[] = [];\n\n constructor(CanvasKit: CanvasKit, ref: TypefaceFontProvider) {\n super(CanvasKit, ref, \"FontMgr\");\n }\n\n matchFamilyStyle(_name: string, _style: FontStyle): SkTypeface {\n throw new NotImplementedOnRNWeb();\n }\n countFamilies() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n return this.ref.countFamilies();\n }\n getFamilyName(index: number) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n return this.ref.getFamilyName(index);\n }\n registerFont(typeface: SkTypeface, familyName: string) {\n const strLen = lengthBytesUTF8(familyName) + 1;\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n const strPtr = this.CanvasKit._malloc(strLen);\n stringToUTF8(this.CanvasKit, familyName, strPtr, strLen);\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n this.ref._registerFont(typeface.ref, strPtr);\n }\n\n dispose() {\n for (const ptr of this.allocatedPointers) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n this.CanvasKit._free(ptr);\n }\n\n this.ref.delete();\n }\n}\n\nconst lengthBytesUTF8 = (str: string) => {\n // TextEncoder will give us the byte length in UTF8 form\n const encoder = new TextEncoder();\n const utf8 = encoder.encode(str);\n return utf8.length;\n};\n\nconst stringToUTF8 = (\n CanvasKit: CanvasKit,\n str: string,\n outPtr: number,\n maxBytesToWrite: number\n) => {\n // TextEncoder will give us the byte array in UTF8 form\n const encoder = new TextEncoder();\n const utf8 = encoder.encode(str);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n const heap: Int8Array = CanvasKit.HEAPU8;\n\n // Check if there's enough space\n if (utf8.length > maxBytesToWrite) {\n throw new Error(\"Not enough space to write UTF8 encoded string\");\n }\n\n // Copy the bytes\n for (let i = 0; i < utf8.length; i++) {\n heap[outPtr + i] = utf8[i];\n }\n\n // Null terminate\n if (utf8.length < maxBytesToWrite) {\n heap[outPtr + utf8.length] = 0;\n }\n};\n"],"mappings":";;AAKA,SAASA,UAAT,EAAqBC,qBAArB,QAAkD,QAAlD;AAEA,OAAO,MAAMC,yBAAN,SACGF,UADH,CAGP;EAGEG,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAkD;IAC3D,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,SAAtB;;IAD2D,2CAFvB,EAEuB;EAE5D;;EAEDC,gBAAgB,CAACC,KAAD,EAAgBC,MAAhB,EAA+C;IAC7D,MAAM,IAAIP,qBAAJ,EAAN;EACD;;EACDQ,aAAa,GAAG;IACd;IACA;IACA,OAAO,KAAKJ,GAAL,CAASI,aAAT,EAAP;EACD;;EACDC,aAAa,CAACC,KAAD,EAAgB;IAC3B;IACA;IACA,OAAO,KAAKN,GAAL,CAASK,aAAT,CAAuBC,KAAvB,CAAP;EACD;;EACDC,YAAY,CAACC,QAAD,EAAuBC,UAAvB,EAA2C;IACrD,MAAMC,MAAM,GAAGC,eAAe,CAACF,UAAD,CAAf,GAA8B,CAA7C,CADqD,CAGrD;IACA;;IACA,MAAMG,MAAM,GAAG,KAAKb,SAAL,CAAec,OAAf,CAAuBH,MAAvB,CAAf;;IACAI,YAAY,CAAC,KAAKf,SAAN,EAAiBU,UAAjB,EAA6BG,MAA7B,EAAqCF,MAArC,CAAZ,CANqD,CAQrD;IACA;;IACA,KAAKV,GAAL,CAASe,aAAT,CAAuBP,QAAQ,CAACR,GAAhC,EAAqCY,MAArC;EACD;;EAEDI,OAAO,GAAG;IACR,KAAK,MAAMC,GAAX,IAAkB,KAAKC,iBAAvB,EAA0C;MACxC;MACA;MACA,KAAKnB,SAAL,CAAeoB,KAAf,CAAqBF,GAArB;IACD;;IAED,KAAKjB,GAAL,CAASoB,MAAT;EACD;;AAzCH;;AA4CA,MAAMT,eAAe,GAAIU,GAAD,IAAiB;EACvC;EACA,MAAMC,OAAO,GAAG,IAAIC,WAAJ,EAAhB;EACA,MAAMC,IAAI,GAAGF,OAAO,CAACG,MAAR,CAAeJ,GAAf,CAAb;EACA,OAAOG,IAAI,CAACE,MAAZ;AACD,CALD;;AAOA,MAAMZ,YAAY,GAAG,CACnBf,SADmB,EAEnBsB,GAFmB,EAGnBM,MAHmB,EAInBC,eAJmB,KAKhB;EACH;EACA,MAAMN,OAAO,GAAG,IAAIC,WAAJ,EAAhB;EACA,MAAMC,IAAI,GAAGF,OAAO,CAACG,MAAR,CAAeJ,GAAf,CAAb,CAHG,CAIH;EACA;;EACA,MAAMQ,IAAe,GAAG9B,SAAS,CAAC+B,MAAlC,CANG,CAQH;;EACA,IAAIN,IAAI,CAACE,MAAL,GAAcE,eAAlB,EAAmC;IACjC,MAAM,IAAIG,KAAJ,CAAU,+CAAV,CAAN;EACD,CAXE,CAaH;;;EACA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGR,IAAI,CAACE,MAAzB,EAAiCM,CAAC,EAAlC,EAAsC;IACpCH,IAAI,CAACF,MAAM,GAAGK,CAAV,CAAJ,GAAmBR,IAAI,CAACQ,CAAD,CAAvB;EACD,CAhBE,CAkBH;;;EACA,IAAIR,IAAI,CAACE,MAAL,GAAcE,eAAlB,EAAmC;IACjCC,IAAI,CAACF,MAAM,GAAGH,IAAI,CAACE,MAAf,CAAJ,GAA6B,CAA7B;EACD;AACF,CA3BD"}
@@ -0,0 +1,7 @@
1
+ import type { CanvasKit } from "canvaskit-wasm";
2
+ import { Host } from "./Host";
3
+ import { JsiSkTypefaceFontProvider } from "./JsiSkTypefaceFontProvider";
4
+ export declare class JsiSkTypefaceFontProviderFactory extends Host implements JsiSkTypefaceFontProviderFactory {
5
+ constructor(CanvasKit: CanvasKit);
6
+ Make(): JsiSkTypefaceFontProvider;
7
+ }
@@ -0,0 +1,14 @@
1
+ import { Host } from "./Host";
2
+ import { JsiSkTypefaceFontProvider } from "./JsiSkTypefaceFontProvider";
3
+ export class JsiSkTypefaceFontProviderFactory extends Host {
4
+ constructor(CanvasKit) {
5
+ super(CanvasKit);
6
+ }
7
+
8
+ Make() {
9
+ const tf = this.CanvasKit.TypefaceFontProvider.Make();
10
+ return new JsiSkTypefaceFontProvider(this.CanvasKit, tf);
11
+ }
12
+
13
+ }
14
+ //# sourceMappingURL=JsiSkTypefaceFontProviderFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Host","JsiSkTypefaceFontProvider","JsiSkTypefaceFontProviderFactory","constructor","CanvasKit","Make","tf","TypefaceFontProvider"],"sources":["JsiSkTypefaceFontProviderFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkTypefaceFontProvider } from \"./JsiSkTypefaceFontProvider\";\n\nexport class JsiSkTypefaceFontProviderFactory\n extends Host\n implements JsiSkTypefaceFontProviderFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n Make() {\n const tf = this.CanvasKit.TypefaceFontProvider.Make();\n return new JsiSkTypefaceFontProvider(this.CanvasKit, tf);\n }\n}\n"],"mappings":"AAEA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,yBAAT,QAA0C,6BAA1C;AAEA,OAAO,MAAMC,gCAAN,SACGF,IADH,CAGP;EACEG,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,IAAI,GAAG;IACL,MAAMC,EAAE,GAAG,KAAKF,SAAL,CAAeG,oBAAf,CAAoCF,IAApC,EAAX;IACA,OAAO,IAAIJ,yBAAJ,CAA8B,KAAKG,SAAnC,EAA8CE,EAA9C,CAAP;EACD;;AARH"}
@@ -25,6 +25,8 @@ import { JsiSkFont } from "./JsiSkFont";
25
25
  import { MakeVertices } from "./JsiSkVerticesFactory";
26
26
  import { JsiSkPath } from "./JsiSkPath";
27
27
  import { JsiSkTypeface } from "./JsiSkTypeface";
28
+ import { JsiSkTypefaceFontProviderFactory } from "./JsiSkTypefaceFontProviderFactory";
29
+ import { JsiSkFontMgrFactory } from "./JsiSkFontMgrFactory";
28
30
  export const JsiSkApi = CanvasKit => ({
29
31
  Point: (x, y) => new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),
30
32
  RuntimeShaderBuilder: _ => {
@@ -59,6 +61,8 @@ export const JsiSkApi = CanvasKit => ({
59
61
  XYWHRect: (x, y, width, height) => {
60
62
  return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));
61
63
  },
62
- Surface: new JsiSkSurfaceFactory(CanvasKit)
64
+ Surface: new JsiSkSurfaceFactory(CanvasKit),
65
+ TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),
66
+ FontMgr: new JsiSkFontMgrFactory(CanvasKit)
63
67
  });
64
68
  //# sourceMappingURL=JsiSkia.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","ContourMeasureIter","path","forceClosed","resScale","fromValue","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","SVG","TextBlob","XYWHRect","width","height","Surface"],"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\";\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 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 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});\n"],"mappings":"AAYA,SAASA,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,KAAT,QAAsB,cAAtB;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,yBAAT,QAA0C,6BAA1C;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,YAAT,QAA6B,wBAA7B;AAC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K,EAAE,IAAIrD,iBAAJ,CAAsBQ,SAAtB,CAzDgD;EA0DvD8C,GAAG,EAAE,IAAIrD,eAAJ,CAAoBO,SAApB,CA1DkD;EA2DvD+C,QAAQ,EAAE,IAAIrD,oBAAJ,CAAyBM,SAAzB,CA3D6C;EA4DvDgD,QAAQ,EAAE,CAAC9C,CAAD,EAAYC,CAAZ,EAAuB8C,KAAvB,EAAsCC,MAAtC,KAAyD;IACjE,OAAO,IAAI5E,SAAJ,CAAc0B,SAAd,EAAyBA,SAAS,CAACgD,QAAV,CAAmB9C,CAAnB,EAAsBC,CAAtB,EAAyB8C,KAAzB,EAAgCC,MAAhC,CAAzB,CAAP;EACD,CA9DsD;EA+DvDC,OAAO,EAAE,IAAI3E,mBAAJ,CAAwBwB,SAAxB;AA/D8C,CAAjC,CAAjB"}
1
+ {"version":3,"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkTypefaceFontProviderFactory","JsiSkFontMgrFactory","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","Error","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","ContourMeasureIter","path","forceClosed","resScale","fromValue","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","SVG","TextBlob","XYWHRect","width","height","Surface","TypefaceFontProvider","FontMgr"],"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\";\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 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 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});\n"],"mappings":"AAYA,SAASA,UAAT,QAA2B,cAA3B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,KAAT,QAAsB,cAAtB;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,oBAAT,QAAqC,wBAArC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,yBAAT,QAA0C,6BAA1C;AACA,SAASC,uBAAT,QAAwC,2BAAxC;AACA,SAASC,kBAAT,QAAmC,sBAAnC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,oBAAT,QAAqC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A,YAAY,CAACiD,IAAb,CAAkB,IAAlB,EAAwB3C,SAAxB,CAvDyC;EAwDvD4C,IAAI,EAAE,IAAIvD,gBAAJ,CAAqBW,SAArB,CAxDiD;EAyDvD6C,KAAK,EAAE,IAAIvD,iBAAJ,CAAsBU,SAAtB,CAzDgD;EA0DvD8C,GAAG,EAAE,IAAIvD,eAAJ,CAAoBS,SAApB,CA1DkD;EA2DvD+C,QAAQ,EAAE,IAAIvD,oBAAJ,CAAyBQ,SAAzB,CA3D6C;EA4DvDgD,QAAQ,EAAE,CAAC9C,CAAD,EAAYC,CAAZ,EAAuB8C,KAAvB,EAAsCC,MAAtC,KAAyD;IACjE,OAAO,IAAI9E,SAAJ,CAAc4B,SAAd,EAAyBA,SAAS,CAACgD,QAAV,CAAmB9C,CAAnB,EAAsBC,CAAtB,EAAyB8C,KAAzB,EAAgCC,MAAhC,CAAzB,CAAP;EACD,CA9DsD;EA+DvDC,OAAO,EAAE,IAAI7E,mBAAJ,CAAwB0B,SAAxB,CA/D8C;EAgEvDoD,oBAAoB,EAAE,IAAIvD,gCAAJ,CAAqCG,SAArC,CAhEiC;EAiEvDqD,OAAO,EAAE,IAAIvD,mBAAJ,CAAwBE,SAAxB;AAjE8C,CAAjC,CAAjB"}
@@ -1,3 +1,5 @@
1
1
  import type { SkData, DataSourceParam, SkJSIInstance } from "../types";
2
+ export declare const loadData: <T>(source: DataSourceParam, factory: (data: SkData) => T | null, onError?: ((err: Error) => void) | undefined) => Promise<T | null>;
3
+ export declare const useCollectionLoading: <T extends SkJSIInstance<string>>(source: DataSourceParam[], loader: () => Promise<(T | null)[]>) => T[] | null;
2
4
  export declare const useRawData: <T extends SkJSIInstance<string>>(source: DataSourceParam, factory: (data: SkData) => T | null, onError?: ((err: Error) => void) | undefined) => T | null;
3
5
  export declare const useData: (source: DataSourceParam, onError?: ((err: Error) => void) | undefined) => SkData | null;
@@ -1,5 +1,18 @@
1
- import type { DataSourceParam } from "../types";
1
+ import type { DataModule, DataSourceParam, SkFontMgr } from "../types";
2
+ import type { SkTypefaceFontProvider } from "../types/Paragraph/TypefaceFontProvider";
2
3
  /**
3
4
  * Returns a Skia Font object
4
5
  * */
5
6
  export declare const useFont: (font: DataSourceParam, size?: number, onError?: ((err: Error) => void) | undefined) => import("../types").SkFont | null;
7
+ declare type Slant = "normal" | "italic" | "oblique";
8
+ declare type Weight = "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900";
9
+ interface RNFontStyle {
10
+ fontFamily: string;
11
+ fontSize: number;
12
+ fontStyle: Slant;
13
+ fontWeight: Weight;
14
+ }
15
+ export declare const matchFont: (inputStyle?: Partial<RNFontStyle>, fontMgr?: SkFontMgr) => import("../types").SkFont;
16
+ export declare const listFontFamilies: (fontMgr?: SkFontMgr) => string[];
17
+ export declare const useFonts: (sources: Record<string, DataModule[]>) => SkTypefaceFontProvider | null;
18
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { SkJSIInstance } from "../JsiInstance";
2
+ import type { SkTypeface } from "../Typeface";
3
+ import type { FontStyle } from "./Font";
4
+ export interface SkFontMgr extends SkJSIInstance<"FontMgr"> {
5
+ countFamilies(): number;
6
+ getFamilyName(index: number): string;
7
+ matchFamilyStyle(name: string, style: FontStyle): SkTypeface;
8
+ }
@@ -0,0 +1,4 @@
1
+ import type { SkFontMgr } from "./FontMgr";
2
+ export interface FontMgrFactory {
3
+ System(): SkFontMgr;
4
+ }
@@ -1 +1,3 @@
1
1
  export * from "./Font";
2
+ export * from "./FontMgr";
3
+ export * from "./FontMgrFactory";
@@ -0,0 +1,10 @@
1
+ import type { SkFontMgr } from "../Font";
2
+ import type { SkTypeface } from "../Typeface";
3
+ export interface SkTypefaceFontProvider extends SkFontMgr {
4
+ /**
5
+ * Registers a given typeface with the given family name.
6
+ * @param typeface - Typeface.
7
+ * @param family
8
+ */
9
+ registerFont(typeface: SkTypeface, familyName: string): void;
10
+ }
@@ -0,0 +1,4 @@
1
+ import type { SkTypefaceFontProvider } from "./TypefaceFontProvider";
2
+ export interface TypefaceFontProviderFactory {
3
+ Make(): SkTypefaceFontProvider;
4
+ }
@@ -1,7 +1,7 @@
1
1
  import type { ImageFilterFactory } from "./ImageFilter";
2
2
  import type { PathFactory } from "./Path";
3
3
  import type { ColorFilterFactory } from "./ColorFilter";
4
- import type { SkFont } from "./Font";
4
+ import type { SkFont, FontMgrFactory } from "./Font";
5
5
  import type { SkTypeface, TypefaceFactory } from "./Typeface";
6
6
  import type { ImageFactory } from "./Image";
7
7
  import type { MaskFilterFactory } from "./MaskFilter";
@@ -23,6 +23,7 @@ import type { SkPath } from "./Path/Path";
23
23
  import type { SkContourMeasureIter } from "./ContourMeasure";
24
24
  import type { PictureFactory, SkPictureRecorder } from "./Picture";
25
25
  import type { Color, SkColor } from "./Color";
26
+ import type { TypefaceFontProviderFactory } from "./Paragraph/TypefaceFontProviderFactory";
26
27
  /**
27
28
  * Declares the interface for the native Skia API
28
29
  */
@@ -42,6 +43,8 @@ export interface Skia {
42
43
  ColorFilter: ColorFilterFactory;
43
44
  Font: (typeface?: SkTypeface, size?: number) => SkFont;
44
45
  Typeface: TypefaceFactory;
46
+ TypefaceFontProvider: TypefaceFontProviderFactory;
47
+ FontMgr: FontMgrFactory;
45
48
  MaskFilter: MaskFilterFactory;
46
49
  RuntimeEffect: RuntimeEffectFactory;
47
50
  ImageFilter: ImageFilterFactory;
@@ -11,7 +11,7 @@ export declare abstract class BaseHostObject<T, N extends string> extends Host i
11
11
  readonly __typename__: N;
12
12
  ref: T;
13
13
  constructor(CanvasKit: CanvasKit, ref: T, typename: N);
14
- abstract dispose: () => void;
14
+ abstract dispose(): void;
15
15
  }
16
16
  export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
17
17
  static fromValue<T>(value: SkJSIInstance<string>): T;
@@ -0,0 +1,10 @@
1
+ import type { CanvasKit, FontMgr } from "canvaskit-wasm";
2
+ import type { FontStyle, SkFontMgr, SkTypeface } from "../types";
3
+ import { HostObject } from "./Host";
4
+ export declare class JsiSkFontMgr extends HostObject<FontMgr, "FontMgr"> implements SkFontMgr {
5
+ constructor(CanvasKit: CanvasKit, ref: FontMgr);
6
+ dispose(): void;
7
+ countFamilies(): number;
8
+ getFamilyName(index: number): string;
9
+ matchFamilyStyle(_familyName: string, _fontStyle: FontStyle): SkTypeface;
10
+ }
@@ -0,0 +1,8 @@
1
+ import type { CanvasKit } from "canvaskit-wasm";
2
+ import type { FontMgrFactory } from "../types";
3
+ import { Host } from "./Host";
4
+ import { JsiSkFontMgr } from "./JsiSkFontMgr";
5
+ export declare class JsiSkFontMgrFactory extends Host implements FontMgrFactory {
6
+ constructor(CanvasKit: CanvasKit);
7
+ System(): JsiSkFontMgr;
8
+ }
@@ -0,0 +1,13 @@
1
+ import type { CanvasKit, TypefaceFontProvider } from "canvaskit-wasm";
2
+ import type { SkTypefaceFontProvider } from "../types/Paragraph/TypefaceFontProvider";
3
+ import type { FontStyle, SkTypeface } from "../types";
4
+ import { HostObject } from "./Host";
5
+ export declare class JsiSkTypefaceFontProvider extends HostObject<TypefaceFontProvider, "FontMgr"> implements SkTypefaceFontProvider {
6
+ private allocatedPointers;
7
+ constructor(CanvasKit: CanvasKit, ref: TypefaceFontProvider);
8
+ matchFamilyStyle(_name: string, _style: FontStyle): SkTypeface;
9
+ countFamilies(): any;
10
+ getFamilyName(index: number): any;
11
+ registerFont(typeface: SkTypeface, familyName: string): void;
12
+ dispose(): void;
13
+ }
@@ -0,0 +1,7 @@
1
+ import type { CanvasKit } from "canvaskit-wasm";
2
+ import { Host } from "./Host";
3
+ import { JsiSkTypefaceFontProvider } from "./JsiSkTypefaceFontProvider";
4
+ export declare class JsiSkTypefaceFontProviderFactory extends Host implements JsiSkTypefaceFontProviderFactory {
5
+ constructor(CanvasKit: CanvasKit);
6
+ Make(): JsiSkTypefaceFontProvider;
7
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file