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

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 +3643 -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 +493 -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 +289 -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 +4605 -1423
  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 +4191 -1412
  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 +544 -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 +219 -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
@@ -0,0 +1,268 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { Vec3Handle } from "../../../handles"
4
+
5
+ /**
6
+ * Camera controls.
7
+ *
8
+ * Position the viewport camera, snap it to a standard orthographic/isometric
9
+ * view, and toggle between the 2D (plan) and 3D modelling modes — mirrors the
10
+ * canvas view menu and the 2D/3D toggle. Like {@linkcode PluginZoomApi}, these
11
+ * are transient VIEW-STATE changes: they are not model edits, so they are not
12
+ * write-gated and are not undoable. Accessed via `snaptrude.core.camera`.
13
+ */
14
+ export abstract class PluginCameraApi {
15
+ constructor() {}
16
+
17
+ /**
18
+ * Point the camera: place its eye at `eye` looking toward `target` (world
19
+ * coordinates, internal `babylon` units). View-state only — not undoable.
20
+ *
21
+ * @param eye - Camera position as a {@linkcode Vec3Handle}
22
+ * @param target - Point the camera looks at as a {@linkcode Vec3Handle}
23
+ * @returns `true` once the camera has been positioned.
24
+ *
25
+ * @examplePrompt Look at the model from above the north-east corner
26
+ * @examplePrompt Position the camera at (50, 30, 50) looking at the origin
27
+ * @examplePrompt Point the camera at the centre of the building from the side
28
+ * @examplePrompt Set the eye to this point and aim it at that point
29
+ *
30
+ * # Example
31
+ * ```ts
32
+ * const { vec3 } = snaptrude.core.math
33
+ * await snaptrude.core.camera.lookFrom(vec3.new(50, 30, 50), vec3.new(0, 0, 0))
34
+ * ```
35
+ */
36
+ public abstract lookFrom(
37
+ eye: Vec3Handle,
38
+ target: Vec3Handle,
39
+ ): PluginApiReturn<boolean>
40
+
41
+ /**
42
+ * Snap the camera to a standard view — the five orthographic elevations
43
+ * (`top` / `front` / `back` / `left` / `right`) or the 3D `iso` (isometric
44
+ * perspective) view. Mirrors the canvas view menu. View-state only — not
45
+ * undoable. The orthographic presets exit 2D mode first if needed.
46
+ *
47
+ * @param view - The standard view to snap to ({@linkcode PluginStandardView})
48
+ * @returns `true` once the view has been applied.
49
+ *
50
+ * @examplePrompt Switch to the top view
51
+ * @examplePrompt Show me the front elevation
52
+ * @examplePrompt Go to the isometric view
53
+ * @examplePrompt Look at the model from the left
54
+ * @examplePrompt Give me a plan view from the top
55
+ *
56
+ * # Example
57
+ * ```ts
58
+ * await snaptrude.core.camera.setStandardView("top")
59
+ * ```
60
+ */
61
+ public abstract setStandardView(
62
+ view: PluginStandardView,
63
+ ): PluginApiReturn<boolean>
64
+
65
+ /**
66
+ * Get the current camera mode. Paired with {@linkcode PluginCameraApi.setMode}.
67
+ *
68
+ * @returns `"2d"` when the editor is in plan view, `"3d"` otherwise.
69
+ *
70
+ * @examplePrompt Am I in 2D or 3D?
71
+ * @examplePrompt What view mode is the editor in?
72
+ *
73
+ * # Example
74
+ * ```ts
75
+ * if ((await snaptrude.core.camera.getMode()) === "2d") {
76
+ * await snaptrude.core.camera.setMode("3d")
77
+ * }
78
+ * ```
79
+ */
80
+ public abstract getMode(): PluginApiReturn<PluginCameraMode>
81
+
82
+ /**
83
+ * Toggle the modelling mode between `2d` (plan) and `3d`. Mirrors the canvas
84
+ * 2D/3D toggle: `3d` enters the isometric perspective view, `2d` drops to the
85
+ * orthographic plan of the active storey. View-state only — not undoable.
86
+ *
87
+ * @param mode - `"2d"` or `"3d"` ({@linkcode PluginCameraMode})
88
+ * @returns `true` once the mode switch has been requested.
89
+ *
90
+ * @examplePrompt Switch to 3D view
91
+ * @examplePrompt Drop into 2D plan mode
92
+ * @examplePrompt Go back to 3D
93
+ * @examplePrompt Show the floor plan in 2D
94
+ *
95
+ * # Example
96
+ * ```ts
97
+ * await snaptrude.core.camera.setMode("3d")
98
+ * ```
99
+ */
100
+ public abstract setMode(mode: PluginCameraMode): PluginApiReturn<boolean>
101
+
102
+ /**
103
+ * Read the camera's current projection: `"perspective"` (the default 3D
104
+ * view) or `"orthographic"`. In 2D (plan) mode this always reports
105
+ * `"orthographic"` — a plan is an orthographic projection.
106
+ *
107
+ * @returns The current {@linkcode PluginCameraProjection}.
108
+ *
109
+ * @examplePrompt Is the camera in perspective or orthographic?
110
+ * @examplePrompt What projection is the 3D view using?
111
+ * @examplePrompt Check whether perspective is on
112
+ *
113
+ * # Example
114
+ * ```ts
115
+ * const projection = await snaptrude.core.camera.getProjection()
116
+ * console.log(projection) // "perspective" | "orthographic"
117
+ * ```
118
+ */
119
+ public abstract getProjection(): PluginApiReturn<PluginCameraProjection>
120
+
121
+ /**
122
+ * Switch the 3D camera between `"perspective"` and `"orthographic"`
123
+ * projection — the Perspective/Orthographic control in the Design tab's
124
+ * View Settings panel. Like {@linkcode PluginCameraApi.setMode}, this is a
125
+ * transient view-state change: not write-gated, not undoable.
126
+ *
127
+ * In 2D (plan) mode the canvas is always an orthographic plan:
128
+ * `"orthographic"` is accepted as a no-op, while `"perspective"` is
129
+ * rejected — switch to 3D first via `setMode("3d")`.
130
+ *
131
+ * @param projection - `"perspective"` or `"orthographic"` ({@linkcode PluginCameraProjection})
132
+ * @returns `true` once the projection has been applied.
133
+ *
134
+ * @examplePrompt Switch the camera to orthographic
135
+ * @examplePrompt Turn perspective off
136
+ * @examplePrompt Give me a perspective view of the model
137
+ * @examplePrompt Make the 3D view orthographic like an axonometric drawing
138
+ *
139
+ * # Example
140
+ * ```ts
141
+ * await snaptrude.core.camera.setProjection("orthographic")
142
+ * const projection = await snaptrude.core.camera.getProjection() // "orthographic"
143
+ * ```
144
+ */
145
+ public abstract setProjection(
146
+ projection: PluginCameraProjection,
147
+ ): PluginApiReturn<boolean>
148
+
149
+ /**
150
+ * Zoom (fit) the camera to all geometry in the scene — the "zoom extents"
151
+ * action. View-state only — not undoable. Canonical home of the zoom-extents
152
+ * read (the deprecated `core.zoom.extents`).
153
+ *
154
+ * @returns `true` once the camera has been framed to the scene.
155
+ *
156
+ * @examplePrompt Zoom out so I can see the whole model
157
+ * @examplePrompt Fit everything in the view
158
+ * @examplePrompt Frame the entire building in the viewport
159
+ * @examplePrompt Do a zoom extents on the canvas
160
+ *
161
+ * # Example
162
+ * ```ts
163
+ * await snaptrude.core.camera.zoomExtents()
164
+ * ```
165
+ */
166
+ public abstract zoomExtents(): PluginApiReturn<boolean>
167
+
168
+ /**
169
+ * Zoom (fit) the camera to the current selection. View-state only — not
170
+ * undoable. Canonical home of the zoom-to-selection read (the deprecated
171
+ * `core.zoom.selection`).
172
+ *
173
+ * @returns `true` if there was a selection to frame; `false` if nothing is
174
+ * selected (no-op).
175
+ *
176
+ * @examplePrompt Zoom in on what I have selected
177
+ * @examplePrompt Frame the selected walls in the view
178
+ * @examplePrompt Focus the camera on my current selection
179
+ * @examplePrompt Fit the view to the selected room
180
+ *
181
+ * # Example
182
+ * ```ts
183
+ * await snaptrude.core.camera.zoomSelection()
184
+ * ```
185
+ */
186
+ public abstract zoomSelection(): PluginApiReturn<boolean>
187
+ }
188
+
189
+ /**
190
+ * A standard camera view: the five orthographic elevations (`top`/`front`/
191
+ * `back`/`left`/`right`) or the 3D isometric perspective (`iso`).
192
+ */
193
+ export const PluginStandardView = z.enum([
194
+ "top",
195
+ "front",
196
+ "back",
197
+ "left",
198
+ "right",
199
+ "iso",
200
+ ])
201
+ export type PluginStandardView = z.infer<typeof PluginStandardView>
202
+
203
+ /**
204
+ * The modelling mode: `2d` (orthographic plan) or `3d` (isometric perspective).
205
+ */
206
+ export const PluginCameraMode = z.enum(["2d", "3d"])
207
+ export type PluginCameraMode = z.infer<typeof PluginCameraMode>
208
+
209
+ /**
210
+ * The 3D camera projection: `perspective` (the default) or `orthographic` —
211
+ * the Perspective/Orthographic control in the Design tab's View Settings panel.
212
+ */
213
+ export const PluginCameraProjection = z.enum(["perspective", "orthographic"])
214
+ export type PluginCameraProjection = z.infer<typeof PluginCameraProjection>
215
+
216
+ /**
217
+ * Arguments for {@linkcode PluginCameraApi.lookFrom}.
218
+ *
219
+ * | Property | Type | Description |
220
+ * |---|---|---|
221
+ * | `eye` | {@linkcode Vec3Handle} | Camera position (world, `babylon` units) |
222
+ * | `target` | {@linkcode Vec3Handle} | Point the camera looks at |
223
+ */
224
+ export const PluginCameraLookFromArgs = z.object({
225
+ eye: Vec3Handle,
226
+ target: Vec3Handle,
227
+ })
228
+ export type PluginCameraLookFromArgs = z.infer<typeof PluginCameraLookFromArgs>
229
+
230
+ /**
231
+ * Arguments for {@linkcode PluginCameraApi.setStandardView}.
232
+ *
233
+ * | Property | Type | Description |
234
+ * |---|---|---|
235
+ * | `view` | {@linkcode PluginStandardView} | The standard view to snap to |
236
+ */
237
+ export const PluginCameraSetStandardViewArgs = z.object({
238
+ view: PluginStandardView,
239
+ })
240
+ export type PluginCameraSetStandardViewArgs = z.infer<
241
+ typeof PluginCameraSetStandardViewArgs
242
+ >
243
+
244
+ /**
245
+ * Arguments for {@linkcode PluginCameraApi.setMode}.
246
+ *
247
+ * | Property | Type | Description |
248
+ * |---|---|---|
249
+ * | `mode` | {@linkcode PluginCameraMode} | `"2d"` or `"3d"` |
250
+ */
251
+ export const PluginCameraSetModeArgs = z.object({
252
+ mode: PluginCameraMode,
253
+ })
254
+ export type PluginCameraSetModeArgs = z.infer<typeof PluginCameraSetModeArgs>
255
+
256
+ /**
257
+ * Arguments for {@linkcode PluginCameraApi.setProjection}.
258
+ *
259
+ * | Property | Type | Description |
260
+ * |---|---|---|
261
+ * | `projection` | {@linkcode PluginCameraProjection} | `"perspective"` or `"orthographic"` |
262
+ */
263
+ export const PluginCameraSetProjectionArgs = z.object({
264
+ projection: PluginCameraProjection,
265
+ })
266
+ export type PluginCameraSetProjectionArgs = z.infer<
267
+ typeof PluginCameraSetProjectionArgs
268
+ >
@@ -1,6 +1,6 @@
1
1
  import * as z from "zod"
