@floless/app 0.152.1 → 0.154.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 (32) hide show
  1. package/dist/floless-server.cjs +5913 -3408
  2. package/dist/internal-workflows/floless-rfi-gmail-send/.floless-owner.json +1 -1
  3. package/dist/internal-workflows/floless-rfi-gmail-send/floless-rfi-gmail-send.flo +4 -2
  4. package/dist/schemas/revit.model.v1.schema.json +5 -0
  5. package/dist/schemas/steel.model.v2.schema.json +1 -1
  6. package/dist/skills/floless-app-new-workflow/SKILL.md +8 -2
  7. package/dist/skills/floless-app-onboarding/SKILL.md +8 -5
  8. package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +8 -3
  9. package/dist/skills/floless-app-queue/SKILL.md +23 -4
  10. package/dist/skills/floless-app-steel-takeoff/SKILL.md +18 -2
  11. package/dist/web/agents.js +8 -1
  12. package/dist/web/app.css +107 -5
  13. package/dist/web/app.js +106 -12
  14. package/dist/web/aware.js +424 -57
  15. package/dist/web/chat.css +60 -13
  16. package/dist/web/chat.js +814 -148
  17. package/dist/web/commands-shell.js +200 -21
  18. package/dist/web/commands-steel.js +78 -3
  19. package/dist/web/guide.js +213 -13
  20. package/dist/web/index.html +16 -9
  21. package/dist/web/instructor.js +2 -1
  22. package/dist/web/leave-guard.js +51 -7
  23. package/dist/web/left-pane.js +251 -46
  24. package/dist/web/model-editor-steel-adapter.js +3 -0
  25. package/dist/web/model-viewport.js +14 -6
  26. package/dist/web/revit-editor.js +1 -0
  27. package/dist/web/steel-3d-view.js +15 -7
  28. package/dist/web/steel-editor.html +367 -54
  29. package/dist/web/tekla-structural-grid-adapter.js +7 -1
  30. package/dist/web/tool-updates.js +141 -33
  31. package/dist/web/workspaces.js +125 -21
  32. package/package.json +1 -1
@@ -23,13 +23,14 @@
23
23
  const empty = document.getElementById('left-pane-empty');
24
24
  const modelContext = document.getElementById('left-model-context');
25
25
  const modelIndexHeader = document.getElementById('left-model-index-header');
26
+ const layoutToggle = document.getElementById('left-layout-toggle');
26
27
  // A PANEL tab's slot (web/model-panel-bridge.js has the contract): the editor moves its own controls into
27
28
  // this frame. It is replaced by a fresh, empty one whenever the generation changes, so a departing editor's
28
29
  // controls leave with it. No src: the frame's first about:blank document is this origin and stays put.
29
30
  const panelSlot = document.getElementById('left-model-panel-slot');
30
31
  let panelFrame = document.getElementById('left-model-panel');
31
32
  if (!frame || !pane || !stack || !split || !status || !modelTabs || !modelSearch || !modelSearchInput || !modelSearchClear || !modelIndexLabel || !followSelection || !modelContent || !collapsedHost || !empty || !modelContext
32
- || !modelIndexHeader || !panelSlot || !panelFrame) return;
33
+ || !modelIndexHeader || !panelSlot || !panelFrame || !layoutToggle) return;
33
34
 
34
35
  const sections = {
35
36
  narrative: stack.querySelector('[data-left-section="narrative"]'),
@@ -41,7 +42,9 @@
41
42
  narrative: pane.querySelector('[data-left-section-switch="narrative"]'),
42
43
  model: pane.querySelector('[data-left-section-switch="model"]'),
43
44
  };
44
- const defaults = { order: ['narrative', 'model'], visible: { narrative: true, model: true }, ratio: 58, tab: 'model', followSelection: true };
45
+ const defaults = { order: ['narrative', 'model'], visible: { narrative: true, model: true }, ratio: 58, columnRatio: 50, tab: 'model', followSelection: true };
46
+ const LABELS = { narrative: 'AI Chat', model: 'Model' };
47
+ const otherOf = (key) => (key === 'model' ? 'narrative' : 'model');
45
48
  let stored = {};
46
49
  try { stored = JSON.parse(localStorage.getItem(STORAGE_KEY) || '{}'); } catch { /* a locked-down profile still gets the pane */ }
47
50
  const validOrder = Array.isArray(stored.order) && stored.order.length === 2
@@ -53,6 +56,9 @@
53
56
  model: stored.visible?.model !== false,
54
57
  },
55
58
  ratio: Number.isFinite(stored.ratio) ? Math.max(25, Math.min(75, stored.ratio)) : defaults.ratio,
59
+ // 'columns' puts AI Chat and Model side by side; anything else read back is the stacked default.
60
+ layout: stored.layout === 'columns' ? 'columns' : 'stack',
61
+ columnRatio: Number.isFinite(stored.columnRatio) ? Math.max(25, Math.min(75, stored.columnRatio)) : defaults.columnRatio,
56
62
  tab: typeof stored.tab === 'string' ? stored.tab : defaults.tab,
57
63
  followSelection: typeof stored.followSelection === 'boolean' ? stored.followSelection : defaults.followSelection,
58
64
  modelAvailable: false,
@@ -92,7 +98,7 @@
92
98
  }
93
99
 
94
100
  function save() {
95
- try { localStorage.setItem(STORAGE_KEY, JSON.stringify({ order: state.order, visible: state.visible, ratio: state.ratio, tab: state.tab, followSelection: state.followSelection })); }
101
+ try { localStorage.setItem(STORAGE_KEY, JSON.stringify({ order: state.order, visible: state.visible, ratio: state.ratio, layout: state.layout, columnRatio: state.columnRatio, tab: state.tab, followSelection: state.followSelection })); }
96
102
  catch (error) { console.warn('[left-pane] Could not save panel layout.', error); }
97
103
  }
98
104
 
@@ -134,18 +140,35 @@
134
140
  function pendingDecisionVisible() {
135
141
  return approvalVisible() && !!approvalTray.querySelector('.ai-chat-approval:not(.ai-chat-approval-scope)');
136
142
  }
143
+ // Side by side needs the window to give the pane two columns and still leave the canvas room
144
+ // (web/app.js owns that width). Without the room the saved choice stays, and the panels stack
145
+ // until there is room again.
146
+ let layoutApiMissing = false;
147
+ const layoutApiReady = () => typeof window.flolessPanelLayout?.canFitLeftColumns === 'function';
148
+ function columnsFit() {
149
+ const api = window.flolessPanelLayout;
150
+ if (!layoutApiReady()) {
151
+ // Without the shell's width side there is no room to promise: stacked is the safe layout.
152
+ if (!layoutApiMissing) { layoutApiMissing = true; console.warn('[left-pane] The panel width controls did not load, so side by side is unavailable.'); }
153
+ return false;
154
+ }
155
+ return api.canFitLeftColumns() === true;
156
+ }
157
+ function columnsWanted() { return state.layout === 'columns' && columnsFit(); }
158
+ // Side by side, each section has the full height, so none of the stacked height rules below apply.
137
159
  function compactApproval() {
138
- return window.innerHeight <= 520 && approvalVisible() && shown('narrative') && shown('model');
160
+ return !columnsWanted() && window.innerHeight <= 520 && approvalVisible() && shown('narrative') && shown('model');
139
161
  }
140
162
  function presented(key) { return shown(key) && !(key === 'model' && compactApproval() && !modelRequestedDuringApproval); }
163
+ function sideBySide() { return columnsWanted() && presented('narrative') && presented('model'); }
141
164
  function minimumNarrativeRatio() { return (290 + 5.5) / stack.clientHeight * 100; }
142
165
  // The AI Chat section is never shorter than the rows of its chat that do not shrink (#1515): its
143
- // heading and controls, the chat toolbar, the recovery and attachment rows and the composer. The
166
+ // heading and controls, the chat toolbar, the recovery row and the composer (attachments included). The
144
167
  // conversation feed, the ⚙ strip and the approval tray are the rows that give height back — chat.css
145
168
  // declares exactly those minmax(0, …), and chat-ui.test.ts holds this list to that template. Below
146
169
  // this floor the composer would be pushed out through the host's overflow: hidden edge, leaving the
147
170
  // panel with no message box at all. It is measured, not a constant: the composer grows with a long
148
- // message, an attachment row can appear, and the disclosure wraps with the panel's width. Model
171
+ // message or attachments above it, and the disclosure wraps with the panel's width. Model
149
172
  // yields height to it, down to Model's own minimum and never further: a window too short for both
150
173
  // is a cue to hide one.
151
174
  const CHAT_YIELDING_ROWS = [1, 2, 5];
@@ -169,7 +192,7 @@
169
192
  }
170
193
  function narrativeFloorRatio() {
171
194
  const height = stack.clientHeight;
172
- if (!(height > 0) || !chatShell || !presented('narrative') || !presented('model')) return 0;
195
+ if (!(height > 0) || !chatShell || !presented('narrative') || !presented('model') || sideBySide()) return 0;
173
196
  const rows = window.getComputedStyle(chatShell).gridTemplateRows.split(' ').map(Number.parseFloat);
174
197
  if (!rows.length || rows.some((row) => !Number.isFinite(row))) return 0;
175
198
  const rigid = rows.reduce((sum, row, index) => sum + (CHAT_YIELDING_ROWS.includes(index) ? 0 : row), 0)
@@ -193,6 +216,8 @@
193
216
  // exact boundary can round 290 to 289.99999999999994 and cancel an active drag.
194
217
  return !!approvalTray.querySelector('.ai-chat-approval-scope') && narrativeRatio + 1e-9 < minimumNarrativeRatio();
195
218
  }
219
+ // The approval hold is about HEIGHT: side by side, AI Chat has the pane's full height and nothing is held.
220
+ function splitLockedNow() { return !sideBySide() && approvalSplitLocked(state.order[0]); }
196
221
  function commandInstance(value) { return encodeURIComponent(String(value)); }
197
222
 
198
223
  function applyChatIndicator(button) {
@@ -269,13 +294,19 @@
269
294
  announceSelection();
270
295
  const both = presented('narrative') && presented('model');
271
296
  const first = state.order[0];
272
- const splitLocked = approvalSplitLocked(first);
273
- if (splitLocked && splitSession) finishSplit(false);
297
+ const columns = sideBySide();
298
+ const splitLocked = !columns && approvalSplitLocked(first);
299
+ if (splitSession && (splitLocked || splitSession.columns !== columns)) finishSplit(false);
300
+ stack.classList.toggle('left-pane-columns', columns);
301
+ window.flolessPanelLayout?.setLeftColumns?.(columns);
302
+ split.setAttribute('aria-orientation', columns ? 'vertical' : 'horizontal');
303
+ reflectLayoutToggle(both);
274
304
  if (!presented('model') && sections.model.contains(document.activeElement)) switches.model.focus({ preventScroll: true });
275
305
  split.hidden = !both;
276
306
  split.setAttribute('aria-disabled', String(splitLocked));
277
307
  split.tabIndex = splitLocked ? -1 : 0;
278
- split.dataset.tip = splitLocked ? 'Resize is paused while approval needs space' : 'Drag or use arrow keys to resize · Enter or double-click to reset';
308
+ split.dataset.tip = splitLocked ? 'Resize is paused while approval needs space'
309
+ : `Drag or use arrow keys to resize ${columns ? 'the columns' : 'the panels'} · Enter or double-click to reset`;
279
310
  if (splitLocked) split.dataset.blockedReason = 'Resolve or leave this approval before resizing the panels.';
280
311
  else delete split.dataset.blockedReason;
281
312
  if (splitLocked && document.activeElement === split) switches.narrative.focus({ preventScroll: true });
@@ -289,13 +320,24 @@
289
320
  if (key === 'model') switches.model.dataset.tip = compactApproval() && !modelRequestedDuringApproval
290
321
  ? 'Show Model while approval waits' : 'Show or hide Model';
291
322
  }
292
- sizeSplit(both, first, splitLocked);
323
+ sizeSplit(both, first, splitLocked, columns);
293
324
  collapsedHost.replaceChildren(...state.order.filter(available).map(collapsedButton));
294
325
  }
295
326
 
296
327
  // Section heights and the separator's range. Also run on its own whenever the AI Chat floor can have
297
328
  // moved (see the ResizeObserver at the end), which needs none of reflect()'s focus or button work.
298
- function sizeSplit(both = presented('narrative') && presented('model'), first = state.order[0], splitLocked = approvalSplitLocked(first)) {
329
+ function sizeSplit(both = presented('narrative') && presented('model'), first = state.order[0], splitLocked = splitLockedNow(), columns = sideBySide()) {
330
+ if (columns) {
331
+ // Side by side: the divider shares the pane's WIDTH. A column never goes under its CSS minimum,
332
+ // so each flex basis may shrink to make room for the other.
333
+ const ratio = shownColumnRatio();
334
+ const [low, high] = columnBounds();
335
+ for (const key of Object.keys(sections)) sections[key].style.flex = `1 1 calc(${key === first ? ratio : 100 - ratio}% - 5.5px)`;
336
+ split.setAttribute('aria-valuemin', String(Math.round(low))); split.setAttribute('aria-valuemax', String(Math.round(high)));
337
+ split.setAttribute('aria-valuenow', String(Math.round(ratio)));
338
+ split.setAttribute('aria-valuetext', `${Math.round(ratio)}% of the width for ${LABELS[first]}`);
339
+ return;
340
+ }
299
341
  const floor = narrativeFloorRatio();
300
342
  const ratio = shownRatio(floor);
301
343
  for (const key of Object.keys(sections)) {
@@ -326,21 +368,73 @@
326
368
  if (key === 'model' && value && pendingRevealId) revealSelectedEntity();
327
369
  }
328
370
 
329
- function move(key, delta, announce = true) {
330
- // A panel move also rewrites the ratio so each section keeps its physical
331
- // height. Do not let it sample the temporary ratio from an unfinished
371
+ // The layout switch in the toolbar: pressed while side by side is the saved choice. It only means
372
+ // something with both panels open, so it is hidden otherwise rather than shown disabled.
373
+ function reflectLayoutToggle(both) {
374
+ const wanted = state.layout === 'columns';
375
+ layoutToggle.hidden = !both;
376
+ const fit = columnsFit();
377
+ // Pressed is the saved choice; the label says when the window is holding it back, so neither
378
+ // claims columns that are not on screen.
379
+ layoutToggle.setAttribute('aria-pressed', String(wanted));
380
+ const ready = layoutApiReady();
381
+ layoutToggle.setAttribute('aria-label', wanted && !fit ? (ready ? 'Side by side, waiting for a wider window' : 'Side by side, not available right now') : 'Side by side');
382
+ layoutToggle.dataset.tip = fit ? (wanted ? 'Stack AI Chat and Model' : 'Place AI Chat and Model side by side')
383
+ : !ready ? 'Side by side is not available right now · reload FloLess to try again'
384
+ : wanted ? 'Side by side needs a wider window, so the panels are stacked for now · click to keep them stacked'
385
+ : 'Side by side needs a wider window · click to keep it for when there is room';
386
+ }
387
+ // What to say when side by side cannot be shown: only the remedies that would actually work now.
388
+ function noRoomMessage() {
389
+ if (!layoutApiReady()) return 'Side by side is not available right now because the panel width controls did not load, so AI Chat and Model stay stacked. Reload FloLess to try again.';
390
+ // Folding Inspect is offered only while it is open AND folding it would actually make the room.
391
+ const foldHelps = !document.getElementById('app')?.classList.contains('right-collapsed')
392
+ && window.flolessPanelLayout.canFitLeftColumns({ inspectFolded: true }) === true;
393
+ return `Side by side needs a wider window, so AI Chat and Model stay stacked for now. ${foldHelps
394
+ ? 'Widen the window or fold the Inspect panel, and they move side by side.' : 'Widen the window, and they move side by side.'}`;
395
+ }
396
+ // Said where a sighted person looks too: the click changed nothing they can see.
397
+ function tellNoRoom() { const message = noRoomMessage(); status.textContent = message; window.showToast?.(message, 'info'); }
398
+
399
+ // Puts one panel above, below, left of or right of the other; left or right is side by side.
400
+ function place(key, where, announce = true) {
401
+ // A panel move also rewrites the ratios so each section keeps its physical
402
+ // size. Do not let it sample the temporary ratio from an unfinished
332
403
  // splitter gesture; Escape must still be able to restore one coherent state.
333
- if (splitSession) return;
334
- const from = state.order.indexOf(key);
335
- const to = Math.max(0, Math.min(state.order.length - 1, from + delta));
336
- if (from < 0 || from === to) return;
337
- state.order.splice(from, 1); state.order.splice(to, 0, key);
338
- state.ratio = 100 - state.ratio;
339
- save(); arrange(); reflect();
340
- if (panelShown !== null) { panelShown = null; renderModel(); } // the move re-created the panel frame's document
341
- if (announce) status.textContent = `${key === 'model' ? 'Model' : 'AI Chat'} panel moved ${to === 0 ? 'above' : 'below'} ${state.order[1 - to] === 'model' ? 'Model' : 'AI Chat'}.`;
404
+ if (splitSession || !sections[key]) return;
405
+ const other = otherOf(key);
406
+ const columns = where === 'left' || where === 'right';
407
+ if (columns && !(shown(key) && shown(other))) {
408
+ if (announce) {
409
+ const message = `${LABELS[other]} is hidden. Show it with the ${LABELS[other].toUpperCase()} switch above, then place the panels side by side.`;
410
+ status.textContent = message; window.showToast?.(message, 'info');
411
+ }
412
+ return;
413
+ }
414
+ const order = where === 'above' || where === 'left' ? [key, other] : [other, key];
415
+ const reordered = order[0] !== state.order[0];
416
+ const layout = columns ? 'columns' : 'stack';
417
+ if (!reordered && layout === state.layout) return;
418
+ if (reordered) { state.order = order; state.ratio = 100 - state.ratio; state.columnRatio = 100 - state.columnRatio; arrange(); }
419
+ state.layout = layout;
420
+ save(); reflect();
421
+ if (reordered && panelShown !== null) { panelShown = null; renderModel(); } // the move re-created the panel frame's document
422
+ if (announce) {
423
+ if (columns && !columnsFit()) tellNoRoom();
424
+ else status.textContent = columns
425
+ ? `${LABELS[key]} panel moved ${where} of ${LABELS[other]}, side by side.`
426
+ : `${LABELS[key]} panel moved ${where} ${LABELS[other]}.`;
427
+ }
342
428
  pane.querySelector(`[data-left-reorder="${key}"]`)?.focus();
343
429
  }
430
+ function setLayout(layout) {
431
+ if (splitSession || layout === state.layout) return;
432
+ state.layout = layout;
433
+ save(); reflect();
434
+ if (layout === 'columns' && !columnsFit()) tellNoRoom();
435
+ else status.textContent = layout === 'columns' ? 'AI Chat and Model placed side by side.' : 'AI Chat and Model stacked.';
436
+ }
437
+ layoutToggle.addEventListener('click', () => setLayout(state.layout === 'columns' ? 'stack' : 'columns'));
344
438
 
345
439
  pane.addEventListener('click', (event) => {
346
440
  const switcher = event.target.closest('[data-left-section-switch]');
@@ -370,8 +464,9 @@
370
464
 
371
465
  pane.addEventListener('keydown', (event) => {
372
466
  const grip = event.target.closest('[data-left-reorder]');
373
- if (grip && event.altKey && ['ArrowUp', 'ArrowDown'].includes(event.key)) {
374
- event.preventDefault(); move(grip.dataset.leftReorder, event.key === 'ArrowUp' ? -1 : 1); return;
467
+ const where = { ArrowUp: 'above', ArrowDown: 'below', ArrowLeft: 'left', ArrowRight: 'right' }[event.key];
468
+ if (grip && event.altKey && where) {
469
+ event.preventDefault(); place(grip.dataset.leftReorder, where); return;
375
470
  }
376
471
  const sectionSwitch = event.target.closest('[data-left-section-switch]');
377
472
  if (!sectionSwitch || !['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return;
@@ -382,23 +477,120 @@
382
477
  event.preventDefault(); live[next]?.focus();
383
478
  });
384
479
  document.addEventListener('floless:chat-indicator', syncChatIndicator);
385
- pane.querySelectorAll('[data-left-reorder]').forEach((grip) => {
386
- grip.addEventListener('dragstart', (event) => {
387
- if (splitSession) { event.preventDefault(); return; }
388
- dragKey = grip.dataset.leftReorder; event.dataTransfer.effectAllowed = 'move'; event.dataTransfer.setData('text/plain', dragKey);
480
+ // A panel is dragged by its whole header (the ⠿ grip inside it is the keyboard carrier). Dropped on
481
+ // the other panel it stacks above or below it, by the half it lands on; dropped on the strip that
482
+ // opens over the canvas beside the pane it docks as a second column, side by side. The custom data
483
+ // type keeps the drag out of text fields: the AI Chat composer must not receive the word "model".
484
+ const DRAG_TYPE = 'application/x-floless-left-section';
485
+ const dockZone = document.createElement('div');
486
+ dockZone.className = 'left-dock-zone'; dockZone.hidden = true; dockZone.setAttribute('aria-hidden', 'true');
487
+ const dockTitle = document.createElement('strong'); dockTitle.textContent = 'Place side by side';
488
+ const dockNote = document.createElement('span');
489
+ dockZone.append(dockTitle, dockNote);
490
+ document.body.append(dockZone);
491
+ function clearDropMarks() {
492
+ pane.querySelectorAll('.drag-over').forEach((el) => el.classList.remove('drag-over', 'drag-over-top', 'drag-over-bottom'));
493
+ dockZone.classList.remove('drag-over');
494
+ }
495
+ function endSectionDrag() {
496
+ dragKey = null; clearDropMarks();
497
+ dockZone.hidden = true; document.body.classList.remove('left-pane-section-dragging');
498
+ }
499
+ // The strip opens beside the pane, about a column wide, unless the dragged panel already is the
500
+ // right-hand column (dropping there would change nothing).
501
+ function openDockZone(key) {
502
+ if (!presented(otherOf(key)) || (sideBySide() && state.order[1] === key)) return;
503
+ const rect = pane.getBoundingClientRect();
504
+ const room = (window.innerWidth || 0) - rect.right;
505
+ if (!(rect.height > 0) || room < 120) return;
506
+ dockNote.textContent = columnsFit() ? `Drop to dock ${LABELS[key]} as a second column`
507
+ : 'Needs a wider window · drop to keep this choice; the panels stay stacked until there is room';
508
+ Object.assign(dockZone.style, { left: `${rect.right + 8}px`, top: `${rect.top + 8}px`, height: `${rect.height - 16}px`, width: `${Math.min(340, room - 24)}px` });
509
+ dockZone.hidden = false;
510
+ }
511
+ pane.querySelectorAll('[data-left-drag]').forEach((heading) => {
512
+ // The × inside the header is a button, not a handle. A browser fires dragstart on the draggable
513
+ // header itself, never on the button the press began on, so the press is what is remembered.
514
+ let pressedOnClose = false;
515
+ heading.addEventListener('pointerdown', (event) => { pressedOnClose = !!event.target.closest?.('.left-section-close'); });
516
+ heading.addEventListener('dragstart', (event) => {
517
+ const fromClose = pressedOnClose || !!event.target.closest?.('.left-section-close');
518
+ pressedOnClose = false;
519
+ if (splitSession || fromClose) { event.preventDefault(); return; }
520
+ dragKey = heading.dataset.leftDrag;
521
+ event.dataTransfer.effectAllowed = 'move'; event.dataTransfer.setData(DRAG_TYPE, dragKey);
522
+ // Workspace frames would swallow the drag over the canvas, so they stop taking the pointer meanwhile.
523
+ document.body.classList.add('left-pane-section-dragging');
524
+ openDockZone(dragKey);
389
525
  });
390
- grip.addEventListener('dragend', () => { dragKey = null; pane.querySelectorAll('.drag-over').forEach((el) => el.classList.remove('drag-over')); });
526
+ heading.addEventListener('dragend', endSectionDrag);
391
527
  });
392
528
  pane.querySelectorAll('[data-left-section]').forEach((section) => {
393
- section.addEventListener('dragover', (event) => { if (!dragKey || dragKey === section.dataset.leftSection) return; event.preventDefault(); section.classList.add('drag-over'); });
394
- section.addEventListener('dragleave', () => section.classList.remove('drag-over'));
529
+ // The upper or lower half of the panel under the pointer. Without a usable position the dragged
530
+ // panel takes the target's place, as dropping onto a panel always did.
531
+ const landing = (event) => {
532
+ const rect = section.getBoundingClientRect();
533
+ if (!Number.isFinite(event.clientY) || !(rect.height > 0)) {
534
+ return state.order.indexOf(section.dataset.leftSection) === 0 ? 'above' : 'below';
535
+ }
536
+ return event.clientY < rect.top + rect.height / 2 ? 'above' : 'below';
537
+ };
538
+ section.addEventListener('dragover', (event) => {
539
+ if (!dragKey || dragKey === section.dataset.leftSection) return;
540
+ event.preventDefault();
541
+ if (event.dataTransfer) event.dataTransfer.dropEffect = 'move';
542
+ const where = landing(event);
543
+ section.classList.add('drag-over');
544
+ section.classList.toggle('drag-over-top', where === 'above'); section.classList.toggle('drag-over-bottom', where === 'below');
545
+ });
546
+ section.addEventListener('dragleave', (event) => {
547
+ if (event.relatedTarget && section.contains(event.relatedTarget)) return;
548
+ section.classList.remove('drag-over', 'drag-over-top', 'drag-over-bottom');
549
+ });
395
550
  section.addEventListener('drop', (event) => {
396
- event.preventDefault(); section.classList.remove('drag-over');
397
- const target = section.dataset.leftSection;
398
- if (dragKey && dragKey !== target) move(dragKey, state.order.indexOf(target) - state.order.indexOf(dragKey));
551
+ if (!dragKey) return;
552
+ event.preventDefault();
553
+ const key = dragKey, target = section.dataset.leftSection, where = landing(event);
554
+ endSectionDrag();
555
+ if (key !== target) place(key, where);
399
556
  });
400
557
  });
558
+ dockZone.addEventListener('dragover', (event) => {
559
+ if (!dragKey) return;
560
+ event.preventDefault();
561
+ if (event.dataTransfer) event.dataTransfer.dropEffect = 'move';
562
+ dockZone.classList.add('drag-over');
563
+ });
564
+ dockZone.addEventListener('dragleave', () => dockZone.classList.remove('drag-over'));
565
+ dockZone.addEventListener('drop', (event) => {
566
+ if (!dragKey) return;
567
+ event.preventDefault();
568
+ const key = dragKey;
569
+ endSectionDrag();
570
+ place(key, 'right');
571
+ });
401
572
 
573
+ // The divider's real range: a quarter to three quarters, narrowed so neither column goes under the
574
+ // 260px the stylesheet holds it to. Unknown width (not laid out yet): the plain quarter range.
575
+ function columnBounds() {
576
+ const width = stack.clientWidth;
577
+ const reserve = width > 0 ? (260 + 5.5) / width * 100 : 0;
578
+ const low = Math.max(25, reserve), high = Math.min(75, 100 - reserve);
579
+ return low <= high ? [low, high] : [50, 50];
580
+ }
581
+ function shownColumnRatio() { const [low, high] = columnBounds(); return Math.max(low, Math.min(high, state.columnRatio)); }
582
+ // Reset is the person's choice even when the columns' minimum already shows half and half.
583
+ function resetColumnRatio() {
584
+ if (state.columnRatio === defaults.columnRatio) return false;
585
+ state.columnRatio = defaults.columnRatio; sizeSplit(); return true;
586
+ }
587
+ function setColumnRatio(value) {
588
+ const [low, high] = columnBounds();
589
+ const next = Math.max(low, Math.min(high, value));
590
+ // Compared with the divider on screen: a press the columns' minimum absorbs saves nothing.
591
+ if (next === shownColumnRatio()) return false;
592
+ state.columnRatio = next; sizeSplit(); return true;
593
+ }
402
594
  function setRatio(value) {
403
595
  let next = Math.max(25, Math.min(75, value));
404
596
  if (approvalVisible() && !pendingDecisionVisible() && presented('narrative') && presented('model')
@@ -420,11 +612,11 @@
420
612
  if (!splitSession) return;
421
613
  const session = splitSession;
422
614
  splitSession = null;
423
- split.classList.remove('dragging'); document.body.classList.remove('left-pane-height-resizing');
424
- if (!commit) state.ratio = session.startRatio;
615
+ split.classList.remove('dragging'); document.body.classList.remove('left-pane-height-resizing', 'left-pane-width-resizing');
616
+ if (!commit) state[session.key] = session.startRatio;
425
617
  try { if (!split.hasPointerCapture || split.hasPointerCapture(session.pointerId)) split.releasePointerCapture(session.pointerId); } catch { /* capture may already be gone */ }
426
618
  reflect();
427
- if (commit && state.ratio !== session.startRatio) save();
619
+ if (commit && state[session.key] !== session.startRatio) save();
428
620
  }
429
621
  split.addEventListener('pointerdown', (event) => {
430
622
  if (event.button !== 0 || event.isPrimary === false) return;
@@ -432,15 +624,18 @@
432
624
  if (splitSession) finishSplit(false);
433
625
  event.preventDefault(); split.focus();
434
626
  const rect = stack.getBoundingClientRect();
435
- if (!(rect.height > 0)) return;
436
- splitSession = { pointerId: event.pointerId, top: rect.top, height: rect.height, startRatio: state.ratio };
627
+ const columns = sideBySide();
628
+ if (!((columns ? rect.width : rect.height) > 0)) return;
629
+ splitSession = { pointerId: event.pointerId, columns, top: rect.top, height: rect.height, left: rect.left, width: rect.width,
630
+ key: columns ? 'columnRatio' : 'ratio', startRatio: columns ? state.columnRatio : state.ratio };
437
631
  try { split.setPointerCapture(event.pointerId); } catch { /* window listeners still own the gesture */ }
438
- split.classList.add('dragging'); document.body.classList.add('left-pane-height-resizing');
632
+ split.classList.add('dragging'); document.body.classList.add(columns ? 'left-pane-width-resizing' : 'left-pane-height-resizing');
439
633
  });
440
634
  window.addEventListener('pointermove', (event) => {
441
635
  if (!splitSession || event.pointerId !== splitSession.pointerId) return;
442
636
  if (event.pointerType === 'mouse' && event.buttons === 0) { finishSplit(true); return; }
443
- setRatio(((event.clientY - splitSession.top) / splitSession.height) * 100);
637
+ if (splitSession.columns) setColumnRatio(((event.clientX - splitSession.left) / splitSession.width) * 100);
638
+ else setRatio(((event.clientY - splitSession.top) / splitSession.height) * 100);
444
639
  });
445
640
  window.addEventListener('pointerup', (event) => { if (splitSession?.pointerId === event.pointerId) finishSplit(true); });
446
641
  window.addEventListener('pointercancel', (event) => { if (splitSession?.pointerId === event.pointerId) finishSplit(false); });
@@ -450,6 +645,7 @@
450
645
  split.addEventListener('dblclick', (event) => {
451
646
  if (split.getAttribute('aria-disabled') === 'true') return;
452
647
  if (splitSession) { event.preventDefault(); return; }
648
+ if (sideBySide()) { if (resetColumnRatio()) save(); return; }
453
649
  if (setRatio(defaults.ratio)) save();
454
650
  });
455
651
  window.addEventListener('keydown', (event) => {
@@ -457,7 +653,14 @@
457
653
  if (event.target !== split) return;
458
654
  if (split.getAttribute('aria-disabled') === 'true') { event.preventDefault(); return; }
459
655
  if (splitSession) {
460
- if (['ArrowUp', 'ArrowDown', 'Enter'].includes(event.key)) event.preventDefault();
656
+ if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Enter'].includes(event.key)) event.preventDefault();
657
+ return;
658
+ }
659
+ // Side by side the divider is upright, so Left and Right move it.
660
+ if (sideBySide()) {
661
+ if (event.key === 'Enter') { event.preventDefault(); if (resetColumnRatio()) save(); return; }
662
+ if (!['ArrowLeft', 'ArrowRight'].includes(event.key)) return;
663
+ event.preventDefault(); if (setColumnRatio(shownColumnRatio() + (event.key === 'ArrowLeft' ? -1 : 1) * (event.shiftKey ? 10 : 2))) save();
461
664
  return;
462
665
  }
463
666
  if (event.key === 'Enter') { event.preventDefault(); if (setRatio(defaults.ratio)) save(); return; }
@@ -981,14 +1184,14 @@
981
1184
  // A floor that moves can also start or end a Revoke approval's hold on the split; that needs
982
1185
  // reflect()'s focus, tooltip and blocked-reason work, not only new section heights.
983
1186
  const refitFloor = () => {
984
- if (String(approvalSplitLocked(state.order[0])) !== split.getAttribute('aria-disabled')) reflect();
1187
+ if (String(splitLockedNow()) !== split.getAttribute('aria-disabled')) reflect();
985
1188
  else sizeSplit();
986
1189
  };
987
1190
  const chatFeed = chatShell?.querySelector('.ai-chat-feed');
988
1191
  if (chatFeed) new MutationObserver(refitFloor).observe(chatFeed, { childList: true });
989
1192
  // The AI Chat floor moves with the chat's rows that do not shrink and with the stack's own height (the
990
1193
  // Instructor strip opening, not only a window resize), so the split is re-sized whenever the composer,
991
- // the recovery or attachment row, or the stack changes size: a message growing to six lines at the
1194
+ // the recovery row, the attachments inside the composer, or the stack changes size: a message growing to six lines at the
992
1195
  // minimum takes height from Model instead of pushing the composer out. None of these, nor the three
993
1196
  // below, is sized by the split, so re-sizing it cannot feed back into this. (Row 4 also holds the offscreen-activity
994
1197
  // badge, which follows the feed's height; chat.js only shows it with 88px of feed to spare, so it is
@@ -1014,5 +1217,7 @@
1014
1217
  if (window.innerHeight > 520) modelRequestedDuringApproval = false;
1015
1218
  reflect();
1016
1219
  });
1220
+ // Inspect folding, opening or changing width moves the room for two columns as much as the window does.
1221
+ window.addEventListener('floless:panel-room', () => reflect());
1017
1222
  arrange(); reflect();
1018
1223
  })();
@@ -196,6 +196,9 @@ export function createSteelAdapter({ viewport, editorBridge = {} }) {
196
196
  // notifies. The Objects-pane Show all needs this rather than the controller's Ghost flag (or the
197
197
  // toolbar mark painted from it), which Show all clears only after the renderer has notified.
198
198
  hasVisibilityTreatment: () => !!invoke('hasVisibilityTreatment', [], false),
199
+ // Monotonic count of every Ghost/Isolate/Hide/Show-all/saved-view change. null when the renderer has no such counter, which a caller must read as "cannot tell".
200
+ visibilityRevision: () => invoke('visibilityRevision', [], null),
201
+ isIsolated: () => !!invoke('isIsolated', [], false),
199
202
  selectionHiddenIds: () => invoke('selectionHiddenIds', [], []),
200
203
  connHiddenIds: () => invoke('connHiddenIds', [], []),
201
204
  setGroupsHidden: (keys, hidden) => invoke('setGroupsHidden', [keys, hidden]),
@@ -366,6 +366,12 @@ export function createModelViewportController(options) {
366
366
  ghostUnselected: state.ghostUnselected,
367
367
  hasVisibilityFilter: state.hasVisibilityFilter,
368
368
  });
369
+ // THE choke point for object-visibility changes (Ghost unselected, Isolate, Hide selected, Show all, a saved view's
370
+ // objects state, and the scene reporting its own change). Every writer below calls visibilityChanged(); a host that
371
+ // wants to know whether the user touched visibility between two moments compares visibilityRevision() instead of
372
+ // watching individual commands, so a new way to change visibility cannot slip past it.
373
+ let visibilityRevision = 0;
374
+ const visibilityChanged = () => { visibilityRevision += 1; };
369
375
  const publishState = () => {
370
376
  const snapshot = editorState();
371
377
  for (const listener of [...stateSubscribers]) {
@@ -533,8 +539,9 @@ export function createModelViewportController(options) {
533
539
  const next = value ?? adapter.sectionState();
534
540
  state = transitionViewportState(state, { type: 'section', clipping: next.clipping, workPlane: next.workPlane, workArea: next.workArea, activeClipGesture: next.activeClipGesture ?? null }); publishState(); return true;
535
541
  },
536
- reportVisibility(filtered) {
542
+ reportVisibility(filtered, options) {
537
543
  if (disposed) return false;
544
+ if (!options || options.intentional !== false) visibilityChanged(); // an internal refresh ({ intentional: false }) republishes the state without counting as a user change
538
545
  state = transitionViewportState(state, { type: 'visibility', filtered: filtered ?? adapter.hasVisibilityFilter() }); publishState(); return true;
539
546
  },
540
547
  commitSelection(commit) {
@@ -570,7 +577,7 @@ export function createModelViewportController(options) {
570
577
  state = transitionViewportState(state, { type: 'hover', key: next }); applyPresentation(); return next;
571
578
  },
572
579
  hideSelection() {
573
- ensureLive(); const outcome = adapter.hideSelection(state.selectedKeys);
580
+ ensureLive(); const outcome = adapter.hideSelection(state.selectedKeys); visibilityChanged();
574
581
  const hiddenKeys = Array.isArray(outcome?.hiddenKeys) ? outcome.hiddenKeys.filter((key) => state.selectedKeys.includes(key)) : [];
575
582
  state = transitionViewportState(state, { type: 'visibility', filtered: adapter.hasVisibilityFilter() });
576
583
  const hoverHidden = hiddenKeys.includes(state.hoverKey);
@@ -582,19 +589,19 @@ export function createModelViewportController(options) {
582
589
  publishState(); return Number.isFinite(outcome?.count) ? outcome.count : outcome;
583
590
  },
584
591
  isolateSelection() {
585
- ensureLive(); const result = adapter.isolateSelection(state.selectedKeys);
592
+ ensureLive(); const result = adapter.isolateSelection(state.selectedKeys); visibilityChanged();
586
593
  state = transitionViewportState(state, { type: 'visibility', filtered: adapter.hasVisibilityFilter() });
587
594
  if (state.ghostUnselected) { state = transitionViewportState(state, { type: 'ghost', enabled: false }); applyPresentation(); }
588
595
  publishState(); return result;
589
596
  },
590
597
  showAll() {
591
- ensureLive(); adapter.clearVisibility();
598
+ ensureLive(); adapter.clearVisibility(); visibilityChanged();
592
599
  state = transitionViewportState(state, { type: 'visibility', filtered: adapter.hasVisibilityFilter() });
593
600
  state = transitionViewportState(state, { type: 'ghost', enabled: false });
594
601
  applyPresentation(); publishState();
595
602
  },
596
603
  setGhostUnselected(enabled) {
597
- ensureLive();
604
+ ensureLive(); visibilityChanged();
598
605
  // Isolate and Ghost unselected are alternatives: Ghost lifts an isolation, and the adapter brings back only what
599
606
  // the isolation hid. An isolation already cleared some other way leaves nothing to lift.
600
607
  if (enabled && adapter.isIsolated?.()) {
@@ -606,9 +613,10 @@ export function createModelViewportController(options) {
606
613
  },
607
614
  toggleGhostUnselected() { return api.setGhostUnselected(!state.ghostUnselected); },
608
615
  ghostUnselected() { ensureLive(); return state.ghostUnselected; },
616
+ visibilityRevision() { return visibilityRevision; },
609
617
  visibilitySnapshot() { ensureLive(); return immutable(adapter.snapshotVisibility()); },
610
618
  applyVisibilitySnapshot(value) {
611
- ensureLive(); adapter.applyVisibilitySnapshot(value);
619
+ ensureLive(); adapter.applyVisibilitySnapshot(value); visibilityChanged();
612
620
  state = transitionViewportState(state, { type: 'visibility', filtered: adapter.hasVisibilityFilter() });
613
621
  if (value && Object.prototype.hasOwnProperty.call(value, 'ghostUnselected')) {
614
622
  state = transitionViewportState(state, { type: 'ghost', enabled: value.ghostUnselected });
@@ -270,6 +270,7 @@ const TEKLA_AUDIT_COPY = Object.freeze({
270
270
  'part-operations-unevaluated': Object.freeze({ group: 'shape-not-evaluated', title: 'Shape detail not evaluated', detail: 'Some part operations were preserved as database facts but were not evaluated into the displayed shape.' }),
271
271
  'weld-recipes-unevaluated': Object.freeze({ group: 'shape-not-evaluated', title: 'Shape detail not evaluated', detail: 'Some weld-shape instructions were preserved as database facts but were not evaluated into display geometry.' }),
272
272
  'grid-mapping-unevaluated': Object.freeze({ group: 'shape-not-evaluated', title: 'Grid not shown in 3D', detail: 'This grid is present in the Tekla database, but its display extents could not be mapped safely.' }),
273
+ 'grid-record-undecoded': Object.freeze({ group: 'not-shown', title: 'Grid not shown in 3D', detail: 'This grid is in the Tekla model, but it could not be drawn: the model has more than one grid, or its grid record could not be read. The rest of the model is unaffected. To see the grid, keep one grid in the Tekla model and read the model again; if it is still not shown, use Report an issue.' }),
273
274
  'unsupported-native-type': Object.freeze({ group: 'shape-not-evaluated', title: 'Shape detail not evaluated', detail: 'This native Tekla object type is recorded but is not yet interpreted by the parser.' }),
274
275
  // #1836: the model was read without a Tekla catalogue file the person chose to continue without.
275
276
  'profile-catalogue-missing': Object.freeze({ group: 'shape-not-evaluated', title: 'Shown as a stand-in bar', detail: 'This part’s profile shape isn’t known because profdb.bin was missing, so it is drawn as a thin stand-in bar where it can be placed. Read the model again with that file for the real shape.' }),