@snaptrude/plugin-core 0.9.16 → 0.9.18-voids-20261016.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 (107) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/api-manifest.full.json +10406 -0
  3. package/api-manifest.json +827 -51
  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 +29 -0
  7. package/dist/api/core/camera/index.d.ts.map +1 -1
  8. package/dist/api/core/geom/create/index.d.ts +7 -1
  9. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  10. package/dist/api/core/geom/update/contour.d.ts +8 -2
  11. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  12. package/dist/api/core/zoom/index.d.ts +13 -0
  13. package/dist/api/core/zoom/index.d.ts.map +1 -1
  14. package/dist/api/design/bim.d.ts +209 -0
  15. package/dist/api/design/bim.d.ts.map +1 -0
  16. package/dist/api/design/boolean/index.d.ts +2 -0
  17. package/dist/api/design/boolean/index.d.ts.map +1 -1
  18. package/dist/api/design/catalog.d.ts +320 -0
  19. package/dist/api/design/catalog.d.ts.map +1 -0
  20. package/dist/api/design/create/bulk-items.d.ts +65 -25
  21. package/dist/api/design/create/bulk-items.d.ts.map +1 -1
  22. package/dist/api/design/create/index.d.ts +272 -99
  23. package/dist/api/design/create/index.d.ts.map +1 -1
  24. package/dist/api/design/create/opening-fields.d.ts +13 -12
  25. package/dist/api/design/create/opening-fields.d.ts.map +1 -1
  26. package/dist/api/design/delete/index.d.ts +1 -0
  27. package/dist/api/design/delete/index.d.ts.map +1 -1
  28. package/dist/api/design/doors/index.d.ts +18 -24
  29. package/dist/api/design/doors/index.d.ts.map +1 -1
  30. package/dist/api/design/family.d.ts +797 -27
  31. package/dist/api/design/family.d.ts.map +1 -1
  32. package/dist/api/design/index.d.ts +16 -0
  33. package/dist/api/design/index.d.ts.map +1 -1
  34. package/dist/api/design/networks.d.ts +1703 -0
  35. package/dist/api/design/networks.d.ts.map +1 -0
  36. package/dist/api/design/query/index.d.ts +42 -32
  37. package/dist/api/design/query/index.d.ts.map +1 -1
  38. package/dist/api/design/selection/index.d.ts +10 -10
  39. package/dist/api/design/types/index.d.ts +40 -24
  40. package/dist/api/design/types/index.d.ts.map +1 -1
  41. package/dist/api/design/update/index.d.ts +43 -3
  42. package/dist/api/design/update/index.d.ts.map +1 -1
  43. package/dist/api/design/windows/index.d.ts +8 -8
  44. package/dist/api/design/windows/index.d.ts.map +1 -1
  45. package/dist/api/presentation/aiInspiration.d.ts +10 -10
  46. package/dist/api/presentation/annotate.d.ts +38 -22
  47. package/dist/api/presentation/annotate.d.ts.map +1 -1
  48. package/dist/api/presentation/drawingContract.d.ts +32 -0
  49. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  50. package/dist/api/presentation/drawings.d.ts +3523 -0
  51. package/dist/api/presentation/drawings.d.ts.map +1 -0
  52. package/dist/api/presentation/export.d.ts +23 -5
  53. package/dist/api/presentation/export.d.ts.map +1 -1
  54. package/dist/api/presentation/index.d.ts +41 -12
  55. package/dist/api/presentation/index.d.ts.map +1 -1
  56. package/dist/api/presentation/placedViews.d.ts +106 -6
  57. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  58. package/dist/api/presentation/sections.d.ts +461 -0
  59. package/dist/api/presentation/sections.d.ts.map +1 -0
  60. package/dist/api/presentation/shapes.d.ts +2 -2
  61. package/dist/api/presentation/sheets.d.ts +175 -19
  62. package/dist/api/presentation/sheets.d.ts.map +1 -1
  63. package/dist/api/presentation/viewPresets.d.ts +222 -0
  64. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  65. package/dist/api/presentation/views.d.ts +103 -5
  66. package/dist/api/presentation/views.d.ts.map +1 -1
  67. package/dist/api/presentation/walkthroughs.d.ts +6 -6
  68. package/dist/errors/codes.d.ts +3 -1
  69. package/dist/errors/codes.d.ts.map +1 -1
  70. package/dist/index.cjs +3749 -2328
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.js +3616 -2328
  73. package/dist/index.js.map +1 -1
  74. package/package.json +1 -1
  75. package/scripts/generate-manifest.mjs +5 -0
  76. package/src/api/core/camera/index.ts +29 -0
  77. package/src/api/core/geom/create/index.ts +7 -1
  78. package/src/api/core/geom/update/contour.ts +8 -2
  79. package/src/api/core/zoom/index.ts +13 -0
  80. package/src/api/design/bim.ts +121 -0
  81. package/src/api/design/boolean/index.ts +2 -0
  82. package/src/api/design/catalog.ts +203 -0
  83. package/src/api/design/create/bulk-items.ts +57 -17
  84. package/src/api/design/create/index.ts +288 -120
  85. package/src/api/design/create/opening-fields.ts +15 -12
  86. package/src/api/design/delete/index.ts +1 -0
  87. package/src/api/design/doors/index.ts +58 -42
  88. package/src/api/design/family.ts +662 -32
  89. package/src/api/design/index.ts +34 -4
  90. package/src/api/design/networks.ts +607 -0
  91. package/src/api/design/query/index.ts +12 -2
  92. package/src/api/design/types/index.ts +31 -24
  93. package/src/api/design/update/index.ts +44 -3
  94. package/src/api/design/windows/index.ts +40 -22
  95. package/src/api/presentation/annotate.ts +90 -58
  96. package/src/api/presentation/drawingContract.ts +70 -0
  97. package/src/api/presentation/drawings.ts +1179 -0
  98. package/src/api/presentation/export.ts +32 -6
  99. package/src/api/presentation/index.ts +48 -14
  100. package/src/api/presentation/placedViews.ts +119 -28
  101. package/src/api/presentation/sections.ts +420 -0
  102. package/src/api/presentation/sheets.ts +181 -20
  103. package/src/api/presentation/viewPresets.ts +241 -0
  104. package/src/api/presentation/views.ts +46 -6
  105. package/src/errors/codes.ts +7 -0
  106. package/test/drawingContract.test.mjs +288 -0
  107. package/test/errors.test.mjs +1 -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