2
2
  import { PluginApiReturn } from "../../../types"
3
- import { Vec3Handle, ComponentHandle } from "../../../handles"
3
+ import { Vec3Handle, ComponentHandle, Vec3Components } from "../../../handles"
4
4
 
5
5
  /**
6
6
  * Comments — create, edit, resolve, tag, and list scene/project comments.
@@ -140,7 +140,10 @@ export abstract class PluginCommentApi {
140
140
  * await snaptrude.core.comment.tag(comment, "alex@acme.com")
141
141
  * ```
142
142
  */
143
- public abstract tag(comment: CommentHandle, email: string): PluginApiReturn<boolean>
143
+ public abstract tag(
144
+ comment: CommentHandle,
145
+ email: string,
146
+ ): PluginApiReturn<boolean>
144
147
 
145
148
  /**
146
149
  * Permanently remove a comment from the project.
@@ -176,6 +179,57 @@ export abstract class PluginCommentApi {
176
179
  * ```
177
180
  */
178
181
  public abstract list(): PluginApiReturn<CommentHandle[]>
182
+
183
+ /**
184
+ * Read a comment's full detail — its text, author, pin location, resolved
185
+ * state, and reply thread. Comments are otherwise write-only; this is the read
186
+ * side. Pass a top-level comment handle or a reply handle (a reply has an empty
187
+ * `thread`). Returns `null` if the handle doesn't match a live comment.
188
+ *
189
+ * @param comment - The comment (or reply) to read.
190
+ * @returns the {@link PluginCommentDetails}, or `null` if not found.
191
+ *
192
+ * @examplePrompt Read the comment on this wall and tell me what it says
193
+ * @examplePrompt Who left this comment and where is it pinned?
194
+ * @examplePrompt Show me the full thread for this comment
195
+ * @examplePrompt Get the text and author of the selected comment
196
+ *
197
+ * # Example
198
+ * ```ts
199
+ * const [first] = await snaptrude.core.comment.list()
200
+ * const details = await snaptrude.core.comment.get(first)
201
+ * console.log(details?.content, "by", details?.author?.name)
202
+ * console.log(`${details?.thread.length ?? 0} replies`)
203
+ * ```
204
+ */
205
+ public abstract get(
206
+ comment: CommentHandle,
207
+ ): PluginApiReturn<PluginCommentDetails | null>
208
+
209
+ /**
210
+ * Reply to a comment — posts a new comment threaded under `comment` (which must
211
+ * be a top-level comment, not itself a reply). Notifies the thread's
212
+ * participants, mirroring the sidebar Reply action.
213
+ *
214
+ * @param comment - The top-level comment to reply to.
215
+ * @param text - The reply text (emojis = plain unicode).
216
+ * @returns the new reply's {@link CommentHandle}.
217
+ *
218
+ * @examplePrompt Reply to this comment saying I fixed the wall height
219
+ * @examplePrompt Add a reply to the review note confirming it's done
220
+ * @examplePrompt Respond to the comment about the door with "looks good now"
221
+ * @examplePrompt Post a follow-up on the selected comment thread
222
+ *
223
+ * # Example
224
+ * ```ts
225
+ * const [thread] = await snaptrude.core.comment.list()
226
+ * const reply = await snaptrude.core.comment.reply(thread, "Fixed 👍")
227
+ * ```
228
+ */
229
+ public abstract reply(
230
+ comment: CommentHandle,
231
+ text: string,
232
+ ): PluginApiReturn<CommentHandle>
179
233
  }
