@buerli.io/react-cad 0.9.0-beta.1 → 0.10.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.
Files changed (29) hide show
  1. package/build/components/UI/CAD/ModelTree/FeatureList/utils.d.ts +4 -0
  2. package/build/components/UI/CAD/ModelTree/useContextMenuItems.d.ts +5 -0
  3. package/build/components/UI/CAD/Solids/useContextMenuItems.d.ts +5 -0
  4. package/build/components/UI/CAD/common/ContextMenu.d.ts +31 -0
  5. package/build/components/UI/CAD/common/Icon.d.ts +5 -0
  6. package/build/components/UI/CAD/hooks/index.d.ts +2 -1
  7. package/build/components/UI/CAD/hooks/useContextMenuInteraction.d.ts +7 -0
  8. package/build/components/UI/CAD/hooks/useContextMenuItems.d.ts +5 -0
  9. package/build/components/UI/CAD/index.d.ts +3 -0
  10. package/build/components/UI/CAD/plugins/ProductManagement/useContextMenuItems.d.ts +5 -0
  11. package/build/index.cjs.js +2380 -1045
  12. package/build/index.js +2388 -1055
  13. package/build/plugins/Dimensions/index.d.ts +1 -4
  14. package/build/plugins/Sketch/Root/useContextMenuItems.d.ts +5 -0
  15. package/build/plugins/Sketch/View/graphics/hooks.d.ts +2 -2
  16. package/build/plugins/Sketch/View/handlers/DrawRectangle.d.ts +2 -2
  17. package/build/plugins/Sketch/View/handlers/HandlersConstructors.d.ts +4 -2
  18. package/build/plugins/Sketch/View/handlers/Split.d.ts +3 -0
  19. package/build/plugins/Sketch/View/handlers/splitHelpers.d.ts +34 -0
  20. package/build/plugins/Sketch/types.d.ts +6 -4
  21. package/build/plugins/Sketch/utils/Interaction.d.ts +1 -1
  22. package/build/plugins/Sketch/utils/getGeometryPriority.d.ts +1 -1
  23. package/build/utils/helpers.d.ts +1 -0
  24. package/package.json +11 -11
  25. package/build/components/UI/CAD/ModelTree/useMenuItems.d.ts +0 -5
  26. package/build/components/UI/CAD/Solids/useMenuItems.d.ts +0 -5
  27. package/build/components/UI/CAD/hooks/useMenuItems.d.ts +0 -5
  28. package/build/components/UI/CAD/plugins/ProductManagement/useMenuItems.d.ts +0 -5
  29. package/build/plugins/Sketch/Root/useMenuItems.d.ts +0 -5
@@ -1,7 +1,4 @@
1
- import { ObjectID, Plugin as PluginT } from '@buerli.io/core';
1
+ import { Plugin as PluginT } from '@buerli.io/core';
2
2
  export { useDimensionSetId } from './utils';
3
- export declare type DimensionsPState = {
4
- selected: ObjectID[];
5
- };
6
3
  declare const Plugin: PluginT;
7
4
  export { Plugin };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import 'antd/dist/antd.css';
