@floless/app 0.101.1 → 0.101.3
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/floless-server.cjs +7 -2
- package/dist/schemas/steel.takeoff.v1.schema.json +5 -4
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +4 -2
- package/dist/web/grid-core.js +164 -44
- package/dist/web/steel-3d-core.js +110 -0
- package/dist/web/steel-3d-view.js +88 -50
- package/dist/web/steel-editor.html +109 -80
- package/dist/web/steel-view-generation.js +36 -2
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* sanitised draft-only saved-view records. steel-editor.html owns the modal/persistence and
|
|
7
7
|
* steel-3d-view.js owns the camera/mesh intersection.
|
|
8
8
|
*/
|
|
9
|
-
import { parseLen } from './grid-core.js';
|
|
9
|
+
import { parseLen, fmtLen } from './grid-core.js';
|
|
10
10
|
|
|
11
11
|
export const DEFAULT_CUT_MM = 24 * 25.4;
|
|
12
12
|
|
|
@@ -39,12 +39,46 @@ export function parseDepths(kind, raw) {
|
|
|
39
39
|
const values = {};
|
|
40
40
|
for (const key of keys) {
|
|
41
41
|
const mm = parseLen(String(raw?.[key] ?? '').trim());
|
|
42
|
-
if (!positive(mm)) return { ok: false, error: `${key} must be
|
|
42
|
+
if (!positive(mm) || !positive(parseLen(fmtLen(mm)))) return { ok: false, error: `${key} must be at least 1/16\"`, values: null };
|
|
43
43
|
values[key] = mm;
|
|
44
44
|
}
|
|
45
45
|
return { ok: true, error: '', values };
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
export function normalizeDepths(kind, raw) {
|
|
49
|
+
const parsed = parseDepths(kind, raw);
|
|
50
|
+
if (!parsed.ok) return parsed;
|
|
51
|
+
return { ...parsed, formatted: Object.fromEntries(Object.entries(parsed.values).map(([key, mm]) => [key, fmtLen(mm)])) };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Shift-range is add-only: it never removes choices already checked outside the range. */
|
|
55
|
+
export function addRange(keys, selected, anchor, target) {
|
|
56
|
+
const out = new Set(selected || []), a = keys.indexOf(anchor), b = keys.indexOf(target);
|
|
57
|
+
if (a < 0 || b < 0) { if (target) out.add(target); return out; }
|
|
58
|
+
for (let i = Math.min(a, b); i <= Math.max(a, b); i++) out.add(keys[i]);
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Map the editor's stable 2D/3D grid ids to the generator's regular-grid source keys. */
|
|
63
|
+
export function preselectedSourceKeys(gridIds, sources) {
|
|
64
|
+
const available = new Set([...(sources?.x || []), ...(sources?.y || [])].map((s) => `${s.kind}:${s.index}`));
|
|
65
|
+
const out = new Set();
|
|
66
|
+
for (const id of gridIds || []) {
|
|
67
|
+
const m = /^(gv|gh):(\d+)$/.exec(String(id));
|
|
68
|
+
if (!m) continue;
|
|
69
|
+
const key = `${m[1] === 'gv' ? 'grid-x' : 'grid-y'}:${m[2]}`;
|
|
70
|
+
if (available.has(key)) out.add(key);
|
|
71
|
+
}
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Free-angle grids are selectable/editable, but F11 can only cut views from regular X/Y datums. */
|
|
76
|
+
export function unsupportedFreeGridCount(gridIds) {
|
|
77
|
+
let count = 0;
|
|
78
|
+
for (const id of gridIds || []) if (/^gl:/.test(String(id))) count++;
|
|
79
|
+
return count;
|
|
80
|
+
}
|
|
81
|
+
|
|
48
82
|
function saneBounds(bounds) {
|
|
49
83
|
return !!(bounds && vec3(bounds.min) && vec3(bounds.max)
|
|
50
84
|
&& bounds.min.every((n, i) => n < bounds.max[i]));
|