@snaptrude/plugin-core 0.9.14 → 0.9.16

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 (51) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/api-manifest.json +527 -26
  3. package/dist/api/core/camera/index.d.ts +418 -0
  4. package/dist/api/core/camera/index.d.ts.map +1 -1
  5. package/dist/api/core/index.d.ts +4 -4
  6. package/dist/api/core/index.d.ts.map +1 -1
  7. package/dist/api/core/layers.d.ts +377 -255
  8. package/dist/api/core/layers.d.ts.map +1 -1
  9. package/dist/api/core/proposals/index.d.ts +4 -3
  10. package/dist/api/core/proposals/index.d.ts.map +1 -1
  11. package/dist/api/core/storeys/index.d.ts +12 -0
  12. package/dist/api/core/storeys/index.d.ts.map +1 -1
  13. package/dist/api/core/storeys/layers.d.ts +408 -0
  14. package/dist/api/core/storeys/layers.d.ts.map +1 -0
  15. package/dist/api/core/tags.d.ts +3 -3
  16. package/dist/api/design/create/bulk-items.d.ts +44 -0
  17. package/dist/api/design/create/bulk-items.d.ts.map +1 -1
  18. package/dist/api/design/create/index.d.ts +31 -3
  19. package/dist/api/design/create/index.d.ts.map +1 -1
  20. package/dist/api/design/selection/index.d.ts +2 -2
  21. package/dist/api/design/update/index.d.ts +73 -0
  22. package/dist/api/design/update/index.d.ts.map +1 -1
  23. package/dist/api/presentation/aiInspiration.d.ts +13 -13
  24. package/dist/api/presentation/camera.d.ts +265 -0
  25. package/dist/api/presentation/camera.d.ts.map +1 -0
  26. package/dist/api/presentation/index.d.ts +14 -0
  27. package/dist/api/presentation/index.d.ts.map +1 -1
  28. package/dist/api/presentation/placedViews.d.ts +1 -1
  29. package/dist/api/presentation/views.d.ts +3 -1
  30. package/dist/api/presentation/views.d.ts.map +1 -1
  31. package/dist/api/presentation/walkthroughs.d.ts +1350 -0
  32. package/dist/api/presentation/walkthroughs.d.ts.map +1 -0
  33. package/dist/index.cjs +3162 -2553
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.js +3077 -2550
  36. package/dist/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/scripts/generate-manifest.test.mjs +14 -3
  39. package/src/api/core/camera/index.ts +400 -1
  40. package/src/api/core/index.ts +4 -4
  41. package/src/api/core/layers.ts +380 -173
  42. package/src/api/core/proposals/index.ts +4 -3
  43. package/src/api/core/storeys/index.ts +14 -0
  44. package/src/api/core/storeys/layers.ts +339 -0
  45. package/src/api/design/create/bulk-items.ts +68 -0
  46. package/src/api/design/create/index.ts +30 -4
  47. package/src/api/design/update/index.ts +80 -1
  48. package/src/api/presentation/camera.ts +289 -0
  49. package/src/api/presentation/index.ts +14 -0
  50. package/src/api/presentation/views.ts +3 -1
  51. package/src/api/presentation/walkthroughs.ts +1201 -0
@@ -1,255 +1,329 @@
1
1
  import * as z from "zod";
2
2
  import { PluginApiReturn } from "../../types";
3
+ import { ComponentHandle } from "../../handles";
3
4
  /**
4
- * Layers — read and toggle the drawing/reference layers of a storey.
5
+ * Layers — the layers in the **Layers panel** in the left sidebar (the panel
6
+ * with the "+" add-layer button and one row per layer, such as "Default" or
7
+ * "BIM layer"; the radio mark is the active layer).
5
8
  *
6
- * These are the **drawing/reference** layers shown in the storey's Layers panel —
7
- * the surfaces you sketch on and the imported underlays (CAD, PDF, images,
8
- * terrain). They are **not** wall/floor construction-assembly material layers,
9
- * which are a property of the built element, not this namespace.
9
+ * A layer is a named group of objects. Every object is on exactly one layer, and
10
+ * new objects land on the active layer. Each row can be renamed, locked, hidden
11
+ * and deleted, and objects can be moved between layers.
10
12
  *
11
- * Reads return plain records and never throw for a missing layer (`get` and
12
- * `getActive` return `null`, `list` returns `[]`).
13
+ * These are **not** each storey's sketch surfaces and imported underlays (ids
14
+ * like `ly_5`); those are {@linkcode PluginCoreStoreysLayersApi}
15
+ * (`core.storeys.layers`, formerly `core.layers`). They are also not wall/floor
16
+ * construction-assembly material layers.
13
17
  *
14
- * v1 exposes reads plus visibility edits and the active-layer switch.
15
- * Creating and deleting layers are intentionally not part of this contract yet.
18
+ * Each design option ({@linkcode PluginCoreProposalsApi}) owns a set of layers;
19
+ * `core.proposals` records refer to these ids as `bucketIds` and
20
+ * `defaultBucketId`. `list` and every write are scoped to the **active** design
21
+ * option, like the panel; on legacy projects without design options every layer
22
+ * is in scope. Reads never throw for a missing layer (`get` and `getActive`
23
+ * return `null`).
16
24
  *
17
- * Sub-namespace members typed as optional (`?`) are **authored ahead of the
18
- * host** — declared so plugins and codegen can see the shape, but kept out of the
19
- * discovery manifest until the host lands them (at which point they are promoted
20
- * to required `abstract` members).
25
+ * **Compatibility.** Before 0.9.15 this namespace was the storey sketch-surface
26
+ * API that is now {@linkcode PluginCoreStoreysLayersApi}. Calls in that shape
27
+ * keep working here and are routed to it: `list(storeyId)`, `getActive(storeyId)`,
28
+ * and `get` / `setActive` / `update(layerId, hidden)` with a storey-layer id
29
+ * (`ly_*`). They are deprecated: new code calls `core.storeys.layers` directly.
21
30
  *
22
31
  * Accessed via `snaptrude.core.layers`.
23
32
  */
