@snaptrude/plugin-core 0.3.0 → 0.5.0

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 (266) hide show
  1. package/AGENTS.md +130 -48
  2. package/CHANGELOG.md +111 -0
  3. package/api-manifest.full.json +3999 -0
  4. package/api-manifest.json +3845 -0
  5. package/dist/api/core/buildings.d.ts +427 -0
  6. package/dist/api/core/buildings.d.ts.map +1 -0
  7. package/dist/api/core/comment/index.d.ts +230 -0
  8. package/dist/api/core/comment/index.d.ts.map +1 -0
  9. package/dist/api/core/geom/create/index.d.ts +247 -0
  10. package/dist/api/core/geom/create/index.d.ts.map +1 -0
  11. package/dist/api/core/geom/delete/index.d.ts +72 -0
  12. package/dist/api/core/geom/delete/index.d.ts.map +1 -0
  13. package/dist/api/core/geom/index.d.ts +24 -23
  14. package/dist/api/core/geom/index.d.ts.map +1 -1
  15. package/dist/api/core/geom/query/arc.d.ts +169 -0
  16. package/dist/api/core/geom/query/arc.d.ts.map +1 -0
  17. package/dist/api/core/geom/query/brep.d.ts +402 -0
  18. package/dist/api/core/geom/query/brep.d.ts.map +1 -0
  19. package/dist/api/core/geom/query/circle.d.ts +378 -0
  20. package/dist/api/core/geom/query/circle.d.ts.map +1 -0
  21. package/dist/api/core/geom/query/contour.d.ts +450 -0
  22. package/dist/api/core/geom/query/contour.d.ts.map +1 -0
  23. package/dist/api/core/geom/query/curve.d.ts +918 -0
  24. package/dist/api/core/geom/query/curve.d.ts.map +1 -0
  25. package/dist/api/core/geom/query/edge.d.ts +128 -0
  26. package/dist/api/core/geom/query/edge.d.ts.map +1 -0
  27. package/dist/api/core/geom/query/face.d.ts +363 -0
  28. package/dist/api/core/geom/query/face.d.ts.map +1 -0
  29. package/dist/api/core/geom/query/halfedge.d.ts +206 -0
  30. package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
  31. package/dist/api/core/geom/query/index.d.ts +61 -0
  32. package/dist/api/core/geom/query/index.d.ts.map +1 -0
  33. package/dist/api/core/geom/query/profile.d.ts +410 -0
  34. package/dist/api/core/geom/query/profile.d.ts.map +1 -0
  35. package/dist/api/core/geom/query/vertex.d.ts +187 -0
  36. package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
  37. package/dist/api/core/geom/update/contour.d.ts +272 -0
  38. package/dist/api/core/geom/update/contour.d.ts.map +1 -0
  39. package/dist/api/core/geom/update/curve.d.ts +180 -0
  40. package/dist/api/core/geom/update/curve.d.ts.map +1 -0
  41. package/dist/api/core/geom/update/index.d.ts +27 -0
  42. package/dist/api/core/geom/update/index.d.ts.map +1 -0
  43. package/dist/api/core/geom/update/profile.d.ts +329 -0
  44. package/dist/api/core/geom/update/profile.d.ts.map +1 -0
  45. package/dist/api/core/groups.d.ts +485 -0
  46. package/dist/api/core/groups.d.ts.map +1 -0
  47. package/dist/api/core/history/index.d.ts +78 -0
  48. package/dist/api/core/history/index.d.ts.map +1 -0
  49. package/dist/api/core/index.d.ts +46 -1
  50. package/dist/api/core/index.d.ts.map +1 -1
  51. package/dist/api/core/layers.d.ts +402 -0
  52. package/dist/api/core/layers.d.ts.map +1 -0
  53. package/dist/api/core/math/quat.d.ts +111 -128
  54. package/dist/api/core/math/quat.d.ts.map +1 -1
  55. package/dist/api/core/math/vec3.d.ts +120 -102
  56. package/dist/api/core/math/vec3.d.ts.map +1 -1
  57. package/dist/api/core/project/index.d.ts +399 -0
  58. package/dist/api/core/project/index.d.ts.map +1 -0
  59. package/dist/api/core/tags.d.ts +755 -0
  60. package/dist/api/core/tags.d.ts.map +1 -0
  61. package/dist/api/core/units/index.d.ts +175 -0
  62. package/dist/api/core/units/index.d.ts.map +1 -0
  63. package/dist/api/core/zoom/index.d.ts +45 -0
  64. package/dist/api/core/zoom/index.d.ts.map +1 -0
  65. package/dist/api/design/boolean/index.d.ts +168 -0
  66. package/dist/api/design/boolean/index.d.ts.map +1 -0
  67. package/dist/api/design/create/index.d.ts +828 -0
  68. package/dist/api/design/create/index.d.ts.map +1 -0
  69. package/dist/api/design/delete/index.d.ts +63 -0
  70. package/dist/api/design/delete/index.d.ts.map +1 -0
  71. package/dist/api/design/doors/index.d.ts +268 -0
  72. package/dist/api/design/doors/index.d.ts.map +1 -0
  73. package/dist/api/design/edit/index.d.ts +49 -0
  74. package/dist/api/design/edit/index.d.ts.map +1 -0
  75. package/dist/api/design/erase/index.d.ts +160 -0
  76. package/dist/api/design/erase/index.d.ts.map +1 -0
  77. package/dist/api/design/furniture/index.d.ts +123 -0
  78. package/dist/api/design/furniture/index.d.ts.map +1 -0
  79. package/dist/api/design/index.d.ts +153 -0
  80. package/dist/api/design/index.d.ts.map +1 -0
  81. package/dist/api/design/lock.d.ts +41 -0
  82. package/dist/api/design/lock.d.ts.map +1 -0
  83. package/dist/api/design/materials/index.d.ts +297 -0
  84. package/dist/api/design/materials/index.d.ts.map +1 -0
  85. package/dist/api/design/query/geometry/index.d.ts +140 -0
  86. package/dist/api/design/query/geometry/index.d.ts.map +1 -0
  87. package/dist/api/design/query/index.d.ts +1011 -0
  88. package/dist/api/design/query/index.d.ts.map +1 -0
  89. package/dist/api/design/query/spaces.d.ts +221 -0
  90. package/dist/api/design/query/spaces.d.ts.map +1 -0
  91. package/dist/api/design/selection/index.d.ts +138 -0
  92. package/dist/api/design/selection/index.d.ts.map +1 -0
  93. package/dist/api/design/shared.d.ts +38 -0
  94. package/dist/api/design/shared.d.ts.map +1 -0
  95. package/dist/api/design/transform/index.d.ts +87 -0
  96. package/dist/api/design/transform/index.d.ts.map +1 -0
  97. package/dist/api/design/update/index.d.ts +178 -0
  98. package/dist/api/design/update/index.d.ts.map +1 -0
  99. package/dist/api/design/windows/index.d.ts +189 -0
  100. package/dist/api/design/windows/index.d.ts.map +1 -0
  101. package/dist/api/entity/buildableEnvelope.d.ts +261 -0
  102. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
  103. package/dist/api/entity/department.d.ts +0 -98
  104. package/dist/api/entity/department.d.ts.map +1 -1
  105. package/dist/api/entity/index.d.ts +9 -9
  106. package/dist/api/entity/index.d.ts.map +1 -1
  107. package/dist/api/entity/referenceLine.d.ts +49 -106
  108. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  109. package/dist/api/entity/space.d.ts +482 -249
  110. package/dist/api/entity/space.d.ts.map +1 -1
  111. package/dist/api/entity/story.d.ts +49 -39
  112. package/dist/api/entity/story.d.ts.map +1 -1
  113. package/dist/api/index.d.ts +17 -12
  114. package/dist/api/index.d.ts.map +1 -1
  115. package/dist/api/presentation/aiInspiration.d.ts +440 -0
  116. package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
  117. package/dist/api/presentation/diagrams.d.ts +81 -0
  118. package/dist/api/presentation/diagrams.d.ts.map +1 -0
  119. package/dist/api/presentation/import.d.ts +113 -0
  120. package/dist/api/presentation/import.d.ts.map +1 -0
  121. package/dist/api/presentation/index.d.ts +46 -0
  122. package/dist/api/presentation/index.d.ts.map +1 -0
  123. package/dist/api/presentation/sheets.d.ts +176 -0
  124. package/dist/api/presentation/sheets.d.ts.map +1 -0
  125. package/dist/api/presentation/views.d.ts +296 -0
  126. package/dist/api/presentation/views.d.ts.map +1 -0
  127. package/dist/api/program/adjacency.d.ts +155 -0
  128. package/dist/api/program/adjacency.d.ts.map +1 -0
  129. package/dist/api/program/areas.d.ts +360 -0
  130. package/dist/api/program/areas.d.ts.map +1 -0
  131. package/dist/api/program/classification.d.ts +135 -0
  132. package/dist/api/program/classification.d.ts.map +1 -0
  133. package/dist/api/program/cores.d.ts +174 -0
  134. package/dist/api/program/cores.d.ts.map +1 -0
  135. package/dist/api/program/departments.d.ts +431 -0
  136. package/dist/api/program/departments.d.ts.map +1 -0
  137. package/dist/api/program/index.d.ts +69 -0
  138. package/dist/api/program/index.d.ts.map +1 -0
  139. package/dist/api/program/layout.d.ts +63 -0
  140. package/dist/api/program/layout.d.ts.map +1 -0
  141. package/dist/api/program/metrics.d.ts +108 -0
  142. package/dist/api/program/metrics.d.ts.map +1 -0
  143. package/dist/api/program/site.d.ts +367 -0
  144. package/dist/api/program/site.d.ts.map +1 -0
  145. package/dist/api/program/spreadsheet.d.ts +2041 -0
  146. package/dist/api/program/spreadsheet.d.ts.map +1 -0
  147. package/dist/handles.d.ts +138 -0
  148. package/dist/handles.d.ts.map +1 -0
  149. package/dist/host-utils.d.ts +7 -5
  150. package/dist/host-utils.d.ts.map +1 -1
  151. package/dist/index.cjs +4001 -904
  152. package/dist/index.cjs.map +1 -1
  153. package/dist/index.d.ts +1 -0
  154. package/dist/index.d.ts.map +1 -1
  155. package/dist/index.js +3392 -870
  156. package/dist/index.js.map +1 -1
  157. package/package.json +6 -2
  158. package/scripts/generate-manifest.mjs +193 -0
  159. package/scripts/generate-manifest.test.mjs +193 -0
  160. package/src/api/core/buildings.ts +485 -0
  161. package/src/api/core/comment/index.ts +258 -0
  162. package/src/api/core/geom/create/index.ts +293 -0
  163. package/src/api/core/geom/delete/index.ts +78 -0
  164. package/src/api/core/geom/index.ts +24 -23
  165. package/src/api/core/geom/query/arc.ts +169 -0
  166. package/src/api/core/geom/query/brep.ts +444 -0
  167. package/src/api/core/geom/query/circle.ts +404 -0
  168. package/src/api/core/geom/query/contour.ts +540 -0
  169. package/src/api/core/geom/query/curve.ts +1078 -0
  170. package/src/api/core/geom/query/edge.ts +130 -0
  171. package/src/api/core/geom/query/face.ts +403 -0
  172. package/src/api/core/geom/query/halfedge.ts +210 -0
  173. package/src/api/core/geom/query/index.ts +63 -0
  174. package/src/api/core/geom/query/profile.ts +473 -0
  175. package/src/api/core/geom/query/vertex.ts +205 -0
  176. package/src/api/core/geom/update/contour.ts +315 -0
  177. package/src/api/core/geom/update/curve.ts +209 -0
  178. package/src/api/core/geom/update/index.ts +29 -0
  179. package/src/api/core/geom/update/profile.ts +377 -0
  180. package/src/api/core/groups.ts +521 -0
  181. package/src/api/core/history/index.ts +84 -0
  182. package/src/api/core/index.ts +46 -1
  183. package/src/api/core/layers.ts +333 -0
  184. package/src/api/core/math/quat.ts +112 -235
  185. package/src/api/core/math/vec3.ts +124 -159
  186. package/src/api/core/project/index.ts +418 -0
  187. package/src/api/core/tags.ts +808 -0
  188. package/src/api/core/units/index.ts +164 -0
  189. package/src/api/core/zoom/index.ts +47 -0
  190. package/src/api/design/boolean/index.ts +179 -0
  191. package/src/api/design/create/index.ts +886 -0
  192. package/src/api/design/delete/index.ts +67 -0
  193. package/src/api/design/doors/index.ts +285 -0
  194. package/src/api/design/edit/index.ts +54 -0
  195. package/src/api/design/erase/index.ts +151 -0
  196. package/src/api/design/furniture/index.ts +130 -0
  197. package/src/api/design/index.ts +162 -0
  198. package/src/api/design/lock.ts +42 -0
  199. package/src/api/design/materials/index.ts +301 -0
  200. package/src/api/design/query/geometry/index.ts +166 -0
  201. package/src/api/design/query/index.ts +937 -0
  202. package/src/api/design/query/spaces.ts +132 -0
  203. package/src/api/design/selection/index.ts +144 -0
  204. package/src/api/design/shared.ts +40 -0
  205. package/src/api/design/transform/index.ts +93 -0
  206. package/src/api/design/update/index.ts +117 -0
  207. package/src/api/design/windows/index.ts +207 -0
  208. package/src/api/entity/buildableEnvelope.ts +318 -0
  209. package/src/api/entity/department.ts +0 -113
  210. package/src/api/entity/index.ts +9 -9
  211. package/src/api/entity/referenceLine.ts +50 -38
  212. package/src/api/entity/space.ts +285 -226
  213. package/src/api/entity/story.ts +53 -42
  214. package/src/api/index.ts +17 -12
  215. package/src/api/presentation/aiInspiration.ts +362 -0
  216. package/src/api/presentation/diagrams.ts +84 -0
  217. package/src/api/presentation/import.ts +112 -0
  218. package/src/api/presentation/index.ts +48 -0
  219. package/src/api/presentation/sheets.ts +198 -0
  220. package/src/api/presentation/views.ts +303 -0
  221. package/src/api/program/adjacency.ts +164 -0
  222. package/src/api/program/areas.ts +335 -0
  223. package/src/api/program/classification.ts +138 -0
  224. package/src/api/program/cores.ts +171 -0
  225. package/src/api/program/departments.ts +465 -0
  226. package/src/api/program/index.ts +71 -0
  227. package/src/api/program/layout.ts +68 -0
  228. package/src/api/program/metrics.ts +120 -0
  229. package/src/api/program/site.ts +326 -0
  230. package/src/api/program/spreadsheet.ts +2075 -0
  231. package/src/handles.ts +148 -0
  232. package/src/host-utils.ts +10 -6
  233. package/src/index.ts +1 -0
  234. package/dist/api/core/geom/arc.d.ts +0 -81
  235. package/dist/api/core/geom/arc.d.ts.map +0 -1
  236. package/dist/api/core/geom/curve.d.ts +0 -70
  237. package/dist/api/core/geom/curve.d.ts.map +0 -1
  238. package/dist/api/core/geom/line.d.ts +0 -56
  239. package/dist/api/core/geom/line.d.ts.map +0 -1
  240. package/dist/api/core/geom/profile.d.ts +0 -121
  241. package/dist/api/core/geom/profile.d.ts.map +0 -1
  242. package/dist/api/tools/copy.d.ts +0 -59
  243. package/dist/api/tools/copy.d.ts.map +0 -1
  244. package/dist/api/tools/index.d.ts +0 -33
  245. package/dist/api/tools/index.d.ts.map +0 -1
  246. package/dist/api/tools/material.d.ts +0 -51
  247. package/dist/api/tools/material.d.ts.map +0 -1
  248. package/dist/api/tools/offset.d.ts +0 -43
  249. package/dist/api/tools/offset.d.ts.map +0 -1
  250. package/dist/api/tools/selection.d.ts +0 -48
  251. package/dist/api/tools/selection.d.ts.map +0 -1
  252. package/dist/api/tools/transform.d.ts +0 -114
  253. package/dist/api/tools/transform.d.ts.map +0 -1
  254. package/dist/api/units/index.d.ts +0 -163
  255. package/dist/api/units/index.d.ts.map +0 -1
  256. package/src/api/core/geom/arc.ts +0 -70
  257. package/src/api/core/geom/curve.ts +0 -41
  258. package/src/api/core/geom/line.ts +0 -53
  259. package/src/api/core/geom/profile.ts +0 -94
  260. package/src/api/tools/copy.ts +0 -55
  261. package/src/api/tools/index.ts +0 -39
  262. package/src/api/tools/material.ts +0 -49
  263. package/src/api/tools/offset.ts +0 -43
  264. package/src/api/tools/selection.ts +0 -51
  265. package/src/api/tools/transform.ts +0 -117
  266. package/src/api/units/index.ts +0 -163
