@snaptrude/plugin-core 0.2.3 → 0.2.4

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 (57) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/index.cjs +1 -0
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.js +1 -0
  5. package/dist/index.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/api/entity/space.ts +28 -14
  8. package/dist/api/core/geom/arc.d.ts +0 -81
  9. package/dist/api/core/geom/arc.d.ts.map +0 -1
  10. package/dist/api/core/geom/curve.d.ts +0 -70
  11. package/dist/api/core/geom/curve.d.ts.map +0 -1
  12. package/dist/api/core/geom/index.d.ts +0 -32
  13. package/dist/api/core/geom/index.d.ts.map +0 -1
  14. package/dist/api/core/geom/line.d.ts +0 -56
  15. package/dist/api/core/geom/line.d.ts.map +0 -1
  16. package/dist/api/core/geom/profile.d.ts +0 -121
  17. package/dist/api/core/geom/profile.d.ts.map +0 -1
  18. package/dist/api/core/index.d.ts +0 -18
  19. package/dist/api/core/index.d.ts.map +0 -1
  20. package/dist/api/core/math/index.d.ts +0 -18
  21. package/dist/api/core/math/index.d.ts.map +0 -1
  22. package/dist/api/core/math/quat.d.ts +0 -187
  23. package/dist/api/core/math/quat.d.ts.map +0 -1
  24. package/dist/api/core/math/vec3.d.ts +0 -156
  25. package/dist/api/core/math/vec3.d.ts.map +0 -1
  26. package/dist/api/entity/buildableEnvelope.d.ts +0 -233
  27. package/dist/api/entity/buildableEnvelope.d.ts.map +0 -1
  28. package/dist/api/entity/department.d.ts +0 -99
  29. package/dist/api/entity/department.d.ts.map +0 -1
  30. package/dist/api/entity/index.d.ts +0 -33
  31. package/dist/api/entity/index.d.ts.map +0 -1
  32. package/dist/api/entity/referenceLine.d.ts +0 -259
  33. package/dist/api/entity/referenceLine.d.ts.map +0 -1
  34. package/dist/api/entity/space.d.ts +0 -765
  35. package/dist/api/entity/space.d.ts.map +0 -1
  36. package/dist/api/entity/story.d.ts +0 -239
  37. package/dist/api/entity/story.d.ts.map +0 -1
  38. package/dist/api/index.d.ts +0 -30
  39. package/dist/api/index.d.ts.map +0 -1
  40. package/dist/api/tools/copy.d.ts +0 -59
  41. package/dist/api/tools/copy.d.ts.map +0 -1
  42. package/dist/api/tools/index.d.ts +0 -29
  43. package/dist/api/tools/index.d.ts.map +0 -1
  44. package/dist/api/tools/offset.d.ts +0 -43
  45. package/dist/api/tools/offset.d.ts.map +0 -1
  46. package/dist/api/tools/selection.d.ts +0 -48
  47. package/dist/api/tools/selection.d.ts.map +0 -1
  48. package/dist/api/tools/transform.d.ts +0 -114
  49. package/dist/api/tools/transform.d.ts.map +0 -1
  50. package/dist/api/units/index.d.ts +0 -163
  51. package/dist/api/units/index.d.ts.map +0 -1
  52. package/dist/host-utils.d.ts +0 -41
  53. package/dist/host-utils.d.ts.map +0 -1
  54. package/dist/index.d.ts +0 -4
  55. package/dist/index.d.ts.map +0 -1
  56. package/dist/types.d.ts +0 -16
  57. package/dist/types.d.ts.map +0 -1
