@floless/app 0.143.0 → 0.145.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 (52) hide show
  1. package/dist/floless-server.cjs +177602 -161132
  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/aware.js +423 -46
  15. package/dist/web/chat.css +17 -2
  16. package/dist/web/chat.js +2 -1
  17. package/dist/web/commands-revit.js +4 -0
  18. package/dist/web/commands-shell.js +136 -3
  19. package/dist/web/commands-steel.js +6 -0
  20. package/dist/web/commands-tekla-parser.js +48 -0
  21. package/dist/web/commands.js +1 -1
  22. package/dist/web/grid-core.js +15 -0
  23. package/dist/web/index.html +43 -5
  24. package/dist/web/instructor.js +13 -3
  25. package/dist/web/left-pane.js +160 -10
  26. package/dist/web/model-artifact-loader.js +15 -0
  27. package/dist/web/model-display-units.js +89 -0
  28. package/dist/web/model-editor-revit-adapter.js +21 -4
  29. package/dist/web/model-editor.css +4 -2
  30. package/dist/web/model-measure.js +83 -22
  31. package/dist/web/model-panel-bridge.js +46 -3
  32. package/dist/web/model-pointer-dock.js +26 -1
  33. package/dist/web/model-property-display.js +91 -0
  34. package/dist/web/model-revit-module.js +9 -0
  35. package/dist/web/model-selection-tools.js +11 -0
  36. package/dist/web/model-snap-contract.js +14 -0
  37. package/dist/web/model-snapping.js +564 -139
  38. package/dist/web/model-spatial-panel.js +52 -21
  39. package/dist/web/model-structural-grid-view.js +334 -0
  40. package/dist/web/model-tekla-selection.js +32 -0
  41. package/dist/web/model-viewport-revit-adapter.js +179 -32
  42. package/dist/web/revit-editor.css +11 -1
  43. package/dist/web/revit-editor.html +4 -3
  44. package/dist/web/revit-editor.js +589 -111
  45. package/dist/web/steel-3d-view.js +58 -372
  46. package/dist/web/steel-editor.html +231 -8
  47. package/dist/web/tekla-editor.html +71 -0
  48. package/dist/web/tekla-structural-grid-adapter.js +56 -0
  49. package/dist/web/workspaces.js +872 -97
  50. package/distribution-profile-production.mjs +4 -0
  51. package/distribution-resource-inventory.mjs +4 -2
  52. 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,51 @@ 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
