@pascal-app/core 0.9.1 → 1.0.0-beta.1
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.
- package/README.md +17 -10
- package/dist/events/bus.d.ts +49 -2
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/hooks/scene-registry/item-clip-registry.d.ts +18 -0
- package/dist/hooks/scene-registry/item-clip-registry.d.ts.map +1 -0
- package/dist/hooks/scene-registry/item-clip-registry.js +10 -0
- package/dist/hooks/scene-registry/scene-registry.d.ts +8 -1
- package/dist/hooks/scene-registry/scene-registry.d.ts.map +1 -1
- package/dist/hooks/scene-registry/scene-registry.js +27 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts +17 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.js +61 -8
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +135 -28
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.js +427 -271
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +46 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.js +208 -9
- package/dist/hooks/spatial-grid/support-host-id.d.ts +3 -0
- package/dist/hooks/spatial-grid/support-host-id.d.ts.map +1 -0
- package/dist/hooks/spatial-grid/support-host-id.js +2 -0
- package/dist/hooks/spatial-grid/support-host-patch.d.ts +51 -0
- package/dist/hooks/spatial-grid/support-host-patch.d.ts.map +1 -0
- package/dist/hooks/spatial-grid/support-host-patch.js +164 -0
- package/dist/index.d.ts +33 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -10
- package/dist/lib/level-name.d.ts +4 -0
- package/dist/lib/level-name.d.ts.map +1 -0
- package/dist/lib/level-name.js +10 -0
- package/dist/lib/measurement-geometry.d.ts +23 -0
- package/dist/lib/measurement-geometry.d.ts.map +1 -0
- package/dist/lib/measurement-geometry.js +249 -0
- package/dist/lib/polygon-geometry.d.ts +0 -1
- package/dist/lib/polygon-geometry.d.ts.map +1 -1
- package/dist/lib/polygon-geometry.js +0 -18
- package/dist/lib/selection-proxy.d.ts +4 -0
- package/dist/lib/selection-proxy.d.ts.map +1 -0
- package/dist/lib/selection-proxy.js +12 -0
- package/dist/lib/slab-polygon.d.ts +31 -2
- package/dist/lib/slab-polygon.d.ts.map +1 -1
- package/dist/lib/slab-polygon.js +557 -31
- package/dist/lib/slots.d.ts +14 -0
- package/dist/lib/slots.d.ts.map +1 -0
- package/dist/lib/slots.js +26 -0
- package/dist/lib/space-detection.d.ts +40 -6
- package/dist/lib/space-detection.d.ts.map +1 -1
- package/dist/lib/space-detection.js +574 -192
- package/dist/lib/terrain-brush.d.ts +163 -0
- package/dist/lib/terrain-brush.d.ts.map +1 -0
- package/dist/lib/terrain-brush.js +359 -0
- package/dist/lib/terrain-codec.d.ts +51 -0
- package/dist/lib/terrain-codec.d.ts.map +1 -0
- package/dist/lib/terrain-codec.js +167 -0
- package/dist/lib/terrain-field.d.ts +150 -0
- package/dist/lib/terrain-field.d.ts.map +1 -0
- package/dist/lib/terrain-field.js +248 -0
- package/dist/lib/terrain-raycast.d.ts +44 -0
- package/dist/lib/terrain-raycast.d.ts.map +1 -0
- package/dist/lib/terrain-raycast.js +188 -0
- package/dist/lib/terrain-source.d.ts +60 -0
- package/dist/lib/terrain-source.d.ts.map +1 -0
- package/dist/lib/terrain-source.js +90 -0
- package/dist/lib/terrain-support.d.ts +60 -0
- package/dist/lib/terrain-support.d.ts.map +1 -0
- package/dist/lib/terrain-support.js +150 -0
- package/dist/lib/wall-distance.d.ts +60 -0
- package/dist/lib/wall-distance.d.ts.map +1 -0
- package/dist/lib/wall-distance.js +85 -0
- package/dist/lib/zone-quantities.d.ts +21 -0
- package/dist/lib/zone-quantities.d.ts.map +1 -0
- package/dist/lib/zone-quantities.js +428 -0
- package/dist/material-library.d.ts +28 -1
- package/dist/material-library.d.ts.map +1 -1
- package/dist/material-library.js +2233 -441
- package/dist/registry/handles.d.ts +91 -3
- package/dist/registry/handles.d.ts.map +1 -1
- package/dist/registry/index.d.ts +3 -3
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -1
- package/dist/registry/registry.d.ts +46 -3
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +82 -1
- package/dist/registry/subtree.d.ts.map +1 -1
- package/dist/registry/subtree.js +8 -1
- package/dist/registry/types.d.ts +781 -39
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/schema/index.d.ts +27 -8
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +23 -6
- package/dist/schema/material.d.ts +3 -2
- package/dist/schema/material.d.ts.map +1 -1
- package/dist/schema/material.js +7 -5
- package/dist/schema/nodes/box-vent.d.ts +2 -2
- package/dist/schema/nodes/cabinet.d.ts +536 -0
- package/dist/schema/nodes/cabinet.d.ts.map +1 -0
- package/dist/schema/nodes/cabinet.js +139 -0
- package/dist/schema/nodes/ceiling.d.ts +4 -3
- package/dist/schema/nodes/ceiling.d.ts.map +1 -1
- package/dist/schema/nodes/ceiling.js +11 -1
- package/dist/schema/nodes/chimney.d.ts +4 -4
- package/dist/schema/nodes/column.d.ts +4 -2
- package/dist/schema/nodes/column.d.ts.map +1 -1
- package/dist/schema/nodes/column.js +5 -0
- package/dist/schema/nodes/construction-dimension.d.ts +195 -0
- package/dist/schema/nodes/construction-dimension.d.ts.map +1 -0
- package/dist/schema/nodes/construction-dimension.js +151 -0
- package/dist/schema/nodes/cupola.d.ts +2 -2
- package/dist/schema/nodes/door.d.ts +42 -5
- package/dist/schema/nodes/door.d.ts.map +1 -1
- package/dist/schema/nodes/door.js +32 -0
- package/dist/schema/nodes/dormer.d.ts +8 -8
- package/dist/schema/nodes/dormer.js +1 -1
- package/dist/schema/nodes/downspout.d.ts +2 -2
- package/dist/schema/nodes/duct-fitting.d.ts +91 -0
- package/dist/schema/nodes/duct-fitting.d.ts.map +1 -0
- package/dist/schema/nodes/duct-fitting.js +92 -0
- package/dist/schema/nodes/duct-segment.d.ts +61 -0
- package/dist/schema/nodes/duct-segment.d.ts.map +1 -0
- package/dist/schema/nodes/duct-segment.js +73 -0
- package/dist/schema/nodes/duct-terminal.d.ts +58 -0
- package/dist/schema/nodes/duct-terminal.d.ts.map +1 -0
- package/dist/schema/nodes/duct-terminal.js +53 -0
- package/dist/schema/nodes/elevator.d.ts +3 -2
- package/dist/schema/nodes/elevator.d.ts.map +1 -1
- package/dist/schema/nodes/elevator.js +3 -0
- package/dist/schema/nodes/eyebrow-vent.d.ts +2 -2
- package/dist/schema/nodes/fence.d.ts +20 -2
- package/dist/schema/nodes/fence.d.ts.map +1 -1
- package/dist/schema/nodes/fence.js +33 -2
- package/dist/schema/nodes/gutter.d.ts +2 -2
- package/dist/schema/nodes/hvac-equipment.d.ts +64 -0
- package/dist/schema/nodes/hvac-equipment.d.ts.map +1 -0
- package/dist/schema/nodes/hvac-equipment.js +57 -0
- package/dist/schema/nodes/item.d.ts +9 -0
- package/dist/schema/nodes/item.d.ts.map +1 -1
- package/dist/schema/nodes/item.js +24 -0
- package/dist/schema/nodes/level.d.ts +2 -1
- package/dist/schema/nodes/level.d.ts.map +1 -1
- package/dist/schema/nodes/level.js +12 -31
- package/dist/schema/nodes/lineset.d.ts +42 -0
- package/dist/schema/nodes/lineset.d.ts.map +1 -0
- package/dist/schema/nodes/lineset.js +38 -0
- package/dist/schema/nodes/liquid-line.d.ts +34 -0
- package/dist/schema/nodes/liquid-line.d.ts.map +1 -0
- package/dist/schema/nodes/liquid-line.js +24 -0
- package/dist/schema/nodes/measurement.d.ts +306 -0
- package/dist/schema/nodes/measurement.d.ts.map +1 -0
- package/dist/schema/nodes/measurement.js +87 -0
- package/dist/schema/nodes/pipe-fitting.d.ts +56 -0
- package/dist/schema/nodes/pipe-fitting.d.ts.map +1 -0
- package/dist/schema/nodes/pipe-fitting.js +45 -0
- package/dist/schema/nodes/pipe-segment.d.ts +48 -0
- package/dist/schema/nodes/pipe-segment.d.ts.map +1 -0
- package/dist/schema/nodes/pipe-segment.js +36 -0
- package/dist/schema/nodes/pipe-trap.d.ts +43 -0
- package/dist/schema/nodes/pipe-trap.d.ts.map +1 -0
- package/dist/schema/nodes/pipe-trap.js +36 -0
- package/dist/schema/nodes/ridge-vent.d.ts +18 -3
- package/dist/schema/nodes/ridge-vent.d.ts.map +1 -1
- package/dist/schema/nodes/ridge-vent.js +221 -3
- package/dist/schema/nodes/roof-segment-shape.d.ts +90 -0
- package/dist/schema/nodes/roof-segment-shape.d.ts.map +1 -0
- package/dist/schema/nodes/roof-segment-shape.js +318 -0
- package/dist/schema/nodes/roof-segment-walls.d.ts +101 -0
- package/dist/schema/nodes/roof-segment-walls.d.ts.map +1 -0
- package/dist/schema/nodes/roof-segment-walls.js +330 -0
- package/dist/schema/nodes/roof-segment.d.ts +84 -8
- package/dist/schema/nodes/roof-segment.d.ts.map +1 -1
- package/dist/schema/nodes/roof-segment.js +290 -5
- package/dist/schema/nodes/roof.d.ts +8 -8
- package/dist/schema/nodes/shelf.d.ts +4 -2
- package/dist/schema/nodes/shelf.d.ts.map +1 -1
- package/dist/schema/nodes/shelf.js +8 -0
- package/dist/schema/nodes/site.d.ts +9 -0
- package/dist/schema/nodes/site.d.ts.map +1 -1
- package/dist/schema/nodes/site.js +8 -6
- package/dist/schema/nodes/skylight.d.ts +10 -10
- package/dist/schema/nodes/slab.d.ts +8 -2
- package/dist/schema/nodes/slab.d.ts.map +1 -1
- package/dist/schema/nodes/slab.js +18 -2
- package/dist/schema/nodes/solar-panel.d.ts +4 -4
- package/dist/schema/nodes/spawn.d.ts +1 -0
- package/dist/schema/nodes/spawn.d.ts.map +1 -1
- package/dist/schema/nodes/spawn.js +2 -0
- package/dist/schema/nodes/stair-segment.d.ts +4 -4
- package/dist/schema/nodes/stair.d.ts +16 -13
- package/dist/schema/nodes/stair.d.ts.map +1 -1
- package/dist/schema/nodes/stair.js +11 -1
- package/dist/schema/nodes/structural-grid.d.ts +27 -0
- package/dist/schema/nodes/structural-grid.d.ts.map +1 -0
- package/dist/schema/nodes/structural-grid.js +17 -0
- package/dist/schema/nodes/turbine-vent.d.ts +2 -2
- package/dist/schema/nodes/wall.d.ts +248 -6
- package/dist/schema/nodes/wall.d.ts.map +1 -1
- package/dist/schema/nodes/wall.js +266 -0
- package/dist/schema/nodes/window.d.ts +40 -3
- package/dist/schema/nodes/window.d.ts.map +1 -1
- package/dist/schema/nodes/window.js +30 -0
- package/dist/schema/nodes/zone.d.ts +22 -0
- package/dist/schema/nodes/zone.d.ts.map +1 -1
- package/dist/schema/nodes/zone.js +21 -0
- package/dist/schema/scene-material.d.ts +41 -0
- package/dist/schema/scene-material.d.ts.map +1 -0
- package/dist/schema/scene-material.js +9 -0
- package/dist/schema/terrain.d.ts +28 -0
- package/dist/schema/terrain.d.ts.map +1 -0
- package/dist/schema/terrain.js +30 -0
- package/dist/schema/types.d.ts +1300 -97
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +27 -0
- package/dist/services/__fixtures__/wall-plane-top-boundary-repro.d.ts +80 -0
- package/dist/services/__fixtures__/wall-plane-top-boundary-repro.d.ts.map +1 -0
- package/dist/services/__fixtures__/wall-plane-top-boundary-repro.js +89 -0
- package/dist/services/alignment-anchors.d.ts.map +1 -1
- package/dist/services/alignment-anchors.js +30 -1
- package/dist/services/alignment.d.ts +5 -0
- package/dist/services/alignment.d.ts.map +1 -1
- package/dist/services/alignment.js +2 -0
- package/dist/services/hosting.d.ts +8 -0
- package/dist/services/hosting.d.ts.map +1 -1
- package/dist/services/hosting.js +13 -4
- package/dist/services/index.d.ts +9 -2
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +9 -2
- package/dist/services/level-height.d.ts +27 -0
- package/dist/services/level-height.d.ts.map +1 -0
- package/dist/services/level-height.js +94 -0
- package/dist/services/opening-guides.d.ts +141 -0
- package/dist/services/opening-guides.d.ts.map +1 -0
- package/dist/services/opening-guides.js +267 -0
- package/dist/services/port-connectivity.d.ts +115 -0
- package/dist/services/port-connectivity.d.ts.map +1 -0
- package/dist/services/port-connectivity.js +300 -0
- package/dist/services/riser-diagram.d.ts +40 -0
- package/dist/services/riser-diagram.d.ts.map +1 -0
- package/dist/services/riser-diagram.js +110 -0
- package/dist/services/snap.d.ts +9 -1
- package/dist/services/snap.d.ts.map +1 -1
- package/dist/services/snap.js +21 -1
- package/dist/services/storey.d.ts +103 -0
- package/dist/services/storey.d.ts.map +1 -0
- package/dist/services/storey.js +296 -0
- package/dist/services/system-graph.d.ts +30 -0
- package/dist/services/system-graph.d.ts.map +1 -0
- package/dist/services/system-graph.js +164 -0
- package/dist/services/validate-dwv.d.ts +32 -0
- package/dist/services/validate-dwv.d.ts.map +1 -0
- package/dist/services/validate-dwv.js +118 -0
- package/dist/store/actions/node-actions.d.ts.map +1 -1
- package/dist/store/actions/node-actions.js +141 -4
- package/dist/store/history-control.d.ts +31 -0
- package/dist/store/history-control.d.ts.map +1 -1
- package/dist/store/history-control.js +130 -0
- package/dist/store/use-live-terrain.d.ts +65 -0
- package/dist/store/use-live-terrain.d.ts.map +1 -0
- package/dist/store/use-live-terrain.js +31 -0
- package/dist/store/use-live-transforms.d.ts +8 -0
- package/dist/store/use-live-transforms.d.ts.map +1 -1
- package/dist/store/use-scene.d.ts +47 -3
- package/dist/store/use-scene.d.ts.map +1 -1
- package/dist/store/use-scene.js +992 -55
- package/dist/systems/elevator/elevator-opening-system.d.ts +1 -0
- package/dist/systems/elevator/elevator-opening-system.d.ts.map +1 -1
- package/dist/systems/elevator/elevator-opening-system.js +27 -21
- package/dist/systems/elevator/elevator-service.d.ts +0 -2
- package/dist/systems/elevator/elevator-service.d.ts.map +1 -1
- package/dist/systems/elevator/elevator-service.js +2 -24
- package/dist/systems/fence/fence-centerline.d.ts +12 -0
- package/dist/systems/fence/fence-centerline.d.ts.map +1 -0
- package/dist/systems/fence/fence-centerline.js +37 -0
- package/dist/systems/fence/fence-spline.d.ts +39 -0
- package/dist/systems/fence/fence-spline.d.ts.map +1 -0
- package/dist/systems/fence/fence-spline.js +196 -0
- package/dist/systems/slab/slab-placement.d.ts +11 -0
- package/dist/systems/slab/slab-placement.d.ts.map +1 -0
- package/dist/systems/slab/slab-placement.js +14 -0
- package/dist/systems/slab/slab-support.d.ts +137 -0
- package/dist/systems/slab/slab-support.d.ts.map +1 -0
- package/dist/systems/slab/slab-support.js +557 -0
- package/dist/systems/stair/stair-footprint.d.ts.map +1 -1
- package/dist/systems/stair/stair-footprint.js +21 -11
- package/dist/systems/stair/stair-opening-preview.d.ts +1300 -505
- package/dist/systems/stair/stair-opening-preview.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-sync.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-sync.js +19 -33
- package/dist/systems/stair/stair-opening-system.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-system.js +32 -4
- package/dist/systems/stair/stair-rise.d.ts +22 -0
- package/dist/systems/stair/stair-rise.d.ts.map +1 -0
- package/dist/systems/stair/stair-rise.js +79 -0
- package/dist/systems/wall/wall-curve.d.ts +10 -0
- package/dist/systems/wall/wall-curve.d.ts.map +1 -1
- package/dist/systems/wall/wall-curve.js +1 -1
- package/dist/systems/wall/wall-mitering.d.ts.map +1 -1
- package/dist/systems/wall/wall-mitering.js +44 -8
- package/dist/systems/wall/wall-top.d.ts +40 -0
- package/dist/systems/wall/wall-top.d.ts.map +1 -0
- package/dist/systems/wall/wall-top.js +46 -0
- package/dist/utils/clone-scene-graph.d.ts +1 -0
- package/dist/utils/clone-scene-graph.d.ts.map +1 -1
- package/dist/utils/clone-scene-graph.js +56 -5
- package/dist/utils/heal-scene-graph.d.ts +18 -0
- package/dist/utils/heal-scene-graph.d.ts.map +1 -0
- package/dist/utils/heal-scene-graph.js +106 -0
- package/dist/validation/validate-build-json.d.ts +3 -0
- package/dist/validation/validate-build-json.d.ts.map +1 -1
- package/dist/validation/validate-build-json.js +90 -5
- package/package.json +4 -4
- package/dist/hooks/spatial-grid/floor-placed-elevation.test.d.ts +0 -2
- package/dist/hooks/spatial-grid/floor-placed-elevation.test.d.ts.map +0 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.test.js +0 -273
- package/dist/lib/space-detection-pause.test.d.ts +0 -2
- package/dist/lib/space-detection-pause.test.d.ts.map +0 -1
- package/dist/lib/space-detection-pause.test.js +0 -42
- package/dist/lib/space-detection.test.d.ts +0 -2
- package/dist/lib/space-detection.test.d.ts.map +0 -1
- package/dist/lib/space-detection.test.js +0 -77
- package/dist/registry/registry.test.d.ts +0 -2
- package/dist/registry/registry.test.d.ts.map +0 -1
- package/dist/registry/registry.test.js +0 -183
- package/dist/registry/relations-resolver.test.d.ts +0 -2
- package/dist/registry/relations-resolver.test.d.ts.map +0 -1
- package/dist/registry/relations-resolver.test.js +0 -183
- package/dist/registry/scene-api.test.d.ts +0 -2
- package/dist/registry/scene-api.test.d.ts.map +0 -1
- package/dist/registry/scene-api.test.js +0 -183
- package/dist/registry/subtree.test.d.ts +0 -2
- package/dist/registry/subtree.test.d.ts.map +0 -1
- package/dist/registry/subtree.test.js +0 -133
- package/dist/schema/asset-url.test.d.ts +0 -2
- package/dist/schema/asset-url.test.d.ts.map +0 -1
- package/dist/schema/asset-url.test.js +0 -134
- package/dist/services/alignment-anchors.test.d.ts +0 -2
- package/dist/services/alignment-anchors.test.d.ts.map +0 -1
- package/dist/services/alignment-anchors.test.js +0 -383
- package/dist/services/alignment.test.d.ts +0 -2
- package/dist/services/alignment.test.d.ts.map +0 -1
- package/dist/services/alignment.test.js +0 -92
- package/dist/services/drag-session.test.d.ts +0 -2
- package/dist/services/drag-session.test.d.ts.map +0 -1
- package/dist/services/drag-session.test.js +0 -219
- package/dist/services/hosting.test.d.ts +0 -2
- package/dist/services/hosting.test.d.ts.map +0 -1
- package/dist/services/hosting.test.js +0 -199
- package/dist/services/movement.test.d.ts +0 -2
- package/dist/services/movement.test.d.ts.map +0 -1
- package/dist/services/movement.test.js +0 -133
- package/dist/services/single-undo-dance.test.d.ts +0 -2
- package/dist/services/single-undo-dance.test.d.ts.map +0 -1
- package/dist/services/single-undo-dance.test.js +0 -210
- package/dist/services/snap.test.d.ts +0 -2
- package/dist/services/snap.test.d.ts.map +0 -1
- package/dist/services/snap.test.js +0 -95
- package/dist/store/actions/node-mutation-sanitize.test.d.ts +0 -2
- package/dist/store/actions/node-mutation-sanitize.test.d.ts.map +0 -1
- package/dist/store/actions/node-mutation-sanitize.test.js +0 -147
- package/dist/store/actions/reparent.test.d.ts +0 -2
- package/dist/store/actions/reparent.test.d.ts.map +0 -1
- package/dist/store/actions/reparent.test.js +0 -212
- package/dist/store/use-scene-elevator-migration.test.d.ts +0 -2
- package/dist/store/use-scene-elevator-migration.test.d.ts.map +0 -1
- package/dist/store/use-scene-elevator-migration.test.js +0 -109
- package/dist/systems/elevator/elevator-opening-sync.test.d.ts +0 -2
- package/dist/systems/elevator/elevator-opening-sync.test.d.ts.map +0 -1
- package/dist/systems/elevator/elevator-opening-sync.test.js +0 -146
- package/dist/systems/elevator/elevator-runtime.test.d.ts +0 -2
- package/dist/systems/elevator/elevator-runtime.test.d.ts.map +0 -1
- package/dist/systems/elevator/elevator-runtime.test.js +0 -64
- package/dist/systems/stair/stair-opening-preview.test.d.ts +0 -2
- package/dist/systems/stair/stair-opening-preview.test.d.ts.map +0 -1
- package/dist/systems/stair/stair-opening-preview.test.js +0 -80
- package/dist/systems/stair/stair-opening-sync.test.d.ts +0 -2
- package/dist/systems/stair/stair-opening-sync.test.d.ts.map +0 -1
- package/dist/systems/stair/stair-opening-sync.test.js +0 -446
- package/dist/utils/clone-scene-graph.test.d.ts +0 -2
- package/dist/utils/clone-scene-graph.test.d.ts.map +0 -1
- package/dist/utils/clone-scene-graph.test.js +0 -59
|
@@ -1,446 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { BuildingNode, CeilingNode, LevelNode, SlabNode, StairNode, StairSegmentNode, } from '../../schema';
|
|
3
|
-
import { syncAutoStairOpenings } from './stair-opening-sync';
|
|
4
|
-
describe('syncAutoStairOpenings', () => {
|
|
5
|
-
test('only applies stair holes to destination slabs that overlap the opening', () => {
|
|
6
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
7
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
8
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
9
|
-
const landingSlab = SlabNode.parse({
|
|
10
|
-
name: 'Landing Slab',
|
|
11
|
-
parentId: upper.id,
|
|
12
|
-
polygon: [
|
|
13
|
-
[0, 0],
|
|
14
|
-
[4, 0],
|
|
15
|
-
[4, 3],
|
|
16
|
-
[0, 3],
|
|
17
|
-
],
|
|
18
|
-
});
|
|
19
|
-
const bedroomSlab = SlabNode.parse({
|
|
20
|
-
name: 'Bedroom Slab',
|
|
21
|
-
parentId: upper.id,
|
|
22
|
-
polygon: [
|
|
23
|
-
[4, 0],
|
|
24
|
-
[8, 0],
|
|
25
|
-
[8, 3],
|
|
26
|
-
[4, 3],
|
|
27
|
-
],
|
|
28
|
-
});
|
|
29
|
-
const segment = StairSegmentNode.parse({
|
|
30
|
-
parentId: 'stair_main',
|
|
31
|
-
width: 1,
|
|
32
|
-
length: 2.6,
|
|
33
|
-
height: 2.5,
|
|
34
|
-
stepCount: 12,
|
|
35
|
-
});
|
|
36
|
-
const stair = StairNode.parse({
|
|
37
|
-
id: 'stair_main',
|
|
38
|
-
name: 'Main Stair',
|
|
39
|
-
parentId: ground.id,
|
|
40
|
-
position: [2, 0, 0.2],
|
|
41
|
-
stairType: 'straight',
|
|
42
|
-
fromLevelId: ground.id,
|
|
43
|
-
toLevelId: upper.id,
|
|
44
|
-
slabOpeningMode: 'destination',
|
|
45
|
-
children: [segment.id],
|
|
46
|
-
});
|
|
47
|
-
const nodes = Object.fromEntries([
|
|
48
|
-
building,
|
|
49
|
-
ground,
|
|
50
|
-
upper,
|
|
51
|
-
landingSlab,
|
|
52
|
-
bedroomSlab,
|
|
53
|
-
stair,
|
|
54
|
-
{ ...segment, parentId: stair.id },
|
|
55
|
-
].map((node) => [node.id, node]));
|
|
56
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
57
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
58
|
-
const bedroomUpdate = updates.find((update) => update.id === bedroomSlab.id);
|
|
59
|
-
expect(landingUpdate?.data.holes).toHaveLength(1);
|
|
60
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
61
|
-
expect(bedroomUpdate).toBeUndefined();
|
|
62
|
-
});
|
|
63
|
-
test('applies stair holes to a later destination slab when the configured offset overhangs the slab edge', () => {
|
|
64
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
65
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
66
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
67
|
-
const landingSlab = SlabNode.parse({
|
|
68
|
-
name: 'Landing Slab',
|
|
69
|
-
parentId: upper.id,
|
|
70
|
-
polygon: [
|
|
71
|
-
[0, 0],
|
|
72
|
-
[4, 0],
|
|
73
|
-
[4, 3],
|
|
74
|
-
[0, 3],
|
|
75
|
-
],
|
|
76
|
-
});
|
|
77
|
-
const segment = StairSegmentNode.parse({
|
|
78
|
-
parentId: 'stair_edge',
|
|
79
|
-
width: 1,
|
|
80
|
-
length: 2.6,
|
|
81
|
-
height: 2.5,
|
|
82
|
-
stepCount: 12,
|
|
83
|
-
});
|
|
84
|
-
const stair = StairNode.parse({
|
|
85
|
-
id: 'stair_edge',
|
|
86
|
-
name: 'Edge Stair',
|
|
87
|
-
parentId: ground.id,
|
|
88
|
-
position: [2, 0, 0],
|
|
89
|
-
stairType: 'straight',
|
|
90
|
-
fromLevelId: ground.id,
|
|
91
|
-
toLevelId: upper.id,
|
|
92
|
-
slabOpeningMode: 'destination',
|
|
93
|
-
openingOffset: 0.08,
|
|
94
|
-
children: [segment.id],
|
|
95
|
-
});
|
|
96
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
97
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
98
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
99
|
-
const hole = landingUpdate?.data.holes?.[0];
|
|
100
|
-
expect(hole).toBeDefined();
|
|
101
|
-
expect(Math.min(...hole.map(([, z]) => z))).toBeCloseTo(-0.08);
|
|
102
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
103
|
-
});
|
|
104
|
-
test('does not apply stair holes to slabs on another building with a matching level number', () => {
|
|
105
|
-
const buildingA = BuildingNode.parse({ name: 'Building A' });
|
|
106
|
-
const groundA = LevelNode.parse({ name: 'Ground A', level: 0, parentId: buildingA.id });
|
|
107
|
-
const upperA = LevelNode.parse({ name: 'Upper A', level: 1, parentId: buildingA.id });
|
|
108
|
-
const buildingB = BuildingNode.parse({ name: 'Building B' });
|
|
109
|
-
const upperB = LevelNode.parse({ name: 'Upper B', level: 1, parentId: buildingB.id });
|
|
110
|
-
const slabA = SlabNode.parse({
|
|
111
|
-
name: 'Upper A Slab',
|
|
112
|
-
parentId: upperA.id,
|
|
113
|
-
polygon: [
|
|
114
|
-
[0, 0],
|
|
115
|
-
[4, 0],
|
|
116
|
-
[4, 3],
|
|
117
|
-
[0, 3],
|
|
118
|
-
],
|
|
119
|
-
});
|
|
120
|
-
const slabB = SlabNode.parse({
|
|
121
|
-
name: 'Upper B Slab',
|
|
122
|
-
parentId: upperB.id,
|
|
123
|
-
polygon: [
|
|
124
|
-
[0, 0],
|
|
125
|
-
[4, 0],
|
|
126
|
-
[4, 3],
|
|
127
|
-
[0, 3],
|
|
128
|
-
],
|
|
129
|
-
});
|
|
130
|
-
const segment = StairSegmentNode.parse({
|
|
131
|
-
parentId: 'stair_scoped',
|
|
132
|
-
width: 1,
|
|
133
|
-
length: 2.6,
|
|
134
|
-
height: 2.5,
|
|
135
|
-
stepCount: 12,
|
|
136
|
-
});
|
|
137
|
-
const stair = StairNode.parse({
|
|
138
|
-
id: 'stair_scoped',
|
|
139
|
-
name: 'Scoped Stair',
|
|
140
|
-
parentId: groundA.id,
|
|
141
|
-
position: [2, 0, 0.2],
|
|
142
|
-
stairType: 'straight',
|
|
143
|
-
fromLevelId: groundA.id,
|
|
144
|
-
toLevelId: upperA.id,
|
|
145
|
-
slabOpeningMode: 'destination',
|
|
146
|
-
children: [segment.id],
|
|
147
|
-
});
|
|
148
|
-
const nodes = Object.fromEntries([
|
|
149
|
-
buildingA,
|
|
150
|
-
groundA,
|
|
151
|
-
upperA,
|
|
152
|
-
buildingB,
|
|
153
|
-
upperB,
|
|
154
|
-
slabA,
|
|
155
|
-
slabB,
|
|
156
|
-
stair,
|
|
157
|
-
{ ...segment, parentId: stair.id },
|
|
158
|
-
].map((node) => [node.id, node]));
|
|
159
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
160
|
-
expect(updates.find((update) => update.id === slabA.id)?.data.holes).toHaveLength(1);
|
|
161
|
-
expect(updates.find((update) => update.id === slabB.id)).toBeUndefined();
|
|
162
|
-
});
|
|
163
|
-
test('uses the parent level when a stair has stale from-level data', () => {
|
|
164
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
165
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
166
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
167
|
-
const landingSlab = SlabNode.parse({
|
|
168
|
-
name: 'Landing Slab',
|
|
169
|
-
parentId: upper.id,
|
|
170
|
-
polygon: [
|
|
171
|
-
[0, 0],
|
|
172
|
-
[4, 0],
|
|
173
|
-
[4, 8],
|
|
174
|
-
[0, 8],
|
|
175
|
-
],
|
|
176
|
-
});
|
|
177
|
-
const segment = StairSegmentNode.parse({
|
|
178
|
-
parentId: 'stair_stale_from',
|
|
179
|
-
width: 1,
|
|
180
|
-
length: 6,
|
|
181
|
-
height: 2.5,
|
|
182
|
-
stepCount: 12,
|
|
183
|
-
});
|
|
184
|
-
const stair = StairNode.parse({
|
|
185
|
-
id: 'stair_stale_from',
|
|
186
|
-
name: 'Stale From Stair',
|
|
187
|
-
parentId: ground.id,
|
|
188
|
-
position: [2, 0, 0.2],
|
|
189
|
-
stairType: 'straight',
|
|
190
|
-
fromLevelId: 'default',
|
|
191
|
-
toLevelId: upper.id,
|
|
192
|
-
slabOpeningMode: 'destination',
|
|
193
|
-
children: [segment.id],
|
|
194
|
-
});
|
|
195
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
196
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
197
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
198
|
-
const hole = landingUpdate?.data.holes?.[0];
|
|
199
|
-
expect(hole).toBeDefined();
|
|
200
|
-
expect(Math.min(...hole.map(([, z]) => z))).toBeGreaterThan(0.9);
|
|
201
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
202
|
-
});
|
|
203
|
-
test('infers the destination level when a destination stair has blank level fields', () => {
|
|
204
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
205
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
206
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
207
|
-
const landingSlab = SlabNode.parse({
|
|
208
|
-
name: 'Landing Slab',
|
|
209
|
-
parentId: upper.id,
|
|
210
|
-
polygon: [
|
|
211
|
-
[0, 0],
|
|
212
|
-
[4, 0],
|
|
213
|
-
[4, 8],
|
|
214
|
-
[0, 8],
|
|
215
|
-
],
|
|
216
|
-
});
|
|
217
|
-
const segment = StairSegmentNode.parse({
|
|
218
|
-
parentId: 'stair_blank_levels',
|
|
219
|
-
width: 1,
|
|
220
|
-
length: 6,
|
|
221
|
-
height: 2.5,
|
|
222
|
-
stepCount: 12,
|
|
223
|
-
});
|
|
224
|
-
const stair = StairNode.parse({
|
|
225
|
-
id: 'stair_blank_levels',
|
|
226
|
-
name: 'Blank Level Stair',
|
|
227
|
-
parentId: ground.id,
|
|
228
|
-
position: [2, 0, 0.2],
|
|
229
|
-
stairType: 'straight',
|
|
230
|
-
fromLevelId: '',
|
|
231
|
-
toLevelId: '',
|
|
232
|
-
slabOpeningMode: 'destination',
|
|
233
|
-
children: [segment.id],
|
|
234
|
-
});
|
|
235
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
236
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
237
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
238
|
-
expect(landingUpdate?.data.holes).toHaveLength(1);
|
|
239
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
240
|
-
});
|
|
241
|
-
test('infers the destination level when a destination stair targets its source level', () => {
|
|
242
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
243
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
244
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
245
|
-
const landingSlab = SlabNode.parse({
|
|
246
|
-
name: 'Landing Slab',
|
|
247
|
-
parentId: upper.id,
|
|
248
|
-
polygon: [
|
|
249
|
-
[0, 0],
|
|
250
|
-
[4, 0],
|
|
251
|
-
[4, 8],
|
|
252
|
-
[0, 8],
|
|
253
|
-
],
|
|
254
|
-
});
|
|
255
|
-
const segment = StairSegmentNode.parse({
|
|
256
|
-
parentId: 'stair_self_target',
|
|
257
|
-
width: 1,
|
|
258
|
-
length: 6,
|
|
259
|
-
height: 2.5,
|
|
260
|
-
stepCount: 12,
|
|
261
|
-
});
|
|
262
|
-
const stair = StairNode.parse({
|
|
263
|
-
id: 'stair_self_target',
|
|
264
|
-
name: 'Self Target Stair',
|
|
265
|
-
parentId: ground.id,
|
|
266
|
-
position: [2, 0, 0.2],
|
|
267
|
-
stairType: 'straight',
|
|
268
|
-
fromLevelId: ground.id,
|
|
269
|
-
toLevelId: ground.id,
|
|
270
|
-
slabOpeningMode: 'destination',
|
|
271
|
-
children: [segment.id],
|
|
272
|
-
});
|
|
273
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
274
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
275
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
276
|
-
expect(landingUpdate?.data.holes).toHaveLength(1);
|
|
277
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
278
|
-
});
|
|
279
|
-
test('does not add stair holes when a manual surface hole already covers them', () => {
|
|
280
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
281
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
282
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
283
|
-
const manualOpening = [
|
|
284
|
-
[1.0, 0.0],
|
|
285
|
-
[3.0, 0.0],
|
|
286
|
-
[3.0, 3.0],
|
|
287
|
-
[1.0, 3.0],
|
|
288
|
-
];
|
|
289
|
-
const sourceCeiling = CeilingNode.parse({
|
|
290
|
-
name: 'Source Ceiling',
|
|
291
|
-
parentId: ground.id,
|
|
292
|
-
polygon: [
|
|
293
|
-
[0, 0],
|
|
294
|
-
[4, 0],
|
|
295
|
-
[4, 3],
|
|
296
|
-
[0, 3],
|
|
297
|
-
],
|
|
298
|
-
holes: [manualOpening],
|
|
299
|
-
holeMetadata: [{ source: 'manual' }],
|
|
300
|
-
});
|
|
301
|
-
const landingSlab = SlabNode.parse({
|
|
302
|
-
name: 'Landing Slab',
|
|
303
|
-
parentId: upper.id,
|
|
304
|
-
polygon: [
|
|
305
|
-
[0, 0],
|
|
306
|
-
[4, 0],
|
|
307
|
-
[4, 3],
|
|
308
|
-
[0, 3],
|
|
309
|
-
],
|
|
310
|
-
holes: [manualOpening],
|
|
311
|
-
holeMetadata: [{ source: 'manual' }],
|
|
312
|
-
});
|
|
313
|
-
const segment = StairSegmentNode.parse({
|
|
314
|
-
parentId: 'stair_main',
|
|
315
|
-
width: 1,
|
|
316
|
-
length: 2.6,
|
|
317
|
-
height: 2.5,
|
|
318
|
-
stepCount: 12,
|
|
319
|
-
});
|
|
320
|
-
const stair = StairNode.parse({
|
|
321
|
-
id: 'stair_main',
|
|
322
|
-
name: 'Main Stair',
|
|
323
|
-
parentId: ground.id,
|
|
324
|
-
position: [2, 0, 0.2],
|
|
325
|
-
stairType: 'straight',
|
|
326
|
-
fromLevelId: ground.id,
|
|
327
|
-
toLevelId: upper.id,
|
|
328
|
-
slabOpeningMode: 'destination',
|
|
329
|
-
children: [segment.id],
|
|
330
|
-
});
|
|
331
|
-
const nodes = Object.fromEntries([
|
|
332
|
-
building,
|
|
333
|
-
ground,
|
|
334
|
-
upper,
|
|
335
|
-
sourceCeiling,
|
|
336
|
-
landingSlab,
|
|
337
|
-
stair,
|
|
338
|
-
{ ...segment, parentId: stair.id },
|
|
339
|
-
].map((node) => [node.id, node]));
|
|
340
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
341
|
-
expect(updates.find((update) => update.id === landingSlab.id)).toBeUndefined();
|
|
342
|
-
expect(updates.find((update) => update.id === sourceCeiling.id)).toBeUndefined();
|
|
343
|
-
});
|
|
344
|
-
test('adds stair holes when an existing manual hole is too small', () => {
|
|
345
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
346
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
347
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
348
|
-
const smallManualOpening = [
|
|
349
|
-
[1.8, 1.6],
|
|
350
|
-
[2.2, 1.6],
|
|
351
|
-
[2.2, 2.1],
|
|
352
|
-
[1.8, 2.1],
|
|
353
|
-
];
|
|
354
|
-
const landingSlab = SlabNode.parse({
|
|
355
|
-
name: 'Landing Slab',
|
|
356
|
-
parentId: upper.id,
|
|
357
|
-
polygon: [
|
|
358
|
-
[0, 0],
|
|
359
|
-
[4, 0],
|
|
360
|
-
[4, 3],
|
|
361
|
-
[0, 3],
|
|
362
|
-
],
|
|
363
|
-
holes: [smallManualOpening],
|
|
364
|
-
holeMetadata: [{ source: 'manual' }],
|
|
365
|
-
});
|
|
366
|
-
const segment = StairSegmentNode.parse({
|
|
367
|
-
parentId: 'stair_main',
|
|
368
|
-
width: 1,
|
|
369
|
-
length: 2.6,
|
|
370
|
-
height: 2.5,
|
|
371
|
-
stepCount: 12,
|
|
372
|
-
});
|
|
373
|
-
const stair = StairNode.parse({
|
|
374
|
-
id: 'stair_main',
|
|
375
|
-
name: 'Main Stair',
|
|
376
|
-
parentId: ground.id,
|
|
377
|
-
position: [2, 0, 0.2],
|
|
378
|
-
stairType: 'straight',
|
|
379
|
-
fromLevelId: ground.id,
|
|
380
|
-
toLevelId: upper.id,
|
|
381
|
-
slabOpeningMode: 'destination',
|
|
382
|
-
children: [segment.id],
|
|
383
|
-
});
|
|
384
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
385
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
386
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
387
|
-
expect(landingUpdate?.data.holes).toHaveLength(2);
|
|
388
|
-
expect(landingUpdate?.data.holes?.[0]).toEqual(smallManualOpening);
|
|
389
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([
|
|
390
|
-
{ source: 'manual' },
|
|
391
|
-
{ source: 'stair', stairId: stair.id },
|
|
392
|
-
]);
|
|
393
|
-
});
|
|
394
|
-
test('removes stale auto stair holes when a manual hole overlaps the stair opening', () => {
|
|
395
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
396
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
397
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
398
|
-
const manualOpening = [
|
|
399
|
-
[1.0, 0.0],
|
|
400
|
-
[3.0, 0.0],
|
|
401
|
-
[3.0, 3.0],
|
|
402
|
-
[1.0, 3.0],
|
|
403
|
-
];
|
|
404
|
-
const staleAutoOpening = [
|
|
405
|
-
[1.5, 1],
|
|
406
|
-
[2.5, 1],
|
|
407
|
-
[2.5, 2.8],
|
|
408
|
-
[1.5, 2.8],
|
|
409
|
-
];
|
|
410
|
-
const landingSlab = SlabNode.parse({
|
|
411
|
-
name: 'Landing Slab',
|
|
412
|
-
parentId: upper.id,
|
|
413
|
-
polygon: [
|
|
414
|
-
[0, 0],
|
|
415
|
-
[4, 0],
|
|
416
|
-
[4, 3],
|
|
417
|
-
[0, 3],
|
|
418
|
-
],
|
|
419
|
-
holes: [manualOpening, staleAutoOpening],
|
|
420
|
-
holeMetadata: [{ source: 'manual' }, { source: 'stair', stairId: 'stair_main' }],
|
|
421
|
-
});
|
|
422
|
-
const segment = StairSegmentNode.parse({
|
|
423
|
-
parentId: 'stair_main',
|
|
424
|
-
width: 1,
|
|
425
|
-
length: 2.6,
|
|
426
|
-
height: 2.5,
|
|
427
|
-
stepCount: 12,
|
|
428
|
-
});
|
|
429
|
-
const stair = StairNode.parse({
|
|
430
|
-
id: 'stair_main',
|
|
431
|
-
name: 'Main Stair',
|
|
432
|
-
parentId: ground.id,
|
|
433
|
-
position: [2, 0, 0.2],
|
|
434
|
-
stairType: 'straight',
|
|
435
|
-
fromLevelId: ground.id,
|
|
436
|
-
toLevelId: upper.id,
|
|
437
|
-
slabOpeningMode: 'destination',
|
|
438
|
-
children: [segment.id],
|
|
439
|
-
});
|
|
440
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
441
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
442
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
443
|
-
expect(landingUpdate?.data.holes).toEqual([manualOpening]);
|
|
444
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'manual' }]);
|
|
445
|
-
});
|
|
446
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clone-scene-graph.test.d.ts","sourceRoot":"","sources":["../../src/utils/clone-scene-graph.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { forkSceneGraph } from './clone-scene-graph';
|
|
3
|
-
function makeNode(id, type, extra = {}) {
|
|
4
|
-
return {
|
|
5
|
-
object: 'node',
|
|
6
|
-
id,
|
|
7
|
-
type,
|
|
8
|
-
parentId: null,
|
|
9
|
-
visible: true,
|
|
10
|
-
metadata: {},
|
|
11
|
-
...extra,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function makeSceneGraph() {
|
|
15
|
-
const site = makeNode('site_1', 'site', { children: ['level_1'] });
|
|
16
|
-
const level = makeNode('level_1', 'level', {
|
|
17
|
-
parentId: 'site_1',
|
|
18
|
-
children: ['wall_1', 'scan_1', 'guide_1'],
|
|
19
|
-
});
|
|
20
|
-
const wall = makeNode('wall_1', 'wall', { parentId: 'level_1' });
|
|
21
|
-
const scan = makeNode('scan_1', 'scan', { parentId: 'level_1', url: 'scan.glb' });
|
|
22
|
-
const guide = makeNode('guide_1', 'guide', { parentId: 'level_1', url: 'guide.png' });
|
|
23
|
-
return {
|
|
24
|
-
nodes: {
|
|
25
|
-
['site_1']: site,
|
|
26
|
-
['level_1']: level,
|
|
27
|
-
['wall_1']: wall,
|
|
28
|
-
['scan_1']: scan,
|
|
29
|
-
['guide_1']: guide,
|
|
30
|
-
},
|
|
31
|
-
rootNodeIds: ['site_1'],
|
|
32
|
-
collections: {
|
|
33
|
-
['collection_1']: {
|
|
34
|
-
id: 'collection_1',
|
|
35
|
-
name: 'References',
|
|
36
|
-
nodeIds: ['scan_1', 'guide_1'],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
describe('forkSceneGraph', () => {
|
|
42
|
-
test('strips scan and guide nodes by default', () => {
|
|
43
|
-
const forked = forkSceneGraph(makeSceneGraph());
|
|
44
|
-
const nodes = Object.values(forked.nodes);
|
|
45
|
-
expect(nodes.some((node) => node.type === 'scan')).toBe(false);
|
|
46
|
-
expect(nodes.some((node) => node.type === 'guide')).toBe(false);
|
|
47
|
-
expect(nodes.some((node) => node.type === 'wall')).toBe(true);
|
|
48
|
-
expect(forked.collections).toEqual({});
|
|
49
|
-
});
|
|
50
|
-
test('preserves scan and guide nodes when requested', () => {
|
|
51
|
-
const forked = forkSceneGraph(makeSceneGraph(), { preserveScans: true });
|
|
52
|
-
const nodes = Object.values(forked.nodes);
|
|
53
|
-
expect(nodes.some((node) => node.type === 'scan')).toBe(true);
|
|
54
|
-
expect(nodes.some((node) => node.type === 'guide')).toBe(true);
|
|
55
|
-
expect(nodes.map((node) => node.id)).not.toContain('scan_1');
|
|
56
|
-
expect(nodes.map((node) => node.id)).not.toContain('guide_1');
|
|
57
|
-
expect(Object.values(forked.collections ?? {}).flatMap((collection) => collection.nodeIds)).toHaveLength(2);
|
|
58
|
-
});
|
|
59
|
-
});
|