@pascal-app/core 0.9.2 → 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 +21 -2
- package/dist/events/bus.d.ts.map +1 -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 +116 -66
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.js +316 -441
- 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 +193 -12
- 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 +23 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -10
- package/dist/lib/measurement-geometry.d.ts +4 -0
- package/dist/lib/measurement-geometry.d.ts.map +1 -1
- package/dist/lib/measurement-geometry.js +27 -10
- package/dist/lib/slab-polygon.d.ts.map +1 -1
- package/dist/lib/slab-polygon.js +33 -1
- package/dist/lib/space-detection.d.ts +15 -4
- package/dist/lib/space-detection.d.ts.map +1 -1
- package/dist/lib/space-detection.js +174 -88
- 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/zone-quantities.d.ts +1 -1
- package/dist/lib/zone-quantities.d.ts.map +1 -1
- package/dist/lib/zone-quantities.js +311 -66
- package/dist/material-library.d.ts +9 -1
- package/dist/material-library.d.ts.map +1 -1
- package/dist/material-library.js +56 -4
- package/dist/registry/handles.d.ts +16 -1
- package/dist/registry/handles.d.ts.map +1 -1
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/subtree.d.ts.map +1 -1
- package/dist/registry/subtree.js +5 -2
- package/dist/registry/types.d.ts +64 -1
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/schema/index.d.ts +6 -3
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +6 -3
- package/dist/schema/nodes/cabinet.d.ts +2 -0
- package/dist/schema/nodes/cabinet.d.ts.map +1 -1
- package/dist/schema/nodes/cabinet.js +4 -2
- package/dist/schema/nodes/ceiling.d.ts +1 -1
- package/dist/schema/nodes/ceiling.d.ts.map +1 -1
- package/dist/schema/nodes/ceiling.js +7 -1
- package/dist/schema/nodes/column.d.ts +1 -0
- package/dist/schema/nodes/column.d.ts.map +1 -1
- package/dist/schema/nodes/column.js +2 -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/door.d.ts +29 -0
- package/dist/schema/nodes/door.d.ts.map +1 -1
- package/dist/schema/nodes/door.js +20 -0
- package/dist/schema/nodes/duct-terminal.d.ts +1 -0
- package/dist/schema/nodes/duct-terminal.d.ts.map +1 -1
- package/dist/schema/nodes/duct-terminal.js +2 -0
- package/dist/schema/nodes/fence.d.ts +2 -0
- package/dist/schema/nodes/fence.d.ts.map +1 -1
- package/dist/schema/nodes/fence.js +8 -0
- package/dist/schema/nodes/hvac-equipment.d.ts +1 -0
- package/dist/schema/nodes/hvac-equipment.d.ts.map +1 -1
- package/dist/schema/nodes/hvac-equipment.js +2 -0
- package/dist/schema/nodes/item.d.ts +1 -0
- package/dist/schema/nodes/item.d.ts.map +1 -1
- package/dist/schema/nodes/item.js +13 -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 -33
- package/dist/schema/nodes/shelf.d.ts +1 -0
- package/dist/schema/nodes/shelf.d.ts.map +1 -1
- package/dist/schema/nodes/shelf.js +2 -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/slab.d.ts +5 -0
- package/dist/schema/nodes/slab.d.ts.map +1 -1
- package/dist/schema/nodes/slab.js +14 -2
- 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.d.ts +3 -1
- package/dist/schema/nodes/stair.d.ts.map +1 -1
- package/dist/schema/nodes/stair.js +8 -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/wall.d.ts +5 -2
- package/dist/schema/nodes/wall.d.ts.map +1 -1
- package/dist/schema/nodes/wall.js +13 -4
- package/dist/schema/nodes/window.d.ts +29 -0
- package/dist/schema/nodes/window.d.ts.map +1 -1
- package/dist/schema/nodes/window.js +18 -0
- package/dist/schema/nodes/zone.d.ts +20 -0
- package/dist/schema/nodes/zone.d.ts.map +1 -1
- package/dist/schema/nodes/zone.js +15 -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 +211 -3
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +4 -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/index.d.ts +2 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -1
- package/dist/services/level-height.d.ts +8 -9
- package/dist/services/level-height.d.ts.map +1 -1
- package/dist/services/level-height.js +48 -16
- 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/store/actions/node-actions.d.ts.map +1 -1
- package/dist/store/actions/node-actions.js +47 -3
- package/dist/store/history-control.d.ts +20 -0
- package/dist/store/history-control.d.ts.map +1 -1
- package/dist/store/history-control.js +110 -13
- 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 +31 -2
- package/dist/store/use-scene.d.ts.map +1 -1
- package/dist/store/use-scene.js +638 -8
- 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/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-opening-preview.d.ts +1060 -935
- 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 +18 -15
- 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.js +6 -6
- 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.map +1 -1
- package/dist/utils/clone-scene-graph.js +34 -3
- package/dist/utils/heal-scene-graph.d.ts +1 -1
- package/dist/utils/heal-scene-graph.d.ts.map +1 -1
- package/dist/utils/heal-scene-graph.js +25 -9
- package/dist/validation/validate-build-json.d.ts +2 -0
- package/dist/validation/validate-build-json.d.ts.map +1 -1
- package/dist/validation/validate-build-json.js +59 -3
- package/package.json +2 -2
- package/dist/hooks/scene-registry/scene-registry.test.d.ts +0 -2
- package/dist/hooks/scene-registry/scene-registry.test.d.ts.map +0 -1
- package/dist/hooks/scene-registry/scene-registry.test.js +0 -26
- 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 -366
- package/dist/hooks/spatial-grid/wall-slab-overlap.test.d.ts +0 -2
- package/dist/hooks/spatial-grid/wall-slab-overlap.test.d.ts.map +0 -1
- package/dist/hooks/spatial-grid/wall-slab-overlap.test.js +0 -363
- package/dist/lib/measurement-geometry.test.d.ts +0 -2
- package/dist/lib/measurement-geometry.test.d.ts.map +0 -1
- package/dist/lib/measurement-geometry.test.js +0 -102
- package/dist/lib/slab-polygon.test.d.ts +0 -2
- package/dist/lib/slab-polygon.test.d.ts.map +0 -1
- package/dist/lib/slab-polygon.test.js +0 -635
- 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 -376
- package/dist/lib/zone-quantities.test.d.ts +0 -2
- package/dist/lib/zone-quantities.test.d.ts.map +0 -1
- package/dist/lib/zone-quantities.test.js +0 -82
- 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 -196
- 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 -163
- 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/schema/material.test.d.ts +0 -2
- package/dist/schema/material.test.d.ts.map +0 -1
- package/dist/schema/material.test.js +0 -43
- package/dist/schema/nodes/measurement.test.d.ts +0 -2
- package/dist/schema/nodes/measurement.test.d.ts.map +0 -1
- package/dist/schema/nodes/measurement.test.js +0 -139
- package/dist/schema/nodes/ridge-vent-defaults.test.d.ts +0 -2
- package/dist/schema/nodes/ridge-vent-defaults.test.d.ts.map +0 -1
- package/dist/schema/nodes/ridge-vent-defaults.test.js +0 -205
- package/dist/schema/nodes/roof-segment-shape.test.d.ts +0 -2
- package/dist/schema/nodes/roof-segment-shape.test.d.ts.map +0 -1
- package/dist/schema/nodes/roof-segment-shape.test.js +0 -175
- package/dist/schema/nodes/roof-segment-surface.test.d.ts +0 -2
- package/dist/schema/nodes/roof-segment-surface.test.d.ts.map +0 -1
- package/dist/schema/nodes/roof-segment-surface.test.js +0 -48
- package/dist/schema/nodes/roof-segment-trim.test.d.ts +0 -2
- package/dist/schema/nodes/roof-segment-trim.test.d.ts.map +0 -1
- package/dist/schema/nodes/roof-segment-trim.test.js +0 -107
- package/dist/schema/nodes/roof-segment-walls.test.d.ts +0 -2
- package/dist/schema/nodes/roof-segment-walls.test.d.ts.map +0 -1
- package/dist/schema/nodes/roof-segment-walls.test.js +0 -92
- package/dist/schema/nodes/wall.test.d.ts +0 -2
- package/dist/schema/nodes/wall.test.d.ts.map +0 -1
- package/dist/schema/nodes/wall.test.js +0 -208
- 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 -230
- 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/opening-guides.test.d.ts +0 -2
- package/dist/services/opening-guides.test.d.ts.map +0 -1
- package/dist/services/opening-guides.test.js +0 -208
- package/dist/services/port-connectivity.test.d.ts +0 -2
- package/dist/services/port-connectivity.test.d.ts.map +0 -1
- package/dist/services/port-connectivity.test.js +0 -297
- package/dist/services/riser-diagram.test.d.ts +0 -2
- package/dist/services/riser-diagram.test.d.ts.map +0 -1
- package/dist/services/riser-diagram.test.js +0 -66
- 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 -137
- package/dist/services/system-graph.test.d.ts +0 -2
- package/dist/services/system-graph.test.d.ts.map +0 -1
- package/dist/services/system-graph.test.js +0 -138
- package/dist/services/validate-dwv.test.d.ts +0 -2
- package/dist/services/validate-dwv.test.d.ts.map +0 -1
- package/dist/services/validate-dwv.test.js +0 -109
- 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/actions/ridge-vent-update.test.d.ts +0 -2
- package/dist/store/actions/ridge-vent-update.test.d.ts.map +0 -1
- package/dist/store/actions/ridge-vent-update.test.js +0 -264
- package/dist/store/use-scene-dirty-tracking.test.d.ts +0 -2
- package/dist/store/use-scene-dirty-tracking.test.d.ts.map +0 -1
- package/dist/store/use-scene-dirty-tracking.test.js +0 -68
- 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/store/use-scene-measurement-roundtrip.test.d.ts +0 -2
- package/dist/store/use-scene-measurement-roundtrip.test.d.ts.map +0 -1
- package/dist/store/use-scene-measurement-roundtrip.test.js +0 -97
- package/dist/store/use-scene-plugins.test.d.ts +0 -2
- package/dist/store/use-scene-plugins.test.d.ts.map +0 -1
- package/dist/store/use-scene-plugins.test.js +0 -51
- package/dist/store/use-scene-wall-slot-migration.test.d.ts +0 -2
- package/dist/store/use-scene-wall-slot-migration.test.d.ts.map +0 -1
- package/dist/store/use-scene-wall-slot-migration.test.js +0 -210
- package/dist/store/use-scene-window-migration.test.d.ts +0 -2
- package/dist/store/use-scene-window-migration.test.d.ts.map +0 -1
- package/dist/store/use-scene-window-migration.test.js +0 -85
- 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/fence/fence-spline.test.d.ts +0 -2
- package/dist/systems/fence/fence-spline.test.d.ts.map +0 -1
- package/dist/systems/fence/fence-spline.test.js +0 -136
- 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 -485
- package/dist/systems/wall/wall-mitering.test.d.ts +0 -2
- package/dist/systems/wall/wall-mitering.test.d.ts.map +0 -1
- package/dist/systems/wall/wall-mitering.test.js +0 -63
- 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 -62
- package/dist/utils/heal-scene-graph.test.d.ts +0 -2
- package/dist/utils/heal-scene-graph.test.d.ts.map +0 -1
- package/dist/utils/heal-scene-graph.test.js +0 -88
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { BuildingNode, CeilingNode, ElevatorNode, LevelNode, SlabNode } from '../../schema';
|
|
3
|
-
import { syncAutoElevatorOpenings } from './elevator-opening-sync';
|
|
4
|
-
describe('syncAutoElevatorOpenings', () => {
|
|
5
|
-
test('does not add elevator holes when a manual surface hole already covers them', () => {
|
|
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 elevator = ElevatorNode.parse({
|
|
10
|
-
name: 'Elevator',
|
|
11
|
-
parentId: building.id,
|
|
12
|
-
position: [2, 0, 1.5],
|
|
13
|
-
width: 1.6,
|
|
14
|
-
depth: 1.6,
|
|
15
|
-
});
|
|
16
|
-
const buildingWithChildren = {
|
|
17
|
-
...building,
|
|
18
|
-
children: [ground.id, upper.id, elevator.id],
|
|
19
|
-
};
|
|
20
|
-
const manualOpening = [
|
|
21
|
-
[1, 0.5],
|
|
22
|
-
[3, 0.5],
|
|
23
|
-
[3, 2.5],
|
|
24
|
-
[1, 2.5],
|
|
25
|
-
];
|
|
26
|
-
const sourceCeiling = CeilingNode.parse({
|
|
27
|
-
name: 'Source Ceiling',
|
|
28
|
-
parentId: ground.id,
|
|
29
|
-
polygon: [
|
|
30
|
-
[0, 0],
|
|
31
|
-
[4, 0],
|
|
32
|
-
[4, 3],
|
|
33
|
-
[0, 3],
|
|
34
|
-
],
|
|
35
|
-
holes: [manualOpening],
|
|
36
|
-
holeMetadata: [{ source: 'manual' }],
|
|
37
|
-
});
|
|
38
|
-
const upperSlab = SlabNode.parse({
|
|
39
|
-
name: 'Upper Slab',
|
|
40
|
-
parentId: upper.id,
|
|
41
|
-
polygon: [
|
|
42
|
-
[0, 0],
|
|
43
|
-
[4, 0],
|
|
44
|
-
[4, 3],
|
|
45
|
-
[0, 3],
|
|
46
|
-
],
|
|
47
|
-
holes: [manualOpening],
|
|
48
|
-
holeMetadata: [{ source: 'manual' }],
|
|
49
|
-
});
|
|
50
|
-
const nodes = Object.fromEntries([buildingWithChildren, ground, upper, elevator, sourceCeiling, upperSlab].map((node) => [
|
|
51
|
-
node.id,
|
|
52
|
-
node,
|
|
53
|
-
]));
|
|
54
|
-
const updates = syncAutoElevatorOpenings(nodes);
|
|
55
|
-
expect(updates.find((update) => update.id === upperSlab.id)).toBeUndefined();
|
|
56
|
-
expect(updates.find((update) => update.id === sourceCeiling.id)).toBeUndefined();
|
|
57
|
-
});
|
|
58
|
-
test('adds elevator holes when an existing manual hole is too small', () => {
|
|
59
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
60
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
61
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
62
|
-
const elevator = ElevatorNode.parse({
|
|
63
|
-
name: 'Elevator',
|
|
64
|
-
parentId: building.id,
|
|
65
|
-
position: [2, 0, 1.5],
|
|
66
|
-
width: 1.6,
|
|
67
|
-
depth: 1.6,
|
|
68
|
-
});
|
|
69
|
-
const buildingWithChildren = {
|
|
70
|
-
...building,
|
|
71
|
-
children: [ground.id, upper.id, elevator.id],
|
|
72
|
-
};
|
|
73
|
-
const smallManualOpening = [
|
|
74
|
-
[1.7, 1.2],
|
|
75
|
-
[2.3, 1.2],
|
|
76
|
-
[2.3, 1.8],
|
|
77
|
-
[1.7, 1.8],
|
|
78
|
-
];
|
|
79
|
-
const upperSlab = SlabNode.parse({
|
|
80
|
-
name: 'Upper Slab',
|
|
81
|
-
parentId: upper.id,
|
|
82
|
-
polygon: [
|
|
83
|
-
[0, 0],
|
|
84
|
-
[4, 0],
|
|
85
|
-
[4, 3],
|
|
86
|
-
[0, 3],
|
|
87
|
-
],
|
|
88
|
-
holes: [smallManualOpening],
|
|
89
|
-
holeMetadata: [{ source: 'manual' }],
|
|
90
|
-
});
|
|
91
|
-
const nodes = Object.fromEntries([buildingWithChildren, ground, upper, elevator, upperSlab].map((node) => [node.id, node]));
|
|
92
|
-
const updates = syncAutoElevatorOpenings(nodes);
|
|
93
|
-
const slabUpdate = updates.find((update) => update.id === upperSlab.id);
|
|
94
|
-
expect(slabUpdate?.data.holes).toHaveLength(2);
|
|
95
|
-
expect(slabUpdate?.data.holes?.[0]).toEqual(smallManualOpening);
|
|
96
|
-
expect(slabUpdate?.data.holeMetadata).toEqual([
|
|
97
|
-
{ source: 'manual' },
|
|
98
|
-
{ source: 'elevator', elevatorId: elevator.id },
|
|
99
|
-
]);
|
|
100
|
-
});
|
|
101
|
-
test('removes stale auto elevator holes when a manual hole overlaps the elevator opening', () => {
|
|
102
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
103
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
104
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
105
|
-
const elevator = ElevatorNode.parse({
|
|
106
|
-
name: 'Elevator',
|
|
107
|
-
parentId: building.id,
|
|
108
|
-
position: [2, 0, 1.5],
|
|
109
|
-
width: 1.6,
|
|
110
|
-
depth: 1.6,
|
|
111
|
-
});
|
|
112
|
-
const buildingWithChildren = {
|
|
113
|
-
...building,
|
|
114
|
-
children: [ground.id, upper.id, elevator.id],
|
|
115
|
-
};
|
|
116
|
-
const manualOpening = [
|
|
117
|
-
[1, 0.5],
|
|
118
|
-
[3, 0.5],
|
|
119
|
-
[3, 2.5],
|
|
120
|
-
[1, 2.5],
|
|
121
|
-
];
|
|
122
|
-
const staleAutoOpening = [
|
|
123
|
-
[1.12, 0.62],
|
|
124
|
-
[2.88, 0.62],
|
|
125
|
-
[2.88, 2.38],
|
|
126
|
-
[1.12, 2.38],
|
|
127
|
-
];
|
|
128
|
-
const upperSlab = SlabNode.parse({
|
|
129
|
-
name: 'Upper Slab',
|
|
130
|
-
parentId: upper.id,
|
|
131
|
-
polygon: [
|
|
132
|
-
[0, 0],
|
|
133
|
-
[4, 0],
|
|
134
|
-
[4, 3],
|
|
135
|
-
[0, 3],
|
|
136
|
-
],
|
|
137
|
-
holes: [manualOpening, staleAutoOpening],
|
|
138
|
-
holeMetadata: [{ source: 'manual' }, { source: 'elevator', elevatorId: elevator.id }],
|
|
139
|
-
});
|
|
140
|
-
const nodes = Object.fromEntries([buildingWithChildren, ground, upper, elevator, upperSlab].map((node) => [node.id, node]));
|
|
141
|
-
const updates = syncAutoElevatorOpenings(nodes);
|
|
142
|
-
const slabUpdate = updates.find((update) => update.id === upperSlab.id);
|
|
143
|
-
expect(slabUpdate?.data.holes).toEqual([manualOpening]);
|
|
144
|
-
expect(slabUpdate?.data.holeMetadata).toEqual([{ source: 'manual' }]);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elevator-runtime.test.d.ts","sourceRoot":"","sources":["../../../src/systems/elevator/elevator-runtime.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { ElevatorNode } from '../../schema';
|
|
3
|
-
import { createElevatorInteractiveState, openElevatorDoorState, queueElevatorRequest, stepElevatorRuntimeState, } from './elevator-runtime';
|
|
4
|
-
const groundLevelId = 'level_ground';
|
|
5
|
-
const upperLevelId = 'level_upper';
|
|
6
|
-
const entries = [
|
|
7
|
-
{ id: groundLevelId, label: '0', baseY: 0 },
|
|
8
|
-
{ id: upperLevelId, label: '1', baseY: 2.5 },
|
|
9
|
-
];
|
|
10
|
-
const elevator = ElevatorNode.parse({
|
|
11
|
-
speed: 10,
|
|
12
|
-
doorDurationMs: 100,
|
|
13
|
-
dwellMs: 0,
|
|
14
|
-
});
|
|
15
|
-
describe('elevator runtime helpers', () => {
|
|
16
|
-
test('queues level requests without duplicating the target', () => {
|
|
17
|
-
const state = createElevatorInteractiveState(groundLevelId, 0);
|
|
18
|
-
const queued = queueElevatorRequest(state, upperLevelId);
|
|
19
|
-
const duplicated = queueElevatorRequest(queued, upperLevelId);
|
|
20
|
-
expect(queued.queue).toEqual([upperLevelId]);
|
|
21
|
-
expect(queued.requestedStops).toEqual([upperLevelId]);
|
|
22
|
-
expect(duplicated.queue).toEqual([upperLevelId]);
|
|
23
|
-
expect(duplicated.requestedStops).toEqual([upperLevelId]);
|
|
24
|
-
});
|
|
25
|
-
test('opens doors only when the elevator is not moving', () => {
|
|
26
|
-
const idle = createElevatorInteractiveState(groundLevelId, 0);
|
|
27
|
-
const moving = { ...idle, phase: 'moving' };
|
|
28
|
-
expect(openElevatorDoorState(idle).phase).toBe('opening');
|
|
29
|
-
expect(openElevatorDoorState(moving)).toBe(moving);
|
|
30
|
-
});
|
|
31
|
-
test('moves to a queued level and clears the served request on arrival', () => {
|
|
32
|
-
const queued = queueElevatorRequest(createElevatorInteractiveState(groundLevelId, 0), upperLevelId);
|
|
33
|
-
const moving = stepElevatorRuntimeState({
|
|
34
|
-
defaultEntry: entries[0],
|
|
35
|
-
delta: 0.016,
|
|
36
|
-
elevator,
|
|
37
|
-
entries,
|
|
38
|
-
now: 0,
|
|
39
|
-
state: queued,
|
|
40
|
-
});
|
|
41
|
-
const arrived = stepElevatorRuntimeState({
|
|
42
|
-
defaultEntry: entries[0],
|
|
43
|
-
delta: 1,
|
|
44
|
-
elevator,
|
|
45
|
-
entries,
|
|
46
|
-
now: 100,
|
|
47
|
-
state: moving,
|
|
48
|
-
});
|
|
49
|
-
const open = stepElevatorRuntimeState({
|
|
50
|
-
defaultEntry: entries[0],
|
|
51
|
-
delta: 1,
|
|
52
|
-
elevator,
|
|
53
|
-
entries,
|
|
54
|
-
now: 200,
|
|
55
|
-
state: arrived,
|
|
56
|
-
});
|
|
57
|
-
expect(moving.phase).toBe('moving');
|
|
58
|
-
expect(arrived.currentLevelId).toBe(upperLevelId);
|
|
59
|
-
expect(arrived.phase).toBe('opening');
|
|
60
|
-
expect(open.phase).toBe('open');
|
|
61
|
-
expect(open.queue).toEqual([]);
|
|
62
|
-
expect(open.requestedStops).toEqual([upperLevelId]);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fence-spline.test.d.ts","sourceRoot":"","sources":["../../../src/systems/fence/fence-spline.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { getFenceControlHandle, getFenceSplineFrameAt, getFenceSplineLength, getTwoPointFenceCurveTangents, isSplineFence, sampleFenceSpline, } from './fence-spline';
|
|
3
|
-
describe('isSplineFence', () => {
|
|
4
|
-
test('false without a path or with < 2 points', () => {
|
|
5
|
-
expect(isSplineFence({ path: undefined })).toBe(false);
|
|
6
|
-
expect(isSplineFence({ path: [[0, 0]] })).toBe(false);
|
|
7
|
-
});
|
|
8
|
-
test('true with >= 2 points', () => {
|
|
9
|
-
expect(isSplineFence({
|
|
10
|
-
path: [
|
|
11
|
-
[0, 0],
|
|
12
|
-
[1, 0],
|
|
13
|
-
],
|
|
14
|
-
})).toBe(true);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
describe('sampleFenceSpline', () => {
|
|
18
|
-
test('honors the control points as on-curve anchors', () => {
|
|
19
|
-
const path = [
|
|
20
|
-
[0, 0],
|
|
21
|
-
[2, 2],
|
|
22
|
-
[4, 0],
|
|
23
|
-
];
|
|
24
|
-
const sampled = sampleFenceSpline(path, undefined, 8);
|
|
25
|
-
// First and last sample equal the path endpoints exactly.
|
|
26
|
-
expect(sampled[0]).toEqual({ x: 0, y: 0 });
|
|
27
|
-
expect(sampled[sampled.length - 1]).toEqual({ x: 4, y: 0 });
|
|
28
|
-
// The interior control point is interpolated: some sample lands on (2, 2).
|
|
29
|
-
const hitsMiddle = sampled.some((p) => Math.hypot(p.x - 2, p.y - 2) < 1e-6);
|
|
30
|
-
expect(hitsMiddle).toBe(true);
|
|
31
|
-
});
|
|
32
|
-
test('two-point path with no tangents is a straight segment', () => {
|
|
33
|
-
expect(sampleFenceSpline([
|
|
34
|
-
[0, 0],
|
|
35
|
-
[3, 0],
|
|
36
|
-
], undefined, 8)).toEqual([
|
|
37
|
-
{ x: 0, y: 0 },
|
|
38
|
-
{ x: 3, y: 0 },
|
|
39
|
-
]);
|
|
40
|
-
});
|
|
41
|
-
test('a stored tangent bends an otherwise straight two-point span', () => {
|
|
42
|
-
const path = [
|
|
43
|
-
[0, 0],
|
|
44
|
-
[4, 0],
|
|
45
|
-
];
|
|
46
|
-
// Pull the first point's handle up — the span should bow off the X axis.
|
|
47
|
-
const sampled = sampleFenceSpline(path, [[0, 2], null], 12);
|
|
48
|
-
expect(sampled[0]).toEqual({ x: 0, y: 0 });
|
|
49
|
-
expect(sampled[sampled.length - 1]).toEqual({ x: 4, y: 0 });
|
|
50
|
-
const maxY = Math.max(...sampled.map((p) => Math.abs(p.y)));
|
|
51
|
-
expect(maxY).toBeGreaterThan(0.1);
|
|
52
|
-
});
|
|
53
|
-
test('generated two-point curve tangents create a gentle arc', () => {
|
|
54
|
-
const path = [
|
|
55
|
-
[0, 0],
|
|
56
|
-
[4, 0],
|
|
57
|
-
];
|
|
58
|
-
const sampled = sampleFenceSpline(path, getTwoPointFenceCurveTangents(path), 16);
|
|
59
|
-
expect(sampled[0]).toEqual({ x: 0, y: 0 });
|
|
60
|
-
expect(sampled[sampled.length - 1]).toEqual({ x: 4, y: 0 });
|
|
61
|
-
const maxY = Math.max(...sampled.map((p) => p.y));
|
|
62
|
-
expect(maxY).toBeGreaterThan(0.4);
|
|
63
|
-
});
|
|
64
|
-
test('produces a smooth (no-cusp) curve on uneven spacing', () => {
|
|
65
|
-
const path = [
|
|
66
|
-
[0, 0],
|
|
67
|
-
[1, 0.2],
|
|
68
|
-
[5, 0.3],
|
|
69
|
-
[6, 0],
|
|
70
|
-
];
|
|
71
|
-
const sampled = sampleFenceSpline(path, undefined, 16);
|
|
72
|
-
let maxTurn = 0;
|
|
73
|
-
for (let i = 2; i < sampled.length; i += 1) {
|
|
74
|
-
const a = sampled[i - 2];
|
|
75
|
-
const b = sampled[i - 1];
|
|
76
|
-
const c = sampled[i];
|
|
77
|
-
const t1 = Math.atan2(b.y - a.y, b.x - a.x);
|
|
78
|
-
const t2 = Math.atan2(c.y - b.y, c.x - b.x);
|
|
79
|
-
let d = Math.abs(t2 - t1);
|
|
80
|
-
if (d > Math.PI)
|
|
81
|
-
d = 2 * Math.PI - d;
|
|
82
|
-
maxTurn = Math.max(maxTurn, d);
|
|
83
|
-
}
|
|
84
|
-
expect(maxTurn).toBeLessThan(Math.PI / 2);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
describe('getFenceControlHandle', () => {
|
|
88
|
-
test('returns the stored tangent when present', () => {
|
|
89
|
-
expect(getFenceControlHandle([
|
|
90
|
-
[0, 0],
|
|
91
|
-
[4, 0],
|
|
92
|
-
], [[1, 2], null], 0)).toEqual({ x: 1, y: 2 });
|
|
93
|
-
});
|
|
94
|
-
test('falls back to the automatic distance-aware tangent', () => {
|
|
95
|
-
const path = [
|
|
96
|
-
[0, 0],
|
|
97
|
-
[3, 0],
|
|
98
|
-
[6, 0],
|
|
99
|
-
];
|
|
100
|
-
expect(getFenceControlHandle(path, undefined, 1)).toEqual({ x: 1, y: 0 });
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
describe('getFenceSplineFrameAt', () => {
|
|
104
|
-
const path = [
|
|
105
|
-
[0, 0],
|
|
106
|
-
[2, 0],
|
|
107
|
-
[4, 0],
|
|
108
|
-
];
|
|
109
|
-
test('t=0 / t=1 land on the endpoints', () => {
|
|
110
|
-
expect(getFenceSplineFrameAt(path, 0).point).toEqual({ x: 0, y: 0 });
|
|
111
|
-
expect(getFenceSplineFrameAt(path, 1).point).toEqual({ x: 4, y: 0 });
|
|
112
|
-
});
|
|
113
|
-
test('returns a unit tangent and perpendicular normal', () => {
|
|
114
|
-
const frame = getFenceSplineFrameAt(path, 0.5);
|
|
115
|
-
expect(Math.hypot(frame.tangent.x, frame.tangent.y)).toBeCloseTo(1, 5);
|
|
116
|
-
const dot = frame.tangent.x * frame.normal.x + frame.tangent.y * frame.normal.y;
|
|
117
|
-
expect(dot).toBeCloseTo(0, 5);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
describe('getFenceSplineLength', () => {
|
|
121
|
-
test('roughly matches the straight distance for a straight path', () => {
|
|
122
|
-
expect(getFenceSplineLength([
|
|
123
|
-
[0, 0],
|
|
124
|
-
[3, 4],
|
|
125
|
-
], undefined, 8)).toBeCloseTo(5, 5);
|
|
126
|
-
});
|
|
127
|
-
test('a curved path is longer than its endpoint chord', () => {
|
|
128
|
-
const path = [
|
|
129
|
-
[0, 0],
|
|
130
|
-
[2, 2],
|
|
131
|
-
[4, 0],
|
|
132
|
-
];
|
|
133
|
-
const chord = Math.hypot(4, 0);
|
|
134
|
-
expect(getFenceSplineLength(path, undefined, 16)).toBeGreaterThan(chord);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stair-opening-preview.test.d.ts","sourceRoot":"","sources":["../../../src/systems/stair/stair-opening-preview.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { BuildingNode, LevelNode, SlabNode, StairNode, StairSegmentNode } from '../../schema';
|
|
3
|
-
import { getNodesWithLiveStairOpeningInputs, hasLiveStairOpeningInputs, } from './stair-opening-preview';
|
|
4
|
-
import { syncAutoStairOpenings } from './stair-opening-sync';
|
|
5
|
-
describe('stair opening previews', () => {
|
|
6
|
-
test('computes auto openings from live stair transforms', () => {
|
|
7
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
8
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
9
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
10
|
-
const slab = SlabNode.parse({
|
|
11
|
-
name: 'Upper Slab',
|
|
12
|
-
parentId: upper.id,
|
|
13
|
-
polygon: [
|
|
14
|
-
[0, 0],
|
|
15
|
-
[5, 0],
|
|
16
|
-
[5, 4],
|
|
17
|
-
[0, 4],
|
|
18
|
-
],
|
|
19
|
-
});
|
|
20
|
-
const segment = StairSegmentNode.parse({
|
|
21
|
-
parentId: 'stair_live',
|
|
22
|
-
width: 1,
|
|
23
|
-
length: 3,
|
|
24
|
-
height: 2.5,
|
|
25
|
-
stepCount: 12,
|
|
26
|
-
});
|
|
27
|
-
const stair = StairNode.parse({
|
|
28
|
-
id: 'stair_live',
|
|
29
|
-
name: 'Live Stair',
|
|
30
|
-
parentId: ground.id,
|
|
31
|
-
position: [1, 0, 0.2],
|
|
32
|
-
stairType: 'straight',
|
|
33
|
-
fromLevelId: ground.id,
|
|
34
|
-
toLevelId: upper.id,
|
|
35
|
-
slabOpeningMode: 'destination',
|
|
36
|
-
children: [segment.id],
|
|
37
|
-
});
|
|
38
|
-
const nodes = Object.fromEntries([building, ground, upper, slab, stair, { ...segment, parentId: stair.id }].map((node) => [
|
|
39
|
-
node.id,
|
|
40
|
-
node,
|
|
41
|
-
]));
|
|
42
|
-
const liveTransforms = new Map([
|
|
43
|
-
[stair.id, { position: [3, 0, 0.2], rotation: 0 }],
|
|
44
|
-
]);
|
|
45
|
-
const liveOverrides = new Map();
|
|
46
|
-
expect(hasLiveStairOpeningInputs(nodes, liveTransforms, liveOverrides, new Set())).toBe(true);
|
|
47
|
-
const previewNodes = getNodesWithLiveStairOpeningInputs(nodes, liveTransforms, liveOverrides, new Set());
|
|
48
|
-
const updates = syncAutoStairOpenings(previewNodes);
|
|
49
|
-
const hole = updates.find((update) => update.id === slab.id)?.data.holes?.[0];
|
|
50
|
-
expect(hole).toBeDefined();
|
|
51
|
-
expect(Math.max(...hole.map(([x]) => x))).toBeGreaterThan(3.4);
|
|
52
|
-
});
|
|
53
|
-
test('ignores its own live surface overrides as preview inputs', () => {
|
|
54
|
-
const slab = SlabNode.parse({
|
|
55
|
-
polygon: [
|
|
56
|
-
[0, 0],
|
|
57
|
-
[4, 0],
|
|
58
|
-
[4, 4],
|
|
59
|
-
[0, 4],
|
|
60
|
-
],
|
|
61
|
-
});
|
|
62
|
-
const nodes = { [slab.id]: slab };
|
|
63
|
-
const liveOverrides = new Map([
|
|
64
|
-
[
|
|
65
|
-
slab.id,
|
|
66
|
-
{
|
|
67
|
-
holes: [
|
|
68
|
-
[
|
|
69
|
-
[1, 1],
|
|
70
|
-
[2, 1],
|
|
71
|
-
[2, 2],
|
|
72
|
-
[1, 2],
|
|
73
|
-
],
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
]);
|
|
78
|
-
expect(hasLiveStairOpeningInputs(nodes, new Map(), liveOverrides, new Set([slab.id]))).toBe(false);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stair-opening-sync.test.d.ts","sourceRoot":"","sources":["../../../src/systems/stair/stair-opening-sync.test.ts"],"names":[],"mappings":""}
|