@floless/app 0.137.3 → 0.138.0

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.
Files changed (47) hide show
  1. package/dist/floless-server.cjs +47890 -27033
  2. package/dist/internal-workflows/floless-rfi-gmail-send/.floless-owner.json +1 -0
  3. package/dist/internal-workflows/floless-rfi-gmail-send/floless-rfi-gmail-send.flo +32 -0
  4. package/dist/schemas/steel.model.v2.schema.json +218 -27
  5. package/dist/skills/floless-app-knowledge/SKILL.md +5 -2
  6. package/dist/skills/floless-app-rfi/SKILL.md +410 -0
  7. package/dist/skills/floless-app-routines/SKILL.md +7 -2
  8. package/dist/skills/floless-app-routines/references/routines-api.md +14 -5
  9. package/dist/skills/floless-app-steel-model/SKILL.md +34 -32
  10. package/dist/skills/floless-app-steel-takeoff/SKILL.md +498 -34
  11. package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +6 -6
  12. package/dist/skills/floless-app-tweak-contract/SKILL.md +6 -2
  13. package/dist/templates/floless-workspace-knowledge.flo +20 -4
  14. package/dist/templates/steel-model.flo +27 -15
  15. package/dist/web/app.css +559 -131
  16. package/dist/web/app.js +216 -54
  17. package/dist/web/aware.js +982 -128
  18. package/dist/web/checkpoint-standard.js +218 -0
  19. package/dist/web/commands-filter.js +23 -0
  20. package/dist/web/commands-shell.js +237 -5
  21. package/dist/web/commands-steel.js +172 -47
  22. package/dist/web/connection-review-client.js +2 -2
  23. package/dist/web/display-units.js +243 -0
  24. package/dist/web/grid-core.js +474 -58
  25. package/dist/web/grid-display.js +344 -0
  26. package/dist/web/index.html +106 -66
  27. package/dist/web/instructor-reporter.js +5 -0
  28. package/dist/web/instructor.js +175 -33
  29. package/dist/web/json-schema-subset.js +145 -25
  30. package/dist/web/steel-3d-core.js +237 -151
  31. package/dist/web/steel-3d-view.js +366 -113
  32. package/dist/web/steel-catalog-picker.js +98 -15
  33. package/dist/web/steel-detail-refs.js +1 -1
  34. package/dist/web/steel-editor.html +6479 -921
  35. package/dist/web/steel-filter.html +404 -57
  36. package/dist/web/steel-model-adapter.js +1 -1
  37. package/dist/web/steel-model-commands.js +72 -66
  38. package/dist/web/steel-model-v2-client-validation.js +10 -3
  39. package/dist/web/steel-model-v2-commands.js +269 -77
  40. package/dist/web/steel-model-v2-projection.js +18 -17
  41. package/dist/web/steel-plan-transform.js +52 -9
  42. package/dist/web/steel-plan-view-id.js +1 -7
  43. package/dist/web/steel-read-confidence.js +454 -5
  44. package/dist/web/steel-units.js +39 -0
  45. package/dist/web/steel-view-generation.js +21 -7
  46. package/dist/web/workspaces.js +2178 -497
  47. package/package.json +5 -1