+ /** How much nearer than a snap point a surface must be to hide it, in model millimetres. */
584
+ export const REVIT_SNAP_OCCLUSION_TOLERANCE_MM = 0.5;
585
+ const occlusionBoxes = new WeakMap();
586
+
587
+ /**
588
+ * Is `point` hidden from `origin` by a visible, un-clipped surface nearer than `tolerance` (render
589
+ * units) short of it? Only meshes whose world box the sight segment crosses are raycast, one at a time,
590
+ * and the answer is given at the first hit that counts — the same visibility rule as the surface pick.
591
+ */
592
+ export function revitSnapPointOccluded(point, origin, meshes, planes = [], tolerance = 0) {
593
+ if (!Array.isArray(origin) || !Array.isArray(point) || !meshes?.length) return false;
594
+ const from = new THREE.Vector3().fromArray(origin); const to = new THREE.Vector3().fromArray(point);
595
+ const length = from.distanceTo(to); const far = length - Math.max(0, tolerance);
596
+ if (!(far > 0)) return false;
597
+ const probe = new THREE.Raycaster(from, to.clone().sub(from).divideScalar(length), 0, far);
598
+ const entry = new THREE.Vector3(); const hits = [];
599
+ for (const mesh of meshes) {
600
+ if (!mesh?.visible) continue;
601
+ // World box cached per mesh, rebuilt when the mesh moves (its world matrix changes).
602
+ let cached = occlusionBoxes.get(mesh);
603
+ if (!cached || !cached.matrix.equals(mesh.matrixWorld)) {
604
+ if (!mesh.geometry.boundingBox) mesh.geometry.computeBoundingBox();
605
+ cached = { matrix: mesh.matrixWorld.clone(), box: mesh.geometry.boundingBox.clone().applyMatrix4(mesh.matrixWorld) };
606
+ occlusionBoxes.set(mesh, cached);
607
+ }
608
+ const box = cached.box;
609
+ const crossing = box.containsPoint(from) ? from : probe.ray.intersectBox(box, entry);
610
+ if (!crossing || from.distanceTo(crossing) > far) continue;
611
+ hits.length = 0; mesh.raycast(probe, hits);
612
+ if (hits.some((hit) => hit.distance <= far && planes.every((plane) => plane.distanceToPoint(hit.point) >= -1e-7))) return true;
613
+ }
614
+ return false;
615
+ }
616
+
617
+ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuild = () => {}, formatDistance = (valueMm) => `${Math.round(valueMm)} mm`, includeHiddenSelectionBounds = false }) {
618
+ if (typeof formatDistance !== 'function') throw new TypeError('Model viewport distance formatter must be a function.');
567
619
  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();
620
+ const scene = new THREE.Scene(); const gridLabelScene = new THREE.Scene(); const overlayScene = new THREE.Scene();
569
621
  const ambient = new THREE.AmbientLight(0xffffff, 1.6); scene.add(ambient);
570
622
  const key = new THREE.DirectionalLight(0xffffff, 1.4); scene.add(key); scene.add(key.target);
571
623
  let lighting = MODEL_LIGHTING_DEFAULTS;
@@ -576,6 +628,8 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
576
628
  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
629
  let mountContext = null; let inputArbiter = null; let releaseClipInput = null; let releaseClipOverlayInput = null; let pendingLoad = null; let loadSequence = 0; let controller = null;
578
630
  let spatialTools = null; let releaseSpatial = null; let spatialState = null; let workPlaneHelper = null;
631
+ let structuralGrid = null; let structuralGridReceipt = null; let structuralGridOwnerId = null;
632
+ let structuralGridBaseVisible = true; let structuralGridVisibilityBeforeIsolation = null;
579
633
  // Outline materials are shared across generations (they are keyed by colour and opacity, not by
580
634
  // model), so the cache lives with the VIEWPORT and is disposed exactly once, at viewport disposal.
581
635
  const edgeMaterials = createRevitEdgeMaterials();
@@ -689,6 +743,10 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
689
743
  const orbitInput = createCadOrbitEventProxy(canvas);
690
744
  const controls = new OrbitControls(camera, orbitInput.element);
691
745
  const ray = new THREE.Raycaster(); const pointer = new THREE.Vector2();
746
+ const structuralGridView = createModelStructuralGridView({
747
+ scene, labelScene: gridLabelScene, getCamera: () => camera, getCanvas: () => canvas,
748
+ getClipPlanes: () => activeRenderPlanes,
749
+ });
692
750
  const cameraListeners = new Set();
693
751
  const orientationListeners = new Set();
694
752
  const pointerWorldListeners = new Set();
@@ -706,7 +764,15 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
706
764
  return hits;
707
765
  };
708
766
  const qualifiedHitAt = (clientX, clientY) => {
709
- const hit = ownerHitsAt(clientX, clientY)[0]; const receipt = hit?.object?.userData?.entityReceipt;
767
+ const winner = structuralGridView.pick({
768
+ clientX, clientY, meshHits: ownerHitsAt(clientX, clientY), raycaster: ray,
769
+ isOpaqueOccluder: (hit) => mode !== 'xray' && (hit.object?.material?.opacity ?? 1) >= .99,
770
+ });
771
+ if (winner?.kind === 'grid' && structuralGridReceipt) return {
772
+ ...structuralGridReceipt, providerToken: structuralGridOwnerId, gridSubIdentity: winner.id,
773
+ point: null, normal: null, distance: winner.distance,
774
+ };
775
+ const hit = winner?.kind === 'mesh' ? winner.hit : null; const receipt = hit?.object?.userData?.entityReceipt;
710
776
  if (!hit || !receipt) return null;
711
777
  return { ...receipt, providerToken: hit.object.userData.entityId, point: hit.point?.toArray() ?? null,
712
778
  normal: hit.face?.normal?.toArray() ?? null, distance: hit.distance };
@@ -727,7 +793,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
727
793
  mountContext?.reportCameraState?.();
728
794
  };
