@pascal-app/core 1.0.0-beta.5 → 1.0.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 (417) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +23 -0
  3. package/dist/capture/index.d.ts +3 -0
  4. package/dist/capture/index.d.ts.map +1 -0
  5. package/dist/capture/index.js +2 -0
  6. package/dist/capture/schema.d.ts +417 -0
  7. package/dist/capture/schema.d.ts.map +1 -0
  8. package/dist/capture/schema.js +350 -0
  9. package/dist/capture/source.d.ts +60 -0
  10. package/dist/capture/source.d.ts.map +1 -0
  11. package/dist/capture/source.js +254 -0
  12. package/dist/events/bus.d.ts +58 -7
  13. package/dist/events/bus.d.ts.map +1 -1
  14. package/dist/events/hidden-wall-pointer-hold.d.ts +28 -0
  15. package/dist/events/hidden-wall-pointer-hold.d.ts.map +1 -0
  16. package/dist/events/hidden-wall-pointer-hold.js +37 -0
  17. package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts +4 -4
  18. package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts.map +1 -1
  19. package/dist/hooks/spatial-grid/floor-placed-elevation.js +7 -12
  20. package/dist/hooks/spatial-grid/floor-placed-footprints.d.ts +4 -0
  21. package/dist/hooks/spatial-grid/floor-placed-footprints.d.ts.map +1 -0
  22. package/dist/hooks/spatial-grid/floor-placed-footprints.js +7 -0
  23. package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +5 -8
  24. package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
  25. package/dist/hooks/spatial-grid/spatial-grid-manager.js +23 -106
  26. package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +2931 -2
  27. package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
  28. package/dist/hooks/spatial-grid/spatial-grid-sync.js +207 -30
  29. package/dist/hooks/spatial-grid/support-host-patch.d.ts +45 -1
  30. package/dist/hooks/spatial-grid/support-host-patch.d.ts.map +1 -1
  31. package/dist/hooks/spatial-grid/support-host-patch.js +174 -9
  32. package/dist/hooks/spatial-grid/use-spatial-query.d.ts +1 -1
  33. package/dist/hooks/spatial-grid/use-spatial-query.js +1 -1
  34. package/dist/index.d.ts +74 -64
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +74 -61
  37. package/dist/lib/asset-storage.d.ts.map +1 -1
  38. package/dist/lib/asset-storage.js +4 -1
  39. package/dist/lib/door-operation.d.ts +1 -1
  40. package/dist/lib/item-polygon-overlap.d.ts +6 -0
  41. package/dist/lib/item-polygon-overlap.d.ts.map +1 -0
  42. package/dist/lib/item-polygon-overlap.js +67 -0
  43. package/dist/lib/level-name.d.ts +1 -1
  44. package/dist/lib/measurement-geometry.d.ts +4 -4
  45. package/dist/lib/plan-footprint.d.ts +41 -0
  46. package/dist/lib/plan-footprint.d.ts.map +1 -0
  47. package/dist/lib/plan-footprint.js +58 -0
  48. package/dist/lib/polygon-union.d.ts +4 -0
  49. package/dist/lib/polygon-union.d.ts.map +1 -0
  50. package/dist/lib/polygon-union.js +306 -0
  51. package/dist/lib/roof-overlap.d.ts +32 -0
  52. package/dist/lib/roof-overlap.d.ts.map +1 -0
  53. package/dist/lib/roof-overlap.js +72 -0
  54. package/dist/lib/room-topology-index.d.ts +1 -1
  55. package/dist/lib/room-topology-index.js +1 -1
  56. package/dist/lib/selection-proxy.d.ts +1 -1
  57. package/dist/lib/slab-polygon.d.ts +36 -3
  58. package/dist/lib/slab-polygon.d.ts.map +1 -1
  59. package/dist/lib/slab-polygon.js +135 -29
  60. package/dist/lib/space-detection.d.ts +12 -1
  61. package/dist/lib/space-detection.d.ts.map +1 -1
  62. package/dist/lib/space-detection.js +58 -25
  63. package/dist/lib/terrain-brush.d.ts +1 -1
  64. package/dist/lib/terrain-brush.js +1 -1
  65. package/dist/lib/terrain-codec.d.ts +2 -2
  66. package/dist/lib/terrain-codec.js +1 -1
  67. package/dist/lib/terrain-raycast.d.ts +1 -1
  68. package/dist/lib/terrain-raycast.js +1 -1
  69. package/dist/lib/terrain-source.d.ts +3 -3
  70. package/dist/lib/terrain-source.js +3 -3
  71. package/dist/lib/terrain-support.d.ts +1 -1
  72. package/dist/lib/terrain-support.js +3 -3
  73. package/dist/lib/unit-containment.d.ts +19 -0
  74. package/dist/lib/unit-containment.d.ts.map +1 -0
  75. package/dist/lib/unit-containment.js +158 -0
  76. package/dist/lib/unit-report.d.ts +19 -0
  77. package/dist/lib/unit-report.d.ts.map +1 -0
  78. package/dist/lib/unit-report.js +36 -0
  79. package/dist/lib/wall-distance.d.ts +2 -2
  80. package/dist/lib/wall-distance.js +1 -1
  81. package/dist/lib/zone-quantities.d.ts +1 -1
  82. package/dist/lib/zone-quantities.js +7 -7
  83. package/dist/material-library.d.ts +1 -1
  84. package/dist/material-library.js +1 -1
  85. package/dist/procedural-items/fixtures.d.ts +261 -0
  86. package/dist/procedural-items/fixtures.d.ts.map +1 -0
  87. package/dist/procedural-items/fixtures.js +349 -0
  88. package/dist/procedural-items/index.d.ts +10 -0
  89. package/dist/procedural-items/index.d.ts.map +1 -0
  90. package/dist/procedural-items/index.js +9 -0
  91. package/dist/procedural-items/integration.d.ts +92 -0
  92. package/dist/procedural-items/integration.d.ts.map +1 -0
  93. package/dist/procedural-items/integration.js +19 -0
  94. package/dist/procedural-items/library-colors.d.ts +56 -0
  95. package/dist/procedural-items/library-colors.d.ts.map +1 -0
  96. package/dist/procedural-items/library-colors.js +84 -0
  97. package/dist/procedural-items/materials.d.ts +5 -0
  98. package/dist/procedural-items/materials.d.ts.map +1 -0
  99. package/dist/procedural-items/materials.js +47 -0
  100. package/dist/procedural-items/node.d.ts +280 -0
  101. package/dist/procedural-items/node.d.ts.map +1 -0
  102. package/dist/procedural-items/node.js +71 -0
  103. package/dist/procedural-items/placement.d.ts +7 -0
  104. package/dist/procedural-items/placement.d.ts.map +1 -0
  105. package/dist/procedural-items/placement.js +48 -0
  106. package/dist/procedural-items/query.d.ts +50 -0
  107. package/dist/procedural-items/query.d.ts.map +1 -0
  108. package/dist/procedural-items/query.js +298 -0
  109. package/dist/procedural-items/recipe.d.ts +144 -0
  110. package/dist/procedural-items/recipe.d.ts.map +1 -0
  111. package/dist/procedural-items/recipe.js +372 -0
  112. package/dist/procedural-items/spatial.d.ts +19 -0
  113. package/dist/procedural-items/spatial.d.ts.map +1 -0
  114. package/dist/procedural-items/spatial.js +39 -0
  115. package/dist/registry/__bench__/relations-resolver.bench.js +2 -2
  116. package/dist/registry/handles.d.ts +36 -7
  117. package/dist/registry/handles.d.ts.map +1 -1
  118. package/dist/registry/index.d.ts +6 -7
  119. package/dist/registry/index.d.ts.map +1 -1
  120. package/dist/registry/index.js +4 -5
  121. package/dist/registry/registry.d.ts +13 -6
  122. package/dist/registry/registry.d.ts.map +1 -1
  123. package/dist/registry/registry.js +37 -4
  124. package/dist/registry/relations-resolver.d.ts +2 -2
  125. package/dist/registry/relations-resolver.js +1 -1
  126. package/dist/registry/scene-api.d.ts +18 -2
  127. package/dist/registry/scene-api.d.ts.map +1 -1
  128. package/dist/registry/scene-api.js +50 -2
  129. package/dist/registry/subtree.d.ts +1 -1
  130. package/dist/registry/subtree.js +2 -2
  131. package/dist/registry/types.d.ts +246 -21
  132. package/dist/registry/types.d.ts.map +1 -1
  133. package/dist/registry/use-registry-version.js +1 -1
  134. package/dist/registry/validate-relations.d.ts +4 -0
  135. package/dist/registry/validate-relations.d.ts.map +1 -0
  136. package/dist/registry/validate-relations.js +22 -0
  137. package/dist/schema/__bench__/node-parsers.bench.d.ts +24 -0
  138. package/dist/schema/__bench__/node-parsers.bench.d.ts.map +1 -0
  139. package/dist/schema/__bench__/node-parsers.bench.js +314 -0
  140. package/dist/schema/__fixtures__/node-fixtures.d.ts +28 -0
  141. package/dist/schema/__fixtures__/node-fixtures.d.ts.map +1 -0
  142. package/dist/schema/__fixtures__/node-fixtures.js +127 -0
  143. package/dist/schema/base.d.ts +1 -1
  144. package/dist/schema/base.d.ts.map +1 -1
  145. package/dist/schema/base.js +9 -2
  146. package/dist/schema/collections.d.ts +1 -1
  147. package/dist/schema/collections.js +1 -1
  148. package/dist/schema/compiled-node-parsers.d.ts +40 -0
  149. package/dist/schema/compiled-node-parsers.d.ts.map +1 -0
  150. package/dist/schema/compiled-node-parsers.js +95 -0
  151. package/dist/schema/index.d.ts +73 -66
  152. package/dist/schema/index.d.ts.map +1 -1
  153. package/dist/schema/index.js +65 -57
  154. package/dist/schema/material.d.ts +1 -0
  155. package/dist/schema/material.d.ts.map +1 -1
  156. package/dist/schema/material.js +2 -1
  157. package/dist/schema/nodes/automatic-downspout.d.ts +17 -0
  158. package/dist/schema/nodes/automatic-downspout.d.ts.map +1 -0
  159. package/dist/schema/nodes/automatic-downspout.js +237 -0
  160. package/dist/schema/nodes/block.d.ts +107 -0
  161. package/dist/schema/nodes/block.d.ts.map +1 -0
  162. package/dist/schema/nodes/block.js +206 -0
  163. package/dist/schema/nodes/box-vent.d.ts +8 -2
  164. package/dist/schema/nodes/box-vent.d.ts.map +1 -1
  165. package/dist/schema/nodes/box-vent.js +4 -2
  166. package/dist/schema/nodes/building.d.ts +2 -2
  167. package/dist/schema/nodes/building.d.ts.map +1 -1
  168. package/dist/schema/nodes/building.js +8 -5
  169. package/dist/schema/nodes/cabinet.d.ts +26 -4
  170. package/dist/schema/nodes/cabinet.d.ts.map +1 -1
  171. package/dist/schema/nodes/cabinet.js +29 -8
  172. package/dist/schema/nodes/ceiling.d.ts +2 -2
  173. package/dist/schema/nodes/ceiling.js +5 -5
  174. package/dist/schema/nodes/chimney.d.ts +2 -2
  175. package/dist/schema/nodes/chimney.js +2 -2
  176. package/dist/schema/nodes/column.d.ts +7 -6
  177. package/dist/schema/nodes/column.d.ts.map +1 -1
  178. package/dist/schema/nodes/column.js +3 -2
  179. package/dist/schema/nodes/construction-dimension.d.ts +1 -1
  180. package/dist/schema/nodes/construction-dimension.js +2 -2
  181. package/dist/schema/nodes/cupola.d.ts +9 -1
  182. package/dist/schema/nodes/cupola.d.ts.map +1 -1
  183. package/dist/schema/nodes/cupola.js +4 -2
  184. package/dist/schema/nodes/door.d.ts +1 -1
  185. package/dist/schema/nodes/door.js +2 -2
  186. package/dist/schema/nodes/dormer.d.ts +45 -2
  187. package/dist/schema/nodes/dormer.d.ts.map +1 -1
  188. package/dist/schema/nodes/dormer.js +133 -9
  189. package/dist/schema/nodes/downspout.d.ts +11 -1
  190. package/dist/schema/nodes/downspout.d.ts.map +1 -1
  191. package/dist/schema/nodes/downspout.js +26 -2
  192. package/dist/schema/nodes/duct-fitting.d.ts +18 -1
  193. package/dist/schema/nodes/duct-fitting.d.ts.map +1 -1
  194. package/dist/schema/nodes/duct-fitting.js +26 -5
  195. package/dist/schema/nodes/duct-segment.d.ts +23 -1
  196. package/dist/schema/nodes/duct-segment.d.ts.map +1 -1
  197. package/dist/schema/nodes/duct-segment.js +21 -1
  198. package/dist/schema/nodes/duct-terminal.d.ts +1 -1
  199. package/dist/schema/nodes/duct-terminal.js +1 -1
  200. package/dist/schema/nodes/elevator.d.ts +1 -1
  201. package/dist/schema/nodes/elevator.js +2 -2
  202. package/dist/schema/nodes/eyebrow-vent.d.ts +8 -2
  203. package/dist/schema/nodes/eyebrow-vent.d.ts.map +1 -1
  204. package/dist/schema/nodes/eyebrow-vent.js +4 -2
  205. package/dist/schema/nodes/fence.d.ts +1 -1
  206. package/dist/schema/nodes/fence.js +2 -2
  207. package/dist/schema/nodes/guide.d.ts +1 -1
  208. package/dist/schema/nodes/guide.js +2 -2
  209. package/dist/schema/nodes/gutter.d.ts +36 -2
  210. package/dist/schema/nodes/gutter.d.ts.map +1 -1
  211. package/dist/schema/nodes/gutter.js +310 -3
  212. package/dist/schema/nodes/hanger-overrides.d.ts +7 -0
  213. package/dist/schema/nodes/hanger-overrides.d.ts.map +1 -0
  214. package/dist/schema/nodes/hanger-overrides.js +6 -0
  215. package/dist/schema/nodes/hvac-equipment.d.ts +1 -1
  216. package/dist/schema/nodes/hvac-equipment.js +1 -1
  217. package/dist/schema/nodes/imported-mesh.d.ts +40 -0
  218. package/dist/schema/nodes/imported-mesh.d.ts.map +1 -0
  219. package/dist/schema/nodes/imported-mesh.js +27 -0
  220. package/dist/schema/nodes/item.d.ts +3 -2
  221. package/dist/schema/nodes/item.d.ts.map +1 -1
  222. package/dist/schema/nodes/item.js +8 -3
  223. package/dist/schema/nodes/lean-to-extension.d.ts +212 -0
  224. package/dist/schema/nodes/lean-to-extension.d.ts.map +1 -0
  225. package/dist/schema/nodes/lean-to-extension.js +114 -0
  226. package/dist/schema/nodes/level.d.ts +2 -2
  227. package/dist/schema/nodes/level.d.ts.map +1 -1
  228. package/dist/schema/nodes/level.js +1 -1
  229. package/dist/schema/nodes/lineset.d.ts +1 -1
  230. package/dist/schema/nodes/lineset.js +1 -1
  231. package/dist/schema/nodes/liquid-line.d.ts +1 -1
  232. package/dist/schema/nodes/liquid-line.js +1 -1
  233. package/dist/schema/nodes/measurement.d.ts +1 -1
  234. package/dist/schema/nodes/measurement.js +2 -2
  235. package/dist/schema/nodes/pipe-fitting.d.ts +10 -2
  236. package/dist/schema/nodes/pipe-fitting.d.ts.map +1 -1
  237. package/dist/schema/nodes/pipe-fitting.js +7 -3
  238. package/dist/schema/nodes/pipe-segment.d.ts +24 -2
  239. package/dist/schema/nodes/pipe-segment.d.ts.map +1 -1
  240. package/dist/schema/nodes/pipe-segment.js +21 -1
  241. package/dist/schema/nodes/pipe-trap.d.ts +2 -2
  242. package/dist/schema/nodes/pipe-trap.js +1 -1
  243. package/dist/schema/nodes/ridge-vent.d.ts +2 -2
  244. package/dist/schema/nodes/ridge-vent.d.ts.map +1 -1
  245. package/dist/schema/nodes/ridge-vent.js +7 -4
  246. package/dist/schema/nodes/roof-segment-shape.d.ts +5 -1
  247. package/dist/schema/nodes/roof-segment-shape.d.ts.map +1 -1
  248. package/dist/schema/nodes/roof-segment-shape.js +65 -2
  249. package/dist/schema/nodes/roof-segment-walls.d.ts +4 -2
  250. package/dist/schema/nodes/roof-segment-walls.d.ts.map +1 -1
  251. package/dist/schema/nodes/roof-segment-walls.js +2 -2
  252. package/dist/schema/nodes/roof-segment.d.ts +42 -2
  253. package/dist/schema/nodes/roof-segment.d.ts.map +1 -1
  254. package/dist/schema/nodes/roof-segment.js +81 -4
  255. package/dist/schema/nodes/roof.d.ts +23 -2
  256. package/dist/schema/nodes/roof.d.ts.map +1 -1
  257. package/dist/schema/nodes/roof.js +17 -3
  258. package/dist/schema/nodes/scan.d.ts +19 -2
  259. package/dist/schema/nodes/scan.d.ts.map +1 -1
  260. package/dist/schema/nodes/scan.js +13 -3
  261. package/dist/schema/nodes/shelf.d.ts +3 -3
  262. package/dist/schema/nodes/shelf.d.ts.map +1 -1
  263. package/dist/schema/nodes/shelf.js +3 -4
  264. package/dist/schema/nodes/site.d.ts +1 -1
  265. package/dist/schema/nodes/site.js +2 -2
  266. package/dist/schema/nodes/skylight.d.ts +5 -5
  267. package/dist/schema/nodes/skylight.js +2 -2
  268. package/dist/schema/nodes/slab.d.ts +1 -1
  269. package/dist/schema/nodes/slab.js +3 -3
  270. package/dist/schema/nodes/solar-panel.d.ts +1 -1
  271. package/dist/schema/nodes/solar-panel.js +3 -3
  272. package/dist/schema/nodes/spawn.d.ts +1 -1
  273. package/dist/schema/nodes/spawn.js +1 -1
  274. package/dist/schema/nodes/stair-segment.d.ts +1 -1
  275. package/dist/schema/nodes/stair-segment.js +2 -2
  276. package/dist/schema/nodes/stair.d.ts +2 -2
  277. package/dist/schema/nodes/stair.js +3 -3
  278. package/dist/schema/nodes/structural-grid.d.ts +1 -1
  279. package/dist/schema/nodes/structural-grid.js +1 -1
  280. package/dist/schema/nodes/turbine-vent.d.ts +8 -2
  281. package/dist/schema/nodes/turbine-vent.d.ts.map +1 -1
  282. package/dist/schema/nodes/turbine-vent.js +4 -2
  283. package/dist/schema/nodes/unit.d.ts +33 -0
  284. package/dist/schema/nodes/unit.d.ts.map +1 -0
  285. package/dist/schema/nodes/unit.js +13 -0
  286. package/dist/schema/nodes/wall.d.ts +5 -5
  287. package/dist/schema/nodes/wall.d.ts.map +1 -1
  288. package/dist/schema/nodes/wall.js +13 -6
  289. package/dist/schema/nodes/window.d.ts +10 -3
  290. package/dist/schema/nodes/window.d.ts.map +1 -1
  291. package/dist/schema/nodes/window.js +6 -2
  292. package/dist/schema/nodes/zone.d.ts +2 -2
  293. package/dist/schema/nodes/zone.js +2 -2
  294. package/dist/schema/scene-material.js +2 -2
  295. package/dist/schema/types.d.ts +815 -118
  296. package/dist/schema/types.d.ts.map +1 -1
  297. package/dist/schema/types.js +79 -46
  298. package/dist/services/alignment-anchors.d.ts +6 -11
  299. package/dist/services/alignment-anchors.d.ts.map +1 -1
  300. package/dist/services/alignment-anchors.js +7 -34
  301. package/dist/services/drag-session.d.ts +4 -4
  302. package/dist/services/drag-session.js +1 -1
  303. package/dist/services/hosting.d.ts +4 -10
  304. package/dist/services/hosting.d.ts.map +1 -1
  305. package/dist/services/hosting.js +6 -16
  306. package/dist/services/index.d.ts +16 -13
  307. package/dist/services/index.d.ts.map +1 -1
  308. package/dist/services/index.js +16 -13
  309. package/dist/services/level-height.d.ts +2 -2
  310. package/dist/services/level-height.js +3 -3
  311. package/dist/services/movement.d.ts +3 -3
  312. package/dist/services/movement.js +2 -2
  313. package/dist/services/port-connectivity.d.ts +1 -1
  314. package/dist/services/port-connectivity.js +1 -1
  315. package/dist/services/riser-diagram.d.ts +1 -1
  316. package/dist/services/shelf-board.d.ts +5 -0
  317. package/dist/services/shelf-board.d.ts.map +1 -0
  318. package/dist/services/shelf-board.js +15 -0
  319. package/dist/services/storey.d.ts +2 -2
  320. package/dist/services/storey.js +2 -2
  321. package/dist/services/surface-hosting-procedural-parity.fixtures.d.ts +13 -0
  322. package/dist/services/surface-hosting-procedural-parity.fixtures.d.ts.map +1 -0
  323. package/dist/services/surface-hosting-procedural-parity.fixtures.js +4691 -0
  324. package/dist/services/surface-hosting-shelf-parity.fixtures.d.ts +1060 -0
  325. package/dist/services/surface-hosting-shelf-parity.fixtures.d.ts.map +1 -0
  326. package/dist/services/surface-hosting-shelf-parity.fixtures.js +3127 -0
  327. package/dist/services/surface-hosting.d.ts +88 -0
  328. package/dist/services/surface-hosting.d.ts.map +1 -0
  329. package/dist/services/surface-hosting.js +268 -0
  330. package/dist/services/surface-region.d.ts +8 -0
  331. package/dist/services/surface-region.d.ts.map +1 -0
  332. package/dist/services/surface-region.js +44 -0
  333. package/dist/services/system-graph.d.ts +12 -1
  334. package/dist/services/system-graph.d.ts.map +1 -1
  335. package/dist/services/system-graph.js +36 -6
  336. package/dist/services/validate-dwv.d.ts +1 -1
  337. package/dist/services/validate-dwv.js +1 -1
  338. package/dist/store/actions/node-actions.d.ts +9 -2
  339. package/dist/store/actions/node-actions.d.ts.map +1 -1
  340. package/dist/store/actions/node-actions.js +475 -24
  341. package/dist/store/history-control.d.ts +3 -3
  342. package/dist/store/history-invalidation.d.ts +3 -0
  343. package/dist/store/history-invalidation.d.ts.map +1 -0
  344. package/dist/store/history-invalidation.js +72 -0
  345. package/dist/store/scene-hydration.d.ts +5 -0
  346. package/dist/store/scene-hydration.d.ts.map +1 -0
  347. package/dist/store/scene-hydration.js +57 -0
  348. package/dist/store/use-interactive.d.ts +2 -2
  349. package/dist/store/use-live-terrain.d.ts +1 -1
  350. package/dist/store/use-scene.d.ts +7 -4
  351. package/dist/store/use-scene.d.ts.map +1 -1
  352. package/dist/store/use-scene.js +361 -87
  353. package/dist/systems/elevator/elevator-dispatch.d.ts +2 -2
  354. package/dist/systems/elevator/elevator-dispatch.js +1 -1
  355. package/dist/systems/elevator/elevator-geometry.d.ts +1 -1
  356. package/dist/systems/elevator/elevator-opening-sync.d.ts +1 -1
  357. package/dist/systems/elevator/elevator-opening-sync.js +2 -2
  358. package/dist/systems/elevator/elevator-opening-system.js +3 -3
  359. package/dist/systems/elevator/elevator-runtime.d.ts +3 -3
  360. package/dist/systems/elevator/elevator-runtime.js +3 -3
  361. package/dist/systems/elevator/elevator-service.d.ts +1 -1
  362. package/dist/systems/elevator/elevator-service.js +1 -1
  363. package/dist/systems/fence/fence-centerline.d.ts +2 -2
  364. package/dist/systems/fence/fence-centerline.js +2 -2
  365. package/dist/systems/fence/fence-spline.d.ts +2 -2
  366. package/dist/systems/roof/roof-elevation-system.d.ts +3 -0
  367. package/dist/systems/roof/roof-elevation-system.d.ts.map +1 -0
  368. package/dist/systems/roof/roof-elevation-system.js +94 -0
  369. package/dist/systems/roof/roof-elevation.d.ts +4 -0
  370. package/dist/systems/roof/roof-elevation.d.ts.map +1 -0
  371. package/dist/systems/roof/roof-elevation.js +95 -0
  372. package/dist/systems/roof/roof-footprint.d.ts +17 -0
  373. package/dist/systems/roof/roof-footprint.d.ts.map +1 -0
  374. package/dist/systems/roof/roof-footprint.js +83 -0
  375. package/dist/systems/slab/slab-placement.d.ts +1 -1
  376. package/dist/systems/slab/slab-support.d.ts +1 -1
  377. package/dist/systems/slab/slab-support.js +4 -4
  378. package/dist/systems/stair/stair-flight.d.ts +17 -0
  379. package/dist/systems/stair/stair-flight.d.ts.map +1 -0
  380. package/dist/systems/stair/stair-flight.js +27 -0
  381. package/dist/systems/stair/stair-footprint.d.ts +1 -1
  382. package/dist/systems/stair/stair-opening-preview.d.ts +1621 -1267
  383. package/dist/systems/stair/stair-opening-preview.d.ts.map +1 -1
  384. package/dist/systems/stair/stair-opening-preview.js +2 -2
  385. package/dist/systems/stair/stair-opening-sync.d.ts +1 -1
  386. package/dist/systems/stair/stair-opening-sync.js +6 -6
  387. package/dist/systems/stair/stair-opening-system.d.ts +1 -0
  388. package/dist/systems/stair/stair-opening-system.d.ts.map +1 -1
  389. package/dist/systems/stair/stair-opening-system.js +100 -103
  390. package/dist/systems/stair/stair-rise.d.ts +1 -1
  391. package/dist/systems/stair/stair-rise.d.ts.map +1 -1
  392. package/dist/systems/stair/stair-rise.js +23 -24
  393. package/dist/systems/wall/wall-curve.d.ts +3 -2
  394. package/dist/systems/wall/wall-curve.d.ts.map +1 -1
  395. package/dist/systems/wall/wall-curve.js +73 -0
  396. package/dist/systems/wall/wall-footprint.d.ts +3 -2
  397. package/dist/systems/wall/wall-footprint.d.ts.map +1 -1
  398. package/dist/systems/wall/wall-footprint.js +3 -2
  399. package/dist/systems/wall/wall-mitering.d.ts +1 -1
  400. package/dist/systems/wall/wall-mitering.js +1 -1
  401. package/dist/systems/wall/wall-move.d.ts +1 -1
  402. package/dist/systems/wall/wall-top.d.ts +1 -1
  403. package/dist/systems/wall/wall-topology.d.ts +2 -2
  404. package/dist/systems/wall/wall-topology.js +4 -4
  405. package/dist/utils/clone-scene-graph.d.ts +3 -3
  406. package/dist/utils/clone-scene-graph.d.ts.map +1 -1
  407. package/dist/utils/clone-scene-graph.js +35 -3
  408. package/dist/utils/scene-migrations.d.ts +3 -3
  409. package/dist/utils/scene-migrations.js +3 -3
  410. package/dist/utils/vertical-scene-migration.js +5 -5
  411. package/dist/validation/validate-build-json.d.ts +7 -1
  412. package/dist/validation/validate-build-json.d.ts.map +1 -1
  413. package/dist/validation/validate-build-json.js +92 -4
  414. package/package.json +23 -5
  415. package/dist/systems/elevator/elevator-runtime-system.d.ts +0 -2
  416. package/dist/systems/elevator/elevator-runtime-system.d.ts.map +0 -1
  417. package/dist/systems/elevator/elevator-runtime-system.js +0 -8
