@floless/app 0.139.1 → 0.141.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.
Files changed (41) hide show
  1. package/dist/floless-server.cjs +32765 -36490
  2. package/dist/skills/floless-app-steel-takeoff/SKILL.md +8 -3
  3. package/dist/skills/floless-app-vectorize/SKILL.md +1 -1
  4. package/dist/skills/floless-app-vectorize/scripts/extract_pdf.py +7 -1
  5. package/dist/skills/floless-app-vectorize/scripts/vision_to_contract.py +7 -1
  6. package/dist/web/app.css +163 -3
  7. package/dist/web/aware.js +657 -66
  8. package/dist/web/chat.css +387 -25
  9. package/dist/web/chat.js +2005 -108
  10. package/dist/web/commands-filter.js +86 -8
  11. package/dist/web/commands-revit.js +2 -1
  12. package/dist/web/commands-shell.js +249 -13
  13. package/dist/web/commands-steel.js +34 -24
  14. package/dist/web/commands.js +19 -0
  15. package/dist/web/filter-ai-context.js +57 -0
  16. package/dist/web/filter-ai-proposal.js +87 -0
  17. package/dist/web/filter-guidance.js +8 -0
  18. package/dist/web/index.html +72 -11
  19. package/dist/web/instructor.js +231 -33
  20. package/dist/web/left-pane.js +185 -18
  21. package/dist/web/local-discovery.js +297 -0
  22. package/dist/web/model-editor-revit-adapter.js +3 -1
  23. package/dist/web/model-editor-steel-adapter.js +3 -1
  24. package/dist/web/model-editor.css +4 -4
  25. package/dist/web/model-revit-module.js +63 -0
  26. package/dist/web/model-viewport-toolbar.js +13 -1
  27. package/dist/web/model-viewport.js +16 -1
  28. package/dist/web/overlay-escape.js +79 -0
  29. package/dist/web/revit-editor.css +7 -0
  30. package/dist/web/revit-editor.html +5 -5
  31. package/dist/web/revit-editor.js +20 -10
  32. package/dist/web/steel-detail-refs.js +0 -69
  33. package/dist/web/steel-editor.html +103 -264
  34. package/dist/web/steel-filter-core.js +298 -12
  35. package/dist/web/steel-filter-hit.js +526 -0
  36. package/dist/web/steel-filter.html +1647 -75
  37. package/dist/web/steel-split-view.js +1 -1
  38. package/dist/web/vector-3d.html +3 -0
  39. package/dist/web/vector-editor.html +9 -1
  40. package/dist/web/workspaces.js +198 -25
  41. package/package.json +5 -2
@@ -115,7 +115,7 @@
115
115
  #m3dAxes,.model-world-axes-host,.model-axis-triad-host{position:absolute;right:15px;bottom:12px;width:78px;height:78px;z-index:8;pointer-events:none;filter:drop-shadow(0 6px 14px rgba(0,0,0,.5))}
116
116
  .model-view-cube-host canvas,#m3dCube canvas,.model-world-axes-host canvas,.model-axis-triad-host canvas,#m3dAxes canvas{display:block;width:100%;height:100%}
117
117
  .model-view-cube-host canvas:focus-visible,#m3dCube canvas:focus-visible{outline:2px solid var(--brand,var(--accent,#60a5fa));outline-offset:3px;border-radius:8px}
