@floless/app 0.125.1 → 0.126.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.
@@ -73,6 +73,12 @@ nodes:
73
73
  sb.Append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">");
74
74
  sb.Append("<title>" + E(title) + "</title><style>");
75
75
  sb.Append("*{margin:0;padding:0;box-sizing:border-box}");
76
+ // Scrollbars, themed GLOBALLY for both engines. The report is its own document inside the
77
+ // Viewer iframe, so web/app.css never reaches it: without this the page itself — and any
78
+ // container a later edit makes scrollable — falls back to the browser's own bar. Firefox
79
+ // reads only scrollbar-width/-color; Safari before 18.2 reads only the ::-webkit- block, so
80
+ // both halves are needed. Colours are slate-300/-400, the same ramp as this report's greys.
81
+ sb.Append("*{scrollbar-width:thin;scrollbar-color:#cbd5e1 transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#94a3b8}");
76
82
  sb.Append("body{font-family:-apple-system,'Segoe UI',Roboto,sans-serif;background:#f1f5f9;color:#0f172a;padding:2.5rem;line-height:1.6}");
77
83
  sb.Append(".wrap{max-width:760px;margin:0 auto;background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:2rem 2.25rem;box-shadow:0 10px 30px rgba(2,6,23,.06)}");
78
84
  sb.Append(".hd{border-bottom:2px solid #4a9eff;padding-bottom:1rem;margin-bottom:1.5rem}");
@@ -105,6 +105,12 @@ nodes:
105
105
  sb.Append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">");
106
106
  sb.Append("<title>Knowledge Base consulted</title><style>");
107
107
  sb.Append("*{margin:0;padding:0;box-sizing:border-box}");
108
+ // Scrollbars, themed GLOBALLY for both engines. The report is its own document inside the
109
+ // Viewer iframe, so web/app.css never reaches it: without this the page itself — and any
110
+ // container a later edit makes scrollable — falls back to the browser's own bar. Firefox
111
+ // reads only scrollbar-width/-color; Safari before 18.2 reads only the ::-webkit- block, so
112
+ // both halves are needed. Colours are slate-300/-400, the same ramp as this report's greys.
113
+ sb.Append("*{scrollbar-width:thin;scrollbar-color:#cbd5e1 transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#94a3b8}");
108
114
  sb.Append("body{font-family:-apple-system,'Segoe UI',Roboto,sans-serif;background:#f1f5f9;color:#0f172a;padding:2.5rem;line-height:1.6}");
109
115
  sb.Append(".wrap{max-width:760px;margin:0 auto;background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:2rem 2.25rem;box-shadow:0 10px 30px rgba(2,6,23,.06)}");
110
116
  sb.Append(".hd{border-bottom:2px solid #4a9eff;padding-bottom:1rem;margin-bottom:1.5rem}");
@@ -100,6 +100,12 @@ nodes:
100
100
  sb.Append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">");
101
101
  sb.Append("<title>Approved Workspace Project</title><style>");
102
102
  sb.Append("*{margin:0;padding:0;box-sizing:border-box}");
103
+ // Scrollbars, themed GLOBALLY for both engines. The report is its own document inside the
104
+ // Viewer iframe, so web/app.css never reaches it: without this the page itself — and any
105
+ // container a later edit makes scrollable — falls back to the browser's own bar. Firefox
106
+ // reads only scrollbar-width/-color; Safari before 18.2 reads only the ::-webkit- block, so
107
+ // both halves are needed. Colours are slate-300/-400, the same ramp as this report's greys.
108
+ sb.Append("*{scrollbar-width:thin;scrollbar-color:#cbd5e1 transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#94a3b8}");
103
109
  sb.Append("body{font-family:-apple-system,'Segoe UI',Roboto,sans-serif;background:#f1f5f9;color:#0f172a;padding:2.5rem;line-height:1.6}");
104
110
  sb.Append(".wrap{max-width:760px;margin:0 auto;background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:2rem 2.25rem;box-shadow:0 10px 30px rgba(2,6,23,.06)}");
