@pascal-app/core 1.0.6 → 1.0.7

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 (940) hide show
  1. package/dist/agent-operations/__fixtures__/add-object-cases.d.ts +31 -0
  2. package/dist/agent-operations/__fixtures__/add-object-cases.d.ts.map +1 -1
  3. package/dist/agent-operations/__fixtures__/build-room-cases.d.ts.map +1 -1
  4. package/dist/agent-operations/__fixtures__/build-room-cases.js +27 -0
  5. package/dist/agent-operations/__fixtures__/cases.d.ts.map +1 -1
  6. package/dist/agent-operations/__fixtures__/cases.js +19 -11
  7. package/dist/agent-operations/__fixtures__/design-brief-cases.d.ts +25 -2
  8. package/dist/agent-operations/__fixtures__/design-brief-cases.d.ts.map +1 -1
  9. package/dist/agent-operations/__fixtures__/design-brief-cases.js +509 -66
  10. package/dist/agent-operations/__fixtures__/dressing-scenes.d.ts +30 -0
  11. package/dist/agent-operations/__fixtures__/dressing-scenes.d.ts.map +1 -0
  12. package/dist/agent-operations/__fixtures__/dressing-scenes.js +82 -0
  13. package/dist/agent-operations/__fixtures__/native-materials.d.ts +407 -9
  14. package/dist/agent-operations/__fixtures__/native-materials.d.ts.map +1 -1
  15. package/dist/agent-operations/__fixtures__/notation-cases.d.ts.map +1 -1
  16. package/dist/agent-operations/__fixtures__/notation-cases.js +14 -0
  17. package/dist/agent-operations/__fixtures__/roof-bearing-cases.d.ts +7253 -4053
  18. package/dist/agent-operations/__fixtures__/roof-bearing-cases.d.ts.map +1 -1
  19. package/dist/agent-operations/__fixtures__/room-cases.d.ts +1 -0
  20. package/dist/agent-operations/__fixtures__/room-cases.d.ts.map +1 -1
  21. package/dist/agent-operations/__fixtures__/room-cases.js +57 -1
  22. package/dist/agent-operations/__fixtures__/room-check-scenes.d.ts +51 -0
  23. package/dist/agent-operations/__fixtures__/room-check-scenes.d.ts.map +1 -0
  24. package/dist/agent-operations/__fixtures__/room-check-scenes.js +121 -0
  25. package/dist/agent-operations/__fixtures__/scene-check-cases.d.ts.map +1 -1
  26. package/dist/agent-operations/__fixtures__/scene-check-cases.js +152 -18
  27. package/dist/agent-operations/__fixtures__/search-assets-cases.d.ts.map +1 -1
  28. package/dist/agent-operations/__fixtures__/search-assets-cases.js +91 -0
  29. package/dist/agent-operations/__fixtures__/site-cases.d.ts +40 -1
  30. package/dist/agent-operations/__fixtures__/site-cases.d.ts.map +1 -1
  31. package/dist/agent-operations/__fixtures__/structure-cases.d.ts +3 -0
  32. package/dist/agent-operations/__fixtures__/structure-cases.d.ts.map +1 -1
  33. package/dist/agent-operations/__fixtures__/structure-cases.js +199 -18
  34. package/dist/agent-operations/__fixtures__/unit-cases.d.ts +6 -0
  35. package/dist/agent-operations/__fixtures__/unit-cases.d.ts.map +1 -0
  36. package/dist/agent-operations/__fixtures__/unit-cases.js +266 -0
  37. package/dist/agent-operations/__fixtures__/verify-scene-cases.d.ts +109 -73
  38. package/dist/agent-operations/__fixtures__/verify-scene-cases.d.ts.map +1 -1
  39. package/dist/agent-operations/add-column.d.ts.map +1 -1
  40. package/dist/agent-operations/add-column.js +32 -3
  41. package/dist/agent-operations/add-fence.d.ts.map +1 -1
  42. package/dist/agent-operations/add-fence.js +2 -1
  43. package/dist/agent-operations/add-level.d.ts.map +1 -1
  44. package/dist/agent-operations/add-level.js +4 -4
  45. package/dist/agent-operations/add-object.d.ts +32 -6
  46. package/dist/agent-operations/add-object.d.ts.map +1 -1
  47. package/dist/agent-operations/add-object.js +59 -12
  48. package/dist/agent-operations/add-wall.d.ts +3 -8
  49. package/dist/agent-operations/add-wall.d.ts.map +1 -1
  50. package/dist/agent-operations/add-wall.js +31 -8
  51. package/dist/agent-operations/apply-changes.d.ts.map +1 -1
  52. package/dist/agent-operations/apply-changes.js +2 -1
  53. package/dist/agent-operations/asset-catalog.d.ts +63 -0
  54. package/dist/agent-operations/asset-catalog.d.ts.map +1 -0
  55. package/dist/agent-operations/asset-catalog.js +182 -0
  56. package/dist/agent-operations/asset-views.d.ts +4 -2
  57. package/dist/agent-operations/asset-views.d.ts.map +1 -1
  58. package/dist/agent-operations/asset-views.js +1 -3
  59. package/dist/agent-operations/author-scene-checks.d.ts +38 -0
  60. package/dist/agent-operations/author-scene-checks.d.ts.map +1 -0
  61. package/dist/agent-operations/author-scene-checks.js +266 -0
  62. package/dist/agent-operations/author-scene.d.ts +54 -20
  63. package/dist/agent-operations/author-scene.d.ts.map +1 -1
  64. package/dist/agent-operations/author-scene.js +1164 -196
  65. package/dist/agent-operations/authored-scene-merge.d.ts.map +1 -1
  66. package/dist/agent-operations/authored-scene-merge.js +61 -3
  67. package/dist/agent-operations/batch.d.ts +1 -1
  68. package/dist/agent-operations/batch.d.ts.map +1 -1
  69. package/dist/agent-operations/batch.js +38 -39
  70. package/dist/agent-operations/ceiling-object-observations.d.ts.map +1 -1
  71. package/dist/agent-operations/ceiling-object-observations.js +5 -4
  72. package/dist/agent-operations/circulation-geometry.d.ts +14 -0
  73. package/dist/agent-operations/circulation-geometry.d.ts.map +1 -0
  74. package/dist/agent-operations/circulation-geometry.js +151 -0
  75. package/dist/agent-operations/circulation-graph.d.ts +72 -0
  76. package/dist/agent-operations/circulation-graph.d.ts.map +1 -0
  77. package/dist/agent-operations/circulation-graph.js +713 -0
  78. package/dist/agent-operations/circulation-non-spaces.d.ts +10 -0
  79. package/dist/agent-operations/circulation-non-spaces.d.ts.map +1 -0
  80. package/dist/agent-operations/circulation-non-spaces.js +88 -0
  81. package/dist/agent-operations/circulation-spaces.d.ts +5880 -0
  82. package/dist/agent-operations/circulation-spaces.d.ts.map +1 -0
  83. package/dist/agent-operations/circulation-spaces.js +368 -0
  84. package/dist/agent-operations/collections.d.ts.map +1 -1
  85. package/dist/agent-operations/collections.js +9 -7
  86. package/dist/agent-operations/corner-window.d.ts.map +1 -1
  87. package/dist/agent-operations/corner-window.js +2 -4
  88. package/dist/agent-operations/create-roof.d.ts.map +1 -1
  89. package/dist/agent-operations/create-roof.js +5 -7
  90. package/dist/agent-operations/create-room.d.ts +4 -1
  91. package/dist/agent-operations/create-room.d.ts.map +1 -1
  92. package/dist/agent-operations/create-room.js +7 -4
  93. package/dist/agent-operations/create-stair.js +2 -2
  94. package/dist/agent-operations/design-brief.d.ts +13 -7
  95. package/dist/agent-operations/design-brief.d.ts.map +1 -1
  96. package/dist/agent-operations/design-brief.js +172 -92
  97. package/dist/agent-operations/door-clearance.d.ts +68 -8
  98. package/dist/agent-operations/door-clearance.d.ts.map +1 -1
  99. package/dist/agent-operations/door-clearance.js +127 -20
  100. package/dist/agent-operations/dress-targets.d.ts +23 -0
  101. package/dist/agent-operations/dress-targets.d.ts.map +1 -0
  102. package/dist/agent-operations/dress-targets.js +34 -0
  103. package/dist/agent-operations/duplicate-node.d.ts +14 -0
  104. package/dist/agent-operations/duplicate-node.d.ts.map +1 -0
  105. package/dist/agent-operations/duplicate-node.js +173 -0
  106. package/dist/agent-operations/find-by-type.d.ts.map +1 -1
  107. package/dist/agent-operations/find-by-type.js +3 -0
  108. package/dist/agent-operations/furnish-room.d.ts +2 -0
  109. package/dist/agent-operations/furnish-room.d.ts.map +1 -1
  110. package/dist/agent-operations/furnish-room.js +15 -4
  111. package/dist/agent-operations/furniture-kind.d.ts +28 -1
  112. package/dist/agent-operations/furniture-kind.d.ts.map +1 -1
  113. package/dist/agent-operations/furniture-kind.js +105 -6
  114. package/dist/agent-operations/ground-reader.d.ts +10 -0
  115. package/dist/agent-operations/ground-reader.d.ts.map +1 -0
  116. package/dist/agent-operations/ground-reader.js +25 -0
  117. package/dist/agent-operations/index.d.ts +118 -12
  118. package/dist/agent-operations/index.d.ts.map +1 -1
  119. package/dist/agent-operations/index.js +26 -1
  120. package/dist/agent-operations/item-solids.d.ts +39 -0
  121. package/dist/agent-operations/item-solids.d.ts.map +1 -0
  122. package/dist/agent-operations/item-solids.js +128 -0
  123. package/dist/agent-operations/layout-clearance.d.ts +91 -11
  124. package/dist/agent-operations/layout-clearance.d.ts.map +1 -1
  125. package/dist/agent-operations/layout-clearance.js +280 -73
  126. package/dist/agent-operations/level-height-fill.d.ts.map +1 -1
  127. package/dist/agent-operations/level-height-fill.js +7 -1
  128. package/dist/agent-operations/level-reads.d.ts +5 -0
  129. package/dist/agent-operations/level-reads.d.ts.map +1 -1
  130. package/dist/agent-operations/level-reads.js +38 -2
  131. package/dist/agent-operations/list-levels.d.ts.map +1 -1
  132. package/dist/agent-operations/list-levels.js +2 -4
  133. package/dist/agent-operations/move-node.d.ts +12 -0
  134. package/dist/agent-operations/move-node.d.ts.map +1 -0
  135. package/dist/agent-operations/move-node.js +28 -0
  136. package/dist/agent-operations/move-plan.d.ts +28 -0
  137. package/dist/agent-operations/move-plan.d.ts.map +1 -0
  138. package/dist/agent-operations/move-plan.js +257 -0
  139. package/dist/agent-operations/node-patch.d.ts.map +1 -1
  140. package/dist/agent-operations/node-patch.js +15 -0
  141. package/dist/agent-operations/paint.d.ts +3 -1
  142. package/dist/agent-operations/paint.d.ts.map +1 -1
  143. package/dist/agent-operations/paint.js +14 -1
  144. package/dist/agent-operations/photo-elevation.d.ts.map +1 -1
  145. package/dist/agent-operations/photo-elevation.js +2 -1
  146. package/dist/agent-operations/place-in-room.d.ts.map +1 -1
  147. package/dist/agent-operations/place-in-room.js +1 -0
  148. package/dist/agent-operations/place-items.d.ts.map +1 -1
  149. package/dist/agent-operations/place-items.js +3 -4
  150. package/dist/agent-operations/plan-clearance.d.ts +28 -0
  151. package/dist/agent-operations/plan-clearance.d.ts.map +1 -0
  152. package/dist/agent-operations/plan-clearance.js +47 -0
  153. package/dist/agent-operations/plan-geometry.d.ts +2 -0
  154. package/dist/agent-operations/plan-geometry.d.ts.map +1 -1
  155. package/dist/agent-operations/plan-geometry.js +10 -0
  156. package/dist/agent-operations/project-files.d.ts +10 -0
  157. package/dist/agent-operations/project-files.d.ts.map +1 -1
  158. package/dist/agent-operations/reachability.d.ts +41 -0
  159. package/dist/agent-operations/reachability.d.ts.map +1 -0
  160. package/dist/agent-operations/reachability.js +199 -0
  161. package/dist/agent-operations/room-checks.d.ts +60 -0
  162. package/dist/agent-operations/room-checks.d.ts.map +1 -0
  163. package/dist/agent-operations/room-checks.js +226 -0
  164. package/dist/agent-operations/room-faces.d.ts +30 -0
  165. package/dist/agent-operations/room-faces.d.ts.map +1 -0
  166. package/dist/agent-operations/room-faces.js +31 -0
  167. package/dist/agent-operations/room-findings.d.ts +5 -2
  168. package/dist/agent-operations/room-findings.d.ts.map +1 -1
  169. package/dist/agent-operations/room-findings.js +30 -0
  170. package/dist/agent-operations/room-finishes.d.ts +87 -0
  171. package/dist/agent-operations/room-finishes.d.ts.map +1 -0
  172. package/dist/agent-operations/room-finishes.js +193 -0
  173. package/dist/agent-operations/room-floor-script.d.ts +3 -3
  174. package/dist/agent-operations/room-floor-script.js +3 -3
  175. package/dist/agent-operations/room-readings.d.ts +90 -0
  176. package/dist/agent-operations/room-readings.d.ts.map +1 -0
  177. package/dist/agent-operations/room-readings.js +369 -0
  178. package/dist/agent-operations/room-tile.d.ts +15 -0
  179. package/dist/agent-operations/room-tile.d.ts.map +1 -0
  180. package/dist/agent-operations/room-tile.js +30 -0
  181. package/dist/agent-operations/room-wet.d.ts +55 -0
  182. package/dist/agent-operations/room-wet.d.ts.map +1 -0
  183. package/dist/agent-operations/room-wet.js +203 -0
  184. package/dist/agent-operations/scene-check-policy.d.ts +5 -0
  185. package/dist/agent-operations/scene-check-policy.d.ts.map +1 -0
  186. package/dist/agent-operations/scene-check-policy.js +24 -0
  187. package/dist/agent-operations/scene-checkpoint.d.ts +10 -0
  188. package/dist/agent-operations/scene-checkpoint.d.ts.map +1 -1
  189. package/dist/agent-operations/scene-checkpoint.js +31 -0
  190. package/dist/agent-operations/scene-issue-groups.d.ts +17 -0
  191. package/dist/agent-operations/scene-issue-groups.d.ts.map +1 -0
  192. package/dist/agent-operations/scene-issue-groups.js +71 -0
  193. package/dist/agent-operations/scene-materials.d.ts +23 -0
  194. package/dist/agent-operations/scene-materials.d.ts.map +1 -1
  195. package/dist/agent-operations/scene-materials.js +41 -0
  196. package/dist/agent-operations/scene-queries.d.ts +1667 -866
  197. package/dist/agent-operations/scene-queries.d.ts.map +1 -1
  198. package/dist/agent-operations/scene-queries.js +3 -3
  199. package/dist/agent-operations/scene-review.d.ts.map +1 -1
  200. package/dist/agent-operations/scene-review.js +3 -2
  201. package/dist/agent-operations/scene-view.d.ts.map +1 -1
  202. package/dist/agent-operations/scene-view.js +91 -21
  203. package/dist/agent-operations/search-assets.d.ts +10 -6
  204. package/dist/agent-operations/search-assets.d.ts.map +1 -1
  205. package/dist/agent-operations/search-assets.js +37 -22
  206. package/dist/agent-operations/set-checkpoint.d.ts.map +1 -1
  207. package/dist/agent-operations/set-checkpoint.js +1 -0
  208. package/dist/agent-operations/set-ground-level.d.ts +1 -1
  209. package/dist/agent-operations/set-ground-level.d.ts.map +1 -1
  210. package/dist/agent-operations/set-ground-level.js +3 -14
  211. package/dist/agent-operations/site.js +3 -2
  212. package/dist/agent-operations/slab-surface-script.d.ts +25 -0
  213. package/dist/agent-operations/slab-surface-script.d.ts.map +1 -0
  214. package/dist/agent-operations/slab-surface-script.js +60 -0
  215. package/dist/agent-operations/stair-plan-footprint.d.ts +9 -0
  216. package/dist/agent-operations/stair-plan-footprint.d.ts.map +1 -0
  217. package/dist/agent-operations/stair-plan-footprint.js +50 -0
  218. package/dist/agent-operations/types.d.ts +10 -5
  219. package/dist/agent-operations/types.d.ts.map +1 -1
  220. package/dist/agent-operations/units.d.ts +26 -0
  221. package/dist/agent-operations/units.d.ts.map +1 -0
  222. package/dist/agent-operations/units.js +110 -0
  223. package/dist/agent-operations/unreachable-rooms-check.d.ts +17 -0
  224. package/dist/agent-operations/unreachable-rooms-check.d.ts.map +1 -0
  225. package/dist/agent-operations/unreachable-rooms-check.js +35 -0
  226. package/dist/agent-operations/usage-checks.d.ts +2 -0
  227. package/dist/agent-operations/usage-checks.d.ts.map +1 -0
  228. package/dist/agent-operations/usage-checks.js +12 -0
  229. package/dist/agent-operations/verify-scene.d.ts +8 -11
  230. package/dist/agent-operations/verify-scene.d.ts.map +1 -1
  231. package/dist/agent-operations/verify-scene.js +55 -11
  232. package/dist/agent-operations/wall-face-defaults.d.ts +44 -0
  233. package/dist/agent-operations/wall-face-defaults.d.ts.map +1 -0
  234. package/dist/agent-operations/wall-face-defaults.js +229 -0
  235. package/dist/agent-operations/wall-joins.d.ts +119 -0
  236. package/dist/agent-operations/wall-joins.d.ts.map +1 -0
  237. package/dist/agent-operations/wall-joins.js +308 -0
  238. package/dist/agent-operations/wall-object-observations.d.ts.map +1 -1
  239. package/dist/agent-operations/wall-object-observations.js +4 -6
  240. package/dist/agent-operations/wall-skirting.d.ts.map +1 -1
  241. package/dist/agent-operations/wall-skirting.js +2 -0
  242. package/dist/agent-operations/wall-type.d.ts +49 -0
  243. package/dist/agent-operations/wall-type.d.ts.map +1 -0
  244. package/dist/agent-operations/wall-type.js +31 -0
  245. package/dist/agent-operations/zone-coverage.d.ts +85 -0
  246. package/dist/agent-operations/zone-coverage.d.ts.map +1 -0
  247. package/dist/agent-operations/zone-coverage.js +208 -0
  248. package/dist/agent-tools/add-object.d.ts +31 -0
  249. package/dist/agent-tools/add-object.d.ts.map +1 -1
  250. package/dist/agent-tools/add-object.js +44 -7
  251. package/dist/agent-tools/assets.d.ts +4 -0
  252. package/dist/agent-tools/assets.d.ts.map +1 -1
  253. package/dist/agent-tools/assets.js +11 -1
  254. package/dist/agent-tools/author-scene.d.ts +810 -15
  255. package/dist/agent-tools/author-scene.d.ts.map +1 -1
  256. package/dist/agent-tools/author-scene.js +275 -34
  257. package/dist/agent-tools/batch.d.ts +1 -1
  258. package/dist/agent-tools/batch.d.ts.map +1 -1
  259. package/dist/agent-tools/batch.js +5 -1
  260. package/dist/agent-tools/checkpoints.js +1 -1
  261. package/dist/agent-tools/columns.d.ts +14 -0
  262. package/dist/agent-tools/columns.d.ts.map +1 -1
  263. package/dist/agent-tools/columns.js +14 -2
  264. package/dist/agent-tools/contract.d.ts +10 -0
  265. package/dist/agent-tools/contract.d.ts.map +1 -1
  266. package/dist/agent-tools/contract.js +5 -1
  267. package/dist/agent-tools/corner-window.d.ts +1 -0
  268. package/dist/agent-tools/corner-window.d.ts.map +1 -1
  269. package/dist/agent-tools/corner-window.js +1 -1
  270. package/dist/agent-tools/create-room.d.ts +85 -0
  271. package/dist/agent-tools/create-room.d.ts.map +1 -1
  272. package/dist/agent-tools/create-room.js +8 -1
  273. package/dist/agent-tools/design-brief.d.ts +513 -7
  274. package/dist/agent-tools/design-brief.d.ts.map +1 -1
  275. package/dist/agent-tools/design-brief.js +192 -14
  276. package/dist/agent-tools/designs.js +1 -1
  277. package/dist/agent-tools/find-by-type.js +1 -1
  278. package/dist/agent-tools/index.d.ts +658 -10
  279. package/dist/agent-tools/index.d.ts.map +1 -1
  280. package/dist/agent-tools/index.js +9 -1
  281. package/dist/agent-tools/levels.js +4 -4
  282. package/dist/agent-tools/move-duplicate.d.ts +65 -0
  283. package/dist/agent-tools/move-duplicate.d.ts.map +1 -0
  284. package/dist/agent-tools/move-duplicate.js +68 -0
  285. package/dist/agent-tools/paint.d.ts +6 -0
  286. package/dist/agent-tools/paint.d.ts.map +1 -1
  287. package/dist/agent-tools/paint.js +7 -3
  288. package/dist/agent-tools/photo-elevation.js +1 -1
  289. package/dist/agent-tools/project-files.d.ts +2 -2
  290. package/dist/agent-tools/project-files.d.ts.map +1 -1
  291. package/dist/agent-tools/project-files.js +1 -1
  292. package/dist/agent-tools/refusal.d.ts +9 -1
  293. package/dist/agent-tools/refusal.d.ts.map +1 -1
  294. package/dist/agent-tools/refusal.js +5 -1
  295. package/dist/agent-tools/roofs.js +1 -1
  296. package/dist/agent-tools/room-structure.d.ts +60 -0
  297. package/dist/agent-tools/room-structure.d.ts.map +1 -1
  298. package/dist/agent-tools/room-structure.js +20 -1
  299. package/dist/agent-tools/search-materials.d.ts +1 -0
  300. package/dist/agent-tools/search-materials.d.ts.map +1 -1
  301. package/dist/agent-tools/site.js +1 -1
  302. package/dist/agent-tools/stairs.js +1 -1
  303. package/dist/agent-tools/units.d.ts +84 -0
  304. package/dist/agent-tools/units.d.ts.map +1 -0
  305. package/dist/agent-tools/units.js +54 -0
  306. package/dist/agent-tools/verify-scene-usage.d.ts +44 -0
  307. package/dist/agent-tools/verify-scene-usage.d.ts.map +1 -0
  308. package/dist/agent-tools/verify-scene-usage.js +146 -0
  309. package/dist/agent-tools/verify-scene.d.ts +12 -1
  310. package/dist/agent-tools/verify-scene.d.ts.map +1 -1
  311. package/dist/agent-tools/verify-scene.js +183 -3
  312. package/dist/agent-tools/view-scene.d.ts +3 -0
  313. package/dist/agent-tools/view-scene.d.ts.map +1 -1
  314. package/dist/agent-tools/view-scene.js +4 -1
  315. package/dist/agent-tools/wall-openings.d.ts +121 -2
  316. package/dist/agent-tools/wall-openings.d.ts.map +1 -1
  317. package/dist/agent-tools/wall-openings.js +123 -18
  318. package/dist/agent-tools/walls.d.ts +30 -0
  319. package/dist/agent-tools/walls.d.ts.map +1 -1
  320. package/dist/agent-tools/walls.js +54 -2
  321. package/dist/building/__fixtures__/wall-opening-cases.d.ts +340 -195
  322. package/dist/building/__fixtures__/wall-opening-cases.d.ts.map +1 -1
  323. package/dist/building/__fixtures__/wall-opening-cases.js +13 -0
  324. package/dist/building/code-profile.d.ts +231 -0
  325. package/dist/building/code-profile.d.ts.map +1 -0
  326. package/dist/building/code-profile.js +208 -0
  327. package/dist/building/corner-window.d.ts +2 -2
  328. package/dist/building/corner-window.d.ts.map +1 -1
  329. package/dist/building/corner-window.js +11 -2
  330. package/dist/building/door-types.d.ts +1 -0
  331. package/dist/building/door-types.d.ts.map +1 -1
  332. package/dist/building/door-types.js +2 -0
  333. package/dist/building/floor-item-fit.d.ts.map +1 -1
  334. package/dist/building/floor-item-fit.js +2 -4
  335. package/dist/building/ground-level.d.ts +1 -3
  336. package/dist/building/ground-level.d.ts.map +1 -1
  337. package/dist/building/ground-level.js +3 -5
  338. package/dist/building/index.d.ts +2 -0
  339. package/dist/building/index.d.ts.map +1 -1
  340. package/dist/building/index.js +2 -0
  341. package/dist/building/level-duplication.d.ts +5951 -4351
  342. package/dist/building/level-duplication.d.ts.map +1 -1
  343. package/dist/building/level-insertion.d.ts +1 -1
  344. package/dist/building/level-wall-copy.d.ts +24 -0
  345. package/dist/building/level-wall-copy.d.ts.map +1 -0
  346. package/dist/building/level-wall-copy.js +53 -0
  347. package/dist/building/merge-windows.d.ts.map +1 -1
  348. package/dist/building/merge-windows.js +1 -0
  349. package/dist/building/opening-style-presets.d.ts +2 -0
  350. package/dist/building/opening-style-presets.d.ts.map +1 -1
  351. package/dist/building/opening-style-presets.js +26 -5
  352. package/dist/building/room-use.d.ts +26 -0
  353. package/dist/building/room-use.d.ts.map +1 -0
  354. package/dist/building/room-use.js +102 -0
  355. package/dist/building/wall-openings.d.ts +115 -7
  356. package/dist/building/wall-openings.d.ts.map +1 -1
  357. package/dist/building/wall-openings.js +121 -29
  358. package/dist/building/window-types.d.ts +1 -0
  359. package/dist/building/window-types.d.ts.map +1 -1
  360. package/dist/building/window-types.js +3 -0
  361. package/dist/coherence/__fixtures__/enclosure-scenes.d.ts +84 -0
  362. package/dist/coherence/__fixtures__/enclosure-scenes.d.ts.map +1 -0
  363. package/dist/coherence/__fixtures__/enclosure-scenes.js +44 -0
  364. package/dist/commands/structure/attached-walls.d.ts +16 -0
  365. package/dist/commands/structure/attached-walls.d.ts.map +1 -0
  366. package/dist/commands/structure/attached-walls.js +53 -0
  367. package/dist/commands/structure/index.d.ts +3 -0
  368. package/dist/commands/structure/index.d.ts.map +1 -1
  369. package/dist/commands/structure/index.js +3 -0
  370. package/dist/commands/structure/move-separators.d.ts +62 -0
  371. package/dist/commands/structure/move-separators.d.ts.map +1 -0
  372. package/dist/commands/structure/move-separators.js +346 -0
  373. package/dist/commands/structure/set-floor-foundation.d.ts +5 -0
  374. package/dist/commands/structure/set-floor-foundation.d.ts.map +1 -1
  375. package/dist/commands/structure/set-wall-geometry.d.ts.map +1 -1
  376. package/dist/commands/structure/set-wall-geometry.js +44 -11
  377. package/dist/commands/structure/set-zone-intent.d.ts +26 -0
  378. package/dist/commands/structure/set-zone-intent.d.ts.map +1 -1
  379. package/dist/commands/structure/set-zone-intent.js +107 -2
  380. package/dist/commands/structure/shared.d.ts +888 -88
  381. package/dist/commands/structure/shared.d.ts.map +1 -1
  382. package/dist/commands/structure/wall-overlap.d.ts +45 -0
  383. package/dist/commands/structure/wall-overlap.d.ts.map +1 -0
  384. package/dist/commands/structure/wall-overlap.js +289 -0
  385. package/dist/commands/structure/zone-wall-merge.d.ts +3326 -2370
  386. package/dist/commands/structure/zone-wall-merge.d.ts.map +1 -1
  387. package/dist/contracts/reference-discovery.d.ts +2 -2
  388. package/dist/contracts/reference-discovery.d.ts.map +1 -1
  389. package/dist/contracts/reference-discovery.js +5 -3
  390. package/dist/contracts/reference-inventory.d.ts.map +1 -1
  391. package/dist/contracts/reference-inventory.js +75 -24
  392. package/dist/events/bus.d.ts +15 -2
  393. package/dist/events/bus.d.ts.map +1 -1
  394. package/dist/hooks/spatial-grid/built-in-floor-placed.d.ts +40 -0
  395. package/dist/hooks/spatial-grid/built-in-floor-placed.d.ts.map +1 -0
  396. package/dist/hooks/spatial-grid/built-in-floor-placed.js +220 -0
  397. package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts.map +1 -1
  398. package/dist/hooks/spatial-grid/floor-placed-elevation.js +13 -7
  399. package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +56 -1
  400. package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
  401. package/dist/hooks/spatial-grid/spatial-grid-manager.js +177 -27
  402. package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +1631 -831
  403. package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
  404. package/dist/hooks/spatial-grid/spatial-grid-sync.js +24 -1
  405. package/dist/hooks/spatial-grid/support-host-patch.js +10 -10
  406. package/dist/i18n/format.d.ts +41 -0
  407. package/dist/i18n/format.d.ts.map +1 -0
  408. package/dist/i18n/format.js +124 -0
  409. package/dist/i18n/index.d.ts +5 -0
  410. package/dist/i18n/index.d.ts.map +1 -0
  411. package/dist/i18n/index.js +3 -0
  412. package/dist/i18n/registry.d.ts +78 -0
  413. package/dist/i18n/registry.d.ts.map +1 -0
  414. package/dist/i18n/registry.js +252 -0
  415. package/dist/i18n/use-translate.d.ts +16 -0
  416. package/dist/i18n/use-translate.d.ts.map +1 -0
  417. package/dist/i18n/use-translate.js +23 -0
  418. package/dist/index.d.ts +32 -16
  419. package/dist/index.d.ts.map +1 -1
  420. package/dist/index.js +31 -15
  421. package/dist/lib/__fixtures__/mezzanine.d.ts +6840 -4169
  422. package/dist/lib/__fixtures__/mezzanine.d.ts.map +1 -1
  423. package/dist/lib/absorb-wall-separators.d.ts +2128 -1328
  424. package/dist/lib/absorb-wall-separators.d.ts.map +1 -1
  425. package/dist/lib/beam.d.ts +137 -0
  426. package/dist/lib/beam.d.ts.map +1 -0
  427. package/dist/lib/beam.js +297 -0
  428. package/dist/lib/below-grade-footprints.d.ts +13 -5
  429. package/dist/lib/below-grade-footprints.d.ts.map +1 -1
  430. package/dist/lib/below-grade-footprints.js +53 -10
  431. package/dist/lib/build-up.d.ts +89 -0
  432. package/dist/lib/build-up.d.ts.map +1 -0
  433. package/dist/lib/build-up.js +216 -0
  434. package/dist/lib/corner-pair.d.ts +205 -4
  435. package/dist/lib/corner-pair.d.ts.map +1 -1
  436. package/dist/lib/deck-boards.d.ts +80 -0
  437. package/dist/lib/deck-boards.d.ts.map +1 -0
  438. package/dist/lib/deck-boards.js +184 -0
  439. package/dist/lib/deck-framing.d.ts +150 -0
  440. package/dist/lib/deck-framing.d.ts.map +1 -0
  441. package/dist/lib/deck-framing.js +515 -0
  442. package/dist/lib/deepest-drawn.d.ts +3 -6
  443. package/dist/lib/deepest-drawn.d.ts.map +1 -1
  444. package/dist/lib/deepest-drawn.js +4 -8
  445. package/dist/lib/door-opening.d.ts +19 -0
  446. package/dist/lib/door-opening.d.ts.map +1 -0
  447. package/dist/lib/door-opening.js +27 -0
  448. package/dist/lib/door-operation.d.ts +2 -0
  449. package/dist/lib/door-operation.d.ts.map +1 -1
  450. package/dist/lib/door-operation.js +4 -0
  451. package/dist/lib/exterior-wall-loops.d.ts.map +1 -1
  452. package/dist/lib/exterior-wall-loops.js +2 -1
  453. package/dist/lib/finish-script.d.ts +5 -5
  454. package/dist/lib/finish-script.d.ts.map +1 -1
  455. package/dist/lib/finish-script.js +12 -5
  456. package/dist/lib/floor-footprint-name.d.ts +17 -0
  457. package/dist/lib/floor-footprint-name.d.ts.map +1 -1
  458. package/dist/lib/floor-footprint-name.js +17 -4
  459. package/dist/lib/floor-intent-changes.d.ts.map +1 -1
  460. package/dist/lib/floor-intent-changes.js +60 -35
  461. package/dist/lib/floor-opening-footprints.d.ts +1 -1
  462. package/dist/lib/floor-opening-footprints.d.ts.map +1 -1
  463. package/dist/lib/floor-opening-footprints.js +10 -4
  464. package/dist/lib/floor-plate-paint.d.ts +2 -0
  465. package/dist/lib/floor-plate-paint.d.ts.map +1 -1
  466. package/dist/lib/floor-plate-paint.js +12 -0
  467. package/dist/lib/floor-plates.d.ts +250 -0
  468. package/dist/lib/floor-plates.d.ts.map +1 -1
  469. package/dist/lib/floor-plates.js +43 -4
  470. package/dist/lib/floor-script.d.ts +35 -6
  471. package/dist/lib/floor-script.d.ts.map +1 -1
  472. package/dist/lib/floor-script.js +96 -16
  473. package/dist/lib/foundation-construction.d.ts +4 -13
  474. package/dist/lib/foundation-construction.d.ts.map +1 -1
  475. package/dist/lib/foundation-construction.js +4 -14
  476. package/dist/lib/foundation-standard.d.ts +2 -3
  477. package/dist/lib/foundation-standard.d.ts.map +1 -1
  478. package/dist/lib/foundation-standard.js +2 -3
  479. package/dist/lib/foundation-wall.d.ts +1 -2
  480. package/dist/lib/foundation-wall.d.ts.map +1 -1
  481. package/dist/lib/foundation-wall.js +1 -2
  482. package/dist/lib/framing-post.d.ts +91 -0
  483. package/dist/lib/framing-post.d.ts.map +1 -0
  484. package/dist/lib/framing-post.js +174 -0
  485. package/dist/lib/geometry-script-node.d.ts +11 -0
  486. package/dist/lib/geometry-script-node.d.ts.map +1 -1
  487. package/dist/lib/geometry-script-node.js +35 -0
  488. package/dist/lib/grade-standing.d.ts +16 -2
  489. package/dist/lib/grade-standing.d.ts.map +1 -1
  490. package/dist/lib/grade-standing.js +129 -9
  491. package/dist/lib/ground-seat.d.ts +2 -22
  492. package/dist/lib/ground-seat.d.ts.map +1 -1
  493. package/dist/lib/ground-seat.js +2 -17
  494. package/dist/lib/ground-window.d.ts +2 -1
  495. package/dist/lib/ground-window.d.ts.map +1 -1
  496. package/dist/lib/ground-window.js +5 -2
  497. package/dist/lib/level-footprints.d.ts +2 -0
  498. package/dist/lib/level-footprints.d.ts.map +1 -1
  499. package/dist/lib/level-footprints.js +7 -0
  500. package/dist/lib/opening-casing.d.ts +67 -0
  501. package/dist/lib/opening-casing.d.ts.map +1 -0
  502. package/dist/lib/opening-casing.js +131 -0
  503. package/dist/lib/opening-exterior-face.d.ts +6 -0
  504. package/dist/lib/opening-exterior-face.d.ts.map +1 -0
  505. package/dist/lib/opening-exterior-face.js +15 -0
  506. package/dist/lib/opening-floor-datum.d.ts +11 -5
  507. package/dist/lib/opening-floor-datum.d.ts.map +1 -1
  508. package/dist/lib/opening-floor-datum.js +38 -6
  509. package/dist/lib/opening-frame-depth.d.ts +18 -0
  510. package/dist/lib/opening-frame-depth.d.ts.map +1 -0
  511. package/dist/lib/opening-frame-depth.js +22 -0
  512. package/dist/lib/outdoor-room.d.ts +32 -0
  513. package/dist/lib/outdoor-room.d.ts.map +1 -0
  514. package/dist/lib/outdoor-room.js +66 -0
  515. package/dist/lib/plate-surface.d.ts +8 -0
  516. package/dist/lib/plate-surface.d.ts.map +1 -1
  517. package/dist/lib/plate-surface.js +53 -3
  518. package/dist/lib/porch-framing-sync.d.ts +46 -0
  519. package/dist/lib/porch-framing-sync.d.ts.map +1 -0
  520. package/dist/lib/porch-framing-sync.js +206 -0
  521. package/dist/lib/porch-framing.d.ts +44 -0
  522. package/dist/lib/porch-framing.d.ts.map +1 -0
  523. package/dist/lib/porch-framing.js +159 -0
  524. package/dist/lib/railing-rooms.d.ts +13 -0
  525. package/dist/lib/railing-rooms.d.ts.map +1 -0
  526. package/dist/lib/railing-rooms.js +37 -0
  527. package/dist/lib/roof-eave.d.ts +135 -0
  528. package/dist/lib/roof-eave.d.ts.map +1 -0
  529. package/dist/lib/roof-eave.js +186 -0
  530. package/dist/lib/room-floor-plate.d.ts +3 -1
  531. package/dist/lib/room-floor-plate.d.ts.map +1 -1
  532. package/dist/lib/room-floor-plate.js +7 -0
  533. package/dist/lib/space-detection.d.ts +13 -0
  534. package/dist/lib/space-detection.d.ts.map +1 -1
  535. package/dist/lib/space-detection.js +112 -24
  536. package/dist/lib/structure-kernel.d.ts +22 -9
  537. package/dist/lib/structure-kernel.d.ts.map +1 -1
  538. package/dist/lib/structure-kernel.js +146 -28
  539. package/dist/lib/structure-reconcile.d.ts +1 -1
  540. package/dist/lib/structure-reconcile.d.ts.map +1 -1
  541. package/dist/lib/structure-reconcile.js +7 -4
  542. package/dist/lib/surface-intent.d.ts +10 -0
  543. package/dist/lib/surface-intent.d.ts.map +1 -0
  544. package/dist/lib/surface-intent.js +18 -0
  545. package/dist/lib/terrain-source.d.ts.map +1 -1
  546. package/dist/lib/terrain-source.js +2 -1
  547. package/dist/lib/wall-face-script.d.ts.map +1 -1
  548. package/dist/lib/wall-face-script.js +5 -2
  549. package/dist/material-kinds.d.ts +1 -1
  550. package/dist/material-kinds.d.ts.map +1 -1
  551. package/dist/material-kinds.js +1 -0
  552. package/dist/material-library.d.ts +15 -0
  553. package/dist/material-library.d.ts.map +1 -1
  554. package/dist/material-library.js +458 -59
  555. package/dist/node-slots/door.d.ts +3 -4
  556. package/dist/node-slots/door.d.ts.map +1 -1
  557. package/dist/node-slots/door.js +4 -3
  558. package/dist/node-slots/wall.d.ts.map +1 -1
  559. package/dist/node-slots/wall.js +21 -3
  560. package/dist/node-slots/window.d.ts +2 -2
  561. package/dist/node-slots/window.d.ts.map +1 -1
  562. package/dist/node-slots/window.js +6 -1
  563. package/dist/procedural-items/design.d.ts +8 -0
  564. package/dist/procedural-items/design.d.ts.map +1 -1
  565. package/dist/procedural-items/design.js +169 -21
  566. package/dist/procedural-items/motion-controller.d.ts +2 -0
  567. package/dist/procedural-items/motion-controller.d.ts.map +1 -1
  568. package/dist/procedural-items/motion-controller.js +2 -1
  569. package/dist/registry/index.d.ts +2 -2
  570. package/dist/registry/index.d.ts.map +1 -1
  571. package/dist/registry/index.js +1 -1
  572. package/dist/registry/mechanism.d.ts +4 -1
  573. package/dist/registry/mechanism.d.ts.map +1 -1
  574. package/dist/registry/mechanism.js +10 -0
  575. package/dist/registry/types.d.ts +65 -23
  576. package/dist/registry/types.d.ts.map +1 -1
  577. package/dist/runtime/__fixtures__/live-scene.d.ts +14 -0
  578. package/dist/runtime/__fixtures__/live-scene.d.ts.map +1 -0
  579. package/dist/runtime/__fixtures__/live-scene.js +64 -0
  580. package/dist/runtime/apply.d.ts +42 -0
  581. package/dist/runtime/apply.d.ts.map +1 -0
  582. package/dist/runtime/apply.js +274 -0
  583. package/dist/runtime/dependencies.d.ts +97 -0
  584. package/dist/runtime/dependencies.d.ts.map +1 -0
  585. package/dist/runtime/dependencies.js +42 -0
  586. package/dist/runtime/ids.d.ts +11 -0
  587. package/dist/runtime/ids.d.ts.map +1 -0
  588. package/dist/runtime/ids.js +80 -0
  589. package/dist/runtime/index.d.ts +14 -0
  590. package/dist/runtime/index.d.ts.map +1 -0
  591. package/dist/runtime/index.js +11 -0
  592. package/dist/runtime/node-queries.d.ts +16 -0
  593. package/dist/runtime/node-queries.d.ts.map +1 -0
  594. package/dist/runtime/node-queries.js +30 -0
  595. package/dist/runtime/patch.d.ts +26 -0
  596. package/dist/runtime/patch.d.ts.map +1 -0
  597. package/dist/runtime/patch.js +165 -0
  598. package/dist/runtime/reader.d.ts +104 -0
  599. package/dist/runtime/reader.d.ts.map +1 -0
  600. package/dist/runtime/reader.js +455 -0
  601. package/dist/runtime/scene-runtime.d.ts +112 -0
  602. package/dist/runtime/scene-runtime.d.ts.map +1 -0
  603. package/dist/runtime/scene-runtime.js +302 -0
  604. package/dist/schema/__fixtures__/node-fixtures.d.ts.map +1 -1
  605. package/dist/schema/__fixtures__/node-fixtures.js +1 -0
  606. package/dist/schema/assembly.d.ts +3 -0
  607. package/dist/schema/assembly.d.ts.map +1 -1
  608. package/dist/schema/assembly.js +13 -0
  609. package/dist/schema/asset-url.d.ts +37 -2
  610. package/dist/schema/asset-url.d.ts.map +1 -1
  611. package/dist/schema/asset-url.js +80 -11
  612. package/dist/schema/base.d.ts +8 -0
  613. package/dist/schema/base.d.ts.map +1 -1
  614. package/dist/schema/base.js +19 -1
  615. package/dist/schema/build-up.d.ts +247 -0
  616. package/dist/schema/build-up.d.ts.map +1 -0
  617. package/dist/schema/build-up.js +83 -0
  618. package/dist/schema/geometry-source.d.ts +80 -0
  619. package/dist/schema/geometry-source.d.ts.map +1 -1
  620. package/dist/schema/geometry-source.js +38 -0
  621. package/dist/schema/index.d.ts +12 -7
  622. package/dist/schema/index.d.ts.map +1 -1
  623. package/dist/schema/index.js +12 -6
  624. package/dist/schema/material.d.ts +5 -0
  625. package/dist/schema/material.d.ts.map +1 -1
  626. package/dist/schema/material.js +6 -0
  627. package/dist/schema/nodes/beam.d.ts +264 -0
  628. package/dist/schema/nodes/beam.d.ts.map +1 -0
  629. package/dist/schema/nodes/beam.js +139 -0
  630. package/dist/schema/nodes/box-vent.d.ts +5 -0
  631. package/dist/schema/nodes/box-vent.d.ts.map +1 -1
  632. package/dist/schema/nodes/cabinet.d.ts +10 -0
  633. package/dist/schema/nodes/cabinet.d.ts.map +1 -1
  634. package/dist/schema/nodes/ceiling.d.ts +48 -0
  635. package/dist/schema/nodes/ceiling.d.ts.map +1 -1
  636. package/dist/schema/nodes/ceiling.js +5 -0
  637. package/dist/schema/nodes/chimney.d.ts +10 -0
  638. package/dist/schema/nodes/chimney.d.ts.map +1 -1
  639. package/dist/schema/nodes/column.d.ts +42 -0
  640. package/dist/schema/nodes/column.d.ts.map +1 -1
  641. package/dist/schema/nodes/column.js +11 -1
  642. package/dist/schema/nodes/cupola.d.ts +5 -0
  643. package/dist/schema/nodes/cupola.d.ts.map +1 -1
  644. package/dist/schema/nodes/door.d.ts +54 -3
  645. package/dist/schema/nodes/door.d.ts.map +1 -1
  646. package/dist/schema/nodes/door.js +41 -7
  647. package/dist/schema/nodes/dormer.d.ts +20 -0
  648. package/dist/schema/nodes/dormer.d.ts.map +1 -1
  649. package/dist/schema/nodes/downspout.d.ts +5 -0
  650. package/dist/schema/nodes/downspout.d.ts.map +1 -1
  651. package/dist/schema/nodes/elevator.d.ts +5 -0
  652. package/dist/schema/nodes/elevator.d.ts.map +1 -1
  653. package/dist/schema/nodes/eyebrow-vent.d.ts +5 -0
  654. package/dist/schema/nodes/eyebrow-vent.d.ts.map +1 -1
  655. package/dist/schema/nodes/fence.d.ts +5 -0
  656. package/dist/schema/nodes/fence.d.ts.map +1 -1
  657. package/dist/schema/nodes/guide.d.ts +14 -0
  658. package/dist/schema/nodes/guide.d.ts.map +1 -1
  659. package/dist/schema/nodes/guide.js +2 -0
  660. package/dist/schema/nodes/gutter.d.ts +5 -0
  661. package/dist/schema/nodes/gutter.d.ts.map +1 -1
  662. package/dist/schema/nodes/item.d.ts +71 -0
  663. package/dist/schema/nodes/item.d.ts.map +1 -1
  664. package/dist/schema/nodes/item.js +5 -1
  665. package/dist/schema/nodes/level.d.ts +1 -1
  666. package/dist/schema/nodes/level.d.ts.map +1 -1
  667. package/dist/schema/nodes/opening-types.d.ts +13 -0
  668. package/dist/schema/nodes/opening-types.d.ts.map +1 -1
  669. package/dist/schema/nodes/opening-types.js +8 -1
  670. package/dist/schema/nodes/railing-wall.d.ts +112 -0
  671. package/dist/schema/nodes/railing-wall.d.ts.map +1 -0
  672. package/dist/schema/nodes/railing-wall.js +160 -0
  673. package/dist/schema/nodes/ridge-vent.d.ts +5 -0
  674. package/dist/schema/nodes/ridge-vent.d.ts.map +1 -1
  675. package/dist/schema/nodes/roof-segment.d.ts +224 -1
  676. package/dist/schema/nodes/roof-segment.d.ts.map +1 -1
  677. package/dist/schema/nodes/roof-segment.js +57 -10
  678. package/dist/schema/nodes/roof-types.d.ts +11 -0
  679. package/dist/schema/nodes/roof-types.d.ts.map +1 -1
  680. package/dist/schema/nodes/roof-types.js +6 -0
  681. package/dist/schema/nodes/roof.d.ts +60 -0
  682. package/dist/schema/nodes/roof.d.ts.map +1 -1
  683. package/dist/schema/nodes/roof.js +4 -0
  684. package/dist/schema/nodes/shelf.d.ts +5 -0
  685. package/dist/schema/nodes/shelf.d.ts.map +1 -1
  686. package/dist/schema/nodes/site.d.ts +80 -0
  687. package/dist/schema/nodes/site.d.ts.map +1 -1
  688. package/dist/schema/nodes/site.js +7 -0
  689. package/dist/schema/nodes/skylight.d.ts +10 -0
  690. package/dist/schema/nodes/skylight.d.ts.map +1 -1
  691. package/dist/schema/nodes/slab.d.ts +137 -0
  692. package/dist/schema/nodes/slab.d.ts.map +1 -1
  693. package/dist/schema/nodes/slab.js +3 -0
  694. package/dist/schema/nodes/solar-panel.d.ts +10 -0
  695. package/dist/schema/nodes/solar-panel.d.ts.map +1 -1
  696. package/dist/schema/nodes/stair-segment.d.ts +5 -0
  697. package/dist/schema/nodes/stair-segment.d.ts.map +1 -1
  698. package/dist/schema/nodes/stair-structure.d.ts +69 -0
  699. package/dist/schema/nodes/stair-structure.d.ts.map +1 -0
  700. package/dist/schema/nodes/stair-structure.js +39 -0
  701. package/dist/schema/nodes/stair.d.ts +46 -0
  702. package/dist/schema/nodes/stair.d.ts.map +1 -1
  703. package/dist/schema/nodes/stair.js +3 -0
  704. package/dist/schema/nodes/turbine-vent.d.ts +5 -0
  705. package/dist/schema/nodes/turbine-vent.d.ts.map +1 -1
  706. package/dist/schema/nodes/wall.d.ts +135 -2
  707. package/dist/schema/nodes/wall.d.ts.map +1 -1
  708. package/dist/schema/nodes/wall.js +42 -6
  709. package/dist/schema/nodes/window.d.ts +66 -1
  710. package/dist/schema/nodes/window.d.ts.map +1 -1
  711. package/dist/schema/nodes/window.js +50 -5
  712. package/dist/schema/nodes/zone.d.ts +68 -0
  713. package/dist/schema/nodes/zone.d.ts.map +1 -1
  714. package/dist/schema/nodes/zone.js +32 -0
  715. package/dist/schema/scene-material.d.ts +5 -0
  716. package/dist/schema/scene-material.d.ts.map +1 -1
  717. package/dist/schema/types.d.ts +1079 -4
  718. package/dist/schema/types.d.ts.map +1 -1
  719. package/dist/schema/types.js +2 -0
  720. package/dist/schema/wall-type.d.ts +95 -0
  721. package/dist/schema/wall-type.d.ts.map +1 -0
  722. package/dist/schema/wall-type.js +32 -0
  723. package/dist/services/roof-bearing.d.ts.map +1 -1
  724. package/dist/services/roof-bearing.js +6 -3
  725. package/dist/services/roof-level.d.ts.map +1 -1
  726. package/dist/services/roof-level.js +4 -3
  727. package/dist/services/roof-move.d.ts.map +1 -1
  728. package/dist/services/roof-move.js +13 -7
  729. package/dist/services/storey.d.ts.map +1 -1
  730. package/dist/services/storey.js +13 -8
  731. package/dist/spatial/usage-field/beds.d.ts +51 -0
  732. package/dist/spatial/usage-field/beds.d.ts.map +1 -0
  733. package/dist/spatial/usage-field/beds.js +346 -0
  734. package/dist/spatial/usage-field/blocked.d.ts +28 -0
  735. package/dist/spatial/usage-field/blocked.d.ts.map +1 -0
  736. package/dist/spatial/usage-field/blocked.js +185 -0
  737. package/dist/spatial/usage-field/boxes.d.ts +17 -0
  738. package/dist/spatial/usage-field/boxes.d.ts.map +1 -0
  739. package/dist/spatial/usage-field/boxes.js +82 -0
  740. package/dist/spatial/usage-field/catalogue-shapes.d.ts +3 -0
  741. package/dist/spatial/usage-field/catalogue-shapes.d.ts.map +1 -0
  742. package/dist/spatial/usage-field/catalogue-shapes.js +257 -0
  743. package/dist/spatial/usage-field/catalogue.d.ts +6 -0
  744. package/dist/spatial/usage-field/catalogue.d.ts.map +1 -0
  745. package/dist/spatial/usage-field/catalogue.js +11 -0
  746. package/dist/spatial/usage-field/clash.d.ts +40 -0
  747. package/dist/spatial/usage-field/clash.d.ts.map +1 -0
  748. package/dist/spatial/usage-field/clash.js +187 -0
  749. package/dist/spatial/usage-field/door-stairs.d.ts +18 -0
  750. package/dist/spatial/usage-field/door-stairs.d.ts.map +1 -0
  751. package/dist/spatial/usage-field/door-stairs.js +129 -0
  752. package/dist/spatial/usage-field/entry-way.d.ts +14 -0
  753. package/dist/spatial/usage-field/entry-way.d.ts.map +1 -0
  754. package/dist/spatial/usage-field/entry-way.js +219 -0
  755. package/dist/spatial/usage-field/fences.d.ts +18 -0
  756. package/dist/spatial/usage-field/fences.d.ts.map +1 -0
  757. package/dist/spatial/usage-field/fences.js +253 -0
  758. package/dist/spatial/usage-field/field.d.ts +44 -0
  759. package/dist/spatial/usage-field/field.d.ts.map +1 -0
  760. package/dist/spatial/usage-field/field.js +145 -0
  761. package/dist/spatial/usage-field/findings.d.ts +76 -0
  762. package/dist/spatial/usage-field/findings.d.ts.map +1 -0
  763. package/dist/spatial/usage-field/findings.js +252 -0
  764. package/dist/spatial/usage-field/fixtures.d.ts +18 -0
  765. package/dist/spatial/usage-field/fixtures.d.ts.map +1 -0
  766. package/dist/spatial/usage-field/fixtures.js +160 -0
  767. package/dist/spatial/usage-field/flag.d.ts +10 -0
  768. package/dist/spatial/usage-field/flag.d.ts.map +1 -0
  769. package/dist/spatial/usage-field/flag.js +12 -0
  770. package/dist/spatial/usage-field/floors.d.ts +13 -0
  771. package/dist/spatial/usage-field/floors.d.ts.map +1 -0
  772. package/dist/spatial/usage-field/floors.js +36 -0
  773. package/dist/spatial/usage-field/index.d.ts +7 -0
  774. package/dist/spatial/usage-field/index.d.ts.map +1 -0
  775. package/dist/spatial/usage-field/index.js +5 -0
  776. package/dist/spatial/usage-field/items.d.ts +38 -0
  777. package/dist/spatial/usage-field/items.d.ts.map +1 -0
  778. package/dist/spatial/usage-field/items.js +261 -0
  779. package/dist/spatial/usage-field/labels.d.ts +8 -0
  780. package/dist/spatial/usage-field/labels.d.ts.map +1 -0
  781. package/dist/spatial/usage-field/labels.js +14 -0
  782. package/dist/spatial/usage-field/level-field.d.ts +47 -0
  783. package/dist/spatial/usage-field/level-field.d.ts.map +1 -0
  784. package/dist/spatial/usage-field/level-field.js +96 -0
  785. package/dist/spatial/usage-field/measure.d.ts +324 -0
  786. package/dist/spatial/usage-field/measure.d.ts.map +1 -0
  787. package/dist/spatial/usage-field/measure.js +458 -0
  788. package/dist/spatial/usage-field/obstacles.d.ts +63 -0
  789. package/dist/spatial/usage-field/obstacles.d.ts.map +1 -0
  790. package/dist/spatial/usage-field/obstacles.js +215 -0
  791. package/dist/spatial/usage-field/openings.d.ts +12 -0
  792. package/dist/spatial/usage-field/openings.d.ts.map +1 -0
  793. package/dist/spatial/usage-field/openings.js +162 -0
  794. package/dist/spatial/usage-field/path.d.ts +48 -0
  795. package/dist/spatial/usage-field/path.d.ts.map +1 -0
  796. package/dist/spatial/usage-field/path.js +354 -0
  797. package/dist/spatial/usage-field/pieces.d.ts +27 -0
  798. package/dist/spatial/usage-field/pieces.d.ts.map +1 -0
  799. package/dist/spatial/usage-field/pieces.js +89 -0
  800. package/dist/spatial/usage-field/shapes.d.ts +18 -0
  801. package/dist/spatial/usage-field/shapes.d.ts.map +1 -0
  802. package/dist/spatial/usage-field/shapes.js +92 -0
  803. package/dist/spatial/usage-field/stairs.d.ts +23 -0
  804. package/dist/spatial/usage-field/stairs.d.ts.map +1 -0
  805. package/dist/spatial/usage-field/stairs.js +163 -0
  806. package/dist/spatial/usage-field/support.d.ts +24 -0
  807. package/dist/spatial/usage-field/support.d.ts.map +1 -0
  808. package/dist/spatial/usage-field/support.js +46 -0
  809. package/dist/spatial/usage-field/swings.d.ts +846 -0
  810. package/dist/spatial/usage-field/swings.d.ts.map +1 -0
  811. package/dist/spatial/usage-field/swings.js +427 -0
  812. package/dist/spatial/usage-field/types.d.ts +65 -0
  813. package/dist/spatial/usage-field/types.d.ts.map +1 -0
  814. package/dist/spatial/usage-field/types.js +1 -0
  815. package/dist/spatial/usage-field/walls.d.ts +1057 -0
  816. package/dist/spatial/usage-field/walls.d.ts.map +1 -0
  817. package/dist/spatial/usage-field/walls.js +166 -0
  818. package/dist/spatial/usage-field/way-in.d.ts +26 -0
  819. package/dist/spatial/usage-field/way-in.d.ts.map +1 -0
  820. package/dist/spatial/usage-field/way-in.js +113 -0
  821. package/dist/store/actions/node-actions.d.ts +2124 -1322
  822. package/dist/store/actions/node-actions.d.ts.map +1 -1
  823. package/dist/store/actions/node-actions.js +42 -16
  824. package/dist/store/derived-node-guard.d.ts +10 -2
  825. package/dist/store/derived-node-guard.d.ts.map +1 -1
  826. package/dist/store/derived-node-guard.js +31 -11
  827. package/dist/store/document-settling.d.ts +9 -0
  828. package/dist/store/document-settling.d.ts.map +1 -0
  829. package/dist/store/document-settling.js +22 -0
  830. package/dist/store/history-control.d.ts +19 -10
  831. package/dist/store/history-control.d.ts.map +1 -1
  832. package/dist/store/history-control.js +176 -127
  833. package/dist/store/history-drafts.d.ts.map +1 -1
  834. package/dist/store/history-drafts.js +21 -17
  835. package/dist/store/live-previews.d.ts +9 -0
  836. package/dist/store/live-previews.d.ts.map +1 -0
  837. package/dist/store/live-previews.js +19 -0
  838. package/dist/store/scene-annotations.d.ts +6751 -5151
  839. package/dist/store/scene-annotations.d.ts.map +1 -1
  840. package/dist/store/scene-environment.d.ts +33 -0
  841. package/dist/store/scene-environment.d.ts.map +1 -0
  842. package/dist/store/scene-environment.js +54 -0
  843. package/dist/store/scene-hydration.d.ts.map +1 -1
  844. package/dist/store/scene-hydration.js +41 -30
  845. package/dist/store/use-interactive.d.ts +9 -3
  846. package/dist/store/use-interactive.d.ts.map +1 -1
  847. package/dist/store/use-interactive.js +43 -11
  848. package/dist/store/use-live-node-overrides.d.ts.map +1 -1
  849. package/dist/store/use-live-node-overrides.js +3 -0
  850. package/dist/store/use-scene.d.ts +25 -0
  851. package/dist/store/use-scene.d.ts.map +1 -1
  852. package/dist/store/use-scene.js +408 -336
  853. package/dist/systems/document-reconcile.d.ts +40 -0
  854. package/dist/systems/document-reconcile.d.ts.map +1 -0
  855. package/dist/systems/document-reconcile.js +159 -0
  856. package/dist/systems/elevator/elevator-opening-system.d.ts.map +1 -1
  857. package/dist/systems/elevator/elevator-opening-system.js +9 -24
  858. package/dist/systems/fence/guard-layout.d.ts +69 -0
  859. package/dist/systems/fence/guard-layout.d.ts.map +1 -0
  860. package/dist/systems/fence/guard-layout.js +194 -0
  861. package/dist/systems/owned-floor-openings.d.ts +13 -1
  862. package/dist/systems/owned-floor-openings.d.ts.map +1 -1
  863. package/dist/systems/owned-floor-openings.js +58 -2
  864. package/dist/systems/reconcile-owned-floor-openings.d.ts +3 -1
  865. package/dist/systems/reconcile-owned-floor-openings.d.ts.map +1 -1
  866. package/dist/systems/reconcile-owned-floor-openings.js +4 -4
  867. package/dist/systems/roof/roof-elevation-system.d.ts.map +1 -1
  868. package/dist/systems/roof/roof-elevation-system.js +8 -26
  869. package/dist/systems/roof/roof-elevation.d.ts +16 -1
  870. package/dist/systems/roof/roof-elevation.d.ts.map +1 -1
  871. package/dist/systems/roof/roof-elevation.js +85 -4
  872. package/dist/systems/roof/roof-footprint.d.ts +42 -1
  873. package/dist/systems/roof/roof-footprint.d.ts.map +1 -1
  874. package/dist/systems/roof/roof-footprint.js +160 -4
  875. package/dist/systems/slab/__fixtures__/floor-step.d.ts +3163 -1934
  876. package/dist/systems/slab/__fixtures__/floor-step.d.ts.map +1 -1
  877. package/dist/systems/slab/__fixtures__/raised-room.d.ts +2495 -1249
  878. package/dist/systems/slab/__fixtures__/raised-room.d.ts.map +1 -1
  879. package/dist/systems/stair/stair-clearance.d.ts +7 -0
  880. package/dist/systems/stair/stair-clearance.d.ts.map +1 -1
  881. package/dist/systems/stair/stair-clearance.js +31 -11
  882. package/dist/systems/stair/stair-construction.d.ts +8 -3
  883. package/dist/systems/stair/stair-construction.d.ts.map +1 -1
  884. package/dist/systems/stair/stair-construction.js +55 -4
  885. package/dist/systems/stair/stair-opening-preview.d.ts +889 -89
  886. package/dist/systems/stair/stair-opening-preview.d.ts.map +1 -1
  887. package/dist/systems/stair/stair-opening-system.d.ts.map +1 -1
  888. package/dist/systems/stair/stair-opening-system.js +18 -34
  889. package/dist/systems/stair/stair-presets.d.ts +36 -0
  890. package/dist/systems/stair/stair-presets.d.ts.map +1 -1
  891. package/dist/systems/stair/stair-rise-query.d.ts.map +1 -1
  892. package/dist/systems/stair/stair-rise-query.js +3 -2
  893. package/dist/systems/stair/stair-rise.d.ts.map +1 -1
  894. package/dist/systems/stair/stair-rise.js +6 -0
  895. package/dist/systems/stair/stair-sizing.d.ts +42 -11
  896. package/dist/systems/stair/stair-sizing.d.ts.map +1 -1
  897. package/dist/systems/stair/stair-sizing.js +10 -1
  898. package/dist/systems/stair/stair-structure.d.ts +277 -0
  899. package/dist/systems/stair/stair-structure.d.ts.map +1 -0
  900. package/dist/systems/stair/stair-structure.js +496 -0
  901. package/dist/systems/wall/wall-assembly.d.ts +84 -6
  902. package/dist/systems/wall/wall-assembly.d.ts.map +1 -1
  903. package/dist/systems/wall/wall-assembly.js +204 -5
  904. package/dist/systems/wall/wall-finish.d.ts +38 -2
  905. package/dist/systems/wall/wall-finish.d.ts.map +1 -1
  906. package/dist/systems/wall/wall-finish.js +70 -2
  907. package/dist/systems/wall/wall-footprint.js +2 -2
  908. package/dist/systems/wall/wall-merge.d.ts.map +1 -1
  909. package/dist/systems/wall/wall-merge.js +28 -7
  910. package/dist/systems/wall/wall-mitering.d.ts +1 -0
  911. package/dist/systems/wall/wall-mitering.d.ts.map +1 -1
  912. package/dist/systems/wall/wall-mitering.js +152 -52
  913. package/dist/systems/wall/wall-move.d.ts +23 -6
  914. package/dist/systems/wall/wall-move.d.ts.map +1 -1
  915. package/dist/systems/wall/wall-move.js +65 -0
  916. package/dist/systems/wall/wall-top.d.ts +2 -2
  917. package/dist/systems/wall/wall-top.d.ts.map +1 -1
  918. package/dist/systems/wall/wall-top.js +6 -1
  919. package/dist/systems/wall/wall-topology.d.ts +32 -1
  920. package/dist/systems/wall/wall-topology.d.ts.map +1 -1
  921. package/dist/systems/wall/wall-topology.js +118 -10
  922. package/dist/systems/wall/wall-trim-profiles.d.ts +12 -0
  923. package/dist/systems/wall/wall-trim-profiles.d.ts.map +1 -0
  924. package/dist/systems/wall/wall-trim-profiles.js +191 -0
  925. package/dist/utils/ensure-scene-openings.d.ts +6523 -4923
  926. package/dist/utils/ensure-scene-openings.d.ts.map +1 -1
  927. package/dist/utils/floor-piece-adoption.d.ts +5 -0
  928. package/dist/utils/floor-piece-adoption.d.ts.map +1 -1
  929. package/dist/utils/floor-plate-migration.d.ts +1930 -1130
  930. package/dist/utils/floor-plate-migration.d.ts.map +1 -1
  931. package/dist/utils/owned-floor-opening-migration.d.ts +888 -88
  932. package/dist/utils/owned-floor-opening-migration.d.ts.map +1 -1
  933. package/dist/utils/reconcile-structure-on-load.d.ts +1930 -1130
  934. package/dist/utils/reconcile-structure-on-load.d.ts.map +1 -1
  935. package/dist/utils/structure-id.d.ts.map +1 -1
  936. package/dist/utils/structure-id.js +4 -0
  937. package/package.json +22 -5
  938. package/dist/lib/generic-foundation.d.ts +0 -40
  939. package/dist/lib/generic-foundation.d.ts.map +0 -1
  940. package/dist/lib/generic-foundation.js +0 -200
