@snaptrude/plugin-core 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +130 -48
- package/CHANGELOG.md +111 -0
- package/api-manifest.full.json +3999 -0
- package/api-manifest.json +3845 -0
- package/dist/api/core/buildings.d.ts +427 -0
- package/dist/api/core/buildings.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +230 -0
- package/dist/api/core/comment/index.d.ts.map +1 -0
- package/dist/api/core/geom/create/index.d.ts +247 -0
- package/dist/api/core/geom/create/index.d.ts.map +1 -0
- package/dist/api/core/geom/delete/index.d.ts +72 -0
- package/dist/api/core/geom/delete/index.d.ts.map +1 -0
- package/dist/api/core/geom/index.d.ts +24 -23
- package/dist/api/core/geom/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +169 -0
- package/dist/api/core/geom/query/arc.d.ts.map +1 -0
- package/dist/api/core/geom/query/brep.d.ts +402 -0
- package/dist/api/core/geom/query/brep.d.ts.map +1 -0
- package/dist/api/core/geom/query/circle.d.ts +378 -0
- package/dist/api/core/geom/query/circle.d.ts.map +1 -0
- package/dist/api/core/geom/query/contour.d.ts +450 -0
- package/dist/api/core/geom/query/contour.d.ts.map +1 -0
- package/dist/api/core/geom/query/curve.d.ts +918 -0
- package/dist/api/core/geom/query/curve.d.ts.map +1 -0
- package/dist/api/core/geom/query/edge.d.ts +128 -0
- package/dist/api/core/geom/query/edge.d.ts.map +1 -0
- package/dist/api/core/geom/query/face.d.ts +363 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -0
- package/dist/api/core/geom/query/halfedge.d.ts +206 -0
- package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
- package/dist/api/core/geom/query/index.d.ts +61 -0
- package/dist/api/core/geom/query/index.d.ts.map +1 -0
- package/dist/api/core/geom/query/profile.d.ts +410 -0
- package/dist/api/core/geom/query/profile.d.ts.map +1 -0
- package/dist/api/core/geom/query/vertex.d.ts +187 -0
- package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
- package/dist/api/core/geom/update/contour.d.ts +272 -0
- package/dist/api/core/geom/update/contour.d.ts.map +1 -0
- package/dist/api/core/geom/update/curve.d.ts +180 -0
- package/dist/api/core/geom/update/curve.d.ts.map +1 -0
- package/dist/api/core/geom/update/index.d.ts +27 -0
- package/dist/api/core/geom/update/index.d.ts.map +1 -0
- package/dist/api/core/geom/update/profile.d.ts +329 -0
- package/dist/api/core/geom/update/profile.d.ts.map +1 -0
- package/dist/api/core/groups.d.ts +485 -0
- package/dist/api/core/groups.d.ts.map +1 -0
- package/dist/api/core/history/index.d.ts +78 -0
- package/dist/api/core/history/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +46 -1
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/layers.d.ts +402 -0
- package/dist/api/core/layers.d.ts.map +1 -0
- package/dist/api/core/math/quat.d.ts +111 -128
- package/dist/api/core/math/quat.d.ts.map +1 -1
- package/dist/api/core/math/vec3.d.ts +120 -102
- package/dist/api/core/math/vec3.d.ts.map +1 -1
- package/dist/api/core/project/index.d.ts +399 -0
- package/dist/api/core/project/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +755 -0
- package/dist/api/core/tags.d.ts.map +1 -0
- package/dist/api/core/units/index.d.ts +175 -0
- package/dist/api/core/units/index.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +45 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +168 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +828 -0
- package/dist/api/design/create/index.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +63 -0
- package/dist/api/design/delete/index.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +268 -0
- package/dist/api/design/doors/index.d.ts.map +1 -0
- package/dist/api/design/edit/index.d.ts +49 -0
- package/dist/api/design/edit/index.d.ts.map +1 -0
- package/dist/api/design/erase/index.d.ts +160 -0
- package/dist/api/design/erase/index.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +123 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +153 -0
- package/dist/api/design/index.d.ts.map +1 -0
- package/dist/api/design/lock.d.ts +41 -0
- package/dist/api/design/lock.d.ts.map +1 -0
- package/dist/api/design/materials/index.d.ts +297 -0
- package/dist/api/design/materials/index.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +140 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +1011 -0
- package/dist/api/design/query/index.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +221 -0
- package/dist/api/design/query/spaces.d.ts.map +1 -0
- package/dist/api/design/selection/index.d.ts +138 -0
- package/dist/api/design/selection/index.d.ts.map +1 -0
- package/dist/api/design/shared.d.ts +38 -0
- package/dist/api/design/shared.d.ts.map +1 -0
- package/dist/api/design/transform/index.d.ts +87 -0
- package/dist/api/design/transform/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +178 -0
- package/dist/api/design/update/index.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +189 -0
- package/dist/api/design/windows/index.d.ts.map +1 -0
- package/dist/api/entity/buildableEnvelope.d.ts +261 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
- package/dist/api/entity/department.d.ts +0 -98
- package/dist/api/entity/department.d.ts.map +1 -1
- package/dist/api/entity/index.d.ts +9 -9
- package/dist/api/entity/index.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +49 -106
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +482 -249
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +49 -39
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +17 -12
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +440 -0
- package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +81 -0
- package/dist/api/presentation/diagrams.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +113 -0
- package/dist/api/presentation/import.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +46 -0
- package/dist/api/presentation/index.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +176 -0
- package/dist/api/presentation/sheets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +296 -0
- package/dist/api/presentation/views.d.ts.map +1 -0
- package/dist/api/program/adjacency.d.ts +155 -0
- package/dist/api/program/adjacency.d.ts.map +1 -0
- package/dist/api/program/areas.d.ts +360 -0
- package/dist/api/program/areas.d.ts.map +1 -0
- package/dist/api/program/classification.d.ts +135 -0
- package/dist/api/program/classification.d.ts.map +1 -0
- package/dist/api/program/cores.d.ts +174 -0
- package/dist/api/program/cores.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +431 -0
- package/dist/api/program/departments.d.ts.map +1 -0
- package/dist/api/program/index.d.ts +69 -0
- package/dist/api/program/index.d.ts.map +1 -0
- package/dist/api/program/layout.d.ts +63 -0
- package/dist/api/program/layout.d.ts.map +1 -0
- package/dist/api/program/metrics.d.ts +108 -0
- package/dist/api/program/metrics.d.ts.map +1 -0
- package/dist/api/program/site.d.ts +367 -0
- package/dist/api/program/site.d.ts.map +1 -0
- package/dist/api/program/spreadsheet.d.ts +2041 -0
- package/dist/api/program/spreadsheet.d.ts.map +1 -0
- package/dist/handles.d.ts +138 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/host-utils.d.ts +7 -5
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4001 -904
- 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 +3392 -870
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/scripts/generate-manifest.mjs +193 -0
- package/scripts/generate-manifest.test.mjs +193 -0
- package/src/api/core/buildings.ts +485 -0
- package/src/api/core/comment/index.ts +258 -0
- package/src/api/core/geom/create/index.ts +293 -0
- package/src/api/core/geom/delete/index.ts +78 -0
- package/src/api/core/geom/index.ts +24 -23
- package/src/api/core/geom/query/arc.ts +169 -0
- package/src/api/core/geom/query/brep.ts +444 -0
- package/src/api/core/geom/query/circle.ts +404 -0
- package/src/api/core/geom/query/contour.ts +540 -0
- package/src/api/core/geom/query/curve.ts +1078 -0
- package/src/api/core/geom/query/edge.ts +130 -0
- package/src/api/core/geom/query/face.ts +403 -0
- package/src/api/core/geom/query/halfedge.ts +210 -0
- package/src/api/core/geom/query/index.ts +63 -0
- package/src/api/core/geom/query/profile.ts +473 -0
- package/src/api/core/geom/query/vertex.ts +205 -0
- package/src/api/core/geom/update/contour.ts +315 -0
- package/src/api/core/geom/update/curve.ts +209 -0
- package/src/api/core/geom/update/index.ts +29 -0
- package/src/api/core/geom/update/profile.ts +377 -0
- package/src/api/core/groups.ts +521 -0
- package/src/api/core/history/index.ts +84 -0
- package/src/api/core/index.ts +46 -1
- package/src/api/core/layers.ts +333 -0
- package/src/api/core/math/quat.ts +112 -235
- package/src/api/core/math/vec3.ts +124 -159
- package/src/api/core/project/index.ts +418 -0
- package/src/api/core/tags.ts +808 -0
- package/src/api/core/units/index.ts +164 -0
- package/src/api/core/zoom/index.ts +47 -0
- package/src/api/design/boolean/index.ts +179 -0
- package/src/api/design/create/index.ts +886 -0
- package/src/api/design/delete/index.ts +67 -0
- package/src/api/design/doors/index.ts +285 -0
- package/src/api/design/edit/index.ts +54 -0
- package/src/api/design/erase/index.ts +151 -0
- package/src/api/design/furniture/index.ts +130 -0
- package/src/api/design/index.ts +162 -0
- package/src/api/design/lock.ts +42 -0
- package/src/api/design/materials/index.ts +301 -0
- package/src/api/design/query/geometry/index.ts +166 -0
- package/src/api/design/query/index.ts +937 -0
- package/src/api/design/query/spaces.ts +132 -0
- package/src/api/design/selection/index.ts +144 -0
- package/src/api/design/shared.ts +40 -0
- package/src/api/design/transform/index.ts +93 -0
- package/src/api/design/update/index.ts +117 -0
- package/src/api/design/windows/index.ts +207 -0
- package/src/api/entity/buildableEnvelope.ts +318 -0
- package/src/api/entity/department.ts +0 -113
- package/src/api/entity/index.ts +9 -9
- package/src/api/entity/referenceLine.ts +50 -38
- package/src/api/entity/space.ts +285 -226
- package/src/api/entity/story.ts +53 -42
- package/src/api/index.ts +17 -12
- package/src/api/presentation/aiInspiration.ts +362 -0
- package/src/api/presentation/diagrams.ts +84 -0
- package/src/api/presentation/import.ts +112 -0
- package/src/api/presentation/index.ts +48 -0
- package/src/api/presentation/sheets.ts +198 -0
- package/src/api/presentation/views.ts +303 -0
- package/src/api/program/adjacency.ts +164 -0
- package/src/api/program/areas.ts +335 -0
- package/src/api/program/classification.ts +138 -0
- package/src/api/program/cores.ts +171 -0
- package/src/api/program/departments.ts +465 -0
- package/src/api/program/index.ts +71 -0
- package/src/api/program/layout.ts +68 -0
- package/src/api/program/metrics.ts +120 -0
- package/src/api/program/site.ts +326 -0
- package/src/api/program/spreadsheet.ts +2075 -0
- package/src/handles.ts +148 -0
- package/src/host-utils.ts +10 -6
- package/src/index.ts +1 -0
- package/dist/api/core/geom/arc.d.ts +0 -81
- package/dist/api/core/geom/arc.d.ts.map +0 -1
- package/dist/api/core/geom/curve.d.ts +0 -70
- package/dist/api/core/geom/curve.d.ts.map +0 -1
- package/dist/api/core/geom/line.d.ts +0 -56
- package/dist/api/core/geom/line.d.ts.map +0 -1
- package/dist/api/core/geom/profile.d.ts +0 -121
- package/dist/api/core/geom/profile.d.ts.map +0 -1
- package/dist/api/tools/copy.d.ts +0 -59
- package/dist/api/tools/copy.d.ts.map +0 -1
- package/dist/api/tools/index.d.ts +0 -33
- package/dist/api/tools/index.d.ts.map +0 -1
- package/dist/api/tools/material.d.ts +0 -51
- package/dist/api/tools/material.d.ts.map +0 -1
- package/dist/api/tools/offset.d.ts +0 -43
- package/dist/api/tools/offset.d.ts.map +0 -1
- package/dist/api/tools/selection.d.ts +0 -48
- package/dist/api/tools/selection.d.ts.map +0 -1
- package/dist/api/tools/transform.d.ts +0 -114
- package/dist/api/tools/transform.d.ts.map +0 -1
- package/dist/api/units/index.d.ts +0 -163
- package/dist/api/units/index.d.ts.map +0 -1
- package/src/api/core/geom/arc.ts +0 -70
- package/src/api/core/geom/curve.ts +0 -41
- package/src/api/core/geom/line.ts +0 -53
- package/src/api/core/geom/profile.ts +0 -94
- package/src/api/tools/copy.ts +0 -55
- package/src/api/tools/index.ts +0 -39
- package/src/api/tools/material.ts +0 -49
- package/src/api/tools/offset.ts +0 -43
- package/src/api/tools/selection.ts +0 -51
- package/src/api/tools/transform.ts +0 -117
- package/src/api/units/index.ts +0 -163
package/src/api/entity/story.ts
CHANGED
|
@@ -19,30 +19,32 @@ export abstract class PluginStoryApi {
|
|
|
19
19
|
/**
|
|
20
20
|
* Get properties of a story by its storey number.
|
|
21
21
|
*
|
|
22
|
-
* Only the properties listed in
|
|
22
|
+
* Only the properties listed in `properties`
|
|
23
23
|
* are returned — unlisted properties will be `undefined` in the result.
|
|
24
24
|
*
|
|
25
|
-
* @param
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* to retrieve. See {@linkcode PluginStoryGetProperty} for available values.
|
|
25
|
+
* @param storyValue - Integer storey number
|
|
26
|
+
* (e.g. `1` for ground floor, `2` for first floor, `-1` for basement)
|
|
27
|
+
* @param properties - Array of property names
|
|
28
|
+
* to retrieve. See {@linkcode PluginStoryGetProperty} for available values.
|
|
30
29
|
* @returns A partial {@linkcode PluginStoryGetResult} containing only the requested properties
|
|
31
30
|
* @throws If the story with the given value does not exist
|
|
32
31
|
*
|
|
32
|
+
* @examplePrompt What is the height of the ground floor?
|
|
33
|
+
* @examplePrompt How many rooms are on the second storey?
|
|
34
|
+
* @examplePrompt Get the total floor area of level 3
|
|
35
|
+
* @examplePrompt Is the first floor hidden in the viewport?
|
|
36
|
+
* @examplePrompt Show me the name and height of story 2
|
|
37
|
+
*
|
|
33
38
|
* # Example
|
|
34
39
|
* ```ts
|
|
35
|
-
* const info = await snaptrude.entity.story.get(
|
|
36
|
-
* storyValue: 1,
|
|
37
|
-
* properties: ["height", "name", "spacesCount"],
|
|
38
|
-
* })
|
|
40
|
+
* const info = await snaptrude.entity.story.get(1, ["height", "name", "spacesCount"])
|
|
39
41
|
* console.log(info.name, info.height, info.spacesCount)
|
|
40
42
|
* ```
|
|
41
43
|
*/
|
|
42
|
-
public abstract get(
|
|
43
|
-
storyValue,
|
|
44
|
-
properties,
|
|
45
|
-
|
|
44
|
+
public abstract get(
|
|
45
|
+
storyValue: number,
|
|
46
|
+
properties: PluginStoryGetProperty[],
|
|
47
|
+
): PluginApiReturn<PluginStoryGetResult>
|
|
46
48
|
|
|
47
49
|
/**
|
|
48
50
|
* Get all stories in the current project.
|
|
@@ -53,6 +55,11 @@ export abstract class PluginStoryApi {
|
|
|
53
55
|
* @returns A {@linkcode PluginStoryGetAllResult} with a `stories` array,
|
|
54
56
|
* each entry containing `value`, `id`, and `name`
|
|
55
57
|
*
|
|
58
|
+
* @examplePrompt How many floors does this building have?
|
|
59
|
+
* @examplePrompt List all the storeys in the project
|
|
60
|
+
* @examplePrompt Show me every level with its name
|
|
61
|
+
* @examplePrompt Which stories exist in this model?
|
|
62
|
+
*
|
|
56
63
|
* # Example
|
|
57
64
|
* ```ts
|
|
58
65
|
* const { stories } = await snaptrude.entity.story.getAll()
|
|
@@ -67,30 +74,31 @@ export abstract class PluginStoryApi {
|
|
|
67
74
|
* Create a new story (floor) in the project.
|
|
68
75
|
*
|
|
69
76
|
* The new story is inserted at the position specified by
|
|
70
|
-
*
|
|
71
|
-
* operation is undoable.
|
|
77
|
+
* `storyValue`. This operation is undoable.
|
|
72
78
|
*
|
|
73
|
-
* @param
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* units. If omitted, the project's default storey height is used.
|
|
79
|
+
* @param storyValue - Integer storey number
|
|
80
|
+
* to create (e.g. `3` to add a third floor)
|
|
81
|
+
* @param height - Optional height in Babylon
|
|
82
|
+
* units. If omitted, the project's default storey height is used.
|
|
78
83
|
* @returns A {@linkcode PluginStoryCreateResult} with `storyId` and `storyValue`
|
|
79
84
|
* @throws If a story with the given value already exists or creation fails
|
|
80
85
|
*
|
|
86
|
+
* @examplePrompt Add a third floor to the building
|
|
87
|
+
* @examplePrompt Create a new storey above the second floor
|
|
88
|
+
* @examplePrompt Add a basement level to this project
|
|
89
|
+
* @examplePrompt Insert a new level with a custom floor height
|
|
90
|
+
* @examplePrompt Add another floor on top of the building
|
|
91
|
+
*
|
|
81
92
|
* # Example
|
|
82
93
|
* ```ts
|
|
83
94
|
* // Create a new third floor with custom height
|
|
84
|
-
* const { storyId } = await snaptrude.entity.story.create(
|
|
85
|
-
* storyValue: 3,
|
|
86
|
-
* height: 4.5,
|
|
87
|
-
* })
|
|
95
|
+
* const { storyId } = await snaptrude.entity.story.create(3, 4.5)
|
|
88
96
|
* ```
|
|
89
97
|
*/
|
|
90
|
-
public abstract create(
|
|
91
|
-
storyValue,
|
|
92
|
-
height,
|
|
93
|
-
|
|
98
|
+
public abstract create(
|
|
99
|
+
storyValue: number,
|
|
100
|
+
height?: number,
|
|
101
|
+
): PluginApiReturn<PluginStoryCreateResult>
|
|
94
102
|
|
|
95
103
|
/**
|
|
96
104
|
* Update a story's height.
|
|
@@ -98,27 +106,28 @@ export abstract class PluginStoryApi {
|
|
|
98
106
|
* Changes the floor-to-floor height of the specified story. This
|
|
99
107
|
* operation is undoable.
|
|
100
108
|
*
|
|
101
|
-
* @param
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* units
|
|
109
|
+
* @param storyValue - Integer storey number
|
|
110
|
+
* identifying the story to update
|
|
111
|
+
* @param height - New height value in Babylon
|
|
112
|
+
* units
|
|
106
113
|
* @returns A {@linkcode PluginStoryUpdateResult} with the updated `storyValue` and `height`
|
|
107
114
|
* @throws If the story does not exist or the update fails
|
|
108
115
|
*
|
|
116
|
+
* @examplePrompt Change the ground floor height to 3.5 metres
|
|
117
|
+
* @examplePrompt Make the second storey taller
|
|
118
|
+
* @examplePrompt Set the floor-to-floor height of level 1
|
|
119
|
+
* @examplePrompt Increase the height of the third floor
|
|
120
|
+
*
|
|
109
121
|
* # Example
|
|
110
122
|
* ```ts
|
|
111
123
|
* // Set ground floor height to 5 Babylon units
|
|
112
|
-
* const result = await snaptrude.entity.story.update(
|
|
113
|
-
* storyValue: 1,
|
|
114
|
-
* height: 5,
|
|
115
|
-
* })
|
|
124
|
+
* const result = await snaptrude.entity.story.update(1, 5)
|
|
116
125
|
* ```
|
|
117
126
|
*/
|
|
118
|
-
public abstract update(
|
|
119
|
-
storyValue,
|
|
120
|
-
height,
|
|
121
|
-
|
|
127
|
+
public abstract update(
|
|
128
|
+
storyValue: number,
|
|
129
|
+
height: number,
|
|
130
|
+
): PluginApiReturn<PluginStoryUpdateResult>
|
|
122
131
|
}
|
|
123
132
|
|
|
124
133
|
/**
|
|
@@ -146,6 +155,8 @@ export const PluginStoryGetProperty = z.enum([
|
|
|
146
155
|
"totalArea",
|
|
147
156
|
])
|
|
148
157
|
|
|
158
|
+
export type PluginStoryGetProperty = z.infer<typeof PluginStoryGetProperty>
|
|
159
|
+
|
|
149
160
|
/**
|
|
150
161
|
* Arguments for {@linkcode PluginStoryApi.get}.
|
|
151
162
|
*
|
package/src/api/index.ts
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
import { PluginCoreApi } from "./core"
|
|
2
|
+
import { PluginDesignApi } from "./design"
|
|
2
3
|
import { PluginEntityApi } from "./entity"
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { PluginProgramApi } from "./program"
|
|
5
|
+
import { PluginPresentationApi } from "./presentation"
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Root API surface for Snaptrude plugins.
|
|
8
9
|
*
|
|
9
10
|
* Access all plugin capabilities through the namespaced properties:
|
|
10
11
|
*
|
|
11
|
-
* - {@linkcode PluginApi.core} — Math
|
|
12
|
+
* - {@linkcode PluginApi.core} — Math, geometry kernel, history, units, zoom, project, comments (infrastructure)
|
|
13
|
+
* - {@linkcode PluginApi.design} — Author, query & edit BIM geometry
|
|
12
14
|
* - {@linkcode PluginApi.entity} — CRUD operations on Snaptrude entities (spaces, stories)
|
|
13
|
-
* - {@linkcode PluginApi.
|
|
14
|
-
* - {@linkcode PluginApi.
|
|
15
|
+
* - {@linkcode PluginApi.program} — Program-mode planning reads (departments, metrics)
|
|
16
|
+
* - {@linkcode PluginApi.presentation} — Presentation preparation (views, AI Inspiration)
|
|
15
17
|
*/
|
|
16
18
|
export abstract class PluginApi {
|
|
17
|
-
/** Core math and
|
|
19
|
+
/** Core math, geometry, history, and units primitives. See {@linkcode PluginCoreApi}. */
|
|
18
20
|
public abstract core: PluginCoreApi
|
|
19
|
-
/**
|
|
20
|
-
public abstract
|
|
21
|
+
/** Author, query & edit BIM geometry. See {@linkcode PluginDesignApi}. */
|
|
22
|
+
public abstract design: PluginDesignApi
|
|
21
23
|
/** CRUD operations on Snaptrude entities. See {@linkcode PluginEntityApi}. */
|
|
22
24
|
public abstract entity: PluginEntityApi
|
|
23
|
-
/**
|
|
24
|
-
public abstract
|
|
25
|
+
/** Program-mode planning reads — departments and area metrics. See {@linkcode PluginProgramApi}. */
|
|
26
|
+
public abstract program: PluginProgramApi
|
|
27
|
+
/** Presentation preparation reads — saved views. See {@linkcode PluginPresentationApi}. */
|
|
28
|
+
public abstract presentation: PluginPresentationApi
|
|
25
29
|
|
|
26
30
|
constructor() {}
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
export * from "./core"
|
|
34
|
+
export * from "./design"
|
|
30
35
|
export * from "./entity"
|
|
31
|
-
export * from "./
|
|
32
|
-
export * from "./
|
|
36
|
+
export * from "./program"
|
|
37
|
+
export * from "./presentation"
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import type { PluginApiReturn } from "../../types"
|
|
3
|
+
|
|
4
|
+
const JsonPrimitive = z.union([z.string(), z.number(), z.boolean(), z.null()])
|
|
5
|
+
type JsonValue =
|
|
6
|
+
| z.infer<typeof JsonPrimitive>
|
|
7
|
+
| JsonValue[]
|
|
8
|
+
| { [key: string]: JsonValue }
|
|
9
|
+
const JsonValue: z.ZodType<JsonValue> = z.lazy(() =>
|
|
10
|
+
z.union([JsonPrimitive, z.array(JsonValue), z.record(z.string(), JsonValue)]),
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
export const PluginAIInspirationOutputKind = z.enum([
|
|
14
|
+
"source",
|
|
15
|
+
"image",
|
|
16
|
+
"video",
|
|
17
|
+
])
|
|
18
|
+
export type PluginAIInspirationOutputKind = z.infer<
|
|
19
|
+
typeof PluginAIInspirationOutputKind
|
|
20
|
+
>
|
|
21
|
+
|
|
22
|
+
export const PluginAIInspirationModelOutput = z.enum(["image", "video"])
|
|
23
|
+
export type PluginAIInspirationModelOutput = z.infer<
|
|
24
|
+
typeof PluginAIInspirationModelOutput
|
|
25
|
+
>
|
|
26
|
+
|
|
27
|
+
export const PluginAIInspirationShapeKind = z.enum(["image", "view", "video"])
|
|
28
|
+
export type PluginAIInspirationShapeKind = z.infer<
|
|
29
|
+
typeof PluginAIInspirationShapeKind
|
|
30
|
+
>
|
|
31
|
+
|
|
32
|
+
export const PluginAIInspirationVideoMode = z.enum([
|
|
33
|
+
"animate",
|
|
34
|
+
"references",
|
|
35
|
+
"keyframes",
|
|
36
|
+
])
|
|
37
|
+
export type PluginAIInspirationVideoMode = z.infer<
|
|
38
|
+
typeof PluginAIInspirationVideoMode
|
|
39
|
+
>
|
|
40
|
+
|
|
41
|
+
export const PluginAIInspirationVideoMotion = z.enum([
|
|
42
|
+
"auto",
|
|
43
|
+
"slow-dolly",
|
|
44
|
+
"subtle-orbit",
|
|
45
|
+
"reveal",
|
|
46
|
+
])
|
|
47
|
+
export type PluginAIInspirationVideoMotion = z.infer<
|
|
48
|
+
typeof PluginAIInspirationVideoMotion
|
|
49
|
+
>
|
|
50
|
+
|
|
51
|
+
export const PluginAIInspirationVideoDuration = z.enum(["4s", "6s", "8s"])
|
|
52
|
+
export type PluginAIInspirationVideoDuration = z.infer<
|
|
53
|
+
typeof PluginAIInspirationVideoDuration
|
|
54
|
+
>
|
|
55
|
+
|
|
56
|
+
export const PluginAIInspirationRegionHint = z.object({
|
|
57
|
+
x: z.number().finite(),
|
|
58
|
+
y: z.number().finite(),
|
|
59
|
+
w: z.number().finite().positive(),
|
|
60
|
+
h: z.number().finite().positive(),
|
|
61
|
+
})
|
|
62
|
+
export type PluginAIInspirationRegionHint = z.infer<
|
|
63
|
+
typeof PluginAIInspirationRegionHint
|
|
64
|
+
>
|
|
65
|
+
|
|
66
|
+
export const PluginAIInspirationPoint = z.object({
|
|
67
|
+
x: z.number().finite(),
|
|
68
|
+
y: z.number().finite(),
|
|
69
|
+
})
|
|
70
|
+
export type PluginAIInspirationPoint = z.infer<typeof PluginAIInspirationPoint>
|
|
71
|
+
|
|
72
|
+
export const PluginAIInspirationTextAnnotation = z.object({
|
|
73
|
+
text: z.string().min(1),
|
|
74
|
+
x: z.number().finite().optional(),
|
|
75
|
+
y: z.number().finite().optional(),
|
|
76
|
+
})
|
|
77
|
+
export type PluginAIInspirationTextAnnotation = z.infer<
|
|
78
|
+
typeof PluginAIInspirationTextAnnotation
|
|
79
|
+
>
|
|
80
|
+
|
|
81
|
+
export const PluginAIInspirationSketchGuidance = z.object({
|
|
82
|
+
visualShapeIds: z.array(z.string()).optional(),
|
|
83
|
+
textAnnotations: z.array(PluginAIInspirationTextAnnotation).optional(),
|
|
84
|
+
})
|
|
85
|
+
export type PluginAIInspirationSketchGuidance = z.infer<
|
|
86
|
+
typeof PluginAIInspirationSketchGuidance
|
|
87
|
+
>
|
|
88
|
+
|
|
89
|
+
export const PluginAIInspirationSiteOptions = z.object({
|
|
90
|
+
includeSatellite: z.boolean().optional(),
|
|
91
|
+
includeStreetView: z.boolean().optional(),
|
|
92
|
+
includeAerial: z.boolean().optional(),
|
|
93
|
+
aerialBearing: z.number().finite().optional(),
|
|
94
|
+
aerialPitch: z.number().finite().optional(),
|
|
95
|
+
selectedDiagramIds: z.array(z.string()).optional(),
|
|
96
|
+
location: z
|
|
97
|
+
.object({
|
|
98
|
+
lat: z.number().finite(),
|
|
99
|
+
lng: z.number().finite(),
|
|
100
|
+
})
|
|
101
|
+
.optional(),
|
|
102
|
+
})
|
|
103
|
+
export type PluginAIInspirationSiteOptions = z.infer<
|
|
104
|
+
typeof PluginAIInspirationSiteOptions
|
|
105
|
+
>
|
|
106
|
+
|
|
107
|
+
export const PluginAIInspirationAppliedPreset = z.object({
|
|
108
|
+
source: z.enum(["curated", "user"]),
|
|
109
|
+
presetId: z.string().min(1),
|
|
110
|
+
name: z.string().min(1),
|
|
111
|
+
savedPresetKind: z.enum(["prompt", "style"]).optional(),
|
|
112
|
+
stylePrompt: z.string().optional(),
|
|
113
|
+
modelId: z.string().optional(),
|
|
114
|
+
referenceImages: z
|
|
115
|
+
.array(
|
|
116
|
+
z.object({
|
|
117
|
+
url: z.string().min(1),
|
|
118
|
+
label: z.string().optional(),
|
|
119
|
+
weight: z.number().finite().optional(),
|
|
120
|
+
}),
|
|
121
|
+
)
|
|
122
|
+
.optional(),
|
|
123
|
+
siteDefaults: z
|
|
124
|
+
.object({
|
|
125
|
+
includeSatellite: z.boolean().optional(),
|
|
126
|
+
includeStreetView: z.boolean().optional(),
|
|
127
|
+
includeAerial: z.boolean().optional(),
|
|
128
|
+
})
|
|
129
|
+
.optional(),
|
|
130
|
+
})
|
|
131
|
+
export type PluginAIInspirationAppliedPreset = z.infer<
|
|
132
|
+
typeof PluginAIInspirationAppliedPreset
|
|
133
|
+
>
|
|
134
|
+
|
|
135
|
+
export const PluginAIInspirationVideoOptions = z.object({
|
|
136
|
+
mode: PluginAIInspirationVideoMode.optional(),
|
|
137
|
+
endFrameShapeId: z.string().optional(),
|
|
138
|
+
motion: PluginAIInspirationVideoMotion.optional(),
|
|
139
|
+
duration: PluginAIInspirationVideoDuration.optional(),
|
|
140
|
+
})
|
|
141
|
+
export type PluginAIInspirationVideoOptions = z.infer<
|
|
142
|
+
typeof PluginAIInspirationVideoOptions
|
|
143
|
+
>
|
|
144
|
+
|
|
145
|
+
export const PluginAIInspirationModel = z.object({
|
|
146
|
+
id: z.string(),
|
|
147
|
+
label: z.string(),
|
|
148
|
+
supportsMultiImage: z.boolean(),
|
|
149
|
+
output: PluginAIInspirationModelOutput,
|
|
150
|
+
isDefault: z.boolean().optional(),
|
|
151
|
+
})
|
|
152
|
+
export type PluginAIInspirationModel = z.infer<typeof PluginAIInspirationModel>
|
|
153
|
+
|
|
154
|
+
export const PluginAIInspirationListModelsResult = z.object({
|
|
155
|
+
defaultModelId: z.string(),
|
|
156
|
+
models: z.array(PluginAIInspirationModel),
|
|
157
|
+
})
|
|
158
|
+
export type PluginAIInspirationListModelsResult = z.infer<
|
|
159
|
+
typeof PluginAIInspirationListModelsResult
|
|
160
|
+
>
|
|
161
|
+
|
|
162
|
+
export const PluginAIInspirationShapeRef = z.object({
|
|
163
|
+
shapeId: z.string(),
|
|
164
|
+
assetId: z.string().optional(),
|
|
165
|
+
kind: PluginAIInspirationShapeKind,
|
|
166
|
+
name: z.string().optional(),
|
|
167
|
+
width: z.number().finite().optional(),
|
|
168
|
+
height: z.number().finite().optional(),
|
|
169
|
+
outputType: PluginAIInspirationOutputKind.optional(),
|
|
170
|
+
sourceUrl: z.string().optional(),
|
|
171
|
+
})
|
|
172
|
+
export type PluginAIInspirationShapeRef = z.infer<
|
|
173
|
+
typeof PluginAIInspirationShapeRef
|
|
174
|
+
>
|
|
175
|
+
|
|
176
|
+
export const PluginAIInspirationListSourcesArgs = z.object({
|
|
177
|
+
includeGenerated: z.boolean().optional(),
|
|
178
|
+
includeSourceUrl: z.boolean().optional(),
|
|
179
|
+
})
|
|
180
|
+
export type PluginAIInspirationListSourcesArgs = z.infer<
|
|
181
|
+
typeof PluginAIInspirationListSourcesArgs
|
|
182
|
+
>
|
|
183
|
+
|
|
184
|
+
export const PluginAIInspirationListSourcesResult = z.object({
|
|
185
|
+
sources: z.array(PluginAIInspirationShapeRef),
|
|
186
|
+
})
|
|
187
|
+
export type PluginAIInspirationListSourcesResult = z.infer<
|
|
188
|
+
typeof PluginAIInspirationListSourcesResult
|
|
189
|
+
>
|
|
190
|
+
|
|
191
|
+
export const PluginAIInspirationOutput = z.object({
|
|
192
|
+
outputType: z.enum(["image", "video"]),
|
|
193
|
+
shapeId: z.string(),
|
|
194
|
+
assetId: z.string(),
|
|
195
|
+
outputUrl: z.string().optional(),
|
|
196
|
+
position: PluginAIInspirationPoint.optional(),
|
|
197
|
+
})
|
|
198
|
+
export type PluginAIInspirationOutput = z.infer<
|
|
199
|
+
typeof PluginAIInspirationOutput
|
|
200
|
+
>
|
|
201
|
+
|
|
202
|
+
export const PluginAIInspirationDebugSummary = z.record(z.string(), JsonValue)
|
|
203
|
+
export type PluginAIInspirationDebugSummary = z.infer<
|
|
204
|
+
typeof PluginAIInspirationDebugSummary
|
|
205
|
+
>
|
|
206
|
+
|
|
207
|
+
export const PluginAIInspirationRunMetadata = z.object({
|
|
208
|
+
geometryFidelity: z.string().optional(),
|
|
209
|
+
debugSummary: PluginAIInspirationDebugSummary.optional(),
|
|
210
|
+
streetViewComposite: z
|
|
211
|
+
.object({
|
|
212
|
+
used: z.boolean(),
|
|
213
|
+
renderMode: z.enum(["prompt_refs_default", "masked_composite_pilot"]),
|
|
214
|
+
backgroundLabel: z.string().optional(),
|
|
215
|
+
})
|
|
216
|
+
.optional(),
|
|
217
|
+
})
|
|
218
|
+
export type PluginAIInspirationRunMetadata = z.infer<
|
|
219
|
+
typeof PluginAIInspirationRunMetadata
|
|
220
|
+
>
|
|
221
|
+
|
|
222
|
+
export const PluginAIInspirationGenerateArgs = z.object({
|
|
223
|
+
sourceShapeId: z.string().min(1),
|
|
224
|
+
prompt: z.string().min(1).max(8000),
|
|
225
|
+
modelId: z.string().optional(),
|
|
226
|
+
referenceShapeIds: z.array(z.string()).max(12).optional(),
|
|
227
|
+
referenceStrength: z.enum(["low", "medium", "high"]).optional(),
|
|
228
|
+
appliedPreset: PluginAIInspirationAppliedPreset.optional(),
|
|
229
|
+
site: PluginAIInspirationSiteOptions.optional(),
|
|
230
|
+
regionHint: PluginAIInspirationRegionHint.optional(),
|
|
231
|
+
sketchGuidance: PluginAIInspirationSketchGuidance.optional(),
|
|
232
|
+
video: PluginAIInspirationVideoOptions.optional(),
|
|
233
|
+
})
|
|
234
|
+
export type PluginAIInspirationGenerateArgs = z.infer<
|
|
235
|
+
typeof PluginAIInspirationGenerateArgs
|
|
236
|
+
>
|
|
237
|
+
|
|
238
|
+
export const PluginAIInspirationRunResult = z.object({
|
|
239
|
+
outputs: z.array(PluginAIInspirationOutput).min(1),
|
|
240
|
+
metadata: PluginAIInspirationRunMetadata.optional(),
|
|
241
|
+
})
|
|
242
|
+
export type PluginAIInspirationRunResult = z.infer<
|
|
243
|
+
typeof PluginAIInspirationRunResult
|
|
244
|
+
>
|
|
245
|
+
|
|
246
|
+
export const PluginAIInspirationRefineArgs = z.object({
|
|
247
|
+
sourceShapeId: z.string().min(1),
|
|
248
|
+
upscaleFactor: z
|
|
249
|
+
.union([z.literal(1.5), z.literal(2), z.literal(4)])
|
|
250
|
+
.optional(),
|
|
251
|
+
})
|
|
252
|
+
export type PluginAIInspirationRefineArgs = z.infer<
|
|
253
|
+
typeof PluginAIInspirationRefineArgs
|
|
254
|
+
>
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Present-mode AI Inspiration APIs.
|
|
258
|
+
*
|
|
259
|
+
* These APIs operate on Present canvas shape IDs and inherit the current user's
|
|
260
|
+
* AI quota. They create outputs on the Present canvas; pure backend generation
|
|
261
|
+
* without canvas output is intentionally out of scope.
|
|
262
|
+
*
|
|
263
|
+
* Accessed via `snaptrude.presentation.aiInspiration`.
|
|
264
|
+
*/
|
|
265
|
+
export abstract class PluginPresentationAIInspirationApi {
|
|
266
|
+
constructor() {}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* List AI Inspiration models that can be used for generation.
|
|
270
|
+
*
|
|
271
|
+
* @returns The default model ID and available model descriptors.
|
|
272
|
+
*
|
|
273
|
+
* @examplePrompt What AI inspiration models can I use?
|
|
274
|
+
* @examplePrompt List the available image and video models
|
|
275
|
+
* @examplePrompt Which generation model is the default?
|
|
276
|
+
*
|
|
277
|
+
* # Example
|
|
278
|
+
* ```ts
|
|
279
|
+
* const { defaultModelId, models } = await snaptrude.presentation.aiInspiration.listModels()
|
|
280
|
+
* const videoModels = models.filter((m) => m.output === "video")
|
|
281
|
+
* console.log(defaultModelId, videoModels.map((m) => m.id))
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
public abstract listModels(): PluginApiReturn<PluginAIInspirationListModelsResult>
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* List image/view/video sources on the current Present page.
|
|
288
|
+
*
|
|
289
|
+
* @param args - Optional filters. Set `includeGenerated` to include AI outputs.
|
|
290
|
+
* @returns Serializable shape references using Present canvas shape IDs.
|
|
291
|
+
*
|
|
292
|
+
* @examplePrompt List the images I can generate from on this page
|
|
293
|
+
* @examplePrompt What source shapes are on the present canvas?
|
|
294
|
+
* @examplePrompt Show me the reference images available for AI generation
|
|
295
|
+
*
|
|
296
|
+
* # Example
|
|
297
|
+
* ```ts
|
|
298
|
+
* const { sources } = await snaptrude.presentation.aiInspiration.listSources({ includeGenerated: true })
|
|
299
|
+
* for (const s of sources) console.log(s.kind, s.shapeId, s.name)
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
public abstract listSources(
|
|
303
|
+
args: PluginAIInspirationListSourcesArgs,
|
|
304
|
+
): PluginApiReturn<PluginAIInspirationListSourcesResult>
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Generate an image or video from a Present canvas source.
|
|
308
|
+
*
|
|
309
|
+
* @param args - Generation options including source, prompt, model, references, site context,
|
|
310
|
+
* region guidance, sketch guidance, and video options.
|
|
311
|
+
* @returns The created canvas output(s).
|
|
312
|
+
*
|
|
313
|
+
* @examplePrompt Generate an image from this sketch
|
|
314
|
+
* @examplePrompt Render the selected view as a photorealistic image
|
|
315
|
+
* @examplePrompt Make an AI image of a modern facade from this source
|
|
316
|
+
* @examplePrompt Generate a video from this image
|
|
317
|
+
* @examplePrompt Turn this massing into a rendered street view
|
|
318
|
+
*
|
|
319
|
+
* # Example
|
|
320
|
+
* ```ts
|
|
321
|
+
* const { sources } = await snaptrude.presentation.aiInspiration.listSources({})
|
|
322
|
+
* const [source, ...refs] = sources
|
|
323
|
+
* const { outputs } = await snaptrude.presentation.aiInspiration.generate({
|
|
324
|
+
* sourceShapeId: source.shapeId,
|
|
325
|
+
* prompt: "Photorealistic render of a modern timber facade at dusk",
|
|
326
|
+
* referenceShapeIds: refs.slice(0, 2).map((r) => r.shapeId),
|
|
327
|
+
* referenceStrength: "medium",
|
|
328
|
+
* })
|
|
329
|
+
* for (const out of outputs) console.log(out.outputType, out.shapeId, out.outputUrl)
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
public abstract generate(
|
|
333
|
+
args: PluginAIInspirationGenerateArgs,
|
|
334
|
+
): PluginApiReturn<PluginAIInspirationRunResult>
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Refine/upscale an AI Inspiration source image.
|
|
338
|
+
*
|
|
339
|
+
* @param args - Source shape and optional upscale factor.
|
|
340
|
+
* @returns The refined canvas output(s).
|
|
341
|
+
*
|
|
342
|
+
* @examplePrompt Upscale this AI image
|
|
343
|
+
* @examplePrompt Refine and sharpen the selected render
|
|
344
|
+
* @examplePrompt Make this generated image higher resolution
|
|
345
|
+
*
|
|
346
|
+
* # Example
|
|
347
|
+
* ```ts
|
|
348
|
+
* const { sources } = await snaptrude.presentation.aiInspiration.listSources({ includeGenerated: true })
|
|
349
|
+
* const image = sources.find((s) => s.kind === "image")
|
|
350
|
+
* if (image) {
|
|
351
|
+
* const { outputs } = await snaptrude.presentation.aiInspiration.refine({
|
|
352
|
+
* sourceShapeId: image.shapeId,
|
|
353
|
+
* upscaleFactor: 2,
|
|
354
|
+
* })
|
|
355
|
+
* console.log(outputs[0].shapeId)
|
|
356
|
+
* }
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
public abstract refine(
|
|
360
|
+
args: PluginAIInspirationRefineArgs,
|
|
361
|
+
): PluginApiReturn<PluginAIInspirationRunResult>
|
|
362
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../types"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Presentation diagrams — place diagram images onto sheets.
|
|
6
|
+
*
|
|
7
|
+
* {@linkcode PluginPresentationDiagramsApi.place} drops diagram images (by
|
|
8
|
+
* URL) onto a sheet and returns the created canvas shape ids (requires Present
|
|
9
|
+
* mode to be open). Adjacency data itself is read and computed via
|
|
10
|
+
* `program.adjacency` (see {@linkcode PluginProgramAdjacencyApi}).
|
|
11
|
+
*
|
|
12
|
+
* A future one-step spec-based `place` — which would render a diagram spec
|
|
13
|
+
* and place it in a single call — awaits a public generator from the
|
|
14
|
+
* documentation engine; until that generator exists, `place` takes ready
|
|
15
|
+
* image `urls` (we do not ship a spec-based `place` that would only throw).
|
|
16
|
+
*
|
|
17
|
+
* Accessed via `snaptrude.presentation.diagrams`.
|
|
18
|
+
*/
|
|
19
|
+
export abstract class PluginPresentationDiagramsApi {
|
|
20
|
+
constructor() {}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Place diagram images onto a sheet.
|
|
24
|
+
*
|
|
25
|
+
* Drops the given diagram image URLs onto a sheet and returns the ids of the
|
|
26
|
+
* created canvas shapes. Requires Present mode to be open.
|
|
27
|
+
*
|
|
28
|
+
* @param sheetId - The sheet to place onto.
|
|
29
|
+
* @param urls - Diagram image URLs to place.
|
|
30
|
+
* @param options - Optional `position` (`{ x, y }`, relative to the sheet)
|
|
31
|
+
* for the placed images.
|
|
32
|
+
* @returns A {@linkcode PluginPresentationDiagramsPlaceResult} with the created
|
|
33
|
+
* `shapeIds`.
|
|
34
|
+
* @throws If Present mode is not open or the sheet id is invalid.
|
|
35
|
+
*
|
|
36
|
+
* @examplePrompt Place the adjacency diagram on Sheet 1
|
|
37
|
+
* @examplePrompt Add the program diagram to the cover sheet
|
|
38
|
+
* @examplePrompt Drop these diagram images onto the layout
|
|
39
|
+
*
|
|
40
|
+
* # Example
|
|
41
|
+
* ```ts
|
|
42
|
+
* await snaptrude.presentation.diagrams.place("sheet_1", [
|
|
43
|
+
* "https://example.com/program-diagram.png",
|
|
44
|
+
* ])
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
public abstract place(
|
|
48
|
+
sheetId: string,
|
|
49
|
+
urls: string[],
|
|
50
|
+
options?: { position?: { x: number; y: number } },
|
|
51
|
+
): PluginApiReturn<PluginPresentationDiagramsPlaceResult>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Arguments for {@linkcode PluginPresentationDiagramsApi.place}.
|
|
56
|
+
*
|
|
57
|
+
* | Property | Type | Description |
|
|
58
|
+
* |---|---|---|
|
|
59
|
+
* | `sheetId` | `string` | The sheet to place onto |
|
|
60
|
+
* | `urls` | `string[]` | Diagram image URLs |
|
|
61
|
+
* | `position` | `{ x: number; y: number } \| undefined` | Where to place them |
|
|
62
|
+
*/
|
|
63
|
+
export const PluginPresentationDiagramsPlaceArgs = z.object({
|
|
64
|
+
sheetId: z.string(),
|
|
65
|
+
urls: z.array(z.string()),
|
|
66
|
+
position: z.object({ x: z.number(), y: z.number() }).optional(),
|
|
67
|
+
})
|
|
68
|
+
export type PluginPresentationDiagramsPlaceArgs = z.infer<
|
|
69
|
+
typeof PluginPresentationDiagramsPlaceArgs
|
|
70
|
+
>
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Result of {@linkcode PluginPresentationDiagramsApi.place}.
|
|
74
|
+
*
|
|
75
|
+
* | Property | Type | Description |
|
|
76
|
+
* |---|---|---|
|
|
77
|
+
* | `shapeIds` | `string[]` | Ids of the created canvas shapes |
|
|
78
|
+
*/
|
|
79
|
+
export const PluginPresentationDiagramsPlaceResult = z.object({
|
|
80
|
+
shapeIds: z.array(z.string()),
|
|
81
|
+
})
|
|
82
|
+
export type PluginPresentationDiagramsPlaceResult = z.infer<
|
|
83
|
+
typeof PluginPresentationDiagramsPlaceResult
|
|
84
|
+
>
|