@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.
- package/CHANGELOG.md +22 -0
- package/api-manifest.full.json +360 -19
- package/api-manifest.json +915 -37
- package/dist/api/core/camera/index.d.ts +208 -0
- package/dist/api/core/camera/index.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +105 -2
- package/dist/api/core/comment/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +13 -13
- package/dist/api/core/geom/delete/index.d.ts +8 -2
- package/dist/api/core/geom/delete/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +5 -5
- package/dist/api/core/geom/query/brep.d.ts +18 -18
- package/dist/api/core/geom/query/circle.d.ts +18 -18
- package/dist/api/core/geom/query/contour.d.ts +20 -20
- package/dist/api/core/geom/query/curve.d.ts +49 -49
- package/dist/api/core/geom/query/edge.d.ts +5 -5
- package/dist/api/core/geom/query/face.d.ts +16 -16
- package/dist/api/core/geom/query/halfedge.d.ts +8 -8
- package/dist/api/core/geom/query/profile.d.ts +19 -19
- package/dist/api/core/geom/query/vertex.d.ts +8 -8
- package/dist/api/core/geom/update/contour.d.ts +14 -14
- package/dist/api/core/geom/update/curve.d.ts +7 -7
- package/dist/api/core/geom/update/profile.d.ts +16 -16
- package/dist/api/core/handles/index.d.ts +210 -0
- package/dist/api/core/handles/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +15 -0
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/export/index.d.ts +132 -0
- package/dist/api/core/io/export/index.d.ts.map +1 -0
- package/dist/api/core/io/import/index.d.ts +1 -1
- package/dist/api/core/io/index.d.ts +5 -0
- package/dist/api/core/io/index.d.ts.map +1 -1
- package/dist/api/core/layers.d.ts +7 -7
- package/dist/api/core/proposals/index.d.ts +65 -9
- package/dist/api/core/proposals/index.d.ts.map +1 -1
- package/dist/api/core/user.d.ts +44 -0
- package/dist/api/core/user.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +4 -4
- package/dist/api/design/create/index.d.ts +139 -44
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +36 -0
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/edit/index.d.ts +1 -1
- package/dist/api/design/erase/index.d.ts +2 -2
- package/dist/api/design/furniture/index.d.ts +114 -3
- package/dist/api/design/furniture/index.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +10 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/materials/index.d.ts +111 -14
- package/dist/api/design/materials/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +31 -1
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/spaces.d.ts +5 -5
- package/dist/api/design/transform/index.d.ts +83 -14
- package/dist/api/design/transform/index.d.ts.map +1 -1
- package/dist/api/design/types/index.d.ts +181 -0
- package/dist/api/design/types/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +335 -2
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/visibility.d.ts +98 -0
- package/dist/api/design/visibility.d.ts.map +1 -0
- package/dist/api/entity/referenceLine.d.ts +2 -2
- package/dist/api/entity/space.d.ts +19 -19
- package/dist/api/entity/story.d.ts +128 -15
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +1967 -7
- package/dist/api/presentation/aiInspiration.d.ts.map +1 -1
- package/dist/api/presentation/annotate.d.ts +448 -0
- package/dist/api/presentation/annotate.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +49 -8
- package/dist/api/presentation/diagrams.d.ts.map +1 -1
- package/dist/api/presentation/export.d.ts +104 -0
- package/dist/api/presentation/export.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +40 -3
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/sheets.d.ts +410 -13
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/views.d.ts +165 -10
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/program/areas.d.ts +63 -3
- package/dist/api/program/areas.d.ts.map +1 -1
- package/dist/api/program/cores.d.ts +3 -99
- package/dist/api/program/cores.d.ts.map +1 -1
- package/dist/api/program/index.d.ts +2 -2
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/layout.d.ts +172 -12
- package/dist/api/program/layout.d.ts.map +1 -1
- package/dist/api/program/site.d.ts +11 -8
- package/dist/api/program/site.d.ts.map +1 -1
- package/dist/api/program/spreadsheet.d.ts +105 -13
- package/dist/api/program/spreadsheet.d.ts.map +1 -1
- package/dist/handles.d.ts +64 -25
- package/dist/handles.d.ts.map +1 -1
- package/dist/index.cjs +2502 -1466
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2369 -1461
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/core/camera/index.ts +212 -0
- package/src/api/core/comment/index.ts +120 -2
- package/src/api/core/geom/delete/index.ts +6 -0
- package/src/api/core/handles/index.ts +233 -0
- package/src/api/core/index.ts +15 -0
- package/src/api/core/io/export/index.ts +124 -0
- package/src/api/core/io/index.ts +5 -0
- package/src/api/core/proposals/index.ts +71 -11
- package/src/api/core/user.ts +46 -0
- package/src/api/design/create/index.ts +166 -36
- package/src/api/design/doors/index.ts +40 -0
- package/src/api/design/furniture/index.ts +127 -3
- package/src/api/design/index.ts +10 -0
- package/src/api/design/materials/index.ts +157 -30
- package/src/api/design/query/index.ts +33 -7
- package/src/api/design/transform/index.ts +89 -12
- package/src/api/design/types/index.ts +156 -0
- package/src/api/design/update/index.ts +402 -6
- package/src/api/design/visibility.ts +109 -0
- package/src/api/entity/story.ts +141 -15
- package/src/api/presentation/aiInspiration.ts +761 -7
- package/src/api/presentation/annotate.ts +360 -0
- package/src/api/presentation/diagrams.ts +53 -8
- package/src/api/presentation/export.ts +104 -0
- package/src/api/presentation/index.ts +48 -3
- package/src/api/presentation/sheets.ts +346 -13
- package/src/api/presentation/views.ts +164 -12
- package/src/api/program/areas.ts +57 -6
- package/src/api/program/cores.ts +3 -91
- package/src/api/program/index.ts +2 -2
- package/src/api/program/layout.ts +182 -12
- package/src/api/program/site.ts +11 -8
- package/src/api/program/spreadsheet.ts +125 -29
- package/src/handles.ts +77 -13
- package/tsconfig.json +7 -2
package/src/api/entity/story.ts
CHANGED
|
@@ -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
|
|
105
|
+
* Update a story's floor-to-floor `height` and/or `name`.
|
|
106
106
|
*
|
|
107
|
-
*
|
|
108
|
-
* walls, columns, and masses on the story are **stretched** to the new
|
|
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
|
|
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
|
-
* @
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
*
|