24
33
  export declare abstract class PluginCoreLayersApi {
25
34
  constructor();
26
35
  /**
27
- * List the drawing layers of a storey.
36
+ * List the layers in the Layers panel: the active design option's layers,
37
+ * default layer first, then in creation order.
28
38
  *
29
- * Optionally filter to a single {@linkcode PluginCoreLayerType}.
39
+ * @returns A {@linkcode PluginCoreLayersListResult} with a `layers` array.
30
40
  *
31
- * @param storeyId - The storey whose layers to read.
32
- * @param layerType - Optional {@linkcode PluginCoreLayerType} filter.
33
- * @returns A {@linkcode PluginCoreLayersListResult} with a `layers` array
34
- * (empty when the storey is missing or has no matching layers).
35
- *
36
- * @examplePrompt List the drawing layers on this storey
37
- * @examplePrompt Show all the PDF underlays on storey st_2
38
- * @examplePrompt What CAD layers are on the ground floor?
41
+ * @examplePrompt List all the layers in the Layers panel
42
+ * @examplePrompt Show me the layers in the left sidebar
43
+ * @examplePrompt What layers does this project have?
44
+ * @examplePrompt Show every layer with whether it is locked or hidden
45
+ * @examplePrompt Which layer is the default layer?
46
+ * @examplePrompt Which layers are empty?
39
47
  *
40
48
  * # Example
41
49
  * ```ts
42
- * const { layers } = await snaptrude.core.layers.list("st_2")
43
- * for (const l of layers) console.log(l.name, l.layerType, l.hidden)
50
+ * const { layers } = await snaptrude.core.layers.list()
51
+ * for (const l of layers) console.log(l.name, l.objectCount, l.locked, l.hidden)
44
52
  * ```
45
53
  */
46
- abstract list(storeyId: string, layerType?: PluginCoreLayerType): PluginApiReturn<PluginCoreLayersListResult>;
54
+ abstract list(): PluginApiReturn<PluginCoreLayersListResult>;
47
55
  /**
48
- * Get a single drawing layer by id.
56
+ * Get one Layers-panel layer by id, including layers owned by other design
57
+ * options.
49
58
  *
50
59
  * @param layerId - The id of the layer to read.
51
60
  * @returns The matching {@linkcode PluginCoreLayer}, or `null` if no layer has
52
61
  * that id.
53
62
  *
54
- * @examplePrompt Get the drawing layer with id ly_5
55
- * @examplePrompt Is layer ly_5 hidden or locked?
56
- * @examplePrompt Look up a single drawing layer by its id
63
+ * @examplePrompt Get the Layers-panel layer with id 3f2a…
64
+ * @examplePrompt Is the Furniture layer locked or hidden?
65
+ * @examplePrompt How many objects are on layer 3f2a…?
57
66
  *
58
67
  * # Example
59
68
  * ```ts
60
- * const layer = await snaptrude.core.layers.get("ly_5")
61
- * if (layer) console.log(layer.name, layer.hidden, layer.locked)
69
+ * const layer = await snaptrude.core.layers.get(layerId)
70
+ * if (layer) console.log(layer.name, layer.objectCount)
62
71
  * ```
63
72
  */
64
73
  abstract get(layerId: string): PluginApiReturn<PluginCoreLayersGetResult>;
65
74
  /**
66
- * Get the active drawing layer of a storey.
67
- *
68
- * The active layer is the one new sketch geometry is drawn onto. Paired with
69
- * {@linkcode PluginCoreLayersApi.setActive}.
75
+ * Get the active Layers-panel layer: the one new objects land on.
70
76
  *
71
- * @param storeyId - The storey whose active layer to read.
72
- * @returns The active {@linkcode PluginCoreLayer}, or `null` if the storey is
73
- * missing or has no active layer.
77
+ * @returns The active {@linkcode PluginCoreLayer}, or `null` if none is set.
74
78
  *
75
- * @examplePrompt Which drawing layer is active on this storey?
76
- * @examplePrompt Get the current layer on storey st_2
77
- * @examplePrompt What layer am I drawing on?
79
+ * @examplePrompt Which layer is active?
80
+ * @examplePrompt Which layer in the Layers panel is active?
81
+ * @examplePrompt What layer will new objects go on?
82
+ * @examplePrompt Which layer are new walls and masses being added to?
78
83
  *
79
84
  * # Example
80
85
  * ```ts
81
- * const active = await snaptrude.core.layers.getActive("st_2")
86
+ * const active = await snaptrude.core.layers.getActive()
82
87
  * if (active) console.log(active.name)
83
88
  * ```
84
89
  */
85
- abstract getActive(storeyId: string): PluginApiReturn<PluginCoreLayersGetActiveResult>;
90
+ abstract getActive(): PluginApiReturn<PluginCoreLayersGetActiveResult>;
91
+ /**
92
+ * Create a new layer in the Layers panel (the panel's "Add new layer" button
93
+ * followed by naming it).
94
+ *
95
+ * The layer is added to the active design option and is **not** made active;
96
+ * call {@linkcode PluginCoreLayersApi.setActive} to put new objects on it.
97
+ * Names are trimmed, 1-40 characters, and must be unique across all layers
98
+ * (case-insensitive). **Undoable.**
99
+ *
100
+ * @param name - The new layer's name.
101
+ * @returns The created {@linkcode PluginCoreLayer}.
102
+ * @throws `VALIDATION` for an empty name or one longer than 40 characters;
103
+ * `PRECONDITION_FAILED` if a layer with that name already exists.
104
+ *
105
+ * @examplePrompt Create a new layer called Furniture
106
+ * @examplePrompt Add a layer called Landscape
107
+ * @examplePrompt Add a layer named Landscape to the Layers panel
108
+ * @examplePrompt Make a new layer for the facade elements
109
+ * @examplePrompt Create layers named Structure and Services
110
+ *
111
+ * # Example
112
+ * ```ts
113
+ * const layer = await snaptrude.core.layers.create("Furniture")
114
+ * await snaptrude.core.layers.setActive(layer.id)
115
+ * ```
116
+ */
117
+ abstract create(name: string): PluginApiReturn<PluginCoreLayersCreateResult>;
86
118
  /**
87
- * Make a drawing layer the active layer of its storey.
119
+ * Rename a layer (the panel row's "Rename layer").
120
+ *
121
+ * Names are trimmed, 1-40 characters, and must be unique across all layers
122
+ * (case-insensitive; changing only the case of the layer's own name is
123
+ * allowed). The default layer cannot be renamed. **Not undoable.**
124
+ *
125
+ * @param layerId - The id of the layer to rename.
126
+ * @param name - The new name.
127
+ * @returns The updated {@linkcode PluginCoreLayer}.
128
+ * @throws `VALIDATION` for a bad name; `HANDLE_INVALID` for an unknown
129
+ * `layerId`; `PRECONDITION_FAILED` if the layer is the default layer, is
130
+ * outside the active design option, or the name is already used;
131
+ * `OPERATION_FAILED` if the app refuses the rename.
88
132
  *
89
- * Paired with {@linkcode PluginCoreLayersApi.getActive}.
133
+ * @examplePrompt Rename the Furniture layer to Loose furniture
134
+ * @examplePrompt Rename layer 3f2a… to Existing building
135
+ * @examplePrompt Change the name of the Landscape layer
136
+ *
137
+ * # Example
138
+ * ```ts
139
+ * await snaptrude.core.layers.rename(layerId, "Loose furniture")
140
+ * ```
141
+ */
142
+ abstract rename(layerId: string, name: string): PluginApiReturn<PluginCoreLayersRenameResult>;
143
+ /**
144
+ * Lock/unlock or show/hide a layer (the panel row's padlock and eye).
145
+ *
146
+ * A **sparse** update: omitted fields are unchanged. `hidden` is **per-user**:
147
+ * it hides the layer for you, not for collaborators. Locking and hiding block
148
+ * interactive drawing in the app; plugin creates are not blocked (see
149
+ * {@linkcode PluginCoreLayersApi.setActive}). **Undoable**, one undo step per
150
+ * changed field.
151
+ *
152
+ * @param layerId - The id of the layer to update.
153
+ * @param options - `{ locked?, hidden? }`; omitted fields are unchanged.
154
+ * @returns The updated {@linkcode PluginCoreLayer}.
155
+ * @throws `VALIDATION` for any option other than `locked` / `hidden` (to
156
+ * rename, use {@linkcode PluginCoreLayersApi.rename}); `HANDLE_INVALID` for
157
+ * an unknown `layerId`; `PRECONDITION_FAILED` if the layer is outside the
158
+ * active design option, or `hidden` is changed with no signed-in user.
159
+ *
160
+ * @examplePrompt Lock the Default layer
161
+ * @examplePrompt Lock the Structure layer
162
+ * @examplePrompt Hide the Landscape layer in the Layers panel
163
+ * @examplePrompt Unlock layer 3f2a… and show it again
164
+ *
165
+ * # Example
166
+ * ```ts
167
+ * await snaptrude.core.layers.update(layerId, { locked: true, hidden: false })
168
+ * ```
169
+ */
170
+ abstract update(layerId: string, options?: {
171
+ locked?: boolean;
172
+ hidden?: boolean;
173
+ }): PluginApiReturn<PluginCoreLayersUpdateResult>;
174
+ /**
175
+ * Make a layer the active layer (clicking its row in the Layers panel).
176
+ *
177
+ * New objects, whether drawn in the app or created by plugins with
178
+ * `design.create.*`, land on the active layer. When the active layer is locked
179
+ * or hidden the app blocks interactive drawing, but plugin creates still land
180
+ * on it: objects created on a hidden layer are invisible, and objects on a
181
+ * locked layer cannot be edited. Unlock or show the layer first
182
+ * ({@linkcode PluginCoreLayersApi.update}). **Not undoable.**
90
183
  *
91
184
  * @param layerId - The id of the layer to activate.
92
185
  * @returns The id of the now-active layer.
93
- * @throws If no layer has the given id.
186
+ * @throws `HANDLE_INVALID` for an unknown `layerId`; `PRECONDITION_FAILED` if
187
+ * the layer is outside the active design option.
94
188
  *
95
- * @examplePrompt Draw on layer ly_5
96
- * @examplePrompt Make this the active layer
97
- * @examplePrompt Switch the active layer to the CAD underlay
189
+ * @examplePrompt Put new objects on the Furniture layer
190
+ * @examplePrompt Make the Structure layer the active layer in the Layers panel
191
+ * @examplePrompt Switch the active layer to Landscape
98
192
  *
99
193
  * # Example
100
194
  * ```ts
101
- * await snaptrude.core.layers.setActive("ly_5")
195
+ * await snaptrude.core.layers.setActive(layerId)
102
196
  * ```
103
197
  */
104
198
  abstract setActive(layerId: string): PluginApiReturn<PluginCoreLayersSetActiveResult>;
105
199
  /**
106
- * Update a drawing layer's visibility.
200
+ * Delete a layer (the panel row's "Delete layer").
107
201
  *
108
- * A **sparse** update: omit `hidden` to leave it unchanged. This edit is **not
109
- * undoable**. Locking and renaming are not exposed — layer `locked` is a
110
- * read-only status here (setting it at runtime does not lock the live meshes or
111
- * flip the panel padlock until a reload), and a rename cascades to every member
112
- * mesh's `layerName`, a corruption hazard.
202
+ * Choose **exactly one** disposition, mirroring the delete dialog:
113
203
  *
114
- * @param layerId - The id of the layer to update.
115
- * @param hidden - New hidden state (unchanged if omitted).
116
- * @returns The updated {@linkcode PluginCoreLayer}.
117
- * @throws If no layer has the given id.
204
+ * - `{ deleteObjects: true }` destroys the objects on the layer.
205
+ * - `{ targetLayerId }` moves them to another layer of the active design
206
+ * option first, then deletes the emptied layer.
207
+ *
208
+ * A bare `delete(layerId)` is **rejected**: the engine would drop the layer
209
+ * and leave its objects on a missing layer. Refused for the default layer, the
210
+ * last layer, a locked layer, a layer shared with other design options
211
+ * (`proposalIds.length > 1`; unshare it in the app first), and, with
212
+ * `deleteObjects`, when any object on it is locked. The server checks that no
213
+ * collaborator is using the layer (needs a live connection; times out after
214
+ * ~10 s). If the layer was active, the active design option's default layer
215
+ * becomes active.
118
216
  *
119
- * @examplePrompt Hide the PDF underlay layer
120
- * @examplePrompt Show the CAD layer again
121
- * @examplePrompt Hide layer ly_5
217
+ * **Treat as permanent.** `core.history.undo` restores the layer in this
218
+ * session only; the server does not re-link it to its design option, so after
219
+ * a reload it is missing from the panel.
220
+ *
221
+ * @param layerId - The id of the layer to delete.
222
+ * @param options - Exactly one disposition: `{ deleteObjects: true }` or
223
+ * `{ targetLayerId }`.
224
+ * @returns Confirmation that the layer was deleted.
225
+ * @throws `VALIDATION` for no disposition, both, or `targetLayerId` equal to
226
+ * `layerId`; `HANDLE_INVALID` for an unknown `layerId` or
227
+ * `targetLayerId`; `PRECONDITION_FAILED` for the refusals above or a layer
228
+ * or target outside the active design option; `OPERATION_FAILED` if the
229
+ * server refuses (a collaborator is using it), the connection is down, or
230
+ * the check times out.
231
+ *
232
+ * @examplePrompt Delete the Furniture layer and everything on it
233
+ * @examplePrompt Delete the Furniture layer and move its objects to Default
234
+ * @examplePrompt Remove layer 3f2a… and move its objects to the default layer
235
+ * @examplePrompt Merge the Services layer into Structure and delete it
236
+ * @examplePrompt Delete every empty layer
237
+ *
238
+ * # Example
239
+ * ```ts
240
+ * await snaptrude.core.layers.delete(layerId, { deleteObjects: true })
241
+ * const { layers } = await snaptrude.core.layers.list()
242
+ * const def = layers.find((l) => l.isDefault)!
243
+ * await snaptrude.core.layers.delete(otherId, { targetLayerId: def.id })
244
+ * ```
245
+ */
246
+ abstract delete(layerId: string, options: {
247
+ deleteObjects: true;
248
+ targetLayerId?: never;
249
+ } | {
250
+ deleteObjects?: false;
251
+ targetLayerId: string;
252
+ }): PluginApiReturn<PluginCoreLayersDeleteResult>;
253
+ /**
254
+ * Move objects onto a layer (picking a layer in the object properties panel).
255
+ *
256
+ * Doors, windows and voids hosted by a moved wall (and a terrain's
257
+ * neighbourhood buildings) move with it; if any of those is locked, the parent
258
+ * is skipped as `locked`. Locked objects, unknown ids and objects outside the
259
+ * active design option are returned in `skipped`, never silently dropped. The target layer's own lock
260
+ * does not block the move. An object is always on exactly one layer, so there
261
+ * is no `unassign`: assign to another layer instead. **Undoable** (one step).
262
+ *
263
+ * @param componentIds - The objects to move.
264
+ * @param layerId - The target layer.
265
+ * @returns A {@linkcode PluginCoreLayersAssignResult} splitting `assigned`
266
+ * from `skipped`.
267
+ * @throws `VALIDATION` for an empty `componentIds`; `HANDLE_INVALID` for an
268
+ * unknown `layerId`; `PRECONDITION_FAILED` if the target is outside the
269
+ * active design option.
270
+ *
271
+ * @examplePrompt Move the selected objects to the BIM layer
272
+ * @examplePrompt Move the selected objects to the Furniture layer
273
+ * @examplePrompt Assign the generated walls to the Structure layer
274
+ * @examplePrompt Put these masses on layer 3f2a…
122
275
  *
123
276
  * # Example
124
277
  * ```ts
125
- * const layer = await snaptrude.core.layers.update("ly_5", true)
278
+ * const { assigned, skipped } = await snaptrude.core.layers.assign(ids, layerId)
126
279
  * ```
127
280
  */
128
- abstract update(layerId: string, hidden?: boolean): PluginApiReturn<PluginCoreLayersUpdateResult>;
281
+ abstract assign(componentIds: ComponentHandle[], layerId: string): PluginApiReturn<PluginCoreLayersAssignResult>;
129
282
  }
