@snaptrude/plugin-core 0.8.0 → 0.9.1

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 (129) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/api-manifest.full.json +1350 -89
  3. package/api-manifest.json +1146 -48
  4. package/dist/api/analysis/daylight.d.ts +603 -0
  5. package/dist/api/analysis/daylight.d.ts.map +1 -0
  6. package/dist/api/analysis/heatmaps.d.ts +438 -14
  7. package/dist/api/analysis/heatmaps.d.ts.map +1 -1
  8. package/dist/api/analysis/index.d.ts +15 -0
  9. package/dist/api/analysis/index.d.ts.map +1 -1
  10. package/dist/api/analysis/solar.d.ts +249 -0
  11. package/dist/api/analysis/solar.d.ts.map +1 -0
  12. package/dist/api/analysis/weather.d.ts +193 -0
  13. package/dist/api/analysis/weather.d.ts.map +1 -0
  14. package/dist/api/core/camera/index.d.ts +37 -0
  15. package/dist/api/core/camera/index.d.ts.map +1 -1
  16. package/dist/api/core/geom/create/index.d.ts +318 -1
  17. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  18. package/dist/api/core/index.d.ts +9 -0
  19. package/dist/api/core/index.d.ts.map +1 -1
  20. package/dist/api/core/io/export/index.d.ts +3 -1
  21. package/dist/api/core/io/export/index.d.ts.map +1 -1
  22. package/dist/api/core/io/import/index.d.ts +61 -0
  23. package/dist/api/core/io/import/index.d.ts.map +1 -1
  24. package/dist/api/core/io/terrain/index.d.ts +132 -0
  25. package/dist/api/core/io/terrain/index.d.ts.map +1 -1
  26. package/dist/api/core/mode/index.d.ts +99 -0
  27. package/dist/api/core/mode/index.d.ts.map +1 -0
  28. package/dist/api/core/storeys/index.d.ts +251 -0
  29. package/dist/api/core/storeys/index.d.ts.map +1 -0
  30. package/dist/api/core/tags.d.ts +24 -0
  31. package/dist/api/core/tags.d.ts.map +1 -1
  32. package/dist/api/core/zoom/index.d.ts +4 -0
  33. package/dist/api/core/zoom/index.d.ts.map +1 -1
  34. package/dist/api/design/create/index.d.ts +115 -4
  35. package/dist/api/design/create/index.d.ts.map +1 -1
  36. package/dist/api/design/delete/index.d.ts +3 -0
  37. package/dist/api/design/delete/index.d.ts.map +1 -1
  38. package/dist/api/design/query/geometry/index.d.ts +112 -0
  39. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  40. package/dist/api/design/query/index.d.ts +4 -0
  41. package/dist/api/design/query/index.d.ts.map +1 -1
  42. package/dist/api/design/query/referenceLines.d.ts +45 -0
  43. package/dist/api/design/query/referenceLines.d.ts.map +1 -0
  44. package/dist/api/design/query/spaces.d.ts +173 -0
  45. package/dist/api/design/query/spaces.d.ts.map +1 -1
  46. package/dist/api/design/transform/index.d.ts +12 -0
  47. package/dist/api/design/transform/index.d.ts.map +1 -1
  48. package/dist/api/design/update/index.d.ts +51 -1
  49. package/dist/api/design/update/index.d.ts.map +1 -1
  50. package/dist/api/entity/buildableEnvelope.d.ts +4 -0
  51. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  52. package/dist/api/entity/referenceLine.d.ts +8 -0
  53. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  54. package/dist/api/entity/story.d.ts +20 -0
  55. package/dist/api/entity/story.d.ts.map +1 -1
  56. package/dist/api/index.d.ts +5 -0
  57. package/dist/api/index.d.ts.map +1 -1
  58. package/dist/api/presentation/annotate.d.ts +23 -4
  59. package/dist/api/presentation/annotate.d.ts.map +1 -1
  60. package/dist/api/presentation/diagrams.d.ts +64 -2
  61. package/dist/api/presentation/diagrams.d.ts.map +1 -1
  62. package/dist/api/presentation/export.d.ts +4 -0
  63. package/dist/api/presentation/export.d.ts.map +1 -1
  64. package/dist/api/presentation/import.d.ts +6 -0
  65. package/dist/api/presentation/import.d.ts.map +1 -1
  66. package/dist/api/presentation/index.d.ts +20 -1
  67. package/dist/api/presentation/index.d.ts.map +1 -1
  68. package/dist/api/presentation/placedViews.d.ts +1139 -0
  69. package/dist/api/presentation/placedViews.d.ts.map +1 -0
  70. package/dist/api/presentation/shapes.d.ts +481 -0
  71. package/dist/api/presentation/shapes.d.ts.map +1 -0
  72. package/dist/api/presentation/sheets.d.ts +42 -0
  73. package/dist/api/presentation/sheets.d.ts.map +1 -1
  74. package/dist/api/presentation/slideshow.d.ts +125 -0
  75. package/dist/api/presentation/slideshow.d.ts.map +1 -0
  76. package/dist/api/presentation/tables.d.ts +81 -0
  77. package/dist/api/presentation/tables.d.ts.map +1 -0
  78. package/dist/api/program/site.d.ts +260 -2
  79. package/dist/api/program/site.d.ts.map +1 -1
  80. package/dist/api/program/spreadsheet.d.ts +260 -28
  81. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  82. package/dist/api/workspace/index.d.ts +505 -0
  83. package/dist/api/workspace/index.d.ts.map +1 -0
  84. package/dist/index.cjs +2904 -1761
  85. package/dist/index.cjs.map +1 -1
  86. package/dist/index.js +2762 -1761
  87. package/dist/index.js.map +1 -1
  88. package/package.json +3 -2
  89. package/scripts/generate-manifest.mjs +45 -0
  90. package/src/api/analysis/daylight.ts +470 -0
  91. package/src/api/analysis/heatmaps.ts +444 -17
  92. package/src/api/analysis/index.ts +15 -0
  93. package/src/api/analysis/solar.ts +237 -0
  94. package/src/api/analysis/weather.ts +179 -0
  95. package/src/api/core/camera/index.ts +39 -0
  96. package/src/api/core/geom/create/index.ts +344 -1
  97. package/src/api/core/index.ts +9 -0
  98. package/src/api/core/io/export/index.ts +3 -1
  99. package/src/api/core/io/import/index.ts +64 -0
  100. package/src/api/core/io/terrain/index.ts +143 -0
  101. package/src/api/core/mode/index.ts +96 -0
  102. package/src/api/core/storeys/index.ts +279 -0
  103. package/src/api/core/tags.ts +27 -0
  104. package/src/api/core/zoom/index.ts +4 -0
  105. package/src/api/design/create/index.ts +138 -1
  106. package/src/api/design/delete/index.ts +3 -0
  107. package/src/api/design/query/geometry/index.ts +125 -3
  108. package/src/api/design/query/index.ts +4 -0
  109. package/src/api/design/query/referenceLines.ts +52 -0
  110. package/src/api/design/query/spaces.ts +143 -0
  111. package/src/api/design/transform/index.ts +12 -0
  112. package/src/api/design/update/index.ts +66 -1
  113. package/src/api/entity/buildableEnvelope.ts +4 -0
  114. package/src/api/entity/referenceLine.ts +8 -0
  115. package/src/api/entity/story.ts +20 -0
  116. package/src/api/index.ts +5 -0
  117. package/src/api/presentation/annotate.ts +27 -2
  118. package/src/api/presentation/diagrams.ts +67 -2
  119. package/src/api/presentation/export.ts +4 -0
  120. package/src/api/presentation/import.ts +6 -0
  121. package/src/api/presentation/index.ts +20 -1
  122. package/src/api/presentation/placedViews.ts +1120 -0
  123. package/src/api/presentation/shapes.ts +274 -0
  124. package/src/api/presentation/sheets.ts +54 -0
  125. package/src/api/presentation/slideshow.ts +134 -0
  126. package/src/api/presentation/tables.ts +84 -0
  127. package/src/api/program/site.ts +205 -2
  128. package/src/api/program/spreadsheet.ts +251 -6
  129. package/src/api/workspace/index.ts +563 -0
