@floless/app 0.128.2 → 0.129.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.
@@ -1501,10 +1501,10 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1501
1501
  <span class=tb-sep></span>
1502
1502
  <!-- Section -->
1503
1503
  <div class=m3dwrap>
1504
- <button id=m3dClip data-tip="Clip planes and boxes — section to see inside a connection">Clip ▾</button>
1504
+ <button id=m3dClip data-tip="Clip planes and boxes — section your model to see inside">Clip ▾</button>
1505
1505
  <div id=m3dClipMenu class=m3dmenu role=menu>
1506
1506
  <button data-clip=plane data-tip="Click a model face to cut the view there (Shift+X)">Add clip plane</button>
1507
- <button data-clip=box data-tip="Section a box around the selection (or whole model) (Shift+B)">Add clip box</button>
1507
+ <button data-clip=box data-tip="Click two corners, then a height, to cut away everything outside (Shift+B)">Add clip box</button>
1508
1508
  <hr>
1509
1509
  <button data-clip=clear class=mdanger data-tip="Remove every clip">Clear all clips</button>
1510
1510
  </div>
@@ -1512,7 +1512,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1512
1512
  <div class=m3dwrap>
1513
1513
  <button id=m3dWp data-tip="Working plane — every 3D pick (Move/Copy, next: drawing) lands on it. Set it from a face, 3 points, or a principal plane.">◇ Plane ▾</button>
1514
1514
  <div id=m3dWpMenu class=m3dmenu role=menu>
1515
- <button data-wp=face data-tip="One click on any member face — the plane lands on it">Pick a face…</button>
1515
+ <button data-wp=face data-tip="One click on any face — yours or a reference model's — the plane lands on it">Pick a face…</button>
1516
1516
  <button data-wp=3pt data-tip="Three snapped points: origin, X direction, a point on the Y side">3 points…</button>
1517
1517
  <hr>
1518
1518
  <div class=mlabel>Principal + offset</div>