+ >
@@ -5,16 +5,20 @@ import { PluginPresentationAIInspirationApi } from "./aiInspiration"
5
5
  import { PluginPresentationSheetsApi } from "./sheets"
6
6
  import { PluginPresentationPlacedViewsApi } from "./placedViews"
7
7
  import { PluginPresentationDiagramsApi } from "./diagrams"
8
+ import { PluginPresentationDrawingsApi } from "./drawings"
9
+ import { PluginPresentationViewPresetsApi } from "./viewPresets"
8
10
  import { PluginPresentationAnnotateApi } from "./annotate"
9
11
  import { PluginPresentationShapesApi } from "./shapes"
10
12
  import { PluginPresentationTablesApi } from "./tables"
11
13
  import { PluginPresentationSlideshowApi } from "./slideshow"
12
14
  import { PluginPresentationImportApi } from "./import"
13
15
  import { PluginPresentationWalkthroughsApi } from "./walkthroughs"
16
+ import { PluginPresentationSectionsApi } from "./sections"
14
17
  import {
15
- PluginPresentationExportResult,
18
+ type PluginPresentationExportResult,
19
+ type PluginPresentationExportDownloadResult,
16
20
  type PluginPresentationExportFormat,
17
- type PluginPresentationExportResolution,
21
+ type PluginPresentationExportOptions,
18
22
  } from "./export"
19
23
 