@@ -26,12 +26,22 @@ export abstract class PluginPresentationAnnotateApi {
26
26
  * Creates a text shape on the given sheet and returns the id of the created
27
27
  * canvas shape. Requires Present mode to be open.
28
28
  *
29
+ * Typography is optional: `fontFamily` takes a system family or any Google
30
+ * Font (loaded automatically, the same loader as the Present text panel);
31
+ * `fontWeight` is a numeric weight string like `"400"` or `"700"`,
32
+ * optionally with the `-italic` suffix (e.g. `"700-italic"`) — the Present
33
+ * text panel's value domain; a weight the chosen font does not provide
34
+ * falls back to regular. `fontSizePx` sets an exact pixel size, overriding
35
+ * the `size` preset when both are given (`size` alone keeps working).
36
+ *
29
37
  * @param sheetId - The sheet to annotate.
30
38
  * @param text - The label text.
31
39
  * @param options - Optional `position` (`{ x, y }`, relative to the sheet's
32
40
  * top-left, in canvas units — defaults to the sheet's top-left corner),
33
- * `size` (`"s" | "m" | "l" | "xl"`, default `"m"`), and `color` (a named
34
- * palette color, default `"black"`).
41
+ * `size` (`"s" | "m" | "l" | "xl"`, default `"m"`), `color` (a named
42
+ * palette color, default `"black"`), and typography: `fontFamily`,
43
+ * `fontWeight` (numeric string, `-italic` suffix allowed), `fontSizePx`
44
+ * (positive px size overriding the `size` preset).
35
45
  * @returns A {@linkcode PluginPresentationAnnotateTextResult} with the created
36
46
  * `shapeId`.
37
47
  * @throws If Present mode is not open or the sheet id is invalid.
@@ -57,6 +67,9 @@ export abstract class PluginPresentationAnnotateApi {
57
67
  position?: { x: number; y: number }
58
68
  size?: PluginAnnotateTextSize
59
69
  color?: PluginAnnotateTextColor
70
+ fontFamily?: string
71
+ fontWeight?: string
72
+ fontSizePx?: number
60
73
  },
61
74
  ): PluginApiReturn<PluginPresentationAnnotateTextResult>
62
75
 
@@ -218,6 +231,9 @@ export type PluginAnnotateTextColor = z.infer<typeof PluginAnnotateTextColor>
218
231
  * | `position` | `{ x: number; y: number } \| undefined` | Where to place it (relative to the sheet) |
219
232
  * | `size` | {@linkcode PluginAnnotateTextSize}` \| undefined` | Text size preset |
220
233
  * | `color` | {@linkcode PluginAnnotateTextColor}` \| undefined` | Text color |
234
+ * | `fontFamily` | `string \| undefined` | System family or any Google Font (loaded automatically) |
235
+ * | `fontWeight` | `string \| undefined` | Numeric weight like `"400"`/`"700"`, `-italic` suffix allowed |
236
+ * | `fontSizePx` | `number \| undefined` | Exact px size (overrides the `size` preset) |
221
237
  */
222
238
  export const PluginPresentationAnnotateTextArgs = z.object({
223
239
  sheetId: z.string(),
@@ -225,6 +241,15 @@ export const PluginPresentationAnnotateTextArgs = z.object({
225
241
  position: z.object({ x: z.number(), y: z.number() }).optional(),
226
242
  size: PluginAnnotateTextSize.optional(),
227
243
  color: PluginAnnotateTextColor.optional(),
244
+ fontFamily: z.string().min(1).optional(),
245
+ fontWeight: z
246
+ .string()
247
+ .regex(
248
+ /^\d{3}(-italic)?$/,
249
+ 'fontWeight must be a numeric string like "400" or "700", optionally with the "-italic" suffix',
250
+ )
251
+ .optional(),
252
+ fontSizePx: z.number().finite().positive().optional(),
228
253
  })
229
254
  export type PluginPresentationAnnotateTextArgs = z.infer<
230
255
  typeof PluginPresentationAnnotateTextArgs
@@ -8,8 +8,10 @@ import { PluginApiReturn } from "../../types"
8
8
  * {@linkcode PluginPresentationDiagramsApi.generateProgram} runs the Present-mode
9
9
  * **Program** action: it reads the project's spaces and departments and creates
10
10
  * new layout sheets holding the generated diagram graphics.
11
+ * {@linkcode PluginPresentationDiagramsApi.generateSite} runs the site-diagram
12
+ * flow (location / streetview / climate sheets from the map terrain).
11
13
  * {@linkcode PluginPresentationDiagramsApi.place} drops ready diagram images (by
12
- * URL) onto an existing sheet and returns the created canvas shape ids. Both
14
+ * URL) onto an existing sheet and returns the created canvas shape ids. All
13
15
  * require Present mode to be open. Adjacency data itself is read and computed via
14
16
  * `program.adjacency` (see {@linkcode PluginProgramAdjacencyApi}).
15
17
  *
@@ -50,6 +52,44 @@ export abstract class PluginPresentationDiagramsApi {
50
52
  */
51
53
  public abstract generateProgram(): PluginApiReturn<PluginPresentationDiagramsGenerateResult>
52
54
 
55
+ /**
56
+ * Generate the site diagrams (location, streetview, climate) for the
57
+ * current model, creating new layout sheets.
58
+ *
59
+ * Runs the same auto-generation as the Present-mode site-diagram flow:
60
+ * each requested type renders its diagram from the project's map terrain
61
+ * and creates a new sheet holding it. `options.types` selects which
62
+ * diagrams to generate (default: all three). Generation is tracked
63
+ * per-proposal — a type whose diagram already exists for the active
64
+ * proposal is **skipped, not duplicated** (the same semantics as the
65
+ * mount-time flow; existing site-diagram sheets are never replaced), so
66
+ * `sheetIds` contains only the sheets created by this call and can be
67
+ * empty when everything already exists. Requires Present mode to be open
68
+ * and the project to have a map terrain to generate from.
69
+ *
70
+ * @param options - Optional `types` — which site diagrams to generate
71
+ * (default: `["location", "streetview", "climate"]`).
72
+ * @returns A {@linkcode PluginPresentationDiagramsGenerateResult} with the
73
+ * `sheetIds` of the sheets created by this call (empty when all requested
74
+ * types were already generated).
75
+ * @throws If Present mode is not open or the project has no map terrain to
76
+ * generate from.
77
+ *
78
+ * @examplePrompt Generate the site diagrams for this project
79
+ * @examplePrompt Create the location, streetview and climate sheets
80
+ * @examplePrompt Add a climate diagram sheet to the presentation
81
+ *
82
+ * # Example
83
+ * ```ts
84
+ * const { sheetIds } = await snaptrude.presentation.diagrams.generateSite({
85
+ * types: ["location", "climate"],
86
+ * })
87
+ * ```
88
+ */
89
+ public abstract generateSite(options?: {
90
+ types?: PluginPresentationSiteDiagramType[]
91
+ }): PluginApiReturn<PluginPresentationDiagramsGenerateResult>
92
+
53
93
  /**
54
94
  * Place diagram images onto a sheet.
55
95
  *
@@ -114,8 +154,33 @@ export type PluginPresentationDiagramsPlaceResult = z.infer<
114
154
  typeof PluginPresentationDiagramsPlaceResult
115
155
  >
116
156
 
157
+ /** A site diagram type — the three diagrams of the Present-mode site flow. */
158
+ export const PluginPresentationSiteDiagramType = z.enum([
159
+ "location",
160
+ "streetview",
161
+ "climate",
162
+ ])
163
+ export type PluginPresentationSiteDiagramType = z.infer<
164
+ typeof PluginPresentationSiteDiagramType
165
+ >
166
+
167
+ /**
168
+ * Arguments for {@linkcode PluginPresentationDiagramsApi.generateSite}.
169
+ *
170
+ * | Property | Type | Description |
171
+ * |---|---|---|
172
+ * | `types` | {@linkcode PluginPresentationSiteDiagramType}`[] \| undefined` | Which site diagrams to generate (default: all three) |
173
+ */
174
+ export const PluginPresentationDiagramsGenerateSiteArgs = z.object({
175
+ types: z.array(PluginPresentationSiteDiagramType).min(1).optional(),
176
+ })
177
+ export type PluginPresentationDiagramsGenerateSiteArgs = z.infer<
178
+ typeof PluginPresentationDiagramsGenerateSiteArgs
179
+ >
180
+
117
181
  /**
118
- * Result of {@linkcode PluginPresentationDiagramsApi.generateProgram}.
182
+ * Result of {@linkcode PluginPresentationDiagramsApi.generateProgram} and
183
+ * {@linkcode PluginPresentationDiagramsApi.generateSite}.
119
184
  *
120
185
  * | Property | Type | Description |
121
186
  * |---|---|---|
@@ -20,6 +20,10 @@ import * as z from "zod"
20
20
  *
21
21
  * Accessed via `snaptrude.presentation.export`.
22
22
  *
23
+ * For a different export intent, see `core.io.export.model` (the 3D model as a
24
+ * GLB/OBJ/FBX/3DS file) and `program.spreadsheet.export` (the area-program /
25
+ * takeoff workbook as XLSX/PDF/CSV).
26
+ *
23
27
  * The schemas and result types live here; the callable method is declared on
24
28
  * {@linkcode PluginPresentationApi.export}.
25
29
  */
@@ -20,6 +20,9 @@ export abstract class PluginPresentationImportApi {
20
20
  /**
21
21
  * Import a reference image onto the current Present sheet.
22
22
  *
23
+ * To place the image as a **scene** underlay to trace over — on a storey,
24
+ * not the Present canvas — use `core.io.import.image` instead.
25
+ *
23
26
  * @param source - The asset to import: exactly one of `url` or `dataUrl`.
24
27
  * @param options - Optional `position` — where to place the image on the
25
28
  * sheet.
@@ -50,6 +53,9 @@ export abstract class PluginPresentationImportApi {
50
53
  *
51
54
  * Each page is converted to vector SVG and placed as a canvas shape.
52
55
  *
56
+ * To bring the PDF into the **scene** as a traceable underlay — on a storey,
57
+ * not the Present canvas — use `core.io.import.pdf` instead.
58
+ *
53
59
  * @param source - The asset to import: exactly one of `url` or `dataUrl`.
54
60
  * @param options - Optional `position` — where to place the pages on the
55
61
  * sheet.
@@ -2,8 +2,12 @@ import { PluginApiReturn } from "../../types"
2
2
  import { PluginPresentationViewsApi } from "./views"
3
3
  import { PluginPresentationAIInspirationApi } from "./aiInspiration"
4
4
  import { PluginPresentationSheetsApi } from "./sheets"
5
+ import { PluginPresentationPlacedViewsApi } from "./placedViews"
5
6
  import { PluginPresentationDiagramsApi } from "./diagrams"
6
7
  import { PluginPresentationAnnotateApi } from "./annotate"
8
+ import { PluginPresentationShapesApi } from "./shapes"
9
+ import { PluginPresentationTablesApi } from "./tables"
10
+ import { PluginPresentationSlideshowApi } from "./slideshow"
7
11
  import { PluginPresentationImportApi } from "./import"
8
12
  import {
9
13
  PluginPresentationExportResult,
@@ -23,7 +27,10 @@ import {
23
27
  *
24
28
  * - {@linkcode PluginPresentationApi.views} — Saved 2D/3D views (list, get, capture, activate, create)
25
29
  * - {@linkcode PluginPresentationApi.sheets} — Layout sheets (list, get, create, place views)
26
- * - {@linkcode PluginPresentationApi.diagrams} — Place program/adjacency/site diagram images on sheets
30
+ * - {@linkcode PluginPresentationApi.placedViews} — Views already placed on the canvas (move, scale, crop)
31
+ * - {@linkcode PluginPresentationApi.diagrams} — Generate program/site diagram sheets, place diagram images
32
+ * - {@linkcode PluginPresentationApi.tables} — Place data tables on sheets
33
+ * - {@linkcode PluginPresentationApi.slideshow} — Run the Present-mode slideshow
27
34
  * - {@linkcode PluginPresentationApi.import} — Import reference images/PDFs onto the canvas
28
35
  * - {@linkcode PluginPresentationApi.aiInspiration} — Present-mode AI image/video generation
29
36
  *
@@ -34,10 +41,18 @@ export abstract class PluginPresentationApi {
34
41
  public abstract views: PluginPresentationViewsApi
35
42
  /** Layout sheets — list/get/create and place views (Present mode). See {@linkcode PluginPresentationSheetsApi}. */
36
43
  public abstract sheets: PluginPresentationSheetsApi
44
+ /** Placed views — layout of the view shapes on the canvas: move/scale/setScale/setCrop (Present mode). See {@linkcode PluginPresentationPlacedViewsApi}. */
45
+ public abstract placedViews: PluginPresentationPlacedViewsApi
37
46
  /** Program/adjacency/site diagrams — place images on sheets. See {@linkcode PluginPresentationDiagramsApi}. */
38
47
  public abstract diagrams: PluginPresentationDiagramsApi
39
48
  /** Annotations on Present-mode sheets — text/arrows/notes/geo shapes. See {@linkcode PluginPresentationAnnotateApi}. */
40
49
  public abstract annotate: PluginPresentationAnnotateApi
50
+ /** Plugin-owned keyed shapes — upsert/remove/list so reruns update instead of duplicating. See {@linkcode PluginPresentationShapesApi}. */
51
+ public abstract shapes: PluginPresentationShapesApi
52
+ /** Data tables on Present sheets — place string rows as a table shape. See {@linkcode PluginPresentationTablesApi}. */
53
+ public abstract tables: PluginPresentationTablesApi
54
+ /** The Present-mode slideshow — start/stop/getState. See {@linkcode PluginPresentationSlideshowApi}. */
55
+ public abstract slideshow: PluginPresentationSlideshowApi
41
56
  /** Import reference images/PDFs onto the Present canvas. See {@linkcode PluginPresentationImportApi}. */
42
57
  public abstract import: PluginPresentationImportApi
43
58
  /**
@@ -86,8 +101,12 @@ export abstract class PluginPresentationApi {
86
101
 
87
102
  export * from "./views"
88
103
  export * from "./sheets"
104
+ export * from "./placedViews"
89
105
  export * from "./diagrams"
90
106
  export * from "./annotate"
107
+ export * from "./shapes"
108
+ export * from "./tables"
109
+ export * from "./slideshow"
91
110
  export * from "./import"
92
111
  export * from "./aiInspiration"
93
112
  export * from "./export"