130
283
  /**
131
- * The kind of a drawing layer.
132
- *
133
- * Author-drawable kinds (`floor`, `wall`, `ceiling`, `rough`, `default`) plus
134
- * read-only imported underlays (`image`, `cad`, `pdf`, `terrain`, `buildings`).
135
- */
136
- export declare const PluginCoreLayerType: z.ZodEnum<{
137
- default: "default";
138
- terrain: "terrain";
139
- buildings: "buildings";
140
- floor: "floor";
141
- wall: "wall";
142
- ceiling: "ceiling";
143
- rough: "rough";
144
- image: "image";
145
- cad: "cad";
146
- pdf: "pdf";
147
- }>;
148
- export type PluginCoreLayerType = z.infer<typeof PluginCoreLayerType>;
149
- /**
150
- * A drawing/reference layer on a storey.
151
- *
152
- * | Property | Type | Description |
153
- * |---|---|---|
154
- * | `id` | `string` | Stable public layer id (e.g. `"ly_5"`) |
155
- * | `name` | `string` | Display name |
156
- * | `layerType` | {@linkcode PluginCoreLayerType} | The layer's kind |
157
- * | `storeyId` | `string` | The stable id of the storey this layer belongs to |
158
- * | `buildingId` | `string` | The stable id of the building this layer belongs to |
159
- * | `hidden` | `boolean` | Whether the layer is hidden |
160
- * | `locked` | `boolean` | Whether the layer is locked against edits |
161
- * | `contentSummary` | `object` | A summary of what the layer holds (see below) |
162
- *
163
- * `contentSummary`:
284
+ * A layer in the Layers panel.
164
285
  *
165
286
  * | Property | Type | Description |
166
287
  * |---|---|---|
167
- * | `hasFloorplan` | `boolean` | Whether the layer holds drawn floorplan geometry |
168
- * | `pdfCount` | `number` | Number of PDF underlays on the layer |
169
- * | `hasTerrain` | `boolean` | Whether the layer holds terrain |
288
+ * | `id` | `string` | Layer id (the ids `core.proposals` records list) |
289
+ * | `name` | `string` | Display name (1-40 characters, unique case-insensitively) |
290
+ * | `isDefault` | `boolean` | The design option's default layer: cannot be renamed or deleted |
291
+ * | `isActive` | `boolean` | Whether new objects land on this layer |
292
+ * | `locked` | `boolean` | Whether the layer is locked (its objects cannot be edited) |
293
+ * | `hidden` | `boolean` | Whether the layer is hidden **for the current user** |
294
+ * | `proposalIds` | `string[]` | Design options that own the layer (more than one = shared) |
295
+ * | `objectCount` | `number` | Objects currently on the layer (0 = empty) |
170
296
  */
