@shopify/react-native-skia 0.1.222 → 0.1.224
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkApi.h +6 -1
- package/cpp/api/JsiSkFontMgrFactory.h +9 -4
- package/cpp/api/JsiSkParagraph.h +135 -0
- package/cpp/api/JsiSkParagraphBuilder.h +159 -0
- package/cpp/api/JsiSkParagraphStyle.h +124 -0
- package/cpp/api/JsiSkStrutStyle.h +96 -0
- package/cpp/api/JsiSkTextStyle.h +185 -0
- package/cpp/api/{JsiSkTypeFaceFontProviderFactory.h → JsiSkTypefaceFontProviderFactory.h} +1 -1
- package/cpp/jsi/JsiHostObject.h +21 -0
- package/cpp/rnskia/dom/JsiDomApi.h +4 -0
- package/cpp/rnskia/dom/nodes/JsiParagraphNode.h +62 -0
- package/cpp/rnskia/dom/props/ParagraphProp.h +45 -0
- package/cpp/skia/modules/skunicode/include/SkUnicode.h +312 -0
- package/cpp/skia/src/base/SkTInternalLList.h +304 -0
- package/cpp/skia/src/base/SkUTF.h +95 -0
- package/cpp/skia/src/core/SkLRUCache.h +130 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +2 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +7 -0
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/ParagraphNode.d.ts +8 -0
- package/lib/commonjs/dom/nodes/drawings/ParagraphNode.js +41 -0
- package/lib/commonjs/dom/nodes/drawings/ParagraphNode.js.map +1 -0
- package/lib/commonjs/dom/types/NodeType.d.ts +2 -1
- package/lib/commonjs/dom/types/NodeType.js +1 -0
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/dom/types/Paragraph.d.ts +8 -0
- package/lib/commonjs/dom/types/Paragraph.js +6 -0
- package/lib/commonjs/dom/types/Paragraph.js.map +1 -0
- package/lib/commonjs/dom/types/SkDOM.d.ts +2 -0
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/dom/types/index.d.ts +1 -0
- package/lib/commonjs/dom/types/index.js +13 -0
- package/lib/commonjs/dom/types/index.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.d.ts +3 -1
- package/lib/commonjs/renderer/HostComponents.js +4 -0
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/components/index.d.ts +1 -0
- package/lib/commonjs/renderer/components/index.js +13 -0
- package/lib/commonjs/renderer/components/index.js.map +1 -1
- package/lib/commonjs/renderer/components/paragraph/Paragraph.d.ts +4 -0
- package/lib/commonjs/renderer/components/paragraph/Paragraph.js +17 -0
- package/lib/commonjs/renderer/components/paragraph/Paragraph.js.map +1 -0
- package/lib/commonjs/renderer/components/paragraph/index.d.ts +1 -0
- package/lib/commonjs/renderer/components/paragraph/index.js +19 -0
- package/lib/commonjs/renderer/components/paragraph/index.js.map +1 -0
- package/lib/commonjs/skia/types/Paragraph/Paragraph.d.ts +56 -0
- package/lib/commonjs/skia/types/Paragraph/Paragraph.js +6 -0
- package/lib/commonjs/skia/types/Paragraph/Paragraph.js.map +1 -0
- package/lib/commonjs/skia/types/Paragraph/ParagraphBuilder.d.ts +60 -0
- package/lib/commonjs/skia/types/Paragraph/ParagraphBuilder.js +18 -0
- package/lib/commonjs/skia/types/Paragraph/ParagraphBuilder.js.map +1 -0
- package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.d.ts +41 -0
- package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.js +36 -0
- package/lib/commonjs/skia/types/Paragraph/ParagraphStyle.js.map +1 -0
- package/lib/commonjs/skia/types/Paragraph/TextStyle.d.ts +62 -0
- package/lib/commonjs/skia/types/Paragraph/TextStyle.js +35 -0
- package/lib/commonjs/skia/types/Paragraph/TextStyle.js.map +1 -0
- package/lib/commonjs/skia/types/Paragraph/index.d.ts +6 -0
- package/lib/commonjs/skia/types/Paragraph/index.js +84 -0
- package/lib/commonjs/skia/types/Paragraph/index.js.map +1 -0
- package/lib/commonjs/skia/types/Skia.d.ts +2 -0
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/types/index.d.ts +1 -0
- package/lib/commonjs/skia/types/index.js +13 -0
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkParagraph.d.ts +16 -0
- package/lib/commonjs/skia/web/JsiSkParagraph.js +91 -0
- package/lib/commonjs/skia/web/JsiSkParagraph.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkParagraphBuilder.d.ts +15 -0
- package/lib/commonjs/skia/web/JsiSkParagraphBuilder.js +85 -0
- package/lib/commonjs/skia/web/JsiSkParagraphBuilder.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkParagraphBuilderFactory.d.ts +8 -0
- package/lib/commonjs/skia/web/JsiSkParagraphBuilderFactory.js +34 -0
- package/lib/commonjs/skia/web/JsiSkParagraphBuilderFactory.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkParagraphStyle.d.ts +5 -0
- package/lib/commonjs/skia/web/JsiSkParagraphStyle.js +59 -0
- package/lib/commonjs/skia/web/JsiSkParagraphStyle.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkTextStyle.d.ts +5 -0
- package/lib/commonjs/skia/web/JsiSkTextStyle.js +54 -0
- package/lib/commonjs/skia/web/JsiSkTextStyle.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkia.js +4 -1
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +2 -0
- package/lib/module/dom/nodes/JsiSkDOM.js +6 -0
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/drawings/ParagraphNode.d.ts +8 -0
- package/lib/module/dom/nodes/drawings/ParagraphNode.js +30 -0
- package/lib/module/dom/nodes/drawings/ParagraphNode.js.map +1 -0
- package/lib/module/dom/types/NodeType.d.ts +2 -1
- package/lib/module/dom/types/NodeType.js +1 -0
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/dom/types/Paragraph.d.ts +8 -0
- package/lib/module/dom/types/Paragraph.js +2 -0
- package/lib/module/dom/types/Paragraph.js.map +1 -0
- package/lib/module/dom/types/SkDOM.d.ts +2 -0
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/dom/types/index.d.ts +1 -0
- package/lib/module/dom/types/index.js +1 -0
- package/lib/module/dom/types/index.js.map +1 -1
- package/lib/module/renderer/HostComponents.d.ts +3 -1
- package/lib/module/renderer/HostComponents.js +4 -0
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/components/index.d.ts +1 -0
- package/lib/module/renderer/components/index.js +1 -0
- package/lib/module/renderer/components/index.js.map +1 -1
- package/lib/module/renderer/components/paragraph/Paragraph.d.ts +4 -0
- package/lib/module/renderer/components/paragraph/Paragraph.js +5 -0
- package/lib/module/renderer/components/paragraph/Paragraph.js.map +1 -0
- package/lib/module/renderer/components/paragraph/index.d.ts +1 -0
- package/lib/module/renderer/components/paragraph/index.js +2 -0
- package/lib/module/renderer/components/paragraph/index.js.map +1 -0
- package/lib/module/skia/types/Paragraph/Paragraph.d.ts +56 -0
- package/lib/module/skia/types/Paragraph/Paragraph.js +2 -0
- package/lib/module/skia/types/Paragraph/Paragraph.js.map +1 -0
- package/lib/module/skia/types/Paragraph/ParagraphBuilder.d.ts +60 -0
- package/lib/module/skia/types/Paragraph/ParagraphBuilder.js +11 -0
- package/lib/module/skia/types/Paragraph/ParagraphBuilder.js.map +1 -0
- package/lib/module/skia/types/Paragraph/ParagraphStyle.d.ts +41 -0
- package/lib/module/skia/types/Paragraph/ParagraphStyle.js +27 -0
- package/lib/module/skia/types/Paragraph/ParagraphStyle.js.map +1 -0
- package/lib/module/skia/types/Paragraph/TextStyle.d.ts +62 -0
- package/lib/module/skia/types/Paragraph/TextStyle.js +26 -0
- package/lib/module/skia/types/Paragraph/TextStyle.js.map +1 -0
- package/lib/module/skia/types/Paragraph/index.d.ts +6 -0
- package/lib/module/skia/types/Paragraph/index.js +7 -0
- package/lib/module/skia/types/Paragraph/index.js.map +1 -0
- package/lib/module/skia/types/Skia.d.ts +2 -0
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/types/index.d.ts +1 -0
- package/lib/module/skia/types/index.js +1 -0
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraph.d.ts +16 -0
- package/lib/module/skia/web/JsiSkParagraph.js +81 -0
- package/lib/module/skia/web/JsiSkParagraph.js.map +1 -0
- package/lib/module/skia/web/JsiSkParagraphBuilder.d.ts +15 -0
- package/lib/module/skia/web/JsiSkParagraphBuilder.js +73 -0
- package/lib/module/skia/web/JsiSkParagraphBuilder.js.map +1 -0
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.d.ts +8 -0
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js +21 -0
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js.map +1 -0
- package/lib/module/skia/web/JsiSkParagraphStyle.d.ts +5 -0
- package/lib/module/skia/web/JsiSkParagraphStyle.js +49 -0
- package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -0
- package/lib/module/skia/web/JsiSkTextStyle.d.ts +5 -0
- package/lib/module/skia/web/JsiSkTextStyle.js +45 -0
- package/lib/module/skia/web/JsiSkTextStyle.js.map +1 -0
- package/lib/module/skia/web/JsiSkia.js +3 -1
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +2 -0
- package/lib/typescript/src/dom/nodes/drawings/ParagraphNode.d.ts +8 -0
- package/lib/typescript/src/dom/types/NodeType.d.ts +2 -1
- package/lib/typescript/src/dom/types/Paragraph.d.ts +8 -0
- package/lib/typescript/src/dom/types/SkDOM.d.ts +2 -0
- package/lib/typescript/src/dom/types/index.d.ts +1 -0
- package/lib/typescript/src/renderer/HostComponents.d.ts +3 -1
- package/lib/typescript/src/renderer/components/index.d.ts +1 -0
- package/lib/typescript/src/renderer/components/paragraph/Paragraph.d.ts +4 -0
- package/lib/typescript/src/renderer/components/paragraph/index.d.ts +1 -0
- package/lib/typescript/src/skia/types/Paragraph/Paragraph.d.ts +56 -0
- package/lib/typescript/src/skia/types/Paragraph/ParagraphBuilder.d.ts +60 -0
- package/lib/typescript/src/skia/types/Paragraph/ParagraphStyle.d.ts +41 -0
- package/lib/typescript/src/skia/types/Paragraph/TextStyle.d.ts +62 -0
- package/lib/typescript/src/skia/types/Paragraph/index.d.ts +6 -0
- package/lib/typescript/src/skia/types/Skia.d.ts +2 -0
- package/lib/typescript/src/skia/types/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkParagraph.d.ts +16 -0
- package/lib/typescript/src/skia/web/JsiSkParagraphBuilder.d.ts +15 -0
- package/lib/typescript/src/skia/web/JsiSkParagraphBuilderFactory.d.ts +8 -0
- package/lib/typescript/src/skia/web/JsiSkParagraphStyle.d.ts +5 -0
- package/lib/typescript/src/skia/web/JsiSkTextStyle.d.ts +5 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +5 -5
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/Info.plist +5 -5
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/src/dom/nodes/JsiSkDOM.ts +9 -0
- package/src/dom/nodes/drawings/ParagraphNode.ts +22 -0
- package/src/dom/types/NodeType.ts +3 -0
- package/src/dom/types/Paragraph.ts +10 -0
- package/src/dom/types/SkDOM.ts +4 -0
- package/src/dom/types/index.ts +1 -0
- package/src/renderer/HostComponents.ts +10 -0
- package/src/renderer/components/index.ts +2 -0
- package/src/renderer/components/paragraph/Paragraph.tsx +8 -0
- package/src/renderer/components/paragraph/index.ts +1 -0
- package/src/skia/types/Paragraph/Paragraph.ts +59 -0
- package/src/skia/types/Paragraph/ParagraphBuilder.ts +96 -0
- package/src/skia/types/Paragraph/ParagraphStyle.ts +45 -0
- package/src/skia/types/Paragraph/TextStyle.ts +70 -0
- package/src/skia/types/Paragraph/index.ts +6 -0
- package/src/skia/types/Skia.ts +3 -0
- package/src/skia/types/index.ts +1 -0
- package/src/skia/web/JsiSkParagraph.ts +69 -0
- package/src/skia/web/JsiSkParagraphBuilder.ts +99 -0
- package/src/skia/web/JsiSkParagraphBuilderFactory.ts +42 -0
- package/src/skia/web/JsiSkParagraphStyle.ts +65 -0
- package/src/skia/web/JsiSkTextStyle.ts +53 -0
- package/src/skia/web/JsiSkia.ts +2 -0
- /package/cpp/api/{JsiSkTypeFaceFontProvider.h → JsiSkTypefaceFontProvider.h} +0 -0
@@ -0,0 +1,81 @@
|
|
1
|
+
import { HostObject } from "./Host";
|
2
|
+
export class JsiSkParagraph extends HostObject {
|
3
|
+
constructor(CanvasKit, ref) {
|
4
|
+
super(CanvasKit, ref, "Paragraph");
|
5
|
+
}
|
6
|
+
|
7
|
+
layout(width) {
|
8
|
+
this.ref.layout(width);
|
9
|
+
}
|
10
|
+
|
11
|
+
paint(canvas, x, y) {
|
12
|
+
canvas.ref.drawParagraph(this.ref, x, y);
|
13
|
+
}
|
14
|
+
|
15
|
+
getHeight() {
|
16
|
+
return this.ref.getHeight();
|
17
|
+
}
|
18
|
+
|
19
|
+
getMaxWidth() {
|
20
|
+
return this.ref.getMaxWidth();
|
21
|
+
}
|
22
|
+
|
23
|
+
getGlyphPositionAtCoordinate(x, y) {
|
24
|
+
return this.ref.getGlyphPositionAtCoordinate(x, y).pos;
|
25
|
+
}
|
26
|
+
|
27
|
+
getRectsForPlaceholders() {
|
28
|
+
return this.ref.getRectsForPlaceholders().map(_ref => {
|
29
|
+
let {
|
30
|
+
rect,
|
31
|
+
dir
|
32
|
+
} = _ref;
|
33
|
+
return {
|
34
|
+
rect: {
|
35
|
+
x: rect.at(0),
|
36
|
+
y: rect.at(1),
|
37
|
+
width: rect.at(2),
|
38
|
+
height: rect.at(3)
|
39
|
+
},
|
40
|
+
direction: dir.value
|
41
|
+
};
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
getRectsForRange(start, end) {
|
46
|
+
return this.ref.getRectsForRange(start, end, {
|
47
|
+
value: 0
|
48
|
+
}
|
49
|
+
/** kTight */
|
50
|
+
, {
|
51
|
+
value: 0
|
52
|
+
}
|
53
|
+
/** kTight */
|
54
|
+
).map(_ref2 => {
|
55
|
+
let {
|
56
|
+
rect
|
57
|
+
} = _ref2;
|
58
|
+
return {
|
59
|
+
x: rect[0],
|
60
|
+
y: rect[1],
|
61
|
+
width: rect[2],
|
62
|
+
height: rect[3]
|
63
|
+
};
|
64
|
+
});
|
65
|
+
}
|
66
|
+
|
67
|
+
getLineMetrics() {
|
68
|
+
return this.ref.getLineMetrics().map((r, index) => ({
|
69
|
+
x: r.left,
|
70
|
+
y: index * r.height,
|
71
|
+
width: r.width,
|
72
|
+
height: r.height
|
73
|
+
}));
|
74
|
+
}
|
75
|
+
|
76
|
+
dispose() {
|
77
|
+
this.ref.delete();
|
78
|
+
}
|
79
|
+
|
80
|
+
}
|
81
|
+
//# sourceMappingURL=JsiSkParagraph.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["HostObject","JsiSkParagraph","constructor","CanvasKit","ref","layout","width","paint","canvas","x","y","drawParagraph","getHeight","getMaxWidth","getGlyphPositionAtCoordinate","pos","getRectsForPlaceholders","map","rect","dir","at","height","direction","value","getRectsForRange","start","end","getLineMetrics","r","index","left","dispose","delete"],"sources":["JsiSkParagraph.ts"],"sourcesContent":["import type { CanvasKit, Paragraph } from \"canvaskit-wasm\";\n\nimport type { SkRect, SkRectWithDirection, SkParagraph } from \"../types\";\n\nimport { HostObject } from \"./Host\";\nimport type { JsiSkCanvas } from \"./JsiSkCanvas\";\n\nexport class JsiSkParagraph\n extends HostObject<Paragraph, \"Paragraph\">\n implements SkParagraph\n{\n constructor(CanvasKit: CanvasKit, ref: Paragraph) {\n super(CanvasKit, ref, \"Paragraph\");\n }\n\n layout(width: number): void {\n this.ref.layout(width);\n }\n paint(canvas: JsiSkCanvas, x: number, y: number): void {\n canvas.ref.drawParagraph(this.ref, x, y);\n }\n getHeight(): number {\n return this.ref.getHeight();\n }\n getMaxWidth(): number {\n return this.ref.getMaxWidth();\n }\n getGlyphPositionAtCoordinate(x: number, y: number): number {\n return this.ref.getGlyphPositionAtCoordinate(x, y).pos;\n }\n getRectsForPlaceholders(): SkRectWithDirection[] {\n return this.ref.getRectsForPlaceholders().map(({ rect, dir }) => ({\n rect: {\n x: rect.at(0)!,\n y: rect.at(1)!,\n width: rect.at(2)!,\n height: rect.at(3)!,\n },\n direction: dir.value,\n }));\n }\n getRectsForRange(start: number, end: number): SkRect[] {\n return this.ref\n .getRectsForRange(\n start,\n end,\n { value: 0 } /** kTight */,\n { value: 0 } /** kTight */\n )\n .map(({ rect }) => ({\n x: rect[0],\n y: rect[1],\n width: rect[2],\n height: rect[3],\n }));\n }\n getLineMetrics(): SkRect[] {\n return this.ref.getLineMetrics().map((r, index) => ({\n x: r.left,\n y: index * r.height,\n width: r.width,\n height: r.height,\n }));\n }\n\n dispose() {\n this.ref.delete();\n }\n}\n"],"mappings":"AAIA,SAASA,UAAT,QAA2B,QAA3B;AAGA,OAAO,MAAMC,cAAN,SACGD,UADH,CAGP;EACEE,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAuC;IAChD,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,WAAtB;EACD;;EAEDC,MAAM,CAACC,KAAD,EAAsB;IAC1B,KAAKF,GAAL,CAASC,MAAT,CAAgBC,KAAhB;EACD;;EACDC,KAAK,CAACC,MAAD,EAAsBC,CAAtB,EAAiCC,CAAjC,EAAkD;IACrDF,MAAM,CAACJ,GAAP,CAAWO,aAAX,CAAyB,KAAKP,GAA9B,EAAmCK,CAAnC,EAAsCC,CAAtC;EACD;;EACDE,SAAS,GAAW;IAClB,OAAO,KAAKR,GAAL,CAASQ,SAAT,EAAP;EACD;;EACDC,WAAW,GAAW;IACpB,OAAO,KAAKT,GAAL,CAASS,WAAT,EAAP;EACD;;EACDC,4BAA4B,CAACL,CAAD,EAAYC,CAAZ,EAA+B;IACzD,OAAO,KAAKN,GAAL,CAASU,4BAAT,CAAsCL,CAAtC,EAAyCC,CAAzC,EAA4CK,GAAnD;EACD;;EACDC,uBAAuB,GAA0B;IAC/C,OAAO,KAAKZ,GAAL,CAASY,uBAAT,GAAmCC,GAAnC,CAAuC;MAAA,IAAC;QAAEC,IAAF;QAAQC;MAAR,CAAD;MAAA,OAAoB;QAChED,IAAI,EAAE;UACJT,CAAC,EAAES,IAAI,CAACE,EAAL,CAAQ,CAAR,CADC;UAEJV,CAAC,EAAEQ,IAAI,CAACE,EAAL,CAAQ,CAAR,CAFC;UAGJd,KAAK,EAAEY,IAAI,CAACE,EAAL,CAAQ,CAAR,CAHH;UAIJC,MAAM,EAAEH,IAAI,CAACE,EAAL,CAAQ,CAAR;QAJJ,CAD0D;QAOhEE,SAAS,EAAEH,GAAG,CAACI;MAPiD,CAApB;IAAA,CAAvC,CAAP;EASD;;EACDC,gBAAgB,CAACC,KAAD,EAAgBC,GAAhB,EAAuC;IACrD,OAAO,KAAKtB,GAAL,CACJoB,gBADI,CAEHC,KAFG,EAGHC,GAHG,EAIH;MAAEH,KAAK,EAAE;IAAT;IAAa;IAJV,EAKH;MAAEA,KAAK,EAAE;IAAT;IAAa;IALV,EAOJN,GAPI,CAOA;MAAA,IAAC;QAAEC;MAAF,CAAD;MAAA,OAAe;QAClBT,CAAC,EAAES,IAAI,CAAC,CAAD,CADW;QAElBR,CAAC,EAAEQ,IAAI,CAAC,CAAD,CAFW;QAGlBZ,KAAK,EAAEY,IAAI,CAAC,CAAD,CAHO;QAIlBG,MAAM,EAAEH,IAAI,CAAC,CAAD;MAJM,CAAf;IAAA,CAPA,CAAP;EAaD;;EACDS,cAAc,GAAa;IACzB,OAAO,KAAKvB,GAAL,CAASuB,cAAT,GAA0BV,GAA1B,CAA8B,CAACW,CAAD,EAAIC,KAAJ,MAAe;MAClDpB,CAAC,EAAEmB,CAAC,CAACE,IAD6C;MAElDpB,CAAC,EAAEmB,KAAK,GAAGD,CAAC,CAACP,MAFqC;MAGlDf,KAAK,EAAEsB,CAAC,CAACtB,KAHyC;MAIlDe,MAAM,EAAEO,CAAC,CAACP;IAJwC,CAAf,CAA9B,CAAP;EAMD;;EAEDU,OAAO,GAAG;IACR,KAAK3B,GAAL,CAAS4B,MAAT;EACD;;AAzDH"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { CanvasKit, ParagraphBuilder } from "canvaskit-wasm";
|
2
|
+
import type { SkParagraphBuilder, SkParagraph, SkTextStyle, SkPaint } from "../types";
|
3
|
+
import { PlaceholderAlignment, TextBaseline } from "../types";
|
4
|
+
import { HostObject } from "./Host";
|
5
|
+
export declare class JsiSkParagraphBuilder extends HostObject<ParagraphBuilder, "ParagraphBuilder"> implements SkParagraphBuilder {
|
6
|
+
constructor(CanvasKit: CanvasKit, ref: ParagraphBuilder);
|
7
|
+
addPlaceholder(width?: number | undefined, height?: number | undefined, alignment?: PlaceholderAlignment | undefined, baseline?: TextBaseline | undefined, offset?: number | undefined): SkParagraphBuilder;
|
8
|
+
addText(text: string): SkParagraphBuilder;
|
9
|
+
build(): SkParagraph;
|
10
|
+
reset(): void;
|
11
|
+
pushStyle(style: SkTextStyle, foregroundPaint?: SkPaint | undefined, backgroundPaint?: SkPaint | undefined): SkParagraphBuilder;
|
12
|
+
pop(): SkParagraphBuilder;
|
13
|
+
dispose(): void;
|
14
|
+
private makePaint;
|
15
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import { PlaceholderAlignment, TextBaseline } from "../types";
|
2
|
+
import { HostObject } from "./Host";
|
3
|
+
import { JsiSkParagraph } from "./JsiSkParagraph";
|
4
|
+
import { JsiSkTextStyle } from "./JsiSkTextStyle";
|
5
|
+
import { JsiSkPaint } from "./JsiSkPaint";
|
6
|
+
export class JsiSkParagraphBuilder extends HostObject {
|
7
|
+
constructor(CanvasKit, ref) {
|
8
|
+
super(CanvasKit, ref, "ParagraphBuilder");
|
9
|
+
}
|
10
|
+
|
11
|
+
addPlaceholder() {
|
12
|
+
let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
13
|
+
let height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
14
|
+
let alignment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : PlaceholderAlignment.Baseline;
|
15
|
+
let baseline = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : TextBaseline.Alphabetic;
|
16
|
+
let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
17
|
+
this.ref.addPlaceholder(width, height, {
|
18
|
+
value: alignment
|
19
|
+
}, {
|
20
|
+
value: baseline
|
21
|
+
}, offset);
|
22
|
+
return this;
|
23
|
+
}
|
24
|
+
|
25
|
+
addText(text) {
|
26
|
+
this.ref.addText(text);
|
27
|
+
return this;
|
28
|
+
}
|
29
|
+
|
30
|
+
build() {
|
31
|
+
return new JsiSkParagraph(this.CanvasKit, this.ref.build());
|
32
|
+
}
|
33
|
+
|
34
|
+
reset() {
|
35
|
+
this.ref.reset();
|
36
|
+
}
|
37
|
+
|
38
|
+
pushStyle(style, foregroundPaint, backgroundPaint) {
|
39
|
+
const textStyle = JsiSkTextStyle.toTextStyle(style);
|
40
|
+
|
41
|
+
if (foregroundPaint || backgroundPaint) {
|
42
|
+
var _textStyle$color, _textStyle$background;
|
43
|
+
|
44
|
+
// Due the canvaskit API not exposing textStyle methods,
|
45
|
+
// we set the default paint color to black for the foreground
|
46
|
+
// and transparent for the background
|
47
|
+
const fg = foregroundPaint ? JsiSkPaint.fromValue(foregroundPaint) : this.makePaint((_textStyle$color = textStyle.color) !== null && _textStyle$color !== void 0 ? _textStyle$color : Float32Array.of(0, 0, 0, 1));
|
48
|
+
const bg = backgroundPaint ? JsiSkPaint.fromValue(backgroundPaint) : this.makePaint((_textStyle$background = textStyle.backgroundColor) !== null && _textStyle$background !== void 0 ? _textStyle$background : Float32Array.of(0, 0, 0, 0));
|
49
|
+
this.ref.pushPaintStyle(new this.CanvasKit.TextStyle(textStyle), fg, bg);
|
50
|
+
} else {
|
51
|
+
this.ref.pushStyle(new this.CanvasKit.TextStyle(textStyle));
|
52
|
+
}
|
53
|
+
|
54
|
+
return this;
|
55
|
+
}
|
56
|
+
|
57
|
+
pop() {
|
58
|
+
this.ref.pop();
|
59
|
+
return this;
|
60
|
+
}
|
61
|
+
|
62
|
+
dispose() {
|
63
|
+
this.ref.delete();
|
64
|
+
}
|
65
|
+
|
66
|
+
makePaint(color) {
|
67
|
+
const paint = new this.CanvasKit.Paint();
|
68
|
+
paint.setColor(color);
|
69
|
+
return paint;
|
70
|
+
}
|
71
|
+
|
72
|
+
}
|
73
|
+
//# sourceMappingURL=JsiSkParagraphBuilder.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["PlaceholderAlignment","TextBaseline","HostObject","JsiSkParagraph","JsiSkTextStyle","JsiSkPaint","JsiSkParagraphBuilder","constructor","CanvasKit","ref","addPlaceholder","width","height","alignment","Baseline","baseline","Alphabetic","offset","value","addText","text","build","reset","pushStyle","style","foregroundPaint","backgroundPaint","textStyle","toTextStyle","fg","fromValue","makePaint","color","Float32Array","of","bg","backgroundColor","pushPaintStyle","TextStyle","pop","dispose","delete","paint","Paint","setColor"],"sources":["JsiSkParagraphBuilder.ts"],"sourcesContent":["import type {\n CanvasKit,\n InputColor,\n Paint,\n ParagraphBuilder,\n TextStyle,\n} from \"canvaskit-wasm\";\n\nimport type {\n SkParagraphBuilder,\n SkParagraph,\n SkTextStyle,\n SkPaint,\n} from \"../types\";\nimport { PlaceholderAlignment, TextBaseline } from \"../types\";\n\nimport { HostObject } from \"./Host\";\nimport { JsiSkParagraph } from \"./JsiSkParagraph\";\nimport { JsiSkTextStyle } from \"./JsiSkTextStyle\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\n\nexport class JsiSkParagraphBuilder\n extends HostObject<ParagraphBuilder, \"ParagraphBuilder\">\n implements SkParagraphBuilder\n{\n constructor(CanvasKit: CanvasKit, ref: ParagraphBuilder) {\n super(CanvasKit, ref, \"ParagraphBuilder\");\n }\n\n addPlaceholder(\n width: number | undefined = 0,\n height: number | undefined = 0,\n alignment: PlaceholderAlignment | undefined = PlaceholderAlignment.Baseline,\n baseline: TextBaseline | undefined = TextBaseline.Alphabetic,\n offset: number | undefined = 0\n ): SkParagraphBuilder {\n this.ref.addPlaceholder(\n width,\n height,\n { value: alignment },\n { value: baseline },\n offset\n );\n return this;\n }\n addText(text: string): SkParagraphBuilder {\n this.ref.addText(text);\n return this;\n }\n\n build(): SkParagraph {\n return new JsiSkParagraph(this.CanvasKit, this.ref.build());\n }\n\n reset(): void {\n this.ref.reset();\n }\n\n pushStyle(\n style: SkTextStyle,\n foregroundPaint?: SkPaint | undefined,\n backgroundPaint?: SkPaint | undefined\n ): SkParagraphBuilder {\n const textStyle: TextStyle = JsiSkTextStyle.toTextStyle(style);\n if (foregroundPaint || backgroundPaint) {\n // Due the canvaskit API not exposing textStyle methods,\n // we set the default paint color to black for the foreground\n // and transparent for the background\n const fg: Paint = foregroundPaint\n ? JsiSkPaint.fromValue(foregroundPaint)\n : this.makePaint(textStyle.color ?? Float32Array.of(0, 0, 0, 1));\n const bg: Paint = backgroundPaint\n ? JsiSkPaint.fromValue(backgroundPaint)\n : this.makePaint(\n textStyle.backgroundColor ?? Float32Array.of(0, 0, 0, 0)\n );\n this.ref.pushPaintStyle(new this.CanvasKit.TextStyle(textStyle), fg, bg);\n } else {\n this.ref.pushStyle(new this.CanvasKit.TextStyle(textStyle));\n }\n\n return this;\n }\n\n pop(): SkParagraphBuilder {\n this.ref.pop();\n return this;\n }\n\n dispose() {\n this.ref.delete();\n }\n\n private makePaint(color: InputColor) {\n const paint = new this.CanvasKit.Paint();\n paint.setColor(color);\n return paint;\n }\n}\n"],"mappings":"AAcA,SAASA,oBAAT,EAA+BC,YAA/B,QAAmD,UAAnD;AAEA,SAASC,UAAT,QAA2B,QAA3B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,UAAT,QAA2B,cAA3B;AAEA,OAAO,MAAMC,qBAAN,SACGJ,UADH,CAGP;EACEK,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAA8C;IACvD,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,kBAAtB;EACD;;EAEDC,cAAc,GAMQ;IAAA,IALpBC,KAKoB,uEALQ,CAKR;IAAA,IAJpBC,MAIoB,uEAJS,CAIT;IAAA,IAHpBC,SAGoB,uEAH0Bb,oBAAoB,CAACc,QAG/C;IAAA,IAFpBC,QAEoB,uEAFiBd,YAAY,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,SAA7B,CAAxB,EAAiEE,EAAjE,EAAqEM,EAArE;IACD,CAbD,MAaO;MACL,KAAK1B,GAAL,CAASc,SAAT,CAAmB,IAAI,KAAKf,SAAL,CAAe8B,SAAnB,CAA6BX,SAA7B,CAAnB;IACD;;IAED,OAAO,IAAP;EACD;;EAEDY,GAAG,GAAuB;IACxB,KAAK9B,GAAL,CAAS8B,GAAT;IACA,OAAO,IAAP;EACD;;EAEDC,OAAO,GAAG;IACR,KAAK/B,GAAL,CAASgC,MAAT;EACD;;EAEOV,SAAS,CAACC,KAAD,EAAoB;IACnC,MAAMU,KAAK,GAAG,IAAI,KAAKlC,SAAL,CAAemC,KAAnB,EAAd;IACAD,KAAK,CAACE,QAAN,CAAeZ,KAAf;IACA,OAAOU,KAAP;EACD;;AAzEH"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { CanvasKit } from "canvaskit-wasm";
|
2
|
+
import type { ParagraphBuilderFactory, SkParagraphStyle, SkTypefaceFontProvider } from "../types";
|
3
|
+
import { Host } from "./Host";
|
4
|
+
import { JsiSkParagraphBuilder } from "./JsiSkParagraphBuilder";
|
5
|
+
export declare class JsiSkParagraphBuilderFactory extends Host implements ParagraphBuilderFactory {
|
6
|
+
constructor(CanvasKit: CanvasKit);
|
7
|
+
Make(paragraphStyle: SkParagraphStyle, typefaceProvider?: SkTypefaceFontProvider): JsiSkParagraphBuilder;
|
8
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { Host } from "./Host";
|
2
|
+
import { JsiSkParagraphBuilder } from "./JsiSkParagraphBuilder";
|
3
|
+
import { JsiSkParagraphStyle } from "./JsiSkParagraphStyle";
|
4
|
+
import { JsiSkTypeface } from "./JsiSkTypeface";
|
5
|
+
export class JsiSkParagraphBuilderFactory extends Host {
|
6
|
+
constructor(CanvasKit) {
|
7
|
+
super(CanvasKit);
|
8
|
+
}
|
9
|
+
|
10
|
+
Make(paragraphStyle, typefaceProvider) {
|
11
|
+
const style = new this.CanvasKit.ParagraphStyle(JsiSkParagraphStyle.toParagraphStyle(this.CanvasKit, paragraphStyle !== null && paragraphStyle !== void 0 ? paragraphStyle : {}));
|
12
|
+
|
13
|
+
if (typefaceProvider === undefined) {
|
14
|
+
throw new Error("SkTypefaceFontProvider is required on React Native Web.");
|
15
|
+
}
|
16
|
+
|
17
|
+
return new JsiSkParagraphBuilder(this.CanvasKit, this.CanvasKit.ParagraphBuilder.MakeFromFontProvider(style, JsiSkTypeface.fromValue(typefaceProvider)));
|
18
|
+
}
|
19
|
+
|
20
|
+
}
|
21
|
+
//# sourceMappingURL=JsiSkParagraphBuilderFactory.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["Host","JsiSkParagraphBuilder","JsiSkParagraphStyle","JsiSkTypeface","JsiSkParagraphBuilderFactory","constructor","CanvasKit","Make","paragraphStyle","typefaceProvider","style","ParagraphStyle","toParagraphStyle","undefined","Error","ParagraphBuilder","MakeFromFontProvider","fromValue"],"sources":["JsiSkParagraphBuilderFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n ParagraphBuilderFactory,\n SkParagraphStyle,\n SkTypefaceFontProvider,\n} from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkParagraphBuilder } from \"./JsiSkParagraphBuilder\";\nimport { JsiSkParagraphStyle } from \"./JsiSkParagraphStyle\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\n\nexport class JsiSkParagraphBuilderFactory\n extends Host\n implements ParagraphBuilderFactory\n{\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n Make(\n paragraphStyle: SkParagraphStyle,\n typefaceProvider?: SkTypefaceFontProvider\n ) {\n const style = new this.CanvasKit.ParagraphStyle(\n JsiSkParagraphStyle.toParagraphStyle(this.CanvasKit, paragraphStyle ?? {})\n );\n if (typefaceProvider === undefined) {\n throw new Error(\n \"SkTypefaceFontProvider is required on React Native Web.\"\n );\n }\n return new JsiSkParagraphBuilder(\n this.CanvasKit,\n this.CanvasKit.ParagraphBuilder.MakeFromFontProvider(\n style,\n JsiSkTypeface.fromValue(typefaceProvider)\n )\n );\n }\n}\n"],"mappings":"AAQA,SAASA,IAAT,QAAqB,QAArB;AACA,SAASC,qBAAT,QAAsC,yBAAtC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,aAAT,QAA8B,iBAA9B;AAEA,OAAO,MAAMC,4BAAN,SACGJ,IADH,CAGP;EACEK,WAAW,CAACC,SAAD,EAAuB;IAChC,MAAMA,SAAN;EACD;;EAEDC,IAAI,CACFC,cADE,EAEFC,gBAFE,EAGF;IACA,MAAMC,KAAK,GAAG,IAAI,KAAKJ,SAAL,CAAeK,cAAnB,CACZT,mBAAmB,CAACU,gBAApB,CAAqC,KAAKN,SAA1C,EAAqDE,cAArD,aAAqDA,cAArD,cAAqDA,cAArD,GAAuE,EAAvE,CADY,CAAd;;IAGA,IAAIC,gBAAgB,KAAKI,SAAzB,EAAoC;MAClC,MAAM,IAAIC,KAAJ,CACJ,yDADI,CAAN;IAGD;;IACD,OAAO,IAAIb,qBAAJ,CACL,KAAKK,SADA,EAEL,KAAKA,SAAL,CAAeS,gBAAf,CAAgCC,oBAAhC,CACEN,KADF,EAEEP,aAAa,CAACc,SAAd,CAAwBR,gBAAxB,CAFF,CAFK,CAAP;EAOD;;AAxBH"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { SkTextDirection } from "../types";
|
2
|
+
export class JsiSkParagraphStyle {
|
3
|
+
static toParagraphStyle(ck, value) {
|
4
|
+
var _value$disableHinting, _value$ellipsis, _value$heightMultipli, _value$maxLines, _value$replaceTabChar, _ps$strutStyle, _value$strutStyle$fon, _value$strutStyle, _value$strutStyle$fon2, _value$strutStyle2, _value$strutStyle$hei, _value$strutStyle3, _value$strutStyle$lea, _value$strutStyle4, _value$strutStyle$for, _value$strutStyle5, _ps$strutStyle$fontSt, _value$strutStyle6, _value$strutStyle6$fo, _value$strutStyle7, _value$strutStyle7$fo, _value$strutStyle8, _value$strutStyle8$fo, _value$strutStyle$hal, _value$strutStyle9, _value$strutStyle$str, _value$strutStyle10;
|
5
|
+
|
6
|
+
// Seems like we need to provide the textStyle.color value, otherwise
|
7
|
+
// the constructor crashes.
|
8
|
+
const ps = new ck.ParagraphStyle({
|
9
|
+
textStyle: {
|
10
|
+
color: ck.BLACK
|
11
|
+
}
|
12
|
+
});
|
13
|
+
ps.disableHinting = (_value$disableHinting = value.disableHinting) !== null && _value$disableHinting !== void 0 ? _value$disableHinting : ps.disableHinting;
|
14
|
+
ps.ellipsis = (_value$ellipsis = value.ellipsis) !== null && _value$ellipsis !== void 0 ? _value$ellipsis : ps.ellipsis;
|
15
|
+
ps.heightMultiplier = (_value$heightMultipli = value.heightMultiplier) !== null && _value$heightMultipli !== void 0 ? _value$heightMultipli : ps.heightMultiplier;
|
16
|
+
ps.maxLines = (_value$maxLines = value.maxLines) !== null && _value$maxLines !== void 0 ? _value$maxLines : ps.maxLines;
|
17
|
+
ps.replaceTabCharacters = (_value$replaceTabChar = value.replaceTabCharacters) !== null && _value$replaceTabChar !== void 0 ? _value$replaceTabChar : ps.replaceTabCharacters;
|
18
|
+
ps.textAlign = value.textAlign !== undefined ? {
|
19
|
+
value: value.textAlign
|
20
|
+
} : undefined !== null && undefined !== void 0 ? undefined : ps.textAlign;
|
21
|
+
ps.textDirection = value.textDirection !== undefined ? {
|
22
|
+
value: value.textDirection === SkTextDirection.LTR ? 1 : 0
|
23
|
+
} : ps.textDirection;
|
24
|
+
ps.textHeightBehavior = value.textHeightBehavior !== undefined ? {
|
25
|
+
value: value.textHeightBehavior
|
26
|
+
} : ps.textHeightBehavior;
|
27
|
+
ps.strutStyle = (_ps$strutStyle = ps.strutStyle) !== null && _ps$strutStyle !== void 0 ? _ps$strutStyle : {};
|
28
|
+
ps.strutStyle.fontFamilies = (_value$strutStyle$fon = (_value$strutStyle = value.strutStyle) === null || _value$strutStyle === void 0 ? void 0 : _value$strutStyle.fontFamilies) !== null && _value$strutStyle$fon !== void 0 ? _value$strutStyle$fon : ps.strutStyle.fontFamilies;
|
29
|
+
ps.strutStyle.fontSize = (_value$strutStyle$fon2 = (_value$strutStyle2 = value.strutStyle) === null || _value$strutStyle2 === void 0 ? void 0 : _value$strutStyle2.fontSize) !== null && _value$strutStyle$fon2 !== void 0 ? _value$strutStyle$fon2 : ps.strutStyle.fontSize;
|
30
|
+
ps.strutStyle.heightMultiplier = (_value$strutStyle$hei = (_value$strutStyle3 = value.strutStyle) === null || _value$strutStyle3 === void 0 ? void 0 : _value$strutStyle3.heightMultiplier) !== null && _value$strutStyle$hei !== void 0 ? _value$strutStyle$hei : ps.strutStyle.heightMultiplier;
|
31
|
+
ps.strutStyle.leading = (_value$strutStyle$lea = (_value$strutStyle4 = value.strutStyle) === null || _value$strutStyle4 === void 0 ? void 0 : _value$strutStyle4.leading) !== null && _value$strutStyle$lea !== void 0 ? _value$strutStyle$lea : ps.strutStyle.leading;
|
32
|
+
ps.strutStyle.forceStrutHeight = (_value$strutStyle$for = (_value$strutStyle5 = value.strutStyle) === null || _value$strutStyle5 === void 0 ? void 0 : _value$strutStyle5.forceStrutHeight) !== null && _value$strutStyle$for !== void 0 ? _value$strutStyle$for : ps.strutStyle.forceStrutHeight;
|
33
|
+
ps.strutStyle.fontStyle = (_ps$strutStyle$fontSt = ps.strutStyle.fontStyle) !== null && _ps$strutStyle$fontSt !== void 0 ? _ps$strutStyle$fontSt : {};
|
34
|
+
ps.strutStyle.fontStyle.slant = ((_value$strutStyle6 = value.strutStyle) === null || _value$strutStyle6 === void 0 ? void 0 : (_value$strutStyle6$fo = _value$strutStyle6.fontStyle) === null || _value$strutStyle6$fo === void 0 ? void 0 : _value$strutStyle6$fo.slant) !== undefined ? {
|
35
|
+
value: value.strutStyle.fontStyle.slant
|
36
|
+
} : ps.strutStyle.fontStyle.slant;
|
37
|
+
ps.strutStyle.fontStyle.width = ((_value$strutStyle7 = value.strutStyle) === null || _value$strutStyle7 === void 0 ? void 0 : (_value$strutStyle7$fo = _value$strutStyle7.fontStyle) === null || _value$strutStyle7$fo === void 0 ? void 0 : _value$strutStyle7$fo.width) !== undefined ? {
|
38
|
+
value: value.strutStyle.fontStyle.width
|
39
|
+
} : ps.strutStyle.fontStyle.width;
|
40
|
+
ps.strutStyle.fontStyle.weight = ((_value$strutStyle8 = value.strutStyle) === null || _value$strutStyle8 === void 0 ? void 0 : (_value$strutStyle8$fo = _value$strutStyle8.fontStyle) === null || _value$strutStyle8$fo === void 0 ? void 0 : _value$strutStyle8$fo.weight) !== undefined ? {
|
41
|
+
value: value.strutStyle.fontStyle.weight
|
42
|
+
} : ps.strutStyle.fontStyle.weight;
|
43
|
+
ps.strutStyle.halfLeading = (_value$strutStyle$hal = (_value$strutStyle9 = value.strutStyle) === null || _value$strutStyle9 === void 0 ? void 0 : _value$strutStyle9.halfLeading) !== null && _value$strutStyle$hal !== void 0 ? _value$strutStyle$hal : ps.strutStyle.halfLeading;
|
44
|
+
ps.strutStyle.strutEnabled = (_value$strutStyle$str = (_value$strutStyle10 = value.strutStyle) === null || _value$strutStyle10 === void 0 ? void 0 : _value$strutStyle10.strutEnabled) !== null && _value$strutStyle$str !== void 0 ? _value$strutStyle$str : ps.strutStyle.strutEnabled;
|
45
|
+
return ps;
|
46
|
+
}
|
47
|
+
|
48
|
+
}
|
49
|
+
//# sourceMappingURL=JsiSkParagraphStyle.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["SkTextDirection","JsiSkParagraphStyle","toParagraphStyle","ck","value","ps","ParagraphStyle","textStyle","color","BLACK","disableHinting","ellipsis","heightMultiplier","maxLines","replaceTabCharacters","textAlign","undefined","textDirection","LTR","textHeightBehavior","strutStyle","fontFamilies","fontSize","leading","forceStrutHeight","fontStyle","slant","width","weight","halfLeading","strutEnabled"],"sources":["JsiSkParagraphStyle.ts"],"sourcesContent":["import type { CanvasKit, ParagraphStyle } from \"canvaskit-wasm\";\n\nimport { SkTextDirection, type SkParagraphStyle } from \"../types\";\n\nexport class JsiSkParagraphStyle {\n static toParagraphStyle(\n ck: CanvasKit,\n value: SkParagraphStyle\n ): ParagraphStyle {\n // Seems like we need to provide the textStyle.color value, otherwise\n // the constructor crashes.\n const ps = new ck.ParagraphStyle({ textStyle: { color: ck.BLACK } });\n\n ps.disableHinting = value.disableHinting ?? ps.disableHinting;\n ps.ellipsis = value.ellipsis ?? ps.ellipsis;\n ps.heightMultiplier = value.heightMultiplier ?? ps.heightMultiplier;\n ps.maxLines = value.maxLines ?? ps.maxLines;\n ps.replaceTabCharacters =\n value.replaceTabCharacters ?? ps.replaceTabCharacters;\n ps.textAlign =\n value.textAlign !== undefined\n ? { value: value.textAlign }\n : undefined ?? ps.textAlign;\n ps.textDirection =\n value.textDirection !== undefined\n ? { value: value.textDirection === SkTextDirection.LTR ? 1 : 0 }\n : ps.textDirection;\n ps.textHeightBehavior =\n value.textHeightBehavior !== undefined\n ? { value: value.textHeightBehavior }\n : ps.textHeightBehavior;\n\n ps.strutStyle = ps.strutStyle ?? {};\n ps.strutStyle.fontFamilies =\n value.strutStyle?.fontFamilies ?? ps.strutStyle.fontFamilies;\n ps.strutStyle.fontSize =\n value.strutStyle?.fontSize ?? ps.strutStyle.fontSize;\n ps.strutStyle.heightMultiplier =\n value.strutStyle?.heightMultiplier ?? ps.strutStyle.heightMultiplier;\n ps.strutStyle.leading = value.strutStyle?.leading ?? ps.strutStyle.leading;\n ps.strutStyle.forceStrutHeight =\n value.strutStyle?.forceStrutHeight ?? ps.strutStyle.forceStrutHeight;\n\n ps.strutStyle.fontStyle = ps.strutStyle.fontStyle ?? {};\n\n ps.strutStyle.fontStyle.slant =\n value.strutStyle?.fontStyle?.slant !== undefined\n ? { value: value.strutStyle.fontStyle.slant }\n : ps.strutStyle.fontStyle.slant;\n ps.strutStyle.fontStyle.width =\n value.strutStyle?.fontStyle?.width !== undefined\n ? { value: value.strutStyle.fontStyle.width }\n : ps.strutStyle.fontStyle.width;\n ps.strutStyle.fontStyle.weight =\n value.strutStyle?.fontStyle?.weight !== undefined\n ? { value: value.strutStyle.fontStyle.weight }\n : ps.strutStyle.fontStyle.weight;\n ps.strutStyle.halfLeading =\n value.strutStyle?.halfLeading ?? ps.strutStyle.halfLeading;\n ps.strutStyle.strutEnabled =\n value.strutStyle?.strutEnabled ?? ps.strutStyle.strutEnabled;\n\n return ps;\n }\n}\n"],"mappings":"AAEA,SAASA,eAAT,QAAuD,UAAvD;AAEA,OAAO,MAAMC,mBAAN,CAA0B;EACR,OAAhBC,gBAAgB,CACrBC,EADqB,EAErBC,KAFqB,EAGL;IAAA;;IAChB;IACA;IACA,MAAMC,EAAE,GAAG,IAAIF,EAAE,CAACG,cAAP,CAAsB;MAAEC,SAAS,EAAE;QAAEC,KAAK,EAAEL,EAAE,CAACM;MAAZ;IAAb,CAAtB,CAAX;IAEAJ,EAAE,CAACK,cAAH,4BAAoBN,KAAK,CAACM,cAA1B,yEAA4CL,EAAE,CAACK,cAA/C;IACAL,EAAE,CAACM,QAAH,sBAAcP,KAAK,CAACO,QAApB,6DAAgCN,EAAE,CAACM,QAAnC;IACAN,EAAE,CAACO,gBAAH,4BAAsBR,KAAK,CAACQ,gBAA5B,yEAAgDP,EAAE,CAACO,gBAAnD;IACAP,EAAE,CAACQ,QAAH,sBAAcT,KAAK,CAACS,QAApB,6DAAgCR,EAAE,CAACQ,QAAnC;IACAR,EAAE,CAACS,oBAAH,4BACEV,KAAK,CAACU,oBADR,yEACgCT,EAAE,CAACS,oBADnC;IAEAT,EAAE,CAACU,SAAH,GACEX,KAAK,CAACW,SAAN,KAAoBC,SAApB,GACI;MAAEZ,KAAK,EAAEA,KAAK,CAACW;IAAf,CADJ,GAEIC,SAFJ,aAEIA,SAFJ,cAEIA,SAFJ,GAEiBX,EAAE,CAACU,SAHtB;IAIAV,EAAE,CAACY,aAAH,GACEb,KAAK,CAACa,aAAN,KAAwBD,SAAxB,GACI;MAAEZ,KAAK,EAAEA,KAAK,CAACa,aAAN,K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AN,CAAiBK,SAAjB,CAA2BC;IAApC,CADJ,GAEIrB,EAAE,CAACe,UAAH,CAAcK,SAAd,CAAwBC,KAH9B;IAIArB,EAAE,CAACe,UAAH,CAAcK,SAAd,CAAwBE,KAAxB,GACE,uBAAAvB,KAAK,CAACgB,UAAN,mGAAkBK,SAAlB,gFAA6BE,KAA7B,MAAuCX,SAAvC,GACI;MAAEZ,KAAK,EAAEA,KAAK,CAACgB,UAAN,CAAiBK,SAAjB,CAA2BE;IAApC,CADJ,GAEItB,EAAE,CAACe,UAAH,CAAcK,SAAd,CAAwBE,KAH9B;IAIAtB,EAAE,CAACe,UAAH,CAAcK,SAAd,CAAwBG,MAAxB,GACE,uBAAAxB,KAAK,CAACgB,UAAN,mGAAkBK,SAAlB,gFAA6BG,MAA7B,MAAwCZ,SAAxC,GACI;MAAEZ,KAAK,EAAEA,KAAK,CAACgB,UAAN,CAAiBK,SAAjB,CAA2BG;IAApC,CADJ,GAEIvB,EAAE,CAACe,UAAH,CAAcK,SAAd,CAAwBG,MAH9B;IAIAvB,EAAE,CAACe,UAAH,CAAcS,WAAd,kDACEzB,KAAK,CAACgB,UADR,uDACE,mBAAkBS,WADpB,yEACmCxB,EAAE,CAACe,UAAH,CAAcS,WADjD;IAEAxB,EAAE,CAACe,UAAH,CAAcU,YAAd,mDACE1B,KAAK,CAACgB,UADR,wDACE,oBAAkBU,YADpB,yEACoCzB,EAAE,CAACe,UAAH,CAAcU,YADlD;IAGA,OAAOzB,EAAP;EACD;;AA3D8B"}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
export class JsiSkTextStyle {
|
2
|
+
static toTextStyle(value) {
|
3
|
+
return {
|
4
|
+
backgroundColor: value.backgroundColor,
|
5
|
+
color: value.color,
|
6
|
+
decoration: value.decoration,
|
7
|
+
decorationColor: value.decorationColor,
|
8
|
+
decorationStyle: value.decorationStyle ? {
|
9
|
+
value: value.decorationStyle
|
10
|
+
} : undefined,
|
11
|
+
decorationThickness: value.decorationThickness,
|
12
|
+
fontFamilies: value.fontFamilies,
|
13
|
+
fontSize: value.fontSize,
|
14
|
+
fontStyle: value.fontStyle ? {
|
15
|
+
slant: value.fontStyle.slant ? {
|
16
|
+
value: value.fontStyle.slant
|
17
|
+
} : undefined,
|
18
|
+
weight: value.fontStyle.weight ? {
|
19
|
+
value: value.fontStyle.weight
|
20
|
+
} : undefined,
|
21
|
+
width: value.fontStyle.width ? {
|
22
|
+
value: value.fontStyle.width
|
23
|
+
} : undefined
|
24
|
+
} : undefined,
|
25
|
+
fontFeatures: value.fontFeatures,
|
26
|
+
foregroundColor: value.foregroundColor,
|
27
|
+
fontVariations: value.fontVariations,
|
28
|
+
halfLeading: value.halfLeading,
|
29
|
+
heightMultiplier: value.heightMultiplier,
|
30
|
+
letterSpacing: value.letterSpacing,
|
31
|
+
locale: value.locale,
|
32
|
+
shadows: value.shadows ? value.shadows.map(shadow => ({
|
33
|
+
blurRadius: shadow.blurRadius,
|
34
|
+
color: shadow.color,
|
35
|
+
offset: shadow.offset ? [shadow.offset.x, shadow.offset.y] : undefined
|
36
|
+
})) : undefined,
|
37
|
+
textBaseline: value.textBaseline ? {
|
38
|
+
value: value.textBaseline
|
39
|
+
} : undefined,
|
40
|
+
wordSpacing: value.wordSpacing
|
41
|
+
};
|
42
|
+
}
|
43
|
+
|
44
|
+
}
|
45
|
+
//# sourceMappingURL=JsiSkTextStyle.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["JsiSkTextStyle","toTextStyle","value","backgroundColor","color","decoration","decorationColor","decorationStyle","undefined","decorationThickness","fontFamilies","fontSize","fontStyle","slant","weight","width","fontFeatures","foregroundColor","fontVariations","halfLeading","heightMultiplier","letterSpacing","locale","shadows","map","shadow","blurRadius","offset","x","y","textBaseline","wordSpacing"],"sources":["JsiSkTextStyle.ts"],"sourcesContent":["import type { TextStyle } from \"canvaskit-wasm\";\n\nimport type { SkTextStyle } from \"../types\";\n\nexport class JsiSkTextStyle {\n static toTextStyle(value: SkTextStyle): TextStyle {\n return {\n backgroundColor: value.backgroundColor,\n color: value.color,\n decoration: value.decoration,\n decorationColor: value.decorationColor,\n decorationStyle: value.decorationStyle\n ? { value: value.decorationStyle }\n : undefined,\n decorationThickness: value.decorationThickness,\n fontFamilies: value.fontFamilies,\n fontSize: value.fontSize,\n fontStyle: value.fontStyle\n ? {\n slant: value.fontStyle.slant\n ? { value: value.fontStyle.slant }\n : undefined,\n weight: value.fontStyle.weight\n ? { value: value.fontStyle.weight }\n : undefined,\n width: value.fontStyle.width\n ? { value: value.fontStyle.width }\n : undefined,\n }\n : undefined,\n fontFeatures: value.fontFeatures,\n foregroundColor: value.foregroundColor,\n fontVariations: value.fontVariations,\n halfLeading: value.halfLeading,\n heightMultiplier: value.heightMultiplier,\n letterSpacing: value.letterSpacing,\n locale: value.locale,\n shadows: value.shadows\n ? value.shadows.map((shadow) => ({\n blurRadius: shadow.blurRadius,\n color: shadow.color,\n offset: shadow.offset\n ? [shadow.offset.x, shadow.offset.y]\n : undefined,\n }))\n : undefined,\n textBaseline: value.textBaseline\n ? { value: value.textBaseline }\n : undefined,\n wordSpacing: value.wordSpacing,\n };\n }\n}\n"],"mappings":"AAIA,OAAO,MAAMA,cAAN,CAAqB;EACR,OAAXC,WAAW,CAACC,KAAD,EAAgC;IAChD,OAAO;MACLC,eAAe,EAAED,KAAK,CAACC,eADlB;MAELC,KAAK,EAAEF,KAAK,CAACE,KAFR;MAGLC,UAAU,EAAEH,KAAK,CAACG,UAHb;MAILC,eAAe,EAAEJ,KAAK,CAACI,eAJlB;MAKLC,eAAe,EAAEL,KAAK,CAACK,eAAN,GACb;QAAEL,KAAK,EAAEA,KAAK,CAACK;MAAf,CADa,GAEbC,SAPC;MAQLC,mBAAmB,EAAEP,KAAK,CAACO,mBARtB;MASLC,YAAY,EAAER,KAAK,CAACQ,YATf;MAULC,QAAQ,EAAET,KAAK,CAACS,QAVX;MAWLC,SAAS,EAAEV,KAAK,CAACU,SAAN,GACP;QACEC,KAA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P;EA6CD;;AA/CyB"}
|
@@ -28,6 +28,7 @@ import { JsiSkTypeface } from "./JsiSkTypeface";
|
|
28
28
|
import { JsiSkTypefaceFontProviderFactory } from "./JsiSkTypefaceFontProviderFactory";
|
29
29
|
import { JsiSkFontMgrFactory } from "./JsiSkFontMgrFactory";
|
30
30
|
import { JsiSkAnimatedImageFactory } from "./JsiSkAnimatedImageFactory";
|
31
|
+
import { JsiSkParagraphBuilderFactory } from "./JsiSkParagraphBuilderFactory";
|
31
32
|
export const JsiSkApi = CanvasKit => ({
|
32
33
|
Point: (x, y) => new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),
|
33
34
|
RuntimeShaderBuilder: _ => {
|
@@ -65,6 +66,7 @@ export const JsiSkApi = CanvasKit => ({
|
|
65
66
|
},
|
66
67
|
Surface: new JsiSkSurfaceFactory(CanvasKit),
|
67
68
|
TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),
|
68
|
-
FontMgr: new JsiSkFontMgrFactory(CanvasKit)
|
69
|
+
FontMgr: new JsiSkFontMgrFactory(CanvasKit),
|
70
|
+
ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit)
|
69
71
|
});
|
70
72
|
//# 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","JsiSkTypefaceFontProviderFactory","JsiSkFontMgrFactory","JsiSkAnimatedImageFactory","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","AnimatedImage","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\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\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 AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n});\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;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,aAAT,QAA8B,iBAA9B;AACA,SAASC,gCAAT,QAAiD,oCAAjD;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,yBAAT,QAA0C,6BAA1C;AAEA,OAAO,MAAMC,QAAQ,GAAIC,SAAD,KAAiC;EACvDC,KAAK,EAAE,CAACC,CAAD,EAAYC,CAAZ,KACL,
|
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","JsiSkAnimatedImageFactory","JsiSkParagraphBuilderFactory","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","AnimatedImage","SVG","TextBlob","XYWHRect","width","height","Surface","TypefaceFontProvider","FontMgr","ParagraphBuilder"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n SkContourMeasureIter,\n Skia,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\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 AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n});\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;AAC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wB4B,SAAxB,CAhE8C;EAiEvDqD,oBAAoB,EAAE,IAAI1D,gCAAJ,CAAqCK,SAArC,CAjEiC;EAkEvDsD,OAAO,EAAE,IAAI1D,mBAAJ,CAAwBI,SAAxB,CAlE8C;EAmEvDuD,gBAAgB,EAAE,IAAIzD,4BAAJ,CAAiCE,SAAjC;AAnEqC,CAAjC,CAAjB"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { PathProps, SkDOM, GroupProps, ImageProps, BlurImageFilterProps, MatrixColorFilterProps, CircleProps, BlurMaskFilterProps, LinearGradientProps, PaintProps, ShaderProps, ImageShaderProps, CustomDrawingNodeProps, LineProps, OvalProps, PatchProps, PointsProps, RectProps, RoundedRectProps, VerticesProps, TextProps, DiffRectProps, OffsetImageFilterProps, BlendColorFilterProps, TextPathProps, TextBlobProps, GlyphsProps, TwoPointConicalGradientProps, TurbulenceProps, SweepGradientProps, RadialGradientProps, FractalNoiseProps, ColorProps, PictureProps, ImageSVGProps, LerpColorFilterProps, DrawingNodeProps, BoxProps, BoxShadowProps, ChildrenProps } from "../types";
|
2
2
|
import type { BlendImageFilterProps, BlendProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, RuntimeShaderImageFilterProps } from "../types/ImageFilters";
|
3
3
|
import type { CornerPathEffectProps, DashPathEffectProps, DiscretePathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps } from "../types/PathEffects";
|
4
|
+
import type { ParagraphProps } from "../types/Paragraph";
|
4
5
|
import type { NodeContext } from "./Node";
|
5
6
|
export declare class JsiSkDOM implements SkDOM {
|
6
7
|
private ctx;
|
@@ -61,4 +62,5 @@ export declare class JsiSkDOM implements SkDOM {
|
|
61
62
|
BackdropFilter(props: ChildrenProps): import("../types").RenderNode<ChildrenProps>;
|
62
63
|
Box(props: BoxProps): import("../types").RenderNode<BoxProps>;
|
63
64
|
BoxShadow(props: BoxShadowProps): import("../types").DeclarationNode<BoxShadowProps>;
|
65
|
+
Paragraph(props: ParagraphProps): import("../types").RenderNode<ParagraphProps>;
|
64
66
|
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { DrawingContext, ParagraphProps } from "../../types";
|
2
|
+
import { JsiDrawingNode } from "../DrawingNode";
|
3
|
+
import type { NodeContext } from "../Node";
|
4
|
+
export declare class ParagraphNode extends JsiDrawingNode<ParagraphProps, null> {
|
5
|
+
constructor(ctx: NodeContext, props: ParagraphProps);
|
6
|
+
deriveProps(): null;
|
7
|
+
draw({ canvas }: DrawingContext): void;
|
8
|
+
}
|
@@ -54,7 +54,8 @@ export declare const enum NodeType {
|
|
54
54
|
TextBlob = "skTextBlob",
|
55
55
|
Glyphs = "skGlyphs",
|
56
56
|
Picture = "skPicture",
|
57
|
-
ImageSVG = "skImageSVG"
|
57
|
+
ImageSVG = "skImageSVG",
|
58
|
+
Paragraph = "skParagraph"
|
58
59
|
}
|
59
60
|
export declare const enum DeclarationType {
|
60
61
|
Paint = 0,
|
@@ -6,6 +6,7 @@ import type { ImageProps, CircleProps, PathProps, CustomDrawingNodeProps, LinePr
|
|
6
6
|
import type { BlurMaskFilterProps } from "./MaskFilters";
|
7
7
|
import type { FractalNoiseProps, SweepGradientProps, ImageShaderProps, LinearGradientProps, ShaderProps, TurbulenceProps, TwoPointConicalGradientProps, RadialGradientProps, ColorProps } from "./Shaders";
|
8
8
|
import type { CornerPathEffectProps, DashPathEffectProps, DiscretePathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps } from "./PathEffects";
|
9
|
+
import type { ParagraphProps } from "./Paragraph";
|
9
10
|
type ImageFilterNode<P> = DeclarationNode<P>;
|
10
11
|
type PathEffectNode<P> = DeclarationNode<P>;
|
11
12
|
type NullablePathEffectNode<P> = DeclarationNode<P>;
|
@@ -67,5 +68,6 @@ export interface SkDOM {
|
|
67
68
|
BackdropFilter(props: ChildrenProps): RenderNode<ChildrenProps>;
|
68
69
|
Box(props: BoxProps): RenderNode<BoxProps>;
|
69
70
|
BoxShadow(props: BoxShadowProps): DeclarationNode<BoxShadowProps>;
|
71
|
+
Paragraph(props: ParagraphProps): RenderNode<ParagraphProps>;
|
70
72
|
}
|
71
73
|
export {};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { NodeType } from "../dom/types";
|
2
|
-
import type { DeclarationNode, FractalNoiseProps, RenderNode, CircleProps, DrawingNodeProps, ImageProps, PaintProps, PathProps, CustomDrawingNodeProps, LineProps, OvalProps, DiffRectProps, PointsProps, RectProps, RoundedRectProps, TextProps, VerticesProps, BlurMaskFilterProps, BlendImageFilterProps, BlurImageFilterProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps, MatrixColorFilterProps, ShaderProps, ImageShaderProps, LinearGradientProps, GroupProps, PatchProps, BlendColorFilterProps, DashPathEffectProps, DiscretePathEffectProps, CornerPathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps, TextPathProps, TextBlobProps, GlyphsProps, TwoPointConicalGradientProps, TurbulenceProps, SweepGradientProps, RadialGradientProps, ColorProps, PictureProps, ImageSVGProps, LerpColorFilterProps, BoxProps, BoxShadowProps } from "../dom/types";
|
2
|
+
import type { DeclarationNode, FractalNoiseProps, RenderNode, CircleProps, DrawingNodeProps, ImageProps, PaintProps, PathProps, CustomDrawingNodeProps, LineProps, OvalProps, DiffRectProps, PointsProps, RectProps, RoundedRectProps, TextProps, VerticesProps, BlurMaskFilterProps, BlendImageFilterProps, BlurImageFilterProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps, MatrixColorFilterProps, ShaderProps, ImageShaderProps, LinearGradientProps, GroupProps, PatchProps, BlendColorFilterProps, DashPathEffectProps, DiscretePathEffectProps, CornerPathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps, TextPathProps, TextBlobProps, GlyphsProps, TwoPointConicalGradientProps, TurbulenceProps, SweepGradientProps, RadialGradientProps, ColorProps, PictureProps, ImageSVGProps, LerpColorFilterProps, BoxProps, BoxShadowProps, ParagraphProps } from "../dom/types";
|
3
3
|
import type { ChildrenProps } from "../dom/types/Common";
|
4
4
|
import type { BlendProps, MorphologyImageFilterProps } from "../dom/types/ImageFilters";
|
5
5
|
import type { SkRect, SkRRect } from "../skia/types";
|
@@ -68,6 +68,7 @@ declare global {
|
|
68
68
|
BoxNode: (prop: BoxProps) => RenderNode<BoxProps>;
|
69
69
|
BoxShadowNode: (prop: BoxShadowProps) => DeclarationNode<BoxShadowProps>;
|
70
70
|
LayerNode: (prop: ChildrenProps) => RenderNode<ChildrenProps>;
|
71
|
+
ParagraphNode: (props: ParagraphProps) => RenderNode<ParagraphProps>;
|
71
72
|
};
|
72
73
|
namespace JSX {
|
73
74
|
interface IntrinsicElements {
|
@@ -127,6 +128,7 @@ declare global {
|
|
127
128
|
skBackdropFilter: SkiaProps<ChildrenProps>;
|
128
129
|
skBox: SkiaProps<BoxProps>;
|
129
130
|
skBoxShadow: SkiaProps<BoxShadowProps>;
|
131
|
+
skParagraph: SkiaProps<ParagraphProps>;
|
130
132
|
}
|
131
133
|
}
|
132
134
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./Paragraph";
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import type { SkCanvas } from "../Canvas";
|
2
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
3
|
+
import type { SkRect } from "../Rect";
|
4
|
+
import type { SkTextDirection } from "./ParagraphStyle";
|
5
|
+
export interface SkRectWithDirection {
|
6
|
+
rect: SkRect;
|
7
|
+
direction: SkTextDirection;
|
8
|
+
}
|
9
|
+
export interface SkParagraph extends SkJSIInstance<"Paragraph"> {
|
10
|
+
/**
|
11
|
+
* Calculates the position of the the glyphs in the paragraph
|
12
|
+
* @param width Max width of the paragraph
|
13
|
+
*/
|
14
|
+
layout(width: number): void;
|
15
|
+
/**
|
16
|
+
* Paints the paragraph to the provded canvas
|
17
|
+
* @param canvas Canvas to paint into
|
18
|
+
* @param x X coordinate to paint at
|
19
|
+
* @param y Y coordinate to paint at
|
20
|
+
*/
|
21
|
+
paint(canvas: SkCanvas, x: number, y: number): void;
|
22
|
+
/**
|
23
|
+
* Returns the height of the paragraph. This method requires the layout
|
24
|
+
* method to have been called first.
|
25
|
+
*/
|
26
|
+
getHeight(): number;
|
27
|
+
/**
|
28
|
+
* Returns the max width of the paragraph. This method requires the layout
|
29
|
+
* method to have been called first.
|
30
|
+
*/
|
31
|
+
getMaxWidth(): number;
|
32
|
+
/**
|
33
|
+
* Returns the index of the glyph at the given position. This method requires
|
34
|
+
* the layout method to have been called first.
|
35
|
+
* @param x X coordinate of the position
|
36
|
+
* @param y Y coordinate of the position
|
37
|
+
*/
|
38
|
+
getGlyphPositionAtCoordinate(x: number, y: number): number;
|
39
|
+
/**
|
40
|
+
* Returns the bounding boxes of the glyphs in the given range. This method
|
41
|
+
* requires the layout method to have been called first.
|
42
|
+
* @param start Start index of the range
|
43
|
+
* @param end End index of the range
|
44
|
+
*/
|
45
|
+
getRectsForRange(start: number, end: number): SkRect[];
|
46
|
+
/**
|
47
|
+
* Returns the bounding boxes for all lines in the paragraph. This method
|
48
|
+
* requires the layout method to have been called first.
|
49
|
+
*/
|
50
|
+
getLineMetrics(): Array<SkRect>;
|
51
|
+
/**
|
52
|
+
* Returns a list of rects with direction info for the placeholders added
|
53
|
+
* to the paragraph.
|
54
|
+
*/
|
55
|
+
getRectsForPlaceholders(): SkRectWithDirection[];
|
56
|
+
}
|