@buerli.io/react-cad 1.0.1 → 1.1.0-beta.7

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/ThemeToggle.d.ts +2 -0
  2. package/build/components/UI/CAD/ToolBar/ToolBar.d.ts +2 -0
  3. package/build/components/UI/CAD/common/Menu.d.ts +1 -0
  4. package/build/components/UI/CAD/plugins/ProductManagement/Root.d.ts +1 -0
  5. package/build/components/UI/ThemeVars.d.ts +6 -0
  6. package/build/components/UI/editors/ColorEditor/ColorEditor.d.ts +1 -0
  7. package/build/components/UI/editors/NumberEditor/NumOrExpr.d.ts +1 -0
  8. package/build/components/UI/editors/RefsEditors/ChainFinder.d.ts +4 -6
  9. package/build/components/UI/editors/RefsEditors/MateOrientationEditor.d.ts +1 -0
  10. package/build/components/UI/editors/ToleranceEditor/ToleranceEditor.d.ts +1 -0
  11. package/build/components/UI/editors/TypeEditor/TypeEditor.d.ts +1 -0
  12. package/build/index.cjs.js +2502 -1602
  13. package/build/index.d.ts +2 -0
  14. package/build/index.js +2441 -1545
  15. package/build/plugins/Sketch/Root/Constraints/Constraints.d.ts +1 -0
  16. package/build/plugins/Sketch/Root/CopyPatterns.d.ts +1 -0
  17. package/build/plugins/Sketch/Root/Details.d.ts +1 -0
  18. package/build/plugins/Sketch/Root/Handlers.d.ts +1 -0
  19. package/build/plugins/Sketch/Root/useContextMenuItems.d.ts +2 -2
  20. package/build/plugins/Sketch/View/graphics/Merged/Arc.d.ts +8 -0
  21. package/build/plugins/Sketch/View/graphics/Merged/Circle.d.ts +1 -0
  22. package/build/plugins/Sketch/View/graphics/Merged/Line.d.ts +5 -0
  23. package/build/plugins/Sketch/View/graphics/Merged/LineGeometry.d.ts +2 -0
  24. package/build/plugins/Sketch/View/graphics/Merged/LineMaterial.d.ts +2 -0
  25. package/build/plugins/Sketch/View/graphics/Merged/MergedWrapper.d.ts +0 -10
  26. package/build/plugins/Sketch/View/graphics/hooks.d.ts +3 -0
  27. package/build/plugins/Sketch/View/graphics/transform.d.ts +4 -0
  28. package/build/plugins/Sketch/View/handlers/filletHelpers.d.ts +2 -0
  29. package/build/plugins/Sketch/types.d.ts +4 -0
  30. package/build/theme/themeStore.d.ts +68 -0
  31. package/build/utils/FileUtils.d.ts +3 -1
  32. package/build/utils/sketchUtils.d.ts +14 -0
  33. package/package.json +5 -4
@@ -1,2 +1,3 @@
1
1
  import React from 'react';
2
+ import '../../../../components/UI/editors/antd-theme.css';
2
3
  export declare const Constraints: React.FC;
@@ -1,2 +1,3 @@
1
1
  import React from 'react';
2
+ import '../../../components/UI/editors/antd-theme.css';
2
3
  export declare const CopyPatterns: React.FC;
@@ -1,2 +1,3 @@
1
1
  import React from 'react';
2
+ import '../../../components/UI/editors/antd-theme.css';
2
3
  export declare const Details: React.FC;
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
+ import '../../../components/UI/editors/antd-theme.css';
2
3
  import './Handlers.css';
3
4
  export declare const Handlers: React.FC;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import 'antd/dist/antd.css';
3
- import { DrawingID, PluginID } from '@buerli.io/core';
3
+ import { DrawingID, ObjectID, PluginID } from '@buerli.io/core';
4
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[];
5
+ export declare function useContextMenuItems(drawingId: DrawingID, pluginId: PluginID, objectId: ObjectID, setRename: React.Dispatch<React.SetStateAction<boolean>>): MenuElement[];
@@ -2,11 +2,19 @@ import React from 'react';
2
2
  import * as THREE from 'three';
3
3
  import { DrawingID, PluginID } from '@buerli.io/core';
4
4
  import { commonProps } from '../primitives';
