svg-path-commander 2.3.3 → 2.3.4
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/AGENTS.md +94 -43
- package/CHANGELOG.md +41 -1
- package/LICENSE +0 -0
- package/README.md +374 -345
- package/dist/index.d.ts +130 -270
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +181 -240
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -2
- package/dist/index.min.js.map +1 -1
- package/dist/util.d.ts +90 -248
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +177 -233
- package/dist/util.js.map +1 -1
- package/package.json +50 -43
package/dist/util.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SVGPathCommander v2.3.
|
|
2
|
+
* SVGPathCommander v2.3.4 (http://thednp.github.io/svg-path-commander)
|
|
3
3
|
* Copyright 2026 © thednp
|
|
4
4
|
* Licensed under MIT (https://github.com/thednp/svg-path-commander/blob/master/LICENSE)
|
|
5
5
|
*/
|
|
6
6
|
import CSSMatrix from "@thednp/dommatrix";
|
|
7
|
-
//#region src/interface.d.ts
|
|
8
7
|
/** The properties of a path segment found by segment lookup utilities. */
|
|
9
8
|
type SegmentProperties = {
|
|
10
9
|
/** The path segment. */
|
|
@@ -131,10 +130,16 @@ type ParserParams = {
|
|
|
131
130
|
x1: number;
|
|
132
131
|
/** The Y coordinate of the previous control point. */
|
|
133
132
|
y1: number;
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
/**
|
|
134
|
+
* The X coordinate of the reflectable control point of the previous
|
|
135
|
+
* segment, `null` when the previous segment has none.
|
|
136
|
+
*/
|
|
137
|
+
x2: number | null;
|
|
138
|
+
/**
|
|
139
|
+
* The Y coordinate of the reflectable control point of the previous
|
|
140
|
+
* segment, `null` when the previous segment has none.
|
|
141
|
+
*/
|
|
142
|
+
y2: number | null;
|
|
138
143
|
/** The X coordinate of the current point. */
|
|
139
144
|
x: number;
|
|
140
145
|
/** The Y coordinate of the current point. */
|
|
@@ -157,10 +162,8 @@ type TransformObject = {
|
|
|
157
162
|
/** The transform origin. */
|
|
158
163
|
origin: number[];
|
|
159
164
|
};
|
|
160
|
-
//#endregion
|
|
161
|
-
//#region src/types.d.ts
|
|
162
165
|
/** Whitespace character codes recognized by the SVG path string tokenizer. */
|
|
163
|
-
type SpaceNumber = 0x1680 | 0x180e | 0x2000 | 0x2001 | 0x2002 | 0x2003 | 0x2004 | 0x2005 | 0x2006 | 0x2007 | 0x2008 | 0x2009 | 0x200a | 0x202f | 0x205f | 0x3000 | 0xfeff | 0x0a | 0x0d | 0x2028 | 0x2029 | 0x20 | 0x09 | 0x0b | 0x0c | 0xa0
|
|
166
|
+
type SpaceNumber = 0x1680 | 0x180e | 0x2000 | 0x2001 | 0x2002 | 0x2003 | 0x2004 | 0x2005 | 0x2006 | 0x2007 | 0x2008 | 0x2009 | 0x200a | 0x202f | 0x205f | 0x3000 | 0xfeff | 0x0a | 0x0d | 0x2028 | 0x2029 | 0x20 | 0x09 | 0x0b | 0x0c | 0xa0;
|
|
164
167
|
/** Character codes of all SVG path command letters. */
|
|
165
168
|
type PathCommandNumber = 0x6d | 0x7a | 0x6c | 0x68 | 0x76 | 0x63 | 0x73 | 0x71 | 0x74 | 0x61;
|
|
166
169
|
/** Character codes of the decimal digits 0-9. */
|
|
@@ -302,7 +305,7 @@ type MorphPathArray = PolygonArray | PolylineArray | CurveArray | ClosedCurveArr
|
|
|
302
305
|
/** The SVG element types that can be converted to a path. */
|
|
303
306
|
type ShapeTypes = SVGPolylineElement | SVGPolygonElement | SVGLineElement | SVGEllipseElement | SVGCircleElement | SVGRectElement;
|
|
304
307
|
/** The shape attributes mapped to each supported SVG element type. */
|
|
305
|
-
type ShapeOps = LineAttr | PolyAttr |
|
|
308
|
+
type ShapeOps = LineAttr | PolyAttr | EllipseAttr | CircleAttr | RectAttr | GlyphAttr;
|
|
306
309
|
/** A `TransformObject` with a required 3D origin. */
|
|
307
310
|
type TransformObjectValues = Partial<TransformObject> & {
|
|
308
311
|
/** The transform origin. */
|
|
@@ -366,8 +369,6 @@ interface EqualizationOptions {
|
|
|
366
369
|
/** The target segment count for both paths. */
|
|
367
370
|
target?: number;
|
|
368
371
|
}
|
|
369
|
-
//#endregion
|
|
370
|
-
//#region src/math/arcTools.d.ts
|
|
371
372
|
/**
|
|
372
373
|
* Returns the signed arc length of an ellipse segment from angle `0` up to
|
|
373
374
|
* the given `theta` angle, by integrating the curve speed
|
|
@@ -503,8 +504,6 @@ declare const arcTools: {
|
|
|
503
504
|
getArcProps: typeof getArcProps;
|
|
504
505
|
getPointAtArcLength: typeof getPointAtArcLength;
|
|
505
506
|
};
|
|
506
|
-
//#endregion
|
|
507
|
-
//#region src/math/bezier.d.ts
|
|
508
507
|
/**
|
|
509
508
|
* @param points
|
|
510
509
|
* @returns
|
|
@@ -596,8 +595,6 @@ declare const bezierTools: {
|
|
|
596
595
|
minmaxQ: typeof minmaxQ;
|
|
597
596
|
Tvalues: number[];
|
|
598
597
|
};
|
|
599
|
-
//#endregion
|
|
600
|
-
//#region src/math/cubicTools.d.ts
|
|
601
598
|
/**
|
|
602
599
|
* Returns a point at a given length of a CubicBezier segment.
|
|
603
600
|
*
|
|
@@ -670,8 +667,6 @@ declare const cubicTools: {
|
|
|
670
667
|
getPointAtCubicLength: typeof getPointAtCubicLength;
|
|
671
668
|
getPointAtCubicSegmentLength: typeof getPointAtCubicSegmentLength;
|
|
672
669
|
};
|
|
673
|
-
//#endregion
|
|
674
|
-
//#region src/math/lineTools.d.ts
|
|
675
670
|
/**
|
|
676
671
|
* Returns length for line segments (MoveTo, LineTo).
|
|
677
672
|
*
|
|
@@ -712,8 +707,6 @@ declare const lineTools: {
|
|
|
712
707
|
getLineLength: typeof getLineLength;
|
|
713
708
|
getPointAtLineLength: typeof getPointAtLineLength;
|
|
714
709
|
};
|
|
715
|
-
//#endregion
|
|
716
|
-
//#region src/math/quadTools.d.ts
|
|
717
710
|
/**
|
|
718
711
|
* Returns the {x,y} coordinates of a point at a
|
|
719
712
|
* given length of a quadratic-bezier segment.
|
|
@@ -781,8 +774,6 @@ declare const quadTools: {
|
|
|
781
774
|
getQuadBBox: typeof getQuadBBox;
|
|
782
775
|
getQuadLength: typeof getQuadLength;
|
|
783
776
|
};
|
|
784
|
-
//#endregion
|
|
785
|
-
//#region src/math/polygonTools.d.ts
|
|
786
777
|
/**
|
|
787
778
|
* d3-polygon-area
|
|
788
779
|
* @see https://github.com/d3/d3-polygon
|
|
@@ -817,8 +808,6 @@ declare const polygonTools: {
|
|
|
817
808
|
polygonLength: typeof polygonLength;
|
|
818
809
|
polygonCentroid: typeof polygonCentroid;
|
|
819
810
|
};
|
|
820
|
-
//#endregion
|
|
821
|
-
//#region src/math/distanceSquareRoot.d.ts
|
|
822
811
|
/**
|
|
823
812
|
* Returns the square root of the distance
|
|
824
813
|
* between two given points.
|
|
@@ -827,9 +816,7 @@ declare const polygonTools: {
|
|
|
827
816
|
* @param b the second point coordinates
|
|
828
817
|
* @returns the distance value
|
|
829
818
|
*/
|
|
830
|
-
declare const distanceSquareRoot: (a: PointTuple, b: PointTuple) => number;
|
|
831
|
-
//#endregion
|
|
832
|
-
//#region src/math/midPoint.d.ts
|
|
819
|
+
export declare const distanceSquareRoot: (a: PointTuple, b: PointTuple) => number;
|
|
833
820
|
/**
|
|
834
821
|
* Returns the coordinates of a specified distance
|
|
835
822
|
* ratio between two points.
|
|
@@ -839,9 +826,7 @@ declare const distanceSquareRoot: (a: PointTuple, b: PointTuple) => number;
|
|
|
839
826
|
* @param t the ratio
|
|
840
827
|
* @returns the midpoint coordinates
|
|
841
828
|
*/
|
|
842
|
-
declare const midPoint: ([ax, ay]: PointTuple, [bx, by]: PointTuple, t: number) => PointTuple;
|
|
843
|
-
//#endregion
|
|
844
|
-
//#region src/math/rotateVector.d.ts
|
|
829
|
+
export declare const midPoint: ([ax, ay]: PointTuple, [bx, by]: PointTuple, t: number) => PointTuple;
|
|
845
830
|
/**
|
|
846
831
|
* Returns an {x,y} vector rotated by a given
|
|
847
832
|
* angle in radian.
|
|
@@ -851,12 +836,10 @@ declare const midPoint: ([ax, ay]: PointTuple, [bx, by]: PointTuple, t: number)
|
|
|
851
836
|
* @param rad the radian vector angle
|
|
852
837
|
* @returns the rotated vector
|
|
853
838
|
*/
|
|
854
|
-
declare const rotateVector: (x: number, y: number, rad: number) => {
|
|
839
|
+
export declare const rotateVector: (x: number, y: number, rad: number) => {
|
|
855
840
|
x: number;
|
|
856
841
|
y: number;
|
|
857
842
|
};
|
|
858
|
-
//#endregion
|
|
859
|
-
//#region src/math/roundTo.d.ts
|
|
860
843
|
/**
|
|
861
844
|
* Rounds a number to the specified number of decimal places.
|
|
862
845
|
*
|
|
@@ -864,9 +847,7 @@ declare const rotateVector: (x: number, y: number, rad: number) => {
|
|
|
864
847
|
* @param round - Number of decimal places
|
|
865
848
|
* @returns The rounded number
|
|
866
849
|
*/
|
|
867
|
-
declare const roundTo: (n: number, round: number) => number;
|
|
868
|
-
//#endregion
|
|
869
|
-
//#region src/convert/pathToAbsolute.d.ts
|
|
850
|
+
export declare const roundTo: (n: number, round: number) => number;
|
|
870
851
|
/**
|
|
871
852
|
* Parses a path string value or object and returns an array
|
|
872
853
|
* of segments, all converted to absolute values.
|
|
@@ -880,9 +861,7 @@ declare const roundTo: (n: number, round: number) => number;
|
|
|
880
861
|
* // => [['M', 10, 10], ['L', 90, 90]]
|
|
881
862
|
* ```
|
|
882
863
|
*/
|
|
883
|
-
declare const pathToAbsolute: <T extends PathArray>(pathInput: string | T) => AbsoluteArray;
|
|
884
|
-
//#endregion
|
|
885
|
-
//#region src/convert/pathToRelative.d.ts
|
|
864
|
+
export declare const pathToAbsolute: <T extends PathArray>(pathInput: string | T) => AbsoluteArray;
|
|
886
865
|
/**
|
|
887
866
|
* Parses a path string value or object and returns an array
|
|
888
867
|
* of segments, all converted to relative values.
|
|
@@ -896,9 +875,7 @@ declare const pathToAbsolute: <T extends PathArray>(pathInput: string | T) => Ab
|
|
|
896
875
|
* // => [['M', 10, 10], ['l', 80, 80]]
|
|
897
876
|
* ```
|
|
898
877
|
*/
|
|
899
|
-
declare const pathToRelative: <T extends PathArray>(pathInput: string | T) => RelativeArray;
|
|
900
|
-
//#endregion
|
|
901
|
-
//#region src/convert/pathToCurve.d.ts
|
|
878
|
+
export declare const pathToRelative: <T extends PathArray>(pathInput: string | T) => RelativeArray;
|
|
902
879
|
/**
|
|
903
880
|
* Parses a path string or PathArray and returns a new one
|
|
904
881
|
* in which all segments are converted to cubic-bezier.
|
|
@@ -912,9 +889,7 @@ declare const pathToRelative: <T extends PathArray>(pathInput: string | T) => Re
|
|
|
912
889
|
* // => [['M', 10, 50], ['C', 25, 25, 40, 50, 40, 50]]
|
|
913
890
|
* ```
|
|
914
891
|
*/
|
|
915
|
-
declare const pathToCurve: <T extends PathArray>(pathInput: string | T) => CurveArray;
|
|
916
|
-
//#endregion
|
|
917
|
-
//#region src/convert/pathToString.d.ts
|
|
892
|
+
export declare const pathToCurve: <T extends PathArray>(pathInput: string | T) => CurveArray;
|
|
918
893
|
/**
|
|
919
894
|
* Returns a valid `d` attribute string value created
|
|
920
895
|
* by rounding values and concatenating the PathArray segments.
|
|
@@ -929,15 +904,14 @@ declare const pathToCurve: <T extends PathArray>(pathInput: string | T) => Curve
|
|
|
929
904
|
* // => 'M10 10L90 90'
|
|
930
905
|
* ```
|
|
931
906
|
*/
|
|
932
|
-
declare const pathToString: <T extends PathArray>(path: T, roundOption?: number | "off") => string;
|
|
933
|
-
//#endregion
|
|
934
|
-
//#region src/parser/parsePathString.d.ts
|
|
907
|
+
export declare const pathToString: <T extends PathArray>(path: T, roundOption?: number | "off") => string;
|
|
935
908
|
/**
|
|
936
909
|
* Parses a path string value and returns an array
|
|
937
910
|
* of segments we like to call `PathArray`.
|
|
938
911
|
*
|
|
939
912
|
* If parameter value is already a `PathArray`,
|
|
940
913
|
* return a clone of it.
|
|
914
|
+
|
|
941
915
|
* @example
|
|
942
916
|
* parsePathString("M 0 0L50 50")
|
|
943
917
|
* // => [["M",0,0],["L",50,50]]
|
|
@@ -945,16 +919,14 @@ declare const pathToString: <T extends PathArray>(path: T, roundOption?: number
|
|
|
945
919
|
* @param pathInput the string to be parsed
|
|
946
920
|
* @returns the resulted `pathArray` or error string
|
|
947
921
|
*/
|
|
948
|
-
declare const parsePathString: <T extends PathArray>(pathInput: string | T) => PathArray;
|
|
949
|
-
//#endregion
|
|
950
|
-
//#region src/parser/pathParser.d.ts
|
|
922
|
+
export declare const parsePathString: <T extends PathArray>(pathInput: string | T) => PathArray;
|
|
951
923
|
/**
|
|
952
924
|
* The `PathParser` is used by the `parsePathString` static method
|
|
953
925
|
* to generate a `pathArray`.
|
|
954
926
|
*
|
|
955
927
|
* @param pathString - The SVG path string to parse
|
|
956
928
|
*/
|
|
957
|
-
declare class PathParser {
|
|
929
|
+
export declare class PathParser {
|
|
958
930
|
segments: PathArray | PathSegment[];
|
|
959
931
|
pathValue: string;
|
|
960
932
|
max: number;
|
|
@@ -965,38 +937,28 @@ declare class PathParser {
|
|
|
965
937
|
err: string;
|
|
966
938
|
constructor(pathString: string);
|
|
967
939
|
}
|
|
968
|
-
//#endregion
|
|
969
|
-
//#region src/parser/finalizeSegment.d.ts
|
|
970
940
|
/**
|
|
971
941
|
* Breaks the parsing of a pathString once a segment is finalized.
|
|
972
942
|
*
|
|
973
943
|
* @param path - The PathParser instance
|
|
974
944
|
*/
|
|
975
|
-
declare const finalizeSegment: (path: PathParser) => void;
|
|
976
|
-
//#endregion
|
|
977
|
-
//#region src/parser/invalidPathValue.d.ts
|
|
945
|
+
export declare const finalizeSegment: (path: PathParser) => void;
|
|
978
946
|
/** Error message prefix used when a path string cannot be parsed. */
|
|
979
|
-
declare const invalidPathValue = "Invalid path value";
|
|
980
|
-
//#endregion
|
|
981
|
-
//#region src/parser/isArcCommand.d.ts
|
|
947
|
+
export declare const invalidPathValue = "Invalid path value";
|
|
982
948
|
/**
|
|
983
949
|
* Checks if the character is an A (arc-to) path command.
|
|
984
950
|
*
|
|
985
951
|
* @param code the character to check
|
|
986
952
|
* @returns check result
|
|
987
953
|
*/
|
|
988
|
-
declare const isArcCommand: (code: number) => code is 97;
|
|
989
|
-
//#endregion
|
|
990
|
-
//#region src/parser/isDigit.d.ts
|
|
954
|
+
export declare const isArcCommand: (code: number) => code is 97;
|
|
991
955
|
/**
|
|
992
956
|
* Checks if a character is a digit.
|
|
993
957
|
*
|
|
994
958
|
* @param code the character to check
|
|
995
959
|
* @returns check result
|
|
996
960
|
*/
|
|
997
|
-
declare const isDigit: (code: number) => code is DigitNumber;
|
|
998
|
-
//#endregion
|
|
999
|
-
//#region src/parser/isDigitStart.d.ts
|
|
961
|
+
export declare const isDigit: (code: number) => code is DigitNumber;
|
|
1000
962
|
/**
|
|
1001
963
|
* Checks if the character is or belongs to a number.
|
|
1002
964
|
* [0-9]|+|-|.
|
|
@@ -1004,38 +966,30 @@ declare const isDigit: (code: number) => code is DigitNumber;
|
|
|
1004
966
|
* @param code the character to check
|
|
1005
967
|
* @returns check result
|
|
1006
968
|
*/
|
|
1007
|
-
declare const isDigitStart: (code: number) => code is DigitNumber | 43 | 45 | 46;
|
|
1008
|
-
//#endregion
|
|
1009
|
-
//#region src/parser/isMoveCommand.d.ts
|
|
969
|
+
export declare const isDigitStart: (code: number) => code is DigitNumber | 43 | 45 | 46;
|
|
1010
970
|
/**
|
|
1011
971
|
* Checks if the character is a MoveTo command.
|
|
1012
972
|
*
|
|
1013
973
|
* @param code the character to check
|
|
1014
974
|
* @returns check result
|
|
1015
975
|
*/
|
|
1016
|
-
declare const isMoveCommand: (code: number) => code is 109 | 77;
|
|
1017
|
-
//#endregion
|
|
1018
|
-
//#region src/parser/isPathCommand.d.ts
|
|
976
|
+
export declare const isMoveCommand: (code: number) => code is 109 | 77;
|
|
1019
977
|
/**
|
|
1020
978
|
* Checks if the character is a path command.
|
|
1021
979
|
*
|
|
1022
980
|
* @param code the character to check
|
|
1023
981
|
* @returns check result
|
|
1024
982
|
*/
|
|
1025
|
-
declare const isPathCommand: (code: number) => code is PathCommandNumber;
|
|
1026
|
-
//#endregion
|
|
1027
|
-
//#region src/parser/isSpace.d.ts
|
|
983
|
+
export declare const isPathCommand: (code: number) => code is PathCommandNumber;
|
|
1028
984
|
/**
|
|
1029
985
|
* Checks if the character is a space.
|
|
1030
986
|
*
|
|
1031
987
|
* @param ch the character to check
|
|
1032
988
|
* @returns check result
|
|
1033
989
|
*/
|
|
1034
|
-
declare const isSpace: (ch: number) => ch is SpaceNumber;
|
|
1035
|
-
//#endregion
|
|
1036
|
-
//#region src/parser/paramsCount.d.ts
|
|
990
|
+
export declare const isSpace: (ch: number) => ch is SpaceNumber;
|
|
1037
991
|
/** Segment params length */
|
|
1038
|
-
declare const paramsCounts: {
|
|
992
|
+
export declare const paramsCounts: {
|
|
1039
993
|
a: number;
|
|
1040
994
|
c: number;
|
|
1041
995
|
h: number;
|
|
@@ -1048,42 +1002,32 @@ declare const paramsCounts: {
|
|
|
1048
1002
|
v: number;
|
|
1049
1003
|
z: number;
|
|
1050
1004
|
};
|
|
1051
|
-
//#endregion
|
|
1052
|
-
//#region src/parser/paramsParser.d.ts
|
|
1053
1005
|
/**
|
|
1054
1006
|
* Default parser parameters object used to track position state
|
|
1055
1007
|
* while iterating through path segments.
|
|
1056
1008
|
*/
|
|
1057
|
-
declare const paramsParser: ParserParams;
|
|
1058
|
-
//#endregion
|
|
1059
|
-
//#region src/parser/scanFlag.d.ts
|
|
1009
|
+
export declare const paramsParser: ParserParams;
|
|
1060
1010
|
/**
|
|
1061
1011
|
* Validates an A (arc-to) specific path command value.
|
|
1062
1012
|
* Usually a `large-arc-flag` or `sweep-flag`.
|
|
1063
1013
|
*
|
|
1064
1014
|
* @param path - The PathParser instance
|
|
1065
1015
|
*/
|
|
1066
|
-
declare const scanFlag: (path: PathParser) => void;
|
|
1067
|
-
//#endregion
|
|
1068
|
-
//#region src/parser/scanParam.d.ts
|
|
1016
|
+
export declare const scanFlag: (path: PathParser) => void;
|
|
1069
1017
|
/**
|
|
1070
1018
|
* Validates every character of the path string,
|
|
1071
1019
|
* every path command, negative numbers or floating point numbers.
|
|
1072
1020
|
*
|
|
1073
1021
|
* @param path - The PathParser instance
|
|
1074
1022
|
*/
|
|
1075
|
-
declare const scanParam: (path: PathParser) => void;
|
|
1076
|
-
//#endregion
|
|
1077
|
-
//#region src/parser/scanSegment.d.ts
|
|
1023
|
+
export declare const scanParam: (path: PathParser) => void;
|
|
1078
1024
|
/**
|
|
1079
1025
|
* Scans every character in the path string to determine
|
|
1080
1026
|
* where a segment starts and where it ends.
|
|
1081
1027
|
*
|
|
1082
1028
|
* @param path - The PathParser instance
|
|
1083
1029
|
*/
|
|
1084
|
-
declare const scanSegment: (path: PathParser) => void;
|
|
1085
|
-
//#endregion
|
|
1086
|
-
//#region src/parser/skipSpaces.d.ts
|
|
1030
|
+
export declare const scanSegment: (path: PathParser) => void;
|
|
1087
1031
|
/**
|
|
1088
1032
|
* Points the parser to the next character in the
|
|
1089
1033
|
* path string every time it encounters any kind of
|
|
@@ -1091,9 +1035,7 @@ declare const scanSegment: (path: PathParser) => void;
|
|
|
1091
1035
|
*
|
|
1092
1036
|
* @param path - The PathParser instance
|
|
1093
1037
|
*/
|
|
1094
|
-
declare const skipSpaces: (path: PathParser) => void;
|
|
1095
|
-
//#endregion
|
|
1096
|
-
//#region src/util/getPathBBox.d.ts
|
|
1038
|
+
export declare const skipSpaces: (path: PathParser) => void;
|
|
1097
1039
|
/**
|
|
1098
1040
|
* Calculates the bounding box of a path.
|
|
1099
1041
|
*
|
|
@@ -1106,7 +1048,7 @@ declare const skipSpaces: (path: PathParser) => void;
|
|
|
1106
1048
|
* // => { x: 0, y: 0, width: 100, height: 100, x2: 100, y2: 100, cx: 50, cy: 50, cz: 150 }
|
|
1107
1049
|
* ```
|
|
1108
1050
|
*/
|
|
1109
|
-
declare const getPathBBox: <T extends PathArray>(pathInput: T | string) => {
|
|
1051
|
+
export declare const getPathBBox: <T extends PathArray>(pathInput: T | string) => {
|
|
1110
1052
|
x: number;
|
|
1111
1053
|
y: number;
|
|
1112
1054
|
width: number;
|
|
@@ -1117,8 +1059,6 @@ declare const getPathBBox: <T extends PathArray>(pathInput: T | string) => {
|
|
|
1117
1059
|
cy: number;
|
|
1118
1060
|
cz: number;
|
|
1119
1061
|
};
|
|
1120
|
-
//#endregion
|
|
1121
|
-
//#region src/util/getTotalLength.d.ts
|
|
1122
1062
|
/**
|
|
1123
1063
|
* Returns the total length of a path, equivalent to `shape.getTotalLength()`.
|
|
1124
1064
|
*
|
|
@@ -1131,13 +1071,9 @@ declare const getPathBBox: <T extends PathArray>(pathInput: T | string) => {
|
|
|
1131
1071
|
* // => 300
|
|
1132
1072
|
* ```
|
|
1133
1073
|
*/
|
|
1134
|
-
declare const getTotalLength: <T extends PathArray>(pathInput: string | T) => number;
|
|
1135
|
-
//#endregion
|
|
1136
|
-
//#region src/util/distanceEpsilon.d.ts
|
|
1074
|
+
export declare const getTotalLength: <T extends PathArray>(pathInput: string | T) => number;
|
|
1137
1075
|
/** Small threshold value used for floating-point distance comparisons in path calculations. */
|
|
1138
1076
|
declare const DISTANCE_EPSILON = 0.00001;
|
|
1139
|
-
//#endregion
|
|
1140
|
-
//#region src/util/getClosestPoint.d.ts
|
|
1141
1077
|
/**
|
|
1142
1078
|
* Returns the point in path closest to a given point.
|
|
1143
1079
|
*
|
|
@@ -1145,15 +1081,13 @@ declare const DISTANCE_EPSILON = 0.00001;
|
|
|
1145
1081
|
* @param point the given point
|
|
1146
1082
|
* @returns the best match
|
|
1147
1083
|
*/
|
|
1148
|
-
declare const getClosestPoint: (pathInput: string | PathArray, point: {
|
|
1084
|
+
export declare const getClosestPoint: (pathInput: string | PathArray, point: {
|
|
1149
1085
|
x: number;
|
|
1150
1086
|
y: number;
|
|
1151
1087
|
}) => {
|
|
1152
1088
|
x: number;
|
|
1153
1089
|
y: number;
|
|
1154
1090
|
};
|
|
1155
|
-
//#endregion
|
|
1156
|
-
//#region src/util/getDrawDirection.d.ts
|
|
1157
1091
|
/**
|
|
1158
1092
|
* Check if a path is drawn clockwise and returns true if so,
|
|
1159
1093
|
* false otherwise.
|
|
@@ -1161,9 +1095,7 @@ declare const getClosestPoint: (pathInput: string | PathArray, point: {
|
|
|
1161
1095
|
* @param path the path string or `pathArray`
|
|
1162
1096
|
* @returns true when clockwise or false if not
|
|
1163
1097
|
*/
|
|
1164
|
-
declare const getDrawDirection: (path: string | PathArray) => boolean;
|
|
1165
|
-
//#endregion
|
|
1166
|
-
//#region src/util/getPathArea.d.ts
|
|
1098
|
+
export declare const getDrawDirection: (path: string | PathArray) => boolean;
|
|
1167
1099
|
/**
|
|
1168
1100
|
* Returns the signed area of a shape.
|
|
1169
1101
|
*
|
|
@@ -1180,9 +1112,7 @@ declare const getDrawDirection: (path: string | PathArray) => boolean;
|
|
|
1180
1112
|
* // => -10000 (counter-clockwise square)
|
|
1181
1113
|
* ```
|
|
1182
1114
|
*/
|
|
1183
|
-
declare const getPathArea: <T extends PathArray | string>(path: T) => number;
|
|
1184
|
-
//#endregion
|
|
1185
|
-
//#region src/util/getPointAtLength.d.ts
|
|
1115
|
+
export declare const getPathArea: <T extends PathArray | string>(path: T) => number;
|
|
1186
1116
|
/**
|
|
1187
1117
|
* Returns [x,y] coordinates of a point at a given length along a path.
|
|
1188
1118
|
*
|
|
@@ -1196,12 +1126,10 @@ declare const getPathArea: <T extends PathArray | string>(path: T) => number;
|
|
|
1196
1126
|
* // => { x: 50, y: 0 }
|
|
1197
1127
|
* ```
|
|
1198
1128
|
*/
|
|
1199
|
-
declare const getPointAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => {
|
|
1129
|
+
export declare const getPointAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => {
|
|
1200
1130
|
x: number;
|
|
1201
1131
|
y: number;
|
|
1202
1132
|
};
|
|
1203
|
-
//#endregion
|
|
1204
|
-
//#region src/util/getPropertiesAtLength.d.ts
|
|
1205
1133
|
/**
|
|
1206
1134
|
* Returns the segment, its index and length as well as
|
|
1207
1135
|
* the length to that segment at a given length in a path.
|
|
@@ -1210,9 +1138,7 @@ declare const getPointAtLength: <T extends PathArray>(pathInput: string | T, dis
|
|
|
1210
1138
|
* @param distance the given length
|
|
1211
1139
|
* @returns the requested properties
|
|
1212
1140
|
*/
|
|
1213
|
-
declare const getPropertiesAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => SegmentProperties;
|
|
1214
|
-
//#endregion
|
|
1215
|
-
//#region src/util/getPropertiesAtPoint.d.ts
|
|
1141
|
+
export declare const getPropertiesAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => SegmentProperties;
|
|
1216
1142
|
/**
|
|
1217
1143
|
* Returns the point and segment in path closest to a given point as well as
|
|
1218
1144
|
* the distance to the path stroke.
|
|
@@ -1223,9 +1149,7 @@ declare const getPropertiesAtLength: <T extends PathArray>(pathInput: string | T
|
|
|
1223
1149
|
* @param point the given point
|
|
1224
1150
|
* @returns the requested properties
|
|
1225
1151
|
*/
|
|
1226
|
-
declare const getPropertiesAtPoint: <T extends PathArray>(pathInput: string | T, point: Point) => PointProperties;
|
|
1227
|
-
//#endregion
|
|
1228
|
-
//#region src/util/getSegmentAtLength.d.ts
|
|
1152
|
+
export declare const getPropertiesAtPoint: <T extends PathArray>(pathInput: string | T, point: Point) => PointProperties;
|
|
1229
1153
|
/**
|
|
1230
1154
|
* Returns the segment at a given length.
|
|
1231
1155
|
*
|
|
@@ -1233,9 +1157,7 @@ declare const getPropertiesAtPoint: <T extends PathArray>(pathInput: string | T,
|
|
|
1233
1157
|
* @param distance the distance in path to look at
|
|
1234
1158
|
* @returns the requested segment
|
|
1235
1159
|
*/
|
|
1236
|
-
declare const getSegmentAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => PathSegment | undefined;
|
|
1237
|
-
//#endregion
|
|
1238
|
-
//#region src/util/getSegmentOfPoint.d.ts
|
|
1160
|
+
export declare const getSegmentAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => PathSegment | undefined;
|
|
1239
1161
|
/**
|
|
1240
1162
|
* Returns the path segment which contains a given point.
|
|
1241
1163
|
*
|
|
@@ -1243,12 +1165,10 @@ declare const getSegmentAtLength: <T extends PathArray>(pathInput: string | T, d
|
|
|
1243
1165
|
* @param point the point of the shape to look for
|
|
1244
1166
|
* @returns the requested segment
|
|
1245
1167
|
*/
|
|
1246
|
-
declare const getSegmentOfPoint: <T extends PathArray>(path: string | T, point: {
|
|
1168
|
+
export declare const getSegmentOfPoint: <T extends PathArray>(path: string | T, point: {
|
|
1247
1169
|
x: number;
|
|
1248
1170
|
y: number;
|
|
1249
1171
|
}) => SegmentProperties | undefined;
|
|
1250
|
-
//#endregion
|
|
1251
|
-
//#region src/util/isAbsoluteArray.d.ts
|
|
1252
1172
|
/**
|
|
1253
1173
|
* Iterates an array to check if it's a `pathArray`
|
|
1254
1174
|
* with all absolute values.
|
|
@@ -1256,9 +1176,7 @@ declare const getSegmentOfPoint: <T extends PathArray>(path: string | T, point:
|
|
|
1256
1176
|
* @param path the `pathArray` to be checked
|
|
1257
1177
|
* @returns iteration result
|
|
1258
1178
|
*/
|
|
1259
|
-
declare const isAbsoluteArray: (path: unknown) => path is AbsoluteArray;
|
|
1260
|
-
//#endregion
|
|
1261
|
-
//#region src/util/isCurveArray.d.ts
|
|
1179
|
+
export declare const isAbsoluteArray: (path: unknown) => path is AbsoluteArray;
|
|
1262
1180
|
/**
|
|
1263
1181
|
* Iterates an array to check if it's a `pathArray`
|
|
1264
1182
|
* with all C (cubic bezier) segments.
|
|
@@ -1266,9 +1184,7 @@ declare const isAbsoluteArray: (path: unknown) => path is AbsoluteArray;
|
|
|
1266
1184
|
* @param path the `Array` to be checked
|
|
1267
1185
|
* @returns iteration result
|
|
1268
1186
|
*/
|
|
1269
|
-
declare const isCurveArray: (path: unknown) => path is CurveArray;
|
|
1270
|
-
//#endregion
|
|
1271
|
-
//#region src/util/isNormalizedArray.d.ts
|
|
1187
|
+
export declare const isCurveArray: (path: unknown) => path is CurveArray;
|
|
1272
1188
|
/**
|
|
1273
1189
|
* Iterates an array to check if it's a `pathArray`
|
|
1274
1190
|
* with all segments in non-shorthand notation
|
|
@@ -1277,18 +1193,14 @@ declare const isCurveArray: (path: unknown) => path is CurveArray;
|
|
|
1277
1193
|
* @param path - the array to be checked
|
|
1278
1194
|
* @returns true if the array is a normalized path array
|
|
1279
1195
|
*/
|
|
1280
|
-
declare const isNormalizedArray: (path: unknown) => path is NormalArray;
|
|
1281
|
-
//#endregion
|
|
1282
|
-
//#region src/util/isPathArray.d.ts
|
|
1196
|
+
export declare const isNormalizedArray: (path: unknown) => path is NormalArray;
|
|
1283
1197
|
/**
|
|
1284
1198
|
* Iterates an array to check if it's an actual `pathArray`.
|
|
1285
1199
|
*
|
|
1286
1200
|
* @param path the `pathArray` to be checked
|
|
1287
1201
|
* @returns iteration result
|
|
1288
1202
|
*/
|
|
1289
|
-
declare const isPathArray: (path: unknown) => path is PathArray;
|
|
1290
|
-
//#endregion
|
|
1291
|
-
//#region src/util/isPointInStroke.d.ts
|
|
1203
|
+
export declare const isPathArray: (path: unknown) => path is PathArray;
|
|
1292
1204
|
/**
|
|
1293
1205
|
* Checks if a given point is in the stroke of a path.
|
|
1294
1206
|
*
|
|
@@ -1296,28 +1208,22 @@ declare const isPathArray: (path: unknown) => path is PathArray;
|
|
|
1296
1208
|
* @param point the given `{x,y}` point
|
|
1297
1209
|
* @returns the query result
|
|
1298
1210
|
*/
|
|
1299
|
-
declare const isPointInStroke: <T extends PathArray>(pathInput: string | T, point: {
|
|
1211
|
+
export declare const isPointInStroke: <T extends PathArray>(pathInput: string | T, point: {
|
|
1300
1212
|
x: number;
|
|
1301
1213
|
y: number;
|
|
1302
1214
|
}) => boolean;
|
|
1303
|
-
//#endregion
|
|
1304
|
-
//#region src/util/isPolygonArray.d.ts
|
|
1305
1215
|
/**
|
|
1306
1216
|
* Checks if a path is a polygon (only M, L, H, V, Z commands).
|
|
1307
1217
|
* @param pathArray PathArray (pre-normalize if needed)
|
|
1308
1218
|
* @returns boolean
|
|
1309
1219
|
*/
|
|
1310
|
-
declare const isPolygonArray: (path: PathArray) => path is PolygonArray;
|
|
1311
|
-
//#endregion
|
|
1312
|
-
//#region src/util/isPolylineArray.d.ts
|
|
1220
|
+
export declare const isPolygonArray: (path: PathArray) => path is PolygonArray;
|
|
1313
1221
|
/**
|
|
1314
1222
|
* Checks if a path is a polyline (only M, L, H, V commands).
|
|
1315
1223
|
* @param pathArray PathArray (pre-normalize if needed)
|
|
1316
1224
|
* @returns boolean
|
|
1317
1225
|
*/
|
|
1318
|
-
declare function isPolylineArray(path: PathArray): path is PolylineArray;
|
|
1319
|
-
//#endregion
|
|
1320
|
-
//#region src/util/isRelativeArray.d.ts
|
|
1226
|
+
export declare function isPolylineArray(path: PathArray): path is PolylineArray;
|
|
1321
1227
|
/**
|
|
1322
1228
|
* Iterates an array to check if it's a `pathArray`
|
|
1323
1229
|
* with relative values.
|
|
@@ -1325,9 +1231,7 @@ declare function isPolylineArray(path: PathArray): path is PolylineArray;
|
|
|
1325
1231
|
* @param path the `pathArray` to be checked
|
|
1326
1232
|
* @returns iteration result
|
|
1327
1233
|
*/
|
|
1328
|
-
declare const isRelativeArray: (path: unknown) => path is RelativeArray;
|
|
1329
|
-
//#endregion
|
|
1330
|
-
//#region src/util/isValidPath.d.ts
|
|
1234
|
+
export declare const isRelativeArray: (path: unknown) => path is RelativeArray;
|
|
1331
1235
|
/**
|
|
1332
1236
|
* Parses a path string value to determine its validity
|
|
1333
1237
|
* then returns true if it's valid or false otherwise.
|
|
@@ -1335,32 +1239,24 @@ declare const isRelativeArray: (path: unknown) => path is RelativeArray;
|
|
|
1335
1239
|
* @param pathString the path string to be parsed
|
|
1336
1240
|
* @returns the path string validity
|
|
1337
1241
|
*/
|
|
1338
|
-
declare const isValidPath: (pathString: string) => boolean;
|
|
1339
|
-
//#endregion
|
|
1340
|
-
//#region src/util/isMultiPath.d.ts
|
|
1242
|
+
export declare const isValidPath: (pathString: string) => boolean;
|
|
1341
1243
|
/**
|
|
1342
1244
|
* Determines if an SVG path contains multiple subpaths.
|
|
1343
1245
|
* Accepts path string or PathArray.
|
|
1344
1246
|
* @param path - 'M10,10 L20,20 Z M30,30 L40,40' → true
|
|
1345
1247
|
* @returns boolean
|
|
1346
1248
|
*/
|
|
1347
|
-
declare const isMultiPath: <T extends PathArray>(path: string | T) => boolean;
|
|
1348
|
-
//#endregion
|
|
1349
|
-
//#region src/util/isClosedPath.d.ts
|
|
1249
|
+
export declare const isMultiPath: <T extends PathArray>(path: string | T) => boolean;
|
|
1350
1250
|
/**
|
|
1351
1251
|
* Check if a PathArray is closed, which means its last segment is a Z.
|
|
1352
1252
|
* @param path
|
|
1353
1253
|
* @returns true if the path is closed
|
|
1354
1254
|
*/
|
|
1355
|
-
declare const isClosedPath: <T extends PathArray>(path: T) => boolean;
|
|
1356
|
-
//#endregion
|
|
1357
|
-
//#region src/util/shapeParams.d.ts
|
|
1255
|
+
export declare const isClosedPath: <T extends PathArray>(path: T) => boolean;
|
|
1358
1256
|
/**
|
|
1359
1257
|
* Supported shapes and their specific parameters.
|
|
1360
1258
|
*/
|
|
1361
|
-
declare const shapeParams: ShapeParams;
|
|
1362
|
-
//#endregion
|
|
1363
|
-
//#region src/util/shapeToPath.d.ts
|
|
1259
|
+
export declare const shapeParams: ShapeParams;
|
|
1364
1260
|
/**
|
|
1365
1261
|
* Returns a new `<path>` element created from attributes of a `<line>`, `<polyline>`,
|
|
1366
1262
|
* `<polygon>`, `<rect>`, `<ellipse>`, `<circle>` or `<glyph>`. If `replace` parameter
|
|
@@ -1390,9 +1286,7 @@ declare const shapeParams: ShapeParams;
|
|
|
1390
1286
|
* // => 'M50 25A25 25 0 1 1 50 75A25 25 0 1 1 50 25Z'
|
|
1391
1287
|
* ```
|
|
1392
1288
|
*/
|
|
1393
|
-
declare const shapeToPath: (element: ShapeTypes | ShapeOps, replace?: boolean, ownerDocument?: Document) => SVGPathElement | false;
|
|
1394
|
-
//#endregion
|
|
1395
|
-
//#region src/util/shapeToPathArray.d.ts
|
|
1289
|
+
export declare const shapeToPath: (element: ShapeTypes | ShapeOps, replace?: boolean, ownerDocument?: Document) => SVGPathElement | false;
|
|
1396
1290
|
/**
|
|
1397
1291
|
* Returns a new `pathArray` created from attributes of a `<line>`, `<polyline>`,
|
|
1398
1292
|
* `<polygon>`, `<rect>`, `<ellipse>`, `<circle>`, <path> or `<glyph>`.
|
|
@@ -1403,9 +1297,7 @@ declare const shapeToPath: (element: ShapeTypes | ShapeOps, replace?: boolean, o
|
|
|
1403
1297
|
* @param element target shape
|
|
1404
1298
|
* @returns the newly created `<path>` element
|
|
1405
1299
|
*/
|
|
1406
|
-
declare const shapeToPathArray: (element: ShapeTypes | ShapeOps) => false | PathArray;
|
|
1407
|
-
//#endregion
|
|
1408
|
-
//#region src/process/normalizePath.d.ts
|
|
1300
|
+
export declare const shapeToPathArray: (element: ShapeTypes | ShapeOps) => false | PathArray;
|
|
1409
1301
|
/**
|
|
1410
1302
|
* Parses a path string or PathArray, then iterates the result for:
|
|
1411
1303
|
* * converting segments to absolute values
|
|
@@ -1420,9 +1312,7 @@ declare const shapeToPathArray: (element: ShapeTypes | ShapeOps) => false | Path
|
|
|
1420
1312
|
* // => [['M', 10, 90], ['C', 30, 90, 25, 10, 50, 10], ['C', 75, 10, 70, 90, 90, 90]]
|
|
1421
1313
|
* ```
|
|
1422
1314
|
*/
|
|
1423
|
-
declare const normalizePath: <T extends string | PathArray>(pathInput: T) => NormalArray;
|
|
1424
|
-
//#endregion
|
|
1425
|
-
//#region src/process/optimizePath.d.ts
|
|
1315
|
+
export declare const normalizePath: <T extends string | PathArray>(pathInput: T) => NormalArray;
|
|
1426
1316
|
/**
|
|
1427
1317
|
* Optimizes a PathArray:
|
|
1428
1318
|
* * converts segments to shorthand if possible
|
|
@@ -1438,9 +1328,7 @@ declare const normalizePath: <T extends string | PathArray>(pathInput: T) => Nor
|
|
|
1438
1328
|
* // => [['M', 10, 10], ['l', 0, 0], ['l', 80, 80]]
|
|
1439
1329
|
* ```
|
|
1440
1330
|
*/
|
|
1441
|
-
declare const optimizePath: <T extends string | PathArray>(pathInput: T, roundOption?: number) => PathArray;
|
|
1442
|
-
//#endregion
|
|
1443
|
-
//#region src/process/reversePath.d.ts
|
|
1331
|
+
export declare const optimizePath: <T extends string | PathArray>(pathInput: T, roundOption?: number) => PathArray;
|
|
1444
1332
|
/**
|
|
1445
1333
|
* Reverses all segments of a PathArray and returns a new PathArray
|
|
1446
1334
|
* with absolute values.
|
|
@@ -1454,9 +1342,7 @@ declare const optimizePath: <T extends string | PathArray>(pathInput: T, roundOp
|
|
|
1454
1342
|
* // => [['M', 0, 100], ['L', 0, 0], ['L', 100, 0], ['L', 100, 100], ['Z']]
|
|
1455
1343
|
* ```
|
|
1456
1344
|
*/
|
|
1457
|
-
declare const reversePath: <T extends PathArray>(pathInput: T) => T;
|
|
1458
|
-
//#endregion
|
|
1459
|
-
//#region src/process/splitPath.d.ts
|
|
1345
|
+
export declare const reversePath: <T extends PathArray>(pathInput: T | string) => T;
|
|
1460
1346
|
/**
|
|
1461
1347
|
* Split a path string or PathArray into an array of sub-paths.
|
|
1462
1348
|
*
|
|
@@ -1475,9 +1361,7 @@ declare const reversePath: <T extends PathArray>(pathInput: T) => T;
|
|
|
1475
1361
|
* // ]
|
|
1476
1362
|
* ```
|
|
1477
1363
|
*/
|
|
1478
|
-
declare const splitPath: <T extends PathArray>(pathInput: T | string) => T[];
|
|
1479
|
-
//#endregion
|
|
1480
|
-
//#region src/process/transformPath.d.ts
|
|
1364
|
+
export declare const splitPath: <T extends PathArray>(pathInput: T | string) => T[];
|
|
1481
1365
|
/**
|
|
1482
1366
|
* Apply a 2D / 3D transformation to a PathArray.
|
|
1483
1367
|
*
|
|
@@ -1494,9 +1378,7 @@ declare const splitPath: <T extends PathArray>(pathInput: T | string) => T[];
|
|
|
1494
1378
|
* // => [['M', 10, 20], ['L', 210, 20], ['L', 210, 220], ['L', 10, 220], ['Z']]
|
|
1495
1379
|
* ```
|
|
1496
1380
|
*/
|
|
1497
|
-
declare const transformPath: <T extends PathArray>(pathInput: T | string, transform?: Partial<TransformObject>) => T | AbsoluteArray;
|
|
1498
|
-
//#endregion
|
|
1499
|
-
//#region src/process/absolutizeSegment.d.ts
|
|
1381
|
+
export declare const transformPath: <T extends PathArray>(pathInput: T | string, transform?: Partial<TransformObject>) => T | AbsoluteArray;
|
|
1500
1382
|
/**
|
|
1501
1383
|
* Returns an absolute segment of a `PathArray` object.
|
|
1502
1384
|
*
|
|
@@ -1506,9 +1388,7 @@ declare const transformPath: <T extends PathArray>(pathInput: T | string, transf
|
|
|
1506
1388
|
* @param lastY the last known Y value
|
|
1507
1389
|
* @returns the absolute segment
|
|
1508
1390
|
*/
|
|
1509
|
-
declare const absolutizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment;
|
|
1510
|
-
//#endregion
|
|
1511
|
-
//#region src/process/arcToCubic.d.ts
|
|
1391
|
+
export declare const absolutizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment;
|
|
1512
1392
|
/**
|
|
1513
1393
|
* Converts A (arc-to) segments to C (cubic-bezier-to).
|
|
1514
1394
|
*
|
|
@@ -1527,9 +1407,7 @@ declare const absolutizeSegment: (segment: PathSegment, index: number, lastX: nu
|
|
|
1527
1407
|
* @param recursive the parameters needed to split arc into 2 segments
|
|
1528
1408
|
* @returns the resulting cubic-bezier segment(s)
|
|
1529
1409
|
*/
|
|
1530
|
-
declare const arcToCubic: (X1: number, Y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, X2: number, Y2: number, recursive?: [number, number, number, number]) => number[];
|
|
1531
|
-
//#endregion
|
|
1532
|
-
//#region src/process/getSVGMatrix.d.ts
|
|
1410
|
+
export declare const arcToCubic: (X1: number, Y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, X2: number, Y2: number, recursive?: [number, number, number, number]) => number[];
|
|
1533
1411
|
/**
|
|
1534
1412
|
* Returns a transformation matrix to apply to `<path>` elements.
|
|
1535
1413
|
*
|
|
@@ -1538,9 +1416,7 @@ declare const arcToCubic: (X1: number, Y1: number, RX: number, RY: number, angle
|
|
|
1538
1416
|
* @param transform the `transformObject`
|
|
1539
1417
|
* @returns a new transformation matrix
|
|
1540
1418
|
*/
|
|
1541
|
-
declare const getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix;
|
|
1542
|
-
//#endregion
|
|
1543
|
-
//#region src/process/iterate.d.ts
|
|
1419
|
+
export declare const getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix;
|
|
1544
1420
|
/**
|
|
1545
1421
|
* Iterates over a `PathArray`, executing a callback for each segment.
|
|
1546
1422
|
* The callback can:
|
|
@@ -1568,9 +1444,7 @@ declare const getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix;
|
|
|
1568
1444
|
* if (seg[0] === 'L') return ['C', x, y, seg[1], seg[2], seg[1], seg[2]];
|
|
1569
1445
|
* });
|
|
1570
1446
|
*/
|
|
1571
|
-
declare const iterate: <T extends PathArray>(path: T, iterator: IteratorCallback<T>) => T;
|
|
1572
|
-
//#endregion
|
|
1573
|
-
//#region src/process/lineToCubic.d.ts
|
|
1447
|
+
export declare const iterate: <T extends PathArray>(path: T, iterator: IteratorCallback<T>) => T;
|
|
1574
1448
|
/**
|
|
1575
1449
|
* Converts an L (line-to) segment to C (cubic-bezier).
|
|
1576
1450
|
*
|
|
@@ -1580,19 +1454,16 @@ declare const iterate: <T extends PathArray>(path: T, iterator: IteratorCallback
|
|
|
1580
1454
|
* @param y2 line end y
|
|
1581
1455
|
* @returns the cubic-bezier segment
|
|
1582
1456
|
*/
|
|
1583
|
-
declare const lineToCubic: (x1: number, y1: number, x2: number, y2: number) => number[];
|
|
1584
|
-
//#endregion
|
|
1585
|
-
//#region src/process/normalizeSegment.d.ts
|
|
1457
|
+
export declare const lineToCubic: (x1: number, y1: number, x2: number, y2: number) => number[];
|
|
1586
1458
|
/**
|
|
1587
1459
|
* Normalizes a single segment of a `pathArray` object.
|
|
1588
1460
|
*
|
|
1589
1461
|
* @param segment the segment object
|
|
1590
1462
|
* @param params the normalization parameters
|
|
1463
|
+
* @param prevCommand the command of the previous segment
|
|
1591
1464
|
* @returns the normalized segment
|
|
1592
1465
|
*/
|
|
1593
|
-
declare const normalizeSegment: (segment: PathSegment, params: ParserParams) => NormalSegment;
|
|
1594
|
-
//#endregion
|
|
1595
|
-
//#region src/process/projection2d.d.ts
|
|
1466
|
+
export declare const normalizeSegment: (segment: PathSegment, params: ParserParams, prevCommand?: PathCommand | null) => NormalSegment;
|
|
1596
1467
|
/**
|
|
1597
1468
|
* Returns the [x,y] projected coordinates for a given an [x,y] point
|
|
1598
1469
|
* and an [x,y,z] perspective origin point.
|
|
@@ -1607,9 +1478,7 @@ declare const normalizeSegment: (segment: PathSegment, params: ParserParams) =>
|
|
|
1607
1478
|
* @param origin the [x,y,z] transform origin
|
|
1608
1479
|
* @returns the projected [x,y] coordinates
|
|
1609
1480
|
*/
|
|
1610
|
-
declare const projection2d: (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]) => PointTuple;
|
|
1611
|
-
//#endregion
|
|
1612
|
-
//#region src/process/quadToCubic.d.ts
|
|
1481
|
+
export declare const projection2d: (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]) => PointTuple;
|
|
1613
1482
|
/**
|
|
1614
1483
|
* Converts a Q (quadratic-bezier) segment to C (cubic-bezier).
|
|
1615
1484
|
*
|
|
@@ -1621,9 +1490,7 @@ declare const projection2d: (m: CSSMatrix, point2D: PointTuple, origin: [number,
|
|
|
1621
1490
|
* @param y2 curve end y
|
|
1622
1491
|
* @returns the cubic-bezier segment
|
|
1623
1492
|
*/
|
|
1624
|
-
declare const quadToCubic: (x1: number, y1: number, qx: number, qy: number, x2: number, y2: number) => [number, number, number, number, number, number];
|
|
1625
|
-
//#endregion
|
|
1626
|
-
//#region src/process/relativizeSegment.d.ts
|
|
1493
|
+
export declare const quadToCubic: (x1: number, y1: number, qx: number, qy: number, x2: number, y2: number) => [number, number, number, number, number, number];
|
|
1627
1494
|
/**
|
|
1628
1495
|
* Returns a relative segment of a `PathArray` object.
|
|
1629
1496
|
*
|
|
@@ -1633,9 +1500,7 @@ declare const quadToCubic: (x1: number, y1: number, qx: number, qy: number, x2:
|
|
|
1633
1500
|
* @param lastY the last known Y value
|
|
1634
1501
|
* @returns the relative segment
|
|
1635
1502
|
*/
|
|
1636
|
-
declare const relativizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => MSegment | RelativeSegment;
|
|
1637
|
-
//#endregion
|
|
1638
|
-
//#region src/process/reverseCurve.d.ts
|
|
1503
|
+
export declare const relativizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => MSegment | RelativeSegment;
|
|
1639
1504
|
/**
|
|
1640
1505
|
* Reverses all segments of a `pathArray`
|
|
1641
1506
|
* which consists of only C (cubic-bezier) path commands.
|
|
@@ -1643,9 +1508,7 @@ declare const relativizeSegment: (segment: PathSegment, index: number, lastX: nu
|
|
|
1643
1508
|
* @param path the source `pathArray`
|
|
1644
1509
|
* @returns the reversed `pathArray`
|
|
1645
1510
|
*/
|
|
1646
|
-
declare const reverseCurve: (path: CurveArray) => CurveArray;
|
|
1647
|
-
//#endregion
|
|
1648
|
-
//#region src/process/roundPath.d.ts
|
|
1511
|
+
export declare const reverseCurve: (path: CurveArray) => CurveArray;
|
|
1649
1512
|
/**
|
|
1650
1513
|
* Rounds the values of a `pathArray` instance to
|
|
1651
1514
|
* a specified amount of decimals and returns it.
|
|
@@ -1654,9 +1517,7 @@ declare const reverseCurve: (path: CurveArray) => CurveArray;
|
|
|
1654
1517
|
* @param roundOption the amount of decimals to round numbers to
|
|
1655
1518
|
* @returns the resulted `pathArray` with rounded values
|
|
1656
1519
|
*/
|
|
1657
|
-
declare const roundPath: <T extends PathArray>(path: T, roundOption?: number | "off") => T;
|
|
1658
|
-
//#endregion
|
|
1659
|
-
//#region src/process/roundSegment.d.ts
|
|
1520
|
+
export declare const roundPath: <T extends PathArray>(path: T, roundOption?: number | "off") => T;
|
|
1660
1521
|
/**
|
|
1661
1522
|
* Rounds the numeric values of a path segment to the specified precision.
|
|
1662
1523
|
*
|
|
@@ -1664,9 +1525,7 @@ declare const roundPath: <T extends PathArray>(path: T, roundOption?: number | "
|
|
|
1664
1525
|
* @param roundOption - Number of decimal places
|
|
1665
1526
|
* @returns The rounded segment
|
|
1666
1527
|
*/
|
|
1667
|
-
declare const roundSegment: <T extends PathSegment>(segment: T, roundOption: number) => T;
|
|
1668
|
-
//#endregion
|
|
1669
|
-
//#region src/process/segmentToCubic.d.ts
|
|
1528
|
+
export declare const roundSegment: <T extends PathSegment>(segment: T, roundOption: number) => T;
|
|
1670
1529
|
/**
|
|
1671
1530
|
* Converts any segment to C (cubic-bezier).
|
|
1672
1531
|
*
|
|
@@ -1674,9 +1533,7 @@ declare const roundSegment: <T extends PathSegment>(segment: T, roundOption: num
|
|
|
1674
1533
|
* @param params the source segment parameters
|
|
1675
1534
|
* @returns the cubic-bezier segment
|
|
1676
1535
|
*/
|
|
1677
|
-
declare const segmentToCubic: (segment: PathSegment, params: ParserParams) => MSegment | CSegment;
|
|
1678
|
-
//#endregion
|
|
1679
|
-
//#region src/process/shortenSegment.d.ts
|
|
1536
|
+
export declare const segmentToCubic: (segment: PathSegment, params: ParserParams) => MSegment | CSegment;
|
|
1680
1537
|
/**
|
|
1681
1538
|
* Shorten a single segment of a `pathArray` object.
|
|
1682
1539
|
*
|
|
@@ -1686,9 +1543,7 @@ declare const segmentToCubic: (segment: PathSegment, params: ParserParams) => MS
|
|
|
1686
1543
|
* @param prevCommand the path command of the previous segment
|
|
1687
1544
|
* @returns the shortened segment
|
|
1688
1545
|
*/
|
|
1689
|
-
declare const shortenSegment: (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment;
|
|
1690
|
-
//#endregion
|
|
1691
|
-
//#region src/morph/fixPath.d.ts
|
|
1546
|
+
export declare const shortenSegment: (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment;
|
|
1692
1547
|
/**
|
|
1693
1548
|
* Checks a `PathArray` for an unnecessary `Z` segment
|
|
1694
1549
|
* and removes it. The `PathArray` is modified in place.
|
|
@@ -1703,9 +1558,7 @@ declare const shortenSegment: (segment: AbsoluteSegment, normalSegment: NormalSe
|
|
|
1703
1558
|
* @param pathInput the `pathArray` source
|
|
1704
1559
|
* @returns void
|
|
1705
1560
|
*/
|
|
1706
|
-
declare const fixPath: <T extends PathArray>(pathInput: T | string) => void;
|
|
1707
|
-
//#endregion
|
|
1708
|
-
//#region src/morph/splitCubicSegment.d.ts
|
|
1561
|
+
export declare const fixPath: <T extends PathArray>(pathInput: T | string) => void;
|
|
1709
1562
|
/**
|
|
1710
1563
|
* Split a cubic Bézier into two cubics at parameter t [0–1].
|
|
1711
1564
|
*
|
|
@@ -1720,9 +1573,7 @@ declare const fixPath: <T extends PathArray>(pathInput: T | string) => void;
|
|
|
1720
1573
|
* @param t - Parameter in range [0, 1] at which to split
|
|
1721
1574
|
* @returns Array of two cubic segments, each as [x1,y1, x2,y2, x3,y3, x4,y4]
|
|
1722
1575
|
*/
|
|
1723
|
-
declare function splitCubicSegment(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number, t: number): [CubicCoordinates, CubicCoordinates];
|
|
1724
|
-
//#endregion
|
|
1725
|
-
//#region src/morph/equalizeSegments.d.ts
|
|
1576
|
+
export declare function splitCubicSegment(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number, t: number): [CubicCoordinates, CubicCoordinates];
|
|
1726
1577
|
/**
|
|
1727
1578
|
* Equalizes two paths for morphing (single subpath only).
|
|
1728
1579
|
*
|
|
@@ -1738,9 +1589,7 @@ declare function splitCubicSegment(x1: number, y1: number, x2: number, y2: numbe
|
|
|
1738
1589
|
* // eq1.length === eq2.length
|
|
1739
1590
|
* ```
|
|
1740
1591
|
*/
|
|
1741
|
-
declare const equalizeSegments: (path1: PathArray | string, path2: PathArray | string, initialCfg?: EqualizationOptions) => [MorphPathArray, MorphPathArray];
|
|
1742
|
-
//#endregion
|
|
1743
|
-
//#region src/morph/equalizePaths.d.ts
|
|
1592
|
+
export declare const equalizeSegments: (path1: PathArray | string, path2: PathArray | string, initialCfg?: EqualizationOptions) => [MorphPathArray, MorphPathArray];
|
|
1744
1593
|
/**
|
|
1745
1594
|
* Equalizes two paths for morphing (single/multi subpath).
|
|
1746
1595
|
*
|
|
@@ -1756,9 +1605,7 @@ declare const equalizeSegments: (path1: PathArray | string, path2: PathArray | s
|
|
|
1756
1605
|
* // eq1.length === eq2.length — ready for morphing
|
|
1757
1606
|
* ```
|
|
1758
1607
|
*/
|
|
1759
|
-
declare const equalizePaths: (pathInput1: string | PathArray, pathInput2: string | PathArray, initialCfg?: {}) => [MorphPathArray, MorphPathArray];
|
|
1760
|
-
//#endregion
|
|
1761
|
-
//#region src/intersect/pathIntersection.d.ts
|
|
1608
|
+
export declare const equalizePaths: (pathInput1: string | PathArray, pathInput2: string | PathArray, initialCfg?: {}) => [MorphPathArray, MorphPathArray];
|
|
1762
1609
|
/**
|
|
1763
1610
|
* Finds intersection points between two paths.
|
|
1764
1611
|
*
|
|
@@ -1775,9 +1622,7 @@ declare const equalizePaths: (pathInput1: string | PathArray, pathInput2: string
|
|
|
1775
1622
|
* // => [{ x: 80.4136, y: 19.5864, t1: 0.7262, t2: 0.2738 }]
|
|
1776
1623
|
* ```
|
|
1777
1624
|
*/
|
|
1778
|
-
declare const pathsIntersection: <T extends string | PathArray>(pathInput1: T, pathInput2: T, justCount?: boolean) => number | IntersectionPoint[];
|
|
1779
|
-
//#endregion
|
|
1780
|
-
//#region src/intersect/boundingBoxIntersect.d.ts
|
|
1625
|
+
export declare const pathsIntersection: <T extends string | PathArray>(pathInput1: T, pathInput2: T, justCount?: boolean) => number | IntersectionPoint[];
|
|
1781
1626
|
/**
|
|
1782
1627
|
* Checks if two bounding boxes intersect.
|
|
1783
1628
|
*
|
|
@@ -1785,9 +1630,7 @@ declare const pathsIntersection: <T extends string | PathArray>(pathInput1: T, p
|
|
|
1785
1630
|
* @param b - Second bounding box as [minX, minY, maxX, maxY]
|
|
1786
1631
|
* @returns True if the bounding boxes overlap
|
|
1787
1632
|
*/
|
|
1788
|
-
declare const boundingBoxIntersect: (a: BBoxMaxima, b: BBoxMaxima) => boolean;
|
|
1789
|
-
//#endregion
|
|
1790
|
-
//#region src/intersect/isPointInsideBBox.d.ts
|
|
1633
|
+
export declare const boundingBoxIntersect: (a: BBoxMaxima, b: BBoxMaxima) => boolean;
|
|
1791
1634
|
/**
|
|
1792
1635
|
* Checks if a point is inside a bounding box.
|
|
1793
1636
|
*
|
|
@@ -1795,7 +1638,6 @@ declare const boundingBoxIntersect: (a: BBoxMaxima, b: BBoxMaxima) => boolean;
|
|
|
1795
1638
|
* @param point - The point as [x, y]
|
|
1796
1639
|
* @returns True if the point is inside or on the edge of the bounding box
|
|
1797
1640
|
*/
|
|
1798
|
-
declare const isPointInsideBBox: (bbox: BBoxMaxima, [x, y]: PointTuple) => boolean;
|
|
1799
|
-
|
|
1800
|
-
export { PathParser, absolutizeSegment, arcToCubic, arcTools, bezierTools, boundingBoxIntersect, cubicTools, DISTANCE_EPSILON as distanceEpsilon, distanceSquareRoot, equalizePaths, equalizeSegments, finalizeSegment, fixPath, getClosestPoint, getDrawDirection, getPathArea, getPathBBox, getPointAtLength, getPropertiesAtLength, getPropertiesAtPoint, getSVGMatrix, getSegmentAtLength, getSegmentOfPoint, getTotalLength, invalidPathValue, isAbsoluteArray, isArcCommand, isClosedPath, isCurveArray, isDigit, isDigitStart, isMoveCommand, isMultiPath, isNormalizedArray, isPathArray, isPathCommand, isPointInStroke, isPointInsideBBox, isPolygonArray, isPolylineArray, isRelativeArray, isSpace, isValidPath, iterate, lineToCubic, lineTools, midPoint, normalizePath, normalizeSegment, optimizePath, paramsCounts, paramsParser, parsePathString, pathToAbsolute, pathToCurve, pathToRelative, pathToString, pathsIntersection, polygonTools, projection2d, quadToCubic, quadTools, relativizeSegment, reverseCurve, reversePath, rotateVector, roundPath, roundSegment, roundTo, scanFlag, scanParam, scanSegment, segmentToCubic, shapeParams, shapeToPath, shapeToPathArray, shortenSegment, skipSpaces, splitCubicSegment, splitPath, transformPath };
|
|
1641
|
+
export declare const isPointInsideBBox: (bbox: BBoxMaxima, [x, y]: PointTuple) => boolean;
|
|
1642
|
+
export { arcTools, bezierTools, cubicTools, DISTANCE_EPSILON as distanceEpsilon, lineTools, polygonTools, quadTools };
|
|
1801
1643
|
//# sourceMappingURL=util.d.ts.map
|