@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,60 @@
|
|
1
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
2
|
+
import type { SkPaint } from "../Paint";
|
3
|
+
import type { SkParagraph } from "./Paragraph";
|
4
|
+
import type { SkParagraphStyle } from "./ParagraphStyle";
|
5
|
+
import type { SkTextStyle, TextBaseline } from "./TextStyle";
|
6
|
+
import type { SkTypefaceFontProvider } from "./TypefaceFontProvider";
|
7
|
+
export interface ParagraphBuilderFactory {
|
8
|
+
/**
|
9
|
+
* Creates a new ParagraphBuilder object from custom fonts.
|
10
|
+
* @param paragraphStyle Initial paragraph style
|
11
|
+
* @param typefaceProvider Typeface provider
|
12
|
+
*/
|
13
|
+
Make(paragraphStyle?: SkParagraphStyle, typefaceProvider?: SkTypefaceFontProvider): SkParagraphBuilder;
|
14
|
+
}
|
15
|
+
export declare enum PlaceholderAlignment {
|
16
|
+
Baseline = 0,
|
17
|
+
AboveBaseline = 1,
|
18
|
+
BelowBaseline = 2,
|
19
|
+
Top = 3,
|
20
|
+
Bottom = 4,
|
21
|
+
Middle = 5
|
22
|
+
}
|
23
|
+
export interface SkParagraphBuilder extends SkJSIInstance<"ParagraphBuilder"> {
|
24
|
+
/**
|
25
|
+
* Creates a Paragraph object from the builder and the inputs given to the builder.
|
26
|
+
*/
|
27
|
+
build(): SkParagraph;
|
28
|
+
/**
|
29
|
+
* Restores the builder to its initial empty state.
|
30
|
+
*/
|
31
|
+
reset(): void;
|
32
|
+
/**
|
33
|
+
* Pushes a text-style to the builder
|
34
|
+
* @param style Style to push
|
35
|
+
* @param foregroundPaint Foreground paint object
|
36
|
+
* @param backgroundPaint Background paint object
|
37
|
+
* @returns The builder
|
38
|
+
*/
|
39
|
+
pushStyle: (style: SkTextStyle, foregroundPaint?: SkPaint | undefined, backgroundPaint?: SkPaint | undefined) => SkParagraphBuilder;
|
40
|
+
/**
|
41
|
+
* Pops the current text style from the builder
|
42
|
+
* @returns The builder
|
43
|
+
*/
|
44
|
+
pop: () => SkParagraphBuilder;
|
45
|
+
/**
|
46
|
+
* Adds text to the builder
|
47
|
+
* @param text
|
48
|
+
* @returns The builder
|
49
|
+
*/
|
50
|
+
addText: (text: string) => SkParagraphBuilder;
|
51
|
+
/**
|
52
|
+
* Pushes the information required to leave an open space.
|
53
|
+
* @param width
|
54
|
+
* @param height
|
55
|
+
* @param alignment
|
56
|
+
* @param baseline
|
57
|
+
* @param offset
|
58
|
+
*/
|
59
|
+
addPlaceholder(width?: number, height?: number, alignment?: PlaceholderAlignment, baseline?: TextBaseline, offset?: number): SkParagraphBuilder;
|
60
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import type { SkTextFontStyle, SkTextStyle } from "./TextStyle";
|
2
|
+
export declare enum SkTextDirection {
|
3
|
+
RTL = 0,
|
4
|
+
LTR = 1
|
5
|
+
}
|
6
|
+
export declare enum SkTextAlign {
|
7
|
+
Left = 0,
|
8
|
+
Right = 1,
|
9
|
+
Center = 2,
|
10
|
+
Justify = 3,
|
11
|
+
Start = 4,
|
12
|
+
End = 5
|
13
|
+
}
|
14
|
+
export interface SkStrutStyle {
|
15
|
+
strutEnabled?: boolean;
|
16
|
+
fontFamilies?: string[];
|
17
|
+
fontStyle?: SkTextFontStyle;
|
18
|
+
fontSize?: number;
|
19
|
+
heightMultiplier?: number;
|
20
|
+
halfLeading?: boolean;
|
21
|
+
leading?: number;
|
22
|
+
forceStrutHeight?: boolean;
|
23
|
+
}
|
24
|
+
export declare enum SkTextHeightBehavior {
|
25
|
+
All = 0,
|
26
|
+
DisableFirstAscent = 1,
|
27
|
+
DisableLastDescent = 2,
|
28
|
+
DisableAll = 3
|
29
|
+
}
|
30
|
+
export interface SkParagraphStyle {
|
31
|
+
disableHinting?: boolean;
|
32
|
+
ellipsis?: string;
|
33
|
+
heightMultiplier?: number;
|
34
|
+
maxLines?: number;
|
35
|
+
replaceTabCharacters?: boolean;
|
36
|
+
strutStyle?: SkStrutStyle;
|
37
|
+
textAlign?: SkTextAlign;
|
38
|
+
textDirection?: SkTextDirection;
|
39
|
+
textHeightBehavior?: SkTextHeightBehavior;
|
40
|
+
textStyle?: SkTextStyle;
|
41
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import type { SkColor } from "../Color";
|
2
|
+
import type { FontSlant, FontWeight, FontWidth } from "../Font";
|
3
|
+
import type { SkPoint } from "../Point";
|
4
|
+
export declare enum TextDecoration {
|
5
|
+
NoDecoration = 0,
|
6
|
+
Underline = 1,
|
7
|
+
Overline = 2,
|
8
|
+
LineThrough = 4
|
9
|
+
}
|
10
|
+
export declare enum TextDecorationStyle {
|
11
|
+
Solid = 0,
|
12
|
+
Double = 1,
|
13
|
+
Dotted = 2,
|
14
|
+
Dashed = 3,
|
15
|
+
Wavy = 4
|
16
|
+
}
|
17
|
+
export interface SkTextShadow {
|
18
|
+
color?: SkColor;
|
19
|
+
/**
|
20
|
+
* 2d array for x and y offset. Defaults to [0, 0]
|
21
|
+
*/
|
22
|
+
offset?: SkPoint;
|
23
|
+
blurRadius?: number;
|
24
|
+
}
|
25
|
+
export interface SkTextFontFeatures {
|
26
|
+
name: string;
|
27
|
+
value: number;
|
28
|
+
}
|
29
|
+
export interface SkTextFontStyle {
|
30
|
+
weight?: FontWeight;
|
31
|
+
width?: FontWidth;
|
32
|
+
slant?: FontSlant;
|
33
|
+
}
|
34
|
+
export interface SkTextFontVariations {
|
35
|
+
axis: string;
|
36
|
+
value: number;
|
37
|
+
}
|
38
|
+
export declare enum TextBaseline {
|
39
|
+
Alphabetic = 0,
|
40
|
+
Ideographic = 1
|
41
|
+
}
|
42
|
+
export interface SkTextStyle {
|
43
|
+
backgroundColor?: SkColor;
|
44
|
+
color?: SkColor;
|
45
|
+
decoration?: number;
|
46
|
+
decorationColor?: SkColor;
|
47
|
+
decorationThickness?: number;
|
48
|
+
decorationStyle?: TextDecoration;
|
49
|
+
fontFamilies?: string[];
|
50
|
+
fontFeatures?: SkTextFontFeatures[];
|
51
|
+
fontSize?: number;
|
52
|
+
fontStyle?: SkTextFontStyle;
|
53
|
+
fontVariations?: SkTextFontVariations[];
|
54
|
+
foregroundColor?: SkColor;
|
55
|
+
heightMultiplier?: number;
|
56
|
+
halfLeading?: boolean;
|
57
|
+
letterSpacing?: number;
|
58
|
+
locale?: string;
|
59
|
+
shadows?: SkTextShadow[];
|
60
|
+
textBaseline?: TextBaseline;
|
61
|
+
wordSpacing?: number;
|
62
|
+
}
|
@@ -25,6 +25,7 @@ import type { PictureFactory, SkPictureRecorder } from "./Picture";
|
|
25
25
|
import type { Color, SkColor } from "./Color";
|
26
26
|
import type { TypefaceFontProviderFactory } from "./Paragraph/TypefaceFontProviderFactory";
|
27
27
|
import type { AnimatedImageFactory } from "./AnimatedImage";
|
28
|
+
import type { ParagraphBuilderFactory } from "./Paragraph/ParagraphBuilder";
|
28
29
|
/**
|
29
30
|
* Declares the interface for the native Skia API
|
30
31
|
*/
|
@@ -68,4 +69,5 @@ export interface Skia {
|
|
68
69
|
SVG: SVGFactory;
|
69
70
|
TextBlob: TextBlobFactory;
|
70
71
|
Surface: SurfaceFactory;
|
72
|
+
ParagraphBuilder: ParagraphBuilderFactory;
|
71
73
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { CanvasKit, Paragraph } from "canvaskit-wasm";
|
2
|
+
import type { SkRect, SkRectWithDirection, SkParagraph } from "../types";
|
3
|
+
import { HostObject } from "./Host";
|
4
|
+
import type { JsiSkCanvas } from "./JsiSkCanvas";
|
5
|
+
export declare class JsiSkParagraph extends HostObject<Paragraph, "Paragraph"> implements SkParagraph {
|
6
|
+
constructor(CanvasKit: CanvasKit, ref: Paragraph);
|
7
|
+
layout(width: number): void;
|
8
|
+
paint(canvas: JsiSkCanvas, x: number, y: number): void;
|
9
|
+
getHeight(): number;
|
10
|
+
getMaxWidth(): number;
|
11
|
+
getGlyphPositionAtCoordinate(x: number, y: number): number;
|
12
|
+
getRectsForPlaceholders(): SkRectWithDirection[];
|
13
|
+
getRectsForRange(start: number, end: number): SkRect[];
|
14
|
+
getLineMetrics(): SkRect[];
|
15
|
+
dispose(): void;
|
16
|
+
}
|
@@ -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,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
|
+
}
|
Binary file
|
Binary file
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libskottie.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
+
<string>x86_64</string>
|
16
17
|
</array>
|
17
18
|
<key>SupportedPlatform</key>
|
18
19
|
<string>ios</string>
|
20
|
+
<key>SupportedPlatformVariant</key>
|
21
|
+
<string>simulator</string>
|
19
22
|
</dict>
|
20
23
|
<dict>
|
21
24
|
<key>LibraryIdentifier</key>
|
22
|
-
<string>ios-
|
25
|
+
<string>ios-arm64_arm64e</string>
|
23
26
|
<key>LibraryPath</key>
|
24
27
|
<string>libskottie.a</string>
|
25
28
|
<key>SupportedArchitectures</key>
|
26
29
|
<array>
|
27
30
|
<string>arm64</string>
|
28
31
|
<string>arm64e</string>
|
29
|
-
<string>x86_64</string>
|
30
32
|
</array>
|
31
33
|
<key>SupportedPlatform</key>
|
32
34
|
<string>ios</string>
|
33
|
-
<key>SupportedPlatformVariant</key>
|
34
|
-
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libskparagraph.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
+
<string>x86_64</string>
|
16
17
|
</array>
|
17
18
|
<key>SupportedPlatform</key>
|
18
19
|
<string>ios</string>
|
20
|
+
<key>SupportedPlatformVariant</key>
|
21
|
+
<string>simulator</string>
|
19
22
|
</dict>
|
20
23
|
<dict>
|
21
24
|
<key>LibraryIdentifier</key>
|
22
|
-
<string>ios-
|
25
|
+
<string>ios-arm64_arm64e</string>
|
23
26
|
<key>LibraryPath</key>
|
24
27
|
<string>libskparagraph.a</string>
|
25
28
|
<key>SupportedArchitectures</key>
|
26
29
|
<array>
|
27
30
|
<string>arm64</string>
|
28
31
|
<string>arm64e</string>
|
29
|
-
<string>x86_64</string>
|
30
32
|
</array>
|
31
33
|
<key>SupportedPlatform</key>
|
32
34
|
<string>ios</string>
|
33
|
-
<key>SupportedPlatformVariant</key>
|
34
|
-
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -6,32 +6,32 @@
|
|
6
6
|
<array>
|
7
7
|
<dict>
|
8
8
|
<key>LibraryIdentifier</key>
|
9
|
-
<string>ios-
|
9
|
+
<string>ios-arm64_arm64e_x86_64-simulator</string>
|
10
10
|
<key>LibraryPath</key>
|
11
11
|
<string>libsvg.a</string>
|
12
12
|
<key>SupportedArchitectures</key>
|
13
13
|
<array>
|
14
14
|
<string>arm64</string>
|
15
15
|
<string>arm64e</string>
|
16
|
+
<string>x86_64</string>
|
16
17
|
</array>
|
17
18
|
<key>SupportedPlatform</key>
|
18
19
|
<string>ios</string>
|
20
|
+
<key>SupportedPlatformVariant</key>
|
21
|
+
<string>simulator</string>
|
19
22
|
</dict>
|
20
23
|
<dict>
|
21
24
|
<key>LibraryIdentifier</key>
|
22
|
-
<string>ios-
|
25
|
+
<string>ios-arm64_arm64e</string>
|
23
26
|
<key>LibraryPath</key>
|
24
27
|
<string>libsvg.a</string>
|
25
28
|
<key>SupportedArchitectures</key>
|
26
29
|
<array>
|
27
30
|
<string>arm64</string>
|
28
31
|
<string>arm64e</string>
|
29
|
-
<string>x86_64</string>
|
30
32
|
</array>
|
31
33
|
<key>SupportedPlatform</key>
|
32
34
|
<string>ios</string>
|
33
|
-
<key>SupportedPlatformVariant</key>
|
34
|
-
<string>simulator</string>
|
35
35
|
</dict>
|
36
36
|
</array>
|
37
37
|
<key>CFBundlePackageType</key>
|
Binary file
|
Binary file
|
package/package.json
CHANGED
@@ -57,6 +57,7 @@ import type {
|
|
57
57
|
Path2DPathEffectProps,
|
58
58
|
} from "../types/PathEffects";
|
59
59
|
import { NATIVE_DOM } from "../../renderer/HostComponents";
|
60
|
+
import type { ParagraphProps } from "../types/Paragraph";
|
60
61
|
|
61
62
|
import {
|
62
63
|
FillNode,
|
@@ -123,6 +124,7 @@ import { GroupNode } from "./GroupNode";
|
|
123
124
|
import { PaintNode } from "./PaintNode";
|
124
125
|
import type { NodeContext } from "./Node";
|
125
126
|
import { LayerNode } from "./LayerNode";
|
127
|
+
import { ParagraphNode } from "./drawings/ParagraphNode";
|
126
128
|
|
127
129
|
export class JsiSkDOM implements SkDOM {
|
128
130
|
constructor(private ctx: NodeContext) {}
|
@@ -470,4 +472,11 @@ export class JsiSkDOM implements SkDOM {
|
|
470
472
|
? global.SkiaDomApi.BoxShadowNode(props)
|
471
473
|
: new BoxShadowNode(this.ctx, props);
|
472
474
|
}
|
475
|
+
|
476
|
+
// Paragraph
|
477
|
+
Paragraph(props: ParagraphProps) {
|
478
|
+
return NATIVE_DOM
|
479
|
+
? global.SkiaDomApi.ParagraphNode(props)
|
480
|
+
: new ParagraphNode(this.ctx, props);
|
481
|
+
}
|
473
482
|
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import type { DrawingContext, ParagraphProps } from "../../types";
|
2
|
+
import { NodeType } from "../../types";
|
3
|
+
import { JsiDrawingNode } from "../DrawingNode";
|
4
|
+
import type { NodeContext } from "../Node";
|
5
|
+
|
6
|
+
export class ParagraphNode extends JsiDrawingNode<ParagraphProps, null> {
|
7
|
+
constructor(ctx: NodeContext, props: ParagraphProps) {
|
8
|
+
super(ctx, NodeType.Paragraph, props);
|
9
|
+
}
|
10
|
+
|
11
|
+
deriveProps() {
|
12
|
+
return null;
|
13
|
+
}
|
14
|
+
|
15
|
+
draw({ canvas }: DrawingContext) {
|
16
|
+
const { paragraph, x, y, width } = this.props;
|
17
|
+
if (paragraph) {
|
18
|
+
paragraph.layout(width);
|
19
|
+
paragraph.paint(canvas, x, y);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
package/src/dom/types/SkDOM.ts
CHANGED
@@ -58,6 +58,7 @@ import type {
|
|
58
58
|
Path1DPathEffectProps,
|
59
59
|
Path2DPathEffectProps,
|
60
60
|
} from "./PathEffects";
|
61
|
+
import type { ParagraphProps } from "./Paragraph";
|
61
62
|
|
62
63
|
type ImageFilterNode<P> = DeclarationNode<P>;
|
63
64
|
|
@@ -179,4 +180,7 @@ export interface SkDOM {
|
|
179
180
|
BackdropFilter(props: ChildrenProps): RenderNode<ChildrenProps>;
|
180
181
|
Box(props: BoxProps): RenderNode<BoxProps>;
|
181
182
|
BoxShadow(props: BoxShadowProps): DeclarationNode<BoxShadowProps>;
|
183
|
+
|
184
|
+
// Paragraph
|
185
|
+
Paragraph(props: ParagraphProps): RenderNode<ParagraphProps>;
|
182
186
|
}
|
package/src/dom/types/index.ts
CHANGED
@@ -50,6 +50,7 @@ import type {
|
|
50
50
|
LerpColorFilterProps,
|
51
51
|
BoxProps,
|
52
52
|
BoxShadowProps,
|
53
|
+
ParagraphProps,
|
53
54
|
} from "../dom/types";
|
54
55
|
import type { ChildrenProps } from "../dom/types/Common";
|
55
56
|
import type {
|
@@ -193,6 +194,9 @@ declare global {
|
|
193
194
|
BoxNode: (prop: BoxProps) => RenderNode<BoxProps>;
|
194
195
|
BoxShadowNode: (prop: BoxShadowProps) => DeclarationNode<BoxShadowProps>;
|
195
196
|
LayerNode: (prop: ChildrenProps) => RenderNode<ChildrenProps>;
|
197
|
+
|
198
|
+
// Paragraph
|
199
|
+
ParagraphNode: (props: ParagraphProps) => RenderNode<ParagraphProps>;
|
196
200
|
};
|
197
201
|
|
198
202
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
@@ -268,6 +272,9 @@ declare global {
|
|
268
272
|
skBackdropFilter: SkiaProps<ChildrenProps>;
|
269
273
|
skBox: SkiaProps<BoxProps>;
|
270
274
|
skBoxShadow: SkiaProps<BoxShadowProps>;
|
275
|
+
|
276
|
+
// Paragraph
|
277
|
+
skParagraph: SkiaProps<ParagraphProps>;
|
271
278
|
}
|
272
279
|
}
|
273
280
|
}
|
@@ -399,6 +406,9 @@ export const createNode = (
|
|
399
406
|
return Sk.Box(props);
|
400
407
|
case NodeType.BoxShadow:
|
401
408
|
return Sk.BoxShadow(props);
|
409
|
+
// Paragraph
|
410
|
+
case NodeType.Paragraph:
|
411
|
+
return Sk.Paragraph(props);
|
402
412
|
default:
|
403
413
|
return exhaustiveCheck(type);
|
404
414
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./Paragraph";
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import type { SkCanvas } from "../Canvas";
|
2
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
3
|
+
import type { SkRect } from "../Rect";
|
4
|
+
|
5
|
+
import type { SkTextDirection } from "./ParagraphStyle";
|
6
|
+
|
7
|
+
export interface SkRectWithDirection {
|
8
|
+
rect: SkRect;
|
9
|
+
direction: SkTextDirection;
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface SkParagraph extends SkJSIInstance<"Paragraph"> {
|
13
|
+
/**
|
14
|
+
* Calculates the position of the the glyphs in the paragraph
|
15
|
+
* @param width Max width of the paragraph
|
16
|
+
*/
|
17
|
+
layout(width: number): void;
|
18
|
+
/**
|
19
|
+
* Paints the paragraph to the provded canvas
|
20
|
+
* @param canvas Canvas to paint into
|
21
|
+
* @param x X coordinate to paint at
|
22
|
+
* @param y Y coordinate to paint at
|
23
|
+
*/
|
24
|
+
paint(canvas: SkCanvas, x: number, y: number): void;
|
25
|
+
/**
|
26
|
+
* Returns the height of the paragraph. This method requires the layout
|
27
|
+
* method to have been called first.
|
28
|
+
*/
|
29
|
+
getHeight(): number;
|
30
|
+
/**
|
31
|
+
* Returns the max width of the paragraph. This method requires the layout
|
32
|
+
* method to have been called first.
|
33
|
+
*/
|
34
|
+
getMaxWidth(): number;
|
35
|
+
/**
|
36
|
+
* Returns the index of the glyph at the given position. This method requires
|
37
|
+
* the layout method to have been called first.
|
38
|
+
* @param x X coordinate of the position
|
39
|
+
* @param y Y coordinate of the position
|
40
|
+
*/
|
41
|
+
getGlyphPositionAtCoordinate(x: number, y: number): number;
|
42
|
+
/**
|
43
|
+
* Returns the bounding boxes of the glyphs in the given range. This method
|
44
|
+
* requires the layout method to have been called first.
|
45
|
+
* @param start Start index of the range
|
46
|
+
* @param end End index of the range
|
47
|
+
*/
|
48
|
+
getRectsForRange(start: number, end: number): SkRect[];
|
49
|
+
/**
|
50
|
+
* Returns the bounding boxes for all lines in the paragraph. This method
|
51
|
+
* requires the layout method to have been called first.
|
52
|
+
*/
|
53
|
+
getLineMetrics(): Array<SkRect>;
|
54
|
+
/**
|
55
|
+
* Returns a list of rects with direction info for the placeholders added
|
56
|
+
* to the paragraph.
|
57
|
+
*/
|
58
|
+
getRectsForPlaceholders(): SkRectWithDirection[];
|
59
|
+
}
|