@floless/app 0.134.1 → 0.134.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 +2837 -1082
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +268 -31
- package/dist/skills/steel-drawing-abbreviations/SKILL.md +18 -1
- package/dist/web/app.css +14 -0
- package/dist/web/app.js +4 -0
- package/dist/web/commands-filter.js +16 -13
- package/dist/web/commands-shell.js +33 -0
- package/dist/web/commands-steel.js +49 -9
- package/dist/web/commands.js +4 -0
- package/dist/web/connection-review-client.js +120 -0
- package/dist/web/index.html +25 -4
- package/dist/web/instructor.js +29 -11
- package/dist/web/steel-3d-core.js +101 -7
- package/dist/web/steel-3d-view.js +757 -242
- package/dist/web/steel-canvas-guidance.js +9 -1
- package/dist/web/steel-detail-refs.js +118 -0
- package/dist/web/steel-editor.html +1476 -188
- package/dist/web/steel-filter-core.js +53 -22
- package/dist/web/steel-filter.html +472 -78
- package/dist/web/steel-model-v2-client-validation.js +6 -0
- package/dist/web/steel-profile-colours.js +54 -0
- package/dist/web/steel-read-confidence.js +140 -0
- package/dist/web/steel-reference-sheet.js +50 -0
- package/dist/web/steel-view-generation.js +119 -27
- package/dist/web/workspaces.js +444 -58
- package/package.json +2 -1
|
@@ -9,7 +9,8 @@ export function canvasToolGuidanceState(state = {}) {
|
|
|
9
9
|
const forceOpen = !!(
|
|
10
10
|
state.teklaDragActive || state.workPlaneMode || state.addActive || state.transformActive ||
|
|
11
11
|
state.referenceMeasureActive || state.gridLinePickActive || state.clipMode || state.dimensionMode ||
|
|
12
|
-
state.insertMode || state.basePickColumn || state.frameMode || state.framePickStep != null || state.geometryMode
|
|
12
|
+
state.insertMode || state.basePickColumn || state.frameMode || state.framePickStep != null || state.geometryMode ||
|
|
13
|
+
state.connectionMemberPick
|
|
13
14
|
);
|
|
14
15
|
|
|
15
16
|
let text = null;
|
|
@@ -17,6 +18,13 @@ export function canvasToolGuidanceState(state = {}) {
|
|
|
17
18
|
text = state.dimensionHasStart
|
|
18
19
|
? 'Click the second dimension point · Esc to step back'
|
|
19
20
|
: 'Click the first dimension point · Esc to cancel';
|
|
21
|
+
} else if (state.connectionMemberPick) {
|
|
22
|
+
const n = state.connectionMemberPickCount || 0;
|
|
23
|
+
// Esc SKIPS rather than cancels: the geometry is already placed by the time this pick is armed, so
|
|
24
|
+
// saying "cancel" would promise an undo this step cannot deliver.
|
|
25
|
+
text = n
|
|
26
|
+
? `${n} member${n === 1 ? '' : 's'} picked · Enter to confirm · Esc to skip`
|
|
27
|
+
: 'Click each member this connection joins · Enter to confirm · Esc to skip';
|
|
20
28
|
} else if (state.insertMode) {
|
|
21
29
|
text = `Click to place ${state.insertName || 'the detail'} on a member face or the working plane · Esc to cancel`;
|
|
22
30
|
} else if (state.basePickColumn) {
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
* exactly as the drawing prints it is also what lets a detailer match it against the sheet.
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
import { normalizeCatalogText } from './steel-catalog-picker.js';
|
|
31
|
+
|
|
30
32
|
const finite = (n) => Number.isFinite(typeof n === 'number' ? n : Number(n));
|
|
31
33
|
/** A drawable position. The renderer coerces, so numeric strings are accepted — but not a NaN, which
|
|
32
34
|
* would put an un-clickable rect at an undefined coordinate. */
|
|
@@ -102,6 +104,122 @@ export function planDetailRefs(plan) {
|
|
|
102
104
|
return out;
|
|
103
105
|
}
|
|
104
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Every drawable profile label on the plan: `{text, disp}`, in source order, NOT deduplicated.
|
|
109
|
+
*
|
|
110
|
+
* These are `plan.labels[]` — the PDF-extracted `{text, disp}` strings the profile-pick overlay draws
|
|
111
|
+
* as clickable hot-zones ("click a profile label in the drawing to apply it"). Same shape rule as
|
|
112
|
+
* `planDetailRefs`: an entry needs BOTH a printable string AND a drawable point, because the hot-zone
|
|
113
|
+
* is sized from the text and positioned at `disp` — an empty string sizes a zero box and a missing/NaN
|
|
114
|
+
* `disp` puts a rect at an undefined coordinate. Dropping the malformed ones here keeps that validation
|
|
115
|
+
* (and its tests) out of the page closure, where #887 hid: the overlay drew a positioned box for every
|
|
116
|
+
* label but never the text inside it, so every hot-zone rendered empty and unlabelled.
|
|
117
|
+
*/
|
|
118
|
+
export function planProfileLabels(plan) {
|
|
119
|
+
if (!plan || typeof plan !== 'object' || !Array.isArray(plan.labels)) return [];
|
|
120
|
+
const out = [];
|
|
121
|
+
for (const entry of plan.labels) {
|
|
122
|
+
if (!entry || typeof entry !== 'object') continue;
|
|
123
|
+
const name = text(entry.text);
|
|
124
|
+
if (!name || !point(entry.disp)) continue;
|
|
125
|
+
out.push({ text: name, disp: [Number(entry.disp[0]), Number(entry.disp[1])] });
|
|
126
|
+
}
|
|
127
|
+
return out;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const profileSheetIndex = new WeakMap();
|
|
131
|
+
const canonicalProfile = (value) => normalizeCatalogText(value);
|
|
132
|
+
// Drawing labels may legitimately name custom, built-up, foreign, or unresolved sections that are
|
|
133
|
+
// absent from the installed catalogue. Keep those pickable (the editor marks them RFI), while rejecting
|
|
134
|
+
// ordinary annotations. Catalogue membership is authoritative; outside it, accept only known structural
|
|
135
|
+
// section families plus the two explicit unresolved/custom conventions FloLess already authors.
|
|
136
|
+
const STRUCTURAL_PROFILE = /^(?:2L|HSS|PIPE|HP|MC|WT|MT|ST|W|M|S|C|L|IPE|IPN|HEA|HEB|HEM|HE|HL|HD|UB|UC|UKB|UKC|PFC|CHS|RHS|SHS|EA|UA)\d/;
|
|
137
|
+
const CUSTOM_PROFILE = /^(?:MF\d+|BG\d+-CUSTOM)$/;
|
|
138
|
+
const DRAWING_ANNOTATION = /^(?:NOTE|NOTES|GRID|LEVEL|ELEV|ELEVATION|DETAIL|SHEET)\d/;
|
|
139
|
+
const profileToken = (value) => {
|
|
140
|
+
const name = canonicalProfile(value);
|
|
141
|
+
return name.length >= 2 && name.length <= 64 && /[A-Z]/.test(name) && /\d/.test(name)
|
|
142
|
+
&& /^[A-Z0-9][A-Z0-9X./+'"#-]*$/.test(name)
|
|
143
|
+
? name : '';
|
|
144
|
+
};
|
|
145
|
+
const profileDesignation = (value, catalogue) => {
|
|
146
|
+
const name = profileToken(value);
|
|
147
|
+
return name && !DRAWING_ANNOTATION.test(name)
|
|
148
|
+
&& (catalogue.has(name) || STRUCTURAL_PROFILE.test(name) || CUSTOM_PROFILE.test(name)) ? name : '';
|
|
149
|
+
};
|
|
150
|
+
const sheetKey = (value) => String(value == null ? '' : value).trim().replace(/\s+/g, ' ').toUpperCase();
|
|
151
|
+
const bbox = (value) => Array.isArray(value) && value.length >= 4 && value.slice(0, 4).every(finite)
|
|
152
|
+
&& Number(value[2]) >= Number(value[0]) && Number(value[3]) >= Number(value[1]);
|
|
153
|
+
const intersects = (a, b) => !b || (a[2] >= b[0] && a[0] <= b[2] && a[3] >= b[1] && a[1] <= b[3]);
|
|
154
|
+
|
|
155
|
+
function indexedFilterLabels(sheet) {
|
|
156
|
+
const cached = profileSheetIndex.get(sheet);
|
|
157
|
+
if (cached) return cached;
|
|
158
|
+
const out = [];
|
|
159
|
+
for (const entry of Array.isArray(sheet?.elements) ? sheet.elements : []) {
|
|
160
|
+
if (!entry || entry.kind !== 'text' || !bbox(entry.bbox)) continue;
|
|
161
|
+
const name = profileToken(entry.text);
|
|
162
|
+
if (!name) continue;
|
|
163
|
+
const box = entry.bbox.slice(0, 4).map(Number);
|
|
164
|
+
out.push({ text: name, disp: [(box[0] + box[2]) / 2, (box[1] + box[3]) / 2], bbox: box });
|
|
165
|
+
}
|
|
166
|
+
profileSheetIndex.set(sheet, out);
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The bounded data source for the profile-pick overlay.
|
|
172
|
+
*
|
|
173
|
+
* Authored plan labels win. Only when there are none does the caller receive a Filter-text fallback,
|
|
174
|
+
* and that fallback is available only for one exact, case-folded sheet match. The Filter sheet's raw
|
|
175
|
+
* text is indexed once by object identity; designation-shape validation, viewport intersection and the
|
|
176
|
+
* DOM cap keep a 40k-element drawing from becoming a 40k-node overlay without hiding unresolved profiles.
|
|
177
|
+
*/
|
|
178
|
+
export function planProfileLabelOverlay(plan, filter, options = {}) {
|
|
179
|
+
const max = Number.isSafeInteger(options.max) && options.max > 0 ? options.max : 500;
|
|
180
|
+
const viewport = bbox(options.viewport) ? options.viewport.slice(0, 4).map(Number) : null;
|
|
181
|
+
const catalogue = new Set((Array.isArray(options.profiles) ? options.profiles : []).map(canonicalProfile).filter(Boolean));
|
|
182
|
+
const explicit = [];
|
|
183
|
+
const seen = new Set();
|
|
184
|
+
for (const entry of Array.isArray(plan?.labels) ? plan.labels : []) {
|
|
185
|
+
if (!entry || !point(entry.disp)) continue;
|
|
186
|
+
const name = profileDesignation(entry.text, catalogue);
|
|
187
|
+
if (!name) continue;
|
|
188
|
+
const x = Number(entry.disp[0]), y = Number(entry.disp[1]), key = `${name}\0${x}\0${y}`;
|
|
189
|
+
if (seen.has(key)) continue;
|
|
190
|
+
seen.add(key);
|
|
191
|
+
explicit.push({ text: name, disp: [x, y], bbox: [x, y, x, y] });
|
|
192
|
+
}
|
|
193
|
+
let source = 'plan', candidates = explicit, diagnostic = null;
|
|
194
|
+
if (!explicit.length) {
|
|
195
|
+
const wanted = sheetKey(plan?.sheet);
|
|
196
|
+
const matches = (Array.isArray(filter?.sheets) ? filter.sheets : []).filter((sheet) => sheetKey(sheet?.sheet) === wanted);
|
|
197
|
+
if (matches.length !== 1) {
|
|
198
|
+
const action = ' Save the matching sheet in Drawing Filter, or choose a profile with Browse.';
|
|
199
|
+
diagnostic = matches.length
|
|
200
|
+
? `Profile picking is unavailable because more than one Filter sheet matches ${text(plan?.sheet) || 'this plan'}.${action}`
|
|
201
|
+
: `Profile picking is unavailable because no Filter sheet matches ${text(plan?.sheet) || 'this plan'}.${action}`;
|
|
202
|
+
return { labels: [], source: 'none', hidden: 0, message: null, diagnostic };
|
|
203
|
+
}
|
|
204
|
+
source = 'filter';
|
|
205
|
+
const fallbackSeen = new Set();
|
|
206
|
+
candidates = indexedFilterLabels(matches[0]).filter((entry) => {
|
|
207
|
+
if (!profileDesignation(entry.text, catalogue)) return false;
|
|
208
|
+
const key = `${entry.text}\0${entry.bbox.join('\0')}`;
|
|
209
|
+
if (fallbackSeen.has(key)) return false;
|
|
210
|
+
fallbackSeen.add(key);
|
|
211
|
+
return true;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
const visible = candidates.filter((entry) => intersects(entry.bbox, viewport));
|
|
215
|
+
const labels = visible.slice(0, max);
|
|
216
|
+
const hidden = visible.length - labels.length;
|
|
217
|
+
return {
|
|
218
|
+
labels, source, hidden, diagnostic,
|
|
219
|
+
message: hidden > 0 ? 'Zoom in to reveal the remaining profile labels' : null,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
105
223
|
/**
|
|
106
224
|
* Callout kinds that are NOT details for scoring purposes.
|
|
107
225
|
*
|