5
+ export declare type ArcInstance = THREE.Group & {
6
+ radius: number;
7
+ tubeRadius: number;
8
+ arcAngle: number;
9
+ units: number;
10
+ periodLength: number;
11
+ };
5
12
  export declare const useTubeRadius: (drawingId: DrawingID, pluginId: PluginID, scalePlus?: boolean) => number;
6
13
  export declare const Arc: React.FC<{
7
14
  start: THREE.Vector3;
8
15
  end: THREE.Vector3;
9
16
  center: THREE.Vector3;
10
17
  clockwise: boolean;
18
+ isConstruction: boolean;
11
19
  scalePlus?: boolean;
12
20
  } & commonProps>;
@@ -4,5 +4,6 @@ import { commonProps } from '../primitives';
4
4
  export declare const Circle: React.FC<{
5
5
  center: THREE.Vector3;
6
6
  radius: number;
7
+ isConstruction: boolean;
7
8
  scalePlus?: boolean;
8
9
  } & commonProps>;
@@ -1,10 +1,15 @@
1
1
  import React from 'react';
2
2
  import * as THREE from 'three';
3
3
  import { commonProps } from '../primitives';
4
+ export declare type CylinderInstance = THREE.Group & {
5
+ units: number;
6
+ periodLength: number;
7
+ };
4
8
  export declare const Line: React.FC<{
5
9
  start: THREE.Vector3;
6
10
  end: THREE.Vector3;
7
11
  width?: number;
12
+ isConstruction: boolean;
8
13
  notInteractive?: boolean;
9
14
  scalePlus?: boolean;
10
15
  } & commonProps>;
@@ -0,0 +1,2 @@
1
+ import * as THREE from 'three';
2
+ export declare const createLineGeometry: (tubeSegments: number, instanceLimit: number) => THREE.CylinderGeometry;
@@ -0,0 +1,2 @@
1
+ import * as THREE from 'three';
2
+ export declare const createLineMaterial: () => THREE.ShaderMaterial;
@@ -1,13 +1,4 @@
1
1
  import React from 'react';
