@bitbybit-dev/base 1.7.0 → 1.8.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 (91) hide show
  1. package/NOTICE +24 -0
  2. package/README.md +3 -1
  3. package/lib/api/GlobalCDNProvider.js +1 -1
  4. package/lib/api/inputs/base-inputs.d.ts +20 -0
  5. package/lib/api/inputs/base-inputs.js +22 -0
  6. package/lib/api/inputs/io-inputs.d.ts +408 -8
  7. package/lib/api/inputs/io-inputs.js +344 -7
  8. package/lib/api/inputs/mesh-inputs.d.ts +20 -1
  9. package/lib/api/inputs/mesh-inputs.js +23 -0
  10. package/lib/api/inputs/recipes-inputs.d.ts +13 -5
  11. package/lib/api/inputs/recipes-inputs.js +10 -5
  12. package/lib/api/kernel-calls/index.d.ts +1 -0
  13. package/lib/api/kernel-calls/index.js +1 -0
  14. package/lib/api/kernel-calls/resolve-dto.d.ts +3 -1
  15. package/lib/api/kernel-calls/resolve-dto.js +7 -2
  16. package/lib/api/kernel-calls/settings.d.ts +19 -0
  17. package/lib/api/kernel-calls/up-axis-aliases.d.ts +25 -0
  18. package/lib/api/kernel-calls/up-axis-aliases.js +70 -0
  19. package/lib/api/models/simplex.d.ts +2 -0
  20. package/lib/api/models/simplex.js +10 -1
  21. package/lib/api/resolved-inputs/index.d.ts +11 -2
  22. package/lib/api/services/helpers/curves/conic-arcs.d.ts +3 -1
  23. package/lib/api/services/helpers/curves/conic-arcs.js +4 -2
  24. package/lib/api/services/helpers/files/drawing/drawing-budget.js +16 -6
  25. package/lib/api/services/helpers/files/drawing/drawing-dimension.constants.d.ts +14 -0
  26. package/lib/api/services/helpers/files/drawing/drawing-dimension.constants.js +14 -0
  27. package/lib/api/services/helpers/files/drawing/drawing-dimension.d.ts +4 -0
  28. package/lib/api/services/helpers/files/drawing/drawing-dimension.js +271 -0
  29. package/lib/api/services/helpers/files/drawing/drawing-geometry.d.ts +3 -0
  30. package/lib/api/services/helpers/files/drawing/drawing-geometry.js +28 -11
  31. package/lib/api/services/helpers/files/drawing/drawing-hatch.d.ts +10 -0
  32. package/lib/api/services/helpers/files/drawing/drawing-hatch.js +123 -0
  33. package/lib/api/services/helpers/files/drawing/drawing-loops.d.ts +3 -0
  34. package/lib/api/services/helpers/files/drawing/drawing-loops.js +91 -0
  35. package/lib/api/services/helpers/files/drawing/drawing-model.d.ts +6 -1
  36. package/lib/api/services/helpers/files/drawing/drawing-model.js +97 -13
  37. package/lib/api/services/helpers/files/drawing/drawing-scale.d.ts +2 -0
  38. package/lib/api/services/helpers/files/drawing/drawing-scale.js +47 -0
  39. package/lib/api/services/helpers/files/drawing/drawing-text.d.ts +9 -0
  40. package/lib/api/services/helpers/files/drawing/drawing-text.js +25 -0
  41. package/lib/api/services/helpers/files/drawing/drawing-types.d.ts +57 -0
  42. package/lib/api/services/helpers/files/drawing/drawing.constants.d.ts +13 -0
  43. package/lib/api/services/helpers/files/drawing/drawing.constants.js +17 -0
  44. package/lib/api/services/helpers/files/dxf/dxf-annotations.d.ts +5 -0
  45. package/lib/api/services/helpers/files/dxf/dxf-annotations.js +96 -0
  46. package/lib/api/services/helpers/files/dxf/dxf-entities.d.ts +5 -1
  47. package/lib/api/services/helpers/files/dxf/dxf-entities.js +5 -2
  48. package/lib/api/services/helpers/files/dxf/dxf-generator.js +26 -10
  49. package/lib/api/services/helpers/files/dxf/dxf-reader-annotations.d.ts +9 -0
  50. package/lib/api/services/helpers/files/dxf/dxf-reader-annotations.js +312 -0
  51. package/lib/api/services/helpers/files/dxf/dxf-reader-dtos.js +37 -3
  52. package/lib/api/services/helpers/files/dxf/dxf-reader-segments.d.ts +9 -0
  53. package/lib/api/services/helpers/files/dxf/dxf-reader-segments.js +151 -0
  54. package/lib/api/services/helpers/files/dxf/dxf-reader-types.d.ts +27 -0
  55. package/lib/api/services/helpers/files/dxf/dxf-reader.constants.d.ts +63 -0
  56. package/lib/api/services/helpers/files/dxf/dxf-reader.constants.js +17 -0
  57. package/lib/api/services/helpers/files/dxf/dxf-reader.d.ts +1 -1
  58. package/lib/api/services/helpers/files/dxf/dxf-reader.js +71 -181
  59. package/lib/api/services/helpers/files/dxf/dxf-tables.d.ts +2 -0
  60. package/lib/api/services/helpers/files/dxf/dxf-tables.js +5 -4
  61. package/lib/api/services/helpers/files/dxf/dxf-tokens.d.ts +2 -0
  62. package/lib/api/services/helpers/files/dxf/dxf-tokens.js +25 -1
  63. package/lib/api/services/helpers/files/dxf/dxf.constants.d.ts +11 -0
  64. package/lib/api/services/helpers/files/dxf/dxf.constants.js +13 -0
  65. package/lib/api/services/helpers/files/svg/svg-strokes.d.ts +1 -1
  66. package/lib/api/services/helpers/files/svg/svg-strokes.js +47 -23
  67. package/lib/api/services/helpers/files/svg/svg-writer.d.ts +2 -0
  68. package/lib/api/services/helpers/files/svg/svg-writer.js +100 -23
  69. package/lib/api/services/helpers/files/svg/svg.constants.d.ts +2 -1
  70. package/lib/api/services/helpers/files/svg/svg.constants.js +2 -1
  71. package/lib/api/services/helpers/geometry/loop-fill.d.ts +2 -0
  72. package/lib/api/services/helpers/geometry/loop-fill.js +37 -0
  73. package/lib/api/services/helpers/helper-types.d.ts +33 -0
  74. package/lib/api/services/helpers/text/stroke-font.d.ts +6 -0
  75. package/lib/api/services/helpers/text/stroke-font.js +177 -0
  76. package/lib/api/services/helpers/text/stroke-letters.constants.d.ts +2 -0
  77. package/lib/api/services/helpers/text/stroke-letters.constants.js +18 -0
  78. package/lib/api/services/helpers/text/stroke-marks.constants.d.ts +14 -0
  79. package/lib/api/services/helpers/text/stroke-marks.constants.js +34 -0
  80. package/lib/api/services/io/drawing.d.ts +198 -0
  81. package/lib/api/services/io/drawing.js +242 -0
  82. package/lib/api/services/io/dxf.d.ts +3 -3
  83. package/lib/api/services/io/dxf.js +4 -4
  84. package/lib/api/services/io/svg.d.ts +13 -11
  85. package/lib/api/services/io/svg.js +15 -12
  86. package/lib/api/services/mesh.d.ts +19 -0
  87. package/lib/api/services/mesh.js +40 -0
  88. package/lib/api/services/recipes.js +3 -2
  89. package/lib/api/services/text.d.ts +3 -3
  90. package/lib/api/services/text.js +7 -25
  91. package/package.json +1 -1
