@snaptrude/plugin-core 0.11.0-rc.1 → 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 (226) hide show
  1. package/AGENTS.md +4 -0
  2. package/CHANGELOG.md +176 -14
  3. package/api-manifest.json +872 -49
  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 +447 -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/proposals/index.d.ts +4 -3
  33. package/dist/api/core/proposals/index.d.ts.map +1 -1
  34. package/dist/api/core/storeys/index.d.ts +17 -2
  35. package/dist/api/core/storeys/index.d.ts.map +1 -1
  36. package/dist/api/core/storeys/layers.d.ts +408 -0
  37. package/dist/api/core/storeys/layers.d.ts.map +1 -0
  38. package/dist/api/core/tags.d.ts +84 -3
  39. package/dist/api/core/tags.d.ts.map +1 -1
  40. package/dist/api/core/zoom/index.d.ts +13 -0
  41. package/dist/api/core/zoom/index.d.ts.map +1 -1
  42. package/dist/api/design/bim.d.ts +299 -0
  43. package/dist/api/design/bim.d.ts.map +1 -0
  44. package/dist/api/design/boolean/index.d.ts +2 -0
  45. package/dist/api/design/boolean/index.d.ts.map +1 -1
  46. package/dist/api/design/catalog.d.ts +320 -0
  47. package/dist/api/design/catalog.d.ts.map +1 -0
  48. package/dist/api/design/create/bulk-items.d.ts +269 -0
  49. package/dist/api/design/create/bulk-items.d.ts.map +1 -0
  50. package/dist/api/design/create/grids.d.ts +132 -0
  51. package/dist/api/design/create/grids.d.ts.map +1 -0
  52. package/dist/api/design/create/index.d.ts +753 -102
  53. package/dist/api/design/create/index.d.ts.map +1 -1
  54. package/dist/api/design/create/opening-fields.d.ts +38 -0
  55. package/dist/api/design/create/opening-fields.d.ts.map +1 -0
  56. package/dist/api/design/delete/index.d.ts +7 -20
  57. package/dist/api/design/delete/index.d.ts.map +1 -1
  58. package/dist/api/design/dimensions.d.ts +427 -0
  59. package/dist/api/design/dimensions.d.ts.map +1 -0
  60. package/dist/api/design/doors/index.d.ts +24 -23
  61. package/dist/api/design/doors/index.d.ts.map +1 -1
  62. package/dist/api/design/family.d.ts +1446 -0
  63. package/dist/api/design/family.d.ts.map +1 -0
  64. package/dist/api/design/grids.d.ts +237 -0
  65. package/dist/api/design/grids.d.ts.map +1 -0
  66. package/dist/api/design/index.d.ts +30 -0
  67. package/dist/api/design/index.d.ts.map +1 -1
  68. package/dist/api/design/networks.d.ts +1703 -0
  69. package/dist/api/design/networks.d.ts.map +1 -0
  70. package/dist/api/design/query/geometry/index.d.ts +33 -5
  71. package/dist/api/design/query/geometry/index.d.ts.map +1 -1
  72. package/dist/api/design/query/grids.d.ts +287 -0
  73. package/dist/api/design/query/grids.d.ts.map +1 -0
  74. package/dist/api/design/query/index.d.ts +143 -36
  75. package/dist/api/design/query/index.d.ts.map +1 -1
  76. package/dist/api/design/query/spaces.d.ts +5 -66
  77. package/dist/api/design/query/spaces.d.ts.map +1 -1
  78. package/dist/api/design/selection/index.d.ts +12 -12
  79. package/dist/api/design/types/index.d.ts +40 -24
  80. package/dist/api/design/types/index.d.ts.map +1 -1
  81. package/dist/api/design/update/index.d.ts +412 -8
  82. package/dist/api/design/update/index.d.ts.map +1 -1
  83. package/dist/api/design/windows/index.d.ts +8 -8
  84. package/dist/api/design/windows/index.d.ts.map +1 -1
  85. package/dist/api/entity/buildableEnvelope.d.ts +84 -2
  86. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  87. package/dist/api/entity/referenceLine.d.ts +13 -1
  88. package/dist/api/entity/referenceLine.d.ts.map +1 -1
  89. package/dist/api/entity/space.d.ts +12 -15
  90. package/dist/api/entity/space.d.ts.map +1 -1
  91. package/dist/api/entity/story.d.ts +4 -4
  92. package/dist/api/presentation/aiInspiration.d.ts +24 -24
  93. package/dist/api/presentation/annotate.d.ts +38 -22
  94. package/dist/api/presentation/annotate.d.ts.map +1 -1
  95. package/dist/api/presentation/camera.d.ts +265 -0
  96. package/dist/api/presentation/camera.d.ts.map +1 -0
  97. package/dist/api/presentation/drawingContract.d.ts +32 -0
  98. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  99. package/dist/api/presentation/drawings.d.ts +3523 -0
  100. package/dist/api/presentation/drawings.d.ts.map +1 -0
  101. package/dist/api/presentation/export.d.ts +23 -5
  102. package/dist/api/presentation/export.d.ts.map +1 -1
  103. package/dist/api/presentation/graphics.d.ts +419 -0
  104. package/dist/api/presentation/graphics.d.ts.map +1 -0
  105. package/dist/api/presentation/index.d.ts +66 -12
  106. package/dist/api/presentation/index.d.ts.map +1 -1
  107. package/dist/api/presentation/placedViews.d.ts +117 -51
  108. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  109. package/dist/api/presentation/sections.d.ts +461 -0
  110. package/dist/api/presentation/sections.d.ts.map +1 -0
  111. package/dist/api/presentation/shapes.d.ts +2 -2
  112. package/dist/api/presentation/sheets.d.ts +175 -37
  113. package/dist/api/presentation/sheets.d.ts.map +1 -1
  114. package/dist/api/presentation/standards.d.ts +590 -0
  115. package/dist/api/presentation/standards.d.ts.map +1 -0
  116. package/dist/api/presentation/viewPresets.d.ts +222 -0
  117. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  118. package/dist/api/presentation/views.d.ts +144 -9
  119. package/dist/api/presentation/views.d.ts.map +1 -1
  120. package/dist/api/presentation/walkthroughs.d.ts +1350 -0
  121. package/dist/api/presentation/walkthroughs.d.ts.map +1 -0
  122. package/dist/api/program/departments.d.ts +58 -2
  123. package/dist/api/program/departments.d.ts.map +1 -1
  124. package/dist/api/program/index.d.ts +16 -6
  125. package/dist/api/program/index.d.ts.map +1 -1
  126. package/dist/api/program/labels.d.ts +355 -0
  127. package/dist/api/program/labels.d.ts.map +1 -0
  128. package/dist/api/program/metadata.d.ts +328 -0
  129. package/dist/api/program/metadata.d.ts.map +1 -0
  130. package/dist/api/program/site.d.ts +4 -4
  131. package/dist/api/program/spreadsheet.d.ts +267 -4
  132. package/dist/api/program/spreadsheet.d.ts.map +1 -1
  133. package/dist/api/workspace/index.d.ts +49 -2
  134. package/dist/api/workspace/index.d.ts.map +1 -1
  135. package/dist/errors/codes.d.ts +5 -8
  136. package/dist/errors/codes.d.ts.map +1 -1
  137. package/dist/handles.d.ts +32 -3
  138. package/dist/handles.d.ts.map +1 -1
  139. package/dist/index.cjs +6534 -2865
  140. package/dist/index.cjs.map +1 -1
  141. package/dist/index.d.ts +2 -0
  142. package/dist/index.d.ts.map +1 -1
  143. package/dist/index.js +6118 -2857
  144. package/dist/index.js.map +1 -1
  145. package/dist/massParameters.d.ts +287 -0
  146. package/dist/massParameters.d.ts.map +1 -0
  147. package/dist/massParameters.ops.d.ts +138 -0
  148. package/dist/massParameters.ops.d.ts.map +1 -0
  149. package/package.json +2 -1
  150. package/scripts/check-dist-fresh.mjs +22 -0
  151. package/scripts/generate-manifest.mjs +5 -0
  152. package/scripts/generate-manifest.test.mjs +14 -3
  153. package/src/api/core/camera/index.ts +429 -1
  154. package/src/api/core/geom/create/index.ts +1037 -102
  155. package/src/api/core/geom/query/brep.ts +60 -2
  156. package/src/api/core/geom/query/curve.ts +26 -2
  157. package/src/api/core/geom/query/edge.ts +2 -2
  158. package/src/api/core/geom/query/face.ts +109 -4
  159. package/src/api/core/geom/update/contour.ts +10 -2
  160. package/src/api/core/geom/update/profile.ts +2 -0
  161. package/src/api/core/handles/index.ts +3 -2
  162. package/src/api/core/index.ts +4 -4
  163. package/src/api/core/io/import/index.ts +11 -3
  164. package/src/api/core/layers.ts +380 -173
  165. package/src/api/core/mode/index.ts +19 -7
  166. package/src/api/core/proposals/index.ts +4 -3
  167. package/src/api/core/storeys/index.ts +19 -2
  168. package/src/api/core/storeys/layers.ts +339 -0
  169. package/src/api/core/tags.ts +76 -0
  170. package/src/api/core/zoom/index.ts +13 -0
  171. package/src/api/design/bim.ts +210 -0
  172. package/src/api/design/boolean/index.ts +2 -0
  173. package/src/api/design/catalog.ts +203 -0
  174. package/src/api/design/create/bulk-items.ts +294 -0
  175. package/src/api/design/create/grids.ts +137 -0
  176. package/src/api/design/create/index.ts +824 -141
  177. package/src/api/design/create/opening-fields.ts +40 -0
  178. package/src/api/design/delete/index.ts +6 -20
  179. package/src/api/design/dimensions.ts +453 -0
  180. package/src/api/design/doors/index.ts +64 -41
  181. package/src/api/design/family.ts +1342 -0
  182. package/src/api/design/grids.ts +237 -0
  183. package/src/api/design/index.ts +49 -4
  184. package/src/api/design/networks.ts +607 -0
  185. package/src/api/design/query/geometry/index.ts +35 -4
  186. package/src/api/design/query/grids.ts +197 -0
  187. package/src/api/design/query/index.ts +105 -5
  188. package/src/api/design/query/spaces.ts +0 -68
  189. package/src/api/design/types/index.ts +31 -24
  190. package/src/api/design/update/index.ts +398 -4
  191. package/src/api/design/windows/index.ts +40 -22
  192. package/src/api/entity/buildableEnvelope.ts +77 -2
  193. package/src/api/entity/referenceLine.ts +25 -12
  194. package/src/api/entity/space.ts +0 -2
  195. package/src/api/presentation/annotate.ts +90 -58
  196. package/src/api/presentation/camera.ts +289 -0
  197. package/src/api/presentation/drawingContract.ts +70 -0
  198. package/src/api/presentation/drawings.ts +1179 -0
  199. package/src/api/presentation/export.ts +32 -6
  200. package/src/api/presentation/graphics.ts +324 -0
  201. package/src/api/presentation/index.ts +73 -14
  202. package/src/api/presentation/placedViews.ts +120 -57
  203. package/src/api/presentation/sections.ts +420 -0
  204. package/src/api/presentation/sheets.ts +182 -37
  205. package/src/api/presentation/standards.ts +445 -0
  206. package/src/api/presentation/viewPresets.ts +241 -0
  207. package/src/api/presentation/views.ts +81 -10
  208. package/src/api/presentation/walkthroughs.ts +1201 -0
  209. package/src/api/program/departments.ts +54 -2
  210. package/src/api/program/index.ts +16 -6
  211. package/src/api/program/labels.ts +332 -0
  212. package/src/api/program/metadata.ts +364 -0
  213. package/src/api/program/spreadsheet.ts +282 -0
  214. package/src/api/workspace/index.ts +51 -2
  215. package/src/errors/codes.ts +9 -30
  216. package/src/handles.ts +42 -3
  217. package/src/index.ts +2 -0
  218. package/src/massParameters.ops.ts +246 -0
  219. package/src/massParameters.ts +427 -0
  220. package/test/drawingContract.test.mjs +288 -0
  221. package/test/errors.test.mjs +1 -4
  222. package/test/massParameters.test.mjs +952 -0
  223. package/test/paperPensContract.test.mjs +75 -0
  224. package/test/presentationViewSettings.test.mjs +85 -0
  225. package/api-manifest.full.json +0 -6928
  226. package/snaptrude-plugin-core-0.11.0.tgz +0 -0