20
24
  /**
@@ -29,7 +33,9 @@ import {
29
33
  *
30
34
  * - {@linkcode PluginPresentationApi.views} — Saved 2D/3D views (list, get, capture, activate, create)
31
35
  * - {@linkcode PluginPresentationApi.camera} — The Present canvas camera (screenshot, pan/zoom, frame sheets)
32
- * - {@linkcode PluginPresentationApi.sheets} — Layout sheets (list, get, create, place views)
36
+ * - {@linkcode PluginPresentationApi.drawings} — Drawings made from saved views (create, rescale, crop, restyle, labels, export)
37
+ * - {@linkcode PluginPresentationApi.viewPresets} — Reusable drawing styles (list, get, create, update, copy, rename, delete)
38
+ * - {@linkcode PluginPresentationApi.sheets} — Layout sheets (list, get, create, place views and drawings)
33
39
  * - {@linkcode PluginPresentationApi.placedViews} — Views already placed on the canvas (move, scale, crop)
34
40
  * - {@linkcode PluginPresentationApi.diagrams} — Generate program/site diagram sheets, place diagram images
35
41
  * - {@linkcode PluginPresentationApi.tables} — Place data tables on sheets
@@ -37,6 +43,7 @@ import {
37
43
  * - {@linkcode PluginPresentationApi.import} — Import reference images/PDFs onto the canvas
38
44
  * - {@linkcode PluginPresentationApi.aiInspiration} — Present-mode AI image/video generation
39
45
  * - {@linkcode PluginPresentationApi.walkthroughs} — Camera paths through the model: create, play, capture, export as video
46
+ * - {@linkcode PluginPresentationApi.sections} — Section lines: create, edit, open their views, and read what each cuts
40
47
  *
41
48
  * Accessed via `snaptrude.presentation`.
42
49
  */