@@ -17,6 +17,34 @@ export var IO;
17
17
  lineTypeEnum["center"] = "center";
18
18
  lineTypeEnum["dotted"] = "dotted";
19
19
  })(lineTypeEnum = IO.lineTypeEnum || (IO.lineTypeEnum = {}));
20
+ /**
21
+ * What a hatch fills its region with: `solid` ink, or lines `spacing` apart - `ansi31` one run
22
+ * of lines, `ansi32` lines in pairs a third of the spacing apart, `ansi37` two runs crossing at
23
+ * right angles.
24
+ *
25
+ * The second line of each `ansi32` pair is drawn whole, where the ANSI32 of CAD programs dashes
26
+ * it; a DXF file names the pattern ANSI32 at its standard scale.
27
+ * @beta
28
+ */
29
+ let hatchPatternEnum;
30
+ (function (hatchPatternEnum) {
31
+ hatchPatternEnum["solid"] = "solid";
32
+ hatchPatternEnum["ansi31"] = "ansi31";
33
+ hatchPatternEnum["ansi32"] = "ansi32";
34
+ hatchPatternEnum["ansi37"] = "ansi37";
35
+ })(hatchPatternEnum = IO.hatchPatternEnum || (IO.hatchPatternEnum = {}));
36
+ /**
37
+ * What a dimension measures: a `linear` distance between two points, the `diameter` or the
38
+ * `radius` of a circle, or the `angle` between two arms that meet at a point.
39
+ * @beta
40
+ */
41
+ let dimensionKindEnum;
42
+ (function (dimensionKindEnum) {
43
+ dimensionKindEnum["linear"] = "linear";
44
+ dimensionKindEnum["diameter"] = "diameter";
45
+ dimensionKindEnum["radius"] = "radius";
46
+ dimensionKindEnum["angular"] = "angular";
47
+ })(dimensionKindEnum = IO.dimensionKindEnum || (IO.dimensionKindEnum = {}));
20
48
  /**
21
49
  * A straight line in a drawing path, from `start` to `end`. Points may carry a Z coordinate; one
22
50
  * without it lies at Z 0.
@@ -191,11 +219,169 @@ export var IO;
191
219
  }
192
220
  IO.DrawingPathDto = DrawingPathDto;
193
221
  /**
194
- * A part of a drawing: paths drawn on one layer with one color and one line type, which
195
- * `io.dxf.dxfCreate` writes as DXF and `io.svg.svgCreate` as SVG.
222
+ * A line of text, in the stroke font `text.vectorText` draws.
223
+ *
224
+ * SVG draws its strokes; DXF writes a text fitted to their width. Accented Latin letters are
225
+ * drawn; a character the font lacks is a question mark, an emoji two.
226
+ * @beta
227
+ */
228
+ class DrawingTextDto {
229
+ constructor(text, position, height, anchor, rotation, widthFactor) {
230
+ /**
231
+ * The height of a capital letter, in drawing units.
232
+ * @default 3.5
233
+ * @minimum 0
234
+ * @exclusiveMinimum true
235
+ */
236
+ this.height = 3.5;
237
+ /**
238
+ * Which point of the baseline `position` is: where the text starts, its middle or its end.
239
+ * @default start
240
+ */
241
+ this.anchor = "start";
242
+ /**
243
+ * The angle of the baseline in degrees, counterclockwise from the X axis.
244
+ * @default 0
245
+ */
246
+ this.rotation = 0;
247
+ /**
248
+ * How wide the letters are drawn against their natural width: below 1 narrows a text to fit a
249
+ * cell, above 1 widens it.
250
+ * @default 1
251
+ * @minimum 0
252
+ * @exclusiveMinimum true
253
+ */
254
+ this.widthFactor = 1;
255
+ if (text !== undefined) {
256
+ this.text = text;
257
+ }
258
+ if (position !== undefined) {
259
+ this.position = position;
260
+ }
261
+ if (height !== undefined) {
262
+ this.height = height;
263
+ }
264
+ if (anchor !== undefined) {
265
+ this.anchor = anchor;
266
+ }
267
+ if (rotation !== undefined) {
268
+ this.rotation = rotation;
269
+ }
270
+ if (widthFactor !== undefined) {
271
+ this.widthFactor = widthFactor;
272
+ }
273
+ }
274
+ }
275
+ IO.DrawingTextDto = DrawingTextDto;
276
+ /**
277
+ * The room a drawing text takes, as `io.drawing.textSize` measures it.
278
+ * @beta
279
+ */
280
+ class DrawingTextSizeDto {
281
+ }
282
+ IO.DrawingTextSizeDto = DrawingTextSizeDto;
283
+ /**
284
+ * A hatched region of a drawing part: what its boundaries enclose, filled with a pattern.
285
+ *
286
+ * A boundary inside another cuts a hole, and one whose ends do not meet is closed by a
287
+ * straight line.
288
+ * @beta
289
+ */
290
+ class DrawingHatchDto {
291
+ constructor(boundaries, pattern, angle, spacing) {
292
+ /**
293
+ * What the region is filled with.
294
+ * @default ansi31
295
+ */
296
+ this.pattern = hatchPatternEnum.ansi31;
297
+ /**
298
+ * The angle of the pattern's lines in degrees, counterclockwise from the X axis; `solid`
299
+ * ignores it.
300
+ * @default 45
301
+ */
302
+ this.angle = 45;
303
+ /**
304
+ * The distance between the pattern's lines, in drawing units; `solid` ignores it. DXF writes
305
+ * it as a scale of the pattern in `acad.pat` for an inch drawing, in `acadiso.pat` otherwise.
306
+ * @default 3
307
+ * @minimum 0
308
+ * @exclusiveMinimum true
309
+ */
310
+ this.spacing = 3;
311
+ if (boundaries !== undefined) {
312
+ this.boundaries = boundaries;
313
+ }
314
+ if (pattern !== undefined) {
315
+ this.pattern = pattern;
316
+ }
317
+ if (angle !== undefined) {
318
+ this.angle = angle;
319
+ }
320
+ if (spacing !== undefined) {
321
+ this.spacing = spacing;
322
+ }
323
+ }
324
+ }
325
+ IO.DrawingHatchDto = DrawingHatchDto;
326
+ /**
327
+ * A hatch and how closely its curved boundaries are followed, for `io.drawing.clippedHatchLines`,
328
+ * which clips the pattern's lines to the region, and `io.drawing.hatchOutlines`, which gives the
329
+ * region's outlines as points.
330
+ * @beta
331
+ */
332
+ class DrawingHatchRegionDto {
333
+ constructor(boundaries, pattern, angle, spacing, tolerance) {
334
+ /**
335
+ * What the region is filled with; `solid` has no lines.
336
+ * @default ansi31
337
+ */
338
+ this.pattern = hatchPatternEnum.ansi31;
339
+ /**
340
+ * The angle of the pattern's lines in degrees, counterclockwise from the X axis.
341
+ * @default 45
342
+ */
343
+ this.angle = 45;
344
+ /**
345
+ * The distance between the pattern's lines, in drawing units.
346
+ * @default 3
347
+ * @minimum 0
348
+ * @exclusiveMinimum true
349
+ */
350
+ this.spacing = 3;
351
+ /**
352
+ * How far, in drawing units, the outline may stray from a curved boundary: arcs, circles,
353
+ * ellipses and splines become straight pieces this close to the curve.
354
+ * @default 0.01
355
+ * @minimum 0
356
+ * @exclusiveMinimum true
357
+ * @maximum Infinity
358
+ * @step 0.001
359
+ */
360
+ this.tolerance = 0.01;
361
+ if (boundaries !== undefined) {
362
+ this.boundaries = boundaries;
363
+ }
364
+ if (pattern !== undefined) {
365
+ this.pattern = pattern;
366
+ }
367
+ if (angle !== undefined) {
368
+ this.angle = angle;
369
+ }
370
+ if (spacing !== undefined) {
371
+ this.spacing = spacing;
372
+ }
373
+ if (tolerance !== undefined) {
374
+ this.tolerance = tolerance;
375
+ }
376
+ }
377
+ }
378
+ IO.DrawingHatchRegionDto = DrawingHatchRegionDto;
379
+ /**
380
+ * A part of a drawing: paths, texts and hatches on one layer, in one color, line type and line
381
+ * weight, which `io.dxf.dxfCreate` writes as DXF and `io.svg.svgCreate` as SVG.
196
382
  */
