@floless/app 0.135.0 → 0.136.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.
@@ -257,6 +257,43 @@
257
257
  #detOpacity{flex:1;min-width:0} /* SIZING only — the theming is the global input[type=range] rule below */
258
258
  #zoombar #zPct{min-width:40px;text-align:right;color:var(--mut);font-variant-numeric:tabular-nums}
259
259
  /* Connection Component breadcrumb (Slice A) — a floating chip over the 3D canvas, same recipe as #zoombar. */
260
+ /* #935 — the plan-registration refusal, said out loud on the canvas the wrong geometry is drawn on.
261
+ Floats over #pane2d the way #connCrumb floats over #pane3d (same recipe: absolute chip, themed
262
+ chrome, its own z above the canvas), and wears .read-diag's amber triple because it reports
263
+ something the AUTHORED contract got wrong rather than a mistake the user made here. Amber, not
264
+ --err: this file reserves red for faults the user can fix IN the editor, and this one they cannot
265
+ (the fix is a contract edit, which their terminal AI makes). Left+right inset rather than centred
266
+ because it carries a sentence, not a breadcrumb, and must wrap rather than ellipsize.
267
+ z:58 sits above the SVG and below toasts (60) and #tooltip (80), matching #connCrumb's reasoning. */
268
+ /* The pill only ever counts sheets whose registration is STATED and does not hold, so it always carries
269
+ the amber tone — `#reviewStat.has` does the same for its own fault count. Without this it inherits
270
+ `.stat{color:var(--mut)}` and sits in the nothing-to-see-here tone beside a banner saying the model
271
+ is metres out. */
272
+ #regStat b{color:var(--warn)}
273
+ #regBanner{position:absolute;left:12px;right:12px;top:12px;display:none;z-index:58;border:1px solid var(--warn-edge);border-radius:8px;background:var(--warn-bg);color:var(--warn);padding:8px 10px;font-size:12px;line-height:1.5;box-shadow:0 4px 14px rgba(0,0,0,.45)}
274
+ #regBanner.on{display:block}
275
+ /* …and the tone that is NOT a fault. A sheet still being registered is ordinary unfinished work, so it
276
+ recedes to the neutral tier in the same two tokens #rcIssues' own `.rcban.plain` uses. TWO classes,
277
+ which beats the single-class rule above on specificity — the trap that rule's own comment records. */
278
+ #regBanner.on.plain{border-color:var(--line);background:var(--panel);color:var(--mut)}
279
+ #regBanner.on.plain button{border-color:var(--line);color:var(--mut)}
280
+ #regBanner.on.plain .rgdet{border-top-color:var(--line)}
281
+ #regBanner .rgline{overflow-wrap:anywhere}
282
+ #regBanner .rgact{display:flex;gap:6px;align-items:center;margin-top:6px;flex-wrap:wrap}
283
+ #regBanner .rgcta{color:var(--mut);font-size:11px;flex:1;min-width:0}
284
+ /* `--warn-edge` and `--warn-bg` are the SAME token value in both dark palettes, so a border drawn in
285
+ the edge colour ON this banner's own background is invisible — the two buttons rendered as bare
286
+ amber text with no affordance, and the details separator vanished entirely. `.read-diag` carries
287
+ the same triple and never exposed it, because it holds no controls. The border is the amber INK
288
+ instead, which reads against the fill in both themes. */
289
+ #regBanner button{background:transparent;border:1px solid var(--warn);color:var(--warn);border-radius:6px;padding:2px 8px;font:11px system-ui;cursor:pointer}
290
+ #regBanner button:hover{background:rgba(148,163,184,.12)}
291
+ #regBanner button:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}
292
+ /* The exact planTransform sentence, verbatim and as REAL DOM text — never a tooltip. It names the
293
+ contract fields the terminal AI has to change, so it must be selectable, copyable and reachable by
294
+ a screen reader. Collapsed by default so the plain-English lead reads first. */
295
+ #regBanner .rgdet{display:none;margin-top:6px;padding-top:6px;border-top:1px solid var(--warn);color:var(--mut);font:11px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow-wrap:anywhere}
296
+ #regBanner.det .rgdet{display:block}
260
297
  #connCrumb{position:absolute;left:50%;top:48px;transform:translateX(-50%);display:none;align-items:center;gap:1px;max-width:min(72%,560px);background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:4px 10px;box-shadow:0 4px 14px rgba(0,0,0,.45);z-index:58;font-size:12px;white-space:nowrap;overflow:hidden} /* below #m3dBar (top:12,h~29,z:59); z:58 keeps it clickable above the model-glued label chips, which sit under the 3D chrome at z:3-4 (#614) */
261
298
  #connCrumb .seg{color:var(--mut);cursor:pointer;padding:1px 4px;border-radius:4px;background:none;border:0;font:inherit;max-width:260px;overflow:hidden;text-overflow:ellipsis}
262
299
  #connCrumb .seg:hover{color:var(--text);text-decoration:underline}
@@ -1832,6 +1869,10 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1832
1869
  worse than one that is absent. But BOTH hidden while the server could not derive the state would
1833
1870
  read as "all clear", so that one condition gets its own neutral marker instead of silence. -->
1834
1871
  <span class=stat id=reviewUnavailStat data-tip="The server could not check connections for moved steel this time" hidden>Review check unavailable</span>
1872
+ <!-- #935. Hidden at zero like the readouts above. This one scans EVERY plan rather than the active one
1873
+ on purpose: the reported defect placed a 250-member model 18 m out while the author worked on other
1874
+ sheets, so a surface that only speaks when you happen to open the bad sheet repeats the bug. -->
1875
+ <button data-command-id="steel.registration-list" class=stat id=regStat data-tip="Sheets whose registration does not agree with the grid — click to list them" aria-haspopup="true" aria-expanded="false" aria-controls="reviewFly" hidden>Registration <b id=regCount>0</b></button>
1835
1876
  <span class=stat id=csStat data-tip="Coordinate system — Global by default. Set a local frame from the ⋯ menu for skewed framing.">Axes <b>Global</b></span>
1836
1877
  <span class=stat id=snapStat style="display:none" data-tip="Snap restricted for this operation — right-click the canvas to change; click here or press Esc to clear">Snap <b>—</b></span>
1837
1878
  <button data-command-id="steel.confidence-report" class=stat id=confStat data-tip="Confidence report — review recorded drawing evidence." style="display:none" aria-haspopup=dialog aria-controls=confModal><span id=confLabel>Confidence</span> <b id=confPct>—</b><span id=confTgt></span></button>