2
- import * as THREE from 'three';
3
- declare type ArcInstance = THREE.Group & {
4
- radius: number;
5
- tubeRadius: number;
6
- angularLength: number;
7
- };
8
- export declare const getCylBB: () => THREE.Box3;
9
- export declare const getSphereBB: () => THREE.Box3;
10
- export declare const getArcBB: (mesh: ArcInstance) => THREE.Box3;
11
2
  export declare const MeshContext: React.Context<{
12
3
  MockCylinder: any;
13
4
  MockSphere: any;
@@ -21,4 +12,3 @@ export declare const MeshContext: React.Context<{
21
12
  export declare const MergedWrapper: React.FC<{
22
13
  children?: React.ReactNode;
23
14
  }>;
24
- export {};
@@ -1,4 +1,5 @@
1
1
  import { ScgObject, DrawingID, ObjectID } from '@buerli.io/core';
2
+ import { ThemeMode } from '../../../../theme/themeStore';
2
3
  export declare const useGeomParams: (objId: ObjectID) => {
3
4
  renderOrder: number;
4
5
  polygonOffsetUnits: number;
@@ -8,7 +9,9 @@ export declare const useGeomParams: (objId: ObjectID) => {
8
9
  isConstrOverdefined: boolean;
9
10
  };
10
11
  declare type ObjState = {
12
+ theme: ThemeMode;
11
13
  isSketchActive: boolean;
14
+ isConstruction: boolean;
12
15
  isHighlighted: boolean;
13
16
  isGHovered: boolean;
14
17
  isSHovered: boolean;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import * as THREE from 'three';
3
+ import { DrawingID, PluginID } from "@buerli.io/core";
4
+ export declare function useTransform<T extends THREE.Object3D>(drawingId: DrawingID, pluginId: PluginID, position: THREE.Vector3, quaternion: THREE.Quaternion, baseScale: THREE.Vector3, mScale: THREE.Vector3): React.RefObject<T>;
@@ -7,11 +7,13 @@ export declare type FilletablePointInfo = {
7
7
  arcCenterPos: THREE.Vector3;
8
8
  clockwise: boolean;
9
9
  lineIds: ObjectID[];
10
+ isConstruction: boolean;
10
11
  };
11
12
  export declare type FilletArcsInfo = {
12
13
  controlPos: THREE.Vector3;
13
14
  arcStartPos: THREE.Vector3;
14
15
  arcEndPos: THREE.Vector3;
16
+ isConstruction: boolean;
15
17
  };
16
18
  export declare function evaluateClockwise(start: THREE.Vector3, end: THREE.Vector3, control: THREE.Vector3): boolean;
17
19
  export declare const getFilletablePointsMap: (drawingId: DrawingID, sketchId: ObjectID) => {
@@ -86,12 +86,14 @@ declare type TmpObjectCommon = {
86
86
  export declare type TmpLineT = TmpObjectCommon & {
87
87
  startPId: TmpObjectID;
88
88
  endPId: TmpObjectID;
89
+ isConstruction: boolean;
89
90
  };
90
91
  export declare type TmpRectT = TmpObjectCommon & {
91
92
  start: THREE.Vector3;
92
93
  end: THREE.Vector3;
93
94
  isSquare: boolean;
94
95
  isCentered: boolean;
96
+ isConstruction: boolean;
95
97
  };
96
98
  export declare type TmpPointT = TmpObjectCommon & {
97
99
  position: THREE.Vector3;
@@ -103,10 +105,12 @@ export declare type TmpArcT = TmpObjectCommon & {
103
105
  centerPId: TmpObjectID;
104
106
  clockwise: boolean;
105
107
  drawAsLine?: boolean;
108
+ isConstruction: boolean;
106
109
  };
107
110
  export declare type TmpCircleT = TmpObjectCommon & {
108
111
  centerPId: TmpObjectID;
109
112
  radius: number;
113
+ isConstruction: boolean;
110
114
  };
111
115
  export declare type TmpAngularDimensionT = TmpObjectCommon & {
112
116
  dir0: THREE.Vector3;
@@ -0,0 +1,68 @@
1
+ export declare type ThemeMode = 'light' | 'dark';
2
+ export declare type ThemeColors = {
3
+ background: string;
4
+ text: string;
5
+ textSecondary: string;
6
+ border: string;
7
+ headerBackground: string;
8
+ headerDotLight: string;
9
+ headerDotDark: string;
10
+ sectionHeaderBg: string;
11
+ sectionHeaderText: string;
12
+ sectionHeaderBorder: string;
13
+ hoverBg: string;
14
+ hoverBorder: string;
15
+ linkColor: string;
16
+ contextMenuBorder: string;
17
+ contextMenuHeaderBg: string;
18
+ scrollbarThumb: string;
19
+ boxShadow: string;
20
+ msgSuccessBorder: string;
21
+ msgSuccessBg: string;
22
+ msgErrorBorder: string;
23
+ msgErrorBg: string;
24
+ msgErrorBgAccent: string;
25
+ msgErrorBorderAccent: string;
26
+ msgWarningBorder: string;
27
+ msgWarningBg: string;
28
+ msgInfoBorder: string;
29
+ msgInfoBg: string;
30
+ msgShownBorder: string;
31
+ msgShownBg: string;
32
+ inputBg: string;
33
+ inputBgDisabled: string;
34
+ inputBorder: string;
35
+ inputBorderDisabled: string;
36
+ inputText: string;
37
+ closeIcon: string;
38
+ iconFilter: string;
39
+ tooltipBg: string;
40
+ tooltipText: string;
41
+ expressionSpanBg: string;
42
+ expressionSpanSelectedBg: string;
43
+ canvasText: number;
44
+ canvasDimLine: number;
45
+ canvasLabelBg: number;
46
+ loadingOverlayBg: string;
47
+ };
48
+ export declare const lightTheme: ThemeColors;
49
+ export declare const darkTheme: ThemeColors;
50
+ declare type ThemeState = {
51
+ mode: ThemeMode;
52
+ colors: ThemeColors;
53
+ setMode: (mode: ThemeMode) => void;
54
+ };
55
+ export declare const useThemeStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ThemeState>>;
56
+ /** Hook returning the current react-cad theme colors. */
57
+ export declare const useRCadTheme: () => ThemeColors;
58
+ /** Hook returning the current theme mode. */
59
+ export declare const useRCadThemeMode: () => ThemeMode;
60
+ /** Set the react-cad theme mode imperatively. */
61
+ export declare const setRCadThemeMode: (mode: ThemeMode) => void;
62
+ /** Hook returning the canvas text/overlay color (numeric, for three.js materials). */
63
+ export declare const useCanvasTextColor: () => number;
64
+ /** Hook returning the dimension line/arrow color (numeric, for three.js materials). */
65
+ export declare const useCanvasDimLineColor: () => number;
66
+ /** Hook returning the canvas label background color (numeric, for measure/dimension labels). */
67
+ export declare const useCanvasLabelBg: () => number;
68
+ export {};
@@ -9,10 +9,12 @@ export declare const FileUtils: {
9
9
  *
10
10
  * @param onLoad The callback.
11
11
  * @param type The content type.
12
+ * @param multiple The flag for allowing / not allowing to select multiple files to be loaded.
13
+ * @param accept Default electable formats (if not specified, accept all).
12
14
  */
13
15
  loadFile: (onLoad: (files: {
14
16
  file: File;
15
17
  content: any;
16
- }[]) => void, type?: 'DataURL' | 'ArrayBuffer' | 'BinaryString' | 'Text', multiple?: boolean) => void;
18
+ }[]) => void, type?: 'DataURL' | 'ArrayBuffer' | 'BinaryString' | 'Text', multiple?: boolean, accept?: string) => void;
17
19
  exportNode: (drawingId: DrawingID, objectId: ObjectID, type?: 'ofb' | 'stp' | 'step' | 'stl') => Promise<void>;
18
20
  };
@@ -17,6 +17,13 @@ export declare const isSketchActive: (drawingId: DrawingID) => boolean;
17
17
  * @returns Tangent vector value.
18
18
  */
19
19
  export declare const calculateTangent: (drawingId: DrawingID, curveId: ObjectID, point: THREE.Vector3) => THREE.Vector3 | undefined;
20
+ /**
21
+ * Checks if the object represents a sketch curve.
22
+ *
23
+ * @param arg A structure object or CCClass of a structure object.
24
+ * @returns True if the object represents a sketch curve, false otherwise.
25
+ */
26
+ export declare const isSketchCurve: (arg: ScgObject | ScgClassType) => boolean;
20
27
  /**
21
28
  * Checks if the object represents a sketch geometry.
22
29
  *
@@ -45,6 +52,13 @@ export declare const isSketchObj: (arg: ScgObject | ScgClassType) => boolean;
45
52
  * @returns True if the object represents a sketch region, false otherwise.
46
53
  */
47
54
  export declare const isSketchRegion: (arg: ScgObject | ScgClassType) => boolean;
55
+ /**
56
+ * Checks if the object is a construction geometry.
57
+ *
58
+ * @param arg A structure object or CCClass of a structure object.
59
+ * @returns True if the object is a construction geometry, false otherwise.
60
+ */
61
+ export declare const isConstruction: (arg: ScgObject) => boolean;
48
62
  /**
49
63
  * Searches for the sketch which nests the specified object.
50
64
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerli.io/react-cad",
3
- "version": "1.0.1",
3
+ "version": "1.1.0-beta.7",
4
4
  "description": "buerli CAD components",
5
5
  "author": "AWV Informatik AG <info@awv-informatik.ch>",
6
6
  "repository": {},
@@ -17,6 +17,7 @@
17
17
  "test": "jest --silent",
18
18
  "testVerbose": "jest",
19
19
  "lint": "eslint \"./src/**/*.ts?(x)\"",
20
+ "compile": "tsc",
20
21
  "prettify": "prettier --write \"./{src,tests}/**/*.{js,jsx,ts,tsx,json}\""
21
22
  },
22
23
  "lint-staged": {
@@ -32,7 +33,7 @@
32
33
  "@babel/preset-env": "^7.15.0",
33
34
  "@babel/preset-react": "^7.14.5",
34
35
  "@babel/preset-typescript": "^7.10.4",
35
- "@buerli.io/icons": "^1.0.18",
36
+ "@buerli.io/icons": "^1.0.19",
36
37
  "@react-three/drei": "9.92.3",
37
38
  "@react-three/fiber": "8.15.14",
38
39
  "@rollup/plugin-babel": "^5.3.0",
@@ -87,8 +88,8 @@
87
88
  "three": ">=0.153"
88
89
  },
89
90
  "dependencies": {
90
- "@buerli.io/classcad": "1.0.1",
91
- "@buerli.io/react": "1.0.1",
91
+ "@buerli.io/classcad": "1.1.0-beta.7",
92
+ "@buerli.io/react": "1.1.0-beta.7",
92
93
  "@dnd-kit/core": "^6.0.8",
93
94
  "@dnd-kit/modifiers": "^6.0.1",
94
95
  "@dnd-kit/sortable": "^7.0.2",