@@ -35,10 +35,11 @@ import { migrateVerticalSceneNodes } from '../utils/vertical-scene-migration.js'
35
35
  import { migrateLegacyWallAssemblies } from '../utils/wall-assembly-migration.js';
36
36
  import { migrateWallFaceBands, migrateWallFaceKeys } from '../utils/wall-face-migration.js';
37
37
  import * as nodeActions from './actions/node-actions.js';
38
- import { areSceneSnapshotsEqual, beginSceneHistoryPauseSession, getSceneHistoryPauseDepth, isRestoringSceneHistory, notifySceneCommit, pauseSceneHistory, resetSceneHistoryPauseDepth, resumeSceneHistory, runAsRemoteSceneChange, runAsSceneHistoryRestore, runSceneWriteGuards, runWithSceneCommitNodeIds, } from './history-control.js';
38
+ import { areSceneSnapshotsEqual, beginSceneHistoryPauseSession, getSceneHistoryPauseDepth, isRestoringSceneHistory, notifySceneCommit, pauseSceneHistory, resetSceneHistoryPauseDepth, resumeSceneHistory, runAsRemoteSceneChange, runAsSceneHistoryRestore, runAsSingleSceneHistoryStep, runSceneWriteGuards, runWithSceneCommitNodeIds, settlePendingSceneCommit, } from './history-control.js';
39
39
  import { beginSceneHistoryDraft as beginSceneHistoryDraftIn, clearSceneHistoryDrafts, createdSceneHistoryDraftIds, hasSceneHistoryDrafts, noteSceneHistoryDraftWrite, sceneHistoryDraftRevertUpdates as sceneHistoryDraftRevertUpdatesIn, settleSceneHistoryDrafts, withAdoptedDraftsAsOriginal, withDraftsRestored, } from './history-drafts.js';
