@snaptrude/plugin-core 0.0.0-dev-20260708130115

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 (241) hide show
  1. package/AGENTS.md +227 -0
  2. package/CHANGELOG.md +119 -0
  3. package/CLAUDE.md +11 -0
  4. package/api-manifest.json +5004 -0
  5. package/dist/api/core/buildings.d.ts +427 -0
  6. package/dist/api/core/buildings.d.ts.map +1 -0
  7. package/dist/api/core/comment/index.d.ts +230 -0
  8. package/dist/api/core/comment/index.d.ts.map +1 -0
  9. package/dist/api/core/geom/create/index.d.ts +247 -0
  10. package/dist/api/core/geom/create/index.d.ts.map +1 -0
  11. package/dist/api/core/geom/delete/index.d.ts +72 -0
  12. package/dist/api/core/geom/delete/index.d.ts.map +1 -0
  13. package/dist/api/core/geom/index.d.ts +33 -0
  14. package/dist/api/core/geom/index.d.ts.map +1 -0
  15. package/dist/api/core/geom/query/arc.d.ts +169 -0
  16. package/dist/api/core/geom/query/arc.d.ts.map +1 -0
  17. package/dist/api/core/geom/query/brep.d.ts +402 -0
  18. package/dist/api/core/geom/query/brep.d.ts.map +1 -0
  19. package/dist/api/core/geom/query/circle.d.ts +378 -0
  20. package/dist/api/core/geom/query/circle.d.ts.map +1 -0
  21. package/dist/api/core/geom/query/contour.d.ts +450 -0
  22. package/dist/api/core/geom/query/contour.d.ts.map +1 -0
  23. package/dist/api/core/geom/query/curve.d.ts +918 -0
  24. package/dist/api/core/geom/query/curve.d.ts.map +1 -0
  25. package/dist/api/core/geom/query/edge.d.ts +128 -0
  26. package/dist/api/core/geom/query/edge.d.ts.map +1 -0
  27. package/dist/api/core/geom/query/face.d.ts +363 -0
  28. package/dist/api/core/geom/query/face.d.ts.map +1 -0
  29. package/dist/api/core/geom/query/halfedge.d.ts +206 -0
  30. package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
  31. package/dist/api/core/geom/query/index.d.ts +61 -0
  32. package/dist/api/core/geom/query/index.d.ts.map +1 -0
  33. package/dist/api/core/geom/query/profile.d.ts +410 -0
  34. package/dist/api/core/geom/query/profile.d.ts.map +1 -0
  35. package/dist/api/core/geom/query/vertex.d.ts +187 -0
  36. package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
  37. package/dist/api/core/geom/update/contour.d.ts +272 -0
  38. package/dist/api/core/geom/update/contour.d.ts.map +1 -0
  39. package/dist/api/core/geom/update/curve.d.ts +180 -0
  40. package/dist/api/core/geom/update/curve.d.ts.map +1 -0
  41. package/dist/api/core/geom/update/index.d.ts +27 -0
  42. package/dist/api/core/geom/update/index.d.ts.map +1 -0
  43. package/dist/api/core/geom/update/profile.d.ts +329 -0
  44. package/dist/api/core/geom/update/profile.d.ts.map +1 -0
  45. package/dist/api/core/groups.d.ts +485 -0
  46. package/dist/api/core/groups.d.ts.map +1 -0
  47. package/dist/api/core/history/index.d.ts +78 -0
  48. package/dist/api/core/history/index.d.ts.map +1 -0
  49. package/dist/api/core/index.d.ts +63 -0
  50. package/dist/api/core/index.d.ts.map +1 -0
  51. package/dist/api/core/layers.d.ts +402 -0
  52. package/dist/api/core/layers.d.ts.map +1 -0
  53. package/dist/api/core/math/index.d.ts +18 -0
  54. package/dist/api/core/math/index.d.ts.map +1 -0
  55. package/dist/api/core/math/quat.d.ts +170 -0
  56. package/dist/api/core/math/quat.d.ts.map +1 -0
  57. package/dist/api/core/math/vec3.d.ts +174 -0
  58. package/dist/api/core/math/vec3.d.ts.map +1 -0
  59. package/dist/api/core/project/index.d.ts +399 -0
  60. package/dist/api/core/project/index.d.ts.map +1 -0
  61. package/dist/api/core/tags.d.ts +755 -0
  62. package/dist/api/core/tags.d.ts.map +1 -0
  63. package/dist/api/core/units/index.d.ts +175 -0
  64. package/dist/api/core/units/index.d.ts.map +1 -0
  65. package/dist/api/core/zoom/index.d.ts +45 -0
  66. package/dist/api/core/zoom/index.d.ts.map +1 -0
  67. package/dist/api/design/boolean/index.d.ts +168 -0
  68. package/dist/api/design/boolean/index.d.ts.map +1 -0
  69. package/dist/api/design/create/index.d.ts +828 -0
  70. package/dist/api/design/create/index.d.ts.map +1 -0
  71. package/dist/api/design/delete/index.d.ts +63 -0
  72. package/dist/api/design/delete/index.d.ts.map +1 -0
  73. package/dist/api/design/doors/index.d.ts +268 -0
  74. package/dist/api/design/doors/index.d.ts.map +1 -0
  75. package/dist/api/design/edit/index.d.ts +49 -0
  76. package/dist/api/design/edit/index.d.ts.map +1 -0
  77. package/dist/api/design/erase/index.d.ts +160 -0
  78. package/dist/api/design/erase/index.d.ts.map +1 -0
  79. package/dist/api/design/furniture/index.d.ts +123 -0
  80. package/dist/api/design/furniture/index.d.ts.map +1 -0
  81. package/dist/api/design/index.d.ts +153 -0
  82. package/dist/api/design/index.d.ts.map +1 -0
  83. package/dist/api/design/lock.d.ts +41 -0
  84. package/dist/api/design/lock.d.ts.map +1 -0
  85. package/dist/api/design/materials/index.d.ts +297 -0
  86. package/dist/api/design/materials/index.d.ts.map +1 -0
  87. package/dist/api/design/query/geometry/index.d.ts +140 -0
  88. package/dist/api/design/query/geometry/index.d.ts.map +1 -0
  89. package/dist/api/design/query/index.d.ts +1011 -0
  90. package/dist/api/design/query/index.d.ts.map +1 -0
  91. package/dist/api/design/query/spaces.d.ts +221 -0
  92. package/dist/api/design/query/spaces.d.ts.map +1 -0
  93. package/dist/api/design/selection/index.d.ts +138 -0
  94. package/dist/api/design/selection/index.d.ts.map +1 -0
  95. package/dist/api/design/shared.d.ts +38 -0
  96. package/dist/api/design/shared.d.ts.map +1 -0
  97. package/dist/api/design/transform/index.d.ts +87 -0
  98. package/dist/api/design/transform/index.d.ts.map +1 -0
  99. package/dist/api/design/update/index.d.ts +178 -0
  100. package/dist/api/design/update/index.d.ts.map +1 -0
  101. package/dist/api/design/windows/index.d.ts +189 -0
  102. package/dist/api/design/windows/index.d.ts.map +1 -0
  103. package/dist/api/entity/buildableEnvelope.d.ts +261 -0
  104. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
  105. package/dist/api/entity/department.d.ts +1 -0
  106. package/dist/api/entity/department.d.ts.map +1 -0
  107. package/dist/api/entity/index.d.ts +28 -0
  108. package/dist/api/entity/index.d.ts.map +1 -0
  109. package/dist/api/entity/referenceLine.d.ts +202 -0
  110. package/dist/api/entity/referenceLine.d.ts.map +1 -0
  111. package/dist/api/entity/space.d.ts +846 -0
  112. package/dist/api/entity/space.d.ts.map +1 -0
  113. package/dist/api/entity/story.d.ts +249 -0
  114. package/dist/api/entity/story.d.ts.map +1 -0
  115. package/dist/api/index.d.ts +35 -0
  116. package/dist/api/index.d.ts.map +1 -0
  117. package/dist/api/presentation/aiInspiration.d.ts +2400 -0
  118. package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
  119. package/dist/api/presentation/diagrams.d.ts +81 -0
  120. package/dist/api/presentation/diagrams.d.ts.map +1 -0
  121. package/dist/api/presentation/import.d.ts +113 -0
  122. package/dist/api/presentation/import.d.ts.map +1 -0
  123. package/dist/api/presentation/index.d.ts +45 -0
  124. package/dist/api/presentation/index.d.ts.map +1 -0
  125. package/dist/api/presentation/sheets.d.ts +176 -0
  126. package/dist/api/presentation/sheets.d.ts.map +1 -0
  127. package/dist/api/presentation/views.d.ts +296 -0
  128. package/dist/api/presentation/views.d.ts.map +1 -0
  129. package/dist/api/program/adjacency.d.ts +155 -0
  130. package/dist/api/program/adjacency.d.ts.map +1 -0
  131. package/dist/api/program/areas.d.ts +360 -0
  132. package/dist/api/program/areas.d.ts.map +1 -0
  133. package/dist/api/program/classification.d.ts +135 -0
  134. package/dist/api/program/classification.d.ts.map +1 -0
  135. package/dist/api/program/cores.d.ts +174 -0
  136. package/dist/api/program/cores.d.ts.map +1 -0
  137. package/dist/api/program/departments.d.ts +431 -0
  138. package/dist/api/program/departments.d.ts.map +1 -0
  139. package/dist/api/program/index.d.ts +69 -0
  140. package/dist/api/program/index.d.ts.map +1 -0
  141. package/dist/api/program/layout.d.ts +63 -0
  142. package/dist/api/program/layout.d.ts.map +1 -0
  143. package/dist/api/program/metrics.d.ts +108 -0
  144. package/dist/api/program/metrics.d.ts.map +1 -0
  145. package/dist/api/program/site.d.ts +367 -0
  146. package/dist/api/program/site.d.ts.map +1 -0
  147. package/dist/api/program/spreadsheet.d.ts +2041 -0
  148. package/dist/api/program/spreadsheet.d.ts.map +1 -0
  149. package/dist/handles.d.ts +138 -0
  150. package/dist/handles.d.ts.map +1 -0
  151. package/dist/host-utils.d.ts +43 -0
  152. package/dist/host-utils.d.ts.map +1 -0
  153. package/dist/index.cjs +4597 -0
  154. package/dist/index.cjs.map +1 -0
  155. package/dist/index.d.ts +5 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +3870 -0
  158. package/dist/index.js.map +1 -0
  159. package/dist/types.d.ts +16 -0
  160. package/dist/types.d.ts.map +1 -0
  161. package/package.json +39 -0
  162. package/scripts/generate-manifest.mjs +193 -0
  163. package/scripts/generate-manifest.test.mjs +193 -0
  164. package/src/api/core/buildings.ts +485 -0
  165. package/src/api/core/comment/index.ts +258 -0
  166. package/src/api/core/geom/create/index.ts +293 -0
  167. package/src/api/core/geom/delete/index.ts +78 -0
  168. package/src/api/core/geom/index.ts +35 -0
  169. package/src/api/core/geom/query/arc.ts +169 -0
  170. package/src/api/core/geom/query/brep.ts +444 -0
  171. package/src/api/core/geom/query/circle.ts +404 -0
  172. package/src/api/core/geom/query/contour.ts +540 -0
  173. package/src/api/core/geom/query/curve.ts +1078 -0
  174. package/src/api/core/geom/query/edge.ts +130 -0
  175. package/src/api/core/geom/query/face.ts +403 -0
  176. package/src/api/core/geom/query/halfedge.ts +210 -0
  177. package/src/api/core/geom/query/index.ts +63 -0
  178. package/src/api/core/geom/query/profile.ts +473 -0
  179. package/src/api/core/geom/query/vertex.ts +205 -0
  180. package/src/api/core/geom/update/contour.ts +315 -0
  181. package/src/api/core/geom/update/curve.ts +209 -0
  182. package/src/api/core/geom/update/index.ts +29 -0
  183. package/src/api/core/geom/update/profile.ts +377 -0
  184. package/src/api/core/groups.ts +521 -0
  185. package/src/api/core/history/index.ts +84 -0
  186. package/src/api/core/index.ts +65 -0
  187. package/src/api/core/layers.ts +333 -0
  188. package/src/api/core/math/index.ts +20 -0
  189. package/src/api/core/math/quat.ts +172 -0
  190. package/src/api/core/math/vec3.ts +179 -0
  191. package/src/api/core/project/index.ts +418 -0
  192. package/src/api/core/tags.ts +808 -0
  193. package/src/api/core/units/index.ts +164 -0
  194. package/src/api/core/zoom/index.ts +47 -0
  195. package/src/api/design/boolean/index.ts +179 -0
  196. package/src/api/design/create/index.ts +886 -0
  197. package/src/api/design/delete/index.ts +67 -0
  198. package/src/api/design/doors/index.ts +285 -0
  199. package/src/api/design/edit/index.ts +54 -0
  200. package/src/api/design/erase/index.ts +151 -0
  201. package/src/api/design/furniture/index.ts +130 -0
  202. package/src/api/design/index.ts +162 -0
  203. package/src/api/design/lock.ts +42 -0
  204. package/src/api/design/materials/index.ts +301 -0
  205. package/src/api/design/query/geometry/index.ts +166 -0
  206. package/src/api/design/query/index.ts +937 -0
  207. package/src/api/design/query/spaces.ts +132 -0
  208. package/src/api/design/selection/index.ts +144 -0
  209. package/src/api/design/shared.ts +40 -0
  210. package/src/api/design/transform/index.ts +93 -0
  211. package/src/api/design/update/index.ts +117 -0
  212. package/src/api/design/windows/index.ts +207 -0
  213. package/src/api/entity/buildableEnvelope.ts +318 -0
  214. package/src/api/entity/department.ts +0 -0
  215. package/src/api/entity/index.ts +30 -0
  216. package/src/api/entity/referenceLine.ts +227 -0
  217. package/src/api/entity/space.ts +612 -0
  218. package/src/api/entity/story.ts +273 -0
  219. package/src/api/index.ts +37 -0
  220. package/src/api/presentation/aiInspiration.ts +1116 -0
  221. package/src/api/presentation/diagrams.ts +84 -0
  222. package/src/api/presentation/import.ts +112 -0
  223. package/src/api/presentation/index.ts +47 -0
  224. package/src/api/presentation/sheets.ts +198 -0
  225. package/src/api/presentation/views.ts +303 -0
  226. package/src/api/program/adjacency.ts +164 -0
  227. package/src/api/program/areas.ts +335 -0
  228. package/src/api/program/classification.ts +138 -0
  229. package/src/api/program/cores.ts +171 -0
  230. package/src/api/program/departments.ts +465 -0
  231. package/src/api/program/index.ts +71 -0
  232. package/src/api/program/layout.ts +68 -0
  233. package/src/api/program/metrics.ts +120 -0
  234. package/src/api/program/site.ts +326 -0
  235. package/src/api/program/spreadsheet.ts +2075 -0
  236. package/src/handles.ts +148 -0
  237. package/src/host-utils.ts +64 -0
  238. package/src/index.ts +4 -0
  239. package/src/types.ts +16 -0
  240. package/tsconfig.json +17 -0
  241. package/tsup.config.ts +12 -0