@@ -1,6 +1,7 @@
1
1
  import * as z from "zod"
2
2
  import { PluginApiReturn } from "../../types"
3
- import { PluginSheetPosition, PluginViewLod } from "./sheets"
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.
@@ -613,23 +621,6 @@ export abstract class PluginPresentationPlacedViewsApi {
613
621
  shapeId: string,
614
622
  enabled: boolean,
615
623
  ): PluginApiReturn<void>
616
-
617
- /**
618
- * Set the level of detail a placed view renders at — `"design"` (the
619
- * Design-mode massing representation) or `"bim"` (the detailed BIM
620
- * representation). Views only. Undoable. Requires Present mode to be open.
621
- *
622
- * @param shapeId - The placed view shape.
623
- * @param lod - Target level of detail.
624
- * @throws If Present mode is not open or `shapeId` is not a placed view.
625
- *
626
- * @examplePrompt Switch this placed view to the BIM level of detail
627
- * @examplePrompt Show the massing version of the placed plan
628
- */
629
- public abstract setLod(
630
- shapeId: string,
631
- lod: PluginViewLod,
632
- ): PluginApiReturn<void>
633
624
  }
634
625
 
635
626
  /** A point in crop space — fractions (0–1) of the uncropped view. */
@@ -674,8 +665,6 @@ export type PluginPlacedViewCrop = z.infer<typeof PluginPlacedViewCrop>
674
665
  * | `rotation` | `number` | Rotation in radians, `[0, 2π)` (nonzero only for 3D views — 2D views cannot rotate; set with `setRotation`) |
