@snaptrude/plugin-core 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/api/entity/space.d.ts +153 -1
- package/dist/api/entity/space.d.ts.map +1 -1
- 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 -4
- 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 +79 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +72 -53
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/entity/space.ts +95 -1
- package/src/api/index.ts +2 -2
- package/src/api/tools/copy.ts +55 -0
- package/src/api/tools/index.ts +15 -4
- package/src/api/tools/offset.ts +43 -0
- package/dist/api/tools/material.d.ts +0 -51
- package/dist/api/tools/material.d.ts.map +0 -1
- package/src/api/tools/material.ts +0 -49
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,
|
|
@@ -654,6 +654,14 @@ var PluginSpaceCreateFromProfileArgs = z9.object({
|
|
|
654
654
|
var PluginSpaceCreateFromProfileResult = z9.object({
|
|
655
655
|
spaceId: z9.string()
|
|
656
656
|
});
|
|
657
|
+
var PluginSpaceUpdateGeometryFromProfileArgs = z9.object({
|
|
658
|
+
spaceId: z9.string(),
|
|
659
|
+
profile: PProfile,
|
|
660
|
+
extrudeHeight: z9.number()
|
|
661
|
+
});
|
|
662
|
+
var PluginSpaceUpdateGeometryFromProfileResult = z9.object({
|
|
663
|
+
spaceId: z9.string()
|
|
664
|
+
});
|
|
657
665
|
var PluginSpaceGetProperty = z9.enum([
|
|
658
666
|
// Basic
|
|
659
667
|
"id",
|
|
@@ -677,7 +685,8 @@ var PluginSpaceGetProperty = z9.enum([
|
|
|
677
685
|
"rotation",
|
|
678
686
|
"rotationQuaternion",
|
|
679
687
|
// Derived from brep
|
|
680
|
-
"planPoints"
|
|
688
|
+
"planPoints",
|
|
689
|
+
"profile"
|
|
681
690
|
]);
|
|
682
691
|
var PluginSpaceGetArgs = z9.object({
|
|
683
692
|
spaceId: z9.string(),
|
|
@@ -718,7 +727,8 @@ var PluginSpaceGetResult = z9.object({
|
|
|
718
727
|
rotation: PVec3,
|
|
719
728
|
rotationQuaternion: PQuat.nullable(),
|
|
720
729
|
// Derived from brep
|
|
721
|
-
planPoints: z9.array(PVec3)
|
|
730
|
+
planPoints: z9.array(PVec3),
|
|
731
|
+
profile: PProfile
|
|
722
732
|
}).partial();
|
|
723
733
|
var PluginSpaceGetAllResult = z9.object({
|
|
724
734
|
spacesIds: z9.array(z9.string())
|
|
@@ -829,54 +839,58 @@ var PluginEntityApi = class {
|
|
|
829
839
|
}
|
|
830
840
|
};
|
|
831
841
|
|
|
832
|
-
// src/api/tools/
|
|
842
|
+
// src/api/tools/copy.ts
|
|
833
843
|
import * as z11 from "zod";
|
|
844
|
+
var PluginCopyMode = z11.enum(["instance", "unique"]);
|
|
845
|
+
var PluginCopyArgs = z11.object({
|
|
846
|
+
componentIds: z11.array(z11.string()).min(1),
|
|
847
|
+
displacement: PVec3,
|
|
848
|
+
count: z11.number().int().positive().optional(),
|
|
849
|
+
copyMode: PluginCopyMode.optional()
|
|
850
|
+
});
|
|
851
|
+
var PluginCopyResult = z11.object({
|
|
852
|
+
copiedIds: z11.array(z11.string())
|
|
853
|
+
});
|
|
854
|
+
|
|
855
|
+
// src/api/tools/offset.ts
|
|
856
|
+
import * as z12 from "zod";
|
|
857
|
+
var PluginOffsetArgs = z12.object({
|
|
858
|
+
componentId: z12.string().min(1),
|
|
859
|
+
distance: z12.number(),
|
|
860
|
+
profilePickPoint: PVec3.optional()
|
|
861
|
+
});
|
|
862
|
+
var PluginOffsetResult = z12.object({
|
|
863
|
+
createdIds: z12.array(z12.string()),
|
|
864
|
+
deletedIds: z12.array(z12.string())
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
// src/api/tools/selection.ts
|
|
868
|
+
import * as z13 from "zod";
|
|
834
869
|
var PluginSelectionApi = class {
|
|
835
870
|
constructor() {
|
|
836
871
|
}
|
|
837
872
|
};
|
|
838
|
-
var PluginSelectionGetResult =
|
|
839
|
-
selected:
|
|
873
|
+
var PluginSelectionGetResult = z13.object({
|
|
874
|
+
selected: z13.array(z13.string())
|
|
840
875
|
});
|
|
841
876
|
|
|
842
877
|
// src/api/tools/transform.ts
|
|
843
|
-
import * as
|
|
878
|
+
import * as z14 from "zod";
|
|
844
879
|
var PluginTransformApi = class {
|
|
845
880
|
constructor() {
|
|
846
881
|
}
|
|
847
882
|
};
|
|
848
|
-
var PluginMoveArgs =
|
|
849
|
-
componentIds:
|
|
883
|
+
var PluginMoveArgs = z14.object({
|
|
884
|
+
componentIds: z14.array(z14.string()),
|
|
850
885
|
displacement: PVec3
|
|
851
886
|
});
|
|
852
|
-
var PluginRotateArgs =
|
|
853
|
-
componentIds:
|
|
854
|
-
angle:
|
|
887
|
+
var PluginRotateArgs = z14.object({
|
|
888
|
+
componentIds: z14.array(z14.string()),
|
|
889
|
+
angle: z14.number(),
|
|
855
890
|
axis: PVec3,
|
|
856
891
|
pivot: PVec3
|
|
857
892
|
});
|
|
858
893
|
|
|
859
|
-
// src/api/tools/material.ts
|
|
860
|
-
import * as z13 from "zod";
|
|
861
|
-
var PluginMaterialApi = class {
|
|
862
|
-
constructor() {
|
|
863
|
-
}
|
|
864
|
-
};
|
|
865
|
-
var DEFAULT_MATERIALS = /* @__PURE__ */ ((DEFAULT_MATERIALS2) => {
|
|
866
|
-
DEFAULT_MATERIALS2["GLASS"] = "glass";
|
|
867
|
-
DEFAULT_MATERIALS2["WOOD"] = "wood";
|
|
868
|
-
DEFAULT_MATERIALS2["METAL"] = "metal";
|
|
869
|
-
DEFAULT_MATERIALS2["STONE"] = "stone";
|
|
870
|
-
DEFAULT_MATERIALS2["TILES"] = "tiles";
|
|
871
|
-
DEFAULT_MATERIALS2["CONCRETE"] = "concrete";
|
|
872
|
-
DEFAULT_MATERIALS2["BRICK"] = "brick";
|
|
873
|
-
return DEFAULT_MATERIALS2;
|
|
874
|
-
})(DEFAULT_MATERIALS || {});
|
|
875
|
-
var PluginMaterialArgs = z13.object({
|
|
876
|
-
materialName: z13.enum(Object.values(DEFAULT_MATERIALS)),
|
|
877
|
-
componentIds: z13.array(z13.string())
|
|
878
|
-
});
|
|
879
|
-
|
|
880
894
|
// src/api/tools/index.ts
|
|
881
895
|
var PluginToolsApi = class {
|
|
882
896
|
constructor() {
|
|
@@ -884,12 +898,12 @@ var PluginToolsApi = class {
|
|
|
884
898
|
};
|
|
885
899
|
|
|
886
900
|
// src/api/units/index.ts
|
|
887
|
-
import * as
|
|
901
|
+
import * as z15 from "zod";
|
|
888
902
|
var PluginUnitsApi = class {
|
|
889
903
|
constructor() {
|
|
890
904
|
}
|
|
891
905
|
};
|
|
892
|
-
var PUnitType =
|
|
906
|
+
var PUnitType = z15.enum([
|
|
893
907
|
"meters",
|
|
894
908
|
"feet-inches",
|
|
895
909
|
"inches",
|
|
@@ -898,21 +912,21 @@ var PUnitType = z14.enum([
|
|
|
898
912
|
"kilometers",
|
|
899
913
|
"miles"
|
|
900
914
|
]);
|
|
901
|
-
var PluginUnitsConvertFromArgs =
|
|
915
|
+
var PluginUnitsConvertFromArgs = z15.object({
|
|
902
916
|
unit: PUnitType,
|
|
903
|
-
value:
|
|
904
|
-
degree:
|
|
917
|
+
value: z15.number(),
|
|
918
|
+
degree: z15.number().int().min(1).max(3).optional()
|
|
905
919
|
});
|
|
906
|
-
var PluginUnitsConvertFromResult =
|
|
907
|
-
value:
|
|
920
|
+
var PluginUnitsConvertFromResult = z15.object({
|
|
921
|
+
value: z15.number()
|
|
908
922
|
});
|
|
909
|
-
var PluginUnitsConvertToArgs =
|
|
923
|
+
var PluginUnitsConvertToArgs = z15.object({
|
|
910
924
|
unit: PUnitType,
|
|
911
|
-
value:
|
|
912
|
-
degree:
|
|
925
|
+
value: z15.number(),
|
|
926
|
+
degree: z15.number().int().min(1).max(3).optional()
|
|
913
927
|
});
|
|
914
|
-
var PluginUnitsConvertToResult =
|
|
915
|
-
value:
|
|
928
|
+
var PluginUnitsConvertToResult = z15.object({
|
|
929
|
+
value: z15.number()
|
|
916
930
|
});
|
|
917
931
|
|
|
918
932
|
// src/api/index.ts
|
|
@@ -930,6 +944,9 @@ export {
|
|
|
930
944
|
PVec3,
|
|
931
945
|
PluginApi,
|
|
932
946
|
PluginArcApi,
|
|
947
|
+
PluginCopyArgs,
|
|
948
|
+
PluginCopyMode,
|
|
949
|
+
PluginCopyResult,
|
|
933
950
|
PluginCoreApi,
|
|
934
951
|
PluginCurveApi,
|
|
935
952
|
PluginDepartmentApi,
|
|
@@ -942,10 +959,10 @@ export {
|
|
|
942
959
|
PluginGeomApi,
|
|
943
960
|
PluginLineApi,
|
|
944
961
|
PluginMassType,
|
|
945
|
-
PluginMaterialApi,
|
|
946
|
-
PluginMaterialArgs,
|
|
947
962
|
PluginMathApi,
|
|
948
963
|
PluginMoveArgs,
|
|
964
|
+
PluginOffsetArgs,
|
|
965
|
+
PluginOffsetResult,
|
|
949
966
|
PluginProfileApi,
|
|
950
967
|
PluginProfileFromLinePointsArgs,
|
|
951
968
|
PluginQuatApi,
|
|
@@ -972,6 +989,8 @@ export {
|
|
|
972
989
|
PluginSpaceGetResult,
|
|
973
990
|
PluginSpaceType,
|
|
974
991
|
PluginSpaceUpdateArgs,
|
|
992
|
+
PluginSpaceUpdateGeometryFromProfileArgs,
|
|
993
|
+
PluginSpaceUpdateGeometryFromProfileResult,
|
|
975
994
|
PluginSpaceUpdateResult,
|
|
976
995
|
PluginStoryApi,
|
|
977
996
|
PluginStoryCreateArgs,
|