729
795
  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; }
796
+ function bounds(objects = ownedMeshes, includeHidden = false) { return revitObjectBounds(objects, includeHidden); }
731
797
  function applyLighting(value = lighting) {
732
798
  lighting = normalizeModelLighting(value);
733
799
  // Realistic REBALANCES this rig rather than adding to it. Ambient 1.6 and key 1.4 are bright
@@ -768,6 +834,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
768
834
  const inArea = !spatialVisibilityBox || spatialVisibilityBox.intersectsBox(new THREE.Box3().setFromObject(mesh));
769
835
  mesh.visible = composeRevitVisibility(baseVisibility.get(mesh) !== false, inArea);
770
836
  }
837
+ structuralGridView.setVisibility({ hiddenIds: structuralGridBaseVisible ? [] : structuralGridView.info().ids });
771
838
  };
772
839
  const paintSpatialState = (state) => {
773
840
  spatialState = state;
@@ -804,7 +871,13 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
804
871
  paintSelection(ownedMeshes, selected);
805
872
  mountContext?.reportSectionState?.();
806
873
  };
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(); }
874
+ 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(); }
875
+ function fit(objects = ownedMeshes, direction = MODEL_NAMED_VIEWS.iso, includeHidden = false) {
876
+ const purpose = arguments[3] ?? 'camera-all';
877
+ const meshBounds = bounds(objects, includeHidden);
878
+ fitBox(structuralGridView.composeBounds({ meshBounds: meshBounds.isEmpty() ? null : meshBounds, purpose,
879
+ gridOwnerSelected: structuralGridOwnerId != null && selected.includes(structuralGridOwnerId) }), direction);
880
+ }
808
881
  function applyView(name) { const direction = MODEL_NAMED_VIEWS[name]; if (direction) fit(ownedMeshes, direction); }
809
882
  function applyDirection(direction) {
810
883
  if (!Array.isArray(direction) || direction.length !== 3 || !direction.every(Number.isFinite)) throw new TypeError('View direction must be a finite vector.');
@@ -866,6 +939,10 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
866
939
  onCursor(value) { canvas.style.cursor = value; },
867
940
  });
868
941
  const clipReadout = document.createElement('div'); clipReadout.className = 'model-clip-drag-readout'; clipReadout.hidden = true; canvas.parentElement?.append(clipReadout);
942
+ let lastClipReadout = null;
943
+ const paintClipReadout = (value, text = formatDistance(value.valueMm)) => {
944
+ clipReadout.textContent = `${text}${value.type ? ` · ${value.type}` : ''}`;
945
+ };
869
946
  const clipGeometryPatch = (clip) => clip.kind === 'plane'
870
947
  ? { origin: [...(clip.origin ?? clip.point)], normal: [...(clip.normal ?? clip.n)] }
871
948
  : { min: [...(clip.box?.min ?? clip.min)], max: [...(clip.box?.max ?? clip.max)] };
@@ -878,17 +955,18 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
878
955
  getClips: () => clipSession?.clips?.() ?? spatialState?.clips ?? [],
879
956
  getSelectedClipIds: () => clipSession?.selected?.() ?? [],
880
957
  isPlacementArmed: () => clipGesture.state().active !== null,
881
- formatDistance: (valueMm) => `${Math.round(valueMm)} mm`,
958
+ formatDistance,
882
959
  update({ clipId, clip }) {
883
960
  if (!clipSession) return;
884
961
  clipEdit ||= clipSession.beginLogicalEdit('clip-handle-drag');
885
962
  clipEdit.update(clipId, clipGeometryPatch(clip));
886
963
  },
