@snaptrude/plugin-core 0.10.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/AGENTS.md +4 -0
  2. package/CHANGELOG.md +187 -3
  3. package/api-manifest.json +929 -25
  4. package/dist/api/analysis/daylight.d.ts +5 -5
  5. package/dist/api/analysis/solar.d.ts +2 -2
  6. package/dist/api/core/camera/index.d.ts +463 -0
  7. package/dist/api/core/camera/index.d.ts.map +1 -1
  8. package/dist/api/core/geom/create/index.d.ts +942 -101
  9. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  10. package/dist/api/core/geom/query/brep.d.ts +59 -2
  11. package/dist/api/core/geom/query/brep.d.ts.map +1 -1
  12. package/dist/api/core/geom/query/curve.d.ts +59 -35
  13. package/dist/api/core/geom/query/curve.d.ts.map +1 -1
  14. package/dist/api/core/geom/query/edge.d.ts +2 -2
  15. package/dist/api/core/geom/query/face.d.ts +105 -0
  16. package/dist/api/core/geom/query/face.d.ts.map +1 -1
  17. package/dist/api/core/geom/update/contour.d.ts +10 -2
  18. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  19. package/dist/api/core/geom/update/curve.d.ts +5 -5
  20. package/dist/api/core/geom/update/profile.d.ts +3 -1
  21. package/dist/api/core/geom/update/profile.d.ts.map +1 -1
  22. package/dist/api/core/handles/index.d.ts +4 -2
  23. package/dist/api/core/handles/index.d.ts.map +1 -1
  24. package/dist/api/core/index.d.ts +4 -4
  25. package/dist/api/core/index.d.ts.map +1 -1
  26. package/dist/api/core/io/import/index.d.ts +3 -1
  27. package/dist/api/core/io/import/index.d.ts.map +1 -1
  28. package/dist/api/core/layers.d.ts +377 -255
  29. package/dist/api/core/layers.d.ts.map +1 -1
  30. package/dist/api/core/mode/index.d.ts +19 -7
  31. package/dist/api/core/mode/index.d.ts.map +1 -1
  32. package/dist/api/core/project/index.d.ts +68 -1
  33. package/dist/api/core/project/index.d.ts.map +1 -1
  34. package/dist/api/core/proposals/index.d.ts +4 -3
  35. package/dist/api/core/proposals/index.d.ts.map +1 -1
  36. package/dist/api/core/storeys/index.d.ts +31 -2
  37. package/dist/api/core/storeys/index.d.ts.map +1 -1
  38. package/dist/api/core/storeys/layers.d.ts +408 -0
  39. package/dist/api/core/storeys/layers.d.ts.map +1 -0
  40. package/dist/api/core/tags.d.ts +84 -3
  41. package/dist/api/core/tags.d.ts.map +1 -1
  42. package/dist/api/core/zoom/index.d.ts +13 -0
  43. package/dist/api/core/zoom/index.d.ts.map +1 -1
  44. package/dist/api/design/bim.d.ts +299 -0
  45. package/dist/api/design/bim.d.ts.map +1 -0
  46. package/dist/api/design/boolean/index.d.ts +2 -0
  47. package/dist/api/design/boolean/index.d.ts.map +1 -1
  48. package/dist/api/design/catalog.d.ts +320 -0
  49. package/dist/api/design/catalog.d.ts.map +1 -0
  50. package/dist/api/design/create/bulk-items.d.ts +269 -0
  51. package/dist/api/design/create/bulk-items.d.ts.map +1 -0
  52. package/dist/api/design/create/grids.d.ts +132 -0
  53. package/dist/api/design/create/grids.d.ts.map +1 -0
  54. package/dist/api/design/create/index.d.ts +752 -78
  55. package/dist/api/design/create/index.d.ts.map +1 -1
  56. package/dist/api/design/create/opening-fields.d.ts +38 -0
  57. package/dist/api/design/create/opening-fields.d.ts.map +1 -0
  58. package/dist/api/design/delete/index.d.ts +5 -0
  59. package/dist/api/design/delete/index.d.ts.map +1 -1
  60. package/dist/api/design/dimensions.d.ts +427 -0
  61. package/dist/api/design/dimensions.d.ts.map +1 -0
  62. package/dist/api/design/doors/index.d.ts +24 -23
  63. package/dist/api/design/doors/index.d.ts.map +1 -1
  64. package/dist/api/design/family.d.ts +1446 -0
  65. package/dist/api/design/family.d.ts.map +1 -0
  66. package/dist/api/design/furniture/index.d.ts +33 -0
  67. package/dist/api/design/furniture/index.d.ts.map +1 -1
  68. package/dist/api/design/grids.d.ts +237 -0
  69. package/dist/api/design/grids.d.ts.map +1 -0
  70. package/dist/api/design/index.d.ts +30 -0
  71. package/dist/api/design/index.d.ts.map +1 -1
  72. package/dist/api/design/networks.d.ts +1703 -0
  73. package/dist/api/design/networks.d.ts.map +1 -0
  74. package/dist/api/design/query/geometry/index.d.ts +33 -5
  75. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  76. package/dist/api/design/query/grids.d.ts +287 -0
  77. package/dist/api/design/query/grids.d.ts.map +1 -0
  78. package/dist/api/design/query/index.d.ts +143 -34
  79. package/dist/api/design/query/index.d.ts.map +1 -1
  80. package/dist/api/design/query/spaces.d.ts +5 -5
  81. package/dist/api/design/selection/index.d.ts +12 -12
  82. package/dist/api/design/types/index.d.ts +40 -24
  83. package/dist/api/design/types/index.d.ts.map +1 -1
  84. package/dist/api/design/update/index.d.ts +412 -8
  85. package/dist/api/design/update/index.d.ts.map +1 -1
  86. package/dist/api/design/visibility.d.ts +28 -0
  87. package/dist/api/design/visibility.d.ts.map +1 -1
  88. package/dist/api/design/windows/index.d.ts +8 -8
  89. package/dist/api/design/windows/index.d.ts.map +1 -1
  90. package/dist/api/entity/buildableEnvelope.d.ts +84 -2
  91. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  92. package/dist/api/entity/referenceLine.d.ts +13 -1
  93. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  94. package/dist/api/entity/space.d.ts +12 -12
  95. package/dist/api/entity/story.d.ts +4 -4
  96. package/dist/api/presentation/aiInspiration.d.ts +24 -24
  97. package/dist/api/presentation/annotate.d.ts +38 -22
  98. package/dist/api/presentation/annotate.d.ts.map +1 -1
  99. package/dist/api/presentation/camera.d.ts +265 -0
  100. package/dist/api/presentation/camera.d.ts.map +1 -0
  101. package/dist/api/presentation/drawingContract.d.ts +32 -0
  102. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  103. package/dist/api/presentation/drawings.d.ts +3523 -0
  104. package/dist/api/presentation/drawings.d.ts.map +1 -0
  105. package/dist/api/presentation/export.d.ts +23 -5
  106. package/dist/api/presentation/export.d.ts.map +1 -1
  107. package/dist/api/presentation/graphics.d.ts +419 -0
  108. package/dist/api/presentation/graphics.d.ts.map +1 -0
  109. package/dist/api/presentation/index.d.ts +66 -12
  110. package/dist/api/presentation/index.d.ts.map +1 -1
  111. package/dist/api/presentation/placedViews.d.ts +116 -16
  112. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  113. package/dist/api/presentation/sections.d.ts +461 -0
  114. package/dist/api/presentation/sections.d.ts.map +1 -0
  115. package/dist/api/presentation/shapes.d.ts +2 -2
  116. package/dist/api/presentation/sheets.d.ts +175 -19
  117. package/dist/api/presentation/sheets.d.ts.map +1 -1
  118. package/dist/api/presentation/standards.d.ts +590 -0
  119. package/dist/api/presentation/standards.d.ts.map +1 -0
  120. package/dist/api/presentation/viewPresets.d.ts +222 -0
  121. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  122. package/dist/api/presentation/views.d.ts +144 -9
  123. package/dist/api/presentation/views.d.ts.map +1 -1
  124. package/dist/api/presentation/walkthroughs.d.ts +1350 -0
  125. package/dist/api/presentation/walkthroughs.d.ts.map +1 -0
  126. package/dist/api/program/departments.d.ts +58 -2
  127. package/dist/api/program/departments.d.ts.map +1 -1
  128. package/dist/api/program/index.d.ts +16 -6
  129. package/dist/api/program/index.d.ts.map +1 -1
  130. package/dist/api/program/labels.d.ts +355 -0
  131. package/dist/api/program/labels.d.ts.map +1 -0
  132. package/dist/api/program/metadata.d.ts +328 -0
  133. package/dist/api/program/metadata.d.ts.map +1 -0
  134. package/dist/api/program/site.d.ts +4 -4
  135. package/dist/api/program/spreadsheet.d.ts +267 -4
  136. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  137. package/dist/api/workspace/index.d.ts +49 -2
  138. package/dist/api/workspace/index.d.ts.map +1 -1
  139. package/dist/errors/codes.d.ts +3 -1
  140. package/dist/errors/codes.d.ts.map +1 -1
  141. package/dist/handles.d.ts +32 -3
  142. package/dist/handles.d.ts.map +1 -1
  143. package/dist/index.cjs +6539 -2804
  144. package/dist/index.cjs.map +1 -1
  145. package/dist/index.d.ts +2 -0
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +6121 -2801
  148. package/dist/index.js.map +1 -1
  149. package/dist/massParameters.d.ts +287 -0
  150. package/dist/massParameters.d.ts.map +1 -0
  151. package/dist/massParameters.ops.d.ts +138 -0
  152. package/dist/massParameters.ops.d.ts.map +1 -0
  153. package/package.json +14 -13
  154. package/scripts/check-dist-fresh.mjs +22 -0
  155. package/scripts/generate-manifest.mjs +5 -0
  156. package/scripts/generate-manifest.test.mjs +14 -3
  157. package/src/api/core/camera/index.ts +446 -1
  158. package/src/api/core/geom/create/index.ts +1037 -102
  159. package/src/api/core/geom/query/brep.ts +60 -2
  160. package/src/api/core/geom/query/curve.ts +26 -2
  161. package/src/api/core/geom/query/edge.ts +2 -2
  162. package/src/api/core/geom/query/face.ts +109 -4
  163. package/src/api/core/geom/update/contour.ts +10 -2
  164. package/src/api/core/geom/update/profile.ts +2 -0
  165. package/src/api/core/handles/index.ts +3 -2
  166. package/src/api/core/index.ts +4 -4
  167. package/src/api/core/io/import/index.ts +11 -3
  168. package/src/api/core/layers.ts +380 -173
  169. package/src/api/core/mode/index.ts +19 -7
  170. package/src/api/core/project/index.ts +62 -1
  171. package/src/api/core/proposals/index.ts +4 -3
  172. package/src/api/core/storeys/index.ts +34 -2
  173. package/src/api/core/storeys/layers.ts +339 -0
  174. package/src/api/core/tags.ts +76 -0
  175. package/src/api/core/zoom/index.ts +13 -0
  176. package/src/api/design/bim.ts +210 -0
  177. package/src/api/design/boolean/index.ts +2 -0
  178. package/src/api/design/catalog.ts +203 -0
  179. package/src/api/design/create/bulk-items.ts +294 -0
  180. package/src/api/design/create/grids.ts +137 -0
  181. package/src/api/design/create/index.ts +823 -114
  182. package/src/api/design/create/opening-fields.ts +40 -0
  183. package/src/api/design/delete/index.ts +5 -0
  184. package/src/api/design/dimensions.ts +453 -0
  185. package/src/api/design/doors/index.ts +64 -41
  186. package/src/api/design/family.ts +1342 -0
  187. package/src/api/design/furniture/index.ts +34 -0
  188. package/src/api/design/grids.ts +237 -0
  189. package/src/api/design/index.ts +49 -4
  190. package/src/api/design/networks.ts +607 -0
  191. package/src/api/design/query/geometry/index.ts +35 -4
  192. package/src/api/design/query/grids.ts +197 -0
  193. package/src/api/design/query/index.ts +105 -3
  194. package/src/api/design/types/index.ts +31 -24
  195. package/src/api/design/update/index.ts +398 -4
  196. package/src/api/design/visibility.ts +34 -0
  197. package/src/api/design/windows/index.ts +40 -22
  198. package/src/api/entity/buildableEnvelope.ts +77 -2
  199. package/src/api/entity/referenceLine.ts +25 -12
  200. package/src/api/presentation/annotate.ts +90 -58
  201. package/src/api/presentation/camera.ts +289 -0
  202. package/src/api/presentation/drawingContract.ts +70 -0
  203. package/src/api/presentation/drawings.ts +1179 -0
  204. package/src/api/presentation/export.ts +32 -6
  205. package/src/api/presentation/graphics.ts +324 -0
  206. package/src/api/presentation/index.ts +73 -14
  207. package/src/api/presentation/placedViews.ts +119 -28
  208. package/src/api/presentation/sections.ts +420 -0
  209. package/src/api/presentation/sheets.ts +181 -20
  210. package/src/api/presentation/standards.ts +445 -0
  211. package/src/api/presentation/viewPresets.ts +241 -0
  212. package/src/api/presentation/views.ts +81 -10
  213. package/src/api/presentation/walkthroughs.ts +1201 -0
  214. package/src/api/program/departments.ts +54 -2
  215. package/src/api/program/index.ts +16 -6
  216. package/src/api/program/labels.ts +332 -0
  217. package/src/api/program/metadata.ts +364 -0
  218. package/src/api/program/spreadsheet.ts +282 -0
  219. package/src/api/workspace/index.ts +51 -2
  220. package/src/errors/codes.ts +7 -0
  221. package/src/handles.ts +42 -3
  222. package/src/index.ts +2 -0
  223. package/src/massParameters.ops.ts +246 -0
  224. package/src/massParameters.ts +427 -0
  225. package/test/drawingContract.test.mjs +288 -0
  226. package/test/errors.test.mjs +1 -0
  227. package/test/massParameters.test.mjs +952 -0
  228. package/test/paperPensContract.test.mjs +75 -0
  229. package/test/presentationViewSettings.test.mjs +85 -0
