@bitbybit-dev/base 1.3.2 → 1.4.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 (77) hide show
  1. package/README.md +1 -1
  2. package/lib/api/GlobalCDNProvider.js +1 -1
  3. package/lib/api/index.d.ts +2 -0
  4. package/lib/api/index.js +2 -0
  5. package/lib/api/inputs/base-inputs.d.ts +10 -4
  6. package/lib/api/inputs/color-inputs.d.ts +24 -23
  7. package/lib/api/inputs/color-inputs.js +1 -0
  8. package/lib/api/inputs/dates-inputs.d.ts +16 -16
  9. package/lib/api/inputs/frame-inputs.d.ts +515 -0
  10. package/lib/api/inputs/frame-inputs.js +617 -0
  11. package/lib/api/inputs/index.d.ts +1 -0
  12. package/lib/api/inputs/index.js +1 -0
  13. package/lib/api/inputs/io-inputs.d.ts +3 -3
  14. package/lib/api/inputs/io-inputs.js +1 -1
  15. package/lib/api/inputs/lists-inputs.d.ts +23 -23
  16. package/lib/api/inputs/logic-inputs.d.ts +11 -11
  17. package/lib/api/inputs/math-inputs.d.ts +49 -49
  18. package/lib/api/inputs/math-inputs.js +4 -4
  19. package/lib/api/inputs/mesh-inputs.d.ts +3 -3
  20. package/lib/api/inputs/mesh-inputs.js +3 -3
  21. package/lib/api/inputs/point-inputs.d.ts +39 -38
  22. package/lib/api/inputs/point-inputs.js +6 -5
  23. package/lib/api/inputs/polyline-inputs.d.ts +5 -4
  24. package/lib/api/inputs/polyline-inputs.js +3 -3
  25. package/lib/api/inputs/text-inputs.d.ts +34 -33
  26. package/lib/api/inputs/text-inputs.js +15 -12
  27. package/lib/api/inputs/transforms-inputs.d.ts +16 -16
  28. package/lib/api/inputs/vector-inputs.d.ts +26 -25
  29. package/lib/api/inputs/vector-inputs.js +2 -1
  30. package/lib/api/kernel-calls/call-by-path.d.ts +12 -0
  31. package/lib/api/kernel-calls/call-by-path.js +36 -0
  32. package/lib/api/kernel-calls/constraints.d.ts +53 -0
  33. package/lib/api/kernel-calls/constraints.js +21 -0
  34. package/lib/api/kernel-calls/describe-failure.d.ts +32 -0
  35. package/lib/api/kernel-calls/describe-failure.js +164 -0
  36. package/lib/api/kernel-calls/errors.d.ts +55 -0
  37. package/lib/api/kernel-calls/errors.js +42 -0
  38. package/lib/api/kernel-calls/failure-message.d.ts +18 -0
  39. package/lib/api/kernel-calls/failure-message.js +36 -0
  40. package/lib/api/kernel-calls/index.d.ts +10 -0
  41. package/lib/api/kernel-calls/index.js +10 -0
  42. package/lib/api/kernel-calls/input-rules.d.ts +67 -0
  43. package/lib/api/kernel-calls/input-rules.js +135 -0
  44. package/lib/api/kernel-calls/input-validation.d.ts +130 -0
  45. package/lib/api/kernel-calls/input-validation.js +221 -0
  46. package/lib/api/kernel-calls/rehydrate.d.ts +16 -0
  47. package/lib/api/kernel-calls/rehydrate.js +38 -0
  48. package/lib/api/kernel-calls/resolve-dto.d.ts +59 -0
  49. package/lib/api/kernel-calls/resolve-dto.js +61 -0
  50. package/lib/api/kernel-calls/with-defaults.d.ts +16 -0
  51. package/lib/api/kernel-calls/with-defaults.js +53 -0
  52. package/lib/api/resolved-inputs/index.d.ts +304 -0
  53. package/lib/api/resolved-inputs/index.js +1 -0
  54. package/lib/api/services/color.js +43 -26
  55. package/lib/api/services/dates.js +53 -33
  56. package/lib/api/services/frame.d.ts +670 -0
  57. package/lib/api/services/frame.js +1040 -0
  58. package/lib/api/services/helpers/dxf/dxf-generator.d.ts +2 -3
  59. package/lib/api/services/helpers/dxf/dxf-generator.js +27 -37
  60. package/lib/api/services/helpers/dxf/dxf.js +10 -4
  61. package/lib/api/services/helpers/frame-axes.d.ts +36 -0
  62. package/lib/api/services/helpers/frame-axes.js +57 -0
  63. package/lib/api/services/helpers/matrices.d.ts +17 -0
  64. package/lib/api/services/helpers/matrices.js +51 -0
  65. package/lib/api/services/index.d.ts +1 -0
  66. package/lib/api/services/index.js +1 -0
  67. package/lib/api/services/line.js +15 -12
  68. package/lib/api/services/lists.js +174 -136
  69. package/lib/api/services/logic.js +44 -34
  70. package/lib/api/services/math.js +127 -82
  71. package/lib/api/services/mesh.js +20 -13
  72. package/lib/api/services/point.js +62 -46
  73. package/lib/api/services/polyline.js +22 -18
  74. package/lib/api/services/text.js +81 -46
  75. package/lib/api/services/transforms.js +38 -25
  76. package/lib/api/services/vector.js +37 -22
  77. package/package.json +1 -1