105
111
  sb.Append(".hd{border-bottom:2px solid #4a9eff;padding-bottom:1rem;margin-bottom:1.5rem}");
@@ -153,6 +153,12 @@ nodes:
153
153
  sb.Append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">");
154
154
  sb.Append("<title>" + E(modelName) + " - BOM Phase " + phase + "</title><style>");
155
155
  sb.Append("*{margin:0;padding:0;box-sizing:border-box}body{font-family:-apple-system,'Segoe UI',Roboto,sans-serif;background:#0f172a;color:#e2e8f0;padding:2rem;line-height:1.6}.container{max-width:1200px;margin:0 auto}");
156
+ // Scrollbars, themed GLOBALLY for both engines. The report is its own document inside the
157
+ // Viewer iframe, so web/app.css never reaches it: without this the long table's wrapper and
158
+ // the page itself draw the browser's native LIGHT bar over a dark report. Firefox reads only
159
+ // scrollbar-width/-color; Safari before 18.2 reads only the ::-webkit- block — both halves
160
+ // are needed. Colours are this report's own slate tokens, no new hues.
161
+ sb.Append("*{scrollbar-width:thin;scrollbar-color:#334155 transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#334155;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#64748b}");
156
162
  sb.Append(".report-header{border-bottom:2px solid #d946ef;padding-bottom:1rem;margin-bottom:2rem}.report-header h1{font-size:1.75rem;font-weight:700;color:#f8fafc}.report-header .subtitle{color:#94a3b8;font-size:.875rem;margin-top:.25rem}");
157
163
  sb.Append(".summary-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem;margin-bottom:2rem}.card{background:#1e293b;border:1px solid #334155;border-radius:8px;padding:1.25rem}.card .label{font-size:.75rem;text-transform:uppercase;letter-spacing:.05em;color:#94a3b8;margin-bottom:.25rem}.card .value{font-size:1.5rem;font-weight:700;color:#f8fafc;font-family:Consolas,monospace}.card .value.accent{color:#d946ef}");
158
164
  sb.Append(".cat{margin-bottom:1.75rem}.cat h2{font-size:1rem;font-weight:700;color:#f8fafc;margin-bottom:.5rem;display:flex;align-items:baseline;gap:.5rem}.cat h2 .pill{font-size:.7rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:#0f172a;background:#d946ef;border-radius:999px;padding:.1rem .5rem}.cat h2 .sub{font-size:.8rem;font-weight:400;color:#94a3b8;font-family:Consolas,monospace;margin-left:auto}");
@@ -88,6 +88,12 @@ nodes:
88
88
 
89
89
  var sb = new StringBuilder();