@@ -1,14 +1,15 @@
1
1
  import * as z from "zod"
2
+ import { PluginExportFileName } from "./drawingContract"
2
3
 
3
4
  /**
4
5
  * Presentation export — render the Present-mode layout sheets to a downloadable
5
- * file (PDF / PNG / JPG) and hand the plugin the bytes as base64.
6
+ * file (PDF / PNG / JPG), returning base64 by default or starting a browser download.
6
7
  *
7
8
  * This wraps the same pipeline the Present-mode **Export** dialog drives:
8
9
  * each sheet is serialized to an SVG, then either composed into a PDF
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).
10
+ * (svg2pdf/jspdf) or rasterized to a PNG/JPG. By default the plugin receives the
11
+ * encoded bytes to save, upload or preview. With `download: true`, the host
12
+ * initiates browser downloads and returns metadata only, keeping agent results small.
12
13
  *
13
14
  * Requires **Present mode to be open** (the documentation editor); the call
14
15
  * throws `PRECONDITION_FAILED` when it is not.
@@ -60,19 +61,27 @@ export type PluginPresentationExportResolution = z.infer<
60
61
  * | `sheetIds` | `string[] \| undefined` | Sheets to export (all sheets when omitted) |
61
62
  * | `combine` | `boolean \| undefined` | PDF only: one multi-page file (default `true`) vs one file per sheet |
62
63
  * | `resolution` | {@linkcode PluginPresentationExportResolution}` \| undefined` | Raster target size (`png`/`jpg` only) |
63
- * | `fileName` | `string \| undefined` | Base file name (without extension) |
64
+ * | `fileName` | `string \| undefined` | Base file name WITHOUT an extension (`"Floor Pattern View"`, never `"Floor Pattern View.pdf"`); the host appends the extension for the format, and a name ending in .pdf/.svg/.png/.jpg/.jpeg, a dot or a space is rejected |
65
+ * | `download` | `boolean \| undefined` | Start browser downloads and return metadata without base64 (default `false`) |
64
66
  */
