@snaptrude/plugin-core 0.0.0-dev-20260708130115 → 0.0.0-dev-20260827135706

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 (261) hide show
  1. package/CHANGELOG.md +152 -1
  2. package/api-manifest.json +3620 -276
  3. package/dist/api/analysis/daylight.d.ts +603 -0
  4. package/dist/api/analysis/daylight.d.ts.map +1 -0
  5. package/dist/api/analysis/heatmaps.d.ts +658 -0
  6. package/dist/api/analysis/heatmaps.d.ts.map +1 -0
  7. package/dist/api/analysis/illuminance.d.ts +145 -0
  8. package/dist/api/analysis/illuminance.d.ts.map +1 -0
  9. package/dist/api/analysis/index.d.ts +59 -0
  10. package/dist/api/analysis/index.d.ts.map +1 -0
  11. package/dist/api/analysis/shadows.d.ts +165 -0
  12. package/dist/api/analysis/shadows.d.ts.map +1 -0
  13. package/dist/api/analysis/solar.d.ts +249 -0
  14. package/dist/api/analysis/solar.d.ts.map +1 -0
  15. package/dist/api/analysis/sunlightHours.d.ts +208 -0
  16. package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
  17. package/dist/api/analysis/sunpath.d.ts +80 -0
  18. package/dist/api/analysis/sunpath.d.ts.map +1 -0
  19. package/dist/api/analysis/weather.d.ts +193 -0
  20. package/dist/api/analysis/weather.d.ts.map +1 -0
  21. package/dist/api/core/camera/index.d.ts +261 -0
  22. package/dist/api/core/camera/index.d.ts.map +1 -0
  23. package/dist/api/core/comment/index.d.ts +105 -2
  24. package/dist/api/core/comment/index.d.ts.map +1 -1
  25. package/dist/api/core/geom/create/index.d.ts +840 -14
  26. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  27. package/dist/api/core/geom/delete/index.d.ts +8 -2
  28. package/dist/api/core/geom/delete/index.d.ts.map +1 -1
  29. package/dist/api/core/geom/query/arc.d.ts +5 -5
  30. package/dist/api/core/geom/query/brep.d.ts +130 -18
  31. package/dist/api/core/geom/query/brep.d.ts.map +1 -1
  32. package/dist/api/core/geom/query/circle.d.ts +18 -18
  33. package/dist/api/core/geom/query/contour.d.ts +20 -20
  34. package/dist/api/core/geom/query/curve.d.ts +49 -49
  35. package/dist/api/core/geom/query/edge.d.ts +5 -5
  36. package/dist/api/core/geom/query/face.d.ts +16 -16
  37. package/dist/api/core/geom/query/halfedge.d.ts +8 -8
  38. package/dist/api/core/geom/query/profile.d.ts +19 -19
  39. package/dist/api/core/geom/query/vertex.d.ts +8 -8
  40. package/dist/api/core/geom/update/contour.d.ts +14 -14
  41. package/dist/api/core/geom/update/curve.d.ts +7 -7
  42. package/dist/api/core/geom/update/profile.d.ts +16 -16
  43. package/dist/api/core/handles/index.d.ts +210 -0
  44. package/dist/api/core/handles/index.d.ts.map +1 -0
  45. package/dist/api/core/index.d.ts +34 -0
  46. package/dist/api/core/index.d.ts.map +1 -1
  47. package/dist/api/core/io/export/index.d.ts +134 -0
  48. package/dist/api/core/io/export/index.d.ts.map +1 -0
  49. package/dist/api/core/io/import/index.d.ts +453 -0
  50. package/dist/api/core/io/import/index.d.ts.map +1 -0
  51. package/dist/api/core/io/index.d.ts +40 -0
  52. package/dist/api/core/io/index.d.ts.map +1 -0
  53. package/dist/api/core/io/job/index.d.ts +139 -0
  54. package/dist/api/core/io/job/index.d.ts.map +1 -0
  55. package/dist/api/core/io/query/index.d.ts +74 -0
  56. package/dist/api/core/io/query/index.d.ts.map +1 -0
  57. package/dist/api/core/io/terrain/index.d.ts +341 -0
  58. package/dist/api/core/io/terrain/index.d.ts.map +1 -0
  59. package/dist/api/core/io/underlay/index.d.ts +805 -0
  60. package/dist/api/core/io/underlay/index.d.ts.map +1 -0
  61. package/dist/api/core/layers.d.ts +7 -7
  62. package/dist/api/core/mode/index.d.ts +99 -0
  63. package/dist/api/core/mode/index.d.ts.map +1 -0
  64. package/dist/api/core/project/index.d.ts +68 -1
  65. package/dist/api/core/project/index.d.ts.map +1 -1
  66. package/dist/api/core/proposals/index.d.ts +531 -0
  67. package/dist/api/core/proposals/index.d.ts.map +1 -0
  68. package/dist/api/core/storeys/index.d.ts +265 -0
  69. package/dist/api/core/storeys/index.d.ts.map +1 -0
  70. package/dist/api/core/tags.d.ts +24 -0
  71. package/dist/api/core/tags.d.ts.map +1 -1
  72. package/dist/api/core/user.d.ts +44 -0
  73. package/dist/api/core/user.d.ts.map +1 -0
  74. package/dist/api/core/zoom/index.d.ts +4 -0
  75. package/dist/api/core/zoom/index.d.ts.map +1 -1
  76. package/dist/api/design/boolean/index.d.ts +4 -4
  77. package/dist/api/design/create/index.d.ts +568 -45
  78. package/dist/api/design/create/index.d.ts.map +1 -1
  79. package/dist/api/design/delete/index.d.ts +3 -0
  80. package/dist/api/design/delete/index.d.ts.map +1 -1
  81. package/dist/api/design/doors/index.d.ts +195 -0
  82. package/dist/api/design/doors/index.d.ts.map +1 -1
  83. package/dist/api/design/edit/index.d.ts +1 -1
  84. package/dist/api/design/erase/index.d.ts +2 -2
  85. package/dist/api/design/family.d.ts +349 -0
  86. package/dist/api/design/family.d.ts.map +1 -0
  87. package/dist/api/design/furniture/index.d.ts +181 -8
  88. package/dist/api/design/furniture/index.d.ts.map +1 -1
  89. package/dist/api/design/index.d.ts +98 -0
  90. package/dist/api/design/index.d.ts.map +1 -1
  91. package/dist/api/design/lock.d.ts +26 -0
  92. package/dist/api/design/lock.d.ts.map +1 -1
  93. package/dist/api/design/materials/index.d.ts +270 -16
  94. package/dist/api/design/materials/index.d.ts.map +1 -1
  95. package/dist/api/design/query/geometry/index.d.ts +112 -0
  96. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  97. package/dist/api/design/query/index.d.ts +282 -11
  98. package/dist/api/design/query/index.d.ts.map +1 -1
  99. package/dist/api/design/query/referenceLines.d.ts +45 -0
  100. package/dist/api/design/query/referenceLines.d.ts.map +1 -0
  101. package/dist/api/design/query/spaces.d.ts +181 -8
  102. package/dist/api/design/query/spaces.d.ts.map +1 -1
  103. package/dist/api/design/selection/index.d.ts +144 -0
  104. package/dist/api/design/selection/index.d.ts.map +1 -1
  105. package/dist/api/design/transform/index.d.ts +172 -10
  106. package/dist/api/design/transform/index.d.ts.map +1 -1
  107. package/dist/api/design/types/index.d.ts +181 -0
  108. package/dist/api/design/types/index.d.ts.map +1 -0
  109. package/dist/api/design/update/index.d.ts +553 -2
  110. package/dist/api/design/update/index.d.ts.map +1 -1
  111. package/dist/api/design/visibility.d.ts +126 -0
  112. package/dist/api/design/visibility.d.ts.map +1 -0
  113. package/dist/api/design/windows/index.d.ts +113 -2
  114. package/dist/api/design/windows/index.d.ts.map +1 -1
  115. package/dist/api/entity/buildableEnvelope.d.ts +4 -0
  116. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  117. package/dist/api/entity/referenceLine.d.ts +10 -2
  118. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  119. package/dist/api/entity/space.d.ts +21 -21
  120. package/dist/api/entity/story.d.ts +242 -15
  121. package/dist/api/entity/story.d.ts.map +1 -1
  122. package/dist/api/index.d.ts +10 -0
  123. package/dist/api/index.d.ts.map +1 -1
  124. package/dist/api/presentation/aiInspiration.d.ts +25 -25
  125. package/dist/api/presentation/annotate.d.ts +467 -0
  126. package/dist/api/presentation/annotate.d.ts.map +1 -0
  127. package/dist/api/presentation/diagrams.d.ts +111 -8
  128. package/dist/api/presentation/diagrams.d.ts.map +1 -1
  129. package/dist/api/presentation/export.d.ts +108 -0
  130. package/dist/api/presentation/export.d.ts.map +1 -0
  131. package/dist/api/presentation/import.d.ts +55 -4
  132. package/dist/api/presentation/import.d.ts.map +1 -1
  133. package/dist/api/presentation/index.d.ts +58 -1
  134. package/dist/api/presentation/index.d.ts.map +1 -1
  135. package/dist/api/presentation/placedViews.d.ts +1139 -0
  136. package/dist/api/presentation/placedViews.d.ts.map +1 -0
  137. package/dist/api/presentation/shapes.d.ts +481 -0
  138. package/dist/api/presentation/shapes.d.ts.map +1 -0
  139. package/dist/api/presentation/sheets.d.ts +452 -13
  140. package/dist/api/presentation/sheets.d.ts.map +1 -1
  141. package/dist/api/presentation/slideshow.d.ts +125 -0
  142. package/dist/api/presentation/slideshow.d.ts.map +1 -0
  143. package/dist/api/presentation/tables.d.ts +81 -0
  144. package/dist/api/presentation/tables.d.ts.map +1 -0
  145. package/dist/api/presentation/views.d.ts +367 -7
  146. package/dist/api/presentation/views.d.ts.map +1 -1
  147. package/dist/api/program/areas.d.ts +102 -12
  148. package/dist/api/program/areas.d.ts.map +1 -1
  149. package/dist/api/program/cores.d.ts +3 -99
  150. package/dist/api/program/cores.d.ts.map +1 -1
  151. package/dist/api/program/index.d.ts +7 -15
  152. package/dist/api/program/index.d.ts.map +1 -1
  153. package/dist/api/program/layout.d.ts +346 -11
  154. package/dist/api/program/layout.d.ts.map +1 -1
  155. package/dist/api/program/site.d.ts +469 -13
  156. package/dist/api/program/site.d.ts.map +1 -1
  157. package/dist/api/program/spreadsheet.d.ts +365 -41
  158. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  159. package/dist/api/workspace/index.d.ts +505 -0
  160. package/dist/api/workspace/index.d.ts.map +1 -0
  161. package/dist/errors/codes.d.ts +34 -0
  162. package/dist/errors/codes.d.ts.map +1 -0
  163. package/dist/errors/envelope.d.ts +56 -0
  164. package/dist/errors/envelope.d.ts.map +1 -0
  165. package/dist/errors/index.d.ts +6 -0
  166. package/dist/errors/index.d.ts.map +1 -0
  167. package/dist/errors/plugin-error.d.ts +69 -0
  168. package/dist/errors/plugin-error.d.ts.map +1 -0
  169. package/dist/handles.d.ts +97 -25
  170. package/dist/handles.d.ts.map +1 -1
  171. package/dist/host-utils.d.ts +4 -0
  172. package/dist/host-utils.d.ts.map +1 -1
  173. package/dist/index.cjs +4582 -1422
  174. package/dist/index.cjs.map +1 -1
  175. package/dist/index.d.ts +1 -0
  176. package/dist/index.d.ts.map +1 -1
  177. package/dist/index.js +4171 -1411
  178. package/dist/index.js.map +1 -1
  179. package/package.json +4 -2
  180. package/scripts/generate-manifest.mjs +45 -0
  181. package/scripts/generate-manifest.test.mjs +103 -4
  182. package/src/api/analysis/daylight.ts +470 -0
  183. package/src/api/analysis/heatmaps.ts +683 -0
  184. package/src/api/analysis/illuminance.ts +155 -0
  185. package/src/api/analysis/index.ts +61 -0
  186. package/src/api/analysis/shadows.ts +183 -0
  187. package/src/api/analysis/solar.ts +237 -0
  188. package/src/api/analysis/sunlightHours.ts +211 -0
  189. package/src/api/analysis/sunpath.ts +83 -0
  190. package/src/api/analysis/weather.ts +179 -0
  191. package/src/api/core/camera/index.ts +268 -0
  192. package/src/api/core/comment/index.ts +120 -2
  193. package/src/api/core/geom/create/index.ts +912 -1
  194. package/src/api/core/geom/delete/index.ts +6 -0
  195. package/src/api/core/geom/query/brep.ts +119 -0
  196. package/src/api/core/handles/index.ts +233 -0
  197. package/src/api/core/index.ts +34 -0
  198. package/src/api/core/io/export/index.ts +126 -0
  199. package/src/api/core/io/import/index.ts +496 -0
  200. package/src/api/core/io/index.ts +42 -0
  201. package/src/api/core/io/job/index.ts +140 -0
  202. package/src/api/core/io/query/index.ts +71 -0
  203. package/src/api/core/io/terrain/index.ts +360 -0
  204. package/src/api/core/io/underlay/index.ts +705 -0
  205. package/src/api/core/mode/index.ts +96 -0
  206. package/src/api/core/project/index.ts +62 -1
  207. package/src/api/core/proposals/index.ts +569 -0
  208. package/src/api/core/storeys/index.ts +294 -0
  209. package/src/api/core/tags.ts +27 -0
  210. package/src/api/core/user.ts +46 -0
  211. package/src/api/core/zoom/index.ts +4 -0
  212. package/src/api/design/create/index.ts +670 -30
  213. package/src/api/design/delete/index.ts +3 -0
  214. package/src/api/design/doors/index.ts +208 -0
  215. package/src/api/design/erase/index.ts +1 -1
  216. package/src/api/design/family.ts +388 -0
  217. package/src/api/design/furniture/index.ts +197 -8
  218. package/src/api/design/index.ts +102 -0
  219. package/src/api/design/lock.ts +27 -0
  220. package/src/api/design/materials/index.ts +334 -27
  221. package/src/api/design/query/geometry/index.ts +125 -3
  222. package/src/api/design/query/index.ts +217 -7
  223. package/src/api/design/query/referenceLines.ts +52 -0
  224. package/src/api/design/query/spaces.ts +143 -0
  225. package/src/api/design/selection/index.ts +129 -0
  226. package/src/api/design/transform/index.ts +170 -9
  227. package/src/api/design/types/index.ts +156 -0
  228. package/src/api/design/update/index.ts +631 -3
  229. package/src/api/design/visibility.ts +143 -0
  230. package/src/api/design/windows/index.ts +128 -2
  231. package/src/api/entity/buildableEnvelope.ts +4 -0
  232. package/src/api/entity/referenceLine.ts +8 -0
  233. package/src/api/entity/story.ts +259 -15
  234. package/src/api/index.ts +10 -0
  235. package/src/api/presentation/annotate.ts +385 -0
  236. package/src/api/presentation/diagrams.ts +118 -8
  237. package/src/api/presentation/export.ts +108 -0
  238. package/src/api/presentation/import.ts +51 -4
  239. package/src/api/presentation/index.ts +66 -1
  240. package/src/api/presentation/placedViews.ts +1120 -0
  241. package/src/api/presentation/shapes.ts +274 -0
  242. package/src/api/presentation/sheets.ts +400 -13
  243. package/src/api/presentation/slideshow.ts +134 -0
  244. package/src/api/presentation/tables.ts +84 -0
  245. package/src/api/presentation/views.ts +376 -8
  246. package/src/api/program/areas.ts +88 -15
  247. package/src/api/program/cores.ts +3 -91
  248. package/src/api/program/index.ts +7 -15
  249. package/src/api/program/layout.ts +365 -11
  250. package/src/api/program/site.ts +435 -13
  251. package/src/api/program/spreadsheet.ts +376 -35
  252. package/src/api/workspace/index.ts +563 -0
  253. package/src/errors/codes.ts +136 -0
  254. package/src/errors/envelope.ts +75 -0
  255. package/src/errors/index.ts +21 -0
  256. package/src/errors/plugin-error.ts +134 -0
  257. package/src/handles.ts +123 -13
  258. package/src/host-utils.ts +4 -0
  259. package/src/index.ts +1 -0
  260. package/test/errors.test.mjs +184 -0
  261. package/tsconfig.json +7 -2
