@bitbybit-dev/base 1.3.2-rc.1 → 1.4.0-rc.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
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Base algorithms for [Bitbybit](https://bitbybit.dev) CAD platform - math, vectors, matrices, lists, text utilities, and shared types used across all higher-level packages.
4
4
 
5
- <img src="https://app.bitbybit.dev/assets/git-cover.png" alt="Picture showing bitbybit.dev platform">
5
+ <img src="https://bitbybit.dev/files/site/git-cover.png" alt="Picture showing bitbybit.dev platform">
6
6
 
7
7
  ## Overview
8
8
 
@@ -1,3 +1,3 @@
1
1
  export class GlobalCDNProvider {
2
2
  }
3
- GlobalCDNProvider.BITBYBIT_CDN_URL = "https://git-cdn.bitbybit.dev/v1.3.2-rc.1";
3
+ GlobalCDNProvider.BITBYBIT_CDN_URL = "https://git-cdn.bitbybit.dev/v1.4.0-rc.0";
@@ -1,4 +1,6 @@
1
1
  export * from "./services";
2
+ export * from "./kernel-calls";
2
3
  export * from "./GlobalCDNProvider";
3
4
  export * as Inputs from "./inputs";
5
+ export * as Resolved from "./resolved-inputs";
4
6
  export { Base } from "./inputs/base-inputs";
package/lib/api/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from "./services";
2
+ export * from "./kernel-calls";
2
3
  export * from "./GlobalCDNProvider";
3
4
  export * as Inputs from "./inputs";
5
+ export * as Resolved from "./resolved-inputs";
4
6
  export { Base } from "./inputs/base-inputs";
@@ -98,15 +98,21 @@ export declare namespace Base {
98
98
  */
99
99
  type Mesh3 = Triangle3[];
100
100
  /**
101
- * An infinite plane: an origin point, a normal vector, and a direction vector that fixes the
102
- * plane's rotation about its own normal. That third field is what lets an operation place 2D
103
- * geometry on the plane with a predictable orientation rather than an arbitrary one.
101
+ * A coordinate frame: an origin, a normal (its z axis) and a direction (its x axis, square to the
102
+ * normal); its y axis is the normal crossed with the direction, so the frame is right-handed. A
103
+ * frame places things: shapes land on it, profiles are drawn in its plane.
104
104
  */
105
- type Plane3 = {
105
+ type Frame = {
106
106
  origin: Base.Point3;
107
107
  normal: Base.Vector3;
108
108
  direction: Base.Vector3;
109
109
  };
110
+ /**
111
+ * An infinite plane: an origin point, a normal vector, and a direction vector that fixes the
112
+ * plane's rotation about its own normal.
113
+ * @deprecated Use `Frame`, the same three fields; `Plane3` is removed in the next major version.
114
+ */
115
+ type Plane3 = Frame;
110
116
  /**
111
117
  * The axis-aligned box enclosing a shape, as a min and a max corner, with the center and the
112
118
  * width, height and length filled in as a convenience. Use it to size a camera to a model, to lay
@@ -13,7 +13,7 @@ export declare namespace Color {
13
13
  * The color as a hex text such as `#ff5733`, with or without the `#`.
14
14
  * @default #0000ff
15
15
  */
16
- color: Base.Color;
16
+ color?: Base.Color | undefined;
17
17
  }
18
18
  /**
19
19
  * An `{ r, g, b }` color with channels from 0 to 255, for `color.rgb255Color`.
@@ -26,7 +26,7 @@ export declare namespace Color {
26
26
  * @minimum 0
27
27
  * @maximum 255
28
28
  */
29
- colorRgb: Base.ColorRGB;
29
+ colorRgb?: Base.ColorRGB | undefined;
30
30
  }
31
31
  /**
32
32
  * An `{ r, g, b }` color with channels from 0 to 1, for `color.rgb1Color`.
@@ -39,7 +39,7 @@ export declare namespace Color {
39
39
  * @minimum 0
40
40
  * @maximum 1
41
41
  */
42
- colorRgb: Base.ColorRGB;
42
+ colorRgb?: Base.ColorRGB | undefined;
43
43
  }
