@bitbybit-dev/base 0.19.8 → 0.20.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 (65) hide show
  1. package/babel.config.cjs +1 -0
  2. package/babel.config.d.cts +5 -0
  3. package/index.d.ts +1 -0
  4. package/{index.ts → index.js} +1 -2
  5. package/lib/api/index.js +1 -0
  6. package/lib/api/inputs/base-inputs.d.ts +35 -0
  7. package/lib/api/inputs/base-inputs.js +1 -0
  8. package/lib/api/inputs/{color-inputs.ts → color-inputs.d.ts} +26 -48
  9. package/lib/api/inputs/color-inputs.js +164 -0
  10. package/lib/api/inputs/dates-inputs.d.ts +216 -0
  11. package/lib/api/inputs/dates-inputs.js +271 -0
  12. package/lib/api/inputs/{index.ts → index.d.ts} +1 -0
  13. package/lib/api/inputs/index.js +10 -0
  14. package/lib/api/inputs/{inputs.ts → inputs.d.ts} +1 -0
  15. package/lib/api/inputs/inputs.js +10 -0
  16. package/lib/api/inputs/{lists-inputs.ts → lists-inputs.d.ts} +91 -190
  17. package/lib/api/inputs/lists-inputs.js +576 -0
  18. package/lib/api/inputs/{logic-inputs.ts → logic-inputs.d.ts} +24 -46
  19. package/lib/api/inputs/logic-inputs.js +111 -0
  20. package/lib/api/inputs/{math-inputs.ts → math-inputs.d.ts} +53 -97
  21. package/lib/api/inputs/math-inputs.js +391 -0
  22. package/lib/api/inputs/{point-inputs.ts → point-inputs.d.ts} +77 -168
  23. package/lib/api/inputs/point-inputs.js +521 -0
  24. package/lib/api/inputs/text-inputs.d.ts +83 -0
  25. package/lib/api/inputs/text-inputs.js +120 -0
  26. package/lib/api/inputs/{transforms-inputs.ts → transforms-inputs.d.ts} +35 -64
  27. package/lib/api/inputs/transforms-inputs.js +200 -0
  28. package/lib/api/inputs/{vector-inputs.ts → vector-inputs.d.ts} +48 -104
  29. package/lib/api/inputs/vector-inputs.js +304 -0
  30. package/lib/api/services/color.d.ts +114 -0
  31. package/lib/api/services/{color.ts → color.js} +15 -34
  32. package/lib/api/services/dates.d.ts +367 -0
  33. package/lib/api/services/dates.js +450 -0
  34. package/lib/api/services/geometry-helper.d.ts +15 -0
  35. package/lib/api/services/{geometry-helper.ts → geometry-helper.js} +31 -43
  36. package/lib/api/services/{index.ts → index.d.ts} +2 -1
  37. package/lib/api/services/index.js +10 -0
  38. package/lib/api/services/lists.d.ts +287 -0
  39. package/lib/api/services/{lists.ts → lists.js} +59 -83
  40. package/lib/api/services/logic.d.ts +99 -0
  41. package/lib/api/services/{logic.ts → logic.js} +24 -32
  42. package/lib/api/services/math.d.ts +349 -0
  43. package/lib/api/services/{math.ts → math.js} +71 -136
  44. package/lib/api/services/point.d.ts +222 -0
  45. package/lib/api/services/{point.ts → point.js} +32 -67
  46. package/lib/api/services/text.d.ts +69 -0
  47. package/lib/api/services/{text.ts → text.js} +7 -17
  48. package/lib/api/services/transforms.d.ts +122 -0
  49. package/lib/api/services/{transforms.ts → transforms.js} +37 -83
  50. package/lib/api/services/vector.d.ts +320 -0
  51. package/lib/api/services/{vector.ts → vector.js} +42 -80
  52. package/lib/{index.ts → index.d.ts} +0 -1
  53. package/lib/index.js +1 -0
  54. package/package.json +1 -1
  55. package/lib/api/inputs/base-inputs.ts +0 -18
  56. package/lib/api/inputs/text-inputs.ts +0 -108
  57. package/lib/api/services/color.test.ts +0 -86
  58. package/lib/api/services/lists.test.ts +0 -612
  59. package/lib/api/services/logic.test.ts +0 -187
  60. package/lib/api/services/math.test.ts +0 -622
  61. package/lib/api/services/text.test.ts +0 -55
  62. package/lib/api/services/vector.test.ts +0 -360
  63. package/tsconfig.bitbybit.json +0 -26
  64. package/tsconfig.json +0 -24
  65. /package/lib/api/{index.ts → index.d.ts} +0 -0