180
234
 
181
235
  /**
@@ -256,3 +310,67 @@ export const PluginCommentTagArgs = z.object({
256
310
  })
257
311
 
258
312
  export type PluginCommentTagArgs = z.infer<typeof PluginCommentTagArgs>
313
+
314
+ /**
315
+ * Arguments for {@link PluginCommentApi.reply}.
316
+ *
317
+ * | Property | Type | Description |
318
+ * |---|---|---|
319
+ * | `comment` | {@link CommentHandle} | The top-level comment to reply to |
320
+ * | `text` | `string` | The reply text (emojis = unicode) |
321
+ */
322
+ export const PluginCommentReplyArgs = z.object({
323
+ comment: CommentHandle,
324
+ text: z.string(),
325
+ })
326
+
327
+ export type PluginCommentReplyArgs = z.infer<typeof PluginCommentReplyArgs>
328
+
329
+ /**
330
+ * The author of a comment or reply — the display name and email of the teammate
331
+ * who posted it. `null` on the rare comment with no recorded author.
332
+ */
333
+ export interface PluginCommentAuthor {
334
+ /** The author's display name (falls back to their email). */
335
+ name: string
336
+ /** The author's email. */
337
+ email: string
338
+ }
339
+
340
+ /**
341
+ * One reply in a comment's thread (returned by {@link PluginCommentApi.get}).
342
+ */
343
+ export interface PluginCommentReply {
344
+ /** The reply's own {@link CommentHandle}. */
345
+ id: CommentHandle
346
+ /** The reply text. */
347
+ content: string
348
+ /** Who posted the reply. */
349
+ author: PluginCommentAuthor | null
350
+ /** ISO-8601 timestamp of when the reply was posted (empty if unknown). */
351
+ createdAt: string
352
+ }
353
+
354
+ /**
355
+ * The read model of a comment — returned by {@link PluginCommentApi.get}. The
356
+ * inverse of {@link PluginCommentApi.create}: `content`/`component`/`position`
357
+ * echo what was posted, plus the resolved state and reply `thread`.
358
+ */
359
+ export interface PluginCommentDetails {
360
+ /** The comment's {@link CommentHandle}. */
361
+ id: CommentHandle
362
+ /** The comment text. */
363
+ content: string
364
+ /** Who posted the comment. */
365
+ author: PluginCommentAuthor | null
366
+ /** The pin point (engine world coordinates), or `null` if un-anchored. */
367
+ position: Vec3Components | null
368
+ /** The component the comment is anchored to, or `null` if un-anchored. */
369
+ component: ComponentHandle | null
370
+ /** Whether the comment has been marked resolved. */
371
+ isResolved: boolean
372
+ /** ISO-8601 timestamp of when the comment was posted (empty if unknown). */
373
+ createdAt: string
374
+ /** The reply thread, oldest first. Empty for a comment with no replies. */
375
+ thread: PluginCommentReply[]
376
+ }