@@ -45,6 +52,10 @@ export abstract class PluginPresentationApi {
45
52
  public abstract views: PluginPresentationViewsApi
46
53
  /** The Present canvas camera — screenshot what is on screen, read/pan/zoom it, frame sheets (Present mode). See {@linkcode PluginPresentationCameraApi}. */
47
54
  public abstract camera: PluginPresentationCameraApi
55
+ /** Drawing deliverables made from saved views, independent of sheet composition (Present mode). See {@linkcode PluginPresentationDrawingsApi}. */
56
+ public abstract drawings: PluginPresentationDrawingsApi
57
+ /** Reusable kernel-plan styles stored in the Present document. See {@linkcode PluginPresentationViewPresetsApi}. */
58
+ public abstract viewPresets: PluginPresentationViewPresetsApi
48
59
  /** Layout sheets — list/get/create and place views (Present mode). See {@linkcode PluginPresentationSheetsApi}. */
49
60
  public abstract sheets: PluginPresentationSheetsApi
50
61
  /** Placed views — layout of the view shapes on the canvas: move/scale/setScale/setCrop (Present mode). See {@linkcode PluginPresentationPlacedViewsApi}. */
@@ -72,18 +83,31 @@ export abstract class PluginPresentationApi {
72
83
  * Present canvas. See {@linkcode PluginPresentationWalkthroughsApi}.
73
84
  */
74
85
  public abstract walkthroughs: PluginPresentationWalkthroughsApi
86
+ /**
87
+ * Sections — lines on the plan that cut the model: create, edit and delete
88
+ * them, open their views, and read what each one cuts (`getCut`). See
89
+ * {@linkcode PluginPresentationSectionsApi}.
90
+ */
91
+ public abstract sections: PluginPresentationSectionsApi
75
92
 
76
93
  /**
77
94
  * Export the presentation's layout sheets to a downloadable file (PDF / PNG /
78
- * JPG) and return the encoded bytes as base64. Wraps the Present-mode Export
79
- * dialog pipeline headlessly. Requires Present mode to be open.
95
+ * JPG). Return base64 by default; `download: true` initiates browser downloads
96
+ * and returns metadata without base64. Requires Present mode to be open.
97
+ * `fileName` is a base name WITHOUT an extension ("Floor Pattern View", never
98
+ * "Floor Pattern View.pdf"): the host appends the extension for the format, and
99
+ * a name ending in .pdf, .svg, .png, .jpg or .jpeg, a dot or a space is rejected.
80
100
  *
81
101
  * @param format - Output format: `"pdf"`, `"png"`, or `"jpg"`.
82
102
  * @param options - Optional `sheetIds` (all sheets when omitted), `combine`
83
103
  * (PDF only — one multi-page file vs one per sheet, default `true`),
84
- * `resolution` (raster target size for `png`/`jpg`), and `fileName`.
85
- * @returns A {@linkcode PluginPresentationExportResult} — always a `files`
86
- * array (one entry for a combined PDF, one per sheet otherwise).
104
+ * `resolution` (raster target size for `png`/`jpg`), `fileName` (a base name
105
+ * WITHOUT an extension, e.g. "Floor Pattern View"; the host appends the
106
+ * extension and rejects a name ending in .pdf/.svg/.png/.jpg/.jpeg), and `download`.
107
+ * @returns A `files` array (one entry for a combined PDF, one per sheet otherwise).
108
+ * Downloads return {@linkcode PluginPresentationExportDownloadResult}; otherwise
109
+ * {@linkcode PluginPresentationExportResult}. Download initiation does not prove
110
+ * the browser saved the file; multiple downloads may require user permission.
87
111
  * @throws If Present mode is not open, a `sheetId` is unknown, or a sheet
88
112
  * fails to serialize/encode.
89
113
  *
@@ -96,17 +120,23 @@ export abstract class PluginPresentationApi {
96
120
  * # Example
97
121
  * ```ts
98
122
  * const { files } = await snaptrude.presentation.export("pdf")
123
+ * const download = await snaptrude.presentation.export("pdf", { download: true })
99
124
  * ```
100
125
  */
101
126
  public abstract export(
102
127
  format: PluginPresentationExportFormat,
103
- options?: {
104
- sheetIds?: string[]
105
- combine?: boolean
106
- resolution?: PluginPresentationExportResolution
107
- fileName?: string
108
- },
128
+ options?: PluginPresentationExportOptions & { download?: false },
109
129
  ): PluginApiReturn<PluginPresentationExportResult>
130
+ public abstract export(
131
+ format: PluginPresentationExportFormat,
132
+ options: PluginPresentationExportOptions & { download: true },
133
+ ): PluginApiReturn<PluginPresentationExportDownloadResult>
134
+ public abstract export(
135
+ format: PluginPresentationExportFormat,
136
+ options?: PluginPresentationExportOptions,
137
+ ): PluginApiReturn<
138
+ PluginPresentationExportResult | PluginPresentationExportDownloadResult
139
+ >
110
140
 
111
141
  constructor() {}
112
142
  }
@@ -123,4 +153,8 @@ export * from "./slideshow"
123
153
  export * from "./import"
124
154
  export * from "./aiInspiration"
125
155
  export * from "./walkthroughs"
156
+ export * from "./sections"
126
157
  export * from "./export"
158
+ export * from "./drawings"
159
+ export * from "./drawingContract"
160
+ export * from "./viewPresets"
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod"
2
2
  import { PluginApiReturn } from "../../types"
3
3
  import { PluginSheetPosition } from "./sheets"
4
+ import { PluginStandardDrawingScale } from "./drawingContract"
4
5
 
5
6
  /**
6
7
  * Placed views — the view shapes already laid out on the Present canvas.
@@ -141,14 +142,21 @@ export abstract class PluginPresentationPlacedViewsApi {
141
142
 
142
143
  /**
143
144
  * Set a placed view's architectural scale.
145
+ * `scale` must be a standard architectural scale denominator (100 means 1:100)
146
+ * in the project's unit system; any other value is rejected. Metric: 10, 20, 50,
147
+ * 100, 150, 200, 250, 500, 1000. Imperial detail: 12, 16, 24, 32, 48, 64, 96, 128,
148
+ * 192, 384, 768, 1536 (1" = 1' to 1/128" = 1'; 48 is 1/4" = 1', 96 is 1/8" = 1').
149
+ * Imperial site: 120, 240, 360, 480, 600, 1200, 2400, 3600, 4800 (1" = 10' to
150
+ * 1" = 400'). Pick the LARGEST standard scale (smallest denominator) at which the
151
+ * view still fits its frame or sheet and its room labels stay readable: for a
152
+ * building floor plan that is usually 1:50 to 1:200 (1/4" = 1' to 1/16" = 1').
153
+ * Never use a site-sized scale (1:500 and up, 1/64" = 1' (768) and smaller,
154
+ * 1" = 20' (240) and up) for a single building plan unless the user asked for it.
144
155
  *
145
156
  * Applies a standard architectural scale — the same write the placed view's
146
157
  * Scale dropdown performs. The view (and its labels) is resized about its
147
- * top-left corner so it prints at the given scale. `scale` must be one of
148
- * the standard values for the project's unit system (metric `10, 20, 50,
149
- * 100, 150, 200, 250, 500, 1000`; imperial e.g. `48` for 1/4″ = 1′, `96`
150
- * for 1/8″ = 1′, `120` for 1″ = 10′) — the same validation as
151
- * `sheets.place`. 3D views have no architectural scale — calling this on
158
+ * top-left corner so it prints at the given scale (the same validation as
159
+ * `sheets.place`). 3D views have no architectural scale — calling this on
152
160
  * one throws. Requires Present mode to be open.
153
161
  *
154
162
  * @param shapeId - The placed view shape to set the scale of.
@@ -741,7 +749,7 @@ export type PluginPresentationPlacedViewsScaleArgs = z.infer<
741
749
  */
742
750
  export const PluginPresentationPlacedViewsSetScaleArgs = z.object({
743
751
  shapeId: z.string(),
744
- scale: z.number().positive(),
752
+ scale: PluginStandardDrawingScale,
745
753
  })
746
754
  export type PluginPresentationPlacedViewsSetScaleArgs = z.infer<
747
755
  typeof PluginPresentationPlacedViewsSetScaleArgs
@@ -794,11 +802,28 @@ export const PluginViewSettingCategory = z.enum([
794
802
  "Envelope",
795
803
  "Facade/Mass",
796
804
  "Dimension",
805
+ "Grid",
806
+ "Walls",
807
+ "Columns",
808
+ "Beams",
809
+ "Doors",
810
+ "Windows",
811
+ "Floors",
812
+ "Slabs",
813
+ "Roofs",
814
+ "Ceilings",
815
+ "Staircase",
816
+ "Furniture",
817
+ "Families",
818
+ "Underlay",
819
+ "Overlay",
797
820
  "Reference Line",
798
821
  "Adjacency Line",
799
822
  "Landscape elements",
800
823
  ])
801
- export type PluginViewSettingCategory = z.infer<typeof PluginViewSettingCategory>
824
+ export type PluginViewSettingCategory = z.infer<
825
+ typeof PluginViewSettingCategory
826
+ >
802
827
 
803
828
  /** The 7 line dash styles (mirrors the host's LINE_STYLES). */
804
829
  export const PluginViewLineStyle = z.enum([
@@ -824,7 +849,7 @@ export type PluginViewLineStyle = z.infer<typeof PluginViewLineStyle>
824
849
  * | `lineStyle` | {@linkcode PluginViewLineStyle}? | Dash pattern |
825
850
  * | `lineColor` | `string`? | Line color, 6-digit hex (`#` optional) |
826
851
  * | `dashLength` | `number`? | Dash-length multiplier (> 0; `1` = default) |
827
- * | `lineWidth` | `number`? | Single line weight in mm (categories without cut/projection) |
852
+ * | `lineWidth` | `number`? | Single line weight in mm (Dimension: 0.05–0.7; otherwise non-negative) |
828
853
  * | `cutWidth` | `number`? | Cut-line weight in mm |
829
854
  * | `projectionWidth` | `number`? | Projection-line weight in mm |
830
855
  * | `treeLineWidth` | `number`? | Tree line weight in mm (Landscape) |
@@ -857,8 +882,13 @@ export const PluginPlacedViewStylePatch = z
857
882
  colorMode: z
858
883
  .string()
859
884
  .refine(
860
- (v) => ["department", "texture", "monochrome"].includes(v) || v.startsWith("tag:"),
861
- { message: "colorMode must be department, texture, monochrome, or tag:<tagCategoryId>" },
885
+ (v) =>
886
+ ["department", "texture", "monochrome"].includes(v) ||
887
+ v.startsWith("tag:"),
888
+ {
889
+ message:
890
+ "colorMode must be department, texture, monochrome, or tag:<tagCategoryId>",
891
+ },
862
892
  )
863
893
  .optional(),
864
894
  opacity: z.number().finite().min(0).max(100).optional(),
@@ -870,13 +900,42 @@ export const PluginPlacedViewStylePatch = z
870
900
  viewStyle: z.enum(["NONE", "FILLET", "BUBBLE"]).optional(),
871
901
  radius: z.number().finite().min(0).optional(),
872
902
  inset: z.number().finite().min(0).optional(),
903
+ // Dimension lengths are plotted paper millimetres, independent of drawing scale.
904
+ markerKind: z
905
+ .enum(["architecturalTick", "openArrow", "closedArrow"])
906
+ .optional(),
907
+ markerSize: z.number().finite().min(0.5).max(6).optional(),
908
+ extensionLineVisible: z.boolean().optional(),
909
+ extensionLineStyle: PluginViewLineStyle.optional(),
910
+ extensionGap: z.number().finite().min(0).max(10).optional(),
911
+ extensionOvershoot: z.number().finite().min(0).max(10).optional(),
912
+ textColor: z
913
+ .string()
914
+ .regex(/^(inherit|#[0-9a-fA-F]{6})$/)
915
+ .optional(),
916
+ textGap: z.number().finite().min(0).max(10).optional(),
917
+ textPlacement: z.literal("above").optional(),
918
+ textMask: z.boolean().optional(),
919
+ textMaskColor: z
920
+ .string()
921
+ .regex(/^#[0-9a-fA-F]{6}$/)
922
+ .optional(),
923
+ textMaskPadding: z.number().finite().min(0).max(5).optional(),
873
924
  })
874
925
  .strict()
875
- .refine((p) => Object.keys(p).length > 0, { message: "patch must set at least one setting" })
876
- export type PluginPlacedViewStylePatch = z.infer<typeof PluginPlacedViewStylePatch>
926
+ .refine((p) => Object.keys(p).length > 0, {
927
+ message: "patch must set at least one setting",
928
+ })
929
+ export type PluginPlacedViewStylePatch = z.infer<
930
+ typeof PluginPlacedViewStylePatch
931
+ >
877
932
 
878
933
  /** Label types that carry typography in a category's Text tab. */
879
- export const PluginViewLabelType = z.enum(["objectLabels", "department", "areas"])
934
+ export const PluginViewLabelType = z.enum([
935
+ "objectLabels",
936
+ "department",
937
+ "areas",
938
+ ])
880
939
  export type PluginViewLabelType = z.infer<typeof PluginViewLabelType>
881
940
 
882
941
  /** Typography patch for one label type. `fontSize` is in px. */
@@ -885,7 +944,10 @@ const PluginViewFontVariantPatch = z
885
944
  fontFamily: z.string().min(1).optional(),
886
945
  fontWeight: z
887
946
  .string()
888
- .regex(/^\d{3}$/, 'fontWeight must be a numeric string like "400" or "700"')
947
+ .regex(
948
+ /^\d{3}$/,
949
+ 'fontWeight must be a numeric string like "400" or "700"',
950
+ )
889
951
  .optional(),
890
952
  fontStyle: z.enum(["normal", "italic"]).optional(),
891
953
  fontSize: z.number().finite().positive().max(200).optional(),
@@ -910,8 +972,12 @@ export const PluginPlacedViewFontStylesPatch = z
910
972
  areas: PluginViewFontVariantPatch.optional(),
911
973
  })
912
974
  .strict()
913
- .refine((p) => Object.keys(p).length > 0, { message: "patch must set at least one field" })
914
- export type PluginPlacedViewFontStylesPatch = z.infer<typeof PluginPlacedViewFontStylesPatch>
975
+ .refine((p) => Object.keys(p).length > 0, {
976
+ message: "patch must set at least one field",
977
+ })
978
+ export type PluginPlacedViewFontStylesPatch = z.infer<
979
+ typeof PluginPlacedViewFontStylesPatch
980
+ >
915
981
 
916
982
  /** Resolved font styles for one label type (fontSize in px). */
917
983
  export type PluginViewFontVariant = {
@@ -961,12 +1027,25 @@ export type PluginPlacedViewStylesResult = {
961
1027
  }
962
1028
 
963
1029
  /** Arguments for {@link PluginPresentationPlacedViewsApi.updateStyles}. */
964
- export const PluginPlacedViewsUpdateStylesArgs = z.object({
965
- shapeId: z.string().min(1),
966
- category: PluginViewSettingCategory,
967
- patch: PluginPlacedViewStylePatch,
968
- })
969
- export type PluginPlacedViewsUpdateStylesArgs = z.infer<typeof PluginPlacedViewsUpdateStylesArgs>
1030
+ export const PluginPlacedViewsUpdateStylesArgs = z
1031
+ .object({
1032
+ shapeId: z.string().min(1),
1033
+ category: PluginViewSettingCategory,
1034
+ patch: PluginPlacedViewStylePatch,
1035
+ })
1036
+ .refine(
1037
+ ({ category, patch }) =>
1038
+ category !== "Dimension" ||
1039
+ patch.lineWidth === undefined ||
1040
+ (patch.lineWidth >= 0.05 && patch.lineWidth <= 0.7),
1041
+ {
1042
+ message: "Dimension lineWidth must be between 0.05 and 0.7 paper mm",
1043
+ path: ["patch", "lineWidth"],
1044
+ },
1045
+ )
1046
+ export type PluginPlacedViewsUpdateStylesArgs = z.infer<
1047
+ typeof PluginPlacedViewsUpdateStylesArgs
1048
+ >
970
1049
 
971
1050
  /** Arguments for {@link PluginPresentationPlacedViewsApi.updateFontStyles}. */
972
1051
  export const PluginPlacedViewsUpdateFontStylesArgs = z.object({
@@ -1011,7 +1090,9 @@ export const PluginPlacedViewsMoveLabelArgs = z.object({
1011
1090
  labelId: z.string().min(1),
1012
1091
  position: PluginSheetPosition,
1013
1092
  })
1014
- export type PluginPlacedViewsMoveLabelArgs = z.infer<typeof PluginPlacedViewsMoveLabelArgs>
1093
+ export type PluginPlacedViewsMoveLabelArgs = z.infer<
1094
+ typeof PluginPlacedViewsMoveLabelArgs
1095
+ >
1015
1096
 
1016
1097
  /** Arguments for {@link PluginPresentationPlacedViewsApi.setLabelHidden}. */
1017
1098
  export const PluginPlacedViewsSetLabelHiddenArgs = z.object({
@@ -1081,14 +1162,18 @@ export const PluginPlacedViewsMoveShapeArgs = z.object({
1081
1162
  position: PluginSheetPosition,
1082
1163
  sheetId: z.string().optional(),
1083
1164
  })
1084
- export type PluginPlacedViewsMoveShapeArgs = z.infer<typeof PluginPlacedViewsMoveShapeArgs>
1165
+ export type PluginPlacedViewsMoveShapeArgs = z.infer<
1166
+ typeof PluginPlacedViewsMoveShapeArgs
1167
+ >
1085
1168
 
1086
1169
  /** Arguments for {@link PluginPresentationPlacedViewsApi.resizeShape}. */
1087
1170
  export const PluginPlacedViewsResizeShapeArgs = z.object({
1088
1171
  shapeId: z.string().min(1),
1089
1172
  factor: z.number().finite().min(0.01).max(100),
1090
1173
  })
1091
- export type PluginPlacedViewsResizeShapeArgs = z.infer<typeof PluginPlacedViewsResizeShapeArgs>
1174
+ export type PluginPlacedViewsResizeShapeArgs = z.infer<
1175
+ typeof PluginPlacedViewsResizeShapeArgs
1176
+ >
1092
1177
 
1093
1178
  /** Arguments for {@link PluginPresentationPlacedViewsApi.rotateShape}. */
1094
1179
  export const PluginPresentationPlacedViewsRotateShapeArgs = z.object({
@@ -1103,18 +1188,24 @@ export type PluginPresentationPlacedViewsRotateShapeArgs = z.infer<
1103
1188
  export const PluginPlacedViewsDeleteShapesArgs = z.object({
1104
1189
  shapeIds: z.array(z.string().min(1)).min(1).max(500),
1105
1190
  })
1106
- export type PluginPlacedViewsDeleteShapesArgs = z.infer<typeof PluginPlacedViewsDeleteShapesArgs>
1191
+ export type PluginPlacedViewsDeleteShapesArgs = z.infer<
1192
+ typeof PluginPlacedViewsDeleteShapesArgs
1193
+ >
1107
1194
 
1108
1195
  /** Arguments for {@link PluginPresentationPlacedViewsApi.setOpacity}. */
1109
1196
  export const PluginPlacedViewsSetOpacityArgs = z.object({
1110
1197
  shapeId: z.string().min(1),
1111
1198
  opacity: z.number().finite().min(0).max(1),
1112
1199
  })
1113
- export type PluginPlacedViewsSetOpacityArgs = z.infer<typeof PluginPlacedViewsSetOpacityArgs>
1200
+ export type PluginPlacedViewsSetOpacityArgs = z.infer<
1201
+ typeof PluginPlacedViewsSetOpacityArgs
1202
+ >
1114
1203
 
1115
1204
  /** Arguments for {@link PluginPresentationPlacedViewsApi.setMask}. */
1116
1205
  export const PluginPlacedViewsSetMaskArgs = z.object({
1117
1206
  shapeId: z.string().min(1),
1118
1207
  enabled: z.boolean(),
1119
1208
  })
1120
- export type PluginPlacedViewsSetMaskArgs = z.infer<typeof PluginPlacedViewsSetMaskArgs>
1209
+ export type PluginPlacedViewsSetMaskArgs = z.infer<
1210
+ typeof PluginPlacedViewsSetMaskArgs
1211
+ >