@snaptrude/plugin-core 0.9.16 → 0.9.18-edgesetbacks-20261021.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/AGENTS.md +231 -231
  2. package/CHANGELOG.md +408 -402
  3. package/CLAUDE.md +11 -11
  4. package/api-manifest.json +1510 -701
  5. package/dist/api/analysis/daylight.d.ts +5 -5
  6. package/dist/api/analysis/solar.d.ts +2 -2
  7. package/dist/api/core/camera/index.d.ts +29 -0
  8. package/dist/api/core/camera/index.d.ts.map +1 -1
  9. package/dist/api/core/geom/create/index.d.ts +7 -1
  10. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  11. package/dist/api/core/geom/update/contour.d.ts +8 -2
  12. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  13. package/dist/api/core/storeys/index.d.ts +5 -2
  14. package/dist/api/core/storeys/index.d.ts.map +1 -1
  15. package/dist/api/core/zoom/index.d.ts +13 -0
  16. package/dist/api/core/zoom/index.d.ts.map +1 -1
  17. package/dist/api/design/bim.d.ts +299 -0
  18. package/dist/api/design/bim.d.ts.map +1 -0
  19. package/dist/api/design/boolean/index.d.ts +2 -0
  20. package/dist/api/design/boolean/index.d.ts.map +1 -1
  21. package/dist/api/design/catalog.d.ts +320 -0
  22. package/dist/api/design/catalog.d.ts.map +1 -0
  23. package/dist/api/design/create/bulk-items.d.ts +65 -25
  24. package/dist/api/design/create/bulk-items.d.ts.map +1 -1
  25. package/dist/api/design/create/index.d.ts +299 -100
  26. package/dist/api/design/create/index.d.ts.map +1 -1
  27. package/dist/api/design/create/opening-fields.d.ts +13 -12
  28. package/dist/api/design/create/opening-fields.d.ts.map +1 -1
  29. package/dist/api/design/delete/index.d.ts +1 -0
  30. package/dist/api/design/delete/index.d.ts.map +1 -1
  31. package/dist/api/design/doors/index.d.ts +18 -24
  32. package/dist/api/design/doors/index.d.ts.map +1 -1
  33. package/dist/api/design/family.d.ts +813 -35
  34. package/dist/api/design/family.d.ts.map +1 -1
  35. package/dist/api/design/index.d.ts +16 -0
  36. package/dist/api/design/index.d.ts.map +1 -1
  37. package/dist/api/design/networks.d.ts +1703 -0
  38. package/dist/api/design/networks.d.ts.map +1 -0
  39. package/dist/api/design/query/grids.d.ts +2 -2
  40. package/dist/api/design/query/index.d.ts +42 -32
  41. package/dist/api/design/query/index.d.ts.map +1 -1
  42. package/dist/api/design/selection/index.d.ts +10 -10
  43. package/dist/api/design/types/index.d.ts +40 -24
  44. package/dist/api/design/types/index.d.ts.map +1 -1
  45. package/dist/api/design/update/index.d.ts +111 -6
  46. package/dist/api/design/update/index.d.ts.map +1 -1
  47. package/dist/api/design/windows/index.d.ts +8 -8
  48. package/dist/api/design/windows/index.d.ts.map +1 -1
  49. package/dist/api/entity/buildableEnvelope.d.ts +84 -2
  50. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  51. package/dist/api/presentation/aiInspiration.d.ts +10 -10
  52. package/dist/api/presentation/annotate.d.ts +38 -22
  53. package/dist/api/presentation/annotate.d.ts.map +1 -1
  54. package/dist/api/presentation/drawingContract.d.ts +32 -0
  55. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  56. package/dist/api/presentation/drawings.d.ts +3523 -0
  57. package/dist/api/presentation/drawings.d.ts.map +1 -0
  58. package/dist/api/presentation/export.d.ts +23 -5
  59. package/dist/api/presentation/export.d.ts.map +1 -1
  60. package/dist/api/presentation/index.d.ts +41 -12
  61. package/dist/api/presentation/index.d.ts.map +1 -1
  62. package/dist/api/presentation/placedViews.d.ts +106 -6
  63. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  64. package/dist/api/presentation/sections.d.ts +461 -0
  65. package/dist/api/presentation/sections.d.ts.map +1 -0
  66. package/dist/api/presentation/shapes.d.ts +2 -2
  67. package/dist/api/presentation/sheets.d.ts +175 -19
  68. package/dist/api/presentation/sheets.d.ts.map +1 -1
  69. package/dist/api/presentation/viewPresets.d.ts +222 -0
  70. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  71. package/dist/api/presentation/views.d.ts +141 -8
  72. package/dist/api/presentation/views.d.ts.map +1 -1
  73. package/dist/api/presentation/walkthroughs.d.ts +6 -6
  74. package/dist/errors/codes.d.ts +3 -1
  75. package/dist/errors/codes.d.ts.map +1 -1
  76. package/dist/index.cjs +3883 -2385
  77. package/dist/index.cjs.map +1 -1
  78. package/dist/index.js +3744 -2385
  79. package/dist/index.js.map +1 -1
  80. package/package.json +1 -1
  81. package/scripts/check-dist-fresh.mjs +22 -22
  82. package/scripts/generate-manifest.mjs +243 -238
  83. package/scripts/generate-manifest.test.mjs +303 -303
  84. package/src/api/analysis/daylight.ts +470 -470
  85. package/src/api/analysis/heatmaps.ts +683 -683
  86. package/src/api/analysis/illuminance.ts +155 -155
  87. package/src/api/analysis/index.ts +61 -61
  88. package/src/api/analysis/shadows.ts +183 -183
  89. package/src/api/analysis/solar.ts +237 -237
  90. package/src/api/analysis/sunlightHours.ts +211 -211
  91. package/src/api/analysis/sunpath.ts +83 -83
  92. package/src/api/analysis/weather.ts +179 -179
  93. package/src/api/core/buildings.ts +485 -485
  94. package/src/api/core/camera/index.ts +696 -667
  95. package/src/api/core/comment/index.ts +376 -376
  96. package/src/api/core/geom/create/index.ts +2139 -2133
  97. package/src/api/core/geom/delete/index.ts +84 -84
  98. package/src/api/core/geom/index.ts +35 -35
  99. package/src/api/core/geom/query/arc.ts +169 -169
  100. package/src/api/core/geom/query/brep.ts +621 -621
  101. package/src/api/core/geom/query/circle.ts +404 -404
  102. package/src/api/core/geom/query/contour.ts +540 -540
  103. package/src/api/core/geom/query/curve.ts +1102 -1102
  104. package/src/api/core/geom/query/edge.ts +130 -130
  105. package/src/api/core/geom/query/face.ts +508 -508
  106. package/src/api/core/geom/query/halfedge.ts +210 -210
  107. package/src/api/core/geom/query/index.ts +63 -63
  108. package/src/api/core/geom/query/profile.ts +473 -473
  109. package/src/api/core/geom/query/vertex.ts +205 -205
  110. package/src/api/core/geom/update/contour.ts +323 -317
  111. package/src/api/core/geom/update/curve.ts +209 -209
  112. package/src/api/core/geom/update/index.ts +29 -29
  113. package/src/api/core/geom/update/profile.ts +379 -379
  114. package/src/api/core/groups.ts +521 -521
  115. package/src/api/core/handles/index.ts +234 -234
  116. package/src/api/core/history/index.ts +84 -84
  117. package/src/api/core/index.ts +99 -99
  118. package/src/api/core/io/export/index.ts +126 -126
  119. package/src/api/core/io/import/index.ts +504 -504
  120. package/src/api/core/io/index.ts +42 -42
  121. package/src/api/core/io/job/index.ts +140 -140
  122. package/src/api/core/io/query/index.ts +71 -71
  123. package/src/api/core/io/terrain/index.ts +360 -360
  124. package/src/api/core/io/underlay/index.ts +705 -705
  125. package/src/api/core/layers.ts +540 -540
  126. package/src/api/core/math/index.ts +20 -20
  127. package/src/api/core/math/quat.ts +172 -172
  128. package/src/api/core/math/vec3.ts +179 -179
  129. package/src/api/core/mode/index.ts +108 -108
  130. package/src/api/core/project/index.ts +479 -479
  131. package/src/api/core/proposals/index.ts +570 -570
  132. package/src/api/core/storeys/index.ts +311 -308
  133. package/src/api/core/storeys/layers.ts +339 -339
  134. package/src/api/core/tags.ts +911 -911
  135. package/src/api/core/units/index.ts +164 -164
  136. package/src/api/core/user.ts +46 -46
  137. package/src/api/core/zoom/index.ts +64 -51
  138. package/src/api/design/bim.ts +210 -0
  139. package/src/api/design/boolean/index.ts +181 -179
  140. package/src/api/design/catalog.ts +203 -0
  141. package/src/api/design/create/bulk-items.ts +294 -254
  142. package/src/api/design/create/grids.ts +137 -137
  143. package/src/api/design/create/index.ts +2178 -1980
  144. package/src/api/design/create/opening-fields.ts +40 -37
  145. package/src/api/design/delete/index.ts +75 -74
  146. package/src/api/design/dimensions.ts +453 -453
  147. package/src/api/design/doors/index.ts +516 -500
  148. package/src/api/design/edit/index.ts +54 -54
  149. package/src/api/design/erase/index.ts +151 -151
  150. package/src/api/design/family.ts +1342 -704
  151. package/src/api/design/furniture/index.ts +319 -319
  152. package/src/api/design/grids.ts +237 -237
  153. package/src/api/design/index.ts +304 -274
  154. package/src/api/design/lock.ts +69 -69
  155. package/src/api/design/materials/index.ts +608 -608
  156. package/src/api/design/networks.ts +607 -0
  157. package/src/api/design/query/geometry/index.ts +319 -319
  158. package/src/api/design/query/grids.ts +197 -197
  159. package/src/api/design/query/index.ts +1236 -1226
  160. package/src/api/design/query/referenceLines.ts +52 -52
  161. package/src/api/design/query/spaces.ts +275 -275
  162. package/src/api/design/selection/index.ts +273 -273
  163. package/src/api/design/shared.ts +40 -40
  164. package/src/api/design/transform/index.ts +254 -254
  165. package/src/api/design/types/index.ts +163 -156
  166. package/src/api/design/update/index.ts +1096 -983
  167. package/src/api/design/visibility.ts +143 -143
  168. package/src/api/design/windows/index.ts +351 -333
  169. package/src/api/entity/buildableEnvelope.ts +397 -322
  170. package/src/api/entity/index.ts +30 -30
  171. package/src/api/entity/referenceLine.ts +235 -235
  172. package/src/api/entity/space.ts +612 -612
  173. package/src/api/entity/story.ts +517 -517
  174. package/src/api/index.ts +47 -47
  175. package/src/api/presentation/aiInspiration.ts +1116 -1116
  176. package/src/api/presentation/annotate.ts +417 -385
  177. package/src/api/presentation/camera.ts +289 -289
  178. package/src/api/presentation/diagrams.ts +194 -194
  179. package/src/api/presentation/drawingContract.ts +70 -0
  180. package/src/api/presentation/drawings.ts +1179 -0
  181. package/src/api/presentation/export.ts +134 -108
  182. package/src/api/presentation/import.ts +159 -159
  183. package/src/api/presentation/index.ts +160 -126
  184. package/src/api/presentation/placedViews.ts +1211 -1120
  185. package/src/api/presentation/sections.ts +420 -0
  186. package/src/api/presentation/shapes.ts +274 -274
  187. package/src/api/presentation/sheets.ts +746 -585
  188. package/src/api/presentation/slideshow.ts +134 -134
  189. package/src/api/presentation/tables.ts +84 -84
  190. package/src/api/presentation/viewPresets.ts +241 -0
  191. package/src/api/presentation/views.ts +742 -673
  192. package/src/api/presentation/walkthroughs.ts +1201 -1201
  193. package/src/api/program/adjacency.ts +164 -164
  194. package/src/api/program/areas.ts +408 -408
  195. package/src/api/program/classification.ts +138 -138
  196. package/src/api/program/cores.ts +83 -83
  197. package/src/api/program/departments.ts +517 -517
  198. package/src/api/program/index.ts +73 -73
  199. package/src/api/program/labels.ts +332 -332
  200. package/src/api/program/layout.ts +422 -422
  201. package/src/api/program/metadata.ts +364 -364
  202. package/src/api/program/metrics.ts +120 -120
  203. package/src/api/program/site.ts +748 -748
  204. package/src/api/program/spreadsheet.ts +2698 -2698
  205. package/src/api/workspace/index.ts +612 -612
  206. package/src/errors/codes.ts +143 -136
  207. package/src/errors/envelope.ts +75 -75
  208. package/src/errors/index.ts +21 -21
  209. package/src/errors/plugin-error.ts +134 -134
  210. package/src/handles.ts +297 -297
  211. package/src/host-utils.ts +67 -67
  212. package/src/index.ts +7 -7
  213. package/src/massParameters.ops.ts +246 -246
  214. package/src/massParameters.ts +427 -427
  215. package/src/types.ts +16 -16
  216. package/test/drawingContract.test.mjs +288 -0
  217. package/test/errors.test.mjs +185 -184
  218. package/test/massParameters.test.mjs +952 -952
  219. package/test/presentationViewSettings.test.mjs +85 -0
  220. package/tsconfig.json +22 -22
  221. package/tsup.config.ts +12 -12