@@ -0,0 +1,132 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { ComponentHandle, ContourHandle } from "../../../handles"
4
+ import { PluginSpaceGetProperty, PluginSpaceGetResult } from "../../entity/space"
5
+
6
+ /**
7
+ * `design.query.spaces.*` — space-specific reads (a space is a room mass).
8
+ *
9
+ * Only the space queries feasible against the engine today are exposed here.
10
+ * `getFloor` / `listBoundingWalls` (space↔wall topology) are deferred — they need
11
+ * engine work that does not exist yet. `listAdjacent` stays deferred because the
12
+ * shipped surfaces already answer it with value semantics: per-space via the
13
+ * `adjacency` field of `design.query.getProperties`, in bulk via
14
+ * `program.adjacency.getMatrix`.
15
+ *
16
+ * Accessed via `snaptrude.design.query.spaces`.
17
+ */
18
+ export abstract class PluginDesignQuerySpacesApi {
19
+ constructor() {}
20
+
21
+ /**
22
+ * Get selected properties of a space — the selective multi-property read.
23
+ *
24
+ * Only the properties listed in `properties` are returned — unlisted
25
+ * properties will be `undefined` in the result. This is the canonical home of
26
+ * the read formerly at `entity.space.get` (now deprecated). Adjacency is not
27
+ * part of this read — it is an entity property: read it via the `adjacency`
28
+ * field of {@linkcode PluginDesignQueryApi.getProperties}.
29
+ *
30
+ * @param space - The space (room mass) to read
31
+ * @param properties - Array of property names to retrieve. See
32
+ * {@linkcode PluginDesignQuerySpacesGetProperty} for available values.
33
+ * @returns A partial {@linkcode PluginDesignQuerySpacesGetResult} containing only
34
+ * the requested properties
35
+ * @throws If the space does not exist or the component is not a space/mass
36
+ *
37
+ * @examplePrompt What is the area of this room?
38
+ * @examplePrompt Get the name, storey and height of the selected space
39
+ * @examplePrompt Which department does this room belong to?
40
+ * @examplePrompt Where is this space positioned on the plan?
41
+ * @examplePrompt Read the room type and dimensions of the selected room
42
+ *
43
+ * # Example
44
+ * ```ts
45
+ * const [space] = await snaptrude.design.query.listSpaces()
46
+ * const info = await snaptrude.design.query.spaces.get(space, ["name", "area", "position"])
47
+ * console.log(info.name, info.area, info.position)
48
+ * ```
49
+ */
50
+ public abstract get(
51
+ space: ComponentHandle,
52
+ properties: PluginDesignQuerySpacesGetArgs["properties"],
53
+ ): PluginApiReturn<PluginDesignQuerySpacesGetResult>
54
+
55
+ /**
56
+ * Get the **footprint** of a space — its bottom-face contour (outer profile +
57
+ * holes) as a reusable {@linkcode ContourHandle}. Equivalent to
58
+ * {@linkcode PluginDesignQueryGeometryApi.getBottomContour} narrowed to spaces.
59
+ *
60
+ * @param space - The space (room mass) to read
61
+ * @returns the footprint {@linkcode ContourHandle}, or `null` if the space has
62
+ * no extractable footprint
63
+ *
64
+ * @examplePrompt Get the footprint of this room
65
+ * @examplePrompt Trace the floor outline of the selected space
66
+ * @examplePrompt What is the plan boundary of this room, including any holes?
67
+ * @examplePrompt Give me the base profile of the selected room mass
68
+ *
69
+ * # Example
70
+ * ```ts
71
+ * const [space] = await snaptrude.design.query.listSpaces()
72
+ * const footprint = await snaptrude.design.query.spaces.getFootprint(space)
73
+ * ```
74
+ */
75
+ public abstract getFootprint(
76
+ space: ComponentHandle,
77
+ ): PluginApiReturn<ContourHandle | null>
78
+ }
79
+
80
+ /**
81
+ * Arguments for {@linkcode PluginDesignQuerySpacesApi.getFootprint}.
82
+ *
83
+ * | Property | Type | Description |
84
+ * |---|---|---|
85
+ * | `space` | {@linkcode ComponentHandle} | The space (room mass) to read |
86
+ */
87
+ export const PluginDesignQueryGetFootprintArgs = z.object({
88
+ space: ComponentHandle,
89
+ })
90
+ export type PluginDesignQueryGetFootprintArgs = z.infer<
91
+ typeof PluginDesignQueryGetFootprintArgs
92
+ >
93
+
94
+ /**
95
+ * Property names readable via {@linkcode PluginDesignQuerySpacesApi.get} — the
96
+ * legacy {@linkcode PluginSpaceGetProperty} set minus `"adjacency"` (adjacency is
97
+ * an entity property: see the `adjacency` field of
98
+ * {@linkcode PluginDesignQueryApi.getProperties}).
99
+ */
100
+ export const PluginDesignQuerySpacesGetProperty =
101
+ PluginSpaceGetProperty.exclude(["adjacency"])
102
+ export type PluginDesignQuerySpacesGetProperty = z.infer<
103
+ typeof PluginDesignQuerySpacesGetProperty
104
+ >
105
+
106
+ /**
107
+ * Arguments for {@linkcode PluginDesignQuerySpacesApi.get}.
108
+ *
109
+ * | Property | Type | Description |
110
+ * |---|---|---|
111
+ * | `space` | {@linkcode ComponentHandle} | The space (room mass) to read |
112
+ * | `properties` | {@linkcode PluginDesignQuerySpacesGetProperty}`[]` | Properties to retrieve |
113
+ */
114
+ export const PluginDesignQuerySpacesGetArgs = z.object({
115
+ space: ComponentHandle,
116
+ properties: z.array(PluginDesignQuerySpacesGetProperty),
117
+ })
118
+ export type PluginDesignQuerySpacesGetArgs = z.infer<
119
+ typeof PluginDesignQuerySpacesGetArgs
120
+ >
121
+
122
+ /**
123
+ * Result of {@linkcode PluginDesignQuerySpacesApi.get} — the legacy
124
+ * {@linkcode PluginSpaceGetResult} record minus `adjacency`. Partial: only the
125
+ * requested properties are present.
126
+ */
127
+ export const PluginDesignQuerySpacesGetResult = PluginSpaceGetResult.omit({
128
+ adjacency: true,
129
+ })
130
+ export type PluginDesignQuerySpacesGetResult = z.infer<
131
+ typeof PluginDesignQuerySpacesGetResult
132
+ >
@@ -0,0 +1,144 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { ComponentHandle } from "../../../handles"
4
+ import { PluginDesignChangeResult } from "../lock"
5
+
6
+ /**
7
+ * `snaptrude.design.selection` — read and mutate the current scene selection.
8
+ *
9
+ * Selection targets are {@linkcode ComponentHandle}s. `get` is the one sanctioned
10
+ * `get`-returns-array accessor (§4.1(3)). The mutators (`set`/`add`/`remove`/`clear`)
11
+ * change the live selection and return the resulting selection snapshot — they are
12
+ * **not undoable** (the engine fires a selection listener, no command), so the
13
+ * returned {@linkcode PluginDesignChangeResult} is a committed-state snapshot.
14
+ */
15
+ export abstract class PluginDesignSelectionApi {
16
+ constructor() {}
17
+
18
+ /**
19
+ * Read the current scene selection — the entities the user (or a previous
20
+ * call) has selected, returned as handles you can pass straight into other
21
+ * API calls.
22
+ *
23
+ * @returns The selection as {@linkcode ComponentHandle}`[]` (`[]` when nothing is selected)
24
+ *
25
+ * @examplePrompt What do I have selected right now?
26
+ * @examplePrompt List the currently selected objects
27
+ * @examplePrompt Which rooms are selected in the scene?
28
+ * @examplePrompt Get the ids of everything I've selected
29
+ * @examplePrompt Is anything selected?
30
+ *
31
+ * # Example
32
+ * ```ts
33
+ * // Selection handles feed straight into other API calls
34
+ * const selection = await snaptrude.design.selection.get()
35
+ * if (selection.length > 0) {
36
+ * const props = await snaptrude.design.query.getProperties(selection[0])
37
+ * }
38
+ * ```
39
+ */
40
+ public abstract get(): PluginApiReturn<ComponentHandle[]>
41
+
42
+ /**
43
+ * Replace the selection with exactly the given entities — anything
44
+ * previously selected is deselected first, so afterwards only these
45
+ * entities are selected.
46
+ *
47
+ * @param components The entities to select
48
+ * @returns The resulting selection snapshot
49
+ *
50
+ * @examplePrompt Select these three walls
51
+ * @examplePrompt Select only the kitchen and deselect everything else
52
+ * @examplePrompt Change the selection to just these rooms
53
+ * @examplePrompt Highlight the spaces on the second storey
54
+ *
55
+ * # Example
56
+ * ```ts
57
+ * // Select only the ground-storey walls (replaces the previous selection)
58
+ * const walls = await snaptrude.design.query.listWalls({ storeys: [1] })
59
+ * const { affected } = await snaptrude.design.selection.set(walls)
60
+ * ```
61
+ */
62
+ public abstract set(components: ComponentHandle[]): PluginApiReturn<PluginDesignChangeResult>
63
+
64
+ /**
65
+ * Add entities to the current selection without deselecting anything — the
66
+ * selection grows to include the given entities alongside whatever was
67
+ * already selected.
68
+ *
69
+ * @param components The entities to add to the selection
70
+ * @returns The resulting selection snapshot
71
+ *
72
+ * @examplePrompt Add the corridor to my current selection
73
+ * @examplePrompt Select these columns too, keeping what's already selected
74
+ * @examplePrompt Also select the roof
75
+ * @examplePrompt Extend the selection to include all the doors on this floor
76
+ *
77
+ * # Example
78
+ * ```ts
79
+ * // Grow the selection to include every roof, keeping what's already selected
80
+ * const roofs = await snaptrude.design.query.listRoofs()
81
+ * await snaptrude.design.selection.add(roofs)
82
+ * ```
83
+ */
84
+ public abstract add(components: ComponentHandle[]): PluginApiReturn<PluginDesignChangeResult>
85
+
86
+ /**
87
+ * Remove entities from the current selection — the given entities are
88
+ * deselected while everything else stays selected.
89
+ *
90
+ * @param components The entities to remove from the selection
91
+ * @returns The resulting selection snapshot
92
+ *
93
+ * @examplePrompt Deselect the stair core but keep the rest selected
94
+ * @examplePrompt Remove these walls from my selection
95
+ * @examplePrompt Take the furniture out of the current selection
96
+ * @examplePrompt Unselect the two smaller rooms
97
+ *
98
+ * # Example
99
+ * ```ts
100
+ * // Deselect the furniture while keeping everything else selected
101
+ * const furniture = await snaptrude.design.query.listFurniture({ isSelected: true })
102
+ * await snaptrude.design.selection.remove(furniture)
103
+ * ```
104
+ */
105
+ public abstract remove(
106
+ components: ComponentHandle[]
107
+ ): PluginApiReturn<PluginDesignChangeResult>
108
+
109
+ /**
110
+ * Clear the selection so nothing is selected (equivalent to `set([])`).
111
+ *
112
+ * @returns The resulting (empty) selection snapshot
113
+ *
114
+ * @examplePrompt Deselect everything
115
+ * @examplePrompt Clear my current selection
116
+ * @examplePrompt Unselect all objects in the scene
117
+ * @examplePrompt Make sure nothing is selected before we start
118
+ *
119
+ * # Example
120
+ * ```ts
121
+ * const { affected } = await snaptrude.design.selection.clear()
122
+ * // affected is the resulting selection — always [] here
123
+ * ```
124
+ */
125
+ public abstract clear(): PluginApiReturn<PluginDesignChangeResult>
126
+ }
127
+
128
+ /**
129
+ * Arguments for {@linkcode PluginDesignSelectionApi.set}.
130
+ *
131
+ * | Property | Type | Description |
132
+ * |---|---|---|
133
+ * | `components` | {@linkcode ComponentHandle}`[]` | The entities to select |
134
+ */
135
+ export const PluginDesignSelectionSetArgs = z.object({
136
+ components: z.array(ComponentHandle),
137
+ })
138
+ export type PluginDesignSelectionSetArgs = z.infer<typeof PluginDesignSelectionSetArgs>
139
+
140
+ export const PluginDesignSelectionAddArgs = PluginDesignSelectionSetArgs
141
+ export type PluginDesignSelectionAddArgs = z.infer<typeof PluginDesignSelectionAddArgs>
142
+
143
+ export const PluginDesignSelectionRemoveArgs = PluginDesignSelectionSetArgs
144
+ export type PluginDesignSelectionRemoveArgs = z.infer<typeof PluginDesignSelectionRemoveArgs>
@@ -0,0 +1,40 @@
1
+ import * as z from "zod"
2
+ import { ComponentHandle } from "../../handles"
3
+
4
+ /**
5
+ * Shared `design.*` operation return records (LLD Part A.3).
6
+ *
7
+ * `PluginDesignChangeResult` (`{ affected }`) is NOT here — it already lives in
8
+ * `./lock` and is reused verbatim by the transform/delete mutators.
9
+ *
10
+ * NOTE: `PluginMirrorAxis` currently lives in `./doors`; its relocation into this
11
+ * shared module is deferred to the transform wave (avoids a doors edit + a
12
+ * double-export while `design.transform` is unwired).
13
+ */
14
+
15
+ /**
16
+ * Result of a CSG boolean op (`design.boolean.union/subtract/intersect`). Grounded
17
+ * in the engine `Boolean3dOperation.resultComponents { toCreate; toDelete }`:
18
+ * `created` are the result masses, `deleted` is every consumed input (for
19
+ * `subtract` this includes BOTH the target AND the tools). Errors throw (RPC
20
+ * rejects); no `Result<>` crosses the boundary.
21
+ */
22
+ export const BooleanOutcome = z.object({
23
+ created: z.array(ComponentHandle),
24
+ deleted: z.array(ComponentHandle),
25
+ })
26
+ export type BooleanOutcome = z.infer<typeof BooleanOutcome>
27
+
28
+ /**
29
+ * Result of `design.edit.offsetSplit` (migrated from `tools.offset`). `createdIds`
30
+ * are the components the offset produced; `deletedIds` are those a split-style
31
+ * offset removed. `offsetValue` is the engine's POST-clamp / post-sign applied
32
+ * distance — the only way a caller learns the actually-applied clamped distance
33
+ * (the shipped `tools.offset` result dropped it).
34
+ */
35
+ export const OffsetSplitOutcome = z.object({
36
+ createdIds: z.array(ComponentHandle),
37
+ deletedIds: z.array(ComponentHandle),
38
+ offsetValue: z.number(),
39
+ })
40
+ export type OffsetSplitOutcome = z.infer<typeof OffsetSplitOutcome>
@@ -0,0 +1,93 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { ComponentHandle, Vec3Handle } from "../../../handles"
4
+ import { PluginDesignChangeResult } from "../lock"
5
+
6
+ /**
7
+ * `snaptrude.design.transform` — rigid transforms on scene entities.
8
+ *
9
+ * Migrated from the removed `tools.transform.*`. All ops are undoable and return
10
+ * {@linkcode PluginDesignChangeResult} `{ affected }`; failures throw (RPC rejects).
11
+ *
12
+ * `mirror` / `getPosition` / `setPosition` (and `scale`, an engine gap) are NOT in
13
+ * this surface yet — they are a later, non-migration pass.
14
+ */
15
+ export abstract class PluginDesignTransformApi {
16
+ constructor() {}
17
+
18
+ /**
19
+ * Translate entities by a **relative** displacement vector (added to the first
20
+ * component's absolute position as the anchor). Undoable.
21
+ *
22
+ * @param components - Entities to move
23
+ * @param displacement - Relative translation as a {@linkcode Vec3Handle}
24
+ * @param options - `is2D`, `trackParentChange`
25
+ * @returns {@linkcode PluginDesignChangeResult}
26
+ *
27
+ * @examplePrompt Move the selected room 5 metres to the right
28
+ * @examplePrompt Shift these walls 3m along the x axis
29
+ * @examplePrompt Nudge this space 500mm north
30
+ * @examplePrompt Translate the furniture block by (10, 0, 5)
31
+ * @examplePrompt Move these masses up one storey
32
+ *
33
+ * # Example
34
+ * ```ts
35
+ * const { vec3 } = snaptrude.core.math
36
+ * await snaptrude.design.transform.move(["space-id"], vec3.new(10, 0, 0))
37
+ * ```
38
+ */
39
+ public abstract move(
40
+ components: ComponentHandle[],
41
+ displacement: Vec3Handle,
42
+ options?: { is2D?: boolean; trackParentChange?: boolean },
43
+ ): PluginApiReturn<PluginDesignChangeResult>
44
+
45
+ /**
46
+ * Rotate entities by a **signed angle in DEGREES**, anchored at the combined
47
+ * bounding-box centre (positive = CCW about +Y). NOTE: unlike the removed
48
+ * `tools.transform.rotate` (radians + caller pivot), this canonical form takes
49
+ * DEGREES and has NO caller pivot — the pivot is always the bbox centre. Undoable.
50
+ *
51
+ * @param components - Entities to rotate
52
+ * @param angleInDegrees - Signed rotation angle in degrees
53
+ * @param options - `axis` (defaults to world +Y), `is2D`
54
+ * @returns {@linkcode PluginDesignChangeResult}
55
+ *
56
+ * @examplePrompt Rotate the selected building 90 degrees
57
+ * @examplePrompt Turn this room 45 degrees clockwise
58
+ * @examplePrompt Spin the furniture block 180 degrees about its centre
59
+ * @examplePrompt Rotate these masses 30 degrees around the vertical axis
60
+ *
61
+ * # Example
62
+ * ```ts
63
+ * await snaptrude.design.transform.rotate(["space-id"], 90)
64
+ * ```
65
+ */
66
+ public abstract rotate(
67
+ components: ComponentHandle[],
68
+ angleInDegrees: number,
69
+ options?: { axis?: Vec3Handle; is2D?: boolean },
70
+ ): PluginApiReturn<PluginDesignChangeResult>
71
+ }
72
+
73
+ /**
74
+ * Arguments for {@linkcode PluginDesignTransformApi.move} (options flattened).
75
+ */
76
+ export const PluginDesignMoveArgs = z.object({
77
+ components: z.array(ComponentHandle).min(1),
78
+ displacement: Vec3Handle,
79
+ is2D: z.boolean().optional(),
80
+ trackParentChange: z.boolean().optional(),
81
+ })
82
+ export type PluginDesignMoveArgs = z.infer<typeof PluginDesignMoveArgs>
83
+
84
+ /**
85
+ * Arguments for {@linkcode PluginDesignTransformApi.rotate} (options flattened).
86
+ */
87
+ export const PluginDesignRotateArgs = z.object({
88
+ components: z.array(ComponentHandle).min(1),
89
+ angleInDegrees: z.number(),
90
+ axis: Vec3Handle.optional(),
91
+ is2D: z.boolean().optional(),
92
+ })
93
+ export type PluginDesignRotateArgs = z.infer<typeof PluginDesignRotateArgs>
@@ -0,0 +1,117 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { ComponentHandle, ProfileHandle } from "../../../handles"
4
+ import {
5
+ PluginSpaceType,
6
+ PluginMassType,
7
+ PluginDepartmentId,
8
+ PluginAreaClass,
9
+ PluginSpaceUpdateResult,
10
+ } from "../../entity/space"
11
+
12
+ /**
13
+ * Sparse property updates for a space. Only provided fields change.
14
+ *
15
+ * | Property | Type | Description |
16
+ * |---|---|---|
17
+ * | `room_type` | `string`? | Room label |
18
+ * | `massType` | `PluginMassType`? | Mass type |
19
+ * | `spaceType` | `PluginSpaceType`? | Space type |
20
+ * | `areaClass` | `PluginAreaClass`? | Area class (NET/GROSS/EXCLUDED) |
21
+ * | `departmentId` | `PluginDepartmentId`? | Department |
22
+ */
23
+ export const PluginSpacePropertyUpdates = z.object({
24
+ room_type: z.string().optional(),
25
+ massType: PluginMassType.optional(),
26
+ spaceType: PluginSpaceType.optional(),
27
+ areaClass: PluginAreaClass.optional(),
28
+ departmentId: PluginDepartmentId.optional(),
29
+ })
30
+ export type PluginSpacePropertyUpdates = z.infer<typeof PluginSpacePropertyUpdates>
31
+
32
+ /** Geometry replacement for a space — re-extrude a profile. */
33
+ export const PluginSpaceGeometryUpdate = z.object({
34
+ profile: ProfileHandle,
35
+ extrudeHeight: z.number(),
36
+ })
37
+ export type PluginSpaceGeometryUpdate = z.infer<typeof PluginSpaceGeometryUpdate>
38
+
39
+ /** One space to update via {@linkcode PluginDesignUpdateApi.spaces}. */
40
+ export const PluginUpdateSpaceItem = z.object({
41
+ space: ComponentHandle,
42
+ properties: PluginSpacePropertyUpdates.optional(),
43
+ geometry: PluginSpaceGeometryUpdate.optional(),
44
+ })
45
+ export type PluginUpdateSpaceItem = z.infer<typeof PluginUpdateSpaceItem>
46
+
47
+ /**
48
+ * `snaptrude.design.update` — edit existing scene entities (properties + geometry).
49
+ *
50
+ * Migrated from the removed `entity.space.{update, updateGeometryFromProfile, bulkUpdate}`.
51
+ * Only provided fields change; each call is undoable. Failures throw (RPC rejects).
52
+ */
53
+ export abstract class PluginDesignUpdateApi {
54
+ constructor() {}
55
+
56
+ /**
57
+ * Update a single space (room) — change its properties (room label, space
58
+ * type, mass type, area class, department) and/or replace its geometry by
59
+ * re-extruding a profile to a new height. Sparse and undoable: only the
60
+ * fields you provide change.
61
+ *
62
+ * @param space - The space to update
63
+ * @param options - `properties` (sparse) and/or `geometry` ({ profile, extrudeHeight })
64
+ * @returns the updated space's echoed {@linkcode PluginSpaceUpdateResult}
65
+ *
66
+ * @examplePrompt Rename this room to Office
67
+ * @examplePrompt Change this space's room type to Meeting Room
68
+ * @examplePrompt Set the height of this room to 3 metres
69
+ * @examplePrompt Move this space into the Circulation department
70
+ * @examplePrompt Exclude this room from the area calculations
71
+ *
72
+ * # Example
73
+ * ```ts
74
+ * await snaptrude.design.update.space("space-id", { properties: { room_type: "Office" } })
75
+ * ```
76
+ */
77
+ public abstract space(
78
+ space: ComponentHandle,
79
+ options: {
80
+ properties?: PluginSpacePropertyUpdates
81
+ geometry?: PluginSpaceGeometryUpdate
82
+ },
83
+ ): PluginApiReturn<PluginSpaceUpdateResult>
84
+
85
+ /**
86
+ * Update many spaces (rooms) in one undoable operation — the bulk form of
87
+ * {@linkcode space}. Each item pairs a space with the sparse property
88
+ * changes and/or geometry re-extrude to apply; every item is validated up
89
+ * front, then all changes are applied as a single command.
90
+ *
91
+ * Migrated from `entity.space.bulkUpdate`.
92
+ *
93
+ * @param items - One {@linkcode PluginUpdateSpaceItem} per space
94
+ * @returns one {@linkcode PluginSpaceUpdateResult} per item, in input order
95
+ *
96
+ * @examplePrompt Label all the selected rooms as Bedrooms
97
+ * @examplePrompt Change the room type of these five spaces at once
98
+ * @examplePrompt Set every room on this floor to a 3m height in one go
99
+ * @examplePrompt Bulk-assign these spaces to the Service department
100
+ * @examplePrompt Mark all of these rooms as excluded from area in one update
101
+ *
102
+ * # Example
103
+ * ```ts
104
+ * // Re-label every selected room and mark it NET area — one undoable bulk update
105
+ * const rooms = await snaptrude.design.query.listSpaces({ isSelected: true })
106
+ * const results = await snaptrude.design.update.spaces(
107
+ * rooms.map((space) => ({
108
+ * space,
109
+ * properties: { room_type: "Bedroom", areaClass: "NET" },
110
+ * })),
111
+ * )
112
+ * // One result per item, in input order
113
+ * console.log(results.map((r) => r.spaceId))
114
+ * ```
115
+ */
116
+ public abstract spaces(items: PluginUpdateSpaceItem[]): PluginApiReturn<PluginSpaceUpdateResult[]>
117
+ }