@@ -1,3 +1,5 @@
1
+ import { IN_TO_MM, LB_PER_FT_TO_KG_PER_M } from './steel-units.js';
2
+
1
3
  /*
2
4
  * steel-catalog-picker.js — environment-neutral catalogue browsing for the native steel editor.
3
5
  *
@@ -43,6 +45,43 @@ function propertyKey(row, map) {
43
45
  return candidates.find((key) => map && Object.prototype.hasOwnProperty.call(map, key)) || candidates[0];
44
46
  }
45
47
 
48
+ /**
49
+ * THE PICKER'S UNIT EDGE (UK epic, slices 0 and 4), and it is a FORMATTER rather than a conversion
50
+ * baked into a row.
51
+ *
52
+ * `/api/aisc-shapes` publishes weights in kg/m and sections in millimetres — canonical, for every
53
+ * environment. A project displays one system or the other, and the two places this module shows a
54
+ * number (the browse list's third column and the detail facts) render whichever the project is on.
55
+ *
56
+ * WHY AT RENDER TIME, not in `buildProfileRows`. The rows are built ONCE and closed over by an open
57
+ * picker; baking the conversion into them would leave a picker that was open when the units changed
58
+ * showing the old system until it was rebuilt, with nothing about it looking wrong. Formatting where
59
+ * the string is produced is what makes a live switch simply correct. (Design review.)
60
+ *
61
+ * Rounded for the same reason `bom-format` rounds its own column: the round trip out of kg/m is not
62
+ * bit-exact, so 372 of the catalogue's 2,644 weighted designations come back with a float tail (a
63
+ * W16X26 as 26.000000000000004). Two decimals is the precision the source table carries.
64
+ */
65
+ const round2 = (n) => Math.round(n * 100) / 100;
66
+ const unitWeightText = (kgPerM, units) =>
67
+ kgPerM == null ? null
68
+ : units === 'mm' ? `${round2(kgPerM)} kg/m`
69
+ : `${round2(kgPerM / LB_PER_FT_TO_KG_PER_M)} lb/ft`;
70
+
71
+ /**
72
+ * A section dimension, in the units the project displays. The served `sections` are MILLIMETRES for
73
+ * every environment (`units:'mm'`), so the metric arm converts nothing.
74
+ *
75
+ * Rounded like the weight, and for the same reason: `398.78 / 25.4` is `15.699999999999998`, and a
76
+ * picker that reads `15.699999999999998"` is reporting float noise as precision. Two decimals is what
77
+ * the source table carries; a millimetre is shown to one, which is all a catalogue publishes (a 16.0
78
+ * mm wall, an 11.1 mm leg).
79
+ */
80
+ const dimText = (mm, units) =>
81
+ mm == null ? null
82
+ : units === 'mm' ? `${Math.round(mm * 10) / 10} mm`
83
+ : `${round2(mm / IN_TO_MM)}"`;
84
+
46
85
  export function buildProfileRows(catalog, sections, weights) {
47
86
  return (catalog?.rows || []).map((row) => {
48
87
  const key = propertyKey(row, weights || sections || {});
@@ -53,6 +92,10 @@ export function buildProfileRows(catalog, sections, weights) {
53
92
  aliases: [...(row.aliases || [])],
54
93
  ...(typeof row.geometrySupported === 'boolean' ? { geometrySupported: row.geometrySupported } : {}),
55
94
  ...(row.sectionShape ? { sectionShape: row.sectionShape } : {}),
95
+ // CANONICAL, exactly as served: millimetres and kilograms per metre. The row is the catalogue's
96
+ // answer; how it READS is decided where it is rendered, which is what lets an open picker follow
97
+ // a live units switch. Names unchanged so `resolveProfileCatalogRow`'s alias signature, which
98
+ // compares these fields, keeps comparing the same things.
56
99
  depth: sec?.[0] ?? null,
57
100
  width: sec?.[1] ?? null,
58
101
  web: sec?.[2] ?? null,
@@ -165,7 +208,12 @@ function ensureStyles(doc) {
165
208
  .scp-semantic{width:100%;display:flex!important;align-items:center;gap:9px;text-align:left;padding:8px 9px!important;background:transparent!important;border-color:transparent!important}.scp-semantic:hover{background:var(--field)!important}.scp-semantic[aria-pressed=true]{background:var(--brand-soft,rgba(59,130,246,.14))!important;border-color:var(--brand)!important}.scp-semantic .icon{color:var(--brand);font-size:14px}.scp-semantic .label{font-weight:650}.scp-semantic .meta{display:block;color:var(--mut);font-size:11px;margin-top:2px}.scp-material-current[hidden]{display:none!important}
166
209
  .scp-tree-state{flex:none;color:var(--mut);padding:12px 14px 16px;text-align:center}.scp-tree-state[hidden]{display:none}.scp-tree-state .scp-clear{margin-top:9px}
167
210
  .scp-option.default{margin-bottom:9px!important;border-bottom-color:var(--line)!important}.scp-option.current .name{color:var(--warn)}
168
- .scp-results{padding:8px}.scp-option{width:100%;display:grid;grid-template-columns:minmax(130px,1fr) 72px 84px;align-items:center;gap:8px;text-align:left;margin:0 0 3px;padding:8px 9px!important;background:transparent!important;border-color:transparent!important}.scp-option:hover{background:var(--field)!important}.scp-option.on{background:var(--brand-soft,rgba(59,130,246,.14))!important;border-color:var(--brand)!important}.scp-option .name{font-weight:650}.scp-option .meta{color:var(--mut);text-align:right;font-variant-numeric:tabular-nums}.scp-option.default{grid-template-columns:1fr}.scp-option.default .name:before{content:'↺';display:inline-block;margin-right:8px;color:var(--brand)}
211
+ /* The unit-weight column is 96px, not 84px, and its cell clips rather than spills. A jumbo section
212
+ is ~872 lb/ft and therefore ~1,298 kg/m — four characters wider in a fixed cell that had no
213
+ overflow rule at all, so the heaviest rows would have pushed into their neighbour. The ellipsis
214
+ is the safety net the column should arguably always have had; the extra 12px is what keeps it
215
+ from being needed. (Design review.) */
216
+ .scp-results{padding:8px}.scp-option{width:100%;display:grid;grid-template-columns:minmax(130px,1fr) 72px 96px;align-items:center;gap:8px;text-align:left;margin:0 0 3px;padding:8px 9px!important;background:transparent!important;border-color:transparent!important}.scp-option:hover{background:var(--field)!important}.scp-option.on{background:var(--brand-soft,rgba(59,130,246,.14))!important;border-color:var(--brand)!important}.scp-option .name{font-weight:650}.scp-option .meta{color:var(--mut);text-align:right;font-variant-numeric:tabular-nums;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.scp-option.default{grid-template-columns:1fr}.scp-option.default .name:before{content:'↺';display:inline-block;margin-right:8px;color:var(--brand)}
169
217
  .scp-details{width:auto;box-sizing:border-box;border-left:1px solid var(--line);padding:14px;background:var(--panel)}.scp-preview{height:126px;display:grid;place-items:center;border:1px solid var(--line);border-radius:8px;background:var(--bg);margin-bottom:12px}.scp-preview svg{width:110px;height:94px;color:var(--brand)}
170
218
  .scp-modal.material .scp-details{border-left:0}
171
219
  .scp-detail-name{font-size:15px;font-weight:750;margin-bottom:3px}.scp-detail-sub{color:var(--mut);margin-bottom:12px}.scp-fact-group{margin-top:14px}.scp-fact-group h4{margin:0 0 3px;color:var(--mut);font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.04em}.scp-facts{display:grid;grid-template-columns:1fr auto;gap:0}.scp-facts dt,.scp-facts dd{margin:0;padding:6px 0;border-bottom:1px solid var(--line)}.scp-facts dt{color:var(--mut)}.scp-facts dd{text-align:right;font-variant-numeric:tabular-nums}.scp-note{line-height:1.5;color:var(--mut)}.scp-warning{margin-top:10px;color:var(--warn);line-height:1.45}
@@ -274,20 +322,26 @@ function schematic(row) {
274
322
  return '';
275
323
  }
276
324
 
277
- export function profileFacts(row) {
325
+ export function profileFacts(row, units = 'ft-in') {
278
326
  const facts = [];
279
- if (row.depth != null) facts.push(['Depth', `${row.depth}"`]);
280
- if (row.width != null) facts.push(['Width', `${row.width}"`]);
281
- if (row.web != null) facts.push(['Web / wall', `${row.web}"`]);
282
- if (row.flange != null) facts.push(['Flange', `${row.flange}"`]);
327
+ const dim = (mm) => dimText(mm, units);
328
+ if (row.depth != null) facts.push(['Depth', dim(row.depth)]);
329
+ if (row.width != null) facts.push(['Width', dim(row.width)]);
330
+ if (row.web != null) facts.push(['Web / wall', dim(row.web)]);
331
+ if (row.flange != null) facts.push(['Flange', dim(row.flange)]);
283
332
  const pair = parseDoubleAngleDesignation(row.designation);
284
- if (pair) facts.push(['Gap', formatImperialInches(pair.gap)]);
285
- if (row.weight != null) facts.push(['Weight', `${row.weight} lb/ft`]);
333
+ // The double-angle gap is parsed out of the DESIGNATION, which spells it in inches — so it arrives
334
+ // in inches rather than in millimetres and converts the other way. Routed through the same formatter
335
+ // as every other dimension so a metric project does not read three facts in mm and one in inches;
336
+ // the design review caught it sitting outside the swap. (`formatImperialInches` keeps the ft-in arm
337
+ // exactly as it reads today, fractions and all.)
338
+ if (pair) facts.push(['Gap', units === 'mm' ? dim(pair.gap * IN_TO_MM) : formatImperialInches(pair.gap)]);
339
+ if (row.weight != null) facts.push(['Weight', unitWeightText(row.weight, units)]);
286
340
  return facts;
287
341
  }
288
342
 
289
- function factsHtml(row) {
290
- const facts = profileFacts(row);
343
+ function factsHtml(row, units) {
344
+ const facts = profileFacts(row, units);
291
345
  return facts.length
292
346
  ? `<dl class=scp-facts>${facts.map(([k, v]) => `<dt>${esc(k)}</dt><dd>${esc(v)}</dd>`).join('')}</dl>`
293
347
  : '<div class=scp-note>Section dimensions and weight are unavailable for this catalog entry.</div>';
@@ -305,7 +359,14 @@ function materialFactsHtml(row) {
305
359
  }
306
360
 
307
361
  /** Create one dialog instance. Call twice: once for Profile, once for Material. */
308
- export function createCatalogPicker({ kind, catalog, rows, onRetry, document: doc = globalThis.document } = {}) {
362
+ export function createCatalogPicker({
363
+ kind, catalog, rows, onRetry,
364
+ // A FUNCTION, not a value: the picker outlives a units switch, and a value captured at construction
365
+ // would leave an open picker rendering the system the project was on when it opened. Asked afresh on
366
+ // every render, which is the whole reason the rows carry canonical numbers. (Design review.)
367
+ displayUnits = () => 'ft-in',
368
+ document: doc = globalThis.document,
369
+ } = {}) {
309
370
  if (!doc) throw new Error('createCatalogPicker requires a document');
310
371
  ensureStyles(doc);
311
372
  const isMaterial = kind === 'material';
@@ -503,7 +564,7 @@ export function createCatalogPicker({ kind, catalog, rows, onRetry, document: do
503
564
  } else {
504
565
  const supported = selected.geometrySupported !== false;
505
566
  const preview = supported ? schematic(selected) : '';
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)}`
567
+ 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, displayUnits())}`
507
568
  + ((selected.aliases || []).length ? `<div class=scp-note style="margin-top:10px">Related catalog names: ${esc(selected.aliases.join(', '))}</div>` : '')
508
569
  + (!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>' : '')
509
570
  + `<div class=scp-custom><label for=${modal.id}Custom>Custom / unresolved designation</label><div class=row><input data-command-id="steel.catalog-custom#profile" id=${modal.id}Custom value="${selected.custom ? esc(selected.designation) : ''}" placeholder="e.g. MF1" autocomplete=off><button data-command-id="steel.catalog-use-custom#profile" class=scp-use-custom>Use</button></div></div>`;
@@ -559,11 +620,16 @@ export function createCatalogPicker({ kind, catalog, rows, onRetry, document: do
559
620
  return;
560
621
  }
561
622
  const shown = filtered.slice(0, visible);
623
+ const units = displayUnits();
562
624
  resultFocusIndex = Math.max(0, Math.min(resultFocusIndex, shown.length - 1));
563
625
  results.innerHTML = shown.map((row, index) => {
564
626
  const value = rowValue(row), on = selected && normalizeCatalogText(rowValue(selected)) === normalizeCatalogText(value);
565
- const dims = row.depth != null && row.width != null ? `${row.depth} × ${row.width} in` : '—';
566
- return `<button data-command-id="steel.catalog-profile#${esc(row.designation)}" class="scp-option${on ? ' on' : ''}" role=option aria-selected="${on}" tabindex="${index === resultFocusIndex ? '0' : '-1'}" data-index=${index}><span class=name>${esc(row.designation)}</span><span class=meta>${esc(row.family)}</span><span class=meta>${row.weight == null ? '—' : esc(row.weight + ' lb/ft')}</span><span class=sr-only>${esc(dims)}</span></button>`;
627
+ // Both strings come from the SAME formatters the detail facts use, so the row a user scans and
628
+ // the panel they open cannot disagree about units. The screen-reader dims line is real text
629
+ // content rather than an aria-label, so there is no second copy to keep in step.
630
+ const dims = row.depth != null && row.width != null
631
+ ? `${dimText(row.depth, units)} × ${dimText(row.width, units)}` : '—';
632
+ return `<button data-command-id="steel.catalog-profile#${esc(row.designation)}" class="scp-option${on ? ' on' : ''}" role=option aria-selected="${on}" tabindex="${index === resultFocusIndex ? '0' : '-1'}" data-index=${index}><span class=name>${esc(row.designation)}</span><span class=meta>${esc(row.family)}</span><span class=meta>${row.weight == null ? '—' : esc(unitWeightText(row.weight, units))}</span><span class=sr-only>${esc(dims)}</span></button>`;
567
633
  }).join('') + (visible < filtered.length ? `<button data-command-id="steel.catalog-show-more#profiles" class=scp-more>Show ${Math.min(300, filtered.length - visible)} more</button>` : '');
568
634
  const clear = results.querySelector('.scp-clear'); if (clear) clear.onclick = () => { search.value = ''; visible = 300; resultFocusIndex = 0; render(); search.focus(); };
569
635
  results.querySelectorAll('.scp-option').forEach((button) => {
@@ -711,5 +777,22 @@ export function createCatalogPicker({ kind, catalog, rows, onRetry, document: do
711
777
  else if (!event.shiftKey && doc.activeElement === last) { event.preventDefault(); first.focus(); }
712
778
  });
713
779
 
714
- return { open, close, element: modal };
780
+ /**
781
+ * Re-render an OPEN picker in whatever `displayUnits()` now answers.
782
+ *
783
+ * Formatting at render time is only half the job: nothing re-renders a picker that is already on
784
+ * screen, so a units switch — from this tab's own ⋯ menu or from another tab, through
785
+ * `display-units-changed` — left it showing kg/m and millimetres after the rest of the editor had
786
+ * gone back to lb/ft, with nothing about it looking wrong. Found by driving it in a real browser;
787
+ * no unit test would have, because the defect is that a repaint does not happen.
788
+ *
789
+ * A no-op while closed, so the caller does not have to ask.
790
+ */
791
+ function refresh() {
792
+ if (modal.hidden) return;
793
+ if (!isMaterial) renderResults();
794
+ renderDetails();
795
+ }
796
+
797
+ return { open, close, refresh, element: modal };
715
798
  }
@@ -281,7 +281,7 @@ export function planScoredDetails(plan) {
281
281
  // which is the scope this function has: the same detail referenced from two different plans stays
282
282
  // two rows, and each row names its own plan's sheet, so the worklist still says where to look. On
283
283
  // the demo model that takes 42 bubbles to 32 rows over three plans, for 21 distinct references.
284
- const key = name + '' + targetSheet;
284
+ const key = name + '\x00' + targetSheet;
285
285
  if (seen.has(key)) continue;
286
286
  seen.add(key);
287
287
  out.push({ text: name, targetSheet: targetSheet || null, kind: text(entry.kind) || 'detail' });