@snaptrude/plugin-core 0.11.0-rc.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/AGENTS.md +4 -0
  2. package/CHANGELOG.md +176 -14
  3. package/api-manifest.json +872 -49
  4. package/dist/api/analysis/daylight.d.ts +5 -5
  5. package/dist/api/analysis/solar.d.ts +2 -2
  6. package/dist/api/core/camera/index.d.ts +447 -0
  7. package/dist/api/core/camera/index.d.ts.map +1 -1
  8. package/dist/api/core/geom/create/index.d.ts +942 -101
  9. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  10. package/dist/api/core/geom/query/brep.d.ts +59 -2
  11. package/dist/api/core/geom/query/brep.d.ts.map +1 -1
  12. package/dist/api/core/geom/query/curve.d.ts +59 -35
  13. package/dist/api/core/geom/query/curve.d.ts.map +1 -1
  14. package/dist/api/core/geom/query/edge.d.ts +2 -2
  15. package/dist/api/core/geom/query/face.d.ts +105 -0
  16. package/dist/api/core/geom/query/face.d.ts.map +1 -1
  17. package/dist/api/core/geom/update/contour.d.ts +10 -2
  18. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  19. package/dist/api/core/geom/update/curve.d.ts +5 -5
  20. package/dist/api/core/geom/update/profile.d.ts +3 -1
  21. package/dist/api/core/geom/update/profile.d.ts.map +1 -1
  22. package/dist/api/core/handles/index.d.ts +4 -2
  23. package/dist/api/core/handles/index.d.ts.map +1 -1
  24. package/dist/api/core/index.d.ts +4 -4
  25. package/dist/api/core/index.d.ts.map +1 -1
  26. package/dist/api/core/io/import/index.d.ts +3 -1
  27. package/dist/api/core/io/import/index.d.ts.map +1 -1
  28. package/dist/api/core/layers.d.ts +377 -255
  29. package/dist/api/core/layers.d.ts.map +1 -1
  30. package/dist/api/core/mode/index.d.ts +19 -7
  31. package/dist/api/core/mode/index.d.ts.map +1 -1
  32. package/dist/api/core/proposals/index.d.ts +4 -3
  33. package/dist/api/core/proposals/index.d.ts.map +1 -1
  34. package/dist/api/core/storeys/index.d.ts +17 -2
  35. package/dist/api/core/storeys/index.d.ts.map +1 -1
  36. package/dist/api/core/storeys/layers.d.ts +408 -0
  37. package/dist/api/core/storeys/layers.d.ts.map +1 -0
  38. package/dist/api/core/tags.d.ts +84 -3
  39. package/dist/api/core/tags.d.ts.map +1 -1
  40. package/dist/api/core/zoom/index.d.ts +13 -0
  41. package/dist/api/core/zoom/index.d.ts.map +1 -1
  42. package/dist/api/design/bim.d.ts +299 -0
  43. package/dist/api/design/bim.d.ts.map +1 -0
  44. package/dist/api/design/boolean/index.d.ts +2 -0
  45. package/dist/api/design/boolean/index.d.ts.map +1 -1
  46. package/dist/api/design/catalog.d.ts +320 -0
  47. package/dist/api/design/catalog.d.ts.map +1 -0
  48. package/dist/api/design/create/bulk-items.d.ts +269 -0
  49. package/dist/api/design/create/bulk-items.d.ts.map +1 -0
  50. package/dist/api/design/create/grids.d.ts +132 -0
  51. package/dist/api/design/create/grids.d.ts.map +1 -0
  52. package/dist/api/design/create/index.d.ts +753 -102
  53. package/dist/api/design/create/index.d.ts.map +1 -1
  54. package/dist/api/design/create/opening-fields.d.ts +38 -0
  55. package/dist/api/design/create/opening-fields.d.ts.map +1 -0
  56. package/dist/api/design/delete/index.d.ts +7 -20
  57. package/dist/api/design/delete/index.d.ts.map +1 -1
  58. package/dist/api/design/dimensions.d.ts +427 -0
  59. package/dist/api/design/dimensions.d.ts.map +1 -0
  60. package/dist/api/design/doors/index.d.ts +24 -23
  61. package/dist/api/design/doors/index.d.ts.map +1 -1
  62. package/dist/api/design/family.d.ts +1446 -0
  63. package/dist/api/design/family.d.ts.map +1 -0
  64. package/dist/api/design/grids.d.ts +237 -0
  65. package/dist/api/design/grids.d.ts.map +1 -0
  66. package/dist/api/design/index.d.ts +30 -0
  67. package/dist/api/design/index.d.ts.map +1 -1
  68. package/dist/api/design/networks.d.ts +1703 -0
  69. package/dist/api/design/networks.d.ts.map +1 -0
  70. package/dist/api/design/query/geometry/index.d.ts +33 -5
  71. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  72. package/dist/api/design/query/grids.d.ts +287 -0
  73. package/dist/api/design/query/grids.d.ts.map +1 -0
  74. package/dist/api/design/query/index.d.ts +143 -36
  75. package/dist/api/design/query/index.d.ts.map +1 -1
  76. package/dist/api/design/query/spaces.d.ts +5 -66
  77. package/dist/api/design/query/spaces.d.ts.map +1 -1
  78. package/dist/api/design/selection/index.d.ts +12 -12
  79. package/dist/api/design/types/index.d.ts +40 -24
  80. package/dist/api/design/types/index.d.ts.map +1 -1
  81. package/dist/api/design/update/index.d.ts +412 -8
  82. package/dist/api/design/update/index.d.ts.map +1 -1
  83. package/dist/api/design/windows/index.d.ts +8 -8
  84. package/dist/api/design/windows/index.d.ts.map +1 -1
  85. package/dist/api/entity/buildableEnvelope.d.ts +84 -2
  86. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  87. package/dist/api/entity/referenceLine.d.ts +13 -1
  88. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  89. package/dist/api/entity/space.d.ts +12 -15
  90. package/dist/api/entity/space.d.ts.map +1 -1
  91. package/dist/api/entity/story.d.ts +4 -4
  92. package/dist/api/presentation/aiInspiration.d.ts +24 -24
  93. package/dist/api/presentation/annotate.d.ts +38 -22
  94. package/dist/api/presentation/annotate.d.ts.map +1 -1
  95. package/dist/api/presentation/camera.d.ts +265 -0
  96. package/dist/api/presentation/camera.d.ts.map +1 -0
  97. package/dist/api/presentation/drawingContract.d.ts +32 -0
  98. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  99. package/dist/api/presentation/drawings.d.ts +3523 -0
  100. package/dist/api/presentation/drawings.d.ts.map +1 -0
  101. package/dist/api/presentation/export.d.ts +23 -5
  102. package/dist/api/presentation/export.d.ts.map +1 -1
  103. package/dist/api/presentation/graphics.d.ts +419 -0
  104. package/dist/api/presentation/graphics.d.ts.map +1 -0
  105. package/dist/api/presentation/index.d.ts +66 -12
  106. package/dist/api/presentation/index.d.ts.map +1 -1
  107. package/dist/api/presentation/placedViews.d.ts +117 -51
  108. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  109. package/dist/api/presentation/sections.d.ts +461 -0
  110. package/dist/api/presentation/sections.d.ts.map +1 -0
  111. package/dist/api/presentation/shapes.d.ts +2 -2
  112. package/dist/api/presentation/sheets.d.ts +175 -37
  113. package/dist/api/presentation/sheets.d.ts.map +1 -1
  114. package/dist/api/presentation/standards.d.ts +590 -0
  115. package/dist/api/presentation/standards.d.ts.map +1 -0
  116. package/dist/api/presentation/viewPresets.d.ts +222 -0
  117. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  118. package/dist/api/presentation/views.d.ts +144 -9
  119. package/dist/api/presentation/views.d.ts.map +1 -1
  120. package/dist/api/presentation/walkthroughs.d.ts +1350 -0
  121. package/dist/api/presentation/walkthroughs.d.ts.map +1 -0
  122. package/dist/api/program/departments.d.ts +58 -2
  123. package/dist/api/program/departments.d.ts.map +1 -1
  124. package/dist/api/program/index.d.ts +16 -6
  125. package/dist/api/program/index.d.ts.map +1 -1
  126. package/dist/api/program/labels.d.ts +355 -0
  127. package/dist/api/program/labels.d.ts.map +1 -0
  128. package/dist/api/program/metadata.d.ts +328 -0
  129. package/dist/api/program/metadata.d.ts.map +1 -0
  130. package/dist/api/program/site.d.ts +4 -4
  131. package/dist/api/program/spreadsheet.d.ts +267 -4
  132. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  133. package/dist/api/workspace/index.d.ts +49 -2
  134. package/dist/api/workspace/index.d.ts.map +1 -1
  135. package/dist/errors/codes.d.ts +5 -8
  136. package/dist/errors/codes.d.ts.map +1 -1
  137. package/dist/handles.d.ts +32 -3
  138. package/dist/handles.d.ts.map +1 -1
  139. package/dist/index.cjs +6534 -2865
  140. package/dist/index.cjs.map +1 -1
  141. package/dist/index.d.ts +2 -0
  142. package/dist/index.d.ts.map +1 -1
  143. package/dist/index.js +6118 -2857
  144. package/dist/index.js.map +1 -1
  145. package/dist/massParameters.d.ts +287 -0
  146. package/dist/massParameters.d.ts.map +1 -0
  147. package/dist/massParameters.ops.d.ts +138 -0
  148. package/dist/massParameters.ops.d.ts.map +1 -0
  149. package/package.json +2 -1
  150. package/scripts/check-dist-fresh.mjs +22 -0
  151. package/scripts/generate-manifest.mjs +5 -0
  152. package/scripts/generate-manifest.test.mjs +14 -3
  153. package/src/api/core/camera/index.ts +429 -1
  154. package/src/api/core/geom/create/index.ts +1037 -102
  155. package/src/api/core/geom/query/brep.ts +60 -2
  156. package/src/api/core/geom/query/curve.ts +26 -2
  157. package/src/api/core/geom/query/edge.ts +2 -2
  158. package/src/api/core/geom/query/face.ts +109 -4
  159. package/src/api/core/geom/update/contour.ts +10 -2
  160. package/src/api/core/geom/update/profile.ts +2 -0
  161. package/src/api/core/handles/index.ts +3 -2
  162. package/src/api/core/index.ts +4 -4
  163. package/src/api/core/io/import/index.ts +11 -3
  164. package/src/api/core/layers.ts +380 -173
  165. package/src/api/core/mode/index.ts +19 -7
  166. package/src/api/core/proposals/index.ts +4 -3
  167. package/src/api/core/storeys/index.ts +19 -2
  168. package/src/api/core/storeys/layers.ts +339 -0
  169. package/src/api/core/tags.ts +76 -0
  170. package/src/api/core/zoom/index.ts +13 -0
  171. package/src/api/design/bim.ts +210 -0
  172. package/src/api/design/boolean/index.ts +2 -0
  173. package/src/api/design/catalog.ts +203 -0
  174. package/src/api/design/create/bulk-items.ts +294 -0
  175. package/src/api/design/create/grids.ts +137 -0
  176. package/src/api/design/create/index.ts +824 -141
  177. package/src/api/design/create/opening-fields.ts +40 -0
  178. package/src/api/design/delete/index.ts +6 -20
  179. package/src/api/design/dimensions.ts +453 -0
  180. package/src/api/design/doors/index.ts +64 -41
  181. package/src/api/design/family.ts +1342 -0
  182. package/src/api/design/grids.ts +237 -0
  183. package/src/api/design/index.ts +49 -4
  184. package/src/api/design/networks.ts +607 -0
  185. package/src/api/design/query/geometry/index.ts +35 -4
  186. package/src/api/design/query/grids.ts +197 -0
  187. package/src/api/design/query/index.ts +105 -5
  188. package/src/api/design/query/spaces.ts +0 -68
  189. package/src/api/design/types/index.ts +31 -24
  190. package/src/api/design/update/index.ts +398 -4
  191. package/src/api/design/windows/index.ts +40 -22
  192. package/src/api/entity/buildableEnvelope.ts +77 -2
  193. package/src/api/entity/referenceLine.ts +25 -12
  194. package/src/api/entity/space.ts +0 -2
  195. package/src/api/presentation/annotate.ts +90 -58
  196. package/src/api/presentation/camera.ts +289 -0
  197. package/src/api/presentation/drawingContract.ts +70 -0
  198. package/src/api/presentation/drawings.ts +1179 -0
  199. package/src/api/presentation/export.ts +32 -6
  200. package/src/api/presentation/graphics.ts +324 -0
  201. package/src/api/presentation/index.ts +73 -14
  202. package/src/api/presentation/placedViews.ts +120 -57
  203. package/src/api/presentation/sections.ts +420 -0
  204. package/src/api/presentation/sheets.ts +182 -37
  205. package/src/api/presentation/standards.ts +445 -0
  206. package/src/api/presentation/viewPresets.ts +241 -0
  207. package/src/api/presentation/views.ts +81 -10
  208. package/src/api/presentation/walkthroughs.ts +1201 -0
  209. package/src/api/program/departments.ts +54 -2
  210. package/src/api/program/index.ts +16 -6
  211. package/src/api/program/labels.ts +332 -0
  212. package/src/api/program/metadata.ts +364 -0
  213. package/src/api/program/spreadsheet.ts +282 -0
  214. package/src/api/workspace/index.ts +51 -2
  215. package/src/errors/codes.ts +9 -30
  216. package/src/handles.ts +42 -3
  217. package/src/index.ts +2 -0
  218. package/src/massParameters.ops.ts +246 -0
  219. package/src/massParameters.ts +427 -0
  220. package/test/drawingContract.test.mjs +288 -0
  221. package/test/errors.test.mjs +1 -4
  222. package/test/massParameters.test.mjs +952 -0
  223. package/test/paperPensContract.test.mjs +75 -0
  224. package/test/presentationViewSettings.test.mjs +85 -0
  225. package/api-manifest.full.json +0 -6928
  226. package/snaptrude-plugin-core-0.11.0.tgz +0 -0
