@floless/app 0.113.1 → 0.113.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 +1255 -680
- package/dist/web/app.css +3 -0
- package/dist/web/aware.js +105 -14
- package/dist/web/steel-3d-core.js +31 -0
- package/dist/web/steel-3d-view.js +35 -25
- package/dist/web/steel-editor.html +126 -53
- package/dist/web/steel-filter.html +51 -9
- package/dist/web/workspaces.js +350 -93
- package/package.json +1 -1
|
@@ -401,7 +401,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
401
401
|
body.in-workspace #moreMenu #revertB,body.in-workspace #moreMenu #revertSep{display:block}
|
|
402
402
|
/* Same trap: "Send selection to Tekla" is hidden with an empty selection, and plain [hidden] loses
|
|
403
403
|
to the #moreMenu rule above — without this it ships as a visible row that only scolds you. */
|
|
404
|
-
#moreMenu #sendTeklaB[hidden],#moreMenu #sendRevitB[hidden],#moreMenu #sendSketchupB[hidden]{display:none}
|
|
404
|
+
#moreMenu #sendTeklaB[hidden],#moreMenu #sendRevitB[hidden],#moreMenu #sendSketchupB[hidden],#moreMenu #sendRhinoB[hidden]{display:none}
|
|
405
405
|
#moreMenu button:disabled{opacity:.4;cursor:default;background:transparent}
|
|
406
406
|
#moreMenu button.on{color:var(--brand)}
|
|
407
407
|
button:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
|
|
@@ -964,7 +964,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
964
964
|
<button id=dimToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide all placed dimensions on the plan"><span class=mck aria-hidden=true></span>Dimensions</button>
|
|
965
965
|
<button id=calloutToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide the clickable callout bubbles (section / elevation / detail references) on the plan"><span class=mck aria-hidden=true></span>Callouts</button>
|
|
966
966
|
<button id=gridToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show or hide the grid lines in 2D and 3D"><span class=mck aria-hidden=true></span>Grid lines</button>
|
|
967
|
-
<button id=lenToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show each selected member
|
|
967
|
+
<button id=lenToggleB class=dtog role=menuitemcheckbox aria-checked=false data-tip="Show the length of each selected member in 2D and 3D"><span class=mck aria-hidden=true></span>Member length</button>
|
|
968
968
|
<button id=plToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide property labels in the 2D plan (the property selection is shared with 3D — this hides them here only)"><span class=mck aria-hidden=true></span>Property labels</button>
|
|
969
969
|
<button id=refToggleB class=dtog role=menuitemcheckbox aria-checked=true data-tip="Show or hide the traced reference sheet (the PDF/SVG drawing under the model). Hidden, it also stops contributing snap points."><span class=mck aria-hidden=true></span>Reference sheet</button>
|
|
970
970
|
<button id=gridEditB data-tip="Grid lines — a plan reference with structural bay spacings (n*d repeats a bay). Shows in 2D and 3D; drawing and drags snap to its lines and intersections.">Grid lines…</button>
|
|
@@ -1002,12 +1002,13 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
1002
1002
|
</div>
|
|
1003
1003
|
<button id=csResetB data-tip="Return to the global X/Y axes (default)" disabled>Reset to global axes</button>
|
|
1004
1004
|
</div>
|
|
1005
|
-
<button class=msec-hdr data-sec=session aria-expanded=false data-tip="Reload from the server, or export the data">Session<span class=chev aria-hidden=true>▸</span></button>
|
|
1005
|
+
<button class=msec-hdr data-sec=session aria-expanded=false data-tip="Reload from the server, send selected members to an open CAD app, or export the data.">Session<span class=chev aria-hidden=true>▸</span></button>
|
|
1006
1006
|
<div class=msec-body>
|
|
1007
1007
|
<button id=reloadB data-tip="Reloads this page and pulls in any changes your terminal AI made since you last opened it.">↻ Reload from server</button>
|
|
1008
1008
|
<button id=sendTeklaB data-tip="Creates the selected members as native parts in the open Tekla model, at their real model coordinates. Same as Ctrl+Shift-dragging the selection out of the 3D view onto the Tekla window.">Send selection to Tekla</button>
|
|
1009
1009
|
<button id=sendRevitB data-tip="Creates the selected members as native Revit framing and columns in the open document, at their real model coordinates. Same as Ctrl+Shift-dragging the selection out of the 3D view onto the Revit window.">Send selection to Revit</button>
|
|
1010
1010
|
<button id=sendSketchupB data-tip="Creates the selected members as native groups in the open SketchUp model, at their real model coordinates. Same as Ctrl+Shift-dragging the selection out of the 3D view onto the SketchUp window.">Send selection to SketchUp</button>
|
|
1011
|
+
<button id=sendRhinoB data-tip="Creates the selected members as Rhino objects in the open document, at their real model coordinates. Same as Ctrl+Shift-dragging the selection out of the 3D view onto the Rhino window.">Send selection to Rhino</button>
|
|
1011
1012
|
<button id=exp>Export contract…</button>
|
|
1012
1013
|
</div>
|
|
1013
1014
|
<hr id=revertSep>
|
|
@@ -1490,20 +1491,25 @@ const queueWrite = (fn) => (writeQueue = writeQueue.then(fn, fn));
|
|
|
1490
1491
|
*/
|
|
1491
1492
|
function showEmpty(icon, headline, bodyText, appIdText, opts) {
|
|
1492
1493
|
const wrap = document.createElement('div');
|
|
1493
|
-
wrap.style.cssText = 'display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;text-align:center;color:#e7ecf3;font:13px system-ui,sans-serif;gap:10px;padding:24px;background:#070a0f';
|
|
1494
|
-
|
|
1495
|
-
|
|
1494
|
+
wrap.style.cssText = 'display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100vh;box-sizing:border-box;text-align:center;color:#e7ecf3;font:13px system-ui,sans-serif;gap:10px;padding:24px;background:#070a0f';
|
|
1495
|
+
wrap.setAttribute('role', 'alert');
|
|
1496
|
+
wrap.setAttribute('aria-labelledby', 'empty-state-heading');
|
|
1497
|
+
wrap.setAttribute('aria-describedby', 'empty-state-body');
|
|
1498
|
+
const ic = document.createElement('div'); ic.style.cssText = 'font-size:28px;opacity:.5'; ic.textContent = icon; ic.setAttribute('aria-hidden', 'true');
|
|
1499
|
+
const h = document.createElement('h1'); h.id = 'empty-state-heading'; h.style.cssText = 'font-size:15px;font-weight:600;margin:0';
|
|
1496
1500
|
if (appIdText != null) { h.append(headline + ' '); const b = document.createElement('strong'); b.textContent = appIdText; h.append(b); }
|
|
1497
1501
|
else { h.textContent = headline; }
|
|
1498
|
-
const body = document.createElement('div'); body.style.cssText = 'font-size:12.5px;color:#9aa5b6;max-width:340px;line-height:1.55'; body.textContent = bodyText;
|
|
1502
|
+
const body = document.createElement('div'); body.id = 'empty-state-body'; body.style.cssText = 'font-size:12.5px;color:#9aa5b6;max-width:340px;line-height:1.55'; body.textContent = bodyText;
|
|
1503
|
+
// Insert the live region before populating it so assistive technology reliably announces this async
|
|
1504
|
+
// terminal state. The visual result is unchanged: all children are appended in the same microtask.
|
|
1505
|
+
document.body.replaceChildren(wrap);
|
|
1499
1506
|
wrap.append(ic, h, body);
|
|
1500
1507
|
if (opts && opts.detail) {
|
|
1501
1508
|
const det = document.createElement('div');
|
|
1502
1509
|
det.style.cssText = 'font-size:10.5px;color:#9aa5b6;opacity:.65;margin-top:-2px';
|
|
1503
|
-
det.textContent = opts.detail; // textContent, not innerHTML:
|
|
1510
|
+
det.textContent = opts.detail; // textContent, not innerHTML: detail may include stored/server-authored text
|
|
1504
1511
|
wrap.append(det);
|
|
1505
1512
|
}
|
|
1506
|
-
document.body.replaceChildren(wrap);
|
|
1507
1513
|
}
|
|
1508
1514
|
/*
|
|
1509
1515
|
* A 2D/3D click that lands while boot() is still loading.
|
|
@@ -1558,31 +1564,82 @@ function armEarlyViewToggle() {
|
|
|
1558
1564
|
}
|
|
1559
1565
|
|
|
1560
1566
|
/**
|
|
1561
|
-
* The
|
|
1567
|
+
* The useful fields on an error response, or nulls when there aren't any.
|
|
1562
1568
|
*
|
|
1563
1569
|
* GUARDED, because this reads a body that is not guaranteed to be ours. A 404 can come from a proxy,
|
|
1564
1570
|
* a dev-server error page, or any body-less error response — `res.json()` rejects on every one of
|
|
1565
1571
|
* those, and an unhandled rejection here would replace a styled empty state with a raw `boot().catch`
|
|
1566
|
-
* message. Any failure means "no
|
|
1567
|
-
* before this field existed.
|
|
1572
|
+
* message. Any failure means "no details", which lands the caller on a safe generic state.
|
|
1568
1573
|
*
|
|
1569
1574
|
* The FALLBACK is silent-by-design; the DIAGNOSIS is not. Returning null for an unparseable body and
|
|
1570
1575
|
* returning null for our own ordinary "no contract yet" body are the same value and very different
|
|
1571
1576
|
* events, and without a line here the first leaves no trace anywhere. So the unparseable case warns
|
|
1572
1577
|
* and the ordinary one does not — `body.code` simply being absent is the normal `none` answer.
|
|
1573
1578
|
*/
|
|
1574
|
-
async function
|
|
1579
|
+
async function contractErrorOf(res) {
|
|
1575
1580
|
try {
|
|
1576
1581
|
const body = await res.json();
|
|
1577
|
-
return
|
|
1582
|
+
return {
|
|
1583
|
+
code: body && typeof body.code === 'string' ? body.code : null,
|
|
1584
|
+
error: body && typeof body.error === 'string' && body.error.trim() ? body.error.trim() : null,
|
|
1585
|
+
};
|
|
1578
1586
|
} catch (_) {
|
|
1579
1587
|
// Not JSON, empty, or already consumed. The generic state is the safe answer, but this is a
|
|
1580
1588
|
// response that did not come from us at all — say so rather than letting it look ordinary.
|
|
1581
|
-
console.warn('
|
|
1582
|
-
return null;
|
|
1589
|
+
console.warn('contractErrorOf: ' + res.status + ' body was not readable JSON — falling back to the generic empty state');
|
|
1590
|
+
return { code: null, error: null };
|
|
1583
1591
|
}
|
|
1584
1592
|
}
|
|
1585
1593
|
|
|
1594
|
+
/**
|
|
1595
|
+
* Plain-English recovery for a contract read the server explicitly refused.
|
|
1596
|
+
*
|
|
1597
|
+
* The exact server error remains quiet support detail for policy refusals, while the primary copy stays
|
|
1598
|
+
* in product vocabulary. Unknown failures use the server's own sentence rather than inventing a claim
|
|
1599
|
+
* that the server is offline — receiving an HTTP response proves the opposite.
|
|
1600
|
+
*/
|
|
1601
|
+
function contractFailureState(status, code, serverError, projectScoped) {
|
|
1602
|
+
// The subscription middleware answers before the contract route, so 402 is authoritative even if a
|
|
1603
|
+
// proxy or future server happens to attach a contract-shaped code to the body.
|
|
1604
|
+
if (status === 402) {
|
|
1605
|
+
return {
|
|
1606
|
+
headline: 'Check your FloLess account',
|
|
1607
|
+
body: 'Close this editor, follow the sign-in or subscription prompt in FloLess, then reopen the model.',
|
|
1608
|
+
};
|
|
1609
|
+
}
|
|
1610
|
+
if (code === 'contract-not-activated') {
|
|
1611
|
+
return projectScoped
|
|
1612
|
+
? {
|
|
1613
|
+
headline: 'This model’s conversion isn’t complete',
|
|
1614
|
+
body: 'Open the project in Workspaces and complete its conversion to the 3D model, then try again.',
|
|
1615
|
+
detail: 'Error ' + status + ' · ' + code,
|
|
1616
|
+
}
|
|
1617
|
+
: {
|
|
1618
|
+
headline: 'This model isn’t ready to open',
|
|
1619
|
+
body: 'FloLess blocked this model because its 3D conversion wasn’t completed in a project. Return to FloLess and report the error code below.',
|
|
1620
|
+
detail: 'Error ' + status + ' · ' + code,
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
if (code === 'contract-type-wrong-app') {
|
|
1624
|
+
return {
|
|
1625
|
+
headline: 'This workflow can’t open this model',
|
|
1626
|
+
body: 'This workflow isn’t allowed to use the saved model. Open the Steel Model workflow or project the model came from; if that isn’t available, report the error below.',
|
|
1627
|
+
detail: 'Error ' + status + ' · ' + code,
|
|
1628
|
+
};
|
|
1629
|
+
}
|
|
1630
|
+
if (code === 'contract-type-unknown') {
|
|
1631
|
+
return {
|
|
1632
|
+
headline: 'This model format isn’t supported',
|
|
1633
|
+
body: 'A newer FloLess version may be required. Check for updates, then open the model again.',
|
|
1634
|
+
detail: 'Error ' + status + ' · ' + code,
|
|
1635
|
+
};
|
|
1636
|
+
}
|
|
1637
|
+
return {
|
|
1638
|
+
headline: 'Couldn’t load this model',
|
|
1639
|
+
body: serverError || ('The server returned error ' + status + '. Reopen the editor and try again.'),
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1586
1643
|
async function boot() {
|
|
1587
1644
|
if (!APP_ID) { showEmpty('⊞', 'No workflow selected', 'Open a workflow in the FloLess canvas, then open the contract editor from that workflow’s node.'); return; }
|
|
1588
1645
|
armEarlyViewToggle(); // BEFORE the first await — that is the whole point; see above
|
|
@@ -1599,8 +1656,16 @@ async function boot() {
|
|
|
1599
1656
|
// exists, and reading another drawing is not what gets the user to it.
|
|
1600
1657
|
//
|
|
1601
1658
|
// The CODE, never the sentence — the sentence is copy and copy gets edited.
|
|
1602
|
-
const code = await
|
|
1603
|
-
if (code === 'project-publication') {
|
|
1659
|
+
const { code } = await contractErrorOf(res);
|
|
1660
|
+
if (code === 'project-publication-missing-project') {
|
|
1661
|
+
showEmpty('⊞', 'The project for this model isn’t available',
|
|
1662
|
+
'It may be archived, deleted, or stored on another computer. Check Archived in Workspaces; if you have a project archive, import it.',
|
|
1663
|
+
null);
|
|
1664
|
+
} else if (code === 'project-publication-availability-unknown') {
|
|
1665
|
+
showEmpty('⊞', 'Couldn’t check project availability',
|
|
1666
|
+
'Open Workspaces to check for a project, then try again.',
|
|
1667
|
+
null);
|
|
1668
|
+
} else if (code === 'project-publication') {
|
|
1604
1669
|
// NO `appIdText` HERE, and that is the fix for a real defect rather than a style choice.
|
|
1605
1670
|
//
|
|
1606
1671
|
// `showEmpty` BOLDS its 4th argument and appends it after the headline, so the sibling states
|
|
@@ -1613,8 +1678,8 @@ async function boot() {
|
|
|
1613
1678
|
//
|
|
1614
1679
|
// The workflow id is low-information here anyway: the user opened this editor from that very
|
|
1615
1680
|
// workflow. The body says what is true about it in prose instead.
|
|
1616
|
-
showEmpty('⊞', '
|
|
1617
|
-
'
|
|
1681
|
+
showEmpty('⊞', 'Open a project from Workspaces',
|
|
1682
|
+
'This model was published from a project, and a project using this workflow is available in Workspaces. Open Workspaces to continue with a project.',
|
|
1618
1683
|
null);
|
|
1619
1684
|
} else {
|
|
1620
1685
|
// A code this build has never heard of falls here on purpose — inventing copy for it would be
|
|
@@ -1624,7 +1689,12 @@ async function boot() {
|
|
|
1624
1689
|
showEmpty('⊞', 'No model for', 'Read a structural drawing first — ask your terminal AI to run the workflow, then open this editor again.', APP_ID);
|
|
1625
1690
|
}
|
|
1626
1691
|
} else {
|
|
1627
|
-
|
|
1692
|
+
const failure = await contractErrorOf(res);
|
|
1693
|
+
// This is unconditional for every non-404 refusal: even a known, well-explained state needs one
|
|
1694
|
+
// stable support breadcrumb, and a body parse failure must not erase the HTTP status.
|
|
1695
|
+
console.error('steel-editor: contract read failed (' + res.status + ', ' + (failure.code || 'no code') + ')');
|
|
1696
|
+
const state = contractFailureState(res.status, failure.code, failure.error, !!PROJECT);
|
|
1697
|
+
showEmpty('⚠', state.headline, state.body, null, { detail: state.detail });
|
|
1628
1698
|
}
|
|
1629
1699
|
return;
|
|
1630
1700
|
}
|
|
@@ -4014,7 +4084,7 @@ function render(){
|
|
|
4014
4084
|
// force-closes, so they are unreachable; updConf yields an empty report that leaves #confStat at the
|
|
4015
4085
|
// display:none its markup already carries; and updCS is already called from every path that can change
|
|
4016
4086
|
// the axes on a v2 document (csArm3dB, onFrame3dChange, the view switch), so it would add nothing.
|
|
4017
|
-
if(MODEL_RO){svg.replaceChildren();stats();panel();updUR();syncDisplayRows();return;} // stats() here only RETIRES the per-sheet readouts — see its v2 branch
|
|
4087
|
+
if(MODEL_RO){svg.replaceChildren();stats();panel();updUR();syncDisplayRows();refreshSelLen3d();return;} // stats() here only RETIRES the per-sheet readouts — see its v2 branch; selected length is a 3D overlay and must follow every v2 selection repaint
|
|
4018
4088
|
document.body.classList.remove('snapping'); // a wholesale svg rebuild drops any #snapMark → clear the cursor-hide flag too (the next pointermove re-adds it if still snapping)
|
|
4019
4089
|
buildColorRank(); // refresh the model-global colour rank before any colorFor() call below (B2 — keeps 2D hues stable across plans + matched to 3D)
|
|
4020
4090
|
reanchorAllPlans(); // F9: glue magnetic dims to their members BEFORE anything reads P.dims — covers every mutation path that ends in a render()
|
|
@@ -5146,7 +5216,7 @@ function _len3dFt(m,ppf,dTos){
|
|
|
5146
5216
|
else{z0=eff(m.ends&&m.ends[0]); z1=eff(m.ends&&m.ends[1]);} // start TOS → end TOS
|
|
5147
5217
|
const dz=((z1==null?0:z1)-(z0==null?0:z0))/12; // vertical rise, feet
|
|
5148
5218
|
return Math.hypot(dx,dy,dz);}
|
|
5149
|
-
function _lenFt(m){return _len3dFt(m,FT,defaultTOS);}
|
|
5219
|
+
function _lenFt(m){return MODEL_RO?modelReadsV2().lengthFt(m):_len3dFt(m,FT,defaultTOS);}
|
|
5150
5220
|
const PROP_DEFS=[
|
|
5151
5221
|
{key:'id', label:'Mark', get:m=>m.id, fmt:v=>v==null?'':String(v)},
|
|
5152
5222
|
{key:'profile', label:'Profile', get:m=>m.profile, fmt:v=>v==null?'':String(v)},
|
|
@@ -6316,13 +6386,11 @@ document.getElementById('csArm3dB').onclick=()=>{const d3=window.Steel3DView;if(
|
|
|
6316
6386
|
* markup has no updater in this function, because a hand-maintained second copy is exactly how the v2
|
|
6317
6387
|
* rows came to be skipped in the first place.
|
|
6318
6388
|
*
|
|
6319
|
-
* WHAT A ROW ON A READ-ONLY DOCUMENT REPORTS.
|
|
6320
|
-
*
|
|
6321
|
-
*
|
|
6322
|
-
*
|
|
6323
|
-
*
|
|
6324
|
-
* of this repair did, and it shipped `aria-checked=true` on a DISABLED row — "on, and you cannot turn it
|
|
6325
|
-
* off", which is the very defect this repair exists to remove, just moved to different rows.
|
|
6389
|
+
* WHAT A ROW ON A READ-ONLY DOCUMENT REPORTS. Dimensions and Callouts draw onto the 2D plan, and
|
|
6390
|
+
* Reference sheet draws the traced sheet under it. A v2 document has no 2D plan — render() returns before
|
|
6391
|
+
* drawing one and the 2D tab is permanently the #ro2d empty state — so those three are OFF and disabled.
|
|
6392
|
+
* Member length is deliberately different: it is a model-space read that paints in 3D, the view a v2
|
|
6393
|
+
* document opens in. It therefore reports the shared preference and remains live in read-only mode.
|
|
6326
6394
|
*
|
|
6327
6395
|
* (The equivalent v1 case — Reference sheet checked-and-disabled on a plan with no traced sheet — is
|
|
6328
6396
|
* pre-existing and deliberately untouched here; this change is scoped to the read-only regression.)
|
|
@@ -6336,17 +6404,11 @@ document.getElementById('csArm3dB').onclick=()=>{const d3=window.Steel3DView;if(
|
|
|
6336
6404
|
function syncDisplayRows(){updGridToggle();updLenToggle();updDimToggle();updCalloutToggle();updPlToggle();updRefToggle();}
|
|
6337
6405
|
function updDimToggle(){const b=document.getElementById('dimToggleB');if(!b)return;const on=!MODEL_RO&&dimsVisible;b.disabled=MODEL_RO;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}
|
|
6338
6406
|
document.getElementById('dimToggleB').onclick=e=>{e.stopPropagation();if(MODEL_RO)return;dimsVisible=!dimsVisible;updDimToggle();render();}; // the guard is the enforcement, the disable is only the UX — same split canWriteViews makes
|
|
6339
|
-
// Member length is
|
|
6340
|
-
//
|
|
6341
|
-
//
|
|
6342
|
-
|
|
6343
|
-
//
|
|
6344
|
-
// are both skipped or unreachable on v2; and _len3dFt measures `m.wp`, which a v2 member does not have
|
|
6345
|
-
// (it carries from/to), so every length comes back 0 and is dropped as degenerate. Wiring the call alone
|
|
6346
|
-
// would therefore NOT fix it. Delete this disable when v2 gets a real length — it describes a gap, it
|
|
6347
|
-
// does not declare the row inapplicable.
|
|
6348
|
-
function updLenToggle(){const b=document.getElementById('lenToggleB');if(!b)return;const on=!MODEL_RO&&showSelLen;b.disabled=MODEL_RO;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}
|
|
6349
|
-
document.getElementById('lenToggleB').onclick=e=>{e.stopPropagation();if(MODEL_RO)return;showSelLen=!showSelLen;try{localStorage.setItem('steel:selLen:v1',showSelLen?'1':'0');}catch(_){}updLenToggle();render();}; // render() repaints the 2D chips + pushes labels to 3D
|
|
6407
|
+
// Member length is a READ, not an edit: it remains live for a read-only v2 model and resolves its text
|
|
6408
|
+
// behind modelReadsV2's world-mm geometry boundary. render() repaints 2D chips on v1 and pushes the same
|
|
6409
|
+
// selected-member payload to 3D on both formats.
|
|
6410
|
+
function updLenToggle(){const b=document.getElementById('lenToggleB');if(!b)return;const on=showSelLen;b.disabled=false;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}
|
|
6411
|
+
document.getElementById('lenToggleB').onclick=e=>{e.stopPropagation();showSelLen=!showSelLen;try{localStorage.setItem('steel:selLen:v1',showSelLen?'1':'0');}catch(_){}updLenToggle();render();}; // render() repaints the 2D chips + pushes/clears labels in 3D
|
|
6350
6412
|
function updCalloutToggle(){const b=document.getElementById('calloutToggleB');if(!b)return;const on=!MODEL_RO&&calloutsVisible;b.disabled=MODEL_RO;b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));} // plan-only, like Dimensions
|
|
6351
6413
|
document.getElementById('calloutToggleB').onclick=e=>{e.stopPropagation();if(MODEL_RO)return;calloutsVisible=!calloutsVisible;updCalloutToggle();render();};
|
|
6352
6414
|
// NOTE FOR THE NEXT EDITOR: do NOT add `b.disabled=MODEL_RO` here to match the five rows around it.
|
|
@@ -6610,9 +6672,9 @@ function closeMore(){moreMenu.classList.remove('open');moreBtn.setAttribute('ari
|
|
|
6610
6672
|
moreBtn.onclick=e=>{e.stopPropagation();if(moreOpen())closeMore();else{
|
|
6611
6673
|
// "Send selection to Tekla" is hidden, not disabled, with nothing selected — there is no action to
|
|
6612
6674
|
// offer yet, and a greyed row would read as a broken feature rather than an empty state.
|
|
6613
|
-
{const anySel=!selArr().length;for(const bid of ['sendTeklaB','sendRevitB','sendSketchupB']){const b=document.getElementById(bid);if(b)b.hidden=anySel;}}
|
|
6675
|
+
{const anySel=!selArr().length;for(const bid of ['sendTeklaB','sendRevitB','sendSketchupB','sendRhinoB']){const b=document.getElementById(bid);if(b)b.hidden=anySel;}}
|
|
6614
6676
|
moreMenu.classList.add('open');moreBtn.setAttribute('aria-expanded','true');document.addEventListener('mousedown',moreOutside,true);}};
|
|
6615
|
-
for(const [bid,host] of [['sendTeklaB','tekla'],['sendRevitB','revit'],['sendSketchupB','sketchup']]){
|
|
6677
|
+
for(const [bid,host] of [['sendTeklaB','tekla'],['sendRevitB','revit'],['sendSketchupB','sketchup'],['sendRhinoB','rhino']]){
|
|
6616
6678
|
const b=document.getElementById(bid);if(b)b.onclick=()=>{closeMore();sendSelectionToHost(host,teklaSelectionIds());};}
|
|
6617
6679
|
moreMenu.addEventListener('click',e=>{if(e.target.closest('button')&&!e.target.closest('.msnap')&&!e.target.closest('.dtog')&&!e.target.closest('.msec-hdr')&&!e.target.closest('.ins-in-menu'))closeMore();}); // an item's own handler runs (bubble) before this closes the menu; the snap toggles, section headers, and the Insert picker keep the menu open (settings, not one-shot actions)
|
|
6618
6680
|
// "Snapping" is collapsible to save menu space — the header expands the running-snap switches below it
|
|
@@ -6843,9 +6905,9 @@ function invalidateConnectionDiagnostics(immediate=false){
|
|
|
6843
6905
|
let teklaSendBusy=false;
|
|
6844
6906
|
const teklaSelectionIds=()=>selArr().map(m=>m.id); // members only: grid lines, dimensions and connection parts are never sent (selArr matches against real members)
|
|
6845
6907
|
// What the user calls each application. Copy NEVER says "sketchup-2026" or an agent id.
|
|
6846
|
-
const HOST_NAME={tekla:'Tekla',revit:'Revit',sketchup:'SketchUp'};
|
|
6908
|
+
const HOST_NAME={tekla:'Tekla',revit:'Revit',sketchup:'SketchUp',rhino:'Rhino'};
|
|
6847
6909
|
// Tekla keeps its original route (its readiness probe can tell "open but no model loaded", which the
|
|
6848
|
-
// generic one cannot); Revit and
|
|
6910
|
+
// generic one cannot); Revit, SketchUp, and Rhino share the newer one. Same request body either way.
|
|
6849
6911
|
const hostSendUrl=(host)=>'/api/contract/'+encodeURIComponent(APP_ID)+(host==='tekla'?'/export-tekla':'/export-host/'+encodeURIComponent(host))+PROJECT_QS;
|
|
6850
6912
|
|
|
6851
6913
|
/* Resolve where a drag-out was released and send there.
|
|
@@ -6874,8 +6936,8 @@ async function resolveAndSend(payload){
|
|
|
6874
6936
|
// app happens to sit open from unrelated work must not get an insert into a model they never
|
|
6875
6937
|
// pointed at. Refusing costs a re-drag; guessing costs a wrong model.
|
|
6876
6938
|
if(resolved){
|
|
6877
|
-
toast(proc?('Released over '+proc+' — nothing sent. Drag it out again over Tekla, Revit or
|
|
6878
|
-
:'Released over the desktop — nothing sent. Drag it out again over Tekla, Revit or
|
|
6939
|
+
toast(proc?('Released over '+proc+' — nothing sent. Drag it out again over Tekla, Revit, SketchUp or Rhino.')
|
|
6940
|
+
:'Released over the desktop — nothing sent. Drag it out again over Tekla, Revit, SketchUp or Rhino.');
|
|
6879
6941
|
return;
|
|
6880
6942
|
}
|
|
6881
6943
|
// A drop we could NOT READ is a different fact — our failure, not their aim. With exactly one CAD
|
|
@@ -6885,7 +6947,7 @@ async function resolveAndSend(payload){
|
|
|
6885
6947
|
if(running.length!==1){
|
|
6886
6948
|
toast(running.length>1
|
|
6887
6949
|
?'Couldn’t tell which app you dropped on — try again, or use ⋯ → Session to pick one.'
|
|
6888
|
-
:'Couldn’t tell what you dropped on — open Tekla, Revit or
|
|
6950
|
+
:'Couldn’t tell what you dropped on — open Tekla, Revit, SketchUp or Rhino and try again.');
|
|
6889
6951
|
return;
|
|
6890
6952
|
}
|
|
6891
6953
|
host=running[0];pid=null;
|
|
@@ -6925,14 +6987,19 @@ async function sendSelectionToHost(host,ids,hostPid){
|
|
|
6925
6987
|
const gotNoun=got===1?'member':'members',missed=n-got;
|
|
6926
6988
|
// A member can land as a generic placeholder solid when its section isn't loaded in the host —
|
|
6927
6989
|
// report that rather than let the user find a grey block and assume the export is broken.
|
|
6928
|
-
// One sentence shape across all
|
|
6990
|
+
// One sentence shape across all four hosts — "Inserted {got} of {n} … into {Host} — {why}." —
|
|
6929
6991
|
// so only the reason clause varies by host, never the voice.
|
|
6930
6992
|
const fell=em?em.filter(r=>r&&r.kind==='member'&&r.fallback).length:0;
|
|
6931
|
-
|
|
6993
|
+
let insertedMessage=missed>0
|
|
6932
6994
|
?'Inserted '+got+' of '+n+' '+noun+' into '+NAME+' — '+missed+' had no size to build yet.'
|
|
6933
6995
|
:(fell>0
|
|
6934
6996
|
?'Inserted '+got+' of '+n+' '+noun+' into '+NAME+' — '+fell+' used a placeholder shape (their section isn’t loaded in '+NAME+').'
|
|
6935
|
-
:'Inserted '+got+' '+gotNoun+' into '+NAME+'.')
|
|
6997
|
+
:'Inserted '+got+' '+gotNoun+' into '+NAME+'.');
|
|
6998
|
+
const receiptWarnings=j.receipt&&Array.isArray(j.receipt.warnings)?j.receipt.warnings:[];
|
|
6999
|
+
if(got>0&&host==='rhino'&&receiptWarnings.some(w=>w&&w.code==='view-frame-failed')){
|
|
7000
|
+
insertedMessage+=' Rhino couldn’t frame the view — switch to a model view, then use Zoom Extents to find the inserted members.';
|
|
7001
|
+
}
|
|
7002
|
+
toast(insertedMessage);
|
|
6936
7003
|
}catch(e){
|
|
6937
7004
|
console.error('send to '+host+' failed',e);
|
|
6938
7005
|
// The server's own messages are plain English; a transport failure ("Failed to fetch") is not.
|
|
@@ -7003,8 +7070,10 @@ function modelReadsV1(){
|
|
|
7003
7070
|
const planList=()=>((C&&Array.isArray(C.plans))?C.plans:[]).map(p=>({members:p.members||[],ptPerFt:(p.pt_per_ft>0?p.pt_per_ft:1),defaultTosMm:(p.default_tos!=null?p.default_tos:0)*25.4})); // every sheet WITH its OWN px→ft scale AND its OWN default T.O.S, exactly as the server bake resolves them (contract-to-scene). Guards a not-yet-loaded contract so a hover can't throw out of the pointer handler.
|
|
7004
7071
|
const scaleIndex=()=>{if(!scaleIdx){try{scaleIdx=SteelCore.planScaleIndex(planList(),activeScale());}catch(_){return new Map();}}return scaleIdx;}; // a transient failure returns an empty index WITHOUT caching it — caching one would silently downgrade every member to the active scale until the next rebuild
|
|
7005
7072
|
return {
|
|
7073
|
+
memberEditing:true, // the view may build drag geometry as well as selection state
|
|
7006
7074
|
invalidate(){scaleIdx=null;},
|
|
7007
7075
|
geometryOf:m=>SteelCore.memberGeometryInOwnPlan(m,scaleIndex(),activeScale()),
|
|
7076
|
+
lengthFt(m){const s=SteelCore.planScaleOf(scaleIndex(),m,activeScale());return _len3dFt(m,s.ptPerFt,s.defaultTosMm/25.4);},
|
|
7008
7077
|
scaleOf:m=>SteelCore.planScaleOf(scaleIndex(),m,activeScale()), // keyed by the member OBJECT — ids are only sheet-unique
|
|
7009
7078
|
defaultPlaneZ:()=>activeScale().defaultTosMm,
|
|
7010
7079
|
memberCandidates(excludeId){const dtos=activeScale().defaultTosMm;
|
|
@@ -7020,9 +7089,13 @@ function modelReadsV1(){
|
|
|
7020
7089
|
function modelReadsV2(){
|
|
7021
7090
|
const mem=()=>(C&&Array.isArray(C.members))?C.members:[]; // v2 holds ONE root member array — not a plan property at all
|
|
7022
7091
|
const refuse=(what)=>{throw new Error('steel.model/v2: '+what);};
|
|
7092
|
+
const geometryOf=m=>SteelCore.memberGeometryV2(m);
|
|
7023
7093
|
return {
|
|
7094
|
+
memberEditing:false, // selection stays live; member drag/copy/edit remains refused in this release
|
|
7024
7095
|
invalidate(){}, // nothing is cached: a v2 member carries its own world-mm coordinates, so there is no per-plan scale to index
|
|
7025
|
-
geometryOf
|
|
7096
|
+
geometryOf,
|
|
7097
|
+
lengthFt(m){const g=geometryOf(m),a=g&&g.line&&g.line[0],b=g&&g.line&&g.line[1];
|
|
7098
|
+
return (a&&b)?Math.hypot(b[0]-a[0],b[1]-a[1],b[2]-a[2])/V2_PT_PER_FT:0;}, // stored world mm → true 3D feet; unknown/malformed elevations stay an absent label, never a fabricated length
|
|
7026
7099
|
// A v2 member has no owning plan and no scale. This is only ever asked by a WRITE path (the member
|
|
7027
7100
|
// drag, the endpoint drag, split), every one of which is refused — so reaching it is a bug, and a
|
|
7028
7101
|
// throw says so instead of inverting a commit through a fabricated scale.
|
|
@@ -8308,7 +8381,7 @@ function applyLegendFilter(){
|
|
|
8308
8381
|
}
|
|
8309
8382
|
// Resolve a row to the member/connection ids it represents. A member row's data-key is a profile key; a connection
|
|
8310
8383
|
// row carries its part ids on row._ids. Used by legend click-to-select + the box/isolate SELECTION actions below.
|
|
8311
|
-
function legRowIds(row){if(!row)return [];if(row.dataset.connkey)return (row._ids||[]).slice();const k=row.dataset.key;if(!k)return [];return (
|
|
8384
|
+
function legRowIds(row){if(!row)return [];if(row.dataset.connkey)return (row._ids||[]).slice();const k=row.dataset.key;if(!k)return [];return allMembers().filter(m=>profileKeyOf(m)===k).map(m=>m.id);} // v2's Objects list shows root members, so its selection lookup must use the same format-aware model list rather than the active plan's intentionally empty members[]
|
|
8312
8385
|
let bar3dWired=false;
|
|
8313
8386
|
function seg3dActive(sel,attr,val){document.querySelectorAll(sel+' button').forEach(b=>b.classList.toggle('on',b.getAttribute(attr)===val));}
|
|
8314
8387
|
// Reflect the live projection / display mode into the Camera + Display dropdowns: tick the active menu item AND label the trigger button, so the current mode shows without opening the menu.
|
|
@@ -103,6 +103,16 @@ footer{margin-top:auto;display:flex;align-items:center;gap:6px;flex-wrap:wrap;bo
|
|
|
103
103
|
#canvas text.el{pointer-events:all;cursor:pointer;user-select:none}
|
|
104
104
|
#empty{position:absolute;inset:0;display:none;align-items:center;justify-content:center;padding:40px;text-align:center;color:var(--mut)}
|
|
105
105
|
#empty.show{display:flex}
|
|
106
|
+
#empty>div{max-width:44ch}
|
|
107
|
+
#empty h1{margin:0;font-size:16px;font-weight:600;color:var(--text)}
|
|
108
|
+
#empty .empty-body{margin:8px 0 0;line-height:1.55;color:var(--mut)}
|
|
109
|
+
#empty .empty-body[hidden]{display:none}
|
|
110
|
+
body.publication-blocked header > :not(b),
|
|
111
|
+
body.publication-blocked #panel,
|
|
112
|
+
body.publication-blocked #canvas,
|
|
113
|
+
body.publication-blocked #zoombar{display:none}
|
|
114
|
+
body.publication-blocked #stage{display:flex}
|
|
115
|
+
body.publication-blocked #empty{position:static;flex:1}
|
|
106
116
|
#zoombar{position:absolute;left:12px;bottom:12px;display:flex;gap:6px;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:6px 8px;box-shadow:0 4px 14px rgba(0,0,0,.45)}
|
|
107
117
|
/* eyedropper popover */
|
|
108
118
|
#eye{position:fixed;display:none;z-index:50;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:10px;box-shadow:0 8px 24px rgba(0,0,0,.5);min-width:210px}
|
|
@@ -177,9 +187,10 @@ footer{margin-top:auto;display:flex;align-items:center;gap:6px;flex-wrap:wrap;bo
|
|
|
177
187
|
<image class="bg"></image>
|
|
178
188
|
<g id="overlay" fill="none"></g>
|
|
179
189
|
</svg>
|
|
180
|
-
<div id="empty">
|
|
190
|
+
<div id="empty" role="status" aria-live="polite">
|
|
181
191
|
<div>
|
|
182
|
-
<
|
|
192
|
+
<h1>No filter data yet.</h1>
|
|
193
|
+
<p class="empty-body" hidden></p>
|
|
183
194
|
<!-- "then reload" is GONE, and #441 is what earned that: until it landed, the pre-read verb
|
|
184
195
|
(server/steel-prepass-route.ts) broadcast nothing at all, so this hint could only tell the user
|
|
185
196
|
to refresh by hand. It now announces itself as `pre-read`.
|
|
@@ -560,11 +571,16 @@ async function bootOnce(){
|
|
|
560
571
|
let res;
|
|
561
572
|
try { res = await fetch('/api/contract/' + encodeURIComponent(APP_ID) + CONTRACT_QS); }
|
|
562
573
|
catch(e){ showEmpty('Could not reach the server.'); return; }
|
|
563
|
-
//
|
|
564
|
-
//
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
574
|
+
// A project read asks for 204 when no contract is stored yet. An app-keyed 404 can mean that too, or
|
|
575
|
+
// it can be the explicit publication-ownership refusal shared with the editor and export routes.
|
|
576
|
+
if(res.status === 204){ showEmpty(); return; }
|
|
577
|
+
if(res.status === 404){
|
|
578
|
+
const body = await res.json().catch(() => null);
|
|
579
|
+
const code = body && body.code;
|
|
580
|
+
const publication = publicationEmptyState(code);
|
|
581
|
+
publication ? showEmpty(publication.heading, true, publication.detail) : showEmpty();
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
568
584
|
// Anything else IS a failure, and saying which one matters: a bare showEmpty() presented a 402
|
|
569
585
|
// (subscription lapsed) or a 500 as "No filter data yet" — indistinguishable from a project simply
|
|
570
586
|
// awaiting its first bake — leaving the user, and anyone reading their console, nothing to go on.
|
|
@@ -587,10 +603,36 @@ async function bootOnce(){
|
|
|
587
603
|
if(note) showUpdateNote();
|
|
588
604
|
}
|
|
589
605
|
|
|
590
|
-
function
|
|
606
|
+
function publicationEmptyState(code){
|
|
607
|
+
if(code === 'project-publication-missing-project'){
|
|
608
|
+
return {
|
|
609
|
+
heading: 'The project for this model isn’t available',
|
|
610
|
+
detail: 'It may be archived, deleted, or stored on another computer. Check Archived in Workspaces; if you have a project archive, import it.',
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
if(code === 'project-publication-availability-unknown'){
|
|
614
|
+
return {
|
|
615
|
+
heading: 'Couldn’t check project availability',
|
|
616
|
+
detail: 'Open Workspaces to check for a project, then try again.',
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
if(code === 'project-publication'){
|
|
620
|
+
return {
|
|
621
|
+
heading: 'Open a project from Workspaces',
|
|
622
|
+
detail: 'This model was published from a project, and a project using this workflow is available in Workspaces. Open Workspaces to continue with a project.',
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
return null;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function showEmpty(msg, publicationBlocked = false, detail = ''){
|
|
591
629
|
const e = document.getElementById('empty');
|
|
630
|
+
document.body.classList.toggle('publication-blocked', publicationBlocked);
|
|
631
|
+
const body = e.querySelector('.empty-body');
|
|
632
|
+
body.textContent = detail;
|
|
633
|
+
body.hidden = !detail;
|
|
592
634
|
if(msg){
|
|
593
|
-
e.querySelector('
|
|
635
|
+
e.querySelector('h1').textContent = msg;
|
|
594
636
|
// The hint below explains how a filter gets BAKED ("your terminal AI reads the drawing once…"). Under an
|
|
595
637
|
// error headline — "Could not reach the server.", a 402, "No app specified." — that answers a question
|
|
596
638
|
// nobody asked and implies the thing is merely pending, so it goes away with the good news.
|