package/babel.config.cjs CHANGED
@@ -11,3 +11,4 @@ module.exports = {
11
11
  '@babel/preset-typescript'
12
12
  ],
13
13
  };
14
+ export {};
@@ -0,0 +1,5 @@
1
+ export const presets: (string | (string | {
2
+ targets: {
3
+ node: string;
4
+ };
5
+ })[])[];
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./lib";
@@ -1,5 +1,4 @@
1
1
  /*
2
2
  * Public API Surface of bitbybit-core
3
3
  */
4
-
5
- export * from "./lib";
4
+ export * from "./lib";
@@ -0,0 +1 @@
1
+ export * from "./services";
@@ -0,0 +1,35 @@
1
+ export declare namespace Base {
2
+ type Color = string;
3
+ type ColorRGB = {
4
+ r: number;
5
+ g: number;
6
+ b: number;
7
+ };
8
+ type Material = any;
9
+ type Point2 = [number, number];
10
+ type Vector2 = [number, number];
11
+ type Point3 = [number, number, number];
12
+ type Vector3 = [number, number, number];
13
+ type Line2 = {
14
+ start: Base.Point2;
15
+ end: Base.Point2;
16
+ };
17
+ type Line3 = {
18
+ start: Base.Point3;
19
+ end: Base.Point3;
20
+ };
21
+ type Polyline3 = {
22
+ points: Base.Point3[];
23
+ isClosed?: boolean;
24
+ color?: number[];
25
+ };
26
+ type Polyline2 = {
27
+ points: Base.Point2[];
28
+ isClosed?: boolean;
29
+ color?: number[];
30
+ };
31
+ type TransformMatrix3x3 = [number, number, number, number, number, number, number, number, number];
32
+ type TransformMatrixes3x3 = TransformMatrix3x3[];
33
+ type TransformMatrix = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
34
+ type TransformMatrixes = TransformMatrix[];
35
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,43 +1,32 @@
1
- /* eslint-disable @typescript-eslint/no-namespace */
2
1
  import { Base } from "./base-inputs";
3
-
4
- // tslint:disable-next-line: no-namespace
5
- export namespace Color {
6
- export class HexDto {
7
- constructor(color?: Base.Color) {
8
- if (color !== undefined) { this.color = color; }
9
- }
2
+ export declare namespace Color {
3
+ class HexDto {
4
+ constructor(color?: Base.Color);
10
5
  /**
11
6
  * Color hex
12
7
  * @default #0000ff
13
8
  */
14
- color: Base.Color = "#0000ff";
9
+ color: Base.Color;
15
10
  }
16
- export class InvertHexDto {
17
- constructor(color?: Base.Color) {
18
- if (color !== undefined) { this.color = color; }
19
- }
11
+ class InvertHexDto {
12
+ constructor(color?: Base.Color);
20
13
  /**
21
14
  * Color hex
22
15
  * @default #0000ff
23
16
  */
24
- color: Base.Color = "#0000ff";
17
+ color: Base.Color;
25
18
  /**
26
19
  * Choose to invert the color to black and white (useful for text color)
27
20
  */
28
- blackAndWhite = false;
21
+ blackAndWhite: boolean;
29
22
  }
30
- export class HexDtoMapped {
31
- constructor(color?: Base.Color, from?: number, to?: number) {
32
- if (color !== undefined) { this.color = color; }
33
- if (from !== undefined) { this.from = from; }
34
- if (to !== undefined) { this.to = to; }
35
- }
23
+ class HexDtoMapped {
24
+ constructor(color?: Base.Color, from?: number, to?: number);
36
25
  /**
37
26
  * Color hex
38
27
  * @default #0000ff
39
28
  */
40
- color: Base.Color = "#0000ff";
29
+ color: Base.Color;
41
30
  /**
42
31
  * From min bound
43
32
  * @default 0
@@ -45,7 +34,7 @@ export namespace Color {
45
34
  * @maximum Infinity
46
35
  * @step 1
47
36
  */
48
- from = 0;
37
+ from: number;
49
38
  /**
50
39
  * To max bound
51
40
  * @default 255
@@ -53,13 +42,10 @@ export namespace Color {
53
42
  * @maximum Infinity
54
43
  * @step 1
55
44
  */
56
- to = 255;
45
+ to: number;
57
46
  }
58
- export class RGBObjectMaxDto {
59
- constructor(rgb?: Base.ColorRGB, max?: number) {
60
- if (rgb !== undefined) { this.rgb = rgb; }
61
- if (max !== undefined) { this.max = max; }
62
- }
47
+ class RGBObjectMaxDto {
48
+ constructor(rgb?: Base.ColorRGB, max?: number);
63
49
  /**
64
50
  * Red value component
65
51
  * @default undefined
@@ -72,7 +58,7 @@ export namespace Color {
72
58
  * @maximum 255
73
59
  * @step 0.1
74
60
  */
75
- min = 0;
61
+ min: number;
76
62
  /**
77
63
  * Max value, it would automatically be remapped to whatever is needed if lower comes in
78
64
  * @default 255
@@ -80,16 +66,10 @@ export namespace Color {
80
66
  * @maximum 255
81
67
  * @step 0.1
82
68
  */
83
- max = 255;
69
+ max: number;
84
70
  }
85
- export class RGBMinMaxDto {
86
- constructor(r?: number, g?: number, b?: number, min?: number, max?: number) {
87
- if (r !== undefined) { this.r = r; }
88
- if (g !== undefined) { this.g = g; }
89
- if (b !== undefined) { this.b = b; }
90
- if (min !== undefined) { this.min = min; }
91
- if (max !== undefined) { this.max = max; }
92
- }
71
+ class RGBMinMaxDto {
72
+ constructor(r?: number, g?: number, b?: number, min?: number, max?: number);
93
73
  /**
94
74
  * Red value component
95
75
  * @default 255
@@ -97,7 +77,7 @@ export namespace Color {
97
77
  * @maximum 255
98
78
  * @step 1
99
79
  */
100
- r = 255;
80
+ r: number;
101
81
  /**
102
82
  * Green value component
103
83
  * @default 255
@@ -105,7 +85,7 @@ export namespace Color {
105
85
  * @maximum 255
106
86
  * @step 1
107
87
  */
108
- g = 255;
88
+ g: number;
109
89
  /**
110
90
  * Blue value component
111
91
  * @default 255
@@ -113,7 +93,7 @@ export namespace Color {
113
93
  * @maximum 255
114
94
  * @step 1
115
95
  */
116
- b = 255;
96
+ b: number;
117
97
  /**
118
98
  * Min value of the range
119
99
  * @default 0
@@ -121,7 +101,7 @@ export namespace Color {
121
101
  * @maximum 255
122
102
  * @step 0.1
123
103
  */
124
- min = 0;
104
+ min: number;
125
105
  /**
126
106
  * Max value of the range
127
107
  * @default 255
@@ -129,12 +109,10 @@ export namespace Color {
129
109
  * @maximum 255
130
110
  * @step 0.1
131
111
  */
132
- max = 255;
112
+ max: number;
133
113
  }
134
- export class RGBObjectDto {
135
- constructor(rgb?: Base.ColorRGB) {
136
- if (rgb !== undefined) { this.rgb = rgb; }
137
- }
114
+ class RGBObjectDto {
115
+ constructor(rgb?: Base.ColorRGB);
138
116
  /**
139
117
  * Red value component
140
118
  * @default undefined
@@ -0,0 +1,164 @@
1
+ // tslint:disable-next-line: no-namespace
2
+ export var Color;
3
+ (function (Color) {
4
+ class HexDto {
5
+ constructor(color) {
6
+ /**
7
+ * Color hex
8
+ * @default #0000ff
9
+ */
10
+ this.color = "#0000ff";
11
+ if (color !== undefined) {
12
+ this.color = color;
13
+ }
14
+ }
15
+ }
16
+ Color.HexDto = HexDto;
17
+ class InvertHexDto {
18
+ constructor(color) {
19
+ /**
20
+ * Color hex
21
+ * @default #0000ff
22
+ */
23
+ this.color = "#0000ff";
24
+ /**
25
+ * Choose to invert the color to black and white (useful for text color)
26
+ */
27
+ this.blackAndWhite = false;
28
+ if (color !== undefined) {
29
+ this.color = color;
30
+ }
31
+ }
32
+ }
33
+ Color.InvertHexDto = InvertHexDto;
34
+ class HexDtoMapped {
35
+ constructor(color, from, to) {
36
+ /**
37
+ * Color hex
38
+ * @default #0000ff
39
+ */
40
+ this.color = "#0000ff";
41
+ /**
42
+ * From min bound
43
+ * @default 0
44
+ * @minimum -Infinity
45
+ * @maximum Infinity
46
+ * @step 1
47
+ */
48
+ this.from = 0;
49
+ /**
50
+ * To max bound
51
+ * @default 255
52
+ * @minimum -Infinity
53
+ * @maximum Infinity
54
+ * @step 1
55
+ */
56
+ this.to = 255;
57
+ if (color !== undefined) {
58
+ this.color = color;
59
+ }
60
+ if (from !== undefined) {
61
+ this.from = from;
62
+ }
63
+ if (to !== undefined) {
64
+ this.to = to;
65
+ }
66
+ }
67
+ }
68
+ Color.HexDtoMapped = HexDtoMapped;
69
+ class RGBObjectMaxDto {
70
+ constructor(rgb, max) {
71
+ /**
72
+ * Min value of the range
73
+ * @default 0
74
+ * @minimum 0
75
+ * @maximum 255
76
+ * @step 0.1
77
+ */
78
+ this.min = 0;
79
+ /**
80
+ * Max value, it would automatically be remapped to whatever is needed if lower comes in
81
+ * @default 255
82
+ * @minimum 0
83
+ * @maximum 255
84
+ * @step 0.1
85
+ */
86
+ this.max = 255;
87
+ if (rgb !== undefined) {
88
+ this.rgb = rgb;
89
+ }
90
+ if (max !== undefined) {
91
+ this.max = max;
92
+ }
93
+ }
94
+ }
95
+ Color.RGBObjectMaxDto = RGBObjectMaxDto;
96
+ class RGBMinMaxDto {
97
+ constructor(r, g, b, min, max) {
98
+ /**
99
+ * Red value component
100
+ * @default 255
101
+ * @minimum 0
102
+ * @maximum 255
103
+ * @step 1
104
+ */
105
+ this.r = 255;
106
+ /**
107
+ * Green value component
108
+ * @default 255
109
+ * @minimum 0
110
+ * @maximum 255
111
+ * @step 1
112
+ */
113
+ this.g = 255;
114
+ /**
115
+ * Blue value component
116
+ * @default 255
117
+ * @minimum 0
118
+ * @maximum 255
119
+ * @step 1
120
+ */
121
+ this.b = 255;
122
+ /**
123
+ * Min value of the range
124
+ * @default 0
125
+ * @minimum 0
126
+ * @maximum 255
127
+ * @step 0.1
128
+ */
129
+ this.min = 0;
130
+ /**
131
+ * Max value of the range
132
+ * @default 255
133
+ * @minimum 0
134
+ * @maximum 255
135
+ * @step 0.1
136
+ */
137
+ this.max = 255;
138
+ if (r !== undefined) {
139
+ this.r = r;
140
+ }
141
+ if (g !== undefined) {
142
+ this.g = g;
143
+ }
144
+ if (b !== undefined) {
145
+ this.b = b;
146
+ }
147
+ if (min !== undefined) {
148
+ this.min = min;
149
+ }
150
+ if (max !== undefined) {
151
+ this.max = max;
152
+ }
153
+ }
154
+ }
155
+ Color.RGBMinMaxDto = RGBMinMaxDto;
156
+ class RGBObjectDto {
157
+ constructor(rgb) {
158
+ if (rgb !== undefined) {
159
+ this.rgb = rgb;
160
+ }
161
+ }
162
+ }
163
+ Color.RGBObjectDto = RGBObjectDto;
164
+ })(Color || (Color = {}));
@@ -0,0 +1,216 @@
1
+ export declare namespace Dates {
2
+ class DateDto {
3
+ constructor(date?: Date);
4
+ /**
5
+ * The date
6
+ * @default undefined
7
+ */
8
+ date: Date;
9
+ }
10
+ class DateStringDto {
11
+ constructor(dateString?: string);
12
+ /**
13
+ * The date string
14
+ * @default undefined
15
+ */
16
+ dateString: string;
17
+ }
18
+ class DateSecondsDto {
19
+ constructor(date?: Date, seconds?: number);
20
+ /**
21
+ * The date to update the seconds for
22
+ * @default undefined
23
+ */
24
+ date: Date;
25
+ /**
26
+ * The seconds of the date
27
+ * @default 30
28
+ * @minimum 0
29
+ * @maximum Infinity
30
+ * @step 1
31
+ */
32
+ seconds: number;
33
+ }
34
+ class DateDayDto {
35
+ constructor(date?: Date, day?: number);
36
+ /**
37
+ * The date
38
+ * @default undefined
39
+ */
40
+ date: Date;
41
+ /**
42
+ * The day of the date
43
+ * @default 1
44
+ * @minimum 0
45
+ * @maximum Infinity
46
+ * @step 1
47
+ */
48
+ day: number;
49
+ }
50
+ class DateYearDto {
51
+ constructor(date?: Date, year?: number);
52
+ /**
53
+ * The date
54
+ * @default undefined
55
+ */
56
+ date: Date;
57
+ /**
58
+ * The year of the date
59
+ * @default 1
60
+ * @minimum 0
61
+ * @maximum Infinity
62
+ * @step 1
63
+ */
64
+ year: number;
65
+ }
66
+ class DateMonthDto {
67
+ constructor(date?: Date, month?: number);
68
+ /**
69
+ * The date
70
+ * @default undefined
71
+ */
72
+ date: Date;
73
+ /**
74
+ * The month of the date
75
+ * @default 1
76
+ * @minimum 0
77
+ * @maximum Infinity
78
+ * @step 1
79
+ */
80
+ month: number;
81
+ }
82
+ class DateHoursDto {
83
+ constructor(date?: Date, hours?: number);
84
+ /**
85
+ * The date
86
+ * @default undefined
87
+ */
88
+ date: Date;
89
+ /**
90
+ * The hours of the date
91
+ * @default 1
92
+ * @minimum 0
93
+ * @maximum Infinity
94
+ * @step 1
95
+ */
96
+ hours: number;
97
+ }
98
+ class DateMinutesDto {
99
+ constructor(date?: Date, minutes?: number);
100
+ /**
101
+ * The date
102
+ * @default undefined
103
+ */
104
+ date: Date;
105
+ /**
106
+ * The minutes of the date
107
+ * @default 1
108
+ * @minimum 0
109
+ * @maximum Infinity
110
+ * @step 1
111
+ */
112
+ minutes: number;
113
+ }
114
+ class DateMillisecondsDto {
115
+ constructor(date?: Date, milliseconds?: number);
116
+ /**
117
+ * The date
118
+ * @default undefined
119
+ */
120
+ date: Date;
121
+ /**
122
+ * The milliseconds of the date
123
+ * @default 1
124
+ * @minimum 0
125
+ * @maximum Infinity
126
+ * @step 1
127
+ */
128
+ milliseconds: number;
129
+ }
130
+ class DateTimeDto {
131
+ constructor(date?: Date, time?: number);
132
+ /**
133
+ * The date
134
+ * @default undefined
135
+ */
136
+ date: Date;
137
+ /**
138
+ * The time of the date
139
+ * @default 1
140
+ * @minimum 0
141
+ * @maximum Infinity
142
+ * @step 1
143
+ */
144
+ time: number;
145
+ }
146
+ class CreateFromUnixTimeStampDto {
147
+ constructor(unixTimeStamp?: number);
148
+ /**
149
+ * The unix time stamp
150
+ * @default 1
151
+ * @minimum 0
152
+ * @maximum Infinity
153
+ * @step 1
154
+ */
155
+ unixTimeStamp: number;
156
+ }
157
+ class CreateDateDto {
158
+ constructor(year?: number, month?: number, day?: number, hours?: number, minutes?: number, seconds?: number, milliseconds?: number);
159
+ /**
160
+ * The year of the date
161
+ * @default 1
162
+ * @minimum 0
163
+ * @maximum Infinity
164
+ * @step 1
165
+ */
166
+ year: number;
167
+ /**
168
+ * The month of the date
169
+ * @default 1
170
+ * @minimum 0
171
+ * @maximum Infinity
172
+ * @step 1
173
+ */
174
+ month: number;
175
+ /**
176
+ * The day of the month
177
+ * @default 1
178
+ * @minimum 0
179
+ * @maximum Infinity
180
+ * @step 1
181
+ */
182
+ day: number;
183
+ /**
184
+ * The hours of the date
185
+ * @default 1
186
+ * @minimum 0
187
+ * @maximum Infinity
188
+ * @step 1
189
+ */
190
+ hours: number;
191
+ /**
192
+ * The minutes of the date
193
+ * @default 1
194
+ * @minimum 0
195
+ * @maximum Infinity
196
+ * @step 1
197
+ */
198
+ minutes: number;
199
+ /**
200
+ * The seconds of the date
201
+ * @default 1
202
+ * @minimum 0
203
+ * @maximum Infinity
204
+ * @step 1
205
+ */
206
+ seconds: number;
207
+ /**
208
+ * The milliseconds of the date
209
+ * @default 1
210
+ * @minimum 0
211
+ * @maximum Infinity
212
+ * @step 1
213
+ */
214
+ milliseconds: number;
215
+ }
216
+ }