171
297
  export declare const PluginCoreLayer: z.ZodObject<{
172
298
  id: z.ZodString;
173
299
  name: z.ZodString;
174
- layerType: z.ZodEnum<{
175
- default: "default";
176
- terrain: "terrain";
177
- buildings: "buildings";
178
- floor: "floor";
179
- wall: "wall";
180
- ceiling: "ceiling";
181
- rough: "rough";
182
- image: "image";
183
- cad: "cad";
184
- pdf: "pdf";
185
- }>;
186
- storeyId: z.ZodString;
187
- buildingId: z.ZodString;
188
- hidden: z.ZodBoolean;
300
+ isDefault: z.ZodBoolean;
301
+ isActive: z.ZodBoolean;
189
302
  locked: z.ZodBoolean;
190
- contentSummary: z.ZodObject<{
191
- hasFloorplan: z.ZodBoolean;
192
- pdfCount: z.ZodNumber;
193
- hasTerrain: z.ZodBoolean;
194
- }, z.core.$strip>;
303
+ hidden: z.ZodBoolean;
304
+ proposalIds: z.ZodArray<z.ZodString>;
305
+ objectCount: z.ZodNumber;
195
306
  }, z.core.$strip>;
196
307
  export type PluginCoreLayer = z.infer<typeof PluginCoreLayer>;
