@snaptrude/plugin-core 0.7.0 → 0.8.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 (133) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/api-manifest.full.json +360 -19
  3. package/api-manifest.json +915 -37
  4. package/dist/api/core/camera/index.d.ts +208 -0
  5. package/dist/api/core/camera/index.d.ts.map +1 -0
  6. package/dist/api/core/comment/index.d.ts +105 -2
  7. package/dist/api/core/comment/index.d.ts.map +1 -1
  8. package/dist/api/core/geom/create/index.d.ts +13 -13
  9. package/dist/api/core/geom/delete/index.d.ts +8 -2
  10. package/dist/api/core/geom/delete/index.d.ts.map +1 -1
  11. package/dist/api/core/geom/query/arc.d.ts +5 -5
  12. package/dist/api/core/geom/query/brep.d.ts +18 -18
  13. package/dist/api/core/geom/query/circle.d.ts +18 -18
  14. package/dist/api/core/geom/query/contour.d.ts +20 -20
  15. package/dist/api/core/geom/query/curve.d.ts +49 -49
  16. package/dist/api/core/geom/query/edge.d.ts +5 -5
  17. package/dist/api/core/geom/query/face.d.ts +16 -16
  18. package/dist/api/core/geom/query/halfedge.d.ts +8 -8
  19. package/dist/api/core/geom/query/profile.d.ts +19 -19
  20. package/dist/api/core/geom/query/vertex.d.ts +8 -8
  21. package/dist/api/core/geom/update/contour.d.ts +14 -14
  22. package/dist/api/core/geom/update/curve.d.ts +7 -7
  23. package/dist/api/core/geom/update/profile.d.ts +16 -16
  24. package/dist/api/core/handles/index.d.ts +210 -0
  25. package/dist/api/core/handles/index.d.ts.map +1 -0
  26. package/dist/api/core/index.d.ts +15 -0
  27. package/dist/api/core/index.d.ts.map +1 -1
  28. package/dist/api/core/io/export/index.d.ts +132 -0
  29. package/dist/api/core/io/export/index.d.ts.map +1 -0
  30. package/dist/api/core/io/import/index.d.ts +1 -1
  31. package/dist/api/core/io/index.d.ts +5 -0
  32. package/dist/api/core/io/index.d.ts.map +1 -1
  33. package/dist/api/core/layers.d.ts +7 -7
  34. package/dist/api/core/proposals/index.d.ts +65 -9
  35. package/dist/api/core/proposals/index.d.ts.map +1 -1
  36. package/dist/api/core/user.d.ts +44 -0
  37. package/dist/api/core/user.d.ts.map +1 -0
  38. package/dist/api/design/boolean/index.d.ts +4 -4
  39. package/dist/api/design/create/index.d.ts +139 -44
  40. package/dist/api/design/create/index.d.ts.map +1 -1
  41. package/dist/api/design/doors/index.d.ts +36 -0
  42. package/dist/api/design/doors/index.d.ts.map +1 -1
  43. package/dist/api/design/edit/index.d.ts +1 -1
  44. package/dist/api/design/erase/index.d.ts +2 -2
  45. package/dist/api/design/furniture/index.d.ts +114 -3
  46. package/dist/api/design/furniture/index.d.ts.map +1 -1
  47. package/dist/api/design/index.d.ts +10 -0
  48. package/dist/api/design/index.d.ts.map +1 -1
  49. package/dist/api/design/materials/index.d.ts +111 -14
  50. package/dist/api/design/materials/index.d.ts.map +1 -1
  51. package/dist/api/design/query/index.d.ts +31 -1
  52. package/dist/api/design/query/index.d.ts.map +1 -1
  53. package/dist/api/design/query/spaces.d.ts +5 -5
  54. package/dist/api/design/transform/index.d.ts +83 -14
  55. package/dist/api/design/transform/index.d.ts.map +1 -1
  56. package/dist/api/design/types/index.d.ts +181 -0
  57. package/dist/api/design/types/index.d.ts.map +1 -0
  58. package/dist/api/design/update/index.d.ts +335 -2
  59. package/dist/api/design/update/index.d.ts.map +1 -1
  60. package/dist/api/design/visibility.d.ts +98 -0
  61. package/dist/api/design/visibility.d.ts.map +1 -0
  62. package/dist/api/entity/referenceLine.d.ts +2 -2
  63. package/dist/api/entity/space.d.ts +19 -19
  64. package/dist/api/entity/story.d.ts +128 -15
  65. package/dist/api/entity/story.d.ts.map +1 -1
  66. package/dist/api/presentation/aiInspiration.d.ts +1967 -7
  67. package/dist/api/presentation/aiInspiration.d.ts.map +1 -1
  68. package/dist/api/presentation/annotate.d.ts +448 -0
  69. package/dist/api/presentation/annotate.d.ts.map +1 -0
  70. package/dist/api/presentation/diagrams.d.ts +49 -8
  71. package/dist/api/presentation/diagrams.d.ts.map +1 -1
  72. package/dist/api/presentation/export.d.ts +104 -0
  73. package/dist/api/presentation/export.d.ts.map +1 -0
  74. package/dist/api/presentation/index.d.ts +40 -3
  75. package/dist/api/presentation/index.d.ts.map +1 -1
  76. package/dist/api/presentation/sheets.d.ts +410 -13
  77. package/dist/api/presentation/sheets.d.ts.map +1 -1
  78. package/dist/api/presentation/views.d.ts +165 -10
  79. package/dist/api/presentation/views.d.ts.map +1 -1
  80. package/dist/api/program/areas.d.ts +63 -3
  81. package/dist/api/program/areas.d.ts.map +1 -1
  82. package/dist/api/program/cores.d.ts +3 -99
  83. package/dist/api/program/cores.d.ts.map +1 -1
  84. package/dist/api/program/index.d.ts +2 -2
  85. package/dist/api/program/index.d.ts.map +1 -1
  86. package/dist/api/program/layout.d.ts +172 -12
  87. package/dist/api/program/layout.d.ts.map +1 -1
  88. package/dist/api/program/site.d.ts +11 -8
  89. package/dist/api/program/site.d.ts.map +1 -1
  90. package/dist/api/program/spreadsheet.d.ts +105 -13
  91. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  92. package/dist/handles.d.ts +64 -25
  93. package/dist/handles.d.ts.map +1 -1
  94. package/dist/index.cjs +2502 -1466
  95. package/dist/index.cjs.map +1 -1
  96. package/dist/index.js +2369 -1461
  97. package/dist/index.js.map +1 -1
  98. package/package.json +1 -1
  99. package/src/api/core/camera/index.ts +212 -0
  100. package/src/api/core/comment/index.ts +120 -2
  101. package/src/api/core/geom/delete/index.ts +6 -0
  102. package/src/api/core/handles/index.ts +233 -0
  103. package/src/api/core/index.ts +15 -0
  104. package/src/api/core/io/export/index.ts +124 -0
  105. package/src/api/core/io/index.ts +5 -0
  106. package/src/api/core/proposals/index.ts +71 -11
  107. package/src/api/core/user.ts +46 -0
  108. package/src/api/design/create/index.ts +166 -36
  109. package/src/api/design/doors/index.ts +40 -0
  110. package/src/api/design/furniture/index.ts +127 -3
  111. package/src/api/design/index.ts +10 -0
  112. package/src/api/design/materials/index.ts +157 -30
  113. package/src/api/design/query/index.ts +33 -7
  114. package/src/api/design/transform/index.ts +89 -12
  115. package/src/api/design/types/index.ts +156 -0
  116. package/src/api/design/update/index.ts +402 -6
  117. package/src/api/design/visibility.ts +109 -0
  118. package/src/api/entity/story.ts +141 -15
  119. package/src/api/presentation/aiInspiration.ts +761 -7
  120. package/src/api/presentation/annotate.ts +360 -0
  121. package/src/api/presentation/diagrams.ts +53 -8
  122. package/src/api/presentation/export.ts +104 -0
  123. package/src/api/presentation/index.ts +48 -3
  124. package/src/api/presentation/sheets.ts +346 -13
  125. package/src/api/presentation/views.ts +164 -12
  126. package/src/api/program/areas.ts +57 -6
  127. package/src/api/program/cores.ts +3 -91
  128. package/src/api/program/index.ts +2 -2
  129. package/src/api/program/layout.ts +182 -12
  130. package/src/api/program/site.ts +11 -8
  131. package/src/api/program/spreadsheet.ts +125 -29
  132. package/src/handles.ts +77 -13
  133. package/tsconfig.json +7 -2