887
- commit() { clipEdit?.finish(); clipEdit = null; clipReadout.hidden = true; },
888
- cancel() { clipEdit?.finish(); clipEdit = null; clipReadout.hidden = true; },
964
+ commit() { clipEdit?.finish(); clipEdit = null; clipReadout.hidden = true; lastClipReadout = null; },
965
+ cancel() { clipEdit?.finish(); clipEdit = null; clipReadout.hidden = true; lastClipReadout = null; },
889
966
  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}` : ''}`;
967
+ if (value?.hidden || !value?.readout?.text) { clipReadout.hidden = true; lastClipReadout = null; return; }
968
+ lastClipReadout = value.readout;
969
+ paintClipReadout(lastClipReadout, value.readout.text);
892
970
  clipReadout.style.left = `${value.event.clientX + 14}px`; clipReadout.style.top = `${value.event.clientY + 14}px`; clipReadout.hidden = false;
893
971
  },
894
972
  });
@@ -947,7 +1025,10 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
947
1025
  });
948
1026
 
949
1027
  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 }));
1028
+ const visibleSnapshot = () => [
1029
+ ...ownedMeshes.map((mesh) => ({ id: mesh.userData.entityId, visible: baseVisibility.get(mesh) !== false })),
1030
+ ...(structuralGridOwnerId ? [{ id: structuralGridOwnerId, visible: structuralGridBaseVisible }] : []),
1031
+ ];
951
1032
  const adapter = Object.freeze({
952
1033
  mount(context) {
953
1034
  if (disposed) throw new Error('Revit viewport adapter is disposed.');
@@ -955,7 +1036,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
955
1036
  inputArbiter = mountCadInputArbiter({
956
1037
  surface: canvas, controls, orbitInput, getCamera: () => camera, pickPoint: pickSurface, applyView,
957
1038
  fitAll: () => controller.fitAll(),
958
- fitSelection: () => fit(ownedMeshes.filter((mesh) => selected.includes(mesh.userData.entityId))),
1039
+ fitSelection: () => fit(ownedMeshes.filter((mesh) => selected.includes(mesh.userData.entityId)), MODEL_NAMED_VIEWS.iso, includeHiddenSelectionBounds, 'camera-selection'),
959
1040
  isActive: () => mounted && shown && paintAllowed && canvas.offsetParent !== null,
960
1041
  plugin: selectionInputProxy,
961
1042
  });
@@ -979,13 +1060,20 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
979
1060
  const id = mesh.userData.entityId;
980
1061
  if (!receipts.has(id)) receipts.set(id, await context.generation.register('native', id));
981
1062
  }
1063
+ let nextGridReceipt = null;
1064
+ if (request.structuralGrid) nextGridReceipt = await context.generation.register('native', request.structuralGrid.ownerId);
982
1065
  for (const mesh of next.ownedMeshes) mesh.userData.entityReceipt = receipts.get(mesh.userData.entityId);
983
1066
  const records = [...receipts.entries()].map(([providerToken, identity]) => ({ identity, providerToken, layer: 'model', selectable: true }));
1067
+ if (nextGridReceipt && !receipts.has(request.structuralGrid.ownerId)) records.push({ identity: nextGridReceipt, providerToken: request.structuralGrid.ownerId, layer: 'datum', selectable: true });
984
1068
  const nextSnapIndex = buildModelSnapIndex(next.ownedMeshes); paintSelection(next.ownedMeshes, []);
985
1069
  const generation = createRevitViewportGeneration({ next, records, scene,
986
1070
  onActivate() {
987
1071
  model = next.root; meshes = next.meshes; ownedMeshes = next.ownedMeshes; geometryFrame = nextFrame;
988
- baseVisibility = new Map(ownedMeshes.map((mesh) => [mesh, true])); isolation.forget(); spatialVisibilityBox = null;
1072
+ structuralGrid = request.structuralGrid; structuralGridReceipt = nextGridReceipt; structuralGridOwnerId = structuralGrid?.ownerId ?? null;
1073
+ structuralGridView.clear();
1074
+ if (structuralGrid) structuralGridView.build({ grid: structuralGrid.grid, mmPerPx: 1, geometryOptions: { yUp: true },
1075
+ canonicalToRenderPoint: (point) => geometryFrame.canonicalToRenderPoint(point) });
1076
+ baseVisibility = new Map(ownedMeshes.map((mesh) => [mesh, true])); isolation.forget(); structuralGridBaseVisible = true; structuralGridVisibilityBeforeIsolation = null; spatialVisibilityBox = null;
989
1077
  modelDisposer = next.dispose;
990
1078
  snapIndex = nextSnapIndex; selected = []; hoveredId = null; applyRealistic(); if (spatialState) paintSpatialState(spatialState); clipOverlay.render();
991
1079
  // The staged generation is only live from here, so the outline build starts now —
@@ -993,7 +1081,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
993
1081
  cancelOutlineJob(); sceneGeneration += 1; ensureOutlines();
994
1082
  },
995
1083
  onRelease() {
996
- if (model === next.root) { cancelOutlineJob(); model = null; modelDisposer = null; meshes = []; ownedMeshes = []; hoveredId = null; baseVisibility.clear(); isolation.forget(); spatialVisibilityBox = null; snapIndex = buildModelSnapIndex([]); }
1084
+ 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
1085
  },
998
1086
  });
999
1087
  return { empty: next.ownedMeshes.length === 0, generation };
@@ -1003,10 +1091,13 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1003
1091
  },
1004
1092
  bounds(purpose, keys = []) {
1005
1093
  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() };
1094
+ const box = bounds(ids ? ownedMeshes.filter((mesh) => ids.has(mesh.userData.entityId)) : ownedMeshes, !!ids && includeHiddenSelectionBounds);
1095
+ if (typeof structuralGridView === 'undefined') return box.isEmpty() ? null : { min: box.min.toArray(), max: box.max.toArray() };
1096
+ const composed = structuralGridView.composeBounds({ meshBounds: box.isEmpty() ? null : box, purpose,
1097
+ gridOwnerSelected: structuralGridOwnerId != null && ids?.has(structuralGridOwnerId) });
1098
+ return composed ? { min: composed.min.toArray(), max: composed.max.toArray() } : null;
1008
1099
  },
