@snaptrude/plugin-core 0.9.16-networks-20261012.1 → 0.9.17
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 +6 -0
- package/api-manifest.json +9711 -0
- 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 +0 -29
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/zoom/index.d.ts +0 -13
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/create/bulk-items.d.ts +21 -40
- package/dist/api/design/create/bulk-items.d.ts.map +1 -1
- package/dist/api/design/create/index.d.ts +97 -120
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +12 -13
- package/dist/api/design/create/opening-fields.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +24 -18
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/family.d.ts +27 -797
- package/dist/api/design/family.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +0 -16
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +30 -30
- package/dist/api/design/selection/index.d.ts +10 -10
- package/dist/api/design/types/index.d.ts +24 -40
- package/dist/api/design/types/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +3 -40
- 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 +22 -38
- package/dist/api/presentation/annotate.d.ts.map +1 -1
- package/dist/api/presentation/export.d.ts +5 -23
- package/dist/api/presentation/export.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +21 -32
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +6 -106
- 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 +19 -175
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/views.d.ts +5 -103
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/presentation/walkthroughs.d.ts +6 -6
- package/dist/index.cjs +2434 -3619
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2421 -3501
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/generate-manifest.mjs +0 -5
- package/src/api/core/camera/index.ts +0 -29
- package/src/api/core/zoom/index.ts +0 -13
- package/src/api/design/create/bulk-items.ts +16 -23
- package/src/api/design/create/index.ts +119 -129
- package/src/api/design/create/opening-fields.ts +12 -15
- package/src/api/design/doors/index.ts +42 -58
- package/src/api/design/family.ts +32 -662
- package/src/api/design/index.ts +4 -34
- package/src/api/design/types/index.ts +24 -31
- package/src/api/design/update/index.ts +3 -41
- package/src/api/design/windows/index.ts +22 -40
- package/src/api/presentation/annotate.ts +58 -90
- package/src/api/presentation/export.ts +6 -32
- package/src/api/presentation/index.ts +23 -39
- package/src/api/presentation/placedViews.ts +28 -119
- package/src/api/presentation/sections.ts +420 -0
- package/src/api/presentation/sheets.ts +20 -181
- package/src/api/presentation/views.ts +6 -46
- package/dist/api/design/bim.d.ts +0 -209
- package/dist/api/design/bim.d.ts.map +0 -1
- package/dist/api/design/catalog.d.ts +0 -320
- package/dist/api/design/catalog.d.ts.map +0 -1
- package/dist/api/design/networks.d.ts +0 -1703
- package/dist/api/design/networks.d.ts.map +0 -1
- package/dist/api/presentation/drawingContract.d.ts +0 -32
- package/dist/api/presentation/drawingContract.d.ts.map +0 -1
- package/dist/api/presentation/drawings.d.ts +0 -3523
- package/dist/api/presentation/drawings.d.ts.map +0 -1
- package/dist/api/presentation/viewPresets.d.ts +0 -222
- package/dist/api/presentation/viewPresets.d.ts.map +0 -1
- package/src/api/design/bim.ts +0 -121
- package/src/api/design/catalog.ts +0 -203
- package/src/api/design/networks.ts +0 -607
- package/src/api/presentation/drawingContract.ts +0 -70
- package/src/api/presentation/drawings.ts +0 -1179
- package/src/api/presentation/viewPresets.ts +0 -241
- package/test/drawingContract.test.mjs +0 -288
|
@@ -34,15 +34,14 @@ export abstract class PluginPresentationAnnotateApi {
|
|
|
34
34
|
* falls back to regular. `fontSizePx` sets an exact pixel size, overriding
|
|
35
35
|
* the `size` preset when both are given (`size` alone keeps working).
|
|
36
36
|
*
|
|
37
|
-
* @param sheetId - The sheet to annotate
|
|
37
|
+
* @param sheetId - The sheet to annotate.
|
|
38
38
|
* @param text - The label text.
|
|
39
39
|
* @param options - Optional `position` (`{ x, y }`, relative to the sheet's
|
|
40
40
|
* top-left, in canvas units — defaults to the sheet's top-left corner),
|
|
41
41
|
* `size` (`"s" | "m" | "l" | "xl"`, default `"m"`), `color` (a named
|
|
42
42
|
* palette color, default `"black"`), and typography: `fontFamily`,
|
|
43
43
|
* `fontWeight` (numeric string, `-italic` suffix allowed), `fontSizePx`
|
|
44
|
-
* (positive px size overriding the `size` preset)
|
|
45
|
-
* the annotation to a drawing. Pass exactly one parent: `sheetId` or `drawingId`.
|
|
44
|
+
* (positive px size overriding the `size` preset).
|
|
46
45
|
* @returns A {@linkcode PluginPresentationAnnotateTextResult} with the created
|
|
47
46
|
* `shapeId`.
|
|
48
47
|
* @throws If Present mode is not open or the sheet id is invalid.
|
|
@@ -62,7 +61,7 @@ export abstract class PluginPresentationAnnotateApi {
|
|
|
62
61
|
* ```
|
|
63
62
|
*/
|
|
64
63
|
public abstract text(
|
|
65
|
-
sheetId: string
|
|
64
|
+
sheetId: string,
|
|
66
65
|
text: string,
|
|
67
66
|
options?: {
|
|
68
67
|
position?: { x: number; y: number }
|
|
@@ -71,7 +70,6 @@ export abstract class PluginPresentationAnnotateApi {
|
|
|
71
70
|
fontFamily?: string
|
|
72
71
|
fontWeight?: string
|
|
73
72
|
fontSizePx?: number
|
|
74
|
-
drawingId?: string
|
|
75
73
|
},
|
|
76
74
|
): PluginApiReturn<PluginPresentationAnnotateTextResult>
|
|
77
75
|
|
|
@@ -82,12 +80,11 @@ export abstract class PluginPresentationAnnotateApi {
|
|
|
82
80
|
* top-left, in canvas units — the same Arrow tool as the Present toolbar) and
|
|
83
81
|
* returns the id of the created canvas shape. Requires Present mode to be open.
|
|
84
82
|
*
|
|
85
|
-
* @param sheetId - The sheet to annotate
|
|
83
|
+
* @param sheetId - The sheet to annotate.
|
|
86
84
|
* @param start - Arrow tail position (`{ x, y }`, relative to the sheet's top-left).
|
|
87
85
|
* @param end - Arrow head position (`{ x, y }`, relative to the sheet's top-left).
|
|
88
86
|
* @param options - Optional `color` (a named palette color, default `"black"`)
|
|
89
|
-
* `size` (stroke weight preset, `"s" | "m" | "l" | "xl"`, default `"m"`)
|
|
90
|
-
* and `drawingId` to parent the arrow to a drawing. Pass exactly one parent.
|
|
87
|
+
* and `size` (stroke weight preset, `"s" | "m" | "l" | "xl"`, default `"m"`).
|
|
91
88
|
* @returns A {@linkcode PluginPresentationAnnotateResult} with the created
|
|
92
89
|
* `shapeId`.
|
|
93
90
|
* @throws If Present mode is not open or the sheet id is invalid.
|
|
@@ -107,13 +104,12 @@ export abstract class PluginPresentationAnnotateApi {
|
|
|
107
104
|
* ```
|
|
108
105
|
*/
|
|
109
106
|
public abstract arrow(
|
|
110
|
-
sheetId: string
|
|
107
|
+
sheetId: string,
|
|
111
108
|
start: { x: number; y: number },
|
|
112
109
|
end: { x: number; y: number },
|
|
113
110
|
options?: {
|
|
114
111
|
color?: PluginAnnotateTextColor
|
|
115
112
|
size?: PluginAnnotateTextSize
|
|
116
|
-
drawingId?: string
|
|
117
113
|
},
|
|
118
114
|
): PluginApiReturn<PluginPresentationAnnotateResult>
|
|
119
115
|
|
|
@@ -124,14 +120,13 @@ export abstract class PluginPresentationAnnotateApi {
|
|
|
124
120
|
* fixed-size sticky square that grows with its text) and returns the id of
|
|
125
121
|
* the created canvas shape. Requires Present mode to be open.
|
|
126
122
|
*
|
|
127
|
-
* @param sheetId - The sheet to annotate
|
|
123
|
+
* @param sheetId - The sheet to annotate.
|
|
128
124
|
* @param text - The note text.
|
|
129
125
|
* @param options - Optional `position` (`{ x, y }`, relative to the sheet's
|
|
130
126
|
* top-left, in canvas units — defaults to the sheet's top-left corner),
|
|
131
127
|
* `color` (a named palette color, default `"black"` — rendered as the
|
|
132
128
|
* note's sticky fill), and `size` (text size preset,
|
|
133
|
-
* `"s" | "m" | "l" | "xl"`, default `"m"`)
|
|
134
|
-
* the note to a drawing. Pass exactly one parent.
|
|
129
|
+
* `"s" | "m" | "l" | "xl"`, default `"m"`).
|
|
135
130
|
* @returns A {@linkcode PluginPresentationAnnotateResult} with the created
|
|
136
131
|
* `shapeId`.
|
|
137
132
|
* @throws If Present mode is not open or the sheet id is invalid.
|
|
@@ -150,13 +145,12 @@ export abstract class PluginPresentationAnnotateApi {
|
|
|
150
145
|
* ```
|
|
151
146
|
*/
|
|
152
147
|
public abstract note(
|
|
153
|
-
sheetId: string
|
|
148
|
+
sheetId: string,
|
|
154
149
|
text: string,
|
|
155
150
|
options?: {
|
|
156
151
|
position?: { x: number; y: number }
|
|
157
152
|
color?: PluginAnnotateTextColor
|
|
158
153
|
size?: PluginAnnotateTextSize
|
|
159
|
-
drawingId?: string
|
|
160
154
|
},
|
|
161
155
|
): PluginApiReturn<PluginPresentationAnnotateResult>
|
|
162
156
|
|
|
@@ -168,15 +162,14 @@ export abstract class PluginPresentationAnnotateApi {
|
|
|
168
162
|
* top-left, in canvas units) and returns the id of the created canvas shape.
|
|
169
163
|
* Requires Present mode to be open.
|
|
170
164
|
*
|
|
171
|
-
* @param sheetId - The sheet to annotate
|
|
165
|
+
* @param sheetId - The sheet to annotate.
|
|
172
166
|
* @param kind - The shape kind ({@linkcode PluginAnnotateGeoKind}), e.g.
|
|
173
167
|
* `"rectangle"`, `"ellipse"`, `"cloud"`.
|
|
174
168
|
* @param bounds - Placement box `{ x, y, w, h }` — `x`/`y` are the shape's
|
|
175
169
|
* top-left relative to the sheet's top-left; `w`/`h` must be positive.
|
|
176
170
|
* @param options - Optional `color` (a named palette color, default
|
|
177
171
|
* `"black"`) and `fill` ({@linkcode PluginAnnotateFill}, default `"none"` —
|
|
178
|
-
* outline only)
|
|
179
|
-
* exactly one parent: `sheetId` or `drawingId`.
|
|
172
|
+
* outline only).
|
|
180
173
|
* @returns A {@linkcode PluginPresentationAnnotateResult} with the created
|
|
181
174
|
* `shapeId`.
|
|
182
175
|
* @throws If Present mode is not open or the sheet id is invalid.
|
|
@@ -196,13 +189,12 @@ export abstract class PluginPresentationAnnotateApi {
|
|
|
196
189
|
* ```
|
|
197
190
|
*/
|
|
198
191
|
public abstract shape(
|
|
199
|
-
sheetId: string
|
|
192
|
+
sheetId: string,
|
|
200
193
|
kind: PluginAnnotateGeoKind,
|
|
201
194
|
bounds: { x: number; y: number; w: number; h: number },
|
|
202
195
|
options?: {
|
|
203
196
|
color?: PluginAnnotateTextColor
|
|
204
197
|
fill?: PluginAnnotateFill
|
|
205
|
-
drawingId?: string
|
|
206
198
|
},
|
|
207
199
|
): PluginApiReturn<PluginPresentationAnnotateResult>
|
|
208
200
|
}
|
|
@@ -234,8 +226,7 @@ export type PluginAnnotateTextColor = z.infer<typeof PluginAnnotateTextColor>
|
|
|
234
226
|
*
|
|
235
227
|
* | Property | Type | Description |
|
|
236
228
|
* |---|---|---|
|
|
237
|
-
* | `sheetId` | `string
|
|
238
|
-
* | `drawingId` | `string \| undefined` | The drawing parent; mutually exclusive with `sheetId` |
|
|
229
|
+
* | `sheetId` | `string` | The sheet to annotate |
|
|
239
230
|
* | `text` | `string` | The label text |
|
|
240
231
|
* | `position` | `{ x: number; y: number } \| undefined` | Where to place it (relative to the sheet) |
|
|
241
232
|
* | `size` | {@linkcode PluginAnnotateTextSize}` \| undefined` | Text size preset |
|
|
@@ -244,27 +235,22 @@ export type PluginAnnotateTextColor = z.infer<typeof PluginAnnotateTextColor>
|
|
|
244
235
|
* | `fontWeight` | `string \| undefined` | Numeric weight like `"400"`/`"700"`, `-italic` suffix allowed |
|
|
245
236
|
* | `fontSizePx` | `number \| undefined` | Exact px size (overrides the `size` preset) |
|
|
246
237
|
*/
|
|
247
|
-
export const PluginPresentationAnnotateTextArgs = z
|
|
248
|
-
.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
fontSizePx: z.number().finite().positive().optional(),
|
|
264
|
-
})
|
|
265
|
-
.refine(({ sheetId, drawingId }) => Boolean(sheetId) !== Boolean(drawingId), {
|
|
266
|
-
message: "exactly one of sheetId or drawingId is required",
|
|
267
|
-
})
|
|
238
|
+
export const PluginPresentationAnnotateTextArgs = z.object({
|
|
239
|
+
sheetId: z.string(),
|
|
240
|
+
text: z.string(),
|
|
241
|
+
position: z.object({ x: z.number(), y: z.number() }).optional(),
|
|
242
|
+
size: PluginAnnotateTextSize.optional(),
|
|
243
|
+
color: PluginAnnotateTextColor.optional(),
|
|
244
|
+
fontFamily: z.string().min(1).optional(),
|
|
245
|
+
fontWeight: z
|
|
246
|
+
.string()
|
|
247
|
+
.regex(
|
|
248
|
+
/^\d{3}(-italic)?$/,
|
|
249
|
+
'fontWeight must be a numeric string like "400" or "700", optionally with the "-italic" suffix',
|
|
250
|
+
)
|
|
251
|
+
.optional(),
|
|
252
|
+
fontSizePx: z.number().finite().positive().optional(),
|
|
253
|
+
})
|
|
268
254
|
export type PluginPresentationAnnotateTextArgs = z.infer<
|
|
269
255
|
typeof PluginPresentationAnnotateTextArgs
|
|
270
256
|
>
|
|
@@ -316,25 +302,19 @@ export type PluginAnnotateFill = z.infer<typeof PluginAnnotateFill>
|
|
|
316
302
|
*
|
|
317
303
|
* | Property | Type | Description |
|
|
318
304
|
* |---|---|---|
|
|
319
|
-
* | `sheetId` | `string
|
|
320
|
-
* | `drawingId` | `string \| undefined` | The drawing parent; mutually exclusive with `sheetId` |
|
|
305
|
+
* | `sheetId` | `string` | The sheet to annotate |
|
|
321
306
|
* | `start` | `{ x: number; y: number }` | Arrow tail (relative to the sheet) |
|
|
322
307
|
* | `end` | `{ x: number; y: number }` | Arrow head (relative to the sheet) |
|
|
323
308
|
* | `color` | {@linkcode PluginAnnotateTextColor}` \| undefined` | Arrow color |
|
|
324
309
|
* | `size` | {@linkcode PluginAnnotateTextSize}` \| undefined` | Stroke weight preset |
|
|
325
310
|
*/
|
|
326
|
-
export const PluginPresentationAnnotateArrowArgs = z
|
|
327
|
-
.
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
size: PluginAnnotateTextSize.optional(),
|
|
334
|
-
})
|
|
335
|
-
.refine(({ sheetId, drawingId }) => Boolean(sheetId) !== Boolean(drawingId), {
|
|
336
|
-
message: "exactly one of sheetId or drawingId is required",
|
|
337
|
-
})
|
|
311
|
+
export const PluginPresentationAnnotateArrowArgs = z.object({
|
|
312
|
+
sheetId: z.string(),
|
|
313
|
+
start: z.object({ x: z.number(), y: z.number() }),
|
|
314
|
+
end: z.object({ x: z.number(), y: z.number() }),
|
|
315
|
+
color: PluginAnnotateTextColor.optional(),
|
|
316
|
+
size: PluginAnnotateTextSize.optional(),
|
|
317
|
+
})
|
|
338
318
|
export type PluginPresentationAnnotateArrowArgs = z.infer<
|
|
339
319
|
typeof PluginPresentationAnnotateArrowArgs
|
|
340
320
|
>
|
|
@@ -344,25 +324,19 @@ export type PluginPresentationAnnotateArrowArgs = z.infer<
|
|
|
344
324
|
*
|
|
345
325
|
* | Property | Type | Description |
|
|
346
326
|
* |---|---|---|
|
|
347
|
-
* | `sheetId` | `string
|
|
348
|
-
* | `drawingId` | `string \| undefined` | The drawing parent; mutually exclusive with `sheetId` |
|
|
327
|
+
* | `sheetId` | `string` | The sheet to annotate |
|
|
349
328
|
* | `text` | `string` | The note text |
|
|
350
329
|
* | `position` | `{ x: number; y: number } \| undefined` | Where to place it (relative to the sheet) |
|
|
351
330
|
* | `color` | {@linkcode PluginAnnotateTextColor}` \| undefined` | Sticky fill color |
|
|
352
331
|
* | `size` | {@linkcode PluginAnnotateTextSize}` \| undefined` | Text size preset |
|
|
353
332
|
*/
|
|
354
|
-
export const PluginPresentationAnnotateNoteArgs = z
|
|
355
|
-
.
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
size: PluginAnnotateTextSize.optional(),
|
|
362
|
-
})
|
|
363
|
-
.refine(({ sheetId, drawingId }) => Boolean(sheetId) !== Boolean(drawingId), {
|
|
364
|
-
message: "exactly one of sheetId or drawingId is required",
|
|
365
|
-
})
|
|
333
|
+
export const PluginPresentationAnnotateNoteArgs = z.object({
|
|
334
|
+
sheetId: z.string(),
|
|
335
|
+
text: z.string(),
|
|
336
|
+
position: z.object({ x: z.number(), y: z.number() }).optional(),
|
|
337
|
+
color: PluginAnnotateTextColor.optional(),
|
|
338
|
+
size: PluginAnnotateTextSize.optional(),
|
|
339
|
+
})
|
|
366
340
|
export type PluginPresentationAnnotateNoteArgs = z.infer<
|
|
367
341
|
typeof PluginPresentationAnnotateNoteArgs
|
|
368
342
|
>
|
|
@@ -372,30 +346,24 @@ export type PluginPresentationAnnotateNoteArgs = z.infer<
|
|
|
372
346
|
*
|
|
373
347
|
* | Property | Type | Description |
|
|
374
348
|
* |---|---|---|
|
|
375
|
-
* | `sheetId` | `string
|
|
376
|
-
* | `drawingId` | `string \| undefined` | The drawing parent; mutually exclusive with `sheetId` |
|
|
349
|
+
* | `sheetId` | `string` | The sheet to annotate |
|
|
377
350
|
* | `kind` | {@linkcode PluginAnnotateGeoKind} | The shape kind |
|
|
378
351
|
* | `bounds` | `{ x: number; y: number; w: number; h: number }` | Placement box (relative to the sheet; `w`/`h` positive) |
|
|
379
352
|
* | `color` | {@linkcode PluginAnnotateTextColor}` \| undefined` | Outline color |
|
|
380
353
|
* | `fill` | {@linkcode PluginAnnotateFill}` \| undefined` | Fill style |
|
|
381
354
|
*/
|
|
382
|
-
export const PluginPresentationAnnotateShapeArgs = z
|
|
383
|
-
.
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
fill: PluginAnnotateFill.optional(),
|
|
395
|
-
})
|
|
396
|
-
.refine(({ sheetId, drawingId }) => Boolean(sheetId) !== Boolean(drawingId), {
|
|
397
|
-
message: "exactly one of sheetId or drawingId is required",
|
|
398
|
-
})
|
|
355
|
+
export const PluginPresentationAnnotateShapeArgs = z.object({
|
|
356
|
+
sheetId: z.string(),
|
|
357
|
+
kind: PluginAnnotateGeoKind,
|
|
358
|
+
bounds: z.object({
|
|
359
|
+
x: z.number(),
|
|
360
|
+
y: z.number(),
|
|
361
|
+
w: z.number().positive(),
|
|
362
|
+
h: z.number().positive(),
|
|
363
|
+
}),
|
|
364
|
+
color: PluginAnnotateTextColor.optional(),
|
|
365
|
+
fill: PluginAnnotateFill.optional(),
|
|
366
|
+
})
|
|
399
367
|
export type PluginPresentationAnnotateShapeArgs = z.infer<
|
|
400
368
|
typeof PluginPresentationAnnotateShapeArgs
|
|
401
369
|
>
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
|
-
import { PluginExportFileName } from "./drawingContract"
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Presentation export — render the Present-mode layout sheets to a downloadable
|
|
6
|
-
* file (PDF / PNG / JPG)
|
|
5
|
+
* file (PDF / PNG / JPG) and hand the plugin the bytes as base64.
|
|
7
6
|
*
|
|
8
7
|
* This wraps the same pipeline the Present-mode **Export** dialog drives:
|
|
9
8
|
* each sheet is serialized to an SVG, then either composed into a PDF
|
|
10
|
-
* (svg2pdf/jspdf) or rasterized to a PNG/JPG.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* (svg2pdf/jspdf) or rasterized to a PNG/JPG. Nothing is written to disk
|
|
10
|
+
* host-side — the plugin receives the encoded bytes and decides what to do
|
|
11
|
+
* with them (save, upload, preview).
|
|
13
12
|
*
|
|
14
13
|
* Requires **Present mode to be open** (the documentation editor); the call
|
|
15
14
|
* throws `PRECONDITION_FAILED` when it is not.
|
|
@@ -61,27 +60,19 @@ export type PluginPresentationExportResolution = z.infer<
|
|
|
61
60
|
* | `sheetIds` | `string[] \| undefined` | Sheets to export (all sheets when omitted) |
|
|
62
61
|
* | `combine` | `boolean \| undefined` | PDF only: one multi-page file (default `true`) vs one file per sheet |
|
|
63
62
|
* | `resolution` | {@linkcode PluginPresentationExportResolution}` \| undefined` | Raster target size (`png`/`jpg` only) |
|
|
64
|
-
* | `fileName` | `string \| undefined` | Base file name
|
|
65
|
-
* | `download` | `boolean \| undefined` | Start browser downloads and return metadata without base64 (default `false`) |
|
|
63
|
+
* | `fileName` | `string \| undefined` | Base file name (without extension) |
|
|
66
64
|
*/
|
|
67
65
|
export const PluginPresentationExportArgs = z.object({
|
|
68
66
|
format: PluginPresentationExportFormat,
|
|
69
67
|
sheetIds: z.array(z.string()).optional(),
|
|
70
68
|
combine: z.boolean().optional(),
|
|
71
69
|
resolution: PluginPresentationExportResolution.optional(),
|
|
72
|
-
fileName:
|
|
73
|
-
download: z.boolean().optional(),
|
|
70
|
+
fileName: z.string().optional(),
|
|
74
71
|
})
|
|
75
72
|
export type PluginPresentationExportArgs = z.infer<
|
|
76
73
|
typeof PluginPresentationExportArgs
|
|
77
74
|
>
|
|
78
75
|
|
|
79
|
-
/** Options after the positional export format. Omitted `download` preserves base64 results. */
|
|
80
|
-
export type PluginPresentationExportOptions = Omit<
|
|
81
|
-
PluginPresentationExportArgs,
|
|
82
|
-
"format"
|
|
83
|
-
>
|
|
84
|
-
|
|
85
76
|
/**
|
|
86
77
|
* A single exported file.
|
|
87
78
|
*
|
|
@@ -115,20 +106,3 @@ export const PluginPresentationExportResult = z.object({
|
|
|
115
106
|
export type PluginPresentationExportResult = z.infer<
|
|
116
107
|
typeof PluginPresentationExportResult
|
|
117
108
|
>
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Metadata-only result for `download: true`. `downloadStarted` confirms initiation,
|
|
121
|
-
* not an OS-saved file: browsers may require multiple-download permission. No base64
|
|
122
|
-
* is returned. Default exports retain their existing result and TypeScript contract.
|
|
123
|
-
*/
|
|
124
|
-
export const PluginPresentationExportDownloadResult = z.object({
|
|
125
|
-
files: z.array(
|
|
126
|
-
PluginPresentationExportFile.omit({ dataBase64: true }).extend({
|
|
127
|
-
byteLength: z.number().int().nonnegative(),
|
|
128
|
-
}),
|
|
129
|
-
),
|
|
130
|
-
downloadStarted: z.boolean(),
|
|
131
|
-
})
|
|
132
|
-
export type PluginPresentationExportDownloadResult = z.infer<
|
|
133
|
-
typeof PluginPresentationExportDownloadResult
|
|
134
|
-
>
|
|
@@ -5,19 +5,17 @@ import { PluginPresentationAIInspirationApi } from "./aiInspiration"
|
|
|
5
5
|
import { PluginPresentationSheetsApi } from "./sheets"
|
|
6
6
|
import { PluginPresentationPlacedViewsApi } from "./placedViews"
|
|
7
7
|
import { PluginPresentationDiagramsApi } from "./diagrams"
|
|
8
|
-
import { PluginPresentationDrawingsApi } from "./drawings"
|
|
9
|
-
import { PluginPresentationViewPresetsApi } from "./viewPresets"
|
|
10
8
|
import { PluginPresentationAnnotateApi } from "./annotate"
|
|
11
9
|
import { PluginPresentationShapesApi } from "./shapes"
|
|
12
10
|
import { PluginPresentationTablesApi } from "./tables"
|
|
13
11
|
import { PluginPresentationSlideshowApi } from "./slideshow"
|
|
14
12
|
import { PluginPresentationImportApi } from "./import"
|
|
15
13
|
import { PluginPresentationWalkthroughsApi } from "./walkthroughs"
|
|
14
|
+
import { PluginPresentationSectionsApi } from "./sections"
|
|
16
15
|
import {
|
|
17
|
-
|
|
18
|
-
type PluginPresentationExportDownloadResult,
|
|
16
|
+
PluginPresentationExportResult,
|
|
19
17
|
type PluginPresentationExportFormat,
|
|
20
|
-
type
|
|
18
|
+
type PluginPresentationExportResolution,
|
|
21
19
|
} from "./export"
|
|
22
20
|
|
|
23
21
|
/**
|
|
@@ -32,9 +30,7 @@ import {
|
|
|
32
30
|
*
|
|
33
31
|
* - {@linkcode PluginPresentationApi.views} — Saved 2D/3D views (list, get, capture, activate, create)
|
|
34
32
|
* - {@linkcode PluginPresentationApi.camera} — The Present canvas camera (screenshot, pan/zoom, frame sheets)
|
|
35
|
-
* - {@linkcode PluginPresentationApi.
|
|
36
|
-
* - {@linkcode PluginPresentationApi.viewPresets} — Reusable drawing styles (list, get, create, update, copy, rename, delete)
|
|
37
|
-
* - {@linkcode PluginPresentationApi.sheets} — Layout sheets (list, get, create, place views and drawings)
|
|
33
|
+
* - {@linkcode PluginPresentationApi.sheets} — Layout sheets (list, get, create, place views)
|
|
38
34
|
* - {@linkcode PluginPresentationApi.placedViews} — Views already placed on the canvas (move, scale, crop)
|
|
39
35
|
* - {@linkcode PluginPresentationApi.diagrams} — Generate program/site diagram sheets, place diagram images
|
|
40
36
|
* - {@linkcode PluginPresentationApi.tables} — Place data tables on sheets
|
|
@@ -42,6 +38,7 @@ import {
|
|
|
42
38
|
* - {@linkcode PluginPresentationApi.import} — Import reference images/PDFs onto the canvas
|
|
43
39
|
* - {@linkcode PluginPresentationApi.aiInspiration} — Present-mode AI image/video generation
|
|
44
40
|
* - {@linkcode PluginPresentationApi.walkthroughs} — Camera paths through the model: create, play, capture, export as video
|
|
41
|
+
* - {@linkcode PluginPresentationApi.sections} — Section lines: create, edit, open their views, and read what each cuts
|
|
45
42
|
*
|
|
46
43
|
* Accessed via `snaptrude.presentation`.
|
|
47
44
|
*/
|
|
@@ -50,10 +47,6 @@ export abstract class PluginPresentationApi {
|
|
|
50
47
|
public abstract views: PluginPresentationViewsApi
|
|
51
48
|
/** The Present canvas camera — screenshot what is on screen, read/pan/zoom it, frame sheets (Present mode). See {@linkcode PluginPresentationCameraApi}. */
|
|
52
49
|
public abstract camera: PluginPresentationCameraApi
|
|
53
|
-
/** Drawing deliverables made from saved views, independent of sheet composition (Present mode). See {@linkcode PluginPresentationDrawingsApi}. */
|
|
54
|
-
public abstract drawings: PluginPresentationDrawingsApi
|
|
55
|
-
/** Reusable kernel-plan styles stored in the Present document. See {@linkcode PluginPresentationViewPresetsApi}. */
|
|
56
|
-
public abstract viewPresets: PluginPresentationViewPresetsApi
|
|
57
50
|
/** Layout sheets — list/get/create and place views (Present mode). See {@linkcode PluginPresentationSheetsApi}. */
|
|
58
51
|
public abstract sheets: PluginPresentationSheetsApi
|
|
59
52
|
/** Placed views — layout of the view shapes on the canvas: move/scale/setScale/setCrop (Present mode). See {@linkcode PluginPresentationPlacedViewsApi}. */
|
|
@@ -81,25 +74,24 @@ export abstract class PluginPresentationApi {
|
|
|
81
74
|
* Present canvas. See {@linkcode PluginPresentationWalkthroughsApi}.
|
|
82
75
|
*/
|
|
83
76
|
public abstract walkthroughs: PluginPresentationWalkthroughsApi
|
|
77
|
+
/**
|
|
78
|
+
* Sections — lines on the plan that cut the model: create, edit and delete
|
|
79
|
+
* them, open their views, and read what each one cuts (`getCut`). See
|
|
80
|
+
* {@linkcode PluginPresentationSectionsApi}.
|
|
81
|
+
*/
|
|
82
|
+
public abstract sections: PluginPresentationSectionsApi
|
|
84
83
|
|
|
85
84
|
/**
|
|
86
85
|
* Export the presentation's layout sheets to a downloadable file (PDF / PNG /
|
|
87
|
-
* JPG)
|
|
88
|
-
*
|
|
89
|
-
* `fileName` is a base name WITHOUT an extension ("Floor Pattern View", never
|
|
90
|
-
* "Floor Pattern View.pdf"): the host appends the extension for the format, and
|
|
91
|
-
* a name ending in .pdf, .svg, .png, .jpg or .jpeg, a dot or a space is rejected.
|
|
86
|
+
* JPG) and return the encoded bytes as base64. Wraps the Present-mode Export
|
|
87
|
+
* dialog pipeline headlessly. Requires Present mode to be open.
|
|
92
88
|
*
|
|
93
89
|
* @param format - Output format: `"pdf"`, `"png"`, or `"jpg"`.
|
|
94
90
|
* @param options - Optional `sheetIds` (all sheets when omitted), `combine`
|
|
95
91
|
* (PDF only — one multi-page file vs one per sheet, default `true`),
|
|
96
|
-
* `resolution` (raster target size for `png`/`jpg`), `fileName
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* @returns A `files` array (one entry for a combined PDF, one per sheet otherwise).
|
|
100
|
-
* Downloads return {@linkcode PluginPresentationExportDownloadResult}; otherwise
|
|
101
|
-
* {@linkcode PluginPresentationExportResult}. Download initiation does not prove
|
|
102
|
-
* the browser saved the file; multiple downloads may require user permission.
|
|
92
|
+
* `resolution` (raster target size for `png`/`jpg`), and `fileName`.
|
|
93
|
+
* @returns A {@linkcode PluginPresentationExportResult} — always a `files`
|
|
94
|
+
* array (one entry for a combined PDF, one per sheet otherwise).
|
|
103
95
|
* @throws If Present mode is not open, a `sheetId` is unknown, or a sheet
|
|
104
96
|
* fails to serialize/encode.
|
|
105
97
|
*
|
|
@@ -112,23 +104,17 @@ export abstract class PluginPresentationApi {
|
|
|
112
104
|
* # Example
|
|
113
105
|
* ```ts
|
|
114
106
|
* const { files } = await snaptrude.presentation.export("pdf")
|
|
115
|
-
* const download = await snaptrude.presentation.export("pdf", { download: true })
|
|
116
107
|
* ```
|
|
117
108
|
*/
|
|
118
109
|
public abstract export(
|
|
119
110
|
format: PluginPresentationExportFormat,
|
|
120
|
-
options?:
|
|
111
|
+
options?: {
|
|
112
|
+
sheetIds?: string[]
|
|
113
|
+
combine?: boolean
|
|
114
|
+
resolution?: PluginPresentationExportResolution
|
|
115
|
+
fileName?: string
|
|
116
|
+
},
|
|
121
117
|
): PluginApiReturn<PluginPresentationExportResult>
|
|
122
|
-
public abstract export(
|
|
123
|
-
format: PluginPresentationExportFormat,
|
|
124
|
-
options: PluginPresentationExportOptions & { download: true },
|
|
125
|
-
): PluginApiReturn<PluginPresentationExportDownloadResult>
|
|
126
|
-
public abstract export(
|
|
127
|
-
format: PluginPresentationExportFormat,
|
|
128
|
-
options?: PluginPresentationExportOptions,
|
|
129
|
-
): PluginApiReturn<
|
|
130
|
-
PluginPresentationExportResult | PluginPresentationExportDownloadResult
|
|
131
|
-
>
|
|
132
118
|
|
|
133
119
|
constructor() {}
|
|
134
120
|
}
|
|
@@ -145,7 +131,5 @@ export * from "./slideshow"
|
|
|
145
131
|
export * from "./import"
|
|
146
132
|
export * from "./aiInspiration"
|
|
147
133
|
export * from "./walkthroughs"
|
|
134
|
+
export * from "./sections"
|
|
148
135
|
export * from "./export"
|
|
149
|
-
export * from "./drawings"
|
|
150
|
-
export * from "./drawingContract"
|
|
151
|
-
export * from "./viewPresets"
|