@floless/app 0.139.1 → 0.140.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.
@@ -0,0 +1,250 @@
1
+ /* Explicit, read-only local discovery. A finding is evidence, never a connection. */
2
+ (() => {
3
+ 'use strict';
4
+ const modal = document.getElementById('local-discovery-modal');
5
+ const folderList = document.getElementById('local-discovery-folders');
6
+ const results = document.getElementById('local-discovery-results');
7
+ const errors = document.getElementById('local-discovery-errors');
8
+ const status = document.getElementById('local-discovery-status');
9
+ const browse = document.getElementById('local-discovery-browse');
10
+ const filterInput = document.getElementById('local-discovery-filter');
11
+ const count = document.getElementById('local-discovery-count');
12
+ const previousButton = document.getElementById('local-discovery-previous');
13
+ const nextButton = document.getElementById('local-discovery-next');
14
+ const chooseButton = document.getElementById('local-discovery-choose');
15
+ const scanButton = document.getElementById('local-discovery-scan');
16
+ const closeButton = document.getElementById('local-discovery-close');
17
+ const selections = new Map();
18
+ let scanController = null;
19
+ let scanGeneration = 0;
20
+ let opener = null;
21
+ let openedFromLibrary = false;
22
+ let allFindings = [];
23
+ let page = 0;
24
+ const PAGE_SIZE = 40;
25
+
26
+ const make = (tag, className, content) => {
27
+ const node = document.createElement(tag);
28
+ if (className) node.className = className;
29
+ if (content != null) node.textContent = content;
30
+ return node;
31
+ };
32
+ async function post(path, body, signal) {
33
+ let response;
34
+ try {
35
+ response = await fetch(path, {
36
+ method: 'POST', headers: { 'Content-Type': 'application/json' },
37
+ body: JSON.stringify(body), signal,
38
+ });
39
+ } catch (error) {
40
+ if (error.name === 'AbortError') throw error;
41
+ throw new Error('FloLess could not reach the local scan. Check that FloLess is open, then try again.');
42
+ }
43
+ const data = await response.json().catch(() => ({}));
44
+ if (!response.ok || !data.ok) {
45
+ const error = new Error(data.ok === false && typeof data.error === 'string'
46
+ ? data.error : 'FloLess could not check those locations. Try the scan again.');
47
+ error.code = data.code;
48
+ error.expiredSelectionIds = Array.isArray(data.expiredSelectionIds) ? data.expiredSelectionIds : null;
49
+ throw error;
50
+ }
51
+ return data;
52
+ }
53
+ function setBusy(busy) {
54
+ if (busy && document.activeElement === scanButton) closeButton.focus();
55
+ chooseButton.disabled = busy;
56
+ scanButton.disabled = busy;
57
+ scanButton.textContent = busy ? 'Scanning…' : 'Scan this computer';
58
+ scanButton.setAttribute('aria-busy', String(busy));
59
+ }
60
+ function resetResults() {
61
+ allFindings = [];
62
+ page = 0;
63
+ filterInput.value = '';
64
+ browse.hidden = true;
65
+ results.replaceChildren();
66
+ errors.replaceChildren();
67
+ errors.hidden = true;
68
+ }
69
+ function paintFolders() {
70
+ folderList.replaceChildren();
71
+ for (const [id, path] of selections) {
72
+ const row = make('div', 'local-discovery-folder');
73
+ row.append(make('span', '', path));
74
+ const remove = make('button', '', 'Remove');
75
+ remove.type = 'button';
76
+ remove.dataset.commandId = 'shell.discovery-remove-folder';
77
+ remove.setAttribute('aria-label', `Remove folder ${path}`);
78
+ remove.addEventListener('click', () => {
79
+ ++scanGeneration;
80
+ scanController?.abort();
81
+ scanController = null;
82
+ setBusy(false);
83
+ selections.delete(id); paintFolders(); resetResults();
84
+ status.textContent = 'Scope changed. Scan again to see current findings.';
85
+ });
86
+ row.append(remove);
87
+ folderList.append(row);
88
+ }
89
+ }
90
+ function close(restoreFocus = true) {
91
+ ++scanGeneration;
92
+ const wasScanning = Boolean(scanController);
93
+ scanController?.abort();
94
+ scanController = null;
95
+ setBusy(false);
96
+ if (wasScanning) status.textContent = 'Scan stopped. Start a new scan to review current findings.';
97
+ modal.classList.remove('show');
98
+ if (restoreFocus) {
99
+ if (openedFromLibrary) document.getElementById('lib-modal')?.classList.add('show');
100
+ const target = openedFromLibrary ? opener : document.getElementById('menu-btn');
101
+ if (target?.isConnected && target.getClientRects().length) target.focus();
102
+ }
103
+ opener = null;
104
+ openedFromLibrary = false;
105
+ }
106
+ function open() {
107
+ opener = document.activeElement;
108
+ openedFromLibrary = Boolean(opener?.closest('#lib-modal'));
109
+ document.getElementById('lib-modal')?.classList.remove('show');
110
+ modal.classList.add('show');
111
+ closeButton.focus();
112
+ }
113
+ function findingCard(finding) {
114
+ const card = make('article', 'local-discovery-card');
115
+ const head = make('div', 'local-discovery-card-head');
116
+ head.append(make('strong', '', finding.label || 'Unnamed tool'));
117
+ head.append(make('span', 'local-discovery-found', 'Found'));
118
+ card.append(head);
119
+ const facts = make('dl', 'local-discovery-facts');
120
+ for (const [name, value] of [
121
+ ['Type', finding.kind], ['Source', finding.source], ['Version', finding.version],
122
+ ['Path', finding.path], ['Evidence', finding.evidence],
123
+ ]) {
124
+ if (value == null || value === '') continue;
125
+ facts.append(make('dt', '', name), make('dd', '', String(value)));
126
+ }
127
+ card.append(facts);
128
+ const actions = make('div', 'local-discovery-card-actions');
129
+ if (finding.graft && typeof finding.graft.ref === 'string' && typeof finding.graft.kind === 'string') {
130
+ const graft = make('button', '', 'Open in Graft');
131
+ graft.type = 'button'; graft.dataset.commandId = 'shell.discovery-open-graft';
132
+ graft.addEventListener('click', () => {
133
+ close(false);
134
+ document.dispatchEvent(new CustomEvent('floless:discovery-graft', { detail: finding.graft }));
135
+ });
136
+ actions.append(graft);
137
+ }
138
+ const chat = make('button', '', 'Ask AI Chat');
139
+ chat.type = 'button'; chat.dataset.commandId = 'shell.discovery-ask-chat';
140
+ chat.addEventListener('click', async () => {
141
+ const detail = [finding.label, finding.kind, finding.path, finding.version].filter(Boolean).join(' · ');
142
+ const draft = `I found this local tool: ${detail}. Help me decide how to use it in this project. Do not connect to it or run anything yet.`;
143
+ try {
144
+ await window.flolessChat.openDraft(draft);
145
+ close(false);
146
+ } catch { status.textContent = 'FloLess could not open AI Chat for this finding. Open a project or workflow and try again.'; }
147
+ });
148
+ actions.append(chat);
149
+ card.append(actions);
150
+ return card;
151
+ }
152
+ function paintPage() {
153
+ const query = filterInput.value.trim().toLocaleLowerCase();
154
+ const matching = query ? allFindings.filter((finding) =>
155
+ [finding.label, finding.path].some((value) => String(value || '').toLocaleLowerCase().includes(query))) : allFindings;
156
+ const pages = Math.max(1, Math.ceil(matching.length / PAGE_SIZE));
157
+ page = Math.min(page, pages - 1);
158
+ const start = page * PAGE_SIZE;
159
+ const end = Math.min(start + PAGE_SIZE, matching.length);
160
+ results.replaceChildren();
161
+ for (const finding of matching.slice(start, end)) results.append(findingCard(finding));
162
+ if (!matching.length) results.append(make('p', 'local-discovery-no-filter-match',
163
+ 'No results match this search. Change or clear it to see all results from this scan.'));
164
+ count.textContent = query
165
+ ? `${matching.length ? `Showing ${start + 1}–${end} of ` : ''}${matching.length} matching results (${allFindings.length} total).`
166
+ : `Showing ${start + 1}–${end} of ${allFindings.length} results.`;
167
+ const hidePrevious = page === 0;
168
+ const hideNext = end >= matching.length;
169
+ if ((hidePrevious && document.activeElement === previousButton)
170
+ || (hideNext && document.activeElement === nextButton)) count.focus();
171
+ previousButton.hidden = hidePrevious;
172
+ nextButton.hidden = hideNext;
173
+ }
174
+ async function scan() {
175
+ scanController?.abort();
176
+ scanController = new AbortController();
177
+ const generation = ++scanGeneration;
178
+ resetResults();
179
+ setBusy(true); status.textContent = 'Scanning the listed locations…';
180
+ try {
181
+ const data = await post('/api/local-discovery/scan', { selectionIds: [...selections.keys()] }, scanController.signal);
182
+ if (generation !== scanGeneration) return;
183
+ if (data.code === 'selection-expired') {
184
+ for (const id of data.expiredSelectionIds || [...selections.keys()]) selections.delete(id);
185
+ paintFolders();
186
+ status.textContent = 'Expired folder choices were removed. Scan again, or add those folders again.';
187
+ return;
188
+ }
189
+ const findings = Array.isArray(data.findings) ? data.findings : [];
190
+ const failures = Array.isArray(data.errors) ? data.errors : [];
191
+ status.textContent = findings.length
192
+ ? `${findings.length} ${findings.length === 1 ? 'result' : 'results'} found. Check what FloLess found before taking another step.${failures.length ? ' Some locations could not be fully checked.' : ''}`
193
+ : failures.length ? 'FloLess found no tools in the places it could check. Some places were not fully checked. Scan again or choose a smaller folder.' : 'FloLess found no tools in the places it checked. Add a folder or scan again.';
194
+ allFindings = findings;
195
+ browse.hidden = !findings.length;
196
+ if (findings.length) paintPage();
197
+ if (failures.length) {
198
+ errors.hidden = false;
199
+ errors.append(make('strong', '', 'Some places could not be fully checked. Scan again or choose a smaller folder.'));
200
+ for (const failure of failures) errors.append(make('p', '', `${failure.source}: ${failure.message}`));
201
+ }
202
+ } catch (error) {
203
+ if (generation === scanGeneration && error.code === 'selection-expired') {
204
+ for (const id of error.expiredSelectionIds || [...selections.keys()]) selections.delete(id);
205
+ paintFolders();
206
+ status.textContent = 'Expired folder choices were removed. Scan again, or add those folders again.';
207
+ } else if (error.name !== 'AbortError' && generation === scanGeneration) {
208
+ status.textContent = error.message || 'FloLess could not check those locations. Try the scan again.';
209
+ }
210
+ } finally {
211
+ if (generation === scanGeneration) { scanController = null; setBusy(false); }
212
+ }
213
+ }
214
+ chooseButton.addEventListener('click', async () => {
215
+ chooseButton.disabled = true;
216
+ try {
217
+ const data = await post('/api/local-discovery/folders/choose', {});
218
+ if (!data.cancelled && data.selectionId && data.path) {
219
+ if (selections.size >= 3) selections.delete(selections.keys().next().value);
220
+ selections.set(data.selectionId, data.path);
221
+ paintFolders();
222
+ resetResults();
223
+ status.textContent = 'Folder added to the next scan. Up to three selected folders can be included. No scan has started.';
224
+ }
225
+ } catch (error) { status.textContent = error.message || 'FloLess could not choose that folder. Try another local folder.'; }
226
+ finally { chooseButton.disabled = false; }
227
+ });
228
+ scanButton.addEventListener('click', scan);
229
+ filterInput.addEventListener('input', () => { page = 0; paintPage(); });
230
+ previousButton.addEventListener('click', () => { page = Math.max(0, page - 1); paintPage(); });
231
+ nextButton.addEventListener('click', () => { page += 1; paintPage(); });
232
+ closeButton.addEventListener('click', () => close());
233
+ modal.addEventListener('click', (event) => { if (event.target === modal) close(); });
234
+ modal.addEventListener('keydown', (event) => {
235
+ if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); close(); return; }
236
+ if (event.key !== 'Tab') return;
237
+ const focusables = [...modal.querySelectorAll('button:not([disabled]):not([hidden]), [tabindex="0"]')]
238
+ .filter((item) => item.getClientRects().length);
239
+ if (!focusables.length) { event.preventDefault(); modal.querySelector('.modal')?.focus(); return; }
240
+ const first = focusables[0], last = focusables[focusables.length - 1];
241
+ if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last.focus(); }
242
+ else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first.focus(); }
243
+ });
244
+ document.getElementById('lib-discover-local')?.addEventListener('click', open);
245
+ const previousMenuAction = handleMenuAction;
246
+ handleMenuAction = function (action) {
247
+ if (action === 'discover-local') { open(); return; }
248
+ previousMenuAction(action);
249
+ };
250
+ })();
@@ -34,10 +34,12 @@ const CONTROLS = Object.freeze({
34
34
  'model.display-mode': {
35
35
  kind: 'menu', aria: true, el: 'revitDisplay', menu: 'revitDisplayMenu', label: 'Solid', data: { 'data-mode': 'solid' },
36
36
  tip: 'Display mode — solid, wireframe, see-through, or realistic',
37
+ // Same fidelity-ramp order as the Steel menu — Wireframe, X-ray, Solid, Realistic; Revit has no
38
+ // Shadowed — so the two 3D toolbars read alike (#1427); Solid stays the checked default.
37
39
  items: [
38
- { kind: 'item', cmd: 'revit.display-mode-set#solid', data: { 'data-mode': 'solid' }, role: 'menuitemradio', checked: true, label: 'Solid', tip: 'Solid shaded model' },
39
40
  { kind: 'item', cmd: 'revit.display-mode-set#wireframe', data: { 'data-mode': 'wire' }, role: 'menuitemradio', checked: false, label: 'Wireframe', tip: 'Edges only' },
40
41
  { kind: 'item', cmd: 'revit.display-mode-set#x-ray', data: { 'data-mode': 'xray' }, role: 'menuitemradio', checked: false, label: 'X-ray', tip: 'See through model surfaces' },
42
+ { kind: 'item', cmd: 'revit.display-mode-set#solid', data: { 'data-mode': 'solid' }, role: 'menuitemradio', checked: true, label: 'Solid', tip: 'Solid shaded model' },
41
43
  { kind: 'item', cmd: 'revit.display-mode-set#realistic', data: { 'data-mode': 'realistic' }, role: 'menuitemradio', checked: false, label: 'Realistic', tip: 'Realistic — fuller shading in the model’s own Revit colours (Revit material finishes are not part of the conversion)' },
42
44
  { kind: 'divider' },
43
45
  { kind: 'item', cmd: 'revit.lighting', el: 'revitLighting', data: { 'data-lighting': 'open' }, label: 'Lighting…', tip: 'Adjust sunlight direction and model brightness' },
@@ -266,10 +266,12 @@ const CONTROLS = Object.freeze({
266
266
  // cannot inherit a Steel element selector.
267
267
  kind: 'menu', aria: true, el: 'm3dModeBtn', menu: 'm3dMode', label: 'Solid', data: { 'data-mode': 'solid' },
268
268
  tip: 'Display mode — solid, wireframe, see-through (X-ray) or realistic materials',
269
+ // Ordered as a fidelity ramp — Wire, X-ray, Solid, Realistic, Shadowed — with the default (Solid)
270
+ // in the middle rather than first (#1427). Only the position moves: Solid stays the checked default.
269
271
  items: [
270
- { kind: 'item', cmd: 'steel.display-mode#a solid shaded model', data: { 'data-mode': 'solid' }, class: 'on', role: 'menuitemradio', checked: true, label: 'Solid', tip: 'Solid shaded model' },
271
272
  { kind: 'item', cmd: 'steel.display-mode#a wireframe', data: { 'data-mode': 'wire' }, role: 'menuitemradio', checked: false, label: 'Wire', tip: 'Wireframe — edges only' },
272
273
  { kind: 'item', cmd: 'steel.display-mode#see-through X-ray', data: { 'data-mode': 'xray' }, role: 'menuitemradio', checked: false, label: 'X-ray', tip: 'See-through — reveal hidden parts' },
274
+ { kind: 'item', cmd: 'steel.display-mode#a solid shaded model', data: { 'data-mode': 'solid' }, class: 'on', role: 'menuitemradio', checked: true, label: 'Solid', tip: 'Solid shaded model' },
273
275
  { kind: 'item', cmd: 'steel.display-mode#realistic materials', data: { 'data-mode': 'realistic' }, role: 'menuitemradio', checked: false, label: 'Realistic', tip: 'Realistic — real material finishes (steel, concrete, timber…)' },
274
276
  { kind: 'item', cmd: 'steel.display-mode#realistic with shadows', data: { 'data-mode': 'shadowed' }, role: 'menuitemradio', checked: false, label: 'Shadowed', tip: 'Realistic with cast shadows — more depth, at a cost to frame rate' },
275
277
  { kind: 'divider' },
@@ -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;
@@ -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>
@@ -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;
@@ -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