@snaptrude/plugin-core 0.1.1 → 0.2.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 +7 -0
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/tools/copy.d.ts +59 -0
- package/dist/api/tools/copy.d.ts.map +1 -0
- package/dist/api/tools/index.d.ts +11 -0
- package/dist/api/tools/index.d.ts.map +1 -1
- package/dist/api/tools/offset.d.ts +43 -0
- package/dist/api/tools/offset.d.ts.map +1 -0
- package/dist/index.cjs +63 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +58 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +2 -2
- package/src/api/tools/copy.ts +55 -0
- package/src/api/tools/index.ts +15 -0
- package/src/api/tools/offset.ts +43 -0
package/dist/index.js
CHANGED
|
@@ -17,8 +17,8 @@ var PluginVec3Api = class {
|
|
|
17
17
|
* // { x: 1, y: 2, z: 3 }
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
new(x, y,
|
|
21
|
-
return { x, y, z:
|
|
20
|
+
new(x, y, z16) {
|
|
21
|
+
return { x, y, z: z16 };
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Add two vectors component-wise.
|
|
@@ -196,8 +196,8 @@ var PluginQuatApi = class {
|
|
|
196
196
|
* @param w - The W (scalar) component
|
|
197
197
|
* @returns A new {@linkcode PQuat}
|
|
198
198
|
*/
|
|
199
|
-
new(x, y,
|
|
200
|
-
return { x, y, z:
|
|
199
|
+
new(x, y, z16, w) {
|
|
200
|
+
return { x, y, z: z16, w };
|
|
201
201
|
}
|
|
202
202
|
/**
|
|
203
203
|
* Create an identity quaternion representing no rotation.
|
|
@@ -241,13 +241,13 @@ var PluginQuatApi = class {
|
|
|
241
241
|
* @param z - Rotation around Z axis in **radians**
|
|
242
242
|
* @returns A new {@linkcode PQuat}
|
|
243
243
|
*/
|
|
244
|
-
fromEuler(x, y,
|
|
244
|
+
fromEuler(x, y, z16) {
|
|
245
245
|
const cx = Math.cos(x / 2);
|
|
246
246
|
const sx = Math.sin(x / 2);
|
|
247
247
|
const cy = Math.cos(y / 2);
|
|
248
248
|
const sy = Math.sin(y / 2);
|
|
249
|
-
const cz = Math.cos(
|
|
250
|
-
const sz = Math.sin(
|
|
249
|
+
const cz = Math.cos(z16 / 2);
|
|
250
|
+
const sz = Math.sin(z16 / 2);
|
|
251
251
|
return {
|
|
252
252
|
x: sx * cy * cz + cx * sy * sz,
|
|
253
253
|
y: cx * sy * cz - sx * cy * sz,
|
|
@@ -829,29 +829,54 @@ var PluginEntityApi = class {
|
|
|
829
829
|
}
|
|
830
830
|
};
|
|
831
831
|
|
|
832
|
-
// src/api/tools/
|
|
832
|
+
// src/api/tools/copy.ts
|
|
833
833
|
import * as z11 from "zod";
|
|
834
|
+
var PluginCopyMode = z11.enum(["instance", "unique"]);
|
|
835
|
+
var PluginCopyArgs = z11.object({
|
|
836
|
+
componentIds: z11.array(z11.string()).min(1),
|
|
837
|
+
displacement: PVec3,
|
|
838
|
+
count: z11.number().int().positive().optional(),
|
|
839
|
+
copyMode: PluginCopyMode.optional()
|
|
840
|
+
});
|
|
841
|
+
var PluginCopyResult = z11.object({
|
|
842
|
+
copiedIds: z11.array(z11.string())
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
// src/api/tools/offset.ts
|
|
846
|
+
import * as z12 from "zod";
|
|
847
|
+
var PluginOffsetArgs = z12.object({
|
|
848
|
+
componentId: z12.string().min(1),
|
|
849
|
+
distance: z12.number(),
|
|
850
|
+
profilePickPoint: PVec3.optional()
|
|
851
|
+
});
|
|
852
|
+
var PluginOffsetResult = z12.object({
|
|
853
|
+
createdIds: z12.array(z12.string()),
|
|
854
|
+
deletedIds: z12.array(z12.string())
|
|
855
|
+
});
|
|
856
|
+
|
|
857
|
+
// src/api/tools/selection.ts
|
|
858
|
+
import * as z13 from "zod";
|
|
834
859
|
var PluginSelectionApi = class {
|
|
835
860
|
constructor() {
|
|
836
861
|
}
|
|
837
862
|
};
|
|
838
|
-
var PluginSelectionGetResult =
|
|
839
|
-
selected:
|
|
863
|
+
var PluginSelectionGetResult = z13.object({
|
|
864
|
+
selected: z13.array(z13.string())
|
|
840
865
|
});
|
|
841
866
|
|
|
842
867
|
// src/api/tools/transform.ts
|
|
843
|
-
import * as
|
|
868
|
+
import * as z14 from "zod";
|
|
844
869
|
var PluginTransformApi = class {
|
|
845
870
|
constructor() {
|
|
846
871
|
}
|
|
847
872
|
};
|
|
848
|
-
var PluginMoveArgs =
|
|
849
|
-
componentIds:
|
|
873
|
+
var PluginMoveArgs = z14.object({
|
|
874
|
+
componentIds: z14.array(z14.string()),
|
|
850
875
|
displacement: PVec3
|
|
851
876
|
});
|
|
852
|
-
var PluginRotateArgs =
|
|
853
|
-
componentIds:
|
|
854
|
-
angle:
|
|
877
|
+
var PluginRotateArgs = z14.object({
|
|
878
|
+
componentIds: z14.array(z14.string()),
|
|
879
|
+
angle: z14.number(),
|
|
855
880
|
axis: PVec3,
|
|
856
881
|
pivot: PVec3
|
|
857
882
|
});
|
|
@@ -863,12 +888,12 @@ var PluginToolsApi = class {
|
|
|
863
888
|
};
|
|
864
889
|
|
|
865
890
|
// src/api/units/index.ts
|
|
866
|
-
import * as
|
|
891
|
+
import * as z15 from "zod";
|
|
867
892
|
var PluginUnitsApi = class {
|
|
868
893
|
constructor() {
|
|
869
894
|
}
|
|
870
895
|
};
|
|
871
|
-
var PUnitType =
|
|
896
|
+
var PUnitType = z15.enum([
|
|
872
897
|
"meters",
|
|
873
898
|
"feet-inches",
|
|
874
899
|
"inches",
|
|
@@ -877,21 +902,21 @@ var PUnitType = z13.enum([
|
|
|
877
902
|
"kilometers",
|
|
878
903
|
"miles"
|
|
879
904
|
]);
|
|
880
|
-
var PluginUnitsConvertFromArgs =
|
|
905
|
+
var PluginUnitsConvertFromArgs = z15.object({
|
|
881
906
|
unit: PUnitType,
|
|
882
|
-
value:
|
|
883
|
-
degree:
|
|
907
|
+
value: z15.number(),
|
|
908
|
+
degree: z15.number().int().min(1).max(3).optional()
|
|
884
909
|
});
|
|
885
|
-
var PluginUnitsConvertFromResult =
|
|
886
|
-
value:
|
|
910
|
+
var PluginUnitsConvertFromResult = z15.object({
|
|
911
|
+
value: z15.number()
|
|
887
912
|
});
|
|
888
|
-
var PluginUnitsConvertToArgs =
|
|
913
|
+
var PluginUnitsConvertToArgs = z15.object({
|
|
889
914
|
unit: PUnitType,
|
|
890
|
-
value:
|
|
891
|
-
degree:
|
|
915
|
+
value: z15.number(),
|
|
916
|
+
degree: z15.number().int().min(1).max(3).optional()
|
|
892
917
|
});
|
|
893
|
-
var PluginUnitsConvertToResult =
|
|
894
|
-
value:
|
|
918
|
+
var PluginUnitsConvertToResult = z15.object({
|
|
919
|
+
value: z15.number()
|
|
895
920
|
});
|
|
896
921
|
|
|
897
922
|
// src/api/index.ts
|
|
@@ -909,6 +934,9 @@ export {
|
|
|
909
934
|
PVec3,
|
|
910
935
|
PluginApi,
|
|
911
936
|
PluginArcApi,
|
|
937
|
+
PluginCopyArgs,
|
|
938
|
+
PluginCopyMode,
|
|
939
|
+
PluginCopyResult,
|
|
912
940
|
PluginCoreApi,
|
|
913
941
|
PluginCurveApi,
|
|
914
942
|
PluginDepartmentApi,
|
|
@@ -923,6 +951,8 @@ export {
|
|
|
923
951
|
PluginMassType,
|
|
924
952
|
PluginMathApi,
|
|
925
953
|
PluginMoveArgs,
|
|
954
|
+
PluginOffsetArgs,
|
|
955
|
+
PluginOffsetResult,
|
|
926
956
|
PluginProfileApi,
|
|
927
957
|
PluginProfileFromLinePointsArgs,
|
|
928
958
|
PluginQuatApi,
|