40
40
  import { getHistoryDirtyNodeIds } from './history-invalidation.js';
41
41
  import { retainSceneAnnotations, withoutSceneAnnotations, withoutSceneNodeAnnotations, writeSceneNodeField, } from './scene-annotations.js';
42
+ import { bindSceneEnvironment, liveSceneEnvironment, sceneEnvironmentOf, } from './scene-environment.js';
42
43
  import { invalidatePendingHydration, isHydrationNormalization, queueSceneNormalization, runSceneHydration, } from './scene-hydration.js';
43
44
  import useLiveNodeOverrides from './use-live-node-overrides.js';
44
45
  import useLiveTransforms from './use-live-transforms.js';
@@ -1008,16 +1009,22 @@ function sceneHistorySnapshotFromState(state) {
1008
1009
  * still carry `metadata.isNew`, so only explicitly owned drafts are left out.
1009
1010
  */
1010
1011
  export function getSceneDocument(drafts = []) {
1011
- const state = useScene.getState();
1012
- const kept = withoutDraftSubtrees(state, [...createdSceneHistoryDraftIds(), ...drafts]);
1013
- return {
1014
- nodes: withAdoptedDraftsAsOriginal(state.nodes, kept.nodes),
1015
- rootNodeIds: kept.rootNodeIds,
1016
- collections: kept.collections,
1017
- materials: state.materials,
1018
- installedPlugins: state.installedPlugins,
1019
- hasExplicitPluginInstallState: state.hasExplicitPluginInstallState,
1020
- };
1012
+ return sceneDocumentOf(useScene, drafts);
1013
+ }
1014
+ /** `getSceneDocument` for any scene store: its document as a save writes it. */
1015
+ export function sceneDocumentOf(store, drafts = []) {
1016
+ const state = store.getState();
1017
+ return sceneEnvironmentOf(store).run(() => {
1018
+ const kept = withoutDraftSubtrees(state, [...createdSceneHistoryDraftIds(), ...drafts]);
1019
+ return {
1020
+ nodes: withAdoptedDraftsAsOriginal(state.nodes, kept.nodes),
1021
+ rootNodeIds: kept.rootNodeIds,
1022
+ collections: kept.collections,
1023
+ materials: state.materials,
1024
+ installedPlugins: state.installedPlugins,
1025
+ hasExplicitPluginInstallState: state.hasExplicitPluginInstallState,
1026
+ };
1027
+ });
1021
1028
  }
1022
1029
  /**
1023
1030
  * A dirty mark is a promise that some system will rebuild the node and clear
@@ -1055,52 +1062,31 @@ class GuardedDirtySet extends Set {
1055
1062
  return super.add(id);
1056
1063
  }
1057
1064
  }
1058
- function createSceneStore(config) {
1059
- const hydratedConfig = (set, get, store) => {
1060
- const setWithHydration = (partial, replace) => {
1061
- const state = get();
1062
- let next = typeof partial === 'function' ? partial(state) : partial;
1063
- const documentChanged = ['nodes', 'rootNodeIds', 'materials', 'collections', 'installedPlugins'].some((key) => (replace || key in next) && next[key] !== state[key]);
1064
- if (documentChanged && !isHydrationNormalization()) {
1065
- invalidatePendingHydration();
1066
- if (state.hydrationToken)
1067
- next = { ...next, hydrationToken: null };
1068
- }
1069
- if (replace)
1070
- set(next, true);
1071
- else
1072
- set(next);
1073
- };
1074
- store.setState = setWithHydration;
1075
- return config(setWithHydration, get, store);
1076
- };
1077
- return create()(hydratedConfig);
1078
- }
1079
- function runTemporalJump(target, restore) {
1080
- const draftsBefore = useScene.getState().nodes;
1065
+ function runTemporalJump(store, target, restore) {
1066
+ const draftsBefore = store.getState().nodes;
1081
1067
  const restoreDrafts = () => {
1082
- const current = useScene.getState().nodes;
1068
+ const current = store.getState().nodes;
1083
1069
  const nodes = retainSceneAnnotations(draftsBefore, withDraftsRestored(draftsBefore, current) ?? current);
1084
1070
  if (nodes === current)
1085
1071
  return;
1086
1072
  // The carry's own state, not a new step: a tracked write here would clear redo.
1087
- const pause = beginSceneHistoryPauseSession(useScene);
1073
+ const pause = beginSceneHistoryPauseSession(store);
1088
1074
  try {
1089
- useScene.setState({ nodes });
1075
+ store.setState({ nodes });
1090
1076
  }
1091
1077
  finally {
1092
1078
  pause.end();
1093
1079
  }
1094
1080
  };
1095
- runTemporalJumpOnly(target, () => runAsSceneHistoryRestore(restore));
1081
+ runTemporalJumpOnly(store, target, () => runAsSceneHistoryRestore(restore));
1096
1082
  restoreDrafts();
1097
1083
  }
1098
- function runTemporalJumpOnly(target, jump) {
1084
+ function runTemporalJumpOnly(store, target, jump) {
1099
1085
  if (!target?.nodes) {
1100
1086
  jump();
1101
1087
  return;
1102
1088
  }
1103
- const before = useScene.getState().nodes;
1089
+ const before = store.getState().nodes;
1104
1090
  const changed = new Set();
1105
1091
  for (const id of new Set([...Object.keys(before), ...Object.keys(target.nodes)])) {
1106
1092
  const nodeId = id;
@@ -1116,313 +1102,364 @@ function runTemporalJumpOnly(target, jump) {
1116
1102
  }
1117
1103
  runWithSceneCommitNodeIds(changed, jump);
1118
1104
  }
1119
- const useScene = createSceneStore(temporal((set, get) => ({
1120
- // 1. Flat dictionary of all nodes
1121
- nodes: {},
1122
- // 2. Root node IDs
1123
- rootNodeIds: [],
1124
- // 3. Dirty set
1125
- dirtyNodes: new GuardedDirtySet(get),
1126
- hydrationToken: null,
1127
- hydrationId: null,
1128
- invalidateHydration: () => {
1129
- invalidatePendingHydration();
1130
- if (get().hydrationToken)
1131
- set({ hydrationToken: null });
1132
- },
1133
- // 4. Collections
1134
- collections: {},
1135
- materials: {},
1136
- installedPlugins: [],
1137
- hasExplicitPluginInstallState: false,
1138
- // 5. Read-only lock
1139
- readOnly: false,
1140
- setReadOnly: (readOnly) => set({ readOnly }),
1141
- unloadScene: () => {
1142
- runSceneWriteGuards();
1143
- invalidatePendingHydration();
1144
- set({
1145
- hydrationToken: null,
1146
- hydrationId: null,
1147
- nodes: {},
1148
- rootNodeIds: [],
1149
- dirtyNodes: new GuardedDirtySet(get),
1150
- collections: {},
1151
- materials: {},
1152
- installedPlugins: [],
1153
- hasExplicitPluginInstallState: false,
1154
- });
1155
- },
1156
- clearScene: () => {
1157
- const installedPlugins = get().installedPlugins;
1158
- const hasExplicitPluginInstallState = get().hasExplicitPluginInstallState;
1159
- get().unloadScene();
1160
- get().loadScene(); // Default scene
1161
- set({ installedPlugins, hasExplicitPluginInstallState });
1162
- },
1163
- setScene: (nodes, rootNodeIds, extra) => {
1164
- runSceneWriteGuards();
1165
- // Apply backward compatibility migrations
1166
- const { nodes: patchedNodes, mintedMaterials } = migrateNodes(nodes);
1167
- // Scene materials minted by the legacy→slots migrations join the
1168
- // loaded palette. Their ids are content-derived, so an existing entry
1169
- // with the same id (the hosted authority minted it) is the same material.
1170
- const materials = { ...mintedMaterials, ...(extra?.materials ?? {}) };
1171
- // Remove orphans: nodes whose parentId points to a non-existent node
1172
- const cleanedNodes = { ...patchedNodes };
1173
- for (const node of Object.values(cleanedNodes)) {
1174
- if (node.parentId && !cleanedNodes[node.parentId]) {
1175
- console.warn('[Scene] Removing orphan node', node.id, '(parentId', node.parentId, 'not found)');
1176
- delete cleanedNodes[node.id];
1177
- }
1178
- }
1179
- const normalizedRootNodeIds = normalizeRootNodeIds(cleanedNodes, rootNodeIds);
1180
- const reachableNodeIds = collectReachableNodeIds(cleanedNodes, normalizedRootNodeIds);
1181
- if (normalizedRootNodeIds.length > 0) {
1182
- for (const node of Object.values(cleanedNodes)) {
1183
- if (reachableNodeIds.has(node.id))
1184
- continue;
1185
- console.warn('[Scene] Removing unreachable node', node.id);
1186
- delete cleanedNodes[node.id];
1105
+ /** Every function field of `state` runs inside `environment` (scene-environment.ts). */
1106
+ function inEnvironment(environment, state) {
1107
+ const wrapped = { ...state };
1108
+ for (const [key, value] of Object.entries(state)) {
1109
+ if (typeof value !== 'function')
1110
+ continue;
1111
+ const action = value;
1112
+ wrapped[key] = (...args) => environment.run(() => action(...args));
1113
+ }
1114
+ return wrapped;
1115
+ }
1116
+ /**
1117
+ * A scene store bound to `environment`: its writes, actions, history and commits run in that
1118
+ * environment, so a second store (a detached scene, `@pascal-app/core/runtime`) never pauses,
1119
+ * commits to or drafts in the editor's. Once the environment is disposed, every read and write
1120
+ * of the store throws.
1121
+ */
1122
+ export function createSceneStore(environment) {
1123
+ const store = create()((set, get, api) => {
1124
+ const setWithHydration = (partial, replace) => {
1125
+ const state = get();
1126
+ let next = typeof partial === 'function' ? partial(state) : partial;
1127
+ const documentChanged = ['nodes', 'rootNodeIds', 'materials', 'collections', 'installedPlugins'].some((key) => (replace || key in next) && next[key] !== state[key]);
1128
+ if (documentChanged && !isHydrationNormalization()) {
1129
+ invalidatePendingHydration();
1130
+ if (state.hydrationToken)
1131
+ next = { ...next, hydrationToken: null };
1187
1132
  }
1188
- }
1189
- // Single tracked `set`: with zundo, every tracked write pushes the
1190
- // pre-write state onto `pastStates`. Writing the scene in two steps
1191
- // (as this used to) exposed a half-normalized intermediate state —
1192
- // and the pre-load (possibly empty) state — as undo targets.
1193
- const hydrationId = {};
1194
- runSceneHydration(() => {
1133
+ if (replace)
1134
+ set(next, true);
1135
+ else
1136
+ set(next);
1137
+ };
1138
+ api.setState = setWithHydration;
1139
+ const temporalApi = api;
1140
+ return inEnvironment(environment, sceneStoreConfig(() => temporalApi)(setWithHydration, get, temporalApi));
1141
+ });
1142
+ bindSceneEnvironment(store, environment);
1143
+ const { getState, setState } = store;
1144
+ store.getState = () => {
1145
+ environment.assertActive();
1146
+ return getState();
1147
+ };
1148
+ store.setState = ((partial, replace) => environment.run(() => setState(partial, replace)));
1149
+ const temporalState = store.temporal.getState();
1150
+ store.temporal.setState(inEnvironment(environment, temporalState));
1151
+ return store;
1152
+ }
1153
+ function sceneStoreConfig(storeOf) {
1154
+ return temporal((set, get) => ({
1155
+ // 1. Flat dictionary of all nodes
1156
+ nodes: {},
1157
+ // 2. Root node IDs
1158
+ rootNodeIds: [],
1159
+ // 3. Dirty set
1160
+ dirtyNodes: new GuardedDirtySet(get),
1161
+ hydrationToken: null,
1162
+ hydrationId: null,
1163
+ invalidateHydration: () => {
1164
+ invalidatePendingHydration();
1165
+ if (get().hydrationToken)
1166
+ set({ hydrationToken: null });
1167
+ },
1168
+ // 4. Collections
1169
+ collections: {},
1170
+ materials: {},
1171
+ installedPlugins: [],
1172
+ hasExplicitPluginInstallState: false,
1173
+ // 5. Read-only lock
1174
+ readOnly: false,
1175
+ setReadOnly: (readOnly) => set({ readOnly }),
1176
+ unloadScene: () => {
1177
+ runSceneWriteGuards();
1178
+ invalidatePendingHydration();
1195
1179
  set({
1196
1180
  hydrationToken: null,
1197
- hydrationId,
1198
- nodes: cleanedNodes,
1199
- rootNodeIds: normalizedRootNodeIds,
1181
+ hydrationId: null,
1182
+ nodes: {},
1183
+ rootNodeIds: [],
1200
1184
  dirtyNodes: new GuardedDirtySet(get),
1201
- collections: extra?.collections ?? {},
1202
- materials,
1203
- installedPlugins: Array.from(new Set(extra?.installedPlugins ?? [])),
1204
- hasExplicitPluginInstallState: extra?.hasExplicitPluginInstallState ?? false,
1185
+ collections: {},
1186
+ materials: {},
1187
+ installedPlugins: [],
1188
+ hasExplicitPluginInstallState: false,
1205
1189
  });
1206
- if (!get().readOnly &&
1207
- Object.values(get().nodes).some((node) => node.type === 'stair')) {
1208
- queueSceneNormalization(() => {
1209
- if (get().hydrationId !== hydrationId)
1210
- return;
1211
- const { updates } = ensureSceneOpenings(get().nodes);
1212
- if (!updates.length)
1213
- return;
1214
- pauseSceneHistory(useScene);
1215
- try {
1216
- get().updateNodes(updates);
1217
- }
1218
- finally {
1219
- resumeSceneHistory(useScene);
1220
- }
1190
+ },
1191
+ clearScene: () => {
1192
+ const installedPlugins = get().installedPlugins;
1193
+ const hasExplicitPluginInstallState = get().hasExplicitPluginInstallState;
1194
+ get().unloadScene();
1195
+ get().loadScene(); // Default scene
1196
+ set({ installedPlugins, hasExplicitPluginInstallState });
1197
+ },
1198
+ setScene: (nodes, rootNodeIds, extra) => {
1199
+ runSceneWriteGuards();
1200
+ // Apply backward compatibility migrations
1201
+ const { nodes: patchedNodes, mintedMaterials } = migrateNodes(nodes);
1202
+ // Scene materials minted by the legacy→slots migrations join the
1203
+ // loaded palette. Their ids are content-derived, so an existing entry
1204
+ // with the same id (the hosted authority minted it) is the same material.
1205
+ const materials = { ...mintedMaterials, ...(extra?.materials ?? {}) };
1206
+ // Remove orphans: nodes whose parentId points to a non-existent node
1207
+ const cleanedNodes = { ...patchedNodes };
1208
+ for (const node of Object.values(cleanedNodes)) {
1209
+ if (node.parentId && !cleanedNodes[node.parentId]) {
1210
+ console.warn('[Scene] Removing orphan node', node.id, '(parentId', node.parentId, 'not found)');
1211
+ delete cleanedNodes[node.id];
1212
+ }
1213
+ }
1214
+ const normalizedRootNodeIds = normalizeRootNodeIds(cleanedNodes, rootNodeIds);
1215
+ const reachableNodeIds = collectReachableNodeIds(cleanedNodes, normalizedRootNodeIds);
1216
+ if (normalizedRootNodeIds.length > 0) {
1217
+ for (const node of Object.values(cleanedNodes)) {
1218
+ if (reachableNodeIds.has(node.id))
1219
+ continue;
1220
+ console.warn('[Scene] Removing unreachable node', node.id);
1221
+ delete cleanedNodes[node.id];
1222
+ }
1223
+ }
1224
+ // Single tracked `set`: with zundo, every tracked write pushes the
1225
+ // pre-write state onto `pastStates`. Writing the scene in two steps
1226
+ // (as this used to) exposed a half-normalized intermediate state —
1227
+ // and the pre-load (possibly empty) state — as undo targets.
1228
+ const hydrationId = {};
1229
+ runSceneHydration(() => {
1230
+ set({
1231
+ hydrationToken: null,
1232
+ hydrationId,
1233
+ nodes: cleanedNodes,
1234
+ rootNodeIds: normalizedRootNodeIds,
1235
+ dirtyNodes: new GuardedDirtySet(get),
1236
+ collections: extra?.collections ?? {},
1237
+ materials,
1238
+ installedPlugins: Array.from(new Set(extra?.installedPlugins ?? [])),
1239
+ hasExplicitPluginInstallState: extra?.hasExplicitPluginInstallState ?? false,
1221
1240
  });
1241
+ if (!get().readOnly &&
1242
+ Object.values(get().nodes).some((node) => node.type === 'stair')) {
1243
+ queueSceneNormalization(() => {
1244
+ if (get().hydrationId !== hydrationId)
1245
+ return;
1246
+ const { updates } = ensureSceneOpenings(get().nodes);
1247
+ if (!updates.length)
1248
+ return;
1249
+ pauseSceneHistory(storeOf());
1250
+ try {
1251
+ get().updateNodes(updates);
1252
+ }
1253
+ finally {
1254
+ resumeSceneHistory(storeOf());
1255
+ }
1256
+ });
1257
+ }
1258
+ // Mark all nodes as dirty to trigger re-validation
1259
+ Object.values(get().nodes).forEach((node) => {
1260
+ get().markDirty(node.id);
1261
+ });
1262
+ }, () => set({ hydrationToken: hydrationId }));
1263
+ },
1264
+ setInstalledPlugins: (pluginIds, options) => {
1265
+ if (get().readOnly)
1266
+ return;
1267
+ const nextInstalledPlugins = Array.from(new Set(pluginIds));
1268
+ const previousInstalledPlugins = get().installedPlugins;
1269
+ // Guard against the *next* plugin list: the store still holds the old
1270
+ // one, and re-marks for newly enabled kinds must pass the guard.
1271
+ const dirtyNodes = new GuardedDirtySet(() => ({ nodes: get().nodes, installedPlugins: nextInstalledPlugins }), get().dirtyNodes);
1272
+ for (const node of Object.values(get().nodes)) {
1273
+ if (!getNodePluginId(node.type))
1274
+ continue;
1275
+ if (!isNodeKindEnabled(node.type, nextInstalledPlugins)) {
1276
+ dirtyNodes.delete(node.id);
1277
+ }
1278
+ else if (!isNodeKindEnabled(node.type, previousInstalledPlugins)) {
1279
+ if (nodeRegistry.get(node.type)?.dirtyTracking !== false)
1280
+ dirtyNodes.add(node.id);
1281
+ }
1222
1282
  }
1223
- // Mark all nodes as dirty to trigger re-validation
1224
- Object.values(get().nodes).forEach((node) => {
1225
- get().markDirty(node.id);
1283
+ set({
1284
+ installedPlugins: nextInstalledPlugins,
1285
+ hasExplicitPluginInstallState: options?.explicit ?? get().hasExplicitPluginInstallState,
1286
+ dirtyNodes,
1226
1287
  });
1227
- }, () => set({ hydrationToken: hydrationId }));
1228
- },
1229
- setInstalledPlugins: (pluginIds, options) => {
1230
- if (get().readOnly)
1231
- return;
1232
- const nextInstalledPlugins = Array.from(new Set(pluginIds));
1233
- const previousInstalledPlugins = get().installedPlugins;
1234
- // Guard against the *next* plugin list: the store still holds the old
1235
- // one, and re-marks for newly enabled kinds must pass the guard.
1236
- const dirtyNodes = new GuardedDirtySet(() => ({ nodes: get().nodes, installedPlugins: nextInstalledPlugins }), get().dirtyNodes);
1237
- for (const node of Object.values(get().nodes)) {
1238
- if (!getNodePluginId(node.type))
1239
- continue;
1240
- if (!isNodeKindEnabled(node.type, nextInstalledPlugins)) {
1241
- dirtyNodes.delete(node.id);
1242
- }
1243
- else if (!isNodeKindEnabled(node.type, previousInstalledPlugins)) {
1244
- if (nodeRegistry.get(node.type)?.dirtyTracking !== false)
1245
- dirtyNodes.add(node.id);
1288
+ },
1289
+ loadScene: () => {
1290
+ if (get().rootNodeIds.length > 0) {
1291
+ // Assign all nodes as dirty to force re-validation
1292
+ Object.values(get().nodes).forEach((node) => {
1293
+ get().markDirty(node.id);
1294
+ });
1295
+ return; // Scene already loaded
1246
1296
  }
1247
- }
1248
- set({
1249
- installedPlugins: nextInstalledPlugins,
1250
- hasExplicitPluginInstallState: options?.explicit ?? get().hasExplicitPluginInstallState,
1251
- dirtyNodes,
1252
- });
1253
- },
1254
- loadScene: () => {
1255
- if (get().rootNodeIds.length > 0) {
1256
- // Assign all nodes as dirty to force re-validation
1257
- Object.values(get().nodes).forEach((node) => {
1258
- get().markDirty(node.id);
1297
+ // Create hierarchy: Site → Building → Level. Parent links must be
1298
+ // written explicitly — the schema defaults `parentId` to null, and the
1299
+ // scene authority rejects parent/child asymmetry that the renderer
1300
+ // happily traverses through `children`.
1301
+ const site = SiteNode.parse({});
1302
+ const building = BuildingNode.parse({
1303
+ parentId: site.id,
1259
1304
  });
1260
- return; // Scene already loaded
1261
- }
1262
- // Create hierarchy: Site → Building → Level. Parent links must be
1263
- // written explicitly — the schema defaults `parentId` to null, and the
1264
- // scene authority rejects parent/child asymmetry that the renderer
1265
- // happily traverses through `children`.
1266
- const site = SiteNode.parse({});
1267
- const building = BuildingNode.parse({
1268
- parentId: site.id,
1269
- });
1270
- const level0 = LevelNode.parse({
1271
- parentId: building.id,
1272
- level: 0,
1273
- children: [],
1274
- height: DEFAULT_LEVEL_HEIGHT,
1275
- });
1276
- // Define all nodes flat
1277
- const nodes = {
1278
- [site.id]: { ...site, children: [building.id] },
1279
- [building.id]: { ...building, children: [level0.id] },
1280
- [level0.id]: level0,
1281
- };
1282
- // Site is the root
1283
- const rootNodeIds = [site.id];
1284
- set({ nodes, rootNodeIds });
1285
- },
1286
- markDirty: (id) => {
1287
- // Guarded here too, not just in GuardedDirtySet.add — tests (and any
1288
- // setState caller) can swap in a plain Set.
1289
- if (!isDirtyTrackable(id, get()))
1290
- return;
1291
- get().dirtyNodes.add(id);
1292
- },
1293
- clearDirty: (id) => {
1294
- get().dirtyNodes.delete(id);
1295
- },
1296
- createNodes: (ops, options) => nodeActions.createNodesAction(set, get, ops, options),
1297
- createNode: (node, parentId, options) => nodeActions.createNodesAction(set, get, [{ node, parentId }], options),
1298
- applyNodeChanges: (changes, options) => nodeActions.applyNodeChangesAction(set, get, changes, options),
1299
- updateNodes: (updates, options) => nodeActions.updateNodesAction(set, get, updates, options),
1300
- updateNode: (id, data, options) => nodeActions.updateNodesAction(set, get, [{ id, data }], options),
1301
- detachDerivedNode: (id, data) => nodeActions.detachDerivedNodeAction(set, get, id, data),
1302
- // --- DELETE ---
1303
- deleteNodes: (ids, options) => nodeActions.deleteNodesAction(set, get, ids, options),
1304
- deleteNode: (id, options) => nodeActions.deleteNodesAction(set, get, [id], options),
1305
- // --- COLLECTIONS ---
1306
- createCollection: (name, nodeIds = []) => {
1307
- if (get().readOnly)
1308
- return '';
1309
- const id = generateCollectionId();
1310
- set((state) => ({
1311
- collections: { ...state.collections, [id]: { id, name, nodeIds: [...nodeIds] } },
1312
- nodes: mirrorItemMembership(state.nodes, id, nodeIds, true),
1313
- }));
1314
- return id;
1315
- },
1316
- deleteCollection: (id) => {
1317
- if (get().readOnly)
1318
- return;
1319
- set((state) => {
1320
- const col = state.collections[id];
1321
- const nextCollections = { ...state.collections };
1322
- delete nextCollections[id];
1323
- return {
1324
- collections: nextCollections,
1325
- nodes: mirrorItemMembership(state.nodes, id, col?.nodeIds ?? [], false),
1305
+ const level0 = LevelNode.parse({
1306
+ parentId: building.id,
1307
+ level: 0,
1308
+ children: [],
1309
+ height: DEFAULT_LEVEL_HEIGHT,
1310
+ });
1311
+ // Define all nodes flat
1312
+ const nodes = {
1313
+ [site.id]: { ...site, children: [building.id] },
1314
+ [building.id]: { ...building, children: [level0.id] },
1315
+ [level0.id]: level0,
1326
1316
  };
1327
- });
1328
- },
1329
- updateCollection: (id, data) => {
1330
- if (get().readOnly)
1331
- return;
1332
- set((state) => {
1333
- const col = state.collections[id];
1334
- if (!col)
1335
- return state;
1336
- return { collections: { ...state.collections, [id]: { ...col, ...data } } };
1337
- });
1338
- },
1339
- addToCollection: (id, nodeIds) => {
1340
- if (get().readOnly)
1341
- return;
1342
- set((state) => {
1343
- const col = state.collections[id];
1344
- const added = nodeIds.filter((nodeId) => !col?.nodeIds.includes(nodeId));
1345
- if (!col || added.length === 0)
1346
- return state;
1317
+ // Site is the root
1318
+ const rootNodeIds = [site.id];
1319
+ set({ nodes, rootNodeIds });
1320
+ },
1321
+ markDirty: (id) => {
1322
+ // Guarded here too, not just in GuardedDirtySet.add — tests (and any
1323
+ // setState caller) can swap in a plain Set.
1324
+ if (!isDirtyTrackable(id, get()))
1325
+ return;
1326
+ get().dirtyNodes.add(id);
1327
+ },
1328
+ clearDirty: (id) => {
1329
+ get().dirtyNodes.delete(id);
1330
+ },
1331
+ createNodes: (ops, options) => nodeActions.createNodesAction(set, get, ops, options),
1332
+ createNode: (node, parentId, options) => nodeActions.createNodesAction(set, get, [{ node, parentId }], options),
1333
+ applyNodeChanges: (changes, options) => nodeActions.applyNodeChangesAction(set, get, changes, options),
1334
+ updateNodes: (updates, options) => nodeActions.updateNodesAction(set, get, updates, options),
1335
+ updateNode: (id, data, options) => nodeActions.updateNodesAction(set, get, [{ id, data }], options),
1336
+ detachDerivedNode: (id, data) => nodeActions.detachDerivedNodeAction(set, get, id, data),
1337
+ // --- DELETE ---
1338
+ deleteNodes: (ids, options) => nodeActions.deleteNodesAction(set, get, ids, options),
1339
+ deleteNode: (id, options) => nodeActions.deleteNodesAction(set, get, [id], options),
1340
+ // --- COLLECTIONS ---
1341
+ createCollection: (name, nodeIds = []) => {
1342
+ if (get().readOnly)
1343
+ return '';
1344
+ const id = generateCollectionId();
1345
+ set((state) => ({
1346
+ collections: { ...state.collections, [id]: { id, name, nodeIds: [...nodeIds] } },
1347
+ nodes: mirrorItemMembership(state.nodes, id, nodeIds, true),
1348
+ }));
1349
+ return id;
1350
+ },
1351
+ deleteCollection: (id) => {
1352
+ if (get().readOnly)
1353
+ return;
1354
+ set((state) => {
1355
+ const col = state.collections[id];
1356
+ const nextCollections = { ...state.collections };
1357
+ delete nextCollections[id];
1358
+ return {
1359
+ collections: nextCollections,
1360
+ nodes: mirrorItemMembership(state.nodes, id, col?.nodeIds ?? [], false),
1361
+ };
1362
+ });
1363
+ },
1364
+ updateCollection: (id, data) => {
1365
+ if (get().readOnly)
1366
+ return;
1367
+ set((state) => {
1368
+ const col = state.collections[id];
1369
+ if (!col)
1370
+ return state;
1371
+ return { collections: { ...state.collections, [id]: { ...col, ...data } } };
1372
+ });
1373
+ },
1374
+ addToCollection: (id, nodeIds) => {
1375
+ if (get().readOnly)
1376
+ return;
1377
+ set((state) => {
1378
+ const col = state.collections[id];
1379
+ const added = nodeIds.filter((nodeId) => !col?.nodeIds.includes(nodeId));
1380
+ if (!col || added.length === 0)
1381
+ return state;
1382
+ return {
1383
+ collections: {
1384
+ ...state.collections,
1385
+ [id]: { ...col, nodeIds: [...col.nodeIds, ...added] },
1386
+ },
1387
+ nodes: mirrorItemMembership(state.nodes, id, added, true),
1388
+ };
1389
+ });
1390
+ },
1391
+ removeFromCollection: (id, nodeIds) => {
1392
+ if (get().readOnly)
1393
+ return;
1394
+ set((state) => {
1395
+ const col = state.collections[id];
1396
+ const removed = nodeIds.filter((nodeId) => col?.nodeIds.includes(nodeId));
1397
+ if (!col || removed.length === 0)
1398
+ return state;
1399
+ return {
1400
+ collections: {
1401
+ ...state.collections,
1402
+ [id]: { ...col, nodeIds: col.nodeIds.filter((nodeId) => !removed.includes(nodeId)) },
1403
+ },
1404
+ nodes: mirrorItemMembership(state.nodes, id, removed, false),
1405
+ };
1406
+ });
1407
+ },
1408
+ // --- SCENE MATERIALS ---
1409
+ addSceneMaterial: (material) => {
1410
+ if (get().readOnly)
1411
+ return;
1412
+ set((state) => ({
1413
+ materials: { ...state.materials, [material.id]: material },
1414
+ }));
1415
+ },
1416
+ updateSceneMaterial: (id, data) => {
1417
+ if (get().readOnly)
1418
+ return;
1419
+ set((state) => {
1420
+ const material = state.materials[id];
1421
+ if (!material)
1422
+ return state;
1423
+ return { materials: { ...state.materials, [id]: { ...material, ...data } } };
1424
+ });
1425
+ },
1426
+ removeSceneMaterial: (id) => {
1427
+ if (get().readOnly)
1428
+ return;
1429
+ set((state) => {
1430
+ const materials = { ...state.materials };
1431
+ delete materials[id];
1432
+ return { materials };
1433
+ });
1434
+ },
1435
+ }), {
1436
+ partialize: (state) => sceneHistorySnapshotFromState(state),
1437
+ equality: (pastState, currentState) => areSceneSnapshotsEqual({ ...pastState, nodes: withoutSceneAnnotations(pastState.nodes) }, { ...currentState, nodes: withoutSceneAnnotations(currentState.nodes) }),
1438
+ onSave: (pastState, currentState) => {
1439
+ notifySceneCommit({
1440
+ origin: 'local',
1441
+ before: sceneHistorySnapshotFromState(pastState),
1442
+ current: sceneHistorySnapshotFromState(currentState),
1443
+ });
1444
+ },
1445
+ wrapTemporal: (config) => (set, get, store) => {
1446
+ const state = config(set, get, store);
1347
1447
  return {
1348
- collections: {
1349
- ...state.collections,
1350
- [id]: { ...col, nodeIds: [...col.nodeIds, ...added] },
1448
+ ...state,
1449
+ undo: (steps = 1) => {
1450
+ runSceneWriteGuards(storeOf());
1451
+ return runTemporalJump(storeOf(), get().pastStates.slice().splice(-steps, steps)[0], () => state.undo(steps));
1351
1452
  },
1352
- nodes: mirrorItemMembership(state.nodes, id, added, true),
1353
- };
1354
- });
1355
- },
1356
- removeFromCollection: (id, nodeIds) => {
1357
- if (get().readOnly)
1358
- return;
1359
- set((state) => {
1360
- const col = state.collections[id];
1361
- const removed = nodeIds.filter((nodeId) => col?.nodeIds.includes(nodeId));
1362
- if (!col || removed.length === 0)
1363
- return state;
1364
- return {
1365
- collections: {
1366
- ...state.collections,
1367
- [id]: { ...col, nodeIds: col.nodeIds.filter((nodeId) => !removed.includes(nodeId)) },
1453
+ redo: (steps = 1) => {
1454
+ runSceneWriteGuards(storeOf());
1455
+ return runTemporalJump(storeOf(), get().futureStates.slice().splice(-steps, steps)[0], () => state.redo(steps));
1368
1456
  },
1369
- nodes: mirrorItemMembership(state.nodes, id, removed, false),
1370
1457
  };
1371
- });
1372
- },
1373
- // --- SCENE MATERIALS ---
1374
- addSceneMaterial: (material) => {
1375
- if (get().readOnly)
1376
- return;
1377
- set((state) => ({
1378
- materials: { ...state.materials, [material.id]: material },
1379
- }));
1380
- },
1381
- updateSceneMaterial: (id, data) => {
1382
- if (get().readOnly)
1383
- return;
1384
- set((state) => {
1385
- const material = state.materials[id];
1386
- if (!material)
1387
- return state;
1388
- return { materials: { ...state.materials, [id]: { ...material, ...data } } };
1389
- });
1390
- },
1391
- removeSceneMaterial: (id) => {
1392
- if (get().readOnly)
1393
- return;
1394
- set((state) => {
1395
- const materials = { ...state.materials };
1396
- delete materials[id];
1397
- return { materials };
1398
- });
1399
- },
1400
- }), {
1401
- partialize: (state) => sceneHistorySnapshotFromState(state),
1402
- equality: (pastState, currentState) => areSceneSnapshotsEqual({ ...pastState, nodes: withoutSceneAnnotations(pastState.nodes) }, { ...currentState, nodes: withoutSceneAnnotations(currentState.nodes) }),
1403
- onSave: (pastState, currentState) => {
1404
- notifySceneCommit({
1405
- origin: 'local',
1406
- before: sceneHistorySnapshotFromState(pastState),
1407
- current: sceneHistorySnapshotFromState(currentState),
1408
- });
1409
- },
1410
- wrapTemporal: (config) => (set, get, store) => {
1411
- const state = config(set, get, store);
1412
- return {
1413
- ...state,
1414
- undo: (steps = 1) => {
1415
- runSceneWriteGuards();
1416
- return runTemporalJump(get().pastStates.slice().splice(-steps, steps)[0], () => state.undo(steps));
1417
- },
1418
- redo: (steps = 1) => {
1419
- runSceneWriteGuards();
1420
- return runTemporalJump(get().futureStates.slice().splice(-steps, steps)[0], () => state.redo(steps));
1421
- },
1422
- };
1423
- },
1424
- limit: 50, // Limit to last 50 actions
1425
- }));
1458
+ },
1459
+ limit: 50, // Limit to last 50 actions
1460
+ });
1461
+ }
1462
+ const useScene = createSceneStore(liveSceneEnvironment);
1426
1463
  // Live state belongs to the hydration owner so even a lazy consumer cannot
1427
1464
  // miss an override that was set and cleared before its first frame.
1428
1465
  const invalidateForLiveState = () => {
@@ -1574,7 +1611,12 @@ function insertSceneStructuralPlacements(base, placements) {
1574
1611
  }
1575
1612
  return result;
1576
1613
  }
1577
- function sceneOperationPatchNextState(beforeState, changes) {
1614
+ /**
1615
+ * The document a patch makes of `beforeState`, without a store, or null when the patch does not
1616
+ * apply to it (a delete of a node that changed, a create at a taken position, a node that fails
1617
+ * its schema). `applySceneOperationPatch` writes exactly this.
1618
+ */
1619
+ export function nextSceneOperationState(beforeState, changes) {
1578
1620
  const createIds = new Set();
1579
1621
  const deleteIds = new Set();
1580
1622
  const updateIds = new Set();
@@ -1807,7 +1849,7 @@ function sceneOperationPatchNextState(beforeState, changes) {
1807
1849
  };
1808
1850
  }
1809
1851
  export function applySceneOperationPatch(changes, options = {}) {
1810
- runSceneWriteGuards();
1852
+ runSceneWriteGuards(useScene);
1811
1853
  const beforeState = useScene.getState();
1812
1854
  if (changes.nodeUpdates.length === 0 &&
1813
1855
  changes.materialChanges.length === 0 &&
@@ -1842,7 +1884,7 @@ export function applySceneOperationPatch(changes, options = {}) {
1842
1884
  return false;
1843
1885
  if (sceneOperationPatchHasLiveConflict(beforeState, changes))
1844
1886
  return false;
1845
- const next = sceneOperationPatchNextState(beforeState, changes);
1887
+ const next = nextSceneOperationState(beforeState, changes);
1846
1888
  if (!next)
1847
1889
  return false;
1848
1890
  const before = sceneHistorySnapshotFromState(beforeState);
@@ -1935,6 +1977,36 @@ export function applySceneOperationPatch(changes, options = {}) {
1935
1977
  });
1936
1978
  return true;
1937
1979
  }
1980
+ /**
1981
+ * Runs `run` on `store` as one undo step and one commit that carries everything it changed: its
1982
+ * own writes and the history-paused derived writes it settles after them (`reconcileDocument`),
1983
+ * which a commit captured when the first write landed would miss. Collaboration then receives the
1984
+ * derived construction, with its ids, in the same commit as the edit that caused it.
1985
+ */
1986
+ export function runAsSettledSceneStep(store, run) {
1987
+ const environment = sceneEnvironmentOf(store);
1988
+ const snapshot = () => environment.run(() => sceneHistorySnapshotFromState(store.getState()));
1989
+ const before = snapshot();
1990
+ const pastBefore = store.temporal.getState().pastStates.length;
1991
+ return runAsSingleSceneHistoryStep(store, () => {
1992
+ const result = run();
1993
+ const current = snapshot();
1994
+ if (areSceneSnapshotsEqual(before, current))
1995
+ return result;
1996
+ const temporal = store.temporal.getState();
1997
+ // Only paused (derived) writes landed: they still make one step of their own.
1998
+ if (temporal.pastStates.length === pastBefore &&
1999
+ temporal.isTracking &&
2000
+ getSceneHistoryPauseDepth(store) === 0)
2001
+ store.temporal.setState({ pastStates: [...temporal.pastStates, before], futureStates: [] });
2002
+ const changedNodeIds = new Set();
2003
+ for (const id of new Set([...Object.keys(before.nodes), ...Object.keys(current.nodes)]))
2004
+ if (before.nodes[id] !== current.nodes[id])
2005
+ changedNodeIds.add(id);
2006
+ settlePendingSceneCommit(store, { origin: 'local', before, current, changedNodeIds });
2007
+ return result;
2008
+ });
2009
+ }
1938
2010
  export function applyScenePatch(changes) {
1939
2011
  return applySceneOperationPatch({
1940
2012
  ...changes,
@@ -1943,7 +2015,7 @@ export function applyScenePatch(changes) {
1943
2015
  });
1944
2016
  }
1945
2017
  export function applySceneSnapshot(snapshot, options) {
1946
- runSceneWriteGuards();
2018
+ runSceneWriteGuards(useScene);
1947
2019
  const before = sceneHistorySnapshotFromState(useScene.getState());
1948
2020
  const temporalState = useScene.temporal.getState();
1949
2021
  if (!temporalState.isTracking || getSceneHistoryPauseDepth() > 0 || hasSceneHistoryDrafts()) {