@reekon-tools/boldr-utils 1.3.8 → 1.4.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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/firestore.d.ts +9 -0
- package/dist/types/layout.d.ts +70 -0
- package/dist/types/layout.js +1 -0
- package/dist/utils/micrometersToUnit.js +18 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export { convertMicrometers } from './utils/micrometersToUnit.js';
|
|
|
3
3
|
export { parseMeasurement } from './utils/parseMeasurement.js';
|
|
4
4
|
export { useParseMeasurement } from './hooks/useParseMeasurement.js';
|
|
5
5
|
export * from './types/firestore.js';
|
|
6
|
+
export * from './types/layout.js';
|
|
6
7
|
export { getToleranceColor, calculateDeviationPercentage, isWithinTolerance, generateToleranceGradient, createDefaultToleranceThresholds, DEFAULT_TOLERANCE_COLORS, type ToleranceThreshold, type ToleranceConfig, } from './utils/tolerance.js';
|
package/dist/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { convertMicrometers } from './utils/micrometersToUnit.js';
|
|
|
3
3
|
export { parseMeasurement } from './utils/parseMeasurement.js';
|
|
4
4
|
export { useParseMeasurement } from './hooks/useParseMeasurement.js';
|
|
5
5
|
export * from './types/firestore.js';
|
|
6
|
+
export * from './types/layout.js';
|
|
6
7
|
export { getToleranceColor, calculateDeviationPercentage, isWithinTolerance, generateToleranceGradient, createDefaultToleranceThresholds, DEFAULT_TOLERANCE_COLORS, } from './utils/tolerance.js';
|
|
@@ -96,6 +96,15 @@ export interface Job extends FirestoreDoc, Timestamps {
|
|
|
96
96
|
progress: number;
|
|
97
97
|
projectId: string;
|
|
98
98
|
totalTasks: string;
|
|
99
|
+
toleranceConfig?: {
|
|
100
|
+
thresholds: {
|
|
101
|
+
id: string;
|
|
102
|
+
percentage: number;
|
|
103
|
+
color: string;
|
|
104
|
+
}[];
|
|
105
|
+
updatedAt: Date;
|
|
106
|
+
};
|
|
107
|
+
areaMapFileId?: string;
|
|
99
108
|
}
|
|
100
109
|
export interface Section {
|
|
101
110
|
id: string;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface Point {
|
|
2
|
+
id: string;
|
|
3
|
+
position: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
metadata?: {
|
|
8
|
+
fixed?: boolean;
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface Edge {
|
|
13
|
+
id: string;
|
|
14
|
+
pointIds: [string, string];
|
|
15
|
+
faceIds: string[];
|
|
16
|
+
type: 'wall' | 'opening' | 'door' | 'window' | 'custom';
|
|
17
|
+
metadata?: {
|
|
18
|
+
thickness?: number;
|
|
19
|
+
height?: number;
|
|
20
|
+
label?: string;
|
|
21
|
+
measurementId?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface Face {
|
|
25
|
+
id: string;
|
|
26
|
+
edgeIds: string[];
|
|
27
|
+
type: 'floor' | 'ceiling' | 'zone' | 'custom';
|
|
28
|
+
metadata?: {
|
|
29
|
+
material?: string;
|
|
30
|
+
tags?: string[];
|
|
31
|
+
area?: number;
|
|
32
|
+
measurementIds?: string[];
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface Layout {
|
|
36
|
+
id: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
points: Record<string, Point>;
|
|
39
|
+
edges: Record<string, Edge>;
|
|
40
|
+
faces: Record<string, Face>;
|
|
41
|
+
backgroundImage?: {
|
|
42
|
+
fileId: string;
|
|
43
|
+
position: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
};
|
|
47
|
+
scale: number;
|
|
48
|
+
rotation?: number;
|
|
49
|
+
opacity?: number;
|
|
50
|
+
};
|
|
51
|
+
metadata?: {
|
|
52
|
+
projectId?: string;
|
|
53
|
+
jobId?: string;
|
|
54
|
+
floorLevel?: number;
|
|
55
|
+
lastModified?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface LayoutGroup {
|
|
59
|
+
id: string;
|
|
60
|
+
name?: string;
|
|
61
|
+
projectId: string;
|
|
62
|
+
jobId: string;
|
|
63
|
+
layoutCount?: number;
|
|
64
|
+
thumbnailBase64?: string;
|
|
65
|
+
metadata?: {
|
|
66
|
+
createdAt?: string;
|
|
67
|
+
updatedAt?: string;
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,8 +15,15 @@ export const convertMicrometers = (micrometers, unit, fractionalTolerance, decim
|
|
|
15
15
|
const whole = Math.floor(inches);
|
|
16
16
|
const fractional = inches - whole;
|
|
17
17
|
const numerator = Math.round(fractional * denominator);
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
if (numerator === denominator) {
|
|
19
|
+
value = `${whole + 1}`;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
value =
|
|
23
|
+
numerator === 0
|
|
24
|
+
? `${whole}`
|
|
25
|
+
: `${whole} ${numerator}/${denominator}`;
|
|
26
|
+
}
|
|
20
27
|
}
|
|
21
28
|
else {
|
|
22
29
|
value = inches.toFixed(decimalTolerance.length - 2); // Match decimal places to tolerance
|
|
@@ -36,10 +43,15 @@ export const convertMicrometers = (micrometers, unit, fractionalTolerance, decim
|
|
|
36
43
|
const fractional = inches - wholeInches;
|
|
37
44
|
const denominator = parseInt(fractionalTolerance, 10);
|
|
38
45
|
const numerator = Math.round(fractional * denominator);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
if (numerator === denominator) {
|
|
47
|
+
value = `${wholeFeet}' ${wholeInches + 1}"`;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
value =
|
|
51
|
+
numerator === 0
|
|
52
|
+
? `${wholeFeet}' ${wholeInches}"`
|
|
53
|
+
: `${wholeFeet}' ${wholeInches} ${numerator}/${denominator}"`;
|
|
54
|
+
}
|
|
43
55
|
}
|
|
44
56
|
else if (unit === Units.FeetInchesDecimal) {
|
|
45
57
|
const inches = (fractionalFeet * 12).toFixed(decimalTolerance.length - 2);
|