1009
- fit({ purpose }) { fit(purpose === 'camera-selection' ? ownedMeshes.filter((mesh) => selected.includes(mesh.userData.entityId)) : ownedMeshes); },
1100
+ 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
1101
  pick(payload) { return qualifiedHitAt(payload.clientX, payload.clientY); },
1011
1102
  raycastRecords(event) { const hit = qualifiedHitAt(event.clientX, event.clientY); return hit ? [hit] : []; },
1012
1103
  applyCamera(value) {
@@ -1029,31 +1120,40 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1029
1120
  applyPresentation({ selectedKeys = [], hoverKey = null, ghostUnselected: ghost = false }) {
1030
1121
  ghostUnselected = ghost === true; hoveredId = idsForKeys(hoverKey ? [hoverKey] : [])[0] ?? null;
1031
1122
  reflectSelection(idsForKeys(selectedKeys));
1123
+ structuralGridView.applyPaint({ selectedIds: structuralGridOwnerId && selected.includes(structuralGridOwnerId) ? structuralGridView.info().ids : [],
1124
+ ghost: { active: ghostUnselected && selected.length > 0, focusIds: structuralGridOwnerId && selected.includes(structuralGridOwnerId) ? structuralGridView.info().ids : [], opacity: .18 } });
1032
1125
  },
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() {},
1126
+ 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() {},
1127
+ gridLevels: () => structuralGridView.levelInfo(),
1128
+ setGridHiddenLevels(values) { structuralGridView.setHiddenLevels(values); recomputeVisibility(); },
1034
1129
  setPaintAllowed(on) { paintAllowed = on === true; },
1035
1130
  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); },