675
666
  * | `crop` | {@linkcode PluginPlacedViewCrop}` \| null` | Crop window (`null` when uncropped) |
676
667
  * | `isUnlinked` | `boolean` | Whether the source proposal was removed (an unlinked view no longer refreshes) |
677
- * | `lod` | {@linkcode PluginViewLod}? | Level of detail the view renders at (`"design"` massing / `"bim"` detail); absent on views that predate LOD variants (set with `setLod`) |
678
- * | `inactiveBuildingMask` | `boolean`? | Whether inactive proposal buildings are masked (the `setMask` toggle); absent when never set (masked by default) |
679
668
  */
680
669
  export const PluginPlacedView = z.object({
681
670
  shapeId: z.string(),
@@ -689,8 +678,6 @@ export const PluginPlacedView = z.object({
689
678
  rotation: z.number(),
690
679
  crop: PluginPlacedViewCrop.nullable(),
691
680
  isUnlinked: z.boolean(),
692
- lod: PluginViewLod.optional(),
693
- inactiveBuildingMask: z.boolean().optional(),
694
681
  })
695
682
  export type PluginPlacedView = z.infer<typeof PluginPlacedView>
696
683
 
@@ -762,7 +749,7 @@ export type PluginPresentationPlacedViewsScaleArgs = z.infer<
762
749
  */
763
750
  export const PluginPresentationPlacedViewsSetScaleArgs = z.object({
764
751
  shapeId: z.string(),
765
- scale: z.number().positive(),
752
+ scale: PluginStandardDrawingScale,
766
753
  })
767
754
  export type PluginPresentationPlacedViewsSetScaleArgs = z.infer<
768
755
  typeof PluginPresentationPlacedViewsSetScaleArgs
@@ -815,11 +802,28 @@ export const PluginViewSettingCategory = z.enum([
815
802
  "Envelope",
816
803
  "Facade/Mass",
817
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",
818
820
  "Reference Line",
819
821
  "Adjacency Line",
820
822
  "Landscape elements",
821
823
  ])
822
- export type PluginViewSettingCategory = z.infer<typeof PluginViewSettingCategory>
824
+ export type PluginViewSettingCategory = z.infer<
825
+ typeof PluginViewSettingCategory
826
+ >
823
827
 
824
828
  /** The 7 line dash styles (mirrors the host's LINE_STYLES). */
825
829
  export const PluginViewLineStyle = z.enum([
@@ -845,7 +849,7 @@ export type PluginViewLineStyle = z.infer<typeof PluginViewLineStyle>
845
849
  * | `lineStyle` | {@linkcode PluginViewLineStyle}? | Dash pattern |
846
850
  * | `lineColor` | `string`? | Line color, 6-digit hex (`#` optional) |
847
851
  * | `dashLength` | `number`? | Dash-length multiplier (> 0; `1` = default) |
848
- * | `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) |
849
853
  * | `cutWidth` | `number`? | Cut-line weight in mm |
850
854
  * | `projectionWidth` | `number`? | Projection-line weight in mm |
851
855
  * | `treeLineWidth` | `number`? | Tree line weight in mm (Landscape) |
@@ -878,8 +882,13 @@ export const PluginPlacedViewStylePatch = z
878
882
  colorMode: z
879
883
  .string()
880
884
  .refine(
881
- (v) => ["department", "texture", "monochrome"].includes(v) || v.startsWith("tag:"),
882
- { 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
+ },
883
892
  )
884
893
  .optional(),
885
894
  opacity: z.number().finite().min(0).max(100).optional(),
@@ -891,13 +900,42 @@ export const PluginPlacedViewStylePatch = z
891
900
  viewStyle: z.enum(["NONE", "FILLET", "BUBBLE"]).optional(),
892
901
  radius: z.number().finite().min(0).optional(),
893
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(),
894
924
  })
895
925
  .strict()
896
- .refine((p) => Object.keys(p).length > 0, { message: "patch must set at least one setting" })
897
- 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
+ >
898
932
 
899
933
  /** Label types that carry typography in a category's Text tab. */
900
- export const PluginViewLabelType = z.enum(["objectLabels", "department", "areas"])
934
+ export const PluginViewLabelType = z.enum([
935
+ "objectLabels",
936
+ "department",
937
+ "areas",
938
+ ])
901
939
  export type PluginViewLabelType = z.infer<typeof PluginViewLabelType>
902
940
 
903
941
  /** Typography patch for one label type. `fontSize` is in px. */
@@ -906,7 +944,10 @@ const PluginViewFontVariantPatch = z
906
944
  fontFamily: z.string().min(1).optional(),
907
945
  fontWeight: z
908
946
  .string()
909
- .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
+ )
910
951
  .optional(),
911
952
  fontStyle: z.enum(["normal", "italic"]).optional(),
912
953
  fontSize: z.number().finite().positive().max(200).optional(),
@@ -931,8 +972,12 @@ export const PluginPlacedViewFontStylesPatch = z
931
972
  areas: PluginViewFontVariantPatch.optional(),
932
973
  })
933
974
  .strict()
934
- .refine((p) => Object.keys(p).length > 0, { message: "patch must set at least one field" })
935
- 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
+ >
936
981
 
937
982
  /** Resolved font styles for one label type (fontSize in px). */
938
983
  export type PluginViewFontVariant = {
@@ -982,12 +1027,25 @@ export type PluginPlacedViewStylesResult = {
982
1027
  }
983
1028
 
984
1029
  /** Arguments for {@link PluginPresentationPlacedViewsApi.updateStyles}. */
985
- export const PluginPlacedViewsUpdateStylesArgs = z.object({
986
- shapeId: z.string().min(1),
987
- category: PluginViewSettingCategory,
988
- patch: PluginPlacedViewStylePatch,
989
- })
990
- 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
+ >
991
1049
 
992
1050
  /** Arguments for {@link PluginPresentationPlacedViewsApi.updateFontStyles}. */
993
1051
  export const PluginPlacedViewsUpdateFontStylesArgs = z.object({
@@ -1032,7 +1090,9 @@ export const PluginPlacedViewsMoveLabelArgs = z.object({
1032
1090
  labelId: z.string().min(1),
1033
1091
  position: PluginSheetPosition,
1034
1092
  })
1035
- export type PluginPlacedViewsMoveLabelArgs = z.infer<typeof PluginPlacedViewsMoveLabelArgs>
1093
+ export type PluginPlacedViewsMoveLabelArgs = z.infer<
1094
+ typeof PluginPlacedViewsMoveLabelArgs
1095
+ >
1036
1096
 
1037
1097
  /** Arguments for {@link PluginPresentationPlacedViewsApi.setLabelHidden}. */
1038
1098
  export const PluginPlacedViewsSetLabelHiddenArgs = z.object({
@@ -1102,14 +1162,18 @@ export const PluginPlacedViewsMoveShapeArgs = z.object({
1102
1162
  position: PluginSheetPosition,
1103
1163
  sheetId: z.string().optional(),
1104
1164
  })
1105
- export type PluginPlacedViewsMoveShapeArgs = z.infer<typeof PluginPlacedViewsMoveShapeArgs>
1165
+ export type PluginPlacedViewsMoveShapeArgs = z.infer<
1166
+ typeof PluginPlacedViewsMoveShapeArgs
1167
+ >
1106
1168
 
1107
1169
  /** Arguments for {@link PluginPresentationPlacedViewsApi.resizeShape}. */
1108
1170
  export const PluginPlacedViewsResizeShapeArgs = z.object({
1109
1171
  shapeId: z.string().min(1),
1110
1172
  factor: z.number().finite().min(0.01).max(100),
1111
1173
  })
1112
- export type PluginPlacedViewsResizeShapeArgs = z.infer<typeof PluginPlacedViewsResizeShapeArgs>
1174
+ export type PluginPlacedViewsResizeShapeArgs = z.infer<
1175
+ typeof PluginPlacedViewsResizeShapeArgs
1176
+ >
1113
1177
 
1114
1178
  /** Arguments for {@link PluginPresentationPlacedViewsApi.rotateShape}. */
1115
1179
  export const PluginPresentationPlacedViewsRotateShapeArgs = z.object({
@@ -1124,25 +1188,24 @@ export type PluginPresentationPlacedViewsRotateShapeArgs = z.infer<
1124
1188
  export const PluginPlacedViewsDeleteShapesArgs = z.object({
1125
1189
  shapeIds: z.array(z.string().min(1)).min(1).max(500),
1126
1190
  })
1127
- export type PluginPlacedViewsDeleteShapesArgs = z.infer<typeof PluginPlacedViewsDeleteShapesArgs>
1191
+ export type PluginPlacedViewsDeleteShapesArgs = z.infer<
1192
+ typeof PluginPlacedViewsDeleteShapesArgs
1193
+ >
1128
1194
 
1129
1195
  /** Arguments for {@link PluginPresentationPlacedViewsApi.setOpacity}. */
1130
1196
  export const PluginPlacedViewsSetOpacityArgs = z.object({
1131
1197
  shapeId: z.string().min(1),
1132
1198
  opacity: z.number().finite().min(0).max(1),
1133
1199
  })
1134
- export type PluginPlacedViewsSetOpacityArgs = z.infer<typeof PluginPlacedViewsSetOpacityArgs>
1200
+ export type PluginPlacedViewsSetOpacityArgs = z.infer<
1201
+ typeof PluginPlacedViewsSetOpacityArgs
1202
+ >
1135
1203
 
1136
1204
  /** Arguments for {@link PluginPresentationPlacedViewsApi.setMask}. */
1137
1205
  export const PluginPlacedViewsSetMaskArgs = z.object({
1138
1206
  shapeId: z.string().min(1),
1139
1207
  enabled: z.boolean(),
1140
1208
  })
1141
- export type PluginPlacedViewsSetMaskArgs = z.infer<typeof PluginPlacedViewsSetMaskArgs>
1142
-
1143
- /** Arguments for {@link PluginPresentationPlacedViewsApi.setLod}. */
1144
- export const PluginPlacedViewsSetLodArgs = z.object({
1145
- shapeId: z.string().min(1),
1146
- lod: PluginViewLod,
1147
- })
1148
- export type PluginPlacedViewsSetLodArgs = z.infer<typeof PluginPlacedViewsSetLodArgs>
1209
+ export type PluginPlacedViewsSetMaskArgs = z.infer<
1210
+ typeof PluginPlacedViewsSetMaskArgs
1211
+ >