3
+ import { DrawingID, PluginID } from '@buerli.io/core';
4
+ import { MenuElement } from '../../../components/UI/CAD/common/ContextMenu';
5
+ export declare function useContextMenuItems(drawingId: DrawingID, pluginId: PluginID, setRename: React.Dispatch<React.SetStateAction<boolean>>): MenuElement[];
@@ -9,8 +9,8 @@ export declare const useGeomParams: (objId: ObjectID) => {
9
9
  declare type ObjState = {
10
10
  isSketchActive: boolean;
11
11
  isHighlighted: boolean;
12
- isHovered: boolean;
13
12
  isGHovered: boolean;
13
+ isSHovered: boolean;
14
14
  isSelected: boolean;
15
15
  lgsState: number;
16
16
  };
@@ -21,7 +21,7 @@ export declare const getColor: (object: IStructureObject, objState: ObjState) =>
21
21
  * @returns
22
22
  */
23
23
  export declare const useSketchHandlers: (objId: ObjectID) => Record<string, (e: import("@react-three/fiber/dist/declarations/src/core/events").IntersectionEvent<PointerEvent> & import("@react-three/fiber").Properties<PointerEvent> & import("../../types").PointerEventsT) => void> | undefined;
24
- export declare const useColor: (objId: ObjectID, gHovered: boolean) => number;
24
+ export declare const useColor: (objId: ObjectID) => number;
25
25
  export declare const useUserData: (objId: ObjectID) => {
26
26
  objId: number;
27
27
  onHUD: true;
@@ -1,3 +1,3 @@
1
1
  import { DrawingID, PluginID } from '@buerli.io/core';
2
- import { Handler } from '../../types';
3
- export declare function DrawRectangle(drawingId: DrawingID, pluginId: PluginID): Handler;
2
+ import { Handler, HandlersList } from '../../types';
3
+ export declare function DrawRectangle(drawingId: DrawingID, pluginId: PluginID, rectType: HandlersList.DRAWRECT2POINTS | HandlersList.DRAWRECTCENTER): Handler;
@@ -3,10 +3,10 @@ import { CreateAngle } from './CreateAngle';
3
3
  import { Drag } from './Drag';
4
4
  import { DrawPoint } from './DrawPoint';
5
5
  import { DrawLine } from './DrawLine';
6
- import { DrawRectangle } from './DrawRectangle';
7
6
  import { DrawCircle } from './DrawCircle';
8
7
  import { Fillet } from './Fillet';
9
8
  import { Trim } from './Trim';
9
+ import { Split } from './Split';
10
10
  import { UseRef } from './UseRef';
11
11
  export declare const HandlersConstructors: {
12
12
  createAngle: typeof CreateAngle;
@@ -14,10 +14,12 @@ export declare const HandlersConstructors: {
14
14
  drawPoint: typeof DrawPoint;
15
15
  drawLine: typeof DrawLine;
16
16
  drawCircle: typeof DrawCircle;
17
- drawRectangle: typeof DrawRectangle;
18
17
  fillet: typeof Fillet;
19
18
  trim: typeof Trim;
19
+ split: typeof Split;
20
20
  useReference: typeof UseRef;
21
+ drawRect2Points: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
22
+ drawRectCenter: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
21
23
  drawArcCenter: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
22
24
  drawArcMidlde: (drawingId: DrawingID, pluginId: PluginID) => import("../../types").Handler;
23
25
  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 Split(drawingId: DrawingID, pluginId: PluginID): Handler;
@@ -0,0 +1,34 @@
1
+ import * as THREE from 'three';
2
+ import { DrawingID, ObjectID } from "@buerli.io/core";
3
+ import { CCClasses } from "@buerli.io/classcad";
4
+ declare type CommonInfo = {
5
+ class: CCClasses.CCLine | CCClasses.CCArc | CCClasses.CCCircle;
6
+ bb: THREE.Box2;
7
+ };
8
+ declare type LineInfo = CommonInfo & {
9
+ start: THREE.Vector3;
10
+ end: THREE.Vector3;
11
+ dir: THREE.Vector3;
12
+ };
13
+ declare type ArcInfo = CommonInfo & {
14
+ start: THREE.Vector3;
15
+ end: THREE.Vector3;
16
+ center: THREE.Vector3;
17
+ radius: number;
18
+ clockwise: boolean;
19
+ startAngle: number;
20
+ endAngle: number;
21
+ angularlength: number;
22
+ };
23
+ declare type CircleInfo = CommonInfo & {
24
+ center: THREE.Vector3;
25
+ radius: number;
26
+ };
27
+ export declare type ObjInfo = LineInfo | ArcInfo | CircleInfo;
28
+ export declare function getSketchObjInfo(drawingId: DrawingID, objId: ObjectID): LineInfo | CircleInfo | undefined;
29
+ export declare function getNormalizedPosition(point: THREE.Vector3, sketchObject: ObjInfo): number;
30
+ export declare function getParameterizedPosition(t: number, sketchObject: ObjInfo): THREE.Vector3;
31
+ export declare function calculateIntersections(object: ObjInfo, sketchObjects: ObjInfo[]): number[];
32
+ export declare function calculateClosestIntersection(point: THREE.Vector3, object1: ObjInfo, object2: ObjInfo): number[][];
33
+ export declare function getClosestPoint(point: THREE.Vector3, sketchObject: ObjInfo): THREE.Vector3;
34
+ export {};
@@ -20,8 +20,6 @@ export declare type SketchPState = {
20
20
  tmpObjects: {
21
21
  [key: string]: TmpObject;
22
22
  };
23
- selected: ObjectID[];
24
- hovered: ObjectID;
25
23
  highlighted: ObjectID[];
26
24
  interaction: {
27
25
  cycle: number;
@@ -46,7 +44,8 @@ export declare enum HandlersList {
46
44
  DRAG = "drag",
47
45
  DRAWPOINT = "drawPoint",
48
46
  DRAWLINE = "drawLine",
49
- DRAWRECTANGLE = "drawRectangle",
47
+ DRAWRECT2POINTS = "drawRect2Points",
48
+ DRAWRECTCENTER = "drawRectCenter",
50
49
  DRAWARCTANGENT = "drawArcTangent",
51
50
  DRAWARCCENTER = "drawArcCenter",
52
51
  DRAWARCMIDDLE = "drawArcMidlde",
@@ -54,6 +53,7 @@ export declare enum HandlersList {
54
53
  FILLET = "fillet",
55
54
  HOVER = "hover",
56
55
  TRIM = "trim",
56
+ SPLIT = "split",
57
57
  USEREF = "useReference",
58
58
  GSELECTION = "globalSelection"
59
59
  }
@@ -65,7 +65,7 @@ export declare type Handler = {
65
65
  name: HandlersList;
66
66
  filter: (object: IStructureObject) => boolean;
67
67
  onActivate?: () => void;
68
- onDeactivate?: () => void;
68
+ onDeactivate?: (() => void) | (() => Promise<void>);
69
69
  pointerHandlers: Record<string, (e: ThreeEvent<PointerEvent> & PointerEventsT) => void>;
70
70
  keyHandlers?: Record<string, (e: KeyboardEvent) => boolean | void>;
71
71
  };
@@ -80,6 +80,7 @@ export declare enum TmpObjClasses {
80
80
  declare type TmpObjectCommon = {
81
81
  class: TmpObjClasses;
82
82
  id: string;
83
+ color?: THREE.ColorRepresentation;
83
84
  };
84
85
  export declare type TmpLineT = TmpObjectCommon & {
85
86
  startPId: TmpObjectID;
@@ -93,6 +94,7 @@ export declare type TmpRectT = TmpObjectCommon & {
93
94
  };
94
95
  export declare type TmpPointT = TmpObjectCommon & {
95
96
  position: THREE.Vector3;
97
+ size?: number;
96
98
  };
97
99
  export declare type TmpArcT = TmpObjectCommon & {
98
100
  startPId: TmpObjectID;
@@ -1,5 +1,5 @@
1
1
  import { DrawingID, PluginID, ObjectID } from '@buerli.io/core';
2
2
  export declare const hover: (drawingId: DrawingID, pluginId: PluginID, hoveredId: ObjectID) => void;
3
3
  export declare const unhover: (drawingId: DrawingID, pluginId: PluginID, hoveredId: ObjectID) => void;
4
- export declare const select: (drawingId: DrawingID, pluginId: PluginID, selectedId: ObjectID) => void;
4
+ export declare const select: (drawingId: DrawingID, selectedId: ObjectID) => void;
5
5
  export declare const tab: (drawingId: DrawingID, pluginId: PluginID) => void;
@@ -1,2 +1,2 @@
1
1
  import { IStructureObject } from '@buerli.io/core';
2
- export declare function getGeometryPriority(object: IStructureObject): 1 | 2 | 3 | 4 | -1 | 5;
2
+ export declare function getGeometryPriority(object: IStructureObject): 1 | 2 | 4 | 3 | -1 | 5;
@@ -33,4 +33,5 @@ export declare function rgbToHex(color: {
33
33
  }): string;
34
34
  export declare function fmod(num: number, denom: number): number;
35
35
  export declare function numberToHexColor(color: number): string;
36
+ export declare const solveQuadratic: (a: number, b: number, c: number) => number[];
36
37
  export declare const solveQuartic: (a: number, b: number, c: number, d: number, e: number) => number[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/react-cad",
3
- "version": "0.9.0-beta.1",
3
+ "version": "0.10.0",
4
4
  "description": "buerli CAD components",
5
5
  "author": "AWV Informatik AG <info@awv-informatik.ch>",
6
6
  "repository": {},
@@ -37,7 +37,7 @@
37
37
  "@babel/preset-env": "^7.15.0",
38
38
  "@babel/preset-react": "^7.14.5",
39
39
  "@babel/preset-typescript": "^7.10.4",
40
- "@buerli.io/icons": "^1.0.10",
40
+ "@buerli.io/icons": "^1.0.11",
41
41
  "@react-three/drei": "9.77.1",
42
42
  "@react-three/fiber": "8.13.0",
43
43
  "@rollup/plugin-babel": "^5.3.0",
@@ -71,7 +71,7 @@
71
71
  "jest-environment-jsdom": "^29.1.2",
72
72
  "lint-staged": "10.5.3",
73
73
  "postcss": "^8.2.14",
74
- "prettier": "^2.4.0",
74
+ "prettier": "^3.0.0",
75
75
  "react": "18.0.0",
76
76
  "react-dom": "18.0.0",
77
77
  "react-test-renderer": "^16.13.1",
@@ -90,20 +90,20 @@
90
90
  "react": ">=18.0"
91
91
  },
92
92
  "dependencies": {
93
- "@ant-design/compatible": "^1.0.8",
94
- "@buerli.io/classcad": "0.9.0-beta.1",
95
- "@buerli.io/react": "0.9.0-beta.1",
96
- "@react-three/postprocessing": "2.14.9",
93
+ "@buerli.io/classcad": "0.10.0",
94
+ "@buerli.io/react": "0.10.0",
95
+ "@dnd-kit/core": "^6.0.8",
96
+ "@dnd-kit/modifiers": "^6.0.1",
97
+ "@dnd-kit/sortable": "^7.0.2",
98
+ "@react-three/postprocessing": "2.15.0",
97
99
  "antd": "^4.23.4",
98
100
  "path-browserify": "^1.0.1",
99
- "postprocessing": "6.31.0",
101
+ "postprocessing": "6.33.0",
100
102
  "react-colorful": "^5.3.0",
101
- "react-movable": "^2.3.0",
102
- "react-sortable-hoc": "^2.0.0",
103
103
  "react-uid": "^2.3.1",
104
104
  "styled-components": "^5.3.1",
105
105
  "three-rounded-box": "^0.1.1",
106
- "uuid": "^3.3.2",
106
+ "uuid": "^9.0.0",
107
107
  "zustand": "^4.1.4"
108
108
  }
109
109
  }
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import 'antd/dist/antd.css';
3
- import { DrawingID, ObjectID } from '@buerli.io/core';
4
- import { MenuItems } from '../common/Menu';
5
- export declare function useMenuItems(drawingId: DrawingID, objectId: ObjectID, setRename: React.Dispatch<React.SetStateAction<boolean>>): MenuItems;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import 'antd/dist/antd.css';
3
- import { DrawingID, ObjectID } from '@buerli.io/core';
4
- import { MenuItems } from '../common/Menu';
5
- export declare function useMenuItems(drawingId: DrawingID, solidId: ObjectID, setEditName: React.Dispatch<React.SetStateAction<boolean>>): MenuItems;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import 'antd/dist/antd.css';
3
- import { DrawingID, ObjectID } from '@buerli.io/core';
4
- import { MenuItems } from '../common/Menu';
5
- export declare function useMenuItems(drawingId: DrawingID, featureId: ObjectID, isActive: boolean, setEditName: React.Dispatch<React.SetStateAction<boolean>>): MenuItems;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import 'antd/dist/antd.css';
3
- import { DrawingID, ObjectID, PluginID } from '@buerli.io/core';
4
- import { MenuItems } from '../../common/Menu';
5
- export declare function useMenuItems(drawingId: DrawingID, pluginId: PluginID, prodId: ObjectID, setEditName: React.Dispatch<React.SetStateAction<boolean>>): MenuItems;
@@ -1,5 +0,0 @@
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;