modern-canvas 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { Visibility, Overflow, FontWeight, FontStyle, FontKerning, TextWrap, TextAlign, VerticalAlign, TextTransform, TextDecoration, WritingMode, IDOCTextContent, IDOCStyleDeclaration } from 'modern-idoc';
1
+ import { Visibility, Overflow, IDOCTextStyleDeclaration, IDOCTransformStyleDeclaration } from 'modern-idoc';
2
+ import { CurvePath, LineStyle, Path2D, LineCap, LineJoin, BoundingBox } from 'modern-path2d';
2
3
  import { AnyColor, Colord } from 'colord';
3
4
  import { AnimationItem } from 'lottie-web';
4
- import { MeasureResult } from 'modern-text';
5
+ import { TextOptions, Text, MeasureResult } from 'modern-text';
5
6
  import { Font } from 'modern-font';
6
7
 
7
8
  interface CssFunctionArg {
@@ -885,6 +886,16 @@ declare abstract class Matrix extends EventEmitter {
885
886
  toJSON(): number[];
886
887
  }
887
888
 
889
+ /**
890
+ * Matrix2
891
+ *
892
+ * | x0 | y0 |
893
+ * | x1 | y1 |
894
+ */
895
+ declare class Matrix2 extends Matrix {
896
+ constructor(array?: number[]);
897
+ }
898
+
888
899
  /**
889
900
  * Matrix3
890
901
  *
@@ -897,6 +908,30 @@ declare class Matrix3 extends Matrix {
897
908
  invert(): this;
898
909
  }
899
910
 
911
+ /**
912
+ * Matrix4
913
+ *
914
+ * | x0 | y0 | z0 | m0 |
915
+ * | x1 | y1 | z1 | m1 |
916
+ * | x2 | y2 | z2 | m2 |
917
+ */
918
+ declare class Matrix4 extends Matrix {
919
+ constructor(array?: number[]);
920
+ }
921
+
922
+ declare class Projection2D extends Matrix3 {
923
+ protected _x: number;
924
+ protected _y: number;
925
+ protected _width: number;
926
+ protected _height: number;
927
+ protected _flipY: boolean;
928
+ constructor(_x?: number, _y?: number, _width?: number, _height?: number, _flipY?: boolean);
929
+ flipY(flipY: boolean): this;
930
+ translate(x: number, y: number): this;
931
+ resize(width: number, height: number): this;
932
+ protected _performUpdateArray(): void;
933
+ }
934
+
900
935
  interface Transform2DObject {
901
936
  a: number;
902
937
  c: number;
@@ -963,354 +998,6 @@ declare class Transform2D extends Matrix3 {
963
998
  toObject(): Transform2DObject;
964
999
  }
965
1000
 
966
- interface Shape {
967
- x: number;
968
- y: number;
969
- contains: (x: number, y: number) => boolean;
970
- strokeContains: (x: number, y: number, strokeWidth: number) => boolean;
971
- getBounds: (out?: Rectangle) => Rectangle;
972
- buildOutline: (points: number[]) => void;
973
- buildGeometry: (vertices: number[], indices: number[]) => void;
974
- }
975
-
976
- declare class Rectangle implements Shape {
977
- x: number;
978
- y: number;
979
- width: number;
980
- height: number;
981
- get left(): number;
982
- get right(): number;
983
- get top(): number;
984
- get bottom(): number;
985
- isEmpty(): boolean;
986
- constructor(x?: number, y?: number, width?: number, height?: number);
987
- copyFromBounds(bounds: Bounds): this;
988
- contains(x: number, y: number): boolean;
989
- strokeContains(x: number, y: number, strokeWidth: number): boolean;
990
- clone(): Rectangle;
991
- copyFrom(rectangle: Rectangle): void;
992
- copyTo(rectangle: Rectangle): void;
993
- intersects(other: Rectangle, transform?: Transform2D): boolean;
994
- pad(paddingX?: number, paddingY?: number): this;
995
- fit(rectangle: Rectangle): this;
996
- ceil(resolution?: number, eps?: number): this;
997
- enlarge(rectangle: Rectangle): this;
998
- getBounds(out?: Rectangle): Rectangle;
999
- buildOutline(points: number[]): void;
1000
- buildGeometry(vertices: number[], indices: number[]): void;
1001
- }
1002
-
1003
- interface BoundsData {
1004
- minX: number;
1005
- minY: number;
1006
- maxX: number;
1007
- maxY: number;
1008
- }
1009
- declare class Bounds {
1010
- minX: number;
1011
- minY: number;
1012
- maxX: number;
1013
- maxY: number;
1014
- matrix: Transform2D;
1015
- protected _rectangle?: Rectangle;
1016
- get x(): number;
1017
- set x(value: number);
1018
- get y(): number;
1019
- set y(value: number);
1020
- get width(): number;
1021
- set width(value: number);
1022
- get height(): number;
1023
- set height(value: number);
1024
- get left(): number;
1025
- get right(): number;
1026
- get top(): number;
1027
- get bottom(): number;
1028
- get isPositive(): boolean;
1029
- get isValid(): boolean;
1030
- constructor(minX?: number, minY?: number, maxX?: number, maxY?: number);
1031
- isEmpty(): boolean;
1032
- get rectangle(): Rectangle;
1033
- clear(): this;
1034
- set(x0: number, y0: number, x1: number, y1: number): this;
1035
- addFrame(x0: number, y0: number, x1: number, y1: number, matrix?: Transform2D): void;
1036
- addRect(rect: Rectangle, matrix?: Transform2D): this;
1037
- addBounds(bounds: BoundsData, matrix?: Transform2D): this;
1038
- addBoundsMask(mask: Bounds): void;
1039
- applyMatrix(matrix: Transform2D): void;
1040
- fit(rect: Rectangle): this;
1041
- fitBounds(left: number, right: number, top: number, bottom: number): this;
1042
- pad(paddingX: number, paddingY?: number): this;
1043
- ceil(): this;
1044
- clone(): Bounds;
1045
- scale(x: number, y?: number): this;
1046
- addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number, matrix?: Transform2D): void;
1047
- containsPoint(x: number, y: number): boolean;
1048
- }
1049
-
1050
- declare function buildAdaptiveBezier(points: number[], sX: number, sY: number, cp1x: number, cp1y: number, cp2x: number, cp2y: number, eX: number, eY: number, smoothness?: number): number[];
1051
-
1052
- declare function buildAdaptiveQuadratic(points: number[], sX: number, sY: number, cp1x: number, cp1y: number, eX: number, eY: number, smoothness?: number): number[];
1053
-
1054
- declare function buildArc(points: number[], x: number, y: number, radius: number, start: number, end: number, clockwise: boolean, steps?: number): void;
1055
-
1056
- /**
1057
- * The arcTo() method creates an arc/curve between two tangents on the canvas.
1058
- * "borrowed" from https://code.google.com/p/fxcanvas/ - thanks google!
1059
- * @param points
1060
- * @param x1
1061
- * @param y1
1062
- * @param x2
1063
- * @param y2
1064
- * @param radius
1065
- */
1066
- declare function buildArcTo(points: number[], x1: number, y1: number, x2: number, y2: number, radius: number): void;
1067
-
1068
- declare function buildArcToSvg(points: number[], px: number, py: number, cx: number, cy: number, rx: number, ry: number, xAxisRotation?: number, largeArcFlag?: number, sweepFlag?: number): void;
1069
-
1070
- declare class Circle implements Shape {
1071
- x: number;
1072
- y: number;
1073
- radius: number;
1074
- constructor(x?: number, y?: number, radius?: number);
1075
- contains(x: number, y: number): boolean;
1076
- strokeContains(x: number, y: number, width: number): boolean;
1077
- clone(): Circle;
1078
- copyFrom(circle: Circle): this;
1079
- copyTo(circle: Circle): Circle;
1080
- getBounds(out?: Rectangle): Rectangle;
1081
- buildOutline(points: number[]): void;
1082
- buildGeometry(vertices: number[], indices: number[]): void;
1083
- }
1084
-
1085
- declare class Ellipse implements Shape {
1086
- x: number;
1087
- y: number;
1088
- halfWidth: number;
1089
- halfHeight: number;
1090
- constructor(x?: number, y?: number, halfWidth?: number, halfHeight?: number);
1091
- contains(x: number, y: number): boolean;
1092
- strokeContains(x: number, y: number, width: number): boolean;
1093
- clone(): Ellipse;
1094
- copyFrom(ellipse: Ellipse): this;
1095
- copyTo(ellipse: Ellipse): Ellipse;
1096
- getBounds(): Rectangle;
1097
- buildOutline(points: number[]): void;
1098
- buildGeometry(vertices: number[], indices: number[]): void;
1099
- }
1100
-
1101
- interface PointData {
1102
- x: number;
1103
- y: number;
1104
- }
1105
- interface PointLike extends PointData {
1106
- copyFrom: (p: PointData) => this;
1107
- copyTo: <T extends PointLike>(p: T) => T;
1108
- equals: (p: PointData) => boolean;
1109
- set: (x?: number, y?: number) => void;
1110
- }
1111
- declare class Point {
1112
- x: number;
1113
- y: number;
1114
- protected static _shared?: Point;
1115
- static get shared(): Point;
1116
- constructor(x?: number, y?: number);
1117
- copyFrom(p: PointData): this;
1118
- copyTo<T extends PointLike>(p: T): T;
1119
- equals(p: PointData): boolean;
1120
- set(x?: number, y?: number): this;
1121
- }
1122
-
1123
- declare class Polygon implements Shape {
1124
- points: number[];
1125
- closed: boolean;
1126
- get lastX(): number;
1127
- get lastY(): number;
1128
- get x(): number;
1129
- get y(): number;
1130
- constructor(points: PointData[] | number[]);
1131
- constructor(...points: PointData[] | number[]);
1132
- reset(): this;
1133
- contains(x: number, y: number): boolean;
1134
- strokeContains(x: number, y: number, strokeWidth: number): boolean;
1135
- clone(): Polygon;
1136
- copyFrom(polygon: Polygon): this;
1137
- copyTo(polygon: Polygon): Polygon;
1138
- getBounds(out?: Rectangle): Rectangle;
1139
- buildOutline(points: number[]): void;
1140
- buildGeometry(vertices: number[], indices: number[]): void;
1141
- }
1142
-
1143
- declare class RoundedRectangle implements Shape {
1144
- x: number;
1145
- y: number;
1146
- width: number;
1147
- height: number;
1148
- radius: number;
1149
- constructor(x?: number, y?: number, width?: number, height?: number, radius?: number);
1150
- getBounds(out?: Rectangle): Rectangle;
1151
- clone(): RoundedRectangle;
1152
- copyFrom(rectangle: RoundedRectangle): this;
1153
- copyTo(rectangle: RoundedRectangle): RoundedRectangle;
1154
- contains(x: number, y: number): boolean;
1155
- strokeContains(pX: number, pY: number, strokeWidth: number): boolean;
1156
- buildOutline(points: number[]): void;
1157
- buildGeometry(vertices: number[], indices: number[]): void;
1158
- }
1159
-
1160
- declare class Star extends Polygon {
1161
- constructor(x?: number, y?: number, points?: number, radius?: number, innerRadius?: number, rotation?: number);
1162
- }
1163
-
1164
- declare function squaredDistanceToLineSegment(x: number, y: number, x1: number, y1: number, x2: number, y2: number): number;
1165
- declare class Triangle implements Shape {
1166
- x: number;
1167
- y: number;
1168
- x2: number;
1169
- y2: number;
1170
- x3: number;
1171
- y3: number;
1172
- constructor(x?: number, y?: number, x2?: number, y2?: number, x3?: number, y3?: number);
1173
- contains(x: number, y: number): boolean;
1174
- strokeContains(pointX: number, pointY: number, strokeWidth: number): boolean;
1175
- clone(): Triangle;
1176
- copyFrom(triangle: Triangle): this;
1177
- copyTo(triangle: Triangle): Triangle;
1178
- getBounds(out?: Rectangle): Rectangle;
1179
- buildOutline(points: number[]): void;
1180
- buildGeometry(vertices: number[], indices: number[]): void;
1181
- }
1182
-
1183
- interface ShapeBuildCommand<T extends Shape = Shape> {
1184
- build: (shape: T, points: number[]) => void;
1185
- triangulate: (points: number[], vertices: number[], verticesStride: number, verticesOffset: number, indices: number[], indicesOffset: number) => void;
1186
- }
1187
-
1188
- type RoundedShape = Circle | Ellipse | RoundedRectangle;
1189
- declare const buildCircle: ShapeBuildCommand<RoundedShape>;
1190
-
1191
- type LineCap = 'butt' | 'round' | 'square';
1192
- type LineJoin = 'round' | 'bevel' | 'miter';
1193
- declare const closePointEps = 0.0001;
1194
- declare const curveEps = 0.0001;
1195
- interface LineStyle {
1196
- width: number;
1197
- alignment: number;
1198
- join: LineJoin;
1199
- cap: LineCap;
1200
- miterLimit: number;
1201
- }
1202
- /**
1203
- * Builds a line to draw using the polygon method.
1204
- * @param points
1205
- * @param lineStyle
1206
- * @param flipAlignment
1207
- * @param closed
1208
- * @param vertices
1209
- * @param _verticesStride
1210
- * @param _verticesOffset
1211
- * @param indices
1212
- * @param _indicesOffset
1213
- */
1214
- declare function buildLine(points: number[], lineStyle: LineStyle, flipAlignment: boolean, closed: boolean, vertices: number[], _verticesStride: number, _verticesOffset: number, indices: number[], _indicesOffset: number): void;
1215
-
1216
- declare const buildPolygon: ShapeBuildCommand<Polygon>;
1217
-
1218
- declare const buildRectangle: ShapeBuildCommand<Rectangle>;
1219
-
1220
- declare const buildTriangle: ShapeBuildCommand<Triangle>;
1221
-
1222
- interface Path2DShape {
1223
- shape: Shape;
1224
- transform?: Transform2D;
1225
- }
1226
- declare class Path2D {
1227
- protected _polygon?: Polygon;
1228
- protected _bounds: Bounds;
1229
- shapes: Path2DShape[];
1230
- get bounds(): Bounds;
1231
- startPolygon(x: number, y: number): this;
1232
- endPolygon(closePath?: boolean): this;
1233
- ensurePolygon(start?: boolean): void;
1234
- beginPath(): this;
1235
- moveTo(x: number, y: number): this;
1236
- lineTo(x: number, y: number): this;
1237
- bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): this;
1238
- quadraticCurveTo(cp1x: number, cp1y: number, x: number, y: number, smoothing?: number): this;
1239
- rect(x: number, y: number, width: number, height: number, transform?: Transform2D): void;
1240
- roundRect(x: number, y: number, width: number, height: number, radii: number, transform?: Transform2D): void;
1241
- ellipse(x: number, y: number, radiusX: number, radiusY: number, transform?: Transform2D): void;
1242
- arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise: boolean): this;
1243
- ellipticalArc(rx: number, ry: number, xAxisRotation: number, largeArcFlag: number, sweepFlag: number, x: number, y: number): this;
1244
- poly(points: number[] | PointData[], close?: boolean, transform?: Transform2D): this;
1245
- addShape(shape: Shape, transform?: Transform2D): this;
1246
- addPath(path2D: Path2D): this;
1247
- addSVGPath(d: string): this;
1248
- closePath(): this;
1249
- buildOutline(points?: number[]): number[];
1250
- buildGeometry(vertices?: number[], indices?: number[]): {
1251
- vertices: number[];
1252
- indices: number[];
1253
- };
1254
- }
1255
-
1256
- type SVGPathDefineCommand = 'a' | 's' | 't' | 'v' | 'z' | 'q' | 'g' | 'm' | 'h' | 'l' | 'c' | 'A' | 'S' | 'T' | 'V' | 'Z' | 'Q' | 'G' | 'M' | 'H' | 'L' | 'C';
1257
- interface SVGPathDefine {
1258
- command: SVGPathDefineCommand;
1259
- args: number[];
1260
- }
1261
- type Path2DCallMethod = 'moveTo' | 'lineTo' | 'bezierCurveTo' | 'quadraticCurveTo' | 'ellipticalArc' | 'closePath' | 'rect' | 'roundRect' | 'circle' | 'ellipse' | 'arc' | 'poly' | 'addPath' | 'arcTo' | 'regularPoly' | 'roundPoly' | 'roundShape' | 'filletRect' | 'chamferRect';
1262
- interface Path2DCall {
1263
- method: Path2DCallMethod;
1264
- args: any[];
1265
- }
1266
- declare class SVGPath {
1267
- defines: SVGPathDefine[];
1268
- protected _calls: Path2DCall[];
1269
- protected _dirty: boolean;
1270
- get path2D(): Path2D;
1271
- constructor(d: string | SVGPath);
1272
- protected _addCall(method: Path2DCallMethod, args?: any[], dirty?: boolean): this;
1273
- protected _parseDefines(d: string): SVGPathDefine[];
1274
- update(): void;
1275
- protected _getLastPoint(out: Point): Point;
1276
- protected _smoothBezierCurveTo(cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): this;
1277
- protected _smoothQuadraticCurveTo(x: number, y: number, smoothness?: number): this;
1278
- }
1279
-
1280
- /**
1281
- * Matrix2
1282
- *
1283
- * | x0 | y0 |
1284
- * | x1 | y1 |
1285
- */
1286
- declare class Matrix2 extends Matrix {
1287
- constructor(array?: number[]);
1288
- }
1289
-
1290
- /**
1291
- * Matrix4
1292
- *
1293
- * | x0 | y0 | z0 | m0 |
1294
- * | x1 | y1 | z1 | m1 |
1295
- * | x2 | y2 | z2 | m2 |
1296
- */
1297
- declare class Matrix4 extends Matrix {
1298
- constructor(array?: number[]);
1299
- }
1300
-
1301
- declare class Projection2D extends Matrix3 {
1302
- protected _x: number;
1303
- protected _y: number;
1304
- protected _width: number;
1305
- protected _height: number;
1306
- protected _flipY: boolean;
1307
- constructor(_x?: number, _y?: number, _width?: number, _height?: number, _flipY?: boolean);
1308
- flipY(flipY: boolean): this;
1309
- translate(x: number, y: number): this;
1310
- resize(width: number, height: number): this;
1311
- protected _performUpdateArray(): void;
1312
- }
1313
-
1314
1001
  declare const DEG_TO_RAD: number;