44
44
  /**
45
45
  * An `{ r, g, b, a }` color with color channels from 0 to 255 and opacity from 0 to 1, for
@@ -54,7 +54,7 @@ export declare namespace Color {
54
54
  * @minimum 0
55
55
  * @maximum 255
56
56
  */
57
- colorRgba: Base.ColorRGBA;
57
+ colorRgba?: Base.ColorRGBA | undefined;
58
58
  }
59
59
  /**
60
60
  * An `{ r, g, b, a }` color with every channel from 0 to 1, for `color.rgba1Color`.
@@ -68,7 +68,7 @@ export declare namespace Color {
68
68
  * @minimum 0
69
69
  * @maximum 1
70
70
  */
71
- colorRgba: Base.ColorRGBA;
71
+ colorRgba?: Base.ColorRGBA | undefined;
72
72
  }
73
73
  /**
74
74
  * Separate red, green and blue values from 0 to 255, for color.rgbAtomic255Color.
@@ -81,21 +81,21 @@ export declare namespace Color {
81
81
  * @minimum 0
82
82
  * @maximum 255
83
83
  */
84
- r: number;
84
+ r?: number | undefined;
85
85
  /**
86
86
  * The green channel, from 0 to 255.
87
87
  * @default 0
88
88
  * @minimum 0
89
89
  * @maximum 255
90
90
  */
91
- g: number;
91
+ g?: number | undefined;
92
92
  /**
93
93
  * The blue channel, from 0 to 255.
94
94
  * @default 255
95
95
  * @minimum 0
96
96
  * @maximum 255
97
97
  */
98
- b: number;
98
+ b?: number | undefined;
99
99
  }
100
100
  /**
101
101
  * Separate red, green, blue and alpha values from 0 to 255, for building a color.
@@ -142,21 +142,21 @@ export declare namespace Color {
142
142
  * @minimum 0
143
143
  * @maximum 1
144
144
  */
145
- r: number;
145
+ r?: number | undefined;
146
146
  /**
147
147
  * The green channel, from 0 to 1.
148
148
  * @default 0
149
149
  * @minimum 0
150
150
  * @maximum 1
151
151
  */
152
- g: number;
152
+ g?: number | undefined;
153
153
  /**
154
154
  * The blue channel, from 0 to 1.
155
155
  * @default 1
156
156
  * @minimum 0
157
157
  * @maximum 1
158
158
  */
159
- b: number;
159
+ b?: number | undefined;
160
160
  }
161
161
  /**
162
162
  * Separate red, green, blue and alpha values from 0 to 1, for building a color.
@@ -201,12 +201,13 @@ export declare namespace Color {
201
201
  * The color to invert, as a hex text such as `#ff5733`.
202
202
  * @default #0000ff
203
203
  */
204
- color: Base.Color;
204
+ color?: Base.Color | undefined;
205
205
  /**
206
206
  * When true, the result is black for a light color and white for a dark one instead of the
207
207
  * exact inverse; useful for readable text.
208
+ * @default false
208
209
  */
209
- blackAndWhite: boolean;
210
+ blackAndWhite?: boolean | undefined;
210
211
  }
211
212
  /**
212
213
  * A hex color and a target range for `color.hexToRgbMapped`, `color.getRedParam`,
@@ -218,7 +219,7 @@ export declare namespace Color {
218
219
  * The color as a hex text such as `#ff5733`.
219
220
  * @default #0000ff
220
221
  */
221
- color: Base.Color;
222
+ color?: Base.Color | undefined;
222
223
  /**
223
224
  * The value a channel of 0 maps to.
224
225
  * @default 0
@@ -226,7 +227,7 @@ export declare namespace Color {
226
227
  * @maximum Infinity
227
228
  * @step 1
228
229
  */
229
- from: number;
230
+ from?: number | undefined;
230
231
  /**
231
232
  * The value a channel of 255 maps to; 1 gives channels from 0 to 1.
232
233
  * @default 255
@@ -234,7 +235,7 @@ export declare namespace Color {
234
235
  * @maximum Infinity
235
236
  * @step 1
236
237
  */
