@bitbybit-dev/base 1.2.0 → 1.3.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 (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
@@ -1,3 +1,3 @@
1
1
  export class GlobalCDNProvider {
2
2
  }
3
- GlobalCDNProvider.BITBYBIT_CDN_URL = "https://git-cdn.bitbybit.dev/v1.2.0";
3
+ GlobalCDNProvider.BITBYBIT_CDN_URL = "https://git-cdn.bitbybit.dev/v1.3.0-rc.0";
@@ -4,13 +4,13 @@
4
4
  */
5
5
  export declare namespace Base {
6
6
  /**
7
- * A colour as a CSS string - a hex value such as #ff8800, or any other form the browser
7
+ * A color as a CSS string - a hex value such as #ff8800, or any other form the browser
8
8
  * accepts. This is the form every draw option and material takes; use the color API to convert
9
9
  * to and from RGB and HSL.
10
10
  */
11
11
  type Color = string;
12
12
  /**
13
- * A colour as separate red, green and blue channels, each 0-255. Use it when you need to compute
13
+ * A color as separate red, green and blue channels, each 0-255. Use it when you need to compute
14
14
  * with the channels; convert to a Color string before handing it to a draw call.
15
15
  */
16
16
  type ColorRGB = {
@@ -52,7 +52,7 @@ export declare namespace Base {
52
52
  /**
53
53
  * A direction and magnitude in space as [x, y, z]. Structurally identical to Point3; use this
54
54
  * name where the value means a direction - a normal, an axis, an offset - rather than a position.
55
- * Many operations expect it normalised, and say so on the parameter.
55
+ * Many operations expect it normalized, and say so on the parameter.
56
56
  */
57
57
  type Vector3 = [number, number, number];
58
58
  /**
@@ -108,7 +108,7 @@ export declare namespace Base {
108
108
  direction: Base.Vector3;
109
109
  };
110
110
  /**
111
- * The axis-aligned box enclosing a shape, as a min and a max corner, with the centre and the
111
+ * The axis-aligned box enclosing a shape, as a min and a max corner, with the center and the
112
112
  * width, height and length filled in as a convenience. Use it to size a camera to a model, to lay
113
113
  * objects out without overlap, or to check a part fits a build volume.
114
114
  */
@@ -136,7 +136,7 @@ export declare namespace Base {
136
136
  end: Base.Point3;
137
137
  };
138
138
  /**
139
- * A connected chain of points in space, optionally closed, with an optional colour. Closing it
139
+ * A connected chain of points in space, optionally closed, with an optional color. Closing it
140
140
  * turns the chain into an outline that can become a face.
141
141
  */
142
142
  type Polyline3 = {
@@ -145,7 +145,7 @@ export declare namespace Base {
145
145
  color?: number[];
146
146
  };
147
147
  /**
148
- * A connected chain of points in the plane, optionally closed, with an optional colour.
148
+ * A connected chain of points in the plane, optionally closed, with an optional color.
149
149
  */
150
150
  type Polyline2 = {
151
151
  points: Base.Point2[];
@@ -157,18 +157,19 @@ export declare namespace Base {
157
157
  */
158
158
  type TransformMatrix3x3 = [number, number, number, number, number, number, number, number, number];
159
159
  /**
160
- * A list of 3x3 transformation matrices, for producing patterned layouts in the plane.
160
+ * A list of 3x3 transformation matrices, applied one after another, first to last, as one
161
+ * combined transform in the plane.
161
162
  */
162
163
  type TransformMatrixes3x3 = TransformMatrix3x3[];
163
164
  /**
164
- * A 4x4 transformation matrix as 16 numbers in row-major order. Translation, rotation and scale
165
- * combined into one value that any geometry API will accept, so the same transform applies
166
- * equally to points, curves and solids.
165
+ * A 4x4 transformation matrix as 16 numbers in column-major order, so the translation sits at
166
+ * indices 12 to 14. Translation, rotation and scale combined into one value that any geometry
167
+ * API will accept, so the same transform applies equally to points, curves and solids.
167
168
  */
168
169
  type TransformMatrix = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
169
170
  /**
170
- * A list of 4x4 transformation matrices. Applying a list transforms a shape once per matrix,
171
- * which is how patterned arrays and instanced layouts are produced in a single call.
171
+ * A list of 4x4 transformation matrices, applied one after another, first to last, as one
172
+ * combined transform. A method that takes a list gives one result, not one per matrix.
172
173
  */
173
174
  type TransformMatrixes = TransformMatrix[];
174
175
  /**
@@ -1,188 +1,226 @@
1
1
  import { Base } from "./base-inputs";
2
2
  /**
3
- * Parameters for colour handling: hex, RGB and HSL values, the components to combine or extract, and
4
- * the settings for blending, inverting and generating ranges of colours.
3
+ * Parameters for color handling: hex, RGB and HSL values, the components to combine or extract, and
4
+ * the settings for blending, inverting and generating ranges of colors.
5
5
  */
6
6
  export declare namespace Color {
7
+ /**
8
+ * A hex color for `color.hexColor` and `color.hexToRgb`.
9
+ */
7
10
  class HexDto {
8
11
  constructor(color?: Base.Color);
9
12
  /**
10
- * Color hex
13
+ * The color as a hex text such as `#ff5733`, with or without the `#`.
11
14
  * @default #0000ff
12
15
  */
13
16
  color: Base.Color;
14
17
  }
18
+ /**
19
+ * An `{ r, g, b }` color with channels from 0 to 255, for `color.rgb255Color`.
20
+ */
15
21
  class Rgb255Dto {
16
22
  constructor(colorRgb?: Base.ColorRGB);
17
23
  /**
18
- * Color rgb
24
+ * The color object; each channel from 0 to 255.
19
25
  * @default { "r": 0, "g": 0, "b": 255 }
20
- * @min 0
21
- * @max 255
26
+ * @minimum 0
27
+ * @maximum 255
22
28
  */
23
29
  colorRgb: Base.ColorRGB;
24
30
  }
31
+ /**
32
+ * An `{ r, g, b }` color with channels from 0 to 1, for `color.rgb1Color`.
33
+ */
25
34
  class Rgb1Dto {
26
35
  constructor(colorRgb?: Base.ColorRGB);
27
36
  /**
28
- * Color rgb
37
+ * The color object; each channel from 0 to 1.
29
38
  * @default { "r": 0, "g": 0, "b": 1 }
30
- * @min 0
31
- * @max 1
39
+ * @minimum 0
40
+ * @maximum 1
32
41
  */
33
42
  colorRgb: Base.ColorRGB;
34
43
  }
44
+ /**
45
+ * An `{ r, g, b, a }` color with color channels from 0 to 255 and opacity from 0 to 1, for
46
+ * `color.rgba255Color`.
47
+ */
35
48
  class Rgba255Dto {
36
49
  constructor(colorRgba?: Base.ColorRGBA);
37
50
  /**
38
- * Color rgba
51
+ * The color object; `r`, `g` and `b` from 0 to 255 and `a` from 0 (transparent) to 1
52
+ * (opaque).
39
53
  * @default { "r": 0, "g": 0, "b": 255, "a": 1 }
40
- * @min 0
41
- * @max 255
54
+ * @minimum 0
55
+ * @maximum 255
42
56
  */
43
57
  colorRgba: Base.ColorRGBA;
44
58
  }
59
+ /**
60
+ * An `{ r, g, b, a }` color with every channel from 0 to 1, for `color.rgba1Color`.
61
+ */
45
62
  class Rgba1Dto {
46
63
  constructor(colorRgba?: Base.ColorRGBA);
47
64
  /**
48
- * Color rgba
65
+ * The color object; every channel from 0 to 1, `a` being 0 for transparent and 1 for
66
+ * opaque.
49
67
  * @default { "r": 0, "g": 0, "b": 1, "a": 1 }
50
- * @min 0
51
- * @max 1
68
+ * @minimum 0
69
+ * @maximum 1
52
70
  */
53
71
  colorRgba: Base.ColorRGBA;
54
72
  }
73
+ /**
74
+ * Separate red, green and blue values from 0 to 255, for color.rgbAtomic255Color.
75
+ */
55
76
  class RgbAttomic255Dto {
56
77
  constructor(r?: number, g?: number, b?: number);
57
78
  /**
58
- * Red component
79
+ * The red channel, from 0 to 255.
59
80
  * @default 0
60
81
  * @minimum 0
61
82
  * @maximum 255
62
83
  */
63
84
  r: number;
64
85
  /**
65
- * Green component
86
+ * The green channel, from 0 to 255.
66
87
  * @default 0
67
88
  * @minimum 0
68
89
  * @maximum 255
69
90
  */
70
91
  g: number;
71
92
  /**
72
- * Blue component
93
+ * The blue channel, from 0 to 255.
73
94
  * @default 255
74
95
  * @minimum 0
75
96
  * @maximum 255
76
97
  */
77
98
  b: number;
78
99
  }
100
+ /**
101
+ * Separate red, green, blue and alpha values from 0 to 255, for building a color.
102
+ */
79
103
  class RgbaAttomic255Dto {
80
104
  constructor(r?: number, g?: number, b?: number, a?: number);
81
105
  /**
82
- * Red component
106
+ * The red channel, from 0 to 255.
83
107
  * @default 0
84
108
  * @minimum 0
85
109
  * @maximum 255
86
110
  */
87
111
  r: number;
88
112
  /**
89
- * Green component
113
+ * The green channel, from 0 to 255.
90
114
  * @default 0
91
115
  * @minimum 0
92
116
  * @maximum 255
93
117
  */
94
118
  g: number;
95
119
  /**
96
- * Blue component
120
+ * The blue channel, from 0 to 255.
97
121
  * @default 255
98
122
  * @minimum 0
99
123
  * @maximum 255
100
124
  */
101
125
  b: number;
102
126
  /**
103
- * Alpha component
127
+ * The opacity, from 0 (transparent) to 1 (opaque).
104
128
  * @default 1
105
129
  * @minimum 0
106
130
  * @maximum 1
107
131
  */
108
132
  a: number;
109
133
  }
134
+ /**
135
+ * Separate red, green and blue values from 0 to 1, for color.rgbAtomic1Color.
136
+ */
110
137
  class RgbAttomic1Dto {
111
138
  constructor(r?: number, g?: number, b?: number);
112
139
  /**
113
- * Red component
140
+ * The red channel, from 0 to 1.
114
141
  * @default 0
115
142
  * @minimum 0
116
143
  * @maximum 1
117
144
  */
118
145
  r: number;
119
146
  /**
120
- * Green component
147
+ * The green channel, from 0 to 1.
121
148
  * @default 0
122
149
  * @minimum 0
123
150
  * @maximum 1
124
151
  */
125
152
  g: number;
126
153
  /**
127
- * Blue component
154
+ * The blue channel, from 0 to 1.
128
155
  * @default 1
129
156
  * @minimum 0
130
157
  * @maximum 1
131
158
  */
132
159
  b: number;
133
160
  }
161
+ /**
162
+ * Separate red, green, blue and alpha values from 0 to 1, for building a color.
163
+ */
134
164
  class RgbaAttomic1Dto {
135
165
  constructor(r?: number, g?: number, b?: number, a?: number);
136
166
  /**
137
- * Red component
167
+ * The red channel, from 0 to 1.
138
168
  * @default 0
139
169
  * @minimum 0
140
170
  * @maximum 1
141
171
  */
142
172
  r: number;
143
173
  /**
144
- * Green component
174
+ * The green channel, from 0 to 1.
145
175
  * @default 0
146
176
  * @minimum 0
147
177
  * @maximum 1
148
178
  */
149
179
  g: number;
150
180
  /**
151
- * Blue component
181
+ * The blue channel, from 0 to 1.
152
182
  * @default 1
153
183
  * @minimum 0
154
184
  * @maximum 1
155
185
  */
156
186
  b: number;
157
187
  /**
158
- * Alpha component
188
+ * The opacity, from 0 (transparent) to 1 (opaque).
159
189
  * @default 1
160
190
  * @minimum 0
161
191
  * @maximum 1
162
192
  */
163
193
  a: number;
164
194
  }
195
+ /**
196
+ * A hex color and a mode for `color.invert`.
197
+ */
165
198
  class InvertHexDto {
166
199
  constructor(color?: Base.Color);
167
200
  /**
168
- * Color hex
201
+ * The color to invert, as a hex text such as `#ff5733`.
169
202
  * @default #0000ff
170
203
  */
171
204
  color: Base.Color;
172
205
  /**
173
- * Choose to invert the color to black and white (useful for text color)
206
+ * When true, the result is black for a light color and white for a dark one instead of the
207
+ * exact inverse; useful for readable text.
174
208
  */
175
209
  blackAndWhite: boolean;
176
210
  }
211
+ /**
212
+ * A hex color and a target range for `color.hexToRgbMapped`, `color.getRedParam`,
213
+ * `color.getGreenParam` and `color.getBlueParam`.
214
+ */
177
215
  class HexDtoMapped {
178
216
  constructor(color?: Base.Color, from?: number, to?: number);
179
217
  /**
180
- * Color hex
218
+ * The color as a hex text such as `#ff5733`.
181
219
  * @default #0000ff
182
220
  */
183
221
  color: Base.Color;
184
222
  /**
185
- * From min bound
223
+ * The value a channel of 0 maps to.
186
224
  * @default 0
187
225
  * @minimum -Infinity
188
226
  * @maximum Infinity
@@ -190,7 +228,7 @@ export declare namespace Color {
190
228
  */
191
229
  from: number;
192
230
  /**
193
- * To max bound
231
+ * The value a channel of 255 maps to; 1 gives channels from 0 to 1.
194
232
  * @default 255
195
233
  * @minimum -Infinity
196
234
  * @maximum Infinity
@@ -198,15 +236,18 @@ export declare namespace Color {
198
236
  */
199
237
  to: number;
200
238
  }
239
+ /**
240
+ * An `{ r, g, b }` color and the range its channels use, for `color.rgbObjToHex`.
241
+ */
201
242
  class RGBObjectMaxDto {
202
243
  constructor(rgb?: Base.ColorRGB, max?: number);
203
244
  /**
204
- * Red value component
245
+ * The color object to convert.
205
246
  * @default undefined
206
247
  */
207
248
  rgb: Base.ColorRGB;
208
249
  /**
209
- * Min value of the range
250
+ * The lowest value a channel can have in this object, usually 0.
210
251
  * @default 0
211
252
  * @minimum 0
212
253
  * @maximum 255
@@ -214,7 +255,8 @@ export declare namespace Color {
214
255
  */
215
256
  min: number;
216
257
  /**
217
- * Max value, it would automatically be remapped to whatever is needed if lower comes in
258
+ * The highest value a channel can have in this object: 255 or 1; anything else is remapped
259
+ * to 0 to 255 first.
218
260
  * @default 255
219
261
  * @minimum 0
220
262
  * @maximum 255
@@ -222,10 +264,13 @@ export declare namespace Color {
222
264
  */
223
265
  max: number;
224
266
  }
267
+ /**
268
+ * Three channel values and the range they use, for `color.rgbToHex`.
269
+ */
225
270
  class RGBMinMaxDto {
226
271
  constructor(r?: number, g?: number, b?: number, min?: number, max?: number);
227
272
  /**
228
- * Red value component
273
+ * The red channel, within `min` to `max`.
229
274
  * @default 255
230
275
  * @minimum 0
231
276
  * @maximum 255
@@ -233,7 +278,7 @@ export declare namespace Color {
233
278
  */
234
279
  r: number;
235
280
  /**
236
- * Green value component
281
+ * The green channel, within `min` to `max`.
237
282
  * @default 255
238
283
  * @minimum 0
239
284
  * @maximum 255
@@ -241,15 +286,15 @@ export declare namespace Color {
241
286
  */
242
287
  g: number;
243
288
  /**
244
- * Blue value component
245
- * @default 255
246
- * @minimum 0
247
- * @maximum 255
248
- * @step 1
249
- */
289
+ * The blue channel, within `min` to `max`.
290
+ * @default 255
291
+ * @minimum 0
292
+ * @maximum 255
293
+ * @step 1
294
+ */
250
295
  b: number;
251
296
  /**
252
- * Min value of the range
297
+ * The lowest value a channel can have, usually 0.
253
298
  * @default 0
254
299
  * @minimum 0
255
300
  * @maximum 255
@@ -257,7 +302,8 @@ export declare namespace Color {
257
302
  */
258
303
  min: number;
259
304
  /**
260
- * Max value of the range
305
+ * The highest value a channel can have: 255 or 1; anything else is remapped to 0 to 255
306
+ * first.
261
307
  * @default 255
262
308
  * @minimum 0
263
309
  * @maximum 255
@@ -265,10 +311,13 @@ export declare namespace Color {
265
311
  */
266
312
  max: number;
267
313
  }
314
+ /**
315
+ * An `{ r, g, b }` color for `color.rgbToRed`, `color.rgbToGreen` and `color.rgbToBlue`.
316
+ */
268
317
  class RGBObjectDto {
269
318
  constructor(rgb?: Base.ColorRGB);
270
319
  /**
271
- * Red value component
320
+ * The color object to read a channel from.
272
321
  * @default undefined
273
322
  */
274
323
  rgb: Base.ColorRGB;