1131
+ 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
1132
  hideSelection(keys) {
1038
1133
  const ids = new Set(idsForKeys(keys)); const hiddenIds = new Set();
1039
1134
  ownedMeshes.forEach((mesh) => { if (ids.has(mesh.userData.entityId) && baseVisibility.get(mesh) !== false) { baseVisibility.set(mesh, false); hiddenIds.add(mesh.userData.entityId); } });
1040
1135
  isolation.hid(ownedMeshes.filter((mesh) => ids.has(mesh.userData.entityId))); // even one the isolation had already hidden
1136
+ if (structuralGridOwnerId && ids.has(structuralGridOwnerId) && structuralGridBaseVisible) {
1137
+ structuralGridBaseVisible = false; hiddenIds.add(structuralGridOwnerId);
1138
+ if (structuralGridVisibilityBeforeIsolation !== null) structuralGridVisibilityBeforeIsolation = false;
1139
+ }
1041
1140
  recomputeVisibility(); paintSelection(ownedMeshes, selected);
1042
1141
  const hiddenKeys = keys.filter((key) => { const item = identityRegistry.lookup(key); return item?.kind === 'native' && hiddenIds.has(item.sourceId); });
1043
1142
  return Object.freeze({ count: hiddenIds.size, hiddenKeys: Object.freeze(hiddenKeys) });
1044
1143
  },
1045
- isolateSelection(keys) { const ids = new Set(idsForKeys(keys)); isolation.isolate(baseVisibility, ownedMeshes, (mesh) => ids.has(mesh.userData.entityId)); recomputeVisibility(); paintSelection(ownedMeshes, selected); },
1144
+ 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
1145
  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); },
1146
+ clearIsolation() { if (isolation.clear(baseVisibility)) { if (structuralGridVisibilityBeforeIsolation !== null) structuralGridBaseVisible = structuralGridVisibilityBeforeIsolation; structuralGridVisibilityBeforeIsolation = null; recomputeVisibility(); paintSelection(ownedMeshes, selected); } },
1147
+ clearVisibility() { isolation.forget(); structuralGridVisibilityBeforeIsolation = null; structuralGridBaseVisible = true; structuralGridView.setHiddenLevels([]); ownedMeshes.forEach((mesh) => baseVisibility.set(mesh, true)); recomputeVisibility(); paintSelection(ownedMeshes, selected); },
1148
+ hasVisibilityFilter() { return !structuralGridBaseVisible || structuralGridView.levelInfo().some((level) => !level.visible)
1149
+ || ownedMeshes.some((mesh) => baseVisibility.get(mesh) === false); },
1050
1150
  isVisibilityActionable(key) { return identityRegistry.lookup(key)?.kind === 'native'; },
1051
1151
  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
1152
  displayMode: () => mode,
1053
1153
  sectionState: () => ({ clipping: spatialState?.clips ?? [], workPlane: spatialState?.workPlane ?? null, workArea: spatialState?.workArea ?? null, activeClipGesture: clipGesture.state().active }),
1054
1154
  resize, blockOrbit() { const was = controls.enabled; controls.enabled = false; return () => { if (!disposed) controls.enabled = was; }; },
1055
1155
  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; },
1156
+ queueLoad(bytes, ownerByNode, frameReceipt, structuralGridValue = null) { pendingLoad = { id: ++loadSequence, bytes, ownerByNode, frameReceipt, structuralGrid: structuralGridValue }; return pendingLoad.id; },
1057
1157
  registerInputTool(plugin, options) { if (!inputArbiter) throw new Error('Revit viewport input is not mounted.'); return inputArbiter.registerTool(plugin, options); },
1058
1158
  registerSelectionInterceptor(interceptor) {
1059
1159
  if (!interceptor || typeof interceptor !== 'object') throw new TypeError('Revit selection interceptor must be an object.');
@@ -1069,6 +1169,7 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1069
1169
  cancelOutlineJob(); edgeMaterials.dispose();
1070
1170
  scene.environment = null; environmentTarget?.dispose(); environmentTarget = null; environmentUp = null; environmentLive = false;
1071
1171
  modelDisposer?.(); modelDisposer = null; meshes = []; ownedMeshes = []; model = null;
1172
+ structuralGridView.dispose(); structuralGrid = null; structuralGridReceipt = null; structuralGridOwnerId = null;
1072
1173
  renderer.dispose(); renderer.forceContextLoss?.(); cameraListeners.clear(); orientationListeners.clear(); pointerWorldListeners.clear(); mountContext = null;
1073
1174
  },