@@ -29,10 +29,14 @@ export interface PluginCoreModeSetResult {
29
29
  * Not to be confused with the viewport's 2D/3D camera mode
30
30
  * (`core.camera.setMode`) or saved presentation views (`presentation.views`).
31
31
  *
32
- * `set` covers `design`, `bim`, and `present` — in-page switches.
33
- * `program` opens in its own browser tab in the product, which a plugin worker
34
- * cannot do, so `set("program")` fails with `PRECONDITION_FAILED`; `get()`
35
- * still reports `"program"` for code running in the Program tab.
32
+ * `set` covers `design`, `bim`, and `present` — in-page switches — and
33
+ * `program`, which opens the Program tab (a paired browser window) through the
34
+ * same path as the top bar's Program button. Because the open happens outside a
35
+ * user gesture the browser may block the pop-up; the editor then shows its
36
+ * "Allow pop-up to continue" modal and the tab opens when the user confirms.
37
+ * `get()` reports `"program"` only for code running in the Program tab itself.
38
+ * Prefer {@linkcode PluginWorkspaceApi.openProgramMode} when you need to know
39
+ * the tab is ready before calling `program.spreadsheet.*`.
36
40
  */
37
41
  export abstract class PluginCoreModeApi {
38
42
  constructor() {}
@@ -74,16 +78,24 @@ export abstract class PluginCoreModeApi {
74
78
  * Switch the editor to another application mode — the same action as
75
79
  * clicking that tab in the top menu bar.
76
80
  *
77
- * Supported: `"design"`, `"bim"`, `"present"`. Switching to
78
- * `"program"` is rejected with `PRECONDITION_FAILED` (the Program surface
79
- * opens in its own browser tab in the product; a plugin cannot open one).
81
+ * `"design"`, `"bim"` and `"present"` switch in place. `"program"` opens
82
+ * the Program tab (a paired browser window) exactly as the top bar's Program
83
+ * button does, and resolves once that tab has connected to the editor (up to
84
+ * ~90s — the browser may block the pop-up, in which case the editor shows an
85
+ * "Allow pop-up to continue" modal and waits for the user to confirm).
86
+ * Idempotent when the Program tab is already open. Note `get()` in the model
87
+ * tab keeps reporting the model tab's own mode afterwards; the Program tab is
88
+ * a separate window.
80
89
  *
81
90
  * @param mode - Target mode token from {@linkcode PluginAppMode}
82
91
  * @returns The committed `{ mode }` after the switch.
92
+ * @throws `PRECONDITION_FAILED` for `"program"` when the user dismisses the
93
+ * pop-up modal or the tab does not connect within the timeout.
83
94
  *
84
95
  * @examplePrompt Switch to present mode
85
96
  * @examplePrompt Open BIM mode
86
97
  * @examplePrompt Go back to design mode
98
+ * @examplePrompt Open program mode
87
99
  *
88
100
  * # Example
89
101
  * ```ts
@@ -6,7 +6,8 @@ import { ComponentHandle } from "../../../handles"
6
6
  * Proposals — read and edit the project's design options ("proposals").
7
7
  *
8
8
  * A **proposal** is a design option: one of several variants of the same
9
- * project. Each proposal owns a set of buckets (a bucket == a drawing layer),
9
+ * project. Each proposal owns a set of buckets (a bucket is a layer in the
10
+ * Layers panel; read them with `core.layers.get` / {@linkcode PluginCoreLayersApi}),
10
11
  * and switching the active proposal shows/hides the buckets it owns. Proposals
11
12
  * are **infrastructure**, not design — they own the buckets/layers geometry
12
13
  * lives in — so they sit under `core`, not `design` (constitution §2A).
@@ -324,8 +325,8 @@ export abstract class PluginCoreProposalsApi {
324
325
  * | `id` | `string` | Stable public proposal id (e.g. `"prop_1"`) |
325
326
  * | `name` | `string` | Display name (≤ 24 chars) |
326
327
  * | `isActive` | `boolean` | Whether this is the active proposal |
327
- * | `defaultBucketId` | `string` | Id of the proposal's default bucket (cannot be unshared) |
328
- * | `bucketIds` | `string[]` | Ids of every bucket (layer) the proposal owns |
328
+ * | `defaultBucketId` | `string` | Id of the proposal's default layer (cannot be unshared); read it with `core.layers.get` ({@linkcode PluginCoreLayersApi}) |
329
+ * | `bucketIds` | `string[]` | Ids of every layer in the Layers panel the proposal owns; read them with `core.layers.get` ({@linkcode PluginCoreLayersApi}) |
329
330
  * | `createdAt` | `string` | ISO creation timestamp |
330
331
  * | `createdBy` | `string` | User id of the creator |
331
332
  */
@@ -11,6 +11,7 @@ import {
11
11
  PluginStoryDeleteResult,
12
12
  PluginStoryDuplicateResult,
13
13
  } from "../../entity/story"
14
+ import { PluginCoreStoreysLayersApi } from "./layers"
14
15
 
15
16
  /**
16
17
  * Storey (floor) management.
@@ -24,11 +25,22 @@ import {
24
25
  * API calls** that return Promises and support undo/redo via Snaptrude's command
25
26
  * system (except {@linkcode PluginCoreStoreysApi.setActive}, a view change).
26
27
  *
28
+ * - {@linkcode PluginCoreStoreysApi.layers} — each storey's sketch surfaces
29
+ * (Wall, Rough) and imported underlays (CAD, PDF, image, terrain): list, get,
30
+ * active layer get/set, show/hide. Not the Layers panel; that is `core.layers`.
31
+ *
27
32
  * Accessed via `snaptrude.core.storeys`.
28
33
  */
29
34
  export abstract class PluginCoreStoreysApi {
30
35
  constructor() {}
31
36
 
37
+ /**
38
+ * Storey layers — each storey's sketch surfaces and imported underlays (ids
39
+ * like `ly_5`), formerly `core.layers`. Not the layers in the Layers panel;
40
+ * use `core.layers` for those. See {@linkcode PluginCoreStoreysLayersApi}.
41
+ */
42
+ public abstract layers: PluginCoreStoreysLayersApi
43
+
32
44
  /**
33
45
  * Get properties of a storey by its storey number.
34
46
  *
@@ -178,12 +190,15 @@ export abstract class PluginCoreStoreysApi {
178
190
  /**
179
191
  * Make a storey the active storey — the same as clicking it in the storey/layer
180
192
  * panel. Subsequent draws and creates target this storey, and in 2D the
181
- * viewport switches to it. This is a view/navigation change: it is **not**
193
+ * viewport switches to that storey's plan (and its cut range), unless the
194
+ * active view is already a plan on it.
195
+ * This is a view/navigation change: it is **not**
182
196
  * undoable and commits nothing to the model.
183
197
  *
184
198
  * @param storyValue - Integer storey number to activate
185
199
  * @returns A {@linkcode PluginStorySetActiveResult} echoing the now-active `storyValue`
186
- * @throws `PRECONDITION_FAILED` if no storey has the given value
200
+ * @throws `PRECONDITION_FAILED` if no storey has the given value, or in 2D if
201
+ * the storey has no plan
187
202
  *
188
203
  * @examplePrompt Switch to the second floor
189
204
  * @examplePrompt Make the ground storey active
@@ -292,3 +307,5 @@ export const PluginCoreStoreysListResult = z.object({
292
307
  export type PluginCoreStoreysListResult = z.infer<
293
308
  typeof PluginCoreStoreysListResult
294
309
  >
310
+
311
+ export * from "./layers"
@@ -0,0 +1,339 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+
4
+ /**
5
+ * Storey layers — read and toggle a storey's sketch surfaces and imported
6
+ * underlays.
7
+ *
8
+ * These are each storey's built-in sketch surfaces (Wall, Rough) and its
9
+ * imported underlays (CAD, PDF, images, terrain, neighbourhood buildings), with
10
+ * ids like `ly_5`. They are **NOT** the layers in the product's Layers panel in
11
+ * the left sidebar; use {@linkcode PluginCoreLayersApi} (`core.layers`) for
12
+ * those. They are also not wall/floor construction-assembly material layers.
13
+ *
14
+ * Reads return plain records and never throw for a missing layer (`get` and
15
+ * `getActive` return `null`, `list` returns `[]`).
16
+ *
17
+ * Storey layers are created only by storey creation and `core.io.import.*`;
18
+ * delete underlays with `core.io.underlay.delete` / `core.io.terrain.delete`.
19
+ *
20
+ * Sub-namespace members typed as optional (`?`) are **authored ahead of the
21
+ * host** — declared so plugins and codegen can see the shape, but kept out of the
22
+ * discovery manifest until the host lands them (at which point they are promoted
23
+ * to required `abstract` members).
24
+ *
25
+ * Accessed via `snaptrude.core.storeys.layers` (formerly `core.layers`).
26
+ *
27
+ * Formerly `core.layers`. Calls in that shape on `core.layers` (`list(storeyId)`,
28
+ * `getActive(storeyId)`, `get` / `setActive` / `update(layerId, hidden)` with a
29
+ * `ly_*` id) are still routed here, so plugins built before 0.9.15 keep working.
30
+ */
31
+ export abstract class PluginCoreStoreysLayersApi {
32
+ constructor() {}
33
+
34
+ /**
35
+ * List the storey layers of a storey.
36
+ *
37
+ * Optionally filter to a single {@linkcode PluginCoreStoreyLayerType}.
38
+ *
39
+ * @param storeyId - The storey whose layers to read.
40
+ * @param layerType - Optional {@linkcode PluginCoreStoreyLayerType} filter.
41
+ * @returns A {@linkcode PluginCoreStoreysLayersListResult} with a `layers` array
42
+ * (empty when the storey is missing or has no matching layers).
43
+ *
44
+ * @examplePrompt List the sketch surfaces and underlays on this storey
45
+ * @examplePrompt Show all the PDF underlays on storey st_2
46
+ * @examplePrompt What CAD layers are on the ground floor?
47
+ *
48
+ * # Example
49
+ * ```ts
50
+ * const { layers } = await snaptrude.core.storeys.layers.list("st_2")
51
+ * for (const l of layers) console.log(l.name, l.layerType, l.hidden)
52
+ * ```
53
+ */
54
+ public abstract list(
55
+ storeyId: string,
56
+ layerType?: PluginCoreStoreyLayerType,
57
+ ): PluginApiReturn<PluginCoreStoreysLayersListResult>
58
+
59
+ /**
60
+ * Get a single storey layer by id.
61
+ *
62
+ * @param layerId - The id of the layer to read.
63
+ * @returns The matching {@linkcode PluginCoreStoreyLayer}, or `null` if no layer has
64
+ * that id.
65
+ *
66
+ * @examplePrompt Get the storey drawing layer with id ly_5
67
+ * @examplePrompt Is storey layer ly_5 hidden?
68
+ * @examplePrompt Look up a storey underlay layer by id
69
+ *
70
+ * # Example
71
+ * ```ts
72
+ * const layer = await snaptrude.core.storeys.layers.get("ly_5")
73
+ * if (layer) console.log(layer.name, layer.hidden, layer.locked)
74
+ * ```
75
+ */
76
+ public abstract get(
77
+ layerId: string,
78
+ ): PluginApiReturn<PluginCoreStoreysLayersGetResult>
79
+
80
+ /**
81
+ * Get the active storey layer of a storey.
82
+ *
83
+ * The active layer is the one new sketch geometry is drawn onto. Paired with
84
+ * {@linkcode PluginCoreStoreysLayersApi.setActive}.
85
+ *
86
+ * @param storeyId - The storey whose active layer to read.
87
+ * @returns The active {@linkcode PluginCoreStoreyLayer}, or `null` if the storey is
88
+ * missing or has no active layer.
89
+ *
90
+ * @examplePrompt Which sketch surface (Wall/Rough) is active on this storey?
91
+ * @examplePrompt Get the active storey drawing layer on st_2
92
+ * @examplePrompt Which storey layer is new sketch geometry drawn onto?
93
+ *
94
+ * # Example
95
+ * ```ts
96
+ * const active = await snaptrude.core.storeys.layers.getActive("st_2")
97
+ * if (active) console.log(active.name)
98
+ * ```
99
+ */
100
+ public abstract getActive(
101
+ storeyId: string,
102
+ ): PluginApiReturn<PluginCoreStoreysLayersGetActiveResult>
103
+
104
+ /**
105
+ * Make a storey layer the active layer of its storey.
106
+ *
107
+ * Paired with {@linkcode PluginCoreStoreysLayersApi.getActive}.
108
+ *
109
+ * @param layerId - The id of the layer to activate.
110
+ * @returns The id of the now-active layer.
111
+ * @throws If no layer has the given id.
112
+ *
113
+ * @examplePrompt Switch this storey's sketch surface to the Rough layer
114
+ * @examplePrompt Make storey layer ly_5 the active sketch surface
115
+ * @examplePrompt Switch the active storey layer to the CAD underlay
116
+ *
117
+ * # Example
118
+ * ```ts
119
+ * await snaptrude.core.storeys.layers.setActive("ly_5")
120
+ * ```
121
+ */
122
+ public abstract setActive(
123
+ layerId: string,
124
+ ): PluginApiReturn<PluginCoreStoreysLayersSetActiveResult>
125
+
126
+ /**
127
+ * Update a storey layer's visibility.
128
+ *
129
+ * A **sparse** update: omit `hidden` to leave it unchanged. This edit is **not
130
+ * undoable**. Locking and renaming are not exposed — layer `locked` is a
131
+ * read-only status here (setting it at runtime does not lock the live meshes or
132
+ * show a padlock in the app until a reload), and a rename cascades to every member
133
+ * mesh's `layerName`, a corruption hazard.
134
+ *
135
+ * @param layerId - The id of the layer to update.
136
+ * @param hidden - New hidden state (unchanged if omitted).
137
+ * @returns The updated {@linkcode PluginCoreStoreyLayer}.
138
+ * @throws If no layer has the given id.
139
+ *
140
+ * @examplePrompt Hide the PDF underlay layer
141
+ * @examplePrompt Show the CAD underlay again
142
+ * @examplePrompt Hide storey layer ly_5
143
+ *
144
+ * # Example
145
+ * ```ts
146
+ * const layer = await snaptrude.core.storeys.layers.update("ly_5", true)
147
+ * ```
148
+ */
149
+ public abstract update(
150
+ layerId: string,
151
+ hidden?: boolean,
152
+ ): PluginApiReturn<PluginCoreStoreysLayersUpdateResult>
153
+ }
154
+
155
+ /**
156
+ * The kind of a storey layer.
157
+ *
158
+ * Author-drawable kinds (`floor`, `wall`, `ceiling`, `rough`, `default`) plus
159
+ * read-only imported underlays (`image`, `cad`, `pdf`, `terrain`, `buildings`).
160
+ */
161
+ export const PluginCoreStoreyLayerType = z.enum([
162
+ "floor",
163
+ "wall",
164
+ "ceiling",
165
+ "rough",
166
+ "default",
167
+ "image",
168
+ "cad",
169
+ "pdf",
170
+ "terrain",
171
+ "buildings",
172
+ ])
173
+ export type PluginCoreStoreyLayerType = z.infer<typeof PluginCoreStoreyLayerType>
174
+
175
+ /**
176
+ * A storey layer on a storey.
177
+ *
178
+ * | Property | Type | Description |
179
+ * |---|---|---|
180
+ * | `id` | `string` | Stable public layer id (e.g. `"ly_5"`) |
181
+ * | `name` | `string` | Display name |
182
+ * | `layerType` | {@linkcode PluginCoreStoreyLayerType} | The layer's kind |
183
+ * | `storeyId` | `string` | The stable id of the storey this layer belongs to |
184
+ * | `buildingId` | `string` | The stable id of the building this layer belongs to |
185
+ * | `hidden` | `boolean` | Whether the layer is hidden |
186
+ * | `locked` | `boolean` | Whether the layer is locked against edits |
187
+ * | `contentSummary` | `object` | A summary of what the layer holds (see below) |
188
+ *
189
+ * `contentSummary`:
190
+ *
191
+ * | Property | Type | Description |
192
+ * |---|---|---|
193
+ * | `hasFloorplan` | `boolean` | Whether the layer holds drawn floorplan geometry |
194
+ * | `pdfCount` | `number` | Number of PDF underlays on the layer |
195
+ * | `hasTerrain` | `boolean` | Whether the layer holds terrain |
196
+ */
197
+ export const PluginCoreStoreyLayer = z.object({
198
+ id: z.string(),
199
+ name: z.string(),
200
+ layerType: PluginCoreStoreyLayerType,
201
+ storeyId: z.string(),
202
+ buildingId: z.string(),
203
+ hidden: z.boolean(),
204
+ locked: z.boolean(),
205
+ contentSummary: z.object({
206
+ hasFloorplan: z.boolean(),
207
+ pdfCount: z.number().int(),
208
+ hasTerrain: z.boolean(),
209
+ }),
210
+ })
211
+ export type PluginCoreStoreyLayer = z.infer<typeof PluginCoreStoreyLayer>
212
+
213
+ /**
214
+ * Arguments for {@linkcode PluginCoreStoreysLayersApi.list}.
215
+ *
216
+ * | Property | Type | Description |
217
+ * |---|---|---|
218
+ * | `storeyId` | `string` | The storey whose layers to read |
219
+ * | `layerType` | {@linkcode PluginCoreStoreyLayerType}` \| undefined` | Optional layer-type filter |
220
+ */
221
+ export const PluginCoreStoreysLayersListArgs = z.object({
222
+ storeyId: z.string(),
223
+ layerType: PluginCoreStoreyLayerType.optional(),
224
+ })
225
+ export type PluginCoreStoreysLayersListArgs = z.infer<
226
+ typeof PluginCoreStoreysLayersListArgs
227
+ >
228
+
229
+ /**
230
+ * Result of {@linkcode PluginCoreStoreysLayersApi.list}.
231
+ *
232
+ * | Property | Type | Description |
233
+ * |---|---|---|
234
+ * | `layers` | {@linkcode PluginCoreStoreyLayer}`[]` | The storey's storey layers (empty when missing or none match) |
235
+ */
236
+ export const PluginCoreStoreysLayersListResult = z.object({
237
+ layers: z.array(PluginCoreStoreyLayer),
238
+ })
239
+ export type PluginCoreStoreysLayersListResult = z.infer<
240
+ typeof PluginCoreStoreysLayersListResult
241
+ >
242
+
243
+ /**
244
+ * Arguments for {@linkcode PluginCoreStoreysLayersApi.get}.
245
+ *
246
+ * | Property | Type | Description |
247
+ * |---|---|---|
248
+ * | `layerId` | `string` | The id of the layer to read |
249
+ */
250
+ export const PluginCoreStoreysLayersGetArgs = z.object({
251
+ layerId: z.string(),
252
+ })
253
+ export type PluginCoreStoreysLayersGetArgs = z.infer<
254
+ typeof PluginCoreStoreysLayersGetArgs
255
+ >
256
+
257
+ /**
258
+ * Result of {@linkcode PluginCoreStoreysLayersApi.get} — the layer, or `null`
259
+ * when no layer has the given id.
260
+ */
261
+ export const PluginCoreStoreysLayersGetResult = PluginCoreStoreyLayer.nullable()
262
+ export type PluginCoreStoreysLayersGetResult = z.infer<
263
+ typeof PluginCoreStoreysLayersGetResult
264
+ >
265
+
266
+ /**
267
+ * Arguments for {@linkcode PluginCoreStoreysLayersApi.getActive}.
268
+ *
269
+ * | Property | Type | Description |
270
+ * |---|---|---|
271
+ * | `storeyId` | `string` | The storey whose active layer to read |
272
+ */
273
+ export const PluginCoreStoreysLayersGetActiveArgs = z.object({
274
+ storeyId: z.string(),
275
+ })
276
+ export type PluginCoreStoreysLayersGetActiveArgs = z.infer<
277
+ typeof PluginCoreStoreysLayersGetActiveArgs
278
+ >
279
+
280
+ /**
281
+ * Result of {@linkcode PluginCoreStoreysLayersApi.getActive} — the active layer,
282
+ * or `null` when the storey is missing or has no active layer.
283
+ */
284
+ export const PluginCoreStoreysLayersGetActiveResult = PluginCoreStoreyLayer.nullable()
285
+ export type PluginCoreStoreysLayersGetActiveResult = z.infer<
286
+ typeof PluginCoreStoreysLayersGetActiveResult
287
+ >
288
+
289
+ /**
290
+ * Arguments for {@linkcode PluginCoreStoreysLayersApi.setActive}.
291
+ *
292
+ * | Property | Type | Description |
293
+ * |---|---|---|
294
+ * | `layerId` | `string` | The id of the layer to activate |
295
+ */
296
+ export const PluginCoreStoreysLayersSetActiveArgs = z.object({
297
+ layerId: z.string(),
298
+ })
299
+ export type PluginCoreStoreysLayersSetActiveArgs = z.infer<
300
+ typeof PluginCoreStoreysLayersSetActiveArgs
301
+ >
302
+
303
+ /**
304
+ * Result of {@linkcode PluginCoreStoreysLayersApi.setActive} — the now-active
305
+ * layer's id.
306
+ *
307
+ * | Property | Type | Description |
308
+ * |---|---|---|
309
+ * | `layerId` | `string` | The id of the now-active layer |
310
+ */
311
+ export const PluginCoreStoreysLayersSetActiveResult = z.object({
312
+ layerId: z.string(),
313
+ })
314
+ export type PluginCoreStoreysLayersSetActiveResult = z.infer<
315
+ typeof PluginCoreStoreysLayersSetActiveResult
316
+ >
317
+
318
+ /**
319
+ * Arguments for {@linkcode PluginCoreStoreysLayersApi.update}. Sparse — only the
320
+ * provided fields are changed.
321
+ *
322
+ * | Property | Type | Description |
323
+ * |---|---|---|
324
+ * | `layerId` | `string` | The id of the layer to update |
325
+ * | `hidden` | `boolean \| undefined` | New hidden state (unchanged if omitted) |
326
+ */
327
+ export const PluginCoreStoreysLayersUpdateArgs = z.object({
328
+ layerId: z.string(),
329
+ hidden: z.boolean().optional(),
330
+ })
331
+ export type PluginCoreStoreysLayersUpdateArgs = z.infer<
332
+ typeof PluginCoreStoreysLayersUpdateArgs
333
+ >
334
+
335
+ /** Result of {@linkcode PluginCoreStoreysLayersApi.update} — the updated layer. */
336
+ export const PluginCoreStoreysLayersUpdateResult = PluginCoreStoreyLayer
337
+ export type PluginCoreStoreysLayersUpdateResult = z.infer<
338
+ typeof PluginCoreStoreysLayersUpdateResult
339
+ >
@@ -163,6 +163,40 @@ export abstract class PluginCoreTagsApi {
163
163
  componentId: ComponentHandle,
164
164
  ): PluginApiReturn<PluginCoreTagsGetTagsForComponentResult>
165
165
 
166
+ /**
167
+ * List the tags carried by many components in one call.
168
+ *
169
+ * The plural of {@linkcode PluginCoreTagsApi.listForComponent}: pass
170
+ * `componentIds` to read specific components (unknown ids are skipped), or
171
+ * omit it to read **every** taggable component (Mass/Floor space) in the
172
+ * project. Each entry carries the component id and its tags — one per tagged
173
+ * category, with the tag's `color` — so a plugin can color every space by a
174
+ * chosen category's tag in a single round-trip.
175
+ *
176
+ * @param componentIds - Optional `Component.id`s to read; omit for all spaces.
177
+ * @returns A {@linkcode PluginCoreTagsListForComponentsResult} with a
178
+ * `components` array, one entry per component (in input order when
179
+ * `componentIds` is given).
180
+ *
181
+ * @performance One round-trip for any number of components — use this instead of a `listForComponent` loop.
182
+ *
183
+ * @examplePrompt Get the tags of every space with their colors
184
+ * @examplePrompt List the tags on all rooms so I can color them by Occupancy
185
+ * @examplePrompt Which tag does each selected space carry?
186
+ *
187
+ * # Example
188
+ * ```ts
189
+ * const { components } = await snaptrude.core.tags.listForComponents()
190
+ * for (const c of components) {
191
+ * const occupancy = c.tags.find((t) => t.categoryName === "Occupancy")
192
+ * if (occupancy) paint(c.componentId, occupancy.color)
193
+ * }
194
+ * ```
195
+ */
196
+ public abstract listForComponents(
197
+ componentIds?: ComponentHandle[],
198
+ ): PluginApiReturn<PluginCoreTagsListForComponentsResult>
199
+
166
200
  /**
167
201
  * List the components carrying a given tag or category.
168
202
  *
@@ -588,6 +622,48 @@ export type PluginCoreTagsGetTagsForComponentResult = z.infer<
588
622
  typeof PluginCoreTagsGetTagsForComponentResult
589
623
  >
590
624
 
625
+ /**
626
+ * Arguments for {@linkcode PluginCoreTagsApi.listForComponents}.
627
+ *
628
+ * | Property | Type | Description |
629
+ * |---|---|---|
630
+ * | `componentIds` | `ComponentHandle[]?` | Components to read; omit for every taggable component |
631
+ */
632
+ export const PluginCoreTagsListForComponentsArgs = z.object({
633
+ componentIds: z.array(ComponentHandle).optional(),
634
+ })
635
+ export type PluginCoreTagsListForComponentsArgs = z.infer<
636
+ typeof PluginCoreTagsListForComponentsArgs
637
+ >
638
+
639
+ /**
640
+ * One component's tags, for {@linkcode PluginCoreTagsApi.listForComponents}.
641
+ *
642
+ * | Property | Type | Description |
643
+ * |---|---|---|
644
+ * | `componentId` | `ComponentHandle` | The component's id |
645
+ * | `tags` | {@linkcode PluginCoreComponentTag}`[]` | Its tags, one per tagged category (empty when none) |
646
+ */
647
+ export const PluginCoreComponentTags = z.object({
648
+ componentId: ComponentHandle,
649
+ tags: z.array(PluginCoreComponentTag),
650
+ })
651
+ export type PluginCoreComponentTags = z.infer<typeof PluginCoreComponentTags>
652
+
653
+ /**
654
+ * Result of {@linkcode PluginCoreTagsApi.listForComponents}.
655
+ *
656
+ * | Property | Type | Description |
657
+ * |---|---|---|
658
+ * | `components` | {@linkcode PluginCoreComponentTags}`[]` | One entry per component |
659
+ */
660
+ export const PluginCoreTagsListForComponentsResult = z.object({
661
+ components: z.array(PluginCoreComponentTags),
662
+ })
663
+ export type PluginCoreTagsListForComponentsResult = z.infer<
664
+ typeof PluginCoreTagsListForComponentsResult
665
+ >
666
+
591
667
  /**
592
668
  * Arguments for {@linkcode PluginCoreTagsApi.listComponents}. Provide exactly one
593
669
  * of `tagId`, `categoryId`. `untagged` is valid only with `categoryId`.
@@ -5,6 +5,11 @@ import { PluginApiReturn } from "../../../types"
5
5
  *
6
6
  * Frame the viewport camera onto scene geometry — mirrors the canvas zoom menu
7
7
  * ("Zoom extents" / "Zoom to selection"). Accessed via `snaptrude.core.zoom`.
8
+ *
9
+ * While Present mode is open these calls set the Design frame a view saved in
10
+ * Present (`presentation.views.create`) is taken from; they never move the
11
+ * Present sheet canvas. To pan, zoom or screenshot the Present canvas, use
12
+ * {@linkcode PluginPresentationCameraApi} (`presentation.camera`).
8
13
  */
9
14
  export abstract class PluginZoomApi {
10
15
  constructor() {}
@@ -12,6 +17,10 @@ export abstract class PluginZoomApi {
12
17
  /**
13
18
  * Zoom (fit) the camera to all geometry in the scene — the "zoom extents" action.
14
19
  *
20
+ * While Present is open this sets the Design frame a view saved in Present
21
+ * is taken from; it never moves the Present sheet canvas; use
22
+ * `presentation.camera` for that.
23
+ *
15
24
  * @returns `true` once the camera has been framed to the scene.
16
25
  *
17
26
  * @examplePrompt Zoom out so I can see the whole model
@@ -32,6 +41,10 @@ export abstract class PluginZoomApi {
32
41
  /**
33
42
  * Zoom (fit) the camera to the current selection.
34
43
  *
44
+ * While Present is open this sets the Design frame a view saved in Present
45
+ * is taken from; it never moves the Present sheet canvas; use
46
+ * `presentation.camera` for that.
47
+ *
35
48
  * @returns `true` if there was a selection to frame; `false` if nothing is
36
49
  * selected (no-op).
37
50
  *