@@ -1954,6 +1995,18 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
1954
1995
  <div id=stagewrap>
1955
1996
  <div id=pane2d>
1956
1997
  <div id=stage><svg id=svg tabindex=-1 aria-label="2D model plan"></svg></div>
1998
+ <!-- #935: this sheet's registration is present and REFUSED, so the steel on screen may be metres from
1999
+ where it belongs. role=status, not alert: it is a standing condition of the sheet you are looking
2000
+ at, not an event. No dismiss — a notice you can silence is the silent-wrongness this exists to end. -->
2001
+ <div id=regBanner role=status aria-live=polite>
2002
+ <div class=rgline id=regLead></div>
2003
+ <div class=rgdet id=regDetail></div>
2004
+ <div class=rgact>
2005
+ <span class=rgcta>This can't be fixed here — ask your terminal AI to correct the sheet's registration.</span>
2006
+ <button data-command-id="steel.registration-detail" id=regDetailBtn type=button aria-expanded=false aria-controls=regDetail>Details</button>
2007
+ <button data-command-id="steel.registration-copy" id=regCopyBtn type=button data-tip="Copy the exact reason for your AI">Copy reason</button>
2008
+ </div>
2009
+ </div>
1957
2010
  <div id=zoombar>
1958
2011
  <button data-command-id="steel.zoom" id=zOut data-tip="Zoom out">−</button>
1959
2012
  <input data-command-id="steel.zoom" aria-label="Zoom level" id=zRange type=range min=10 max=400 step=1 value=100>
@@ -3499,14 +3552,28 @@ function v2ProjectionForSheet(sheet){
3499
3552
  let projection=V2_PROJECTIONS.get(sheet);
3500
3553
  if(!projection){projection=V2Projection.createV2Projection(C,sheet,{session:V2_SESSION});V2_SESSION.registerProjection(projection);V2_PROJECTIONS.set(sheet,projection);}
3501
3554
  return projection;}
3555
+ /* The member's projected row, from the active sheet if it is on it and otherwise from whichever sheet
3556
+ HAS it.
3557
+
3558
+ Not `memberSheets(...)[0]` any more. A sheet whose registration is refused projects no members at all
3559
+ (#935), so taking the first sheet blindly makes a member that is perfectly well drawn on a second,
3560
+ valid sheet disappear from every model-wide list that reads through here — `projectedAllMembers`,
3561
+ `byId`, shear-plate eligibility, property labels — and disappear SILENTLY, which is the failure mode
3562
+ this whole change exists to end. Walk the sheets and take the first projection that actually has the
3563
+ row. Stops at the first hit, so the ordinary one-sheet case still builds exactly one projection. */
3502
3564
  function v2ProjectedMember(id){
3503
3565
  const here=(P&&P.members||[]).find(m=>m&&m.id===id);if(here)return here;
3504
- const sheet=V2Projection.memberSheets(C,id)[0];if(!sheet)return undefined;
3505
- return v2ProjectionForSheet(sheet).plan.members.find(m=>m&&m.id===id);}
3566
+ for(const sheet of V2Projection.memberSheets(C,id)){
3567
+ const row=v2ProjectionForSheet(sheet).plan.members.find(m=>m&&m.id===id);
3568
+ if(row)return row;
3569
+ }
3570
+ return undefined;}
3506
3571
  const allMembers=()=>modelMembersV2();
3507
3572
  const projectedAllMembers=()=>(C.members||[]).map(m=>v2ProjectedMember(m.id)).filter(Boolean);
3508
3573
  const byId=id=>v2ProjectedMember(id);
3509
- const planeOf=id=>{const sheet=V2Projection.memberSheets(C,id)[0];return sheet?v2ProjectionForSheet(sheet).plan:P;};
3574
+ // Same rule as v2ProjectedMember, for the same reason: a refused sheet's plan carries no usable
3575
+ // transform, so returning it would do coordinate maths against a registration the runtime just refused.
3576
+ const planeOf=id=>{for(const sheet of V2Projection.memberSheets(C,id)){const plan=v2ProjectionForSheet(sheet).plan;if(!plan.registrationRefusal)return plan;}return P;};
3510
3577
  const planeOfMember=m=>{const link=V2Projection.projectionLink(m);return link?.sheet?v2ProjectionForSheet(link.sheet).plan:null;};
3511
3578
  const selArr=()=>[...selIds].map(byId).filter(Boolean);
3512
3579
  // The active-sheet subset of the selection — for 2D coordinate/decoration ops (handles, badges, move/copy,
@@ -3657,9 +3724,24 @@ const posOffDisp=v=>(typeof v==='number'&&isFinite(v)&&v!==0)?fmtFtIn(v/25.4):''
3657
3724
  const posOffSet=v=>typeof v==='number'&&isFinite(v)&&v!==0;
3658
3725
  let positionBasisGeneration=0,positionBasisFingerprint='',positionBasisListeners=new Set();
3659
3726
  let positionBasisViewUnsub=null;
