@floless/app 0.131.1 → 0.132.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.
@@ -158,6 +158,39 @@ export function chromeVisibility({ mode, activePane } = {}) {
158
158
  };
159
159
  }
160
160
 
161
+ /** The bottom dock's three direct children, by element id, in the order the MARKUP declares them. */
162
+ const DOCK_ITEMS = ['m3dLegendLauncher', 'bottomDockLeft', 'ptrBars'];
163
+
164
+ /**
165
+ * The order the bottom dock's items should sit in the DOM — which is to say, left to right on screen.
166
+ *
167
+ * WHY THIS IS NOT JUST THE MARKUP ORDER. `#m3dLegendLauncher` is declared first because it is leftmost
168
+ * in three of the four arrangements (3D-active split, single 3D, and the stage-wide fallback). The
169
+ * fourth — 2D-active split with the per-pane dock on — pins it to the 3D pane's left edge
170
+ * (`position:absolute`, see the `body.split-view:not(.v3d) #bottomDock.dock-per-pane` rule in
171
+ * steel-editor.html) while `#bottomDockLeft` keeps the gesture hint at the dock's own left edge. There
172
+ * the markup reads the pair backwards, so a keyboard or screen-reader user reached "Expand 3D panel"
173
+ * before the hint sitting far to its left.
174
+ *
175
+ * WHY THE CALLER MOVES NODES RATHER THAN SETTING `order:`. A CSS `order:` swap fixes the visual/DOM
176
+ * mismatch for a sighted keyboard user and leaves the screen-reader one exactly where they were:
177
+ * `order` is a paint-time concern that assistive technology does not reliably follow. Positive
178
+ * `tabindex` is the other tempting one-liner, and it is worse — it lifts these three out of document
179
+ * order for the WHOLE page. So the honest fix is the node order itself, which is what this returns.
180
+ *
181
+ * `v3d` comes from chromeVisibility rather than being re-derived here, so the order and the CSS that
182
+ * pins the launcher can never key off different answers to "is the 3D pane the active one".
183
+ *
184
+ * @param {{mode?: string, activePane?: string, perPane?: boolean}} state — `perPane` is the live
185
+ * `#bottomDock.dock-per-pane` state, which is the fit gate's output and cannot be derived from here.
186
+ * @returns {string[]} element ids, first on screen first.
187
+ */
188
+ export function dockOrder({ mode, activePane, perPane } = {}) {
189
+ const m = sanitizeMode(mode);
190
+ const pinned = m === 'split' && perPane === true && !chromeVisibility({ mode: m, activePane }).v3d;
191
+ return pinned ? ['bottomDockLeft', 'm3dLegendLauncher', 'ptrBars'] : [...DOCK_ITEMS];
192
+ }
193
+
161
194
  /**
162
195
  * What a mode change has to DO, as data.
163
196
  *
@@ -171,21 +171,21 @@
171
171
  <span class="stat" id="title">—</span>
172
172
  <span class="spacer"></span>
173
173
  <span class="stat"><b id="nBoxes">0</b> members · <b id="nExtr">0</b> bodies</span>
174
- <button id="skipChip" hidden>⚠ <b id="nSkipped">0</b> unplaced</button>
174
+ <button id="skipChip" data-command-id="vector3d.unplaced" hidden>⚠ <b id="nSkipped">0</b> unplaced</button>
175
175
  </header>
176
176
  <div id="wrap">
177
177
  <canvas id="stage3d"></canvas>
178
178
  <div id="bar" hidden>
179
179
  <div class="seg-group" id="projSeg">
180
- <button data-proj="persp" class="on" data-tip="Perspective view — natural depth">Persp</button>
181
- <button data-proj="ortho" data-tip="Orthographic — true scale, no perspective">Ortho</button>
180
+ <button data-command-id="vector3d.projection" data-proj="persp" class="on" data-tip="Perspective view — natural depth">Persp</button>
181
+ <button data-command-id="vector3d.projection" data-proj="ortho" data-tip="Orthographic — true scale, no perspective">Ortho</button>
182
182
  </div>
183
- <button id="fitBtn" data-tip="Fit all to view">Fit</button>
183
+ <button id="fitBtn" data-command-id="vector3d.fit" data-tip="Fit all to view">Fit</button>
184
184
  <span class="tb-sep"></span>
185
185
  <div class="seg-group" id="modeSeg">
186
- <button data-mode="solid" class="on" data-tip="Solid shaded model">Solid</button>
187
- <button data-mode="wire" data-tip="Wireframe — edges only">Wire</button>
188
- <button data-mode="xray" data-tip="See-through — reveal hidden parts">X-ray</button>
186
+ <button data-command-id="vector3d.display-mode" data-mode="solid" class="on" data-tip="Solid shaded model">Solid</button>
187
+ <button data-command-id="vector3d.display-mode" data-mode="wire" data-tip="Wireframe — edges only">Wire</button>
188
+ <button data-command-id="vector3d.display-mode" data-mode="xray" data-tip="See-through — reveal hidden parts">X-ray</button>
189
189
  </div>
190
190
  <span class="tb-sep"></span>
191
191
  <span id="groupToggles"></span>
@@ -197,6 +197,17 @@
197
197
  </div>
198
198
  <div id="state" class="show" role="status" aria-live="polite"><div class="spin"></div><div class="msg" id="stateMsg">Reconstructing…</div></div>
199
199
  </div>
200
+ <!-- The Instructor seam. Classic, parser-inserted and BEFORE this page's own script on
201
+ purpose: classic scripts run synchronously in document order while modules are deferred, so
202
+ window.Commands is guaranteed to exist by the time anything below reads it.
203
+ The reporter tells the shell which surface is on screen (so the `?` sheet can put this
204
+ screen's commands first) and forwards `?`/F1 up, because a keydown inside an iframe never
205
+ reaches the shell's own handler. A read-only viewer: nothing here can be armed — see commands-vector3d.js. -->
206
+ <script src="commands.js"></script>
207
+ <script src="commands-vector3d.js"></script>
208
+ <script src="instructor-reporter.js"></script>
209
+ <script>window.InstructorReporter.mount({ surface: 'vector-3d' });</script>
210
+
200
211
  <script type="importmap">{"imports":{"three":"./vendor/three.module.js","three/addons/":"./vendor/","three-bvh-csg":"./vendor/three-bvh-csg.module.js"}}</script>
201
212
  <script type="module" src="./steel-3d-view.js"></script>
202
213
  <script type="module">
@@ -290,6 +301,7 @@ function boot(v3d) {
290
301
  for (const el of scene.elements) counts.set(el.group, (counts.get(el.group) || 0) + 1);
291
302
  for (const g of v3d.getGroups()) {
292
303
  const lab = document.createElement('label'); lab.className = 'gck';
304
+ lab.setAttribute('data-command-id', 'vector3d.group-toggle');
293
305
  const inp = document.createElement('input'); inp.type = 'checkbox'; inp.checked = true;
294
306
  inp.addEventListener('change', () => v3d.toggleGroup(g.key));
295
307
  const sw = document.createElement('span'); sw.className = 'sw'; sw.style.background = g.color;
@@ -206,25 +206,25 @@
206
206
  <span class="spacer"></span>
207
207
  <span class="stat"><b id="nEl">0</b> elements · <b id="nTx">0</b> text</span>
208
208
  <span id="saveStat" data-tip="Edits save to the app's contract automatically" hidden>Auto-save on</span>
209
- <button class="primary" id="exportBtn" disabled>Export SVG</button>
209
+ <button class="primary" id="exportBtn" data-command-id="vector.export-svg" disabled>Export SVG</button>
210
210
  </header>
211
211
  <div id="wrap">
212
212
  <div id="stage">
213
213
  <svg id="svg" xmlns="http://www.w3.org/2000/svg"></svg>
214
214
  <div id="state" class="show"><div class="spin"></div><div id="stateMsg">Loading drawing…</div></div>
215
215
  <div id="zoombar">
216
- <button class="ghost" id="fitBtn" data-tip="Fit to view">Fit</button>
217
- <input type="range" id="zoom" min="10" max="800" value="100" aria-label="Zoom">
216
+ <button class="ghost" id="fitBtn" data-command-id="vector.fit" data-tip="Fit to view">Fit</button>
217
+ <input type="range" id="zoom" min="10" max="800" value="100" data-command-id="vector.zoom" aria-label="Zoom">
218
218
  <span id="zpct">100%</span>
219
219
  </div>
220
- <div id="toast" role="status"><span id="toastMsg"></span><button class="ghost" id="undoBtn">Undo</button></div>
220
+ <div id="toast" role="status"><span id="toastMsg"></span><button class="ghost" id="undoBtn" data-command-id="vector.undo-delete">Undo</button></div>
221
221
  </div>
222
222
  <aside>
223
223
  <div>
224
224
  <h3>Show</h3>
225
- <label class="ck"><input type="checkbox" id="kLines" checked><span>Lines</span><span class="ct" id="cLines">0</span></label>
226
- <label class="ck"><input type="checkbox" id="kCurves" checked><span>Curves</span><span class="ct" id="cCurves">0</span></label>
227
- <label class="ck"><input type="checkbox" id="kText" checked><span>Text</span><span class="ct" id="cText">0</span></label>
225
+ <label class="ck" data-command-id="vector.show-kind"><input type="checkbox" id="kLines" checked><span>Lines</span><span class="ct" id="cLines">0</span></label>
226
+ <label class="ck" data-command-id="vector.show-kind"><input type="checkbox" id="kCurves" checked><span>Curves</span><span class="ct" id="cCurves">0</span></label>
227
+ <label class="ck" data-command-id="vector.show-kind"><input type="checkbox" id="kText" checked><span>Text</span><span class="ct" id="cText">0</span></label>
228
228
  </div>
229
229
  <hr>
230
230
  <div>
@@ -234,13 +234,23 @@
234
234
  <hr>
235
235
  <div>
236
236
  <h3>Confidence</h3>
237
- <label class="ck" id="weakRow" hidden><input type="checkbox" id="weakOnly"><span>Isolate weak traces</span><span class="ct" id="cWeak">0</span></label>
237
+ <label class="ck" id="weakRow" data-command-id="vector.isolate-weak" hidden><input type="checkbox" id="weakOnly"><span>Isolate weak traces</span><span class="ct" id="cWeak">0</span></label>
238
238
  <div class="muted" id="revLine" hidden>Reviewed 0/0</div>
239
239
  <div id="weakList" hidden></div>
240
240
  <div class="muted" id="weakNote">No weak traces — traced exactly from the vector PDF (no AI involved).</div>
241
241
  </div>
242
242
  </aside>
243
243
  </div>
244
+ <!-- The Instructor seam. Classic, parser-inserted and BEFORE this page's own script on
245
+ purpose: classic scripts run synchronously in document order while modules are deferred, so
246
+ window.Commands is guaranteed to exist by the time anything below reads it.
247
+ The reporter tells the shell which surface is on screen (so the `?` sheet can put this
248
+ screen's commands first) and forwards `?`/F1 up, because a keydown inside an iframe never
249
+ reaches the shell's own handler. This surface arms nothing, so its snapshot is just its identity — see commands-vector.js. -->
250
+ <script src="commands.js"></script>
251
+ <script src="commands-vector.js"></script>
252
+ <script src="instructor-reporter.js"></script>
253
+ <script>window.InstructorReporter.mount({ surface: 'vector-editor' });</script>
244
254
  <script>
245
255
  (function () {
246
256
  'use strict';
@@ -424,6 +434,7 @@
424
434
  }
425
435
  for (const l of layers) {
426
436
  const lab = document.createElement('label'); lab.className = 'ck';
437
+ lab.setAttribute('data-command-id', 'vector.layer-toggle');
427
438
  const inp = document.createElement('input'); inp.type = 'checkbox'; inp.checked = true; inp.dataset.layer = l.name;
428
439
  inp.addEventListener('change', applyVisibility);
429
440
  const nm = document.createElement('span'); nm.textContent = l.name;
@@ -639,9 +650,11 @@
639
650
  lbl.addEventListener('click', () => locateOnCanvas(el.id));
640
651
  const pct = document.createElement('span'); pct.className = 'pct'; pct.textContent = Math.round((el.confidence || 0) * 100) + '%';
641
652
  const ok = document.createElement('button'); ok.className = 'ghost'; ok.textContent = 'Accept';
653
+ ok.setAttribute('data-command-id', 'vector.accept-trace');
642
654
  ok.dataset.tip = 'Mark this trace as correct — clears its low-confidence flag.';
643
655
  ok.addEventListener('click', () => acceptEl(el.id));
644
656
  const del = document.createElement('button'); del.className = 'danger'; del.textContent = 'Delete';
657
+ del.setAttribute('data-command-id', 'vector.delete-trace');
645
658
  del.dataset.tip = 'Remove this trace from the drawing (Undo available).';
646
659
  del.addEventListener('click', () => deleteEl(el.id));
647
660
  row.append(lbl, pct, ok, del); box.appendChild(row);
@@ -262,11 +262,6 @@
262
262
  sub: 'Turn steel drawings into a 3D model you can review and export.',
263
263
  label: 'Pick drawings',
264
264
  },
265
- // The "Copy from Workflows" card (kind:'current') lived here until #625. It was the
266
- // transitional bridge from the days when the model normally lived in the Workflows
267
- // pipeline view; with Workspaces now the primary entry point (#623) it was a third card
268
- // for a path most users never take. The server verb it drove (POST /api/projects with
269
- // `seedFromApp`) is deliberately LEFT INTACT — only the client's way in is gone.
270
265
  ],
271
266
  editor: '/steel-editor.html',
272
267
  filter: '/steel-filter.html',
@@ -1537,14 +1532,9 @@
1537
1532
  return res && typeof res.name === 'string' && res.name.trim() ? res.name.trim() : null;
1538
1533
  }
1539
1534
 
1540
- // `createSeeded` — the copy-the-open-Workflows-model create — lived here until #625 removed the one
1541
- // card that called it, along with the `seedLabel` wording it read and the rollback it ran when the
1542
- // app held nothing to copy (#489). The server verb it posted (`seedFromApp` on POST /api/projects)
1543
- // is untouched; git history has the client half if the card ever comes back.
1544
-
1545
1535
  // Drop-a-drawing create. No new server verb: create an EMPTY project, then fire the
1546
1536
  // existing revision pipeline (attachRevision) with the dropped file so the terminal AI reads it into
1547
- // v1. ROLLBACK on cancel/error — if the user cancels the name prompt, or the file can't be read,
1537
+ // the native model. ROLLBACK on cancel/error — if the user cancels the name prompt, or the file can't be read,
1548
1538
  // AFTER the row is created, archive the empty project so no dead, openable project is left
1549
1539
  // behind (the row is created before the source exists — spec §4.1).
1550
1540
  async function createFromDrawing(appId, templateId, files) {
@@ -1554,7 +1544,7 @@
1554
1544
  if (!name) return;
1555
1545
  let project;
1556
1546
  try {
1557
- ({ project } = await api('/api/projects', { method: 'POST', body: JSON.stringify({ name, app: appId, seedFromApp: false }) }));
1547
+ ({ project } = await api('/api/projects', { method: 'POST', body: JSON.stringify({ name, app: appId }) }));
1558
1548
  } catch (err) {
1559
1549
  showToast('Couldn’t create the project: ' + (err && err.message || err), 'warn');
1560
1550
  return;
@@ -1616,11 +1606,6 @@
1616
1606
  renderReadinessState = null;
1617
1607
  track('workspace_project_opened', { app: p.app }); // a real open (card click or post-create landing)
1618
1608
  resetRevisionState(); closeRevReview(); // fresh project — drop any prior revision state and any open review
1619
- // …and any open CONVERSION, for the same reason. The header project combo reaches `openProject`
1620
- // without going through `closeProject`, so switching projects under an open migrate modal would
1621
- // otherwise leave it on screen bound to `migState.projectId` — the project just navigated away
1622
- // from. Narrow (the backdrop covers the combo, so only an untrapped Tab reaches it) and the symmetry
1623
- // is the point: `closeRevReview` on the line above exists for exactly this.
1624
1609
  // Per-project, like everything above it: never let one project's answer describe another's. Not
1625
1610
  // observable today (every history render is preceded by a fetch that sets it, and a failed fetch
1626
1611
  // renders no rows), but leaving a stale cross-project value in place is the shape of bug this
@@ -2692,7 +2677,7 @@
2692
2677
  return '<section class="kb-col">' +
2693
2678
  `<div class="kb-head"><span>References</span><span class="h-end">${n ? `${n} source${n === 1 ? '' : 's'}` : ''}</span></div>` +
2694
2679
  '<div class="kb-refs-body">' +
2695
- '<button type="button" class="kb-drop" id="kb-drop" data-tip="Drop files here, or click to pick them">' +
2680
+ '<button type="button" class="kb-drop" id="kb-drop" data-command-id="shell.add-knowledge" data-tip="Drop files here, or click to pick them">' +
2696
2681
  '<span class="di" aria-hidden="true">⤓</span><span class="dt">Drop references here</span>' +
2697
2682
  '<span class="ds">PDF · images · text · CSV</span>' +
2698
2683
  '</button>' + body +
@@ -4399,7 +4384,7 @@
4399
4384
  // reaches them either. `aria-describedby` points at the reason already printed on the card.
4400
4385
  // The click handler refuses the action and speaks the reason instead.
4401
4386
  // Not applied to the un-approved state: that is the whole pane's condition, and the gate banner
4402
- // above the grid states it once with its own focusable Approve button (the #roRibbon pattern).
4387
+ // above the grid states it once with its own focusable Approve button.
4403
4388
  const softBlock = disabled && !busy && special && special.blockedBy;
4404
4389
  const dis = `${softBlock ? ` aria-disabled="true" aria-describedby="${escapeAttr(special.blockedBy)}"` : ''}` +
4405
4390
  `${disabled && !busy && !softBlock ? ' disabled' : ''}` +
@@ -5742,8 +5727,8 @@
5742
5727
  // worse than none.
5743
5728
  if (isGrid && obj(p.after)) {
5744
5729
  // AGAINST `{}` WHEN THE MODEL HAS NO GRID YET, which is a real state rather than a defensive
5745
- // flourish: `grid` is optional and nullable in v2 precisely so a migrated model can exist
5746
- // before anything builds one. Requiring `before` to be an object too sent that case to the
5730
+ // flourish: `grid` is optional and nullable, so a native model can exist before anything builds
5731
+ // one. Requiring `before` to be an object too sent that case to the
5747
5732
  // single-line branch, where `shortVal` truncates the whole arriving grid to ~57 characters —
5748
5733
  // the unreadable render this expansion exists to prevent, on the one proposal that installs
5749
5734
  // the entire grid. Every sub-key now shows as an arrival instead.
@@ -6419,8 +6404,8 @@
6419
6404
  // line below leaves this iframe at about:blank, so there is no editor document listening for
6420
6405
  // the contract-changed broadcast. After a rollback the server contract is the truth, so a local
6421
6406
  // draft can only put the user's pre-rollback edits back on top of the version they restored.
6422
- // Same origin, and the key is the one the editor builds from ?app=.
6423
- try { localStorage.removeItem('steeltakeoff:edits:v1:' + proj.app); } catch (_) { /* blocked storage */ }
6407
+ // Same origin, and the key matches the native editor's app/project/type-scoped draft.
6408
+ try { const k='steeltakeoff:edits:v2:' + encodeURIComponent(proj.app) + '|' + encodeURIComponent(proj.id) + '|steel.model%2Fv2';localStorage.removeItem(k);localStorage.removeItem(k+'|offered'); } catch (_) { /* blocked storage */ }
6424
6409
  showToast((started && started.message) || `Started a DRAFT from v${n}. Exports still default to the latest approved version.`, 'ok');
