@snaptrude/plugin-core 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/api-manifest.full.json +1350 -89
  3. package/api-manifest.json +826 -40
  4. package/dist/api/analysis/daylight.d.ts +603 -0
  5. package/dist/api/analysis/daylight.d.ts.map +1 -0
  6. package/dist/api/analysis/heatmaps.d.ts +438 -14
  7. package/dist/api/analysis/heatmaps.d.ts.map +1 -1
  8. package/dist/api/analysis/index.d.ts +15 -0
  9. package/dist/api/analysis/index.d.ts.map +1 -1
  10. package/dist/api/analysis/solar.d.ts +249 -0
  11. package/dist/api/analysis/solar.d.ts.map +1 -0
  12. package/dist/api/analysis/weather.d.ts +193 -0
  13. package/dist/api/analysis/weather.d.ts.map +1 -0
  14. package/dist/api/core/camera/index.d.ts +37 -0
  15. package/dist/api/core/camera/index.d.ts.map +1 -1
  16. package/dist/api/core/geom/create/index.d.ts +318 -1
  17. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  18. package/dist/api/core/index.d.ts +9 -0
  19. package/dist/api/core/index.d.ts.map +1 -1
  20. package/dist/api/core/io/export/index.d.ts +3 -1
  21. package/dist/api/core/io/export/index.d.ts.map +1 -1
  22. package/dist/api/core/io/import/index.d.ts +61 -0
  23. package/dist/api/core/io/import/index.d.ts.map +1 -1
  24. package/dist/api/core/mode/index.d.ts +99 -0
  25. package/dist/api/core/mode/index.d.ts.map +1 -0
  26. package/dist/api/core/storeys/index.d.ts +251 -0
  27. package/dist/api/core/storeys/index.d.ts.map +1 -0
  28. package/dist/api/core/tags.d.ts +24 -0
  29. package/dist/api/core/tags.d.ts.map +1 -1
  30. package/dist/api/core/zoom/index.d.ts +4 -0
  31. package/dist/api/core/zoom/index.d.ts.map +1 -1
  32. package/dist/api/design/create/index.d.ts +115 -4
  33. package/dist/api/design/create/index.d.ts.map +1 -1
  34. package/dist/api/design/delete/index.d.ts +3 -0
  35. package/dist/api/design/delete/index.d.ts.map +1 -1
  36. package/dist/api/design/query/geometry/index.d.ts +112 -0
  37. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  38. package/dist/api/design/query/index.d.ts +4 -0
  39. package/dist/api/design/query/index.d.ts.map +1 -1
  40. package/dist/api/design/query/referenceLines.d.ts +45 -0
  41. package/dist/api/design/query/referenceLines.d.ts.map +1 -0
  42. package/dist/api/design/query/spaces.d.ts +173 -0
  43. package/dist/api/design/query/spaces.d.ts.map +1 -1
  44. package/dist/api/design/transform/index.d.ts +12 -0
  45. package/dist/api/design/transform/index.d.ts.map +1 -1
  46. package/dist/api/design/update/index.d.ts +51 -1
  47. package/dist/api/design/update/index.d.ts.map +1 -1
  48. package/dist/api/entity/buildableEnvelope.d.ts +4 -0
  49. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  50. package/dist/api/entity/referenceLine.d.ts +8 -0
  51. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  52. package/dist/api/entity/story.d.ts +20 -0
  53. package/dist/api/entity/story.d.ts.map +1 -1
  54. package/dist/api/index.d.ts +5 -0
  55. package/dist/api/index.d.ts.map +1 -1
  56. package/dist/api/presentation/export.d.ts +4 -0
  57. package/dist/api/presentation/export.d.ts.map +1 -1
  58. package/dist/api/presentation/import.d.ts +6 -0
  59. package/dist/api/presentation/import.d.ts.map +1 -1
  60. package/dist/api/presentation/index.d.ts +9 -0
  61. package/dist/api/presentation/index.d.ts.map +1 -1
  62. package/dist/api/presentation/placedViews.d.ts +370 -0
  63. package/dist/api/presentation/placedViews.d.ts.map +1 -0
  64. package/dist/api/presentation/shapes.d.ts +481 -0
  65. package/dist/api/presentation/shapes.d.ts.map +1 -0
  66. package/dist/api/program/site.d.ts +94 -0
  67. package/dist/api/program/site.d.ts.map +1 -1
  68. package/dist/api/program/spreadsheet.d.ts +260 -28
  69. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  70. package/dist/api/workspace/index.d.ts +460 -0
  71. package/dist/api/workspace/index.d.ts.map +1 -0
  72. package/dist/index.cjs +2625 -1758
  73. package/dist/index.cjs.map +1 -1
  74. package/dist/index.js +2515 -1758
  75. package/dist/index.js.map +1 -1
  76. package/package.json +3 -2
  77. package/scripts/generate-manifest.mjs +45 -0
  78. package/src/api/analysis/daylight.ts +470 -0
  79. package/src/api/analysis/heatmaps.ts +444 -17
  80. package/src/api/analysis/index.ts +15 -0
  81. package/src/api/analysis/solar.ts +237 -0
  82. package/src/api/analysis/weather.ts +179 -0
  83. package/src/api/core/camera/index.ts +39 -0
  84. package/src/api/core/geom/create/index.ts +344 -1
  85. package/src/api/core/index.ts +9 -0
  86. package/src/api/core/io/export/index.ts +3 -1
  87. package/src/api/core/io/import/index.ts +64 -0
  88. package/src/api/core/mode/index.ts +96 -0
  89. package/src/api/core/storeys/index.ts +279 -0
  90. package/src/api/core/tags.ts +27 -0
  91. package/src/api/core/zoom/index.ts +4 -0
  92. package/src/api/design/create/index.ts +138 -1
  93. package/src/api/design/delete/index.ts +3 -0
  94. package/src/api/design/query/geometry/index.ts +125 -3
  95. package/src/api/design/query/index.ts +4 -0
  96. package/src/api/design/query/referenceLines.ts +52 -0
  97. package/src/api/design/query/spaces.ts +143 -0
  98. package/src/api/design/transform/index.ts +12 -0
  99. package/src/api/design/update/index.ts +66 -1
  100. package/src/api/entity/buildableEnvelope.ts +4 -0
  101. package/src/api/entity/referenceLine.ts +8 -0
  102. package/src/api/entity/story.ts +20 -0
  103. package/src/api/index.ts +5 -0
  104. package/src/api/presentation/export.ts +4 -0
  105. package/src/api/presentation/import.ts +6 -0
  106. package/src/api/presentation/index.ts +9 -0
  107. package/src/api/presentation/placedViews.ts +363 -0
  108. package/src/api/presentation/shapes.ts +274 -0
  109. package/src/api/program/site.ts +95 -0
  110. package/src/api/program/spreadsheet.ts +251 -6
  111. package/src/api/workspace/index.ts +516 -0
