@snaptrude/plugin-core 0.6.0 → 0.7.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.
- package/CHANGELOG.md +21 -0
- package/api-manifest.full.json +511 -10
- package/api-manifest.json +529 -4
- package/dist/api/core/index.d.ts +5 -0
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/proposals/index.d.ts +475 -0
- package/dist/api/core/proposals/index.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +209 -0
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +159 -0
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/furniture/index.d.ts +34 -5
- package/dist/api/design/furniture/index.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +83 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/lock.d.ts +26 -0
- package/dist/api/design/lock.d.ts.map +1 -1
- package/dist/api/design/materials/index.d.ts +159 -2
- package/dist/api/design/materials/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +115 -5
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +2 -2
- package/dist/api/design/transform/index.d.ts +83 -2
- package/dist/api/design/transform/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +168 -0
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/windows/index.d.ts +113 -2
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +101 -7
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/presentation/import.d.ts +49 -4
- package/dist/api/presentation/import.d.ts.map +1 -1
- package/dist/api/presentation/views.d.ts +210 -5
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/program/areas.d.ts +42 -12
- package/dist/api/program/areas.d.ts.map +1 -1
- package/dist/api/program/index.d.ts +3 -11
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/layout.d.ts +186 -11
- package/dist/api/program/layout.d.ts.map +1 -1
- package/dist/errors/codes.d.ts +34 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/envelope.d.ts +56 -0
- package/dist/errors/envelope.d.ts.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/plugin-error.d.ts +69 -0
- package/dist/errors/plugin-error.d.ts.map +1 -0
- package/dist/host-utils.d.ts +4 -0
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +1624 -1028
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1546 -1025
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/scripts/generate-manifest.test.mjs +77 -0
- package/src/api/core/index.ts +5 -0
- package/src/api/core/proposals/index.ts +509 -0
- package/src/api/design/create/index.ts +249 -0
- package/src/api/design/doors/index.ts +168 -0
- package/src/api/design/furniture/index.ts +36 -5
- package/src/api/design/index.ts +87 -0
- package/src/api/design/lock.ts +27 -0
- package/src/api/design/materials/index.ts +182 -2
- package/src/api/design/query/index.ts +81 -0
- package/src/api/design/transform/index.ts +74 -2
- package/src/api/design/update/index.ts +167 -0
- package/src/api/design/windows/index.ts +128 -2
- package/src/api/entity/story.ts +105 -7
- package/src/api/presentation/import.ts +45 -4
- package/src/api/presentation/views.ts +221 -5
- package/src/api/program/areas.ts +34 -12
- package/src/api/program/index.ts +3 -11
- package/src/api/program/layout.ts +195 -11
- package/src/errors/codes.ts +136 -0
- package/src/errors/envelope.ts +75 -0
- package/src/errors/index.ts +21 -0
- package/src/errors/plugin-error.ts +134 -0
- package/src/host-utils.ts +4 -0
- package/src/index.ts +1 -0
- package/test/errors.test.mjs +184 -0
|
@@ -2,6 +2,7 @@ import * as z from "zod";
|
|
|
2
2
|
import { PluginApiReturn } from "../../../types";
|
|
3
3
|
import { ComponentHandle } from "../../../handles";
|
|
4
4
|
import { PluginSpaceUpdateResult } from "../../entity/space";
|
|
5
|
+
import { PluginDesignChangeResult } from "../lock";
|
|
5
6
|
/**
|
|
6
7
|
* Sparse property updates for a space. Only provided fields change.
|
|
7
8
|
*
|
|
@@ -109,6 +110,89 @@ export declare const PluginUpdateSpaceItem: z.ZodObject<{
|
|
|
109
110
|
}, z.core.$strip>>;
|
|
110
111
|
}, z.core.$strip>;
|
|
111
112
|
export type PluginUpdateSpaceItem = z.infer<typeof PluginUpdateSpaceItem>;
|
|
113
|
+
/**
|
|
114
|
+
* Wire schema for {@linkcode PluginDesignUpdateApi.setLabel}.
|
|
115
|
+
*
|
|
116
|
+
* | Property | Type | Description |
|
|
117
|
+
* |---|---|---|
|
|
118
|
+
* | `component` | `ComponentHandle` | The component to relabel |
|
|
119
|
+
* | `label` | `string` | New label (non-empty after trimming) |
|
|
120
|
+
*/
|
|
121
|
+
export declare const PluginDesignSetLabelArgs: z.ZodObject<{
|
|
122
|
+
component: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
|
|
123
|
+
label: z.ZodString;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
export type PluginDesignSetLabelArgs = z.infer<typeof PluginDesignSetLabelArgs>;
|
|
126
|
+
/**
|
|
127
|
+
* Sparse parametric updates for a staircase (all fields optional; at least one
|
|
128
|
+
* required). Only the fields you provide change. Consumed by
|
|
129
|
+
* {@linkcode PluginDesignUpdateApi.staircase}; the paired read is
|
|
130
|
+
* `design.query.getStaircaseParams`.
|
|
131
|
+
*
|
|
132
|
+
* All dimensions are in **engine units** (the same convention as
|
|
133
|
+
* `design.doors.setWidth`); `steps` is a unitless integer count. Height, riser,
|
|
134
|
+
* and step count are **coupled** (`staircaseHeight = steps × riser`); the two
|
|
135
|
+
* lock booleans govern which value recomputes — see the method JSDoc.
|
|
136
|
+
*
|
|
137
|
+
* | Property | Type | Description |
|
|
138
|
+
* |---|---|---|
|
|
139
|
+
* | `isStoreyHeightUnlocked` | `boolean`? | Unlock the staircase height from the storey height |
|
|
140
|
+
* | `isStaircaseHeightUnlocked` | `boolean`? | Unlock the height from `steps × riser` |
|
|
141
|
+
* | `storeyHeight` | `number`? | Storey height the stair sits within (engine units) |
|
|
142
|
+
* | `staircaseHeight` | `number`? | Total rise (engine units) |
|
|
143
|
+
* | `steps` | `number`? | Step count (unitless integer) |
|
|
144
|
+
* | `riser` | `number`? | Riser height (engine units) |
|
|
145
|
+
* | `tread` | `number`? | Tread depth (engine units) |
|
|
146
|
+
* | `width` | `number`? | Flight width (engine units) |
|
|
147
|
+
* | `depth` | `number`? | Slab/waist thickness (engine units) |
|
|
148
|
+
* | `wellSize` | `number`? | Stairwell gap (dogLegged / openWell / square) |
|
|
149
|
+
* | `flightStartDistAfterTurn` | `number`? | Flight offset after a turn (dogLegged / lShaped / square) |
|
|
150
|
+
* | `landingWidth` | `number`? | Landing depth (straight / dogLegged) |
|
|
151
|
+
* | `baseOffset` | `number`? | Vertical offset from the storey base (engine units) |
|
|
152
|
+
*/
|
|
153
|
+
export declare const PluginStaircaseParamUpdates: z.ZodObject<{
|
|
154
|
+
isStoreyHeightUnlocked: z.ZodOptional<z.ZodBoolean>;
|
|
155
|
+
isStaircaseHeightUnlocked: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
storeyHeight: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
staircaseHeight: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
steps: z.ZodOptional<z.ZodNumber>;
|
|
159
|
+
riser: z.ZodOptional<z.ZodNumber>;
|
|
160
|
+
tread: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
162
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
wellSize: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
flightStartDistAfterTurn: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
landingWidth: z.ZodOptional<z.ZodNumber>;
|
|
166
|
+
baseOffset: z.ZodOptional<z.ZodNumber>;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
export type PluginStaircaseParamUpdates = z.infer<typeof PluginStaircaseParamUpdates>;
|
|
169
|
+
/**
|
|
170
|
+
* Arguments for {@linkcode PluginDesignUpdateApi.staircase}.
|
|
171
|
+
*
|
|
172
|
+
* | Property | Type | Description |
|
|
173
|
+
* |---|---|---|
|
|
174
|
+
* | `staircases` | {@linkcode ComponentHandle}`[]` | The staircases to update |
|
|
175
|
+
* | `params` | {@linkcode PluginStaircaseParamUpdates} | Sparse parametric changes (≥ 1 field) |
|
|
176
|
+
*/
|
|
177
|
+
export declare const PluginDesignUpdateStaircaseArgs: z.ZodObject<{
|
|
178
|
+
staircases: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>;
|
|
179
|
+
params: z.ZodObject<{
|
|
180
|
+
isStoreyHeightUnlocked: z.ZodOptional<z.ZodBoolean>;
|
|
181
|
+
isStaircaseHeightUnlocked: z.ZodOptional<z.ZodBoolean>;
|
|
182
|
+
storeyHeight: z.ZodOptional<z.ZodNumber>;
|
|
183
|
+
staircaseHeight: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
steps: z.ZodOptional<z.ZodNumber>;
|
|
185
|
+
riser: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
tread: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
depth: z.ZodOptional<z.ZodNumber>;
|
|
189
|
+
wellSize: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
flightStartDistAfterTurn: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
landingWidth: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
baseOffset: z.ZodOptional<z.ZodNumber>;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
export type PluginDesignUpdateStaircaseArgs = z.infer<typeof PluginDesignUpdateStaircaseArgs>;
|
|
112
196
|
/**
|
|
113
197
|
* `snaptrude.design.update` — edit existing scene entities (properties + geometry).
|
|
114
198
|
*
|
|
@@ -117,6 +201,45 @@ export type PluginUpdateSpaceItem = z.infer<typeof PluginUpdateSpaceItem>;
|
|
|
117
201
|
*/
|
|
118
202
|
export declare abstract class PluginDesignUpdateApi {
|
|
119
203
|
constructor();
|
|
204
|
+
/**
|
|
205
|
+
* Set a component's **Label** — the same editable Label field the properties
|
|
206
|
+
* panel shows (doors, windows, furniture, spaces, and every other labelled
|
|
207
|
+
* component). The paired read is `design.query.getLabel`. Undoable; the
|
|
208
|
+
* canvas label text updates immediately.
|
|
209
|
+
*
|
|
210
|
+
* Strictly **per component**: labelling one door of a placed family never
|
|
211
|
+
* touches its sibling doors (the panel's Label edit, by contrast, applies to
|
|
212
|
+
* the whole family). On **legacy masses** without a space type, panel parity
|
|
213
|
+
* applies — a label matching a room-type preset with a height can also
|
|
214
|
+
* adjust the mass's height and material, exactly like typing it in the panel.
|
|
215
|
+
*
|
|
216
|
+
* Throws when the component is locked, the handle is gone/forged, the label
|
|
217
|
+
* is empty, or the component has no mesh to label. Re-applying the current
|
|
218
|
+
* label is a no-op that returns `true` without touching the undo stack.
|
|
219
|
+
*
|
|
220
|
+
* @param component - The component to relabel
|
|
221
|
+
* @param label - New label text (non-empty; leading/trailing whitespace trimmed)
|
|
222
|
+
* @returns `true` once the label is applied
|
|
223
|
+
*
|
|
224
|
+
* @examplePrompt Rename this door to D-101
|
|
225
|
+
* @examplePrompt Number all doors on storey 2 with a D-2-XX tag
|
|
226
|
+
* @examplePrompt Set the selected window's label to W-04
|
|
227
|
+
* @examplePrompt Tag every door with its fire rating
|
|
228
|
+
*
|
|
229
|
+
* # Example
|
|
230
|
+
* ```ts
|
|
231
|
+
* // Door tag numbering: label every door as D-<storey>-<n>, numbered per storey
|
|
232
|
+
* await snaptrude.design.selection.setByFilter({ types: ["door"] })
|
|
233
|
+
* const doors = await snaptrude.design.selection.get()
|
|
234
|
+
* const counts = {}
|
|
235
|
+
* for (const door of doors) {
|
|
236
|
+
* const { storey = 0 } = await snaptrude.design.query.getProperties(door)
|
|
237
|
+
* counts[storey] = (counts[storey] ?? 0) + 1
|
|
238
|
+
* await snaptrude.design.update.setLabel(door, `D-${storey}-${String(counts[storey]).padStart(2, "0")}`)
|
|
239
|
+
* }
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
abstract setLabel(component: ComponentHandle, label: string): PluginApiReturn<boolean>;
|
|
120
243
|
/**
|
|
121
244
|
* Update a single space (room) — change its properties (room label, space
|
|
122
245
|
* type, mass type, area class, department) and/or replace its geometry by
|
|
@@ -174,5 +297,50 @@ export declare abstract class PluginDesignUpdateApi {
|
|
|
174
297
|
* ```
|
|
175
298
|
*/
|
|
176
299
|
abstract spaces(items: PluginUpdateSpaceItem[]): PluginApiReturn<PluginSpaceUpdateResult[]>;
|
|
300
|
+
/**
|
|
301
|
+
* Update the parameters of one or more staircases — riser, tread, width,
|
|
302
|
+
* depth, step count, total height, well size, landing depth, base offset,
|
|
303
|
+
* and the two height locks — in one undoable operation. Sparse: only the
|
|
304
|
+
* fields you provide change. The paired read is
|
|
305
|
+
* `design.query.getStaircaseParams`.
|
|
306
|
+
*
|
|
307
|
+
* All dimensions are in **engine units** (the same convention as
|
|
308
|
+
* `design.doors.setWidth`); `steps` is a unitless integer count. The height,
|
|
309
|
+
* riser, and step count are **coupled** — `staircaseHeight = steps × riser` —
|
|
310
|
+
* and the two lock booleans govern which value recomputes when another
|
|
311
|
+
* changes. With `isStoreyHeightUnlocked` false the staircase height follows
|
|
312
|
+
* the storey height; unlocking it also unlocks the staircase height. Setting
|
|
313
|
+
* `steps` recomputes `riser` (or the height, once the height is unlocked),
|
|
314
|
+
* and setting `riser` recomputes `steps`/height in turn.
|
|
315
|
+
*
|
|
316
|
+
* Presets-only: this edits the parametric fields of a preset staircase; it
|
|
317
|
+
* does not change the staircase's type/preset (there is no in-place re-type).
|
|
318
|
+
* Every edit rebuilds the staircase geometry, so the call is async.
|
|
319
|
+
*
|
|
320
|
+
* Throws when a handle is not a staircase, when a staircase is locked, or
|
|
321
|
+
* when a value falls outside the engine's accepted range (RPC rejects).
|
|
322
|
+
*
|
|
323
|
+
* @param staircases - the staircases to update
|
|
324
|
+
* @param params - sparse {@linkcode PluginStaircaseParamUpdates} (at least one field)
|
|
325
|
+
* @returns the affected staircases
|
|
326
|
+
*
|
|
327
|
+
* @examplePrompt Set the riser of this staircase to 165mm
|
|
328
|
+
* @examplePrompt Change all the stairs to 14 steps
|
|
329
|
+
* @examplePrompt Make the selected staircase 1200 wide with a 280 tread
|
|
330
|
+
* @examplePrompt Widen every staircase on level 1 to 1 metre
|
|
331
|
+
* @examplePrompt Unlock the height and set this stair to 3200 tall
|
|
332
|
+
*
|
|
333
|
+
* # Example
|
|
334
|
+
* ```ts
|
|
335
|
+
* // Give every ground-floor staircase a common riser + tread (engine units)
|
|
336
|
+
* const stairs = await snaptrude.design.query.listStaircases({ storeys: [1] })
|
|
337
|
+
* const { affected } = await snaptrude.design.update.staircase(stairs, {
|
|
338
|
+
* riser: 165,
|
|
339
|
+
* tread: 280,
|
|
340
|
+
* })
|
|
341
|
+
* console.log("updated", affected.length, "staircases")
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
abstract staircase(staircases: ComponentHandle[], params: PluginStaircaseParamUpdates): PluginApiReturn<PluginDesignChangeResult>;
|
|
177
345
|
}
|
|
178
346
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/design/update/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAiB,MAAM,kBAAkB,CAAA;AACjE,OAAO,EAKL,uBAAuB,EACxB,MAAM,oBAAoB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AA+B;;;;;;;;;;;;;;;;;iBAG1C,CAAA;AACF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAE7F;;;;;GAKG;AACH,8BAAsB,qBAAqB;;IAGzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;aACa,QAAQ,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC;IAE7F;;;;;;;;;;;;;;;;;;;;OAoBG;aACa,KAAK,CACnB,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE;QACP,UAAU,CAAC,EAAE,0BAA0B,CAAA;QACvC,QAAQ,CAAC,EAAE,yBAAyB,CAAA;KACrC,GACA,eAAe,CAAC,uBAAuB,CAAC;IAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;aACa,MAAM,CAAC,KAAK,EAAE,qBAAqB,EAAE,GAAG,eAAe,CAAC,uBAAuB,EAAE,CAAC;IAElG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;aACa,SAAS,CACvB,UAAU,EAAE,eAAe,EAAE,EAC7B,MAAM,EAAE,2BAA2B,GAClC,eAAe,CAAC,wBAAwB,CAAC;CAC7C"}
|
|
@@ -2,13 +2,20 @@ import * as z from "zod";
|
|
|
2
2
|
import { PluginApiReturn } from "../../../types";
|
|
3
3
|
import { ComponentHandle } from "../../../handles";
|
|
4
4
|
import { PluginDesignChangeResult } from "../lock";
|
|
5
|
+
import { PluginObjectCatalogGroup, PluginObjectCatalogItem } from "../doors";
|
|
5
6
|
/**
|
|
6
7
|
* `snaptrude.design.windows` — window-specific reads. Creation lives at
|
|
7
8
|
* `design.create.window`; generic reads (`listWindows`/`getHost`/`getProperties`) live
|
|
8
9
|
* at `design.query.*`. Window targets are {@linkcode ComponentHandle}s.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* The **catalog** reads (`listCatalogGroups`/`listCatalog`/`getCatalogItem`/`exists`)
|
|
12
|
+
* browse the placeable window library — plain value records keyed by a library id
|
|
13
|
+
* (team `_id` or general `fullName`), NOT handles — and feed `design.create.window`.
|
|
14
|
+
* They are network-backed but carry no `Async` suffix (§6.6) and never throw
|
|
15
|
+
* (`[]`/`null`). The {@linkcode PluginObjectCatalogGroup} / {@linkcode PluginObjectCatalogItem}
|
|
16
|
+
* DTOs are shared with `design.doors` (defined there, re-exported here).
|
|
17
|
+
*
|
|
18
|
+
* `getSillHeight` (bounds-derived) and the command-wired `mirror` land in a later pass.
|
|
12
19
|
*/
|
|
13
20
|
export declare abstract class PluginDesignWindowsApi {
|
|
14
21
|
constructor();
|
|
@@ -133,6 +140,83 @@ export declare abstract class PluginDesignWindowsApi {
|
|
|
133
140
|
* ```
|
|
134
141
|
*/
|
|
135
142
|
abstract setHeight(window: ComponentHandle, height: number): PluginApiReturn<PluginDesignChangeResult>;
|
|
143
|
+
/**
|
|
144
|
+
* List the window catalog **groups** — the placement families (Fixed,
|
|
145
|
+
* Casement, Sliding, Folding, …), built-in groups merged with any
|
|
146
|
+
* team-custom types.
|
|
147
|
+
*
|
|
148
|
+
* @returns The groups as {@linkcode PluginObjectCatalogGroup}`[]` (`[]` when empty)
|
|
149
|
+
*
|
|
150
|
+
* @examplePrompt What kinds of windows can I place?
|
|
151
|
+
* @examplePrompt List the window groups in the catalog
|
|
152
|
+
* @examplePrompt Show me the window families available in this project
|
|
153
|
+
* @examplePrompt Which window types does this project support?
|
|
154
|
+
*
|
|
155
|
+
* # Example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const groups = await snaptrude.design.windows.listCatalogGroups()
|
|
158
|
+
* for (const g of groups) console.log(g.dbType, g.label, g.source)
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
abstract listCatalogGroups(): PluginApiReturn<PluginObjectCatalogGroup[]>;
|
|
162
|
+
/**
|
|
163
|
+
* List the placeable window catalog (team + general libraries), optionally
|
|
164
|
+
* restricted to one group by its `dbType` token.
|
|
165
|
+
*
|
|
166
|
+
* @param group Restrict to one group's `dbType` (optional; e.g. `"casementDouble"`)
|
|
167
|
+
* @returns The catalog as {@linkcode PluginObjectCatalogItem}`[]` (`[]` when empty)
|
|
168
|
+
*
|
|
169
|
+
* @examplePrompt What windows can I place in this project?
|
|
170
|
+
* @examplePrompt List every window in the library
|
|
171
|
+
* @examplePrompt Show me the casement windows I can add
|
|
172
|
+
* @examplePrompt Browse the window catalog
|
|
173
|
+
*
|
|
174
|
+
* # Example
|
|
175
|
+
* ```ts
|
|
176
|
+
* const [group] = await snaptrude.design.windows.listCatalogGroups()
|
|
177
|
+
* const items = await snaptrude.design.windows.listCatalog(group?.dbType)
|
|
178
|
+
* for (const item of items) console.log(item.id, item.name, item.thumbnailUrl)
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
abstract listCatalog(group?: string): PluginApiReturn<PluginObjectCatalogItem[]>;
|
|
182
|
+
/**
|
|
183
|
+
* Get a single window catalog item by its library id.
|
|
184
|
+
*
|
|
185
|
+
* @param id The catalog library id
|
|
186
|
+
* @returns The item, or `null` if no catalog item matches
|
|
187
|
+
*
|
|
188
|
+
* @examplePrompt Get the details of this window from the library
|
|
189
|
+
* @examplePrompt Look up the catalog entry for this window id
|
|
190
|
+
* @examplePrompt What is the cost of this window item?
|
|
191
|
+
* @examplePrompt Show me the family name of this window in the catalog
|
|
192
|
+
*
|
|
193
|
+
* # Example
|
|
194
|
+
* ```ts
|
|
195
|
+
* const [entry] = await snaptrude.design.windows.listCatalog()
|
|
196
|
+
* const item = await snaptrude.design.windows.getCatalogItem(entry.id)
|
|
197
|
+
* if (item) console.log(item.name, item.source, item.dbType)
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
abstract getCatalogItem(id: string): PluginApiReturn<PluginObjectCatalogItem | null>;
|
|
201
|
+
/**
|
|
202
|
+
* Test whether a window catalog item exists for the given library id.
|
|
203
|
+
*
|
|
204
|
+
* @param id The catalog library id
|
|
205
|
+
* @returns `true` if it exists, otherwise `false`
|
|
206
|
+
*
|
|
207
|
+
* @examplePrompt Is this window still in the library?
|
|
208
|
+
* @examplePrompt Check whether a window catalog item with this id exists
|
|
209
|
+
* @examplePrompt Does my team library have this window?
|
|
210
|
+
* @examplePrompt Verify the window is available before placing it
|
|
211
|
+
*
|
|
212
|
+
* # Example
|
|
213
|
+
* ```ts
|
|
214
|
+
* const [entry] = await snaptrude.design.windows.listCatalog()
|
|
215
|
+
* const stillAvailable = await snaptrude.design.windows.exists(entry.id)
|
|
216
|
+
* console.log(stillAvailable ? "safe to place" : "removed from library")
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
abstract exists(id: string): PluginApiReturn<boolean>;
|
|
136
220
|
}
|
|
137
221
|
/**
|
|
138
222
|
* Arguments for the single-window read methods.
|
|
@@ -186,4 +270,31 @@ export declare const PluginDesignWindowSetHeightArgs: z.ZodObject<{
|
|
|
186
270
|
height: z.ZodNumber;
|
|
187
271
|
}, z.core.$strip>;
|
|
188
272
|
export type PluginDesignWindowSetHeightArgs = z.infer<typeof PluginDesignWindowSetHeightArgs>;
|
|
273
|
+
export { PluginObjectCatalogGroup, PluginObjectCatalogItem };
|
|
274
|
+
/**
|
|
275
|
+
* Arguments for {@linkcode PluginDesignWindowsApi.listCatalog}.
|
|
276
|
+
*
|
|
277
|
+
* | Property | Type | Description |
|
|
278
|
+
* |---|---|---|
|
|
279
|
+
* | `group` | `string`? | Restrict to one group's `dbType` token (optional) |
|
|
280
|
+
*/
|
|
281
|
+
export declare const PluginDesignWindowListCatalogArgs: z.ZodObject<{
|
|
282
|
+
group: z.ZodOptional<z.ZodString>;
|
|
283
|
+
}, z.core.$strip>;
|
|
284
|
+
export type PluginDesignWindowListCatalogArgs = z.infer<typeof PluginDesignWindowListCatalogArgs>;
|
|
285
|
+
/**
|
|
286
|
+
* Arguments for {@linkcode PluginDesignWindowsApi.getCatalogItem} / {@linkcode PluginDesignWindowsApi.exists}.
|
|
287
|
+
*
|
|
288
|
+
* | Property | Type | Description |
|
|
289
|
+
* |---|---|---|
|
|
290
|
+
* | `id` | `string` | The catalog library id |
|
|
291
|
+
*/
|
|
292
|
+
export declare const PluginDesignWindowGetCatalogItemArgs: z.ZodObject<{
|
|
293
|
+
id: z.ZodString;
|
|
294
|
+
}, z.core.$strip>;
|
|
295
|
+
export type PluginDesignWindowGetCatalogItemArgs = z.infer<typeof PluginDesignWindowGetCatalogItemArgs>;
|
|
296
|
+
export declare const PluginDesignWindowExistsArgs: z.ZodObject<{
|
|
297
|
+
id: z.ZodString;
|
|
298
|
+
}, z.core.$strip>;
|
|
299
|
+
export type PluginDesignWindowExistsArgs = z.infer<typeof PluginDesignWindowExistsArgs>;
|
|
189
300
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/design/windows/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/design/windows/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AAE5E;;;;;;;;;;;;;GAaG;AACH,8BAAsB,sBAAsB;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AC,OAAO,sBAAsB,CAAC,CAAA;AAE3E;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAA;AACF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE3E;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B;;;iBAGzC,CAAA;AACF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAE3F;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B;;;iBAG1C,CAAA;AACF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAO7F,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAA;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC;;iBAE5C,CAAA;AACF,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAEjG;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC;;iBAE/C,CAAA;AACF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAA;AAEvG,eAAO,MAAM,4BAA4B;;iBAAuC,CAAA;AAChF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { PluginApiReturn } from "../../types";
|
|
3
|
+
import { ComponentHandle } from "../../handles";
|
|
3
4
|
/**
|
|
4
5
|
* Story (floor/storey) management.
|
|
5
6
|
*
|
|
@@ -90,17 +91,25 @@ export declare abstract class PluginStoryApi {
|
|
|
90
91
|
*/
|
|
91
92
|
abstract create(storyValue: number, height?: number): PluginApiReturn<PluginStoryCreateResult>;
|
|
92
93
|
/**
|
|
93
|
-
* Update a story's height.
|
|
94
|
+
* Update a story's floor-to-floor height, cascading the full geometry change.
|
|
94
95
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
96
|
+
* This is the same operation as editing the height in the Stories panel: the
|
|
97
|
+
* walls, columns, and masses on the story are **stretched** to the new height,
|
|
98
|
+
* every story **above shifts up/down** by the delta so the stack stays
|
|
99
|
+
* contiguous, and coupled elements (staircases, parametric curtain walls,
|
|
100
|
+
* furniture offsets) are re-fitted. The whole cascade is committed as **one
|
|
101
|
+
* undo step**. Height-locked elements are left untouched.
|
|
97
102
|
*
|
|
98
103
|
* @param storyValue - Integer storey number
|
|
99
104
|
* identifying the story to update
|
|
100
|
-
* @param height - New height
|
|
101
|
-
* units
|
|
105
|
+
* @param height - New floor-to-floor height in
|
|
106
|
+
* Babylon units
|
|
102
107
|
* @returns A {@linkcode PluginStoryUpdateResult} with the updated `storyValue` and `height`
|
|
103
|
-
* @throws
|
|
108
|
+
* @throws `PRECONDITION_FAILED` if no story has the given value;
|
|
109
|
+
* `STORY_HEIGHT_REJECTED` if the engine rejects the height (e.g. out of
|
|
110
|
+
* range — the change silently reverts host-side and is surfaced as this
|
|
111
|
+
* error); `STORY_UPDATE_FAILED` if the story cannot be re-read after the
|
|
112
|
+
* update
|
|
104
113
|
*
|
|
105
114
|
* @examplePrompt Change the ground floor height to 3.5 metres
|
|
106
115
|
* @examplePrompt Make the second storey taller
|
|
@@ -109,11 +118,59 @@ export declare abstract class PluginStoryApi {
|
|
|
109
118
|
*
|
|
110
119
|
* # Example
|
|
111
120
|
* ```ts
|
|
112
|
-
* // Set ground floor height to 5 Babylon units
|
|
121
|
+
* // Set ground floor height to 5 Babylon units — walls stretch and the
|
|
122
|
+
* // floors above move up to match, all in a single undo step.
|
|
113
123
|
* const result = await snaptrude.entity.story.update(1, 5)
|
|
114
124
|
* ```
|
|
115
125
|
*/
|
|
116
126
|
abstract update(storyValue: number, height: number): PluginApiReturn<PluginStoryUpdateResult>;
|
|
127
|
+
/**
|
|
128
|
+
* Duplicate a story into the adjacent level, up or down.
|
|
129
|
+
*
|
|
130
|
+
* By default the **whole story** is duplicated: every eligible element on the
|
|
131
|
+
* active story (walls, floors, roofs, masses, columns, beams, staircases,
|
|
132
|
+
* ceilings, parametric curtain walls, and furniture) is copied into the story
|
|
133
|
+
* one level `"up"` or `"down"`. Pass `options.components` to duplicate only a
|
|
134
|
+
* subset instead. The target story is **created automatically** if it does not
|
|
135
|
+
* yet exist, inheriting the source story's height.
|
|
136
|
+
*
|
|
137
|
+
* Copies are **instanced** by default (`unique: false`) — they share geometry
|
|
138
|
+
* with the source, so later edits propagate. Set `unique: true` for independent
|
|
139
|
+
* geometry. Doors and windows are never duplicated on their own; they ride along
|
|
140
|
+
* with their host wall. Locked, throw-away, and unsupported elements are skipped
|
|
141
|
+
* and counted in `skipped`. The whole operation is a single undo step.
|
|
142
|
+
*
|
|
143
|
+
* @param direction - `"up"` to duplicate into the story above, `"down"` for below
|
|
144
|
+
* @param options - `components` (restrict to a subset of the story's elements;
|
|
145
|
+
* omit for the whole story) and `unique` (default `false` = instanced copies;
|
|
146
|
+
* `true` = independent geometry)
|
|
147
|
+
* @returns A {@linkcode PluginStoryDuplicateResult} with the `sourceStory`, the
|
|
148
|
+
* `targetStories` the copies landed on, the `created` component handles, the
|
|
149
|
+
* `createdStoryValues` for any stories generated to receive them, and the
|
|
150
|
+
* `skipped` count of ineligible elements
|
|
151
|
+
* @throws `NO_ACTIVE_STRUCTURE` if there is no active structure to duplicate
|
|
152
|
+
* into; `NO_ELIGIBLE_ELEMENTS` if nothing on the source story (or in
|
|
153
|
+
* `options.components`) is duplicable; `HANDLE_INVALID` for a stale or
|
|
154
|
+
* foreign supplied handle; or if plugin writes are disabled
|
|
155
|
+
*
|
|
156
|
+
* @examplePrompt Duplicate this floor to the storey above
|
|
157
|
+
* @examplePrompt Copy the ground floor down into a new basement
|
|
158
|
+
* @examplePrompt Repeat this level upwards with its own independent geometry
|
|
159
|
+
* @examplePrompt Duplicate just the selected walls onto the next floor up
|
|
160
|
+
*
|
|
161
|
+
* # Example
|
|
162
|
+
* ```ts
|
|
163
|
+
* // Duplicate the whole active story one level up (instanced copies).
|
|
164
|
+
* const { targetStories, created, skipped } =
|
|
165
|
+
* await snaptrude.entity.story.duplicate("up")
|
|
166
|
+
* console.log(`Copied ${created.length} elements onto story ${targetStories}`)
|
|
167
|
+
* if (skipped) console.log(`${skipped} elements were skipped`)
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
abstract duplicate(direction: "up" | "down", options?: {
|
|
171
|
+
components?: ComponentHandle[];
|
|
172
|
+
unique?: boolean;
|
|
173
|
+
}): PluginApiReturn<PluginStoryDuplicateResult>;
|
|
117
174
|
}
|
|
118
175
|
/**
|
|
119
176
|
* Available properties that can be queried on a story.
|
|
@@ -246,4 +303,41 @@ export declare const PluginStoryUpdateResult: z.ZodObject<{
|
|
|
246
303
|
height: z.ZodNumber;
|
|
247
304
|
}, z.core.$strip>;
|
|
248
305
|
export type PluginStoryUpdateResult = z.infer<typeof PluginStoryUpdateResult>;
|
|
306
|
+
/**
|
|
307
|
+
* Arguments for {@linkcode PluginStoryApi.duplicate} (options flattened).
|
|
308
|
+
*
|
|
309
|
+
* | Property | Type | Description |
|
|
310
|
+
* |---|---|---|
|
|
311
|
+
* | `direction` | `'up' \| 'down'` | Which adjacent story to duplicate into |
|
|
312
|
+
* | `components` | {@linkcode ComponentHandle}`[]?` | Restrict to a subset; omit for the whole story |
|
|
313
|
+
* | `unique` | `boolean?` | `false` (default) = instanced copies; `true` = independent geometry |
|
|
314
|
+
*/
|
|
315
|
+
export declare const PluginStoryDuplicateArgs: z.ZodObject<{
|
|
316
|
+
direction: z.ZodEnum<{
|
|
317
|
+
up: "up";
|
|
318
|
+
down: "down";
|
|
319
|
+
}>;
|
|
320
|
+
components: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>>;
|
|
321
|
+
unique: z.ZodOptional<z.ZodBoolean>;
|
|
322
|
+
}, z.core.$strip>;
|
|
323
|
+
export type PluginStoryDuplicateArgs = z.infer<typeof PluginStoryDuplicateArgs>;
|
|
324
|
+
/**
|
|
325
|
+
* Result of {@linkcode PluginStoryApi.duplicate}.
|
|
326
|
+
*
|
|
327
|
+
* | Property | Type | Description |
|
|
328
|
+
* |---|---|---|
|
|
329
|
+
* | `sourceStory` | `number` | Storey value the copies were duplicated from |
|
|
330
|
+
* | `targetStories` | `number[]` | Storey values the copies landed on |
|
|
331
|
+
* | `created` | {@linkcode ComponentHandle}`[]` | Handles of the newly created components |
|
|
332
|
+
* | `createdStoryValues` | `number[]` | Storey values that were generated to receive the copies |
|
|
333
|
+
* | `skipped` | `number` | Count of ineligible elements that were skipped |
|
|
334
|
+
*/
|
|
335
|
+
export declare const PluginStoryDuplicateResult: z.ZodObject<{
|
|
336
|
+
sourceStory: z.ZodNumber;
|
|
337
|
+
targetStories: z.ZodArray<z.ZodNumber>;
|
|
338
|
+
created: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>;
|
|
339
|
+
createdStoryValues: z.ZodArray<z.ZodNumber>;
|
|
340
|
+
skipped: z.ZodNumber;
|
|
341
|
+
}, z.core.$strip>;
|
|
342
|
+
export type PluginStoryDuplicateResult = z.infer<typeof PluginStoryDuplicateResult>;
|
|
249
343
|
//# sourceMappingURL=story.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../../src/api/entity/story.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../../src/api/entity/story.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAA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
* Presentation import — bring external reference assets onto the Present canvas.
|
|
5
5
|
*
|
|
6
|
-
* `import.image` places a reference image
|
|
7
|
-
* page vectorized to SVG)
|
|
8
|
-
*
|
|
6
|
+
* `import.image` places a reference image, `import.pdf` places a PDF (each
|
|
7
|
+
* page vectorized to SVG), and `import.svg` places a validated SVG onto
|
|
8
|
+
* the current Present sheet, returning the created canvas shape ids. Requires
|
|
9
|
+
* Present mode to be open.
|
|
9
10
|
*
|
|
10
11
|
* The host engine takes a browser `File`, which a plugin worker cannot supply,
|
|
11
12
|
* so these accept a `url`/`dataUrl` that the host adapts into a `File`.
|
|
@@ -79,10 +80,54 @@ export declare abstract class PluginPresentationImportApi {
|
|
|
79
80
|
y: number;
|
|
80
81
|
};
|
|
81
82
|
}): PluginApiReturn<PluginPresentationImportResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Import an SVG onto the current Present sheet as a vector asset.
|
|
85
|
+
*
|
|
86
|
+
* An SVG-validating variant of {@linkcode PluginPresentationImportApi.image}:
|
|
87
|
+
* `import.image` already passes SVG sources through, but this method first
|
|
88
|
+
* validates that the source really is an SVG and forces the vector mime
|
|
89
|
+
* type. Throws if the source is not an SVG.
|
|
90
|
+
*
|
|
91
|
+
* **Rendering is vector up to a complexity cap.** Simple SVGs (up to ~1500
|
|
92
|
+
* SVG element nodes and ~2 MB) render true-vector and stay crisp at every
|
|
93
|
+
* zoom. Beyond that cap the shared canvas renderer **intentionally falls
|
|
94
|
+
* back to a 1920px raster** to protect canvas performance, so very complex
|
|
95
|
+
* SVGs can look rasterized when zoomed in. The stored asset is the original
|
|
96
|
+
* SVG either way; only the on-canvas rendering falls back.
|
|
97
|
+
*
|
|
98
|
+
* @param source - The SVG to import: exactly one of `url` or `dataUrl`.
|
|
99
|
+
* @param options - Optional `position` — where to place the SVG on the sheet.
|
|
100
|
+
* @returns A {@linkcode PluginPresentationImportResult} with the created
|
|
101
|
+
* `shapeIds`.
|
|
102
|
+
* @throws If Present mode is not open, the source is not an SVG, or it cannot
|
|
103
|
+
* be loaded.
|
|
104
|
+
*
|
|
105
|
+
* @examplePrompt Import this SVG diagram onto the present canvas
|
|
106
|
+
* @examplePrompt Add a vector logo to my presentation board
|
|
107
|
+
* @examplePrompt Place this SVG floor plan on the current sheet as vectors
|
|
108
|
+
* @examplePrompt Bring a crisp vector graphic into Present mode
|
|
109
|
+
*
|
|
110
|
+
* # Example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const { shapeIds } = await snaptrude.presentation.import.svg({
|
|
113
|
+
* url: "https://example.com/diagram.svg",
|
|
114
|
+
* })
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
abstract svg(source: {
|
|
118
|
+
url?: string;
|
|
119
|
+
dataUrl?: string;
|
|
120
|
+
}, options?: {
|
|
121
|
+
position?: {
|
|
122
|
+
x: number;
|
|
123
|
+
y: number;
|
|
124
|
+
};
|
|
125
|
+
}): PluginApiReturn<PluginPresentationImportResult>;
|
|
82
126
|
}
|
|
83
127
|
/**
|
|
84
128
|
* Arguments for {@linkcode PluginPresentationImportApi.image} /
|
|
85
|
-
* {@linkcode PluginPresentationImportApi.pdf}
|
|
129
|
+
* {@linkcode PluginPresentationImportApi.pdf} /
|
|
130
|
+
* {@linkcode PluginPresentationImportApi.svg}. Provide exactly one source.
|
|
86
131
|
*
|
|
87
132
|
* | Property | Type | Description |
|
|
88
133
|
* |---|---|---|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../src/api/presentation/import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C
|
|
1
|
+
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../src/api/presentation/import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,C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