@floless/app 0.132.2 → 0.133.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/floless-server.cjs +5955 -3275
- package/dist/schemas/steel.model.v2.schema.json +216 -3
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +66 -5
- package/dist/templates/steel-model.flo +6 -2
- package/dist/web/app.css +41 -1
- package/dist/web/app.js +3 -2
- package/dist/web/aware.js +291 -12
- package/dist/web/commands-shell.js +40 -2
- package/dist/web/commands-steel.js +130 -3
- package/dist/web/index.html +16 -3
- package/dist/web/instructor.js +108 -25
- package/dist/web/steel-3d-core.js +137 -11
- package/dist/web/steel-3d-view.js +38 -13
- package/dist/web/steel-catalog-picker.js +96 -5
- package/dist/web/steel-editor.html +380 -168
- package/dist/web/steel-model-v2-client-validation.js +6 -0
- package/dist/web/steel-model-v2-commands.js +127 -50
- package/dist/web/steel-model-v2-projection.js +3 -2
- package/package.json +4 -1
|
@@ -176,27 +176,118 @@ function ensureStyles(doc) {
|
|
|
176
176
|
doc.head.appendChild(style);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
function
|
|
180
|
-
const
|
|
179
|
+
function parseCatalogDimension(token) {
|
|
180
|
+
const value = String(token || '').trim();
|
|
181
|
+
let match = /^(\d+)(?:\s+|-)(\d+)\/(\d+)$/.exec(value);
|
|
182
|
+
if (match) {
|
|
183
|
+
const denominator = Number(match[3]);
|
|
184
|
+
return denominator > 0 ? Number(match[1]) + Number(match[2]) / denominator : null;
|
|
185
|
+
}
|
|
186
|
+
match = /^(\d+)\/(\d+)$/.exec(value);
|
|
187
|
+
if (match) {
|
|
188
|
+
const denominator = Number(match[2]);
|
|
189
|
+
return denominator > 0 ? Number(match[1]) / denominator : null;
|
|
190
|
+
}
|
|
191
|
+
return /^\d+(?:\.\d+)?$/.test(value) ? Number(value) : null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function parseDoubleAngleDesignation(designation) {
|
|
195
|
+
// Preserve mixed-fraction boundaries before the generic search normalizer removes whitespace.
|
|
196
|
+
// Without this, `2 1/2` becomes `21/2` and silently reads as 10.5 inches.
|
|
197
|
+
const fractionSafe = String(designation == null ? '' : designation)
|
|
198
|
+
.replace(/\u00a0/g, ' ')
|
|
199
|
+
.replace(/(\d)\s+(\d+\/\d+)/g, '$1-$2');
|
|
200
|
+
let key = normalizeCatalogText(fractionSafe);
|
|
201
|
+
if (!key.startsWith('2L')) return null;
|
|
202
|
+
key = key.slice(2);
|
|
203
|
+
const suffix = /(LLBB|SLBB)$/.exec(key);
|
|
204
|
+
const orientation = suffix ? suffix[1].toLowerCase() : null;
|
|
205
|
+
if (suffix) key = key.slice(0, -suffix[1].length);
|
|
206
|
+
const tokens = key.split('X');
|
|
207
|
+
if (tokens.length !== 3 && tokens.length !== 4) return null;
|
|
208
|
+
const values = tokens.map(parseCatalogDimension);
|
|
209
|
+
if (values.slice(0, 3).some((value) => value == null || value <= 0)) return null;
|
|
210
|
+
const gap = tokens.length === 4 ? values[3] : 0;
|
|
211
|
+
if (gap == null || (tokens.length === 4 && gap <= 0) || (!orientation && Math.abs(values[0] - values[1]) > 1e-9)) return null;
|
|
212
|
+
return { legA: values[0], legB: values[1], thickness: values[2], gap, orientation: orientation || 'llbb' };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function formatImperialInches(value) {
|
|
216
|
+
if (!Number.isFinite(value) || value < 0) return null;
|
|
217
|
+
const denominator = 64;
|
|
218
|
+
const scaled = value * denominator;
|
|
219
|
+
// Catalog fractions are rendered conventionally, but a valid decimal custom designation must
|
|
220
|
+
// remain exact rather than being silently rounded to the nearest 1/64 inch.
|
|
221
|
+
if (Math.abs(scaled - Math.round(scaled)) > 1e-9) return `${Number(value.toFixed(9))}\"`;
|
|
222
|
+
const rounded = Math.round(scaled);
|
|
223
|
+
const whole = Math.floor(rounded / denominator);
|
|
224
|
+
let numerator = rounded % denominator;
|
|
225
|
+
if (!numerator) return `${whole}\"`;
|
|
226
|
+
let divisor = numerator;
|
|
227
|
+
let other = denominator;
|
|
228
|
+
while (other) [divisor, other] = [other, divisor % other];
|
|
229
|
+
numerator /= divisor;
|
|
230
|
+
const reducedDenominator = denominator / divisor;
|
|
231
|
+
return `${whole ? `${whole} ` : ''}${numerator}/${reducedDenominator}\"`;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function n(value) { return Number(value.toFixed(3)); }
|
|
235
|
+
|
|
236
|
+
function doubleAngleSchematic(spec) {
|
|
237
|
+
const shortBack = spec.orientation === 'slbb';
|
|
238
|
+
const back = shortBack ? spec.legB : spec.legA;
|
|
239
|
+
const outstanding = shortBack ? spec.legA : spec.legB;
|
|
240
|
+
const fullWidth = 2 * outstanding + spec.gap;
|
|
241
|
+
const scale = Math.min(68 / fullWidth, 68 / back);
|
|
242
|
+
const halfBack = back * scale / 2;
|
|
243
|
+
const halfGap = spec.gap * scale / 2;
|
|
244
|
+
const out = outstanding * scale;
|
|
245
|
+
const thickness = Math.max(2.5, Math.min(spec.thickness * scale, halfBack * 2, out));
|
|
246
|
+
const cx = 50, cy = 50;
|
|
247
|
+
const left = [
|
|
248
|
+
[cx-halfGap-out,cy-halfBack],[cx-halfGap,cy-halfBack],[cx-halfGap,cy+halfBack],
|
|
249
|
+
[cx-halfGap-thickness,cy+halfBack],[cx-halfGap-thickness,cy-halfBack+thickness],[cx-halfGap-out,cy-halfBack+thickness],
|
|
250
|
+
];
|
|
251
|
+
const right = [
|
|
252
|
+
[cx+halfGap,cy-halfBack],[cx+halfGap+out,cy-halfBack],[cx+halfGap+out,cy-halfBack+thickness],
|
|
253
|
+
[cx+halfGap+thickness,cy-halfBack+thickness],[cx+halfGap+thickness,cy+halfBack],[cx+halfGap,cy+halfBack],
|
|
254
|
+
];
|
|
255
|
+
const path = (points) => points.map(([x, y], index) => `${index ? 'L' : 'M'}${n(x)} ${n(y)}`).join('') + 'Z';
|
|
256
|
+
return `<svg viewBox="0 0 100 100" aria-hidden="true" data-back-leg="${back}" data-outstanding-leg="${outstanding}"><path d="${path(left)}" fill="currentColor"/><path d="${path(right)}" fill="currentColor"/></svg>`;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export function profileSchematic(row) { return schematic(row); }
|
|
260
|
+
|
|
261
|
+
function schematic(row) {
|
|
262
|
+
const f = String(row?.family || '').toUpperCase();
|
|
263
|
+
const doubleAngle = parseDoubleAngleDesignation(row?.designation);
|
|
264
|
+
if (doubleAngle) return doubleAngleSchematic(doubleAngle);
|
|
181
265
|
const common = 'fill="none" stroke="currentColor" stroke-width="7" stroke-linejoin="round" stroke-linecap="round"';
|
|
182
266
|
if (f === 'HSS') return `<svg viewBox="0 0 100 100" aria-hidden="true"><rect x="17" y="17" width="66" height="66" rx="4" ${common}/><rect x="31" y="31" width="38" height="38" rx="2" ${common}/></svg>`;
|
|
183
267
|
if (f === 'PIPE' || f === 'CHS') return `<svg viewBox="0 0 100 100" aria-hidden="true"><circle cx="50" cy="50" r="34" ${common}/><circle cx="50" cy="50" r="21" ${common}/></svg>`;
|
|
184
268
|
if (f === 'RE') return `<svg viewBox="0 0 100 100" aria-hidden="true"><circle cx="50" cy="50" r="31" fill="currentColor"/><path d="M28 40L72 60M28 60L72 40" fill="none" stroke="var(--panel)" stroke-width="4" stroke-linecap="round"/></svg>`;
|
|
185
269
|
if (f === 'L') return `<svg viewBox="0 0 100 100" aria-hidden="true"><path d="M25 18V78H82" ${common}/></svg>`;
|
|
186
|
-
if (f === '2L') return
|
|
270
|
+
if (f === '2L') return '';
|
|
187
271
|
if (f === 'C' || f === 'MC') return `<svg viewBox="0 0 100 100" aria-hidden="true"><path d="M76 20H30V80H76" ${common}/></svg>`;
|
|
188
272
|
if (f === 'WT' || f === 'MT' || f === 'ST') return `<svg viewBox="0 0 100 100" aria-hidden="true"><path d="M18 24H82M50 24V82" ${common}/></svg>`;
|
|
189
273
|
if (f === 'W' || f === 'M' || f === 'S' || f === 'HP') return `<svg viewBox="0 0 100 100" aria-hidden="true"><path d="M18 20H82M50 20V80M18 80H82" ${common}/></svg>`;
|
|
190
274
|
return '';
|
|
191
275
|
}
|
|
192
276
|
|
|
193
|
-
function
|
|
277
|
+
export function profileFacts(row) {
|
|
194
278
|
const facts = [];
|
|
195
279
|
if (row.depth != null) facts.push(['Depth', `${row.depth}"`]);
|
|
196
280
|
if (row.width != null) facts.push(['Width', `${row.width}"`]);
|
|
197
281
|
if (row.web != null) facts.push(['Web / wall', `${row.web}"`]);
|
|
198
282
|
if (row.flange != null) facts.push(['Flange', `${row.flange}"`]);
|
|
283
|
+
const pair = parseDoubleAngleDesignation(row.designation);
|
|
284
|
+
if (pair) facts.push(['Gap', formatImperialInches(pair.gap)]);
|
|
199
285
|
if (row.weight != null) facts.push(['Weight', `${row.weight} lb/ft`]);
|
|
286
|
+
return facts;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
function factsHtml(row) {
|
|
290
|
+
const facts = profileFacts(row);
|
|
200
291
|
return facts.length
|
|
201
292
|
? `<dl class=scp-facts>${facts.map(([k, v]) => `<dt>${esc(k)}</dt><dd>${esc(v)}</dd>`).join('')}</dl>`
|
|
202
293
|
: '<div class=scp-note>Section dimensions and weight are unavailable for this catalog entry.</div>';
|
|
@@ -411,7 +502,7 @@ export function createCatalogPicker({ kind, catalog, rows, onRetry, document: do
|
|
|
411
502
|
+ `<div class=scp-custom><label for=${modal.id}Custom>Custom material designation</label><div class=row><input data-command-id="steel.catalog-custom#material" id=${modal.id}Custom value="${selected.custom ? esc(selected.value) : ''}" placeholder="e.g. A913-GR.65" autocomplete=off><button data-command-id="steel.catalog-use-custom#material" class=scp-use-custom>Use</button></div></div>`;
|
|
412
503
|
} else {
|
|
413
504
|
const supported = selected.geometrySupported !== false;
|
|
414
|
-
const preview = supported ? schematic(selected
|
|
505
|
+
const preview = supported ? schematic(selected) : '';
|
|
415
506
|
details.innerHTML = `<div class=scp-preview>${preview || '<div class=scp-note>Section preview unavailable for this catalog entry.</div>'}</div><div class=scp-detail-name>${esc(selected.designation)}</div><div class=scp-detail-sub>${selected.current ? 'Current model value · not in this catalog' : esc((catalog?.families || []).find((g) => g.id === selected.family)?.label || selected.family)}</div>${factsHtml(selected)}`
|
|
416
507
|
+ ((selected.aliases || []).length ? `<div class=scp-note style="margin-top:10px">Related catalog names: ${esc(selected.aliases.join(', '))}</div>` : '')
|
|
417
508
|
+ (!supported ? '<div class=scp-warning>This catalog record includes envelope and weight, but not chord or web geometry, so FloLess cannot model this joist faithfully.</div>' : '')
|