@@ -102,21 +102,32 @@ export abstract class PluginStoryApi {
102
102
  ): PluginApiReturn<PluginStoryCreateResult>
103
103
 
104
104
  /**
105
- * Update a story's floor-to-floor height, cascading the full geometry change.
105
+ * Update a story's floor-to-floor `height` and/or `name`.
106
106
  *
107
- * This is the same operation as editing the height in the Stories panel: the
108
- * walls, columns, and masses on the story are **stretched** to the new height,
109
- * every story **above shifts up/down** by the delta so the stack stays
107
+ * **Height** is the same operation as editing the height in the Stories panel:
108
+ * the walls, columns, and masses on the story are **stretched** to the new
109
+ * height, every story **above shifts up/down** by the delta so the stack stays
110
110
  * contiguous, and coupled elements (staircases, parametric curtain walls,
111
- * furniture offsets) are re-fitted. The whole cascade is committed as **one
112
- * undo step**. Height-locked elements are left untouched.
111
+ * furniture offsets) are re-fitted. The whole height cascade is committed as
112
+ * **one undo step**. Height-locked elements are left untouched.
113
+ *
114
+ * **Name** is the same as renaming the story in the Stories panel: it is
115
+ * persisted immediately (saved to the project) but, mirroring the panel, is
116
+ * **not** part of the height undo step.
117
+ *
118
+ * At least one of `height` or `options.name` must be supplied. Omitting the
119
+ * `height` argument (e.g. for a rename-only update) leaves the height
120
+ * untouched.
113
121
  *
114
122
  * @param storyValue - Integer storey number
115
123
  * identifying the story to update
116
124
  * @param height - New floor-to-floor height in
117
- * Babylon units
118
- * @returns A {@linkcode PluginStoryUpdateResult} with the updated `storyValue` and `height`
125
+ * Babylon units. Omit to leave the height unchanged.
126
+ * @param options - `name` (new display name for the story)
127
+ * @returns A {@linkcode PluginStoryUpdateResult} with the story's
128
+ * `storyValue`, `height`, and `name` after the update
119
129
  * @throws `PRECONDITION_FAILED` if no story has the given value;
130
+ * `VALIDATION` if neither `height` nor `options.name` is supplied;
120
131
  * `STORY_HEIGHT_REJECTED` if the engine rejects the height (e.g. out of
121
132
  * range — the change silently reverts host-side and is surfaced as this
122
133
  * error); `STORY_UPDATE_FAILED` if the story cannot be re-read after the
@@ -124,21 +135,77 @@ export abstract class PluginStoryApi {
124
135
  *
125
136
  * @examplePrompt Change the ground floor height to 3.5 metres
126
137
  * @examplePrompt Make the second storey taller
138
+ * @examplePrompt Rename the ground floor to "Lobby"
127
139
  * @examplePrompt Set the floor-to-floor height of level 1
128
- * @examplePrompt Increase the height of the third floor
140
+ * @examplePrompt Rename storey 2 and make it taller in one go
129
141
  *
130
142
  * # Example
131
143
  * ```ts
132
144
  * // Set ground floor height to 5 Babylon units — walls stretch and the
133
145
  * // floors above move up to match, all in a single undo step.
134
146
  * const result = await snaptrude.entity.story.update(1, 5)
147
+ * // Rename only, leaving the height untouched.
148
+ * await snaptrude.entity.story.update(1, undefined, { name: "Lobby" })
135
149
  * ```
136
150
  */
