@bitbybit-dev/base 0.19.6 → 0.19.8

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 (61) hide show
  1. package/babel.config.cjs +0 -1
  2. package/{index.js → index.ts} +2 -1
  3. package/lib/api/inputs/base-inputs.ts +18 -0
  4. package/lib/api/inputs/{color-inputs.d.ts → color-inputs.ts} +48 -26
  5. package/lib/api/inputs/{lists-inputs.d.ts → lists-inputs.ts} +190 -91
  6. package/lib/api/inputs/{logic-inputs.d.ts → logic-inputs.ts} +46 -24
  7. package/lib/api/inputs/{math-inputs.d.ts → math-inputs.ts} +97 -53
  8. package/lib/api/inputs/{point-inputs.d.ts → point-inputs.ts} +168 -77
  9. package/lib/api/inputs/text-inputs.ts +108 -0
  10. package/lib/api/inputs/{transforms-inputs.d.ts → transforms-inputs.ts} +64 -35
  11. package/lib/api/inputs/{vector-inputs.d.ts → vector-inputs.ts} +104 -48
  12. package/lib/api/services/color.test.ts +86 -0
  13. package/lib/api/services/{color.js → color.ts} +34 -15
  14. package/lib/api/services/{geometry-helper.js → geometry-helper.ts} +43 -31
  15. package/lib/api/services/{index.d.ts → index.ts} +1 -1
  16. package/lib/api/services/lists.test.ts +612 -0
  17. package/lib/api/services/{lists.js → lists.ts} +83 -59
  18. package/lib/api/services/logic.test.ts +187 -0
  19. package/lib/api/services/{logic.js → logic.ts} +32 -24
  20. package/lib/api/services/math.test.ts +622 -0
  21. package/lib/api/services/{math.js → math.ts} +136 -71
  22. package/lib/api/services/{point.js → point.ts} +67 -32
  23. package/lib/api/services/text.test.ts +55 -0
  24. package/lib/api/services/{text.js → text.ts} +17 -7
  25. package/lib/api/services/{transforms.js → transforms.ts} +83 -37
  26. package/lib/api/services/vector.test.ts +360 -0
  27. package/lib/api/services/{vector.js → vector.ts} +80 -42
  28. package/lib/{index.d.ts → index.ts} +1 -0
  29. package/package.json +1 -1
  30. package/tsconfig.bitbybit.json +26 -0
  31. package/tsconfig.json +24 -0
  32. package/babel.config.d.cts +0 -5
  33. package/index.d.ts +0 -1
  34. package/lib/api/index.js +0 -1
  35. package/lib/api/inputs/base-inputs.d.ts +0 -35
  36. package/lib/api/inputs/base-inputs.js +0 -1
  37. package/lib/api/inputs/color-inputs.js +0 -164
  38. package/lib/api/inputs/index.js +0 -9
  39. package/lib/api/inputs/inputs.js +0 -9
  40. package/lib/api/inputs/lists-inputs.js +0 -576
  41. package/lib/api/inputs/logic-inputs.js +0 -111
  42. package/lib/api/inputs/math-inputs.js +0 -391
  43. package/lib/api/inputs/point-inputs.js +0 -521
  44. package/lib/api/inputs/text-inputs.d.ts +0 -83
  45. package/lib/api/inputs/text-inputs.js +0 -120
  46. package/lib/api/inputs/transforms-inputs.js +0 -200
  47. package/lib/api/inputs/vector-inputs.js +0 -304
  48. package/lib/api/services/color.d.ts +0 -114
  49. package/lib/api/services/geometry-helper.d.ts +0 -15
  50. package/lib/api/services/index.js +0 -9
  51. package/lib/api/services/lists.d.ts +0 -287
  52. package/lib/api/services/logic.d.ts +0 -99
  53. package/lib/api/services/math.d.ts +0 -349
  54. package/lib/api/services/point.d.ts +0 -222
  55. package/lib/api/services/text.d.ts +0 -69
  56. package/lib/api/services/transforms.d.ts +0 -122
  57. package/lib/api/services/vector.d.ts +0 -320
  58. package/lib/index.js +0 -1
  59. /package/lib/api/{index.d.ts → index.ts} +0 -0
  60. /package/lib/api/inputs/{index.d.ts → index.ts} +0 -0
  61. /package/lib/api/inputs/{inputs.d.ts → inputs.ts} +0 -0
