@snaptrude/plugin-core 0.9.17 → 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.
- package/api-manifest.full.json +10406 -0
- package/api-manifest.json +737 -54
- package/dist/api/analysis/daylight.d.ts +5 -5
- package/dist/api/analysis/solar.d.ts +2 -2
- package/dist/api/core/camera/index.d.ts +29 -0
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +7 -1
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/update/contour.d.ts +8 -2
- package/dist/api/core/geom/update/contour.d.ts.map +1 -1
- package/dist/api/core/zoom/index.d.ts +13 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/bim.d.ts +209 -0
- package/dist/api/design/bim.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +2 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -1
- package/dist/api/design/catalog.d.ts +320 -0
- package/dist/api/design/catalog.d.ts.map +1 -0
- package/dist/api/design/create/bulk-items.d.ts +65 -25
- package/dist/api/design/create/bulk-items.d.ts.map +1 -1
- package/dist/api/design/create/index.d.ts +272 -99
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +13 -12
- package/dist/api/design/create/opening-fields.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +1 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +18 -24
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/family.d.ts +797 -27
- package/dist/api/design/family.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +16 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/networks.d.ts +1703 -0
- package/dist/api/design/networks.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +42 -32
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +10 -10
- package/dist/api/design/types/index.d.ts +40 -24
- package/dist/api/design/types/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +43 -3
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/windows/index.d.ts +8 -8
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +10 -10
- package/dist/api/presentation/annotate.d.ts +38 -22
- package/dist/api/presentation/annotate.d.ts.map +1 -1
- package/dist/api/presentation/drawingContract.d.ts +32 -0
- package/dist/api/presentation/drawingContract.d.ts.map +1 -0
- package/dist/api/presentation/drawings.d.ts +3523 -0
- package/dist/api/presentation/drawings.d.ts.map +1 -0
- package/dist/api/presentation/export.d.ts +23 -5
- package/dist/api/presentation/export.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +32 -12
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +106 -6
- package/dist/api/presentation/placedViews.d.ts.map +1 -1
- package/dist/api/presentation/shapes.d.ts +2 -2
- package/dist/api/presentation/sheets.d.ts +175 -19
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/viewPresets.d.ts +222 -0
- package/dist/api/presentation/viewPresets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +103 -5
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/presentation/walkthroughs.d.ts +6 -6
- package/dist/errors/codes.d.ts +3 -1
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/index.cjs +3693 -2383
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3573 -2383
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/generate-manifest.mjs +5 -0
- package/src/api/core/camera/index.ts +29 -0
- package/src/api/core/geom/create/index.ts +7 -1
- package/src/api/core/geom/update/contour.ts +8 -2
- package/src/api/core/zoom/index.ts +13 -0
- package/src/api/design/bim.ts +121 -0
- package/src/api/design/boolean/index.ts +2 -0
- package/src/api/design/catalog.ts +203 -0
- package/src/api/design/create/bulk-items.ts +57 -17
- package/src/api/design/create/index.ts +288 -120
- package/src/api/design/create/opening-fields.ts +15 -12
- package/src/api/design/delete/index.ts +1 -0
- package/src/api/design/doors/index.ts +58 -42
- package/src/api/design/family.ts +662 -32
- package/src/api/design/index.ts +34 -4
- package/src/api/design/networks.ts +607 -0
- package/src/api/design/query/index.ts +12 -2
- package/src/api/design/types/index.ts +31 -24
- package/src/api/design/update/index.ts +44 -3
- package/src/api/design/windows/index.ts +40 -22
- package/src/api/presentation/annotate.ts +90 -58
- package/src/api/presentation/drawingContract.ts +70 -0
- package/src/api/presentation/drawings.ts +1179 -0
- package/src/api/presentation/export.ts +32 -6
- package/src/api/presentation/index.ts +39 -14
- package/src/api/presentation/placedViews.ts +119 -28
- package/src/api/presentation/sheets.ts +181 -20
- package/src/api/presentation/viewPresets.ts +241 -0
- package/src/api/presentation/views.ts +46 -6
- package/src/errors/codes.ts +7 -0
- package/test/drawingContract.test.mjs +288 -0
- 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)
|
|
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.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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 (
|
|
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:
|
|
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,6 +5,8 @@ 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"
|
|
@@ -13,9 +15,10 @@ import { PluginPresentationImportApi } from "./import"
|
|
|
13
15
|
import { PluginPresentationWalkthroughsApi } from "./walkthroughs"
|
|
14
16
|
import { PluginPresentationSectionsApi } from "./sections"
|
|
15
17
|
import {
|
|
16
|
-
PluginPresentationExportResult,
|
|
18
|
+
type PluginPresentationExportResult,
|
|
19
|
+
type PluginPresentationExportDownloadResult,
|
|
17
20
|
type PluginPresentationExportFormat,
|
|
18
|
-
type
|
|
21
|
+
type PluginPresentationExportOptions,
|
|
19
22
|
} from "./export"
|
|
20
23
|
|
|
21
24
|
/**
|
|
@@ -30,7 +33,9 @@ import {
|
|
|
30
33
|
*
|
|
31
34
|
* - {@linkcode PluginPresentationApi.views} — Saved 2D/3D views (list, get, capture, activate, create)
|
|
32
35
|
* - {@linkcode PluginPresentationApi.camera} — The Present canvas camera (screenshot, pan/zoom, frame sheets)
|
|
33
|
-
* - {@linkcode PluginPresentationApi.
|
|
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)
|
|
34
39
|
* - {@linkcode PluginPresentationApi.placedViews} — Views already placed on the canvas (move, scale, crop)
|
|
35
40
|
* - {@linkcode PluginPresentationApi.diagrams} — Generate program/site diagram sheets, place diagram images
|
|
36
41
|
* - {@linkcode PluginPresentationApi.tables} — Place data tables on sheets
|
|
@@ -47,6 +52,10 @@ export abstract class PluginPresentationApi {
|
|
|
47
52
|
public abstract views: PluginPresentationViewsApi
|
|
48
53
|
/** The Present canvas camera — screenshot what is on screen, read/pan/zoom it, frame sheets (Present mode). See {@linkcode PluginPresentationCameraApi}. */
|
|
49
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
|
|
50
59
|
/** Layout sheets — list/get/create and place views (Present mode). See {@linkcode PluginPresentationSheetsApi}. */
|
|
51
60
|
public abstract sheets: PluginPresentationSheetsApi
|
|
52
61
|
/** Placed views — layout of the view shapes on the canvas: move/scale/setScale/setCrop (Present mode). See {@linkcode PluginPresentationPlacedViewsApi}. */
|
|
@@ -83,15 +92,22 @@ export abstract class PluginPresentationApi {
|
|
|
83
92
|
|
|
84
93
|
/**
|
|
85
94
|
* Export the presentation's layout sheets to a downloadable file (PDF / PNG /
|
|
86
|
-
* JPG)
|
|
87
|
-
*
|
|
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.
|
|
88
100
|
*
|
|
89
101
|
* @param format - Output format: `"pdf"`, `"png"`, or `"jpg"`.
|
|
90
102
|
* @param options - Optional `sheetIds` (all sheets when omitted), `combine`
|
|
91
103
|
* (PDF only — one multi-page file vs one per sheet, default `true`),
|
|
92
|
-
* `resolution` (raster target size for `png`/`jpg`),
|
|
93
|
-
*
|
|
94
|
-
*
|
|
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.
|
|
95
111
|
* @throws If Present mode is not open, a `sheetId` is unknown, or a sheet
|
|
96
112
|
* fails to serialize/encode.
|
|
97
113
|
*
|
|
@@ -104,17 +120,23 @@ export abstract class PluginPresentationApi {
|
|
|
104
120
|
* # Example
|
|
105
121
|
* ```ts
|
|
106
122
|
* const { files } = await snaptrude.presentation.export("pdf")
|
|
123
|
+
* const download = await snaptrude.presentation.export("pdf", { download: true })
|
|
107
124
|
* ```
|
|
108
125
|
*/
|
|
109
126
|
public abstract export(
|
|
110
127
|
format: PluginPresentationExportFormat,
|
|
111
|
-
options?: {
|
|
112
|
-
sheetIds?: string[]
|
|
113
|
-
combine?: boolean
|
|
114
|
-
resolution?: PluginPresentationExportResolution
|
|
115
|
-
fileName?: string
|
|
116
|
-
},
|
|
128
|
+
options?: PluginPresentationExportOptions & { download?: false },
|
|
117
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
|
+
>
|
|
118
140
|
|
|
119
141
|
constructor() {}
|
|
120
142
|
}
|
|
@@ -133,3 +155,6 @@ export * from "./aiInspiration"
|
|
|
133
155
|
export * from "./walkthroughs"
|
|
134
156
|
export * from "./sections"
|
|
135
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
|
|
148
|
-
*
|
|
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:
|
|
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<
|
|
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 (
|
|
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) =>
|
|
861
|
-
|
|
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, {
|
|
876
|
-
|
|
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([
|
|
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(
|
|
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, {
|
|
914
|
-
|
|
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
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
1209
|
+
export type PluginPlacedViewsSetMaskArgs = z.infer<
|
|
1210
|
+
typeof PluginPlacedViewsSetMaskArgs
|
|
1211
|
+
>
|