65
67
  export const PluginPresentationExportArgs = z.object({
66
68
  format: PluginPresentationExportFormat,
67
69
  sheetIds: z.array(z.string()).optional(),
68
70
  combine: z.boolean().optional(),
69
71
  resolution: PluginPresentationExportResolution.optional(),
70
- fileName: z.string().optional(),
72
+ fileName: PluginExportFileName.optional(),
73
+ download: z.boolean().optional(),
71
74
  })
72
75
  export type PluginPresentationExportArgs = z.infer<
73
76
  typeof PluginPresentationExportArgs
74
77
  >
75
78
 
79
+ /** Options after the positional export format. Omitted `download` preserves base64 results. */
80
+ export type PluginPresentationExportOptions = Omit<
81
+ PluginPresentationExportArgs,
82
+ "format"
83
+ >
84
+
76
85
  /**
77
86
  * A single exported file.
78
87
  *
@@ -106,3 +115,20 @@ export const PluginPresentationExportResult = z.object({
106
115
  export type PluginPresentationExportResult = z.infer<
107
116
  typeof PluginPresentationExportResult
108
117
  >
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
+ >
@@ -0,0 +1,324 @@
1
+ import * as z from "zod"
2
+ import type { PluginApiReturn } from "../../types"
3
+
4
+ /** A saved view id. Omit it to address the current Design/BIM view. */
5
+ export const PluginGraphicsViewId = z.union([
6
+ z.string().min(1),
7
+ z.number().finite().int().nonnegative(),
8
+ ])
9
+ export type PluginGraphicsViewId = z.infer<typeof PluginGraphicsViewId>
10
+
11
+ /** A scale denominator: 50 means 1:50, not a world-coordinate multiplier. */
12
+ export const PluginGraphicsScale = z.number().finite().int().min(1).max(24000)
13
+ export const PluginGraphicsDetailLevel = z.enum(["coarse", "fine"])
14
+ export type PluginGraphicsDetailLevel = z.infer<
15
+ typeof PluginGraphicsDetailLevel
16
+ >
17
+ export const PluginGraphicsViewKind = z.enum([
18
+ "plan",
19
+ "section",
20
+ "elevation",
21
+ "three-d",
22
+ ])
23
+ export const PluginGraphicsPen = z.number().finite().int().min(1).max(16)
24
+
25
+ /** Native Object Styles category keys; use these keys rather than the displayed plural labels. */
26
+ export const PluginGraphicsModelCategory = z.enum([
27
+ "Buildable Envelope",
28
+ "Ceilings",
29
+ "Columns",
30
+ "Departments",
31
+ "Doors",
32
+ "Floors",
33
+ "Furniture",
34
+ "Families",
35
+ "Facade/Mass",
36
+ "Roofs",
37
+ "Slabs",
38
+ "Space",
39
+ "Staircase",
40
+ "Beams",
41
+ "Walls",
42
+ "Windows",
43
+ ])
44
+ export const PluginGraphicsAnnotationCategory = z.enum([
45
+ "Dimension",
46
+ "Grids",
47
+ "Sections",
48
+ ])
49
+ export const PluginGraphicsCategory = z.enum([
50
+ ...PluginGraphicsModelCategory.options,
51
+ ...PluginGraphicsAnnotationCategory.options,
52
+ ])
53
+ export const PluginGraphicsOverrideCategory = z.enum([
54
+ ...PluginGraphicsCategory.options,
55
+ "Lines",
56
+ ])
57
+ export type PluginGraphicsOverrideCategory = z.infer<
58
+ typeof PluginGraphicsOverrideCategory
59
+ >
60
+
61
+ /** Project line-style ids. These select a pen and pattern together. */
62
+ export const PluginGraphicsLineStyleId = z.enum([
63
+ "thin",
64
+ "medium",
65
+ "wide",
66
+ "hidden",
67
+ "overhead",
68
+ "demolished",
69
+ "centerline",
70
+ ])
71
+ export type PluginGraphicsLineStyleId = z.infer<
72
+ typeof PluginGraphicsLineStyleId
73
+ >
74
+
75
+ /** Paper dash patterns; their lengths are paper millimetres, not model units. */
76
+ export const PluginGraphicsPatternId = z.enum([
77
+ "solid",
78
+ "dash",
79
+ "hidden",
80
+ "long-dash",
81
+ "loose-dash",
82
+ "dot",
83
+ "dash-dot",
84
+ "dash-dot-dot",
85
+ "center",
86
+ "overhead",
87
+ "demolished",
88
+ "double-dash",
89
+ "triple-dash",
90
+ ])
91
+ export type PluginGraphicsPatternId = z.infer<typeof PluginGraphicsPatternId>
92
+
93
+ /**
94
+ * Machine-readable reasons in PluginError.details.reason. Wire codes remain the
95
+ * published PRECONDITION_FAILED (feature disabled) or VALIDATION (file errors).
96
+ */
97
+ export const PluginPaperPensErrorReason = z.enum([
98
+ "PAPER_PENS_DISABLED",
99
+ "NOT_ACTIVE_VIEW",
100
+ "NOT_A_STANDARD",
101
+ "NEWER_STANDARD",
102
+ "STANDARD_TOO_LARGE",
103
+ ])
104
+ export type PluginPaperPensErrorReason = z.infer<
105
+ typeof PluginPaperPensErrorReason
106
+ >
107
+
108
+ /**
109
+ * Sparse category edit. Omitted fields stay unchanged; false clears a flag and
110
+ * null clears a pen override. Pens are numbers 1–16, never paper-mm widths.
111
+ * Lines supports flags only; annotation rows do not have a cut pen.
112
+ */
113
+ export const PluginGraphicsOverride = z
114
+ .object({
115
+ hidden: z.boolean().optional(),
116
+ halftone: z.boolean().optional(),
117
+ projection: PluginGraphicsPen.nullable().optional(),
118
+ cut: PluginGraphicsPen.nullable().optional(),
119
+ })
120
+ .strict()
121
+ export const PluginGraphicsOverrides = z
122
+ .partialRecord(PluginGraphicsOverrideCategory, PluginGraphicsOverride)
123
+ .superRefine((rows, ctx) => {
124
+ for (const [category, row] of Object.entries(rows)) {
125
+ if (!row) continue
126
+ if (
127
+ category === "Lines" &&
128
+ (row.projection !== undefined || row.cut !== undefined)
129
+ ) {
130
+ ctx.addIssue({
131
+ code: "custom",
132
+ path: [category],
133
+ message: "Lines has visibility and halftone only",
134
+ })
135
+ } else if (
136
+ PluginGraphicsAnnotationCategory.options.some(
137
+ (value) => value === category,
138
+ ) &&
139
+ row.cut !== undefined
140
+ ) {
141
+ ctx.addIssue({
142
+ code: "custom",
143
+ path: [category, "cut"],
144
+ message: "Annotation categories have no cut pen",
145
+ })
146
+ }
147
+ }
148
+ })
149
+ export type PluginGraphicsOverrides = z.infer<typeof PluginGraphicsOverrides>
150
+
151
+ /**
152
+ * One Design/BIM view's graphics. viewId:null means an unsaved current view.
153
+ * scale/scaleLabel:null means the camera has no applicable paper scale (free3D
154
+ * or a perspective section/elevation). Transient scale/detail edits are not saved.
155
+ */
156
+ export const PluginViewGraphics = z.object({
157
+ viewId: z.string().nullable(),
158
+ kind: PluginGraphicsViewKind,
159
+ scale: PluginGraphicsScale.nullable(),
160
+ scaleLabel: z.string().nullable(),
161
+ isCustomScale: z.boolean(),
162
+ detailLevel: PluginGraphicsDetailLevel,
163
+ overrides: PluginGraphicsOverrides,
164
+ })
165
+ export type PluginViewGraphics = z.infer<typeof PluginViewGraphics>
166
+
167
+ /** The same ordered scale choices as the chip, including the current exceptional scale. */
168
+ export const PluginGraphicsScaleOption = z.object({
169
+ scale: PluginGraphicsScale,
170
+ label: z.string(),
171
+ isCustomScale: z.boolean(),
172
+ })
173
+ export type PluginGraphicsScaleOption = z.infer<
174
+ typeof PluginGraphicsScaleOption
175
+ >
176
+
177
+ export const PluginGraphicsViewOptions = z
178
+ .object({ viewId: PluginGraphicsViewId.optional() })
179
+ .strict()
180
+ export type PluginGraphicsViewOptions = z.infer<
181
+ typeof PluginGraphicsViewOptions
182
+ >
183
+ export const PluginGraphicsGetArgs = PluginGraphicsViewOptions
184
+ export const PluginGraphicsSetScaleArgs = z
185
+ .object({
186
+ scale: PluginGraphicsScale,
187
+ options: PluginGraphicsViewOptions.optional(),
188
+ })
189
+ .strict()
190
+ export const PluginGraphicsSetDetailLevelArgs = z
191
+ .object({
192
+ level: PluginGraphicsDetailLevel,
193
+ options: PluginGraphicsViewOptions.optional(),
194
+ })
195
+ .strict()
196
+ export const PluginGraphicsUpdateArgs = z
197
+ .object({
198
+ overrides: PluginGraphicsOverrides,
199
+ options: PluginGraphicsViewOptions.optional(),
200
+ })
201
+ .strict()
202
+ export const PluginGraphicsResetOptions = PluginGraphicsViewOptions.extend({
203
+ category: PluginGraphicsOverrideCategory.optional(),
204
+ }).strict()
205
+ export type PluginGraphicsResetOptions = z.infer<
206
+ typeof PluginGraphicsResetOptions
207
+ >
208
+ export const PluginGraphicsResetArgs = z
209
+ .object({ options: PluginGraphicsResetOptions.optional() })
210
+ .strict()
211
+ export const PluginGraphicsNoArgs = z.object({}).strict()
212
+
213
+ /**
214
+ * Paper Pens on the Design/BIM canvas. Does not require Present mode.
215
+ *
216
+ * Scale/detail use the native UI setters: saved views persist, but these two
217
+ * settings are not model undo steps. Overrides are one saved, undoable step.
218
+ * Thin Lines is a local viewer preference, never a model save/undo or peer edit.
219
+ * All writes refuse PRECONDITION_FAILED with details.reason=PAPER_PENS_DISABLED
220
+ * while canvas-view-scale is off; reads still answer. There is no flag setter.
221
+ */
222
+ export abstract class PluginPresentationGraphicsApi {
223
+ /**
224
+ * Whether Paper Pens is enabled on this viewer. Never changes the feature flag.
225
+ * @returns The current canvas-view-scale value.
226
+ */
227
+ public abstract isEnabled(): PluginApiReturn<boolean>
228
+
229
+ /**
230
+ * Read a view's scale denominator, detail and category overrides.
231
+ * @param viewId - Saved view id; omitted uses the current view.
232
+ * @returns Its graphics, or null for an unknown/inaccessible saved view.
233
+ * @examplePrompt What scale is this plan drawn at?
234
+ */
235
+ public abstract get(
236
+ viewId?: PluginGraphicsViewId,
237
+ ): PluginApiReturn<PluginViewGraphics | null>
238
+
239
+ /**
240
+ * List the chip's scale choices for the project units, in the same order.
241
+ * Custom denominators need not be listed: any integer 1–24000 is valid.
242
+ * @param viewId - View whose current custom/other-unit scale should be included.
243
+ * @returns Scale records; [] for an unknown/inaccessible saved view.
244
+ */
245
+ public abstract listScales(
246
+ viewId?: PluginGraphicsViewId,
247
+ ): PluginApiReturn<PluginGraphicsScaleOption[]>
248
+
249
+ /**
250
+ * Set a paper view's denominator through the same path as the scale chip.
251
+ * A saved view persists this change; it is not a model undo step. Without a
252
+ * saved current view, only viewer state changes. Does not switch the camera. An inactive target refuses NOT_ACTIVE_VIEW.
253
+ * @param scale - Integer 1–24000; 50 means 1:50.
254
+ * @param options - Optional id must identify the active view; open another view first.
255
+ * @returns Updated graphics.
256
+ * @throws VALIDATION for an invalid denominator; PRECONDITION_FAILED when
257
+ * Paper Pens is off or the target has no applicable paper scale.
258
+ * @examplePrompt Set this plan to 1:50
259
+ * @example await snaptrude.presentation.graphics.setScale(50)
260
+ */
261
+ public abstract setScale(
262
+ scale: number,
263
+ options?: PluginGraphicsViewOptions,
264
+ ): PluginApiReturn<PluginViewGraphics>
265
+
266
+ /**
267
+ * Set the active plan's Coarse/Fine drawing detail through the native setter. Fine draws wall
268
+ * layers; this does not enable the project's Detailed View take-off setting.
269
+ * Saved for a saved view, not a model undo step; unsaved current views are transient.
270
+ * @param level - coarse or fine.
271
+ * @param options - Optional id must identify the active view; open another view first.
272
+ * @returns Updated graphics.
273
+ * @examplePrompt Show this plan in Fine detail
274
+ * @example await snaptrude.presentation.graphics.setDetailLevel("fine")
275
+ */
276
+ public abstract setDetailLevel(
277
+ level: PluginGraphicsDetailLevel,
278
+ options?: PluginGraphicsViewOptions,
279
+ ): PluginApiReturn<PluginViewGraphics>
280
+
281
+ /**
282
+ * Change only supplied category fields, as one saved and undoable step.
283
+ * Does not edit project standards. Requires a saved view.
284
+ * @param overrides - Known category keys and sparse fields; false/null clear overrides.
285
+ * @param options - Target saved view; omitted uses the current view. Inactive views are supported.
286
+ * @returns Updated graphics.
287
+ * @examplePrompt Halftone the furniture in this view
288
+ * @example await snaptrude.presentation.graphics.update({ Furniture: { halftone: true } })
289
+ */
290
+ public abstract update(
291
+ overrides: PluginGraphicsOverrides,
292
+ options?: PluginGraphicsViewOptions,
293
+ ): PluginApiReturn<PluginViewGraphics>
294
+
295
+ /**
296
+ * Clear one category or all category overrides, as one saved undoable step.
297
+ * The view's scale and detail level are preserved.
298
+ * @param options - Optional saved view and category; omit category to reset all rows.
299
+ * @returns Updated graphics.
300
+ */
301
+ public abstract reset(
302
+ options?: PluginGraphicsResetOptions,
303
+ ): PluginApiReturn<PluginViewGraphics>
304
+
305
+ /**
306
+ * Read the remembered Thin Lines preference. A disabled feature or capture
307
+ * suspension can make the renderer ignore a true preference temporarily.
308
+ * @returns The viewer preference, not the transient capture state.
309
+ */
310
+ public abstract isThinLinesEnabled(): PluginApiReturn<boolean>
311
+
312
+ /**
313
+ * Enable the viewer's Thin Lines preference. No model save, undo or peer change.
314
+ * capture_view and exported images deliberately suspend it and use real weights.
315
+ * @returns true.
316
+ */
317
+ public abstract enableThinLines(): PluginApiReturn<boolean>
318
+
319
+ /**
320
+ * Disable the viewer's Thin Lines preference. No model save, undo or peer change.
321
+ * @returns false.
322
+ */
323
+ public abstract disableThinLines(): PluginApiReturn<boolean>
324
+ }
@@ -1,18 +1,26 @@
1
1
  import { PluginApiReturn } from "../../types"
