@snaptrude/plugin-core 0.9.16 → 0.9.18-networks-20261016.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +231 -231
- package/CHANGELOG.md +408 -402
- package/CLAUDE.md +11 -11
- package/dist/api/analysis/daylight.d.ts +5 -5
- package/dist/api/analysis/solar.d.ts +2 -2
- package/dist/api/core/camera/index.d.ts +29 -0
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +7 -1
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/update/contour.d.ts +8 -2
- package/dist/api/core/geom/update/contour.d.ts.map +1 -1
- package/dist/api/core/zoom/index.d.ts +13 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/bim.d.ts +209 -0
- package/dist/api/design/bim.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +2 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -1
- package/dist/api/design/catalog.d.ts +320 -0
- package/dist/api/design/catalog.d.ts.map +1 -0
- package/dist/api/design/create/bulk-items.d.ts +65 -25
- package/dist/api/design/create/bulk-items.d.ts.map +1 -1
- package/dist/api/design/create/index.d.ts +272 -99
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +13 -12
- package/dist/api/design/create/opening-fields.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +1 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +18 -24
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/family.d.ts +797 -27
- package/dist/api/design/family.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +16 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/networks.d.ts +1763 -0
- package/dist/api/design/networks.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +42 -32
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +10 -10
- package/dist/api/design/types/index.d.ts +40 -24
- package/dist/api/design/types/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +43 -3
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/windows/index.d.ts +8 -8
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +10 -10
- package/dist/api/presentation/annotate.d.ts +38 -22
- package/dist/api/presentation/annotate.d.ts.map +1 -1
- package/dist/api/presentation/drawingContract.d.ts +32 -0
- package/dist/api/presentation/drawingContract.d.ts.map +1 -0
- package/dist/api/presentation/drawings.d.ts +3523 -0
- package/dist/api/presentation/drawings.d.ts.map +1 -0
- package/dist/api/presentation/export.d.ts +23 -5
- package/dist/api/presentation/export.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +41 -12
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +106 -6
- package/dist/api/presentation/placedViews.d.ts.map +1 -1
- package/dist/api/presentation/sections.d.ts +461 -0
- package/dist/api/presentation/sections.d.ts.map +1 -0
- package/dist/api/presentation/shapes.d.ts +2 -2
- package/dist/api/presentation/sheets.d.ts +175 -19
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/viewPresets.d.ts +222 -0
- package/dist/api/presentation/viewPresets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +103 -5
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/presentation/walkthroughs.d.ts +6 -6
- package/dist/errors/codes.d.ts +3 -1
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/index.cjs +3788 -2328
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3650 -2328
- package/dist/index.js.map +1 -1
- package/package.json +42 -42
- package/scripts/check-dist-fresh.mjs +22 -22
- package/scripts/generate-manifest.mjs +243 -238
- package/scripts/generate-manifest.test.mjs +303 -303
- package/src/api/analysis/daylight.ts +470 -470
- package/src/api/analysis/heatmaps.ts +683 -683
- package/src/api/analysis/illuminance.ts +155 -155
- package/src/api/analysis/index.ts +61 -61
- package/src/api/analysis/shadows.ts +183 -183
- package/src/api/analysis/solar.ts +237 -237
- package/src/api/analysis/sunlightHours.ts +211 -211
- package/src/api/analysis/sunpath.ts +83 -83
- package/src/api/analysis/weather.ts +179 -179
- package/src/api/core/buildings.ts +485 -485
- package/src/api/core/camera/index.ts +696 -667
- package/src/api/core/comment/index.ts +376 -376
- package/src/api/core/geom/create/index.ts +2139 -2133
- package/src/api/core/geom/delete/index.ts +84 -84
- package/src/api/core/geom/index.ts +35 -35
- package/src/api/core/geom/query/arc.ts +169 -169
- package/src/api/core/geom/query/brep.ts +621 -621
- package/src/api/core/geom/query/circle.ts +404 -404
- package/src/api/core/geom/query/contour.ts +540 -540
- package/src/api/core/geom/query/curve.ts +1102 -1102
- package/src/api/core/geom/query/edge.ts +130 -130
- package/src/api/core/geom/query/face.ts +508 -508
- package/src/api/core/geom/query/halfedge.ts +210 -210
- package/src/api/core/geom/query/index.ts +63 -63
- package/src/api/core/geom/query/profile.ts +473 -473
- package/src/api/core/geom/query/vertex.ts +205 -205
- package/src/api/core/geom/update/contour.ts +323 -317
- package/src/api/core/geom/update/curve.ts +209 -209
- package/src/api/core/geom/update/index.ts +29 -29
- package/src/api/core/geom/update/profile.ts +379 -379
- package/src/api/core/groups.ts +521 -521
- package/src/api/core/handles/index.ts +234 -234
- package/src/api/core/history/index.ts +84 -84
- package/src/api/core/index.ts +99 -99
- package/src/api/core/io/export/index.ts +126 -126
- package/src/api/core/io/import/index.ts +504 -504
- package/src/api/core/io/index.ts +42 -42
- package/src/api/core/io/job/index.ts +140 -140
- package/src/api/core/io/query/index.ts +71 -71
- package/src/api/core/io/terrain/index.ts +360 -360
- package/src/api/core/io/underlay/index.ts +705 -705
- package/src/api/core/layers.ts +540 -540
- package/src/api/core/math/index.ts +20 -20
- package/src/api/core/math/quat.ts +172 -172
- package/src/api/core/math/vec3.ts +179 -179
- package/src/api/core/mode/index.ts +108 -108
- package/src/api/core/project/index.ts +479 -479
- package/src/api/core/proposals/index.ts +570 -570
- package/src/api/core/storeys/index.ts +308 -308
- package/src/api/core/storeys/layers.ts +339 -339
- package/src/api/core/tags.ts +911 -911
- package/src/api/core/units/index.ts +164 -164
- package/src/api/core/user.ts +46 -46
- package/src/api/core/zoom/index.ts +64 -51
- package/src/api/design/bim.ts +121 -0
- package/src/api/design/boolean/index.ts +181 -179
- package/src/api/design/catalog.ts +203 -0
- package/src/api/design/create/bulk-items.ts +294 -254
- package/src/api/design/create/grids.ts +137 -137
- package/src/api/design/create/index.ts +2148 -1980
- package/src/api/design/create/opening-fields.ts +40 -37
- package/src/api/design/delete/index.ts +75 -74
- package/src/api/design/dimensions.ts +453 -453
- package/src/api/design/doors/index.ts +516 -500
- package/src/api/design/edit/index.ts +54 -54
- package/src/api/design/erase/index.ts +151 -151
- package/src/api/design/family.ts +1334 -704
- package/src/api/design/furniture/index.ts +319 -319
- package/src/api/design/grids.ts +237 -237
- package/src/api/design/index.ts +304 -274
- package/src/api/design/lock.ts +69 -69
- package/src/api/design/materials/index.ts +608 -608
- package/src/api/design/networks.ts +667 -0
- package/src/api/design/query/geometry/index.ts +319 -319
- package/src/api/design/query/grids.ts +197 -197
- package/src/api/design/query/index.ts +1236 -1226
- package/src/api/design/query/referenceLines.ts +52 -52
- package/src/api/design/query/spaces.ts +275 -275
- package/src/api/design/selection/index.ts +273 -273
- package/src/api/design/shared.ts +40 -40
- package/src/api/design/transform/index.ts +254 -254
- package/src/api/design/types/index.ts +163 -156
- package/src/api/design/update/index.ts +1024 -983
- package/src/api/design/visibility.ts +143 -143
- package/src/api/design/windows/index.ts +351 -333
- package/src/api/entity/buildableEnvelope.ts +322 -322
- package/src/api/entity/index.ts +30 -30
- package/src/api/entity/referenceLine.ts +235 -235
- package/src/api/entity/space.ts +612 -612
- package/src/api/entity/story.ts +517 -517
- package/src/api/index.ts +47 -47
- package/src/api/presentation/aiInspiration.ts +1116 -1116
- package/src/api/presentation/annotate.ts +417 -385
- package/src/api/presentation/camera.ts +289 -289
- package/src/api/presentation/diagrams.ts +194 -194
- package/src/api/presentation/drawingContract.ts +70 -0
- package/src/api/presentation/drawings.ts +1179 -0
- package/src/api/presentation/export.ts +134 -108
- package/src/api/presentation/import.ts +159 -159
- package/src/api/presentation/index.ts +160 -126
- package/src/api/presentation/placedViews.ts +1211 -1120
- package/src/api/presentation/sections.ts +420 -0
- package/src/api/presentation/shapes.ts +274 -274
- package/src/api/presentation/sheets.ts +746 -585
- package/src/api/presentation/slideshow.ts +134 -134
- package/src/api/presentation/tables.ts +84 -84
- package/src/api/presentation/viewPresets.ts +241 -0
- package/src/api/presentation/views.ts +713 -673
- package/src/api/presentation/walkthroughs.ts +1201 -1201
- package/src/api/program/adjacency.ts +164 -164
- package/src/api/program/areas.ts +408 -408
- package/src/api/program/classification.ts +138 -138
- package/src/api/program/cores.ts +83 -83
- package/src/api/program/departments.ts +517 -517
- package/src/api/program/index.ts +73 -73
- package/src/api/program/labels.ts +332 -332
- package/src/api/program/layout.ts +422 -422
- package/src/api/program/metadata.ts +364 -364
- package/src/api/program/metrics.ts +120 -120
- package/src/api/program/site.ts +748 -748
- package/src/api/program/spreadsheet.ts +2698 -2698
- package/src/api/workspace/index.ts +612 -612
- package/src/errors/codes.ts +143 -136
- package/src/errors/envelope.ts +75 -75
- package/src/errors/index.ts +21 -21
- package/src/errors/plugin-error.ts +134 -134
- package/src/handles.ts +297 -297
- package/src/host-utils.ts +67 -67
- package/src/index.ts +7 -7
- package/src/massParameters.ops.ts +246 -246
- package/src/massParameters.ts +427 -427
- package/src/types.ts +16 -16
- package/test/drawingContract.test.mjs +288 -0
- package/test/errors.test.mjs +185 -184
- package/test/massParameters.test.mjs +952 -952
- package/tsconfig.json +22 -22
- package/tsup.config.ts +12 -12
- package/api-manifest.json +0 -9618
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
import * as z from "zod"
|
|
2
|
-
import { PluginApiReturn } from "../../types"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Presentation slideshow — run the Present-mode slideshow programmatically.
|
|
6
|
-
*
|
|
7
|
-
* The scriptable counterpart of the Present toolbar's slideshow: the
|
|
8
|
-
* slideshow plays **all** layout sheets in sheet order (hidden sheets are
|
|
9
|
-
* excluded) — `start` options only pick the slide it opens on. Slide
|
|
10
|
-
* navigation stays with the user (arrow keys / on-screen controls); there is
|
|
11
|
-
* intentionally no `next`/`prev`/`goTo`.
|
|
12
|
-
*
|
|
13
|
-
* **Fullscreen caveat:** browsers only grant fullscreen on a user gesture. A
|
|
14
|
-
* plugin-triggered `start` usually fails that check, in which case the
|
|
15
|
-
* slideshow catches the rejection and runs non-fullscreen (same slides, same
|
|
16
|
-
* controls, windowed).
|
|
17
|
-
*
|
|
18
|
-
* `start`/`stop` are write-gated; `getState` is a never-throw read. Requires
|
|
19
|
-
* Present mode to be open (except `getState`, which reports not-running).
|
|
20
|
-
*
|
|
21
|
-
* Accessed via `snaptrude.presentation.slideshow`.
|
|
22
|
-
*/
|
|
23
|
-
export abstract class PluginPresentationSlideshowApi {
|
|
24
|
-
constructor() {}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Start the slideshow.
|
|
28
|
-
*
|
|
29
|
-
* Launches the Present-mode slideshow over all layout sheets in sheet
|
|
30
|
-
* order. `options.startIndex` opens on that slide (clamped into range);
|
|
31
|
-
* otherwise `options.sheetIds` naming exactly one sheet opens on that
|
|
32
|
-
* sheet; otherwise it opens on the first slide. May run non-fullscreen —
|
|
33
|
-
* see the fullscreen caveat on
|
|
34
|
-
* {@linkcode PluginPresentationSlideshowApi}. Requires Present mode to be
|
|
35
|
-
* open with at least one sheet.
|
|
36
|
-
*
|
|
37
|
-
* @param options - Optional `sheetIds` (open on this sheet when exactly one
|
|
38
|
-
* id is given) and `startIndex` (0-based slide to open on; wins over
|
|
39
|
-
* `sheetIds`; clamped into range).
|
|
40
|
-
* @returns The {@linkcode PluginPresentationSlideshowState} after the
|
|
41
|
-
* launch (`running: true` and the opening `index`).
|
|
42
|
-
* @throws If Present mode is not open or there are no sheets to present.
|
|
43
|
-
*
|
|
44
|
-
* @examplePrompt Start the slideshow
|
|
45
|
-
* @examplePrompt Present the sheets from the beginning
|
|
46
|
-
* @examplePrompt Start the slideshow on sheet 3
|
|
47
|
-
* @examplePrompt Play the presentation starting at the cover sheet
|
|
48
|
-
*
|
|
49
|
-
* # Example
|
|
50
|
-
* ```ts
|
|
51
|
-
* const state = await snaptrude.presentation.slideshow.start({ startIndex: 2 })
|
|
52
|
-
* console.log(state.running, state.index) // true, 2
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
public abstract start(options?: {
|
|
56
|
-
sheetIds?: string[]
|
|
57
|
-
startIndex?: number
|
|
58
|
-
}): PluginApiReturn<PluginPresentationSlideshowState>
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Stop the slideshow.
|
|
62
|
-
*
|
|
63
|
-
* Closes the running slideshow (exiting fullscreen if it entered it) and
|
|
64
|
-
* returns to the Present canvas. A no-op when no slideshow is running.
|
|
65
|
-
*
|
|
66
|
-
* @returns The {@linkcode PluginPresentationSlideshowState} after the stop
|
|
67
|
-
* (`running: false`).
|
|
68
|
-
* @throws If Present mode is not open.
|
|
69
|
-
*
|
|
70
|
-
* @examplePrompt Stop the slideshow
|
|
71
|
-
* @examplePrompt Exit the presentation
|
|
72
|
-
* @examplePrompt Close the slideshow and go back to the sheets
|
|
73
|
-
*
|
|
74
|
-
* # Example
|
|
75
|
-
* ```ts
|
|
76
|
-
* await snaptrude.presentation.slideshow.stop()
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
public abstract stop(): PluginApiReturn<PluginPresentationSlideshowState>
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Read the slideshow state.
|
|
83
|
-
*
|
|
84
|
-
* A never-throw read: reports whether a slideshow is running and, when it
|
|
85
|
-
* is, the current 0-based slide index (`index` is `null` when not
|
|
86
|
-
* running — including when Present mode is closed).
|
|
87
|
-
*
|
|
88
|
-
* @returns The current {@linkcode PluginPresentationSlideshowState}.
|
|
89
|
-
*
|
|
90
|
-
* @examplePrompt Is the slideshow running?
|
|
91
|
-
* @examplePrompt Which slide is the presentation on?
|
|
92
|
-
* @examplePrompt Check the slideshow state
|
|
93
|
-
*
|
|
94
|
-
* # Example
|
|
95
|
-
* ```ts
|
|
96
|
-
* const { running, index } = await snaptrude.presentation.slideshow.getState()
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
public abstract getState(): PluginApiReturn<PluginPresentationSlideshowState>
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Arguments for {@linkcode PluginPresentationSlideshowApi.start}.
|
|
104
|
-
*
|
|
105
|
-
* | Property | Type | Description |
|
|
106
|
-
* |---|---|---|
|
|
107
|
-
* | `sheetIds` | `string[] \| undefined` | Open on this sheet when exactly one id is given |
|
|
108
|
-
* | `startIndex` | `number \| undefined` | 0-based slide to open on (wins over `sheetIds`; clamped) |
|
|
109
|
-
*/
|
|
110
|
-
export const PluginPresentationSlideshowStartArgs = z.object({
|
|
111
|
-
sheetIds: z.array(z.string().min(1)).optional(),
|
|
112
|
-
startIndex: z.number().int().min(0).optional(),
|
|
113
|
-
})
|
|
114
|
-
export type PluginPresentationSlideshowStartArgs = z.infer<
|
|
115
|
-
typeof PluginPresentationSlideshowStartArgs
|
|
116
|
-
>
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* The slideshow state — result of {@linkcode PluginPresentationSlideshowApi.start},
|
|
120
|
-
* {@linkcode PluginPresentationSlideshowApi.stop}, and
|
|
121
|
-
* {@linkcode PluginPresentationSlideshowApi.getState}.
|
|
122
|
-
*
|
|
123
|
-
* | Property | Type | Description |
|
|
124
|
-
* |---|---|---|
|
|
125
|
-
* | `running` | `boolean` | Whether a slideshow is currently running |
|
|
126
|
-
* | `index` | `number \| null` | Current 0-based slide index (`null` when not running) |
|
|
127
|
-
*/
|
|
128
|
-
export const PluginPresentationSlideshowState = z.object({
|
|
129
|
-
running: z.boolean(),
|
|
130
|
-
index: z.number().int().nullable(),
|
|
131
|
-
})
|
|
132
|
-
export type PluginPresentationSlideshowState = z.infer<
|
|
133
|
-
typeof PluginPresentationSlideshowState
|
|
134
|
-
>
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../types"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Presentation slideshow — run the Present-mode slideshow programmatically.
|
|
6
|
+
*
|
|
7
|
+
* The scriptable counterpart of the Present toolbar's slideshow: the
|
|
8
|
+
* slideshow plays **all** layout sheets in sheet order (hidden sheets are
|
|
9
|
+
* excluded) — `start` options only pick the slide it opens on. Slide
|
|
10
|
+
* navigation stays with the user (arrow keys / on-screen controls); there is
|
|
11
|
+
* intentionally no `next`/`prev`/`goTo`.
|
|
12
|
+
*
|
|
13
|
+
* **Fullscreen caveat:** browsers only grant fullscreen on a user gesture. A
|
|
14
|
+
* plugin-triggered `start` usually fails that check, in which case the
|
|
15
|
+
* slideshow catches the rejection and runs non-fullscreen (same slides, same
|
|
16
|
+
* controls, windowed).
|
|
17
|
+
*
|
|
18
|
+
* `start`/`stop` are write-gated; `getState` is a never-throw read. Requires
|
|
19
|
+
* Present mode to be open (except `getState`, which reports not-running).
|
|
20
|
+
*
|
|
21
|
+
* Accessed via `snaptrude.presentation.slideshow`.
|
|
22
|
+
*/
|
|
23
|
+
export abstract class PluginPresentationSlideshowApi {
|
|
24
|
+
constructor() {}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Start the slideshow.
|
|
28
|
+
*
|
|
29
|
+
* Launches the Present-mode slideshow over all layout sheets in sheet
|
|
30
|
+
* order. `options.startIndex` opens on that slide (clamped into range);
|
|
31
|
+
* otherwise `options.sheetIds` naming exactly one sheet opens on that
|
|
32
|
+
* sheet; otherwise it opens on the first slide. May run non-fullscreen —
|
|
33
|
+
* see the fullscreen caveat on
|
|
34
|
+
* {@linkcode PluginPresentationSlideshowApi}. Requires Present mode to be
|
|
35
|
+
* open with at least one sheet.
|
|
36
|
+
*
|
|
37
|
+
* @param options - Optional `sheetIds` (open on this sheet when exactly one
|
|
38
|
+
* id is given) and `startIndex` (0-based slide to open on; wins over
|
|
39
|
+
* `sheetIds`; clamped into range).
|
|
40
|
+
* @returns The {@linkcode PluginPresentationSlideshowState} after the
|
|
41
|
+
* launch (`running: true` and the opening `index`).
|
|
42
|
+
* @throws If Present mode is not open or there are no sheets to present.
|
|
43
|
+
*
|
|
44
|
+
* @examplePrompt Start the slideshow
|
|
45
|
+
* @examplePrompt Present the sheets from the beginning
|
|
46
|
+
* @examplePrompt Start the slideshow on sheet 3
|
|
47
|
+
* @examplePrompt Play the presentation starting at the cover sheet
|
|
48
|
+
*
|
|
49
|
+
* # Example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const state = await snaptrude.presentation.slideshow.start({ startIndex: 2 })
|
|
52
|
+
* console.log(state.running, state.index) // true, 2
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
public abstract start(options?: {
|
|
56
|
+
sheetIds?: string[]
|
|
57
|
+
startIndex?: number
|
|
58
|
+
}): PluginApiReturn<PluginPresentationSlideshowState>
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Stop the slideshow.
|
|
62
|
+
*
|
|
63
|
+
* Closes the running slideshow (exiting fullscreen if it entered it) and
|
|
64
|
+
* returns to the Present canvas. A no-op when no slideshow is running.
|
|
65
|
+
*
|
|
66
|
+
* @returns The {@linkcode PluginPresentationSlideshowState} after the stop
|
|
67
|
+
* (`running: false`).
|
|
68
|
+
* @throws If Present mode is not open.
|
|
69
|
+
*
|
|
70
|
+
* @examplePrompt Stop the slideshow
|
|
71
|
+
* @examplePrompt Exit the presentation
|
|
72
|
+
* @examplePrompt Close the slideshow and go back to the sheets
|
|
73
|
+
*
|
|
74
|
+
* # Example
|
|
75
|
+
* ```ts
|
|
76
|
+
* await snaptrude.presentation.slideshow.stop()
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
public abstract stop(): PluginApiReturn<PluginPresentationSlideshowState>
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Read the slideshow state.
|
|
83
|
+
*
|
|
84
|
+
* A never-throw read: reports whether a slideshow is running and, when it
|
|
85
|
+
* is, the current 0-based slide index (`index` is `null` when not
|
|
86
|
+
* running — including when Present mode is closed).
|
|
87
|
+
*
|
|
88
|
+
* @returns The current {@linkcode PluginPresentationSlideshowState}.
|
|
89
|
+
*
|
|
90
|
+
* @examplePrompt Is the slideshow running?
|
|
91
|
+
* @examplePrompt Which slide is the presentation on?
|
|
92
|
+
* @examplePrompt Check the slideshow state
|
|
93
|
+
*
|
|
94
|
+
* # Example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const { running, index } = await snaptrude.presentation.slideshow.getState()
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
public abstract getState(): PluginApiReturn<PluginPresentationSlideshowState>
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Arguments for {@linkcode PluginPresentationSlideshowApi.start}.
|
|
104
|
+
*
|
|
105
|
+
* | Property | Type | Description |
|
|
106
|
+
* |---|---|---|
|
|
107
|
+
* | `sheetIds` | `string[] \| undefined` | Open on this sheet when exactly one id is given |
|
|
108
|
+
* | `startIndex` | `number \| undefined` | 0-based slide to open on (wins over `sheetIds`; clamped) |
|
|
109
|
+
*/
|
|
110
|
+
export const PluginPresentationSlideshowStartArgs = z.object({
|
|
111
|
+
sheetIds: z.array(z.string().min(1)).optional(),
|
|
112
|
+
startIndex: z.number().int().min(0).optional(),
|
|
113
|
+
})
|
|
114
|
+
export type PluginPresentationSlideshowStartArgs = z.infer<
|
|
115
|
+
typeof PluginPresentationSlideshowStartArgs
|
|
116
|
+
>
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The slideshow state — result of {@linkcode PluginPresentationSlideshowApi.start},
|
|
120
|
+
* {@linkcode PluginPresentationSlideshowApi.stop}, and
|
|
121
|
+
* {@linkcode PluginPresentationSlideshowApi.getState}.
|
|
122
|
+
*
|
|
123
|
+
* | Property | Type | Description |
|
|
124
|
+
* |---|---|---|
|
|
125
|
+
* | `running` | `boolean` | Whether a slideshow is currently running |
|
|
126
|
+
* | `index` | `number \| null` | Current 0-based slide index (`null` when not running) |
|
|
127
|
+
*/
|
|
128
|
+
export const PluginPresentationSlideshowState = z.object({
|
|
129
|
+
running: z.boolean(),
|
|
130
|
+
index: z.number().int().nullable(),
|
|
131
|
+
})
|
|
132
|
+
export type PluginPresentationSlideshowState = z.infer<
|
|
133
|
+
typeof PluginPresentationSlideshowState
|
|
134
|
+
>
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import * as z from "zod"
|
|
2
|
-
import { PluginApiReturn } from "../../types"
|
|
3
|
-
import type { PluginCanvasShape } from "./placedViews"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Presentation tables — place data tables on Present-mode sheets.
|
|
7
|
-
*
|
|
8
|
-
* The scriptable counterpart of the Present canvas's table paste (the flow
|
|
9
|
-
* that turns a Program-mode / Google Sheets / Excel paste into a table
|
|
10
|
-
* shape): {@linkcode PluginPresentationTablesApi.place} takes plain string
|
|
11
|
-
* rows and creates one table shape on a sheet. Requires Present mode to be
|
|
12
|
-
* open.
|
|
13
|
-
*
|
|
14
|
-
* Accessed via `snaptrude.presentation.tables`.
|
|
15
|
-
*/
|
|
16
|
-
export abstract class PluginPresentationTablesApi {
|
|
17
|
-
constructor() {}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Place a table on a sheet.
|
|
21
|
-
*
|
|
22
|
-
* Creates one table shape from `table.rows` — the same shape the Present
|
|
23
|
-
* canvas creates when a spreadsheet table is pasted — and returns the
|
|
24
|
-
* created shape as a canvas-shape record. Cells are plain strings; rows may
|
|
25
|
-
* be ragged (each row needs at least one cell), capped at 10000 cells
|
|
26
|
-
* total. `options.position` is sheet-local (relative to the sheet's
|
|
27
|
-
* top-left, in canvas units — the same convention as `annotate.*`); when
|
|
28
|
-
* omitted the table lands where the paste flow would auto-place it (the
|
|
29
|
-
* center of the current viewport). One undo step. Requires Present mode to
|
|
30
|
-
* be open.
|
|
31
|
-
*
|
|
32
|
-
* @param sheetId - The sheet to place the table on.
|
|
33
|
-
* @param table - The table content: `rows`, an array of string-cell rows.
|
|
34
|
-
* @param options - Optional `position` (`{ x, y }`, relative to the sheet's
|
|
35
|
-
* top-left — defaults to the paste flow's auto-placement).
|
|
36
|
-
* @returns The created table shape as a {@linkcode PluginCanvasShape}.
|
|
37
|
-
* @throws If Present mode is not open, the sheet id is invalid, or the
|
|
38
|
-
* table is empty / exceeds the 10000-cell cap.
|
|
39
|
-
*
|
|
40
|
-
* @examplePrompt Put the area schedule as a table on Sheet 1
|
|
41
|
-
* @examplePrompt Add a table of the room programs to the cover sheet
|
|
42
|
-
* @examplePrompt Paste this data as a table on the sheet
|
|
43
|
-
* @examplePrompt Place a two-column table of space names and areas
|
|
44
|
-
*
|
|
45
|
-
* # Example
|
|
46
|
-
* ```ts
|
|
47
|
-
* const shape = await snaptrude.presentation.tables.place("sheet_1", {
|
|
48
|
-
* rows: [
|
|
49
|
-
* ["Room", "Area"],
|
|
50
|
-
* ["Kitchen", "12.4 m²"],
|
|
51
|
-
* ["Living", "28.0 m²"],
|
|
52
|
-
* ],
|
|
53
|
-
* }, { position: { x: 40, y: 40 } })
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
public abstract place(
|
|
57
|
-
sheetId: string,
|
|
58
|
-
table: { rows: string[][] },
|
|
59
|
-
options?: { position?: { x: number; y: number } },
|
|
60
|
-
): PluginApiReturn<PluginCanvasShape>
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Arguments for {@linkcode PluginPresentationTablesApi.place}.
|
|
65
|
-
*
|
|
66
|
-
* | Property | Type | Description |
|
|
67
|
-
* |---|---|---|
|
|
68
|
-
* | `sheetId` | `string` | The sheet to place the table on |
|
|
69
|
-
* | `rows` | `string[][]` | Table cells as string rows (non-empty; ≤ 10000 cells total) |
|
|
70
|
-
* | `position` | `{ x: number; y: number } \| undefined` | Sheet-local position (default: paste auto-placement) |
|
|
71
|
-
*/
|
|
72
|
-
export const PluginPresentationTablesPlaceArgs = z.object({
|
|
73
|
-
sheetId: z.string().min(1),
|
|
74
|
-
rows: z
|
|
75
|
-
.array(z.array(z.string()).min(1))
|
|
76
|
-
.min(1)
|
|
77
|
-
.refine((rows) => rows.reduce((n, r) => n + r.length, 0) <= 10000, {
|
|
78
|
-
message: "table exceeds the 10000-cell cap",
|
|
79
|
-
}),
|
|
80
|
-
position: z.object({ x: z.number(), y: z.number() }).optional(),
|
|
81
|
-
})
|
|
82
|
-
export type PluginPresentationTablesPlaceArgs = z.infer<
|
|
83
|
-
typeof PluginPresentationTablesPlaceArgs
|
|
84
|
-
>
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../types"
|
|
3
|
+
import type { PluginCanvasShape } from "./placedViews"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Presentation tables — place data tables on Present-mode sheets.
|
|
7
|
+
*
|
|
8
|
+
* The scriptable counterpart of the Present canvas's table paste (the flow
|
|
9
|
+
* that turns a Program-mode / Google Sheets / Excel paste into a table
|
|
10
|
+
* shape): {@linkcode PluginPresentationTablesApi.place} takes plain string
|
|
11
|
+
* rows and creates one table shape on a sheet. Requires Present mode to be
|
|
12
|
+
* open.
|
|
13
|
+
*
|
|
14
|
+
* Accessed via `snaptrude.presentation.tables`.
|
|
15
|
+
*/
|
|
16
|
+
export abstract class PluginPresentationTablesApi {
|
|
17
|
+
constructor() {}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Place a table on a sheet.
|
|
21
|
+
*
|
|
22
|
+
* Creates one table shape from `table.rows` — the same shape the Present
|
|
23
|
+
* canvas creates when a spreadsheet table is pasted — and returns the
|
|
24
|
+
* created shape as a canvas-shape record. Cells are plain strings; rows may
|
|
25
|
+
* be ragged (each row needs at least one cell), capped at 10000 cells
|
|
26
|
+
* total. `options.position` is sheet-local (relative to the sheet's
|
|
27
|
+
* top-left, in canvas units — the same convention as `annotate.*`); when
|
|
28
|
+
* omitted the table lands where the paste flow would auto-place it (the
|
|
29
|
+
* center of the current viewport). One undo step. Requires Present mode to
|
|
30
|
+
* be open.
|
|
31
|
+
*
|
|
32
|
+
* @param sheetId - The sheet to place the table on.
|
|
33
|
+
* @param table - The table content: `rows`, an array of string-cell rows.
|
|
34
|
+
* @param options - Optional `position` (`{ x, y }`, relative to the sheet's
|
|
35
|
+
* top-left — defaults to the paste flow's auto-placement).
|
|
36
|
+
* @returns The created table shape as a {@linkcode PluginCanvasShape}.
|
|
37
|
+
* @throws If Present mode is not open, the sheet id is invalid, or the
|
|
38
|
+
* table is empty / exceeds the 10000-cell cap.
|
|
39
|
+
*
|
|
40
|
+
* @examplePrompt Put the area schedule as a table on Sheet 1
|
|
41
|
+
* @examplePrompt Add a table of the room programs to the cover sheet
|
|
42
|
+
* @examplePrompt Paste this data as a table on the sheet
|
|
43
|
+
* @examplePrompt Place a two-column table of space names and areas
|
|
44
|
+
*
|
|
45
|
+
* # Example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const shape = await snaptrude.presentation.tables.place("sheet_1", {
|
|
48
|
+
* rows: [
|
|
49
|
+
* ["Room", "Area"],
|
|
50
|
+
* ["Kitchen", "12.4 m²"],
|
|
51
|
+
* ["Living", "28.0 m²"],
|
|
52
|
+
* ],
|
|
53
|
+
* }, { position: { x: 40, y: 40 } })
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
public abstract place(
|
|
57
|
+
sheetId: string,
|
|
58
|
+
table: { rows: string[][] },
|
|
59
|
+
options?: { position?: { x: number; y: number } },
|
|
60
|
+
): PluginApiReturn<PluginCanvasShape>
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Arguments for {@linkcode PluginPresentationTablesApi.place}.
|
|
65
|
+
*
|
|
66
|
+
* | Property | Type | Description |
|
|
67
|
+
* |---|---|---|
|
|
68
|
+
* | `sheetId` | `string` | The sheet to place the table on |
|
|
69
|
+
* | `rows` | `string[][]` | Table cells as string rows (non-empty; ≤ 10000 cells total) |
|
|
70
|
+
* | `position` | `{ x: number; y: number } \| undefined` | Sheet-local position (default: paste auto-placement) |
|
|
71
|
+
*/
|
|
72
|
+
export const PluginPresentationTablesPlaceArgs = z.object({
|
|
73
|
+
sheetId: z.string().min(1),
|
|
74
|
+
rows: z
|
|
75
|
+
.array(z.array(z.string()).min(1))
|
|
76
|
+
.min(1)
|
|
77
|
+
.refine((rows) => rows.reduce((n, r) => n + r.length, 0) <= 10000, {
|
|
78
|
+
message: "table exceeds the 10000-cell cap",
|
|
79
|
+
}),
|
|
80
|
+
position: z.object({ x: z.number(), y: z.number() }).optional(),
|
|
81
|
+
})
|
|
82
|
+
export type PluginPresentationTablesPlaceArgs = z.infer<
|
|
83
|
+
typeof PluginPresentationTablesPlaceArgs
|
|
84
|
+
>
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import type { PluginApiReturn } from "../../types"
|
|
3
|
+
|
|
4
|
+
/** Presets are document-local. Their ids are stable across reload; built-ins are immutable. */
|
|
5
|
+
export const PluginViewPreset = z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
name: z.string(),
|
|
8
|
+
builtIn: z.boolean(),
|
|
9
|
+
revision: z.number().int().nonnegative(),
|
|
10
|
+
})
|
|
11
|
+
export type PluginViewPreset = z.infer<typeof PluginViewPreset>
|
|
12
|
+
export const PluginViewPresetIdArgs = z
|
|
13
|
+
.object({ presetId: z.string().min(1) })
|
|
14
|
+
.strict()
|
|
15
|
+
export type PluginViewPresetIdArgs = z.infer<typeof PluginViewPresetIdArgs>
|
|
16
|
+
export const PluginViewPresetCreateArgs = z
|
|
17
|
+
.object({ name: z.string().trim().min(1), fromDrawingId: z.string().min(1) })
|
|
18
|
+
.strict()
|
|
19
|
+
export type PluginViewPresetCreateArgs = z.infer<
|
|
20
|
+
typeof PluginViewPresetCreateArgs
|
|
21
|
+
>
|
|
22
|
+
export const PluginViewPresetRenameArgs = PluginViewPresetIdArgs.extend({
|
|
23
|
+
name: z.string().trim().min(1),
|
|
24
|
+
})
|
|
25
|
+
export type PluginViewPresetRenameArgs = z.infer<
|
|
26
|
+
typeof PluginViewPresetRenameArgs
|
|
27
|
+
>
|
|
28
|
+
export const PluginViewPresetUpdateArgs = PluginViewPresetIdArgs.extend({
|
|
29
|
+
fromDrawingId: z.string().min(1),
|
|
30
|
+
})
|
|
31
|
+
export type PluginViewPresetUpdateArgs = z.infer<
|
|
32
|
+
typeof PluginViewPresetUpdateArgs
|
|
33
|
+
>
|
|
34
|
+
export const PluginViewPresetDeleteArgs = PluginViewPresetIdArgs.extend({
|
|
35
|
+
replacementId: z.string().min(1),
|
|
36
|
+
})
|
|
37
|
+
export type PluginViewPresetDeleteArgs = z.infer<
|
|
38
|
+
typeof PluginViewPresetDeleteArgs
|
|
39
|
+
>
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Reusable styles for kernel-plan drawings, stored in the Present document.
|
|
43
|
+
*
|
|
44
|
+
* A preset holds every style category of a native kernel plan. A drawing is
|
|
45
|
+
* bound to one with {@linkcode PluginPresentationDrawingsApi.applyPreset}; its
|
|
46
|
+
* own style changes are overrides on top, dropped by
|
|
47
|
+
* {@linkcode PluginPresentationDrawingsApi.resetOverrides}. Presets apply only
|
|
48
|
+
* to drawings whose `drawings.getCapabilities(drawingId).presets` is `true`.
|
|
49
|
+
* Local title text is excluded from preset values.
|
|
50
|
+
*
|
|
51
|
+
* Presets are document-local; their ids survive reload. Built-in presets are
|
|
52
|
+
* immutable. Catalog writes (`create`, `copy`, `rename`, `update`, `delete`)
|
|
53
|
+
* are native document metadata and are **not undoable**; binding a drawing or
|
|
54
|
+
* changing its overrides uses Present undo. Every method requires **Present
|
|
55
|
+
* mode to be open** and throws `PRECONDITION_FAILED` ("Present mode is not
|
|
56
|
+
* open") when it is closed; no method switches tabs.
|
|
57
|
+
*
|
|
58
|
+
* Accessed via `snaptrude.presentation.viewPresets`.
|
|
59
|
+
*/
|
|
60
|
+
export abstract class PluginPresentationViewPresetsApi {
|
|
61
|
+
/**
|
|
62
|
+
* List the preset catalog: built-ins first, then custom presets by name.
|
|
63
|
+
*
|
|
64
|
+
* @returns Every {@linkcode PluginViewPreset}.
|
|
65
|
+
* @throws `PRECONDITION_FAILED` if Present mode is not open.
|
|
66
|
+
*
|
|
67
|
+
* @examplePrompt List the available drawing style presets
|
|
68
|
+
* @examplePrompt Which custom presets does this presentation have?
|
|
69
|
+
* @examplePrompt Is there a Planning Issue preset?
|
|
70
|
+
*
|
|
71
|
+
* # Example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const presets = await snaptrude.presentation.viewPresets.list()
|
|
74
|
+
* const custom = presets.filter((preset) => !preset.builtIn)
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
public abstract list(): PluginApiReturn<PluginViewPreset[]>
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Read one preset by id.
|
|
81
|
+
*
|
|
82
|
+
* @param presetId - The preset to read.
|
|
83
|
+
* @returns The {@linkcode PluginViewPreset}, or `null` if no preset has that id.
|
|
84
|
+
* @throws `PRECONDITION_FAILED` if Present mode is not open.
|
|
85
|
+
*
|
|
86
|
+
* @examplePrompt Which preset is this drawing using?
|
|
87
|
+
* @examplePrompt Is this preset a built-in one?
|
|
88
|
+
* @examplePrompt Read the preset bound to the ground floor plan
|
|
89
|
+
*
|
|
90
|
+
* # Example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const drawing = await snaptrude.presentation.drawings.get(drawingId)
|
|
93
|
+
* const preset = drawing?.presetId
|
|
94
|
+
* ? await snaptrude.presentation.viewPresets.get(drawing.presetId)
|
|
95
|
+
* : null
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
public abstract get(
|
|
99
|
+
presetId: string,
|
|
100
|
+
): PluginApiReturn<PluginViewPreset | null>
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Save a kernel-plan drawing's effective styles as a new custom preset and
|
|
104
|
+
* bind that drawing to it. Not undoable (catalog write).
|
|
105
|
+
*
|
|
106
|
+
* @param name - A unique preset name (non-empty after trimming).
|
|
107
|
+
* @param options - `fromDrawingId`: the kernel-plan drawing to take styles from.
|
|
108
|
+
* @returns The new {@linkcode PluginViewPreset}.
|
|
109
|
+
* @throws `VALIDATION` for an empty or duplicate name (with a hint);
|
|
110
|
+
* `PRECONDITION_FAILED` if Present mode is not open, the document is
|
|
111
|
+
* read-only, or the drawing is not a kernel vector plan (each with a
|
|
112
|
+
* hint); `HANDLE_INVALID` if `fromDrawingId` is not a drawing.
|
|
113
|
+
*
|
|
114
|
+
* @examplePrompt Save this drawing's styles as a new preset
|
|
115
|
+
* @examplePrompt Make a preset called Planning Issue from this plan
|
|
116
|
+
* @examplePrompt Turn my restyled drawing into a reusable style
|
|
117
|
+
*
|
|
118
|
+
* # Example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const capabilities = await snaptrude.presentation.drawings.getCapabilities(drawing.id)
|
|
121
|
+
* if (capabilities.presets) {
|
|
122
|
+
* const preset = await snaptrude.presentation.viewPresets.create("Planning Issue", {
|
|
123
|
+
* fromDrawingId: drawing.id,
|
|
124
|
+
* })
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
public abstract create(
|
|
129
|
+
name: string,
|
|
130
|
+
options: { fromDrawingId: string },
|
|
131
|
+
): PluginApiReturn<PluginViewPreset>
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Duplicate a preset under a native-generated unique name. Drawing bindings
|
|
135
|
+
* do not change. Not undoable (catalog write). Built-ins can be copied.
|
|
136
|
+
*
|
|
137
|
+
* @param presetId - The preset to copy.
|
|
138
|
+
* @returns The new custom {@linkcode PluginViewPreset}.
|
|
139
|
+
* @throws `PRECONDITION_FAILED` if Present mode is not open or the document
|
|
140
|
+
* is read-only (each with a hint); `HANDLE_INVALID` if `presetId` does not
|
|
141
|
+
* exist.
|
|
142
|
+
*
|
|
143
|
+
* @examplePrompt Duplicate this preset
|
|
144
|
+
* @examplePrompt Make an editable copy of the built-in preset
|
|
145
|
+
* @examplePrompt Copy the Planning Issue preset so I can change it
|
|
146
|
+
*
|
|
147
|
+
* # Example
|
|
148
|
+
* ```ts
|
|
149
|
+
* const copy = await snaptrude.presentation.viewPresets.copy(preset.id)
|
|
150
|
+
* await snaptrude.presentation.viewPresets.rename(copy.id, "Planning Issue B")
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
public abstract copy(presetId: string): PluginApiReturn<PluginViewPreset>
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Rename a custom preset. Names must stay unique; built-ins cannot be
|
|
157
|
+
* renamed. Not undoable (catalog write).
|
|
158
|
+
*
|
|
159
|
+
* @param presetId - The custom preset to rename.
|
|
160
|
+
* @param name - The new unique name (non-empty after trimming).
|
|
161
|
+
* @returns The renamed {@linkcode PluginViewPreset}.
|
|
162
|
+
* @throws `VALIDATION` when the catalog refuses: an empty or duplicate name,
|
|
163
|
+
* a built-in preset, or an unknown `presetId` (with a hint);
|
|
164
|
+
* `PRECONDITION_FAILED` if Present mode is not open or the document is
|
|
165
|
+
* read-only (each with a hint).
|
|
166
|
+
*
|
|
167
|
+
* @examplePrompt Rename this preset to Client Review
|
|
168
|
+
* @examplePrompt Call the copied preset Planning Issue B
|
|
169
|
+
* @examplePrompt Change the name of my custom drawing style
|
|
170
|
+
*
|
|
171
|
+
* # Example
|
|
172
|
+
* ```ts
|
|
173
|
+
* await snaptrude.presentation.viewPresets.rename(preset.id, "Client Review")
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
public abstract rename(
|
|
177
|
+
presetId: string,
|
|
178
|
+
name: string,
|
|
179
|
+
): PluginApiReturn<PluginViewPreset>
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Replace a custom preset's values with the effective styles of a drawing
|
|
183
|
+
* already bound to it, then refresh every bound drawing. Built-ins cannot
|
|
184
|
+
* be updated. Not undoable (catalog write).
|
|
185
|
+
*
|
|
186
|
+
* @param presetId - The custom preset to update.
|
|
187
|
+
* @param options - `fromDrawingId`: a kernel-plan drawing bound to this preset.
|
|
188
|
+
* @returns The updated {@linkcode PluginViewPreset} (its `revision` grows).
|
|
189
|
+
* @throws `VALIDATION` when the catalog refuses: a built-in preset (with a
|
|
190
|
+
* hint); `PRECONDITION_FAILED` if Present mode is not open, the document
|
|
191
|
+
* is read-only, or the drawing is not a kernel vector plan bound to this
|
|
192
|
+
* preset (each with a hint); `HANDLE_INVALID` if `fromDrawingId` is not a
|
|
193
|
+
* drawing.
|
|
194
|
+
*
|
|
195
|
+
* @examplePrompt Update this preset from the current drawing styles
|
|
196
|
+
* @examplePrompt Push my style changes to every drawing using this preset
|
|
197
|
+
* @examplePrompt Save these overrides into the Planning Issue preset
|
|
198
|
+
*
|
|
199
|
+
* # Example
|
|
200
|
+
* ```ts
|
|
201
|
+
* await snaptrude.presentation.viewPresets.update(drawing.presetId!, {
|
|
202
|
+
* fromDrawingId: drawing.id,
|
|
203
|
+
* })
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
public abstract update(
|
|
207
|
+
presetId: string,
|
|
208
|
+
options: { fromDrawingId: string },
|
|
209
|
+
): PluginApiReturn<PluginViewPreset>
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Delete a custom preset and rebind its drawings to another existing
|
|
213
|
+
* preset. Built-ins cannot be deleted. Not undoable (catalog write).
|
|
214
|
+
*
|
|
215
|
+
* @param presetId - The custom preset to delete.
|
|
216
|
+
* @param options - `replacementId`: the existing preset its drawings move to
|
|
217
|
+
* (not the deleted one).
|
|
218
|
+
* @returns Nothing.
|
|
219
|
+
* @throws `VALIDATION` when the catalog refuses: a built-in or unknown
|
|
220
|
+
* `presetId`, or an unknown `replacementId` (with a hint);
|
|
221
|
+
* `PRECONDITION_FAILED` if Present mode is not open or the document is
|
|
222
|
+
* read-only (each with a hint).
|
|
223
|
+
*
|
|
224
|
+
* @examplePrompt Delete this preset
|
|
225
|
+
* @examplePrompt Remove the old style preset and switch its drawings to the default
|
|
226
|
+
* @examplePrompt Get rid of the Planning Issue B preset
|
|
227
|
+
*
|
|
228
|
+
* # Example
|
|
229
|
+
* ```ts
|
|
230
|
+
* const presets = await snaptrude.presentation.viewPresets.list()
|
|
231
|
+
* const replacement = presets.find((each) => each.builtIn)!
|
|
232
|
+
* await snaptrude.presentation.viewPresets.delete(customPreset.id, {
|
|
233
|
+
* replacementId: replacement.id,
|
|
234
|
+
* })
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
public abstract delete(
|
|
238
|
+
presetId: string,
|
|
239
|
+
options: { replacementId: string },
|
|
240
|
+
): PluginApiReturn<void>
|
|
241
|
+
}
|