90
90
  sb.Append("<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"><title>PDF Takeoff</title><style>");
91
+ // Scrollbars, themed GLOBALLY for both engines. The report is its own document inside the
92
+ // Viewer iframe, so web/app.css never reaches it: without this the page itself — and any
93
+ // container a later edit makes scrollable — falls back to the browser's own bar. Firefox
94
+ // reads only scrollbar-width/-color; Safari before 18.2 reads only the ::-webkit- block, so
95
+ // both halves are needed. Colours are slate-300/-400, the same ramp as this report's greys.
96
+ sb.Append("*{scrollbar-width:thin;scrollbar-color:#cbd5e1 transparent}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:4px}::-webkit-scrollbar-thumb:hover{background:#94a3b8}");
91
97
  sb.Append("body{font-family:-apple-system,'Segoe UI',Roboto,sans-serif;background:#f1f5f9;color:#0f172a;padding:2.5rem;line-height:1.6}");
92
98
  sb.Append(".wrap{max-width:560px;margin:0 auto;background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:1.75rem 2rem;box-shadow:0 10px 30px rgba(2,6,23,.06)}");
93
99
  sb.Append("h1{font-size:1.5rem;font-weight:800;border-bottom:2px solid #4a9eff;padding-bottom:.75rem;margin-bottom:1.25rem}");
@@ -75,8 +75,18 @@ nodes:
75
75
  // hosted shared page alike. The "Made with FloLess" badge is injected by the
76
76
  // server (report-badge.ts) — never add it here. Accent is brand blue #3b82f6
77
77
  // (a selection report is general-purpose; fuchsia is bom-by-phase's phase hue).
78
+ // Scrollbars are themed GLOBALLY for both engines. The report is its own document inside the
79
+ // Viewer iframe, so web/app.css never reaches it: without this the wide table's wrapper and
80
+ // the page itself draw the browser's native LIGHT bar over a dark report. Firefox reads only
81
+ // scrollbar-width/-color; Safari before 18.2 reads only the ::-webkit- block — both halves
82
+ // are needed. Colours are this report's own slate tokens, no new hues.
78
83
  string css =
79
84
  "*{margin:0;padding:0;box-sizing:border-box}"
85
+ + "*{scrollbar-width:thin;scrollbar-color:#334155 transparent}"
86
+ + "::-webkit-scrollbar{width:8px;height:8px}"
87
+ + "::-webkit-scrollbar-track{background:transparent}"
88
+ + "::-webkit-scrollbar-thumb{background:#334155;border-radius:4px}"
89
+ + "::-webkit-scrollbar-thumb:hover{background:#64748b}"
80
90
  + "body{font-family:-apple-system,'Segoe UI',Roboto,sans-serif;background:#0f172a;color:#e2e8f0;padding:2rem;line-height:1.6}"
81
91
  + ".container{max-width:1200px;margin:0 auto}"
82
92
  + ".report-header{border-bottom:2px solid #3b82f6;padding-bottom:1rem;margin-bottom:2rem}"
@@ -90,8 +90,18 @@ nodes:
90
90
  // hosted shared page alike. The "Made with FloLess" badge is injected by the
91
91
  // server (report-badge.ts) — never add it here. Accent is brand blue #3b82f6
92
92
  // (a selection report is general-purpose; fuchsia is bom-by-phase's phase hue).
93
+ // Scrollbars are themed GLOBALLY for both engines. The report is its own document inside the
94
+ // Viewer iframe, so web/app.css never reaches it: without this the wide table's wrapper and
95
+ // the page itself draw the browser's native LIGHT bar over a dark report. Firefox reads only
96
+ // scrollbar-width/-color; Safari before 18.2 reads only the ::-webkit- block — both halves
97
+ // are needed. Colours are this report's own slate tokens, no new hues.
93
98
  string css =
94
99
  "*{margin:0;padding:0;box-sizing:border-box}"
100
+ + "*{scrollbar-width:thin;scrollbar-color:#334155 transparent}"
101
+ + "::-webkit-scrollbar{width:8px;height:8px}"
102
+ + "::-webkit-scrollbar-track{background:transparent}"
103
+ + "::-webkit-scrollbar-thumb{background:#334155;border-radius:4px}"
104
+ + "::-webkit-scrollbar-thumb:hover{background:#64748b}"
95
105
  + "body{font-family:-apple-system,'Segoe UI',Roboto,sans-serif;background:#0f172a;color:#e2e8f0;padding:2rem;line-height:1.6}"
96
106
  + ".container{max-width:1200px;margin:0 auto}"
97
107
  + ".report-header{border-bottom:2px solid #3b82f6;padding-bottom:1rem;margin-bottom:2rem}"
@@ -364,13 +364,11 @@
364
364
  return {
365
365
  start, resume, adopt, acknowledge, retryFailed, check,
366
366
  getState: () => state,
367
- getStoredTransaction: readStored,
368
367
  subscribe(listener) {
369
368
  listeners.add(listener);
370
369
  listener(state);
371
370
  return () => listeners.delete(listener);
372
371
  },
373
- cancelPolling() { generation += 1; },
374
372
  };
375
373
  }
376
374
 
package/dist/web/aware.js CHANGED
@@ -59,6 +59,17 @@
59
59
  const exportReceiptsByApp = new Map(); // appId:kind → latest reconciled receipt counts