@@ -1,200 +0,0 @@
1
- export var Transforms;
2
- (function (Transforms) {
3
- class RotationCenterAxisDto {
4
- constructor(angle, axis, center) {
5
- /**
6
- * Angle of rotation in degrees
7
- * @default 90
8
- * @minimum -Infinity
9
- * @maximum Infinity
10
- * @step 1
11
- */
12
- this.angle = 90;
13
- /**
14
- * Axis vector for rotation
15
- * @default [0, 1, 0]
16
- */
17
- this.axis = [0, 1, 0];
18
- /**
19
- * The center from which the axis is pointing
20
- * @default [0, 0, 0]
21
- */
22
- this.center = [0, 0, 0];
23
- if (angle !== undefined) {
24
- this.angle = angle;
25
- }
26
- if (axis !== undefined) {
27
- this.axis = axis;
28
- }
29
- if (center !== undefined) {
30
- this.center = center;
31
- }
32
- }
33
- }
34
- Transforms.RotationCenterAxisDto = RotationCenterAxisDto;
35
- class RotationCenterDto {
36
- constructor(angle, center) {
37
- /**
38
- * Angle of rotation in degrees
39
- * @default 90
40
- * @minimum -Infinity
41
- * @maximum Infinity
42
- * @step 1
43
- */
44
- this.angle = 90;
45
- /**
46
- * The center from which the axis is pointing
47
- * @default [0, 0, 0]
48
- */
49
- this.center = [0, 0, 0];
50
- if (angle !== undefined) {
51
- this.angle = angle;
52
- }
53
- if (center !== undefined) {
54
- this.center = center;
55
- }
56
- }
57
- }
58
- Transforms.RotationCenterDto = RotationCenterDto;
59
- class RotationCenterYawPitchRollDto {
60
- constructor(yaw, pitch, roll, center) {
61
- /**
62
- * Yaw angle (Rotation around X) in degrees
63
- * @default 0
64
- * @minimum -Infinity
65
- * @maximum Infinity
66
- * @step 1
67
- */
68
- this.yaw = 0;
69
- /**
70
- * Pitch angle (Rotation around Y) in degrees
71
- * @default 0
72
- * @minimum -Infinity
73
- * @maximum Infinity
74
- * @step 1
75
- */
76
- this.pitch = 0;
77
- /**
78
- * Roll angle (Rotation around Z) in degrees
79
- * @default 0
80
- * @minimum -Infinity
81
- * @maximum Infinity
82
- * @step 1
83
- */
84
- this.roll = 0;
85
- /**
86
- * The center from which the rotations are applied
87
- * @default [0, 0, 0]
88
- */
89
- this.center = [0, 0, 0];
90
- if (yaw !== undefined) {
91
- this.yaw = yaw;
92
- }
93
- if (pitch !== undefined) {
94
- this.pitch = pitch;
95
- }
96
- if (roll !== undefined) {
97
- this.roll = roll;
98
- }
99
- if (center !== undefined) {
100
- this.center = center;
101
- }
102
- }
103
- }
104
- Transforms.RotationCenterYawPitchRollDto = RotationCenterYawPitchRollDto;
105
- class ScaleXYZDto {
106
- constructor(scaleXyz) {
107
- /**
108
- * Scaling factors for each axis [1, 2, 1] means that Y axis will be scaled 200% and both x and z axis will remain on 100%
109
- * @default [1, 1, 1]
110
- */
111
- this.scaleXyz = [1, 1, 1];
112
- if (scaleXyz !== undefined) {
113
- this.scaleXyz = scaleXyz;
114
- }
115
- }
116
- }
117
- Transforms.ScaleXYZDto = ScaleXYZDto;
118
- class ScaleCenterXYZDto {
119
- constructor(center, scaleXyz) {
120
- /**
121
- * The center from which the scaling is applied
122
- * @default [0, 0, 0]
123
- */
124
- this.center = [0, 0, 0];
125
- /**
126
- * Scaling factors for each axis [1, 2, 1] means that Y axis will be scaled 200% and both x and z axis will remain on 100%
127
- * @default [1, 1, 1]
128
- */
129
- this.scaleXyz = [1, 1, 1];
130
- if (center !== undefined) {
131
- this.center = center;
132
- }
133
- if (scaleXyz !== undefined) {
134
- this.scaleXyz = scaleXyz;
135
- }
136
- }
137
- }
138
- Transforms.ScaleCenterXYZDto = ScaleCenterXYZDto;
139
- class UniformScaleDto {
140
- constructor(scale) {
141
- /**
142
- * Uniform scale factor for all x, y, z directions. 1 will keep everything on original size, 2 will scale 200%;
143
- * @default 1
144
- * @minimum -Infinity
145
- * @maximum Infinity
146
- * @step 0.1
147
- */
148
- this.scale = 1;
149
- if (scale !== undefined) {
150
- this.scale = scale;
151
- }
152
- }
153
- }
154
- Transforms.UniformScaleDto = UniformScaleDto;
155
- class UniformScaleFromCenterDto {
156
- constructor(scale, center) {
157
- /**
158
- * Scale factor for all x, y, z directions. 1 will keep everything on original size, 2 will scale 200%;
159
- * @default 1
160
- * @minimum -Infinity
161
- * @maximum Infinity
162
- * @step 0.1
163
- */
164
- this.scale = 1;
165
- /**
166
- * Center position of the scaling
167
- * @default [0, 0, 0]
168
- */
169
- this.center = [0, 0, 0];
170
- if (scale !== undefined) {
171
- this.scale = scale;
172
- }
173
- if (center !== undefined) {
174
- this.center = center;
175
- }
176
- }
177
- }
178
- Transforms.UniformScaleFromCenterDto = UniformScaleFromCenterDto;
179
- class TranslationXYZDto {
180
- constructor(translation) {
181
- /**
182
- * Translation vector with [x, y, z] distances
183
- * @default [0, 0, 0]
184
- */
185
- this.translation = [0, 0, 0];
186
- if (translation !== undefined) {
187
- this.translation = translation;
188
- }
189
- }
190
- }
191
- Transforms.TranslationXYZDto = TranslationXYZDto;
192
- class TranslationsXYZDto {
193
- constructor(translations) {
194
- if (translations !== undefined) {
195
- this.translations = translations;
196
- }
197
- }
198
- }
199
- Transforms.TranslationsXYZDto = TranslationsXYZDto;
200
- })(Transforms || (Transforms = {}));
@@ -1,304 +0,0 @@
1
- import { Math } from "./inputs";
2
- export var Vector;
3
- (function (Vector) {
4
- class TwoVectorsDto {
5
- constructor(first, second) {
6
- if (first !== undefined) {
7
- this.first = first;
8
- }
9
- if (second !== undefined) {
10
- this.second = second;
11
- }
12
- }
13
- }
14
- Vector.TwoVectorsDto = TwoVectorsDto;
15
- class VectorBoolDto {
16
- constructor(vector) {
17
- if (vector !== undefined) {
18
- this.vector = vector;
19
- }
20
- }
21
- }
22
- Vector.VectorBoolDto = VectorBoolDto;
23
- class RemoveAllDuplicateVectorsDto {
24
- constructor(vectors, tolerance) {
25
- /**
26
- * Tolerance value
27
- * @default 1e-7
28
- * @minimum 0
29
- * @maximum Infinity
30
- */
31
- this.tolerance = 1e-7;
32
- if (vectors !== undefined) {
33
- this.vectors = vectors;
34
- }
35
- if (tolerance !== undefined) {
36
- this.tolerance = tolerance;
37
- }
38
- }
39
- }
40
- Vector.RemoveAllDuplicateVectorsDto = RemoveAllDuplicateVectorsDto;
41
- class RemoveConsecutiveDuplicateVectorsDto {
42
- constructor(vectors, checkFirstAndLast, tolerance) {
43
- /**
44
- * Check first and last vectors
45
- * @default false
46
- */
47
- this.checkFirstAndLast = false;
48
- /**
49
- * Tolerance value
50
- * @default 1e-7
51
- * @minimum 0
52
- * @maximum Infinity
53
- */
54
- this.tolerance = 1e-7;
55
- if (vectors !== undefined) {
56
- this.vectors = vectors;
57
- }
58
- if (checkFirstAndLast !== undefined) {
59
- this.checkFirstAndLast = checkFirstAndLast;
60
- }
61
- if (tolerance !== undefined) {
62
- this.tolerance = tolerance;
63
- }
64
- }
65
- }
66
- Vector.RemoveConsecutiveDuplicateVectorsDto = RemoveConsecutiveDuplicateVectorsDto;
67
- class VectorDto {
68
- constructor(vector) {
69
- if (vector !== undefined) {
70
- this.vector = vector;
71
- }
72
- }
73
- }
74
- Vector.VectorDto = VectorDto;
75
- class RangeMaxDto {
76
- constructor(max) {
77
- if (max !== undefined) {
78
- this.max = max;
79
- }
80
- }
81
- }
82
- Vector.RangeMaxDto = RangeMaxDto;
83
- class VectorXYZDto {
84
- constructor(x, y, z) {
85
- if (x !== undefined) {
86
- this.x = x;
87
- }
88
- if (y !== undefined) {
89
- this.y = y;
90
- }
91
- if (z !== undefined) {
92
- this.z = z;
93
- }
94
- }
95
- }
96
- Vector.VectorXYZDto = VectorXYZDto;
97
- class VectorXYDto {
98
- constructor(x, y) {
99
- if (x !== undefined) {
100
- this.x = x;
101
- }
102
- if (y !== undefined) {
103
- this.y = y;
104
- }
105
- }
106
- }
107
- Vector.VectorXYDto = VectorXYDto;
108
- class SpanDto {
109
- constructor(step, min, max) {
110
- /**
111
- * Step of the span
112
- * @default 0.1
113
- * @minimum -Infinity
114
- * @maximum Infinity
115
- * @step 0.1
116
- */
117
- this.step = 0.1;
118
- /**
119
- * Min value of the span
120
- * @default 0
121
- * @minimum -Infinity
122
- * @maximum Infinity
123
- * @step 1
124
- */
125
- this.min = 0;
126
- /**
127
- * Max value of the span
128
- * @default 1
129
- * @minimum -Infinity
130
- * @maximum Infinity
131
- * @step 1
132
- */
133
- this.max = 1;
134
- if (step !== undefined) {
135
- this.step = step;
136
- }
137
- if (min !== undefined) {
138
- this.min = min;
139
- }
140
- if (max !== undefined) {
141
- this.max = max;
142
- }
143
- }
144
- }
145
- Vector.SpanDto = SpanDto;
146
- class SpanEaseItemsDto {
147
- constructor(nrItems, min, max, ease) {
148
- /**
149
- * Nr of items in the span
150
- * @default 100
151
- * @minimum 2
152
- * @maximum Infinity
153
- * @step 1
154
- */
155
- this.nrItems = 100;
156
- /**
157
- * Min value of the span
158
- * @default 0
159
- * @minimum -Infinity
160
- * @maximum Infinity
161
- * @step 1
162
- */
163
- this.min = 0;
164
- /**
165
- * Max value of the span
166
- * @default 1
167
- * @minimum -Infinity
168
- * @maximum Infinity
169
- * @step 1
170
- */
171
- this.max = 1;
172
- /**
173
- * Ease type
174
- * @default easeInSine
175
- */
176
- this.ease = Math.easeEnum.easeInSine;
177
- /**
178
- * Indicates wether only intervals should be outputed. This will output step lengths between the values.
179
- * @default false
180
- */
181
- this.intervals = false;
182
- if (nrItems !== undefined) {
183
- this.nrItems = nrItems;
184
- }
185
- if (min !== undefined) {
186
- this.min = min;
187
- }
188
- if (max !== undefined) {
189
- this.max = max;
190
- }
191
- if (ease !== undefined) {
192
- this.ease = ease;
193
- }
194
- }
195
- }
196
- Vector.SpanEaseItemsDto = SpanEaseItemsDto;
197
- class SpanLinearItemsDto {
198
- constructor(nrItems, min, max) {
199
- /**
200
- * Nr of items in the span
201
- * @default 100
202
- * @minimum 2
203
- * @maximum Infinity
204
- * @step 1
205
- */
206
- this.nrItems = 100;
207
- /**
208
- * Min value of the span
209
- * @default 0
210
- * @minimum -Infinity
211
- * @maximum Infinity
212
- * @step 1
213
- */
214
- this.min = 0;
215
- /**
216
- * Max value of the span
217
- * @default 1
218
- * @minimum -Infinity
219
- * @maximum Infinity
220
- * @step 1
221
- */
222
- this.max = 1;
223
- if (nrItems !== undefined) {
224
- this.nrItems = nrItems;
225
- }
226
- if (min !== undefined) {
227
- this.min = min;
228
- }
229
- if (max !== undefined) {
230
- this.max = max;
231
- }
232
- }
233
- }
234
- Vector.SpanLinearItemsDto = SpanLinearItemsDto;
235
- class RayPointDto {
236
- constructor(point, distance, vector) {
237
- if (point !== undefined) {
238
- this.point = point;
239
- }
240
- if (distance !== undefined) {
241
- this.distance = distance;
242
- }
243
- if (vector !== undefined) {
244
- this.vector = vector;
245
- }
246
- }
247
- }
248
- Vector.RayPointDto = RayPointDto;
249
- class VectorsDto {
250
- constructor(vectors) {
251
- if (vectors !== undefined) {
252
- this.vectors = vectors;
253
- }
254
- }
255
- }
256
- Vector.VectorsDto = VectorsDto;
257
- class FractionTwoVectorsDto {
258
- constructor(fraction, first, second) {
259
- /**
260
- * Fraction number
261
- * @default 0.5
262
- * @minimum -Infinity
263
- * @maximum Infinity
264
- * @step 0.1
265
- */
266
- this.fraction = 0.5;
267
- if (fraction !== undefined) {
268
- this.fraction = fraction;
269
- }
270
- if (first !== undefined) {
271
- this.first = first;
272
- }
273
- if (second !== undefined) {
274
- this.second = second;
275
- }
276
- }
277
- }
278
- Vector.FractionTwoVectorsDto = FractionTwoVectorsDto;
279
- class VectorScalarDto {
280
- constructor(scalar, vector) {
281
- if (scalar !== undefined) {
282
- this.scalar = scalar;
283
- }
284
- if (vector !== undefined) {
285
- this.vector = vector;
286
- }
287
- }
288
- }
289
- Vector.VectorScalarDto = VectorScalarDto;
290
- class TwoVectorsReferenceDto {
291
- constructor(reference, first, second) {
292
- if (reference !== undefined) {
293
- this.reference = reference;
294
- }
295
- if (first !== undefined) {
296
- this.first = first;
297
- }
298
- if (second !== undefined) {
299
- this.second = second;
300
- }
301
- }
302
- }
303
- Vector.TwoVectorsReferenceDto = TwoVectorsReferenceDto;
304
- })(Vector || (Vector = {}));
@@ -1,114 +0,0 @@
1
- import * as Inputs from "../inputs";
2
- import { MathBitByBit } from "./math";
3
- export declare class Color {
4
- private readonly math;
5
- constructor(math: MathBitByBit);
6
- /**
7
- * Creates a hex color
8
- * @param inputs Color hex
9
- * @returns color string
10
- * @group create
11
- * @shortname color
12
- * @drawable false
13
- */
14
- hexColor(inputs: Inputs.Color.HexDto): Inputs.Base.Color;
15
- /**
16
- * Creates rgb color from hex
17
- * @param inputs Color hex
18
- * @returns rgb color
19
- * @group convert
20
- * @shortname hex to rgb
21
- * @drawable false
22
- */
23
- hexToRgb(inputs: Inputs.Color.HexDto): Inputs.Base.ColorRGB;
24
- /**
25
- * Creates hex color from rgb
26
- * @param inputs Color hext
27
- * @returns hex color
28
- * @group convert
29
- * @shortname rgb to hex
30
- * @drawable false
31
- */
32
- rgbToHex(inputs: Inputs.Color.RGBMinMaxDto): Inputs.Base.Color;
33
- /**
34
- * Creates hex color from rgb obj that contains {r, g, b} properties in certain range
35
- * @param inputs Color hext
36
- * @returns hex color string
37
- * @group convert
38
- * @shortname rgb obj to hex
39
- * @drawable false
40
- */
41
- rgbObjToHex(inputs: Inputs.Color.RGBObjectMaxDto): Inputs.Base.Color;
42
- /**
43
- * Creates rgb color from hex and maps to different range if needed
44
- * @param inputs Color hext
45
- * @returns rgb color
46
- * @group convert
47
- * @shortname hex to rgb mapped
48
- * @drawable false
49
- */
50
- hexToRgbMapped(inputs: Inputs.Color.HexDtoMapped): Inputs.Base.ColorRGB;
51
- /**
52
- * Get red param
53
- * @param inputs Color hext
54
- * @returns rgb color
55
- * @group hex to
56
- * @shortname red
57
- * @drawable false
58
- */
59
- getRedParam(inputs: Inputs.Color.HexDtoMapped): number;
60
- /**
61
- * Get green param
62
- * @param inputs Color hext
63
- * @returns rgb color
64
- * @group hex to
65
- * @shortname green
66
- * @drawable false
67
- */
68
- getGreenParam(inputs: Inputs.Color.HexDtoMapped): number;
69
- /**
70
- * Get blue param
71
- * @param inputs Color hext
72
- * @returns blue param
73
- * @group hex to
74
- * @shortname blue
75
- * @drawable false
76
- */
77
- getBlueParam(inputs: Inputs.Color.HexDtoMapped): number;
78
- /**
79
- * RGB to red
80
- * @param inputs Color rgb
81
- * @returns red param
82
- * @group rgb to
83
- * @shortname red
84
- * @drawable false
85
- */
86
- rgbToRed(inputs: Inputs.Color.RGBObjectDto): number;
87
- /**
88
- * RGB to green
89
- * @param inputs Color rgb
90
- * @returns green param
91
- * @group rgb to
92
- * @shortname green
93
- * @drawable false
94
- */
95
- rgbToGreen(inputs: Inputs.Color.RGBObjectDto): number;
96
- /**
97
- * RGB to blue
98
- * @param inputs Color rgb
99
- * @returns blue param
100
- * @group rgb to
101
- * @shortname blue
102
- * @drawable false
103
- */
104
- rgbToBlue(inputs: Inputs.Color.RGBObjectDto): number;
105
- /**
106
- * Invert color
107
- * @param inputs hex color and black and white option
108
- * @returns inverted color
109
- * @group hex to
110
- * @shortname invert color
111
- * @drawable false
112
- */
113
- invert(inputs: Inputs.Color.InvertHexDto): Inputs.Base.Color;
114
- }
@@ -1,15 +0,0 @@
1
- import * as Inputs from "../inputs";
2
- export declare class GeometryHelper {
3
- transformControlPoints(transformation: number[][] | number[][][], transformedControlPoints: Inputs.Base.Point3[]): Inputs.Base.Point3[];
4
- getFlatTransformations(transformation: number[][] | number[][][]): number[][];
5
- getArrayDepth: (value: any) => number;
6
- transformPointsByMatrixArray(points: Inputs.Base.Point3[], transform: number[]): Inputs.Base.Point3[];
7
- transformPointsCoordinates(points: Inputs.Base.Point3[], transform: number[]): Inputs.Base.Point3[];
8
- removeAllDuplicateVectors(vectors: number[][], tolerance?: number): number[][];
9
- removeConsecutiveVectorDuplicates(vectors: number[][], checkFirstAndLast?: boolean, tolerance?: number): number[][];
10
- vectorsTheSame(vec1: number[], vec2: number[], tolerance: number): boolean;
11
- approxEq(num1: number, num2: number, tolerance: number): boolean;
12
- removeConsecutivePointDuplicates(points: Inputs.Base.Point3[], checkFirstAndLast?: boolean, tolerance?: number): Inputs.Base.Point3[];
13
- arePointsTheSame(pointA: Inputs.Base.Point3 | Inputs.Base.Point2, pointB: Inputs.Base.Point3 | Inputs.Base.Point2, tolerance: number): boolean;
14
- private transformCoordinates;
15
- }
@@ -1,9 +0,0 @@
1
- export * from "./color";
2
- export * from "./lists";
3
- export * from "./logic";
4
- export * from "./math";
5
- export * from "./point";
6
- export * from "./text";
7
- export * from "./vector";
8
- export * from "./transforms";
9
- export * from "./geometry-helper";