@@ -1,187 +0,0 @@
1
- import * as z from "zod";
2
- import type { PVec3 } from "./vec3";
3
- /**
4
- * Quaternion operations for 3D rotations.
5
- *
6
- * Quaternions avoid gimbal lock and provide smooth interpolation
7
- * compared to Euler angles. All methods are **pure** — they return
8
- * new {@linkcode PQuat} values without mutating the inputs.
9
- *
10
- * Accessed via `snaptrude.core.math.quat`.
11
- */
12
- export declare abstract class PluginQuatApi {
13
- constructor();
14
- /**
15
- * Create a new quaternion from raw components.
16
- *
17
- * For most use cases prefer {@linkcode PluginQuatApi.fromAxisAngle}
18
- * or {@linkcode PluginQuatApi.fromEuler} instead.
19
- *
20
- * @param x - The X component
21
- * @param y - The Y component
22
- * @param z - The Z component
23
- * @param w - The W (scalar) component
24
- * @returns A new {@linkcode PQuat}
25
- */
26
- new(x: number, y: number, z: number, w: number): PQuat;
27
- /**
28
- * Create an identity quaternion representing no rotation.
29
- *
30
- * @returns `{ x: 0, y: 0, z: 0, w: 1 }`
31
- */
32
- identity(): PQuat;
33
- /**
34
- * Create a quaternion from an axis and an angle.
35
- *
36
- * @param axis - The rotation axis as a {@linkcode PVec3} (will be normalized internally)
37
- * @param angle - The rotation angle in **radians**
38
- * @returns A new unit {@linkcode PQuat}, or identity if {@linkcode axis} has zero length
39
- *
40
- * # Example
41
- * ```ts
42
- * const { vec3, quat } = snaptrude.core.math
43
- * // 90° rotation around the Y axis
44
- * const rot = quat.fromAxisAngle(vec3.new(0, 1, 0), Math.PI / 2)
45
- * ```
46
- */
47
- fromAxisAngle(axis: PVec3, angle: number): PQuat;
48
- /**
49
- * Create a quaternion from Euler angles in **XYZ** rotation order.
50
- *
51
- * @param x - Rotation around X axis in **radians**
52
- * @param y - Rotation around Y axis in **radians**
53
- * @param z - Rotation around Z axis in **radians**
54
- * @returns A new {@linkcode PQuat}
55
- */
56
- fromEuler(x: number, y: number, z: number): PQuat;
57
- /**
58
- * Multiply two quaternions, combining their rotations.
59
- *
60
- * Quaternion multiplication is **not commutative**: `a * b ≠ b * a`.
61
- * The result applies rotation {@linkcode b} first, then {@linkcode a}.
62
- *
63
- * @param a - First quaternion (applied second)
64
- * @param b - Second quaternion (applied first)
65
- * @returns A new {@linkcode PQuat} representing the combined rotation
66
- */
67
- multiply(a: PQuat, b: PQuat): PQuat;
68
- /**
69
- * Compute the conjugate of a quaternion.
70
- *
71
- * For unit quaternions the conjugate equals the inverse.
72
- *
73
- * @param q - The quaternion
74
- * @returns A new {@linkcode PQuat} with negated vector part `(-x, -y, -z, w)`
75
- */
76
- conjugate(q: PQuat): PQuat;
77
- /**
78
- * Compute the length (magnitude) of a quaternion.
79
- *
80
- * @param q - The quaternion
81
- * @returns The magnitude `√(x² + y² + z² + w²)`
82
- */
83
- length(q: PQuat): number;
84
- /**
85
- * Normalize a quaternion to unit length.
86
- *
87
- * @param q - The quaternion to normalize
88
- * @returns A new unit-length {@linkcode PQuat}, or identity if the input has zero length
89
- */
90
- normalize(q: PQuat): PQuat;
91
- /**
92
- * Compute the inverse of a quaternion.
93
- *
94
- * The inverse satisfies `q * inverse(q) = identity`.
95
- *
96
- * @param q - The quaternion to invert
97
- * @returns A new {@linkcode PQuat} that is the multiplicative inverse,
98
- * or identity if the input has zero length
99
- */
100
- inverse(q: PQuat): PQuat;
101
- /**
102
- * Rotate a 3D vector by a quaternion.
103
- *
104
- * Computes `q * v * conjugate(q)` using the Hamilton product.
105
- *
106
- * @param q - The rotation quaternion (should be unit-length)
107
- * @param v - The vector to rotate as a {@linkcode PVec3}
108
- * @returns A new rotated {@linkcode PVec3}
109
- *
110
- * # Example
111
- * ```ts
112
- * const { vec3, quat } = snaptrude.core.math
113
- * const rot = quat.fromAxisAngle(vec3.new(0, 1, 0), Math.PI / 2)
114
- * const rotated = quat.rotateVec3(rot, vec3.new(1, 0, 0))
115
- * // ≈ { x: 0, y: 0, z: -1 }
116
- * ```
117
- */
118
- rotateVec3(q: PQuat, v: PVec3): PVec3;
119
- /**
120
- * Convert a quaternion to axis-angle representation.
121
- *
122
- * @param q - The quaternion to convert
123
- * @returns An object with:
124
- * - `axis` — The rotation axis as a unit {@linkcode PVec3}
125
- * (defaults to `(1, 0, 0)` when angle is zero)
126
- * - `angle` — The rotation angle in **radians**
127
- */
128
- toAxisAngle(q: PQuat): {
129
- axis: PVec3;
130
- angle: number;
131
- };
132
- /**
133
- * Spherical linear interpolation between two quaternions.
134
- *
135
- * Produces smooth constant-speed rotation between {@linkcode a} and {@linkcode b}.
136
- *
137
- * @param a - Start quaternion (returned when `t = 0`)
138
- * @param b - End quaternion (returned when `t = 1`)
139
- * @param t - Interpolation factor, typically in `[0, 1]`
140
- * @returns A new interpolated {@linkcode PQuat}
141
- */
142
- slerp(a: PQuat, b: PQuat, t: number): PQuat;
143
- /**
144
- * Compute the dot product of two quaternions.
145
- *
146
- * A value close to `1` or `-1` indicates similar orientations;
147
- * a value close to `0` indicates maximally different orientations.
148
- *
149
- * @param a - First quaternion
150
- * @param b - Second quaternion
151
- * @returns The scalar dot product
152
- */
153
- dot(a: PQuat, b: PQuat): number;
154
- /**
155
- * Check if two quaternions are exactly equal (strict equality per component).
156
- *
157
- * For floating-point comparisons, prefer {@linkcode PluginQuatApi.equalsApprox}.
158
- *
159
- * @param a - First quaternion
160
- * @param b - Second quaternion
161
- * @returns `true` if all components match exactly
162
- */
163
- equals(a: PQuat, b: PQuat): boolean;
164
- /**
165
- * Check if two quaternions are approximately equal within a tolerance.
166
- *
167
- * @param a - First quaternion
168
- * @param b - Second quaternion
169
- * @param epsilon - Maximum allowed difference per component (default `1e-6`)
170
- * @returns `true` if `|a[i] - b[i]| < epsilon` for all components
171
- */
172
- equalsApprox(a: PQuat, b: PQuat, epsilon?: number): boolean;
173
- }
174
- /**
175
- * A quaternion with `x`, `y`, `z`, and `w` components.
176
- *
177
- * Used for representing 3D rotations without gimbal lock.
178
- * Equivalent to `BABYLON.Quaternion`.
179
- */
180
- export declare const PQuat: z.ZodObject<{
181
- x: z.ZodNumber;
182
- y: z.ZodNumber;
183
- z: z.ZodNumber;
184
- w: z.ZodNumber;
185
- }, z.core.$strip>;
186
- export type PQuat = z.infer<typeof PQuat>;
187
- //# sourceMappingURL=quat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quat.d.ts","sourceRoot":"","sources":["../../../../src/api/core/math/quat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEnC;;;;;;;;GAQG;AACH,8BAAsB,aAAa;;IAGjC;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK;IAItD;;;;OAIG;IACH,QAAQ,IAAI,KAAK;IAIjB;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK;IAahD;;;;;;;OAOG;IACH,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK;IAejD;;;;;;;;;OASG;IACH,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK;IASnC;;;;;;;OAOG;IACH,SAAS,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK;IAI1B;;;;;OAKG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM;IAIxB;;;;;OAKG;IACH,SAAS,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK;IAM1B;;;;;;;;OAQG;IACH,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK;IAMxB;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK;IAOrC;;;;;;;;OAQG;IACH,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG;QAAE,IAAI,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAarD;;;;;;;;;OASG;IACH,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK;IAsB3C;;;;;;;;;OASG;IACH,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM;IAI/B;;;;;;;;OAQG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,OAAO;IAInC;;;;;;;OAOG;IACH,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAE,MAAa,GAAG,OAAO;CAQlE;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;;;iBAKhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAA"}
@@ -1,156 +0,0 @@
1
- import * as z from "zod";
2
- /**
3
- * 3D vector operations for positions, directions, and displacements.
4
- *
5
- * All methods are **pure** — they return new {@linkcode PVec3} values
6
- * without mutating the inputs.
7
- *
8
- * Accessed via `snaptrude.core.math.vec3`.
9
- */
10
- export declare abstract class PluginVec3Api {
11
- constructor();
12
- /**
13
- * Create a new 3D vector.
14
- *
15
- * @param x - The X component
16
- * @param y - The Y component
17
- * @param z - The Z component
18
- * @returns A new {@linkcode PVec3}
19
- *
20
- * # Example
21
- * ```ts
22
- * const position = snaptrude.core.math.vec3.new(1, 2, 3)
23
- * // { x: 1, y: 2, z: 3 }
24
- * ```
25
- */
26
- new(x: number, y: number, z: number): PVec3;
27
- /**
28
- * Add two vectors component-wise.
29
- *
30
- * @param a - First vector
31
- * @param b - Second vector
32
- * @returns A new {@linkcode PVec3} where each component is `a[i] + b[i]`
33
- */
34
- add(a: PVec3, b: PVec3): PVec3;
35
- /**
36
- * Subtract vector {@linkcode b} from vector {@linkcode a} component-wise.
37
- *
38
- * @param a - Vector to subtract from
39
- * @param b - Vector to subtract
40
- * @returns A new {@linkcode PVec3} where each component is `a[i] - b[i]`
41
- */
42
- subtract(a: PVec3, b: PVec3): PVec3;
43
- /**
44
- * Scale a vector by a scalar value.
45
- *
46
- * @param v - The vector to scale
47
- * @param scalar - The scalar multiplier
48
- * @returns A new {@linkcode PVec3} where each component is `v[i] * scalar`
49
- */
50
- scale(v: PVec3, scalar: number): PVec3;
51
- /**
52
- * Compute the dot product of two vectors.
53
- *
54
- * The dot product equals `|a| * |b| * cos(θ)` where `θ` is the angle
55
- * between the vectors. Useful for checking orthogonality (result = 0)
56
- * or projection.
57
- *
58
- * @param a - First vector
59
- * @param b - Second vector
60
- * @returns The scalar dot product
61
- */
62
- dot(a: PVec3, b: PVec3): number;
63
- /**
64
- * Compute the cross product of two vectors.
65
- *
66
- * The result is a vector perpendicular to both inputs, with magnitude
67
- * equal to the area of the parallelogram they span. Useful for computing
68
- * surface normals.
69
- *
70
- * @param a - First vector
71
- * @param b - Second vector
72
- * @returns A new {@linkcode PVec3} perpendicular to both {@linkcode a} and {@linkcode b}
73
- */
74
- cross(a: PVec3, b: PVec3): PVec3;
75
- /**
76
- * Compute the length (magnitude) of a vector.
77
- *
78
- * @param v - The vector
79
- * @returns The Euclidean length `√(x² + y² + z²)`
80
- */
81
- length(v: PVec3): number;
82
- /**
83
- * Compute the squared length of a vector.
84
- *
85
- * Avoids the `sqrt` call — prefer this over {@linkcode PluginVec3Api.length}
86
- * when comparing relative magnitudes.
87
- *
88
- * @param v - The vector
89
- * @returns The squared length `x² + y² + z²`
90
- */
91
- lengthSquared(v: PVec3): number;
92
- /**
93
- * Normalize a vector to unit length.
94
- *
95
- * @param v - The vector to normalize
96
- * @returns A new unit-length {@linkcode PVec3} in the same direction,
97
- * or a zero vector `(0, 0, 0)` if the input has zero length
98
- */
99
- normalize(v: PVec3): PVec3;
100
- /**
101
- * Compute the Euclidean distance between two points.
102
- *
103
- * @param a - First point
104
- * @param b - Second point
105
- * @returns The distance `|a - b|`
106
- */
107
- distance(a: PVec3, b: PVec3): number;
108
- /**
109
- * Linearly interpolate between two vectors.
110
- *
111
- * @param a - Start vector (returned when `t = 0`)
112
- * @param b - End vector (returned when `t = 1`)
113
- * @param t - Interpolation factor, typically in `[0, 1]`
114
- * @returns A new {@linkcode PVec3} at `a + (b - a) * t`
115
- */
116
- lerp(a: PVec3, b: PVec3, t: number): PVec3;
117
- /**
118
- * Negate a vector (reverse its direction).
119
- *
120
- * @param v - The vector to negate
121
- * @returns A new {@linkcode PVec3} with all components negated
122
- */
123
- negate(v: PVec3): PVec3;
124
- /**
125
- * Check if two vectors are exactly equal (strict equality per component).
126
- *
127
- * For floating-point comparisons, prefer {@linkcode PluginVec3Api.equalsApprox}.
128
- *
129
- * @param a - First vector
130
- * @param b - Second vector
131
- * @returns `true` if all components match exactly
132
- */
133
- equals(a: PVec3, b: PVec3): boolean;
134
- /**
135
- * Check if two vectors are approximately equal within a tolerance.
136
- *
137
- * @param a - First vector
138
- * @param b - Second vector
139
- * @param epsilon - Maximum allowed difference per component (default `1e-6`)
140
- * @returns `true` if `|a[i] - b[i]| < epsilon` for all components
141
- */
142
- equalsApprox(a: PVec3, b: PVec3, epsilon?: number): boolean;
143
- }
144
- /**
145
- * A 3D vector with `x`, `y`, and `z` components.
146
- *
147
- * Used throughout the plugin API for positions, directions, displacements,
148
- * and Euler rotation angles. Equivalent to `BABYLON.Vector3`.
149
- */
150
- export declare const PVec3: z.ZodObject<{
151
- x: z.ZodNumber;
152
- y: z.ZodNumber;
153
- z: z.ZodNumber;
154
- }, z.core.$strip>;
155
- export type PVec3 = z.infer<typeof PVec3>;
156
- //# sourceMappingURL=vec3.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vec3.d.ts","sourceRoot":"","sources":["../../../../src/api/core/math/vec3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AAExB;;;;;;;GAOG;AACH,8BAAsB,aAAa;;IAGjC;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK;IAI3C;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK;IAI9B;;;;;;OAMG;IACH,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK;IAInC;;;;;;OAMG;IACH,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK;IAItC;;;;;;;;;;OAUG;IACH,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM;IAI/B;;;;;;;;;;OAUG;IACH,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK;IAQhC;;;;;OAKG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM;IAIxB;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM;IAI/B;;;;;;OAMG;IACH,SAAS,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK;IAM1B;;;;;;OAMG;IACH,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM;IAIpC;;;;;;;OAOG;IACH,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK;IAQ1C;;;;;OAKG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK;IAIvB;;;;;;;;OAQG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,OAAO;IAInC;;;;;;;OAOG;IACH,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAE,MAAa,GAAG,OAAO;CAOlE;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;;iBAIhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAA"}
@@ -1,233 +0,0 @@
1
- import * as z from "zod";
2
- import { PluginApiReturn } from "../../types";
3
- /**
4
- * Buildable Envelope management — create and update parametric zoning envelopes.
5
- *
6
- * A **buildable envelope** is the regulated volume inside which a building may
7
- * be massed. The host owns envelope identity: {@linkcode PluginBuildableEnvelopeApi.create create}
8
- * mints a `buildableEnvelopeId` and returns it; {@linkcode PluginBuildableEnvelopeApi.update update}
9
- * requires that id to target the existing envelope.
10
- *
11
- * Accessed via `snaptrude.entity.buildableEnvelope`.
12
- */
13
- export declare abstract class PluginBuildableEnvelopeApi {
14
- constructor();
15
- /**
16
- * Create a new parametric buildable envelope.
17
- *
18
- * @param args - A {@linkcode PluginBuildableEnvelopeCreateArgs} object.
19
- * @returns A {@linkcode PluginBuildableEnvelopeCreateResult} with the
20
- * `buildableEnvelopeId` of the created envelope.
21
- * @throws If validation fails or generation produces no renderable geometry.
22
- *
23
- * # Example
24
- * ```ts
25
- * const { buildableEnvelopeId } = await snaptrude.entity.buildableEnvelope.create({
26
- * sitePolygon: [
27
- * { x: 0, z: 0 },
28
- * { x: 100, z: 0 },
29
- * { x: 100, z: 80 },
30
- * { x: 0, z: 80 },
31
- * ],
32
- * lengthUnit: "ft",
33
- * setbacks: [
34
- * { aboveHeight: 0, front: 10, side: 5, rear: 10 },
35
- * { aboveHeight: 100, front: 20, side: 10, rear: 20 },
36
- * ],
37
- * verticalCap: { kind: "max_height", maxHeight: 150 },
38
- * floorToFloor: 12,
39
- * })
40
- * ```
41
- */
42
- abstract create(args: PluginBuildableEnvelopeCreateArgs): PluginApiReturn<PluginBuildableEnvelopeCreateResult>;
43
- /**
44
- * Update an existing parametric buildable envelope.
45
- *
46
- * @param args - A {@linkcode PluginBuildableEnvelopeUpdateArgs} object.
47
- * `buildableEnvelopeId` is required and must match an existing envelope on
48
- * the canvas.
49
- * @returns A {@linkcode PluginBuildableEnvelopeUpdateResult} with the
50
- * `buildableEnvelopeId` of the updated envelope.
51
- * @throws If validation fails, the envelope does not exist, or generation
52
- * produces no renderable geometry.
53
- *
54
- * # Example
55
- * ```ts
56
- * const { buildableEnvelopeId } = await snaptrude.entity.buildableEnvelope.update({
57
- * buildableEnvelopeId: existingId,
58
- * sitePolygon: [
59
- * { x: 0, z: 0 },
60
- * { x: 100, z: 0 },
61
- * { x: 100, z: 80 },
62
- * { x: 0, z: 80 },
63
- * ],
64
- * lengthUnit: "ft",
65
- * setbacks: [{ aboveHeight: 0, front: 10, side: 5, rear: 10 }],
66
- * verticalCap: { kind: "max_height", maxHeight: 175 },
67
- * floorToFloor: 12,
68
- * })
69
- * ```
70
- */
71
- abstract update(args: PluginBuildableEnvelopeUpdateArgs): PluginApiReturn<PluginBuildableEnvelopeUpdateResult>;
72
- }
73
- /**
74
- * Site polygon vertex in the request `lengthUnit`.
75
- *
76
- * Vertices may be passed as `{x, z}` objects or `[x, z]` tuples. Numeric
77
- * values must be finite (no `NaN` or `±Infinity`).
78
- */
79
- export declare const PluginBuildableEnvelopePolygonVertex: z.ZodUnion<readonly [z.ZodObject<{
80
- x: z.ZodNumber;
81
- z: z.ZodNumber;
82
- }, z.core.$strict>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>;
83
- export type PluginBuildableEnvelopePolygonVertex = z.infer<typeof PluginBuildableEnvelopePolygonVertex>;
84
- /**
85
- * Vertical cap for a buildable envelope.
86
- *
87
- * Use exactly one shape:
88
- * - `{ kind: "max_height", maxHeight }`
89
- * - `{ kind: "max_floors", maxFloors }`
90
- *
91
- * Floor-to-floor height is not nested here; it is always supplied as the
92
- * top-level `floorToFloor` argument.
93
- */
94
- export declare const PluginBuildableEnvelopeVerticalCap: z.ZodDiscriminatedUnion<[z.ZodObject<{
95
- kind: z.ZodLiteral<"max_height">;
96
- maxHeight: z.ZodNumber;
97
- }, z.core.$strict>, z.ZodObject<{
98
- kind: z.ZodLiteral<"max_floors">;
99
- maxFloors: z.ZodNumber;
100
- }, z.core.$strict>], "kind">;
101
- export type PluginBuildableEnvelopeVerticalCap = z.infer<typeof PluginBuildableEnvelopeVerticalCap>;
102
- /**
103
- * One tier of a buildable envelope's setback profile.
104
- *
105
- * Tiers are ordered by `aboveHeight`. The first tier (index 0) must have
106
- * `aboveHeight: 0` and describes the ground footprint; each subsequent tier
107
- * describes the complete setback at a strictly greater height. Each tier
108
- * carries its own `front`, `side`, and `rear` values — there is no
109
- * inheritance from earlier tiers.
110
- *
111
- * All numeric values must be finite and nonnegative, in the request
112
- * `lengthUnit`.
113
- *
114
- * | Property | Type | Description |
115
- * |---|---|---|
116
- * | `aboveHeight` | `number` | Height at or above which this tier applies; the ground tier uses `0` |
117
- * | `front` | `number` | Front setback for this tier |
118
- * | `side` | `number` | Side setback for this tier |
119
- * | `rear` | `number` | Rear setback for this tier |
120
- */
121
- export declare const PluginBuildableEnvelopeSetbackTier: z.ZodObject<{
122
- aboveHeight: z.ZodNumber;
123
- front: z.ZodNumber;
124
- side: z.ZodNumber;
125
- rear: z.ZodNumber;
126
- }, z.core.$strict>;
127
- export type PluginBuildableEnvelopeSetbackTier = z.infer<typeof PluginBuildableEnvelopeSetbackTier>;
128
- /**
129
- * Arguments for {@linkcode PluginBuildableEnvelopeApi.create}.
130
- *
131
- * Strict schema. The host owns identity — no `buildableEnvelopeId` is accepted
132
- * on create; the id is minted by the host and returned in
133
- * {@linkcode PluginBuildableEnvelopeCreateResult}.
134
- *
135
- * | Property | Type | Description |
136
- * |---|---|---|
137
- * | `sitePolygon` | {@linkcode PluginBuildableEnvelopePolygonVertex}`[]` | Site polygon vertices in `lengthUnit`; minimum 3 vertices |
138
- * | `lengthUnit` | `"ft" \| "m"` | Unit used by all length fields |
139
- * | `setbacks` | {@linkcode PluginBuildableEnvelopeSetbackTier}`[]` | Setback profile, ground tier first; minimum 1 tier |
140
- * | `verticalCap` | {@linkcode PluginBuildableEnvelopeVerticalCap} | Maximum height or floor count |
141
- * | `floorToFloor` | `number` | Required floor-to-floor height in `lengthUnit` |
142
- * | `farRatio` | `number?` | Optional FAR value, positive when provided |
143
- * | `lotCoverageMaxPct` | `number?` | Optional lot coverage cap, `0..100` |
144
- */
145
- export declare const PluginBuildableEnvelopeCreateArgs: z.ZodObject<{
146
- sitePolygon: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
147
- x: z.ZodNumber;
148
- z: z.ZodNumber;
149
- }, z.core.$strict>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>>;
150
- lengthUnit: z.ZodUnion<readonly [z.ZodLiteral<"ft">, z.ZodLiteral<"m">]>;
151
- setbacks: z.ZodArray<z.ZodObject<{
152
- aboveHeight: z.ZodNumber;
153
- front: z.ZodNumber;
154
- side: z.ZodNumber;
155
- rear: z.ZodNumber;
156
- }, z.core.$strict>>;
157
- verticalCap: z.ZodDiscriminatedUnion<[z.ZodObject<{
158
- kind: z.ZodLiteral<"max_height">;
159
- maxHeight: z.ZodNumber;
160
- }, z.core.$strict>, z.ZodObject<{
161
- kind: z.ZodLiteral<"max_floors">;
162
- maxFloors: z.ZodNumber;
163
- }, z.core.$strict>], "kind">;
164
- floorToFloor: z.ZodNumber;
165
- farRatio: z.ZodOptional<z.ZodNumber>;
166
- lotCoverageMaxPct: z.ZodOptional<z.ZodNumber>;
167
- }, z.core.$strict>;
168
- export type PluginBuildableEnvelopeCreateArgs = z.infer<typeof PluginBuildableEnvelopeCreateArgs>;
169
- /**
170
- * Result of {@linkcode PluginBuildableEnvelopeApi.create}.
171
- *
172
- * | Property | Type | Description |
173
- * |---|---|---|
174
- * | `buildableEnvelopeId` | `string` | Non-empty unique ID of the created buildable envelope |
175
- */
176
- export declare const PluginBuildableEnvelopeCreateResult: z.ZodObject<{
177
- buildableEnvelopeId: z.ZodString;
178
- }, z.core.$strict>;
179
- export type PluginBuildableEnvelopeCreateResult = z.infer<typeof PluginBuildableEnvelopeCreateResult>;
180
- /**
181
- * Arguments for {@linkcode PluginBuildableEnvelopeApi.update}.
182
- *
183
- * Strict schema. `buildableEnvelopeId` is required and identifies the prior
184
- * envelope on the canvas to update.
185
- *
186
- * | Property | Type | Description |
187
- * |---|---|---|
188
- * | `buildableEnvelopeId` | `string` | Existing envelope ID to update; non-empty |
189
- * | `sitePolygon` | {@linkcode PluginBuildableEnvelopePolygonVertex}`[]` | Site polygon vertices in `lengthUnit`; minimum 3 vertices |
190
- * | `lengthUnit` | `"ft" \| "m"` | Unit used by all length fields |
191
- * | `setbacks` | {@linkcode PluginBuildableEnvelopeSetbackTier}`[]` | Setback profile, ground tier first; minimum 1 tier |
192
- * | `verticalCap` | {@linkcode PluginBuildableEnvelopeVerticalCap} | Maximum height or floor count |
193
- * | `floorToFloor` | `number` | Required floor-to-floor height in `lengthUnit` |
194
- * | `farRatio` | `number?` | Optional FAR value, positive when provided |
195
- * | `lotCoverageMaxPct` | `number?` | Optional lot coverage cap, `0..100` |
196
- */
197
- export declare const PluginBuildableEnvelopeUpdateArgs: z.ZodObject<{
198
- buildableEnvelopeId: z.ZodString;
199
- sitePolygon: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
200
- x: z.ZodNumber;
201
- z: z.ZodNumber;
202
- }, z.core.$strict>, z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>]>>;
203
- lengthUnit: z.ZodUnion<readonly [z.ZodLiteral<"ft">, z.ZodLiteral<"m">]>;
204
- setbacks: z.ZodArray<z.ZodObject<{
205
- aboveHeight: z.ZodNumber;
206
- front: z.ZodNumber;
207
- side: z.ZodNumber;
208
- rear: z.ZodNumber;
209
- }, z.core.$strict>>;
210
- verticalCap: z.ZodDiscriminatedUnion<[z.ZodObject<{
211
- kind: z.ZodLiteral<"max_height">;
212
- maxHeight: z.ZodNumber;
213
- }, z.core.$strict>, z.ZodObject<{
214
- kind: z.ZodLiteral<"max_floors">;
215
- maxFloors: z.ZodNumber;
216
- }, z.core.$strict>], "kind">;
217
- floorToFloor: z.ZodNumber;
218
- farRatio: z.ZodOptional<z.ZodNumber>;
219
- lotCoverageMaxPct: z.ZodOptional<z.ZodNumber>;
220
- }, z.core.$strict>;
221
- export type PluginBuildableEnvelopeUpdateArgs = z.infer<typeof PluginBuildableEnvelopeUpdateArgs>;
222
- /**
223
- * Result of {@linkcode PluginBuildableEnvelopeApi.update}.
224
- *
225
- * | Property | Type | Description |
226
- * |---|---|---|
227
- * | `buildableEnvelopeId` | `string` | Non-empty unique ID of the updated buildable envelope |
228
- */
229
- export declare const PluginBuildableEnvelopeUpdateResult: z.ZodObject<{
230
- buildableEnvelopeId: z.ZodString;
231
- }, z.core.$strict>;
232
- export type PluginBuildableEnvelopeUpdateResult = z.infer<typeof PluginBuildableEnvelopeUpdateResult>;
233
- //# sourceMappingURL=buildableEnvelope.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildableEnvelope.d.ts","sourceRoot":"","sources":["../../../src/api/entity/buildableEnvelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;;;;GASG;AACH,8BAAsB,0BAA0B;;IAG9C;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;aACa,MAAM,CACpB,IAAI,EAAE,iCAAiC,GACtC,eAAe,CAAC,mCAAmC,CAAC;IAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;aACa,MAAM,CACpB,IAAI,EAAE,iCAAiC,GACtC,eAAe,CAAC,mCAAmC,CAAC;CACxD;AAED;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC;;;kEAG/C,CAAA;AAEF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,oCAAoC,CAC5C,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kCAAkC;;;;;;4BAS7C,CAAA;AAEF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,kCAAkC,CAC1C,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,kCAAkC;;;;;kBAKpC,CAAA;AAEX,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,kCAAkC,CAC1C,CAAA;AA+BD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;kBAWZ,CAAA;AAElC,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,iCAAiC,CACzC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mCAAmC;;kBAErC,CAAA;AAEX,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,mCAAmC,CAC3C,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;kBAYZ,CAAA;AAElC,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,iCAAiC,CACzC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mCAAmC;;kBAErC,CAAA;AAEX,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,mCAAmC,CAC3C,CAAA"}
@@ -1,99 +0,0 @@
1
- import * as z from "zod";
2
- import { PluginApiReturn } from "../../types";
3
- /**
4
- * Department management — create and query departments.
5
- *
6
- * A **department** is a named, colored grouping applied to spaces.
7
- * Departments are used to categorize spaces by function (e.g. "FOH",
8
- * "Emergency", "Residential") and control their visual appearance.
9
- *
10
- * Accessed via `snaptrude.entity.department`.
11
- */
12
- export declare abstract class PluginDepartmentApi {
13
- constructor();
14
- /**
15
- * Create a new department.
16
- *
17
- * @param args - An object containing:
18
- * - {@linkcode PluginDepartmentCreateArgs.name args.name} — Display name
19
- * - {@linkcode PluginDepartmentCreateArgs.color args.color} — CSS hex color string (e.g. `"#b5e1dc"`)
20
- * @returns A {@linkcode PluginDepartmentCreateResult} with the `departmentId`
21
- * of the created department
22
- * @throws If department creation fails
23
- *
24
- * # Example
25
- * ```ts
26
- * const { departmentId } = await snaptrude.entity.department.create({
27
- * name: "Emergency",
28
- * color: "#f5e68b",
29
- * })
30
- * ```
31
- */
32
- abstract create(args: PluginDepartmentCreateArgs): PluginApiReturn<PluginDepartmentCreateResult>;
33
- /**
34
- * Get all departments in the current project.
35
- *
36
- * Returns every department including well-known ones (Default, Site, etc.)
37
- * and user-created departments.
38
- *
39
- * @returns A {@linkcode PluginDepartmentGetAllResult} with a `departments` array
40
- *
41
- * # Example
42
- * ```ts
43
- * const { departments } = await snaptrude.entity.department.getAll()
44
- * for (const dept of departments) {
45
- * console.log(dept.id, dept.name, dept.color)
46
- * }
47
- * ```
48
- */
49
- abstract getAll(): PluginApiReturn<PluginDepartmentGetAllResult>;
50
- }
51
- /**
52
- * Arguments for {@linkcode PluginDepartmentApi.create}.
53
- *
54
- * | Property | Type | Description |
55
- * |---|---|---|
56
- * | `name` | `string` | Display name of the department |
57
- * | `color` | `string` | CSS hex color string (e.g. `"#b5e1dc"`) |
58
- */
59
- export declare const PluginDepartmentCreateArgs: z.ZodObject<{
60
- name: z.ZodString;
61
- color: z.ZodString;
62
- }, z.core.$strip>;
63
- export type PluginDepartmentCreateArgs = z.infer<typeof PluginDepartmentCreateArgs>;
64
- /**
65
- * Result of {@linkcode PluginDepartmentApi.create}.
66
- *
67
- * | Property | Type | Description |
68
- * |---|---|---|
69
- * | `departmentId` | `string` | Unique ID of the created department |
70
- */
71
- export declare const PluginDepartmentCreateResult: z.ZodObject<{
72
- departmentId: z.ZodString;
73
- }, z.core.$strip>;
74
- export type PluginDepartmentCreateResult = z.infer<typeof PluginDepartmentCreateResult>;
75
- /**
76
- * A single department entry returned by {@linkcode PluginDepartmentApi.getAll}.
77
- */
78
- export declare const PluginDepartmentEntry: z.ZodObject<{
79
- id: z.ZodString;
80
- name: z.ZodString;
81
- color: z.ZodString;
82
- }, z.core.$strip>;
83
- export type PluginDepartmentEntry = z.infer<typeof PluginDepartmentEntry>;
84
- /**
85
- * Result of {@linkcode PluginDepartmentApi.getAll}.
86
- *
87
- * | Property | Type | Description |
88
- * |---|---|---|
89
- * | `departments` | {@linkcode PluginDepartmentEntry}`[]` | All departments in the project |
90
- */
91
- export declare const PluginDepartmentGetAllResult: z.ZodObject<{
92
- departments: z.ZodArray<z.ZodObject<{
93
- id: z.ZodString;
94
- name: z.ZodString;
95
- color: z.ZodString;
96
- }, z.core.$strip>>;
97
- }, z.core.$strip>;
98
- export type PluginDepartmentGetAllResult = z.infer<typeof PluginDepartmentGetAllResult>;
99
- //# sourceMappingURL=department.d.ts.map