60
60
  const exportBusyByApp = new Set(); // appId:kind → one in-flight host/export mutation
61
61
 
62
+ // The CLOSED set of reason prefixes a scene bake tags a skipped entry with (contract-to-scene.ts):
63
+ // a connection it could not expand, a trim it could not apply, or a member whose weight the AISC
64
+ // catalogue knows and whose footprint it does not tabulate. Anything else in `skipped` is a bare
65
+ // member id — an RFI with no resolvable size.
66
+ //
67
+ // Matched by PREFIX and not by "contains a colon": a member id is an unconstrained string in the
68
+ // contract schema, so an imported id may legitimately carry one, and a colon test would drop that
69
+ // member out of BOTH counts — an undercount in the one message whose job is to stop members going
70
+ // missing quietly.
71
+ const SKIP_REASON_PREFIX = /^(?:joint|trim|nofootprint):/;
72
+
62
73
  // Local UI-state persistence (per origin; never touches the .flo or lock).
63
74
  // The last-opened app is restored on refresh; per-app input values are saved
64
75
  // explicitly via "Save inputs" (Ctrl+S) and rehydrated when the app opens.
@@ -420,11 +431,6 @@
420
431
  : app.lock.present
421
432
  ? `<span class="cm"># ${escapeHtml(app.id)}.lock · node "${escapeHtml(n.id)}"</span>\n${escapeHtml(nodeYaml(n))}`
422
433
  : `<span class="cm"># not compiled</span>\nHit ⎙ Compile to freeze the .lock.`,
423
- // raw (unescaped) exec source for the Debug-in-VS handler; null for non-exec.
424
- _execSource: execSource,
425
- _execVersion: n.config && typeof n.config.version === 'string' ? n.config.version : null,
426
- _appId: app.id,
427
- _nodeId: n.id,
428
434
  execution: liveTrace,
429
435
  };
430
436
  }
@@ -2624,12 +2630,20 @@
2624
2630
  const res = await api('/api/contract/' + encodeURIComponent(appId) + '/export-3d', { method: 'POST' });
2625
2631
  const html = res.report && res.report.html;
2626
2632
  if (!html) { $reportOverlay.innerHTML = '<div>The 3D render produced no output. Check the Execution tab.</div>'; return; }
2627
- // Partial render: members with no resolvable AISC size were dropped server-side (res.skipped) —
2628
- // surface that, never let an incomplete model read as complete.
2629
- const dropped = Array.isArray(res.skipped) ? res.skipped.length : 0;
2630
- $reportSub.textContent = (dropped ? `${dropped} member(s) not shown (no AISC size — RFI). ` : '')
2633
+ // Partial render: members the bake could not extrude were dropped server-side (res.skipped) —
2634
+ // surface that, never let an incomplete model read as complete. Two reasons, and they are not
2635
+ // the same news: an RFI member has no size and is flagged everywhere else, while a
2636
+ // `nofootprint:` member has an EXACT weight and no tabulated footprint, so it is priced in the
2637
+ // BOM and missing from this view. Calling both "RFI" hid the second entirely (#627).
2638
+ const skips = Array.isArray(res.skipped) ? res.skipped : [];
2639
+ const noFit = skips.filter((s) => String(s).startsWith('nofootprint:')).length;
2640
+ const rfi = skips.filter((s) => !SKIP_REASON_PREFIX.test(String(s))).length;
2641
+ const parts = [];
2642
+ if (rfi) parts.push(`${rfi} with no AISC size (RFI)`);
2643
+ if (noFit) parts.push(`${noFit} priced but not drawn (no tabulated footprint)`);
2644
+ $reportSub.textContent = (parts.length ? `${parts.join(', ')} — not shown. ` : '')
2631
2645
  + 'Live 3D view from the approved model — drag to orbit, scroll to zoom, click an element to inspect.';