237
- to: number;
238
+ to?: number | undefined;
238
239
  }
239
240
  /**
240
241
  * An `{ r, g, b }` color and the range its channels use, for `color.rgbObjToHex`.
@@ -253,7 +254,7 @@ export declare namespace Color {
253
254
  * @maximum 255
254
255
  * @step 0.1
255
256
  */
256
- min: number;
257
+ min?: number | undefined;
257
258
  /**
258
259
  * The highest value a channel can have in this object: 255 or 1; anything else is remapped
259
260
  * to 0 to 255 first.
@@ -262,7 +263,7 @@ export declare namespace Color {
262
263
  * @maximum 255
263
264
  * @step 0.1
264
265
  */
265
- max: number;
266
+ max?: number | undefined;
266
267
  }
267
268
  /**
268
269
  * Three channel values and the range they use, for `color.rgbToHex`.
@@ -276,7 +277,7 @@ export declare namespace Color {
276
277
  * @maximum 255
277
278
  * @step 1
278
279
  */
279
- r: number;
280
+ r?: number | undefined;
280
281
  /**
281
282
  * The green channel, within `min` to `max`.
282
283
  * @default 255
@@ -284,7 +285,7 @@ export declare namespace Color {
284
285
  * @maximum 255
285
286
  * @step 1
286
287
  */
287
- g: number;
288
+ g?: number | undefined;
288
289
  /**
289
290
  * The blue channel, within `min` to `max`.
290
291
  * @default 255
@@ -292,7 +293,7 @@ export declare namespace Color {
292
293
  * @maximum 255
293
294
  * @step 1
294
295
  */
295
- b: number;
296
+ b?: number | undefined;
296
297
  /**
297
298
  * The lowest value a channel can have, usually 0.
298
299
  * @default 0
@@ -300,7 +301,7 @@ export declare namespace Color {
300
301
  * @maximum 255
301
302
  * @step 0.1
302
303
  */
303
- min: number;
304
+ min?: number | undefined;
304
305
  /**
305
306
  * The highest value a channel can have: 255 or 1; anything else is remapped to 0 to 255
306
307
  * first.
@@ -309,7 +310,7 @@ export declare namespace Color {
309
310
  * @maximum 255
310
311
  * @step 0.1
311
312
  */
312
- max: number;
313
+ max?: number | undefined;
313
314
  }
314
315
  /**
315
316
  * An `{ r, g, b }` color for `color.rgbToRed`, `color.rgbToGreen` and `color.rgbToBlue`.
@@ -281,6 +281,7 @@ export var Color;
281
281
  /**
282
282
  * When true, the result is black for a light color and white for a dark one instead of the
283
283
  * exact inverse; useful for readable text.
284
+ * @default false
284
285
  */
285
286
  this.blackAndWhite = false;
286
287
  if (color !== undefined) {
@@ -43,7 +43,7 @@ export declare namespace Dates {
43
43
  * @maximum Infinity
44
44
  * @step 1
45
45
  */
46
- seconds: number;
46
+ seconds?: number | undefined;
47
47
  }
48
48
  /**
49
49
  * A date and a new value for its day, for `dates.setDayOfMonth` and `dates.setUTCDay`.
@@ -62,7 +62,7 @@ export declare namespace Dates {
62
62
  * @maximum Infinity
63
63
  * @step 1
64
64
  */
65
- day: number;
65
+ day?: number | undefined;
66
66
  }
67
67
  /**
68
68
  * A date and a new value for its year, for `dates.setYear` and `dates.setUTCYear`.
@@ -82,7 +82,7 @@ export declare namespace Dates {
82
82
  * @maximum Infinity
83
83
  * @step 1
84
84
  */
85
- year: number;
85
+ year?: number | undefined;
86
86
  }
87
87
  /**
88
88
  * A date and a new value for its month, for `dates.setMonth` and `dates.setUTCMonth`.
@@ -102,7 +102,7 @@ export declare namespace Dates {
102
102
  * @maximum Infinity
103
103
  * @step 1
104
104
  */