197
- /**
198
- * Arguments for {@linkcode PluginCoreLayersApi.list}.
199
- *
200
- * | Property | Type | Description |
201
- * |---|---|---|
202
- * | `storeyId` | `string` | The storey whose layers to read |
203
- * | `layerType` | {@linkcode PluginCoreLayerType}` \| undefined` | Optional layer-type filter |
204
- */
205
- export declare const PluginCoreLayersListArgs: z.ZodObject<{
206
- storeyId: z.ZodString;
207
- layerType: z.ZodOptional<z.ZodEnum<{
208
- default: "default";
209
- terrain: "terrain";
210
- buildings: "buildings";
211
- floor: "floor";
212
- wall: "wall";
213
- ceiling: "ceiling";
214
- rough: "rough";
215
- image: "image";
216
- cad: "cad";
217
- pdf: "pdf";
218
- }>>;
219
- }, z.core.$strip>;
220
- export type PluginCoreLayersListArgs = z.infer<typeof PluginCoreLayersListArgs>;
308
+ /** A layer name: trimmed, 1-40 characters (the panel input's limit). */
309
+ export declare const PluginCoreLayerName: z.ZodString;
221
310
  /**
222
311
  * Result of {@linkcode PluginCoreLayersApi.list}.
223
312
  *
224
313
  * | Property | Type | Description |
225
314
  * |---|---|---|
226
- * | `layers` | {@linkcode PluginCoreLayer}`[]` | The storey's drawing layers (empty when missing or none match) |
315
+ * | `layers` | {@linkcode PluginCoreLayer}`[]` | The active design option's layers, default first |
227
316
  */