@@ -1,12 +1,14 @@
1
1
  import type { ComponentType } from 'react';
2
2
  import type { AnimationClip, BufferGeometry, Object3D, Ray } from 'three';
3
3
  import type { ZodObject, z } from 'zod';
4
- import type { MaterialSchema, MaterialTarget } from '../schema/material';
5
- import type { MeasurementFeatureReference, MeasurementPoint } from '../schema/nodes/measurement';
6
- import type { SceneMaterial, SceneMaterialId } from '../schema/scene-material';
7
- import type { AnyNode, AnyNodeId } from '../schema/types';
8
- import type { HandleList } from './handles';
9
- import type { CloneNodesIntoOptions, Subtree } from './subtree';
4
+ import type { MaterialSchema, MaterialTarget } from '../schema/material.js';
5
+ import type { AssetInput, ItemNode } from '../schema/nodes/item.js';
6
+ import type { MeasurementFeatureReference, MeasurementPoint } from '../schema/nodes/measurement.js';
7
+ import type { SceneMaterial, SceneMaterialId } from '../schema/scene-material.js';
8
+ import type { AnyNode, AnyNodeId } from '../schema/types.js';
9
+ import type { SurfaceProvider } from '../services/surface-hosting.js';
10
+ import type { HandleList } from './handles.js';
11
+ import type { CloneNodesIntoOptions, Subtree } from './subtree.js';
10
12
  export type GeometryContext = {
11
13
  /** Look up any node by ID. Returns undefined if the node doesn't exist. */
12
14
  resolve: <N = AnyNode>(id: AnyNodeId) => N | undefined;
@@ -60,6 +62,9 @@ export type GeometryContext = {
60
62
  materials?: Record<SceneMaterialId, SceneMaterial>;
61
63
  /** Opaque host/plugin context. Core never interprets extension values. */
62
64
  extensions?: Readonly<Record<string, unknown>>;
65
+ /** Read-only scene snapshot for pure floor-plan builders that need to
66
+ * inspect cross-kind spatial relationships such as connected ports. */
67
+ sceneNodes?: Readonly<Record<AnyNodeId, AnyNode>>;
63
68
  /**
64
69
  * Optional view state — only populated for `def.floorplan` builders. The
65
70
  * 2D floor-plan layer surfaces selection / hover here so kinds can vary
@@ -83,6 +88,10 @@ export type GeometryContext = {
83
88
  * wall ends only during the move.
84
89
  */
85
90
  moving: boolean;
91
+ /** The unit under focus in the editor and its member zone ids, so zone
92
+ * builders can dim non-members. Absent when no unit is focused. */
93
+ focusedUnitId?: string;
94
+ focusedUnitMemberIds?: readonly string[];
86
95
  /**
87
96
  * The kind's theme palette. Theme-aware colors (selection stroke,
88
97
  * endpoint handle fill, hatch color) live here so kinds don't need
@@ -191,6 +200,8 @@ export type DimensionTextPosition = 'above' | 'centered';
191
200
  export type FloorplanStyle = {
192
201
  stroke?: string;
193
202
  fill?: string;
203
+ /** Winding rule for compound paths. `evenodd` keeps nested contour rings hollow. */
204
+ fillRule?: 'nonzero' | 'evenodd';
194
205
  strokeWidth?: number;
195
206
  strokeDasharray?: string;
196
207
  opacity?: number;
@@ -264,6 +275,8 @@ export type ToolHint = {
264
275
  * so the HUD reflects reality. Omit for always-shown hints.
265
276
  */
266
277
  minDraftVertices?: number;
278
+ /** Optional live predicate for hints that only apply in one tool sub-mode. */
279
+ visible?: ToolHintVisibility;
267
280
  /**
268
281
  * Render this hint as a live mode chip — like the snapping / continuation
269
282
  * chips — instead of a static key row: the HUD shows the current value's
@@ -273,6 +286,12 @@ export type ToolHint = {
273
286
  */
274
287
  chip?: ToolHintChip;
275
288
  };
289
+ export type ToolHintVisibility = {
290
+ /** Subscribe to changes that may alter `value`. */
291
+ subscribe: (onChange: () => void) => () => void;
292
+ /** Whether the helper should render this hint now. */
293
+ value: () => boolean;
294
+ };
276
295
  export type ToolHintChip = {
277
296
  /** Subscribe to live value changes (Zustand-store-like); returns unsubscribe. */
278
297
  subscribe: (onChange: () => void) => () => void;
@@ -288,6 +307,30 @@ export type ToolHintChip = {
288
307
  /** Hover tooltip, e.g. 'Placement type — click or press I to cycle'. */
289
308
  tooltip?: string;
290
309
  };
310
+ export type FloorplanScope = 'level' | 'building' | 'site';
311
+ export type ToolOptionChoice = {
312
+ /** Value token, e.g. 'draw'. */
313
+ value: string;
314
+ /** Button label. Sentence case. */
315
+ label: string;
316
+ /** Helper line shown under the row while this choice is active. */
317
+ description?: string;
318
+ };
319
+ export type ToolOption = {
320
+ /** Stable row id within the kind, e.g. 'footprintSource'. */
321
+ id: string;
322
+ /** Row label. Sentence case, e.g. 'Create from'. */
323
+ label: string;
324
+ choices: readonly ToolOptionChoice[];
325
+ /** Subscribe to live value changes (Zustand-store-like); returns unsubscribe. */
326
+ subscribe: (onChange: () => void) => () => void;
327
+ /** Current value token. */
328
+ value: () => string;
329
+ /** Select a choice. Pure state write — arming the tool is the host's job. */
330
+ set: (value: string) => void;
331
+ /** Optional live predicate — e.g. the roof's 'Create from' hides for conical. */
332
+ visible?: ToolHintVisibility;
333
+ };
291
334
  export type FloorplanGeometry = ({
292
335
  kind: 'path';
293
336
  d: string;
@@ -460,6 +503,7 @@ export type FloorplanGeometry = ({
460
503
  | {
461
504
  kind: 'midpoint-handle';
462
505
  point: FloorplanPoint;
506
+ activation?: 'drag' | 'action';
463
507
  affordance: string;
464
508
  payload: unknown;
465
509
  }
@@ -707,6 +751,8 @@ export type FloorplanAffordance<N> = {
707
751
  initialPlanPoint: FloorplanAffordancePoint;
708
752
  /** Active editor grid step in meters. */
709
753
  gridSnapStep: number;
754
+ /** Injected mutation/read seam for kind-owned affordances. */
755
+ sceneApi?: SceneApi;
710
756
  }): FloorplanAffordanceSession;
711
757
  };
712
758
  export type FloorplanMoveTargetSession = {
@@ -757,6 +803,7 @@ export type FloorplanMoveTargetSession = {
757
803
  export type FloorplanMoveTarget<N> = (args: {
758
804
  node: N;
759
805
  nodes: Record<AnyNodeId, AnyNode>;
806
+ sceneApi?: SceneApi;
760
807
  }) => FloorplanMoveTargetSession;
761
808
  /**
762
809
  * A plugin-contributed section for the floating node inspector card.
@@ -855,6 +902,13 @@ export type NodeDefinition<S extends ZodObject<any>> = {
855
902
  * Kinds outside any distribution system leave this unset.
856
903
  */
857
904
  distributionRole?: DistributionRole;
905
+ /** Optional behavior while the kind's click-to-click construction tool is active. */
906
+ drafting?: {
907
+ /** Raycast architectural hosts and emit their semantic surface data with grid events. */
908
+ surfaceQuery?: boolean;
909
+ /** Cancel the in-flight draft before applying an undo or redo history jump. */
910
+ cancelOnHistoryJump?: boolean;
911
+ };
858
912
  /**
859
913
  * When `distributionRole` is `'fitting'`, controls whether this fitting
860
914
  * is dragged as a rigid follower when a connected run endpoint moves.
@@ -886,6 +940,27 @@ export type NodeDefinition<S extends ZodObject<any>> = {
886
940
  dirtyTracking?: boolean;
887
941
  /** GLB bake treatment for this kind (default `'static'`). See {@link BakePolicy}. */
888
942
  bake?: BakePolicy;
943
+ /**
944
+ * Optional export-only geometry builder. The GLB exporter calls this against
945
+ * persisted scene data and replaces the registered node's cloned subtree
946
+ * with the returned local-space Object3D. The live editor object is never
947
+ * passed to the hook or mutated.
948
+ *
949
+ * Use this when the live geometry is unsuitable for a portable GLB (for
950
+ * example, a procedural NodeMaterial that masks a maximum candidate
951
+ * population on the GPU). The returned tree must be a complete static
952
+ * snapshot for this node and use exporter-supported Three.js materials.
953
+ */
954
+ bakeGeometry?: BakeGeometryBuilder<z.infer<S>>;
955
+ /**
956
+ * Optional asynchronous export-only geometry builder for textured static artifacts.
957
+ * Export preparation awaits this exactly once in place of {@link bakeGeometry}.
958
+ * Synchronous geometry-only callers continue to use `bakeGeometry`.
959
+ *
960
+ * The returned tree follows the same ownership contract: it is detached,
961
+ * local-space, complete for the node, and owned by the export artifact.
962
+ */
963
+ bakeGeometryAsync?: BakeGeometryAsyncBuilder<z.infer<S>>;
889
964
  /**
890
965
  * Renderer for this kind. Optional under the three-checkbox composition
891
966
  * model (see `wiki/architecture/node-definitions.md`): when omitted, the
@@ -944,6 +1019,8 @@ export type NodeDefinition<S extends ZodObject<any>> = {
944
1019
  * inputs aren't captured by the node alone.
945
1020
  */
946
1021
  geometryKey?: (node: z.infer<S>) => string;
1022
+ /** Child kinds whose live overrides affect this node’s generated geometry. */
1023
+ geometryChildTypes?: readonly string[];
947
1024
  /**
948
1025
  * Level-batch precompute hook. Called by `<GeometrySystem>` once per
949
1026
  * level per frame, **before** the per-node `def.geometry` calls in
@@ -979,8 +1056,9 @@ export type NodeDefinition<S extends ZodObject<any>> = {
979
1056
  /**
980
1057
  * Pure 2D builder for floor-plan rendering. Mirrors `geometry` but emits
981
1058
  * plain `FloorplanGeometry` data (SVG-renderable) rather than three.js
982
- * Object3D. Coordinates are level-local meters — the floor-plan panel
983
- * applies the world→SVG transform.
1059
+ * Object3D. Level- and building-scoped builders emit building-local metres.
1060
+ * Site-scoped builders emit site-local metres; the floor-plan layer projects
1061
+ * their output into the active building's plan coordinates.
984
1062
  *
985
1063
  * Returns `null` when the kind shouldn't appear in floor plan (e.g. an
986
1064
  * invisible utility node, or a kind that's 3D-only). Kinds that need
@@ -991,8 +1069,10 @@ export type NodeDefinition<S extends ZodObject<any>> = {
991
1069
  * the legacy `floorplan-panel.tsx` monolith.
992
1070
  */
993
1071
  floorplan?: (node: z.infer<S>, ctx: GeometryContext) => FloorplanGeometry | null;
994
- /** Extra node IDs whose committed changes invalidate this node's floor-plan cache. */
995
- floorplanDependencies?: (node: z.infer<S>) => readonly AnyNodeId[];
1072
+ /** Extra node IDs whose committed changes invalidate this node's floor-plan cache.
1073
+ * `nodes` is the committed scene, for dependencies the node doesn't name itself
1074
+ * (a zone's owning unit lists the zone, not the other way round). */
1075
+ floorplanDependencies?: (node: z.infer<S>, nodes: Readonly<Record<AnyNodeId, AnyNode>>) => readonly AnyNodeId[];
996
1076
  /** Stable semantic geometry that associative measurement anchors may reference. */
997
1077
  measurement?: MeasurementContribution<z.infer<S>>;
998
1078
  /**
@@ -1005,8 +1085,11 @@ export type NodeDefinition<S extends ZodObject<any>> = {
1005
1085
  * building). For `'building'`-scoped kinds the layer iterates every
1006
1086
  * instance whose parent matches the active level's building, and
1007
1087
  * synthesises a `GeometryContext` whose `parent` is the active level.
1088
+ * `'site'` discovers direct children of the active building's Site,
1089
+ * supplies the real Site as `ctx.parent`, and projects site-local output
1090
+ * into the active building's plan coordinates below level architecture.
1008
1091
  */
1009
- floorplanScope?: 'level' | 'building';
1092
+ floorplanScope?: FloorplanScope;
1010
1093
  /**
1011
1094
  * 2D drag affordances keyed by the string identifier emitted on
1012
1095
  * `endpoint-handle` (and similar interactive floor-plan primitives) via
@@ -1170,6 +1253,12 @@ export type NodeDefinition<S extends ZodObject<any>> = {
1170
1253
  * its bespoke helper component instead.
1171
1254
  */
1172
1255
  toolHints?: ToolHint[];
1256
+ /**
1257
+ * Pick-one option rows for this kind's build tool, rendered by the shared
1258
+ * `<ToolOptionsPanel>` in whichever sidebar the host mounts it (see
1259
+ * `ToolOption`). E.g. the roof's 'Create from: Draw / Room'.
1260
+ */
1261
+ toolOptions?: readonly ToolOption[];
1173
1262
  /**
1174
1263
  * Which snapping profile this kind uses, so the editor's contextual snapping
1175
1264
  * HUD + snap math + force-place affordance are node-declared rather than
@@ -1285,6 +1374,8 @@ export type Presentation = {
1285
1374
  icon: IconRef;
1286
1375
  /** Tool palette section. Defaults to `category` when omitted. */
1287
1376
  paletteSection?: 'site' | 'structure' | 'furnish';
1377
+ /** Optional presentation-only subgroup used by palette surfaces. */
1378
+ paletteGroup?: string;
1288
1379
  /** Sort key within a palette section; lower numbers come first. */
1289
1380
  paletteOrder?: number;
1290
1381
  /** Set true for kinds that exist but should NOT appear in the palette
@@ -1293,6 +1384,9 @@ export type Presentation = {
1293
1384
  /** Set false when selection is edited directly through in-scene affordances
1294
1385
  * and the generic floating action menu would duplicate or conflict with them. */
1295
1386
  actionMenu?: boolean;
1387
+ /** Set false to drop the "Find in catalog" action for this kind — for nodes
1388
+ * that are placed through a plugin panel rather than a browsable catalog. */
1389
+ findInCatalog?: boolean;
1296
1390
  };
1297
1391
  export type IconRef =
1298
1392
  /** Iconify identifier, e.g. `lucide:square`. Matches the @iconify-react
@@ -1352,6 +1446,8 @@ export type BakeReplaceRenderer<N> = {
1352
1446
  }>;
1353
1447
  }>;
1354
1448
  };
1449
+ export type BakeGeometryBuilder<N> = (node: N, ctx: GeometryContext) => Object3D;
1450
+ export type BakeGeometryAsyncBuilder<N> = (node: N, ctx: GeometryContext) => Promise<Object3D>;
1355
1451
  export type AssetRef = {
1356
1452
  id: string;
1357
1453
  src: string;
@@ -1392,10 +1488,18 @@ export type Capabilities = {
1392
1488
  cuttable?: CuttableConfig;
1393
1489
  snappable?: SnappableConfig;
1394
1490
  surfaces?: SurfacesConfig;
1491
+ faceHost?: FaceHostCapability<any>;
1395
1492
  duplicable?: boolean | DuplicableConfig;
1396
1493
  deletable?: boolean;
1397
1494
  groupable?: boolean;
1398
1495
  selectable?: SelectableConfig;
1496
+ /**
1497
+ * Whether selecting this kind should replace its rendered mesh materials
1498
+ * with the editor's selection tint. Defaults to `true`. Set to `false` for
1499
+ * hidden interaction nodes whose rendered geometry must retain its authored
1500
+ * materials while the node remains selected (for example, paint layers).
1501
+ */
1502
+ selectionHighlight?: boolean;
1399
1503
  interactive?: boolean;
1400
1504
  floorPlaced?: FloorPlacedConfig;
1401
1505
  /**
@@ -1771,6 +1875,8 @@ export type CapabilityCtx = {
1771
1875
  export type MovableConfig = {
1772
1876
  axes: ReadonlyArray<'x' | 'y' | 'z'>;
1773
1877
  gridSnap?: boolean;
1878
+ /** Allow an ordinary primary-button body drag to enter the move tool. */
1879
+ directDrag?: boolean;
1774
1880
  /**
1775
1881
  * Pin the dragged node to the cursor (absolute placement) instead of the
1776
1882
  * default offset-preserving drag, where the node moves by the cursor's
@@ -1806,11 +1912,34 @@ export type MovableConfig = {
1806
1912
  parentFrame?: MovableParentFrame;
1807
1913
  /**
1808
1914
  * Optional group-move snap for the generic multi-selection translate gizmo.
1809
- * Returns an adjusted candidate position for this node when the moving group
1810
- * should magnetically settle onto a nearby feature (for example, a cabinet
1811
- * run snapping flush to a wall while the whole selected kitchen moves as one).
1915
+ * Returns an adjusted candidate position for this node when the moving
1916
+ * group should magnetically settle onto a nearby feature.
1812
1917
  */
1813
1918
  groupMoveSnap?: (args: GroupMoveSnapArgs) => [number, number, number] | null;
1919
+ /**
1920
+ * Optional rotation-aware group-move snap. This is additive to the original
1921
+ * `groupMoveSnap` contract so existing v1 plugins remain valid.
1922
+ */
1923
+ groupMoveSnapPose?: (args: GroupMoveSnapArgs) => GroupMoveSnapResult | null;
1924
+ /**
1925
+ * Optional kind-owned validity check for the final planar drag pose. This
1926
+ * complements `floorPlaced` collision checks for constraints that depend
1927
+ * on other scene geometry, such as a cabinet crossing a wall opening.
1928
+ */
1929
+ isValidPosition?: (args: {
1930
+ node: AnyNode;
1931
+ position: readonly [number, number, number];
1932
+ rotation: number;
1933
+ levelId: AnyNodeId | null;
1934
+ nodes: Readonly<Record<string, AnyNode>>;
1935
+ }) => boolean;
1936
+ /**
1937
+ * Kind-owned grid resolver for a planar move. Unlike scalar grid snapping,
1938
+ * this receives the complete candidate pose so a kind can snap a visible
1939
+ * footprint edge (including a local bounds offset and rotation) rather than
1940
+ * blindly rounding its stored origin.
1941
+ */
1942
+ gridSnapPosition?: (args: GridSnapPositionArgs) => [number, number, number];
1814
1943
  override?: (ctx: CapabilityCtx) => MovableConfig | null;
1815
1944
  };
1816
1945
  export type MovableParentFrame = {
@@ -1837,6 +1966,24 @@ export type MovableParentFrame = {
1837
1966
  magneticSnap?: (node: AnyNode, parent: AnyNode, local: readonly [number, number, number], nodes: Readonly<Record<string, AnyNode>>) => [number, number, number];
1838
1967
  /** Optional snap-line matches for the parent-frame magnetic snap result. */
1839
1968
  magneticSnapMatches?: (node: AnyNode, parent: AnyNode, local: readonly [number, number, number], snappedLocal: readonly [number, number, number], nodes: Readonly<Record<string, AnyNode>>) => ParentFrameSnapMatch[];
1969
+ /** Optional kind-owned live patches for derived nodes that follow the move. */
1970
+ previewOverrides?: (args: {
1971
+ node: AnyNode;
1972
+ parent: AnyNode;
1973
+ position: readonly [number, number, number];
1974
+ sceneApi: SceneApi;
1975
+ }) => ReadonlyArray<readonly [AnyNodeId, Partial<AnyNode>]>;
1976
+ /**
1977
+ * Optional live collision check for a child moving in the parent frame.
1978
+ * The generic move tool uses this to colour the drag bounds and reject an
1979
+ * invalid drop; the kind owns the actual domain rule.
1980
+ */
1981
+ isValidPosition?: (args: {
1982
+ node: AnyNode;
1983
+ parent: AnyNode;
1984
+ position: readonly [number, number, number];
1985
+ nodes: Readonly<Record<string, AnyNode>>;
1986
+ }) => boolean;
1840
1987
  /**
1841
1988
  * Called after a move of the child commits, with the LIVE (post-commit)
1842
1989
  * child and parent. Lets the kind run derived-state maintenance the
@@ -1860,10 +2007,19 @@ export type ParentFrameSnapMatch = {
1860
2007
  export type GroupMoveSnapArgs = {
1861
2008
  node: AnyNode;
1862
2009
  candidatePosition: [number, number, number];
2010
+ candidateRotation?: number;
1863
2011
  movingIds: readonly AnyNodeId[];
1864
2012
  nodes: Readonly<Record<string, AnyNode>>;
1865
2013
  levelId: AnyNodeId | null;
1866
2014
  };
2015
+ export type GroupMoveSnapResult = {
2016
+ position: [number, number, number];
2017
+ rotation?: number;
2018
+ };
2019
+ export type GridSnapPositionArgs = Omit<GroupMoveSnapArgs, 'candidateRotation'> & {
2020
+ candidateRotation: number;
2021
+ gridStep: number;
2022
+ };
1867
2023
  export type LiveTransformLike = {
1868
2024
  position: [number, number, number];
1869
2025
  rotation: number;
@@ -1896,8 +2052,11 @@ export type SnappableConfig = {
1896
2052
  };
1897
2053
  export type SnapPointKind = 'start' | 'end' | 'midpoint' | 'center' | 'corners';
1898
2054
  export type SurfacesConfig = {
2055
+ hosting?: SurfaceProvider;
1899
2056
  top?: {
1900
- height: number | ((n: AnyNode) => number);
2057
+ height: number | ((n: AnyNode, context: {
2058
+ nodes: Record<string, AnyNode>;
2059
+ }) => number);
1901
2060
  };
1902
2061
  sides?: {
1903
2062
  faces: 'all' | ReadonlyArray<readonly [number, number, number]>;
@@ -1909,6 +2068,43 @@ export type SurfacePoint = {
1909
2068
  position: readonly [number, number, number];
1910
2069
  normal: readonly [number, number, number];
1911
2070
  };
2071
+ export type FaceHostPlacementArgs<N extends AnyNode = AnyNode> = {
2072
+ host: N;
2073
+ asset: AssetInput;
2074
+ draftItem: ItemNode | null;
2075
+ localPosition: readonly [number, number, number];
2076
+ faceIndex?: number;
2077
+ object: Object3D;
2078
+ currentFaceId?: string | null;
2079
+ rawDimensions: readonly [number, number, number];
2080
+ dimensions: readonly [number, number, number];
2081
+ snapScalar: (value: number) => number;
2082
+ };
2083
+ export type FaceHostStoredPlacementArgs<N extends AnyNode = AnyNode> = {
2084
+ host: N;
2085
+ item: ItemNode;
2086
+ position: readonly [number, number, number];
2087
+ };
2088
+ export type FaceHostStoredValidityArgs<N extends AnyNode = AnyNode> = {
2089
+ host: N;
2090
+ item: ItemNode;
2091
+ asset: AssetInput;
2092
+ };
2093
+ export type FaceHostPlacementResult = {
2094
+ faceId: string;
2095
+ nodeUpdate: Partial<ItemNode>;
2096
+ position: [number, number, number];
2097
+ rotation: [number, number, number];
2098
+ cursorPosition: [number, number, number];
2099
+ cursorRotation: [number, number, number];
2100
+ };
2101
+ export type FaceHostCapability<N extends AnyNode = AnyNode> = {
2102
+ currentFaceId: (item: ItemNode | null) => string | null;
2103
+ clearItemFields: readonly (keyof ItemNode)[];
2104
+ resolvePlacement: (args: FaceHostPlacementArgs<N>) => FaceHostPlacementResult | null;
2105
+ storedPlacementPatch: (args: FaceHostStoredPlacementArgs<N>) => Partial<ItemNode> | null;
2106
+ isStoredPlacementValid: (args: FaceHostStoredValidityArgs<N>) => boolean;
2107
+ };
1912
2108
  export type SelectableConfig = {
1913
2109
  hitVolume?: 'bbox' | 'mesh' | 'none';
1914
2110
  override?: (ctx: CapabilityCtx) => SelectableConfig | null;
@@ -1998,7 +2194,7 @@ export type ParametricDescriptor<N> = {
1998
2194
  * Direct store/MCP writes bypass it — keep real invariants in
1999
2195
  * `invariants`.
2000
2196
  */
2001
- derive?: (next: N, patch: Partial<N>) => Partial<N>;
2197
+ derive?: (next: N, patch: Partial<N>, previous?: N) => Partial<N>;
2002
2198
  /**
2003
2199
  * Cross-node companion to `derive`: after an inspector edit lands on
2004
2200
  * this node, return patches for OTHER nodes that must follow to keep
@@ -2018,13 +2214,15 @@ export type ParametricDescriptor<N> = {
2018
2214
  * auto-inserted elbow re-extends the duct runs it trimmed back onto the
2019
2215
  * corner it replaced. Called with the node and the live scene `nodes`
2020
2216
  * map BEFORE the deletion lands; patches targeting nodes also being
2021
- * deleted are ignored. Applied in the same `set` as the delete so it's
2022
- * one undo step. Fires only on `deleteNodes` (user-intent deletes) —
2217
+ * deleted are ignored. `pendingDeleteIds` includes cascaded companion
2218
+ * deletes, while `requestedDeleteIds` is the user's original selection.
2219
+ * Applied in the same `set` as the delete so it's one undo step. Fires
2220
+ * only on `deleteNodes` (user-intent deletes) —
2023
2221
  * NOT on `applyNodeChanges`, whose deletes are internal re-routes that
2024
2222
  * rewrite neighbours explicitly in the same batch and would fight a
2025
2223
  * restore.
2026
2224
  */
2027
- onDelete?: (node: N, nodes: Record<AnyNodeId, AnyNode>) => Array<{
2225
+ onDelete?: (node: N, nodes: Record<AnyNodeId, AnyNode>, pendingDeleteIds: ReadonlySet<AnyNodeId>, requestedDeleteIds: ReadonlySet<AnyNodeId>) => Array<{
2028
2226
  id: AnyNodeId;
2029
2227
  data: Partial<AnyNode>;
2030
2228
  }>;
@@ -2035,9 +2233,10 @@ export type ParametricDescriptor<N> = {
2035
2233
  * deletion; returned ids are recursively expanded through the normal
2036
2234
  * descendant cascade. `pendingDeleteIds` holds every id already part of
2037
2235
  * the gesture so "would my parent become empty?" checks see sibling
2038
- * deletes from the same multi-select.
2236
+ * deletes from the same multi-select. `requestedDeleteIds` remains the
2237
+ * original selection while the pending set expands.
2039
2238
  */
2040
- onDeleteCascade?: (node: N, nodes: Record<AnyNodeId, AnyNode>, pendingDeleteIds: ReadonlySet<AnyNodeId>) => AnyNodeId[];
2239
+ onDeleteCascade?: (node: N, nodes: Record<AnyNodeId, AnyNode>, pendingDeleteIds: ReadonlySet<AnyNodeId>, requestedDeleteIds: ReadonlySet<AnyNodeId>) => AnyNodeId[];
2041
2240
  customPanel?: () => Promise<{
2042
2241
  default: ComponentType<{
2043
2242
  node: N;
@@ -2075,9 +2274,12 @@ export type ParamAction<N> = {
2075
2274
  export type ParamGroup<N> = {
2076
2275
  label: string;
2077
2276
  fields: ParamField<N>[];
2277
+ /** Whether this inspector group is open when it is first rendered. */
2278
+ defaultExpanded?: boolean;
2078
2279
  };
2079
2280
  export type ParamField<N> = {
2080
2281
  key: keyof N;
2282
+ label?: string;
2081
2283
  kind: 'number';
2082
2284
  unit?: string;
2083
2285
  min?: number;
@@ -2087,10 +2289,12 @@ export type ParamField<N> = {
2087
2289
  customEditor?: ComponentType;
2088
2290
  } | {
2089
2291
  key: keyof N;
2292
+ label?: string;
2090
2293
  kind: 'boolean';
2091
2294
  visibleIf?: (n: N) => boolean;
2092
2295
  } | {
2093
2296
  key: keyof N;
2297
+ label?: string;
2094
2298
  kind: 'enum';
2095
2299
  options: readonly string[];
2096
2300
  /** Defaults to 'select' (dropdown). 'segmented' renders the inline
@@ -2099,18 +2303,22 @@ export type ParamField<N> = {
2099
2303
  visibleIf?: (n: N) => boolean;
2100
2304
  } | {
2101
2305
  key: keyof N;
2306
+ label?: string;
2102
2307
  kind: 'vec3';
2103
2308
  visibleIf?: (n: N) => boolean;
2104
2309
  } | {
2105
2310
  key: keyof N;
2311
+ label?: string;
2106
2312
  kind: 'color';
2107
2313
  visibleIf?: (n: N) => boolean;
2108
2314
  } | {
2109
2315
  key: keyof N;
2316
+ label?: string;
2110
2317
  kind: 'material';
2111
2318
  visibleIf?: (n: N) => boolean;
2112
2319
  } | {
2113
2320
  key: keyof N;
2321
+ label?: string;
2114
2322
  kind: 'ref';
2115
2323
  refKind: string;
2116
2324
  visibleIf?: (n: N) => boolean;
@@ -2122,6 +2330,7 @@ export type ParamField<N> = {
2122
2330
  * update logic. `key` here is just a stable React key/label. */
2123
2331
  | {
2124
2332
  key: string;
2333
+ label?: string;
2125
2334
  kind: 'custom';
2126
2335
  component: ComponentType<{
2127
2336
  node: N;
@@ -2180,6 +2389,22 @@ export type SceneApi = {
2180
2389
  nodes: () => Readonly<Record<AnyNodeId, AnyNode>>;
2181
2390
  update: (id: AnyNodeId, patch: Partial<AnyNode>) => void;
2182
2391
  upsert: (node: AnyNode, parentId?: AnyNodeId) => AnyNodeId;
2392
+ createMany?: (ops: {
2393
+ node: AnyNode;
2394
+ parentId?: AnyNodeId;
2395
+ }[]) => void;
2396
+ applyChanges?: (changes: {
2397
+ create?: {
2398
+ node: AnyNode;
2399
+ parentId?: AnyNodeId;
2400
+ }[];
2401
+ update?: {
2402
+ id: AnyNodeId;
2403
+ data: Partial<AnyNode>;
2404
+ }[];
2405
+ delete?: AnyNodeId[];
2406
+ }) => void;
2407
+ subscribeNodes?: (listener: (nodes: Readonly<Record<AnyNodeId, AnyNode>>, previous: Readonly<Record<AnyNodeId, AnyNode>>, changedIds: ReadonlySet<AnyNodeId>) => void) => () => void;
2183
2408
  delete: (id: AnyNodeId) => void;
2184
2409
  restore: (id: AnyNodeId) => void;
2185
2410
  restoreAll: () => void;