@@ -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
+ >
@@ -0,0 +1,112 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../types"
3
+
4
+ /**
5
+ * Presentation import — bring external reference assets onto the Present canvas.
6
+ *
7
+ * `import.image` places a reference image and `import.pdf` places a PDF (each
8
+ * page vectorized to SVG) onto the current Present sheet, returning the created
9
+ * canvas shape ids. Requires Present mode to be open.
10
+ *
11
+ * The host engine takes a browser `File`, which a plugin worker cannot supply,
12
+ * so these accept a `url`/`dataUrl` that the host adapts into a `File`.
13
+ *
14
+ * Accessed via `snaptrude.presentation.import`.
15
+ */
16
+ export abstract class PluginPresentationImportApi {
17
+ constructor() {}
18
+
19
+ /**
20
+ * Import a reference image onto the current Present sheet.
21
+ *
22
+ * @param source - The asset to import: exactly one of `url` or `dataUrl`.
23
+ * @param options - Optional `position` — where to place the image on the
24
+ * sheet.
25
+ * @returns A {@linkcode PluginPresentationImportResult} with the created
26
+ * `shapeIds`.
27
+ * @throws If Present mode is not open or the source cannot be loaded.
28
+ *
29
+ * @examplePrompt Import this reference image onto the present canvas
30
+ * @examplePrompt Add a JPG to my presentation board
31
+ * @examplePrompt Drop this site photo onto the current sheet
32
+ * @examplePrompt Bring an inspiration image into Present mode
33
+ *
34
+ * # Example
35
+ * ```ts
36
+ * const { shapeIds } = await snaptrude.presentation.import.image(
37
+ * { url: "https://example.com/ref.png" },
38
+ * { position: { x: 200, y: 150 } },
39
+ * )
40
+ * ```
41
+ */
42
+ public abstract image(
43
+ source: { url?: string; dataUrl?: string },
44
+ options?: { position?: { x: number; y: number } },
45
+ ): PluginApiReturn<PluginPresentationImportResult>
46
+
47
+ /**
48
+ * Import a PDF onto the current Present sheet (one shape per page).
49
+ *
50
+ * Each page is converted to vector SVG and placed as a canvas shape.
51
+ *
52
+ * @param source - The asset to import: exactly one of `url` or `dataUrl`.
53
+ * @param options - Optional `position` — where to place the pages on the
54
+ * sheet.
55
+ * @returns A {@linkcode PluginPresentationImportResult} with one `shapeId` per
56
+ * page.
57
+ * @throws If Present mode is not open or the source cannot be loaded.
58
+ *
59
+ * @examplePrompt Import this PDF onto the present canvas
60
+ * @examplePrompt Add a multi-page PDF reference to my board
61
+ * @examplePrompt Bring a PDF floor plan into Present mode as vectors
62
+ * @examplePrompt Place each page of this PDF on the sheet
63
+ *
64
+ * # Example
65
+ * ```ts
66
+ * const { shapeIds } = await snaptrude.presentation.import.pdf({
67
+ * url: "https://example.com/plans.pdf",
68
+ * })
69
+ * ```
70
+ */
71
+ public abstract pdf(
72
+ source: { url?: string; dataUrl?: string },
73
+ options?: { position?: { x: number; y: number } },
74
+ ): PluginApiReturn<PluginPresentationImportResult>
75
+ }
76
+
77
+ /**
78
+ * Arguments for {@linkcode PluginPresentationImportApi.image} /
79
+ * {@linkcode PluginPresentationImportApi.pdf}. Provide exactly one source.
80
+ *
81
+ * | Property | Type | Description |
82
+ * |---|---|---|
83
+ * | `url` | `string \| undefined` | URL of the asset to import |
84
+ * | `dataUrl` | `string \| undefined` | Base64 data URL of the asset |
85
+ * | `position` | `{ x: number; y: number } \| undefined` | Where to place it on the sheet |
86
+ */
87
+ export const PluginPresentationImportArgs = z
88
+ .object({
89
+ url: z.string().optional(),
90
+ dataUrl: z.string().optional(),
91
+ position: z.object({ x: z.number(), y: z.number() }).optional(),
92
+ })
93
+ .refine((a) => Boolean(a.url) || Boolean(a.dataUrl), {
94
+ message: "Provide a url or a dataUrl",
95
+ })
96
+ export type PluginPresentationImportArgs = z.infer<
97
+ typeof PluginPresentationImportArgs
98
+ >
99
+
100
+ /**
101
+ * Result of an import.
102
+ *
103
+ * | Property | Type | Description |
104
+ * |---|---|---|
105
+ * | `shapeIds` | `string[]` | Ids of the created canvas shapes (one per page for PDFs) |
106
+ */
107
+ export const PluginPresentationImportResult = z.object({
108
+ shapeIds: z.array(z.string()),
109
+ })
110
+ export type PluginPresentationImportResult = z.infer<
111
+ typeof PluginPresentationImportResult
112
+ >
@@ -0,0 +1,47 @@
1
+ import { PluginPresentationViewsApi } from "./views"
2
+ import { PluginPresentationAIInspirationApi } from "./aiInspiration"
3
+ import { PluginPresentationSheetsApi } from "./sheets"
4
+ import { PluginPresentationDiagramsApi } from "./diagrams"
5
+ import { PluginPresentationImportApi } from "./import"
6
+
7
+ /**
8
+ * Presentation APIs — prepare and assemble presentations.
9
+ *
10
+ * Reads describe the artifacts a presentation is built from (saved views, layout
11
+ * sheets); writes assemble them (place views/diagrams on sheets, import
12
+ * references, capture/save views). Present-mode AI Inspiration also lives here.
13
+ *
14
+ * Several members require **Present mode to be open** (the documentation editor):
15
+ * sheets, diagram placement, and import.
16
+ *
17
+ * - {@linkcode PluginPresentationApi.views} — Saved 2D/3D views (list, get, capture, activate, create)
18
+ * - {@linkcode PluginPresentationApi.sheets} — Layout sheets (list, get, create, place views)
19
+ * - {@linkcode PluginPresentationApi.diagrams} — Place program/adjacency/site diagram images on sheets
20
+ * - {@linkcode PluginPresentationApi.import} — Import reference images/PDFs onto the canvas
21
+ * - {@linkcode PluginPresentationApi.aiInspiration} — Present-mode AI image/video generation
22
+ *
23
+ * Accessed via `snaptrude.presentation`.
24
+ */
25
+ export abstract class PluginPresentationApi {
26
+ /** Saved 2D/3D views. See {@linkcode PluginPresentationViewsApi}. */
27
+ public abstract views: PluginPresentationViewsApi
28
+ /** Layout sheets — list/get/create and place views (Present mode). See {@linkcode PluginPresentationSheetsApi}. */
29
+ public abstract sheets: PluginPresentationSheetsApi
30
+ /** Program/adjacency/site diagrams — place images on sheets. See {@linkcode PluginPresentationDiagramsApi}. */
31
+ public abstract diagrams: PluginPresentationDiagramsApi
32
+ /** Import reference images/PDFs onto the Present canvas. See {@linkcode PluginPresentationImportApi}. */
33
+ public abstract import: PluginPresentationImportApi
34
+ /**
35
+ * Present-mode AI Inspiration image/video generation. See
36
+ * {@linkcode PluginPresentationAIInspirationApi}.
37
+ */
38
+ public abstract aiInspiration: PluginPresentationAIInspirationApi
39
+
40
+ constructor() {}
41
+ }
42
+
43
+ export * from "./views"
44
+ export * from "./sheets"
45
+ export * from "./diagrams"
46
+ export * from "./import"
47
+ export * from "./aiInspiration"
@@ -0,0 +1,198 @@
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../types"
3
+
4
+ /**
5
+ * Presentation sheets — the layout sheets a presentation is assembled on.
6
+ *
7
+ * A **sheet** is a page in Present mode that views and diagrams are placed onto.
8
+ * These methods require **Present mode to be open** (the documentation editor) —
9
+ * reads return `[]`/`null` and writes throw when it is not.
10
+ *
11
+ * `list`/`get` are reads; `create` adds a sheet and `place` drops a saved view
12
+ * onto a sheet (returning the id of the created canvas shape).
13
+ *
14
+ * Accessed via `snaptrude.presentation.sheets`.
15
+ */
16
+ export abstract class PluginPresentationSheetsApi {
17
+ constructor() {}
18
+
19
+ /**
20
+ * List the layout sheets in the presentation.
21
+ *
22
+ * @returns A {@linkcode PluginPresentationSheetsListResult} with a `sheets`
23
+ * array (empty when Present mode is closed or there are no sheets).
24
+ *
25
+ * @examplePrompt List all the sheets
26
+ * @examplePrompt How many layout sheets are there?
27
+ * @examplePrompt Show me the presentation sheets
28
+ * @examplePrompt What sheets can I place views on?
29
+ *
30
+ * # Example
31
+ * ```ts
32
+ * const { sheets } = await snaptrude.presentation.sheets.list()
33
+ * ```
34
+ */
35
+ public abstract list(): PluginApiReturn<PluginPresentationSheetsListResult>
36
+
37
+ /**
38
+ * Get a single sheet by id.
39
+ *
40
+ * @param sheetId - The id of the sheet to read.
41
+ * @returns The matching {@linkcode PluginPresentationSheet}, or `null`.
42
+ *
43
+ * @examplePrompt Get the sheet with id sheet_1
44
+ * @examplePrompt Find the sheet called Cover
45
+ * @examplePrompt Look up a layout sheet by id
46
+ *
47
+ * # Example
48
+ * ```ts
49
+ * const sheet = await snaptrude.presentation.sheets.get("sheet_1")
50
+ * ```
51
+ */
52
+ public abstract get(
53
+ sheetId: string,
54
+ ): PluginApiReturn<PluginPresentationSheetsGetResult>
55
+
56
+ /**
57
+ * Create a new layout sheet.
58
+ *
59
+ * Requires Present mode to be open.
60
+ *
61
+ * @param name - Display name for the new sheet (optional).
62
+ * @returns The newly created {@linkcode PluginPresentationSheet}.
63
+ * @throws If Present mode is not open.
64
+ *
65
+ * @examplePrompt Create a new sheet called Cover
66
+ * @examplePrompt Add a layout sheet
67
+ * @examplePrompt Make a new presentation sheet named Floor Plans
68
+ *
69
+ * # Example
70
+ * ```ts
71
+ * const sheet = await snaptrude.presentation.sheets.create("Cover")
72
+ * ```
73
+ */
74
+ public abstract create(
75
+ name?: string,
76
+ ): PluginApiReturn<PluginPresentationSheet>
77
+
78
+ /**
79
+ * Place a saved view onto a sheet.
80
+ *
81
+ * Drops the given view onto the sheet at an optional position and returns the
82
+ * id of the created canvas shape. Requires Present mode to be open.
83
+ *
84
+ * @param sheetId - The id of the sheet to place onto.
85
+ * @param viewId - The id of the saved view to place.
86
+ * @param options - Optional `position` ({@linkcode PluginSheetPosition}) —
87
+ * where to place it (a default is used when omitted).
88
+ * @returns A {@linkcode PluginPresentationSheetsPlaceResult} with the created
89
+ * `shapeId`.
90
+ * @throws If Present mode is not open, or the sheet/view id is invalid.
91
+ *
92
+ * @examplePrompt Place the floor plan on Sheet 1
93
+ * @examplePrompt Add this 3D view to the cover sheet
94
+ * @examplePrompt Drop the site plan onto the layout sheet at 100, 200
95
+ * @examplePrompt Put the Ground Floor view on sheet_1
96
+ *
97
+ * # Example
98
+ * ```ts
99
+ * const { shapeId } = await snaptrude.presentation.sheets.place("sheet_1", "view_123")
100
+ * ```
101
+ */
102
+ public abstract place(
103
+ sheetId: string,
104
+ viewId: string,
105
+ options?: { position?: PluginSheetPosition },
106
+ ): PluginApiReturn<PluginPresentationSheetsPlaceResult>
107
+ }
108
+
109
+ /**
110
+ * A layout sheet in the presentation.
111
+ *
112
+ * | Property | Type | Description |
113
+ * |---|---|---|
114
+ * | `id` | `string` | Unique sheet id |
115
+ * | `name` | `string` | Display name |
116
+ */
117
+ export const PluginPresentationSheet = z.object({
118
+ id: z.string(),
119
+ name: z.string(),
120
+ })
121
+ export type PluginPresentationSheet = z.infer<typeof PluginPresentationSheet>
122
+
123
+ /**
124
+ * A position on a sheet/canvas (sheet coordinates).
125
+ *
126
+ * | Property | Type | Description |
127
+ * |---|---|---|
128
+ * | `x` | `number` | X coordinate |
129
+ * | `y` | `number` | Y coordinate |
130
+ */
131
+ export const PluginSheetPosition = z.object({
132
+ x: z.number(),
133
+ y: z.number(),
134
+ })
135
+ export type PluginSheetPosition = z.infer<typeof PluginSheetPosition>
136
+
137
+ /** Result of {@linkcode PluginPresentationSheetsApi.list}. */
138
+ export const PluginPresentationSheetsListResult = z.object({
139
+ sheets: z.array(PluginPresentationSheet),
140
+ })
141
+ export type PluginPresentationSheetsListResult = z.infer<
142
+ typeof PluginPresentationSheetsListResult
143
+ >
144
+
145
+ /** Arguments for {@linkcode PluginPresentationSheetsApi.get}. */
146
+ export const PluginPresentationSheetsGetArgs = z.object({
147
+ id: z.string(),
148
+ })
149
+ export type PluginPresentationSheetsGetArgs = z.infer<
150
+ typeof PluginPresentationSheetsGetArgs
151
+ >
152
+
153
+ /** Result of {@linkcode PluginPresentationSheetsApi.get} — the sheet, or `null`. */
154
+ export const PluginPresentationSheetsGetResult =
155
+ PluginPresentationSheet.nullable()
156
+ export type PluginPresentationSheetsGetResult = z.infer<
157
+ typeof PluginPresentationSheetsGetResult
158
+ >
159
+
160
+ /** Arguments for {@linkcode PluginPresentationSheetsApi.create}. */
161
+ export const PluginPresentationSheetsCreateArgs = z.object({
162
+ name: z.string().optional(),
163
+ })
164
+ export type PluginPresentationSheetsCreateArgs = z.infer<
165
+ typeof PluginPresentationSheetsCreateArgs
166
+ >
167
+
168
+ /**
169
+ * Arguments for {@linkcode PluginPresentationSheetsApi.place}.
170
+ *
171
+ * | Property | Type | Description |
172
+ * |---|---|---|
173
+ * | `sheetId` | `string` | The sheet to place onto |
174
+ * | `viewId` | `string` | The saved view to place |
175
+ * | `position` | {@linkcode PluginSheetPosition}` \| undefined` | Where to place it (a default is used when omitted) |
176
+ */
177
+ export const PluginPresentationSheetsPlaceArgs = z.object({
178
+ sheetId: z.string(),
179
+ viewId: z.string(),
180
+ position: PluginSheetPosition.optional(),
181
+ })
182
+ export type PluginPresentationSheetsPlaceArgs = z.infer<
183
+ typeof PluginPresentationSheetsPlaceArgs
184
+ >
185
+
186
+ /**
187
+ * Result of {@linkcode PluginPresentationSheetsApi.place}.
188
+ *
189
+ * | Property | Type | Description |
190
+ * |---|---|---|
191
+ * | `shapeId` | `string` | Id of the created canvas shape |
192
+ */
193
+ export const PluginPresentationSheetsPlaceResult = z.object({
194
+ shapeId: z.string(),
195
+ })
196
+ export type PluginPresentationSheetsPlaceResult = z.infer<
197
+ typeof PluginPresentationSheetsPlaceResult
198
+ >