2632
- if (dropped) showToast(`3D: ${dropped} member(s) skipped — no resolvable AISC size`, 'info');
2646
+ if (parts.length) showToast(`3D: ${parts.join(' · ')}`, noFit ? 'warn' : 'info');
2633
2647
  paintReport(html, true);
2634
2648
  lastReportByApp.set(currentId, { nodeId: res.report.nodeId, label: '3D', html, interactive: true });
2635
2649
  $reportModal.dataset.html = '1';
@@ -2660,12 +2674,21 @@
2660
2674
  a.href = url; a.download = res.filename || (appId + '.ifc');
2661
2675
  document.body.appendChild(a); a.click(); a.remove();
2662
2676
  setTimeout(() => URL.revokeObjectURL(url), 4000);
2663
- const dropped = Array.isArray(res.skipped) ? res.skipped.length : 0;
2664
- // Skip wording differs by contract: steel `skipped` = RFI members (no AISC size); a vector
2665
- // reconstruction's `skipped` = unplaced entities, plus extruded bodies (extrusionsSkipped)
2666
- // that don't export to IFC yet. Label each honestly.
2677
+ const skips = Array.isArray(res.skipped) ? res.skipped : [];
2678
+ const dropped = skips.length;
2679
+ // Skip wording differs by contract: a vector reconstruction's `skipped` = unplaced entities,
2680
+ // plus extruded bodies (extrusionsSkipped) that don't export to IFC yet. A steel model's splits
2681
+ // in two — an RFI member has no size, while a `nofootprint:` member has an exact weight and no
2682
+ // tabulated footprint, so the BOM prices steel this .ifc does not contain. Label each honestly;
2683
+ // the second used to be reported as an RFI, which is the one thing it is not (#627).
2684
+ const noFit = skips.filter((s) => String(s).startsWith('nofootprint:')).length;
2685
+ const rfi = skips.filter((s) => !SKIP_REASON_PREFIX.test(String(s))).length;
2667
2686
  const notes = [];
2668
- if (dropped) notes.push(isVector ? `${dropped} unplaced` : `${dropped} RFI member${dropped === 1 ? '' : 's'}`);
2687
+ if (isVector) { if (dropped) notes.push(`${dropped} unplaced`); }
2688
+ else {
2689
+ if (rfi) notes.push(`${rfi} RFI member${rfi === 1 ? '' : 's'}`);
2690
+ if (noFit) notes.push(`${noFit} member${noFit === 1 ? '' : 's'} priced but not exported (no tabulated footprint)`);
2691
+ }
2669
2692
  if (res.extrusionsSkipped) notes.push(`${res.extrusionsSkipped} extruded ${res.extrusionsSkipped === 1 ? 'body' : 'bodies'} (view-only)`);
2670
2693
  const summary = exportReceiptText(appId, 'ifc');