3727
+ /* The shared gate for authoring geometry against the CURRENT surface — and, since #935, the one place
3728
+ that answers "can this sheet map pixels to the world at all".
3729
+
3730
+ A refused registration has no px<->world transform, so every write that starts from a sheet pixel
3731
+ throws out of `planTransform`. `drawClick` is the live one: it does its own `pushUndo` rather than
3732
+ going through `edit()`, and `edit()` only catches `V2CommandError` anyway, so the throw escaped to
3733
+ the console with no toast, no undo entry and the draw tool still armed. Refusing HERE fixes that at
3734
+ the source and costs nothing extra: this gate already disables the Profile Position controls, stamps
3735
+ `data-blocked-reason` on each, and narrates through `#posPositionStatus`, so the block is announced
3736
+ rather than merely enforced. 3D is untouched — it authors in world coordinates and does not care what
3737
+ any sheet's registration says. */
3660
3738
  function positionAuthoringBasis(){
3661
3739
  let raw;
3662
3740
  if(view3d&&window.Steel3DView&&window.Steel3DView.positionAuthoringBasis){raw=window.Steel3DView.positionAuthoringBasis();}
3741
+ else if(P&&P.registrationRefusal)raw={ok:false,code:'position-authoring-basis-unavailable',
3742
+ message:P.registrationRefusal.registered
3743
+ ?'This sheet’s registration does not fit the grid, so FloLess cannot turn a point on it into a model position. Ask your terminal AI to correct it.'
3744
+ :'This sheet is not registered to the grid yet, so FloLess cannot turn a point on it into a model position.'};
3663
3745
  else if(!(P&&P.frame))raw={ok:true,kind:'global',x:[1,0,0],y:[0,1,0]};
3664
3746
  else{
3665
3747
  try{
@@ -5268,7 +5350,6 @@ function sectionShapeComponents(profile,w,d,ppf,round){
5268
5350
  // This must never throw: it runs inside render(), where an exception costs the whole canvas, not one
5269
5351
  // footprint.
5270
5352
  const _PLAN_XF_IDENTITY={rad:0,fitScale:1};
5271
- const _PLAN_XF_UNREGISTERED=['registration-incomplete','view-kind-unsupported','scale-invalid','grid-unavailable'];
5272
5353
  let _planXfCache={key:null,xf:_PLAN_XF_IDENTITY};
5273
5354
  function planRegistration(){
5274
5355
  if(!PlanXf||!P)return _PLAN_XF_IDENTITY;
@@ -5285,11 +5366,28 @@ function planRegistration(){
5285
5366
  const t=PlanXf.planTransform(P);
5286
5367
  if(Number.isFinite(t.rotation)&&t.fitScale>0&&Number.isFinite(t.fitScale))xf={rad:t.rotation,fitScale:t.fitScale};
5287
5368
  }catch(e){
5288
- if(!_PLAN_XF_UNREGISTERED.includes(e&&e.code))
5289
- console.warn('[steel] sheet "'+(P.sheet||'?')+'" has a registration this editor cannot use ('+((e&&e.code)||e)+') — column footprints are drawn unrotated and at the sheet’s stated scale, which may not be where the steel is.');
5369
+ // Nothing reads a refusal off this cache — the banner takes the sheet-level one from the projection.
5370
+ // Carrying it here as a third cache field only invited the next reader to believe otherwise.
5371
+ const refusal=planRefusalFor(P);
5372
+ // Kept beside the visible surfaces, not replaced by them: the console line is what a developer greps
5373
+ // for in a bug report, and it costs nothing. Mid-authoring stays quiet; the footprint just falls back.
5374
+ if(refusal&&refusal.registered)
5375
+ console.warn('[steel] sheet "'+(P.sheet||'?')+'" has a registration this editor cannot use ('+refusal.code+') — column footprints are drawn unrotated and at the sheet’s stated scale, which may not be where the steel is.');
5290
5376
  }
5291
5377
  _planXfCache={key,xf};return xf;
5292
5378
  }
5379
+ /* The same question asked of ANY plan, not just the active one — what the header pill scans.
5380
+
5381
+ Delegates to the projection module's classifier rather than deciding again here. It was decided twice
5382
+ for a while, and the two answers drifted the moment one of them learned that `grid-unavailable` covers
5383
+ both a missing grid and a broken one: the banner called a sheet a fault while the pill counted it as
5384
+ unfinished and stayed silent about it. One classifier, one answer. Never throws — it runs over every
5385
+ plan, including ones this editor would refuse to open. */
5386
+ function planRefusalFor(plan){
5387
+ if(!PlanXf||!plan||plan.viewKind!=='plan')return null;
5388
+ try{ return V2Projection.registrationRefusal({...plan,grid:plan.grid||(C&&C.grid)||null,modelGrid:plan.modelGrid||(C&&C.grid)||null}); }
5389
+ catch(_){ return null; }
5390
+ }
5293
5391
  // The member's stored roll RE-EXPRESSED into `target` (a positionAuthoringBasis snapshot; null/global →
5294
5392
  // world). ONE copy of the roll math — the 2D plan footprint targets global (positionEffectiveWorldRot),
5295
5393
  // the Profile Position panel + 3D gizmo target the current authoring frame (positionAuthoringRoll). The
@@ -6717,12 +6815,34 @@ function partReviewChipFor(jointId){
6717
6815
  return '';}
6718
6816
  function closeReviewFly(){
6719
6817
  const fly=document.getElementById('reviewFly');if(fly)fly.classList.remove('open');
6720
- for(const id of ['reviewStat','untrackedStat']){const b=document.getElementById(id);if(b)b.setAttribute('aria-expanded','false');}
6818
+ for(const id of ['reviewStat','untrackedStat','regStat']){const b=document.getElementById(id);if(b)b.setAttribute('aria-expanded','false');}
6721
6819
  reviewFlyKind=null;}
6722
6820
  function paintReviewFly(kind){
6723
6821
  const list=document.getElementById('reviewFlyList'),title=document.getElementById('reviewFlyTitle'),
6724
6822
  cnt=document.getElementById('reviewFlyCount'),more=document.getElementById('reviewFlyMore');
6725
- if(!list||!reviewSummary)return;
6823
+ if(!list)return;
6824
+ /* #935's list rides this popover rather than a fourth one — the comment on the two review stats already
6825
+ says a second, differently-behaving header popover is exactly the drift the baseline prevents. It is
6826
+ checked BEFORE the `reviewSummary` guard on purpose: registration comes from the contract in the
6827
+ browser, so it must still list when the SERVER could not derive the connection review. */
6828
+ if(kind==='registration'){
6829
+ title.textContent='Registration does not fit the grid';
6830
+ cnt.textContent=String(regRefusals.length);
6831
+ const shownReg=regRefusals.slice(0,REVIEW_LIST_CAP);
6832
+ // The whole tag on ONE line, literal attributes and all, exactly as the review rows above build theirs.
6833
+ // TWO guards require it and they require different things: verify:carrier-escaping matches per line, so
6834
+ // a data-command-id whose closing quote lands on the next line reads as unterminated; and the runtime
6835
+ // command-id scan reads the opening tag's own text, so an id assembled into a variable and concatenated
6836
+ // in reads as a runtime control with no id at all.
6837
+ list.innerHTML=shownReg.map(r=>{const name=esc(r.sheet||('view '+r.index));
6838
+ return '<button data-command-id="steel.registration-select#'+name+'" data-command-instance-label="'+name+'" class=frow data-plan="'+r.index+'"><span class=nm>'+name+'</span><span class=sub>'+esc(r.refusal.code)+'</span></button>';
6839
+ }).join('');
6840
+ more.hidden=regRefusals.length<=REVIEW_LIST_CAP;
6841
+ if(!more.hidden)more.textContent='Showing '+shownReg.length+' of '+regRefusals.length+'.';
6842
+ for(const b of list.querySelectorAll('.frow'))b.onclick=()=>{const i=+b.getAttribute('data-plan');closeReviewFly();setPlan(i);};
6843
+ return;
6844
+ }
6845
+ if(!reviewSummary)return;
6726
6846
  const rows=kind==='needs-review'?(reviewSummary.needsReview||[]):(reviewSummary.untracked||[]);
6727
6847
  title.textContent=kind==='needs-review'?'Needs review':'Not watched';
6728
6848
  cnt.textContent=String(rows.length);
@@ -6740,13 +6860,15 @@ function paintReviewFly(kind){
6740
6860
  if(!more.hidden)more.textContent='Showing '+shown.length+' of '+rows.length+'.';
6741
6861
  for(const b of list.querySelectorAll('.frow'))b.onclick=()=>selectReviewedJoint(b.getAttribute('data-joint'),kind);}
6742
6862
  function openReviewFly(kind,trigger){
6743
- if(!reviewSummary||reviewUnavailable)return;
6863
+ if(kind==='registration'){if(!regRefusals.length)return;}
6864
+ else if(!reviewSummary||reviewUnavailable)return;
6744
6865
  if(reviewFlyKind===kind){closeReviewFly();return;} // the trigger toggles
6745
6866
  reviewFlyKind=kind;paintReviewFly(kind);
6746
6867
  const fly=document.getElementById('reviewFly');if(!fly||!trigger)return;
6747
6868
  const r=trigger.getBoundingClientRect();fly.style.left=Math.max(8,Math.min(r.left,window.innerWidth-266))+'px';fly.style.top=(r.bottom+6)+'px';
6748
6869
  fly.classList.add('open');
6749
- for(const id of ['reviewStat','untrackedStat']){const b=document.getElementById(id);if(b)b.setAttribute('aria-expanded',String(id===(kind==='needs-review'?'reviewStat':'untrackedStat')));}
6870
+ {const owner=kind==='needs-review'?'reviewStat':kind==='untracked'?'untrackedStat':'regStat';
6871
+ for(const id of ['reviewStat','untrackedStat','regStat']){const b=document.getElementById(id);if(b)b.setAttribute('aria-expanded',String(id===owner));}}
6750
6872
  const first=fly.querySelector('.frow');if(first)first.focus();}
6751
6873
  /* A needs-review row selects the MEMBERS the user named — they exist in the contract, so this works in
6752
6874
  Plan view where the joint itself has no representation. An untracked row has no members recorded, so
@@ -6925,7 +7047,7 @@ function render(){
6925
7047
  // `profs` and `detTexts()` live — so the combobox offers the same list with no mirror to keep filled.
6926
7048
  // Deleting the elements while these two writes stayed made render() throw on null here, which also
6927
7049
  // killed every call after it on this line (stats/panel/upd*/syncDisplayRows). Measured in Chromium.
6928
- svg.innerHTML=s; stats(); panel(); updUR(); updDup(); updateMemberEndStatus(); updConf(); updCS(); updConnBtn(); updBpBtn(); updSpBtn(); syncDisplayRows();restoreProfilePickerFocus(profileFocusToken);
7050
+ svg.innerHTML=s; stats(); panel(); updUR(); updDup(); updRegistration(); updateMemberEndStatus(); updConf(); updCS(); updConnBtn(); updBpBtn(); updSpBtn(); syncDisplayRows();restoreProfilePickerFocus(profileFocusToken);
6929
7051
  if(selFilterReady)reflectSelFilter(); // keep the Select-bar Members/Connections buttons in sync with the model — a new/removed connection kind (e.g. the first auto-detailed base plate) flips their on/off without a manual toggle. Gated on selFilterReady so it doesn't run until the deferred first reflect has armed it (that reflect needs BASE_MEMBER_TYPES, initialised later in main()).
6930
7052
  if(view3dShown&&window.Steel3DView){window.Steel3DView.setSelection(selIds);if(window.Steel3DView.setGridSelection)window.Steel3DView.setGridSelection(selGridIds);updateIsolateBtn();if((selIds.size||selGridIds.size)&&window.Steel3DView.selectedClips&&window.Steel3DView.selectedClips().length)window.Steel3DView.setSelectedClips([]);refreshLegendSel();} // keep the 3D member + grid highlight in sync; selecting geometry clears any clip selection (exclusive)
6931
7053
  try{updateConnCrumb();}catch(_){} // Connection Component breadcrumb follows the selection (3D-only; hidden at root)
@@ -6935,6 +7057,71 @@ function updDup(){const n=redundantDups().length;
6935
7057
  document.getElementById('dpc').textContent=n;document.getElementById('dupStat').classList.toggle('has',n>0);
6936
7058
  const b=document.getElementById('dupB');if(b.dataset.flash)return; // don't clobber transient "none" feedback
6937
7059
  b.disabled=false;b.classList.toggle('alert',n>0);b.textContent=n>0?('Duplicates ('+n+')'):'Check duplicates';}
7060
+ /* #935 — the plan-registration refusal, made VISIBLE.
7061
+
7062
+ Two surfaces, deliberately, because one of them cannot do the other's job:
7063
+
7064
+ - The CANVAS banner speaks for the sheet you are looking at, because that is the sheet whose steel is
7065
+ being drawn in the wrong place right now.
7066
+ - The HEADER pill counts EVERY plan. The reported defect placed a 250-member model a median of 18 m
7067
+ out while its author worked on other sheets, so a surface that only speaks when you happen to open
7068
+ the bad one repeats the bug in miniature.
7069
+
7070
+ Neither is dismissible. A notice you can silence is the silent-wrongness this exists to end, one click
7071
+ later. Both disappear on their own the moment the contract stops being refused. */
7072
+ let regRefusals=[],regBannerSheet=null;
7073
+ function updRegistration(){
7074
+ // Every plan, not the active one. Cheap: planTransform parses one grid per plan and this runs on
7075
+ // model change, not per frame.
7076
+ regRefusals=(C&&Array.isArray(C.plans)?C.plans:[]).map((plan,index)=>{
7077
+ const refusal=planRefusalFor(plan);
7078
+ // `registered:false` sheets are excluded: the pill exists to chase FAULTS across the set, and a count
7079
+ // that also totals every half-authored sheet is a number the reader learns to ignore. Those sheets
7080
+ // still explain themselves on their own canvas.
7081
+ return refusal&&refusal.registered?{index,sheet:(plan&&plan.sheet)||'',refusal}:null;
7082
+ }).filter(Boolean);
7083
+ const pill=document.getElementById('regStat'),count=document.getElementById('regCount');
7084
+ if(pill&&count){count.textContent=String(regRefusals.length);pill.hidden=regRefusals.length===0;
7085
+ if(!regRefusals.length&&reviewFlyKind==='registration')closeReviewFly();}
7086
+ paintRegBanner();}
7087
+ /** The active sheet's banner. Reads the memoised `_planXfCache.refusal` rather than transforming again —
7088
+ render() already asked planRegistration() for this exact key. */
7089
+ function paintRegBanner(){
7090
+ const bar=document.getElementById('regBanner');if(!bar)return;
7091
+ // The ACTIVE PROJECTION's refusal, which is the sheet-level question: can this plan be mapped into
7092
+ // display pixels at all. `_planXfCache` answers a narrower one (can a column footprint be rotated), and
7093
+ // reading that here would leave the banner silent on a sheet carrying no columns.
7094
+ const refusal=(P&&P.registrationRefusal)||null;
7095
+ // A banner that carried over from the sheet you just left would accuse the wrong drawing, so the text
7096
+ // AND the expanded/collapsed state reset on every sheet change.
7097
+ const sheet=(P&&P.sheet)||'';
7098
+ if(sheet!==regBannerSheet){regBannerSheet=sheet;bar.classList.remove('det');
7099
+ const t=document.getElementById('regDetailBtn');if(t)t.setAttribute('aria-expanded','false');}
7100
+ if(!refusal){bar.classList.remove('on');bar.classList.remove('plain');return;}
7101
+ // textContent, never innerHTML: a sheet name and an axis id are author-written strings that reach here
7102
+ // unescaped.
7103
+ document.getElementById('regLead').textContent=regLeadText(sheet,refusal);
7104
+ document.getElementById('regDetail').textContent=refusal.message;
7105
+ // Amber only for a registration that IS stated and does not hold. A sheet still being authored recedes
7106
+ // to the neutral tier, exactly as #rcIssues' own `.rcban.plain` does: this file uses amber to mean
7107
+ // “needs review”, and colouring ordinary unfinished work that way misreports it as a fault.
7108
+ bar.classList.toggle('plain',!refusal.registered);
7109
+ bar.classList.add('on');}
7110
+ /** The plain-English lead. A steel detailer reads this one; the exact `$.`-path sentence is under Details. */
7111
+ function regLeadText(sheet,refusal){
7112
+ const name='Sheet “'+(sheet||'this sheet')+'”';
7113
+ /* The neutral lead names WHAT IS MISSING rather than asserting one remedy. It used to say "the sheet
7114
+ just needs its two registration points" for every neutral code, which is false when the missing thing
7115
+ is the grid or the drawing scale — and the reassurance "nothing is wrong" is worse than useless when
7116
+ it is aimed at the wrong field. */
7117
+ if(!refusal.registered){
7118
+ const missing=refusal.code==='grid-unavailable'?'there is no model grid yet for it to register against'
7119
+ :refusal.code==='scale-invalid'?'its drawing scale has not been set yet'
7120
+ :'its two registration points have not been set yet';
7121
+ return name+' cannot be placed on the model: '+missing+', so FloLess has nowhere to put its steel. '
7122
+ +'Nothing is wrong — this part of the read is simply not finished.';}
7123
+ return name+' states a registration that does not hold: its two registration points do not agree with the grid lines they name, '
7124
+ +'so steel taken off this sheet would be metres out of place. No steel is placed on it until that is corrected.';}
6938
7125
  // keep selection-number badges constant on screen while zooming; the end dots grow with zoom (epR) so
6939
7126
  // they stay readable against the thick member line — both must track zoom live as the user zooms.
6940
7127
  function updateBadges(){const R=12/zoom,F=13/zoom,ox=el=>(+el.dataset.fi-(+el.dataset.gn-1)/2)*R*2;
@@ -7530,6 +7717,17 @@ function panel(){
7530
7717
  {const qb=document.getElementById('qdPlaceG');if(qb)qb.onclick=()=>quickDimSpacing(qdAnchorPt);}
7531
7718
  return;}
7532
7719
  const arr=selArr();
7720
+ /* A selection that resolved to NOTHING is not an empty selection, and showing the legend for it tells
7721
+ the user their click did nothing. It happens on a sheet whose registration is refused: the plan
7722
+ projects no members, so a member picked in the 3D view — which draws from the canonical model and is
7723
+ unaffected — has no plan-space twin for `selArr()` to return. Say that, rather than go quiet. The
7724
+ member's own properties are knowable and are NOT shown here yet; that needs a canonical read path for
7725
+ the non-coordinate consumers, which is filed separately rather than bolted on under this fix. */
7726
+ if(arr.length===0&&selIds.size&&P&&P.registrationRefusal){
7727
+ p.innerHTML='<h3>Selected on another view</h3><div class="dmsg warn" style="margin-top:8px">'
7728
+ +esc(selIds.size===1?'That member cannot be shown here.':'Those '+selIds.size+' members cannot be shown here.')
7729
+ +' '+esc(regLeadText((P&&P.sheet)||'',P.registrationRefusal))+'</div>';
7730
+ return;}
7533
7731
  if(arr.length===0){const elevationContext=nativeElevationModel()?nativeElevationContextHtml():
7534
7732
  '<div style="border-top:1px solid var(--line);margin-top:12px;padding-top:12px"><div class=sect>Project defaults</div>'+
7535
7733
  '<div class=hint style="margin:0 0 6px;font-size:11px">Level <b>'+esc(fmtFtIn(defaultTOS))+'</b> ('+esc(P.sheet)+'). '+((P.tos_callouts&&P.tos_callouts.length)?'Per-zone T.O. STEEL callouts from the drawing applied to each member; ':'')+'ends ticked <b>default</b> follow the level.</div>'+
@@ -10138,8 +10336,31 @@ document.addEventListener('click',e=>{if(selFly.classList.contains('open')&&!sel
10138
10336
  /* The two review stats open the same popover. Wired here beside #selFly's own wiring because they are the
10139
10337
  same interaction — a stat that toggles a capped list — and a second, differently-behaving popover in the
10140
10338
  header is exactly the drift the baseline is meant to prevent. */
10339
+ /* #935's two banner buttons. Details EXPANDS the exact planTransform sentence — it is already real DOM
10340
+ text, so this only reveals it; it is never the tooltip, which a keyboard or screen-reader user cannot
10341
+ reach. Copy hands that same sentence to the clipboard because it names the contract fields verbatim
10342
+ ($.datum_ref, $.pt_per_ft) and the user's next move is to paste it to their terminal AI. */
10343
+ {const detBtn=document.getElementById('regDetailBtn'),copyBtn=document.getElementById('regCopyBtn'),
10344
+ bar=document.getElementById('regBanner');
10345
+ if(detBtn&&bar)detBtn.onclick=()=>{const open=bar.classList.toggle('det');detBtn.setAttribute('aria-expanded',String(open));};
10346
+ if(copyBtn&&bar)copyBtn.onclick=async()=>{
10347
+ const text=(document.getElementById('regDetail')||{}).textContent||'';
10348
+ if(!text)return;
10349
+ try{ await navigator.clipboard.writeText(text); }
10350
+ catch(err){
10351
+ // Bind and log it — an insecure context and a denied permission are different problems and a bug
10352
+ // report cannot tell them apart from the toast alone. Then FALL BACK to showing the sentence rather
10353
+ // than only apologising: it is already on the page, so expanding it costs nothing and leaves the user
10354
+ // able to select it by hand.
10355
+ console.error('[steel] could not copy the registration reason', err);
10356
+ bar.classList.add('det');if(detBtn)detBtn.setAttribute('aria-expanded','true');
10357
+ toast('Could not reach the clipboard — the reason is shown below; copy it by hand.');return;
10358
+ }
10359
+ const was=copyBtn.textContent;copyBtn.textContent='Copied';
10360
+ setTimeout(()=>{copyBtn.textContent=was;},1600);
10361
+ };}
10141
10362
  {const rf=document.getElementById('reviewFly');
10142
- for(const [id,kind] of [['reviewStat','needs-review'],['untrackedStat','untracked']]){
10363
+ for(const [id,kind] of [['reviewStat','needs-review'],['untrackedStat','untracked'],['regStat','registration']]){
10143
10364
  const b=document.getElementById(id);if(b)b.onclick=(e)=>{e.stopPropagation();openReviewFly(kind,b);};}
10144
10365
  // Esc returns focus to the trigger it came from, so a keyboard user is not dropped at the top of the page.
10145
10366
  /* ONE Esc, ONE action. Without stopPropagation the global Escape ladder still runs to its terminal
@@ -10149,7 +10370,11 @@ document.addEventListener('click',e=>{if(selFly.classList.contains('open')&&!sel
10149
10370
  if(e.key!=='Escape'||!rf||!rf.classList.contains('open'))return;
10150
10371
  /* Consume it ONLY while the popover or its trigger owns focus. Swallowing every Escape just because the
10151
10372
  list happens to be open would steal it from whatever the user Tabbed to next. */
10152
- const back=reviewFlyKind==='needs-review'?'reviewStat':'untrackedStat',t=document.getElementById(back);
10373
+ /* The trigger that OPENED this list, all three of them. It used to be a two-way ternary, so the
10374
+ registration kind fell into the `untrackedStat` arm and Escape focused a button that is `hidden`
10375
+ whenever there are no untracked connections — dropping the user on <body>, which is the exact
10376
+ thing the comment above says this code exists to prevent. */
10377
+ const back=reviewFlyKind==='needs-review'?'reviewStat':reviewFlyKind==='registration'?'regStat':'untrackedStat',t=document.getElementById(back);
10153
10378
  const mine=rf.contains(document.activeElement)||document.activeElement===t;
10154
10379
  closeReviewFly();
10155
10380
  if(!mine)return;
@@ -12,7 +12,7 @@ import { validateSchemaSubset } from './json-schema-subset.js';
12
12
  * `$defs` (e.g. `{...schema.$defs.dim3, $defs: schema.$defs}`) so local `$ref`s still resolve.
13
13
  */
14
14
  export { validateSchemaSubset };
15
- import { axisLabelsFor, parseSpacings } from './grid-core.js';
15
+ import { parseSpacings } from './grid-core.js';
16
16
  import { positionBasisIssue,POSITION_BASIS_CAPABILITY_VERSION } from './steel-3d-core.js';
17
17
  export const POSITION_BASIS_CLIENT_VALIDATION_VERSION=POSITION_BASIS_CAPABILITY_VERSION;
18
18
 
@@ -37,19 +37,22 @@ export function validateClientSteelModelV2(doc, schema) {
37
37
  const presented = new Set();
38
38
  const axes = rows(doc.grid?.axes);
39
39
  const axisIds = new Set();
40
+ const axisDir = new Map();
40
41
  for (const axis of axes) {
41
42
  if (!axis?.id || axisIds.has(axis.id)) issues.push(`grid-axis-id-duplicate at $.grid.axes`);
42
43
  axisIds.add(axis?.id);
44
+ if (axis?.id && axis?.dir) axisDir.set(axis.id, axis.dir);
43
45
  }
44
- // A control names an axis by the label it PRINTS, which is the per-axis `label` when it has one and the
45
- // `labels_x`/`labels_y` slot when it does not (#740). Counting `axis.label` alone refused a control ref
46
- // for an axis that legitimately takes its name from the override string, while the transform that
47
- // actually resolves the ref accepted it — a refusal the user could not act on.
48
- const labelCounts = (dir, style) => {
49
- const counts = new Map();
50
- if (!object(doc.grid)) return counts;
46
+ // `grid-axis-count`: the axis rows must pair one-for-one with the parsed spacings.
47
+ //
48
+ // This used to also build a per-direction LABEL COUNT, because a registration control was resolved by
49
+ // label and a name that occurred twice — or zero times — had to refuse. Registration now resolves
50
+ // stable axis IDS (#935), so the counting is gone and only the pairing check remains; the label
51
+ // resolver keeps its own job of deciding what a bubble PRINTS (#740).
52
+ const checkAxisCount = (dir) => {
53
+ if (!object(doc.grid)) return;
51
54
  const spacings = parseSpacings(dir === 'x' ? doc.grid.x : doc.grid.y);
52
- if (spacings.err) return counts;
55
+ if (spacings.err) return;
53
56
  const n = spacings.offsets.length;
54
57
  // The axes must pair with the parsed spacings, and this is where that becomes checkable in the
55
58
  // browser. Say it directly rather than leaving it to be inferred from an unresolved control: with the
@@ -67,17 +70,20 @@ export function validateClientSteelModelV2(doc, schema) {
67
70
  // they get now. (Codex review, #918.)
68
71
  const declared = axes.filter((a) => object(a) && a.dir === dir).length;
69
72
  if (declared !== n) issues.push(`grid-axis-count at $.grid.axes — $.grid.${dir} parses to ${n} ${dir} ${n === 1 ? 'entry' : 'entries'} but $.grid.axes declares ${declared} ${dir} ${declared === 1 ? 'axis' : 'axes'}`);
70
- for (const label of axisLabelsFor(doc.grid, dir, style, n)) counts.set(label, (counts.get(label) || 0) + 1);
71
- return counts;
72
73
  };
73
- const axisLabels = { x: labelCounts('x', 'num'), y: labelCounts('y', 'alpha') };
74
+ checkAxisCount('x');
75
+ checkAxisCount('y');
74
76
  const axisRef = (id, path) => {
75
77
  if (id && !axisIds.has(id)) issues.push(`grid-axis-unresolved at ${path}`);
76
78
  };
79
+ // Registration resolves against stable axis IDS, never the editable display label (#935). Direction
80
+ // is part of the check: `xAxisId` naming a dir-y axis is a transposition, not a lookup miss.
77
81
  const controlRef = (ref, path) => {
78
82
  if (!ref) return;
79
- if ((axisLabels.x.get(ref.axis_x) || 0) !== 1 || (axisLabels.y.get(ref.axis_y) || 0) !== 1) {
80
- issues.push(`control-ref-unresolved at ${path}`);
83
+ for (const [field, want] of [['xAxisId', 'x'], ['yAxisId', 'y']]) {
84
+ const id = ref[field];
85
+ if (!id || !axisIds.has(id)) issues.push(`control-ref-unresolved at ${path}.${field}`);
86
+ else if (axisDir.get(id) !== want) issues.push(`control-ref-direction at ${path}.${field}`);
81
87
  }
82
88
  };
83
89
  for (let pi = 0; pi < plans.length; pi += 1) {
@@ -828,38 +828,23 @@ export function createV2CommandSession(model, options = {}) {
828
828
  /**
829
829
  * Rename one grid direction's axes — and carry the sheet registrations that named them.
830
830
  *
831
- * A registration control stores a LABEL, not an axis id ("labels are evidence, not identity"), so a
832
- * rename that touched the grid alone would orphan every sheet registered on the old name and the
833
- * validator would refuse the whole edit. It used to appear to work only because the rename wrote the
834
- * `labels_x`/`labels_y` string that nothing resolving a control ever read (#740). Each control now
835
- * follows the axis it was pointing at, by slot, in the same transaction.
831
+ * A registration control used to store a LABEL, so a rename that touched the grid alone would orphan
832
+ * every sheet registered on the old name and the validator would refuse the whole edit — and this
833
+ * command carried a slot-by-slot rewrite to chase each control onto its axis's new name (#740).
834
+ * That rewrite is GONE, because #935 moved registration onto stable axis ids: renaming a bubble is
835
+ * now purely a display edit and cannot reach a control at all. The bug it was written for cannot
836
+ * recur, and neither can the class it belonged to.
836
837
  *
837
838
  * `labels` is the full list for the direction in authored axis order, or null to clear it to auto.
838
839
  */
839
840
  setGridLabels(dir, labels) {
840
841
  return session.transact('rename grid axes', (doc) => {
841
842
  if (!doc.grid) throw new V2CommandError('grid-unavailable', 'the model has no grid');
842
- const style = dir === 'x' ? 'num' : 'alpha';
843
+ // Still parsed, and still refused on error: `gridLabelPatch` writes one label per parsed entry,
844
+ // so an unreadable spacing string would silently decide how many axes get renamed.
843
845
  const spacings = parseSpacings(dir === 'x' ? doc.grid.x : doc.grid.y);
844
846
  if (spacings.err) throw new V2CommandError('grid-spacing-invalid', `the model grid's ${dir} spacing is unreadable: ${spacings.err}`);
845
- const n = spacings.offsets.length;
846
- const before = axisLabelsFor(doc.grid, dir, style, n);
847
847
  Object.assign(doc.grid, gridLabelPatch(doc.grid, dir, labels));
848
- const after = axisLabelsFor(doc.grid, dir, style, n);
849
-
850
- // Built COMPLETE before any control is rewritten, so a pair of axes that swap names is applied
851
- // once each rather than chased around the map.
852
- const moved = new Map();
853
- before.forEach((old, i) => { if (after[i] !== old) moved.set(old, after[i]); });
854
- if (moved.size) {
855
- const key = dir === 'x' ? 'axis_x' : 'axis_y';
856
- for (const plan of doc.plans || []) {
857
- for (const refKey of ['datum_ref', 'control2_ref']) {
858
- const ref = plan[refKey];
859
- if (ref && moved.has(ref[key])) ref[key] = moved.get(ref[key]);
860
- }
861
- }
862
- }
863
848
  return { structural: true };
864
849
  });
865
850
  },
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { sheetIncludesElevation,POSITION_BASIS_CAPABILITY_VERSION } from './steel-3d-core.js';
10
10
  export const POSITION_BASIS_PROJECTION_VERSION=POSITION_BASIS_CAPABILITY_VERSION;
11
- import { worldToSheetPx } from './steel-plan-transform.js';
11
+ import { worldToSheetPx, planTransform, PlanTransformError } from './steel-plan-transform.js';
12
12
 
13
13
  const IN_MM = 25.4;
14
14
  export const V2_PROJECTION_LINK = Symbol.for('floless.steelModelV2ProjectionLink');
@@ -50,6 +50,62 @@ export function memberSheets(model, memberId) {
50
50
  return (model.plans || []).filter((p) => memberPresence(model, p, member).visible).map((p) => p.sheet);
51
51
  }
52
52
 
53
+ /**
54
+ * Why this plan cannot be mapped into display pixels, or null when it can. THE one classifier: the
55
+ * editor imports it for its whole-model scan and its canvas banner, so what the pill counts and what the
56
+ * banner says can never disagree with what the projection actually did.
57
+ *
58
+ * `registered: false` separates the two states the editor must NOT conflate: a sheet still being
59
+ * authored (no controls yet, a view kind 2D cannot map, no grid) has nothing WRONG with it, while a
60
+ * sheet that states a registration which does not hold is a fault someone has to correct. Both leave
61
+ * the projection empty; only the second is a warning.
62
+ *
63
+ * @param {any} plan @returns {{code: string, message: string, registered: boolean} | null}
64
+ */
65
+ export function registrationRefusal(plan) {
66
+ try { planTransform(plan); return null; } catch (err) {
67
+ /*
68
+ * ONLY a real refusal degrades. `planTransform` is ordinary code and can fail for ordinary reasons —
69
+ * a TypeError, a future regression — and catching those into `registration-invalid` would blame the
70
+ * user's document for a bug in ours, then hide it behind a plausible-looking notice. That is the
71
+ * same substitution this whole change exists to end, so anything that is not a PlanTransformError
72
+ * carrying a code goes back up the stack untouched.
73
+ */
74
+ if (!(err instanceof PlanTransformError) || !err.code) throw err;
75
+ const code = String(err.code);
76
+ return { code, message: String(err.message || code), registered: !isUnstarted(plan, code) };
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Is this refusal "nothing has been stated yet", as opposed to "something is stated and does not hold"?
82
+ *
83
+ * The CODE alone cannot answer it, and reading it as if it could was wrong in a way that mattered: two
84
+ * of these codes cover both states at once. `grid-unavailable` is raised both when there is no model
85
+ * grid (unfinished) and when a grid exists but its `origin` cannot be read (malformed); `scale-invalid`
86
+ * both when `pt_per_ft` was never written (unfinished) and when it is present but zero or negative
87
+ * (malformed). Treating the whole code as unfinished told an author that "nothing is wrong, the sheet
88
+ * just needs its two registration points" about a sheet whose controls were already complete and whose
89
+ * grid was broken — a reassuring sentence that was not true, which is the exact defect class #935 is
90
+ * about. So look at whether the thing the refusal names is ABSENT or merely unusable.
91
+ *
92
+ * @param {any} plan @param {string} code
93
+ */
94
+ function isUnstarted(plan, code) {
95
+ if (code === 'registration-incomplete') return true;
96
+ const grid = plan.modelGrid || plan.grid || null;
97
+ if (code === 'grid-unavailable') return !grid || typeof grid !== 'object';
98
+ if (code === 'scale-invalid') return plan.pt_per_ft == null;
99
+ return false;
100
+ }
101
+
102
+ /**
103
+ * The refusal codes that CAN mean "not registered yet" — the candidates `isUnstarted` then decides
104
+ * between, since two of them also cover a malformed state. Imported by steel-editor.html, which
105
+ * classifies the same throw for the column-footprint fallback, so the two cannot drift apart.
106
+ */
107
+ export const UNREGISTERED_CODES = ['registration-incomplete', 'view-kind-unsupported', 'scale-invalid', 'grid-unavailable'];
108
+
53
109
  function projectGrid(modelGrid, plan) {
54
110
  if (!modelGrid) return null;
55
111
  const out = clone(modelGrid);
@@ -122,9 +178,46 @@ export function createV2Projection(model, sheet, options = {}) {
122
178
  if (!Array.isArray(projection[key])) projection[key] = [];
123
179
  }
124
180
  projection.default_tos = Number.isFinite(plan.elevation_in) ? plan.elevation_in : 0;
125
- projection.grid = projectGrid(model.grid || null, projection);
126
- const visible = (model.members || []).filter((m) => memberPresence(model, plan, m).visible);
181
+ /*
182
+ * The registration is classified ONCE, here, before anything maps a point through it — and a refusal
183
+ * degrades this projection rather than throwing out of it.
184
+ *
185
+ * It used to throw, from deep inside `projectGrid`/`projectMember`, straight through `setPlan` and out
186
+ * of the editor's `boot()`. That was survivable only while `planTransform` refused nothing a real
187
+ * reader produces. #935 added the span invariant, which a real reader DOES trip — so the contract that
188
+ * issue was filed about would have opened to a dead page instead of a wrong one. Trading a silently
189
+ * wrong model for a blank screen with no explanation is not a fix.
190
+ *
191
+ * So: a refused sheet projects EMPTY — no grid, no members — and says why in `registrationRefusal`.
192
+ * Empty is the honest answer. Every projected coordinate is derived from the registration, so a sheet
193
+ * whose registration does not hold has no display position for anything on it; drawing the members
194
+ * anyway, at some invented fallback scale, is exactly the plausible-picture-over-a-real-refusal this
195
+ * whole change exists to end. The editor renders the refusal instead (see #regBanner).
196
+ */
197
+ const refusal = registrationRefusal(projection);
198
+ /*
199
+ * ONE refusal is fatal here rather than a state to render, because it is not a registration state at
200
+ * all: `view-kind-unsupported` says this sheet is not a plan. Every caller reaches this function having
201
+ * already decided it is one, so it reports a confused caller or a malformed document rather than
202
+ * anything a user can correct — and a native v2 document with no `viewKind` MUST keep refusing to open
203
+ * rather than being drawn as an empty plan, a MUST-MATCH guarantee (steel-editor-v2-must-match.test.ts)
204
+ * raised precisely so an unclassified sheet is never quietly reclassified. It is thrown HERE and not
205
+ * inside the classifier, so the editor's whole-model scan can classify every plan without exploding on
206
+ * one it is only counting.
207
+ */
208
+ if (refusal && refusal.code === 'view-kind-unsupported') {
209
+ throw Object.assign(new Error(refusal.message), { code: refusal.code });
210
+ }
211
+ if (refusal) projection.registrationRefusal = refusal;
212
+ projection.grid = refusal ? null : projectGrid(model.grid || null, projection);
213
+ const visible = refusal ? [] : (model.members || []).filter((m) => memberPresence(model, plan, m).visible);
127
214
  projection.members = visible.map((m) => projectMember(m, projection, session));
215
+ // Dimensions go with them. A `dim` is anchored to a member point or a grid axis (`aRef`/`bRef`), so on
216
+ // a refused sheet it measures between two things that are no longer there — and it draws in raw sheet
217
+ // pixels, so it draws ANYWAY, leaving one confident-looking annotation floating over an empty plan.
218
+ // The sheet's own display-space content (segments, labels, callouts) is untouched: that is the drawing
219
+ // itself, and it is well defined with or without a registration.
220
+ if (refusal) projection.dims = [];
128
221
  link(projection, { session, kind: 'plan', sheet });
129
222
  if (projection.grid) {
130
223
  link(projection.grid, { session, kind: 'grid', sheet });