@buerli.io/react-cad 0.0.22-beta.1 → 0.0.23-beta.2

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 (33) hide show
  1. package/build/components/UI/CAD/Drawing.d.ts +3 -2
  2. package/build/components/UI/CAD/Messages/Message.d.ts +5 -0
  3. package/build/components/UI/CAD/Messages/Messages.d.ts +9 -0
  4. package/build/components/UI/CAD/Messages/index.d.ts +1 -0
  5. package/build/components/UI/CAD/Messages/msgStore.d.ts +17 -0
  6. package/build/components/UI/CAD/SideBar/FeatureList/Feature.d.ts +1 -1
  7. package/build/components/UI/CAD/SideBar/FeatureList/utils.d.ts +1 -0
  8. package/build/components/UI/CAD/common/BlankDiv.d.ts +4 -0
  9. package/build/components/UI/CAD/common/primitives.d.ts +4 -1
  10. package/build/components/UI/CAD/store/CADActions.d.ts +4 -0
  11. package/build/components/UI/CAD/store/CADStore.d.ts +4 -0
  12. package/build/index.cjs.js +4302 -3422
  13. package/build/index.js +4302 -3422
  14. package/build/plugins/Sketch/Root/Details.d.ts +2 -0
  15. package/build/plugins/Sketch/Root/useMenuItems.d.ts +5 -0
  16. package/build/plugins/Sketch/View/graphics/Merged/Arc.d.ts +9 -0
  17. package/build/plugins/Sketch/View/graphics/Merged/Line.d.ts +10 -0
  18. package/build/plugins/Sketch/View/graphics/Merged/MergedWrapper.d.ts +14 -0
  19. package/build/plugins/Sketch/View/graphics/Merged/Point.d.ts +8 -0
  20. package/build/plugins/Sketch/View/graphics/graphics.d.ts +1 -2
  21. package/build/plugins/Sketch/View/graphics/hooks.d.ts +3 -1
  22. package/build/plugins/Sketch/View/graphics/primitives.d.ts +3 -3
  23. package/build/plugins/Sketch/View/graphics/scale.d.ts +4 -0
  24. package/build/plugins/Sketch/View/handlers/Drag.d.ts +1 -1
  25. package/build/plugins/Sketch/View/handlers/Fillet.d.ts +1 -1
  26. package/build/plugins/Sketch/View/handlers/Handlers.d.ts +2 -0
  27. package/build/plugins/Sketch/View/handlers/UseRef.d.ts +3 -0
  28. package/build/plugins/Sketch/types.d.ts +1 -0
  29. package/build/plugins/Sketch/utils/Interaction.d.ts +4 -0
  30. package/build/utils/FileUtils.d.ts +1 -1
  31. package/build/utils/helpers.d.ts +2 -0
  32. package/package.json +10 -9
  33. package/build/plugins/Sketch/Root/UseRef.d.ts +0 -2
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Details: React.FC;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import 'antd/dist/antd.css';
3
+ import { DrawingID, ObjectID, PluginID } from '@buerli.io/core';
4
+ import { MenuItems } from '../../../components/UI/CAD/common/Menu';
5
+ export declare function useMenuItems(drawingId: DrawingID, pluginId: PluginID, objectId: ObjectID, setRename: React.Dispatch<React.SetStateAction<boolean>>): MenuItems;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import * as THREE from 'three';
3
+ import { commonProps } from '../primitives';
4
+ export declare const Arc: React.FC<{
5
+ start: THREE.Vector3;
6
+ end: THREE.Vector3;
7
+ center: THREE.Vector3;
8
+ clockwise: boolean;
9
+ } & commonProps>;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import * as THREE from 'three';
3
+ import { commonProps } from '../primitives';
4
+ export declare const Line: React.FC<{
5
+ start: THREE.Vector3;
6
+ end: THREE.Vector3;
7
+ width?: number;
8
+ notInteractive?: boolean;
9
+ scalePlus?: boolean;
10
+ } & commonProps>;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import * as THREE from 'three';
3
+ export declare const getCylBB: () => THREE.Box3;
4
+ export declare const getSphereBB: () => THREE.Box3;
5
+ export declare const MeshContext: React.Context<{
6
+ Cylinder: any;
7
+ Sphere: any;
8
+ }>;
9
+ /**
10
+ * Component which implements InstancedMesh from three.js.
11
+ * Merged component from drei takes globaly created meshes and then passes corresponding "mocked" components via function props (Box and Sphere) to children.
12
+ * "mocked" components are used for saying drei where to draw instances.
13
+ */
14
+ export declare const MergedWrapper: React.FC;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import * as THREE from 'three';
3
+ import { commonProps } from '../primitives';
4
+ export declare const Point: React.FC<{
5
+ position: THREE.Vector3;
6
+ size?: number;
7
+ scalePlus?: boolean;
8
+ } & commonProps>;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { ObjectID } from '@buerli.io/core';
3
- declare const Sketch: React.FC<{
3
+ export declare const Sketch: React.FC<{
4
4
  objId: ObjectID;
5
5
  }>;
6
- export { Sketch };
@@ -2,6 +2,8 @@ import { IStructureObject, DrawingID, ObjectID } from '@buerli.io/core';
2
2
  export declare const useGeomParams: (objId: ObjectID) => {
3
3
  renderOrder: number;
4
4
  polygonOffsetUnits: number;
5
+ isHovered: boolean;
6
+ isSelected: boolean;
5
7
  };
6
8
  declare type ObjState = {
7
9
  isSketchActive: boolean;
@@ -22,7 +24,7 @@ export declare const useUserData: (objId: ObjectID) => {
22
24
  export declare const useHandlersAndColor: (drawingId: DrawingID, objId: ObjectID) => {
23
25
  handlers: {
24
26
  [key: string]: (e: PointerEvent & import("@react-three/fiber/dist/declarations/src/core/events").IntesectionEvent<PointerEvent> & import("../../types").PointerEventsT) => void;
25
- } | undefined;
27
+ };
26
28
  color: number;
27
29
  };
28
30
  export {};
@@ -5,8 +5,7 @@ export declare const pointSize = 0.5;
5
5
  export declare const arcWidth = 0.2;
6
6
  export declare const radSegments = 32;
7
7
  export declare const tubeSegments = 6;
8
- declare type commonProps = {
9
- scale?: number;
8
+ export declare type commonProps = {
10
9
  materialProps?: JSX.IntrinsicElements['meshBasicMaterial'];
11
10
  meshProps?: JSX.IntrinsicElements['mesh'];
12
11
  };
@@ -39,10 +38,11 @@ export declare const Arc: React.FC<{
39
38
  center: THREE.Vector3;
40
39
  clockwise: boolean;
41
40
  width?: number;
41
+ scale?: number;
42
42
  } & commonProps>;
43
43
  export declare const Circle: React.FC<{
44
44
  center: THREE.Vector3;
45
45
  radius: number;
46
46
  width?: number;
47
+ scale?: number;
47
48
  } & commonProps>;
48
- export {};
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare function setScale(newScale: number): void;
3
+ export declare function getScale(): number;
4
+ export declare function useScale(getVector?: (sf: number) => [number, number, number]): React.MutableRefObject<import("three").Object3D | undefined>;
@@ -1,3 +1,3 @@
1
1
  import { DrawingID, PluginID } from '@buerli.io/core';
2
2
  import { Handler } from '../../types';
3
- export declare function Drag(drawingId: DrawingID, pluginId: PluginID): Handler;
3
+ export declare function Drag(drawingId: DrawingID, pluginId: PluginID, camControls: any): Handler;
@@ -1,3 +1,3 @@
1
1
  import { DrawingID, PluginID } from '@buerli.io/core';
2
2
  import { Handler } from '../../types';
3
- export declare function Fillet(drawingId: DrawingID, pluginId: PluginID): Handler;
3
+ export declare function Fillet(drawingId: DrawingID, pluginId: PluginID, camControls: any): Handler;
@@ -8,6 +8,7 @@ import { DrawRectangle } from './DrawRectangle';
8
8
  import { DrawCircle } from './DrawCircle';
9
9
  import { Fillet } from './Fillet';
10
10
  import { Trim } from './Trim';
11
+ import { UseRef } from './UseRef';
11
12
  export declare const Handlers: {
12
13
  createAngle: typeof CreateAngle;
13
14
  drag: typeof Drag;
@@ -17,6 +18,7 @@ export declare const Handlers: {
17
18
  drawRectangle: typeof DrawRectangle;
18
19
  fillet: typeof Fillet;
19
20
  trim: typeof Trim;
21
+ useReference: typeof UseRef;
20
22
  drawArcCenter: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
21
23
  drawArcMidlde: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
22
24
  drawArcTangent: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
@@ -0,0 +1,3 @@
1
+ import { DrawingID, PluginID } from '@buerli.io/core';
2
+ import { Handler } from '../../types';
3
+ export declare function UseRef(drawingId: DrawingID, pluginId: PluginID): Handler;
@@ -49,6 +49,7 @@ export declare enum HandlersList {
49
49
  FILLET = "fillet",
50
50
  HOVER = "hover",
51
51
  TRIM = "trim",
52
+ USEREF = "useReference",
52
53
  GSELECTION = "globalSelection"
53
54
  }
54
55
  export declare type PointerEventsT = {
@@ -0,0 +1,4 @@
1
+ import { DrawingID, PluginID, ObjectID } from '@buerli.io/core';
2
+ export declare const hover: (drawingId: DrawingID, pluginId: PluginID, hoveredId: ObjectID) => void;
3
+ export declare const unhover: (drawingId: DrawingID, pluginId: PluginID, hoveredId: ObjectID) => void;
4
+ export declare const select: (drawingId: DrawingID, pluginId: PluginID, selectedId: ObjectID) => void;
@@ -13,6 +13,6 @@ export declare const FileUtils: {
13
13
  loadFile: (onLoad: (files: {
14
14
  file: File;
15
15
  content: any;
16
- }[]) => void, type?: "DataURL" | "ArrayBuffer" | "BinaryString" | "Text" | undefined, multiple?: boolean | undefined) => void;
16
+ }[]) => void, type?: "Text" | "DataURL" | "ArrayBuffer" | "BinaryString" | undefined, multiple?: boolean | undefined) => void;
17
17
  exportNode: (drawingId: DrawingID, objectId: ObjectID, type?: 'of1' | 'stp' | 'stl') => Promise<void>;
18
18
  };
@@ -18,6 +18,7 @@ export declare const angleVecVec: (a: THREE.Vector3, b: THREE.Vector3) => number
18
18
  export declare const calculateTangent: (tree: IStructureTree, object: IStructureObject & WithMembers & WithChildren, point: THREE.Vector3) => THREE.Vector3 | undefined;
19
19
  export declare function getDescendants(tree: IStructureTree, objectId: ObjectID): number[];
20
20
  export declare function getAncestorIdByClass(drawingId: DrawingID, objectId: ObjectID, parentClass: CCClasses): number | null;
21
+ export declare const isSketchGeometry: (arg: IStructureObject | CCClasses) => boolean;
21
22
  export declare const is2DConstraint: (arg: IStructureObject | CCClasses) => boolean;
22
23
  export declare const degreesToRadians: (degrees: number) => number;
23
24
  export declare const radiansToDegrees: (radians: number) => number;
@@ -32,3 +33,4 @@ export declare function rgbToHex(color: {
32
33
  b: number;
33
34
  }): string;
34
35
  export declare function fmod(num: number, denom: number): number;
36
+ export declare function numberToHexColor(color: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/react-cad",
3
- "version": "0.0.22-beta.1",
3
+ "version": "0.0.23-beta.2",
4
4
  "description": "buerli CAD components",
5
5
  "author": "AWV Informatik AG <info@awv-informatik.ch>",
6
6
  "repository": {},
@@ -14,7 +14,8 @@
14
14
  "scripts": {
15
15
  "build": "rimraf ./build && rollup -c",
16
16
  "postbuild": "tsc --emitDeclarationOnly",
17
- "test": "jest",
17
+ "test": "jest --silent",
18
+ "testVerbose": "jest",
18
19
  "lint": "eslint \"./src/**/*.ts?(x)\"",
19
20
  "prettier": "prettier --write \"./{src,tests}/**/*.{js,jsx,ts,tsx,json}\""
20
21
  },
@@ -46,6 +47,8 @@
46
47
  "@babel/preset-react": "^7.14.5",
47
48
  "@babel/preset-typescript": "^7.10.4",
48
49
  "@buerli.io/icons": "^1.0.9",
50
+ "@react-three/drei": "^7.26.1",
51
+ "@react-three/fiber": "^7.0.19",
49
52
  "@rollup/plugin-babel": "^5.3.0",
50
53
  "@rollup/plugin-image": "^2.1.0",
51
54
  "@rollup/plugin-node-resolve": "^13.0.4",
@@ -82,18 +85,18 @@
82
85
  "rollup-plugin-postcss": "^4.0.1",
83
86
  "rollup-plugin-size-snapshot": "^0.12.0",
84
87
  "rollup-plugin-terser": "^7.0.2",
88
+ "three": "^0.131.3",
85
89
  "typescript": "4.1.2"
86
90
  },
87
91
  "peerDependencies": {
88
- "@react-three/fiber": ">= 7.0.0",
92
+ "@react-three/drei": ">= 7.26.1",
93
+ "@react-three/fiber": ">= 7.0.17",
89
94
  "three": ">=0.129"
90
95
  },
91
96
  "dependencies": {
92
97
  "@ant-design/compatible": "^1.0.8",
93
- "@buerli.io/classcad": "0.0.34-beta.1",
94
- "@buerli.io/react": "0.0.34-beta.1",
95
- "@react-three/drei": "^7.2.1",
96
- "@react-three/fiber": "^7.0.6",
98
+ "@buerli.io/classcad": "0.0.35-beta.2",
99
+ "@buerli.io/react": "0.0.35-beta.2",
97
100
  "antd": "4.11.2",
98
101
  "react": "^17.0.2",
99
102
  "react-colorful": "^5.3.0",
@@ -101,9 +104,7 @@
101
104
  "react-sortable-hoc": "^2.0.0",
102
105
  "react-uid": "^2.3.1",
103
106
  "styled-components": "^4.3.2",
104
- "three": "^0.131.3",
105
107
  "three-rounded-box": "^0.1.1",
106
- "three-stdlib": "^2.4.0",
107
108
  "uuid": "^3.3.2",
108
109
  "zustand": "^3.5.7"
109
110
  }
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const UseRef: React.FC;