2
2
  import { PluginPresentationViewsApi } from "./views"
3
+ import { PluginPresentationCameraApi } from "./camera"
3
4
  import { PluginPresentationAIInspirationApi } from "./aiInspiration"
4
5
  import { PluginPresentationSheetsApi } from "./sheets"
5
6
  import { PluginPresentationPlacedViewsApi } from "./placedViews"
6
7
  import { PluginPresentationDiagramsApi } from "./diagrams"
8
+ import { PluginPresentationDrawingsApi } from "./drawings"
9
+ import { PluginPresentationViewPresetsApi } from "./viewPresets"
7
10
  import { PluginPresentationAnnotateApi } from "./annotate"
8
11
  import { PluginPresentationShapesApi } from "./shapes"
9
12
  import { PluginPresentationTablesApi } from "./tables"
10
13
  import { PluginPresentationSlideshowApi } from "./slideshow"
11
14
  import { PluginPresentationImportApi } from "./import"
15
+ import { PluginPresentationWalkthroughsApi } from "./walkthroughs"
16
+ import { PluginPresentationSectionsApi } from "./sections"
17
+ import { PluginPresentationGraphicsApi } from "./graphics"
18
+ import { PluginPresentationStandardsApi } from "./standards"
12
19
  import {
13
- PluginPresentationExportResult,
20
+ type PluginPresentationExportResult,
21
+ type PluginPresentationExportDownloadResult,
14
22
  type PluginPresentationExportFormat,
15
- type PluginPresentationExportResolution,
23
+ type PluginPresentationExportOptions,
16
24
  } from "./export"