1315
1002
  declare const RAD_TO_DEG: number;
1316
1003
  declare function clamp(min: number, val: number, max: number): number;
@@ -1801,31 +1488,17 @@ interface CanvasBatchable extends Batchable2D {
1801
1488
  texture?: Texture;
1802
1489
  }
1803
1490
  interface StrokedGraphics {
1804
- shapes: Path2DShape[];
1491
+ shapes: CurvePath[];
1805
1492
  texture?: Texture;
1806
1493
  textureTransform?: Transform2D;
1807
1494
  style: LineStyle;
1808
1495
  }
1809
1496
  interface FilledGraphics {
1810
- shapes: Path2DShape[];
1497
+ shapes: CurvePath[];
1811
1498
  texture?: Texture;
1812
1499
  textureTransform?: Transform2D;
1813
1500
  }
1814
- declare class CanvasContext {
1815
- moveTo: (x: number, y: number) => this;
1816
- lineTo: (x: number, y: number) => this;
1817
- bezierCurveTo: (cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number) => this;
1818
- quadraticCurveTo: (cp1x: number, cp1y: number, x: number, y: number, smoothing?: number) => this;
1819
- ellipticalArc: (rx: number, ry: number, xAxisRotation: number, largeArcFlag: number, sweepFlag: number, x: number, y: number) => this;
1820
- rect: (x: number, y: number, width: number, height: number, transform?: Transform2D) => this;
1821
- roundRect: (x: number, y: number, width: number, height: number, radii: number, transform?: Transform2D) => this;
1822
- ellipse: (x: number, y: number, radiusX: number, radiusY: number, transform?: Transform2D) => this;
1823
- arc: (x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise: boolean) => this;
1824
- poly: (points: number[] | PointData[], close?: boolean, transform?: Transform2D) => this;
1825
- addShape: (shape: Shape, transform?: Transform2D) => this;
1826
- addPath: (path2D: Path2D) => this;
1827
- addSvgPath: (d: string) => this;
1828
- closePath: () => this;
1501
+ declare class CanvasContext extends Path2D {
1829
1502
  textureTransform?: Transform2D;
1830
1503
  fillStyle?: ColorValue | Texture;
1831
1504
  strokeStyle?: ColorValue | Texture;
@@ -1833,7 +1506,6 @@ declare class CanvasContext {
1833
1506
  lineJoin?: LineJoin;
1834
1507
  lineWidth?: number;
1835
1508
  miterLimit?: number;
1836
- protected _path2D: Path2D;
1837
1509
  protected _defaultStyle: Texture<TextureSource>;
1838
1510
  protected _stroked: StrokedGraphics[];
1839
1511
  protected _filled: FilledGraphics[];
@@ -1846,7 +1518,7 @@ declare class CanvasContext {
1846
1518
  toBatchables(): CanvasBatchable[];
1847
1519
  }
1848
1520
 
1849
- interface Style2DOptions extends Partial<Style2DBackgroundProperties>, Partial<Style2DFilterProperties>, Partial<Style2DOffsetProperties>, Partial<Style2DTextProperties>, Partial<Style2DTransformProperties> {
1521
+ interface Style2DOptions extends Partial<Style2DBackgroundProperties>, Partial<Style2DFilterProperties>, Partial<Style2DTextProperties>, Partial<Style2DTransformProperties> {
1850
1522
  shadowColor?: string;
1851
1523
  shadowOffsetX?: number;
1852
1524
  shadowOffsetY?: number;
@@ -1855,7 +1527,7 @@ interface Style2DOptions extends Partial<Style2DBackgroundProperties>, Partial<S
1855
1527
  borderRadius?: number;
1856
1528
  overflow?: Overflow;
1857
1529
  }
1858
- interface Style2D extends Style2DBackgroundExtend, Style2DFilterExtend, Style2DOffsetExtend, Style2DTextExtend, Style2DTransformExtend {
1530
+ interface Style2D extends Style2DBackgroundExtend, Style2DFilterExtend, Style2DTextExtend, Style2DTransformExtend {
1859
1531
  }
1860
1532
  declare class Style2D extends _Object {
1861
1533
  shadowColor: string;
@@ -1900,45 +1572,8 @@ declare class Style2DFilterModule extends Style2DModule {
1900
1572
  declare function getComputedFilter(this: Style2D): Style2DFilter;
1901
1573
  declare function getComputedFilterColorMatrix(this: Style2D): ColorMatrix;
1902
1574
 
1903
- interface Style2DOffsetProperties {
1904
- offsetPath?: string;
1905
- offsetAnchor?: string | number;
1906
- offsetDistance?: string | number;
1907
- offsetPosition?: string | number;
1908
- }
1909
- interface Style2DOffsetExtend extends Style2DOffsetProperties {
1910
- getComputedOffset: typeof getComputedOffset;
1911
- }
1912
- declare module '../Style2D' {
1913
- interface Style2DOptions extends Partial<Style2DOffsetProperties> {
1914
- }
1915
- interface Style2D extends Style2DOffsetProperties {
1916
- getComputedOffset: typeof getComputedOffset;
1917
- }
1918
- }
1919
- declare class Style2DOffsetModule extends Style2DModule {
1920
- install(Style2D: new () => Style2D): void;
1921
- }
1922
- declare function getComputedOffset(this: Style2D): void;
1923
-
1924
- interface Style2DTextProperties {
1925
- color: string;
1926
- fontSize: number;
1927
- fontWeight: FontWeight;
1928
- fontFamily: string;
1929
- fontStyle: FontStyle;
1930
- fontKerning: FontKerning;
1931
- textWrap: TextWrap;
1932
- textAlign: TextAlign;
1933
- verticalAlign: VerticalAlign;
1934
- textTransform: TextTransform;
1935
- textDecoration: TextDecoration | null;
1936
- textStrokeWidth: number;
1937
- textStrokeColor: string;
1575
+ interface Style2DTextProperties extends IDOCTextStyleDeclaration {
1938
1576
  direction: 'inherit' | 'ltr' | 'rtl';
1939
- lineHeight: number;
1940
- letterSpacing: number;
1941
- writingMode: WritingMode;
1942
1577
  }
1943
1578
  interface Style2DTextExtend extends Style2DTextProperties {
1944
1579
  }
@@ -1946,16 +1581,7 @@ declare class Style2DTextModule extends Style2DModule {
1946
1581
  install(Style2D: new () => Style2D): void;
1947
1582
  }
1948
1583
 
1949
- interface Style2DTransformProperties {
1950
- left: number;
1951
- top: number;
1952
- width: number;
1953
- height: number;
1954
- rotate: number;
1955
- scaleX: number;
1956
- scaleY: number;
1957
- transform?: string;
1958
- transformOrigin: string;
1584
+ interface Style2DTransformProperties extends IDOCTransformStyleDeclaration {
1959
1585
  }
1960
1586
  interface Style2DTransformExtend extends Style2DTransformProperties {
1961
1587
  getComputedTransform: typeof getComputedTransform;
@@ -2021,7 +1647,7 @@ declare class Node2D extends CanvasItem {
2021
1647
  readonly _transform: Transform2D;
2022
1648
  protected _parentTransformDirtyId?: number;
2023
1649
  constructor(options?: Node2DOptions);
2024
- getBoundingBox(): Rectangle;
1650
+ getBoundingBox(): BoundingBox;
2025
1651
  protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
2026
1652
  protected _updateTransform(): void;
2027
1653
  protected _updateOverflow(): void;
@@ -2113,11 +1739,9 @@ declare class Lottie2D extends Node2D {
2113
1739
  protected _drawContent(): void;
2114
1740
  }
2115
1741
 
2116
- interface Text2DOptions extends Node2DOptions {
1742
+ interface Text2DOptions extends Node2DOptions, Omit<TextOptions, 'style'> {
2117
1743
  pixelRatio?: number;
2118
1744
  split?: boolean;
2119
- content?: IDOCTextContent;
2120
- effects?: Partial<IDOCStyleDeclaration>[];
2121
1745
  }
2122
1746
  /**
2123
1747
  * @example
@@ -2132,12 +1756,16 @@ interface Text2DOptions extends Node2DOptions {
2132
1756
  declare class Text2D extends Node2D {
2133
1757
  pixelRatio: number;
2134
1758
  split: boolean;
2135
- content: IDOCTextContent;
2136
- effects?: Partial<IDOCStyleDeclaration>[];
1759
+ content: TextOptions['content'];
1760
+ effects?: TextOptions['effects'];
1761
+ measureDom?: TextOptions['measureDom'];
1762
+ fonts?: TextOptions['fonts'];
1763
+ text: Text;
2137
1764
  readonly texture: Texture<HTMLCanvasElement>;
2138
1765
  protected _subTextsCount: number;
2139
1766
  constructor(options?: Text2DOptions);
2140
1767
  protected _onUpdateProperty(key: PropertyKey, value: any, oldValue: any): void;
1768
+ protected _updateText(): void;
2141
1769
  protected _onUpdateStyleProperty(key: PropertyKey, value: any, oldValue: any): void;
2142
1770
  protected _getSubTexts(): Text2D[];
2143
1771
  protected _updateSubTexts(): void;
@@ -3112,4 +2740,4 @@ interface RenderOptions {
3112
2740
  }
3113
2741
  declare function render(options: RenderOptions): Promise<HTMLCanvasElement>;
3114
2742
 
3115
- export { Animation2D, type AnimationOptions, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformOptions, type Batchable2D, BlurEffect, Bounds, type BoundsData, type CanvasBatchable, CanvasContext, CanvasItem, type CanvasItemOptions, Circle, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectOptions, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type CssFunction, type CssFunctionArg, type Cursor, type CustomNodeOptions, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, Ellipse, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DOptions, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, type LineCap, type LineJoin, type LineStyle, Loader, Lottie2D, LottieLoader, type LottieOptions, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DOptions, type NodeEventMap, type NodeOptions, type NormalizedKeyframe, PI, PI_2, Path2D, type Path2DCall, type Path2DCallMethod, type Path2DShape, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, Point, type PointData, type PointLike, PointerInputEvent, Polygon, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Rectangle, Reference, type ReferenceEventMap, type RenderCall, type RenderOptions, RenderStack, type Renderable, Renderer, Resource, type ResourceEventMap, RoundedRectangle, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SVGPath, type SVGPathDefine, type SVGPathDefineCommand, SceneTree, type SceneTreeEventMap, type Shape, type ShapeBuildCommand, Star, type StrokedGraphics, Style2D, type Style2DBackgroundExtend, Style2DBackgroundModule, type Style2DBackgroundProperties, type Style2DFilter, type Style2DFilterExtend, type Style2DFilterKey, Style2DFilterModule, type Style2DFilterProperties, Style2DModule, type Style2DOffsetExtend, Style2DOffsetModule, type Style2DOffsetProperties, type Style2DOptions, type Style2DTextExtend, Style2DTextModule, type Style2DTextProperties, type Style2DTransformExtend, Style2DTransformModule, type Style2DTransformProperties, Text2D, type Text2DOptions, TextLoader, Texture, type TextureFilterMode, TextureLoader, type TexturePixelsSource, type TextureSource, type TextureWrapMode, Ticker, TiltShiftEffect, Timer, type TimerEventMap, type TimerOptions, type TimingFunctions, Transform2D, type Transform2DObject, Triangle, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DOptions, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportFramebuffer, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, type WebGLBufferMeta, WebGLBufferModule, type WebGLBufferOptions, type WebGLBufferTarget, type WebGLBufferUsage, type WebGLDrawMode, type WebGLDrawOptions, type WebGLExtensions, type WebGLFramebufferMeta, WebGLFramebufferModule, type WebGLFramebufferOptions, WebGLMaskModule, WebGLModule, type WebGLProgramMeta, WebGLProgramModule, type WebGLProgramOptions, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, type WebGLTarget, type WebGLTextureFilterMode, type WebGLTextureLocation, type WebGLTextureMeta, WebGLTextureModule, type WebGLTextureOptions, type WebGLTextureSource, type WebGLTextureTarget, type WebGLTextureWrapMode, WebGLVertexArrayModule, type WebGLVertexArrayObjectMeta, type WebGLVertexArrayObjectOptions, type WebGLVertexAttrib, type WebGLVertexAttribType, type WebGLViewport, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, type _ObjectEventMap, assets, buildAdaptiveBezier, buildAdaptiveQuadratic, buildArc, buildArcTo, buildArcToSvg, buildCircle, buildLine, buildPolygon, buildRectangle, buildTriangle, clamp, closePointEps, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curveEps, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, squaredDistanceToLineSegment, timingFunctions, uid };
2743
+ export { Animation2D, type AnimationOptions, type AssetHandler, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, type AudioWaveformOptions, type Batchable2D, BlurEffect, type CanvasBatchable, CanvasContext, CanvasItem, type CanvasItemOptions, Color, ColorAdjustEffect, ColorFilterEffect, type ColorFilterEffectOptions, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, type ColorValue, type CssFunction, type CssFunctionArg, type Cursor, type CustomNodeOptions, DEG_TO_RAD, DEVICE_PIXEL_RATIO, type Easing, Effect, type EffectContext, EffectMaterial, type EffectMode, type EffectOptions, EmbossEffect, Engine, type EngineOptions, EventEmitter, type EventListener, type EventListenerOptions, type EventListenerValue, type FilledGraphics, FontLoader, Geometry, type GeometryOptions, GifLoader, GlitchEffect, GodrayEffect, Graphics2D, HTMLAudio, HTMLAudioContext, HTMLSound, type IAudioContext, type IAudioNode, IN_BROWSER, type IPlayOptions, Image2D, type Image2DOptions, Image2DResource, type ImageFrame, ImageTexture, type ImageTextureOptions, IndexBuffer, type IndexBufferOptions, Input, InternalMode, JsonLoader, KawaseEffect, type Keyframe, LeftEraseEffect, Loader, Lottie2D, LottieLoader, type LottieOptions, MainLoop, type MainLoopEventMap, type MaskColor, type MaskData, MaskEffect, type MaskEffectOptions, type MaskObject, type MaskRect, type Maskable, Material, type MaterialOptions, Matrix, Matrix2, Matrix3, Matrix4, type MatrixLike, type MatrixOperateOutput, MouseInputEvent, Node, Node2D, type Node2DOptions, type NodeEventMap, type NodeOptions, type NormalizedKeyframe, PI, PI_2, PixelateEffect, PixelsTexture, type PlatformAudio, type PlatformSound, PointerInputEvent, Projection2D, type PropertyDeclaration, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Reference, type ReferenceEventMap, type RenderCall, type RenderOptions, RenderStack, type Renderable, Renderer, Resource, type ResourceEventMap, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SceneTree, type SceneTreeEventMap, type StrokedGraphics, Style2D, type Style2DBackgroundExtend, Style2DBackgroundModule, type Style2DBackgroundProperties, type Style2DFilter, type Style2DFilterExtend, type Style2DFilterKey, Style2DFilterModule, type Style2DFilterProperties, Style2DModule, type Style2DOptions, type Style2DTextExtend, Style2DTextModule, type Style2DTextProperties, type Style2DTransformExtend, Style2DTransformModule, type Style2DTransformProperties, Text2D, type Text2DOptions, TextLoader, Texture, type TextureFilterMode, TextureLoader, type TexturePixelsSource, type TextureSource, type TextureWrapMode, Ticker, TiltShiftEffect, Timer, type TimerEventMap, type TimerOptions, type TimingFunctions, Transform2D, type Transform2DObject, TwistEffect, UIInputEvent, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, type VectorLike, type VectorOperateOutput, VertexAttribute, type VertexAttributeOptions, VertexBuffer, type VertexBufferOptions, Video2D, type Video2DOptions, VideoLoader, VideoTexture, type VideoTextureOptions, type VideoTextureSource, Viewport, type ViewportFramebuffer, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, type WebGLBufferMeta, WebGLBufferModule, type WebGLBufferOptions, type WebGLBufferTarget, type WebGLBufferUsage, type WebGLDrawMode, type WebGLDrawOptions, type WebGLExtensions, type WebGLFramebufferMeta, WebGLFramebufferModule, type WebGLFramebufferOptions, WebGLMaskModule, WebGLModule, type WebGLProgramMeta, WebGLProgramModule, type WebGLProgramOptions, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, type WebGLTarget, type WebGLTextureFilterMode, type WebGLTextureLocation, type WebGLTextureMeta, WebGLTextureModule, type WebGLTextureOptions, type WebGLTextureSource, type WebGLTextureTarget, type WebGLTextureWrapMode, WebGLVertexArrayModule, type WebGLVertexArrayObjectMeta, type WebGLVertexArrayObjectOptions, type WebGLVertexAttrib, type WebGLVertexAttribType, type WebGLViewport, WebGLViewportModule, WebSound, WheelInputEvent, ZoomBlurEffect, _Object, type _ObjectEventMap, assets, clamp, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, defineProperty, determineCrossOrigin, ease, easeIn, easeInOut, easeOut, getDeclarations, getDefaultCssPropertyValue, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, parseCssFunctions, parseCssProperty, property, protectedProperty, render, timingFunctions, uid };