118
- .model-orientation-status,.model-view-cube-status{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
118
+ .model-view-cube-status{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
119
119
 
120
120
  .model-clip-list{border-top:1px solid var(--line);margin-top:8px;padding-top:4px}.model-clip-list-header{height:30px;display:flex;align-items:center;gap:7px;padding:0 5px;color:var(--text)}.model-clip-list-header strong{font-size:11px;text-transform:uppercase;letter-spacing:.08em}.model-clip-count{min-width:18px;height:18px;display:grid;place-items:center;border-radius:9px;background:var(--btn);color:var(--muted);font-size:10px}.model-clip-enable-all{width:24px;min-width:24px;min-height:24px;padding:0;border:0;background:transparent;color:var(--muted);box-shadow:none}.model-clip-enable-all[data-state="on"]{color:var(--brand,#60a5fa)}.model-clip-enable-all[data-state="mixed"]{color:#64748b}.model-clip-clear{margin-left:auto}.model-clip-list-rows{display:grid;gap:2px}.model-clip-row{min-height:30px;display:grid;grid-template-columns:24px minmax(0,1fr) 24px;align-items:center;gap:4px;border-radius:5px;padding:2px 3px}.model-clip-row:hover,.model-clip-row.is-selected{background:var(--accent-soft)}.model-clip-row.is-selected{outline:1px solid color-mix(in srgb,var(--brand,#3b82f6) 58%,transparent)}.model-clip-row button{min-width:0;min-height:24px;padding:2px 5px;border:0;background:transparent;color:var(--muted);box-shadow:none}.model-clip-row button:hover{background:var(--btn-hover);color:var(--text)}.model-clip-enable{width:22px;border:1px solid var(--line)!important;color:var(--brand,#60a5fa)!important}.model-clip-enable[aria-pressed="false"]{color:transparent!important}.model-clip-label{text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)!important}.model-clip-remove{font-size:16px;line-height:1}.model-clip-rename{width:100%;min-width:0;height:25px;border:1px solid var(--brand,#3b82f6);border-radius:4px;background:var(--bg,#020817);color:var(--text);padding:2px 6px;font:inherit;outline:none}.model-clip-list-empty{padding:10px 7px 12px;color:var(--muted);font-size:11px;line-height:1.45}.model-clip-drag-readout{position:fixed;z-index:60;pointer-events:none;padding:5px 9px;border:1px solid var(--line);border-radius:5px;background:var(--panel);color:var(--text);box-shadow:0 3px 10px rgba(0,0,0,.45);font:11px var(--mono,monospace)}
121
121
 
@@ -130,7 +130,7 @@
130
130
  .model-inspector-toggle{position:absolute;right:calc(var(--panelw,240px) - 5px);top:50%;transform:translateY(-50%);z-index:12;width:11px;height:var(--grip-h,32px);min-width:0;min-height:0;padding:0;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--text-dim,var(--muted)) 60%,var(--btn-hover,#22324a));border:0;border-radius:5px;box-shadow:none;line-height:1;color:var(--text);transition:right .26s cubic-bezier(.2,.6,.2,1)}
131
131
  .model-inspector-toggle:hover{background:var(--brand,var(--accent,#60a5fa));color:#fff}
132
132
  .model-inspector-toggle svg{width:13px;height:13px;display:block;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;transition:transform .15s ease}
133
- .model-editor-shell.panel-layout,.editor-root.model-editor-shell{position:relative;grid-template-columns:minmax(0,1fr) 11px var(--panelw,240px) 0}
133
+ .editor-root.model-editor-shell{position:relative;grid-template-columns:minmax(0,1fr) 11px var(--panelw,240px) 0}
134
134
  body.panel-collapsed .model-inspector-resizer{pointer-events:none;cursor:default;width:0}
135
135
  body.panel-collapsed .model-inspector-panel{width:0!important;padding:0;overflow:hidden;border-left-width:0}
136
136
  body.panel-collapsed .model-inspector-stub{width:var(--pane-collapsed,36px)}
@@ -167,7 +167,7 @@ body:has(.model-inspector-resizer.drag) .model-inspector-panel,body:has(.model-i
167
167
  /* Shared model-space dimension and acquisition overlay. Providers supply points; this presentation,
168
168
  including witness lines, ticks, reticle and acquired-target readout, is identical in every module. */
169
169
  .measure-armed{cursor:crosshair}
170
- #modelDimensionOverlay,.model-dimension-overlay-host{position:absolute;inset:0;z-index:9;pointer-events:none}
170
+ #modelDimensionOverlay{position:absolute;inset:0;z-index:9;pointer-events:none}
171
171
  .model-dim-overlay{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
172
172
  .dimension-mark line,.dimension-preview line{stroke:#60a5fa;stroke-width:1.5;vector-effect:non-scaling-stroke}
173
173
  .dimension-preview line{stroke-dasharray:5 4;opacity:.82}
@@ -186,7 +186,7 @@ body:has(.model-inspector-resizer.drag) .model-inspector-panel,body:has(.model-i
186
186
  .model-dimension-editor>strong{font-size:12px;letter-spacing:.07em;text-transform:uppercase}
187
187
  .model-dimension-choice{display:grid;grid-template-columns:72px repeat(5,minmax(34px,1fr));gap:4px;align-items:center}
188
188
  .model-dimension-choice>span{color:var(--mut,var(--muted));font-size:10px;text-transform:uppercase}
189
- .model-dimension-choice button,.model-dimension-editor-actions button{min-height:28px;padding:3px 7px;background:var(--btn,var(--panel2));border:1px solid var(--line);border-radius:5px;color:var(--text);font:inherit}
189
+ .model-dimension-choice button,.model-dimension-editor-actions button{min-height:28px;padding:3px 7px;background:var(--btn,var(--panel-2,#172235));border:1px solid var(--line);border-radius:5px;color:var(--text);font:inherit}
190
190
  .model-dimension-choice button.on{background:var(--brand,var(--accent,#60a5fa));border-color:var(--brand,var(--accent,#60a5fa));color:#0f172a}
191
191
  .model-dimension-choice button:focus-visible,.model-dimension-editor-actions button:focus-visible{outline:2px solid var(--brand,var(--accent,#60a5fa));outline-offset:1px}
192
192
  .model-dimension-editor-actions{display:flex;justify-content:flex-end;gap:6px;padding-top:2px}
@@ -81,3 +81,66 @@ export function revitPropertyEncodingLabel(row) {
81
81
  // V1 snapshots predate the explicit discriminator and are source-semantic by contract.
82
82
  return row?.storageType ? `Source ${row.storageType}` : 'Imported value';
83
83
  }
84
+
85
+ /**
86
+ * The revision the editor opens first: the working draft, else the approved model, else none.
87
+ * None is an ordinary state (a project whose RVT is importing, never finished importing, or was
88
+ * never added), so the caller renders an empty state instead of treating it as a failure (#1522).
89
+ */
90
+ export function revitInitialAuthority(state) {
91
+ if (state?.draft) return 'draft';
92
+ if (state?.approved) return 'approved';
93
+ return null;
94
+ }
95
+
96
+ /**
97
+ * Plain-English copy for a Revit project with no model to show. Returns null when the project is
98
+ * not in a known no-model state: it has a revision, or it records a published source with no
99
+ * revision behind it, which is inconsistent and must stay a loud failure, not a calm message.
100
+ * Nothing in the editor refreshes on its own, so no copy may promise that the view will update.
101
+ */
102
+ export function revitNoModelCopy(state) {
103
+ if (!state || revitInitialAuthority(state)) return null;
104
+ const pending = typeof state.pendingSource?.filename === 'string' && state.pendingSource.filename.trim()
105
+ ? state.pendingSource.filename : null;
106
+ if (pending && state.importing === true) {
107
+ return {
108
+ kind: 'importing', title: 'Your model is still importing',
109
+ body: `FloLess is converting ${pending} into a model you can view. When the import finishes, open the Model tab again to see it.`,
110
+ };
111
+ }
112
+ // Not running covers a failed or cancelled import and the moment before one is recorded, so the
113
+ // copy claims only what is certain: no model has been made from this RVT yet.
114
+ if (pending) {
115
+ return {
116
+ kind: 'import-unfinished', title: 'No model from this RVT yet',
117
+ body: `${pending} was added to this project, but no model has been made from it yet. Open the Source tab to see how its import went, then try the import again or choose another RVT if it did not finish.`,
118
+ };
119
+ }
120
+ if (state.source) return null;
121
+ return {
122
+ kind: 'no-source', title: 'No Revit model yet',
123
+ body: 'This project has no RVT file yet. Add one on the Source tab; once it is imported, the model opens here.',
124
+ };
125
+ }
126
+
127
+ const SVG_NS = 'http://www.w3.org/2000/svg';
128
+ /**
129
+ * Render the no-model state into the viewport's status overlay: a muted outline cube, a title and
130
+ * the explanation, with no spinner, because nothing is loading here.
131
+ */
132
+ export function renderRevitNoModelState(host, copy, doc = host.ownerDocument) {
133
+ host.replaceChildren();
134
+ host.dataset.state = copy.kind;
135
+ host.setAttribute('role', 'status');
136
+ host.classList.add('viewport-state-empty');
137
+ const icon = doc.createElementNS(SVG_NS, 'svg');
138
+ icon.setAttribute('viewBox', '0 0 24 24'); icon.setAttribute('aria-hidden', 'true'); icon.setAttribute('class', 'viewport-state-icon');
139
+ for (const d of ['M12 3 20 7.5v9L12 21l-8-4.5v-9L12 3Z', 'M4 7.5 12 12l8-4.5', 'M12 12v9']) {
140
+ const path = doc.createElementNS(SVG_NS, 'path'); path.setAttribute('d', d); icon.append(path);
141
+ }
142
+ const title = doc.createElement('strong'); title.textContent = copy.title;
143
+ const body = doc.createElement('span'); body.textContent = copy.body;
144
+ host.append(icon, title, body);
145
+ host.style.display = 'flex';
146
+ }
@@ -286,6 +286,18 @@ export function mountToolbarChrome({ toolbar, getItems = defaultItems, port = nu
286
286
  const menuTrigger = (menu) => menu.parentElement?.querySelector(':scope > button') ?? null;
287
287
  const enabledMenuItems = (menu) => [...menu.querySelectorAll('button:not(:disabled),input:not(:disabled)')]
288
288
  .filter((item) => item.offsetParent !== null);
289
+ // Keyboard-opening lands on the RADIO row that is currently chosen (a menu's exclusive choice —
290
+ // the display mode, or the plane kind in Plane), and on the first row otherwise. Reading `[0]`
291
+ // unconditionally was only right while the checked default happened to sit first; once Solid moved
292
+ // to the middle of the display-mode ramp (#1427) it would have dropped a keyboard user on Wire every
293
+ // time. The role check matters: a `toggle` row is `menuitemcheckbox` and ALSO carries
294
+ // `aria-checked`, and an on toggle is a setting, not the current choice — the Labels menu keeps its
295
+ // property-labels switch on in row 2, and opening that menu must still land on row 1.
296
+ const initialMenuItem = (menu) => {
297
+ const items = enabledMenuItems(menu);
298
+ return items.find((item) => item.getAttribute('role') === 'menuitemradio' && item.getAttribute('aria-checked') === 'true')
299
+ ?? items[0] ?? null;
300
+ };
289
301
  const closeMenu = (menu, restoreFocus = false) => {
290
302
  menu.classList.remove('open'); syncExpanded();
291
303
  if (restoreFocus) menuTrigger(menu)?.focus();
@@ -313,7 +325,7 @@ export function mountToolbarChrome({ toolbar, getItems = defaultItems, port = nu
313
325
  if (!['ArrowDown', 'Enter', ' '].includes(event.key)) return;
314
326
  event.preventDefault(); event.stopPropagation();
315
327
  if (!menu.classList.contains('open')) { closeOrdinaryMenus(menu); menu.classList.add('open'); syncExpanded(); }
316
- enabledMenuItems(menu)[0]?.focus();
328
+ initialMenuItem(menu)?.focus();
317
329
  });
318
330
  listenOrdinary(menu, 'keydown', (event) => {
319
331
  if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); closeMenu(menu, true); return; }
@@ -332,6 +332,18 @@ export function createModelViewportController(options) {
332
332
  if (!surface || disposed) return;
333
333
  const size = platform.measureSurface(surface);
334
334
  adapter.resize?.(immutable(size));
335
+ // Paint at the new size NOW, in the same task, rather than leaving that to the next loop frame (#1416).
336
+ // The browser delivers a ResizeObserver notification after a frame's animation callbacks and before
337
+ // that frame paints, so during a shell pane drag the loop had already drawn at the OLD size when this
338
+ // ran — and resizing a WebGL drawing buffer clears it, so what reached the screen on every drag tick
339
+ // was a blank canvas: measured on the real app shell, 88 handle moves → 88 buffer resizes, none of them
340
+ // followed by a draw before the next frame. That is the flicker. The loop still runs on its own
341
+ // schedule; this only guarantees that no frame ends on a freshly cleared buffer. Same gates as the
342
+ // loop: a hidden viewport, or one whose camera has never been framed, must not paint from here either.
343
+ if (state.shown && state.frameAllowed) {
344
+ const time = clock();
345
+ adapter.beforeRender(time); adapter.render(time); adapter.afterRender(time);
346
+ }
335
347
  };
336
348
  const scheduleLoop = () => {
337
349
  if (loopFrame !== null || disposed || !state.shown) return;
@@ -434,7 +446,10 @@ export function createModelViewportController(options) {
434
446
  show() {
435
447
  ensureLive(); if (!mounted) fail('E_VIEWPORT_NOT_READY', 'viewport is not initialized');
436
448
  state = transitionViewportState(state, { type: 'show' });
437
- paint(state.frameAllowed); adapter.show(); resize(); scheduleLoop(); return api;
449
+ // The loop is armed BEFORE the sizing pass, because resize() now paints (#1416) and a paint may
450
+ // throw: frame() schedules its successor before it renders for exactly this reason, and show()
451
+ // must not be the one place a throwing render leaves a shown viewport with no loop at all.
452
+ paint(state.frameAllowed); adapter.show(); scheduleLoop(); resize(); return api;
438
453
  },
439
454
  hide() {
440
455
  ensureLive(); if (!mounted) return api;
@@ -0,0 +1,79 @@
1
+ /* ──────────────────────────────────────────────────────────────────────────
2
+ Esc from inside a page the shell shows in its full-window overlay (#1571).
3
+
4
+ The shell's editor overlay (#contract-editor in index.html) hosts one of
5
+ these pages in an iframe. A keydown inside an iframe never reaches the
6
+ shell's own document, so without this Esc could close the overlay only
7
+ while focus sat on the overlay's own bar — and a user who has just been
8
+ working in the editor has focus in here.
9
+
10
+ The rule is a LADDER whose last rung is "close": Esc is the page's first.
11
+ It cancels a tool, closes a menu or modal, drops a pick, clears the
12
+ selection — and only an Esc that NOTHING in the page used goes up to the
13
+ shell, which closes the overlay through the same path as its Close button
14
+ (so the Drawing Filter's unsaved-changes question still asks).
15
+
16
+ "Nothing used it" is read from the event, not re-derived here:
17
+ • a handler that consumed it and stopped propagation never lets it reach
18
+ the window-level listener below, and
19
+ • a handler that consumed it and let it bubble calls preventDefault(),
20
+ which is the page's contract for "this Esc was mine". The read happens
21
+ in a macrotask, after the WHOLE dispatch, so a window listener bound
22
+ after this one (the 3D view binds its own inside init()) is heard too.
23
+ A page whose Esc handlers act without either (the steel editor's own
24
+ ladder) marks them with OverlayEscape.markUsed(e) instead — a mark only
25
+ this forwarder reads. preventDefault() would be read by the page's OTHER
26
+ listeners too (the 3D view skips a prevented key), so it would change what
27
+ that Esc does inside the page; markUsed changes nothing but this.
28
+
29
+ Esc while typing into a text field never closes the overlay: there, Esc
30
+ belongs to the field (revert the value, leave the field), even when the
31
+ field has no handler of its own.
32
+
33
+ The shell decides whether the overlay is open and whether THIS window is the
34
+ one it is showing — the same page embedded anywhere else (a workspace step)
35
+ gets `false` back and nothing happens.
36
+ ────────────────────────────────────────────────────────────────────────── */
37
+ (function () {
38
+ 'use strict';
39
+
40
+ function typingInto(t) {
41
+ if (!t) return false;
42
+ if (t.isContentEditable) return true;
43
+ if (t.tagName === 'TEXTAREA' || t.tagName === 'SELECT') return true;
44
+ if (t.tagName !== 'INPUT') return false;
45
+ // A checkbox, radio, button or range has no text to revert: Esc on one is not "typing".
46
+ return !/^(checkbox|radio|button|submit|reset|range|color|file|image)$/i.test(t.type || '');
47
+ }
48
+
49
+ /**
50
+ * @param {object} [opts]
51
+ * @param {function} [opts.idle] page-local veto, read after the dispatch: return false while the page
52
+ * has something Esc should act on that its handlers do not mark. Must not throw
53
+ * on a half-torn-down page (a throw counts as "not idle").
54
+ */
55
+ // Esc events a page handler used without preventDefault(). Weak, so a mark never outlives its event.
56
+ var used = typeof WeakSet === 'function' ? new WeakSet() : null;
57
+ function markUsed(e) { if (used && e && typeof e === 'object') used.add(e); }
58
+
59
+ function mount(opts) {
60
+ var idle = opts && typeof opts.idle === 'function' ? opts.idle : null;
61
+ function onKey(e) {
62
+ if (e.key !== 'Escape' || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey || e.isComposing || e.repeat) return;
63
+ if (e.defaultPrevented || typingInto(e.target)) return;
64
+ setTimeout(function () {
65
+ if (e.defaultPrevented || (used && used.has(e))) return;
66
+ if (idle) { var ok = false; try { ok = idle() === true; } catch (err) { ok = false; } if (!ok) return; }
67
+ try {
68
+ if (window.parent && window.parent !== window && typeof window.parent.__floOverlayEscape === 'function') {
69
+ window.parent.__floOverlayEscape(window);
70
+ }
71
+ } catch (err) { /* cross-origin or torn-down parent */ }
72
+ }, 0);
73
+ }
74
+ window.addEventListener('keydown', onKey);
75
+ return { dispose: function () { window.removeEventListener('keydown', onKey); } };
76
+ }
77
+
78
+ window.OverlayEscape = { mount: mount, markUsed: markUsed, typingInto: typingInto };
79
+ })();
@@ -30,6 +30,13 @@ body.model-panel-host{display:flex;flex-direction:column;background:var(--panel)
30
30
  .model-selection-filter-flyout{position:fixed;z-index:95;width:286px;max-height:min(430px,60vh);display:flex;flex-direction:column;padding:8px;background:var(--panel);border:1px solid var(--line-strong);border-radius:8px;box-shadow:var(--shadow)}.model-filter-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:7px}.model-filter-actions{display:flex;gap:4px}.model-filter-actions button{min-height:25px;padding:2px 7px;font-size:10px}.model-selection-filter-flyout>input{width:100%;min-height:31px;padding:5px 8px;color:var(--text);background:var(--bg);border:1px solid var(--line);border-radius:6px;font:inherit}.model-selection-filter-flyout>input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.model-filter-list{min-height:44px;margin-top:7px;overflow:auto;border-top:1px solid var(--line);padding-top:5px}.model-filter-option{display:flex;align-items:center;gap:5px;min-height:29px;padding:4px 5px;border-radius:5px;cursor:pointer}.model-filter-option:hover{background:var(--accent-soft)}.model-filter-option span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;unicode-bidi:plaintext}
31
31
  .model-spatial-dialog{position:fixed;z-index:96;width:min(360px,calc(100vw - 24px));max-height:min(520px,75vh);display:flex;flex-direction:column;gap:8px;padding:11px;background:var(--panel);border:1px solid var(--line-strong);border-radius:9px;box-shadow:var(--shadow)}.model-spatial-dialog-header{display:flex;align-items:center;justify-content:space-between;gap:8px}.model-spatial-dialog input{width:100%;min-height:32px;padding:6px 8px;color:var(--text);background:var(--bg);border:1px solid var(--line);border-radius:6px;font:inherit}.model-spatial-dialog input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.model-spatial-dialog-actions{display:flex;justify-content:flex-end;gap:5px}.model-saved-view-list{display:grid;gap:4px;overflow:auto;min-height:42px;border-top:1px solid var(--line);padding-top:7px}.model-saved-view-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px}.model-saved-view-row>button:first-child{text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.model-dialog-note{color:var(--muted);font-size:11px}
32
32
  .viewport-state{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;text-align:center;background:rgba(8,13,24,.72);z-index:20}.viewport-state span:last-child{color:var(--muted)}.state-spinner{width:24px;height:24px;border:2px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}
33
+ /* No revision to open yet (#1522): the viewport keeps its scrim and says why, and the model-only chrome steps aside. */
34
+ .viewport-state-empty{gap:6px;padding:24px}.viewport-state-empty .viewport-state-icon{width:32px;height:32px;margin-bottom:6px;fill:none;stroke:var(--muted);stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}.viewport-state-empty strong{font-size:14px;font-weight:600;color:var(--text)}.viewport-state-empty span{max-width:42ch;color:var(--muted)}
35
+ .editor-root[data-model-state="empty"].model-editor-shell,.editor-root[data-model-state="empty"]{grid-template-columns:minmax(0,1fr)}
36
+ /* Hidden by position, not by name: everything beside the viewport (the Properties column) and everything in it but the
37
+ status. The shared chrome stays styled only by model-editor.css (model-editor-shell.test.ts). */
38
+ .editor-root[data-model-state="empty"]>:not(.model-stage),.editor-root[data-model-state="empty"]>.model-stage>:not(#loadingState){display:none}
39
+ body:has(.editor-root[data-model-state="empty"]) .read-only-chip{display:none}
33
40
  #toast{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);padding:8px 12px;border:1px solid var(--line);border-radius:7px;background:var(--panel);box-shadow:var(--shadow);opacity:0;pointer-events:none;z-index:90;transition:opacity .15s}#toast.show{opacity:1}
34
41
  #tooltip{position:fixed;z-index:100;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}#tooltip.show{opacity:1}
35
42
  @media(max-width:820px){:root{--panelw:280px}.authority-kicker,.source-name{display:none}}
@@ -53,15 +53,15 @@
53
53
  <span>Reading the signed snapshot package.</span>
54
54
  </div>
55
55
  </section>
56
- <div id="inspectorResizer" class="inspector-resizer model-inspector-resizer" role="separator" tabindex="0" aria-label="Resize Inspector" aria-orientation="vertical" data-tip="Drag to resize · double-click to reset"></div>
57
- <aside id="inspectorPanel" class="inspector-panel model-inspector-panel" aria-label="Inspector">
56
+ <div id="inspectorResizer" class="inspector-resizer model-inspector-resizer" role="separator" tabindex="0" aria-label="Resize properties panel" aria-orientation="vertical" data-tip="Drag to resize · double-click to reset"></div>
57
+ <aside id="inspectorPanel" class="inspector-panel model-inspector-panel" aria-label="Properties">
58
58
  <div class="panel-heading inspector-heading">
59
- <strong>Inspector</strong>
59
+ <strong>Properties</strong>
60
60
  </div>
61
61
  <div id="inspectorBody" class="inspector-body"></div>
62
62
  </aside>
63
- <div id="inspectorStub" class="model-inspector-stub" aria-hidden="true"><span class="vertical-label">Inspector</span></div>
64
- <button id="inspectorToggle" class="model-inspector-toggle" type="button" data-command-id="revit.inspector-toggle" data-tip="Collapse Inspector" aria-label="Collapse Inspector" aria-controls="inspectorPanel" aria-expanded="true"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m6 3 5 5-5 5"/></svg></button>
63
+ <div id="inspectorStub" class="model-inspector-stub" aria-hidden="true"><span class="vertical-label">Properties</span></div>
64
+ <button id="inspectorToggle" class="model-inspector-toggle" type="button" data-command-id="revit.inspector-toggle" data-tip="Collapse Properties" aria-label="Collapse Properties" aria-controls="inspectorPanel" aria-expanded="true"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m6 3 5 5-5 5"/></svg></button>
65
65
  </main>
66
66
  <div id="toast" role="status" aria-live="polite"></div>
67
67
  <script src="commands.js"></script>
@@ -5,7 +5,7 @@ import { mountModelLightingPanel } from './model-viewport-lighting.js';
5
5
  import { createRevitEditorAdapter, revitRenderPlan } from './model-editor-revit-adapter.js';
6
6
  import {
7
7
  buildRevitClassificationTree, filterRevitPropertyGroups, groupRevitProperties,
8
- revitExplorerTabs, revitPropertyEncodingLabel,
8
+ renderRevitNoModelState, revitExplorerTabs, revitInitialAuthority, revitNoModelCopy, revitPropertyEncodingLabel,
9
9
  } from './model-revit-module.js';
10
10
  import { createRevitViewport } from './model-viewport-revit-adapter.js';
11
11
  import { mountModelOrientationOverlay } from './model-orientation-overlay.js';
@@ -658,11 +658,11 @@ const revitClipListHost = $('revitClipListHost');
658
658
  const revitPanelHost = createPanelHost({ win: window, root: $('revitPanelTabs'), bodies: { clips: revitClipListHost }, install: installTooltips });
659
659
 
660
660
  function mountPanels() {
661
- inspector = mountInspectorShell({ panel: $('inspectorBody'), doc: document, win: window, placement: 'docked', readOnly: true, emptyMessage: 'Select an object to inspect its imported Revit properties.' });
662
- mountSidePanel({ panel: $('inspectorPanel'), resizer: $('inspectorResizer'), toggle: $('inspectorToggle'), root: $('editorRoot'), doc: document, win: window, widthKey: 'floless:revit:inspector-width', collapsedKey: 'floless:revit:inspector-collapsed' });
661
+ inspector = mountInspectorShell({ panel: $('inspectorBody'), doc: document, win: window, placement: 'docked', readOnly: true, emptyMessage: 'Select an object to see its imported properties.' });
662
+ mountSidePanel({ panel: $('inspectorPanel'), resizer: $('inspectorResizer'), toggle: $('inspectorToggle'), root: $('editorRoot'), doc: document, win: window, widthKey: 'floless:revit:inspector-width', collapsedKey: 'floless:revit:inspector-collapsed', label: (collapsed) => (collapsed ? 'Expand Properties' : 'Collapse Properties') });
663
663
  modelPanelBridge = createModelPanelBridge({
664
664
  win: window, origin: location.origin, snapshot: modelPanelSnapshot, selectedId: () => selectedId, selectedIds: () => [...selectedIds],
665
- // ids: what a list click selects (Ctrl/Shift can make it several, or none). The Inspector shows the row clicked
665
+ // ids: what a list click selects (Ctrl/Shift can make it several, or none). The Properties panel shows the row clicked
666
666
  // when it stays selected, else the last one; the viewport shows them all.
667
667
  select: (id, ids = [id]) => {
668
668
  if (!ids.every((each) => entityById.has(each))) return false;
@@ -753,7 +753,7 @@ function mountSharedModelTools() {
753
753
  }
754
754
 
755
755
  function authorityButtons(state) {
756
- const host = $('authorityChoices'); host.replaceChildren(); const available = ['draft', 'approved'].filter((key) => state[key]); const initial = state.draft ? 'draft' : 'approved';
756
+ const host = $('authorityChoices'); host.replaceChildren(); const available = ['draft', 'approved'].filter((key) => state[key]); const initial = revitInitialAuthority(state);
757
757
  window.__revitInstructorState = { ...(window.__revitInstructorState || {}), authority: initial };
758
758
  for (const key of available) { const button = document.createElement('button'); button.type = 'button'; button.dataset.commandId = 'revit.authority'; button.dataset.commandInstanceLabel = key; button.textContent = key === 'draft' ? 'Working model' : 'Approved model'; button.setAttribute('aria-pressed', String(key === initial)); button.addEventListener('click', async () => { if (button.getAttribute('aria-pressed') === 'true') return; try { if (!await loadRevision(state, key)) return; await activateSpatialForRevision(state, state[key]); host.querySelectorAll('button').forEach((item) => item.setAttribute('aria-pressed', String(item === button))); window.__revitInstructorState = { ...(window.__revitInstructorState || {}), authority: key }; window.__instructor?.notifyChanged(); } catch (error) { toast(error.message); } }); host.append(button); }
759
759
  return initial;
@@ -767,6 +767,21 @@ async function boot() {
767
767
  orientation: $('modelViewCube'), axes: $('modelWorldAxes'), explorer: $('modelExplorer'),
768
768
  pointerDock: $('modelBottomDock'), inspector: $('inspectorPanel'), statusHud: $('modelSpatialHud'),
769
769
  });
770
+ window.__revitInstructorState = { selected: selectedId, authority: null };
771
+ // Read the project before creating any WebGL context: a project with no revision yet (its RVT is
772
+ // importing, stopped importing, or was never added) is an ordinary state with nothing to render.
773
+ await json('/api/editor/session', { method: 'POST' });
774
+ const state = (await json(`/api/editor/revit-projects/${encodeURIComponent(projectId)}`)).state;
775
+ $('modelName').textContent = state.projectName || projectId;
776
+ $('sourceName').textContent = state.source?.filename || state.pendingSource?.filename || 'No RVT source';
777
+ if (!revitInitialAuthority(state)) {
778
+ const copy = revitNoModelCopy(state);
779
+ // A published source with no revision behind it is not one of the ordinary states: stay loud.
780
+ if (!copy) throw new Error('This project lists an RVT file, but no model was saved from it, so there is nothing to open. On the Source tab, choose the RVT again to rebuild the model.');
781
+ $('editorRoot').dataset.modelState = 'empty';
782
+ renderRevitNoModelState($('loadingState'), copy);
783
+ return;
784
+ }
770
785
  mountPanels();
771
786
  viewport = createRevitViewport({ canvas: $('modelCanvas'),
772
787
  // A big model takes a few seconds to convert, and the first moment shows nothing happening
@@ -786,12 +801,7 @@ async function boot() {
786
801
  // every mode, so reading it reports a picture the user is not looking at.
787
802
  outline: () => viewport.outlineState?.() ?? null,
788
803
  realistic: () => viewport.realisticState?.() ?? null };
789
- window.__revitInstructorState = { selected: selectedId, authority: null };
790
- await json('/api/editor/session', { method: 'POST' });
791
- const state = (await json(`/api/editor/revit-projects/${encodeURIComponent(projectId)}`)).state;
792
804
  projectContract = await json(`/api/contract/revit-model?project=${encodeURIComponent(projectId)}&quietMissing=1`);
793
- $('modelName').textContent = state.projectName || projectId;
794
- $('sourceName').textContent = state.source?.filename || 'No RVT source';
795
805
  const authority = authorityButtons(state); await loadRevision(state, authority); await activateSpatialForRevision(state, state[authority]); mountSharedModelTools();
796
806
  const releasePointerCoordinates = viewport.onPointerWorld((renderPoint) => {
797
807
  if (!renderPoint || !spatialTools) { $('modelCursorCoordinates').textContent = 'X — · Y — · Z — mm'; return; }
@@ -220,75 +220,6 @@ export function planProfileLabelOverlay(plan, filter, options = {}) {
220
220
  };
221
221
  }
222
222
 
223
- /**
224
- * Callout kinds that are NOT details for scoring purposes.
225
- *
226
- * A section or an elevation is a more GENERAL drawing than a detail — it is a cut or a face of the
227
- * structure, and it typically carries detail callouts of its own rather than being one. So the
228
- * confidence report should not score it as a detail. (Product call, 2026-07-24, answering the question
229
- * #401 was opened to ask.)
230
- *
231
- * Denying these two is the exact complement of `detail-ref`: the schema's callout enum is
232
- * section | elevation | detail-ref and nothing else, and every writeback goes through validateContract,
233
- * so no third general kind can reach here in a document that validates.
234
- *
235
- * It is nonetheless a DENY list rather than an allow list of `detail-ref`, because `callouts[]` is not
236
- * the only input. The schema requires `kind` on a CALLOUT, but a `details[]` entry is a bare `{text}`
237
- * with no kind at all — that is every detail written before callouts existed. Allow-listing would
238
- * score ZERO of them and silently empty the report for models that score fine today. An entry that
239
- * does not say it is a section is treated as a detail: the safe direction, since the failure it risks
240
- * is one row too many rather than a whole model's worth missing.
241
- */
242
- export const NON_DETAIL_KINDS = ['section', 'elevation'];
243
-
244
- /**
245
- * The callouts on this plan that COUNT AS DETAILS for confidence scoring — the same `details[]` +
246
- * `callouts[]` union every other surface reads since #397, minus NON_DETAIL_KINDS.
247
- *
248
- * Not deduplicated and not sorted, unlike planDetailTexts: the scorer emits one row per callout, and
249
- * the same detail referenced twice on a sheet is two things to resolve, not one. Entries with no
250
- * resolvable name are KEPT with an empty text — the scorer bands those `low` with "no sheet reference
251
- * parsed", which is a real finding about the drawing, not a row to hide.
252
- *
253
- * Both scorers read this one function — server/steel-confidence.ts (the authority) and the editor's own
254
- * scoreContractJS — so THIS rule cannot drift between them. The banding either side of it is still two
255
- * hand-mirrored copies; what pins the editor's is the pair of #401 tests in steel-editor-draft.test.ts,
256
- * which boot the real page and assert its detail row count. See the note above the loop in
257
- * steel-confidence.ts for exactly what that does and does not cover.
258
- */
259
- export function planScoredDetails(plan) {
260
- const skip = new Set(NON_DETAIL_KINDS);
261
- const seen = new Set(), out = [];
262
- for (const entry of entries(plan)) {
263
- if (!entry || typeof entry !== 'object') continue;
264
- if (skip.has(text(entry.kind).toLowerCase())) continue;
265
- const name = calloutRefText(entry) || '';
266
- // The sheet the callout STRUCTURALLY points at, carried alongside the printed mark. The scorer
267
- // parses the mark first, but a mark need not contain its sheet — the schema documents "A" and
268
- // "A-A" as legal text and makes `target` required — and on those the parse yields nothing while
269
- // the navigation bubble, which reads target.sheet, jumps to the right sheet regardless. Without
270
- // this the two surfaces disagree: one resolves the reference, the other calls it unparseable.
271
- const t = entry.target;
272
- const targetSheet = (t && typeof t === 'object' && text(t.sheet)) || '';
273
- // One row per distinct REFERENCE, not per bubble. The band asks only whether the referenced sheet
274
- // is in the set, which is a property of the reference — so the same detail called out five times on
275
- // a sheet (the demo model does exactly this: 42 bubbles naming 21 distinct references, one of them
276
- // five times) is ONE thing to resolve, repeated. Left un-deduplicated it padded the Details
277
- // worklist with byte-identical rows and let a single dangling reference count five times against
278
- // the category. planDetailRefs is right NOT to dedupe — it draws a hot-zone per physical bubble —
279
- // but that is the placement question, not the resolution question this scorer asks.
280
- // Keyed on mark AND target sheet, because two sheets can both print "7". Deduplication is PER PLAN,
281
- // which is the scope this function has: the same detail referenced from two different plans stays
282
- // two rows, and each row names its own plan's sheet, so the worklist still says where to look. On
283
- // the demo model that takes 42 bubbles to 32 rows over three plans, for 21 distinct references.
284
- const key = name + '\x00' + targetSheet;
285
- if (seen.has(key)) continue;
286
- seen.add(key);
287
- out.push({ text: name, targetSheet: targetSheet || null, kind: text(entry.kind) || 'detail' });
288
- }
289
- return out;
290
- }
291
-
292
223
  /**
293
224
  * Every detail this plan can bind to, unique and sorted — the plan's own callouts plus the model's
294
225
  * custom details. Numeric-aware ordering, so detail 2 sorts before detail 10 the way a detailer reads