@bitbybit-dev/base 1.2.0 → 1.3.0

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.
Files changed (55) hide show
  1. package/lib/api/GlobalCDNProvider.js +1 -1
  2. package/lib/api/inputs/base-inputs.d.ts +13 -12
  3. package/lib/api/inputs/color-inputs.d.ts +97 -48
  4. package/lib/api/inputs/color-inputs.js +95 -46
  5. package/lib/api/inputs/dates-inputs.d.ts +67 -26
  6. package/lib/api/inputs/dates-inputs.js +57 -16
  7. package/lib/api/inputs/io-inputs.d.ts +13 -15
  8. package/lib/api/inputs/io-inputs.js +7 -8
  9. package/lib/api/inputs/line-inputs.d.ts +88 -33
  10. package/lib/api/inputs/line-inputs.js +61 -11
  11. package/lib/api/inputs/lists-inputs.d.ts +207 -96
  12. package/lib/api/inputs/lists-inputs.js +153 -45
  13. package/lib/api/inputs/logic-inputs.d.ts +52 -22
  14. package/lib/api/inputs/logic-inputs.js +41 -12
  15. package/lib/api/inputs/math-inputs.d.ts +113 -52
  16. package/lib/api/inputs/math-inputs.js +112 -51
  17. package/lib/api/inputs/mesh-inputs.d.ts +30 -11
  18. package/lib/api/inputs/mesh-inputs.js +21 -3
  19. package/lib/api/inputs/point-inputs.d.ts +240 -107
  20. package/lib/api/inputs/point-inputs.js +199 -73
  21. package/lib/api/inputs/polyline-inputs.d.ts +68 -28
  22. package/lib/api/inputs/polyline-inputs.js +48 -13
  23. package/lib/api/inputs/text-inputs.d.ts +117 -46
  24. package/lib/api/inputs/text-inputs.js +111 -41
  25. package/lib/api/inputs/transforms-inputs.d.ts +65 -23
  26. package/lib/api/inputs/transforms-inputs.js +64 -22
  27. package/lib/api/inputs/vector-inputs.d.ts +154 -76
  28. package/lib/api/inputs/vector-inputs.js +132 -57
  29. package/lib/api/models/point/hex-grid-data.d.ts +1 -1
  30. package/lib/api/models/point/hex-grid-data.js +1 -1
  31. package/lib/api/services/color.d.ts +149 -70
  32. package/lib/api/services/color.js +149 -70
  33. package/lib/api/services/dates.d.ts +313 -150
  34. package/lib/api/services/dates.js +313 -150
  35. package/lib/api/services/line.d.ts +138 -68
  36. package/lib/api/services/line.js +138 -68
  37. package/lib/api/services/lists.d.ts +357 -177
  38. package/lib/api/services/lists.js +357 -177
  39. package/lib/api/services/logic.d.ts +98 -45
  40. package/lib/api/services/logic.js +98 -45
  41. package/lib/api/services/math.d.ts +363 -211
  42. package/lib/api/services/math.js +363 -211
  43. package/lib/api/services/mesh.d.ts +73 -31
  44. package/lib/api/services/mesh.js +73 -31
  45. package/lib/api/services/point.d.ts +367 -147
  46. package/lib/api/services/point.js +367 -147
  47. package/lib/api/services/polyline.d.ts +146 -71
  48. package/lib/api/services/polyline.js +146 -71
  49. package/lib/api/services/text.d.ts +320 -165
  50. package/lib/api/services/text.js +320 -165
  51. package/lib/api/services/transforms.d.ts +145 -58
  52. package/lib/api/services/transforms.js +145 -58
  53. package/lib/api/services/vector.d.ts +381 -156
  54. package/lib/api/services/vector.js +381 -156
  55. package/package.json +1 -1
@@ -2,369 +2,524 @@ import * as Inputs from "../inputs";
2
2
  import * as Models from "../models";
3
3
  import { Point } from "./point";
4
4
  /**
5
- * Contains various text methods.
5
+ * Working with text: splitting, joining, searching, trimming, padding, changing case, regular
6
+ * expressions and formatting with placeholders. `vectorChar` and `vectorText` turn text into line
7
+ * paths drawn with a simple stroke font, so words can become geometry. Positions in text count from
8
+ * 0.
6
9
  */