1074
1175
  });
@@ -1108,13 +1209,24 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1108
1209
  generationToken: receipt.namespace, providerToken: sourceId, screenBounds: screenBoundsFor(mesh), rawVisible: mesh.visible, visible: mesh.visible,
1109
1210
  selectable: true, facets: { provider: 'revit' }, ...extra };
1110
1211
  };
1212
+ const gridSelectionHit = (extra = {}) => structuralGridReceipt && structuralGridOwnerId ? {
1213
+ entity: { kind: 'native', sourceId: structuralGridOwnerId }, key: structuralGridReceipt.key,
1214
+ namespace: structuralGridReceipt.namespace, generation: structuralGridReceipt.generation,
1215
+ generationToken: structuralGridReceipt.namespace, providerToken: structuralGridOwnerId,
1216
+ rawVisible: structuralGridView.info().visible.length > 0, visible: structuralGridView.info().visible.length > 0,
1217
+ selectable: true, facets: { provider: 'tekla-db', type: 'Grid' }, ...extra,
1218
+ } : null;
1111
1219
  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;
1220
+ const meshHits = ownerHitsAt(value?.x, value?.y);
1221
+ const meshCandidates = meshHits.map((hit) => selectionHit(hit.object, {
1222
+ point: hit.point?.toArray() ?? null, normal: hit.face?.normal?.toArray() ?? null, distance: hit.distance,
1223
+ })).filter(Boolean);
1224
+ const winner = structuralGridView.pick({ clientX: value?.x, clientY: value?.y, meshHits, raycaster: ray,
1225
+ isOpaqueOccluder: (hit) => mode !== 'xray' && (hit.object?.material?.opacity ?? 1) >= .99 });
1226
+ const primary = winner?.kind === 'grid'
1227
+ ? gridSelectionHit({ distance: winner.distance, gridSubIdentity: winner.id })
1228
+ : winner?.kind === 'mesh' ? meshCandidates.find((candidate) => candidate.providerToken === winner.hit.object?.userData?.entityId) ?? null : null;
1229
+ return orderModelSelectionHits(primary, meshCandidates);
1118
1230
  };
1119
1231
  const allHits = () => {
1120
1232
  const byKey = new Map();
@@ -1127,18 +1239,25 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1127
1239
  top: Math.min(prior.screenBounds.top, item.screenBounds.top), bottom: Math.max(prior.screenBounds.bottom, item.screenBounds.bottom),
1128
1240
  };
1129
1241
  }
1242
+ const grid = gridSelectionHit(); if (grid?.rawVisible) byKey.set(grid.key, grid);
1130
1243
  return [...byKey.values()];
1131
1244
  };
1132
1245
  const selectionTools = Object.freeze({
1133
- coordinator: selectionCoordinator, hitsAt, allHits, marqueeHits: () => allHits(),
1246
+ coordinator: selectionCoordinator, hitsAt, allHits, marqueeHits: (rect) => {
1247
+ const hits = allHits();
1248
+ const grid = gridSelectionHit(); if (!grid) return hits;
1249
+ const ids = structuralGridView.rectangleHits(rect.left, rect.top, rect.right, rect.bottom, rect.mode === 'enclosed');
1250
+ return ids.length ? hits : hits.filter((hit) => hit.key !== grid.key);
1251
+ },
1134
1252
  generationToken: () => identityRegistry.currentNamespace(),
1135
1253
  registerInterceptor: (interceptor) => adapter.registerSelectionInterceptor(interceptor),
1136
1254
  });
1137
1255
  const selectedMeshes = () => ownedMeshes.filter((mesh) => selected.includes(mesh.userData.entityId));
1138
1256
  const needSpatial = () => { if (!spatialTools) throw new Error('Shared spatial tools are not mounted.'); return spatialTools; };