197
383
  class DrawingPartDto {
198
- constructor(layer, color, paths, lineType) {
384
+ constructor(layer, color, paths, lineType, lineWeight, texts, hatches) {
199
385
  /**
200
386
  * The layer the paths go on. Parts may share a layer, which takes the first part's color and
201
387
  * line type; every part's paths keep their own.
@@ -224,9 +410,143 @@ export var IO;
224
410
  if (lineType !== undefined) {
225
411
  this.lineType = lineType;
226
412
  }
413
+ if (lineWeight !== undefined) {
414
+ this.lineWeight = lineWeight;
415
+ }
416
+ if (texts !== undefined) {
417
+ this.texts = texts;
418
+ }
419
+ if (hatches !== undefined) {
420
+ this.hatches = hatches;
421
+ }
227
422
  }
228
423
  }
229
424
  IO.DrawingPartDto = DrawingPartDto;
425
+ /**
426
+ * Drawing parts and the one factor `io.drawing.scaleParts` scales them by about the origin, such
427
+ * as 1/25.4 to turn a drawing in millimetres into inches before writing it.
428
+ * @beta
429
+ */
430
+ class DrawingScalePartsDto {
431
+ constructor(parts, factor) {
432
+ /**
433
+ * What every length is multiplied by: 2 doubles the drawing, 25.4 turns inches into
434
+ * millimetres.
435
+ * @default 1
436
+ * @minimum 0
437
+ * @exclusiveMinimum true
438
+ */
439
+ this.factor = 1;
440
+ if (parts !== undefined) {
441
+ this.parts = parts;
442
+ }
443
+ if (factor !== undefined) {
444
+ this.factor = factor;
445
+ }
446
+ }
447
+ }
448
+ IO.DrawingScalePartsDto = DrawingScalePartsDto;
449
+ /**
450
+ * A dimension in the drawing's plane for `io.drawing.dimensionPicture`, which draws it, and
451
+ * `io.drawing.dimensionExtent`, which measures the box it fills: what it measures, between which
452
+ * points, and the size of its text and arrows.
453
+ * @beta
454
+ */
455
+ class DrawingDimensionDto {
456
+ constructor(kind, start, end, direction, offset, angle, value, decimalPlaces, upperTolerance, lowerTolerance, textHeight, arrowLength) {
457
+ /**
458
+ * What the dimension measures; it decides what `start`, `end`, `offset` and `angle` mean.
459
+ * @default linear
460
+ */
461
+ this.kind = dimensionKindEnum.linear;
462
+ /**
463
+ * For `linear`, how far the dimension line stands from `start`, in drawing units, to the left of
464
+ * `direction`; negative puts it right. Other kinds ignore it.
465
+ * @default 10
466
+ * @minimum -Infinity
467
+ * @maximum Infinity
468
+ */
469
+ this.offset = 10;
470
+ /**
471
+ * For `angular`, the angle in degrees from the first arm, the one through `end`,
472
+ * counterclockwise to the second arm. Other kinds ignore it.
473
+ * @default 90
474
+ * @minimum 0
475
+ * @maximum 360
476
+ * @exclusiveMinimum true
477
+ * @exclusiveMaximum true
478
+ */
479
+ this.angle = 90;
480
+ /**
481
+ * How many decimals the value keeps; trailing zeros are dropped, so 15.50 shows as 15.5.
482
+ * @default 2
483
+ * @minimum 0
484
+ * @maximum 15
485
+ * @step 1
486
+ */
487
+ this.decimalPlaces = 2;
488
+ /**
489
+ * The height of the text's digits, in drawing units; the gaps around the lines are sized from it.
490
+ * @default 3.5
491
+ * @minimum 0
492
+ * @exclusiveMinimum true
493
+ */
494
+ this.textHeight = 3.5;
495
+ if (kind !== undefined) {
496
+ this.kind = kind;
497
+ }
498
+ if (start !== undefined) {
499
+ this.start = start;
500
+ }
501
+ if (end !== undefined) {
502
+ this.end = end;
503
+ }
504
+ if (direction !== undefined) {
505
+ this.direction = direction;
506
+ }
507
+ if (offset !== undefined) {
508
+ this.offset = offset;
509
+ }
510
+ if (angle !== undefined) {
511
+ this.angle = angle;
512
+ }
513
+ if (value !== undefined) {
514
+ this.value = value;
515
+ }
516
+ if (decimalPlaces !== undefined) {
517
+ this.decimalPlaces = decimalPlaces;
518
+ }
519
+ if (upperTolerance !== undefined) {
520
+ this.upperTolerance = upperTolerance;
521
+ }
522
+ if (lowerTolerance !== undefined) {
523
+ this.lowerTolerance = lowerTolerance;
524
+ }
525
+ if (textHeight !== undefined) {
526
+ this.textHeight = textHeight;
527
+ }
528
+ if (arrowLength !== undefined) {
529
+ this.arrowLength = arrowLength;
530
+ }
531
+ }
532
+ }
533
+ IO.DrawingDimensionDto = DrawingDimensionDto;
534
+ /**
535
+ * The box a dimension's picture fills, as `io.drawing.dimensionExtent` and
536
+ * `io.drawing.dimensionPicture` measure it, by its lowest and highest corner.
537
+ * @beta
538
+ */
539
+ class DrawingExtentDto {
540
+ }
541
+ IO.DrawingExtentDto = DrawingExtentDto;
542
+ /**
543
+ * A dimension drawn by `io.drawing.dimensionPicture`: its lines, its arrowheads as loops to
544
+ * fill, its text as strokes and as a drawing text, and the box all of it fills.
545
+ * @beta
546
+ */
547
+ class DrawingDimensionPictureDto {
548
+ }
549
+ IO.DrawingDimensionPictureDto = DrawingDimensionPictureDto;
230
550
  /**
231
551
  * A straight line in a drawing path, under its former DXF name.
232
552
  *
@@ -301,10 +621,11 @@ export var IO;
301
621
  IO.DxfPathsPartDto = DxfPathsPartDto;
302
622
  /**
303
623
  * A whole DXF drawing for `io.dxf.dxfCreate`: its path parts by layer and color, and the color
304
- * format, the version and the unit to write.
624
+ * format, the version and the unit to write. In inches it is marked imperial, so hatch scales
625
+ * count from inch patterns.
305
626
  */
306
627
  class DxfModelDto {
307
- constructor(dxfPathsParts, colorFormat, acadVersion, unit, curveTolerance) {
628
+ constructor(dxfPathsParts, colorFormat, acadVersion, unit, curveTolerance, lineTypeScale) {
308
629
  /**
309
630
  * How colors are written: `aci`, the nearest of AutoCAD's 255 index colors, or `truecolor`,
310
631
  * the exact color beside that index (`AC1015` only; `AC1009` writes the index).
@@ -340,6 +661,9 @@ export var IO;
340
661
  if (curveTolerance !== undefined) {
341
662
  this.curveTolerance = curveTolerance;
342
663
  }
664
+ if (lineTypeScale !== undefined) {
665
+ this.lineTypeScale = lineTypeScale;
666
+ }
343
667
  }
344
668
  }
345
669
  IO.DxfModelDto = DxfModelDto;
@@ -375,7 +699,7 @@ export var IO;
375
699
  * unit that gives it its true size, and how wide the lines and the border are.
376
700
  */
377
701
  class SvgModelDto {
378
- constructor(parts, unit, strokeWidth, margin, tolerance) {
702
+ constructor(parts, unit, strokeWidth, margin, tolerance, lineTypeScale) {
379
703
  /**
380
704
  * The largest distance, in drawing units, between a curve SVG cannot draw exactly (a rational
381
705
  * or higher degree spline) and the cubic curves that stand in for it.
@@ -399,6 +723,9 @@ export var IO;
399
723
  if (tolerance !== undefined) {
400
724
  this.tolerance = tolerance;
401
725
  }
726
+ if (lineTypeScale !== undefined) {
727
+ this.lineTypeScale = lineTypeScale;
728
+ }
402
729
  }
403
730
  }
404
731
  IO.SvgModelDto = SvgModelDto;
@@ -406,7 +733,7 @@ export var IO;
406
733
  * One drawing path for `io.svg.pathData`, and how its coordinates are written.
407
734
  */
408
735
  class SvgPathDataDto {
409
- constructor(path, flipY, tolerance) {
736
+ constructor(path, flipY, tolerance, cubicsOnly) {
410
737
  /**
411
738
  * Whether Y is negated, as an SVG file needs (its Y runs down); leave it off for data drawn
412
739
  * inside a group that flips Y itself.
@@ -421,6 +748,13 @@ export var IO;
421
748
  * @exclusiveMinimum true
422
749
  */
423
750
  this.tolerance = 0.01;
751
+ /**
752
+ * When true, every curve is written as cubic Beziers (`C`), arcs within `tolerance`, for
753
+ * renderers that draw only lines and cubics.
754
+ * @default false
755
+ * @beta
756
+ */
757
+ this.cubicsOnly = false;
424
758
  if (path !== undefined) {
425
759
  this.path = path;
426
760
  }
@@ -430,6 +764,9 @@ export var IO;
430
764
  if (tolerance !== undefined) {
431
765
  this.tolerance = tolerance;
432
766
  }
767
+ if (cubicsOnly !== undefined) {
768
+ this.cubicsOnly = cubicsOnly;
769
+ }
433
770
  }
434
771
  }
435
772
  IO.SvgPathDataDto = SvgPathDataDto;
@@ -1,4 +1,4 @@
1
- import type { Base } from "./base-inputs";
1
+ import { Base } from "./base-inputs";
2
2
  /**
3
3
  * Parameters for polygonal mesh geometry: vertex, index and normal data, the options for building and
4
4
  * inspecting a mesh, and the settings that control conversion between the mesh representations the
@@ -136,6 +136,25 @@ export declare namespace Mesh {
136
136
  */
137
137
  holes?: Base.Point3[][] | undefined;
138
138
  }
139
+ /**
140
+ * Closed loops lying in one plane and the rule that decides what they enclose, for
141
+ * `mesh.triangulateLoops`.
142
+ */
143
+ class TriangulateLoopsDto {
144
+ constructor(loops?: Base.Point3[][], fillRule?: Base.loopFillRuleEnum);
145
+ /**
146
+ * The loops, each a list of corners in one plane; the last need not repeat the first, and loops
147
+ * may run either way and nest.
148
+ * @default undefined
149
+ */
150
+ loops: Base.Point3[][];
151
+ /**
152
+ * How the loops decide what is inside: `evenOdd` leaves every loop inside another open
153
+ * whichever way it runs, as letters are filled; `nonZero` lets their directions count.
154
+ * @default evenOdd
155
+ */
156
+ fillRule?: Base.loopFillRuleEnum | undefined;
157
+ }
139
158
  /**
140
159
  * Two triangle meshes and how close they may come, for `mesh.meshesWithin`.
141
160
  */
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @typescript-eslint/no-namespace */
2
+ import { Base } from "./base-inputs";
1
3
  /**
2
4
  * Parameters for polygonal mesh geometry: vertex, index and normal data, the options for building and
3
5
  * inspecting a mesh, and the settings that control conversion between the mesh representations the
@@ -130,6 +132,27 @@ export var Mesh;
130
132
  }
131
133
  }
132
134
  Mesh.PolygonWithHolesDto = PolygonWithHolesDto;
135
+ /**
136
+ * Closed loops lying in one plane and the rule that decides what they enclose, for
137
+ * `mesh.triangulateLoops`.
138
+ */
139
+ class TriangulateLoopsDto {
140
+ constructor(loops, fillRule) {
141
+ /**
142
+ * How the loops decide what is inside: `evenOdd` leaves every loop inside another open
143
+ * whichever way it runs, as letters are filled; `nonZero` lets their directions count.
144
+ * @default evenOdd
145
+ */
146
+ this.fillRule = Base.loopFillRuleEnum.evenOdd;
147
+ if (loops !== undefined) {
148
+ this.loops = loops;
149
+ }
150
+ if (fillRule !== undefined) {
151
+ this.fillRule = fillRule;
152
+ }
153
+ }
154
+ }
155
+ Mesh.TriangulateLoopsDto = TriangulateLoopsDto;
133
156
  /**
134
157
  * Two triangle meshes and how close they may come, for `mesh.meshesWithin`.
135
158
  */
@@ -1,4 +1,4 @@
1
- import type { Base } from "./base-inputs";
1
+ import { Base } from "./base-inputs";
2
2
  /**
3
3
  * Parameters for working with recipes without a CAD kernel: the recipe to check or read, the roots
4
4
  * to draw as meshes, and the node to follow. Experimental: the recipe format may still change before
@@ -26,7 +26,7 @@ export declare namespace Recipes {
26
26
  * @beta
27
27
  */
28
28
  class RecipeSurfaceMeshesDto {
29
- constructor(recipe?: Base.Recipe, roots?: number[], adjustZtoY?: boolean);
29
+ constructor(recipe?: Base.Recipe, roots?: number[], adjustZtoY?: boolean, upAxis?: Base.upAxisConversionEnum);
30
30
  /**
31
31
  * The recipe: steps such as polygons, extrusions and triangle meshes, and the roots to build
32
32
  * from them.
@@ -40,9 +40,17 @@ export declare namespace Recipes {
40
40
  */
41
41
  roots?: number[] | undefined;
42
42
  /**
43
- * When true, each mesh turns a quarter turn about X, as a kernel's recipe build does with
44
- * this option: `(x, y, z)` becomes `(x, z, -y)`.
45
- * @default false
43
+ * Whether the meshes turn: `zUpToYUp` turns each a quarter turn about X, as a kernel's recipe
44
+ * build does, so `(x, y, z)` becomes `(x, z, -y)`; `keep` leaves them. `yUpToZUp` is refused.
45
+ * @default keep
46
+ */
47
+ upAxis?: Base.upAxisConversionEnum | undefined;
48
+ /**
49
+ * When true, the meshes turn as `upAxis` `zUpToYUp` turns them; false, its old default, decides
50
+ * nothing. True wins over `upAxis` at its default; beside another chosen turn it is refused.
51
+ * @deprecated Give `upAxis` instead; this flag goes in the next major version.
52
+ * @default undefined
53
+ * @optional true
46
54
  */
47
55
  adjustZtoY?: boolean | undefined;
48
56
  }
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @typescript-eslint/no-namespace */
2
+ import { Base } from "./base-inputs";
1
3
  /**
2
4
  * Parameters for working with recipes without a CAD kernel: the recipe to check or read, the roots
3
5
  * to draw as meshes, and the node to follow. Experimental: the recipe format may still change before
@@ -25,13 +27,13 @@ export var Recipes;
25
27
  * @beta
26
28
  */
27
29
  class RecipeSurfaceMeshesDto {
28
- constructor(recipe, roots, adjustZtoY) {
30
+ constructor(recipe, roots, adjustZtoY, upAxis) {
29
31
  /**
30
- * When true, each mesh turns a quarter turn about X, as a kernel's recipe build does with
31
- * this option: `(x, y, z)` becomes `(x, z, -y)`.
32
- * @default false
32
+ * Whether the meshes turn: `zUpToYUp` turns each a quarter turn about X, as a kernel's recipe
33
+ * build does, so `(x, y, z)` becomes `(x, z, -y)`; `keep` leaves them. `yUpToZUp` is refused.
34
+ * @default keep
33
35
  */
34
- this.adjustZtoY = false;
36
+ this.upAxis = Base.upAxisConversionEnum.keep;
35
37
  if (recipe !== undefined) {
36
38
  this.recipe = recipe;
37
39
  }
@@ -41,6 +43,9 @@ export var Recipes;
41
43
  if (adjustZtoY !== undefined) {
42
44
  this.adjustZtoY = adjustZtoY;
43
45
  }
46
+ if (upAxis !== undefined) {
47
+ this.upAxis = upAxis;
48
+ }
44
49
  }
45
50
  }
46
51
  Recipes.RecipeSurfaceMeshesDto = RecipeSurfaceMeshesDto;
@@ -12,3 +12,4 @@ export * from "./hashing";
12
12
  export * from "./unknown-values";
13
13
  export * from "./kernel-steps";
14
14
  export * from "./settings";
15
+ export { checkedUpAxis } from "./up-axis-aliases";
@@ -12,3 +12,4 @@ export * from "./hashing";
12
12
  export * from "./unknown-values";
13
13
  export * from "./kernel-steps";
14
14
  export * from "./settings";
15
+ export { checkedUpAxis } from "./up-axis-aliases";
@@ -35,11 +35,13 @@ export type WithDefaults<T, K extends keyof T> = Omit<T, K> & {
35
35
  * that passed nothing gets the defaults alone. The result is a new plain object - a DTO carries data
36
36
  * and no behaviour, and a plain object is what crosses a worker boundary and what a walk over the
37
37
  * inputs treats as data - and the caller's object is never changed. Properties named in `nested`
38
- * hold a DTO of their own and get its defaults the same way.
38
+ * hold a DTO of their own and get its defaults the same way. On a DTO with an `upAxis` default, the
39
+ * deprecated `adjustZtoY` and `adjustYtoZ` flags a caller gives are laid onto `upAxis` and dropped.
39
40
  * @param Dto - The DTO class whose initializers are the defaults
40
41
  * @param inputs - What the caller passed, usually an object literal
41
42
  * @param nested - The properties that hold a DTO, and its class
42
43
  * @returns A new plain object holding every default the caller did not override
44
+ * @throws InputError when a deprecated up-axis flag asks for another turn than `upAxis` or the other flag
43
45
  */
44
46
  export declare function resolveDto<T extends object>(Dto: DtoConstructor<T>, inputs: unknown, nested?: Readonly<Record<string, DtoConstructor>>): T;
45
47
  /**
@@ -1,4 +1,5 @@
1
1
  import { isRecord } from "./unknown-values";
2
+ import { layUpAxisFlags } from "./up-axis-aliases";
2
3
  /**
3
4
  * Builds the DTO a service reads from what a caller passed: the defaults a new `Dto` holds, with the
4
5
  * caller's properties laid over them. A property the caller set to undefined keeps its default, and
@@ -9,15 +10,18 @@ import { isRecord } from "./unknown-values";
9
10
  * that passed nothing gets the defaults alone. The result is a new plain object - a DTO carries data
10
11
  * and no behaviour, and a plain object is what crosses a worker boundary and what a walk over the
11
12
  * inputs treats as data - and the caller's object is never changed. Properties named in `nested`
12
- * hold a DTO of their own and get its defaults the same way.
13
+ * hold a DTO of their own and get its defaults the same way. On a DTO with an `upAxis` default, the
14
+ * deprecated `adjustZtoY` and `adjustYtoZ` flags a caller gives are laid onto `upAxis` and dropped.
13
15
  * @param Dto - The DTO class whose initializers are the defaults
14
16
  * @param inputs - What the caller passed, usually an object literal
15
17
  * @param nested - The properties that hold a DTO, and its class
16
18
  * @returns A new plain object holding every default the caller did not override
19
+ * @throws InputError when a deprecated up-axis flag asks for another turn than `upAxis` or the other flag
17
20
  */
18
21
  export function resolveDto(Dto, inputs, nested) {
19
22
  const resolved = {};
20
- Object.assign(resolved, new Dto());
23
+ const defaults = Object.assign({}, new Dto());
24
+ Object.assign(resolved, defaults);
21
25
  const hasDefault = (key) => Object.prototype.hasOwnProperty.call(resolved, key) && resolved[key] !== undefined;
22
26
  const isUnset = (key, value) => value === undefined
23
27
  || (value === null && hasDefault(key))
@@ -28,6 +32,7 @@ export function resolveDto(Dto, inputs, nested) {
28
32
  resolved[key] = value;
29
33
  }
30
34
  }
35
+ layUpAxisFlags(resolved, inputs, defaults);
31
36
  }
32
37
  if (nested) {
33
38
  for (const [key, NestedDto] of Object.entries(nested)) {
@@ -67,6 +67,25 @@ export declare class SettingsRelay {
67
67
  * engine's own coordinate system. Content made today is saved with it.
68
68
  */
69
69
  export declare const CURRENT_CONVENTIONS = 1;
70
+ /**
71
+ * One change a conventions level makes, told in words: the level that makes it, the operations
72
+ * whose results it changes and what changes in them. An entry is a dotted path as a script writes
73
+ * it after `bitbybit.`, and one that ends in a dot stands for everything under it.
74
+ */
75
+ export interface ConventionChange {
76
+ /**
77
+ * The conventions level that makes the change, from 1
78
+ */
79
+ readonly level: number;
80
+ /**
81
+ * The operations whose results it changes
82
+ */
83
+ readonly entries: readonly string[];
84
+ /**
85
+ * What changes, in one sentence that starts with what it is about
86
+ */
87
+ readonly change: string;
88
+ }
70
89
  /**
71
90
  * The settings that content saved with a conventions level runs by. Content carries one whole
72
91
  * number instead of the settings themselves, since the right settings depend on the engine that runs it:
@@ -0,0 +1,25 @@
1
+ import { Base } from "../inputs/base-inputs";
2
+ /**
3
+ * Lays the deprecated `adjustZtoY` and `adjustYtoZ` flags of a caller's inputs onto the `upAxis`
4
+ * of a DTO whose defaults carry one, and drops them. A flag at its released default (true where the
5
+ * DTO's `upAxis` defaults to the flag's turn, false elsewhere) decides nothing, as an old example or
6
+ * an old positional constructor spells it. Set the other way it decides: true chooses the flag's
7
+ * turn, false `keep`. A deciding flag wins over an `upAxis` equal to its default, since an editor
8
+ * passes every input and an explicit default cannot be told from one laid; it is refused beside an
9
+ * `upAxis` that chooses another turn, or beside the other flag deciding another one. An `upAxis`
10
+ * that is no turn is left for the method to refuse.
11
+ * @param resolved - The inputs over the DTO's defaults, changed in place
12
+ * @param given - The inputs as the caller passed them
13
+ * @param defaults - The DTO's defaults
14
+ * @throws InputError when the flags and `upAxis` ask for different turns, naming both
15
+ */
16
+ export declare function layUpAxisFlags(resolved: Record<string, unknown>, given: Readonly<Record<string, unknown>>, defaults: Readonly<Record<string, unknown>>): void;
17
+ /**
18
+ * The turn an operation was asked for, among the ones it can make: an operation that reads Z-up
19
+ * files takes `keep` and `zUpToYUp`, one that writes for Z-up tools `keep` and `yUpToZUp`.
20
+ * @param value - The `upAxis` the operation received
21
+ * @param accepted - The turns the operation makes
22
+ * @returns The turn, typed
23
+ * @throws InputError when the value is not among `accepted`, naming the turns that are
24
+ */
25
+ export declare function checkedUpAxis(value: unknown, accepted: readonly Base.upAxisConversionEnum[]): Base.upAxisConversionEnum;