@snaptrude/plugin-core 0.0.0-dev-20260708130115 → 0.0.0-dev-20260827135706
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 +152 -1
- package/api-manifest.json +3620 -276
- package/dist/api/analysis/daylight.d.ts +603 -0
- package/dist/api/analysis/daylight.d.ts.map +1 -0
- package/dist/api/analysis/heatmaps.d.ts +658 -0
- package/dist/api/analysis/heatmaps.d.ts.map +1 -0
- package/dist/api/analysis/illuminance.d.ts +145 -0
- package/dist/api/analysis/illuminance.d.ts.map +1 -0
- package/dist/api/analysis/index.d.ts +59 -0
- package/dist/api/analysis/index.d.ts.map +1 -0
- package/dist/api/analysis/shadows.d.ts +165 -0
- package/dist/api/analysis/shadows.d.ts.map +1 -0
- package/dist/api/analysis/solar.d.ts +249 -0
- package/dist/api/analysis/solar.d.ts.map +1 -0
- package/dist/api/analysis/sunlightHours.d.ts +208 -0
- package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
- package/dist/api/analysis/sunpath.d.ts +80 -0
- package/dist/api/analysis/sunpath.d.ts.map +1 -0
- package/dist/api/analysis/weather.d.ts +193 -0
- package/dist/api/analysis/weather.d.ts.map +1 -0
- package/dist/api/core/camera/index.d.ts +261 -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 +840 -14
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- 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 +130 -18
- package/dist/api/core/geom/query/brep.d.ts.map +1 -1
- 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 +34 -0
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/export/index.d.ts +134 -0
- package/dist/api/core/io/export/index.d.ts.map +1 -0
- package/dist/api/core/io/import/index.d.ts +453 -0
- package/dist/api/core/io/import/index.d.ts.map +1 -0
- package/dist/api/core/io/index.d.ts +40 -0
- package/dist/api/core/io/index.d.ts.map +1 -0
- package/dist/api/core/io/job/index.d.ts +139 -0
- package/dist/api/core/io/job/index.d.ts.map +1 -0
- package/dist/api/core/io/query/index.d.ts +74 -0
- package/dist/api/core/io/query/index.d.ts.map +1 -0
- package/dist/api/core/io/terrain/index.d.ts +341 -0
- package/dist/api/core/io/terrain/index.d.ts.map +1 -0
- package/dist/api/core/io/underlay/index.d.ts +805 -0
- package/dist/api/core/io/underlay/index.d.ts.map +1 -0
- package/dist/api/core/layers.d.ts +7 -7
- package/dist/api/core/mode/index.d.ts +99 -0
- package/dist/api/core/mode/index.d.ts.map +1 -0
- package/dist/api/core/project/index.d.ts +68 -1
- package/dist/api/core/project/index.d.ts.map +1 -1
- package/dist/api/core/proposals/index.d.ts +531 -0
- package/dist/api/core/proposals/index.d.ts.map +1 -0
- package/dist/api/core/storeys/index.d.ts +265 -0
- package/dist/api/core/storeys/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +24 -0
- package/dist/api/core/tags.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/core/zoom/index.d.ts +4 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/boolean/index.d.ts +4 -4
- package/dist/api/design/create/index.d.ts +568 -45
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +3 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +195 -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/family.d.ts +349 -0
- package/dist/api/design/family.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +181 -8
- package/dist/api/design/furniture/index.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +98 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/lock.d.ts +26 -0
- package/dist/api/design/lock.d.ts.map +1 -1
- package/dist/api/design/materials/index.d.ts +270 -16
- package/dist/api/design/materials/index.d.ts.map +1 -1
- package/dist/api/design/query/geometry/index.d.ts +112 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +282 -11
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/referenceLines.d.ts +45 -0
- package/dist/api/design/query/referenceLines.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +181 -8
- package/dist/api/design/query/spaces.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +144 -0
- package/dist/api/design/selection/index.d.ts.map +1 -1
- package/dist/api/design/transform/index.d.ts +172 -10
- 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 +553 -2
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/visibility.d.ts +126 -0
- package/dist/api/design/visibility.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +113 -2
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/entity/buildableEnvelope.d.ts +4 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +10 -2
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +21 -21
- package/dist/api/entity/story.d.ts +242 -15
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +25 -25
- package/dist/api/presentation/annotate.d.ts +467 -0
- package/dist/api/presentation/annotate.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +111 -8
- package/dist/api/presentation/diagrams.d.ts.map +1 -1
- package/dist/api/presentation/export.d.ts +108 -0
- package/dist/api/presentation/export.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +55 -4
- package/dist/api/presentation/import.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +58 -1
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +1139 -0
- package/dist/api/presentation/placedViews.d.ts.map +1 -0
- package/dist/api/presentation/shapes.d.ts +481 -0
- package/dist/api/presentation/shapes.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +452 -13
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/slideshow.d.ts +125 -0
- package/dist/api/presentation/slideshow.d.ts.map +1 -0
- package/dist/api/presentation/tables.d.ts +81 -0
- package/dist/api/presentation/tables.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +367 -7
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/program/areas.d.ts +102 -12
- 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 +7 -15
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/layout.d.ts +346 -11
- package/dist/api/program/layout.d.ts.map +1 -1
- package/dist/api/program/site.d.ts +469 -13
- package/dist/api/program/site.d.ts.map +1 -1
- package/dist/api/program/spreadsheet.d.ts +365 -41
- package/dist/api/program/spreadsheet.d.ts.map +1 -1
- package/dist/api/workspace/index.d.ts +505 -0
- package/dist/api/workspace/index.d.ts.map +1 -0
- package/dist/errors/codes.d.ts +34 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/envelope.d.ts +56 -0
- package/dist/errors/envelope.d.ts.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/plugin-error.d.ts +69 -0
- package/dist/errors/plugin-error.d.ts.map +1 -0
- package/dist/handles.d.ts +97 -25
- package/dist/handles.d.ts.map +1 -1
- package/dist/host-utils.d.ts +4 -0
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4582 -1422
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4171 -1411
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/scripts/generate-manifest.mjs +45 -0
- package/scripts/generate-manifest.test.mjs +103 -4
- package/src/api/analysis/daylight.ts +470 -0
- package/src/api/analysis/heatmaps.ts +683 -0
- package/src/api/analysis/illuminance.ts +155 -0
- package/src/api/analysis/index.ts +61 -0
- package/src/api/analysis/shadows.ts +183 -0
- package/src/api/analysis/solar.ts +237 -0
- package/src/api/analysis/sunlightHours.ts +211 -0
- package/src/api/analysis/sunpath.ts +83 -0
- package/src/api/analysis/weather.ts +179 -0
- package/src/api/core/camera/index.ts +268 -0
- package/src/api/core/comment/index.ts +120 -2
- package/src/api/core/geom/create/index.ts +912 -1
- package/src/api/core/geom/delete/index.ts +6 -0
- package/src/api/core/geom/query/brep.ts +119 -0
- package/src/api/core/handles/index.ts +233 -0
- package/src/api/core/index.ts +34 -0
- package/src/api/core/io/export/index.ts +126 -0
- package/src/api/core/io/import/index.ts +496 -0
- package/src/api/core/io/index.ts +42 -0
- package/src/api/core/io/job/index.ts +140 -0
- package/src/api/core/io/query/index.ts +71 -0
- package/src/api/core/io/terrain/index.ts +360 -0
- package/src/api/core/io/underlay/index.ts +705 -0
- package/src/api/core/mode/index.ts +96 -0
- package/src/api/core/project/index.ts +62 -1
- package/src/api/core/proposals/index.ts +569 -0
- package/src/api/core/storeys/index.ts +294 -0
- package/src/api/core/tags.ts +27 -0
- package/src/api/core/user.ts +46 -0
- package/src/api/core/zoom/index.ts +4 -0
- package/src/api/design/create/index.ts +670 -30
- package/src/api/design/delete/index.ts +3 -0
- package/src/api/design/doors/index.ts +208 -0
- package/src/api/design/erase/index.ts +1 -1
- package/src/api/design/family.ts +388 -0
- package/src/api/design/furniture/index.ts +197 -8
- package/src/api/design/index.ts +102 -0
- package/src/api/design/lock.ts +27 -0
- package/src/api/design/materials/index.ts +334 -27
- package/src/api/design/query/geometry/index.ts +125 -3
- package/src/api/design/query/index.ts +217 -7
- package/src/api/design/query/referenceLines.ts +52 -0
- package/src/api/design/query/spaces.ts +143 -0
- package/src/api/design/selection/index.ts +129 -0
- package/src/api/design/transform/index.ts +170 -9
- package/src/api/design/types/index.ts +156 -0
- package/src/api/design/update/index.ts +631 -3
- package/src/api/design/visibility.ts +143 -0
- package/src/api/design/windows/index.ts +128 -2
- package/src/api/entity/buildableEnvelope.ts +4 -0
- package/src/api/entity/referenceLine.ts +8 -0
- package/src/api/entity/story.ts +259 -15
- package/src/api/index.ts +10 -0
- package/src/api/presentation/annotate.ts +385 -0
- package/src/api/presentation/diagrams.ts +118 -8
- package/src/api/presentation/export.ts +108 -0
- package/src/api/presentation/import.ts +51 -4
- package/src/api/presentation/index.ts +66 -1
- package/src/api/presentation/placedViews.ts +1120 -0
- package/src/api/presentation/shapes.ts +274 -0
- package/src/api/presentation/sheets.ts +400 -13
- package/src/api/presentation/slideshow.ts +134 -0
- package/src/api/presentation/tables.ts +84 -0
- package/src/api/presentation/views.ts +376 -8
- package/src/api/program/areas.ts +88 -15
- package/src/api/program/cores.ts +3 -91
- package/src/api/program/index.ts +7 -15
- package/src/api/program/layout.ts +365 -11
- package/src/api/program/site.ts +435 -13
- package/src/api/program/spreadsheet.ts +376 -35
- package/src/api/workspace/index.ts +563 -0
- package/src/errors/codes.ts +136 -0
- package/src/errors/envelope.ts +75 -0
- package/src/errors/index.ts +21 -0
- package/src/errors/plugin-error.ts +134 -0
- package/src/handles.ts +123 -13
- package/src/host-utils.ts +4 -0
- package/src/index.ts +1 -0
- package/test/errors.test.mjs +184 -0
- package/tsconfig.json +7 -2
|
@@ -8,8 +8,11 @@ import { PluginApiReturn } from "../../types"
|
|
|
8
8
|
* These methods require **Present mode to be open** (the documentation editor) —
|
|
9
9
|
* reads return `[]`/`null` and writes throw when it is not.
|
|
10
10
|
*
|
|
11
|
-
* `list`/`get` are reads;
|
|
12
|
-
*
|
|
11
|
+
* `list`/`get` are reads; the rest mutate and require Present mode to be open:
|
|
12
|
+
* `create` adds a sheet, `place` drops a saved view onto a sheet as a live
|
|
13
|
+
* linked view shape, `rename` relabels a sheet, `delete` removes one, `reorder`
|
|
14
|
+
* moves one in the sheet order, `setActive` navigates to one, and
|
|
15
|
+
* `updatePlacedView` re-renders placed views to the current model.
|
|
13
16
|
*
|
|
14
17
|
* Accessed via `snaptrude.presentation.sheets`.
|
|
15
18
|
*/
|
|
@@ -56,56 +59,321 @@ export abstract class PluginPresentationSheetsApi {
|
|
|
56
59
|
/**
|
|
57
60
|
* Create a new layout sheet.
|
|
58
61
|
*
|
|
62
|
+
* Optionally sets the paper size and orientation — the same presets as the
|
|
63
|
+
* sheet header's size dropdown (ANSI A–E, Arch A–E1, ISO A4–A0). When `size`
|
|
64
|
+
* is omitted the sheet inherits the editor session's last-used size
|
|
65
|
+
* (initially ANSI B) in landscape, so pass `size` explicitly whenever the
|
|
66
|
+
* output format matters.
|
|
67
|
+
*
|
|
59
68
|
* Requires Present mode to be open.
|
|
60
69
|
*
|
|
61
70
|
* @param name - Display name for the new sheet (optional).
|
|
71
|
+
* @param options - Optional `size` ({@linkcode PluginSheetSize} paper preset)
|
|
72
|
+
* and `orientation` ({@linkcode PluginSheetOrientation}; `"landscape"` when
|
|
73
|
+
* omitted).
|
|
62
74
|
* @returns The newly created {@linkcode PluginPresentationSheet}.
|
|
63
75
|
* @throws If Present mode is not open.
|
|
64
76
|
*
|
|
65
77
|
* @examplePrompt Create a new sheet called Cover
|
|
66
|
-
* @examplePrompt Add
|
|
67
|
-
* @examplePrompt Make a new presentation sheet named Floor Plans
|
|
78
|
+
* @examplePrompt Add an A3 landscape layout sheet
|
|
79
|
+
* @examplePrompt Make a new ANSI D presentation sheet named Floor Plans
|
|
80
|
+
* @examplePrompt Create a portrait A4 sheet
|
|
68
81
|
*
|
|
69
82
|
* # Example
|
|
70
83
|
* ```ts
|
|
71
|
-
* const sheet = await snaptrude.presentation.sheets.create("Cover"
|
|
84
|
+
* const sheet = await snaptrude.presentation.sheets.create("Cover", {
|
|
85
|
+
* size: "ISO_A3",
|
|
86
|
+
* orientation: "landscape",
|
|
87
|
+
* })
|
|
72
88
|
* ```
|
|
73
89
|
*/
|
|
74
90
|
public abstract create(
|
|
75
91
|
name?: string,
|
|
92
|
+
options?: { size?: PluginSheetSize; orientation?: PluginSheetOrientation },
|
|
93
|
+
): PluginApiReturn<PluginPresentationSheet>
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Set a sheet's paper size and/or orientation.
|
|
97
|
+
*
|
|
98
|
+
* Applies one of the standard paper presets — exactly what the sheet header's
|
|
99
|
+
* size dropdown and orientation toggle do. Content that no longer fits inside
|
|
100
|
+
* the resized sheet is moved out onto the canvas (matching the native
|
|
101
|
+
* behavior). Undoable. Does not change the user's remembered default size for
|
|
102
|
+
* new sheets.
|
|
103
|
+
*
|
|
104
|
+
* Requires Present mode to be open.
|
|
105
|
+
*
|
|
106
|
+
* @param sheetId - The id of the sheet to resize.
|
|
107
|
+
* @param size - The paper preset ({@linkcode PluginSheetSize}).
|
|
108
|
+
* @param orientation - Optional {@linkcode PluginSheetOrientation}; keeps the
|
|
109
|
+
* sheet's current orientation when omitted.
|
|
110
|
+
* @returns The updated {@linkcode PluginPresentationSheet}.
|
|
111
|
+
* @throws If Present mode is not open, or the sheet id is invalid.
|
|
112
|
+
*
|
|
113
|
+
* @examplePrompt Resize sheet_1 to A1
|
|
114
|
+
* @examplePrompt Make the cover sheet ANSI B portrait
|
|
115
|
+
* @examplePrompt Change this sheet to Arch D landscape
|
|
116
|
+
* @examplePrompt Set the sheet size to A3
|
|
117
|
+
*
|
|
118
|
+
* # Example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const sheet = await snaptrude.presentation.sheets.setSize("sheet_1", "ISO_A1", "portrait")
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
public abstract setSize(
|
|
124
|
+
sheetId: string,
|
|
125
|
+
size: PluginSheetSize,
|
|
126
|
+
orientation?: PluginSheetOrientation,
|
|
127
|
+
): PluginApiReturn<PluginPresentationSheet>
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Set a sheet's print margin.
|
|
131
|
+
*
|
|
132
|
+
* Applies one of the canonical margin presets — exactly what the sheet
|
|
133
|
+
* header's margin dropdown does. `margin` is unit-agnostic: `0 | 0.25 |
|
|
134
|
+
* 0.5 | 0.75 | 1`, displayed as None / 1/4″ / 1/2″ / 3/4″ / 1″ on imperial
|
|
135
|
+
* projects and None / 5mm / 10mm / 15mm / 20mm on metric ones. One undo
|
|
136
|
+
* step. Requires Present mode to be open.
|
|
137
|
+
*
|
|
138
|
+
* @param sheetId - The id of the sheet.
|
|
139
|
+
* @param margin - The margin preset ({@linkcode PluginSheetMargin}).
|
|
140
|
+
* @returns The updated {@linkcode PluginPresentationSheet}.
|
|
141
|
+
* @throws If Present mode is not open, or the sheet id is invalid.
|
|
142
|
+
*
|
|
143
|
+
* @examplePrompt Set the sheet margin to half an inch
|
|
144
|
+
* @examplePrompt Remove the margins on sheet_1
|
|
145
|
+
* @examplePrompt Give the cover sheet a 10mm margin
|
|
146
|
+
*
|
|
147
|
+
* # Example
|
|
148
|
+
* ```ts
|
|
149
|
+
* const sheet = await snaptrude.presentation.sheets.setMargin("sheet_1", 0.5)
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
public abstract setMargin(
|
|
153
|
+
sheetId: string,
|
|
154
|
+
margin: PluginSheetMargin,
|
|
76
155
|
): PluginApiReturn<PluginPresentationSheet>
|
|
77
156
|
|
|
78
157
|
/**
|
|
79
158
|
* Place a saved view onto a sheet.
|
|
80
159
|
*
|
|
81
|
-
* Drops the given view onto the sheet
|
|
82
|
-
*
|
|
160
|
+
* Drops the given view onto the sheet through the **native view drop** — the
|
|
161
|
+
* placed shape is a live linked view (the same shape the Present views panel's
|
|
162
|
+
* drag-drop creates), re-rendered from the current model, so
|
|
163
|
+
* {@linkcode PluginPresentationSheetsApi.updatePlacedView} refreshes it later.
|
|
164
|
+
* 2D and site-plan views are placed at an architectural scale: the closest
|
|
165
|
+
* standard scale by default (the native auto-fit), or the explicit `scale`
|
|
166
|
+
* when given — one of the standard values the placed view's Scale dropdown
|
|
167
|
+
* offers for the project's unit system (metric `10, 20, 50, 100, 150, 200,
|
|
168
|
+
* 250, 500, 1000`; imperial e.g. `48` for 1/4″ = 1′, `96` for 1/8″ = 1′,
|
|
169
|
+
* `120` for 1″ = 10′). 3D views have no scale — passing `scale` for one
|
|
170
|
+
* throws. Requires Present mode to be open.
|
|
83
171
|
*
|
|
84
172
|
* @param sheetId - The id of the sheet to place onto.
|
|
85
173
|
* @param viewId - The id of the saved view to place.
|
|
86
174
|
* @param options - Optional `position` ({@linkcode PluginSheetPosition}) —
|
|
87
|
-
* where to place it (
|
|
175
|
+
* where to place it (sheet centre when omitted) — and `scale` — a standard
|
|
176
|
+
* scale value for the project's unit system (2D/site-plan views only;
|
|
177
|
+
* auto-fit when omitted).
|
|
88
178
|
* @returns A {@linkcode PluginPresentationSheetsPlaceResult} with the created
|
|
89
179
|
* `shapeId`.
|
|
90
|
-
* @throws If Present mode is not open,
|
|
180
|
+
* @throws If Present mode is not open, the sheet/view id is invalid, `scale`
|
|
181
|
+
* is not a standard value for the project's unit system, or `scale` is
|
|
182
|
+
* passed for a 3D view.
|
|
91
183
|
*
|
|
92
184
|
* @examplePrompt Place the floor plan on Sheet 1
|
|
93
185
|
* @examplePrompt Add this 3D view to the cover sheet
|
|
94
186
|
* @examplePrompt Drop the site plan onto the layout sheet at 100, 200
|
|
95
|
-
* @examplePrompt Put the Ground Floor view on sheet_1
|
|
187
|
+
* @examplePrompt Put the Ground Floor view on sheet_1 at 1:100 scale
|
|
188
|
+
* @examplePrompt Place the plan on the cover sheet at quarter-inch scale
|
|
96
189
|
*
|
|
97
190
|
* # Example
|
|
98
191
|
* ```ts
|
|
99
|
-
* const { shapeId } = await snaptrude.presentation.sheets.place("sheet_1", "view_123"
|
|
192
|
+
* const { shapeId } = await snaptrude.presentation.sheets.place("sheet_1", "view_123", {
|
|
193
|
+
* scale: 100, // 1:100 (metric project)
|
|
194
|
+
* })
|
|
100
195
|
* ```
|
|
101
196
|
*/
|
|
102
197
|
public abstract place(
|
|
103
198
|
sheetId: string,
|
|
104
199
|
viewId: string,
|
|
105
|
-
options?: { position?: PluginSheetPosition },
|
|
200
|
+
options?: { position?: PluginSheetPosition; scale?: number },
|
|
106
201
|
): PluginApiReturn<PluginPresentationSheetsPlaceResult>
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Rename a layout sheet.
|
|
205
|
+
*
|
|
206
|
+
* Sets the sheet's display name — the same label the sheets panel shows and
|
|
207
|
+
* that `list`/`get` read back. Requires Present mode to be open.
|
|
208
|
+
*
|
|
209
|
+
* @param sheetId - The id of the sheet to rename.
|
|
210
|
+
* @param name - The new display name (non-empty after trimming).
|
|
211
|
+
* @returns The updated {@linkcode PluginPresentationSheet}.
|
|
212
|
+
* @throws If Present mode is not open, or the sheet id is invalid.
|
|
213
|
+
*
|
|
214
|
+
* @examplePrompt Rename sheet_1 to Cover
|
|
215
|
+
* @examplePrompt Call the first sheet Ground Floor
|
|
216
|
+
* @examplePrompt Change this sheet's name to Site Plan
|
|
217
|
+
*
|
|
218
|
+
* # Example
|
|
219
|
+
* ```ts
|
|
220
|
+
* const sheet = await snaptrude.presentation.sheets.rename("sheet_1", "Cover")
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
public abstract rename(
|
|
224
|
+
sheetId: string,
|
|
225
|
+
name: string,
|
|
226
|
+
): PluginApiReturn<PluginPresentationSheet>
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Delete a layout sheet.
|
|
230
|
+
*
|
|
231
|
+
* Removes the sheet (and its placed content) from the presentation and
|
|
232
|
+
* renumbers the remaining sheets. Requires Present mode to be open. Auto-diagram
|
|
233
|
+
* sheets cannot be deleted through the API — remove those from the Present UI.
|
|
234
|
+
*
|
|
235
|
+
* @param sheetId - The id of the sheet to delete.
|
|
236
|
+
* @returns The id of the deleted sheet
|
|
237
|
+
* (a {@linkcode PluginPresentationSheetsDeleteResult}).
|
|
238
|
+
* @throws If Present mode is not open, the sheet id is invalid, or the sheet is
|
|
239
|
+
* an auto-diagram sheet.
|
|
240
|
+
*
|
|
241
|
+
* @examplePrompt Delete sheet_2
|
|
242
|
+
* @examplePrompt Remove the Cover sheet
|
|
243
|
+
* @examplePrompt Get rid of the last layout sheet
|
|
244
|
+
*
|
|
245
|
+
* # Example
|
|
246
|
+
* ```ts
|
|
247
|
+
* const { id } = await snaptrude.presentation.sheets.delete("sheet_2")
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
public abstract delete(
|
|
251
|
+
sheetId: string,
|
|
252
|
+
): PluginApiReturn<PluginPresentationSheetsDeleteResult>
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Move a sheet to a new position in the sheet order.
|
|
256
|
+
*
|
|
257
|
+
* Reorders the sheet to the given zero-based `index` (as the sheets panel does
|
|
258
|
+
* when a sheet is dragged) and renumbers the rest. `index` is clamped to the
|
|
259
|
+
* valid range. Requires Present mode to be open.
|
|
260
|
+
*
|
|
261
|
+
* @param sheetId - The id of the sheet to move.
|
|
262
|
+
* @param index - Zero-based target position in the sheet order.
|
|
263
|
+
* @returns The sheets in their new order
|
|
264
|
+
* (a {@linkcode PluginPresentationSheetsListResult}).
|
|
265
|
+
* @throws If Present mode is not open, or the sheet id is invalid.
|
|
266
|
+
*
|
|
267
|
+
* @examplePrompt Move sheet_3 to the front
|
|
268
|
+
* @examplePrompt Make the Cover sheet the first sheet
|
|
269
|
+
* @examplePrompt Reorder this sheet to position 2
|
|
270
|
+
*
|
|
271
|
+
* # Example
|
|
272
|
+
* ```ts
|
|
273
|
+
* const { sheets } = await snaptrude.presentation.sheets.reorder("sheet_3", 0)
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
public abstract reorder(
|
|
277
|
+
sheetId: string,
|
|
278
|
+
index: number,
|
|
279
|
+
): PluginApiReturn<PluginPresentationSheetsListResult>
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Make a sheet the active sheet.
|
|
283
|
+
*
|
|
284
|
+
* Selects the sheet in the sheets panel and navigates the Present canvas to it
|
|
285
|
+
* (the same as clicking it in the panel). Requires Present mode to be open.
|
|
286
|
+
*
|
|
287
|
+
* @param sheetId - The id of the sheet to activate.
|
|
288
|
+
* @returns The now-active {@linkcode PluginPresentationSheet}.
|
|
289
|
+
* @throws If Present mode is not open, or the sheet id is invalid.
|
|
290
|
+
*
|
|
291
|
+
* @examplePrompt Go to sheet_1
|
|
292
|
+
* @examplePrompt Open the Cover sheet
|
|
293
|
+
* @examplePrompt Switch to the Site Plan sheet
|
|
294
|
+
*
|
|
295
|
+
* # Example
|
|
296
|
+
* ```ts
|
|
297
|
+
* await snaptrude.presentation.sheets.setActive("sheet_1")
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
public abstract setActive(
|
|
301
|
+
sheetId: string,
|
|
302
|
+
): PluginApiReturn<PluginPresentationSheet>
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Refresh placed views to the current model state.
|
|
306
|
+
*
|
|
307
|
+
* Re-renders the presentation's placed **views** — the live linked view shapes —
|
|
308
|
+
* from the current model (the "Update views" action). Views placed with
|
|
309
|
+
* {@linkcode PluginPresentationSheetsApi.place} are live view shapes too, so
|
|
310
|
+
* they refresh along with panel-dropped ones. Pass `sheetId` to refresh only
|
|
311
|
+
* the views on that sheet, or omit it to refresh every placed view. Requires
|
|
312
|
+
* Present mode to be open.
|
|
313
|
+
*
|
|
314
|
+
* @param options - Optional `sheetId` — restrict the refresh to one sheet's
|
|
315
|
+
* placed views (all placed views when omitted).
|
|
316
|
+
* @returns The ids of the placed view shapes submitted for refresh
|
|
317
|
+
* (a {@linkcode PluginPresentationSheetsUpdatePlacedViewResult}).
|
|
318
|
+
* @throws If Present mode is not open, or `sheetId` is given but invalid.
|
|
319
|
+
*
|
|
320
|
+
* @examplePrompt Update all the placed views to the latest model
|
|
321
|
+
* @examplePrompt Refresh the views on sheet_1
|
|
322
|
+
* @examplePrompt Re-render the placed views after my edits
|
|
323
|
+
*
|
|
324
|
+
* # Example
|
|
325
|
+
* ```ts
|
|
326
|
+
* const { shapeIds } = await snaptrude.presentation.sheets.updatePlacedView()
|
|
327
|
+
* ```
|
|
328
|
+
*/
|
|
329
|
+
public abstract updatePlacedView(options?: {
|
|
330
|
+
sheetId?: string
|
|
331
|
+
}): PluginApiReturn<PluginPresentationSheetsUpdatePlacedViewResult>
|
|
107
332
|
}
|
|
108
333
|
|
|
334
|
+
/**
|
|
335
|
+
* Standard paper-size presets for layout sheets — identical to the sheet
|
|
336
|
+
* header's size dropdown in Present mode.
|
|
337
|
+
*/
|
|
338
|
+
export const PluginSheetSize = z.enum([
|
|
339
|
+
"ANSI_A",
|
|
340
|
+
"ANSI_B",
|
|
341
|
+
"ANSI_C",
|
|
342
|
+
"ANSI_D",
|
|
343
|
+
"ANSI_E",
|
|
344
|
+
"ARCH_A",
|
|
345
|
+
"ARCH_B",
|
|
346
|
+
"ARCH_C",
|
|
347
|
+
"ARCH_D",
|
|
348
|
+
"ARCH_E",
|
|
349
|
+
"ARCH_E1",
|
|
350
|
+
"ISO_A4",
|
|
351
|
+
"ISO_A3",
|
|
352
|
+
"ISO_A2",
|
|
353
|
+
"ISO_A1",
|
|
354
|
+
"ISO_A0",
|
|
355
|
+
])
|
|
356
|
+
export type PluginSheetSize = z.infer<typeof PluginSheetSize>
|
|
357
|
+
|
|
358
|
+
/** Sheet orientation. */
|
|
359
|
+
export const PluginSheetOrientation = z.enum(["landscape", "portrait"])
|
|
360
|
+
export type PluginSheetOrientation = z.infer<typeof PluginSheetOrientation>
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Canonical sheet margin presets — unit-agnostic values matching the sheet
|
|
364
|
+
* header's margin dropdown: `0` (None), `0.25`, `0.5`, `0.75`, `1`.
|
|
365
|
+
* Displayed as None / 1/4″ / 1/2″ / 3/4″ / 1″ on imperial projects and
|
|
366
|
+
* None / 5mm / 10mm / 15mm / 20mm on metric ones.
|
|
367
|
+
*/
|
|
368
|
+
export const PluginSheetMargin = z.union([
|
|
369
|
+
z.literal(0),
|
|
370
|
+
z.literal(0.25),
|
|
371
|
+
z.literal(0.5),
|
|
372
|
+
z.literal(0.75),
|
|
373
|
+
z.literal(1),
|
|
374
|
+
])
|
|
375
|
+
export type PluginSheetMargin = z.infer<typeof PluginSheetMargin>
|
|
376
|
+
|
|
109
377
|
/**
|
|
110
378
|
* A layout sheet in the presentation.
|
|
111
379
|
*
|
|
@@ -113,10 +381,16 @@ export abstract class PluginPresentationSheetsApi {
|
|
|
113
381
|
* |---|---|---|
|
|
114
382
|
* | `id` | `string` | Unique sheet id |
|
|
115
383
|
* | `name` | `string` | Display name |
|
|
384
|
+
* | `size` | {@linkcode PluginSheetSize}` \| null` | Paper preset (`null` for a legacy sheet without one) |
|
|
385
|
+
* | `orientation` | {@linkcode PluginSheetOrientation}` \| null` | Orientation (`null` for a legacy sheet) |
|
|
386
|
+
* | `margin` | {@linkcode PluginSheetMargin}` \| null` | Margin preset (`null` when absent/unrecognized) |
|
|
116
387
|
*/
|
|
117
388
|
export const PluginPresentationSheet = z.object({
|
|
118
389
|
id: z.string(),
|
|
119
390
|
name: z.string(),
|
|
391
|
+
size: PluginSheetSize.nullable(),
|
|
392
|
+
orientation: PluginSheetOrientation.nullable(),
|
|
393
|
+
margin: PluginSheetMargin.nullable(),
|
|
120
394
|
})
|
|
121
395
|
export type PluginPresentationSheet = z.infer<typeof PluginPresentationSheet>
|
|
122
396
|
|
|
@@ -160,11 +434,32 @@ export type PluginPresentationSheetsGetResult = z.infer<
|
|
|
160
434
|
/** Arguments for {@linkcode PluginPresentationSheetsApi.create}. */
|
|
161
435
|
export const PluginPresentationSheetsCreateArgs = z.object({
|
|
162
436
|
name: z.string().optional(),
|
|
437
|
+
size: PluginSheetSize.optional(),
|
|
438
|
+
orientation: PluginSheetOrientation.optional(),
|
|
163
439
|
})
|
|
164
440
|
export type PluginPresentationSheetsCreateArgs = z.infer<
|
|
165
441
|
typeof PluginPresentationSheetsCreateArgs
|
|
166
442
|
>
|
|
167
443
|
|
|
444
|
+
/** Arguments for {@linkcode PluginPresentationSheetsApi.setSize}. */
|
|
445
|
+
export const PluginPresentationSheetsSetSizeArgs = z.object({
|
|
446
|
+
sheetId: z.string(),
|
|
447
|
+
size: PluginSheetSize,
|
|
448
|
+
orientation: PluginSheetOrientation.optional(),
|
|
449
|
+
})
|
|
450
|
+
export type PluginPresentationSheetsSetSizeArgs = z.infer<
|
|
451
|
+
typeof PluginPresentationSheetsSetSizeArgs
|
|
452
|
+
>
|
|
453
|
+
|
|
454
|
+
/** Arguments for {@linkcode PluginPresentationSheetsApi.setMargin}. */
|
|
455
|
+
export const PluginPresentationSheetsSetMarginArgs = z.object({
|
|
456
|
+
sheetId: z.string(),
|
|
457
|
+
margin: PluginSheetMargin,
|
|
458
|
+
})
|
|
459
|
+
export type PluginPresentationSheetsSetMarginArgs = z.infer<
|
|
460
|
+
typeof PluginPresentationSheetsSetMarginArgs
|
|
461
|
+
>
|
|
462
|
+
|
|
168
463
|
/**
|
|
169
464
|
* Arguments for {@linkcode PluginPresentationSheetsApi.place}.
|
|
170
465
|
*
|
|
@@ -172,12 +467,14 @@ export type PluginPresentationSheetsCreateArgs = z.infer<
|
|
|
172
467
|
* |---|---|---|
|
|
173
468
|
* | `sheetId` | `string` | The sheet to place onto |
|
|
174
469
|
* | `viewId` | `string` | The saved view to place |
|
|
175
|
-
* | `position` | {@linkcode PluginSheetPosition}` \| undefined` | Where to place it (
|
|
470
|
+
* | `position` | {@linkcode PluginSheetPosition}` \| undefined` | Where to place it (sheet centre when omitted) |
|
|
471
|
+
* | `scale` | `number \| undefined` | Standard scale value for the project's unit system (2D/site-plan views only; auto-fit to the closest standard scale when omitted) |
|
|
176
472
|
*/
|
|
177
473
|
export const PluginPresentationSheetsPlaceArgs = z.object({
|
|
178
474
|
sheetId: z.string(),
|
|
179
475
|
viewId: z.string(),
|
|
180
476
|
position: PluginSheetPosition.optional(),
|
|
477
|
+
scale: z.number().positive().optional(),
|
|
181
478
|
})
|
|
182
479
|
export type PluginPresentationSheetsPlaceArgs = z.infer<
|
|
183
480
|
typeof PluginPresentationSheetsPlaceArgs
|
|
@@ -196,3 +493,93 @@ export const PluginPresentationSheetsPlaceResult = z.object({
|
|
|
196
493
|
export type PluginPresentationSheetsPlaceResult = z.infer<
|
|
197
494
|
typeof PluginPresentationSheetsPlaceResult
|
|
198
495
|
>
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Arguments for {@linkcode PluginPresentationSheetsApi.rename}.
|
|
499
|
+
*
|
|
500
|
+
* | Property | Type | Description |
|
|
501
|
+
* |---|---|---|
|
|
502
|
+
* | `sheetId` | `string` | The sheet to rename |
|
|
503
|
+
* | `name` | `string` | New display name (non-empty after trimming) |
|
|
504
|
+
*/
|
|
505
|
+
export const PluginPresentationSheetsRenameArgs = z.object({
|
|
506
|
+
sheetId: z.string(),
|
|
507
|
+
name: z.string().trim().min(1),
|
|
508
|
+
})
|
|
509
|
+
export type PluginPresentationSheetsRenameArgs = z.infer<
|
|
510
|
+
typeof PluginPresentationSheetsRenameArgs
|
|
511
|
+
>
|
|
512
|
+
|
|
513
|
+
/** Arguments for {@linkcode PluginPresentationSheetsApi.delete}. */
|
|
514
|
+
export const PluginPresentationSheetsDeleteArgs = z.object({
|
|
515
|
+
sheetId: z.string(),
|
|
516
|
+
})
|
|
517
|
+
export type PluginPresentationSheetsDeleteArgs = z.infer<
|
|
518
|
+
typeof PluginPresentationSheetsDeleteArgs
|
|
519
|
+
>
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Result of {@linkcode PluginPresentationSheetsApi.delete}.
|
|
523
|
+
*
|
|
524
|
+
* | Property | Type | Description |
|
|
525
|
+
* |---|---|---|
|
|
526
|
+
* | `id` | `string` | Id of the deleted sheet |
|
|
527
|
+
*/
|
|
528
|
+
export const PluginPresentationSheetsDeleteResult = z.object({
|
|
529
|
+
id: z.string(),
|
|
530
|
+
})
|
|
531
|
+
export type PluginPresentationSheetsDeleteResult = z.infer<
|
|
532
|
+
typeof PluginPresentationSheetsDeleteResult
|
|
533
|
+
>
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Arguments for {@linkcode PluginPresentationSheetsApi.reorder}.
|
|
537
|
+
*
|
|
538
|
+
* | Property | Type | Description |
|
|
539
|
+
* |---|---|---|
|
|
540
|
+
* | `sheetId` | `string` | The sheet to move |
|
|
541
|
+
* | `index` | `number` | Zero-based target position (clamped to range) |
|
|
542
|
+
*/
|
|
543
|
+
export const PluginPresentationSheetsReorderArgs = z.object({
|
|
544
|
+
sheetId: z.string(),
|
|
545
|
+
index: z.number().int().min(0),
|
|
546
|
+
})
|
|
547
|
+
export type PluginPresentationSheetsReorderArgs = z.infer<
|
|
548
|
+
typeof PluginPresentationSheetsReorderArgs
|
|
549
|
+
>
|
|
550
|
+
|
|
551
|
+
/** Arguments for {@linkcode PluginPresentationSheetsApi.setActive}. */
|
|
552
|
+
export const PluginPresentationSheetsSetActiveArgs = z.object({
|
|
553
|
+
sheetId: z.string(),
|
|
554
|
+
})
|
|
555
|
+
export type PluginPresentationSheetsSetActiveArgs = z.infer<
|
|
556
|
+
typeof PluginPresentationSheetsSetActiveArgs
|
|
557
|
+
>
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Arguments for {@linkcode PluginPresentationSheetsApi.updatePlacedView}.
|
|
561
|
+
*
|
|
562
|
+
* | Property | Type | Description |
|
|
563
|
+
* |---|---|---|
|
|
564
|
+
* | `sheetId` | `string`? | Restrict the refresh to one sheet's placed views |
|
|
565
|
+
*/
|
|
566
|
+
export const PluginPresentationSheetsUpdatePlacedViewArgs = z.object({
|
|
567
|
+
sheetId: z.string().optional(),
|
|
568
|
+
})
|
|
569
|
+
export type PluginPresentationSheetsUpdatePlacedViewArgs = z.infer<
|
|
570
|
+
typeof PluginPresentationSheetsUpdatePlacedViewArgs
|
|
571
|
+
>
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Result of {@linkcode PluginPresentationSheetsApi.updatePlacedView}.
|
|
575
|
+
*
|
|
576
|
+
* | Property | Type | Description |
|
|
577
|
+
* |---|---|---|
|
|
578
|
+
* | `shapeIds` | `string[]` | Ids of the placed view shapes submitted for refresh |
|
|
579
|
+
*/
|
|
580
|
+
export const PluginPresentationSheetsUpdatePlacedViewResult = z.object({
|
|
581
|
+
shapeIds: z.array(z.string()),
|
|
582
|
+
})
|
|
583
|
+
export type PluginPresentationSheetsUpdatePlacedViewResult = z.infer<
|
|
584
|
+
typeof PluginPresentationSheetsUpdatePlacedViewResult
|
|
585
|
+
>
|
|
@@ -0,0 +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
|
+
>
|