1139
1257
  return Object.freeze({
1258
+ refreshDisplay() { if (disposed) return; if (lastClipReadout && !clipReadout.hidden) paintClipReadout(lastClipReadout); clipOverlay.render(); },
1140
1259
  isReady: () => !!model,
1141
- async load(bytes, ownerByNode, frameReceipt) { adapter.queueLoad(bytes, ownerByNode, frameReceipt); return controller.rebuild({ fit: true }); },
1260
+ async load(bytes, ownerByNode, frameReceipt, structuralGridValue = null) { adapter.queueLoad(bytes, ownerByNode, frameReceipt, structuralGridValue); return controller.rebuild({ fit: true }); },
1142
1261
  setProjection: (value) => controller.setProjection(value), setDisplayMode: (value) => controller.setDisplayMode(value),
1143
1262
  fitAll: () => controller.fitAll(), fitSelection: () => controller.fitSelection(),
1144
1263
  applyView, applyDirection, orientation,
@@ -1178,6 +1297,8 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1178
1297
  workAreaState: () => spatialState?.workArea ?? null,
1179
1298
  projection: () => controller.cameraState().projection, displayMode: () => controller.displayMode(),
1180
1299
  lightingState: () => ({ ...lighting }), setLighting: (value) => ({ ...applyLighting(value) }),
1300
+ gridLevels: () => adapter.gridLevels(),
1301
+ setGridHiddenLevels: (values) => adapter.setGridHiddenLevels(values),
1181
1302
  realisticState,
1182
1303
  outlineState: () => ({
1183
1304
  mode, meshes: ownedMeshes.length,
@@ -1210,6 +1331,32 @@ export function createRevitViewport({ canvas, onSelect = () => {}, onOutlineBuil
1210
1331
  side: mesh.material.side, metalness: mesh.material.metalness, roughness: mesh.material.roughness,
1211
1332
  })),
1212
1333
  pickSurface,
1334
+ // Where the pick ray through this pointer starts (the eye, or the near plane when orthographic), in
1335
+ // the same frame as pickSurface's hit. Snapping covers the sightline between the two (#1747).
1336
+ pointerRayOrigin(clientX, clientY) { return setRayAt(clientX, clientY)?.origin.toArray() ?? null; },
1337
+ // Snapping follows exactly what the surface pick follows (ownerHitsAt): only visible meshes, and
1338
+ // only what the section planes keep. An element is skipped whole when hidden or when its envelope
1339
+ // lies entirely on the cut-away side of a plane; a single point is kept only on the kept side.
1340
+ snapVisibility() {
1341
+ const planes = activeRenderPlanes;
1342
+ return {
1343
+ element(mesh, min, max) {
1344
+ if (!mesh?.visible) return false;
1345
+ return planes.every((plane) => {
1346
+ const n = plane.normal;
1347
+ return n.x * (n.x >= 0 ? max[0] : min[0]) + n.y * (n.y >= 0 ? max[1] : min[1]) + n.z * (n.z >= 0 ? max[2] : min[2]) + plane.constant >= -1e-7;
1348
+ });
1349
+ },
1350
+ point(point) {
1351
+ return planes.every((plane) => plane.normal.x * point[0] + plane.normal.y * point[1] + plane.normal.z * point[2] + plane.constant >= -1e-7);
1352
+ },
1353
+ // Hidden behind something nearer the eye? See revitSnapPointOccluded; the tolerance is a fixed
1354
+ // half millimetre of model length, whatever the viewing distance.
1355
+ occluded(point, origin, meshes) {
1356
+ return revitSnapPointOccluded(point, origin, meshes, planes, REVIT_SNAP_OCCLUSION_TOLERANCE_MM / geometryFrame.millimetresPerRenderUnit);
1357
+ },
1358
+ };
1359
+ },
1213
1360
  projectPoint(point) { const value = new THREE.Vector3().fromArray(point).project(camera); const rect = canvas.getBoundingClientRect(); return { x: rect.left + (value.x * .5 + .5) * rect.width, y: rect.top + (-value.y * .5 + .5) * rect.height, visible: value.z >= -1 && value.z <= 1 }; },
1214
1361
  // xeoRVT GLB millimetres cross the render boundary as metres (root scale 0.001). Convert only
1215
1362
  // the measured display value back here; persisted provider coordinates remain untouched.
@@ -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">