@bitbybit-dev/base 0.19.7 → 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.
- package/babel.config.cjs +0 -1
- package/{index.js → index.ts} +2 -1
- package/lib/api/inputs/base-inputs.ts +18 -0
- package/lib/api/inputs/{color-inputs.d.ts → color-inputs.ts} +48 -26
- package/lib/api/inputs/{lists-inputs.d.ts → lists-inputs.ts} +190 -91
- package/lib/api/inputs/{logic-inputs.d.ts → logic-inputs.ts} +46 -24
- package/lib/api/inputs/{math-inputs.d.ts → math-inputs.ts} +97 -53
- package/lib/api/inputs/{point-inputs.d.ts → point-inputs.ts} +168 -77
- package/lib/api/inputs/text-inputs.ts +108 -0
- package/lib/api/inputs/{transforms-inputs.d.ts → transforms-inputs.ts} +64 -35
- package/lib/api/inputs/{vector-inputs.d.ts → vector-inputs.ts} +104 -48
- package/lib/api/services/color.test.ts +86 -0
- package/lib/api/services/{color.js → color.ts} +34 -15
- package/lib/api/services/{geometry-helper.js → geometry-helper.ts} +43 -31
- package/lib/api/services/{index.d.ts → index.ts} +1 -1
- package/lib/api/services/lists.test.ts +612 -0
- package/lib/api/services/{lists.js → lists.ts} +83 -59
- package/lib/api/services/logic.test.ts +187 -0
- package/lib/api/services/{logic.js → logic.ts} +32 -24
- package/lib/api/services/math.test.ts +622 -0
- package/lib/api/services/{math.js → math.ts} +136 -71
- package/lib/api/services/{point.js → point.ts} +67 -32
- package/lib/api/services/text.test.ts +55 -0
- package/lib/api/services/{text.js → text.ts} +17 -7
- package/lib/api/services/{transforms.js → transforms.ts} +83 -37
- package/lib/api/services/vector.test.ts +360 -0
- package/lib/api/services/{vector.js → vector.ts} +80 -42
- package/lib/{index.d.ts → index.ts} +1 -0
- package/package.json +1 -1
- package/tsconfig.bitbybit.json +26 -0
- package/tsconfig.json +24 -0
- package/babel.config.d.cts +0 -5
- package/index.d.ts +0 -1
- package/lib/api/index.js +0 -1
- package/lib/api/inputs/base-inputs.d.ts +0 -35
- package/lib/api/inputs/base-inputs.js +0 -1
- package/lib/api/inputs/color-inputs.js +0 -164
- package/lib/api/inputs/index.js +0 -9
- package/lib/api/inputs/inputs.js +0 -9
- package/lib/api/inputs/lists-inputs.js +0 -576
- package/lib/api/inputs/logic-inputs.js +0 -111
- package/lib/api/inputs/math-inputs.js +0 -391
- package/lib/api/inputs/point-inputs.js +0 -521
- package/lib/api/inputs/text-inputs.d.ts +0 -83
- package/lib/api/inputs/text-inputs.js +0 -120
- package/lib/api/inputs/transforms-inputs.js +0 -200
- package/lib/api/inputs/vector-inputs.js +0 -304
- package/lib/api/services/color.d.ts +0 -114
- package/lib/api/services/geometry-helper.d.ts +0 -15
- package/lib/api/services/index.js +0 -9
- package/lib/api/services/lists.d.ts +0 -287
- package/lib/api/services/logic.d.ts +0 -99
- package/lib/api/services/math.d.ts +0 -349
- package/lib/api/services/point.d.ts +0 -222
- package/lib/api/services/text.d.ts +0 -69
- package/lib/api/services/transforms.d.ts +0 -122
- package/lib/api/services/vector.d.ts +0 -320
- package/lib/index.js +0 -1
- /package/lib/api/{index.d.ts → index.ts} +0 -0
- /package/lib/api/inputs/{index.d.ts → index.ts} +0 -0
- /package/lib/api/inputs/{inputs.d.ts → inputs.ts} +0 -0
package/babel.config.cjs
CHANGED
package/{index.js → index.ts}
RENAMED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
+
export namespace Base {
|
|
3
|
+
export type Color = string;
|
|
4
|
+
export type ColorRGB = { r: number, g: number, b: number };
|
|
5
|
+
export type Material = any;
|
|
6
|
+
export type Point2 = [number, number];
|
|
7
|
+
export type Vector2 = [number, number];
|
|
8
|
+
export type Point3 = [number, number, number];
|
|
9
|
+
export type Vector3 = [number, number, number];
|
|
10
|
+
export type Line2 = { start: Base.Point2, end: Base.Point2 };
|
|
11
|
+
export type Line3 = { start: Base.Point3, end: Base.Point3 };
|
|
12
|
+
export type Polyline3 = { points: Base.Point3[], isClosed?: boolean, color?: number[] };
|
|
13
|
+
export type Polyline2 = { points: Base.Point2[], isClosed?: boolean, color?: number[] };
|
|
14
|
+
export type TransformMatrix3x3 = [number, number, number, number, number, number, number, number, number];
|
|
15
|
+
export type TransformMatrixes3x3 = TransformMatrix3x3[];
|
|
16
|
+
export type TransformMatrix = [number, number, number, number, number, number, number, number, number, number, number, number, number, number, number, number];
|
|
17
|
+
export type TransformMatrixes = TransformMatrix[];
|
|
18
|
+
}
|
|
@@ -1,32 +1,43 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
1
2
|
import { Base } from "./base-inputs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
}
|
|
5
10
|
/**
|
|
6
11
|
* Color hex
|
|
7
12
|
* @default #0000ff
|
|
8
13
|
*/
|
|
9
|
-
color: Base.Color;
|
|
14
|
+
color: Base.Color = "#0000ff";
|
|
10
15
|
}
|
|
11
|
-
class InvertHexDto {
|
|
12
|
-
constructor(color?: Base.Color)
|
|
16
|
+
export class InvertHexDto {
|
|
17
|
+
constructor(color?: Base.Color) {
|
|
18
|
+
if (color !== undefined) { this.color = color; }
|
|
19
|
+
}
|
|
13
20
|
/**
|
|
14
21
|
* Color hex
|
|
15
22
|
* @default #0000ff
|
|
16
23
|
*/
|
|
17
|
-
color: Base.Color;
|
|
24
|
+
color: Base.Color = "#0000ff";
|
|
18
25
|
/**
|
|
19
26
|
* Choose to invert the color to black and white (useful for text color)
|
|
20
27
|
*/
|
|
21
|
-
blackAndWhite
|
|
28
|
+
blackAndWhite = false;
|
|
22
29
|
}
|
|
23
|
-
class HexDtoMapped {
|
|
24
|
-
constructor(color?: Base.Color, from?: number, to?: number)
|
|
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
|
+
}
|
|
25
36
|
/**
|
|
26
37
|
* Color hex
|
|
27
38
|
* @default #0000ff
|
|
28
39
|
*/
|
|
29
|
-
color: Base.Color;
|
|
40
|
+
color: Base.Color = "#0000ff";
|
|
30
41
|
/**
|
|
31
42
|
* From min bound
|
|
32
43
|
* @default 0
|
|
@@ -34,7 +45,7 @@ export declare namespace Color {
|
|
|
34
45
|
* @maximum Infinity
|
|
35
46
|
* @step 1
|
|
36
47
|
*/
|
|
37
|
-
from
|
|
48
|
+
from = 0;
|
|
38
49
|
/**
|
|
39
50
|
* To max bound
|
|
40
51
|
* @default 255
|
|
@@ -42,10 +53,13 @@ export declare namespace Color {
|
|
|
42
53
|
* @maximum Infinity
|
|
43
54
|
* @step 1
|
|
44
55
|
*/
|
|
45
|
-
to
|
|
56
|
+
to = 255;
|
|
46
57
|
}
|
|
47
|
-
class RGBObjectMaxDto {
|
|
48
|
-
constructor(rgb?: Base.ColorRGB, max?: number)
|
|
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
|
+
}
|
|
49
63
|
/**
|
|
50
64
|
* Red value component
|
|
51
65
|
* @default undefined
|
|
@@ -58,7 +72,7 @@ export declare namespace Color {
|
|
|
58
72
|
* @maximum 255
|
|
59
73
|
* @step 0.1
|
|
60
74
|
*/
|
|
61
|
-
min
|
|
75
|
+
min = 0;
|
|
62
76
|
/**
|
|
63
77
|
* Max value, it would automatically be remapped to whatever is needed if lower comes in
|
|
64
78
|
* @default 255
|
|
@@ -66,10 +80,16 @@ export declare namespace Color {
|
|
|
66
80
|
* @maximum 255
|
|
67
81
|
* @step 0.1
|
|
68
82
|
*/
|
|
69
|
-
max
|
|
83
|
+
max = 255;
|
|
70
84
|
}
|
|
71
|
-
class RGBMinMaxDto {
|
|
72
|
-
constructor(r?: number, g?: number, b?: number, min?: number, max?: number)
|
|
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
|
+
}
|
|
73
93
|
/**
|
|
74
94
|
* Red value component
|
|
75
95
|
* @default 255
|
|
@@ -77,7 +97,7 @@ export declare namespace Color {
|
|
|
77
97
|
* @maximum 255
|
|
78
98
|
* @step 1
|
|
79
99
|
*/
|
|
80
|
-
r
|
|
100
|
+
r = 255;
|
|
81
101
|
/**
|
|
82
102
|
* Green value component
|
|
83
103
|
* @default 255
|
|
@@ -85,7 +105,7 @@ export declare namespace Color {
|
|
|
85
105
|
* @maximum 255
|
|
86
106
|
* @step 1
|
|
87
107
|
*/
|
|
88
|
-
g
|
|
108
|
+
g = 255;
|
|
89
109
|
/**
|
|
90
110
|
* Blue value component
|
|
91
111
|
* @default 255
|
|
@@ -93,7 +113,7 @@ export declare namespace Color {
|
|
|
93
113
|
* @maximum 255
|
|
94
114
|
* @step 1
|
|
95
115
|
*/
|
|
96
|
-
b
|
|
116
|
+
b = 255;
|
|
97
117
|
/**
|
|
98
118
|
* Min value of the range
|
|
99
119
|
* @default 0
|
|
@@ -101,7 +121,7 @@ export declare namespace Color {
|
|
|
101
121
|
* @maximum 255
|
|
102
122
|
* @step 0.1
|
|
103
123
|
*/
|
|
104
|
-
min
|
|
124
|
+
min = 0;
|
|
105
125
|
/**
|
|
106
126
|
* Max value of the range
|
|
107
127
|
* @default 255
|
|
@@ -109,10 +129,12 @@ export declare namespace Color {
|
|
|
109
129
|
* @maximum 255
|
|
110
130
|
* @step 0.1
|
|
111
131
|
*/
|
|
112
|
-
max
|
|
132
|
+
max = 255;
|
|
113
133
|
}
|
|
114
|
-
class RGBObjectDto {
|
|
115
|
-
constructor(rgb?: Base.ColorRGB)
|
|
134
|
+
export class RGBObjectDto {
|
|
135
|
+
constructor(rgb?: Base.ColorRGB) {
|
|
136
|
+
if (rgb !== undefined) { this.rgb = rgb; }
|
|
137
|
+
}
|
|
116
138
|
/**
|
|
117
139
|
* Red value component
|
|
118
140
|
* @default undefined
|