@@ -9563,6 +9563,17 @@ async function deleteFav(f){const idx=steelFavourites.findIndex(x=>x.id===f.id);
9563
9563
  // item is replaced by a sentence saying what unlocks it — the server refuses the verbs there too, with
9564
9564
  // the same words, so a direct API hit and a click get the same answer.
9565
9565
  const refGeom=new Map(); // id -> { objects, dropped } once the geometry route has answered
9566
+ /**
9567
+ * Is a progressive preview session open, and what is it called?
9568
+ *
9569
+ * TWO VARIABLES, because they answer different questions and only one may be trusted as the claim.
9570
+ * `refPreviewBusy` is the mutual-exclusion flag — the 3D layer holds ONE preview group, so a second
9571
+ * overlapping session would draw into the first's placement. `refPreviewFor` is only the label the
9572
+ * References tab prints, and a reference whose name is missing would make it falsy — which is exactly
9573
+ * how a name-as-claim silently stops excluding anything.
9574
+ */
9575
+ let refPreviewBusy=false;
9576
+ let refPreviewFor=null;
9566
9577
  const refLoading=new Set(); // ids with a geometry fetch in flight — the row shows it, and it dedupes
9567
9578
  const refFailed=new Map(); // id -> why its geometry could not be fetched (see loadReferenceGeometry)
9568
9579
  const refEmpty=new Set(); // ids the reader answered for, with nothing drawable in the answer
@@ -9654,6 +9665,158 @@ function pushReferences(){
9654
9665
  if(refSelectedId&&v.selectReference&&(!v.selectedReference||v.selectedReference()!==refSelectedId))v.selectReference(refSelectedId);
9655
9666
  }
9656
9667
 
9668
+ /**
9669
+ * Open a progress channel and draw the model as AWARE tessellates it (aware-aeco/aware#405).
9670
+ *
9671
+ * WHY A SESSION AND NOT JUST A STREAM: the server mints the id, so there is no ordering problem. Were
9672
+ * the client to choose it, we would have to either subscribe before the server knew it existed or POST
9673
+ * before subscribing and lose the early batches. Here the session is real the moment the POST below
9674
+ * returns, so we subscribe to something that exists and only then start the import.
9675
+ *
9676
+ * EVERYTHING HERE IS OPTIONAL. A server too old to know the route, a blocked EventSource, a filtered
9677
+ * read (which never produces segments) — every one of them returns null or simply never calls back,
9678
+ * and the import proceeds exactly as it did before this existed. It must never be able to fail one.
9679
+ *
9680
+ * Returns `{progressId, close}`; `close()` is idempotent and MUST be called on every exit, because it
9681
+ * is what removes the preview from the scene.
9682
+ */
9683
+ async function refPreviewOpen(placement,displayName){
9684
+ const V=window.Steel3DView;
9685
+ if(!V||!V.appendReferencePreview)return null;
9686
+ // ONE PREVIEW AT A TIME, and the second caller simply goes without.
9687
+ //
9688
+ // The 3D layer holds a SINGLE preview group with one placement matrix, so two overlapping sessions
9689
+ // would append into each other: the second reference's objects drawn at the first's placement, and
9690
+ // whichever finished first calling `clearReferencePreview()` on both. Overlap is reachable — an
9691
+ // insert can start while a cold-cache `loadReferenceGeometry` is still streaming. Refusing the second
9692
+ // is honest and costs it only the preview; its import is untouched and it draws normally at the end.
9693
+ // (Codex review; the alternative — a per-session group — buys nothing a user can perceive, since two
9694
+ // previews at once is not a state worth rendering.)
9695
+ if(refPreviewBusy)return null;
9696
+ // CLAIMED SYNCHRONOUSLY, before the first `await`. Claiming after the POST would leave the guard above
9697
+ // useless: two callers would both read false, both suspend on the fetch, and both proceed — precisely
9698
+ // the overlap the guard exists to prevent.
9699
+ // The CLAIM is taken now; the LABEL is not. `refPreviewFor` drives a sentence asserting that grey
9700
+ // geometry is on the canvas, and at this instant none is — the first batch is seconds away, and on a
9701
+ // FILTERED import none ever arrives, because `wantsSegments` refuses to segment those at all. Setting
9702
+ // it here would point that sentence at an empty canvas for the whole import. It is set on the first
9703
+ // batch instead, where the claim becomes true. (Code + UX review.)
9704
+ refPreviewBusy=true;refPreviewFor=null;
9705
+ const label=displayName||null;
9706
+ const giveUp=()=>{refPreviewBusy=false;refPreviewFor=null;return null;};
9707
+ let sessionId=null;
9708
+ try{
9709
+ const res=await fetch(refApi('/progress'),{method:'POST',headers:{'content-type':'application/json'}});
9710
+ const d=await res.json().catch(()=>({}));
9711
+ if(!res.ok||!d.ok||!d.sessionId)return giveUp();
9712
+ sessionId=d.sessionId;
9713
+ }catch(e){return giveUp();} // an unreachable/older server gets today's behaviour
9714
+ let es=null,done=false,painted=0;
9715
+ // THE NOTE IS BORROWED, NOT OWNED, so it is put back. `#riProgNote` carries authored copy ("You can
9716
+ // close this — FloLess will keep importing this model.") that nothing else ever rewrites; without a
9717
+ // restore, the first preview replaces that affordance for the rest of the page's life, and a preview
9718
+ // run from `loadReferenceGeometry` — which has no modal open — leaves a stale count behind that the
9719
+ // NEXT import shows, about a different model. (Silent-failure review.)
9720
+ const noteEl=document.getElementById('riProgNote');
9721
+ const noteWas=noteEl?noteEl.textContent:null;
9722
+ const close=()=>{
9723
+ if(done)return;done=true;
9724
+ try{es&&es.close();}catch(e){}
9725
+ // CLEARED BEFORE the authoritative geometry is built by `pushReferences`, never after, so peak GPU
9726
+ // is the larger of preview and real rather than their sum.
9727
+ try{V.clearReferencePreview&&V.clearReferencePreview();}catch(e){console.error('[reference] preview dispose failed',e);}
9728
+ // Put the borrowed note back exactly as it was, so the next import starts from the authored copy.
9729
+ if(noteEl&&noteWas!==null)noteEl.textContent=noteWas;
9730
+ refPreviewBusy=false;refPreviewFor=null;
9731
+ // The panel is showing preview copy that is no longer true; repaint it. Guarded because `close()`
9732
+ // also runs on paths where the tab was never the references one.
9733
+ try{if(legendTab==='refs')renderRefsTab();}catch(e){}
9734
+ };
9735
+ try{
9736
+ es=new EventSource(refApi('/progress/'+encodeURIComponent(sessionId)));
9737
+ es.onmessage=(ev)=>{
9738
+ if(done)return;
9739
+ let m=null;try{m=JSON.parse(ev.data);}catch(e){return;}
9740
+ if(!m)return;
9741
+ if(m.type==='stopped'){
9742
+ // TERMINAL. The server says so for a crossed cap, a suppressed channel, an overflow or the import
9743
+ // answering. The geometry stays on screen until `close()`, which the caller runs the moment it has
9744
+ // the real thing; only the STREAM ends here.
9745
+ //
9746
+ // AND THE LINE MUST BE CORRECTED, which this branch previously did not do. It closed the stream and
9747
+ // returned, leaving "…the rest are still being prepared" frozen on screen — a sentence that becomes
9748
+ // FALSE the instant the channel stops, because the rest of the preview is never coming even though
9749
+ // the import genuinely is still running. The comment here used to describe that exact failure as
9750
+ // the thing to avoid while the code committed it. (UX review.)
9751
+ try{es.close();}catch(e){}
9752
+ // ONLY WHEN DELIVERY STOPPED EARLY, which is what the reason distinguishes. A normal finish also
9753
+ // ends this channel — the pump is aborted the moment the read returns — and rewriting the line
9754
+ // then would flash "the live preview stopped there, but the import is still running" on EVERY
9755
+ // successful import, a second before the modal closes. True for that second and useless: the
9756
+ // sentence exists for the case where the preview stops and the wait genuinely continues.
9757
+ // INVERTED, so a reason nobody listed here is SAFE rather than silent. The first cut named the
9758
+ // three early stops explicitly — and omitted `error`, which is what a failed segment transfer
9759
+ // emits and so the likeliest early stop of all, plus `expired`. Those fell through to "say
9760
+ // nothing", freezing "…the rest are still being prepared" on screen for the remaining minutes of
9761
+ // the read: exactly the false sentence this branch was rewritten to prevent, reintroduced by an
9762
+ // allowlist. Only the two reasons that mean THE READ ITSELF ended stay quiet; anything else is an
9763
+ // early stop until proven otherwise. (Silent-failure review.)
9764
+ if(m.reason!=='aborted'&&m.reason!=='done')refPreviewStopped(painted);
9765
+ return;
9766
+ }
9767
+ if(m.type!=='batch'||!Array.isArray(m.objects))return;
9768
+ try{
9769
+ V.appendReferencePreview(m.objects,placement||null);
9770
+ // Once, on the first batch — a model at real site coordinates would otherwise preview entirely
9771
+ // off-screen, which for this feature is indistinguishable from it not working.
9772
+ V.frameReferencePreview&&V.frameReferencePreview();
9773
+ const first=painted===0;
9774
+ painted=m.painted||painted;
9775
+ refPreviewNote(painted);
9776
+ // The label goes up with the FIRST batch — the moment its sentence becomes true — and the panel is
9777
+ // repainted once, then never again per batch, which would be pure churn.
9778
+ if(first){refPreviewFor=label;if(legendTab==='refs')renderRefsTab();}
9779
+ }catch(e){console.error('[reference] preview batch failed',e);}
9780
+ };
9781
+ // An EventSource error is ordinary here (the server ends the stream when the import answers) and
9782
+ // must stay silent: the import owns the outcome and is about to report it.
9783
+ es.onerror=()=>{};
9784
+ }catch(e){return {progressId:sessionId,close};}
9785
+ return {progressId:sessionId,close};
9786
+ }
9787
+
9788
+ /**
9789
+ * Say what the preview is showing, in the modal's own progress line.
9790
+ *
9791
+ * A count rather than a bar: the total is not known until the walk ends (that is the whole reason this
9792
+ * feature exists), so a percentage would be invented. "Showing 1,300 objects so far" is true.
9793
+ */
9794
+ function refPreviewNote(painted){
9795
+ const el=document.getElementById('riProgNote');
9796
+ if(!el||!painted)return;
9797
+ el.textContent='Showing '+painted.toLocaleString('en-US')+' object'+(painted===1?'':'s')+' so far — the rest are still being prepared.';
9798
+ }
9799
+
9800
+ /**
9801
+ * The preview stream has ended while the import continues — say so, precisely.
9802
+ *
9803
+ * THE SENTENCE MUST STOP PROMISING. "…the rest are still being prepared" is true only while batches
9804
+ * are still coming; once the channel is done it describes something that will never happen, on a modal
9805
+ * that is otherwise scrupulous about claiming only what it can back up. The import is genuinely still
9806
+ * running, so the copy has to separate the two: the PREVIEW stopped, the IMPORT did not.
9807
+ *
9808
+ * Two cases, because they are different facts. Some geometry arrived and then delivery ended (the cap,
9809
+ * a suppressed channel, an overflow) — name what is on screen and that it stops there. Or none ever
9810
+ * arrived, in which case saying "showing 0 objects" would be worse than saying nothing about a count.
9811
+ */
9812
+ function refPreviewStopped(painted){
9813
+ const el=document.getElementById('riProgNote');
9814
+ if(!el)return;
9815
+ el.textContent=painted>0
9816
+ ? 'Showing '+painted.toLocaleString('en-US')+' object'+(painted===1?'':'s')+' — the live preview stopped there, but the import is still running.'
9817
+ : "A live preview isn't available for this import — it's still converting in the background.";
9818
+ }
9819
+
9657
9820
  /**
9658
9821
  * Fetch one reference's geometry.
9659
9822
  *
@@ -9668,11 +9831,17 @@ function pushReferences(){
9668
9831
  async function loadReferenceGeometry(id,opts){
9669
9832
  if(refGeom.has(id)||refLoading.has(id))return;
9670
9833
  refLoading.add(id);if(legendTab==='refs')renderRefsTab();
9834
+ // THE COLD-CACHE PATH IS WHERE THIS MATTERS MOST. The geometry cache is reserved-internal, so every
9835
+ // imported or duplicated project arrives with nothing cached and rebuilds here — someone opening a
9836
+ // shared project waits the whole read before a single triangle appears. The preview uses the stored
9837
+ // placement so it lands where the finished reference will.
9838
+ const pv=await refPreviewOpen((refById(id)||{}).placement||null,(refById(id)||{}).name||null).catch(()=>null);
9671
9839
  try{
9672
9840
  // INSIDE the suffix, not appended after. `refApi` already adds `?project=` and picks its own
9673
9841
  // separator from whether the suffix carries a `?` — appending afterwards produced a second `?`
9674
9842
  // and a 400, which is exactly what the browser pass caught.
9675
- const res=await fetch(refApi('/'+encodeURIComponent(id)+'/geometry'+((opts&&opts.rebuild)?'?rebuild=1':'')));
9843
+ const q=[(opts&&opts.rebuild)?'rebuild=1':'',pv?'progressId='+encodeURIComponent(pv.progressId):''].filter(Boolean).join('&');
9844
+ const res=await fetch(refApi('/'+encodeURIComponent(id)+'/geometry'+(q?'?'+q:'')));
9676
9845
  const d=await res.json().catch(()=>({}));
9677
9846
  // A LATE RESPONSE FOR A REMOVED REFERENCE IS DROPPED. These bodies can be hundreds of megabytes, and
9678
9847
  // repopulating `refGeom` under an id the contract no longer holds leaks all of it while making the
@@ -9714,7 +9883,11 @@ async function loadReferenceGeometry(id,opts){
9714
9883
  // here destroys an in-progress edit: a member selected, a value half-typed and not yet blurred, and any
9715
9884
  // reference finishing its fetch removes the focused input and restores the old value. `loadAllReferences`
9716
9885
  // fires one of these per uncached reference at boot, so it is not a rare race. (Both halves: Codex.)
9717
- finally{refLoading.delete(id);pushReferences();if(legendTab==='refs')renderRefsTab();if(refSelectedObjIdx!==null)panel();}
9886
+ // `pv.close()` FIRST, so the preview is gone before `pushReferences()` builds the authoritative
9887
+ // meshes — the two must never be in the scene together, and disposing first is what keeps peak GPU
9888
+ // at the larger of them rather than their sum. It runs on every exit, including the arms above that
9889
+ // return early for a removed reference.
9890
+ finally{if(pv)pv.close();refLoading.delete(id);pushReferences();if(legendTab==='refs')renderRefsTab();if(refSelectedObjIdx!==null)panel();}
9718
9891
  }
9719
9892
  /** Pull every reference's geometry once the 3D view is up. Sequential: one AWARE run at a time anyway. */
9720
9893
  async function loadAllReferences(){for(const r of refList())await loadReferenceGeometry(r.id);}
@@ -10002,7 +10175,14 @@ function renderRefsTab(){const host=document.getElementById('m3dRefsBody');if(!h
10002
10175
 
10003
10176
  const all=refList();
10004
10177
  if(!all.length){const e=Object.assign(document.createElement('div'),{className:'refempty'});
10005
- e.textContent='No reference models yet — add somebody else’s IFC to see it beside your steel and snap to it. It never enters your BOM, an export, or the lock.';
10178
+ // A PREVIEW ON THE CANVAS MAKES THE PERMANENT COPY READ AS A CONTRADICTION. "No reference models yet"
10179
+ // is literally true while an import is still running — nothing is committed, which is the whole point
10180
+ // of the preview being kept out of `refGeom` and `xrefById` — but a user looking at a grey building on
10181
+ // screen is being told it is not there. Both facts are said instead: it is a preview, and it becomes a
10182
+ // row when the import finishes. (UX review.)
10183
+ e.textContent=refPreviewFor
10184
+ ? 'Reading “'+refPreviewFor+'” — the grey model on the canvas is a live preview. It will appear here as a reference once the import finishes.'
10185
+ : 'No reference models yet — add somebody else’s IFC to see it beside your steel and snap to it. It never enters your BOM, an export, or the lock.';
10006
10186
  host.appendChild(e);return;}
10007
10187
  for(const r of all){host.appendChild(buildRefRow(r));if(r.id===refSelectedId)host.appendChild(buildRefDetail(r));}
10008
10188
  // …and put the caret back where it was. Done here rather than in buildRefMeasureCard because focus only
@@ -11605,6 +11785,10 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
11605
11785
  const riOriginShift=takeOrigin&&riProbeCentre?riProbeCentre.map((v,i)=>riNative[i]-v):null;
11606
11786
  riStage('prog');ri$('riTitle').textContent='Converting into 3D viewer geometry';ri$('riProgNote').style.display='block';ri$('riCancel').textContent='Continue in background';riProg('Converting “'+riName+'” into 3D viewer geometry…','AWARE is tessellating objects and preparing the viewer file. Whole-building models can take several minutes; FloLess will add the reference when that completes.');
11607
11787
  let mid=null;
11788
+ // OPENED BEFORE THE POST, which is the whole ordering requirement: batches announced early would
11789
+ // otherwise be published to a session nobody had attached to yet. Null whenever a preview is not
11790
+ // available — an older server, a blocked EventSource, or a filtered read, which never segments.
11791
+ const riPreview=await refPreviewOpen(takeOrigin&&riOriginShift?{origin:riOriginShift}:null,riName).catch(()=>null);
11608
11792
  try{
11609
11793
  mid=newMutationId();riMutationId=mid;claimMutation(mid);
11610
11794
  const res=await fetch(refApi(''),{method:'POST',signal,headers:{'content-type':'application/json','x-floless-mutation-id':mid},
@@ -11616,7 +11800,10 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
11616
11800
  // part of what the user decided in this modal, so it belongs inside the point of no return
11617
11801
  // rather than in a PUT afterwards. `undefined` here means the whole file — never an empty list,
11618
11802
  // which the reader would read as "select nothing".
11619
- body:JSON.stringify({sha:riSha,name:riName,...(riFilterBody?{filter:riFilterBody}:{}),...(takeOrigin&&riOriginShift?{placement:{origin:riOriginShift}}:{})})});
11803
+ // `progressId` binds this import to the channel opened above. The server refuses a session
11804
+ // belonging to another app or project, and ignores an absent one — so an older server, or a
11805
+ // request without it, is simply the behaviour that shipped before this feature.
11806
+ body:JSON.stringify({sha:riSha,name:riName,...(riPreview?{progressId:riPreview.progressId}:{}),...(riFilterBody?{filter:riFilterBody}:{}),...(takeOrigin&&riOriginShift?{placement:{origin:riOriginShift}}:{})})});
11620
11807
  d=await res.json().catch(()=>({}));
11621
11808
  if(mine!==riRun){
11622
11809
  // Cancelled while this was in flight. The server refuses to commit for a client that has gone
@@ -11659,7 +11846,13 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
11659
11846
  if(mine!==riRun||(e&&e.name==='AbortError')){if(mid)releaseMutation(mid);if(riMutationId===mid)riMutationId=null;return;}
11660
11847
  if(riBackgrounded)toast('Reference import failed — the model could not be added.');
11661
11848
  riClearSoft();riStage('drop');riErr('Could not add that reference.');console.error('[reference] insert failed',e);return;}
11662
- finally{if(mine===riRun){riBusy=false;riAbort=null;riBackgrounded=false;ri$('riCancel').textContent='Cancel';}if(riMutationId===mid)riMutationId=null;}
11849
+ finally{
11850
+ // EVERY EXIT — committed, refused, cancelled, thrown. The preview is standing in for a model
11851
+ // that has now either arrived or been refused, so leaving it on screen would show geometry
11852
+ // beside the real thing, or geometry for an import that was rejected. This runs BEFORE
11853
+ // `pushReferences()` below builds the authoritative meshes, so the two never coexist.
11854
+ if(riPreview)riPreview.close();
11855
+ if(mine===riRun){riBusy=false;riAbort=null;riBackgrounded=false;ri$('riCancel').textContent='Cancel';}if(riMutationId===mid)riMutationId=null;}
11663
11856
  // ── PAST THE POINT OF NO RETURN. Everything above is the transaction; everything below is showing
11664
11857
  // it. They were one try, and a throw in the presentation half ran riErr() on a modal riClose() had
11665
11858
  // already hidden — so the user saw NOTHING while the reference was committed and on disk, and the
@@ -4,14 +4,71 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Steel Filter</title>
7
+ <!-- Mirrors the shell's light/dark choice onto this document's <html> — see web/frame-theme.js for
8
+ why it reads localStorage rather than being poked by the parent. Classic, non-deferred and in
9
+ <head> on purpose: the attribute has to land before first paint or a light user sees a dark flash. -->
10
+ <script src="./frame-theme.js"></script>
7
11
  <style>
8
- :root{--bg:#0f172a;--panel:#1e293b;--line:#334155;--text:#e2e8f0;--mut:#94a3b8;--brand:#3b82f6}
12
+ /* THE CHROME follows the app theme; THE DRAWING SURFACE does not — the two halves of this palette.
13
+ Everything a user reads as app furniture (header, filter rail, buttons, popovers, tooltips,
14
+ scrollbars) is themed below. The stage is deliberately dark in BOTH themes: the linework is
15
+ painted in PALETTE (bright blue/cyan/amber/mint, see the script) over a raster context held at
16
+ opacity .28, both of which are tuned for a dark ground and become unreadable on white. Flipping
17
+ the stage means re-deriving that whole drawing palette — a separate piece of work, and #602's
18
+ reporter names keeping it dark as the acceptable choice as long as it is a deliberate one.
19
+ One carve-out, and it is the same rule rather than an exception to it: the EMPTY state has no
20
+ linework on it, so nothing there justifies a dark ground and #empty follows the theme. */
21
+ :root{
22
+ color-scheme:dark; /* so the UA-drawn bits we do not style (selection, the pre-CSS canvas) agree */
23
+ --bg:#0f172a;--panel:#1e293b;--line:#334155;--text:#e2e8f0;--mut:#94a3b8;--brand:#3b82f6;
24
+ --brand-ink:#fff; /* text/glyphs on a --brand fill */
25
+ --brand-hover:#2f6fe0;
26
+ --btn:#334155; /* secondary button fill, and the option-row hover that matches it */
27
+ --btn-hover:#475569;
28
+ --ctrl-border:#475569; /* button, field and checkbox borders */
29
+ --scroll:#475569;--scroll-hover:#5b6b85;
30
+ --shadow-lg:0 8px 24px rgba(0,0,0,.5); /* popovers */
31
+ /* The tooltip keeps its own, SMALLER treatment on purpose: it is the same control on four surfaces
32
+ (steel-editor.html, vector-editor.html, vector-3d.html all ship 0 8px 22px), so folding it into
33
+ --shadow-lg would silently de-sync this one page from the other three. */
34
+ --shadow-tip:0 8px 22px rgba(0,0,0,.5);
35
+ --warn:#f59e0b;--ok:#34d399;--err:#f87171;
36
+ --cyan:#22d3ee;--cyan-soft:rgba(34,211,238,.10);
37
+ --empty-bg:#0f172a; /* the empty state covers the stage — in dark, the stage's own colour */
38
+ /* THE DARK ISLAND. The stage keeps its own furniture, in BOTH themes: a light zoom bar over a dark
39
+ drawing would put --text (near-black in light) on a --btn fill nobody re-tinted, and its shadow
40
+ would vanish. Pinning them here is also what makes the dark region read as a deliberate viewer
41
+ rather than a pane that failed to repaint. */
42
+ --stage:#0f172a;--stage-text:#e2e8f0;--stage-panel:#1e293b;--stage-line:#334155;
43
+ --stage-btn:#334155;--stage-btn-hover:#475569;--stage-ctrl:#475569;
44
+ --stage-shadow:0 4px 14px rgba(0,0,0,.45);
45
+ --banner-shadow:0 -4px 18px rgba(0,0,0,.45); /* the conflict bar, thrown UPWARD from the page foot */
46
+ }
47
+ /* Light — the same slate/blue ramp as the shell's [data-theme="light"] (web/app.css), re-expressed
48
+ in this page's token names because a standalone page does not load app.css. No new colours: every
49
+ value here is app.css's own light token or the -700/-800 stop of a ramp it already uses on light. */
50
+ [data-theme="light"]{
51
+ color-scheme:light;
52
+ --bg:#fff;--panel:#f1f5f9;--line:#cbd5e1;--text:#0f172a;--mut:#475569;--brand:#2563eb;
53
+ --brand-hover:#1d4ed8;
54
+ --btn:#e2e8f0;--btn-hover:#cbd5e1;--ctrl-border:#94a3b8;
55
+ --scroll:#cbd5e1;--scroll-hover:#94a3b8;
56
+ --shadow-lg:0 8px 24px rgba(15,23,42,.14);--shadow-tip:0 8px 22px rgba(15,23,42,.14);
57
+ /* Every state colour steps DOWN the ramp, amber included. Amber 500 measures 1.96:1 on --panel,
58
+ and --warn is the "Unsaved ●" dot — the only signal that work is at risk — so keeping it would
59
+ have hidden exactly the state a user must not miss. app.css's light block does the same
60
+ (`.trace .lvl.warn { color: #d97706 }`); this goes one stop further to clear AA at 11-12px. */
61
+ --warn:#b45309;--ok:#15803d;--err:#b91c1c;
62
+ --cyan:#155e75;--cyan-soft:rgba(21,94,117,.10);
63
+ --empty-bg:var(--panel); /* no drawing to justify a dark ground — see #empty */
64
+ --banner-shadow:0 -4px 18px rgba(15,23,42,.14);
65
+ }
9
66
  /* Theme EVERY scrollbar — no native white default may leak (panels, popovers, modal lists). */
10
- *{scrollbar-width:thin;scrollbar-color:#475569 transparent}
67
+ *{scrollbar-width:thin;scrollbar-color:var(--scroll) transparent}
11
68
  *::-webkit-scrollbar{width:10px;height:10px}
12
69
  *::-webkit-scrollbar-track{background:transparent}
13
- *::-webkit-scrollbar-thumb{background:#475569;border-radius:6px;border:2px solid transparent;background-clip:content-box}
14
- *::-webkit-scrollbar-thumb:hover{background:#5b6b85;background-clip:content-box}
70
+ *::-webkit-scrollbar-thumb{background:var(--scroll);border-radius:6px;border:2px solid transparent;background-clip:content-box}
71
+ *::-webkit-scrollbar-thumb:hover{background:var(--scroll-hover);background-clip:content-box}
15
72
  *::-webkit-scrollbar-corner{background:transparent}
16
73
  *{box-sizing:border-box}
17
74
  html,body{height:100%}
@@ -19,14 +76,14 @@ body{margin:0;background:var(--bg);color:var(--text);font:13px system-ui,-apple-
19
76
  header{display:flex;align-items:center;gap:14px;padding:8px 14px;background:var(--panel);border-bottom:1px solid var(--line);flex:none}
20
77
  header b{font-size:14px} header .sp{flex:1}
21
78
  .stat{color:var(--mut);font-size:12px} .stat b{color:var(--text)}
22
- .stat.dirty b{color:#f59e0b} .stat.saved b{color:#34d399} .stat.err b{color:#f87171}
79
+ .stat.dirty b{color:var(--warn)} .stat.saved b{color:var(--ok)} .stat.err b{color:var(--err)}
23
80
  /* Save conflict — the model moved under us. Needs its OWN rule: the other states colour a nested <b>,
24
81
  and this text has none, so without this it rendered in muted grey, indistinguishable from idle. Same
25
82
  cyan "non-default, click to act" chip the sibling editors use — no new colour. */
26
- .stat.conflict{color:#22d3ee;border:1px solid #22d3ee;background:rgba(34,211,238,.10);border-radius:4px;padding:1px 6px;cursor:pointer}
27
- button{background:#334155;color:var(--text);border:1px solid #475569;border-radius:6px;padding:5px 10px;cursor:pointer;font:13px system-ui}
28
- button:hover{background:#475569} button:disabled{opacity:.5;cursor:default}
29
- button.primary{background:var(--brand);border-color:var(--brand);color:#fff} button.primary:hover{background:#2f6fe0}
83
+ .stat.conflict{color:var(--cyan);border:1px solid var(--cyan);background:var(--cyan-soft);border-radius:4px;padding:1px 6px;cursor:pointer}
84
+ button{background:var(--btn);color:var(--text);border:1px solid var(--ctrl-border);border-radius:6px;padding:5px 10px;cursor:pointer;font:13px system-ui}
85
+ button:hover{background:var(--btn-hover)} button:disabled{opacity:.5;cursor:default}
86
+ button.primary{background:var(--brand);border-color:var(--brand);color:var(--brand-ink)} button.primary:hover{background:var(--brand-hover)}
30
87
  button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
31
88
  /* Sheet switcher — a themed combobox, NOT a native <select>.
32
89
  A <select>'s CLOSED state takes styling fine; its arrow and its option list do not. Those are drawn
@@ -39,14 +96,14 @@ button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
39
96
  beats the UA's own [hidden] rule by ORIGIN, so without this `sheetCombo.hidden = true` would quietly
40
97
  do nothing. Higher specificity than `.sheet-combo` above, so no !important is needed. */
41
98
  .sheet-combo[hidden]{display:none}
42
- /* Darker than the page's action buttons on purpose (they are #334155): this reads as a FIELD you pick
99
+ /* Set apart from the page's action buttons on purpose (they are --btn): this reads as a FIELD you pick
43
100
  from rather than a button you press — the distinction the native <select> used to carry for free. */
44
101
  /* appearance:none is inert here — the background/border rules below already de-nativize the button in
45
102
  every engine we ship to — but it is stated rather than assumed: `appearance: auto` on this control is
46
103
  the exact signature the QA pass matched on when it caught the <select>, and leaving it reading `auto`
47
104
  would make the next such pass re-raise a defect that is gone. NOT the same case as the checkbox
48
105
  below, whose appearance:none is load-bearing (drop it and a white native box comes back). */
49
- .sheet-trigger{display:inline-flex;align-items:center;gap:6px;min-width:200px;max-width:320px;-webkit-appearance:none;appearance:none;background:var(--bg);border:1px solid #475569;border-radius:6px;padding:5px 8px;font:600 13px system-ui}
106
+ .sheet-trigger{display:inline-flex;align-items:center;gap:6px;min-width:200px;max-width:320px;-webkit-appearance:none;appearance:none;background:var(--bg);border:1px solid var(--ctrl-border);border-radius:6px;padding:5px 8px;font:600 13px system-ui}
50
107
  .sheet-trigger:hover,.sheet-trigger.open{background:var(--bg);border-color:var(--brand)}
51
108
  .sheet-trigger-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}
52
109
  .sheet-caret{color:var(--mut);flex:none;transition:transform .15s}
@@ -54,7 +111,7 @@ button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
54
111
  /* Panel treatment matched to #eye below (8px radius, 0 8px 24px) — this page's own popover idiom, not
55
112
  app.css's larger one, so the two PANEL popovers on this surface read as one family. (#tooltip keeps
56
113
  the smaller cross-page treatment on purpose — it is the same control on four surfaces.) */
57
- .sheet-popover{position:absolute;top:calc(100% + 4px);left:0;min-width:100%;width:max-content;max-width:400px;background:var(--panel);border:1px solid var(--line);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.5);z-index:60;animation:sheet-in .14s ease-out}
114
+ .sheet-popover{position:absolute;top:calc(100% + 4px);left:0;min-width:100%;width:max-content;max-width:400px;background:var(--panel);border:1px solid var(--line);border-radius:8px;box-shadow:var(--shadow-lg);z-index:60;animation:sheet-in .14s ease-out}
58
115
  /* NOT the same case as .sheet-combo[hidden] above, and the asymmetry is worth naming: .sheet-popover
59
116
  declares no `display`, so the UA [hidden] rule already applies unopposed and this is redundant TODAY.
60
117
  It stays as insurance — the moment anyone gives this panel a `display`, its absence becomes the same
@@ -66,14 +123,14 @@ button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
66
123
  must stay on the trigger for aria-activedescendant to mean anything, and a focusable row also left
67
124
  focus on <body> when the row was clicked and then hidden. So this needs its own cursor/font. */
68
125
  .sheet-option{display:block;width:100%;cursor:pointer;background:transparent;border:none;border-left:2px solid transparent;border-radius:4px;padding:6px 8px;text-align:left;font:13px system-ui;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
69
- .sheet-option:hover,.sheet-option.highlighted{background:#334155}
126
+ .sheet-option:hover,.sheet-option.highlighted{background:var(--btn)}
70
127
  /* Left-border accent for the current sheet — the shared .wf-option.selected convention, not a tick glyph. */
71
128
  .sheet-option.selected{border-left-color:var(--brand);color:var(--brand)}
72
129
  /* Mirrors app.css's .sr-only. Needed here because this page does not load app.css, and the sheet
73
130
  switcher has no VISIBLE label beside it the way the workflow/project pickers do. */
74
131
  .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
75
132
  /* Themed tooltip — replaces native title= so no light OS tooltip leaks onto the dark theme. */
76
- #tooltip{position:fixed;z-index:80;background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:5px 8px;font-size:11.5px;line-height:1.35;color:var(--text);pointer-events:none;max-width:260px;box-shadow:0 8px 22px rgba(0,0,0,.5);opacity:0;transition:opacity .12s}
133
+ #tooltip{position:fixed;z-index:80;background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:5px 8px;font-size:11.5px;line-height:1.35;color:var(--text);pointer-events:none;max-width:260px;box-shadow:var(--shadow-tip);opacity:0;transition:opacity .12s}
77
134
  #tooltip.show{opacity:1}
78
135
  #app{display:flex;flex:1;min-height:0}
79
136
  #panel{width:300px;flex:0 0 300px;background:var(--panel);border-right:1px solid var(--line);padding:14px;overflow-y:auto;display:flex;flex-direction:column;gap:18px}
@@ -84,10 +141,10 @@ button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
84
141
  .facet{border-top:1px solid var(--line);padding-top:14px}
85
142
  #modes label,.opts label{display:flex;align-items:center;gap:8px;font-size:12px;padding:4px 0;cursor:pointer;color:var(--text)}
86
143
  .opts label em{margin-left:auto;color:var(--mut);font-style:normal;font-size:11px}
87
- .opts .sw{width:12px;height:12px;border-radius:3px;flex:0 0 12px;border:1px solid var(--line)}
144
+ .opts .sw{width:12px;height:12px;border-radius:3px;flex:0 0 12px;border:1px solid var(--ctrl-border)}
88
145
  .opts label.textlayer{opacity:.55;cursor:default}
89
146
  /* Fully custom checkbox — the native unchecked widget is a white/grey square that breaks the dark baseline. */
90
- input[type=checkbox]{-webkit-appearance:none;appearance:none;width:14px;height:14px;flex:none;border:1px solid #475569;border-radius:3px;background:transparent;cursor:pointer;margin:0;vertical-align:middle}
147
+ input[type=checkbox]{-webkit-appearance:none;appearance:none;width:14px;height:14px;flex:none;border:1px solid var(--ctrl-border);border-radius:3px;background:transparent;cursor:pointer;margin:0;vertical-align:middle}
91
148
  input[type=checkbox]:checked{background:var(--brand);border-color:var(--brand);background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 10 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4l3 3 5-5' stroke='%23fff' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:center}
92
149
  input:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
93
150
  /* FORCED COLORS (Windows High Contrast): the OS overrides every authored colour, so the custom fill and
@@ -102,6 +159,12 @@ input:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
102
159
  border:revert;background:revert;background-image:none}
103
160
  }
104
161
  .facet.dim{opacity:.4} .facet.dim .opts,.facet.dim .acts{pointer-events:none}
162
+ /* Two light-only corrections. An UNCHECKED checkbox here is a bare 1px ring on transparent, which
163
+ on the light rail all but disappears — app.css fills its own checkbox for the same reason, so the
164
+ transparent one is the outlier. And .textlayer's .55 is not symmetric across grounds: it composites
165
+ to 4.7:1 on the dark panel but 3.8:1 on the light one, and these rows still carry a live checkbox. */
166
+ [data-theme="light"] input[type=checkbox]{background:var(--bg)}
167
+ [data-theme="light"] .opts label.textlayer{opacity:.7}
105
168
  .hint{color:var(--mut);font-size:11px;line-height:1.5}
106
169
  /* #count is the footer's only child since #603 took the Fit/Zoom buttons out of the rail, so the
107
170
  flex row that used to wrap around them is gone with them — as are #count's width:100% and
@@ -110,7 +173,7 @@ input:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
110
173
  footer{margin-top:auto;border-top:1px solid var(--line);padding-top:12px}
111
174
  #count{font-size:11px;color:var(--mut)}
112
175
  #count b{color:var(--text)}
113
- #stage{flex:1;position:relative;background:var(--bg);min-width:0}
176
+ #stage{flex:1;position:relative;background:var(--stage);min-width:0}
114
177
  #canvas{width:100%;height:100%;cursor:grab;touch-action:none;display:block}
115
178
  #canvas.dragging{cursor:grabbing}
116
179
  #canvas image.bg{opacity:.28;pointer-events:none}
@@ -119,8 +182,14 @@ footer{margin-top:auto;border-top:1px solid var(--line);padding-top:12px}
119
182
  /* Raster-less baked sheets cannot retain the confidential background. Keep their full vector sheet as
120
183
  an explicit, non-interactive fallback; raster-backed sheets mount selected vectors only. */
121
184
  #canvas .el.is-context{opacity:.2;pointer-events:none}
122
- #empty{position:absolute;inset:0;display:none;align-items:center;justify-content:center;padding:40px;text-align:center;color:var(--mut)}
185
+ #empty{position:absolute;inset:0;display:none;align-items:center;justify-content:center;padding:40px;text-align:center;background:var(--empty-bg);color:var(--mut)}
123
186
  #empty.show{display:flex}
187
+ /* Fit / Zoom steel have nothing to act on while the empty state is up, and this page's rule is to
188
+ HIDE a dead control rather than show it inert. Doing that also settles what the bar should look
189
+ like there: it wears the stage's dark furniture (see :root), and #empty.show covers the stage —
190
+ so on a light theme it was a dark pill floating on a light pane, an artifact of two correct
191
+ decisions meeting. `~` and not a descendant selector: they are siblings inside #stage. */
192
+ #empty.show ~ #zoombar{display:none}
124
193
  #empty>div{max-width:44ch}
125
194
  #empty h1{margin:0;font-size:16px;font-weight:600;color:var(--text)}
126
195
  #empty .empty-body{margin:8px 0 0;line-height:1.55;color:var(--mut)}
@@ -174,16 +243,17 @@ body.publication-blocked #empty{position:static;flex:1}
174
243
  96px cap the bar wraps first, "Fit" keeps its full 35.5px untruncated, and only "Zoom steel"
175
244
  ellipsises (scrollWidth 84 vs clientWidth 77). A button now moves to its own line before it
176
245
  shrinks, so the ellipsis is the second line of defence, not the first. */
177
- #zoombar{position:absolute;left:12px;bottom:12px;max-width:calc(100% - 24px);overflow:hidden;display:flex;flex-wrap:wrap;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)}
178
- #zoombar button{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
246
+ #zoombar{position:absolute;left:12px;bottom:12px;max-width:calc(100% - 24px);overflow:hidden;display:flex;flex-wrap:wrap;gap:6px;background:var(--stage-panel);border:1px solid var(--stage-line);border-radius:8px;padding:6px 8px;box-shadow:var(--stage-shadow)}
247
+ #zoombar button{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:var(--stage-btn);border-color:var(--stage-ctrl);color:var(--stage-text)}
248
+ #zoombar button:hover{background:var(--stage-btn-hover)}
179
249
  /* eyedropper popover */
180
- #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}
250
+ #eye{position:fixed;display:none;z-index:50;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:10px;box-shadow:var(--shadow-lg);min-width:210px}
181
251
  #eye.show{display:block}
182
252
  #eye .ehead{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--mut);margin-bottom:8px;display:flex;justify-content:space-between;align-items:center}
183
253
  #eye .erow{display:flex;align-items:center;gap:8px;padding:4px 0;font-size:12px}
184
254
  #eye .erow .k{color:var(--mut);min-width:72px;flex:none}
185
255
  #eye .erow .v{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
186
- #eye .erow .sw{width:12px;height:12px;border-radius:3px;border:1px solid var(--line);flex:none}
256
+ #eye .erow .sw{width:12px;height:12px;border-radius:3px;border:1px solid var(--ctrl-border);flex:none}
187
257
  #eye .erow button{font-size:11px;padding:2px 7px}
188
258
  #eye .eall{margin-top:8px;width:100%}
189
259
  </style>
@@ -378,9 +448,12 @@ function showChangedBanner(message, opts){
378
448
  if(kind === 'document') lastBanner = message;
379
449
  const bar = document.createElement('div');
380
450
  bar.id = 'conflictBanner';
451
+ // The bar keeps its saturated blue skin in BOTH themes — it is an alert, and it earns its prominence
452
+ // by not being the page's own surface. Its SHADOW is themed, because that one is not a choice: an
453
+ // 18px black glow thrown up a white page is the artifact, not the emphasis.
381
454
  bar.style.cssText = 'position:fixed;bottom:0;left:0;right:0;z-index:50;display:flex;align-items:center;gap:10px;'
382
455
  + 'padding:10px 16px;background:#1e40af;color:#e0f2fe;font:13px system-ui;border-top:1px solid #3b82f6;'
383
- + 'box-shadow:0 -4px 18px rgba(0,0,0,.45)';
456
+ + 'box-shadow:var(--banner-shadow)';
384
457
  const msg = document.createElement('span'); msg.style.cssText = 'flex:1';
385
458
  msg.textContent = message
386
459
  || 'This model changed somewhere else since you opened it — your save didn’t go through. '
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.128.2",
3
+ "version": "0.129.0",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {