@floless/app 0.142.0 → 0.144.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 (54) hide show
  1. package/dist/floless-server.cjs +218260 -189290
  2. package/dist/schemas/steel.model.v2.schema.json +50 -2
  3. package/dist/schemas/tekla.model.v1.schema.json +66 -0
  4. package/dist/schemas/tekla.model.v2.schema.json +69 -0
  5. package/dist/schemas/tekla.source-package.v1.schema.json +37 -0
  6. package/dist/skills/floless-app-steel-takeoff/SKILL.md +24 -1
  7. package/dist/skills/floless-app-workflows/SKILL.md +8 -2
  8. package/dist/skills/floless-app-workflows/references/workspace-data.md +25 -4
  9. package/dist/templates/floless-workspace-model-report.flo +27 -23
  10. package/dist/templates/revit-model.flo +6 -2
  11. package/dist/templates/tekla-model-report.flo +60 -0
  12. package/dist/templates/tekla-parser.flo +61 -0
  13. package/dist/web/app.css +89 -2
  14. package/dist/web/app.js +5 -4
  15. package/dist/web/aware.js +441 -47
  16. package/dist/web/chat.css +2 -0
  17. package/dist/web/chat.js +37 -3
  18. package/dist/web/commands-revit.js +4 -0
  19. package/dist/web/commands-shell.js +136 -3
  20. package/dist/web/commands-steel.js +8 -2
  21. package/dist/web/commands-tekla-parser.js +48 -0
  22. package/dist/web/commands.js +1 -1
  23. package/dist/web/filter-ai-context.js +35 -6
  24. package/dist/web/filter-ai-proposal.js +40 -4
  25. package/dist/web/grid-core.js +15 -0
  26. package/dist/web/index.html +40 -2
  27. package/dist/web/instructor.js +26 -14
  28. package/dist/web/left-pane.js +160 -10
  29. package/dist/web/model-artifact-loader.js +15 -0
  30. package/dist/web/model-display-units.js +89 -0
  31. package/dist/web/model-editor-revit-adapter.js +21 -4
  32. package/dist/web/model-editor.css +4 -2
  33. package/dist/web/model-measure.js +10 -6
  34. package/dist/web/model-panel-bridge.js +46 -3
  35. package/dist/web/model-pointer-dock.js +21 -1
  36. package/dist/web/model-property-display.js +91 -0
  37. package/dist/web/model-revit-module.js +9 -0
  38. package/dist/web/model-selection-tools.js +11 -0
  39. package/dist/web/model-spatial-panel.js +52 -21
  40. package/dist/web/model-structural-grid-view.js +334 -0
  41. package/dist/web/model-tekla-selection.js +32 -0
  42. package/dist/web/model-viewport-revit-adapter.js +119 -32
  43. package/dist/web/revit-editor.css +11 -1
  44. package/dist/web/revit-editor.html +4 -3
  45. package/dist/web/revit-editor.js +589 -111
  46. package/dist/web/steel-3d-view.js +58 -372
  47. package/dist/web/steel-editor.html +258 -17
  48. package/dist/web/steel-filter.html +17 -3
  49. package/dist/web/tekla-editor.html +71 -0
  50. package/dist/web/tekla-structural-grid-adapter.js +56 -0
  51. package/dist/web/workspaces.js +872 -97
  52. package/distribution-profile-production.mjs +4 -0
  53. package/distribution-resource-inventory.mjs +4 -2
  54. package/package.json +5 -2
@@ -10,10 +10,12 @@ import { createModelFrame } from './model-frame.js';
10
10
  import { createModelViewportController } from './model-viewport.js';
11
11
  import { createEntityKeyRegistry } from './model-viewport-state.js';
12
12
  import { createModelSelectionCoordinator } from './model-selection-coordinator.js';
13
+ import { orderModelSelectionHits } from './model-selection-tools.js';
13
14
  import { createModelClipGesture, orientClipNormalAwayFromCamera } from './model-clip-gesture.js';
14
15
  import { createModelClipThreeOverlay } from './model-clip-three-overlay.js';
15
16
  import { createModelClipThreePreview } from './model-clip-three-preview.js';
16
17
  import { MODEL_LIGHTING_DEFAULTS, modelSunDirection, normalizeModelLighting } from './model-viewport-lighting.js';
18
+ import { createModelStructuralGridView } from './model-structural-grid-view.js';
17
19
 
18
20
  const COMPONENT = { 5121: { bytes: 1, read: 'getUint8', array: Uint8Array }, 5123: { bytes: 2, read: 'getUint16', array: Uint16Array }, 5125: { bytes: 4, read: 'getUint32', array: Uint32Array }, 5126: { bytes: 4, read: 'getFloat32', array: Float32Array } };
19
21
  const WIDTH = { SCALAR: 1, VEC2: 2, VEC3: 3, VEC4: 4 };
@@ -31,6 +33,14 @@ export function revitGeometryFrame(receipt = { schema: 'floless.model-cas-manife
31
33
  if (receipt?.schema === 'floless.model-cas-manifest/v2' && sameMatrix(receipt.geometryToRenderMatrix, IDENTITY_RENDER_MATRIX)) {
32
34
  return Object.freeze({ ...createModelFrame({ matrix: IDENTITY_RENDER_MATRIX, millimetresPerRenderUnit: 1 }), receiptSchema: receipt.schema });
33
35
  }
36
+ // Tekla's signed artifacts are already canonical mm/Z-up. Legacy imports used the
37
+ // v1 receipt shape and current imports use v3; only that exact provider may pair
38
+ // either schema with the identity matrix. Legacy RVT v1 stays metre/Y-up.
39
+ if (['floless.model-cas-manifest/v1', 'floless.model-cas-manifest/v3'].includes(receipt?.schema)
40
+ && receipt.providerKind === 'tekla-db'
41
+ && sameMatrix(receipt.geometryToRenderMatrix, IDENTITY_RENDER_MATRIX)) {
42
+ return Object.freeze({ ...createModelFrame({ matrix: IDENTITY_RENDER_MATRIX, millimetresPerRenderUnit: 1 }), receiptSchema: receipt.schema });
43
+ }
34
44
  throw new Error('The verified model uses an unsupported geometry-to-render frame.');
35
45
  }
36
46
 
@@ -563,9 +573,17 @@ export function createRevitIsolation() {
563
573
  };
564
574
  }
565
575
 
566
- export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuild = () => {} }) {
576
+ /** Camera-only bounds: including hidden members never changes the visibility/clip state. */
577
+ export function revitObjectBounds(objects, includeHidden = false) {
578
+ const box = new THREE.Box3();
579
+ objects.forEach((mesh) => { if (includeHidden || mesh.visible) box.expandByObject(mesh); });
580
+ return box;
581
+ }
582
+
583
+ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuild = () => {}, formatDistance = (valueMm) => `${Math.round(valueMm)} mm`, includeHiddenSelectionBounds = false }) {
584
+ if (typeof formatDistance !== 'function') throw new TypeError('Model viewport distance formatter must be a function.');
567
585
  const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: false }); renderer.setPixelRatio(Math.min(devicePixelRatio || 1, 2)); renderer.setClearColor(0x020817, 1); renderer.localClippingEnabled = true;
568
- const scene = new THREE.Scene(); const overlayScene = new THREE.Scene();
586
+ const scene = new THREE.Scene(); const gridLabelScene = new THREE.Scene(); const overlayScene = new THREE.Scene();
569
587
  const ambient = new THREE.AmbientLight(0xffffff, 1.6); scene.add(ambient);
570
588
  const key = new THREE.DirectionalLight(0xffffff, 1.4); scene.add(key); scene.add(key.target);
571
589
  let lighting = MODEL_LIGHTING_DEFAULTS;
@@ -576,6 +594,8 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
576
594
  let camera = perspective; let model = null; let modelDisposer = null; let meshes = []; let ownedMeshes = []; let mode = 'solid'; let selected = []; let hoveredId = null; let ghostUnselected = false; let disposed = false; let mounted = false; let shown = false; let paintAllowed = false; let orthoSpan = 10; let geometryFrame = revitGeometryFrame();
577
595
  let mountContext = null; let inputArbiter = null; let releaseClipInput = null; let releaseClipOverlayInput = null; let pendingLoad = null; let loadSequence = 0; let controller = null;
578
596
  let spatialTools = null; let releaseSpatial = null; let spatialState = null; let workPlaneHelper = null;
597
+ let structuralGrid = null; let structuralGridReceipt = null; let structuralGridOwnerId = null;
598
+ let structuralGridBaseVisible = true; let structuralGridVisibilityBeforeIsolation = null;
579
599
  // Outline materials are shared across generations (they are keyed by colour and opacity, not by
580
600
  // model), so the cache lives with the VIEWPORT and is disposed exactly once, at viewport disposal.
581
601
  const edgeMaterials = createRevitEdgeMaterials();
@@ -689,6 +709,10 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
689
709
  const orbitInput = createCadOrbitEventProxy(canvas);
690
710
  const controls = new OrbitControls(camera, orbitInput.element);
691
711
  const ray = new THREE.Raycaster(); const pointer = new THREE.Vector2();
712
+ const structuralGridView = createModelStructuralGridView({
713
+ scene, labelScene: gridLabelScene, getCamera: () => camera, getCanvas: () => canvas,
714
+ getClipPlanes: () => activeRenderPlanes,
715
+ });
692
716
  const cameraListeners = new Set();
693
717
  const orientationListeners = new Set();
694
718
  const pointerWorldListeners = new Set();
@@ -706,7 +730,15 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
706
730
  return hits;
707
731
  };
708
732
  const qualifiedHitAt = (clientX, clientY) => {
709
- const hit = ownerHitsAt(clientX, clientY)[0]; const receipt = hit?.object?.userData?.entityReceipt;
733
+ const winner = structuralGridView.pick({
734
+ clientX, clientY, meshHits: ownerHitsAt(clientX, clientY), raycaster: ray,
735
+ isOpaqueOccluder: (hit) => mode !== 'xray' && (hit.object?.material?.opacity ?? 1) >= .99,
736
+ });
737
+ if (winner?.kind === 'grid' && structuralGridReceipt) return {
738
+ ...structuralGridReceipt, providerToken: structuralGridOwnerId, gridSubIdentity: winner.id,
739
+ point: null, normal: null, distance: winner.distance,
740
+ };
741
+ const hit = winner?.kind === 'mesh' ? winner.hit : null; const receipt = hit?.object?.userData?.entityReceipt;
710
742
  if (!hit || !receipt) return null;
711
743
  return { ...receipt, providerToken: hit.object.userData.entityId, point: hit.point?.toArray() ?? null,
712
744
  normal: hit.face?.normal?.toArray() ?? null, distance: hit.distance };
@@ -727,7 +759,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
727
759
  mountContext?.reportCameraState?.();
728
760
  };
729
761
  function resize(size = {}) { const w = Math.max(1, size.width ?? canvas.clientWidth), h = Math.max(1, size.height ?? canvas.clientHeight); renderer.setPixelRatio(Math.min(size.pixelRatio ?? devicePixelRatio ?? 1, 2)); renderer.setSize(w, h, false); perspective.aspect = w / h; perspective.updateProjectionMatrix(); orthographic.left = -orthoSpan * w / h; orthographic.right = orthoSpan * w / h; orthographic.top = orthoSpan; orthographic.bottom = -orthoSpan; orthographic.updateProjectionMatrix(); }
730
- function bounds(objects = ownedMeshes) { const box = new THREE.Box3(); objects.forEach((mesh) => { if (mesh.visible) box.expandByObject(mesh); }); return box; }
762
+ function bounds(objects = ownedMeshes, includeHidden = false) { return revitObjectBounds(objects, includeHidden); }
731
763
  function applyLighting(value = lighting) {
732
764
  lighting = normalizeModelLighting(value);
733
765
  // Realistic REBALANCES this rig rather than adding to it. Ambient 1.6 and key 1.4 are bright
@@ -768,6 +800,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
768
800
  const inArea = !spatialVisibilityBox || spatialVisibilityBox.intersectsBox(new THREE.Box3().setFromObject(mesh));
769
801
  mesh.visible = composeRevitVisibility(baseVisibility.get(mesh) !== false, inArea);
770
802
  }
803
+ structuralGridView.setVisibility({ hiddenIds: structuralGridBaseVisible ? [] : structuralGridView.info().ids });
771
804
  };
772
805
  const paintSpatialState = (state) => {
773
806
  spatialState = state;
@@ -804,7 +837,13 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
804
837
  paintSelection(ownedMeshes, selected);
805
838
  mountContext?.reportSectionState?.();
806
839
  };
807
- function fit(objects = ownedMeshes, direction = MODEL_NAMED_VIEWS.iso) { const box = bounds(objects); if (box.isEmpty()) return; const sphere = box.getBoundingSphere(new THREE.Sphere()); orthoSpan = Math.max(sphere.radius * 1.35, .1); const view = new THREE.Vector3().fromArray(direction).normalize(); camera.position.copy(sphere.center).addScaledVector(view, Math.max(sphere.radius * 2.8, 1)); camera.near = Math.max(sphere.radius / 10000, .001); camera.far = Math.max(sphere.radius * 100, 100); camera.updateProjectionMatrix(); controls.object = camera; controls.target.copy(sphere.center); camera.lookAt(sphere.center); controls.update(); resize(); notifyCamera(); }
840
+ function fitBox(box, direction = MODEL_NAMED_VIEWS.iso) { if (!box || box.isEmpty()) return; const sphere = box.getBoundingSphere(new THREE.Sphere()); orthoSpan = Math.max(sphere.radius * 1.35, .1); const view = new THREE.Vector3().fromArray(direction).normalize(); camera.position.copy(sphere.center).addScaledVector(view, Math.max(sphere.radius * 2.8, 1)); camera.near = Math.max(sphere.radius / 10000, .001); camera.far = Math.max(sphere.radius * 100, 100); camera.updateProjectionMatrix(); controls.object = camera; controls.target.copy(sphere.center); camera.lookAt(sphere.center); controls.update(); resize(); notifyCamera(); }
841
+ function fit(objects = ownedMeshes, direction = MODEL_NAMED_VIEWS.iso, includeHidden = false) {
842
+ const purpose = arguments[3] ?? 'camera-all';
843
+ const meshBounds = bounds(objects, includeHidden);
844
+ fitBox(structuralGridView.composeBounds({ meshBounds: meshBounds.isEmpty() ? null : meshBounds, purpose,
845
+ gridOwnerSelected: structuralGridOwnerId != null && selected.includes(structuralGridOwnerId) }), direction);
846
+ }
808
847
  function applyView(name) { const direction = MODEL_NAMED_VIEWS[name]; if (direction) fit(ownedMeshes, direction); }
809
848
  function applyDirection(direction) {
810
849
  if (!Array.isArray(direction) || direction.length !== 3 || !direction.every(Number.isFinite)) throw new TypeError('View direction must be a finite vector.');
@@ -866,6 +905,10 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
866
905
  onCursor(value) { canvas.style.cursor = value; },
867
906
  });
868
907
  const clipReadout = document.createElement('div'); clipReadout.className = 'model-clip-drag-readout'; clipReadout.hidden = true; canvas.parentElement?.append(clipReadout);
908
+ let lastClipReadout = null;
909
+ const paintClipReadout = (value, text = formatDistance(value.valueMm)) => {
910
+ clipReadout.textContent = `${text}${value.type ? ` · ${value.type}` : ''}`;
911
+ };
869
912
  const clipGeometryPatch = (clip) => clip.kind === 'plane'
870
913
  ? { origin: [...(clip.origin ?? clip.point)], normal: [...(clip.normal ?? clip.n)] }
871
914
  : { min: [...(clip.box?.min ?? clip.min)], max: [...(clip.box?.max ?? clip.max)] };
@@ -878,17 +921,18 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
878
921
  getClips: () => clipSession?.clips?.() ?? spatialState?.clips ?? [],
879
922
  getSelectedClipIds: () => clipSession?.selected?.() ?? [],
880
923
  isPlacementArmed: () => clipGesture.state().active !== null,
881
- formatDistance: (valueMm) => `${Math.round(valueMm)} mm`,
924
+ formatDistance,
882
925
  update({ clipId, clip }) {
883
926
  if (!clipSession) return;
884
927
  clipEdit ||= clipSession.beginLogicalEdit('clip-handle-drag');
885
928
  clipEdit.update(clipId, clipGeometryPatch(clip));
886
929
  },
887
- commit() { clipEdit?.finish(); clipEdit = null; clipReadout.hidden = true; },
888
- cancel() { clipEdit?.finish(); clipEdit = null; clipReadout.hidden = true; },
930
+ commit() { clipEdit?.finish(); clipEdit = null; clipReadout.hidden = true; lastClipReadout = null; },
931
+ cancel() { clipEdit?.finish(); clipEdit = null; clipReadout.hidden = true; lastClipReadout = null; },
889
932
  readout(value) {
890
- if (value?.hidden || !value?.readout?.text) { clipReadout.hidden = true; return; }
891
- clipReadout.textContent = `${value.readout.text}${value.readout.type ? ` · ${value.readout.type}` : ''}`;
933
+ if (value?.hidden || !value?.readout?.text) { clipReadout.hidden = true; lastClipReadout = null; return; }
934
+ lastClipReadout = value.readout;
935
+ paintClipReadout(lastClipReadout, value.readout.text);
892
936
  clipReadout.style.left = `${value.event.clientX + 14}px`; clipReadout.style.top = `${value.event.clientY + 14}px`; clipReadout.hidden = false;
893
937
  },
894
938
  });
@@ -947,7 +991,10 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
947
991
  });
948
992
 
949
993
  const idsForKeys = (keys = []) => keys.map((key) => identityRegistry.lookup(key)).filter((item) => item?.kind === 'native').map((item) => item.sourceId);
950
- const visibleSnapshot = () => ownedMeshes.map((mesh) => ({ id: mesh.userData.entityId, visible: baseVisibility.get(mesh) !== false }));
994
+ const visibleSnapshot = () => [
995
+ ...ownedMeshes.map((mesh) => ({ id: mesh.userData.entityId, visible: baseVisibility.get(mesh) !== false })),
996
+ ...(structuralGridOwnerId ? [{ id: structuralGridOwnerId, visible: structuralGridBaseVisible }] : []),
997
+ ];
951
998
  const adapter = Object.freeze({
952
999
  mount(context) {
953
1000
  if (disposed) throw new Error('Revit viewport adapter is disposed.');
@@ -955,7 +1002,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
955
1002
  inputArbiter = mountCadInputArbiter({
956
1003
  surface: canvas, controls, orbitInput, getCamera: () => camera, pickPoint: pickSurface, applyView,
957
1004
  fitAll: () => controller.fitAll(),
958
- fitSelection: () => fit(ownedMeshes.filter((mesh) => selected.includes(mesh.userData.entityId))),
1005
+ fitSelection: () => fit(ownedMeshes.filter((mesh) => selected.includes(mesh.userData.entityId)), MODEL_NAMED_VIEWS.iso, includeHiddenSelectionBounds, 'camera-selection'),
959
1006
  isActive: () => mounted && shown && paintAllowed && canvas.offsetParent !== null,
960
1007
  plugin: selectionInputProxy,
961
1008
  });
@@ -979,13 +1026,20 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
979
1026
  const id = mesh.userData.entityId;
980
1027
  if (!receipts.has(id)) receipts.set(id, await context.generation.register('native', id));
981
1028
  }
1029
+ let nextGridReceipt = null;
1030
+ if (request.structuralGrid) nextGridReceipt = await context.generation.register('native', request.structuralGrid.ownerId);
982
1031
  for (const mesh of next.ownedMeshes) mesh.userData.entityReceipt = receipts.get(mesh.userData.entityId);
983
1032
  const records = [...receipts.entries()].map(([providerToken, identity]) => ({ identity, providerToken, layer: 'model', selectable: true }));
1033
+ if (nextGridReceipt && !receipts.has(request.structuralGrid.ownerId)) records.push({ identity: nextGridReceipt, providerToken: request.structuralGrid.ownerId, layer: 'datum', selectable: true });
984
1034
  const nextSnapIndex = buildModelSnapIndex(next.ownedMeshes); paintSelection(next.ownedMeshes, []);
985
1035
  const generation = createRevitViewportGeneration({ next, records, scene,
986
1036
  onActivate() {
987
1037
  model = next.root; meshes = next.meshes; ownedMeshes = next.ownedMeshes; geometryFrame = nextFrame;
988
- baseVisibility = new Map(ownedMeshes.map((mesh) => [mesh, true])); isolation.forget(); spatialVisibilityBox = null;
1038
+ structuralGrid = request.structuralGrid; structuralGridReceipt = nextGridReceipt; structuralGridOwnerId = structuralGrid?.ownerId ?? null;
1039
+ structuralGridView.clear();
1040
+ if (structuralGrid) structuralGridView.build({ grid: structuralGrid.grid, mmPerPx: 1, geometryOptions: { yUp: true },
1041
+ canonicalToRenderPoint: (point) => geometryFrame.canonicalToRenderPoint(point) });
1042
+ baseVisibility = new Map(ownedMeshes.map((mesh) => [mesh, true])); isolation.forget(); structuralGridBaseVisible = true; structuralGridVisibilityBeforeIsolation = null; spatialVisibilityBox = null;
989
1043
  modelDisposer = next.dispose;
990
1044
  snapIndex = nextSnapIndex; selected = []; hoveredId = null; applyRealistic(); if (spatialState) paintSpatialState(spatialState); clipOverlay.render();
991
1045
  // The staged generation is only live from here, so the outline build starts now —
@@ -993,7 +1047,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
993
1047
  cancelOutlineJob(); sceneGeneration += 1; ensureOutlines();
994
1048
  },
995
1049
  onRelease() {
996
- if (model === next.root) { cancelOutlineJob(); model = null; modelDisposer = null; meshes = []; ownedMeshes = []; hoveredId = null; baseVisibility.clear(); isolation.forget(); spatialVisibilityBox = null; snapIndex = buildModelSnapIndex([]); }
1050
+ if (model === next.root) { cancelOutlineJob(); model = null; modelDisposer = null; meshes = []; ownedMeshes = []; hoveredId = null; baseVisibility.clear(); isolation.forget(); structuralGridBaseVisible = true; structuralGridVisibilityBeforeIsolation = null; spatialVisibilityBox = null; snapIndex = buildModelSnapIndex([]); structuralGridView.clear(); structuralGrid = null; structuralGridReceipt = null; structuralGridOwnerId = null; }
997
1051
  },
998
1052
  });
999
1053
  return { empty: next.ownedMeshes.length === 0, generation };
@@ -1003,10 +1057,13 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1003
1057
  },
1004
1058
  bounds(purpose, keys = []) {
1005
1059
  const ids = purpose === 'camera-selection' ? new Set(idsForKeys(keys)) : null;
1006
- const box = bounds(ids ? ownedMeshes.filter((mesh) => ids.has(mesh.userData.entityId)) : ownedMeshes);
1007
- return box.isEmpty() ? null : { min: box.min.toArray(), max: box.max.toArray() };
1060
+ const box = bounds(ids ? ownedMeshes.filter((mesh) => ids.has(mesh.userData.entityId)) : ownedMeshes, !!ids && includeHiddenSelectionBounds);
1061
+ if (typeof structuralGridView === 'undefined') return box.isEmpty() ? null : { min: box.min.toArray(), max: box.max.toArray() };
1062
+ const composed = structuralGridView.composeBounds({ meshBounds: box.isEmpty() ? null : box, purpose,
1063
+ gridOwnerSelected: structuralGridOwnerId != null && ids?.has(structuralGridOwnerId) });
1064
+ return composed ? { min: composed.min.toArray(), max: composed.max.toArray() } : null;
1008
1065
  },
1009
- fit({ purpose }) { fit(purpose === 'camera-selection' ? ownedMeshes.filter((mesh) => selected.includes(mesh.userData.entityId)) : ownedMeshes); },
1066
+ fit({ purpose }) { fit(purpose === 'camera-selection' ? ownedMeshes.filter((mesh) => selected.includes(mesh.userData.entityId)) : ownedMeshes, MODEL_NAMED_VIEWS.iso, purpose === 'camera-selection' && includeHiddenSelectionBounds, purpose); },
1010
1067
  pick(payload) { return qualifiedHitAt(payload.clientX, payload.clientY); },
1011
1068
  raycastRecords(event) { const hit = qualifiedHitAt(event.clientX, event.clientY); return hit ? [hit] : []; },
1012
1069
  applyCamera(value) {
@@ -1029,31 +1086,40 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1029
1086
  applyPresentation({ selectedKeys = [], hoverKey = null, ghostUnselected: ghost = false }) {
1030
1087
  ghostUnselected = ghost === true; hoveredId = idsForKeys(hoverKey ? [hoverKey] : [])[0] ?? null;
1031
1088
  reflectSelection(idsForKeys(selectedKeys));
1089
+ structuralGridView.applyPaint({ selectedIds: structuralGridOwnerId && selected.includes(structuralGridOwnerId) ? structuralGridView.info().ids : [],
1090
+ ghost: { active: ghostUnselected && selected.length > 0, focusIds: structuralGridOwnerId && selected.includes(structuralGridOwnerId) ? structuralGridView.info().ids : [], opacity: .18 } });
1032
1091
  },
1033
- beforeRender() { controls.update(); clipOverlay.resize(); clipCreationPreview.resize(); }, render() { if (paintAllowed) { renderer.render(scene, camera); const previousAutoClear = renderer.autoClear; renderer.autoClear = false; renderer.clearDepth(); renderer.render(overlayScene, camera); renderer.autoClear = previousAutoClear; } }, afterRender() {},
1092
+ beforeRender() { controls.update(); structuralGridView.resizeLabels(); clipOverlay.resize(); clipCreationPreview.resize(); }, render() { if (paintAllowed) { renderer.render(scene, camera); const previousAutoClear = renderer.autoClear; renderer.autoClear = false; renderer.render(gridLabelScene, camera); renderer.clearDepth(); renderer.render(overlayScene, camera); renderer.autoClear = previousAutoClear; } }, afterRender() {},
1093
+ gridLevels: () => structuralGridView.levelInfo(),
1094
+ setGridHiddenLevels(values) { structuralGridView.setHiddenLevels(values); recomputeVisibility(); },
1034
1095
  setPaintAllowed(on) { paintAllowed = on === true; },
1035
1096
  snapshotVisibility: visibleSnapshot,
1036
- applyVisibilitySnapshot(value) { isolation.forget(); const visible = new Map((value ?? []).map((item) => [item.id, item.visible === true])); ownedMeshes.forEach((mesh) => { if (visible.has(mesh.userData.entityId)) baseVisibility.set(mesh, visible.get(mesh.userData.entityId)); }); recomputeVisibility(); paintSelection(ownedMeshes, selected); },
1097
+ applyVisibilitySnapshot(value) { isolation.forget(); structuralGridVisibilityBeforeIsolation = null; const visible = new Map((value ?? []).map((item) => [item.id, item.visible === true])); ownedMeshes.forEach((mesh) => { if (visible.has(mesh.userData.entityId)) baseVisibility.set(mesh, visible.get(mesh.userData.entityId)); }); if (structuralGridOwnerId && visible.has(structuralGridOwnerId)) structuralGridBaseVisible = visible.get(structuralGridOwnerId); recomputeVisibility(); paintSelection(ownedMeshes, selected); },
1037
1098
  hideSelection(keys) {
1038
1099
  const ids = new Set(idsForKeys(keys)); const hiddenIds = new Set();
1039
1100
  ownedMeshes.forEach((mesh) => { if (ids.has(mesh.userData.entityId) && baseVisibility.get(mesh) !== false) { baseVisibility.set(mesh, false); hiddenIds.add(mesh.userData.entityId); } });
1040
1101
  isolation.hid(ownedMeshes.filter((mesh) => ids.has(mesh.userData.entityId))); // even one the isolation had already hidden
1102
+ if (structuralGridOwnerId && ids.has(structuralGridOwnerId) && structuralGridBaseVisible) {
1103
+ structuralGridBaseVisible = false; hiddenIds.add(structuralGridOwnerId);
1104
+ if (structuralGridVisibilityBeforeIsolation !== null) structuralGridVisibilityBeforeIsolation = false;
1105
+ }
1041
1106
  recomputeVisibility(); paintSelection(ownedMeshes, selected);
1042
1107
  const hiddenKeys = keys.filter((key) => { const item = identityRegistry.lookup(key); return item?.kind === 'native' && hiddenIds.has(item.sourceId); });
1043
1108
  return Object.freeze({ count: hiddenIds.size, hiddenKeys: Object.freeze(hiddenKeys) });
1044
1109
  },
1045
- isolateSelection(keys) { const ids = new Set(idsForKeys(keys)); isolation.isolate(baseVisibility, ownedMeshes, (mesh) => ids.has(mesh.userData.entityId)); recomputeVisibility(); paintSelection(ownedMeshes, selected); },
1110
+ isolateSelection(keys) { const ids = new Set(idsForKeys(keys)); isolation.isolate(baseVisibility, ownedMeshes, (mesh) => ids.has(mesh.userData.entityId)); if (structuralGridVisibilityBeforeIsolation === null) structuralGridVisibilityBeforeIsolation = structuralGridBaseVisible; structuralGridBaseVisible = !!structuralGridOwnerId && ids.has(structuralGridOwnerId); recomputeVisibility(); paintSelection(ownedMeshes, selected); },
1046
1111
  isIsolated: () => isolation.active(),
1047
- clearIsolation() { if (isolation.clear(baseVisibility)) { recomputeVisibility(); paintSelection(ownedMeshes, selected); } },
1048
- clearVisibility() { isolation.forget(); ownedMeshes.forEach((mesh) => baseVisibility.set(mesh, true)); recomputeVisibility(); paintSelection(ownedMeshes, selected); },
1049
- hasVisibilityFilter() { return ownedMeshes.some((mesh) => baseVisibility.get(mesh) === false); },
1112
+ clearIsolation() { if (isolation.clear(baseVisibility)) { if (structuralGridVisibilityBeforeIsolation !== null) structuralGridBaseVisible = structuralGridVisibilityBeforeIsolation; structuralGridVisibilityBeforeIsolation = null; recomputeVisibility(); paintSelection(ownedMeshes, selected); } },
1113
+ clearVisibility() { isolation.forget(); structuralGridVisibilityBeforeIsolation = null; structuralGridBaseVisible = true; structuralGridView.setHiddenLevels([]); ownedMeshes.forEach((mesh) => baseVisibility.set(mesh, true)); recomputeVisibility(); paintSelection(ownedMeshes, selected); },
1114
+ hasVisibilityFilter() { return !structuralGridBaseVisible || structuralGridView.levelInfo().some((level) => !level.visible)
1115
+ || ownedMeshes.some((mesh) => baseVisibility.get(mesh) === false); },
1050
1116
  isVisibilityActionable(key) { return identityRegistry.lookup(key)?.kind === 'native'; },
1051
1117
  cameraState() { return { projection: camera === orthographic ? 'ortho' : 'persp', position: camera.position.toArray(), target: controls.target.toArray(), up: camera.up.toArray(), orthoHeight: orthoSpan * 2, zoom: camera.zoom, near: camera.near, far: camera.far }; },
1052
1118
  displayMode: () => mode,
1053
1119
  sectionState: () => ({ clipping: spatialState?.clips ?? [], workPlane: spatialState?.workPlane ?? null, workArea: spatialState?.workArea ?? null, activeClipGesture: clipGesture.state().active }),
1054
1120
  resize, blockOrbit() { const was = controls.enabled; controls.enabled = false; return () => { if (!disposed) controls.enabled = was; }; },
1055
1121
  show() { shown = true; controls.enabled = true; }, hide() { shown = false; controls.enabled = false; },
1056
- queueLoad(bytes, ownerByNode, frameReceipt) { pendingLoad = { id: ++loadSequence, bytes, ownerByNode, frameReceipt }; return pendingLoad.id; },
1122
+ queueLoad(bytes, ownerByNode, frameReceipt, structuralGridValue = null) { pendingLoad = { id: ++loadSequence, bytes, ownerByNode, frameReceipt, structuralGrid: structuralGridValue }; return pendingLoad.id; },
1057
1123
  registerInputTool(plugin, options) { if (!inputArbiter) throw new Error('Revit viewport input is not mounted.'); return inputArbiter.registerTool(plugin, options); },
1058
1124
  registerSelectionInterceptor(interceptor) {
1059
1125
  if (!interceptor || typeof interceptor !== 'object') throw new TypeError('Revit selection interceptor must be an object.');
@@ -1069,6 +1135,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1069
1135
  cancelOutlineJob(); edgeMaterials.dispose();
1070
1136
  scene.environment = null; environmentTarget?.dispose(); environmentTarget = null; environmentUp = null; environmentLive = false;
1071
1137
  modelDisposer?.(); modelDisposer = null; meshes = []; ownedMeshes = []; model = null;
1138
+ structuralGridView.dispose(); structuralGrid = null; structuralGridReceipt = null; structuralGridOwnerId = null;
1072
1139
  renderer.dispose(); renderer.forceContextLoss?.(); cameraListeners.clear(); orientationListeners.clear(); pointerWorldListeners.clear(); mountContext = null;
1073
1140
  },
1074
1141
  });
@@ -1108,13 +1175,24 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1108
1175
  generationToken: receipt.namespace, providerToken: sourceId, screenBounds: screenBoundsFor(mesh), rawVisible: mesh.visible, visible: mesh.visible,
1109
1176
  selectable: true, facets: { provider: 'revit' }, ...extra };
1110
1177
  };
1178
+ const gridSelectionHit = (extra = {}) => structuralGridReceipt && structuralGridOwnerId ? {
1179
+ entity: { kind: 'native', sourceId: structuralGridOwnerId }, key: structuralGridReceipt.key,
1180
+ namespace: structuralGridReceipt.namespace, generation: structuralGridReceipt.generation,
1181
+ generationToken: structuralGridReceipt.namespace, providerToken: structuralGridOwnerId,
1182
+ rawVisible: structuralGridView.info().visible.length > 0, visible: structuralGridView.info().visible.length > 0,
1183
+ selectable: true, facets: { provider: 'tekla-db', type: 'Grid' }, ...extra,
1184
+ } : null;
1111
1185
  const hitsAt = (value) => {
1112
- const seen = new Set(); const out = [];
1113
- for (const hit of ownerHitsAt(value?.x, value?.y)) {
1114
- const item = selectionHit(hit.object, { point: hit.point?.toArray() ?? null, normal: hit.face?.normal?.toArray() ?? null, distance: hit.distance });
1115
- if (item && !seen.has(item.key)) { seen.add(item.key); out.push(item); }
1116
- }
1117
- return out;
1186
+ const meshHits = ownerHitsAt(value?.x, value?.y);
1187
+ const meshCandidates = meshHits.map((hit) => selectionHit(hit.object, {
1188
+ point: hit.point?.toArray() ?? null, normal: hit.face?.normal?.toArray() ?? null, distance: hit.distance,
1189
+ })).filter(Boolean);
1190
+ const winner = structuralGridView.pick({ clientX: value?.x, clientY: value?.y, meshHits, raycaster: ray,
1191
+ isOpaqueOccluder: (hit) => mode !== 'xray' && (hit.object?.material?.opacity ?? 1) >= .99 });
1192
+ const primary = winner?.kind === 'grid'
1193
+ ? gridSelectionHit({ distance: winner.distance, gridSubIdentity: winner.id })
1194
+ : winner?.kind === 'mesh' ? meshCandidates.find((candidate) => candidate.providerToken === winner.hit.object?.userData?.entityId) ?? null : null;
1195
+ return orderModelSelectionHits(primary, meshCandidates);
1118
1196
  };
1119
1197
  const allHits = () => {
1120
1198
  const byKey = new Map();
@@ -1127,18 +1205,25 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1127
1205
  top: Math.min(prior.screenBounds.top, item.screenBounds.top), bottom: Math.max(prior.screenBounds.bottom, item.screenBounds.bottom),
1128
1206
  };
1129
1207
  }
1208
+ const grid = gridSelectionHit(); if (grid?.rawVisible) byKey.set(grid.key, grid);
1130
1209
  return [...byKey.values()];
1131
1210
  };
1132
1211
  const selectionTools = Object.freeze({
1133
- coordinator: selectionCoordinator, hitsAt, allHits, marqueeHits: () => allHits(),
1212
+ coordinator: selectionCoordinator, hitsAt, allHits, marqueeHits: (rect) => {
1213
+ const hits = allHits();
1214
+ const grid = gridSelectionHit(); if (!grid) return hits;
1215
+ const ids = structuralGridView.rectangleHits(rect.left, rect.top, rect.right, rect.bottom, rect.mode === 'enclosed');
1216
+ return ids.length ? hits : hits.filter((hit) => hit.key !== grid.key);
1217
+ },
1134
1218
  generationToken: () => identityRegistry.currentNamespace(),
1135
1219
  registerInterceptor: (interceptor) => adapter.registerSelectionInterceptor(interceptor),
1136
1220
  });
1137
1221
  const selectedMeshes = () => ownedMeshes.filter((mesh) => selected.includes(mesh.userData.entityId));
1138
1222
  const needSpatial = () => { if (!spatialTools) throw new Error('Shared spatial tools are not mounted.'); return spatialTools; };
1139
1223
  return Object.freeze({
1224
+ refreshDisplay() { if (disposed) return; if (lastClipReadout && !clipReadout.hidden) paintClipReadout(lastClipReadout); clipOverlay.render(); },
1140
1225
  isReady: () => !!model,
1141
- async load(bytes, ownerByNode, frameReceipt) { adapter.queueLoad(bytes, ownerByNode, frameReceipt); return controller.rebuild({ fit: true }); },
1226
+ async load(bytes, ownerByNode, frameReceipt, structuralGridValue = null) { adapter.queueLoad(bytes, ownerByNode, frameReceipt, structuralGridValue); return controller.rebuild({ fit: true }); },
1142
1227
  setProjection: (value) => controller.setProjection(value), setDisplayMode: (value) => controller.setDisplayMode(value),
1143
1228
  fitAll: () => controller.fitAll(), fitSelection: () => controller.fitSelection(),
1144
1229
  applyView, applyDirection, orientation,
@@ -1178,6 +1263,8 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1178
1263
  workAreaState: () => spatialState?.workArea ?? null,
1179
1264
  projection: () => controller.cameraState().projection, displayMode: () => controller.displayMode(),
1180
1265
  lightingState: () => ({ ...lighting }), setLighting: (value) => ({ ...applyLighting(value) }),
1266
+ gridLevels: () => adapter.gridLevels(),
1267
+ setGridHiddenLevels: (values) => adapter.setGridHiddenLevels(values),
1181
1268
  realisticState,
1182
1269
  outlineState: () => ({
1183
1270
  mode, meshes: ownedMeshes.length,
@@ -18,15 +18,20 @@ input[type=number]{-moz-appearance:textfield;appearance:textfield}input[type=num
18
18
  .authority-copy{display:grid;grid-template-columns:auto auto;column-gap:9px;align-items:baseline;min-width:0}.authority-kicker{grid-row:1/3;color:var(--accent);font-size:10px;letter-spacing:.12em;text-transform:uppercase}.authority-copy strong,.source-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.authority-copy strong{font-size:13px}.source-name{font-size:11px;color:var(--muted);max-width:42vw;unicode-bidi:plaintext}
19
19
  .authority-choices{display:flex;gap:4px;margin-left:auto}.authority-choices button{min-height:28px;font-size:11px}.authority-choices button[aria-pressed="true"]{color:#dbeafe;border-color:#3b82f6;background:var(--accent-soft)}
20
20
  .read-only-chip{border:1px solid var(--line);border-radius:999px;padding:3px 8px;color:var(--muted);font-size:10px;letter-spacing:.08em;text-transform:uppercase}
21
+ .model-display-units{display:flex;align-items:center;gap:0;flex-shrink:0;font-size:11px}.model-display-units>span{margin-right:7px;color:var(--muted)}.model-display-units button{min-height:28px;padding:3px 8px;border-radius:0}.model-display-units button:first-of-type{border-radius:5px 0 0 5px}.model-display-units button:last-child{border-radius:0 5px 5px 0;margin-left:-1px}.model-display-units button[aria-pressed="true"]{background:var(--accent-soft);border-color:var(--accent);color:var(--text);position:relative}.model-property-coverage{margin:10px 0 0;color:var(--muted);font-size:10px;line-height:1.5}
22
+ .revit-imported-property .property-value{white-space:pre-wrap}
23
+ .model-display-units button[data-unit-choice="mm"]{border-radius:0 5px 5px 0;margin-left:-1px}.model-display-units .model-units-retry{border-radius:5px;margin-left:7px}.model-display-units .model-units-status{margin-left:7px;margin-right:0}
21
24
  .editor-root{height:calc(100% - 54px);display:grid;grid-template-columns:minmax(0,1fr) 6px var(--panelw);min-width:0}.model-stage{position:relative;min-width:0;overflow:hidden;container-type:inline-size;background:radial-gradient(circle at 52% 45%,#14213a 0,#0b1322 58%,#080d18 100%)}
22
25
  #modelCanvas{display:block;width:100%;height:100%;touch-action:none}
23
26
  #modelSelectionMarquee{position:absolute;z-index:18;pointer-events:none;border:1px solid var(--accent);background:rgba(37,99,235,.12)}#modelSelectionMarquee[data-mode="crossing"]{border-style:dashed;background:rgba(16,185,129,.1);border-color:#34d399}
24
27
  #modelHoverSummary{position:absolute;left:50%;bottom:70px;z-index:17;max-width:min(440px,70%);transform:translateX(-50%);padding:5px 9px;border:1px solid var(--line);border-radius:6px;background:rgba(16,24,39,.94);box-shadow:var(--shadow-tip);color:var(--text);font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;pointer-events:none}
25
28
  .model-spatial-hud{position:absolute;right:12px;bottom:96px;z-index:16;display:flex;align-items:center;gap:8px;padding:5px 8px;border:1px solid var(--line);border-radius:6px;background:rgba(16,24,39,.9);box-shadow:var(--shadow-tip);font:10.5px/1.3 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--muted);pointer-events:none}.model-spatial-hud span:first-child{color:var(--accent);font-weight:700}.model-spatial-hud span+span{padding-left:8px;border-left:1px solid var(--line)}
26
29
  /* The Clips tab. Shown only in the main window's left Model section, whose frame it fills (createPanelHost). */
27
- body.model-panel-host{display:flex;flex-direction:column;background:var(--panel)}#revitPanelTabs{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;padding:6px}#revitPanelTabs[hidden]{display:none}.revit-clip-list-host{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;overflow:hidden}.revit-clip-list-host.model-clip-list{margin:0;padding:0;border-top:0}.revit-clip-list-host .model-clip-list-rows{min-height:0;overflow:auto;flex:1 1 auto}
30
+ body.model-panel-host{display:flex;flex-direction:column;background:var(--panel)}#revitPanelTabs{display:flex;flex:1 1 auto;flex-direction:column;min-height:0;padding:6px}#revitPanelTabs[hidden]{display:none}.revit-clip-list-host{display:none;flex:1 1 auto;flex-direction:column;min-height:0;overflow:hidden}.revit-clip-list-host.on{display:flex}.revit-clip-list-host.model-clip-list{margin:0;padding:0;border-top:0}.revit-clip-list-host .model-clip-list-rows{min-height:0;overflow:auto;flex:1 1 auto}
28
31
  .inspector-resizer{cursor:ew-resize;background:#0c1422;border-left:1px solid var(--line);border-right:1px solid transparent}.inspector-resizer:hover,.inspector-resizer.drag{background:#17243a;border-color:#36557e}.inspector-panel{min-width:0;background:var(--panel);display:flex;flex-direction:column}.inspector-body{overflow:auto;min-height:0;flex:1}.insp-head{padding:14px 14px 9px;font-weight:650;font-size:14px;border-bottom:1px solid var(--line);unicode-bidi:plaintext}.insp-note{padding:26px 16px;text-align:center;color:var(--muted)}.insp-body{padding:8px 12px 18px}.insp-section{padding:10px 0;border-bottom:1px solid var(--line)}.insp-section-heading{font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.1em;margin-bottom:7px}.property-row{display:grid;grid-template-columns:minmax(90px,.8fr) minmax(0,1.2fr);gap:10px;padding:3px 0}.property-key{color:var(--muted)}.property-value{min-width:0;overflow-wrap:anywhere;unicode-bidi:plaintext}.inspector-heading{display:flex}body.panel-collapsed .editor-root{grid-template-columns:minmax(0,1fr) 0 36px}body.panel-collapsed .inspector-resizer{display:none}body.panel-collapsed .inspector-panel{width:36px}body.panel-collapsed .inspector-heading{height:100%;padding:7px;align-items:flex-start}body.panel-collapsed .inspector-heading strong,body.panel-collapsed .inspector-body{display:none}
29
32
  .revit-property-search{width:100%;min-height:32px;margin-bottom:7px;padding:6px 9px;color:var(--text);background:var(--bg);border:1px solid var(--line);border-radius:6px;font:inherit}.revit-property-search:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-color:transparent}.revit-property-group{border:1px solid var(--line);border-radius:6px;margin-top:6px;overflow:hidden}.revit-property-group-trigger{width:100%;display:flex;align-items:center;gap:8px;text-align:left;border:0;border-radius:0;background:var(--panel-2)}.revit-property-group-trigger::before{content:'›';color:var(--muted);transform:rotate(0)}.revit-property-group-trigger[aria-expanded="true"]::before{transform:rotate(90deg)}.revit-property-group-body{padding:5px 8px}.revit-imported-property{display:grid;grid-template-columns:minmax(80px,.8fr) minmax(0,1.1fr) auto;gap:4px 8px;padding:7px 0;border-bottom:1px solid var(--line)}.revit-imported-property:last-child{border-bottom:0}.revit-property-provenance{grid-column:1/3;color:var(--muted);font-size:10px}.revit-property-copy{grid-column:3;grid-row:1/3;align-self:center;min-height:25px;padding:2px 7px;font-size:10px}
33
+ .tekla-uda-property{grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;column-gap:8px;row-gap:3px}.tekla-uda-property .property-key{grid-column:1;grid-row:1;min-width:0;overflow-wrap:anywhere;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px}.tekla-uda-property .property-value{grid-column:1;grid-row:2;min-width:0;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--text)}.tekla-uda-property .revit-property-copy{grid-column:2;grid-row:1/3}
34
+ .tekla-audit-host{display:none;flex:1 1 auto;min-height:0;overflow:hidden;flex-direction:column}.tekla-audit-host.on{display:flex}.tekla-audit-summary{position:sticky;top:0;z-index:1;display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:7px 7px 6px;background:var(--panel)}.tekla-audit-summary>div{display:flex;flex-direction:column;padding:8px;border:1px solid var(--line);border-radius:6px;background:var(--panel-2)}.tekla-audit-summary strong{font-size:17px;line-height:1.1}.tekla-audit-summary span{margin-top:3px;color:var(--muted);font-size:10px}.tekla-audit-filters{display:flex;flex-wrap:wrap;gap:4px;padding:3px 7px 7px;border-bottom:1px solid var(--line)}.tekla-audit-filter{min-height:26px;padding:3px 7px;font-size:10px}.tekla-audit-filter[aria-pressed="true"]{color:#dbeafe;border-color:#3b82f6;background:var(--accent-soft)}.tekla-audit-list{flex:1 1 auto;min-height:0;overflow:auto;padding:6px 7px}.tekla-audit-row{width:100%;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 8px;margin-bottom:5px;padding:8px;text-align:left;background:transparent}.tekla-audit-row[aria-selected="true"]{border-color:var(--accent);background:var(--accent-soft)}.tekla-audit-row strong,.tekla-audit-row>span:nth-child(2){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tekla-audit-row>span:nth-child(2){grid-column:1;color:var(--muted);font-size:11px;unicode-bidi:plaintext}.tekla-audit-location{grid-column:2;grid-row:1/3;align-self:center;color:#93c5fd;font-size:10px}.tekla-audit-location.missing{color:#fda4af}.tekla-audit-state,.tekla-audit-empty{display:flex;flex-direction:column;gap:5px;padding:18px 12px;color:var(--muted);text-align:center}.tekla-audit-state strong{color:var(--text)}.tekla-audit-inspector-ok{padding:5px 0;color:var(--muted)}.tekla-audit-inspector-item{padding:8px 0;border-bottom:1px solid var(--line)}.tekla-audit-inspector-item:last-child{border-bottom:0}.tekla-audit-inspector-item p{margin:4px 0;color:var(--muted)}.tekla-audit-technical summary{cursor:pointer;color:var(--accent);font-size:11px}.tekla-audit-technical pre{max-height:180px;overflow:auto;margin:6px 0 0;padding:7px;border:1px solid var(--line);border-radius:5px;background:var(--bg);color:var(--muted);font:10px/1.4 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre-wrap;overflow-wrap:anywhere}
30
35
  .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
36
  .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
37
  .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)}}
@@ -37,6 +42,11 @@ body.model-panel-host{display:flex;flex-direction:column;background:var(--panel)
37
42
  status. The shared chrome stays styled only by model-editor.css (model-editor-shell.test.ts). */
38
43
  .editor-root[data-model-state="empty"]>:not(.model-stage),.editor-root[data-model-state="empty"]>.model-stage>:not(#loadingState){display:none}
39
44
  body:has(.editor-root[data-model-state="empty"]) .read-only-chip{display:none}
45
+ :root[data-theme="light"]:has(.editor-root[data-model-state="empty"]){color-scheme:light;--bg:#fff;--panel:#fff;--line:#e2e8f0;--text:#0f172a;--muted:#64748b;--accent:#2563eb;--scroll:#cbd5e1;--scroll-hover:#94a3b8}
46
+ :root[data-theme="light"]:has(.editor-root[data-model-state="empty"]) .authority-bar{background:#fff}
47
+ :root[data-theme="light"]:has(.editor-root[data-model-state="empty"]) .model-stage{background:#f1f5f9}
48
+ :root[data-theme="light"]:has(.editor-root[data-model-state="empty"]) .viewport-state-empty{background:transparent}
40
49
  #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}
41
50
  #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}
42
51
  @media(max-width:820px){:root{--panelw:280px}.authority-kicker,.source-name{display:none}}
52
+ .tekla-audit-omissions{grid-column:1/-1;margin:0;padding:6px 2px;color:var(--muted);font-size:11px;line-height:1.4}
@@ -3,19 +3,20 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
- <title>Revit model · FloLess</title>
6
+ <title>Revit Parser · FloLess</title>
7
7
  <link rel="stylesheet" href="model-editor.css">
8
8
  <link rel="stylesheet" href="revit-editor.css">
9
9
  </head>
10
10
  <body class="revit-model-editor">
11
11
  <header class="authority-bar">
12
12
  <div class="authority-copy">
13
- <span class="authority-kicker">Revit model</span>
13
+ <span class="authority-kicker">Revit Parser</span>
14
14
  <strong id="modelName">Loading model…</strong>
15
15
  <span id="sourceName" class="source-name"></span>
16
16
  </div>
17
17
  <div id="authorityChoices" class="authority-choices" role="group" aria-label="Model authority"></div>
18
- <span class="read-only-chip">Read only</span>
18
+ <div id="modelUnits" class="model-display-units"></div>
19
+ <span class="read-only-chip">Read-only</span>
19
20
  </header>
20
21
  <main id="editorRoot" class="editor-root">
21
22
  <section id="modelStage" class="model-stage" aria-label="Revit model viewport">