@bitbybit-dev/base 0.21.1 → 1.0.0-rc.1
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 -1
- package/babel.config.d.cts +1 -1
- package/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.js +2 -0
- package/lib/api/inputs/base-inputs.d.ts +11 -0
- package/lib/api/inputs/base-inputs.js +7 -0
- package/lib/api/inputs/color-inputs.d.ts +150 -0
- package/lib/api/inputs/color-inputs.js +220 -0
- package/lib/api/inputs/inputs.d.ts +1 -14
- package/lib/api/inputs/inputs.js +2 -14
- package/lib/api/inputs/vector-inputs.d.ts +1 -1
- package/lib/api/inputs/vector-inputs.js +1 -1
- package/lib/api/models/simplex.js +2 -2
- package/lib/api/services/color.d.ts +55 -1
- package/lib/api/services/color.js +67 -1
- package/lib/api/services/helpers/dxf/dxf-generator.js +10 -10
- package/lib/api/services/point.js +1 -1
- package/lib/api/services/transforms.js +3 -3
- package/package.json +13 -14
package/babel.config.cjs
CHANGED
package/babel.config.d.cts
CHANGED
package/lib/api/index.d.ts
CHANGED
package/lib/api/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base namespace containing foundational types and enums used across all bitbybit packages.
|
|
3
|
+
* This is the single source of truth - other packages extend this via module augmentation.
|
|
4
|
+
*/
|
|
1
5
|
export declare namespace Base {
|
|
2
6
|
type Color = string;
|
|
3
7
|
type ColorRGB = {
|
|
@@ -5,6 +9,12 @@ export declare namespace Base {
|
|
|
5
9
|
g: number;
|
|
6
10
|
b: number;
|
|
7
11
|
};
|
|
12
|
+
type ColorRGBA = {
|
|
13
|
+
r: number;
|
|
14
|
+
g: number;
|
|
15
|
+
b: number;
|
|
16
|
+
a: number;
|
|
17
|
+
};
|
|
8
18
|
type Material = any;
|
|
9
19
|
type Point2 = [number, number];
|
|
10
20
|
type Vector2 = [number, number];
|
|
@@ -20,6 +30,7 @@ export declare namespace Base {
|
|
|
20
30
|
};
|
|
21
31
|
type Segment2 = [Point2, Point2];
|
|
22
32
|
type Segment3 = [Point3, Point3];
|
|
33
|
+
/** Triangle plane is efficient definition described by a normal vector and d value (N dot X = d) */
|
|
23
34
|
type TrianglePlane3 = {
|
|
24
35
|
normal: Vector3;
|
|
25
36
|
d: number;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
2
|
+
/**
|
|
3
|
+
* Base namespace containing foundational types and enums used across all bitbybit packages.
|
|
4
|
+
* This is the single source of truth - other packages extend this via module augmentation.
|
|
5
|
+
*/
|
|
2
6
|
export var Base;
|
|
3
7
|
(function (Base) {
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Alignment Enums
|
|
10
|
+
// ============================================================================
|
|
4
11
|
let horizontalAlignEnum;
|
|
5
12
|
(function (horizontalAlignEnum) {
|
|
6
13
|
horizontalAlignEnum["left"] = "left";
|
|
@@ -8,6 +8,156 @@ export declare namespace Color {
|
|
|
8
8
|
*/
|
|
9
9
|
color: Base.Color;
|
|
10
10
|
}
|
|
11
|
+
class Rgb255Dto {
|
|
12
|
+
constructor(colorRgb?: Base.ColorRGB);
|
|
13
|
+
/**
|
|
14
|
+
* Color rgb
|
|
15
|
+
* @default { "r": 0, "g": 0, "b": 255 }
|
|
16
|
+
* @min 0
|
|
17
|
+
* @max 255
|
|
18
|
+
*/
|
|
19
|
+
colorRgb: Base.ColorRGB;
|
|
20
|
+
}
|
|
21
|
+
class Rgb1Dto {
|
|
22
|
+
constructor(colorRgb?: Base.ColorRGB);
|
|
23
|
+
/**
|
|
24
|
+
* Color rgb
|
|
25
|
+
* @default { "r": 0, "g": 0, "b": 1 }
|
|
26
|
+
* @min 0
|
|
27
|
+
* @max 1
|
|
28
|
+
*/
|
|
29
|
+
colorRgb: Base.ColorRGB;
|
|
30
|
+
}
|
|
31
|
+
class Rgba255Dto {
|
|
32
|
+
constructor(colorRgba?: Base.ColorRGBA);
|
|
33
|
+
/**
|
|
34
|
+
* Color rgba
|
|
35
|
+
* @default { "r": 0, "g": 0, "b": 255, "a": 1 }
|
|
36
|
+
* @min 0
|
|
37
|
+
* @max 255
|
|
38
|
+
*/
|
|
39
|
+
colorRgba: Base.ColorRGBA;
|
|
40
|
+
}
|
|
41
|
+
class Rgba1Dto {
|
|
42
|
+
constructor(colorRgba?: Base.ColorRGBA);
|
|
43
|
+
/**
|
|
44
|
+
* Color rgba
|
|
45
|
+
* @default { "r": 0, "g": 0, "b": 1, "a": 1 }
|
|
46
|
+
* @min 0
|
|
47
|
+
* @max 1
|
|
48
|
+
*/
|
|
49
|
+
colorRgba: Base.ColorRGBA;
|
|
50
|
+
}
|
|
51
|
+
class RgbAttomic255Dto {
|
|
52
|
+
constructor(r?: number, g?: number, b?: number);
|
|
53
|
+
/**
|
|
54
|
+
* Red component
|
|
55
|
+
* @default 0
|
|
56
|
+
* @minimum 0
|
|
57
|
+
* @maximum 255
|
|
58
|
+
*/
|
|
59
|
+
r: number;
|
|
60
|
+
/**
|
|
61
|
+
* Green component
|
|
62
|
+
* @default 0
|
|
63
|
+
* @minimum 0
|
|
64
|
+
* @maximum 255
|
|
65
|
+
*/
|
|
66
|
+
g: number;
|
|
67
|
+
/**
|
|
68
|
+
* Blue component
|
|
69
|
+
* @default 255
|
|
70
|
+
* @minimum 0
|
|
71
|
+
* @maximum 255
|
|
72
|
+
*/
|
|
73
|
+
b: number;
|
|
74
|
+
}
|
|
75
|
+
class RgbaAttomic255Dto {
|
|
76
|
+
constructor(r?: number, g?: number, b?: number, a?: number);
|
|
77
|
+
/**
|
|
78
|
+
* Red component
|
|
79
|
+
* @default 0
|
|
80
|
+
* @minimum 0
|
|
81
|
+
* @maximum 255
|
|
82
|
+
*/
|
|
83
|
+
r: number;
|
|
84
|
+
/**
|
|
85
|
+
* Green component
|
|
86
|
+
* @default 0
|
|
87
|
+
* @minimum 0
|
|
88
|
+
* @maximum 255
|
|
89
|
+
*/
|
|
90
|
+
g: number;
|
|
91
|
+
/**
|
|
92
|
+
* Blue component
|
|
93
|
+
* @default 255
|
|
94
|
+
* @minimum 0
|
|
95
|
+
* @maximum 255
|
|
96
|
+
*/
|
|
97
|
+
b: number;
|
|
98
|
+
/**
|
|
99
|
+
* Alpha component
|
|
100
|
+
* @default 1
|
|
101
|
+
* @minimum 0
|
|
102
|
+
* @maximum 1
|
|
103
|
+
*/
|
|
104
|
+
a: number;
|
|
105
|
+
}
|
|
106
|
+
class RgbAttomic1Dto {
|
|
107
|
+
constructor(r?: number, g?: number, b?: number);
|
|
108
|
+
/**
|
|
109
|
+
* Red component
|
|
110
|
+
* @default 0
|
|
111
|
+
* @minimum 0
|
|
112
|
+
* @maximum 1
|
|
113
|
+
*/
|
|
114
|
+
r: number;
|
|
115
|
+
/**
|
|
116
|
+
* Green component
|
|
117
|
+
* @default 0
|
|
118
|
+
* @minimum 0
|
|
119
|
+
* @maximum 1
|
|
120
|
+
*/
|
|
121
|
+
g: number;
|
|
122
|
+
/**
|
|
123
|
+
* Blue component
|
|
124
|
+
* @default 1
|
|
125
|
+
* @minimum 0
|
|
126
|
+
* @maximum 1
|
|
127
|
+
*/
|
|
128
|
+
b: number;
|
|
129
|
+
}
|
|
130
|
+
class RgbaAttomic1Dto {
|
|
131
|
+
constructor(r?: number, g?: number, b?: number, a?: number);
|
|
132
|
+
/**
|
|
133
|
+
* Red component
|
|
134
|
+
* @default 0
|
|
135
|
+
* @minimum 0
|
|
136
|
+
* @maximum 1
|
|
137
|
+
*/
|
|
138
|
+
r: number;
|
|
139
|
+
/**
|
|
140
|
+
* Green component
|
|
141
|
+
* @default 0
|
|
142
|
+
* @minimum 0
|
|
143
|
+
* @maximum 1
|
|
144
|
+
*/
|
|
145
|
+
g: number;
|
|
146
|
+
/**
|
|
147
|
+
* Blue component
|
|
148
|
+
* @default 1
|
|
149
|
+
* @minimum 0
|
|
150
|
+
* @maximum 1
|
|
151
|
+
*/
|
|
152
|
+
b: number;
|
|
153
|
+
/**
|
|
154
|
+
* Alpha component
|
|
155
|
+
* @default 1
|
|
156
|
+
* @minimum 0
|
|
157
|
+
* @maximum 1
|
|
158
|
+
*/
|
|
159
|
+
a: number;
|
|
160
|
+
}
|
|
11
161
|
class InvertHexDto {
|
|
12
162
|
constructor(color?: Base.Color);
|
|
13
163
|
/**
|
|
@@ -14,6 +14,226 @@ export var Color;
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
Color.HexDto = HexDto;
|
|
17
|
+
class Rgb255Dto {
|
|
18
|
+
constructor(colorRgb) {
|
|
19
|
+
/**
|
|
20
|
+
* Color rgb
|
|
21
|
+
* @default { "r": 0, "g": 0, "b": 255 }
|
|
22
|
+
* @min 0
|
|
23
|
+
* @max 255
|
|
24
|
+
*/
|
|
25
|
+
this.colorRgb = { r: 0, g: 0, b: 255 };
|
|
26
|
+
if (colorRgb !== undefined) {
|
|
27
|
+
this.colorRgb = colorRgb;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
Color.Rgb255Dto = Rgb255Dto;
|
|
32
|
+
class Rgb1Dto {
|
|
33
|
+
constructor(colorRgb) {
|
|
34
|
+
/**
|
|
35
|
+
* Color rgb
|
|
36
|
+
* @default { "r": 0, "g": 0, "b": 1 }
|
|
37
|
+
* @min 0
|
|
38
|
+
* @max 1
|
|
39
|
+
*/
|
|
40
|
+
this.colorRgb = { r: 0, g: 0, b: 1 };
|
|
41
|
+
if (colorRgb !== undefined) {
|
|
42
|
+
this.colorRgb = colorRgb;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
Color.Rgb1Dto = Rgb1Dto;
|
|
47
|
+
class Rgba255Dto {
|
|
48
|
+
constructor(colorRgba) {
|
|
49
|
+
/**
|
|
50
|
+
* Color rgba
|
|
51
|
+
* @default { "r": 0, "g": 0, "b": 255, "a": 1 }
|
|
52
|
+
* @min 0
|
|
53
|
+
* @max 255
|
|
54
|
+
*/
|
|
55
|
+
this.colorRgba = { r: 0, g: 0, b: 255, a: 1 };
|
|
56
|
+
if (colorRgba !== undefined) {
|
|
57
|
+
this.colorRgba = colorRgba;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
Color.Rgba255Dto = Rgba255Dto;
|
|
62
|
+
class Rgba1Dto {
|
|
63
|
+
constructor(colorRgba) {
|
|
64
|
+
/**
|
|
65
|
+
* Color rgba
|
|
66
|
+
* @default { "r": 0, "g": 0, "b": 1, "a": 1 }
|
|
67
|
+
* @min 0
|
|
68
|
+
* @max 1
|
|
69
|
+
*/
|
|
70
|
+
this.colorRgba = { r: 0, g: 0, b: 1, a: 1 };
|
|
71
|
+
if (colorRgba !== undefined) {
|
|
72
|
+
this.colorRgba = colorRgba;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
Color.Rgba1Dto = Rgba1Dto;
|
|
77
|
+
class RgbAttomic255Dto {
|
|
78
|
+
constructor(r, g, b) {
|
|
79
|
+
/**
|
|
80
|
+
* Red component
|
|
81
|
+
* @default 0
|
|
82
|
+
* @minimum 0
|
|
83
|
+
* @maximum 255
|
|
84
|
+
*/
|
|
85
|
+
this.r = 0;
|
|
86
|
+
/**
|
|
87
|
+
* Green component
|
|
88
|
+
* @default 0
|
|
89
|
+
* @minimum 0
|
|
90
|
+
* @maximum 255
|
|
91
|
+
*/
|
|
92
|
+
this.g = 0;
|
|
93
|
+
/**
|
|
94
|
+
* Blue component
|
|
95
|
+
* @default 255
|
|
96
|
+
* @minimum 0
|
|
97
|
+
* @maximum 255
|
|
98
|
+
*/
|
|
99
|
+
this.b = 255;
|
|
100
|
+
if (r !== undefined) {
|
|
101
|
+
this.r = r;
|
|
102
|
+
}
|
|
103
|
+
if (g !== undefined) {
|
|
104
|
+
this.g = g;
|
|
105
|
+
}
|
|
106
|
+
if (b !== undefined) {
|
|
107
|
+
this.b = b;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
Color.RgbAttomic255Dto = RgbAttomic255Dto;
|
|
112
|
+
class RgbaAttomic255Dto {
|
|
113
|
+
constructor(r, g, b, a) {
|
|
114
|
+
/**
|
|
115
|
+
* Red component
|
|
116
|
+
* @default 0
|
|
117
|
+
* @minimum 0
|
|
118
|
+
* @maximum 255
|
|
119
|
+
*/
|
|
120
|
+
this.r = 0;
|
|
121
|
+
/**
|
|
122
|
+
* Green component
|
|
123
|
+
* @default 0
|
|
124
|
+
* @minimum 0
|
|
125
|
+
* @maximum 255
|
|
126
|
+
*/
|
|
127
|
+
this.g = 0;
|
|
128
|
+
/**
|
|
129
|
+
* Blue component
|
|
130
|
+
* @default 255
|
|
131
|
+
* @minimum 0
|
|
132
|
+
* @maximum 255
|
|
133
|
+
*/
|
|
134
|
+
this.b = 255;
|
|
135
|
+
/**
|
|
136
|
+
* Alpha component
|
|
137
|
+
* @default 1
|
|
138
|
+
* @minimum 0
|
|
139
|
+
* @maximum 1
|
|
140
|
+
*/
|
|
141
|
+
this.a = 1;
|
|
142
|
+
if (r !== undefined) {
|
|
143
|
+
this.r = r;
|
|
144
|
+
}
|
|
145
|
+
if (g !== undefined) {
|
|
146
|
+
this.g = g;
|
|
147
|
+
}
|
|
148
|
+
if (b !== undefined) {
|
|
149
|
+
this.b = b;
|
|
150
|
+
}
|
|
151
|
+
if (a !== undefined) {
|
|
152
|
+
this.a = a;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
Color.RgbaAttomic255Dto = RgbaAttomic255Dto;
|
|
157
|
+
class RgbAttomic1Dto {
|
|
158
|
+
constructor(r, g, b) {
|
|
159
|
+
/**
|
|
160
|
+
* Red component
|
|
161
|
+
* @default 0
|
|
162
|
+
* @minimum 0
|
|
163
|
+
* @maximum 1
|
|
164
|
+
*/
|
|
165
|
+
this.r = 0;
|
|
166
|
+
/**
|
|
167
|
+
* Green component
|
|
168
|
+
* @default 0
|
|
169
|
+
* @minimum 0
|
|
170
|
+
* @maximum 1
|
|
171
|
+
*/
|
|
172
|
+
this.g = 0;
|
|
173
|
+
/**
|
|
174
|
+
* Blue component
|
|
175
|
+
* @default 1
|
|
176
|
+
* @minimum 0
|
|
177
|
+
* @maximum 1
|
|
178
|
+
*/
|
|
179
|
+
this.b = 1;
|
|
180
|
+
if (r !== undefined) {
|
|
181
|
+
this.r = r;
|
|
182
|
+
}
|
|
183
|
+
if (g !== undefined) {
|
|
184
|
+
this.g = g;
|
|
185
|
+
}
|
|
186
|
+
if (b !== undefined) {
|
|
187
|
+
this.b = b;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
Color.RgbAttomic1Dto = RgbAttomic1Dto;
|
|
192
|
+
class RgbaAttomic1Dto {
|
|
193
|
+
constructor(r, g, b, a) {
|
|
194
|
+
/**
|
|
195
|
+
* Red component
|
|
196
|
+
* @default 0
|
|
197
|
+
* @minimum 0
|
|
198
|
+
* @maximum 1
|
|
199
|
+
*/
|
|
200
|
+
this.r = 0;
|
|
201
|
+
/**
|
|
202
|
+
* Green component
|
|
203
|
+
* @default 0
|
|
204
|
+
* @minimum 0
|
|
205
|
+
* @maximum 1
|
|
206
|
+
*/
|
|
207
|
+
this.g = 0;
|
|
208
|
+
/**
|
|
209
|
+
* Blue component
|
|
210
|
+
* @default 1
|
|
211
|
+
* @minimum 0
|
|
212
|
+
* @maximum 1
|
|
213
|
+
*/
|
|
214
|
+
this.b = 1;
|
|
215
|
+
/**
|
|
216
|
+
* Alpha component
|
|
217
|
+
* @default 1
|
|
218
|
+
* @minimum 0
|
|
219
|
+
* @maximum 1
|
|
220
|
+
*/
|
|
221
|
+
this.a = 1;
|
|
222
|
+
if (r !== undefined) {
|
|
223
|
+
this.r = r;
|
|
224
|
+
}
|
|
225
|
+
if (g !== undefined) {
|
|
226
|
+
this.g = g;
|
|
227
|
+
}
|
|
228
|
+
if (b !== undefined) {
|
|
229
|
+
this.b = b;
|
|
230
|
+
}
|
|
231
|
+
if (a !== undefined) {
|
|
232
|
+
this.a = a;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
Color.RgbaAttomic1Dto = RgbaAttomic1Dto;
|
|
17
237
|
class InvertHexDto {
|
|
18
238
|
constructor(color) {
|
|
19
239
|
/**
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
export * from "./
|
|
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";
|
|
10
|
-
export * from "./dates-inputs";
|
|
11
|
-
export * from "./line-inputs";
|
|
12
|
-
export * from "./polyline-inputs";
|
|
13
|
-
export * from "./mesh-inputs";
|
|
14
|
-
export * from "./io-inputs";
|
|
1
|
+
export * from "./index";
|
package/lib/api/inputs/inputs.js
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./
|
|
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";
|
|
10
|
-
export * from "./dates-inputs";
|
|
11
|
-
export * from "./line-inputs";
|
|
12
|
-
export * from "./polyline-inputs";
|
|
13
|
-
export * from "./mesh-inputs";
|
|
14
|
-
export * from "./io-inputs";
|
|
1
|
+
// Re-export everything from index for backward compatibility
|
|
2
|
+
export * from "./index";
|
|
@@ -163,8 +163,8 @@ export const defaultsVectorParams = {
|
|
|
163
163
|
input: "?",
|
|
164
164
|
align: "left",
|
|
165
165
|
font: simplex,
|
|
166
|
-
height: 21,
|
|
167
|
-
lineSpacing: 2.142857142857143,
|
|
166
|
+
height: 21, // == old vector_xxx simplex font height
|
|
167
|
+
lineSpacing: 2.142857142857143, // == 30/14 == old vector_xxx ratio
|
|
168
168
|
letterSpacing: 1,
|
|
169
169
|
extrudeOffset: 0
|
|
170
170
|
};
|
|
@@ -9,10 +9,64 @@ export declare class Color {
|
|
|
9
9
|
* @param inputs Color hex
|
|
10
10
|
* @returns color string
|
|
11
11
|
* @group create
|
|
12
|
-
* @shortname color
|
|
12
|
+
* @shortname color hex
|
|
13
13
|
* @drawable false
|
|
14
14
|
*/
|
|
15
15
|
hexColor(inputs: Inputs.Color.HexDto): Inputs.Base.Color;
|
|
16
|
+
/**
|
|
17
|
+
* Creates and returns rgb color object
|
|
18
|
+
* @param inputs Color rgb
|
|
19
|
+
* @returns color object
|
|
20
|
+
* @group create
|
|
21
|
+
* @shortname color rgb 0-255
|
|
22
|
+
* @drawable false
|
|
23
|
+
*/
|
|
24
|
+
rgb255Color(inputs: Inputs.Color.Rgb255Dto): Inputs.Base.ColorRGB;
|
|
25
|
+
/**
|
|
26
|
+
* Creates and returns rgb color object
|
|
27
|
+
* @param inputs Color rgb
|
|
28
|
+
* @returns color object
|
|
29
|
+
* @group create
|
|
30
|
+
* @shortname color rgb 0-1
|
|
31
|
+
* @drawable false
|
|
32
|
+
*/
|
|
33
|
+
rgb1Color(inputs: Inputs.Color.Rgb1Dto): Inputs.Base.ColorRGB;
|
|
34
|
+
/**
|
|
35
|
+
* Creates and returns rgba color object
|
|
36
|
+
* @param inputs Color rgba
|
|
37
|
+
* @returns color object
|
|
38
|
+
* @group create
|
|
39
|
+
* @shortname color rgba 0-255
|
|
40
|
+
* @drawable false
|
|
41
|
+
*/
|
|
42
|
+
rgba255Color(inputs: Inputs.Color.Rgba255Dto): Inputs.Base.ColorRGBA;
|
|
43
|
+
/**
|
|
44
|
+
* Creates and returns rgba color object
|
|
45
|
+
* @param inputs Color rgba
|
|
46
|
+
* @returns color object
|
|
47
|
+
* @group create
|
|
48
|
+
* @shortname color rgba 0-1
|
|
49
|
+
* @drawable false
|
|
50
|
+
*/
|
|
51
|
+
rgba1Color(inputs: Inputs.Color.Rgba1Dto): Inputs.Base.ColorRGBA;
|
|
52
|
+
/**
|
|
53
|
+
* Creates atomic rgb color object
|
|
54
|
+
* @param inputs Color rgb
|
|
55
|
+
* @returns color object
|
|
56
|
+
* @group create
|
|
57
|
+
* @shortname atomic color rgb 0-255
|
|
58
|
+
* @drawable false
|
|
59
|
+
*/
|
|
60
|
+
rgbAtomic255Color(inputs: Inputs.Color.RgbAttomic255Dto): Inputs.Base.ColorRGB;
|
|
61
|
+
/**
|
|
62
|
+
* Creates atomic rgb color object
|
|
63
|
+
* @param inputs Color rgb
|
|
64
|
+
* @returns color object
|
|
65
|
+
* @group create
|
|
66
|
+
* @shortname atomic color rgb 0-1
|
|
67
|
+
* @drawable false
|
|
68
|
+
*/
|
|
69
|
+
rgbAtomic1Color(inputs: Inputs.Color.RgbAttomic1Dto): Inputs.Base.ColorRGB;
|
|
16
70
|
/**
|
|
17
71
|
* Converts hex color to RGB object with r, g, b values (0-255 range).
|
|
18
72
|
* Example: '#FF5733' → {r: 255, g: 87, b: 51}
|
|
@@ -8,12 +8,78 @@ export class Color {
|
|
|
8
8
|
* @param inputs Color hex
|
|
9
9
|
* @returns color string
|
|
10
10
|
* @group create
|
|
11
|
-
* @shortname color
|
|
11
|
+
* @shortname color hex
|
|
12
12
|
* @drawable false
|
|
13
13
|
*/
|
|
14
14
|
hexColor(inputs) {
|
|
15
15
|
return inputs.color;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates and returns rgb color object
|
|
19
|
+
* @param inputs Color rgb
|
|
20
|
+
* @returns color object
|
|
21
|
+
* @group create
|
|
22
|
+
* @shortname color rgb 0-255
|
|
23
|
+
* @drawable false
|
|
24
|
+
*/
|
|
25
|
+
rgb255Color(inputs) {
|
|
26
|
+
return inputs.colorRgb;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates and returns rgb color object
|
|
30
|
+
* @param inputs Color rgb
|
|
31
|
+
* @returns color object
|
|
32
|
+
* @group create
|
|
33
|
+
* @shortname color rgb 0-1
|
|
34
|
+
* @drawable false
|
|
35
|
+
*/
|
|
36
|
+
rgb1Color(inputs) {
|
|
37
|
+
return inputs.colorRgb;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates and returns rgba color object
|
|
41
|
+
* @param inputs Color rgba
|
|
42
|
+
* @returns color object
|
|
43
|
+
* @group create
|
|
44
|
+
* @shortname color rgba 0-255
|
|
45
|
+
* @drawable false
|
|
46
|
+
*/
|
|
47
|
+
rgba255Color(inputs) {
|
|
48
|
+
return inputs.colorRgba;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates and returns rgba color object
|
|
52
|
+
* @param inputs Color rgba
|
|
53
|
+
* @returns color object
|
|
54
|
+
* @group create
|
|
55
|
+
* @shortname color rgba 0-1
|
|
56
|
+
* @drawable false
|
|
57
|
+
*/
|
|
58
|
+
rgba1Color(inputs) {
|
|
59
|
+
return inputs.colorRgba;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Creates atomic rgb color object
|
|
63
|
+
* @param inputs Color rgb
|
|
64
|
+
* @returns color object
|
|
65
|
+
* @group create
|
|
66
|
+
* @shortname atomic color rgb 0-255
|
|
67
|
+
* @drawable false
|
|
68
|
+
*/
|
|
69
|
+
rgbAtomic255Color(inputs) {
|
|
70
|
+
return Object.assign({}, inputs);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates atomic rgb color object
|
|
74
|
+
* @param inputs Color rgb
|
|
75
|
+
* @returns color object
|
|
76
|
+
* @group create
|
|
77
|
+
* @shortname atomic color rgb 0-1
|
|
78
|
+
* @drawable false
|
|
79
|
+
*/
|
|
80
|
+
rgbAtomic1Color(inputs) {
|
|
81
|
+
return Object.assign({}, inputs);
|
|
82
|
+
}
|
|
17
83
|
/**
|
|
18
84
|
* Converts hex color to RGB object with r, g, b values (0-255 range).
|
|
19
85
|
* Example: '#FF5733' → {r: 255, g: 87, b: 51}
|
|
@@ -133,7 +133,7 @@ export class DxfGenerator {
|
|
|
133
133
|
"2",
|
|
134
134
|
"VPORT",
|
|
135
135
|
"70",
|
|
136
|
-
"2",
|
|
136
|
+
"2", // Number of viewports
|
|
137
137
|
"0",
|
|
138
138
|
"VPORT",
|
|
139
139
|
"2",
|
|
@@ -606,7 +606,7 @@ export class DxfGenerator {
|
|
|
606
606
|
// Use 24-bit true color for full color spectrum (newer CAD software)
|
|
607
607
|
const trueColor = (r * 65536) + (g * 256) + b;
|
|
608
608
|
return [
|
|
609
|
-
{ code: "62", value: "256" },
|
|
609
|
+
{ code: "62", value: "256" }, // 256 = ByEntity
|
|
610
610
|
{ code: "420", value: trueColor.toString() }
|
|
611
611
|
];
|
|
612
612
|
}
|
|
@@ -627,14 +627,14 @@ export class DxfGenerator {
|
|
|
627
627
|
rgbToAciColorIndex(r, g, b) {
|
|
628
628
|
// ACI standard colors (simplified mapping)
|
|
629
629
|
const aciColors = {
|
|
630
|
-
1: [255, 0, 0],
|
|
631
|
-
2: [255, 255, 0],
|
|
632
|
-
3: [0, 255, 0],
|
|
633
|
-
4: [0, 255, 255],
|
|
634
|
-
5: [0, 0, 255],
|
|
635
|
-
6: [255, 0, 255],
|
|
636
|
-
7: [255, 255, 255],
|
|
637
|
-
8: [128, 128, 128],
|
|
630
|
+
1: [255, 0, 0], // Red
|
|
631
|
+
2: [255, 255, 0], // Yellow
|
|
632
|
+
3: [0, 255, 0], // Green
|
|
633
|
+
4: [0, 255, 255], // Cyan
|
|
634
|
+
5: [0, 0, 255], // Blue
|
|
635
|
+
6: [255, 0, 255], // Magenta
|
|
636
|
+
7: [255, 255, 255], // White
|
|
637
|
+
8: [128, 128, 128], // Gray
|
|
638
638
|
9: [192, 192, 192] // Light gray
|
|
639
639
|
};
|
|
640
640
|
// Special case for black or very dark colors
|
|
@@ -450,7 +450,7 @@ export class Point {
|
|
|
450
450
|
radiusHexagon: BASE_RADIUS,
|
|
451
451
|
nrHexagonsX: nrHexagonsInWidth,
|
|
452
452
|
nrHexagonsY: nrHexagonsInHeight,
|
|
453
|
-
orientOnCenter: false,
|
|
453
|
+
orientOnCenter: false, // Important: Do not center here
|
|
454
454
|
pointsOnGround: false // Keep on XY plane for now
|
|
455
455
|
});
|
|
456
456
|
if (unscaledCenters.length === 0) {
|
|
@@ -323,9 +323,9 @@ export class Transforms {
|
|
|
323
323
|
// m41, m42, m43 = 0, m44 = 1
|
|
324
324
|
// Assemble the 4x4 matrix in COLUMN-MAJOR order
|
|
325
325
|
const m = [
|
|
326
|
-
m11, m21, m31, 0.0,
|
|
327
|
-
m12, m22, m32, 0.0,
|
|
328
|
-
m13, m23, m33, 0.0,
|
|
326
|
+
m11, m21, m31, 0.0, // Column 1
|
|
327
|
+
m12, m22, m32, 0.0, // Column 2
|
|
328
|
+
m13, m23, m33, 0.0, // Column 3
|
|
329
329
|
0.0, 0.0, 0.0, 1.0 // Column 4
|
|
330
330
|
];
|
|
331
331
|
return m;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitbybit-dev/base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
4
|
"description": "Bit By Bit Developers Base CAD Library to Program Geometry",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -60,19 +60,18 @@
|
|
|
60
60
|
"dependencies": {},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"shx":"0.4.0",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"ts-
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"babel
|
|
72
|
-
"@babel/
|
|
73
|
-
"@babel/preset-
|
|
74
|
-
"
|
|
75
|
-
"jest-html-reporters": "3.0.11"
|
|
63
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
64
|
+
"mvdir": "1.0.22",
|
|
65
|
+
"jest": "30.2.0",
|
|
66
|
+
"ts-node": "10.9.2",
|
|
67
|
+
"ts-jest": "29.4.6",
|
|
68
|
+
"typescript": "5.9.3",
|
|
69
|
+
"@types/jest": "30.0.0",
|
|
70
|
+
"babel-jest": "30.2.0",
|
|
71
|
+
"@babel/core": "7.28.6",
|
|
72
|
+
"@babel/preset-env": "7.28.6",
|
|
73
|
+
"@babel/preset-typescript": "7.28.5",
|
|
74
|
+
"jest-html-reporters": "3.1.7"
|
|
76
75
|
},
|
|
77
76
|
"jest": {
|
|
78
77
|
"preset": "ts-jest",
|