@bitbybit-dev/base 0.19.8 → 0.19.9
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.
- package/babel.config.cjs +1 -0
- package/babel.config.d.cts +5 -0
- package/index.d.ts +1 -0
- package/{index.ts → index.js} +1 -2
- package/lib/api/index.js +1 -0
- package/lib/api/inputs/base-inputs.d.ts +35 -0
- package/lib/api/inputs/base-inputs.js +1 -0
- package/lib/api/inputs/{color-inputs.ts → color-inputs.d.ts} +26 -48
- package/lib/api/inputs/color-inputs.js +164 -0
- package/lib/api/inputs/index.js +9 -0
- package/lib/api/inputs/inputs.js +9 -0
- package/lib/api/inputs/{lists-inputs.ts → lists-inputs.d.ts} +91 -190
- package/lib/api/inputs/lists-inputs.js +576 -0
- package/lib/api/inputs/{logic-inputs.ts → logic-inputs.d.ts} +24 -46
- package/lib/api/inputs/logic-inputs.js +111 -0
- package/lib/api/inputs/{math-inputs.ts → math-inputs.d.ts} +53 -97
- package/lib/api/inputs/math-inputs.js +391 -0
- package/lib/api/inputs/{point-inputs.ts → point-inputs.d.ts} +77 -168
- package/lib/api/inputs/point-inputs.js +521 -0
- package/lib/api/inputs/text-inputs.d.ts +83 -0
- package/lib/api/inputs/text-inputs.js +120 -0
- package/lib/api/inputs/{transforms-inputs.ts → transforms-inputs.d.ts} +35 -64
- package/lib/api/inputs/transforms-inputs.js +200 -0
- package/lib/api/inputs/{vector-inputs.ts → vector-inputs.d.ts} +48 -104
- package/lib/api/inputs/vector-inputs.js +304 -0
- package/lib/api/services/color.d.ts +114 -0
- package/lib/api/services/{color.ts → color.js} +15 -34
- package/lib/api/services/geometry-helper.d.ts +15 -0
- package/lib/api/services/{geometry-helper.ts → geometry-helper.js} +31 -43
- package/lib/api/services/{index.ts → index.d.ts} +1 -1
- package/lib/api/services/index.js +9 -0
- package/lib/api/services/lists.d.ts +287 -0
- package/lib/api/services/{lists.ts → lists.js} +59 -83
- package/lib/api/services/logic.d.ts +99 -0
- package/lib/api/services/{logic.ts → logic.js} +24 -32
- package/lib/api/services/math.d.ts +349 -0
- package/lib/api/services/{math.ts → math.js} +71 -136
- package/lib/api/services/point.d.ts +222 -0
- package/lib/api/services/{point.ts → point.js} +32 -67
- package/lib/api/services/text.d.ts +69 -0
- package/lib/api/services/{text.ts → text.js} +7 -17
- package/lib/api/services/transforms.d.ts +122 -0
- package/lib/api/services/{transforms.ts → transforms.js} +37 -83
- package/lib/api/services/vector.d.ts +320 -0
- package/lib/api/services/{vector.ts → vector.js} +42 -80
- package/lib/{index.ts → index.d.ts} +0 -1
- package/lib/index.js +1 -0
- package/package.json +1 -1
- package/lib/api/inputs/base-inputs.ts +0 -18
- package/lib/api/inputs/text-inputs.ts +0 -108
- package/lib/api/services/color.test.ts +0 -86
- package/lib/api/services/lists.test.ts +0 -612
- package/lib/api/services/logic.test.ts +0 -187
- package/lib/api/services/math.test.ts +0 -622
- package/lib/api/services/text.test.ts +0 -55
- package/lib/api/services/vector.test.ts +0 -360
- package/tsconfig.bitbybit.json +0 -26
- package/tsconfig.json +0 -24
- /package/lib/api/{index.ts → index.d.ts} +0 -0
- /package/lib/api/inputs/{index.ts → index.d.ts} +0 -0
- /package/lib/api/inputs/{inputs.ts → inputs.d.ts} +0 -0
package/babel.config.cjs
CHANGED
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./lib";
|
package/{index.ts → index.js}
RENAMED
package/lib/api/index.js
ADDED
|
@@ -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
|
-
|
|
5
|
-
|
|
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
|
|
9
|
+
color: Base.Color;
|
|
15
10
|
}
|
|
16
|
-
|
|
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
|
|
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
|
|
21
|
+
blackAndWhite: boolean;
|
|
29
22
|
}
|
|
30
|
-
|
|
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
|
|
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
|
|
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
|
|
45
|
+
to: number;
|
|
57
46
|
}
|
|
58
|
-
|
|
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
|
|
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
|
|
69
|
+
max: number;
|
|
84
70
|
}
|
|
85
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
112
|
+
max: number;
|
|
133
113
|
}
|
|
134
|
-
|
|
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,9 @@
|
|
|
1
|
+
export * from "./color-inputs";
|
|
2
|
+
export * from "./lists-inputs";
|
|
3
|
+
export * from "./logic-inputs";
|
|
4
|
+
export * from "./math-inputs";
|
|
5
|
+
export * from "./point-inputs";
|
|
6
|
+
export * from "./text-inputs";
|
|
7
|
+
export * from "./vector-inputs";
|
|
8
|
+
export * from "./transforms-inputs";
|
|
9
|
+
export * from "./base-inputs";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./color-inputs";
|
|
2
|
+
export * from "./lists-inputs";
|
|
3
|
+
export * from "./logic-inputs";
|
|
4
|
+
export * from "./math-inputs";
|
|
5
|
+
export * from "./point-inputs";
|
|
6
|
+
export * from "./text-inputs";
|
|
7
|
+
export * from "./text-inputs";
|
|
8
|
+
export * from "./vector-inputs";
|
|
9
|
+
export * from "./transforms-inputs";
|