17
25
 
18
26
  /**
@@ -26,19 +34,33 @@ import {
26
34
  * sheets, diagram placement, and import.
27
35
  *
28
36
  * - {@linkcode PluginPresentationApi.views} — Saved 2D/3D views (list, get, capture, activate, create)
29
- * - {@linkcode PluginPresentationApi.sheets} — Layout sheets (list, get, create, place views)
37
+ * - {@linkcode PluginPresentationApi.camera} — The Present canvas camera (screenshot, pan/zoom, frame sheets)
38
+ * - {@linkcode PluginPresentationApi.drawings} — Drawings made from saved views (create, rescale, crop, restyle, labels, export)
39
+ * - {@linkcode PluginPresentationApi.viewPresets} — Reusable drawing styles (list, get, create, update, copy, rename, delete)
40
+ * - {@linkcode PluginPresentationApi.sheets} — Layout sheets (list, get, create, place views and drawings)
30
41
  * - {@linkcode PluginPresentationApi.placedViews} — Views already placed on the canvas (move, scale, crop)
31
42
  * - {@linkcode PluginPresentationApi.diagrams} — Generate program/site diagram sheets, place diagram images
32
43
  * - {@linkcode PluginPresentationApi.tables} — Place data tables on sheets
33
44
  * - {@linkcode PluginPresentationApi.slideshow} — Run the Present-mode slideshow
34
45
  * - {@linkcode PluginPresentationApi.import} — Import reference images/PDFs onto the canvas
35
46
  * - {@linkcode PluginPresentationApi.aiInspiration} — Present-mode AI image/video generation
47
+ * - {@linkcode PluginPresentationApi.walkthroughs} — Camera paths through the model: create, play, capture, export as video
48
+ * - {@linkcode PluginPresentationApi.sections} — Section lines: create, edit, open their views, and read what each cuts
49
+ *
50
+ * - {@linkcode PluginPresentationApi.graphics} — Design/BIM view scale, detail, category overrides and viewer Thin Lines
51
+ * - {@linkcode PluginPresentationApi.standards} — Project graphic standards and standard-file interchange
36
52
  *
37
53
  * Accessed via `snaptrude.presentation`.
38
54
  */