2671
2694
  showToast(summary && summary.partial
@@ -16,6 +16,83 @@ import { mmPerPx } from './grid-core.js';
16
16
  export const FT_TO_MM = 304.8;
17
17
  export const IN_TO_MM = 25.4;
18
18
 
19
+ /** @typedef {'I'|'C'|'L'|'TUBE'|'BOX'} SectionKind */
20
+
21
+ /**
22
+ * Steel families as literal designation PREFIXES, paired with the section kind each one draws as.
23
+ * Order here is presentation only — `sectionKindOf` picks the longest match, never the first — with one
24
+ * caveat worth stating because nothing in the loop enforces it: two entries carrying the SAME prefix can
25
+ * only tie, and the tie goes to the earlier one, so a duplicate added later is silently dead. That is the
26
+ * same unreachability this change set out to remove, just re-keyed from chain order to array order, so
27
+ * `section-kind.test.ts` checks the table for duplicates rather than trusting this paragraph.
28
+ *
29
+ * The annotation below is NOT enforcement either: this is a .js file and the server tsconfig runs
30
+ * `allowJs` without `checkJs`, so a typo'd entry (`['MC', 'c']`) or a malformed one still compiles —
31
+ * verified. `section-kind.test.ts` validates the table's shape for that reason.
32
+ *
33
+ * Tees (`WT`/`ST`/`MT`) deliberately carry no entry: there is no 'T' kind, so they ride their parent
34
+ * letter and draw as an I. That is the long-standing behaviour and is left exactly as it was — a tee
35
+ * outline is its own change, not part of the prefix-shadowing fix below. Note that ADDING a tee entry
36
+ * here WOULD silently take every `WT` away from 'I': "a new family cannot un-reach an existing one" is
37
+ * about each family's own prefix still matching, not about the designations it currently attracts.
38
+ *
39
+ * @type {ReadonlyArray<readonly [string, SectionKind]>}
40
+ */
41
+ export const SECTION_FAMILIES = [
42
+ ['W', 'I'], ['M', 'I'], ['S', 'I'], ['HP', 'I'], // US I-family
43
+ ['UC', 'I'], ['UB', 'I'], ['UKC', 'I'], ['UKB', 'I'], ['IPE', 'I'], ['HE', 'I'], // UK/EU I-family
44
+ ['C', 'C'], ['MC', 'C'], ['PFC', 'C'], // channels
45
+ ['L', 'L'], // angles
46
+ ['HSS', 'TUBE'], ['PIPE', 'TUBE'], ['TS', 'TUBE'], ['TUBE', 'TUBE'], ['HSQ', 'TUBE'],
47
+ ['SHS', 'TUBE'], ['RHS', 'TUBE'], ['CHS', 'TUBE'], // hollow sections
48
+ ];
49
+
50
+ /**
51
+ * Section shape KIND from a steel designation — the ONE classifier behind the 2D plan outline
52
+ * (`web/steel-editor.html` sectionShapePts), the 3D extrusion (`web/steel-3d-view.js` shapeOf) and
53
+ * the base-plate weld footprint (`server/steel-joints.ts` profileOutline). Each of those three used
54
+ * to carry its own copy of an ordered regex chain kept in step by a comment; this is the source they
55
+ * now share, so the copies cannot drift apart again.
56
+ *
57
+ * LONGEST PREFIX WINS, and that IS the fix rather than a matter of taste. The old chain tested a bare
58
+ * `M`, `S` and `C` inside earlier alternations, so a one-letter family silently swallowed a longer one
59
+ * three separate times — `M` ate `MC` (#647: an MC channel drew as a wide flange), `S` ate `SHS`, and
60
+ * `C` ate `CHS`, the last two leaving a closed hollow section classified as an open I or channel.
61
+ *
62
+ * In `steel-joints` that is not cosmetic, though the two tubes were hurt differently and it is worth
63
+ * being exact: an `SHS` answering 'I' reached the I-only estimate in `lapFaces` and BUILT a lap on a
64
+ * bearing face it does not have, whereas a `CHS` answering 'C' never entered that branch and so WAS
65
+ * refused — just as `bearing-face-unresolved` rather than the `closed-section-unsupported` it is owed,
66
+ * and with a channel traced as its weld outline. Reachability was a property of the whole chain's ORDER
67
+ * and so invisible while reading any single branch of it; matching on longest literal prefix removes the
68
+ * class, because adding a family can no longer un-reach one.
69
+ *
70
+ * WHAT THIS DOES NOT PROMISE. It matches a literal prefix, not a parsed designation, and several
71
+ * families are a single letter — so `STEEL` answers 'I', `CUSTOM` and `COL` answer 'C', and an `MC`
72
+ * written `M.C.18X58` answers 'I'. Only a designation with no KNOWN family prefix (`2L…`, `ZZ99`, '')
73
+ * reaches BOX. That is long-standing behaviour, unchanged here and not a regression, but do not read BOX
74
+ * as "we could not classify it" — this cannot currently say that, which is why `steel-joints` has no
75
+ * honest way to refuse an unrecognised designation. See #657.
76
+ *
77
+ * @param {unknown} profile
78
+ * @returns {SectionKind}
79
+ */
80
+ export function sectionKindOf(profile) {
81
+ const p = String(profile == null ? '' : profile).toUpperCase().trim();
82
+ /** @type {SectionKind} */
83
+ let kind = 'BOX';
84
+ let best = 0;
85
+ // No cast on `familyKind`: the table is annotated, so a bad entry is a problem at the table (where
86
+ // section-kind.test.ts checks for it) rather than something an assertion here quietly waves through.
87
+ for (const [prefix, familyKind] of SECTION_FAMILIES) {
88
+ if (prefix.length > best && p.startsWith(prefix)) {
89
+ best = prefix.length;
90
+ kind = familyKind;
91
+ }
92
+ }
93
+ return kind;
94
+ }
95
+
19
96
  /**
20
97
  * Clip a 3D segment against convex half-spaces. Each plane is
21
98
  * `{ normal:[x,y,z], constant }`, with points on the non-negative side kept.
@@ -19,7 +19,7 @@ import { OrbitControls } from 'three/addons/OrbitControls.js';
19
19
  import { RoomEnvironment } from 'three/addons/RoomEnvironment.js';
20
20
  import { surfaceTextures, applyTriplanar, TILE_MM, DIRECTIONAL } from './steel-materials.js';
21
21
  import { Brush, Evaluator, SUBTRACTION } from 'three-bvh-csg';
22
- import { snapPoint, planPointToWp, memberGeometry, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, snapGridPoint, clipSegmentToPlanes, pointSegmentDistance2d, perspectiveSegmentParameter, gridDepthWins, segmentHitsRect2d, projectedFootprintHitsRect2d, pickGridLevel, selectedLengthLabelAnchors } from './steel-3d-core.js';
22
+ import { snapPoint, planPointToWp, memberGeometry, snapElevation, dim3dGeom, dominantAxis3d, planeBasis, planeFrom3Points, frameFrom3Points, frameFromAngle, worldToLocal, identityFrame, resolvePointEntry, offsetsFor, candidateOnPlane, snapGridPoint, clipSegmentToPlanes, pointSegmentDistance2d, perspectiveSegmentParameter, gridDepthWins, segmentHitsRect2d, projectedFootprintHitsRect2d, pickGridLevel, selectedLengthLabelAnchors, sectionKindOf } from './steel-3d-core.js';
23
23
  // `gridGeometry`, `gridCandidates3d` and `mmPerPx` moved behind the host's model read half (unit 5, P7d):
24
24
  // each takes a `ptPerFt`, which is a v1 PLAN default and meaningless on a world-mm model grid.
25
25
  import { visibleGridLevels } from './grid-core.js';
@@ -378,12 +378,9 @@ function lengthAxisOf(el) {
378
378
  function shapeOf(el) {
379
379
  const explicit = (el.section && el.section.shape || '').toString().toUpperCase().trim();
380
380
  if (/^(I|C|L|TUBE|BOX)$/.test(explicit)) return explicit; // explicit section.shape override wins
381
- const p = ((el.meta && el.meta.profile) || '').toString().toUpperCase().trim();
382
- if (/^(W|M|S|HP|UC|UB|UKC|UKB|IPE|HE)/.test(p)) return 'I'; // wide-flange / I-section
383
- if (/^(C|MC|PFC)/.test(p)) return 'C'; // channel
384
- if (/^L/.test(p)) return 'L'; // angle
385
- if (/^(HSS|PIPE|TS|SHS|RHS|CHS|TUBE|HSQ)/.test(p)) return 'TUBE'; // hollow tube
386
- return 'BOX';
381
+ // The designation itself goes to the shared classifier (steel-3d-core.js), which the 2D plan outline
382
+ // and the base-plate weld also use. The copy that lived here drew MC channels as I-sections (#647).
383
+ return sectionKindOf((el.meta && el.meta.profile) || '');
387
384
  }
388
385
  // A real thickness off the element's `xsection` (AISC table / designation) when there is one and it fits
389
386
  // inside the section, else null so the caller keeps its estimate. The fit check matters: a metric