@@ -1,673 +1,742 @@
1
- import * as z from "zod"
2
- import { PluginApiReturn } from "../../types"
3
-
4
- /**
5
- * Presentation views — read the saved 2D/3D views used to prepare presentations.
6
- *
7
- * A **view** is a saved camera/plan: a sheet-ready 2D plan or a saved 3D view.
8
- * A plugin can list and read views, capture them to images, activate one (move
9
- * the camera to it), save the current camera as a new view, rename or delete a
10
- * saved view, and read/update a view's display settings (background, color
11
- * mode, view mode, axis, edges, labels). Each view carries the `storey` it was
12
- * saved on.
13
- *
14
- * `list`/`get`/`getActive`/`capture`/`getSettings` are reads;
15
- * `setActive`/`create`/`rename`/`delete`/`updateSettings` are writes (a view is
16
- * a camera bookmark — not geometry).
17
- *
18
- * Accessed via `snaptrude.presentation.views`.
19
- */
20
- export abstract class PluginPresentationViewsApi {
21
- constructor() {}
22
-
23
- /**
24
- * List the saved views in the active project.
25
- *
26
- * @returns A {@linkcode PluginPresentationViewsListResult} with a `views` array
27
- * of 2D and 3D views (empty when the project has none).
28
- *
29
- * @examplePrompt List all the saved views
30
- * @examplePrompt What 2D and 3D views are in this project?
31
- * @examplePrompt Which view is currently active?
32
- * @examplePrompt Get the names of every presentation view
33
- * @examplePrompt Show me the 3D views I can put on a sheet
34
- *
35
- * # Example
36
- * ```ts
37
- * const { views } = await snaptrude.presentation.views.list()
38
- * const active = views.find((v) => v.isActive)
39
- * const plans = views.filter((v) => v.type === "2d")
40
- * ```
41
- */
42
- public abstract list(): PluginApiReturn<PluginPresentationViewsListResult>
43
-
44
- /**
45
- * Get a single saved view by id.
46
- *
47
- * @param viewId - The id of the view to read.
48
- * @returns The matching {@linkcode PluginPresentationView}, or `null` if no view
49
- * has that id.
50
- *
51
- * @examplePrompt Get the view with id view_12345
52
- * @examplePrompt Find the saved view called Ground Floor Plan
53
- * @examplePrompt Look up a presentation view by its id
54
- *
55
- * # Example
56
- * ```ts
57
- * const view = await snaptrude.presentation.views.get("view_123")
58
- * ```
59
- */
60
- public abstract get(
61
- viewId: string,
62
- ): PluginApiReturn<PluginPresentationViewsGetResult>
63
-
64
- /**
65
- * Get the currently active view.
66
- *
67
- * @returns The active {@linkcode PluginPresentationView}, or `null` if none is
68
- * active.
69
- *
70
- * @examplePrompt Which view is active right now?
71
- * @examplePrompt Get the current view
72
- * @examplePrompt What view am I looking at?
73
- *
74
- * # Example
75
- * ```ts
76
- * const active = await snaptrude.presentation.views.getActive()
77
- * ```
78
- */
79
- public abstract getActive(): PluginApiReturn<PluginPresentationViewsGetResult>
80
-
81
- /**
82
- * Capture a screenshot of a view as a base64 image.
83
- *
84
- * Captures the **current** viewport by default; pass `viewId` to capture a
85
- * specific saved view (which briefly applies that view to the scene). Use
86
- * `format`/`resolution` to control the output. This shoots the Design (3D)
87
- * canvas; to screenshot the Present canvas use
88
- * {@linkcode PluginPresentationCameraApi.capture}.
89
- *
90
- * @param options - All optional: `viewId` (capture this saved view; omit for the
91
- * current viewport), `format` (default `"png"`), `resolution` (e.g. `"1280x720"`).
92
- * @returns A {@linkcode PluginPresentationViewsCaptureResult} with the base64
93
- * `image` data URL.
94
- * @throws If a given `viewId` does not exist.
95
- *
96
- * @examplePrompt Take a screenshot of the current view
97
- * @examplePrompt Capture this view as a PNG
98
- * @examplePrompt Render the Site Plan view to an image
99
- * @examplePrompt Export a high-res image of what I'm looking at
100
- *
101
- * # Example
102
- * ```ts
103
- * const { image } = await snaptrude.presentation.views.capture({ format: "png" })
104
- * ```
105
- */
106
- public abstract capture(options?: {
107
- viewId?: string
108
- format?: "png" | "jpeg"
109
- resolution?: string
110
- }): PluginApiReturn<PluginPresentationViewsCaptureResult>
111
-
112
- /**
113
- * Activate a saved view — move the camera to it and restore its scene state.
114
- *
115
- * Applies the view's camera, visibility, and storey state to the live scene.
116
- * Paired with {@linkcode PluginPresentationViewsApi.getActive}.
117
- *
118
- * @param viewId - The id of the view to activate.
119
- * @returns The id of the now-active view.
120
- * @throws If no view has the given id.
121
- *
122
- * @examplePrompt Switch to the Ground Floor plan view
123
- * @examplePrompt Make the 3D view active
124
- * @examplePrompt Go to the view named Entrance
125
- * @examplePrompt Load the site plan view
126
- *
127
- * # Example
128
- * ```ts
129
- * await snaptrude.presentation.views.setActive("view_123")
130
- * ```
131
- */
132
- public abstract setActive(
133
- viewId: string,
134
- ): PluginApiReturn<PluginPresentationViewsSetActiveResult>
135
-
136
- /**
137
- * Save the current camera/scene state as a new named view.
138
- *
139
- * Creates a camera bookmark (not geometry) from where the camera is now.
140
- *
141
- * @param name - Name for the new view (a default is used when omitted).
142
- * @param options - Optional `kind` (what kind of view to save, default
143
- * `"view"`) and `storey` (save the view on a specific storey — the storey is
144
- * activated first, matching the storey the view is captured on; when omitted
145
- * the current active storey is used).
146
- * @returns The newly created {@linkcode PluginPresentationView}.
147
- * @throws If `storey` is given but no such storey exists, or the view could
148
- * not be saved.
149
- *
150
- * @examplePrompt Save the current view as Lobby Perspective
151
- * @examplePrompt Create a new saved view from where I'm looking
152
- * @examplePrompt Bookmark this camera angle
153
- * @examplePrompt Save the current 2D plan as a view
154
- * @examplePrompt Save a view on the second storey
155
- *
156
- * # Example
157
- * ```ts
158
- * const view = await snaptrude.presentation.views.create("Lobby")
159
- * // …or capture the view on a specific storey
160
- * const level2 = await snaptrude.presentation.views.create("Level 2", { storey: 2 })
161
- * ```
162
- */
163
- public abstract create(
164
- name?: string,
165
- options?: { kind?: "view" | "sitePlan"; storey?: number },
166
- ): PluginApiReturn<PluginPresentationViewsCreateResult>
167
-
168
- /**
169
- * Read a saved view's display settings (background, color mode, view mode,
170
- * axis, edges, labels).
171
- *
172
- * @param viewId - The id of the view to read settings for.
173
- * @returns The view's {@linkcode PluginPresentationViewSettings}, or `null` if
174
- * no view has that id.
175
- *
176
- * @examplePrompt What color mode is the Ground Floor view using?
177
- * @examplePrompt Get the display settings for this view
178
- * @examplePrompt Does the site plan view show axes and labels?
179
- * @examplePrompt Read the background color of the active view
180
- *
181
- * # Example
182
- * ```ts
183
- * const settings = await snaptrude.presentation.views.getSettings("view_123")
184
- * if (settings) console.log(settings.colorMode, settings.backgroundColor)
185
- * ```
186
- */
187
- public abstract getSettings(
188
- viewId: string,
189
- ): PluginApiReturn<PluginPresentationViewsGetSettingsResult>
190
-
191
- /**
192
- * Update a saved view's display settings (partial patch — only the fields you
193
- * pass change).
194
- *
195
- * Persists and broadcasts the change; if the view is currently active, the
196
- * scene updates live. **Not Ctrl+Z-undoable** — view-metadata edits publish
197
- * directly and do not land on the local undo stack; this matches how the
198
- * product's own view-settings UI behaves.
199
- *
200
- * Label patch semantics (mirroring the product, which stores no label
201
- * selection while labels are off):
202
- *
203
- * - `{ showLabels: true }` alone turns labels on; if the view has no stored
204
- * selection, the product defaults (`objectLabels`, `areas`) are applied —
205
- * labels are never "on" with an empty selection (the product has no such
206
- * state; labels render only while the selection is non-empty).
207
- * - `{ labels: [...] }` alone sets the selection **and turns labels on**.
208
- * - `{ showLabels: false }` turns labels off and **clears the stored
209
- * selection** — a later read returns `labels: []`.
210
- * - `{ showLabels: false, labels: [...] }` with a non-empty list is
211
- * contradictory and **rejected** (nothing is silently discarded).
212
- * - `{ showLabels: true, labels: [] }` is likewise contradictory and
213
- * **rejected** — pass a non-empty list, or omit `labels` to get the
214
- * defaults.
215
- *
216
- * `colorMode` accepts the `tag:<categoryId>` scheme strings returned by
217
- * {@linkcode PluginPresentationViewsApi.getSettings}, so read-then-write
218
- * round-trips a tag-based color scheme unchanged.
219
- *
220
- * `viewMode` (`"perspective"` | `"isometric"`) applies to **3D views only** —
221
- * a 2D plan is always orthographic, so a `viewMode: "perspective"` patch on a
222
- * 2D view is rejected. `"isometric"` on a 2D plan is accepted as a no-op (the
223
- * plan is already orthographic), so writing back exactly what
224
- * {@linkcode PluginPresentationViewsApi.getSettings} returned is always a
225
- * no-op. On the active view the camera switches projection live (the same
226
- * toggle the view-settings modal runs); on other views the mode is applied
227
- * the next time the view is activated.
228
- *
229
- * @param viewId - The id of the view to update.
230
- * @param settings - A partial {@linkcode PluginPresentationViewSettings}; any
231
- * omitted field is left unchanged.
232
- * @returns The updated view's `id`.
233
- * @throws If writes are disabled, no view has the given id, the patch is
234
- * contradictory (`showLabels: false` with a non-empty `labels`, or
235
- * `showLabels: true` with an explicitly empty `labels` list), or
236
- * `viewMode: "perspective"` is patched on a 2D plan view.
237
- *
238
- * @examplePrompt Switch this view to monochrome color mode
239
- * @examplePrompt Turn off the axis in the Ground Floor view
240
- * @examplePrompt Set the background of the active view to white
241
- * @examplePrompt Show area labels on this view
242
- * @examplePrompt Enable hidden-line mode for the section view
243
- * @examplePrompt Make the 3D view orthographic instead of perspective
244
- *
245
- * # Example
246
- * ```ts
247
- * await snaptrude.presentation.views.updateSettings("view_123", {
248
- * colorMode: "monochrome",
249
- * showAxis: false,
250
- * })
251
- * // switch a 3D view to an isometric (orthographic) projection
252
- * await snaptrude.presentation.views.updateSettings("view_123", {
253
- * viewMode: "isometric",
254
- * })
255
- * ```
256
- */
257
- public abstract updateSettings(
258
- viewId: string,
259
- settings: Partial<PluginPresentationViewSettings>,
260
- ): PluginApiReturn<PluginPresentationViewsUpdateSettingsResult>
261
-
262
- /**
263
- * Rename a saved view.
264
- *
265
- * Sets the view's display name — the same label the views panel shows and
266
- * that `list`/`get` read back. Names must be unique within the proposal and
267
- * cannot contain the characters `\ : { } [ ] | ; < > ? ~`.
268
- *
269
- * @param viewId - The id of the view to rename.
270
- * @param name - The new display name (non-empty after trimming).
271
- * @returns The updated {@linkcode PluginPresentationView}.
272
- * @throws If writes are disabled, no view has the given id, the name is
273
- * empty/invalid, or another view in the proposal already has that name.
274
- *
275
- * @examplePrompt Rename the view Lobby to Entrance Lobby
276
- * @examplePrompt Call this view Ground Floor Plan
277
- * @examplePrompt Change the active view's name to Final
278
- *
279
- * # Example
280
- * ```ts
281
- * const view = await snaptrude.presentation.views.rename("view_123", "Entrance")
282
- * ```
283
- */
284
- public abstract rename(
285
- viewId: string,
286
- name: string,
287
- ): PluginApiReturn<PluginPresentationViewsRenameResult>
288
-
289
- /**
290
- * Delete a saved view.
291
- *
292
- * Removes the view from the project and the views panel (the panel's own
293
- * delete action). If the deleted view was active, the product falls back to
294
- * the default plan/3D view. Default views (the built-in plan/3D/site-plan
295
- * entries) cannot be deleted.
296
- *
297
- * @param viewId - The id of the view to delete.
298
- * @returns The id of the deleted view
299
- * (a {@linkcode PluginPresentationViewsDeleteResult}).
300
- * @throws If writes are disabled, no view has the given id, or the view is a
301
- * default view.
302
- *
303
- * @examplePrompt Delete the view named Old Draft
304
- * @examplePrompt Remove this saved view
305
- * @examplePrompt Get rid of the Lobby camera bookmark
306
- *
307
- * # Example
308
- * ```ts
309
- * const { id } = await snaptrude.presentation.views.delete("view_123")
310
- * ```
311
- */
312
- public abstract delete(
313
- viewId: string,
314
- ): PluginApiReturn<PluginPresentationViewsDeleteResult>
315
- }
316
-
317
- /**
318
- * The kind of a saved view: a 2D plan view or a 3D view.
319
- */
320
- export const PluginPresentationViewType = z.enum(["2d", "3d"])
321
- export type PluginPresentationViewType = z.infer<
322
- typeof PluginPresentationViewType
323
- >
324
-
325
- /**
326
- * A saved presentation view.
327
- *
328
- * | Property | Type | Description |
329
- * |---|---|---|
330
- * | `id` | `string` | Unique view id |
331
- * | `name` | `string` | Display name |
332
- * | `type` | `"2d" \| "3d"` | Whether this is a 2D plan view or a 3D view |
333
- * | `isActive` | `boolean` | Whether this view is the currently active view |
334
- * | `storey` | `number \| null` | The storey this view was saved on (`null` on older views saved without one) |
335
- */
336
- export const PluginPresentationView = z.object({
337
- id: z.string(),
338
- name: z.string(),
339
- type: PluginPresentationViewType,
340
- isActive: z.boolean(),
341
- storey: z.number().nullable(),
342
- })
343
- export type PluginPresentationView = z.infer<typeof PluginPresentationView>
344
-
345
- /**
346
- * Result of {@linkcode PluginPresentationViewsApi.list}.
347
- *
348
- * | Property | Type | Description |
349
- * |---|---|---|
350
- * | `views` | {@linkcode PluginPresentationView}`[]` | All saved views in the project |
351
- */
352
- export const PluginPresentationViewsListResult = z.object({
353
- views: z.array(PluginPresentationView),
354
- })
355
- export type PluginPresentationViewsListResult = z.infer<
356
- typeof PluginPresentationViewsListResult
357
- >
358
-
359
- /**
360
- * Arguments for {@linkcode PluginPresentationViewsApi.get}.
361
- *
362
- * | Property | Type | Description |
363
- * |---|---|---|
364
- * | `id` | `string` | The id of the view to read |
365
- */
366
- export const PluginPresentationViewsGetArgs = z.object({
367
- id: z.string(),
368
- })
369
- export type PluginPresentationViewsGetArgs = z.infer<
370
- typeof PluginPresentationViewsGetArgs
371
- >
372
-
373
- /**
374
- * Result of {@linkcode PluginPresentationViewsApi.get} and
375
- * {@linkcode PluginPresentationViewsApi.getActive} — the view, or `null` when
376
- * there is no match / no active view.
377
- */
378
- export const PluginPresentationViewsGetResult =
379
- PluginPresentationView.nullable()
380
- export type PluginPresentationViewsGetResult = z.infer<
381
- typeof PluginPresentationViewsGetResult
382
- >
383
-
384
- /** Image format for {@linkcode PluginPresentationViewsApi.capture}. */
385
- export const PluginPresentationImageFormat = z.enum(["png", "jpeg"])
386
- export type PluginPresentationImageFormat = z.infer<
387
- typeof PluginPresentationImageFormat
388
- >
389
-
390
- /**
391
- * Arguments for {@linkcode PluginPresentationViewsApi.capture}. All optional.
392
- *
393
- * | Property | Type | Description |
394
- * |---|---|---|
395
- * | `viewId` | `string \| undefined` | Capture this saved view; omit to capture the current viewport |
396
- * | `format` | `"png" \| "jpeg" \| undefined` | Output image format (default `"png"`) |
397
- * | `resolution` | `string \| undefined` | Optional resolution hint (e.g. `"1280x720"`) |
398
- */
399
- export const PluginPresentationViewsCaptureArgs = z.object({
400
- viewId: z.string().optional(),
401
- format: PluginPresentationImageFormat.optional(),
402
- resolution: z.string().optional(),
403
- })
404
- export type PluginPresentationViewsCaptureArgs = z.infer<
405
- typeof PluginPresentationViewsCaptureArgs
406
- >
407
-
408
- /**
409
- * Result of {@linkcode PluginPresentationViewsApi.capture}.
410
- *
411
- * | Property | Type | Description |
412
- * |---|---|---|
413
- * | `image` | `string` | The captured image as a base64 data URL |
414
- */
415
- export const PluginPresentationViewsCaptureResult = z.object({
416
- image: z.string(),
417
- })
418
- export type PluginPresentationViewsCaptureResult = z.infer<
419
- typeof PluginPresentationViewsCaptureResult
420
- >
421
-
422
- /**
423
- * Arguments for {@linkcode PluginPresentationViewsApi.setActive}.
424
- *
425
- * | Property | Type | Description |
426
- * |---|---|---|
427
- * | `id` | `string` | The id of the view to activate |
428
- */
429
- export const PluginPresentationViewsSetActiveArgs = z.object({
430
- id: z.string(),
431
- })
432
- export type PluginPresentationViewsSetActiveArgs = z.infer<
433
- typeof PluginPresentationViewsSetActiveArgs
434
- >
435
-
436
- /** Result of {@linkcode PluginPresentationViewsApi.setActive} — the active view's id. */
437
- export const PluginPresentationViewsSetActiveResult = z.object({
438
- id: z.string(),
439
- })
440
- export type PluginPresentationViewsSetActiveResult = z.infer<
441
- typeof PluginPresentationViewsSetActiveResult
442
- >
443
-
444
- /**
445
- * Arguments for {@linkcode PluginPresentationViewsApi.create}. All optional.
446
- *
447
- * | Property | Type | Description |
448
- * |---|---|---|
449
- * | `name` | `string \| undefined` | Name for the new view (a default is used when omitted) |
450
- * | `kind` | `"view" \| "sitePlan" \| undefined` | What kind of view to save (default `"view"`). `"plan"` is not offered — the host cannot create a plan view without a `planId` this API does not carry. |
451
- * | `storey` | `number \| undefined` | Save the view on this storey (activated before capture); defaults to the current active storey |
452
- */
453
- export const PluginPresentationViewsCreateArgs = z.object({
454
- name: z.string().optional(),
455
- kind: z.enum(["view", "sitePlan"]).optional(),
456
- storey: z.number().optional(),
457
- })
458
- export type PluginPresentationViewsCreateArgs = z.infer<
459
- typeof PluginPresentationViewsCreateArgs
460
- >
461
-
462
- /** Result of {@linkcode PluginPresentationViewsApi.create} — the saved view. */
463
- export const PluginPresentationViewsCreateResult = PluginPresentationView
464
- export type PluginPresentationViewsCreateResult = z.infer<
465
- typeof PluginPresentationViewsCreateResult
466
- >
467
-
468
- /**
469
- * How the scene is colored in a view.
470
- *
471
- * | Value | Meaning |
472
- * |---|---|
473
- * | `monochrome` | Flat single-tone shading |
474
- * | `texture` | Material textures/colors |
475
- * | `department` | Colored by department |
476
- * | `tag:<categoryId>` | Colored by a project tag category (e.g. `tag:ZONE`) |
477
- *
478
- * The `tag:<categoryId>` form carries the product's tag-based color schemes
479
- * losslessly — reading a view that uses one returns the `tag:` string as-is,
480
- * and writing it back preserves the scheme (read-then-write is safe).
481
- */
482
- export const PluginPresentationViewColorMode = z.union([
483
- z.enum(["monochrome", "texture", "department"]),
484
- z.templateLiteral(["tag:", z.string()]),
485
- ])
486
- export type PluginPresentationViewColorMode = z.infer<
487
- typeof PluginPresentationViewColorMode
488
- >
489
-
490
- /**
491
- * A category of on-canvas labels a view can show.
492
- *
493
- * | Value | Meaning |
494
- * |---|---|
495
- * | `objectLabels` | Per-object name labels |
496
- * | `areas` | Area/room labels |
497
- * | `department` | Department labels |
498
- */
499
- export const PluginPresentationViewLabel = z.enum([
500
- "objectLabels",
501
- "areas",
502
- "department",
503
- ])
504
- export type PluginPresentationViewLabel = z.infer<
505
- typeof PluginPresentationViewLabel
506
- >
507
-
508
- /**
509
- * A view's camera projection: perspective, or isometric (orthographic).
510
- *
511
- * | Value | Meaning |
512
- * |---|---|
513
- * | `perspective` | Perspective projection (vanishing points) |
514
- * | `isometric` | Orthographic projection (no perspective distortion) |
515
- *
516
- * Applies to 3D views; a 2D plan view is always orthographic and reads
517
- * `"isometric"`.
518
- */
519
- export const PluginPresentationViewMode = z.enum(["perspective", "isometric"])
520
- export type PluginPresentationViewMode = z.infer<
521
- typeof PluginPresentationViewMode
522
- >
523
-
524
- /**
525
- * A view's display settings.
526
- *
527
- * | Property | Type | Description |
528
- * |---|---|---|
529
- * | `backgroundColor` | `string` | Canvas background as a hex color (e.g. `#ffffff`) |
530
- * | `colorMode` | {@linkcode PluginPresentationViewColorMode} | How the scene is colored (including `tag:<categoryId>` schemes) |
531
- * | `viewMode` | {@linkcode PluginPresentationViewMode} | Camera projection — `"perspective"` or `"isometric"` (orthographic). Writable on 3D views only; a 2D plan always reads `"isometric"` and accepts only `"isometric"` (a no-op) |
532
- * | `showAxis` | `boolean` | Whether the X/Y/Z axes are shown |
533
- * | `showEdges` | `boolean` | Whether edges are shown; `false` = hidden-line rendering |
534
- * | `showLabels` | `boolean` | Master label switch — whether on-canvas labels are shown at all. `true` always pairs with a non-empty `labels` selection (labels render only while the selection is non-empty; there is no labels-on-with-empty-selection state) |
535
- * | `labels` | {@linkcode PluginPresentationViewLabel}`[]` | Which label categories are selected. When `showLabels` is `false` the view stores no selection and this reads `[]` |
536
- */
537
- export const PluginPresentationViewSettings = z.object({
538
- backgroundColor: z.string(),
539
- colorMode: PluginPresentationViewColorMode,
540
- viewMode: PluginPresentationViewMode,
541
- showAxis: z.boolean(),
542
- showEdges: z.boolean(),
543
- showLabels: z.boolean(),
544
- labels: z.array(PluginPresentationViewLabel),
545
- })
546
- export type PluginPresentationViewSettings = z.infer<
547
- typeof PluginPresentationViewSettings
548
- >
549
-
550
- /**
551
- * Arguments for {@linkcode PluginPresentationViewsApi.getSettings}.
552
- *
553
- * | Property | Type | Description |
554
- * |---|---|---|
555
- * | `id` | `string` | The id of the view to read settings for |
556
- */
557
- export const PluginPresentationViewsGetSettingsArgs = z.object({
558
- id: z.string(),
559
- })
560
- export type PluginPresentationViewsGetSettingsArgs = z.infer<
561
- typeof PluginPresentationViewsGetSettingsArgs
562
- >
563
-
564
- /**
565
- * Result of {@linkcode PluginPresentationViewsApi.getSettings} — the settings,
566
- * or `null` when no view has that id.
567
- */
568
- export const PluginPresentationViewsGetSettingsResult =
569
- PluginPresentationViewSettings.nullable()
570
- export type PluginPresentationViewsGetSettingsResult = z.infer<
571
- typeof PluginPresentationViewsGetSettingsResult
572
- >
573
-
574
- /**
575
- * Arguments for {@linkcode PluginPresentationViewsApi.updateSettings}. The
576
- * `settings` patch is partial — any omitted field is left unchanged. A patch
577
- * pairing `showLabels: false` with a non-empty `labels` list, or
578
- * `showLabels: true` with an explicitly empty `labels` list, is rejected as
579
- * contradictory (see the method JSDoc for the full label patch semantics).
580
- *
581
- * | Property | Type | Description |
582
- * |---|---|---|
583
- * | `id` | `string` | The id of the view to update |
584
- * | `settings` | `Partial<`{@linkcode PluginPresentationViewSettings}`>` | The fields to change |
585
- */
586
- export const PluginPresentationViewsUpdateSettingsArgs = z
587
- .object({
588
- id: z.string(),
589
- settings: PluginPresentationViewSettings.partial(),
590
- })
591
- .refine(
592
- (v) =>
593
- !(
594
- v.settings.showLabels === false && (v.settings.labels?.length ?? 0) > 0
595
- ),
596
- {
597
- message:
598
- "Contradictory patch: labels cannot be set while showLabels is false",
599
- },
600
- )
601
- .refine(
602
- (v) =>
603
- !(
604
- v.settings.showLabels === true &&
605
- v.settings.labels !== undefined &&
606
- v.settings.labels.length === 0
607
- ),
608
- {
609
- message:
610
- "Contradictory patch: showLabels cannot be true with an explicitly empty labels list — pass a non-empty list, or omit labels to apply the defaults",
611
- },
612
- )
613
- export type PluginPresentationViewsUpdateSettingsArgs = z.infer<
614
- typeof PluginPresentationViewsUpdateSettingsArgs
615
- >
616
-
617
- /** Result of {@linkcode PluginPresentationViewsApi.updateSettings} — the updated view's id. */
618
- export const PluginPresentationViewsUpdateSettingsResult = z.object({
619
- id: z.string(),
620
- })
621
- export type PluginPresentationViewsUpdateSettingsResult = z.infer<
622
- typeof PluginPresentationViewsUpdateSettingsResult
623
- >
624
-
625
- /**
626
- * Arguments for {@linkcode PluginPresentationViewsApi.rename}.
627
- *
628
- * | Property | Type | Description |
629
- * |---|---|---|
630
- * | `id` | `string` | The id of the view to rename |
631
- * | `name` | `string` | New display name (non-empty after trimming) |
632
- */
633
- export const PluginPresentationViewsRenameArgs = z.object({
634
- id: z.string(),
635
- name: z.string().trim().min(1),
636
- })
637
- export type PluginPresentationViewsRenameArgs = z.infer<
638
- typeof PluginPresentationViewsRenameArgs
639
- >
640
-
641
- /** Result of {@linkcode PluginPresentationViewsApi.rename} — the renamed view. */
642
- export const PluginPresentationViewsRenameResult = PluginPresentationView
643
- export type PluginPresentationViewsRenameResult = z.infer<
644
- typeof PluginPresentationViewsRenameResult
645
- >
646
-
647
- /**
648
- * Arguments for {@linkcode PluginPresentationViewsApi.delete}.
649
- *
650
- * | Property | Type | Description |
651
- * |---|---|---|
652
- * | `id` | `string` | The id of the view to delete |
653
- */
654
- export const PluginPresentationViewsDeleteArgs = z.object({
655
- id: z.string(),
656
- })
657
- export type PluginPresentationViewsDeleteArgs = z.infer<
658
- typeof PluginPresentationViewsDeleteArgs
659
- >
660
-
661
- /**
662
- * Result of {@linkcode PluginPresentationViewsApi.delete}.
663
- *
664
- * | Property | Type | Description |
665
- * |---|---|---|
666
- * | `id` | `string` | Id of the deleted view |
667
- */
668
- export const PluginPresentationViewsDeleteResult = z.object({
669
- id: z.string(),
670
- })
671
- export type PluginPresentationViewsDeleteResult = z.infer<
672
- typeof PluginPresentationViewsDeleteResult
673
- >
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../types"
3
+
4
+ /**
5
+ * Presentation views — read the saved plan, 3D, and elevation views used to prepare presentations.
6
+ *
7
+ * A **view** is a saved camera/plan: a sheet-ready 2D plan or a saved 3D view.
8
+ * A plugin can list and read views, capture them to images, activate one (move
9
+ * the camera to it), save the current camera as a new view, rename or delete a
10
+ * saved view, and read/update a view's display settings (background, color
11
+ * mode, view mode, axis, edges, labels). Each view carries the `storey` it was
12
+ * saved on.
13
+ *
14
+ * `list`/`get`/`getActive`/`capture`/`getSettings` are reads;
15
+ * `setActive`/`create`/`rename`/`delete`/`updateSettings` are writes (a view is
16
+ * a camera bookmark — not geometry).
17
+ *
18
+ * Accessed via `snaptrude.presentation.views`.
19
+ */
20
+ export abstract class PluginPresentationViewsApi {
21
+ constructor() {}
22
+
23
+ /**
24
+ * List the saved views in the active project.
25
+ *
26
+ * @returns A {@linkcode PluginPresentationViewsListResult} with a `views` array
27
+ * of plan, 3D, and elevation views (empty when the project has none).
28
+ *
29
+ * @examplePrompt List all the saved views
30
+ * @examplePrompt What plan, 3D, and elevation views are in this project?
31
+ * @examplePrompt Which view is currently active?
32
+ * @examplePrompt Get the names of every presentation view
33
+ * @examplePrompt Show me the 3D views I can put on a sheet
34
+ *
35
+ * # Example
36
+ * ```ts
37
+ * const { views } = await snaptrude.presentation.views.list()
38
+ * const active = views.find((v) => v.isActive)
39
+ * const plans = views.filter((v) => v.type === "2d")
40
+ * ```
41
+ */
42
+ public abstract list(): PluginApiReturn<PluginPresentationViewsListResult>
43
+
44
+ /**
45
+ * Get a single saved view by id.
46
+ *
47
+ * @param viewId - The id of the view to read.
48
+ * @returns The matching {@linkcode PluginPresentationView}, or `null` if no view
49
+ * has that id.
50
+ *
51
+ * @examplePrompt Get the view with id view_12345
52
+ * @examplePrompt Find the saved view called Ground Floor Plan
53
+ * @examplePrompt Look up a presentation view by its id
54
+ *
55
+ * # Example
56
+ * ```ts
57
+ * const view = await snaptrude.presentation.views.get("view_123")
58
+ * ```
59
+ */
60
+ public abstract get(
61
+ viewId: string,
62
+ ): PluginApiReturn<PluginPresentationViewsGetResult>
63
+
64
+ /**
65
+ * Get the currently active view.
66
+ *
67
+ * @returns The active {@linkcode PluginPresentationView}, or `null` if none is
68
+ * active.
69
+ *
70
+ * @examplePrompt Which view is active right now?
71
+ * @examplePrompt Get the current view
72
+ * @examplePrompt What view am I looking at?
73
+ *
74
+ * # Example
75
+ * ```ts
76
+ * const active = await snaptrude.presentation.views.getActive()
77
+ * ```
78
+ */
79
+ public abstract getActive(): PluginApiReturn<PluginPresentationViewsGetResult>
80
+
81
+ /**
82
+ * Capture a screenshot of a view as a base64 image.
83
+ *
84
+ * Captures the **current** viewport by default; pass `viewId` to capture a
85
+ * specific saved view (which briefly applies that view to the scene). Use
86
+ * `format`/`resolution` to control the output. This shoots the Design (3D)
87
+ * canvas; to screenshot the Present canvas use
88
+ * {@linkcode PluginPresentationCameraApi.capture}.
89
+ *
90
+ * @param options - All optional: `viewId` (capture this saved view; omit for the
91
+ * current viewport), `format` (default `"png"`), `resolution` (e.g. `"1280x720"`).
92
+ * @returns A {@linkcode PluginPresentationViewsCaptureResult} with the base64
93
+ * `image` data URL.
94
+ * @throws If a given `viewId` does not exist.
95
+ *
96
+ * @examplePrompt Take a screenshot of the current view
97
+ * @examplePrompt Capture this view as a PNG
98
+ * @examplePrompt Render the Site Plan view to an image
99
+ * @examplePrompt Export a high-res image of what I'm looking at
100
+ *
101
+ * # Example
102
+ * ```ts
103
+ * const { image } = await snaptrude.presentation.views.capture({ format: "png" })
104
+ * ```
105
+ */
106
+ public abstract capture(options?: {
107
+ viewId?: string
108
+ format?: "png" | "jpeg"
109
+ resolution?: string
110
+ }): PluginApiReturn<PluginPresentationViewsCaptureResult>
111
+
112
+ /**
113
+ * Activate a saved view — move the camera to it and restore its scene state.
114
+ *
115
+ * Applies the view's camera, visibility, and storey state to the live scene.
116
+ * Paired with {@linkcode PluginPresentationViewsApi.getActive}.
117
+ *
118
+ * While Present is open this sets the Design frame a view saved in Present
119
+ * is taken from; it never moves the Present sheet canvas; use
120
+ * `presentation.camera` for that.
121
+ *
122
+ * @param viewId - The id of the view to activate.
123
+ * @returns The id of the now-active view.
124
+ * @throws If no view has the given id.
125
+ *
126
+ * @examplePrompt Switch to the Ground Floor plan view
127
+ * @examplePrompt Make the 3D view active
128
+ * @examplePrompt Go to the view named Entrance
129
+ * @examplePrompt Load the site plan view
130
+ *
131
+ * # Example
132
+ * ```ts
133
+ * await snaptrude.presentation.views.setActive("view_123")
134
+ * ```
135
+ */
136
+ public abstract setActive(
137
+ viewId: string,
138
+ ): PluginApiReturn<PluginPresentationViewsSetActiveResult>
139
+
140
+ /**
141
+ * Save the current camera/scene state as a new named view.
142
+ *
143
+ * Creates a camera bookmark (not geometry) from where the camera is now.
144
+ *
145
+ * Works while Present mode is open. Present draws its drawings on the same
146
+ * 3D scene, so a view saved in Present takes its framing (camera, 2D or 3D
147
+ * mode, projection, storey, building) from the Design frame instead: the one
148
+ * the user had when Present opened, or one a plugin set since with
149
+ * `setActive`, `updateSettings({ viewMode })`, `core.camera`, `core.zoom`,
150
+ * `core.storeys.setActive`, `core.storeys.layers.setActive` or
151
+ * `core.buildings.setActive`. It never moves the Present sheet canvas; use
152
+ * `presentation.camera` for that.
153
+ *
154
+ * @param name - Name for the new view (a default is used when omitted).
155
+ * @param options - Optional `kind` (what kind of view to save, default
156
+ * `"view"`) and `storey` (save the view on a specific storey — the storey is
157
+ * activated first, matching the storey the view is captured on; when omitted
158
+ * the current active storey is used).
159
+ * @returns The newly created {@linkcode PluginPresentationView}.
160
+ * @throws If `storey` is given but no such storey exists, or the view could
161
+ * not be saved.
162
+ *
163
+ * @examplePrompt Save the current view as Lobby Perspective
164
+ * @examplePrompt Create a new saved view from where I'm looking
165
+ * @examplePrompt Bookmark this camera angle
166
+ * @examplePrompt Save the current 2D plan as a view
167
+ * @examplePrompt Save a view on the second storey
168
+ *
169
+ * # Example
170
+ * ```ts
171
+ * const view = await snaptrude.presentation.views.create("Lobby")
172
+ * // …or capture the view on a specific storey
173
+ * const level2 = await snaptrude.presentation.views.create("Level 2", { storey: 2 })
174
+ * ```
175
+ */
176
+ public abstract create(
177
+ name?: string,
178
+ options?: { kind?: "view" | "sitePlan"; storey?: number },
179
+ ): PluginApiReturn<PluginPresentationViewsCreateResult>
180
+
181
+ /**
182
+ * Read a saved view's display settings (background, color mode, view mode,
183
+ * axis, edges, labels).
184
+ *
185
+ * @param viewId - The id of the view to read settings for.
186
+ * @returns The view's {@linkcode PluginPresentationViewSettings}, or `null` if
187
+ * no view has that id. A plan view also reports its `cutPlaneHeight`,
188
+ * `viewDepthStorey` and `showOverheadObjects` (saved values, or the product
189
+ * defaults for a plan saved before cut ranges existed); other views omit them.
190
+ *
191
+ * @examplePrompt What color mode is the Ground Floor view using?
192
+ * @examplePrompt Get the display settings for this view
193
+ * @examplePrompt Does the site plan view show axes and labels?
194
+ * @examplePrompt Read the background color of the active view
195
+ * @examplePrompt What is the cut height of this plan?
196
+ * @examplePrompt How deep does this plan look below the cut?
197
+ *
198
+ * # Example
199
+ * ```ts
200
+ * const settings = await snaptrude.presentation.views.getSettings("view_123")
201
+ * if (settings) console.log(settings.colorMode, settings.backgroundColor)
202
+ * ```
203
+ */
204
+ public abstract getSettings(
205
+ viewId: string,
206
+ ): PluginApiReturn<PluginPresentationViewsGetSettingsResult>
207
+
208
+ /**
209
+ * Update a saved view's display settings (partial patch — only the fields you
210
+ * pass change).
211
+ *
212
+ * Persists and broadcasts the change; if the view is currently active, the
213
+ * scene updates live. **Not Ctrl+Z-undoable** — view-metadata edits publish
214
+ * directly and do not land on the local undo stack; this matches how the
215
+ * product's own view-settings UI behaves.
216
+ *
217
+ * Label patch semantics (mirroring the product, which stores no label
218
+ * selection while labels are off):
219
+ *
220
+ * - `{ showLabels: true }` alone turns labels on; if the view has no stored
221
+ * selection, the product defaults (`objectLabels`, `areas`) are applied —
222
+ * labels are never "on" with an empty selection (the product has no such
223
+ * state; labels render only while the selection is non-empty).
224
+ * - `{ labels: [...] }` alone sets the selection **and turns labels on**.
225
+ * - `{ showLabels: false }` turns labels off and **clears the stored
226
+ * selection** — a later read returns `labels: []`.
227
+ * - `{ showLabels: false, labels: [...] }` with a non-empty list is
228
+ * contradictory and **rejected** (nothing is silently discarded).
229
+ * - `{ showLabels: true, labels: [] }` is likewise contradictory and
230
+ * **rejected** — pass a non-empty list, or omit `labels` to get the
231
+ * defaults.
232
+ *
233
+ * `colorMode` accepts the `tag:<categoryId>` scheme strings returned by
234
+ * {@linkcode PluginPresentationViewsApi.getSettings}, so read-then-write
235
+ * round-trips a tag-based color scheme unchanged.
236
+ *
237
+ * `viewMode` (`"perspective"` | `"isometric"`) applies to **3D views only** —
238
+ * a 2D plan is always orthographic, so a `viewMode: "perspective"` patch on a
239
+ * 2D view is rejected. `"isometric"` on a 2D plan is accepted as a no-op (the
240
+ * plan is already orthographic), so writing back exactly what
241
+ * {@linkcode PluginPresentationViewsApi.getSettings} returned is always a
242
+ * no-op. On the active view the camera switches projection live (the same
243
+ * toggle the view-settings modal runs); on other views the mode is applied
244
+ * the next time the view is activated.
245
+ *
246
+ * `cutPlaneHeight`, `viewDepthStorey` and `showOverheadObjects` set the plan's
247
+ * cut range and apply to **plan views only** (patching them on a 3D, elevation
248
+ * or site-plan view is rejected). `cutPlaneHeight` is in engine units, the same
249
+ * unit as `story.height`, and must be greater than 0 and less than the plan
250
+ * storey's height. `viewDepthStorey` must be an existing storey at or below the
251
+ * plan's storey. A sparse patch leaves the other two range fields as they
252
+ * were; on the active plan the canvas redraws live.
253
+ *
254
+ * @param viewId - The id of the view to update.
255
+ * @param settings - A partial {@linkcode PluginPresentationViewSettings}; any
256
+ * omitted field is left unchanged.
257
+ * @returns The updated view's `id`.
258
+ * @throws If writes are disabled, no view has the given id, the patch is
259
+ * contradictory (`showLabels: false` with a non-empty `labels`, or
260
+ * `showLabels: true` with an explicitly empty `labels` list),
261
+ * `viewMode: "perspective"` is patched on a 2D plan view, a plan-range
262
+ * field is patched on a view that is not a plan, or the cut height / depth
263
+ * is out of range.
264
+ *
265
+ * @examplePrompt Switch this view to monochrome color mode
266
+ * @examplePrompt Turn off the axis in the Ground Floor view
267
+ * @examplePrompt Set the background of the active view to white
268
+ * @examplePrompt Show area labels on this view
269
+ * @examplePrompt Enable hidden-line mode for the section view
270
+ * @examplePrompt Make the 3D view orthographic instead of perspective
271
+ * @examplePrompt Raise the cut plane of the Ground Floor plan to 1.8 m
272
+ * @examplePrompt Show the basement below in this plan
273
+ * @examplePrompt Hide the overhead objects in this plan
274
+ *
275
+ * # Example
276
+ * ```ts
277
+ * await snaptrude.presentation.views.updateSettings("view_123", {
278
+ * colorMode: "monochrome",
279
+ * showAxis: false,
280
+ * })
281
+ * // switch a 3D view to an isometric (orthographic) projection
282
+ * await snaptrude.presentation.views.updateSettings("view_123", {
283
+ * viewMode: "isometric",
284
+ * })
285
+ * // set a plan's range: cut 1.2 m up, show the basement below, no overhead
286
+ * await snaptrude.presentation.views.updateSettings("plan_1", {
287
+ * cutPlaneHeight: 4.72,
288
+ * viewDepthStorey: -1,
289
+ * showOverheadObjects: false,
290
+ * })
291
+ * ```
292
+ */
293
+ public abstract updateSettings(
294
+ viewId: string,
295
+ settings: Partial<PluginPresentationViewSettings>,
296
+ ): PluginApiReturn<PluginPresentationViewsUpdateSettingsResult>
297
+
298
+ /**
299
+ * Rename a saved view.
300
+ *
301
+ * Sets the view's display name — the same label the views panel shows and
302
+ * that `list`/`get` read back. Names must be unique within the proposal and
303
+ * cannot contain the characters `\ : { } [ ] | ; < > ? ~`.
304
+ *
305
+ * @param viewId - The id of the view to rename.
306
+ * @param name - The new display name (non-empty after trimming).
307
+ * @returns The updated {@linkcode PluginPresentationView}.
308
+ * @throws If writes are disabled, no view has the given id, the name is
309
+ * empty/invalid, or another view in the proposal already has that name.
310
+ *
311
+ * @examplePrompt Rename the view Lobby to Entrance Lobby
312
+ * @examplePrompt Call this view Ground Floor Plan
313
+ * @examplePrompt Change the active view's name to Final
314
+ *
315
+ * # Example
316
+ * ```ts
317
+ * const view = await snaptrude.presentation.views.rename("view_123", "Entrance")
318
+ * ```
319
+ */
320
+ public abstract rename(
321
+ viewId: string,
322
+ name: string,
323
+ ): PluginApiReturn<PluginPresentationViewsRenameResult>
324
+
325
+ /**
326
+ * Delete a saved view.
327
+ *
328
+ * Removes the view from the project and the views panel (the panel's own
329
+ * delete action). If the deleted view was active, the product falls back to
330
+ * the default plan/3D view. Default views (the built-in plan/3D/site-plan
331
+ * entries) cannot be deleted.
332
+ *
333
+ * @param viewId - The id of the view to delete.
334
+ * @returns The id of the deleted view
335
+ * (a {@linkcode PluginPresentationViewsDeleteResult}).
336
+ * @throws If writes are disabled, no view has the given id, or the view is a
337
+ * default view.
338
+ *
339
+ * @examplePrompt Delete the view named Old Draft
340
+ * @examplePrompt Remove this saved view
341
+ * @examplePrompt Get rid of the Lobby camera bookmark
342
+ *
343
+ * # Example
344
+ * ```ts
345
+ * const { id } = await snaptrude.presentation.views.delete("view_123")
346
+ * ```
347
+ */
348
+ public abstract delete(
349
+ viewId: string,
350
+ ): PluginApiReturn<PluginPresentationViewsDeleteResult>
351
+ }
352
+
353
+ /**
354
+ * The rendering category of a saved view. Existing plan/3D values are preserved;
355
+ * elevations are identified independently of their orthographic 3D camera.
356
+ */
357
+ export const PluginPresentationViewType = z.enum(["2d", "3d", "elevation"])
358
+ export type PluginPresentationViewType = z.infer<
359
+ typeof PluginPresentationViewType
360
+ >
361
+
362
+ /** The native semantic kind persisted for a saved view. */
363
+ export const PluginPresentationViewKind = z.enum([
364
+ "plan",
365
+ "sitePlan",
366
+ "threeD",
367
+ "elevation",
368
+ ])
369
+ export type PluginPresentationViewKind = z.infer<
370
+ typeof PluginPresentationViewKind
371
+ >
372
+
373
+ /** Cardinal direction for an elevation; non-elevation views return `null`. */
374
+ export const PluginPresentationElevationDirection = z.enum([
375
+ "north",
376
+ "east",
377
+ "south",
378
+ "west",
379
+ ])
380
+ export type PluginPresentationElevationDirection = z.infer<
381
+ typeof PluginPresentationElevationDirection
382
+ >
383
+
384
+ /**
385
+ * A saved presentation view.
386
+ *
387
+ * | Property | Type | Description |
388
+ * |---|---|---|
389
+ * | `id` | `string` | Unique view id |
390
+ * | `name` | `string` | Display name |
391
+ * | `type` | `"2d" \| "3d" \| "elevation"` | Rendering category; elevations are distinct from ordinary 3D views |
392
+ * | `kind` | {@linkcode PluginPresentationViewKind} | Native semantic view kind |
393
+ * | `direction` | {@linkcode PluginPresentationElevationDirection}` \| null` | Cardinal direction for elevations; otherwise `null` |
394
+ * | `isActive` | `boolean` | Whether this view is the currently active view |
395
+ * | `storey` | `number \| null` | The storey this view was saved on (`null` on older views saved without one) |
396
+ */
397
+ export const PluginPresentationView = z.object({
398
+ id: z.string(),
399
+ name: z.string(),
400
+ type: PluginPresentationViewType,
401
+ kind: PluginPresentationViewKind,
402
+ direction: PluginPresentationElevationDirection.nullable(),
403
+ isActive: z.boolean(),
404
+ storey: z.number().nullable(),
405
+ })
406
+ export type PluginPresentationView = z.infer<typeof PluginPresentationView>
407
+
408
+ /**
409
+ * Result of {@linkcode PluginPresentationViewsApi.list}.
410
+ *
411
+ * | Property | Type | Description |
412
+ * |---|---|---|
413
+ * | `views` | {@linkcode PluginPresentationView}`[]` | All saved views in the project |
414
+ */
415
+ export const PluginPresentationViewsListResult = z.object({
416
+ views: z.array(PluginPresentationView),
417
+ })
418
+ export type PluginPresentationViewsListResult = z.infer<
419
+ typeof PluginPresentationViewsListResult
420
+ >
421
+
422
+ /**
423
+ * Arguments for {@linkcode PluginPresentationViewsApi.get}.
424
+ *
425
+ * | Property | Type | Description |
426
+ * |---|---|---|
427
+ * | `id` | `string` | The id of the view to read |
428
+ */
429
+ export const PluginPresentationViewsGetArgs = z.object({
430
+ id: z.string(),
431
+ })
432
+ export type PluginPresentationViewsGetArgs = z.infer<
433
+ typeof PluginPresentationViewsGetArgs
434
+ >
435
+
436
+ /**
437
+ * Result of {@linkcode PluginPresentationViewsApi.get} and
438
+ * {@linkcode PluginPresentationViewsApi.getActive} — the view, or `null` when
439
+ * there is no match / no active view.
440
+ */
441
+ export const PluginPresentationViewsGetResult =
442
+ PluginPresentationView.nullable()
443
+ export type PluginPresentationViewsGetResult = z.infer<
444
+ typeof PluginPresentationViewsGetResult
445
+ >
446
+
447
+ /** Image format for {@linkcode PluginPresentationViewsApi.capture}. */
448
+ export const PluginPresentationImageFormat = z.enum(["png", "jpeg"])
449
+ export type PluginPresentationImageFormat = z.infer<
450
+ typeof PluginPresentationImageFormat
451
+ >
452
+
453
+ /**
454
+ * Arguments for {@linkcode PluginPresentationViewsApi.capture}. All optional.
455
+ *
456
+ * | Property | Type | Description |
457
+ * |---|---|---|
458
+ * | `viewId` | `string \| undefined` | Capture this saved view; omit to capture the current viewport |
459
+ * | `format` | `"png" \| "jpeg" \| undefined` | Output image format (default `"png"`) |
460
+ * | `resolution` | `string \| undefined` | Optional resolution hint (e.g. `"1280x720"`) |
461
+ */
462
+ export const PluginPresentationViewsCaptureArgs = z.object({
463
+ viewId: z.string().optional(),
464
+ format: PluginPresentationImageFormat.optional(),
465
+ resolution: z.string().optional(),
466
+ })
467
+ export type PluginPresentationViewsCaptureArgs = z.infer<
468
+ typeof PluginPresentationViewsCaptureArgs
469
+ >
470
+
471
+ /**
472
+ * Result of {@linkcode PluginPresentationViewsApi.capture}.
473
+ *
474
+ * | Property | Type | Description |
475
+ * |---|---|---|
476
+ * | `image` | `string` | The captured image as a base64 data URL |
477
+ */
478
+ export const PluginPresentationViewsCaptureResult = z.object({
479
+ image: z.string(),
480
+ })
481
+ export type PluginPresentationViewsCaptureResult = z.infer<
482
+ typeof PluginPresentationViewsCaptureResult
483
+ >
484
+
485
+ /**
486
+ * Arguments for {@linkcode PluginPresentationViewsApi.setActive}.
487
+ *
488
+ * | Property | Type | Description |
489
+ * |---|---|---|
490
+ * | `id` | `string` | The id of the view to activate |
491
+ */
492
+ export const PluginPresentationViewsSetActiveArgs = z.object({
493
+ id: z.string(),
494
+ })
495
+ export type PluginPresentationViewsSetActiveArgs = z.infer<
496
+ typeof PluginPresentationViewsSetActiveArgs
497
+ >
498
+
499
+ /** Result of {@linkcode PluginPresentationViewsApi.setActive} — the active view's id. */
500
+ export const PluginPresentationViewsSetActiveResult = z.object({
501
+ id: z.string(),
502
+ })
503
+ export type PluginPresentationViewsSetActiveResult = z.infer<
504
+ typeof PluginPresentationViewsSetActiveResult
505
+ >
506
+
507
+ /**
508
+ * Arguments for {@linkcode PluginPresentationViewsApi.create}. All optional.
509
+ *
510
+ * | Property | Type | Description |
511
+ * |---|---|---|
512
+ * | `name` | `string \| undefined` | Name for the new view (a default is used when omitted) |
513
+ * | `kind` | `"view" \| "sitePlan" \| undefined` | What kind of view to save (default `"view"`). `"plan"` is not offered — the host cannot create a plan view without a `planId` this API does not carry. |
514
+ * | `storey` | `number \| undefined` | Save the view on this storey (activated before capture); defaults to the current active storey |
515
+ */
516
+ export const PluginPresentationViewsCreateArgs = z.object({
517
+ name: z.string().optional(),
518
+ kind: z.enum(["view", "sitePlan"]).optional(),
519
+ storey: z.number().optional(),
520
+ })
521
+ export type PluginPresentationViewsCreateArgs = z.infer<
522
+ typeof PluginPresentationViewsCreateArgs
523
+ >
524
+
525
+ /** Result of {@linkcode PluginPresentationViewsApi.create} — the saved view. */
526
+ export const PluginPresentationViewsCreateResult = PluginPresentationView
527
+ export type PluginPresentationViewsCreateResult = z.infer<
528
+ typeof PluginPresentationViewsCreateResult
529
+ >
530
+
531
+ /**
532
+ * How the scene is colored in a view.
533
+ *
534
+ * | Value | Meaning |
535
+ * |---|---|
536
+ * | `monochrome` | Flat single-tone shading |
537
+ * | `texture` | Material textures/colors |
538
+ * | `department` | Colored by department |
539
+ * | `tag:<categoryId>` | Colored by a project tag category (e.g. `tag:ZONE`) |
540
+ *
541
+ * The `tag:<categoryId>` form carries the product's tag-based color schemes
542
+ * losslessly — reading a view that uses one returns the `tag:` string as-is,
543
+ * and writing it back preserves the scheme (read-then-write is safe).
544
+ */
545
+ export const PluginPresentationViewColorMode = z.union([
546
+ z.enum(["monochrome", "texture", "department"]),
547
+ z.templateLiteral(["tag:", z.string()]),
548
+ ])
549
+ export type PluginPresentationViewColorMode = z.infer<
550
+ typeof PluginPresentationViewColorMode
551
+ >
552
+
553
+ /**
554
+ * A category of on-canvas labels a view can show.
555
+ *
556
+ * | Value | Meaning |
557
+ * |---|---|
558
+ * | `objectLabels` | Per-object name labels |
559
+ * | `areas` | Area/room labels |
560
+ * | `department` | Department labels |
561
+ */
562
+ export const PluginPresentationViewLabel = z.enum([
563
+ "objectLabels",
564
+ "areas",
565
+ "department",
566
+ ])
567
+ export type PluginPresentationViewLabel = z.infer<
568
+ typeof PluginPresentationViewLabel
569
+ >
570
+
571
+ /**
572
+ * A view's camera projection: perspective, or isometric (orthographic).
573
+ *
574
+ * | Value | Meaning |
575
+ * |---|---|
576
+ * | `perspective` | Perspective projection (vanishing points) |
577
+ * | `isometric` | Orthographic projection (no perspective distortion) |
578
+ *
579
+ * Applies to 3D views; a 2D plan view is always orthographic and reads
580
+ * `"isometric"`.
581
+ */
582
+ export const PluginPresentationViewMode = z.enum(["perspective", "isometric"])
583
+ export type PluginPresentationViewMode = z.infer<
584
+ typeof PluginPresentationViewMode
585
+ >
586
+
587
+ /**
588
+ * A view's display settings.
589
+ *
590
+ * | Property | Type | Description |
591
+ * |---|---|---|
592
+ * | `backgroundColor` | `string` | Canvas background as a hex color (e.g. `#ffffff`) |
593
+ * | `colorMode` | {@linkcode PluginPresentationViewColorMode} | How the scene is colored (including `tag:<categoryId>` schemes) |
594
+ * | `viewMode` | {@linkcode PluginPresentationViewMode} | Camera projection — `"perspective"` or `"isometric"` (orthographic). Writable on 3D views only; a 2D plan always reads `"isometric"` and accepts only `"isometric"` (a no-op) |
595
+ * | `showAxis` | `boolean` | Whether the X/Y/Z axes are shown |
596
+ * | `showEdges` | `boolean` | Whether edges are shown; `false` = hidden-line rendering |
597
+ * | `showLabels` | `boolean` | Master label switch — whether on-canvas labels are shown at all. `true` always pairs with a non-empty `labels` selection (labels render only while the selection is non-empty; there is no labels-on-with-empty-selection state) |
598
+ * | `labels` | {@linkcode PluginPresentationViewLabel}`[]` | Which label categories are selected. When `showLabels` is `false` the view stores no selection and this reads `[]` |
599
+ * | `cutPlaneHeight` | `number`? | **Plan views only.** Height of the plan's cut plane above its storey base, in engine units (the unit `story.height` uses). Absent on 3D and elevation views |
600
+ * | `viewDepthStorey` | `number`? | **Plan views only.** The lowest storey the plan shows below the cut; defaults to the plan's own storey. Absent on 3D and elevation views |
601
+ * | `showOverheadObjects` | `boolean`? | **Plan views only.** Whether objects above the cut are drawn as dashed overhead linework. Absent on 3D and elevation views |
602
+ */
603
+ export const PluginPresentationViewSettings = z.object({
604
+ backgroundColor: z.string(),
605
+ colorMode: PluginPresentationViewColorMode,
606
+ viewMode: PluginPresentationViewMode,
607
+ showAxis: z.boolean(),
608
+ showEdges: z.boolean(),
609
+ showLabels: z.boolean(),
610
+ labels: z.array(PluginPresentationViewLabel),
611
+ cutPlaneHeight: z.number().finite().positive().optional(),
612
+ viewDepthStorey: z.number().int().optional(),
613
+ showOverheadObjects: z.boolean().optional(),
614
+ })
615
+ export type PluginPresentationViewSettings = z.infer<
616
+ typeof PluginPresentationViewSettings
617
+ >
618
+
619
+ /**
620
+ * Arguments for {@linkcode PluginPresentationViewsApi.getSettings}.
621
+ *
622
+ * | Property | Type | Description |
623
+ * |---|---|---|
624
+ * | `id` | `string` | The id of the view to read settings for |
625
+ */
626
+ export const PluginPresentationViewsGetSettingsArgs = z.object({
627
+ id: z.string(),
628
+ })
629
+ export type PluginPresentationViewsGetSettingsArgs = z.infer<
630
+ typeof PluginPresentationViewsGetSettingsArgs
631
+ >
632
+
633
+ /**
634
+ * Result of {@linkcode PluginPresentationViewsApi.getSettings} — the settings,
635
+ * or `null` when no view has that id.
636
+ */
637
+ export const PluginPresentationViewsGetSettingsResult =
638
+ PluginPresentationViewSettings.nullable()
639
+ export type PluginPresentationViewsGetSettingsResult = z.infer<
640
+ typeof PluginPresentationViewsGetSettingsResult
641
+ >
642
+
643
+ /**
644
+ * Arguments for {@linkcode PluginPresentationViewsApi.updateSettings}. The
645
+ * `settings` patch is partial — any omitted field is left unchanged. A patch
646
+ * pairing `showLabels: false` with a non-empty `labels` list, or
647
+ * `showLabels: true` with an explicitly empty `labels` list, is rejected as
648
+ * contradictory (see the method JSDoc for the full label patch semantics).
649
+ *
650
+ * | Property | Type | Description |
651
+ * |---|---|---|
652
+ * | `id` | `string` | The id of the view to update |
653
+ * | `settings` | `Partial<`{@linkcode PluginPresentationViewSettings}`>` | The fields to change |
654
+ */
655
+ export const PluginPresentationViewsUpdateSettingsArgs = z
656
+ .object({
657
+ id: z.string(),
658
+ settings: PluginPresentationViewSettings.partial(),
659
+ })
660
+ .refine(
661
+ (v) =>
662
+ !(
663
+ v.settings.showLabels === false && (v.settings.labels?.length ?? 0) > 0
664
+ ),
665
+ {
666
+ message:
667
+ "Contradictory patch: labels cannot be set while showLabels is false",
668
+ },
669
+ )
670
+ .refine(
671
+ (v) =>
672
+ !(
673
+ v.settings.showLabels === true &&
674
+ v.settings.labels !== undefined &&
675
+ v.settings.labels.length === 0
676
+ ),
677
+ {
678
+ message:
679
+ "Contradictory patch: showLabels cannot be true with an explicitly empty labels list — pass a non-empty list, or omit labels to apply the defaults",
680
+ },
681
+ )
682
+ export type PluginPresentationViewsUpdateSettingsArgs = z.infer<
683
+ typeof PluginPresentationViewsUpdateSettingsArgs
684
+ >
685
+
686
+ /** Result of {@linkcode PluginPresentationViewsApi.updateSettings} — the updated view's id. */
687
+ export const PluginPresentationViewsUpdateSettingsResult = z.object({
688
+ id: z.string(),
689
+ })
690
+ export type PluginPresentationViewsUpdateSettingsResult = z.infer<
691
+ typeof PluginPresentationViewsUpdateSettingsResult
692
+ >
693
+
694
+ /**
695
+ * Arguments for {@linkcode PluginPresentationViewsApi.rename}.
696
+ *
697
+ * | Property | Type | Description |
698
+ * |---|---|---|
699
+ * | `id` | `string` | The id of the view to rename |
700
+ * | `name` | `string` | New display name (non-empty after trimming) |
701
+ */
702
+ export const PluginPresentationViewsRenameArgs = z.object({
703
+ id: z.string(),
704
+ name: z.string().trim().min(1),
705
+ })
706
+ export type PluginPresentationViewsRenameArgs = z.infer<
707
+ typeof PluginPresentationViewsRenameArgs
708
+ >
709
+
710
+ /** Result of {@linkcode PluginPresentationViewsApi.rename} — the renamed view. */
711
+ export const PluginPresentationViewsRenameResult = PluginPresentationView
712
+ export type PluginPresentationViewsRenameResult = z.infer<
713
+ typeof PluginPresentationViewsRenameResult
714
+ >
715
+
716
+ /**
717
+ * Arguments for {@linkcode PluginPresentationViewsApi.delete}.
718
+ *
719
+ * | Property | Type | Description |
720
+ * |---|---|---|
721
+ * | `id` | `string` | The id of the view to delete |
722
+ */
723
+ export const PluginPresentationViewsDeleteArgs = z.object({
724
+ id: z.string(),
725
+ })
726
+ export type PluginPresentationViewsDeleteArgs = z.infer<
727
+ typeof PluginPresentationViewsDeleteArgs
728
+ >
729
+
730
+ /**
731
+ * Result of {@linkcode PluginPresentationViewsApi.delete}.
732
+ *
733
+ * | Property | Type | Description |
734
+ * |---|---|---|
735
+ * | `id` | `string` | Id of the deleted view |
736
+ */
737
+ export const PluginPresentationViewsDeleteResult = z.object({
738
+ id: z.string(),
739
+ })
740
+ export type PluginPresentationViewsDeleteResult = z.infer<
741
+ typeof PluginPresentationViewsDeleteResult
742
+ >