@bitbybit-dev/base 0.20.12 → 0.20.14
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/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/inputs/lists-inputs.d.ts +39 -0
- package/lib/api/inputs/lists-inputs.js +43 -0
- package/lib/api/inputs/math-inputs.d.ts +154 -0
- package/lib/api/inputs/math-inputs.js +217 -0
- package/lib/api/inputs/text-inputs.d.ts +139 -0
- package/lib/api/inputs/text-inputs.js +215 -0
- package/lib/api/inputs/vector-inputs.d.ts +8 -0
- package/lib/api/inputs/vector-inputs.js +8 -0
- package/lib/api/services/color.d.ts +27 -12
- package/lib/api/services/color.js +27 -12
- package/lib/api/services/dates.d.ts +62 -30
- package/lib/api/services/dates.js +62 -30
- package/lib/api/services/geometry-helper.d.ts +50 -0
- package/lib/api/services/geometry-helper.js +50 -2
- package/lib/api/services/helpers/dxf/dxf.d.ts +19 -9
- package/lib/api/services/helpers/dxf/dxf.js +19 -9
- package/lib/api/services/line.d.ts +34 -16
- package/lib/api/services/line.js +34 -16
- package/lib/api/services/lists.d.ts +175 -32
- package/lib/api/services/lists.js +275 -32
- package/lib/api/services/logic.d.ts +24 -13
- package/lib/api/services/logic.js +24 -13
- package/lib/api/services/math.d.ts +180 -35
- package/lib/api/services/math.js +215 -35
- package/lib/api/services/mesh.d.ts +17 -6
- package/lib/api/services/mesh.js +17 -6
- package/lib/api/services/point.d.ts +63 -32
- package/lib/api/services/point.js +63 -32
- package/lib/api/services/polyline.d.ts +27 -11
- package/lib/api/services/polyline.js +27 -11
- package/lib/api/services/text.d.ts +286 -7
- package/lib/api/services/text.js +350 -7
- package/lib/api/services/transforms.d.ts +30 -16
- package/lib/api/services/transforms.js +30 -16
- package/lib/api/services/vector.d.ts +85 -38
- package/lib/api/services/vector.js +87 -38
- package/package.json +1 -1
|
@@ -14,7 +14,8 @@ export declare class Polyline {
|
|
|
14
14
|
private readonly geometryHelper;
|
|
15
15
|
constructor(vector: Vector, point: Point, line: Line, geometryHelper: GeometryHelper);
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Calculates total length of polyline by summing distances between consecutive points.
|
|
18
|
+
* Example: points=[[0,0,0], [3,0,0], [3,4,0]] → 3 + 4 = 7
|
|
18
19
|
* @param inputs a polyline
|
|
19
20
|
* @returns length
|
|
20
21
|
* @group get
|
|
@@ -23,7 +24,8 @@ export declare class Polyline {
|
|
|
23
24
|
*/
|
|
24
25
|
length(inputs: Inputs.Polyline.PolylineDto): number;
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
+
* Counts number of points in polyline.
|
|
28
|
+
* Example: polyline with points=[[0,0,0], [1,0,0], [1,1,0]] → 3
|
|
27
29
|
* @param inputs a polyline
|
|
28
30
|
* @returns nr of points
|
|
29
31
|
* @group get
|
|
@@ -32,7 +34,8 @@ export declare class Polyline {
|
|
|
32
34
|
*/
|
|
33
35
|
countPoints(inputs: Inputs.Polyline.PolylineDto): number;
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
37
|
+
* Extracts points array from polyline object.
|
|
38
|
+
* Example: polyline={points:[[0,0,0], [1,0,0]]} → [[0,0,0], [1,0,0]]
|
|
36
39
|
* @param inputs a polyline
|
|
37
40
|
* @returns points
|
|
38
41
|
* @group get
|
|
@@ -41,7 +44,8 @@ export declare class Polyline {
|
|
|
41
44
|
*/
|
|
42
45
|
getPoints(inputs: Inputs.Polyline.PolylineDto): Inputs.Base.Point3[];
|
|
43
46
|
/**
|
|
44
|
-
*
|
|
47
|
+
* Reverses point order of polyline (flips direction).
|
|
48
|
+
* Example: points=[[0,0,0], [1,0,0], [2,0,0]] → [[2,0,0], [1,0,0], [0,0,0]]
|
|
45
49
|
* @param inputs a polyline
|
|
46
50
|
* @returns reversed polyline
|
|
47
51
|
* @group convert
|
|
@@ -50,7 +54,8 @@ export declare class Polyline {
|
|
|
50
54
|
*/
|
|
51
55
|
reverse(inputs: Inputs.Polyline.PolylineDto): Inputs.Polyline.PolylinePropertiesDto;
|
|
52
56
|
/**
|
|
53
|
-
*
|
|
57
|
+
* Applies transformation matrix to all points in polyline (rotates, scales, or translates).
|
|
58
|
+
* Example: polyline with 4 points, translation [5,0,0] → all points moved +5 in X direction
|
|
54
59
|
* @param inputs a polyline
|
|
55
60
|
* @returns transformed polyline
|
|
56
61
|
* @group transforms
|
|
@@ -59,7 +64,8 @@ export declare class Polyline {
|
|
|
59
64
|
*/
|
|
60
65
|
transformPolyline(inputs: Inputs.Polyline.TransformPolylineDto): Inputs.Polyline.PolylinePropertiesDto;
|
|
61
66
|
/**
|
|
62
|
-
*
|
|
67
|
+
* Creates a polyline from points array with optional isClosed flag.
|
|
68
|
+
* Example: points=[[0,0,0], [1,0,0], [1,1,0]], isClosed=true → {points:..., isClosed:true}
|
|
63
69
|
* @param inputs points and info if its closed
|
|
64
70
|
* @returns polyline
|
|
65
71
|
* @group create
|
|
@@ -68,7 +74,9 @@ export declare class Polyline {
|
|
|
68
74
|
*/
|
|
69
75
|
create(inputs: Inputs.Polyline.PolylineCreateDto): Inputs.Polyline.PolylinePropertiesDto;
|
|
70
76
|
/**
|
|
71
|
-
*
|
|
77
|
+
* Converts polyline to line segments (each segment as line object with start/end).
|
|
78
|
+
* Closed polylines include closing segment.
|
|
79
|
+
* Example: 3 points → 2 or 3 lines (depending on isClosed)
|
|
72
80
|
* @param inputs polyline
|
|
73
81
|
* @returns lines
|
|
74
82
|
* @group convert
|
|
@@ -77,7 +85,9 @@ export declare class Polyline {
|
|
|
77
85
|
*/
|
|
78
86
|
polylineToLines(inputs: Inputs.Polyline.PolylineDto): Inputs.Base.Line3[];
|
|
79
87
|
/**
|
|
80
|
-
*
|
|
88
|
+
* Converts polyline to segment arrays (each segment as [point1, point2]).
|
|
89
|
+
* Closed polylines include closing segment if endpoints differ.
|
|
90
|
+
* Example: 4 points, closed → 4 segments connecting all points in a loop
|
|
81
91
|
* @param inputs polyline
|
|
82
92
|
* @returns segments
|
|
83
93
|
* @group convert
|
|
@@ -86,7 +96,9 @@ export declare class Polyline {
|
|
|
86
96
|
*/
|
|
87
97
|
polylineToSegments(inputs: Inputs.Polyline.PolylineDto): Inputs.Base.Segment3[];
|
|
88
98
|
/**
|
|
89
|
-
* Finds
|
|
99
|
+
* Finds points where polyline crosses itself (self-intersection points).
|
|
100
|
+
* Skips adjacent segments and deduplicates close points.
|
|
101
|
+
* Example: figure-8 shaped polyline → returns center crossing point
|
|
90
102
|
* @param inputs points of self intersection
|
|
91
103
|
* @returns polyline
|
|
92
104
|
* @group intersections
|
|
@@ -95,7 +107,9 @@ export declare class Polyline {
|
|
|
95
107
|
*/
|
|
96
108
|
polylineSelfIntersection(inputs: Inputs.Polyline.PolylineToleranceDto): Inputs.Base.Point3[];
|
|
97
109
|
/**
|
|
98
|
-
* Finds
|
|
110
|
+
* Finds intersection points between two polylines (all segment-segment crossings).
|
|
111
|
+
* Tests all segment pairs and deduplicates close points.
|
|
112
|
+
* Example: crossing polylines forming an X → returns center intersection point
|
|
99
113
|
* @param inputs two polylines and tolerance
|
|
100
114
|
* @returns points
|
|
101
115
|
* @group intersection
|
|
@@ -104,7 +118,9 @@ export declare class Polyline {
|
|
|
104
118
|
*/
|
|
105
119
|
twoPolylineIntersection(inputs: Inputs.Polyline.TwoPolylinesToleranceDto): Inputs.Base.Point3[];
|
|
106
120
|
/**
|
|
107
|
-
*
|
|
121
|
+
* Sorts scrambled segments into connected polylines by matching endpoints.
|
|
122
|
+
* Uses spatial hashing for efficient connection finding.
|
|
123
|
+
* Example: 10 random segments that form 2 connected paths → 2 polylines
|
|
108
124
|
* @param inputs segments
|
|
109
125
|
* @returns polylines
|
|
110
126
|
* @group sort
|
|
@@ -10,7 +10,8 @@ export class Polyline {
|
|
|
10
10
|
this.geometryHelper = geometryHelper;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Calculates total length of polyline by summing distances between consecutive points.
|
|
14
|
+
* Example: points=[[0,0,0], [3,0,0], [3,4,0]] → 3 + 4 = 7
|
|
14
15
|
* @param inputs a polyline
|
|
15
16
|
* @returns length
|
|
16
17
|
* @group get
|
|
@@ -27,7 +28,8 @@ export class Polyline {
|
|
|
27
28
|
return distanceOfPolyline;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
+
* Counts number of points in polyline.
|
|
32
|
+
* Example: polyline with points=[[0,0,0], [1,0,0], [1,1,0]] → 3
|
|
31
33
|
* @param inputs a polyline
|
|
32
34
|
* @returns nr of points
|
|
33
35
|
* @group get
|
|
@@ -38,7 +40,8 @@ export class Polyline {
|
|
|
38
40
|
return inputs.polyline.points.length;
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
|
-
*
|
|
43
|
+
* Extracts points array from polyline object.
|
|
44
|
+
* Example: polyline={points:[[0,0,0], [1,0,0]]} → [[0,0,0], [1,0,0]]
|
|
42
45
|
* @param inputs a polyline
|
|
43
46
|
* @returns points
|
|
44
47
|
* @group get
|
|
@@ -49,7 +52,8 @@ export class Polyline {
|
|
|
49
52
|
return inputs.polyline.points;
|
|
50
53
|
}
|
|
51
54
|
/**
|
|
52
|
-
*
|
|
55
|
+
* Reverses point order of polyline (flips direction).
|
|
56
|
+
* Example: points=[[0,0,0], [1,0,0], [2,0,0]] → [[2,0,0], [1,0,0], [0,0,0]]
|
|
53
57
|
* @param inputs a polyline
|
|
54
58
|
* @returns reversed polyline
|
|
55
59
|
* @group convert
|
|
@@ -60,7 +64,8 @@ export class Polyline {
|
|
|
60
64
|
return { points: inputs.polyline.points.reverse() };
|
|
61
65
|
}
|
|
62
66
|
/**
|
|
63
|
-
*
|
|
67
|
+
* Applies transformation matrix to all points in polyline (rotates, scales, or translates).
|
|
68
|
+
* Example: polyline with 4 points, translation [5,0,0] → all points moved +5 in X direction
|
|
64
69
|
* @param inputs a polyline
|
|
65
70
|
* @returns transformed polyline
|
|
66
71
|
* @group transforms
|
|
@@ -74,7 +79,8 @@ export class Polyline {
|
|
|
74
79
|
return { points: transformedControlPoints };
|
|
75
80
|
}
|
|
76
81
|
/**
|
|
77
|
-
*
|
|
82
|
+
* Creates a polyline from points array with optional isClosed flag.
|
|
83
|
+
* Example: points=[[0,0,0], [1,0,0], [1,1,0]], isClosed=true → {points:..., isClosed:true}
|
|
78
84
|
* @param inputs points and info if its closed
|
|
79
85
|
* @returns polyline
|
|
80
86
|
* @group create
|
|
@@ -89,7 +95,9 @@ export class Polyline {
|
|
|
89
95
|
};
|
|
90
96
|
}
|
|
91
97
|
/**
|
|
92
|
-
*
|
|
98
|
+
* Converts polyline to line segments (each segment as line object with start/end).
|
|
99
|
+
* Closed polylines include closing segment.
|
|
100
|
+
* Example: 3 points → 2 or 3 lines (depending on isClosed)
|
|
93
101
|
* @param inputs polyline
|
|
94
102
|
* @returns lines
|
|
95
103
|
* @group convert
|
|
@@ -104,7 +112,9 @@ export class Polyline {
|
|
|
104
112
|
}));
|
|
105
113
|
}
|
|
106
114
|
/**
|
|
107
|
-
*
|
|
115
|
+
* Converts polyline to segment arrays (each segment as [point1, point2]).
|
|
116
|
+
* Closed polylines include closing segment if endpoints differ.
|
|
117
|
+
* Example: 4 points, closed → 4 segments connecting all points in a loop
|
|
108
118
|
* @param inputs polyline
|
|
109
119
|
* @returns segments
|
|
110
120
|
* @group convert
|
|
@@ -132,7 +142,9 @@ export class Polyline {
|
|
|
132
142
|
return segments;
|
|
133
143
|
}
|
|
134
144
|
/**
|
|
135
|
-
* Finds
|
|
145
|
+
* Finds points where polyline crosses itself (self-intersection points).
|
|
146
|
+
* Skips adjacent segments and deduplicates close points.
|
|
147
|
+
* Example: figure-8 shaped polyline → returns center crossing point
|
|
136
148
|
* @param inputs points of self intersection
|
|
137
149
|
* @returns polyline
|
|
138
150
|
* @group intersections
|
|
@@ -184,7 +196,9 @@ export class Polyline {
|
|
|
184
196
|
return selfIntersectionPoints;
|
|
185
197
|
}
|
|
186
198
|
/**
|
|
187
|
-
* Finds
|
|
199
|
+
* Finds intersection points between two polylines (all segment-segment crossings).
|
|
200
|
+
* Tests all segment pairs and deduplicates close points.
|
|
201
|
+
* Example: crossing polylines forming an X → returns center intersection point
|
|
188
202
|
* @param inputs two polylines and tolerance
|
|
189
203
|
* @returns points
|
|
190
204
|
* @group intersection
|
|
@@ -226,7 +240,9 @@ export class Polyline {
|
|
|
226
240
|
return intersectionPoints;
|
|
227
241
|
}
|
|
228
242
|
/**
|
|
229
|
-
*
|
|
243
|
+
* Sorts scrambled segments into connected polylines by matching endpoints.
|
|
244
|
+
* Uses spatial hashing for efficient connection finding.
|
|
245
|
+
* Example: 10 random segments that form 2 connected paths → 2 polylines
|
|
230
246
|
* @param inputs segments
|
|
231
247
|
* @returns polylines
|
|
232
248
|
* @group sort
|
|
@@ -8,7 +8,8 @@ export declare class TextBitByBit {
|
|
|
8
8
|
private readonly point;
|
|
9
9
|
constructor(point: Point);
|
|
10
10
|
/**
|
|
11
|
-
* Creates a text
|
|
11
|
+
* Creates and returns a text string (pass-through for text input).
|
|
12
|
+
* Example: text='Hello World' → 'Hello World'
|
|
12
13
|
* @param inputs a text
|
|
13
14
|
* @returns text
|
|
14
15
|
* @group create
|
|
@@ -17,7 +18,8 @@ export declare class TextBitByBit {
|
|
|
17
18
|
*/
|
|
18
19
|
create(inputs: Inputs.Text.TextDto): string;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* Splits text into multiple pieces using a separator string.
|
|
22
|
+
* Example: text='apple,banana,cherry', separator=',' → ['apple', 'banana', 'cherry']
|
|
21
23
|
* @param inputs a text
|
|
22
24
|
* @returns text
|
|
23
25
|
* @group transform
|
|
@@ -26,7 +28,8 @@ export declare class TextBitByBit {
|
|
|
26
28
|
*/
|
|
27
29
|
split(inputs: Inputs.Text.TextSplitDto): string[];
|
|
28
30
|
/**
|
|
29
|
-
*
|
|
31
|
+
* Replaces all occurrences of a search string with a replacement string.
|
|
32
|
+
* Example: text='hello hello', search='hello', replaceWith='hi' → 'hi hi'
|
|
30
33
|
* @param inputs a text
|
|
31
34
|
* @returns text
|
|
32
35
|
* @group transform
|
|
@@ -35,7 +38,8 @@ export declare class TextBitByBit {
|
|
|
35
38
|
*/
|
|
36
39
|
replaceAll(inputs: Inputs.Text.TextReplaceDto): string;
|
|
37
40
|
/**
|
|
38
|
-
*
|
|
41
|
+
* Joins multiple items into a single text string using a separator.
|
|
42
|
+
* Example: list=['apple', 'banana', 'cherry'], separator=', ' → 'apple, banana, cherry'
|
|
39
43
|
* @param inputs a list of items
|
|
40
44
|
* @returns text
|
|
41
45
|
* @group transform
|
|
@@ -62,7 +66,8 @@ export declare class TextBitByBit {
|
|
|
62
66
|
*/
|
|
63
67
|
toStringEach<T>(inputs: Inputs.Text.ToStringEachDto<T>): string[];
|
|
64
68
|
/**
|
|
65
|
-
*
|
|
69
|
+
* Formats text with placeholder values using {0}, {1}, etc. syntax.
|
|
70
|
+
* Example: text='Point: ({0}, {1})', values=[10, 5] → 'Point: (10, 5)'
|
|
66
71
|
* @param inputs a text and values
|
|
67
72
|
* @returns formatted text
|
|
68
73
|
* @group transform
|
|
@@ -71,7 +76,279 @@ export declare class TextBitByBit {
|
|
|
71
76
|
*/
|
|
72
77
|
format(inputs: Inputs.Text.TextFormatDto): string;
|
|
73
78
|
/**
|
|
74
|
-
*
|
|
79
|
+
* Checks if text contains a search string.
|
|
80
|
+
* Example: text='hello world', search='world' → true
|
|
81
|
+
* @param inputs a text and search string
|
|
82
|
+
* @returns boolean
|
|
83
|
+
* @group query
|
|
84
|
+
* @shortname includes
|
|
85
|
+
* @drawable false
|
|
86
|
+
*/
|
|
87
|
+
includes(inputs: Inputs.Text.TextSearchDto): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Checks if text starts with a search string.
|
|
90
|
+
* Example: text='hello world', search='hello' → true
|
|
91
|
+
* @param inputs a text and search string
|
|
92
|
+
* @returns boolean
|
|
93
|
+
* @group query
|
|
94
|
+
* @shortname starts with
|
|
95
|
+
* @drawable false
|
|
96
|
+
*/
|
|
97
|
+
startsWith(inputs: Inputs.Text.TextSearchDto): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Checks if text ends with a search string.
|
|
100
|
+
* Example: text='hello world', search='world' → true
|
|
101
|
+
* @param inputs a text and search string
|
|
102
|
+
* @returns boolean
|
|
103
|
+
* @group query
|
|
104
|
+
* @shortname ends with
|
|
105
|
+
* @drawable false
|
|
106
|
+
*/
|
|
107
|
+
endsWith(inputs: Inputs.Text.TextSearchDto): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Returns the index of the first occurrence of a search string.
|
|
110
|
+
* Example: text='hello world', search='world' → 6
|
|
111
|
+
* @param inputs a text and search string
|
|
112
|
+
* @returns index or -1 if not found
|
|
113
|
+
* @group query
|
|
114
|
+
* @shortname index of
|
|
115
|
+
* @drawable false
|
|
116
|
+
*/
|
|
117
|
+
indexOf(inputs: Inputs.Text.TextSearchDto): number;
|
|
118
|
+
/**
|
|
119
|
+
* Returns the index of the last occurrence of a search string.
|
|
120
|
+
* Example: text='hello world hello', search='hello' → 12
|
|
121
|
+
* @param inputs a text and search string
|
|
122
|
+
* @returns index or -1 if not found
|
|
123
|
+
* @group query
|
|
124
|
+
* @shortname last index of
|
|
125
|
+
* @drawable false
|
|
126
|
+
*/
|
|
127
|
+
lastIndexOf(inputs: Inputs.Text.TextSearchDto): number;
|
|
128
|
+
/**
|
|
129
|
+
* Extracts a section of text between two indices.
|
|
130
|
+
* Example: text='hello world', start=0, end=5 → 'hello'
|
|
131
|
+
* @param inputs a text, start and end indices
|
|
132
|
+
* @returns extracted text
|
|
133
|
+
* @group transform
|
|
134
|
+
* @shortname substring
|
|
135
|
+
* @drawable false
|
|
136
|
+
*/
|
|
137
|
+
substring(inputs: Inputs.Text.TextSubstringDto): string;
|
|
138
|
+
/**
|
|
139
|
+
* Extracts a section of text and returns a new string.
|
|
140
|
+
* Example: text='hello world', start=0, end=5 → 'hello'
|
|
141
|
+
* @param inputs a text, start and end indices
|
|
142
|
+
* @returns extracted text
|
|
143
|
+
* @group transform
|
|
144
|
+
* @shortname slice
|
|
145
|
+
* @drawable false
|
|
146
|
+
*/
|
|
147
|
+
slice(inputs: Inputs.Text.TextSubstringDto): string;
|
|
148
|
+
/**
|
|
149
|
+
* Returns the character at the specified index.
|
|
150
|
+
* Example: text='hello', index=1 → 'e'
|
|
151
|
+
* @param inputs a text and index
|
|
152
|
+
* @returns character
|
|
153
|
+
* @group query
|
|
154
|
+
* @shortname char at
|
|
155
|
+
* @drawable false
|
|
156
|
+
*/
|
|
157
|
+
charAt(inputs: Inputs.Text.TextIndexDto): string;
|
|
158
|
+
/**
|
|
159
|
+
* Removes whitespace from both ends of text.
|
|
160
|
+
* Example: text=' hello ' → 'hello'
|
|
161
|
+
* @param inputs a text
|
|
162
|
+
* @returns trimmed text
|
|
163
|
+
* @group transform
|
|
164
|
+
* @shortname trim
|
|
165
|
+
* @drawable false
|
|
166
|
+
*/
|
|
167
|
+
trim(inputs: Inputs.Text.TextDto): string;
|
|
168
|
+
/**
|
|
169
|
+
* Removes whitespace from the start of text.
|
|
170
|
+
* Example: text=' hello ' → 'hello '
|
|
171
|
+
* @param inputs a text
|
|
172
|
+
* @returns trimmed text
|
|
173
|
+
* @group transform
|
|
174
|
+
* @shortname trim start
|
|
175
|
+
* @drawable false
|
|
176
|
+
*/
|
|
177
|
+
trimStart(inputs: Inputs.Text.TextDto): string;
|
|
178
|
+
/**
|
|
179
|
+
* Removes whitespace from the end of text.
|
|
180
|
+
* Example: text=' hello ' → ' hello'
|
|
181
|
+
* @param inputs a text
|
|
182
|
+
* @returns trimmed text
|
|
183
|
+
* @group transform
|
|
184
|
+
* @shortname trim end
|
|
185
|
+
* @drawable false
|
|
186
|
+
*/
|
|
187
|
+
trimEnd(inputs: Inputs.Text.TextDto): string;
|
|
188
|
+
/**
|
|
189
|
+
* Pads text from the start to reach target length.
|
|
190
|
+
* Example: text='x', length=3, padString='a' → 'aax'
|
|
191
|
+
* @param inputs a text, target length and pad string
|
|
192
|
+
* @returns padded text
|
|
193
|
+
* @group transform
|
|
194
|
+
* @shortname pad start
|
|
195
|
+
* @drawable false
|
|
196
|
+
*/
|
|
197
|
+
padStart(inputs: Inputs.Text.TextPadDto): string;
|
|
198
|
+
/**
|
|
199
|
+
* Pads text from the end to reach target length.
|
|
200
|
+
* Example: text='x', length=3, padString='a' → 'xaa'
|
|
201
|
+
* @param inputs a text, target length and pad string
|
|
202
|
+
* @returns padded text
|
|
203
|
+
* @group transform
|
|
204
|
+
* @shortname pad end
|
|
205
|
+
* @drawable false
|
|
206
|
+
*/
|
|
207
|
+
padEnd(inputs: Inputs.Text.TextPadDto): string;
|
|
208
|
+
/**
|
|
209
|
+
* Converts text to uppercase.
|
|
210
|
+
* Example: text='hello' → 'HELLO'
|
|
211
|
+
* @param inputs a text
|
|
212
|
+
* @returns uppercase text
|
|
213
|
+
* @group transform
|
|
214
|
+
* @shortname to upper case
|
|
215
|
+
* @drawable false
|
|
216
|
+
*/
|
|
217
|
+
toUpperCase(inputs: Inputs.Text.TextDto): string;
|
|
218
|
+
/**
|
|
219
|
+
* Converts text to lowercase.
|
|
220
|
+
* Example: text='HELLO' → 'hello'
|
|
221
|
+
* @param inputs a text
|
|
222
|
+
* @returns lowercase text
|
|
223
|
+
* @group transform
|
|
224
|
+
* @shortname to lower case
|
|
225
|
+
* @drawable false
|
|
226
|
+
*/
|
|
227
|
+
toLowerCase(inputs: Inputs.Text.TextDto): string;
|
|
228
|
+
/**
|
|
229
|
+
* Capitalizes the first character of text.
|
|
230
|
+
* Example: text='hello world' → 'Hello world'
|
|
231
|
+
* @param inputs a text
|
|
232
|
+
* @returns text with first character uppercase
|
|
233
|
+
* @group transform
|
|
234
|
+
* @shortname capitalize first
|
|
235
|
+
* @drawable false
|
|
236
|
+
*/
|
|
237
|
+
toUpperCaseFirst(inputs: Inputs.Text.TextDto): string;
|
|
238
|
+
/**
|
|
239
|
+
* Lowercases the first character of text.
|
|
240
|
+
* Example: text='Hello World' → 'hello World'
|
|
241
|
+
* @param inputs a text
|
|
242
|
+
* @returns text with first character lowercase
|
|
243
|
+
* @group transform
|
|
244
|
+
* @shortname uncapitalize first
|
|
245
|
+
* @drawable false
|
|
246
|
+
*/
|
|
247
|
+
toLowerCaseFirst(inputs: Inputs.Text.TextDto): string;
|
|
248
|
+
/**
|
|
249
|
+
* Repeats text a specified number of times.
|
|
250
|
+
* Example: text='ha', count=3 → 'hahaha'
|
|
251
|
+
* @param inputs a text and count
|
|
252
|
+
* @returns repeated text
|
|
253
|
+
* @group transform
|
|
254
|
+
* @shortname repeat
|
|
255
|
+
* @drawable false
|
|
256
|
+
*/
|
|
257
|
+
repeat(inputs: Inputs.Text.TextRepeatDto): string;
|
|
258
|
+
/**
|
|
259
|
+
* Reverses the characters in text.
|
|
260
|
+
* Example: text='hello' → 'olleh'
|
|
261
|
+
* @param inputs a text
|
|
262
|
+
* @returns reversed text
|
|
263
|
+
* @group transform
|
|
264
|
+
* @shortname reverse
|
|
265
|
+
* @drawable false
|
|
266
|
+
*/
|
|
267
|
+
reverse(inputs: Inputs.Text.TextDto): string;
|
|
268
|
+
/**
|
|
269
|
+
* Returns the length of text.
|
|
270
|
+
* Example: text='hello' → 5
|
|
271
|
+
* @param inputs a text
|
|
272
|
+
* @returns length
|
|
273
|
+
* @group query
|
|
274
|
+
* @shortname length
|
|
275
|
+
* @drawable false
|
|
276
|
+
*/
|
|
277
|
+
length(inputs: Inputs.Text.TextDto): number;
|
|
278
|
+
/**
|
|
279
|
+
* Checks if text is empty or only whitespace.
|
|
280
|
+
* Example: text=' ' → true
|
|
281
|
+
* @param inputs a text
|
|
282
|
+
* @returns boolean
|
|
283
|
+
* @group query
|
|
284
|
+
* @shortname is empty
|
|
285
|
+
* @drawable false
|
|
286
|
+
*/
|
|
287
|
+
isEmpty(inputs: Inputs.Text.TextDto): boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Concatenates multiple text strings.
|
|
290
|
+
* Example: texts=['hello', ' ', 'world'] → 'hello world'
|
|
291
|
+
* @param inputs array of texts
|
|
292
|
+
* @returns concatenated text
|
|
293
|
+
* @group transform
|
|
294
|
+
* @shortname concat
|
|
295
|
+
* @drawable false
|
|
296
|
+
*/
|
|
297
|
+
concat(inputs: Inputs.Text.TextConcatDto): string;
|
|
298
|
+
/**
|
|
299
|
+
* Tests if text matches a regular expression pattern.
|
|
300
|
+
* Example: text='hello123', pattern='[0-9]+' → true
|
|
301
|
+
* @param inputs a text and regex pattern
|
|
302
|
+
* @returns boolean
|
|
303
|
+
* @group regex
|
|
304
|
+
* @shortname test regex
|
|
305
|
+
* @drawable false
|
|
306
|
+
*/
|
|
307
|
+
regexTest(inputs: Inputs.Text.TextRegexDto): boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Matches text against a regular expression and returns matches.
|
|
310
|
+
* Example: text='hello123world456', pattern='[0-9]+', flags='g' → ['123', '456']
|
|
311
|
+
* @param inputs a text and regex pattern
|
|
312
|
+
* @returns array of matches or null
|
|
313
|
+
* @group regex
|
|
314
|
+
* @shortname regex match
|
|
315
|
+
* @drawable false
|
|
316
|
+
*/
|
|
317
|
+
regexMatch(inputs: Inputs.Text.TextRegexDto): string[] | null;
|
|
318
|
+
/**
|
|
319
|
+
* Replaces text matching a regular expression pattern.
|
|
320
|
+
* Example: text='hello123world456', pattern='[0-9]+', flags='g', replaceWith='X' → 'helloXworldX'
|
|
321
|
+
* @param inputs a text, regex pattern, and replacement
|
|
322
|
+
* @returns text with replacements
|
|
323
|
+
* @group regex
|
|
324
|
+
* @shortname regex replace
|
|
325
|
+
* @drawable false
|
|
326
|
+
*/
|
|
327
|
+
regexReplace(inputs: Inputs.Text.TextRegexReplaceDto): string;
|
|
328
|
+
/**
|
|
329
|
+
* Searches text for a regular expression pattern and returns the index.
|
|
330
|
+
* Example: text='hello123', pattern='[0-9]+' → 5
|
|
331
|
+
* @param inputs a text and regex pattern
|
|
332
|
+
* @returns index or -1 if not found
|
|
333
|
+
* @group regex
|
|
334
|
+
* @shortname regex search
|
|
335
|
+
* @drawable false
|
|
336
|
+
*/
|
|
337
|
+
regexSearch(inputs: Inputs.Text.TextRegexDto): number;
|
|
338
|
+
/**
|
|
339
|
+
* Splits text using a regular expression pattern.
|
|
340
|
+
* Example: text='a1b2c3', pattern='[0-9]+' → ['a', 'b', 'c']
|
|
341
|
+
* @param inputs a text and regex pattern
|
|
342
|
+
* @returns array of split strings
|
|
343
|
+
* @group regex
|
|
344
|
+
* @shortname regex split
|
|
345
|
+
* @drawable false
|
|
346
|
+
*/
|
|
347
|
+
regexSplit(inputs: Inputs.Text.TextRegexDto): string[];
|
|
348
|
+
/**
|
|
349
|
+
* Converts a character to vector paths (polylines) with width and height data for rendering.
|
|
350
|
+
* Uses simplex stroke font to generate 2D line segments representing the character shape.
|
|
351
|
+
* Example: char='A', height=10 → {width:8, height:10, paths:[[points forming A shape]]}
|
|
75
352
|
* @param inputs a text
|
|
76
353
|
* @returns width, height and segments as json
|
|
77
354
|
* @group vector
|
|
@@ -80,7 +357,9 @@ export declare class TextBitByBit {
|
|
|
80
357
|
*/
|
|
81
358
|
vectorChar(inputs: Inputs.Text.VectorCharDto): Models.Text.VectorCharData;
|
|
82
359
|
/**
|
|
83
|
-
*
|
|
360
|
+
* Converts multi-line text to vector paths (polylines) with alignment and spacing controls.
|
|
361
|
+
* Supports line breaks, letter spacing, line spacing, horizontal alignment, and origin centering.
|
|
362
|
+
* Example: text='Hello\nWorld', height=10, align=center → [{line1 chars}, {line2 chars}]
|
|
84
363
|
* @param inputs a text as string
|
|
85
364
|
* @returns segments
|
|
86
365
|
* @group vector
|