6425
6410
  // Reload the editor iframe so it shows the restored geometry (it fetched the contract on load).
6426
6411
  reloadModelFromServerTruth();
@@ -6449,7 +6434,7 @@
6449
6434
  method: 'POST',
6450
6435
  body: JSON.stringify({ expectedEtag: working.etag, expectedEpoch: working.epoch === null ? null : Number(working.epoch) }),
6451
6436
  });
6452
- try { localStorage.removeItem('steeltakeoff:edits:v1:' + proj.app); } catch (_) { /* blocked storage */ }
6437
+ try { const k='steeltakeoff:edits:v2:' + encodeURIComponent(proj.app) + '|' + encodeURIComponent(proj.id) + '|steel.model%2Fv2';localStorage.removeItem(k);localStorage.removeItem(k+'|offered'); } catch (_) { /* blocked storage */ }
6453
6438
  showToast('Resumed the exact saved DRAFT. Its original approved base is preserved.', 'ok');
6454
6439
  reloadModelFromServerTruth();
6455
6440
  await refreshApprovalState(proj.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.131.1",
3
+ "version": "0.132.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": {
@@ -32,6 +32,7 @@
32
32
  "verify:aisc": "node build/verify-aisc-table.mjs",
33
33
  "verify:flo-naming": "node build/verify-flo-naming.mjs",
34
34
  "verify:no-title": "node build/verify-no-title.mjs",
35
+ "verify:native-steel": "node build/verify-native-steel.mjs",
35
36
  "verify:no-native-select": "node build/verify-no-native-select.mjs",
36
37
  "verify:scrollbars": "node build/verify-scrollbars.mjs",
37
38
  "verify:flo-report-scrollbars": "node build/verify-flo-report-scrollbars.mjs",
@@ -46,6 +47,13 @@
46
47
  "verify:no-agent-trailer": "node build/verify-no-agent-trailer.mjs",
47
48
  "verify:app-publication": "node build/verify-app-publication-writers.mjs",
48
49
  "verify:guards-wired": "node build/verify-guards-wired.mjs",
50
+ "verify:command-registry": "node build/verify-command-registry.mjs",
51
+ "verify:instructor-coverage": "node build/verify-instructor-coverage.mjs",
52
+ "verify:instructor-steps": "node build/verify-instructor-steps.mjs",
53
+ "verify:no-echo": "node build/verify-no-echo.mjs",
54
+ "verify:instructor-wired": "node build/verify-instructor-wired.mjs",
55
+ "verify:carrier-escaping": "node build/verify-instructor-carrier-escaping.mjs",
56
+ "verify:producer-purity": "node build/verify-producer-purity.mjs",
49
57
  "verify:claim-lock": "node ../tools/routine-claim.mjs selftest",
50
58
  "typecheck": "tsc --noEmit",
51
59
  "prepack": "npm run build",