@snaptrude/plugin-core 0.2.4 → 0.2.5

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 (52) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api/core/geom/arc.d.ts +81 -0
  3. package/dist/api/core/geom/arc.d.ts.map +1 -0
  4. package/dist/api/core/geom/curve.d.ts +70 -0
  5. package/dist/api/core/geom/curve.d.ts.map +1 -0
  6. package/dist/api/core/geom/index.d.ts +32 -0
  7. package/dist/api/core/geom/index.d.ts.map +1 -0
  8. package/dist/api/core/geom/line.d.ts +56 -0
  9. package/dist/api/core/geom/line.d.ts.map +1 -0
  10. package/dist/api/core/geom/profile.d.ts +121 -0
  11. package/dist/api/core/geom/profile.d.ts.map +1 -0
  12. package/dist/api/core/index.d.ts +18 -0
  13. package/dist/api/core/index.d.ts.map +1 -0
  14. package/dist/api/core/math/index.d.ts +18 -0
  15. package/dist/api/core/math/index.d.ts.map +1 -0
  16. package/dist/api/core/math/quat.d.ts +187 -0
  17. package/dist/api/core/math/quat.d.ts.map +1 -0
  18. package/dist/api/core/math/vec3.d.ts +156 -0
  19. package/dist/api/core/math/vec3.d.ts.map +1 -0
  20. package/dist/api/entity/buildableEnvelope.d.ts +233 -0
  21. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
  22. package/dist/api/entity/department.d.ts +99 -0
  23. package/dist/api/entity/department.d.ts.map +1 -0
  24. package/dist/api/entity/index.d.ts +33 -0
  25. package/dist/api/entity/index.d.ts.map +1 -0
  26. package/dist/api/entity/referenceLine.d.ts +259 -0
  27. package/dist/api/entity/referenceLine.d.ts.map +1 -0
  28. package/dist/api/entity/space.d.ts +816 -0
  29. package/dist/api/entity/space.d.ts.map +1 -0
  30. package/dist/api/entity/story.d.ts +239 -0
  31. package/dist/api/entity/story.d.ts.map +1 -0
  32. package/dist/api/index.d.ts +30 -0
  33. package/dist/api/index.d.ts.map +1 -0
  34. package/dist/api/tools/copy.d.ts +59 -0
  35. package/dist/api/tools/copy.d.ts.map +1 -0
  36. package/dist/api/tools/index.d.ts +29 -0
  37. package/dist/api/tools/index.d.ts.map +1 -0
  38. package/dist/api/tools/offset.d.ts +43 -0
  39. package/dist/api/tools/offset.d.ts.map +1 -0
  40. package/dist/api/tools/selection.d.ts +48 -0
  41. package/dist/api/tools/selection.d.ts.map +1 -0
  42. package/dist/api/tools/transform.d.ts +114 -0
  43. package/dist/api/tools/transform.d.ts.map +1 -0
  44. package/dist/api/units/index.d.ts +163 -0
  45. package/dist/api/units/index.d.ts.map +1 -0
  46. package/dist/host-utils.d.ts +41 -0
  47. package/dist/host-utils.d.ts.map +1 -0
  48. package/dist/index.d.ts +4 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/types.d.ts +16 -0
  51. package/dist/types.d.ts.map +1 -0
  52. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../src/api/entity/space.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAK7C;;;;;;;;;;;GAWG;AACH,8BAAsB,cAAc;;IAGlC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;aACa,iBAAiB,CAAC,EAChC,QAAQ,EACR,UAAU,GACX,EAAE,gCAAgC,GAAG,eAAe,CAAC,kCAAkC,CAAC;IAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuDG;aACa,iBAAiB,CAAC,EAChC,OAAO,EACP,aAAa,EACb,aAAa,EACb,QAAQ,GACT,EAAE,gCAAgC,GAAG,eAAe,CAAC,kCAAkC,CAAC;IAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;aACa,yBAAyB,CAAC,EACxC,OAAO,EACP,OAAO,EACP,aAAa,GACd,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;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;EAazB,CAAA;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B;;;;;EAKtC,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;eAG7B,CAAA;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQhC,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB;;;;;;iBAMlC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
