@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.
Files changed (339) hide show
  1. package/README.md +17 -10
  2. package/dist/events/bus.d.ts +21 -2
  3. package/dist/events/bus.d.ts.map +1 -1
  4. package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts +17 -1
  5. package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts.map +1 -1
  6. package/dist/hooks/spatial-grid/floor-placed-elevation.js +61 -8
  7. package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +116 -66
  8. package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
  9. package/dist/hooks/spatial-grid/spatial-grid-manager.js +316 -441
  10. package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +46 -1
  11. package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
  12. package/dist/hooks/spatial-grid/spatial-grid-sync.js +193 -12
  13. package/dist/hooks/spatial-grid/support-host-id.d.ts +3 -0
  14. package/dist/hooks/spatial-grid/support-host-id.d.ts.map +1 -0
  15. package/dist/hooks/spatial-grid/support-host-id.js +2 -0
  16. package/dist/hooks/spatial-grid/support-host-patch.d.ts +51 -0
  17. package/dist/hooks/spatial-grid/support-host-patch.d.ts.map +1 -0
  18. package/dist/hooks/spatial-grid/support-host-patch.js +164 -0
  19. package/dist/index.d.ts +23 -11
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +22 -10
  22. package/dist/lib/measurement-geometry.d.ts +4 -0
  23. package/dist/lib/measurement-geometry.d.ts.map +1 -1
  24. package/dist/lib/measurement-geometry.js +27 -10
  25. package/dist/lib/slab-polygon.d.ts.map +1 -1
  26. package/dist/lib/slab-polygon.js +33 -1
  27. package/dist/lib/space-detection.d.ts +15 -4
  28. package/dist/lib/space-detection.d.ts.map +1 -1
  29. package/dist/lib/space-detection.js +174 -88
  30. package/dist/lib/terrain-brush.d.ts +163 -0
  31. package/dist/lib/terrain-brush.d.ts.map +1 -0
  32. package/dist/lib/terrain-brush.js +359 -0
  33. package/dist/lib/terrain-codec.d.ts +51 -0
  34. package/dist/lib/terrain-codec.d.ts.map +1 -0
  35. package/dist/lib/terrain-codec.js +167 -0
  36. package/dist/lib/terrain-field.d.ts +150 -0
  37. package/dist/lib/terrain-field.d.ts.map +1 -0
  38. package/dist/lib/terrain-field.js +248 -0
  39. package/dist/lib/terrain-raycast.d.ts +44 -0
  40. package/dist/lib/terrain-raycast.d.ts.map +1 -0
  41. package/dist/lib/terrain-raycast.js +188 -0
  42. package/dist/lib/terrain-source.d.ts +60 -0
  43. package/dist/lib/terrain-source.d.ts.map +1 -0
  44. package/dist/lib/terrain-source.js +90 -0
  45. package/dist/lib/terrain-support.d.ts +60 -0
  46. package/dist/lib/terrain-support.d.ts.map +1 -0
  47. package/dist/lib/terrain-support.js +150 -0
  48. package/dist/lib/zone-quantities.d.ts +1 -1
  49. package/dist/lib/zone-quantities.d.ts.map +1 -1
  50. package/dist/lib/zone-quantities.js +311 -66
  51. package/dist/material-library.d.ts +9 -1
  52. package/dist/material-library.d.ts.map +1 -1
  53. package/dist/material-library.js +56 -4
  54. package/dist/registry/handles.d.ts +16 -1
  55. package/dist/registry/handles.d.ts.map +1 -1
  56. package/dist/registry/index.d.ts +1 -1
  57. package/dist/registry/index.d.ts.map +1 -1
  58. package/dist/registry/subtree.d.ts.map +1 -1
  59. package/dist/registry/subtree.js +5 -2
  60. package/dist/registry/types.d.ts +64 -1
  61. package/dist/registry/types.d.ts.map +1 -1
  62. package/dist/schema/index.d.ts +6 -3
  63. package/dist/schema/index.d.ts.map +1 -1
  64. package/dist/schema/index.js +6 -3
  65. package/dist/schema/nodes/cabinet.d.ts +2 -0
  66. package/dist/schema/nodes/cabinet.d.ts.map +1 -1
  67. package/dist/schema/nodes/cabinet.js +4 -2
  68. package/dist/schema/nodes/ceiling.d.ts +1 -1
  69. package/dist/schema/nodes/ceiling.d.ts.map +1 -1
  70. package/dist/schema/nodes/ceiling.js +7 -1
  71. package/dist/schema/nodes/column.d.ts +1 -0
  72. package/dist/schema/nodes/column.d.ts.map +1 -1
  73. package/dist/schema/nodes/column.js +2 -0
  74. package/dist/schema/nodes/construction-dimension.d.ts +195 -0
  75. package/dist/schema/nodes/construction-dimension.d.ts.map +1 -0
  76. package/dist/schema/nodes/construction-dimension.js +151 -0
  77. package/dist/schema/nodes/door.d.ts +29 -0
  78. package/dist/schema/nodes/door.d.ts.map +1 -1
  79. package/dist/schema/nodes/door.js +20 -0
  80. package/dist/schema/nodes/duct-terminal.d.ts +1 -0
  81. package/dist/schema/nodes/duct-terminal.d.ts.map +1 -1
  82. package/dist/schema/nodes/duct-terminal.js +2 -0
  83. package/dist/schema/nodes/fence.d.ts +2 -0
  84. package/dist/schema/nodes/fence.d.ts.map +1 -1
  85. package/dist/schema/nodes/fence.js +8 -0
  86. package/dist/schema/nodes/hvac-equipment.d.ts +1 -0
  87. package/dist/schema/nodes/hvac-equipment.d.ts.map +1 -1
  88. package/dist/schema/nodes/hvac-equipment.js +2 -0
  89. package/dist/schema/nodes/item.d.ts +1 -0
  90. package/dist/schema/nodes/item.d.ts.map +1 -1
  91. package/dist/schema/nodes/item.js +13 -0
  92. package/dist/schema/nodes/level.d.ts +2 -1
  93. package/dist/schema/nodes/level.d.ts.map +1 -1
  94. package/dist/schema/nodes/level.js +12 -33
  95. package/dist/schema/nodes/shelf.d.ts +1 -0
  96. package/dist/schema/nodes/shelf.d.ts.map +1 -1
  97. package/dist/schema/nodes/shelf.js +2 -0
  98. package/dist/schema/nodes/site.d.ts +9 -0
  99. package/dist/schema/nodes/site.d.ts.map +1 -1
  100. package/dist/schema/nodes/site.js +8 -6
  101. package/dist/schema/nodes/slab.d.ts +5 -0
  102. package/dist/schema/nodes/slab.d.ts.map +1 -1
  103. package/dist/schema/nodes/slab.js +14 -2
  104. package/dist/schema/nodes/spawn.d.ts +1 -0
  105. package/dist/schema/nodes/spawn.d.ts.map +1 -1
  106. package/dist/schema/nodes/spawn.js +2 -0
  107. package/dist/schema/nodes/stair.d.ts +3 -1
  108. package/dist/schema/nodes/stair.d.ts.map +1 -1
  109. package/dist/schema/nodes/stair.js +8 -1
  110. package/dist/schema/nodes/structural-grid.d.ts +27 -0
  111. package/dist/schema/nodes/structural-grid.d.ts.map +1 -0
  112. package/dist/schema/nodes/structural-grid.js +17 -0
  113. package/dist/schema/nodes/wall.d.ts +5 -2
  114. package/dist/schema/nodes/wall.d.ts.map +1 -1
  115. package/dist/schema/nodes/wall.js +13 -4
  116. package/dist/schema/nodes/window.d.ts +29 -0
  117. package/dist/schema/nodes/window.d.ts.map +1 -1
  118. package/dist/schema/nodes/window.js +18 -0
  119. package/dist/schema/nodes/zone.d.ts +20 -0
  120. package/dist/schema/nodes/zone.d.ts.map +1 -1
  121. package/dist/schema/nodes/zone.js +15 -0
  122. package/dist/schema/terrain.d.ts +28 -0
  123. package/dist/schema/terrain.d.ts.map +1 -0
  124. package/dist/schema/terrain.js +30 -0
  125. package/dist/schema/types.d.ts +211 -3
  126. package/dist/schema/types.d.ts.map +1 -1
  127. package/dist/schema/types.js +4 -0
  128. package/dist/services/__fixtures__/wall-plane-top-boundary-repro.d.ts +80 -0
  129. package/dist/services/__fixtures__/wall-plane-top-boundary-repro.d.ts.map +1 -0
  130. package/dist/services/__fixtures__/wall-plane-top-boundary-repro.js +89 -0
  131. package/dist/services/index.d.ts +2 -1
  132. package/dist/services/index.d.ts.map +1 -1
  133. package/dist/services/index.js +2 -1
  134. package/dist/services/level-height.d.ts +8 -9
  135. package/dist/services/level-height.d.ts.map +1 -1
  136. package/dist/services/level-height.js +48 -16
  137. package/dist/services/storey.d.ts +103 -0
  138. package/dist/services/storey.d.ts.map +1 -0
  139. package/dist/services/storey.js +296 -0
  140. package/dist/store/actions/node-actions.d.ts.map +1 -1
  141. package/dist/store/actions/node-actions.js +47 -3
  142. package/dist/store/history-control.d.ts +20 -0
  143. package/dist/store/history-control.d.ts.map +1 -1
  144. package/dist/store/history-control.js +110 -13
  145. package/dist/store/use-live-terrain.d.ts +65 -0
  146. package/dist/store/use-live-terrain.d.ts.map +1 -0
  147. package/dist/store/use-live-terrain.js +31 -0
  148. package/dist/store/use-live-transforms.d.ts +8 -0
  149. package/dist/store/use-live-transforms.d.ts.map +1 -1
  150. package/dist/store/use-scene.d.ts +31 -2
  151. package/dist/store/use-scene.d.ts.map +1 -1
  152. package/dist/store/use-scene.js +638 -8
  153. package/dist/systems/elevator/elevator-opening-system.d.ts +1 -0
  154. package/dist/systems/elevator/elevator-opening-system.d.ts.map +1 -1
  155. package/dist/systems/elevator/elevator-opening-system.js +27 -21
  156. package/dist/systems/elevator/elevator-service.d.ts +0 -2
  157. package/dist/systems/elevator/elevator-service.d.ts.map +1 -1
  158. package/dist/systems/elevator/elevator-service.js +2 -24
  159. package/dist/systems/slab/slab-placement.d.ts +11 -0
  160. package/dist/systems/slab/slab-placement.d.ts.map +1 -0
  161. package/dist/systems/slab/slab-placement.js +14 -0
  162. package/dist/systems/slab/slab-support.d.ts +137 -0
  163. package/dist/systems/slab/slab-support.d.ts.map +1 -0
  164. package/dist/systems/slab/slab-support.js +557 -0
  165. package/dist/systems/stair/stair-opening-preview.d.ts +1060 -935
  166. package/dist/systems/stair/stair-opening-preview.d.ts.map +1 -1
  167. package/dist/systems/stair/stair-opening-sync.d.ts.map +1 -1
  168. package/dist/systems/stair/stair-opening-sync.js +18 -15
  169. package/dist/systems/stair/stair-opening-system.d.ts.map +1 -1
  170. package/dist/systems/stair/stair-opening-system.js +32 -4
  171. package/dist/systems/stair/stair-rise.d.ts +22 -0
  172. package/dist/systems/stair/stair-rise.d.ts.map +1 -0
  173. package/dist/systems/stair/stair-rise.js +79 -0
  174. package/dist/systems/wall/wall-curve.d.ts +10 -0
  175. package/dist/systems/wall/wall-curve.d.ts.map +1 -1
  176. package/dist/systems/wall/wall-curve.js +1 -1
  177. package/dist/systems/wall/wall-mitering.js +6 -6
  178. package/dist/systems/wall/wall-top.d.ts +40 -0
  179. package/dist/systems/wall/wall-top.d.ts.map +1 -0
  180. package/dist/systems/wall/wall-top.js +46 -0
  181. package/dist/utils/clone-scene-graph.d.ts.map +1 -1
  182. package/dist/utils/clone-scene-graph.js +34 -3
  183. package/dist/utils/heal-scene-graph.d.ts +1 -1
  184. package/dist/utils/heal-scene-graph.d.ts.map +1 -1
  185. package/dist/utils/heal-scene-graph.js +25 -9
  186. package/dist/validation/validate-build-json.d.ts +2 -0
  187. package/dist/validation/validate-build-json.d.ts.map +1 -1
  188. package/dist/validation/validate-build-json.js +59 -3
  189. package/package.json +2 -2
  190. package/dist/hooks/scene-registry/scene-registry.test.d.ts +0 -2
  191. package/dist/hooks/scene-registry/scene-registry.test.d.ts.map +0 -1
  192. package/dist/hooks/scene-registry/scene-registry.test.js +0 -26
  193. package/dist/hooks/spatial-grid/floor-placed-elevation.test.d.ts +0 -2
  194. package/dist/hooks/spatial-grid/floor-placed-elevation.test.d.ts.map +0 -1
  195. package/dist/hooks/spatial-grid/floor-placed-elevation.test.js +0 -366
  196. package/dist/hooks/spatial-grid/wall-slab-overlap.test.d.ts +0 -2
  197. package/dist/hooks/spatial-grid/wall-slab-overlap.test.d.ts.map +0 -1
  198. package/dist/hooks/spatial-grid/wall-slab-overlap.test.js +0 -363
  199. package/dist/lib/measurement-geometry.test.d.ts +0 -2
  200. package/dist/lib/measurement-geometry.test.d.ts.map +0 -1
  201. package/dist/lib/measurement-geometry.test.js +0 -102
  202. package/dist/lib/slab-polygon.test.d.ts +0 -2
  203. package/dist/lib/slab-polygon.test.d.ts.map +0 -1
  204. package/dist/lib/slab-polygon.test.js +0 -635
  205. package/dist/lib/space-detection-pause.test.d.ts +0 -2
  206. package/dist/lib/space-detection-pause.test.d.ts.map +0 -1
  207. package/dist/lib/space-detection-pause.test.js +0 -42
  208. package/dist/lib/space-detection.test.d.ts +0 -2
  209. package/dist/lib/space-detection.test.d.ts.map +0 -1
  210. package/dist/lib/space-detection.test.js +0 -376
  211. package/dist/lib/zone-quantities.test.d.ts +0 -2
  212. package/dist/lib/zone-quantities.test.d.ts.map +0 -1
  213. package/dist/lib/zone-quantities.test.js +0 -82
  214. package/dist/registry/registry.test.d.ts +0 -2
  215. package/dist/registry/registry.test.d.ts.map +0 -1
  216. package/dist/registry/registry.test.js +0 -196
  217. package/dist/registry/relations-resolver.test.d.ts +0 -2
  218. package/dist/registry/relations-resolver.test.d.ts.map +0 -1
  219. package/dist/registry/relations-resolver.test.js +0 -183
  220. package/dist/registry/scene-api.test.d.ts +0 -2
  221. package/dist/registry/scene-api.test.d.ts.map +0 -1
  222. package/dist/registry/scene-api.test.js +0 -183
  223. package/dist/registry/subtree.test.d.ts +0 -2
  224. package/dist/registry/subtree.test.d.ts.map +0 -1
  225. package/dist/registry/subtree.test.js +0 -163
  226. package/dist/schema/asset-url.test.d.ts +0 -2
  227. package/dist/schema/asset-url.test.d.ts.map +0 -1
  228. package/dist/schema/asset-url.test.js +0 -134
  229. package/dist/schema/material.test.d.ts +0 -2
  230. package/dist/schema/material.test.d.ts.map +0 -1
  231. package/dist/schema/material.test.js +0 -43
  232. package/dist/schema/nodes/measurement.test.d.ts +0 -2
  233. package/dist/schema/nodes/measurement.test.d.ts.map +0 -1
  234. package/dist/schema/nodes/measurement.test.js +0 -139
  235. package/dist/schema/nodes/ridge-vent-defaults.test.d.ts +0 -2
  236. package/dist/schema/nodes/ridge-vent-defaults.test.d.ts.map +0 -1
  237. package/dist/schema/nodes/ridge-vent-defaults.test.js +0 -205
  238. package/dist/schema/nodes/roof-segment-shape.test.d.ts +0 -2
  239. package/dist/schema/nodes/roof-segment-shape.test.d.ts.map +0 -1
  240. package/dist/schema/nodes/roof-segment-shape.test.js +0 -175
  241. package/dist/schema/nodes/roof-segment-surface.test.d.ts +0 -2
  242. package/dist/schema/nodes/roof-segment-surface.test.d.ts.map +0 -1
  243. package/dist/schema/nodes/roof-segment-surface.test.js +0 -48
  244. package/dist/schema/nodes/roof-segment-trim.test.d.ts +0 -2
  245. package/dist/schema/nodes/roof-segment-trim.test.d.ts.map +0 -1
  246. package/dist/schema/nodes/roof-segment-trim.test.js +0 -107
  247. package/dist/schema/nodes/roof-segment-walls.test.d.ts +0 -2
  248. package/dist/schema/nodes/roof-segment-walls.test.d.ts.map +0 -1
  249. package/dist/schema/nodes/roof-segment-walls.test.js +0 -92
  250. package/dist/schema/nodes/wall.test.d.ts +0 -2
  251. package/dist/schema/nodes/wall.test.d.ts.map +0 -1
  252. package/dist/schema/nodes/wall.test.js +0 -208
  253. package/dist/services/alignment-anchors.test.d.ts +0 -2
  254. package/dist/services/alignment-anchors.test.d.ts.map +0 -1
  255. package/dist/services/alignment-anchors.test.js +0 -383
  256. package/dist/services/alignment.test.d.ts +0 -2
  257. package/dist/services/alignment.test.d.ts.map +0 -1
  258. package/dist/services/alignment.test.js +0 -92
  259. package/dist/services/drag-session.test.d.ts +0 -2
  260. package/dist/services/drag-session.test.d.ts.map +0 -1
  261. package/dist/services/drag-session.test.js +0 -219
  262. package/dist/services/hosting.test.d.ts +0 -2
  263. package/dist/services/hosting.test.d.ts.map +0 -1
  264. package/dist/services/hosting.test.js +0 -230
  265. package/dist/services/movement.test.d.ts +0 -2
  266. package/dist/services/movement.test.d.ts.map +0 -1
  267. package/dist/services/movement.test.js +0 -133
  268. package/dist/services/opening-guides.test.d.ts +0 -2
  269. package/dist/services/opening-guides.test.d.ts.map +0 -1
  270. package/dist/services/opening-guides.test.js +0 -208
  271. package/dist/services/port-connectivity.test.d.ts +0 -2
  272. package/dist/services/port-connectivity.test.d.ts.map +0 -1
  273. package/dist/services/port-connectivity.test.js +0 -297
  274. package/dist/services/riser-diagram.test.d.ts +0 -2
  275. package/dist/services/riser-diagram.test.d.ts.map +0 -1
  276. package/dist/services/riser-diagram.test.js +0 -66
  277. package/dist/services/single-undo-dance.test.d.ts +0 -2
  278. package/dist/services/single-undo-dance.test.d.ts.map +0 -1
  279. package/dist/services/single-undo-dance.test.js +0 -210
  280. package/dist/services/snap.test.d.ts +0 -2
  281. package/dist/services/snap.test.d.ts.map +0 -1
  282. package/dist/services/snap.test.js +0 -137
  283. package/dist/services/system-graph.test.d.ts +0 -2
  284. package/dist/services/system-graph.test.d.ts.map +0 -1
  285. package/dist/services/system-graph.test.js +0 -138
  286. package/dist/services/validate-dwv.test.d.ts +0 -2
  287. package/dist/services/validate-dwv.test.d.ts.map +0 -1
  288. package/dist/services/validate-dwv.test.js +0 -109
  289. package/dist/store/actions/node-mutation-sanitize.test.d.ts +0 -2
  290. package/dist/store/actions/node-mutation-sanitize.test.d.ts.map +0 -1
  291. package/dist/store/actions/node-mutation-sanitize.test.js +0 -147
  292. package/dist/store/actions/reparent.test.d.ts +0 -2
  293. package/dist/store/actions/reparent.test.d.ts.map +0 -1
  294. package/dist/store/actions/reparent.test.js +0 -212
  295. package/dist/store/actions/ridge-vent-update.test.d.ts +0 -2
  296. package/dist/store/actions/ridge-vent-update.test.d.ts.map +0 -1
  297. package/dist/store/actions/ridge-vent-update.test.js +0 -264
  298. package/dist/store/use-scene-dirty-tracking.test.d.ts +0 -2
  299. package/dist/store/use-scene-dirty-tracking.test.d.ts.map +0 -1
  300. package/dist/store/use-scene-dirty-tracking.test.js +0 -68
  301. package/dist/store/use-scene-elevator-migration.test.d.ts +0 -2
  302. package/dist/store/use-scene-elevator-migration.test.d.ts.map +0 -1
  303. package/dist/store/use-scene-elevator-migration.test.js +0 -109
  304. package/dist/store/use-scene-measurement-roundtrip.test.d.ts +0 -2
  305. package/dist/store/use-scene-measurement-roundtrip.test.d.ts.map +0 -1
  306. package/dist/store/use-scene-measurement-roundtrip.test.js +0 -97
  307. package/dist/store/use-scene-plugins.test.d.ts +0 -2
  308. package/dist/store/use-scene-plugins.test.d.ts.map +0 -1
  309. package/dist/store/use-scene-plugins.test.js +0 -51
  310. package/dist/store/use-scene-wall-slot-migration.test.d.ts +0 -2
  311. package/dist/store/use-scene-wall-slot-migration.test.d.ts.map +0 -1
  312. package/dist/store/use-scene-wall-slot-migration.test.js +0 -210
  313. package/dist/store/use-scene-window-migration.test.d.ts +0 -2
  314. package/dist/store/use-scene-window-migration.test.d.ts.map +0 -1
  315. package/dist/store/use-scene-window-migration.test.js +0 -85
  316. package/dist/systems/elevator/elevator-opening-sync.test.d.ts +0 -2
  317. package/dist/systems/elevator/elevator-opening-sync.test.d.ts.map +0 -1
  318. package/dist/systems/elevator/elevator-opening-sync.test.js +0 -146
  319. package/dist/systems/elevator/elevator-runtime.test.d.ts +0 -2
  320. package/dist/systems/elevator/elevator-runtime.test.d.ts.map +0 -1
  321. package/dist/systems/elevator/elevator-runtime.test.js +0 -64
  322. package/dist/systems/fence/fence-spline.test.d.ts +0 -2
  323. package/dist/systems/fence/fence-spline.test.d.ts.map +0 -1
  324. package/dist/systems/fence/fence-spline.test.js +0 -136
  325. package/dist/systems/stair/stair-opening-preview.test.d.ts +0 -2
  326. package/dist/systems/stair/stair-opening-preview.test.d.ts.map +0 -1
  327. package/dist/systems/stair/stair-opening-preview.test.js +0 -80
  328. package/dist/systems/stair/stair-opening-sync.test.d.ts +0 -2
  329. package/dist/systems/stair/stair-opening-sync.test.d.ts.map +0 -1
  330. package/dist/systems/stair/stair-opening-sync.test.js +0 -485
  331. package/dist/systems/wall/wall-mitering.test.d.ts +0 -2
  332. package/dist/systems/wall/wall-mitering.test.d.ts.map +0 -1
  333. package/dist/systems/wall/wall-mitering.test.js +0 -63
  334. package/dist/utils/clone-scene-graph.test.d.ts +0 -2
  335. package/dist/utils/clone-scene-graph.test.d.ts.map +0 -1
  336. package/dist/utils/clone-scene-graph.test.js +0 -62
  337. package/dist/utils/heal-scene-graph.test.d.ts +0 -2
  338. package/dist/utils/heal-scene-graph.test.d.ts.map +0 -1
  339. 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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=elevator-runtime.test.d.ts.map
@@ -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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=fence-spline.test.d.ts.map
@@ -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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=stair-opening-preview.test.d.ts.map
@@ -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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=stair-opening-sync.test.d.ts.map
@@ -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":""}