@@ -6,11 +6,13 @@ import { PluginDesignChangeResult } from "../lock"
6
6
  /**
7
7
  * `snaptrude.design.transform` — rigid transforms on scene entities.
8
8
  *
9
- * Migrated from the removed `tools.transform.*`. All ops are undoable and return
9
+ * `move` / `rotate` migrated from the removed `tools.transform.*`; `align` snaps a
10
+ * set of components' bounding-box edges to each other (or to a reference); `mirror`
11
+ * flips components in place about a horizontal axis. All ops are undoable and return
10
12
  * {@linkcode PluginDesignChangeResult} `{ affected }`; failures throw (RPC rejects).
11
13
  *
12
- * `mirror` / `getPosition` / `setPosition` (and `scale`, an engine gap) are NOT in
13
- * this surface yet — they are a later, non-migration pass.
14
+ * `getPosition` / `setPosition` (and `scale`, an engine gap) are NOT in this surface
15
+ * yet — they are a later pass.
14
16
  */
15
17
  export abstract class PluginDesignTransformApi {
16
18
  constructor() {}
@@ -30,6 +32,9 @@ export abstract class PluginDesignTransformApi {
30
32
  * @examplePrompt Translate the furniture block by (10, 0, 5)
31
33
  * @examplePrompt Move these masses up one storey
32
34
  *
35
+ * @performance Array API — one host round-trip for the whole set. Pass every target in a
36
+ * single call; never loop `design.transform.move` per entity.
37
+ *
33
38
  * # Example
34
39
  * ```ts
35
40
  * const { vec3 } = snaptrude.core.math
@@ -43,33 +48,158 @@ export abstract class PluginDesignTransformApi {
43
48
  ): PluginApiReturn<PluginDesignChangeResult>
44
49
 
45
50
  /**
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.
51
+ * Rotate entities by a **signed angle in DEGREES** (positive = CCW about +Y).
52
+ * The pivot defaults to the combined bounding-box centre; pass `options.pivot`
53
+ * to rotate about an explicit world-space point instead. NOTE: unlike the
54
+ * removed `tools.transform.rotate` (radians), this canonical form takes
55
+ * DEGREES. Undoable.
50
56
  *
51
57
  * @param components - Entities to rotate
52
58
  * @param angleInDegrees - Signed rotation angle in degrees
53
- * @param options - `axis` (defaults to world +Y), `is2D`
59
+ * @param options - `axis` (defaults to world +Y), `pivot` (world-space rotation
60
+ * centre as a {@linkcode Vec3Handle}; defaults to the combined bbox centre),
61
+ * `is2D`
54
62
  * @returns {@linkcode PluginDesignChangeResult}
55
63
  *
56
64
  * @examplePrompt Rotate the selected building 90 degrees
57
65
  * @examplePrompt Turn this room 45 degrees clockwise
58
66
  * @examplePrompt Spin the furniture block 180 degrees about its centre
59
67
  * @examplePrompt Rotate these masses 30 degrees around the vertical axis
68
+ * @examplePrompt Rotate these walls 90 degrees about the origin
69
+ *
70
+ * @performance Array API — one host round-trip for the whole set. Pass every target in a
71
+ * single call; never loop `design.transform.rotate` per entity.
60
72
  *
61
73
  * # Example
62
74
  * ```ts
63
75
  * await snaptrude.design.transform.rotate(["space-id"], 90)
76
+ * // …or rotate about an explicit pivot point
77
+ * const { vec3 } = snaptrude.core.math
78
+ * await snaptrude.design.transform.rotate(["space-id"], 90, { pivot: vec3.new(0, 0, 0) })
64
79
  * ```
65
80
  */
66
81
  public abstract rotate(
67
82
  components: ComponentHandle[],
68
83
  angleInDegrees: number,
69
- options?: { axis?: Vec3Handle; is2D?: boolean },
84
+ options?: { axis?: Vec3Handle; pivot?: Vec3Handle; is2D?: boolean },
85
+ ): PluginApiReturn<PluginDesignChangeResult>
86
+
87
+ /**
88
+ * Align a set of components by snapping one bounding-box edge to a common value
89
+ * — the classic Left/Center/Right/Top/Middle/Bottom align. Purely **world-axis**
90
+ * (deterministic and headless — the UI's camera-relative remap is bypassed):
91
+ *
92
+ * - `left` / `right` / `center` → world **X** min / max / mid
93
+ * - `top` / `bottom` / `middle` → world **Z** max / min / mid
94
+ *
95
+ * There is **no vertical (Y) alignment** in v1 (the UI only reaches it via a
96
+ * side-elevation camera remap, which this API does not replicate). Doors and
97
+ * windows are **rejected** in v1 — if any component in `components` (or the
98
+ * `reference`) is a door or window, the whole call **throws**; nothing is
99
+ * silently dropped. A group aligns as **one rigid body** (its whole-group
100
+ * bounding box moves together). Undoable.
101
+ *
102
+ * Requires **at least 2 components** unless a `reference` is supplied; with a
103
+ * reference, every component aligns to that reference's edge (the reference does
104
+ * not move) and a single component is allowed. Y (height) is preserved.
105
+ *
106
+ * @param components - Entities to align (≥2 without a `reference`)
107
+ * @param edge - Which bounding-box edge to snap ({@linkcode PluginAlignEdge})
108
+ * @param options - `reference`: a component whose edge is the fixed target
109
+ * @returns {@linkcode PluginDesignChangeResult}
110
+ *
111
+ * @examplePrompt Align the selected rooms to the left
112
+ * @examplePrompt Line up these masses along their top edges
113
+ * @examplePrompt Center these columns horizontally
114
+ * @examplePrompt Align all the walls to the left edge of this reference wall
115
+ * @examplePrompt Snap the bottom edges of these spaces together
116
+ *
117
+ * @performance Array API — one host round-trip for the whole set. Pass every target in a
118
+ * single call; never loop `design.transform.align` per entity.
119
+ *
120
+ * # Example
121
+ * ```ts
122
+ * const rooms = await snaptrude.design.selection.get()
123
+ * // align every room's left (world -X) edge to a common minimum
124
+ * await snaptrude.design.transform.align(rooms, "left")
125
+ * // …or align them to a fixed reference component's left edge
126
+ * const [anchor] = await snaptrude.design.query.listWalls({ storeys: [1] })
127
+ * await snaptrude.design.transform.align(rooms, "left", { reference: anchor })
128
+ * ```
129
+ */
130
+ public abstract align(
131
+ components: ComponentHandle[],
132
+ edge: PluginAlignEdge,
133
+ options?: { reference?: ComponentHandle },
134
+ ): PluginApiReturn<PluginDesignChangeResult>
135
+
136
+ /**
137
+ * Mirror components **in place** about a horizontal axis, flipping their geometry
138
+ * across that axis through the combined bounding-box centre (the mesh's
139
+ * world-matrix flip + brep inversion + CAD/dimension-line/parametric handling
140
+ * commit atomically). Nothing moves off-centre — this is the toolbar "flip", not
141
+ * a translate-and-reflect. Undoable.
142
+ *
143
+ * `axis` names the axis the geometry mirrors **across** (world axes, Y is up):
144
+ * - `'x'` — mirror across world X (a front↔back flip in plan; reflects the Z coord)
145
+ * - `'z'` — mirror across world Z (a left↔right flip in plan; reflects the X coord)
146
+ *
147
+ * Vertical (`'y'`) mirroring is intentionally not exposed. Locked, bucket-locked
148
+ * and ineligible entries (terrain, plinths, reference/dimension lines,
149
+ * neighbourhood buildings) are **silently dropped**; the call only throws if
150
+ * nothing mirrorable remains. `affected` echoes the supplied handles.
151
+ *
152
+ * @param components - Entities to mirror (≥1)
153
+ * @param axis - Axis to mirror across ({@linkcode PluginTransformMirrorAxis})
154
+ * @returns {@linkcode PluginDesignChangeResult}
155
+ *
156
+ * @examplePrompt Mirror the selected building across the x axis
157
+ * @examplePrompt Flip these rooms left to right
158
+ * @examplePrompt Mirror this furniture block horizontally
159
+ * @examplePrompt Flip the selected walls front to back
160
+ * @examplePrompt Create a mirror image of these masses about the z axis
161
+ *
162
+ * @performance Array API — one host round-trip for the whole set. Pass every target in a
163
+ * single call; never loop `design.transform.mirror` per entity.
164
+ *
165
+ * # Example
166
+ * ```ts
167
+ * const rooms = await snaptrude.design.selection.get()
168
+ * await snaptrude.design.transform.mirror(rooms, "x")
169
+ * ```
170
+ */
171
+ public abstract mirror(
172
+ components: ComponentHandle[],
173
+ axis: PluginTransformMirrorAxis,
70
174
  ): PluginApiReturn<PluginDesignChangeResult>
71
175
  }
72
176
 
177
+ /**
178
+ * The horizontal axis a {@linkcode PluginDesignTransformApi.mirror} flips **across**
179
+ * (world axes, Y up): `'x'` mirrors across world X (front↔back in plan; reflects Z),
180
+ * `'z'` mirrors across world Z (left↔right in plan; reflects X). Vertical (`'y'`)
181
+ * mirroring is not exposed.
182
+ */
183
+ export const PluginTransformMirrorAxis = z.enum(["x", "z"])
184
+ export type PluginTransformMirrorAxis = z.infer<
185
+ typeof PluginTransformMirrorAxis
186
+ >
187
+
188
+ /**
189
+ * The bounding-box edge an {@linkcode PluginDesignTransformApi.align} snaps to.
190
+ * Mirrors the engine's align `DirectionType`. World-axis mapping: `left`/`right`/`center`
191
+ * → world X min/max/mid; `top`/`bottom`/`middle` → world Z max/min/mid.
192
+ */
193
+ export const PluginAlignEdge = z.enum([
194
+ "left",
195
+ "right",
196
+ "center",
197
+ "top",
198
+ "bottom",
199
+ "middle",
200
+ ])
201
+ export type PluginAlignEdge = z.infer<typeof PluginAlignEdge>
202
+
73
203
  /**
74
204
  * Arguments for {@linkcode PluginDesignTransformApi.move} (options flattened).
75
205
  */
@@ -89,5 +219,36 @@ export const PluginDesignRotateArgs = z.object({
89
219
  angleInDegrees: z.number(),
90
220
  axis: Vec3Handle.optional(),
91
221
  is2D: z.boolean().optional(),
222
+ pivot: Vec3Handle.optional(),
92
223
  })
93
224
  export type PluginDesignRotateArgs = z.infer<typeof PluginDesignRotateArgs>
225
+
226
+ /**
227
+ * Arguments for {@linkcode PluginDesignTransformApi.align} (options flattened).
228
+ *
229
+ * | Property | Type | Description |
230
+ * |---|---|---|
231
+ * | `components` | {@linkcode ComponentHandle}`[]` | Entities to align (≥2 unless `reference` is set — host-enforced) |
232
+ * | `edge` | {@linkcode PluginAlignEdge} | Which bounding-box edge to snap |
233
+ * | `reference` | {@linkcode ComponentHandle} | A fixed component whose edge is the target (optional) |
234
+ */
235
+ export const PluginDesignAlignArgs = z.object({
236
+ components: z.array(ComponentHandle).min(1),
237
+ edge: PluginAlignEdge,
238
+ reference: ComponentHandle.optional(),
239
+ })
240
+ export type PluginDesignAlignArgs = z.infer<typeof PluginDesignAlignArgs>
241
+
242
+ /**
243
+ * Arguments for {@linkcode PluginDesignTransformApi.mirror}.
244
+ *
245
+ * | Property | Type | Description |
246
+ * |---|---|---|
247
+ * | `components` | {@linkcode ComponentHandle}`[]` | Entities to mirror (≥1) |
248
+ * | `axis` | {@linkcode PluginTransformMirrorAxis} | Horizontal axis to mirror across (`'x'` \| `'z'`) |
249
+ */
250
+ export const PluginDesignMirrorArgs = z.object({
251
+ components: z.array(ComponentHandle).min(1),
252
+ axis: PluginTransformMirrorAxis,
253
+ })
254
+ export type PluginDesignMirrorArgs = z.infer<typeof PluginDesignMirrorArgs>
@@ -0,0 +1,156 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+
4
+ /**
5
+ * `snaptrude.design.types` — READ-ONLY reference over the project's building
6
+ * **type / assembly** system (the Project Properties layer stacks: External /
7
+ * Internal walls, slabs, floors, ceilings, roofs). A type bundles a labelled
8
+ * layer stack — each layer's role, thickness (engine units) and material — plus a
9
+ * summed total thickness. Both the built-in defaults and any team/user-added types
10
+ * are surfaced.
11
+ *
12
+ * Types are plain value records ({@linkcode PluginBuildingType}) — NOT scene
13
+ * entities/handles. A type's `id` is a stable `"<kind>:<name>"` token
14
+ * (e.g. `"wall:brickWithPlasterAndPaint"`) returned by
15
+ * {@linkcode PluginDesignTypesApi.list} and consumed by
16
+ * {@linkcode PluginDesignTypesApi.get}. Reads never throw — an unknown id yields
17
+ * `null`; a kind with no types yields `[]`.
18
+ *
19
+ * These are reads only: there is no engine seam to author a type from a plugin
20
+ * (types are created through the construction/project-properties UI).
21
+ */
22
+ export abstract class PluginDesignTypesApi {
23
+ constructor() {}
24
+
25
+ /**
26
+ * List the building types of one `kind` (wall / slab / floor / ceiling / roof)
27
+ * — the built-in defaults plus any team/user-added types. Returns lightweight
28
+ * summaries; call {@linkcode PluginDesignTypesApi.get} for the full layer stack.
29
+ *
30
+ * @param kind Which family of types to list
31
+ * @returns The type summaries as {@linkcode PluginBuildingTypeSummary}`[]` (`[]` when none)
32
+ *
33
+ * @examplePrompt What wall types does this project have?
34
+ * @examplePrompt List the available slab assemblies
35
+ * @examplePrompt Show me every roof type in the project
36
+ * @examplePrompt Which floor types can I use?
37
+ *
38
+ * # Example
39
+ * ```ts
40
+ * const wallTypes = await snaptrude.design.types.list("wall")
41
+ * for (const t of wallTypes) console.log(t.id, t.label, t.thickness)
42
+ * ```
43
+ */
44
+ public abstract list(
45
+ kind: PluginBuildingTypeKind
46
+ ): PluginApiReturn<PluginBuildingTypeSummary[]>
47
+
48
+ /**
49
+ * Get one building type by its `"<kind>:<name>"` id — its labelled layer stack
50
+ * (each layer's role, thickness and material) plus the summed total thickness.
51
+ *
52
+ * @param typeId The type id from {@linkcode PluginDesignTypesApi.list} (e.g. `"wall:exposedConcrete"`)
53
+ * @returns The full type, or `null` if no type matches
54
+ *
55
+ * @examplePrompt What layers make up this wall type?
56
+ * @examplePrompt Show the construction of the exposed-concrete wall
57
+ * @examplePrompt What's the total thickness of this slab type?
58
+ * @examplePrompt Which materials are in this roof assembly?
59
+ *
60
+ * # Example
61
+ * ```ts
62
+ * const [first] = await snaptrude.design.types.list("wall")
63
+ * const type = await snaptrude.design.types.get(first.id)
64
+ * if (type) for (const layer of type.layers) console.log(layer.name, layer.thickness)
65
+ * ```
66
+ */
67
+ public abstract get(typeId: string): PluginApiReturn<PluginBuildingType | null>
68
+ }
69
+
70
+ /** The building-type families exposed by {@linkcode PluginDesignTypesApi}. */
71
+ export const PluginBuildingTypeKind = z.enum(["wall", "slab", "floor", "ceiling", "roof"])
72
+ export type PluginBuildingTypeKind = z.infer<typeof PluginBuildingTypeKind>
73
+
74
+ /**
75
+ * One layer of a building type's assembly.
76
+ *
77
+ * | Property | Type | Description |
78
+ * |---|---|---|
79
+ * | `name` | `string` | Layer name (e.g. `"RCC"`, `"Paint"`) |
80
+ * | `role` | `string` | Layer role (e.g. `"Structure"`, `"Finish"`) |
81
+ * | `thickness` | `number` | Layer thickness in engine units (project's active unit mode) |
82
+ * | `material` | `object`? | Layer material — `{ name, type }` (optional) |
83
+ */
84
+ export const PluginTypeLayer = z.object({
85
+ name: z.string(),
86
+ role: z.string(),
87
+ thickness: z.number(),
88
+ material: z
89
+ .object({
90
+ name: z.string(),
91
+ type: z.string(),
92
+ })
93
+ .optional(),
94
+ })
95
+ export type PluginTypeLayer = z.infer<typeof PluginTypeLayer>
96
+
97
+ /**
98
+ * A lightweight building-type summary (no layer stack).
99
+ *
100
+ * | Property | Type | Description |
101
+ * |---|---|---|
102
+ * | `id` | `string` | Stable `"<kind>:<name>"` token — pass to `design.types.get` |
103
+ * | `kind` | {@linkcode PluginBuildingTypeKind} | Which family it belongs to |
104
+ * | `label` | `string` | Human-readable label |
105
+ * | `isDefault` | `boolean` | `true` for a built-in type, `false` for a team/user type |
106
+ * | `thickness` | `number` | Summed layer thickness in engine units |
107
+ */
108
+ export const PluginBuildingTypeSummary = z.object({
109
+ id: z.string(),
110
+ kind: PluginBuildingTypeKind,
111
+ label: z.string(),
112
+ isDefault: z.boolean(),
113
+ thickness: z.number(),
114
+ })
115
+ export type PluginBuildingTypeSummary = z.infer<typeof PluginBuildingTypeSummary>
116
+
117
+ /**
118
+ * A full building type — a {@linkcode PluginBuildingTypeSummary} plus its layer stack.
119
+ *
120
+ * | Property | Type | Description |
121
+ * |---|---|---|
122
+ * | `id` | `string` | Stable `"<kind>:<name>"` token |
123
+ * | `kind` | {@linkcode PluginBuildingTypeKind} | Which family it belongs to |
124
+ * | `label` | `string` | Human-readable label |
125
+ * | `isDefault` | `boolean` | `true` for a built-in type |
126
+ * | `thickness` | `number` | Summed layer thickness in engine units |
127
+ * | `layers` | {@linkcode PluginTypeLayer}`[]` | The ordered layer stack |
128
+ */
129
+ export const PluginBuildingType = PluginBuildingTypeSummary.extend({
130
+ layers: z.array(PluginTypeLayer),
131
+ })
132
+ export type PluginBuildingType = z.infer<typeof PluginBuildingType>
133
+
134
+ /**
135
+ * Arguments for {@linkcode PluginDesignTypesApi.list}.
136
+ *
137
+ * | Property | Type | Description |
138
+ * |---|---|---|
139
+ * | `kind` | {@linkcode PluginBuildingTypeKind} | Which family of types to list |
140
+ */
141
+ export const PluginDesignTypesListArgs = z.object({
142
+ kind: PluginBuildingTypeKind,
143
+ })
144
+ export type PluginDesignTypesListArgs = z.infer<typeof PluginDesignTypesListArgs>
145
+
146
+ /**
147
+ * Arguments for {@linkcode PluginDesignTypesApi.get}.
148
+ *
149
+ * | Property | Type | Description |
150
+ * |---|---|---|
151
+ * | `typeId` | `string` | The `"<kind>:<name>"` id from `design.types.list` |
152
+ */
153
+ export const PluginDesignTypesGetArgs = z.object({
154
+ typeId: z.string(),
155
+ })
156
+ export type PluginDesignTypesGetArgs = z.infer<typeof PluginDesignTypesGetArgs>