@@ -0,0 +1,515 @@
1
+ import { Base } from "./base-inputs";
2
+ /**
3
+ * Parameters for frames: the origin, normal and direction a frame is built from, the frames, points
4
+ * and vectors converted between a frame and the world, and the counts and spacings of frame
5
+ * patterns. A frame is a point with three axes at right angles, and it places things.
6
+ */
7
+ export declare namespace Frame {
8
+ /**
9
+ * One of a frame's own axes: `x` runs along its `direction`, `z` along its `normal` and `y`
10
+ * across both. Used by `frame.rotate`.
11
+ */
12
+ enum frameAxisEnum {
13
+ x = "x",
14
+ y = "y",
15
+ z = "z"
16
+ }
17
+ /**
18
+ * Where `frame.create` puts a frame, where its Z axis points and roughly where its X axis
19
+ * points; the X axis is turned square to the normal.
20
+ */
21
+ class CreateFrameDto {
22
+ constructor(origin?: Base.Point3, normal?: Base.Vector3, direction?: Base.Vector3);
23
+ /**
24
+ * Where the frame sits.
25
+ * @default [0, 0, 0]
26
+ */
27
+ origin?: Base.Point3 | undefined;
28
+ /**
29
+ * Where the Z axis points; any length but zero.
30
+ * @default [0, 0, 1]
31
+ */
32
+ normal?: Base.Vector3 | undefined;
33
+ /**
34
+ * Roughly where the X axis points. It is turned square to `normal`, so it only must not run
35
+ * along it.
36
+ * @default [1, 0, 0]
37
+ */
38
+ direction?: Base.Vector3 | undefined;
39
+ }
40
+ /**
41
+ * Where `frame.xy`, `frame.yz` and `frame.zx` put the frame they build; each of them fixes
42
+ * the axes itself.
43
+ */
44
+ class OriginDto {
45
+ constructor(origin?: Base.Point3);
46
+ /**
47
+ * Where the frame sits.
48
+ * @default [0, 0, 0]
49
+ */
50
+ origin?: Base.Point3 | undefined;
51
+ }
52
+ /**
53
+ * The three points `frame.fromThreePoints` builds a frame from: its origin, a point its X axis
54
+ * runs toward and a point on the side its Y axis points to.
55
+ */
56
+ class ThreePointsDto {
57
+ constructor(origin?: Base.Point3, xPoint?: Base.Point3, planePoint?: Base.Point3);
58
+ /**
59
+ * Where the frame sits.
60
+ * @default [0, 0, 0]
61
+ */
62
+ origin?: Base.Point3 | undefined;
63
+ /**
64
+ * A point the X axis runs toward from `origin`.
65
+ * @default [1, 0, 0]
66
+ */
67
+ xPoint?: Base.Point3 | undefined;
68
+ /**
69
+ * A third point in the plane, on the side the Y axis points to; it must not lie on the line
70
+ * through the other two.
71
+ * @default [0, 1, 0]
72
+ */
73
+ planePoint?: Base.Point3 | undefined;
74
+ }
75
+ /**
76
+ * A point and a normal for `frame.fromPointAndNormal`, which picks the X axis by a fixed rule,
77
+ * so the same normal always gives the same frame.
78
+ */
79
+ class PointAndNormalDto {
80
+ constructor(origin?: Base.Point3, normal?: Base.Vector3);
81
+ /**
82
+ * Where the frame sits.
83
+ * @default [0, 0, 0]
84
+ */
85
+ origin?: Base.Point3 | undefined;
86
+ /**
87
+ * Where the Z axis points; any length but zero.
88
+ * @default [0, 0, 1]
89
+ */
90
+ normal?: Base.Vector3 | undefined;
91
+ }
92
+ /**
93
+ * The points `frame.bestFit` fits a plane through: at least three, not all on one line.
94
+ */
95
+ class BestFitDto {
96
+ constructor(points?: Base.Point3[]);
97
+ /**
98
+ * The points to fit. Their order decides which way the normal points; where it turns
99
+ * neither way, as in a bow-tie, the normal's largest component is positive.
100
+ * @default undefined
101
+ */
102
+ points: Base.Point3[];
103
+ }
104
+ /**
105
+ * One frame, for the methods that read a frame or turn it over: `frame.origin`, `frame.normal`,
106
+ * `frame.direction`, `frame.yDirection`, `frame.flip` and `frame.toMatrix`.
107
+ */
108
+ class FrameDto {
109
+ constructor(frame?: Base.Frame);
110
+ /**
111
+ * The frame to read or change.
112
+ * @default undefined
113
+ */
114
+ frame: Base.Frame;
115
+ }
116
+ /**
117
+ * A list of frames for `frame.flipFrames`, which turns every one of them over.
118
+ */
119
+ class FramesDto {
120
+ constructor(frames?: Base.Frame[]);
121
+ /**
122
+ * The frames to change, each on its own.
123
+ * @default undefined
124
+ */
125
+ frames: Base.Frame[];
126
+ }
127
+ /**
128
+ * The vector `frame.translate` and `frame.translateFrames` move frames by; their axes keep
129
+ * their directions.
130
+ */
131
+ abstract class TranslateSharedDto {
132
+ /**
133
+ * How far to move each origin, in world coordinates and model units.
134
+ * @default [0, 0, 0]
135
+ */
136
+ translation?: Base.Vector3 | undefined;
137
+ }
138
+ /**
139
+ * A frame and the vector `frame.translate` moves it by; its axes keep their directions.
140
+ */
141
+ class TranslateDto extends TranslateSharedDto {
142
+ constructor(frame?: Base.Frame, translation?: Base.Vector3);
143
+ /**
144
+ * The frame to move.
145
+ * @default undefined
146
+ */
147
+ frame: Base.Frame;
148
+ }
149
+ /**
150
+ * Frames and the one vector `frame.translateFrames` moves them all by; their axes keep their
151
+ * directions.
152
+ */
153
+ class TranslateFramesDto extends TranslateSharedDto {
154
+ constructor(frames?: Base.Frame[], translation?: Base.Vector3);
155
+ /**
156
+ * The frames to move.
157
+ * @default undefined
158
+ */
159
+ frames: Base.Frame[];
160
+ }
161
+ /**
162
+ * The distance `frame.offset` and `frame.offsetFrames` move frames along their own normals;
163
+ * their axes keep their directions.
164
+ */
165
+ abstract class OffsetSharedDto {
166
+ /**
167
+ * How far to move each frame along its normal, in model units; a negative distance moves
168
+ * against it.
169
+ * @default 1
170
+ * @minimum -Infinity
171
+ * @maximum Infinity
172
+ * @step 0.1
173
+ */
174
+ distance?: number | undefined;
175
+ }
176
+ /**
177
+ * A frame and the distance `frame.offset` moves it along its own normal; its axes keep their
178
+ * directions.
179
+ */
180
+ class OffsetDto extends OffsetSharedDto {
181
+ constructor(frame?: Base.Frame, distance?: number);
182
+ /**
183
+ * The frame to move.
184
+ * @default undefined
185
+ */
186
+ frame: Base.Frame;
187
+ }
188
+ /**
189
+ * Frames and the distance `frame.offsetFrames` moves each along its own normal; their axes keep
190
+ * their directions.
191
+ */
192
+ class OffsetFramesDto extends OffsetSharedDto {
193
+ constructor(frames?: Base.Frame[], distance?: number);
194
+ /**
195
+ * The frames to move.
196
+ * @default undefined
197
+ */
198
+ frames: Base.Frame[];
199
+ }
200
+ /**
201
+ * One of a frame's own axes and the angle `frame.rotate` and `frame.rotateFrames` turn frames
202
+ * by about it, through each frame's origin.
203
+ */
204
+ abstract class RotateSharedDto {
205
+ /**
206
+ * Which of each frame's own axes to turn about.
207
+ * @default z
208
+ */
209
+ axis?: frameAxisEnum | undefined;
210
+ /**
211
+ * How far to turn, in degrees; positive is counter-clockwise when the axis points toward
212
+ * you.
213
+ * @default 90
214
+ * @minimum -Infinity
215
+ * @maximum Infinity
216
+ * @step 1
217
+ */
218
+ angle?: number | undefined;
219
+ }
220
+ /**
221
+ * A frame, one of its own axes and the angle `frame.rotate` turns it by about that axis,
222
+ * through its origin.
223
+ */
224
+ class RotateDto extends RotateSharedDto {
225
+ constructor(frame?: Base.Frame, axis?: frameAxisEnum, angle?: number);
226
+ /**
227
+ * The frame to turn.
228
+ * @default undefined
229
+ */
230
+ frame: Base.Frame;
231
+ }
232
+ /**
233
+ * Frames, one of their own axes and the angle `frame.rotateFrames` turns each by about that
234
+ * axis, through its own origin.
235
+ */
236
+ class RotateFramesDto extends RotateSharedDto {
237
+ constructor(frames?: Base.Frame[], axis?: frameAxisEnum, angle?: number);
238
+ /**
239
+ * The frames to turn.
240
+ * @default undefined
241
+ */
242
+ frames: Base.Frame[];
243
+ }
244
+ /**
245
+ * The parent frame whose coordinates `frame.frameToWorld`, `frame.frameToLocal`,
246
+ * `frame.framesToWorld` and `frame.framesToLocal` read frames in.
247
+ */
248
+ abstract class ChildFrameSharedDto {
249
+ /**
250
+ * The frame whose coordinates the frames are given in or converted to.
251
+ * @default undefined
252
+ */
253
+ parent: Base.Frame;
254
+ }
255
+ /**
256
+ * Two frames for `frame.frameToWorld` and `frame.frameToLocal`: the `child` to convert, and the
257
+ * `parent` whose coordinates are used.
258
+ */
259
+ class ChildFrameDto extends ChildFrameSharedDto {
260
+ constructor(child?: Base.Frame, parent?: Base.Frame);
261
+ /**
262
+ * The frame to convert: given in the coordinates of `parent` for `frameToWorld`, in world
263
+ * coordinates for `frameToLocal`.
264
+ * @default undefined
265
+ */
266
+ child: Base.Frame;
267
+ }
268
+ /**
269
+ * Frames and one parent frame for `frame.framesToWorld` and `frame.framesToLocal`, which convert
270
+ * every frame between the parent's coordinates and world coordinates.
271
+ */
272
+ class ChildFramesDto extends ChildFrameSharedDto {
273
+ constructor(children?: Base.Frame[], parent?: Base.Frame);
274
+ /**
275
+ * The frames to convert: given in the coordinates of `parent` for `framesToWorld`, in world
276
+ * coordinates for `framesToLocal`.
277
+ * @default undefined
278
+ */
279
+ children: Base.Frame[];
280
+ }
281
+ /**
282
+ * A frame and one point for `frame.pointToWorld` and `frame.pointToLocal`, which convert the
283
+ * point between the frame's coordinates and world coordinates.
284
+ */
285
+ class FramePointDto {
286
+ constructor(frame?: Base.Frame, point?: Base.Point3);
287
+ /**
288
+ * The frame whose coordinates the point is converted to or from.
289
+ * @default undefined
290
+ */
291
+ frame: Base.Frame;
292
+ /**
293
+ * The point to convert: in the frame's coordinates for `pointToWorld`, in world coordinates
294
+ * for `pointToLocal`.
295
+ * @default undefined
296
+ */
297
+ point: Base.Point3;
298
+ }
299
+ /**
300
+ * A frame and a list of points for `frame.pointsToWorld` and `frame.pointsToLocal`, which
301
+ * convert every point between the frame's coordinates and world coordinates.
302
+ */
303
+ class FramePointsDto {
304
+ constructor(frame?: Base.Frame, points?: Base.Point3[]);
305
+ /**
306
+ * The frame whose coordinates the points are converted to or from.
307
+ * @default undefined
308
+ */
309
+ frame: Base.Frame;
310
+ /**
311
+ * The points to convert: in the frame's coordinates for `pointsToWorld`, in world
312
+ * coordinates for `pointsToLocal`.
313
+ * @default undefined
314
+ */
315
+ points: Base.Point3[];
316
+ }
317
+ /**
318
+ * A frame and a vector for `frame.vectorToWorld` and `frame.vectorToLocal`, which turn the
319
+ * vector between the frame's axes and the world axes without moving it.
320
+ */
321
+ class FrameVectorDto {
322
+ constructor(frame?: Base.Frame, vector?: Base.Vector3);
323
+ /**
324
+ * The frame whose axes the vector is converted to or from.
325
+ * @default undefined
326
+ */
327
+ frame: Base.Frame;
328
+ /**
329
+ * The vector to convert: along the frame's axes for `vectorToWorld`, along the world axes
330
+ * for `vectorToLocal`.
331
+ * @default undefined
332
+ */
333
+ vector: Base.Vector3;
334
+ }
335
+ /**
336
+ * The transformation `frame.fromMatrix` reads a frame from: where it moves the world origin and
337
+ * where it turns the world X and Z axes.
338
+ */
339
+ class TransformationDto {
340
+ constructor(transformation?: Base.TransformMatrixes);
341
+ /**
342
+ * A transformation matrix, or a list of them applied in order; scaling is dropped and a
343
+ * perspective part is refused.
344
+ * @default undefined
345
+ */
346
+ transformation: Base.TransformMatrixes;
347
+ }
348
+ /**
349
+ * Two frames for `frame.matrixFromTo`, whose transformation carries anything placed on `from`
350
+ * onto `to`, turning it the same way.
351
+ */
352
+ class FromToDto {
353
+ constructor(to?: Base.Frame, from?: Base.Frame);
354
+ /**
355
+ * The frame to move onto.
356
+ * @default undefined
357
+ */
358
+ to: Base.Frame;
359
+ /**
360
+ * The frame to move from; left out, the world frame.
361
+ * @default undefined
362
+ * @optional true
363
+ */
364
+ from?: Base.Frame | undefined;
365
+ }
366
+ /**
367
+ * The counts and spacings of the grid of frames `frame.grid` lays out in the plane of `frame`,
368
+ * each turned the same way as `frame`.
369
+ */
370
+ class GridDto {
371
+ constructor(frame?: Base.Frame, countX?: number, countY?: number, spacingX?: number, spacingY?: number, centered?: boolean);
372
+ /**
373
+ * The frame whose plane and axes the grid follows; left out, the world frame.
374
+ * @default undefined
375
+ * @optional true
376
+ */
377
+ frame?: Base.Frame | undefined;
378
+ /**
379
+ * How many frames along the X axis.
380
+ * @default 3
381
+ * @minimum 1
382
+ * @maximum Infinity
383
+ * @step 1
384
+ */
385
+ countX?: number | undefined;
386
+ /**
387
+ * How many frames along the Y axis.
388
+ * @default 3
389
+ * @minimum 1
390
+ * @maximum Infinity
391
+ * @step 1
392
+ */
393
+ countY?: number | undefined;
394
+ /**
395
+ * The distance between neighbours along the X axis, in model units.
396
+ * @default 2
397
+ * @minimum -Infinity
398
+ * @maximum Infinity
399
+ * @step 0.1
400
+ */
401
+ spacingX?: number | undefined;
402
+ /**
403
+ * The distance between neighbours along the Y axis, in model units.
404
+ * @default 2
405
+ * @minimum -Infinity
406
+ * @maximum Infinity
407
+ * @step 0.1
408
+ */
409
+ spacingY?: number | undefined;
410
+ /**
411
+ * When true the grid is centered on the frame's origin; otherwise it starts there and runs
412
+ * along the X and Y axes.
413
+ * @default false
414
+ */
415
+ centered?: boolean | undefined;
416
+ }
417
+ /**
418
+ * The count, radius and sweep of the ring of frames `frame.polar` lays out around the normal of
419
+ * `frame`, in its plane.
420
+ */
421
+ class PolarDto {
422
+ constructor(frame?: Base.Frame, count?: number, radius?: number, angle?: number, startAngle?: number, rotate?: boolean);
423
+ /**
424
+ * The frame the ring turns around, about its normal; left out, the world frame.
425
+ * @default undefined
426
+ * @optional true
427
+ */
428
+ frame?: Base.Frame | undefined;
429
+ /**
430
+ * How many frames in the ring.
431
+ * @default 6
432
+ * @minimum 1
433
+ * @maximum Infinity
434
+ * @step 1
435
+ */
436
+ count?: number | undefined;
437
+ /**
438
+ * The distance from the center to each frame, in model units; at 0 the frames only turn
439
+ * in place.
440
+ * @default 3
441
+ * @minimum 0
442
+ * @maximum Infinity
443
+ * @step 0.1
444
+ */
445
+ radius?: number | undefined;
446
+ /**
447
+ * The angle the ring covers, in degrees, from -360 to 360. A full turn spaces the frames
448
+ * evenly without repeating the first; a smaller angle puts one at each end.
449
+ * @default 360
450
+ * @minimum -360
451
+ * @maximum 360
452
+ * @step 1
453
+ */
454
+ angle?: number | undefined;
455
+ /**
456
+ * The angle of the first frame, in degrees from the X axis toward the Y axis.
457
+ * @default 0
458
+ * @minimum -Infinity
459
+ * @maximum Infinity
460
+ * @step 1
461
+ */
462
+ startAngle?: number | undefined;
463
+ /**
464
+ * When true the frames rotate with the ring, as copies around a hub do; otherwise every frame
465
+ * keeps the axes of `frame`.
466
+ * @default true
467
+ */
468
+ rotate?: boolean | undefined;
469
+ }
470
+ /**
471
+ * The counts and hexagon size of the honeycomb `frame.hexGrid` lays out in the plane of
472
+ * `frame`: one frame at the center of each hexagon, turned the same way as `frame`.
473
+ */
474
+ class HexGridDto {
475
+ constructor(frame?: Base.Frame, countX?: number, countY?: number, radius?: number, centered?: boolean);
476
+ /**
477
+ * The frame whose plane and axes the honeycomb follows; left out, the world frame.
478
+ * @default undefined
479
+ * @optional true
480
+ */
481
+ frame?: Base.Frame | undefined;
482
+ /**
483
+ * How many hexagons in each row, along the X axis.
484
+ * @default 3
485
+ * @minimum 1
486
+ * @maximum Infinity
487
+ * @step 1
488
+ */
489
+ countX?: number | undefined;
490
+ /**
491
+ * How many rows, along the Y axis; every second row is shifted by half a hexagon.
492
+ * @default 3
493
+ * @minimum 1
494
+ * @maximum Infinity
495
+ * @step 1
496
+ */
497
+ countY?: number | undefined;
498
+ /**
499
+ * The distance from a hexagon's center to one of its corners, in model units; two corners
500
+ * lie on the frame's Y axis.
501
+ * @default 1
502
+ * @minimum 0
503
+ * @exclusiveMinimum true
504
+ * @maximum Infinity
505
+ * @step 0.1
506
+ */
507
+ radius?: number | undefined;
508
+ /**
509
+ * When true the honeycomb is centered on the frame's origin; otherwise its first hexagon
510
+ * sits there.
511
+ * @default false
512
+ */
513
+ centered?: boolean | undefined;
514
+ }
515
+ }