228
317
  export declare const PluginCoreLayersListResult: z.ZodObject<{
229
318
  layers: z.ZodArray<z.ZodObject<{
230
319
  id: z.ZodString;
231
320
  name: z.ZodString;
232
- layerType: z.ZodEnum<{
233
- default: "default";
234
- terrain: "terrain";
235
- buildings: "buildings";
236
- floor: "floor";
237
- wall: "wall";
238
- ceiling: "ceiling";
239
- rough: "rough";
240
- image: "image";
241
- cad: "cad";
242
- pdf: "pdf";
243
- }>;
244
- storeyId: z.ZodString;
245
- buildingId: z.ZodString;
246
- hidden: z.ZodBoolean;
321
+ isDefault: z.ZodBoolean;
322
+ isActive: z.ZodBoolean;
247
323
  locked: z.ZodBoolean;
248
- contentSummary: z.ZodObject<{
249
- hasFloorplan: z.ZodBoolean;
250
- pdfCount: z.ZodNumber;
251
- hasTerrain: z.ZodBoolean;
252
- }, z.core.$strip>;
324
+ hidden: z.ZodBoolean;
325
+ proposalIds: z.ZodArray<z.ZodString>;
326
+ objectCount: z.ZodNumber;
253
327
  }, z.core.$strip>>;
254
328
  }, z.core.$strip>;
255
329
  export type PluginCoreLayersListResult = z.infer<typeof PluginCoreLayersListResult>;
@@ -264,77 +338,106 @@ export declare const PluginCoreLayersGetArgs: z.ZodObject<{
264
338
  layerId: z.ZodString;
265
339
  }, z.core.$strip>;
266
340
  export type PluginCoreLayersGetArgs = z.infer<typeof PluginCoreLayersGetArgs>;
267
- /**
268
- * Result of {@linkcode PluginCoreLayersApi.get} — the layer, or `null`
269
- * when no layer has the given id.
270
- */
341
+ /** Result of {@linkcode PluginCoreLayersApi.get}: the layer, or `null`. */
271
342
  export declare const PluginCoreLayersGetResult: z.ZodNullable<z.ZodObject<{
272
343
  id: z.ZodString;
273
344
  name: z.ZodString;
274
- layerType: z.ZodEnum<{
275
- default: "default";
276
- terrain: "terrain";
277
- buildings: "buildings";
278
- floor: "floor";
279
- wall: "wall";
280
- ceiling: "ceiling";
281
- rough: "rough";
282
- image: "image";
283
- cad: "cad";
284
- pdf: "pdf";
285
- }>;
286
- storeyId: z.ZodString;
287
- buildingId: z.ZodString;
288
- hidden: z.ZodBoolean;
345
+ isDefault: z.ZodBoolean;
346
+ isActive: z.ZodBoolean;
289
347
  locked: z.ZodBoolean;
290
- contentSummary: z.ZodObject<{
291
- hasFloorplan: z.ZodBoolean;
292
- pdfCount: z.ZodNumber;
293
- hasTerrain: z.ZodBoolean;
294
- }, z.core.$strip>;
348
+ hidden: z.ZodBoolean;
349
+ proposalIds: z.ZodArray<z.ZodString>;
350
+ objectCount: z.ZodNumber;
295
351
  }, z.core.$strip>>;
296
352
  export type PluginCoreLayersGetResult = z.infer<typeof PluginCoreLayersGetResult>;
353
+ /** Result of {@linkcode PluginCoreLayersApi.getActive}: the active layer, or `null`. */
354
+ export declare const PluginCoreLayersGetActiveResult: z.ZodNullable<z.ZodObject<{
355
+ id: z.ZodString;
356
+ name: z.ZodString;
357
+ isDefault: z.ZodBoolean;
358
+ isActive: z.ZodBoolean;
359
+ locked: z.ZodBoolean;
360
+ hidden: z.ZodBoolean;
361
+ proposalIds: z.ZodArray<z.ZodString>;
362
+ objectCount: z.ZodNumber;
363
+ }, z.core.$strip>>;
364
+ export type PluginCoreLayersGetActiveResult = z.infer<typeof PluginCoreLayersGetActiveResult>;
297
365
  /**
298
- * Arguments for {@linkcode PluginCoreLayersApi.getActive}.
366
+ * Arguments for {@linkcode PluginCoreLayersApi.create}.
299
367
  *
300
368
  * | Property | Type | Description |
301
369
  * |---|---|---|
302
- * | `storeyId` | `string` | The storey whose active layer to read |
370
+ * | `name` | `string` | The new layer's name (trimmed, 1-40 characters) |
303
371
  */