@@ -0,0 +1,239 @@
1
+ import * as z from "zod";
2
+ import { PluginApiReturn } from "../../types";
3
+ /**
4
+ * Story (floor/storey) management.
5
+ *
6
+ * A story represents a building floor in the Snaptrude project. Stories
7
+ * are identified by their integer **story value** (e.g. `1` for ground
8
+ * floor, `2` for first floor, `-1` for a basement).
9
+ *
10
+ * All methods are **host API calls** that return Promises and support
11
+ * undo/redo via Snaptrude's command system.
12
+ *
13
+ * Accessed via `snaptrude.entity.story`.
14
+ */
15
+ export declare abstract class PluginStoryApi {
16
+ constructor();
17
+ /**
18
+ * Get properties of a story by its storey number.
19
+ *
20
+ * Only the properties listed in {@linkcode PluginStoryGetArgs.properties args.properties}
21
+ * are returned — unlisted properties will be `undefined` in the result.
22
+ *
23
+ * @param args - An object containing:
24
+ * - {@linkcode PluginStoryGetArgs.storyValue args.storyValue} — Integer storey number
25
+ * (e.g. `1` for ground floor, `2` for first floor, `-1` for basement)
26
+ * - {@linkcode PluginStoryGetArgs.properties args.properties} — Array of property names
27
+ * to retrieve. See {@linkcode PluginStoryGetProperty} for available values.
28
+ * @returns A partial {@linkcode PluginStoryGetResult} containing only the requested properties
29
+ * @throws If the story with the given value does not exist
30
+ *
31
+ * # Example
32
+ * ```ts
33
+ * const info = await snaptrude.entity.story.get({
34
+ * storyValue: 1,
35
+ * properties: ["height", "name", "spacesCount"],
36
+ * })
37
+ * console.log(info.name, info.height, info.spacesCount)
38
+ * ```
39
+ */
40
+ abstract get({ storyValue, properties, }: PluginStoryGetArgs): PluginApiReturn<PluginStoryGetResult>;
41
+ /**
42
+ * Get all stories in the current project.
43
+ *
44
+ * Returns basic identification data for every storey. Stories are sorted
45
+ * from **top to bottom** (highest story value first).
46
+ *
47
+ * @returns A {@linkcode PluginStoryGetAllResult} with a `stories` array,
48
+ * each entry containing `value`, `id`, and `name`
49
+ *
50
+ * # Example
51
+ * ```ts
52
+ * const { stories } = await snaptrude.entity.story.getAll()
53
+ * for (const s of stories) {
54
+ * console.log(`Story ${s.value}: ${s.name} (id: ${s.id})`)
55
+ * }
56
+ * ```
57
+ */
58
+ abstract getAll(): PluginApiReturn<PluginStoryGetAllResult>;
59
+ /**
60
+ * Create a new story (floor) in the project.
61
+ *
62
+ * The new story is inserted at the position specified by
63
+ * {@linkcode PluginStoryCreateArgs.storyValue args.storyValue}. This
64
+ * operation is undoable.
65
+ *
66
+ * @param args - An object containing:
67
+ * - {@linkcode PluginStoryCreateArgs.storyValue args.storyValue} — Integer storey number
68
+ * to create (e.g. `3` to add a third floor)
69
+ * - {@linkcode PluginStoryCreateArgs.height args.height} — Optional height in Babylon
70
+ * units. If omitted, the project's default storey height is used.
71
+ * @returns A {@linkcode PluginStoryCreateResult} with `storyId` and `storyValue`
72
+ * @throws If a story with the given value already exists or creation fails
73
+ *
74
+ * # Example
75
+ * ```ts
76
+ * // Create a new third floor with custom height
77
+ * const { storyId } = await snaptrude.entity.story.create({
78
+ * storyValue: 3,
79
+ * height: 4.5,
80
+ * })
81
+ * ```
82
+ */
83
+ abstract create({ storyValue, height, }: PluginStoryCreateArgs): PluginApiReturn<PluginStoryCreateResult>;
84
+ /**
85
+ * Update a story's height.
86
+ *
87
+ * Changes the floor-to-floor height of the specified story. This
88
+ * operation is undoable.
89
+ *
90
+ * @param args - An object containing:
91
+ * - {@linkcode PluginStoryUpdateArgs.storyValue args.storyValue} — Integer storey number
92
+ * identifying the story to update
93
+ * - {@linkcode PluginStoryUpdateArgs.height args.height} — New height value in Babylon
94
+ * units
95
+ * @returns A {@linkcode PluginStoryUpdateResult} with the updated `storyValue` and `height`
96
+ * @throws If the story does not exist or the update fails
97
+ *
98
+ * # Example
99
+ * ```ts
100
+ * // Set ground floor height to 5 Babylon units
101
+ * const result = await snaptrude.entity.story.update({
102
+ * storyValue: 1,
103
+ * height: 5,
104
+ * })
105
+ * ```
106
+ */
107
+ abstract update({ storyValue, height, }: PluginStoryUpdateArgs): PluginApiReturn<PluginStoryUpdateResult>;
108
+ }
109
+ /**
110
+ * Available properties that can be queried on a story.
111
+ *
112
+ * | Value | Type | Description |
113
+ * |---|---|---|
114
+ * | `"value"` | `number` | The integer storey number |
115
+ * | `"id"` | `string` | Unique story identifier |
116
+ * | `"name"` | `string` | Display name of the story |
117
+ * | `"height"` | `number` | Floor-to-floor height in Babylon units |
118
+ * | `"base"` | `number` | Base elevation in Babylon units |
119
+ * | `"hidden"` | `boolean` | Whether the story is hidden in the viewport |
120
+ * | `"spacesCount"` | `number` | Number of spaces on this story |
121
+ * | `"totalArea"` | `number` | Total floor area of this story |
122
+ */
123
+ export declare const PluginStoryGetProperty: z.ZodEnum<{
124
+ value: "value";
125
+ name: "name";
126
+ id: "id";
127
+ height: "height";
128
+ base: "base";
129
+ hidden: "hidden";
130
+ spacesCount: "spacesCount";
131
+ totalArea: "totalArea";
132
+ }>;
133
+ /**
134
+ * Arguments for {@linkcode PluginStoryApi.get}.
135
+ *
136
+ * | Property | Type | Description |
137
+ * |---|---|---|
138
+ * | `storyValue` | `number` (int) | The storey number to query |
139
+ * | `properties` | {@linkcode PluginStoryGetProperty}`[]` | Properties to retrieve |
140
+ */
141
+ export declare const PluginStoryGetArgs: z.ZodObject<{
142
+ storyValue: z.ZodNumber;
143
+ properties: z.ZodArray<z.ZodEnum<{
144
+ value: "value";
145
+ name: "name";
146
+ id: "id";
147
+ height: "height";
148
+ base: "base";
149
+ hidden: "hidden";
150
+ spacesCount: "spacesCount";
151
+ totalArea: "totalArea";
152
+ }>>;
153
+ }, z.core.$strip>;
154
+ export type PluginStoryGetArgs = z.infer<typeof PluginStoryGetArgs>;
155
+ /**
156
+ * Result of {@linkcode PluginStoryApi.get}.
157
+ *
158
+ * A partial object — only the properties that were requested in
159
+ * {@linkcode PluginStoryGetArgs.properties} will be present.
160
+ */
161
+ export declare const PluginStoryGetResult: z.ZodObject<{
162
+ value: z.ZodOptional<z.ZodNumber>;
163
+ id: z.ZodOptional<z.ZodString>;
164
+ name: z.ZodOptional<z.ZodString>;
165
+ height: z.ZodOptional<z.ZodNumber>;
166
+ base: z.ZodOptional<z.ZodNumber>;
167
+ hidden: z.ZodOptional<z.ZodBoolean>;
168
+ spacesCount: z.ZodOptional<z.ZodNumber>;
169
+ totalArea: z.ZodOptional<z.ZodNumber>;
170
+ }, z.core.$strip>;
171
+ export type PluginStoryGetResult = z.infer<typeof PluginStoryGetResult>;
172
+ /**
173
+ * Result of {@linkcode PluginStoryApi.getAll}.
174
+ *
175
+ * | Property | Type | Description |
176
+ * |---|---|---|
177
+ * | `stories` | `Array<{ value, id, name }>` | All stories, sorted top to bottom |
178
+ */
179
+ export declare const PluginStoryGetAllResult: z.ZodObject<{
180
+ stories: z.ZodArray<z.ZodObject<{
181
+ value: z.ZodNumber;
182
+ id: z.ZodString;
183
+ name: z.ZodString;
184
+ }, z.core.$strip>>;
185
+ }, z.core.$strip>;
186
+ export type PluginStoryGetAllResult = z.infer<typeof PluginStoryGetAllResult>;
187
+ /**
188
+ * Arguments for {@linkcode PluginStoryApi.create}.
189
+ *
190
+ * | Property | Type | Description |
191
+ * |---|---|---|
192
+ * | `storyValue` | `number` (int) | The storey number for the new story |
193
+ * | `height` | `number?` | Optional height in Babylon units |
194
+ */
195
+ export declare const PluginStoryCreateArgs: z.ZodObject<{
196
+ storyValue: z.ZodNumber;
197
+ height: z.ZodOptional<z.ZodNumber>;
198
+ }, z.core.$strip>;
199
+ export type PluginStoryCreateArgs = z.infer<typeof PluginStoryCreateArgs>;
200
+ /**
201
+ * Result of {@linkcode PluginStoryApi.create}.
202
+ *
203
+ * | Property | Type | Description |
204
+ * |---|---|---|
205
+ * | `storyId` | `string` | Unique ID of the created story |
206
+ * | `storyValue` | `number` | The storey number of the created story |
207
+ */
208
+ export declare const PluginStoryCreateResult: z.ZodObject<{
209
+ storyId: z.ZodString;
210
+ storyValue: z.ZodNumber;
211
+ }, z.core.$strip>;
212
+ export type PluginStoryCreateResult = z.infer<typeof PluginStoryCreateResult>;
213
+ /**
214
+ * Arguments for {@linkcode PluginStoryApi.update}.
215
+ *
216
+ * | Property | Type | Description |
217
+ * |---|---|---|
218
+ * | `storyValue` | `number` (int) | Storey number of the story to update |
219
+ * | `height` | `number` | New height in Babylon units |
220
+ */
221
+ export declare const PluginStoryUpdateArgs: z.ZodObject<{
222
+ storyValue: z.ZodNumber;
223
+ height: z.ZodNumber;
224
+ }, z.core.$strip>;
225
+ export type PluginStoryUpdateArgs = z.infer<typeof PluginStoryUpdateArgs>;
226
+ /**
227
+ * Result of {@linkcode PluginStoryApi.update}.
228
+ *
229
+ * | Property | Type | Description |
230
+ * |---|---|---|
231
+ * | `storyValue` | `number` | The storey number of the updated story |
232
+ * | `height` | `number` | The new height after the update |
233
+ */
234
+ export declare const PluginStoryUpdateResult: z.ZodObject<{
235
+ storyValue: z.ZodNumber;
236
+ height: z.ZodNumber;
237
+ }, z.core.$strip>;
238
+ export type PluginStoryUpdateResult = z.infer<typeof PluginStoryUpdateResult>;
239
+ //# sourceMappingURL=story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../../src/api/entity/story.ts"],"names":[],"mappings":"AAAA,OA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AAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAA;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { PluginCoreApi } from "./core";
2
+ import { PluginEntityApi } from "./entity";
3
+ import { PluginToolsApi } from "./tools";
4
+ import { PluginUnitsApi } from "./units";
5
+ /**
6
+ * Root API surface for Snaptrude plugins.
7
+ *
8
+ * Access all plugin capabilities through the namespaced properties:
9
+ *
10
+ * - {@linkcode PluginApi.core} — Math and geometry primitives
11
+ * - {@linkcode PluginApi.entity} — CRUD operations on Snaptrude entities (spaces, stories)
12
+ * - {@linkcode PluginApi.tools} — Copy, offset, selection, and transform tools
13
+ * - {@linkcode PluginApi.units} — Unit conversion utilities
14
+ */
15
+ export declare abstract class PluginApi {
16
+ /** Core math and geometry primitives. See {@linkcode PluginCoreApi}. */
17
+ abstract core: PluginCoreApi;
18
+ /** Copy, offset, selection, and transform tools. See {@linkcode PluginToolsApi}. */
19
+ abstract tools: PluginToolsApi;
20
+ /** CRUD operations on Snaptrude entities. See {@linkcode PluginEntityApi}. */
21
+ abstract entity: PluginEntityApi;
22
+ /** Unit conversion utilities. See {@linkcode PluginUnitsApi}. */
23
+ abstract units: PluginUnitsApi;
24
+ constructor();
25
+ }
26
+ export * from "./core";
27
+ export * from "./entity";
28
+ export * from "./tools";
29
+ export * from "./units";
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC;;;;;;;;;GASG;AACH,8BAAsB,SAAS;IAC7B,wEAAwE;IACxE,SAAgB,IAAI,EAAE,aAAa,CAAA;IACnC,oFAAoF;IACpF,SAAgB,KAAK,EAAE,cAAc,CAAA;IACrC,8EAA8E;IAC9E,SAAgB,MAAM,EAAE,eAAe,CAAA;IACvC,iEAAiE;IACjE,SAAgB,KAAK,EAAE,cAAc,CAAA;;CAGtC;AAED,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
@@ -0,0 +1,59 @@
1
+ import * as z from "zod";
2
+ import type { ComponentId } from "../../types";
3
+ /**
4
+ * Copy mode for `snaptrude.tools.copy`.
5
+ *
6
+ * | Value | Description |
7
+ * |---|---|
8
+ * | `"instance"` | Create instanced copies where possible |
9
+ * | `"unique"` | Create independent geometry copies |
10
+ */
11
+ export declare const PluginCopyMode: z.ZodEnum<{
12
+ instance: "instance";
13
+ unique: "unique";
14
+ }>;
15
+ export type PluginCopyMode = z.infer<typeof PluginCopyMode>;
16
+ /**
17
+ * Arguments for `snaptrude.tools.copy`.
18
+ *
19
+ * Creates one or more copies for each component in `componentIds`. Copy `i` is
20
+ * offset by `displacement * i`, where `i` starts at `1`. Source positions are
21
+ * preserved. In `"instance"` mode, a unique source mesh can be replaced by an
22
+ * instance at the same position so the source and copied objects remain in the
23
+ * same instance family. The created copy stack becomes the active editor
24
+ * selection, matching the native paste workflow.
25
+ *
26
+ * | Property | Type | Description |
27
+ * |---|---|---|
28
+ * | `componentIds` | `string[]` | Component IDs to copy |
29
+ * | `displacement` | {@linkcode PVec3} | Offset applied to each copy in Babylon units |
30
+ * | `count` | `number` | Number of copies per component. Defaults to `1` |
31
+ * | `copyMode` | {@linkcode PluginCopyMode} | `"instance"` or `"unique"`. Defaults to `"instance"` |
32
+ */
33
+ export declare const PluginCopyArgs: z.ZodObject<{
34
+ componentIds: z.ZodArray<z.ZodString>;
35
+ displacement: z.ZodObject<{
36
+ x: z.ZodNumber;
37
+ y: z.ZodNumber;
38
+ z: z.ZodNumber;
39
+ }, z.core.$strip>;
40
+ count: z.ZodOptional<z.ZodNumber>;
41
+ copyMode: z.ZodOptional<z.ZodEnum<{
42
+ instance: "instance";
43
+ unique: "unique";
44
+ }>>;
45
+ }, z.core.$strip>;
46
+ export type PluginCopyArgs = z.infer<typeof PluginCopyArgs>;
47
+ /**
48
+ * Result of `snaptrude.tools.copy`.
49
+ *
50
+ * Returned IDs are Snaptrude component IDs for the newly created copies, not
51
+ * Babylon mesh IDs.
52
+ */
53
+ export declare const PluginCopyResult: z.ZodObject<{
54
+ copiedIds: z.ZodArray<z.ZodString>;
55
+ }, z.core.$strip>;
56
+ export type PluginCopyResult = {
57
+ copiedIds: ComponentId[];
58
+ };
59
+ //# sourceMappingURL=copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../src/api/tools/copy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAG9C;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;EAAiC,CAAA;AAE5D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;iBAKzB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;iBAE3B,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,WAAW,EAAE,CAAA;CACzB,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { PluginSelectionApi } from "./selection";
2
+ import { PluginTransformApi } from "./transform";
3
+ import type { PluginApiReturn } from "../../types";
4
+ import type { PluginCopyArgs, PluginCopyResult } from "./copy";
5
+ import type { PluginOffsetArgs, PluginOffsetResult } from "./offset";
6
+ /**
7
+ * Snaptrude editor tools for querying and manipulating scene components.
8
+ *
9
+ * - {@linkcode PluginToolsApi.selection} — Query the current user selection
10
+ * - {@linkcode PluginToolsApi.transform} — Move and rotate components
11
+ * - {@linkcode PluginToolsApi.copy} — Copy components
12
+ * - {@linkcode PluginToolsApi.offset} — Offset or split component profiles
13
+ */
14
+ export declare abstract class PluginToolsApi {
15
+ /** Query the current selection. See {@linkcode PluginSelectionApi}. */
16
+ abstract selection: PluginSelectionApi;
17
+ /** Move and rotate components. See {@linkcode PluginTransformApi}. */
18
+ abstract transform: PluginTransformApi;
19
+ /** Copy components by ID. See {@linkcode PluginCopyArgs}. */
20
+ abstract copy(args: PluginCopyArgs): PluginApiReturn<PluginCopyResult>;
21
+ /** Offset or split a component profile. See {@linkcode PluginOffsetArgs}. */
22
+ abstract offset(args: PluginOffsetArgs): PluginApiReturn<PluginOffsetResult>;
23
+ constructor();
24
+ }
25
+ export * from "./copy";
26
+ export * from "./offset";
27
+ export * from "./selection";
28
+ export * from "./transform";
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAEpE;;;;;;;GAOG;AACH,8BAAsB,cAAc;IAClC,uEAAuE;IACvE,SAAgB,SAAS,EAAE,kBAAkB,CAAA;IAC7C,sEAAsE;IACtE,SAAgB,SAAS,EAAE,kBAAkB,CAAA;IAE7C,6DAA6D;aAC7C,IAAI,CAAC,IAAI,EAAE,cAAc,GAAG,eAAe,CAAC,gBAAgB,CAAC;IAE7E,6EAA6E;aAC7D,MAAM,CACpB,IAAI,EAAE,gBAAgB,GACrB,eAAe,CAAC,kBAAkB,CAAC;;CAGvC;AAED,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,43 @@
1
+ import * as z from "zod";
2
+ import type { ComponentId } from "../../types";
3
+ /**
4
+ * Arguments for `snaptrude.tools.offset`.
5
+ *
6
+ * Runs Snaptrude's offset/split operation on the top profile of a scene
7
+ * component. A positive distance offsets outward from the selected profile;
8
+ * a negative distance offsets inward. If `profilePickPoint` is omitted, the
9
+ * outer top profile is used. If `profilePickPoint` is provided, the nearest top
10
+ * contour profile to that point is used, matching the interactive offset tool's
11
+ * pick behavior.
12
+ *
13
+ * | Property | Type | Description |
14
+ * |---|---|---|
15
+ * | `componentId` | `string` | Component ID to offset |
16
+ * | `distance` | `number` | Signed offset distance in Snaptrude units |
17
+ * | `profilePickPoint` | {@linkcode PVec3} | Optional point used to choose a top contour profile |
18
+ */
19
+ export declare const PluginOffsetArgs: z.ZodObject<{
20
+ componentId: z.ZodString;
21
+ distance: z.ZodNumber;
22
+ profilePickPoint: z.ZodOptional<z.ZodObject<{
23
+ x: z.ZodNumber;
24
+ y: z.ZodNumber;
25
+ z: z.ZodNumber;
26
+ }, z.core.$strip>>;
27
+ }, z.core.$strip>;
28
+ export type PluginOffsetArgs = z.infer<typeof PluginOffsetArgs>;
29
+ /**
30
+ * Result of `snaptrude.tools.offset`.
31
+ *
32
+ * `createdIds` are the components created by the offset operation. `deletedIds`
33
+ * are components removed by split-style offsets.
34
+ */
35
+ export declare const PluginOffsetResult: z.ZodObject<{
36
+ createdIds: z.ZodArray<z.ZodString>;
37
+ deletedIds: z.ZodArray<z.ZodString>;
38
+ }, z.core.$strip>;
39
+ export type PluginOffsetResult = {
40
+ createdIds: ComponentId[];
41
+ deletedIds: ComponentId[];
42
+ };
43
+ //# sourceMappingURL=offset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"offset.d.ts","sourceRoot":"","sources":["../../../src/api/tools/offset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAG9C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;iBAI3B,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAA;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,WAAW,EAAE,CAAA;IACzB,UAAU,EAAE,WAAW,EAAE,CAAA;CAC1B,CAAA"}
@@ -0,0 +1,48 @@
1
+ import * as z from "zod";
2
+ import { PluginApiReturn } from "../../types";
3
+ /**
4
+ * Query the current user selection in the Snaptrude editor.
5
+ *
6
+ * Accessed via `snaptrude.tools.selection`.
7
+ */
8
+ export declare abstract class PluginSelectionApi {
9
+ constructor();
10
+ /**
11
+ * Get the IDs of all currently selected components.
12
+ *
13
+ * Returns the component IDs from the editor's active selection stack.
14
+ * If nothing is selected, returns an empty array.
15
+ *
16
+ * The returned IDs can be used with {@linkcode PluginTransformApi.move},
17
+ * {@linkcode PluginTransformApi.rotate}, or entity query methods like
18
+ * {@linkcode PluginSpaceApi.get}.
19
+ *
20
+ * @returns A {@linkcode PluginSelectionGetResult} with a `selected` array
21
+ * of component ID strings
22
+ *
23
+ * # Example
24
+ * ```ts
25
+ * const { selected } = await snaptrude.tools.selection.get()
26
+ * if (selected.length > 0) {
27
+ * // Move selected components 5 units along X
28
+ * await snaptrude.tools.transform.move({
29
+ * componentIds: selected,
30
+ * displacement: snaptrude.core.math.vec3.new(5, 0, 0),
31
+ * })
32
+ * }
33
+ * ```
34
+ */
35
+ abstract get(): PluginApiReturn<PluginSelectionGetResult>;
36
+ }
37
+ /**
38
+ * Result of {@linkcode PluginSelectionApi.get}.
39
+ *
40
+ * | Property | Type | Description |
41
+ * |---|---|---|
42
+ * | `selected` | `string[]` | Component IDs of the current selection |
43
+ */
44
+ export declare const PluginSelectionGetResult: z.ZodObject<{
45
+ selected: z.ZodArray<z.ZodString>;
46
+ }, z.core.$strip>;
47
+ export type PluginSelectionGetResult = z.infer<typeof PluginSelectionGetResult>;
48
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/api/tools/selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;GAIG;AACH,8BAAsB,kBAAkB;;IAGtC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;aACa,GAAG,IAAI,eAAe,CAAC,wBAAwB,CAAC;CACjE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB;;iBAEnC,CAAA;AAEF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
@@ -0,0 +1,114 @@
1
+ import * as z from "zod";
2
+ import { PluginApiReturn } from "../../types";
3
+ /**
4
+ * Transform operations — move and rotate scene components.
5
+ *
6
+ * All transform methods accept an array of component IDs and apply the
7
+ * transformation to each. Operations are recorded in Snaptrude's
8
+ * command system for undo/redo support.
9
+ *
10
+ * Accessed via `snaptrude.tools.transform`.
11
+ */
12
+ export declare abstract class PluginTransformApi {
13
+ constructor();
14
+ /**
15
+ * Translate components by a displacement vector.
16
+ *
17
+ * Each component's position is offset by the given
18
+ * {@linkcode PluginMoveArgs.displacement displacement} vector.
19
+ * This operation is undoable.
20
+ *
21
+ * @param args - An object containing:
22
+ * - {@linkcode PluginMoveArgs.componentIds args.componentIds} — Array of component
23
+ * ID strings to move
24
+ * - {@linkcode PluginMoveArgs.displacement args.displacement} — Translation vector
25
+ * as a {@linkcode PVec3} in Babylon units
26
+ * @throws If any component ID is not found in the scene
27
+ *
28
+ * # Example
29
+ * ```ts
30
+ * const { vec3 } = snaptrude.core.math
31
+ *
32
+ * // Move a space 10 units along the X axis
33
+ * await snaptrude.tools.transform.move({
34
+ * componentIds: ["some-space-id"],
35
+ * displacement: vec3.new(10, 0, 0),
36
+ * })
37
+ * ```
38
+ */
39
+ abstract move({ componentIds, displacement, }: PluginMoveArgs): PluginApiReturn<void>;
40
+ /**
41
+ * Rotate components around an axis through a pivot point.
42
+ *
43
+ * Each component is rotated by {@linkcode PluginRotateArgs.angle angle}
44
+ * radians around the {@linkcode PluginRotateArgs.axis axis} vector,
45
+ * pivoting about the {@linkcode PluginRotateArgs.pivot pivot} point.
46
+ * This operation is undoable.
47
+ *
48
+ * @param args - An object containing:
49
+ * - {@linkcode PluginRotateArgs.componentIds args.componentIds} — Array of component
50
+ * ID strings to rotate
51
+ * - {@linkcode PluginRotateArgs.angle args.angle} — Rotation angle in **radians**
52
+ * - {@linkcode PluginRotateArgs.axis args.axis} — Rotation axis as a {@linkcode PVec3}
53
+ * - {@linkcode PluginRotateArgs.pivot args.pivot} — Pivot point as a {@linkcode PVec3}
54
+ * in Babylon units
55
+ * @throws If any component ID is not found in the scene
56
+ *
57
+ * # Example
58
+ * ```ts
59
+ * const { vec3 } = snaptrude.core.math
60
+ *
61
+ * // Rotate a space 45° around the Y axis at the origin
62
+ * await snaptrude.tools.transform.rotate({
63
+ * componentIds: ["some-space-id"],
64
+ * angle: Math.PI / 4,
65
+ * axis: vec3.new(0, 1, 0),
66
+ * pivot: vec3.new(0, 0, 0),
67
+ * })
68
+ * ```
69
+ */
70
+ abstract rotate({ componentIds, angle, axis, pivot, }: PluginRotateArgs): PluginApiReturn<void>;
71
+ }
72
+ /**
73
+ * Arguments for {@linkcode PluginTransformApi.move}.
74
+ *
75
+ * | Property | Type | Description |
76
+ * |---|---|---|
77
+ * | `componentIds` | `string[]` | Component IDs to move |
78
+ * | `displacement` | {@linkcode PVec3} | Translation vector in Babylon units |
79
+ */
80
+ export declare const PluginMoveArgs: z.ZodObject<{
81
+ componentIds: z.ZodArray<z.ZodString>;
82
+ displacement: z.ZodObject<{
83
+ x: z.ZodNumber;
84
+ y: z.ZodNumber;
85
+ z: z.ZodNumber;
86
+ }, z.core.$strip>;
87
+ }, z.core.$strip>;
88
+ export type PluginMoveArgs = z.infer<typeof PluginMoveArgs>;
89
+ /**
90
+ * Arguments for {@linkcode PluginTransformApi.rotate}.
91
+ *
92
+ * | Property | Type | Description |
93
+ * |---|---|---|
94
+ * | `componentIds` | `string[]` | Component IDs to rotate |
95
+ * | `angle` | `number` | Rotation angle in radians |
96
+ * | `axis` | {@linkcode PVec3} | Rotation axis direction |
97
+ * | `pivot` | {@linkcode PVec3} | Pivot point in Babylon units |
98
+ */
99
+ export declare const PluginRotateArgs: z.ZodObject<{
100
+ componentIds: z.ZodArray<z.ZodString>;
101
+ angle: z.ZodNumber;
102
+ axis: z.ZodObject<{
103
+ x: z.ZodNumber;
104
+ y: z.ZodNumber;
105
+ z: z.ZodNumber;
106
+ }, z.core.$strip>;
107
+ pivot: z.ZodObject<{
108
+ x: z.ZodNumber;
109
+ y: z.ZodNumber;
110
+ z: z.ZodNumber;
111
+ }, z.core.$strip>;
112
+ }, z.core.$strip>;
113
+ export type PluginRotateArgs = z.infer<typeof PluginRotateArgs>;
114
+ //# sourceMappingURL=transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../src/api/tools/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAG7C;;;;;;;;GAQG;AACH,8BAAsB,kBAAkB;;IAGtC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;aACa,IAAI,CAAC,EACnB,YAAY,EACZ,YAAY,GACb,EAAE,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;aACa,MAAM,CAAC,EACrB,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,KAAK,GACN,EAAE,gBAAgB,GAAG,eAAe,CAAC,IAAI,CAAC;CAC5C;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;;;iBAGzB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;iBAK3B,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}