137
151
  public abstract update(
138
152
  storyValue: number,
139
- height: number,
153
+ height?: number,
154
+ options?: { name?: string },
140
155
  ): PluginApiReturn<PluginStoryUpdateResult>
141
156
 
157
+ /**
158
+ * Make a story the active story — the same as clicking it in the storey/layer
159
+ * panel. Subsequent draws and creates target this story, and in 2D the
160
+ * viewport switches to it. This is a view/navigation change: it is **not**
161
+ * undoable and commits nothing to the model.
162
+ *
163
+ * @param storyValue - Integer storey number to activate
164
+ * @returns A {@linkcode PluginStorySetActiveResult} echoing the now-active `storyValue`
165
+ * @throws `PRECONDITION_FAILED` if no story has the given value
166
+ *
167
+ * @examplePrompt Switch to the second floor
168
+ * @examplePrompt Make the ground storey active
169
+ * @examplePrompt Go to the basement level
170
+ * @examplePrompt Set level 3 as the current storey
171
+ *
172
+ * # Example
173
+ * ```ts
174
+ * // Activate story 2, then draw a wall — it lands on story 2.
175
+ * await snaptrude.entity.story.setActive(2)
176
+ * ```
177
+ */
178
+ public abstract setActive(
179
+ storyValue: number,
180
+ ): PluginApiReturn<PluginStorySetActiveResult>
181
+
182
+ /**
183
+ * Delete a story and everything on it — the same as removing it from the
184
+ * storey panel. Every element placed on the story (walls, floors, masses, …)
185
+ * is deleted with it, the remaining stories are re-stacked, and the active
186
+ * story falls back to an adjacent one. Committed as a single undo step.
187
+ *
188
+ * @param storyValue - Integer storey number to delete
189
+ * @returns A {@linkcode PluginStoryDeleteResult} with the deleted `storyValue`
190
+ * and the `newActiveStory` the editor fell back to
191
+ * @throws `PRECONDITION_FAILED` if no story has the given value; or if plugin
192
+ * writes are disabled
193
+ *
194
+ * @examplePrompt Delete the top floor
195
+ * @examplePrompt Remove the basement level
196
+ * @examplePrompt Get rid of storey 3
197
+ * @examplePrompt Delete the second floor and everything on it
198
+ *
199
+ * # Example
200
+ * ```ts
201
+ * const { newActiveStory } = await snaptrude.entity.story.delete(3)
202
+ * console.log(`Deleted story 3; now on story ${newActiveStory}`)
203
+ * ```
204
+ */
205
+ public abstract delete(
206
+ storyValue: number,
207
+ ): PluginApiReturn<PluginStoryDeleteResult>
208
+
142
209
  /**
143
210
  * Duplicate a story into the adjacent level, up or down.
144
211
  *
@@ -301,35 +368,94 @@ export const PluginStoryCreateResult = z.object({
301
368
  export type PluginStoryCreateResult = z.infer<typeof PluginStoryCreateResult>
302
369
 
303
370
  /**
304
- * Arguments for {@linkcode PluginStoryApi.update}.
371
+ * Arguments for {@linkcode PluginStoryApi.update}. At least one of `height` or
372
+ * `name` must be supplied.
305
373
  *
306
374
  * | Property | Type | Description |
307
375
  * |---|---|---|
308
376
  * | `storyValue` | `number` (int) | Storey number of the story to update |
309
- * | `height` | `number` | New height in Babylon units |
377
+ * | `height` | `number?` | New height in Babylon units (omit to leave unchanged) |
378
+ * | `name` | `string?` | New display name for the story (omit to leave unchanged) |
310
379
  */