39
55
  export abstract class PluginPresentationApi {
40
56
  /** Saved 2D/3D views. See {@linkcode PluginPresentationViewsApi}. */
41
57
  public abstract views: PluginPresentationViewsApi
58
+ /** The Present canvas camera — screenshot what is on screen, read/pan/zoom it, frame sheets (Present mode). See {@linkcode PluginPresentationCameraApi}. */
59
+ public abstract camera: PluginPresentationCameraApi
60
+ /** Drawing deliverables made from saved views, independent of sheet composition (Present mode). See {@linkcode PluginPresentationDrawingsApi}. */
61
+ public abstract drawings: PluginPresentationDrawingsApi
62
+ /** Reusable kernel-plan styles stored in the Present document. See {@linkcode PluginPresentationViewPresetsApi}. */
63
+ public abstract viewPresets: PluginPresentationViewPresetsApi
42
64
  /** Layout sheets — list/get/create and place views (Present mode). See {@linkcode PluginPresentationSheetsApi}. */
43
65
  public abstract sheets: PluginPresentationSheetsApi
44
66
  /** Placed views — layout of the view shapes on the canvas: move/scale/setScale/setCrop (Present mode). See {@linkcode PluginPresentationPlacedViewsApi}. */
@@ -60,18 +82,41 @@ export abstract class PluginPresentationApi {
60
82
  * {@linkcode PluginPresentationAIInspirationApi}.
61
83
  */
62
84
  public abstract aiInspiration: PluginPresentationAIInspirationApi
85
+ /**
86
+ * Walkthroughs — camera paths through the model: create (keyframes, floor
87
+ * points, camera-move presets), play, capture and export as video onto the
88
+ * Present canvas. See {@linkcode PluginPresentationWalkthroughsApi}.
89
+ */
90
+ public abstract walkthroughs: PluginPresentationWalkthroughsApi
91
+ /**
92
+ * Sections — lines on the plan that cut the model: create, edit and delete
93
+ * them, open their views, and read what each one cuts (`getCut`). See
94
+ * {@linkcode PluginPresentationSectionsApi}.
95
+ */
96
+ public abstract sections: PluginPresentationSectionsApi
97
+ /** Paper Pens scale, detail, overrides and Thin Lines on the Design/BIM canvas. */
98
+ public abstract graphics: PluginPresentationGraphicsApi
99
+ /** Project graphic standards in paper mm, including native file import/export. */
100
+ public abstract standards: PluginPresentationStandardsApi
63
101
 
64
102
  /**
65
103
  * Export the presentation's layout sheets to a downloadable file (PDF / PNG /
66
- * JPG) and return the encoded bytes as base64. Wraps the Present-mode Export
67
- * dialog pipeline headlessly. Requires Present mode to be open.
104
+ * JPG). Return base64 by default; `download: true` initiates browser downloads
105
+ * and returns metadata without base64. Requires Present mode to be open.
106
+ * `fileName` is a base name WITHOUT an extension ("Floor Pattern View", never
107
+ * "Floor Pattern View.pdf"): the host appends the extension for the format, and
108
+ * a name ending in .pdf, .svg, .png, .jpg or .jpeg, a dot or a space is rejected.
68
109
  *
69
110
  * @param format - Output format: `"pdf"`, `"png"`, or `"jpg"`.
70
111
  * @param options - Optional `sheetIds` (all sheets when omitted), `combine`
71
112
  * (PDF only — one multi-page file vs one per sheet, default `true`),
72
- * `resolution` (raster target size for `png`/`jpg`), and `fileName`.
73
- * @returns A {@linkcode PluginPresentationExportResult} — always a `files`
74
- * array (one entry for a combined PDF, one per sheet otherwise).
113
+ * `resolution` (raster target size for `png`/`jpg`), `fileName` (a base name
114
+ * WITHOUT an extension, e.g. "Floor Pattern View"; the host appends the
115
+ * extension and rejects a name ending in .pdf/.svg/.png/.jpg/.jpeg), and `download`.
116
+ * @returns A `files` array (one entry for a combined PDF, one per sheet otherwise).
117
+ * Downloads return {@linkcode PluginPresentationExportDownloadResult}; otherwise
118
+ * {@linkcode PluginPresentationExportResult}. Download initiation does not prove
119
+ * the browser saved the file; multiple downloads may require user permission.
75
120
  * @throws If Present mode is not open, a `sheetId` is unknown, or a sheet
76
121
  * fails to serialize/encode.
77
122
  *
@@ -84,22 +129,29 @@ export abstract class PluginPresentationApi {
84
129
  * # Example
85
130
  * ```ts
86
131
  * const { files } = await snaptrude.presentation.export("pdf")
132
+ * const download = await snaptrude.presentation.export("pdf", { download: true })
87
133
  * ```
88
134
  */
89
135
  public abstract export(
90
136
  format: PluginPresentationExportFormat,
91
- options?: {
92
- sheetIds?: string[]
93
- combine?: boolean
94
- resolution?: PluginPresentationExportResolution
95
- fileName?: string
96
- },
137
+ options?: PluginPresentationExportOptions & { download?: false },
97
138
  ): PluginApiReturn<PluginPresentationExportResult>
139
+ public abstract export(
140
+ format: PluginPresentationExportFormat,
141
+ options: PluginPresentationExportOptions & { download: true },
142
+ ): PluginApiReturn<PluginPresentationExportDownloadResult>
143
+ public abstract export(
144
+ format: PluginPresentationExportFormat,
145
+ options?: PluginPresentationExportOptions,
146
+ ): PluginApiReturn<
147
+ PluginPresentationExportResult | PluginPresentationExportDownloadResult
148
+ >
98
149
 
99
150
  constructor() {}
100
151
  }
101
152
 
102
153
  export * from "./views"
154
+ export * from "./camera"
103
155
  export * from "./sheets"
104
156
  export * from "./placedViews"
105
157
  export * from "./diagrams"
@@ -109,4 +161,11 @@ export * from "./tables"
109
161
  export * from "./slideshow"
110
162
  export * from "./import"
111
163
  export * from "./aiInspiration"
164
+ export * from "./walkthroughs"
165
+ export * from "./sections"
166
+ export * from "./graphics"
167
+ export * from "./standards"
112
168
  export * from "./export"
169
+ export * from "./drawings"
170
+ export * from "./drawingContract"
171
+ export * from "./viewPresets"