105
- month: number;
105
+ month?: number | undefined;
106
106
  }
107
107
  /**
108
108
  * A date and a new value for its hours, for `dates.setHours` and `dates.setUTCHours`.
@@ -121,7 +121,7 @@ export declare namespace Dates {
121
121
  * @maximum Infinity
122
122
  * @step 1
123
123
  */
124
- hours: number;
124
+ hours?: number | undefined;
125
125
  }
126
126
  /**
127
127
  * A date and a new value for its minutes, for `dates.setMinutes` and `dates.setUTCMinutes`.
@@ -140,7 +140,7 @@ export declare namespace Dates {
140
140
  * @maximum Infinity
141
141
  * @step 1
142
142
  */
143
- minutes: number;
143
+ minutes?: number | undefined;
144
144
  }
145
145
  /**
146
146
  * A date and a new value for its milliseconds, for `dates.setMilliseconds` and
@@ -160,7 +160,7 @@ export declare namespace Dates {
160
160
  * @maximum Infinity
161
161
  * @step 1
162
162
  */
163
- milliseconds: number;
163
+ milliseconds?: number | undefined;
164
164
  }
165
165
  /**
166
166
  * A date and a Unix timestamp for `dates.setTime`.
@@ -179,7 +179,7 @@ export declare namespace Dates {
179
179
  * @maximum Infinity
180
180
  * @step 1
181
181
  */
182
- time: number;
182
+ time?: number | undefined;
183
183
  }
184
184
  /**
185
185
  * A Unix timestamp for `dates.createFromUnixTimeStamp`, which turns it into a date.
@@ -193,7 +193,7 @@ export declare namespace Dates {
193
193
  * @maximum Infinity
194
194
  * @step 1
195
195
  */
196
- unixTimeStamp: number;
196
+ unixTimeStamp?: number | undefined;
197
197
  }
198
198
  /**
199
199
  * The parts of a date for `dates.createDate` and `dates.createDateUTC`; a part outside its
@@ -208,7 +208,7 @@ export declare namespace Dates {
208
208
  * @maximum Infinity
209
209
  * @step 1
210
210
  */
211
- year: number;
211
+ year?: number | undefined;
212
212
  /**
213
213
  * The month counting from 0: 0 is January, 11 December.
214
214
  * @default 1
@@ -216,7 +216,7 @@ export declare namespace Dates {
216
216
  * @maximum Infinity
217
217
  * @step 1
218
218
  */
219
- month: number;
219
+ month?: number | undefined;
220
220
  /**
221
221
  * The day of the month, from 1 to 31.
222
222
  * @default 1
@@ -224,7 +224,7 @@ export declare namespace Dates {
224
224
  * @maximum Infinity
225
225
  * @step 1
226
226
  */
227
- day: number;
227
+ day?: number | undefined;
228
228
  /**
229
229
  * The hour, from 0 to 23.
230
230
  * @default 1
@@ -232,7 +232,7 @@ export declare namespace Dates {
232
232
  * @maximum Infinity
233
233
  * @step 1
234
234
  */
235
- hours: number;
235
+ hours?: number | undefined;
236
236
  /**
237
237
  * The minutes, from 0 to 59.
238
238
  * @default 1
@@ -240,7 +240,7 @@ export declare namespace Dates {
240
240
  * @maximum Infinity
241
241
  * @step 1
242
242
  */
243
- minutes: number;
243
+ minutes?: number | undefined;
244
244
  /**
245
245
  * The seconds, from 0 to 59.
246
246
  * @default 1
@@ -248,7 +248,7 @@ export declare namespace Dates {
248
248
  * @maximum Infinity
249
249
  * @step 1
250
250
  */
251
- seconds: number;
251
+ seconds?: number | undefined;
252
252
  /**
253
253
  * The milliseconds, from 0 to 999.
254
254
  * @default 1
@@ -256,6 +256,6 @@ export declare namespace Dates {
256
256
  * @maximum Infinity
257
257
  * @step 1
258
258
  */
259
- milliseconds: number;
259
+ milliseconds?: number | undefined;
260
260
  }
261
261
  }