7
10
  export declare class TextBitByBit {
8
11
  private readonly point;
9
12
  constructor(point: Point);
10
13
  /**
11
- * Creates and returns a text string (pass-through for text input).
12
- * Example: text='Hello World' → 'Hello World'
13
- * @param inputs a text
14
- * @returns text
14
+ * Passes a text through unchanged, so a value can be given a name and reused.
15
+ *
16
+ * Example: 'Hello World' -> 'Hello World'
17
+ * @param inputs - The text
18
+ * @returns The same text
15
19
  * @group create
16
20
  * @shortname text
17
21
  * @drawable false
18
22
  */
19
23
  create(inputs: Inputs.Text.TextDto): string;
20
24
  /**
21
- * Splits text into multiple pieces using a separator string.
22
- * Example: text='apple,banana,cherry', separator=',' → ['apple', 'banana', 'cherry']
23
- * @param inputs a text
24
- * @returns text
25
- * @group transform
26
- * @shortname split
27
- * @drawable false
28
- */
25
+ * Cuts a text into pieces wherever a separator occurs; the separator itself is dropped.
26
+ *
27
+ * Example: 'apple,banana,cherry' split by ',' -> ['apple', 'banana', 'cherry']
28
+ * @param inputs - The text and the separator
29
+ * @returns The pieces, in order
30
+ * @group transform
31
+ * @shortname split
32
+ * @drawable false
33
+ * @example
34
+ * ```typescript
35
+ * const parts = bitbybit.text.split({ text: "apple,banana,cherry", separator: "," });
36
+ * ```
37
+ */
29
38
  split(inputs: Inputs.Text.TextSplitDto): string[];
30
39
  /**
31
- * Replaces all occurrences of a search string with a replacement string.
32
- * Example: text='hello hello', search='hello', replaceWith='hi' → 'hi hi'
33
- * @param inputs a text
34
- * @returns text
35
- * @group transform
36
- * @shortname replaceAll
37
- * @drawable false
38
- */
40
+ * Replaces every occurrence of a search text with another text.
41
+ *
42
+ * Example: 'hello hello' replacing 'hello' with 'hi' -> 'hi hi'
43
+ * @param inputs - The text, what to search for and what to put in its place
44
+ * @returns The text with the replacements made
45
+ * @group transform
46
+ * @shortname replaceAll
47
+ * @drawable false
48
+ * @example
49
+ * ```typescript
50
+ * const greeting = bitbybit.text.replaceAll({ text: "hello hello", search: "hello", replaceWith: "hi" });
51
+ * ```
52
+ */
39
53
  replaceAll(inputs: Inputs.Text.TextReplaceDto): string;
40
54
  /**
41
- * Joins multiple items into a single text string using a separator.
42
- * Example: list=['apple', 'banana', 'cherry'], separator=', ' → 'apple, banana, cherry'
43
- * @param inputs a list of items
44
- * @returns text
45
- * @group transform
46
- * @shortname join
47
- * @drawable false
48
- */
55
+ * Joins a list of texts into one, with a separator between neighbors.
56
+ *
57
+ * Example: ['apple', 'banana', 'cherry'] joined by ', ' -> 'apple, banana, cherry'
58
+ * @param inputs - The texts and the separator
59
+ * @returns The joined text
60
+ * @group transform
61
+ * @shortname join
62
+ * @drawable false
63
+ * @example
64
+ * ```typescript
65
+ * const line = bitbybit.text.join({ list: ["apple", "banana"], separator: ", " });
66
+ * ```
67
+ */
49
68
  join(inputs: Inputs.Text.TextJoinDto): string;
50
69
  /**
51
- * Transform any item to text
52
- * @param inputs any item
53
- * @returns text
54
- * @group transform
55
- * @shortname to string
56
- * @drawable false
57
- */
70
+ * Turns any value into text, the way JavaScript prints it.
71
+ *
72
+ * Example: 42 -> '42', [1, 2] -> '1,2'
73
+ * @param inputs - The value
74
+ * @returns The value as text
75
+ * @group transform
76
+ * @shortname to string
77
+ * @drawable false
78
+ */
58
79
  toString<T>(inputs: Inputs.Text.ToStringDto<T>): string;
59
80
  /**
60
- * Transform each item in list to text
61
- * @param inputs list of items
62
- * @returns texts
63
- * @group transform
64
- * @shortname to strings
65
- * @drawable false
66
- */
81
+ * Turns every item of a list into text, the way JavaScript prints it.
82
+ *
83
+ * Example: [1, 2.5, true] -> ['1', '2.5', 'true']
84
+ * @param inputs - The list of values
85
+ * @returns One text per item, in order
86
+ * @group transform
87
+ * @shortname to strings
88
+ * @drawable false
89
+ */
67
90
  toStringEach<T>(inputs: Inputs.Text.ToStringEachDto<T>): string[];
68
91
  /**
69
- * Formats text with placeholder values using {0}, {1}, etc. syntax.
70
- * Example: text='Point: ({0}, {1})', values=[10, 5] → 'Point: (10, 5)'
71
- * @param inputs a text and values
72
- * @returns formatted text
92
+ * Fills numbered placeholders in a text with values: `{0}` takes the first value, `{1}` the
93
+ * second, and so on.
94
+ *
95
+ * A placeholder without a value is left as it is.
96
+ * Example: 'Point: ({0}, {1})' with [10, 5] -> 'Point: (10, 5)'
97
+ * @param inputs - The text with placeholders and the values to fill in
98
+ * @returns The filled-in text
73
99
  * @group transform
74
100
  * @shortname format
75
101
  * @drawable false
102
+ * @example
103
+ * ```typescript
104
+ * const label = bitbybit.text.format({ text: "Point: ({0}, {1})", values: ["10", "5"] });
105
+ * ```
76
106
  */
77
107
  format(inputs: Inputs.Text.TextFormatDto): string;
78
108
  /**
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
109
+ * Tells whether a text contains a search text.
110
+ *
111
+ * Example: 'hello world' includes 'world' -> true
112
+ * @param inputs - The text and what to look for
113
+ * @returns True when the search text occurs in it
83
114
  * @group query
84
115
  * @shortname includes
85
116
  * @drawable false
117
+ * @example
118
+ * ```typescript
119
+ * const has = bitbybit.text.includes({ text: "hello world", search: "world" });
120
+ * ```
86
121
  */
87
122
  includes(inputs: Inputs.Text.TextSearchDto): boolean;
88
123
  /**
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
124
+ * Tells whether a text begins with a search text.
125
+ *
126
+ * Example: 'hello world' starts with 'hello' -> true
127
+ * @param inputs - The text and what to look for at its start
128
+ * @returns True when the text begins with it
93
129
  * @group query
94
130
  * @shortname starts with
95
131
  * @drawable false
132
+ * @example
133
+ * ```typescript
134
+ * const starts = bitbybit.text.startsWith({ text: "hello world", search: "hello" });
135
+ * ```
96
136
  */
97
137
  startsWith(inputs: Inputs.Text.TextSearchDto): boolean;
98
138
  /**
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
139
+ * Tells whether a text ends with a search text.
140
+ *
141
+ * Example: 'hello world' ends with 'world' -> true
142
+ * @param inputs - The text and what to look for at its end
143
+ * @returns True when the text ends with it
103
144
  * @group query
104
145
  * @shortname ends with
105
146
  * @drawable false
147
+ * @example
148
+ * ```typescript
149
+ * const ends = bitbybit.text.endsWith({ text: "hello world", search: "world" });
150
+ * ```
106
151
  */
107
152
  endsWith(inputs: Inputs.Text.TextSearchDto): boolean;
108
153
  /**
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
154
+ * Finds where a search text first occurs, counting characters from 0, or -1 when it does not
155
+ * occur.
156
+ *
157
+ * Example: 'hello world' finding 'world' -> 6
158
+ * @param inputs - The text and what to look for
159
+ * @returns The position of the first occurrence, or -1
113
160
  * @group query
114
161
  * @shortname index of
115
162
  * @drawable false
163
+ * @example
164
+ * ```typescript
165
+ * const at = bitbybit.text.indexOf({ text: "hello world", search: "world" });
166
+ * ```
116
167
  */
117
168
  indexOf(inputs: Inputs.Text.TextSearchDto): number;
118
169
  /**
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
170
+ * Finds where a search text last occurs, counting characters from 0, or -1 when it does not
171
+ * occur.
172
+ *
173
+ * Example: 'hello world hello' finding 'hello' -> 12
174
+ * @param inputs - The text and what to look for
175
+ * @returns The position of the last occurrence, or -1
123
176
  * @group query
124
177
  * @shortname last index of
125
178
  * @drawable false
179
+ * @example
180
+ * ```typescript
181
+ * const at = bitbybit.text.lastIndexOf({ text: "hello world hello", search: "hello" });
182
+ * ```
126
183
  */
127
184
  lastIndexOf(inputs: Inputs.Text.TextSearchDto): number;
128
185
  /**
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
186
+ * Takes the characters from a start position up to, but not including, an end position.
187
+ *
188
+ * A start larger than the end swaps the two, and negative positions count as 0.
189
+ * Example: 'hello world' from 0 to 5 -> 'hello'
190
+ * @param inputs - The text and the start and end positions
191
+ * @returns The characters in that range
133
192
  * @group transform
134
193
  * @shortname substring
135
194
  * @drawable false
195
+ * @example
196
+ * ```typescript
197
+ * const word = bitbybit.text.substring({ text: "hello world", start: 0, end: 5 });
198
+ * ```
136
199
  */
137
200
  substring(inputs: Inputs.Text.TextSubstringDto): string;
138
201
  /**
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
202
+ * Takes the characters from a start position up to, but not including, an end position.
203
+ *
204
+ * Unlike `substring`, a negative position counts from the end of the text.
205
+ * Example: 'hello world' from 0 to 5 -> 'hello'; from -5 -> 'world'
206
+ * @param inputs - The text and the start and end positions
207
+ * @returns The characters in that range
143
208
  * @group transform
144
209
  * @shortname slice
145
210
  * @drawable false
211
+ * @example
212
+ * ```typescript
213
+ * const tail = bitbybit.text.slice({ text: "hello world", start: 6, end: 11 });
214
+ * ```
146
215
  */
147
216
  slice(inputs: Inputs.Text.TextSubstringDto): string;
148
217
  /**
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
218
+ * Reads the character at a position, counting from 0.
219
+ *
220
+ * Example: 'hello' at 1 -> 'e'
221
+ * @param inputs - The text and the position
222
+ * @returns The character, or an empty text when the position is outside the text
153
223
  * @group query
154
224
  * @shortname char at
155
225
  * @drawable false
226
+ * @example
227
+ * ```typescript
228
+ * const second = bitbybit.text.charAt({ text: "hello", index: 1 });
229
+ * ```
156
230
  */
157
231
  charAt(inputs: Inputs.Text.TextIndexDto): string;
158
232
  /**
159
- * Removes whitespace from both ends of text.
160
- * Example: text=' hello ' → 'hello'
161
- * @param inputs a text
162
- * @returns trimmed text
233
+ * Removes spaces, tabs and line breaks from both ends of a text.
234
+ *
235
+ * Example: ' hello ' -> 'hello'
236
+ * @param inputs - The text
237
+ * @returns The trimmed text
163
238
  * @group transform
164
239
  * @shortname trim
165
240
  * @drawable false
166
241
  */
167
242
  trim(inputs: Inputs.Text.TextDto): string;
168
243
  /**
169
- * Removes whitespace from the start of text.
170
- * Example: text=' hello ' → 'hello '
171
- * @param inputs a text
172
- * @returns trimmed text
244
+ * Removes spaces, tabs and line breaks from the start of a text.
245
+ *
246
+ * Example: ' hello ' -> 'hello '
247
+ * @param inputs - The text
248
+ * @returns The text without leading whitespace
173
249
  * @group transform
174
250
  * @shortname trim start
175
251
  * @drawable false
176
252
  */
177
253
  trimStart(inputs: Inputs.Text.TextDto): string;
178
254
  /**
179
- * Removes whitespace from the end of text.
180
- * Example: text=' hello ' → ' hello'
181
- * @param inputs a text
182
- * @returns trimmed text
255
+ * Removes spaces, tabs and line breaks from the end of a text.
256
+ *
257
+ * Example: ' hello ' -> ' hello'
258
+ * @param inputs - The text
259
+ * @returns The text without trailing whitespace
183
260
  * @group transform
184
261
  * @shortname trim end
185
262
  * @drawable false
186
263
  */
187
264
  trimEnd(inputs: Inputs.Text.TextDto): string;
188
265
  /**
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
266
+ * Adds a filler text in front until the text reaches a length; a text already that long is left
267
+ * alone.
268
+ *
269
+ * Example: 'x' to length 3 with 'a' -> 'aax'
270
+ * @param inputs - The text, the length to reach and the filler
271
+ * @returns The padded text
193
272
  * @group transform
194
273
  * @shortname pad start
195
274
  * @drawable false
275
+ * @example
276
+ * ```typescript
277
+ * const padded = bitbybit.text.padStart({ text: "7", length: 3, padString: "0" });
278
+ * ```
196
279
  */
197
280
  padStart(inputs: Inputs.Text.TextPadDto): string;
198
281
  /**
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
282
+ * Adds a filler text behind until the text reaches a length; a text already that long is left
283
+ * alone.
284
+ *
285
+ * Example: 'x' to length 3 with 'a' -> 'xaa'
286
+ * @param inputs - The text, the length to reach and the filler
287
+ * @returns The padded text
203
288
  * @group transform
204
289
  * @shortname pad end
205
290
  * @drawable false
291
+ * @example
292
+ * ```typescript
293
+ * const padded = bitbybit.text.padEnd({ text: "x", length: 3, padString: "a" });
294
+ * ```
206
295
  */
207
296
  padEnd(inputs: Inputs.Text.TextPadDto): string;
208
297
  /**
209
- * Converts text to uppercase.
210
- * Example: text='hello' → 'HELLO'
211
- * @param inputs a text
212
- * @returns uppercase text
298
+ * Turns every letter into a capital.
299
+ *
300
+ * Example: 'hello' -> 'HELLO'
301
+ * @param inputs - The text
302
+ * @returns The text in capitals
213
303
  * @group transform
214
304
  * @shortname to upper case
215
305
  * @drawable false
216
306
  */
217
307
  toUpperCase(inputs: Inputs.Text.TextDto): string;
218
308
  /**
219
- * Converts text to lowercase.
220
- * Example: text='HELLO' → 'hello'
221
- * @param inputs a text
222
- * @returns lowercase text
309
+ * Turns every letter into lower case.
310
+ *
311
+ * Example: 'HELLO' -> 'hello'
312
+ * @param inputs - The text
313
+ * @returns The text in lower case
223
314
  * @group transform
224
315
  * @shortname to lower case
225
316
  * @drawable false
226
317
  */
227
318
  toLowerCase(inputs: Inputs.Text.TextDto): string;
228
319
  /**
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
320
+ * Turns the first character into a capital and leaves the rest as it is.
321
+ *
322
+ * Example: 'hello world' -> 'Hello world'
323
+ * @param inputs - The text
324
+ * @returns The text with its first character capitalized
233
325
  * @group transform
234
326
  * @shortname capitalize first
235
327
  * @drawable false
236
328
  */
237
329
  toUpperCaseFirst(inputs: Inputs.Text.TextDto): string;
238
330
  /**
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
331
+ * Turns the first character into lower case and leaves the rest as it is.
332
+ *
333
+ * Example: 'Hello World' -> 'hello World'
334
+ * @param inputs - The text
335
+ * @returns The text with its first character in lower case
243
336
  * @group transform
244
337
  * @shortname uncapitalize first
245
338
  * @drawable false
246
339
  */
247
340
  toLowerCaseFirst(inputs: Inputs.Text.TextDto): string;
248
341
  /**
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
342
+ * Repeats a text a number of times, end to end.
343
+ *
344
+ * Example: 'ha' three times -> 'hahaha'
345
+ * @param inputs - The text and how many times to repeat it
346
+ * @returns The repeated text
253
347
  * @group transform
254
348
  * @shortname repeat
255
349
  * @drawable false
350
+ * @example
351
+ * ```typescript
352
+ * const laugh = bitbybit.text.repeat({ text: "ha", count: 3 });
353
+ * ```
256
354
  */
257
355
  repeat(inputs: Inputs.Text.TextRepeatDto): string;
258
356
  /**
259
- * Reverses the characters in text.
260
- * Example: text='hello' → 'olleh'
261
- * @param inputs a text
262
- * @returns reversed text
357
+ * Reverses the order of the characters.
358
+ *
359
+ * Example: 'hello' -> 'olleh'
360
+ * @param inputs - The text
361
+ * @returns The reversed text
263
362
  * @group transform
264
363
  * @shortname reverse
265
364
  * @drawable false
266
365
  */
267
366
  reverse(inputs: Inputs.Text.TextDto): string;
268
367
  /**
269
- * Returns the length of text.
270
- * Example: text='hello' → 5
271
- * @param inputs a text
272
- * @returns length
368
+ * Counts the characters in a text.
369
+ *
370
+ * Example: 'hello' -> 5
371
+ * @param inputs - The text
372
+ * @returns The number of characters
273
373
  * @group query
274
374
  * @shortname length
275
375
  * @drawable false
276
376
  */
277
377
  length(inputs: Inputs.Text.TextDto): number;
278
378
  /**
279
- * Checks if text is empty or only whitespace.
280
- * Example: text=' ' → true
281
- * @param inputs a text
282
- * @returns boolean
379
+ * Tells whether a text is empty or holds only whitespace.
380
+ *
381
+ * Example: ' ' -> true, 'a' -> false
382
+ * @param inputs - The text
383
+ * @returns True when there is nothing but whitespace
283
384
  * @group query
284
385
  * @shortname is empty
285
386
  * @drawable false
286
387
  */
287
388
  isEmpty(inputs: Inputs.Text.TextDto): boolean;
288
389
  /**
289
- * Concatenates multiple text strings.
290
- * Example: texts=['hello', ' ', 'world'] → 'hello world'
291
- * @param inputs array of texts
292
- * @returns concatenated text
390
+ * Joins several texts into one with nothing between them.
391
+ *
392
+ * Example: ['hello', ' ', 'world'] -> 'hello world'
393
+ * @param inputs - The texts to join
394
+ * @returns The joined text
293
395
  * @group transform
294
396
  * @shortname concat
295
397
  * @drawable false
398
+ * @example
399
+ * ```typescript
400
+ * const sentence = bitbybit.text.concat({ texts: ["hello", " ", "world"] });
401
+ * ```
296
402
  */
297
403
  concat(inputs: Inputs.Text.TextConcatDto): string;
298
404
  /**
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
405
+ * Tells whether a regular expression matches somewhere in a text.
406
+ *
407
+ * Example: 'hello123' against '[0-9]+' -> true
408
+ * @param inputs - The text, the pattern and the flags
409
+ * @returns True when the pattern matches
303
410
  * @group regex
304
411
  * @shortname test regex
305
412
  * @drawable false
413
+ * @example
414
+ * ```typescript
415
+ * const hasDigits = bitbybit.text.regexTest({ text: "hello123", pattern: "[0-9]+", flags: "" });
416
+ * ```
306
417
  */
307
418
  regexTest(inputs: Inputs.Text.TextRegexDto): boolean;
308
419
  /**
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
420
+ * Finds the parts of a text that a regular expression matches.
421
+ *
422
+ * With the `g` flag every match is listed; without it only the first match and its capture
423
+ * groups. No match gives null.
424
+ * Example: 'hello123world456' against '[0-9]+' with 'g' -> ['123', '456']
425
+ * @param inputs - The text, the pattern and the flags
426
+ * @returns The matches, or null when there are none
313
427
  * @group regex
314
428
  * @shortname regex match
315
429
  * @drawable false
430
+ * @example
431
+ * ```typescript
432
+ * const numbers = bitbybit.text.regexMatch({ text: "hello123world456", pattern: "[0-9]+", flags: "g" });
433
+ * ```
316
434
  */
317
435
  regexMatch(inputs: Inputs.Text.TextRegexDto): string[] | null;
318
436
  /**
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
437
+ * Replaces what a regular expression matches with another text.
438
+ *
439
+ * With the `g` flag every match is replaced; without it only the first.
440
+ * Example: 'hello123world456' against '[0-9]+' with 'g', replaced by 'X' -> 'helloXworldX'
441
+ * @param inputs - The text, the pattern, the flags and the replacement
442
+ * @returns The text with the replacements made
323
443
  * @group regex
324
444
  * @shortname regex replace
325
445
  * @drawable false
446
+ * @example
447
+ * ```typescript
448
+ * const clean = bitbybit.text.regexReplace({ text: "hello123world456", pattern: "[0-9]+", flags: "g", replaceWith: "X" });
449
+ * ```
326
450
  */
327
451
  regexReplace(inputs: Inputs.Text.TextRegexReplaceDto): string;
328
452
  /**
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
453
+ * Finds where a regular expression first matches, counting characters from 0, or -1 when it
454
+ * does not match.
455
+ *
456
+ * Example: 'hello123' against '[0-9]+' -> 5
457
+ * @param inputs - The text, the pattern and the flags
458
+ * @returns The position of the first match, or -1
333
459
  * @group regex
334
460
  * @shortname regex search
335
461
  * @drawable false
462
+ * @example
463
+ * ```typescript
464
+ * const at = bitbybit.text.regexSearch({ text: "hello123", pattern: "[0-9]+", flags: "" });
465
+ * ```
336
466
  */
337
467
  regexSearch(inputs: Inputs.Text.TextRegexDto): number;
338
468
  /**
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
469
+ * Cuts a text into pieces wherever a regular expression matches; the matches themselves are
470
+ * dropped.
471
+ *
472
+ * Example: 'a1b2c3' split by '[0-9]+' -> ['a', 'b', 'c', '']
473
+ * @param inputs - The text, the pattern and the flags
474
+ * @returns The pieces, in order
343
475
  * @group regex
344
476
  * @shortname regex split
345
477
  * @drawable false
478
+ * @example
479
+ * ```typescript
480
+ * const letters = bitbybit.text.regexSplit({ text: "a1b2c3", pattern: "[0-9]+", flags: "" });
481
+ * ```
346
482
  */
347
483
  regexSplit(inputs: Inputs.Text.TextRegexDto): string[];
348
484
  /**
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]]}
352
- * @param inputs a text
353
- * @returns width, height and segments as json
485
+ * Draws one character as line paths with a simple stroke font.
486
+ *
487
+ * The paths lie flat on the XZ plane, scaled so the character is `height` tall, and are
488
+ * returned with the character's width and height. An unknown character is drawn as a question
489
+ * mark.
490
+ * Example: 'A' at height 10 -> the strokes of an A, 10 units tall
491
+ * @param inputs - The character, its height and its offsets
492
+ * @returns The character's width, height and stroke paths as lists of points
354
493
  * @group vector
355
494
  * @shortname vector char
356
495
  * @drawable false
496
+ * @example
497
+ * ```typescript
498
+ * const letter = bitbybit.text.vectorChar({ char: "A", height: 10, xOffset: 0, yOffset: 0, extrudeOffset: 0 });
499
+ * ```
357
500
  */
358
501
  vectorChar(inputs: Inputs.Text.VectorCharDto): Models.Text.VectorCharData;
359
502
  /**
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}]
363
- * @param inputs a text as string
364
- * @returns segments
503
+ * Draws a text, with line breaks, as line paths with a simple stroke font.
504
+ *
505
+ * Each line comes back as its characters with their paths, laid out flat on the XZ plane with
506
+ * the given height, spacing and alignment; `centerOnOrigin` puts the middle of the block at the
507
+ * origin.
508
+ * Example: 'Hello' at height 10 -> five characters with their strokes
509
+ * @param inputs - The text and how to lay it out
510
+ * @returns One entry per line, each with its characters and their stroke paths
365
511
  * @group vector
366
512
  * @shortname vector text
367
513
  * @drawable false
514
+ * @example
515
+ * ```typescript
516
+ * const lines = bitbybit.text.vectorText({
517
+ * text: "Hello\nWorld",
518
+ * height: 10,
519
+ * align: Bit.Inputs.Base.horizontalAlignEnum.center,
520
+ * centerOnOrigin: true,
521
+ * });
522
+ * ```
368
523
  */
369
524
  vectorText(inputs: Inputs.Text.VectorTextDto): Models.Text.VectorTextData[];
370
525
  private vectorParamsChar;