304
- export declare const PluginCoreLayersGetActiveArgs: z.ZodObject<{
305
- storeyId: z.ZodString;
372
+ export declare const PluginCoreLayersCreateArgs: z.ZodObject<{
373
+ name: z.ZodString;
374
+ }, z.core.$strip>;
375
+ export type PluginCoreLayersCreateArgs = z.infer<typeof PluginCoreLayersCreateArgs>;
376
+ /** Result of {@linkcode PluginCoreLayersApi.create}: the created layer. */
377
+ export declare const PluginCoreLayersCreateResult: z.ZodObject<{
378
+ id: z.ZodString;
379
+ name: z.ZodString;
380
+ isDefault: z.ZodBoolean;
381
+ isActive: z.ZodBoolean;
382
+ locked: z.ZodBoolean;
383
+ hidden: z.ZodBoolean;
384
+ proposalIds: z.ZodArray<z.ZodString>;
385
+ objectCount: z.ZodNumber;
306
386
  }, z.core.$strip>;
307
- export type PluginCoreLayersGetActiveArgs = z.infer<typeof PluginCoreLayersGetActiveArgs>;
387
+ export type PluginCoreLayersCreateResult = z.infer<typeof PluginCoreLayersCreateResult>;
308
388
  /**
309
- * Result of {@linkcode PluginCoreLayersApi.getActive} — the active layer,
310
- * or `null` when the storey is missing or has no active layer.
389
+ * Arguments for {@linkcode PluginCoreLayersApi.rename}.
390
+ *
391
+ * | Property | Type | Description |
392
+ * |---|---|---|
393
+ * | `layerId` | `string` | The id of the layer to rename |
394
+ * | `name` | `string` | The new name (trimmed, 1-40 characters) |
311
395
  */
312
- export declare const PluginCoreLayersGetActiveResult: z.ZodNullable<z.ZodObject<{
396
+ export declare const PluginCoreLayersRenameArgs: z.ZodObject<{
397
+ layerId: z.ZodString;
398
+ name: z.ZodString;
399
+ }, z.core.$strip>;
400
+ export type PluginCoreLayersRenameArgs = z.infer<typeof PluginCoreLayersRenameArgs>;
401
+ /** Result of {@linkcode PluginCoreLayersApi.rename}: the updated layer. */
402
+ export declare const PluginCoreLayersRenameResult: z.ZodObject<{
313
403
  id: z.ZodString;
314
404
  name: z.ZodString;
315
- layerType: z.ZodEnum<{
316
- default: "default";
317
- terrain: "terrain";
318
- buildings: "buildings";
319
- floor: "floor";
320
- wall: "wall";
321
- ceiling: "ceiling";
322
- rough: "rough";
323
- image: "image";
324
- cad: "cad";
325
- pdf: "pdf";
326
- }>;
327
- storeyId: z.ZodString;
328
- buildingId: z.ZodString;
405
+ isDefault: z.ZodBoolean;
406
+ isActive: z.ZodBoolean;
407
+ locked: z.ZodBoolean;
329
408
  hidden: z.ZodBoolean;
409
+ proposalIds: z.ZodArray<z.ZodString>;
410
+ objectCount: z.ZodNumber;
411
+ }, z.core.$strip>;
412
+ export type PluginCoreLayersRenameResult = z.infer<typeof PluginCoreLayersRenameResult>;
413
+ /**
414
+ * Arguments for {@linkcode PluginCoreLayersApi.update}. Sparse: only the
415
+ * provided fields are changed.
416
+ *
417
+ * | Property | Type | Description |
418
+ * |---|---|---|
419
+ * | `layerId` | `string` | The id of the layer to update |
420
+ * | `locked` | `boolean \| undefined` | New locked state (unchanged if omitted) |
421
+ * | `hidden` | `boolean \| undefined` | New hidden state for the current user (unchanged if omitted) |
422
+ */
423
+ export declare const PluginCoreLayersUpdateArgs: z.ZodObject<{
424
+ layerId: z.ZodString;
425
+ locked: z.ZodOptional<z.ZodBoolean>;
426
+ hidden: z.ZodOptional<z.ZodBoolean>;
427
+ }, z.core.$strict>;
428
+ export type PluginCoreLayersUpdateArgs = z.infer<typeof PluginCoreLayersUpdateArgs>;
429
+ /** Result of {@linkcode PluginCoreLayersApi.update}: the updated layer. */
430
+ export declare const PluginCoreLayersUpdateResult: z.ZodObject<{
431
+ id: z.ZodString;
432
+ name: z.ZodString;
433
+ isDefault: z.ZodBoolean;
434
+ isActive: z.ZodBoolean;
330
435
  locked: z.ZodBoolean;
331
- contentSummary: z.ZodObject<{
332
- hasFloorplan: z.ZodBoolean;
333
- pdfCount: z.ZodNumber;
334
- hasTerrain: z.ZodBoolean;
335
- }, z.core.$strip>;
336
- }, z.core.$strip>>;
337
- export type PluginCoreLayersGetActiveResult = z.infer<typeof PluginCoreLayersGetActiveResult>;
436
+ hidden: z.ZodBoolean;
437
+ proposalIds: z.ZodArray<z.ZodString>;
438
+ objectCount: z.ZodNumber;
439
+ }, z.core.$strip>;
440
+ export type PluginCoreLayersUpdateResult = z.infer<typeof PluginCoreLayersUpdateResult>;
338
441
  /**
339
442
  * Arguments for {@linkcode PluginCoreLayersApi.setActive}.
340
443
  *
@@ -347,8 +450,7 @@ export declare const PluginCoreLayersSetActiveArgs: z.ZodObject<{
347
450
  }, z.core.$strip>;
348
451
  export type PluginCoreLayersSetActiveArgs = z.infer<typeof PluginCoreLayersSetActiveArgs>;
349
452
  /**
350
- * Result of {@linkcode PluginCoreLayersApi.setActive} — the now-active
351
- * layer's id.
453
+ * Result of {@linkcode PluginCoreLayersApi.setActive}.
352
454
  *
353
455
  * | Property | Type | Description |
354
456
  * |---|---|---|
@@ -359,44 +461,64 @@ export declare const PluginCoreLayersSetActiveResult: z.ZodObject<{
359
461
  }, z.core.$strip>;
360
462
  export type PluginCoreLayersSetActiveResult = z.infer<typeof PluginCoreLayersSetActiveResult>;
361
463
  /**
362
- * Arguments for {@linkcode PluginCoreLayersApi.update}. Sparse — only the
363
- * provided fields are changed.
464
+ * Arguments for {@linkcode PluginCoreLayersApi.delete}. Exactly one
465
+ * disposition is required: `deleteObjects: true` XOR `targetLayerId` (a
466
+ * **different** layer).
364
467
  *
365
468
  * | Property | Type | Description |
366
469
  * |---|---|---|
367
- * | `layerId` | `string` | The id of the layer to update |
368
- * | `hidden` | `boolean \| undefined` | New hidden state (unchanged if omitted) |
470
+ * | `layerId` | `string` | The id of the layer to delete |
471
+ * | `deleteObjects` | `boolean \| undefined` | `true` destroys the layer's objects (exclusive with `targetLayerId`) |
472
+ * | `targetLayerId` | `string \| undefined` | Move the layer's objects to this layer, then delete (exclusive with `deleteObjects`) |
369
473
  */
370
- export declare const PluginCoreLayersUpdateArgs: z.ZodObject<{
474
+ export declare const PluginCoreLayersDeleteArgs: z.ZodObject<{
371
475
  layerId: z.ZodString;
372
- hidden: z.ZodOptional<z.ZodBoolean>;
476
+ deleteObjects: z.ZodOptional<z.ZodBoolean>;
477
+ targetLayerId: z.ZodOptional<z.ZodString>;
373
478
  }, z.core.$strip>;
374
- export type PluginCoreLayersUpdateArgs = z.infer<typeof PluginCoreLayersUpdateArgs>;
375
- /** Result of {@linkcode PluginCoreLayersApi.update} — the updated layer. */
376
- export declare const PluginCoreLayersUpdateResult: z.ZodObject<{
377
- id: z.ZodString;
378
- name: z.ZodString;
379
- layerType: z.ZodEnum<{
380
- default: "default";
381
- terrain: "terrain";
382
- buildings: "buildings";
383
- floor: "floor";
384
- wall: "wall";
385
- ceiling: "ceiling";
386
- rough: "rough";
387
- image: "image";
388
- cad: "cad";
389
- pdf: "pdf";
390
- }>;
391
- storeyId: z.ZodString;
392
- buildingId: z.ZodString;
393
- hidden: z.ZodBoolean;
394
- locked: z.ZodBoolean;
395
- contentSummary: z.ZodObject<{
396
- hasFloorplan: z.ZodBoolean;
397
- pdfCount: z.ZodNumber;
398
- hasTerrain: z.ZodBoolean;
399
- }, z.core.$strip>;
479
+ export type PluginCoreLayersDeleteArgs = z.infer<typeof PluginCoreLayersDeleteArgs>;
480
+ /**
481
+ * Result of {@linkcode PluginCoreLayersApi.delete}.
482
+ *
483
+ * | Property | Type | Description |
484
+ * |---|---|---|
485
+ * | `deleted` | `true` | The layer was deleted |
486
+ */
487
+ export declare const PluginCoreLayersDeleteResult: z.ZodObject<{
488
+ deleted: z.ZodLiteral<true>;
400
489
  }, z.core.$strip>;
401
- export type PluginCoreLayersUpdateResult = z.infer<typeof PluginCoreLayersUpdateResult>;
490
+ export type PluginCoreLayersDeleteResult = z.infer<typeof PluginCoreLayersDeleteResult>;
491
+ /**
492
+ * Arguments for {@linkcode PluginCoreLayersApi.assign}.
493
+ *
494
+ * | Property | Type | Description |
495
+ * |---|---|---|
496
+ * | `componentIds` | `string[]` | The objects to move (at least one) |
497
+ * | `layerId` | `string` | The target layer |
498
+ */
499
+ export declare const PluginCoreLayersAssignArgs: z.ZodObject<{
500
+ componentIds: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>;
501
+ layerId: z.ZodString;
502
+ }, z.core.$strip>;
503
+ export type PluginCoreLayersAssignArgs = z.infer<typeof PluginCoreLayersAssignArgs>;
504
+ /**
505
+ * Result of {@linkcode PluginCoreLayersApi.assign}.
506
+ *
507
+ * | Property | Type | Description |
508
+ * |---|---|---|
509
+ * | `assigned` | `string[]` | Ids of the objects that were moved |
510
+ * | `skipped` | `{ id: string; reason: "not-found" \| "locked" \| "outside-proposal" }[]` | Objects that were not moved, each with a reason |
511
+ */
512
+ export declare const PluginCoreLayersAssignResult: z.ZodObject<{
513
+ assigned: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>;
514
+ skipped: z.ZodArray<z.ZodObject<{
515
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
516
+ reason: z.ZodEnum<{
517
+ locked: "locked";
518
+ "not-found": "not-found";
519
+ "outside-proposal": "outside-proposal";
520
+ }>;
521
+ }, z.core.$strip>>;
522
+ }, z.core.$strip>;
523
+ export type PluginCoreLayersAssignResult = z.infer<typeof PluginCoreLayersAssignResult>;
402
524
  //# sourceMappingURL=layers.d.ts.map