@floless/app 0.127.1 → 0.127.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.
@@ -54744,7 +54744,7 @@ function appVersion() {
54744
54744
  return resolveVersion({
54745
54745
  isSea: isSea2(),
54746
54746
  sqVersionXml: readSqVersionXml(),
54747
- define: true ? "0.127.1" : void 0,
54747
+ define: true ? "0.127.3" : void 0,
54748
54748
  pkgVersion: readPkgVersion()
54749
54749
  });
54750
54750
  }
@@ -54760,7 +54760,7 @@ function resolveChannel(s) {
54760
54760
  function appChannel() {
54761
54761
  return resolveChannel({
54762
54762
  isSea: isSea2(),
54763
- define: true ? "0.127.1" : void 0,
54763
+ define: true ? "0.127.3" : void 0,
54764
54764
  // argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
54765
54765
  // carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
54766
54766
  modulePath: process.argv[1]
@@ -71790,9 +71790,10 @@ function watchDisconnect(reply, onGone) {
71790
71790
  // reference-routes.ts
71791
71791
  var APPID = /^[a-z0-9][a-z0-9._-]*$/i;
71792
71792
  var REFERENCE_BODY_LIMIT = 210 * 1024 * 1024;
71793
- function runScope(deps, reply) {
71793
+ function runScope(deps, reply, opts = {}) {
71794
71794
  let current = null;
71795
- const signal = watchDisconnect(reply, () => {
71795
+ const signal = opts.detachOnDisconnect ? { gone: () => false, finish: () => {
71796
+ } } : watchDisconnect(reply, () => {
71796
71797
  if (current) deps.runControl.cancel(current);
71797
71798
  });
71798
71799
  return {
@@ -71949,7 +71950,7 @@ function registerReferenceRoutes(app, deps) {
71949
71950
  app.post(
71950
71951
  "/api/steel/:appId/reference",
71951
71952
  async (req, reply) => {
71952
- const scope = runScope(deps, reply);
71953
+ const scope = runScope(deps, reply, { detachOnDisconnect: true });
71953
71954
  const g = gate2(deps, req.params.appId, req.query.project);
71954
71955
  if (!g.ok) return reply.status(g.refusal.status).send(g.refusal.body);
71955
71956
  const { sha, name, placement } = req.body ?? {};
@@ -1613,7 +1613,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1613
1613
  <!-- The spinner is `connImportModal`'s own `.ci-prog`/`.ci-spin` (see the CSS above), reused rather
1614
1614
  than re-invented: this stage sat as static text for up to six seconds before its honest
1615
1615
  "still working" message appeared, which reads as hung next to the sibling modal that spins. -->
1616
- <div id=riProgStage style="display:none"><div class=ci-prog><span class=ci-spin aria-hidden=true></span><span id=riProgTxt>Reading the file…</span></div></div>
1616
+ <div id=riProgStage style="display:none"><div class=ci-prog><span class=ci-spin aria-hidden=true></span><span id=riProgTxt role=status aria-live=polite>Reading the file…</span></div><div id=riProgNote style="display:none">You can close this — FloLess will keep importing this model.</div></div>
1617
1617
  <div id=riConfirmStage style="display:none">
1618
1618
  <div id=riSays></div>
1619
1619
  <div class=rirow><span class=pn>Schema</span><span class=pv id=riSchema>—</span></div>
@@ -11146,7 +11146,7 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
11146
11146
  // that guard could never fire from this UI, because the browser never disconnected — Cancel left the
11147
11147
  // request in flight, so a cancelled 66 MB read went on holding the single run lock for its full
11148
11148
  // duration and the next import queued behind the file the user had just given up on.
11149
- let riRun=0,riAbort=null;
11149
+ let riRun=0,riAbort=null,riMutationId=null;
11150
11150
  /** End the current attempt: nothing it started may touch the modal, and its upload stops now. */
11151
11151
  const riStop=()=>{riRun++;if(riAbort){try{riAbort.abort();}catch(_){/* already settled */}riAbort=null;}};
11152
11152
  const riClearSoft=()=>{if(riSoftT){clearTimeout(riSoftT);riSoftT=null;}};
@@ -11157,7 +11157,8 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
11157
11157
  ri$('riProgStage').style.display=s==='prog'?'':'none';
11158
11158
  ri$('riConfirmStage').style.display=s==='confirm'?'':'none';
11159
11159
  ri$('riInsert').style.display=s==='confirm'?'':'none';
11160
- ri$('riClose').style.display=s==='prog'?'none':''; // no ✕ mid-run — Cancel owns the exit
11160
+ ri$('riClose').style.display=s==='prog'?'none':'';
11161
+ ri$('riProgNote').style.display='none';
11161
11162
  ri$('riTitle').textContent=s==='prog'?'Reading the file':s==='confirm'?'Add this reference?':'Add a reference model';};
11162
11163
  const riProg=(label,soft)=>{riClearSoft();ri$('riProgTxt').textContent=label;
11163
11164
  if(soft)riSoftT=setTimeout(()=>{ri$('riProgTxt').textContent=soft;},6000);}; // an honest "still working", never a fake %
@@ -11171,7 +11172,18 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
11171
11172
  riBuildPick(null); // and the picker, so a cancelled file's storeys never show under a new name
11172
11173
  riStage('drop');ri$('refImportModal').style.display='flex';}
11173
11174
  window.openRefImport=openRefImport;
11174
- function riClose(){riStop();riClearSoft();ri$('refImportModal').style.display='none';}
11175
+ function riClose(){
11176
+ // A reference insert is intentionally detached from this modal once accepted. Closing is a
11177
+ // backgrounding action, never an implicit cancellation of an expensive model read.
11178
+ if(riBusy&&riStageNow==='prog'){
11179
+ // The server broadcasts before its HTTP response. Once the user backgrounds this attempt, its
11180
+ // mutation may no longer suppress that broadcast or the contract can commit invisibly here.
11181
+ if(riMutationId){releaseMutation(riMutationId);riMutationId=null;}
11182
+ riRun++;riAbort=null;riBusy=false;riClearSoft();ri$('riCancel').textContent='Cancel';ri$('refImportModal').style.display='none';
11183
+ toast('Import continues in the background.');return;
11184
+ }
11185
+ riStop();riClearSoft();ri$('refImportModal').style.display='none';
11186
+ }
11175
11187
 
11176
11188
  const RI_MAX_BYTES=150*1024*1024; // mirrors MAX_BYTES in server/reference-import.ts (pinned by the parity test)
11177
11189
  // Mirrors MAX_OBJECTS / WARN_OBJECTS in server/reference-import.ts (pinned by the same parity test).
@@ -11517,9 +11529,10 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
11517
11529
  const riNative=nativeModelCentre();
11518
11530
  const riFilterBody=riBuildFilter(); // computed ONCE — it was called twice in one expression
11519
11531
  const riOriginShift=takeOrigin&&riProbeCentre?riProbeCentre.map((v,i)=>riNative[i]-v):null;
11520
- riStage('prog');riProg('Reading the geometry…','Still reading — a whole building takes a moment.');
11532
+ riStage('prog');ri$('riProgNote').style.display='block';ri$('riCancel').textContent='Continue in background';riProg('Reading the geometry…','Still reading — a whole building takes a moment.');
11533
+ let mid=null;
11521
11534
  try{
11522
- const mid=newMutationId();claimMutation(mid);
11535
+ mid=newMutationId();riMutationId=mid;claimMutation(mid);
11523
11536
  const res=await fetch(refApi(''),{method:'POST',signal,headers:{'content-type':'application/json','x-floless-mutation-id':mid},
11524
11537
  // The placement rides the INSERT, so the choice the user made in the modal is committed with
11525
11538
  // the reference rather than by a debounced PUT afterwards. Applying it in the presentation
@@ -11539,7 +11552,7 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
11539
11552
  // own echo would not be replayed at us, and if the write DID land, suppressing its broadcast
11540
11553
  // is precisely what would leave a reference committed on disk and invisible in the editor —
11541
11554
  // where the next full save could quietly drop it. Released, the broadcast reconciles instead.
11542
- releaseMutation(mid);
11555
+ releaseMutation(mid);if(riMutationId===mid)riMutationId=null;
11543
11556
  return;
11544
11557
  }
11545
11558
  riClearSoft();
@@ -11568,9 +11581,9 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
11568
11581
  }catch(e){
11569
11582
  // Aborted: no response at all, so we cannot know whether the write landed. Same reasoning as
11570
11583
  // above — release the claim so a broadcast that does arrive is applied rather than swallowed.
11571
- if(mine!==riRun||(e&&e.name==='AbortError')){releaseMutation(mid);return;}
11584
+ if(mine!==riRun||(e&&e.name==='AbortError')){if(mid)releaseMutation(mid);if(riMutationId===mid)riMutationId=null;return;}
11572
11585
  riClearSoft();riStage('drop');riErr('Could not add that reference.');console.error('[reference] insert failed',e);return;}
11573
- finally{riBusy=false;if(mine===riRun)riAbort=null;}
11586
+ finally{if(mine===riRun){riBusy=false;riAbort=null;ri$('riCancel').textContent='Cancel';}if(riMutationId===mid)riMutationId=null;}
11574
11587
  // ── PAST THE POINT OF NO RETURN. Everything above is the transaction; everything below is showing
11575
11588
  // it. They were one try, and a throw in the presentation half ran riErr() on a modal riClose() had
11576
11589
  // already hidden — so the user saw NOTHING while the reference was committed and on disk, and the
@@ -11610,7 +11623,7 @@ function adoptReferenceWrite(etag){if(!etag)return;const prev=serverEtag;serverE
11610
11623
  // exit — and the backdrop, a full-viewport overlay that looks like nothing at all, quietly offered
11611
11624
  // the same abort to a stray click just outside the panel. Hiding one of two identical exits and
11612
11625
  // leaving the invisible one is the version of that rule that does not hold. (UX review, #580.)
11613
- ri$('riBackdrop').onclick=()=>{if(riStageNow!=='prog')riClose();};
11626
+ ri$('riBackdrop').onclick=()=>riClose();
11614
11627
  ri$('riInsert').onclick=riInsert;
11615
11628
  ri$('riPickToggle').onclick=()=>riSetPickOpen(ri$('riPick').style.display==='none');
11616
11629
  // The tri-state header toggle: `null` (all) and a full Set are the same selection but not the
@@ -79,6 +79,17 @@ export function countShown(elements, mode, sel) {
79
79
  return n;
80
80
  }
81
81
 
82
+ /**
83
+ * Geometry that belongs in the live, interactive SVG overlay. A registered raster already preserves
84
+ * the complete drawing for orientation, so mounting non-matches would make a large PDF sluggish.
85
+ * Baked contracts deliberately strip that confidential raster; those sheets retain every vector as
86
+ * the explicit dimmed fallback context and the caller marks non-matches inert.
87
+ */
88
+ export function liveOverlayElements(elements, mode, sel, rasterContext) {
89
+ const all = Array.isArray(elements) ? elements : [];
90
+ return rasterContext ? all.filter((el) => matchesActive(el, mode, sel)) : all;
91
+ }
92
+
82
93
  /**
83
94
  * Where a sheet's background raster (`page.bg_b64`) maps, in the same vector-frame coords as the
84
95
  * elements' `d` paths — so the raster registers 1:1 with the linework. The producer clips the raster
@@ -113,11 +113,11 @@ footer{margin-top:auto;border-top:1px solid var(--line);padding-top:12px}
113
113
  #stage{flex:1;position:relative;background:var(--bg);min-width:0}
114
114
  #canvas{width:100%;height:100%;cursor:grab;touch-action:none;display:block}
115
115
  #canvas.dragging{cursor:grabbing}
116
- #canvas image.bg{opacity:.28}
116
+ #canvas image.bg{opacity:.28;pointer-events:none}
117
117
  #canvas path.el{pointer-events:stroke}
118
118
  #canvas text.el{pointer-events:all;cursor:pointer;user-select:none}
119
- /* Filtered-out vector content stays as quiet, non-selectable drawing context. The selector must beat
120
- the text rule above, otherwise dim labels still open the eyedropper. */
119
+ /* Raster-less baked sheets cannot retain the confidential background. Keep their full vector sheet as
120
+ an explicit, non-interactive fallback; raster-backed sheets mount selected vectors only. */
121
121
  #canvas .el.is-context{opacity:.2;pointer-events:none}
122
122
  #empty{position:absolute;inset:0;display:none;align-items:center;justify-content:center;padding:40px;text-align:center;color:var(--mut)}
123
123
  #empty.show{display:flex}
@@ -289,7 +289,7 @@ body.publication-blocked #empty{position:static;flex:1}
289
289
  </div>
290
290
 
291
291
  <script type="module">
292
- import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, countShown, bgRect, textFontSize, applySelToFilter, normalizeFilter, liveUpdateAction, statChip, newMutationId, sheetLabel, NOTE_TEXT } from './steel-filter-core.js';
292
+ import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, countShown, liveOverlayElements, bgRect, textFontSize, applySelToFilter, normalizeFilter, liveUpdateAction, statChip, newMutationId, sheetLabel, NOTE_TEXT } from './steel-filter-core.js';
293
293
 
294
294
  const APP_ID = new URLSearchParams(location.search).get('app') || '';
295
295
  // Workspaces: project-keyed contract (see steel-editor.html). Empty = legacy app-keyed URLs.
@@ -892,16 +892,19 @@ function setSheet(i){
892
892
  bgImg.style.display='';
893
893
  }
894
894
  else bgImg.style.display = 'none';
895
- buildOverlay();
896
895
  base = { x: 0, y: 0, w: pg.w, h: pg.h }; vb = { ...base }; setVB();
897
- apply();
898
896
  closeEye();
897
+ apply();
899
898
  syncSheetSwitcher();
900
899
  }
901
900
 
902
901
  function buildOverlay(){
903
902
  overlay.replaceChildren();
904
- nodes = ((sheets[active] && sheets[active].elements) || []).map(el => {
903
+ const rasterContext = hasRasterContext();
904
+ // The raster is the full, quiet sheet context. Mount only the selected vectors: a large PDF can
905
+ // carry tens of thousands of paths, and keeping every rejected path in the live SVG makes filtering
906
+ // sluggish even when those paths are dimmed and non-interactive.
907
+ nodes = liveOverlayElements((sheets[active] && sheets[active].elements) || [], mode, sel, rasterContext).map(el => {
905
908
  let n;
906
909
  if(el.kind === 'text'){
907
910
  n = document.createElementNS(SVGNS, 'text');
@@ -930,6 +933,8 @@ function buildOverlay(){
930
933
  });
931
934
  }
932
935
 
936
+ function hasRasterContext(){ return !!((sheets[active] && sheets[active].page) || {}).bg_b64; }
937
+
933
938
  function setOf(facet){ return facet === 'layers' ? sel.layers : facet === 'thicknesses' ? sel.thicknesses : sel.colors; }
934
939
 
935
940
  function buildFacet(facet, items, valueKey, label, selValue){
@@ -974,14 +979,16 @@ function syncFacetChecks(){
974
979
  }
975
980
 
976
981
  function apply(){
977
- for(const { node, el } of nodes){
978
- const vis = matchesActive(el, mode, sel);
979
- node.classList.toggle('is-context', !vis);
980
- node.setAttribute('aria-hidden', String(!vis));
981
- }
982
982
  if(eyeEl && !matchesActive(eyeEl, mode, sel)) closeEye();
983
+ const rasterContext = hasRasterContext();
984
+ buildOverlay();
985
+ if(!rasterContext) for(const { node, el } of nodes){
986
+ const contextOnly = !matchesActive(el, mode, sel);
987
+ node.classList.toggle('is-context', contextOnly);
988
+ node.setAttribute('aria-hidden', String(contextOnly));
989
+ }
983
990
  const cur = (sheets[active] && sheets[active].elements) || [];
984
- let html = '<b>' + countShown(cur, mode, sel) + '</b> selected of <b>' + cur.length + '</b> · remaining elements shown as context';
991
+ let html = '<b>' + countShown(cur, mode, sel) + '</b> selected of <b>' + cur.length + '</b> · complete ' + (rasterContext ? 'drawing' : 'vector drawing') + ' shown as context';
985
992
  if(sheets.length > 1){
986
993
  let sa = 0, ta = 0;
987
994
  for(const s of sheets){ const els = s.elements || []; sa += countShown(els, mode, sel); ta += els.length; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.127.1",
3
+ "version": "0.127.3",
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": {