@@ -20,6 +20,10 @@ import * as z from "zod"
20
20
  *
21
21
  * Accessed via `snaptrude.presentation.export`.
22
22
  *
23
+ * For a different export intent, see `core.io.export.model` (the 3D model as a
24
+ * GLB/OBJ/FBX/3DS file) and `program.spreadsheet.export` (the area-program /
25
+ * takeoff workbook as XLSX/PDF/CSV).
26
+ *
23
27
  * The schemas and result types live here; the callable method is declared on
24
28
  * {@linkcode PluginPresentationApi.export}.
25
29
  */
@@ -20,6 +20,9 @@ export abstract class PluginPresentationImportApi {
20
20
  /**
21
21
  * Import a reference image onto the current Present sheet.
22
22
  *
23
+ * To place the image as a **scene** underlay to trace over — on a storey,
24
+ * not the Present canvas — use `core.io.import.image` instead.
25
+ *
23
26
  * @param source - The asset to import: exactly one of `url` or `dataUrl`.
24
27
  * @param options - Optional `position` — where to place the image on the
25
28
  * sheet.
@@ -50,6 +53,9 @@ export abstract class PluginPresentationImportApi {
50
53
  *
51
54
  * Each page is converted to vector SVG and placed as a canvas shape.
52
55
  *
56
+ * To bring the PDF into the **scene** as a traceable underlay — on a storey,
57
+ * not the Present canvas — use `core.io.import.pdf` instead.
58
+ *
53
59
  * @param source - The asset to import: exactly one of `url` or `dataUrl`.
54
60
  * @param options - Optional `position` — where to place the pages on the
55
61
  * sheet.
@@ -2,8 +2,10 @@ import { PluginApiReturn } from "../../types"
2
2
  import { PluginPresentationViewsApi } from "./views"
3
3
  import { PluginPresentationAIInspirationApi } from "./aiInspiration"
4
4
  import { PluginPresentationSheetsApi } from "./sheets"
5
+ import { PluginPresentationPlacedViewsApi } from "./placedViews"
5
6
  import { PluginPresentationDiagramsApi } from "./diagrams"
6
7
  import { PluginPresentationAnnotateApi } from "./annotate"
8
+ import { PluginPresentationShapesApi } from "./shapes"
7
9
  import { PluginPresentationImportApi } from "./import"
8
10
  import {
9
11
  PluginPresentationExportResult,
@@ -23,6 +25,7 @@ import {
23
25
  *
24
26
  * - {@linkcode PluginPresentationApi.views} — Saved 2D/3D views (list, get, capture, activate, create)
25
27
  * - {@linkcode PluginPresentationApi.sheets} — Layout sheets (list, get, create, place views)
28
+ * - {@linkcode PluginPresentationApi.placedViews} — Views already placed on the canvas (move, scale, crop)
26
29
  * - {@linkcode PluginPresentationApi.diagrams} — Place program/adjacency/site diagram images on sheets
27
30
  * - {@linkcode PluginPresentationApi.import} — Import reference images/PDFs onto the canvas
28
31
  * - {@linkcode PluginPresentationApi.aiInspiration} — Present-mode AI image/video generation
@@ -34,10 +37,14 @@ export abstract class PluginPresentationApi {
34
37
  public abstract views: PluginPresentationViewsApi
35
38
  /** Layout sheets — list/get/create and place views (Present mode). See {@linkcode PluginPresentationSheetsApi}. */
36
39
  public abstract sheets: PluginPresentationSheetsApi
40
+ /** Placed views — layout of the view shapes on the canvas: move/scale/setScale/setCrop (Present mode). See {@linkcode PluginPresentationPlacedViewsApi}. */
41
+ public abstract placedViews: PluginPresentationPlacedViewsApi
37
42
  /** Program/adjacency/site diagrams — place images on sheets. See {@linkcode PluginPresentationDiagramsApi}. */
38
43
  public abstract diagrams: PluginPresentationDiagramsApi
39
44
  /** Annotations on Present-mode sheets — text/arrows/notes/geo shapes. See {@linkcode PluginPresentationAnnotateApi}. */
40
45
  public abstract annotate: PluginPresentationAnnotateApi
46
+ /** Plugin-owned keyed shapes — upsert/remove/list so reruns update instead of duplicating. See {@linkcode PluginPresentationShapesApi}. */
47
+ public abstract shapes: PluginPresentationShapesApi
41
48
  /** Import reference images/PDFs onto the Present canvas. See {@linkcode PluginPresentationImportApi}. */
42
49
  public abstract import: PluginPresentationImportApi
43
50
  /**
@@ -86,8 +93,10 @@ export abstract class PluginPresentationApi {
86
93
 
87
94
  export * from "./views"
88
95
  export * from "./sheets"
96
+ export * from "./placedViews"
89
97
  export * from "./diagrams"
90
98
  export * from "./annotate"
99
+ export * from "./shapes"
91
100
  export * from "./import"
92
101
  export * from "./aiInspiration"
93
102
  export * from "./export"
@@ -0,0 +1,363 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../types"
3
+ import { PluginSheetPosition } from "./sheets"
4
+
5
+ /**
6
+ * Placed views — the view shapes already laid out on the Present canvas.
7
+ *
8
+ * A **placed view** is a saved view that has been dropped onto a layout sheet
9
+ * (or the open canvas) — the live linked view shape
10
+ * {@linkcode PluginPresentationSheetsApi.place} and the Present views panel's
11
+ * drag-drop create. These methods read and edit the **layout** of those
12
+ * shapes: where they sit, how big they are, their architectural scale, and
13
+ * their crop. To refresh a placed view's **content** from the current model,
14
+ * use `sheets.updatePlacedView` — content refresh lives on `sheets`,
15
+ * layout lives here.
16
+ *
17
+ * Reads (`list`) return `[]` when Present mode is closed; `get` and every
18
+ * write require Present mode to be open.
19
+ *
20
+ * Accessed via `snaptrude.presentation.placedViews`.
21
+ */
22
+ export abstract class PluginPresentationPlacedViewsApi {
23
+ constructor() {}
24
+
25
+ /**
26
+ * List the placed views in the presentation.
27
+ *
28
+ * Returns every placed view shape on the Present canvas — those nested on a
29
+ * layout sheet (with that sheet's id) and those sitting loose on the canvas
30
+ * (`sheetId: null`). Pass `sheetId` to list only the views placed on that
31
+ * sheet.
32
+ *
33
+ * @param sheetId - Optional sheet id to filter by.
34
+ * @returns A {@linkcode PluginPresentationPlacedViewsListResult} with a
35
+ * `placedViews` array (empty when Present mode is closed or nothing is
36
+ * placed).
37
+ * @throws If `sheetId` is given but is not a sheet (with Present mode open).
38
+ *
39
+ * @examplePrompt Which views are placed on this sheet?
40
+ * @examplePrompt List all the placed views in the presentation
41
+ * @examplePrompt What's laid out on sheet 2?
42
+ * @examplePrompt Show me every view on the Present canvas
43
+ *
44
+ * # Example
45
+ * ```ts
46
+ * const { placedViews } = await snaptrude.presentation.placedViews.list("sheet_1")
47
+ * ```
48
+ */
49
+ public abstract list(
50
+ sheetId?: string,
51
+ ): PluginApiReturn<PluginPresentationPlacedViewsListResult>
52
+
53
+ /**
54
+ * Get a single placed view by its shape id.
55
+ *
56
+ * `shapeId` is the id `sheets.place` returned (also reported by `list`).
57
+ *
58
+ * @param shapeId - The id of the placed view shape to read.
59
+ * @returns The matching {@linkcode PluginPlacedView}.
60
+ * @throws If Present mode is not open, or `shapeId` is unknown or is not a
61
+ * placed view.
62
+ *
63
+ * @examplePrompt Get the placed view I just dropped on the sheet
64
+ * @examplePrompt Read the position and scale of this placed view
65
+ * @examplePrompt What's the crop on shape_123?
66
+ *
67
+ * # Example
68
+ * ```ts
69
+ * const placed = await snaptrude.presentation.placedViews.get(shapeId)
70
+ * console.log(placed.position, placed.scale)
71
+ * ```
72
+ */
73
+ public abstract get(shapeId: string): PluginApiReturn<PluginPlacedView>
74
+
75
+ /**
76
+ * Move a placed view.
77
+ *
78
+ * Repositions the placed view on its sheet — `position` is the new top-left
79
+ * in sheet coordinates (page coordinates when the view is not on a sheet).
80
+ * Pass `options.sheetId` to move it onto another sheet: the view is
81
+ * reparented to that sheet and then positioned at `position` in the new
82
+ * sheet's coordinates. A grouped placed view (e.g. a sustainability 3D view
83
+ * with its legend) moves as one unit. Requires Present mode to be open.
84
+ *
85
+ * @param shapeId - The placed view shape to move.
86
+ * @param position - New top-left position (sheet-local; page coordinates
87
+ * when off-sheet).
88
+ * @param options - Optional `sheetId` — move the view onto that sheet.
89
+ * @returns The updated {@linkcode PluginPlacedView}.
90
+ * @throws If Present mode is not open, `shapeId` is unknown or is not a
91
+ * placed view, or `options.sheetId` is given but is not a sheet.
92
+ *
93
+ * @examplePrompt Move the site plan view to the top-left of sheet 2
94
+ * @examplePrompt Reposition this placed view to 100, 200
95
+ * @examplePrompt Move the hero perspective onto the cover sheet
96
+ *
97
+ * # Example
98
+ * ```ts
99
+ * await snaptrude.presentation.placedViews.move(shapeId, { x: 50, y: 50 }, {
100
+ * sheetId: "sheet_2",
101
+ * })
102
+ * ```
103
+ */
104
+ public abstract move(
105
+ shapeId: string,
106
+ position: PluginSheetPosition,
107
+ options?: { sheetId?: string },
108
+ ): PluginApiReturn<PluginPlacedView>
109
+
110
+ /**
111
+ * Resize a placed view by a uniform factor.
112
+ *
113
+ * Scales the placed view about its top-left corner — the same resize as
114
+ * dragging a corner handle, aspect ratio held. Works for 2D and 3D views;
115
+ * labels and grouped legends resize with it. For a 2D view the **printed
116
+ * architectural scale changes proportionally** (doubling the size of a
117
+ * 1:100 plan makes it a 1:50 plan) — use
118
+ * {@linkcode PluginPresentationPlacedViewsApi.setScale} to land on an exact
119
+ * standard scale instead. Requires Present mode to be open.
120
+ *
121
+ * @param shapeId - The placed view shape to resize.
122
+ * @param factor - Uniform scale factor, between `0.01` and `100`
123
+ * (`2` doubles the size, `0.5` halves it).
124
+ * @returns The updated {@linkcode PluginPlacedView}.
125
+ * @throws If Present mode is not open, `shapeId` is unknown or is not a
126
+ * placed view, or `factor` is not a finite number between 0.01 and 100.
127
+ *
128
+ * @examplePrompt Make this placed view twice as big
129
+ * @examplePrompt Shrink the placed 3D view to half its size
130
+ * @examplePrompt Scale the placed plan up by 50%
131
+ *
132
+ * # Example
133
+ * ```ts
134
+ * await snaptrude.presentation.placedViews.scale(shapeId, 2)
135
+ * ```
136
+ */
137
+ public abstract scale(
138
+ shapeId: string,
139
+ factor: number,
140
+ ): PluginApiReturn<PluginPlacedView>
141
+
142
+ /**
143
+ * Set a placed view's architectural scale.
144
+ *
145
+ * Applies a standard architectural scale — the same write the placed view's
146
+ * Scale dropdown performs. The view (and its labels) is resized about its
147
+ * top-left corner so it prints at the given scale. `scale` must be one of
148
+ * the standard values for the project's unit system (metric `10, 20, 50,
149
+ * 100, 150, 200, 250, 500, 1000`; imperial e.g. `48` for 1/4″ = 1′, `96`
150
+ * for 1/8″ = 1′, `120` for 1″ = 10′) — the same validation as
151
+ * `sheets.place`. 3D views have no architectural scale — calling this on
152
+ * one throws. Requires Present mode to be open.
153
+ *
154
+ * @param shapeId - The placed view shape to set the scale of.
155
+ * @param scale - A standard scale value for the project's unit system.
156
+ * @returns The updated {@linkcode PluginPlacedView}.
157
+ * @throws If Present mode is not open, `shapeId` is unknown or is not a
158
+ * placed view, `scale` is not a standard value for the project's unit
159
+ * system, or the placed view is a 3D view.
160
+ *
161
+ * @examplePrompt Set the plan to 1:100
162
+ * @examplePrompt Change the placed floor plan to 1:50 scale
163
+ * @examplePrompt Make this view print at quarter-inch scale
164
+ *
165
+ * # Example
166
+ * ```ts
167
+ * await snaptrude.presentation.placedViews.setScale(shapeId, 100) // 1:100
168
+ * ```
169
+ */
170
+ public abstract setScale(
171
+ shapeId: string,
172
+ scale: number,
173
+ ): PluginApiReturn<PluginPlacedView>
174
+
175
+ /**
176
+ * Crop a placed view, or clear its crop.
177
+ *
178
+ * `crop` selects the visible window as **fractions (0–1) of the uncropped
179
+ * view** — `topLeft` must be strictly less than `bottomRight` on both axes.
180
+ * The visible region stays anchored on the page (the same behavior as the
181
+ * interactive crop), labels that fall outside the crop are hidden, and the
182
+ * view's architectural scale is untouched. Pass `null` to clear the crop
183
+ * and restore the full view in its uncropped footprint (the interactive
184
+ * double-click-edge reset). The crop **survives a content refresh**
185
+ * (`sheets.updatePlacedView` recomputes it against the refreshed content
186
+ * and only clears it when the refreshed view no longer overlaps the cropped
187
+ * region). Requires Present mode to be open.
188
+ *
189
+ * @param shapeId - The placed view shape to crop.
190
+ * @param crop - The crop window ({@linkcode PluginPlacedViewCrop},
191
+ * fractions of the uncropped view), or `null` to clear.
192
+ * @returns The updated {@linkcode PluginPlacedView}.
193
+ * @throws If Present mode is not open, `shapeId` is unknown or is not a
194
+ * placed view, or `crop` is not a valid 0–1 rectangle with
195
+ * `topLeft < bottomRight` on both axes.
196
+ *
197
+ * @examplePrompt Crop the placed view to its left half
198
+ * @examplePrompt Crop this view to the top-right quarter
199
+ * @examplePrompt Remove the crop from the placed plan
200
+ *
201
+ * # Example
202
+ * ```ts
203
+ * // keep the left half of the view
204
+ * await snaptrude.presentation.placedViews.setCrop(shapeId, {
205
+ * topLeft: { x: 0, y: 0 },
206
+ * bottomRight: { x: 0.5, y: 1 },
207
+ * })
208
+ * await snaptrude.presentation.placedViews.setCrop(shapeId, null) // clear
209
+ * ```
210
+ */
211
+ public abstract setCrop(
212
+ shapeId: string,
213
+ crop: PluginPlacedViewCrop | null,
214
+ ): PluginApiReturn<PluginPlacedView>
215
+ }
216
+
217
+ /** A point in crop space — fractions (0–1) of the uncropped view. */
218
+ const PluginPlacedViewCropPoint = z.object({
219
+ x: z.number().min(0).max(1),
220
+ y: z.number().min(0).max(1),
221
+ })
222
+
223
+ /**
224
+ * A crop window on a placed view, as fractions (0–1) of the **uncropped**
225
+ * view. `topLeft` must be strictly less than `bottomRight` on both axes.
226
+ *
227
+ * | Property | Type | Description |
228
+ * |---|---|---|
229
+ * | `topLeft` | `{ x: number, y: number }` | Top-left of the visible window (fractions 0–1) |
230
+ * | `bottomRight` | `{ x: number, y: number }` | Bottom-right of the visible window (fractions 0–1) |
231
+ */
232
+ export const PluginPlacedViewCrop = z
233
+ .object({
234
+ topLeft: PluginPlacedViewCropPoint,
235
+ bottomRight: PluginPlacedViewCropPoint,
236
+ })
237
+ .refine(
238
+ (c) => c.topLeft.x < c.bottomRight.x && c.topLeft.y < c.bottomRight.y,
239
+ { message: "topLeft must be strictly less than bottomRight on both axes" },
240
+ )
241
+ export type PluginPlacedViewCrop = z.infer<typeof PluginPlacedViewCrop>
242
+
243
+ /**
244
+ * A view placed on the Present canvas.
245
+ *
246
+ * | Property | Type | Description |
247
+ * |---|---|---|
248
+ * | `shapeId` | `string` | Id of the placed view shape (the id `sheets.place` returns) |
249
+ * | `sheetId` | `string \| null` | The sheet it sits on (`null` when placed loose on the canvas) |
250
+ * | `title` | `string` | The saved view's title |
251
+ * | `viewId` | `string` | Id of the saved view it was placed from |
252
+ * | `position` | {@linkcode PluginSheetPosition} | Top-left position — sheet-local when on a sheet, page coordinates otherwise |
253
+ * | `size` | `{ width: number, height: number }` | Displayed size on the canvas |
254
+ * | `scale` | `number \| null` | Architectural scale (e.g. `100` = 1:100); `null` for 3D views |
255
+ * | `is3d` | `boolean` | Whether it is a 3D view (no architectural scale) |
256
+ * | `rotation` | `number` | Rotation in radians (nonzero only for 3D views) |
257
+ * | `crop` | {@linkcode PluginPlacedViewCrop}` \| null` | Crop window (`null` when uncropped) |
258
+ * | `isUnlinked` | `boolean` | Whether the source proposal was removed (an unlinked view no longer refreshes) |
259
+ */
260
+ export const PluginPlacedView = z.object({
261
+ shapeId: z.string(),
262
+ sheetId: z.string().nullable(),
263
+ title: z.string(),
264
+ viewId: z.string(),
265
+ position: PluginSheetPosition,
266
+ size: z.object({ width: z.number(), height: z.number() }),
267
+ scale: z.number().nullable(),
268
+ is3d: z.boolean(),
269
+ rotation: z.number(),
270
+ crop: PluginPlacedViewCrop.nullable(),
271
+ isUnlinked: z.boolean(),
272
+ })
273
+ export type PluginPlacedView = z.infer<typeof PluginPlacedView>
274
+
275
+ /** Arguments for {@linkcode PluginPresentationPlacedViewsApi.list}. */
276
+ export const PluginPresentationPlacedViewsListArgs = z.object({
277
+ sheetId: z.string().optional(),
278
+ })
279
+ export type PluginPresentationPlacedViewsListArgs = z.infer<
280
+ typeof PluginPresentationPlacedViewsListArgs
281
+ >
282
+
283
+ /** Result of {@linkcode PluginPresentationPlacedViewsApi.list}. */
284
+ export const PluginPresentationPlacedViewsListResult = z.object({
285
+ placedViews: z.array(PluginPlacedView),
286
+ })
287
+ export type PluginPresentationPlacedViewsListResult = z.infer<
288
+ typeof PluginPresentationPlacedViewsListResult
289
+ >
290
+
291
+ /** Arguments for {@linkcode PluginPresentationPlacedViewsApi.get}. */
292
+ export const PluginPresentationPlacedViewsGetArgs = z.object({
293
+ shapeId: z.string(),
294
+ })
295
+ export type PluginPresentationPlacedViewsGetArgs = z.infer<
296
+ typeof PluginPresentationPlacedViewsGetArgs
297
+ >
298
+
299
+ /**
300
+ * Arguments for {@linkcode PluginPresentationPlacedViewsApi.move}.
301
+ *
302
+ * | Property | Type | Description |
303
+ * |---|---|---|
304
+ * | `shapeId` | `string` | The placed view shape to move |
305
+ * | `position` | {@linkcode PluginSheetPosition} | New top-left position (sheet-local; page coordinates when off-sheet) |
306
+ * | `sheetId` | `string`? | Move the view onto this sheet |
307
+ */
308
+ export const PluginPresentationPlacedViewsMoveArgs = z.object({
309
+ shapeId: z.string(),
310
+ position: PluginSheetPosition,
311
+ sheetId: z.string().optional(),
312
+ })
313
+ export type PluginPresentationPlacedViewsMoveArgs = z.infer<
314
+ typeof PluginPresentationPlacedViewsMoveArgs
315
+ >
316
+
317
+ /**
318
+ * Arguments for {@linkcode PluginPresentationPlacedViewsApi.scale}.
319
+ *
320
+ * | Property | Type | Description |
321
+ * |---|---|---|
322
+ * | `shapeId` | `string` | The placed view shape to resize |
323
+ * | `factor` | `number` | Uniform scale factor (0.01–100) |
324
+ */
325
+ export const PluginPresentationPlacedViewsScaleArgs = z.object({
326
+ shapeId: z.string(),
327
+ factor: z.number().finite().min(0.01).max(100),
328
+ })
329
+ export type PluginPresentationPlacedViewsScaleArgs = z.infer<
330
+ typeof PluginPresentationPlacedViewsScaleArgs
331
+ >
332
+
333
+ /**
334
+ * Arguments for {@linkcode PluginPresentationPlacedViewsApi.setScale}.
335
+ *
336
+ * | Property | Type | Description |
337
+ * |---|---|---|
338
+ * | `shapeId` | `string` | The placed view shape to set the scale of |
339
+ * | `scale` | `number` | A standard scale value for the project's unit system |
340
+ */
341
+ export const PluginPresentationPlacedViewsSetScaleArgs = z.object({
342
+ shapeId: z.string(),
343
+ scale: z.number().positive(),
344
+ })
345
+ export type PluginPresentationPlacedViewsSetScaleArgs = z.infer<
346
+ typeof PluginPresentationPlacedViewsSetScaleArgs
347
+ >
348
+
349
+ /**
350
+ * Arguments for {@linkcode PluginPresentationPlacedViewsApi.setCrop}.
351
+ *
352
+ * | Property | Type | Description |
353
+ * |---|---|---|
354
+ * | `shapeId` | `string` | The placed view shape to crop |
355
+ * | `crop` | {@linkcode PluginPlacedViewCrop}` \| null` | The crop window, or `null` to clear |
356
+ */
357
+ export const PluginPresentationPlacedViewsSetCropArgs = z.object({
358
+ shapeId: z.string(),
359
+ crop: PluginPlacedViewCrop.nullable(),
360
+ })
361
+ export type PluginPresentationPlacedViewsSetCropArgs = z.infer<
362
+ typeof PluginPresentationPlacedViewsSetCropArgs
363
+ >