311
380
  export const PluginStoryUpdateArgs = z.object({
312
381
  storyValue: z.number().int(),
313
- height: z.number(),
382
+ height: z.number().optional(),
383
+ name: z.string().optional(),
314
384
  })
315
385
 
316
386
  export type PluginStoryUpdateArgs = z.infer<typeof PluginStoryUpdateArgs>
317
387
 
318
388
  /**
319
- * Result of {@linkcode PluginStoryApi.update}.
389
+ * Result of {@linkcode PluginStoryApi.update} — the story's state after the update.
320
390
  *
321
391
  * | Property | Type | Description |
322
392
  * |---|---|---|
323
393
  * | `storyValue` | `number` | The storey number of the updated story |
324
- * | `height` | `number` | The new height after the update |
394
+ * | `height` | `number` | The height after the update |
395
+ * | `name` | `string` | The name after the update |
325
396
  */
326
397
  export const PluginStoryUpdateResult = z.object({
327
398
  storyValue: z.number(),
328
399
  height: z.number(),
400
+ name: z.string(),
329
401
  })
330
402
 
331
403
  export type PluginStoryUpdateResult = z.infer<typeof PluginStoryUpdateResult>
332
404
 
405
+ /**
406
+ * Arguments for {@linkcode PluginStoryApi.setActive}.
407
+ *
408
+ * | Property | Type | Description |
409
+ * |---|---|---|
410
+ * | `storyValue` | `number` (int) | Storey number to activate |
411
+ */
412
+ export const PluginStorySetActiveArgs = z.object({
413
+ storyValue: z.number().int(),
414
+ })
415
+
416
+ export type PluginStorySetActiveArgs = z.infer<typeof PluginStorySetActiveArgs>
417
+
418
+ /**
419
+ * Result of {@linkcode PluginStoryApi.setActive}.
420
+ *
421
+ * | Property | Type | Description |
422
+ * |---|---|---|
423
+ * | `storyValue` | `number` | The storey number that is now active |
424
+ */
425
+ export const PluginStorySetActiveResult = z.object({
426
+ storyValue: z.number(),
427
+ })
428
+
429
+ export type PluginStorySetActiveResult = z.infer<typeof PluginStorySetActiveResult>
430
+
431
+ /**
432
+ * Arguments for {@linkcode PluginStoryApi.delete}.
433
+ *
434
+ * | Property | Type | Description |
435
+ * |---|---|---|
436
+ * | `storyValue` | `number` (int) | Storey number to delete |
437
+ */
438
+ export const PluginStoryDeleteArgs = z.object({
439
+ storyValue: z.number().int(),
440
+ })
441
+
442
+ export type PluginStoryDeleteArgs = z.infer<typeof PluginStoryDeleteArgs>
443
+
444
+ /**
445
+ * Result of {@linkcode PluginStoryApi.delete}.
446
+ *
447
+ * | Property | Type | Description |
448
+ * |---|---|---|
449
+ * | `storyValue` | `number` | The storey number that was deleted |
450
+ * | `newActiveStory` | `number` | The storey the editor fell back to as active |
451
+ */
452
+ export const PluginStoryDeleteResult = z.object({
453
+ storyValue: z.number(),
454
+ newActiveStory: z.number(),
455
+ })
456
+
457
+ export type PluginStoryDeleteResult = z.infer<typeof PluginStoryDeleteResult>
458
+
333
459
  /**
334
460
  * Arguments for {@linkcode PluginStoryApi.duplicate} (options flattened).
335
461
  *