@wandelbots/wandelbots-js-react-components 3.3.2 → 3.4.0-pr.feat-add-yaskawa-gp200s.438.0503e4b
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/README.md +10 -61
- package/dist/auth0-spa-js.production.esm-1QXzndwB.js +950 -0
- package/dist/auth0-spa-js.production.esm-1QXzndwB.js.map +1 -0
- package/dist/auth0-spa-js.production.esm-BLRAk7Yh.cjs +5 -0
- package/dist/auth0-spa-js.production.esm-BLRAk7Yh.cjs.map +1 -0
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +1 -1
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts.map +1 -1
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/ColliderCollection.d.ts +1 -1
- package/dist/components/3d-viewport/collider/ColliderCollection.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/ColliderElement.d.ts +1 -1
- package/dist/components/3d-viewport/collider/ColliderElement.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts +1 -1
- package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts +1 -1
- package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts.map +1 -1
- package/dist/components/ProgramStateIndicator.d.ts +3 -3
- package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
- package/dist/components/RobotCard.d.ts +3 -4
- package/dist/components/RobotCard.d.ts.map +1 -1
- package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
- package/dist/components/jogging/JoggingStore.d.ts +5 -10
- package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
- package/dist/components/jogging/PoseCartesianValues.d.ts +2 -2
- package/dist/components/jogging/PoseCartesianValues.d.ts.map +1 -1
- package/dist/components/jogging/PoseJointValues.d.ts +2 -1
- package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
- package/dist/components/robots/DHRobot.d.ts.map +1 -1
- package/dist/components/robots/Robot.d.ts +1 -1
- package/dist/components/robots/Robot.d.ts.map +1 -1
- package/dist/components/robots/RobotAnimator.d.ts +2 -2
- package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
- package/dist/components/robots/SupportedRobot.d.ts +3 -3
- package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
- package/dist/components/robots/manufacturerHomePositions.d.ts +1 -1
- package/dist/components/robots/manufacturerHomePositions.d.ts.map +1 -1
- package/dist/components/safetyBar/ControllerTypeIndicator.d.ts.map +1 -1
- package/dist/components/safetyBar/OperationModeIndicator.d.ts +2 -2
- package/dist/components/safetyBar/OperationModeIndicator.d.ts.map +1 -1
- package/dist/components/safetyBar/SafetyBar.d.ts +3 -3
- package/dist/components/safetyBar/SafetyBar.d.ts.map +1 -1
- package/dist/components/safetyBar/SafetyStateIndicator.d.ts +2 -2
- package/dist/components/safetyBar/SafetyStateIndicator.d.ts.map +1 -1
- package/dist/components/utils/errorHandling.d.ts.map +1 -1
- package/dist/index.cjs +155 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +39 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34927 -0
- package/dist/index.js.map +1 -0
- package/package.json +12 -40
- package/src/components/3d-viewport/CoordinateSystemTransform.tsx +1 -1
- package/src/components/3d-viewport/SafetyZonesRenderer.tsx +2 -1
- package/src/components/3d-viewport/collider/ColliderCollection.tsx +1 -1
- package/src/components/3d-viewport/collider/ColliderElement.tsx +1 -1
- package/src/components/3d-viewport/collider/CollisionSceneRenderer.tsx +1 -1
- package/src/components/3d-viewport/collider/colliderShapeToBufferGeometry.ts +1 -1
- package/src/components/AppHeader.md +1 -1
- package/src/components/ProgramStateIndicator.tsx +6 -3
- package/src/components/RobotCard.tsx +7 -4
- package/src/components/jogging/JoggingCartesianTab.tsx +11 -13
- package/src/components/jogging/JoggingJointLimitDetector.tsx +2 -2
- package/src/components/jogging/JoggingJointTab.tsx +4 -4
- package/src/components/jogging/JoggingOptions.tsx +5 -6
- package/src/components/jogging/JoggingPanel.tsx +3 -6
- package/src/components/jogging/JoggingStore.ts +39 -66
- package/src/components/jogging/PoseCartesianValues.tsx +4 -3
- package/src/components/jogging/PoseJointValues.tsx +4 -3
- package/src/components/robots/DHRobot.tsx +3 -2
- package/src/components/robots/Robot.tsx +1 -1
- package/src/components/robots/RobotAnimator.test.tsx +22 -7
- package/src/components/robots/RobotAnimator.tsx +13 -8
- package/src/components/robots/SupportedRobot.tsx +6 -3
- package/src/components/robots/manufacturerHomePositions.ts +1 -1
- package/src/components/safetyBar/ControllerTypeIndicator.tsx +2 -4
- package/src/components/safetyBar/OperationModeIndicator.tsx +5 -7
- package/src/components/safetyBar/SafetyBar.tsx +6 -3
- package/src/components/safetyBar/SafetyStateIndicator.tsx +7 -9
- package/src/components/utils/errorHandling.ts +0 -4
- package/src/i18n/locales/de/translations.json +0 -3
- package/src/i18n/locales/en/translations.json +0 -3
- package/src/index.ts +43 -4
- package/dist/3d.cjs.js +0 -2
- package/dist/3d.cjs.js.map +0 -1
- package/dist/3d.d.ts +0 -11
- package/dist/3d.d.ts.map +0 -1
- package/dist/3d.es.js +0 -16
- package/dist/3d.es.js.map +0 -1
- package/dist/LoadingCover-Dr9hDTku.js +0 -87
- package/dist/LoadingCover-Dr9hDTku.js.map +0 -1
- package/dist/LoadingCover-r2yhJZF9.cjs +0 -2
- package/dist/LoadingCover-r2yhJZF9.cjs.map +0 -1
- package/dist/WandelscriptEditor-Dj7TBCkF.cjs +0 -2
- package/dist/WandelscriptEditor-Dj7TBCkF.cjs.map +0 -1
- package/dist/WandelscriptEditor-DnJvITTA.js +0 -140
- package/dist/WandelscriptEditor-DnJvITTA.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-9WdmjTxR.js +0 -1429
- package/dist/auth0-spa-js.production.esm-9WdmjTxR.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-BcLLh1tx.cjs +0 -5
- package/dist/auth0-spa-js.production.esm-BcLLh1tx.cjs.map +0 -1
- package/dist/components/jogging/JoggingBlocked.d.ts +0 -7
- package/dist/components/jogging/JoggingBlocked.d.ts.map +0 -1
- package/dist/components/utils/errorHandling.test.d.ts +0 -2
- package/dist/components/utils/errorHandling.test.d.ts.map +0 -1
- package/dist/core.cjs.js +0 -2
- package/dist/core.cjs.js.map +0 -1
- package/dist/core.d.ts +0 -33
- package/dist/core.d.ts.map +0 -1
- package/dist/core.es.js +0 -54
- package/dist/core.es.js.map +0 -1
- package/dist/index-CAib4NKw.js +0 -2261
- package/dist/index-CAib4NKw.js.map +0 -1
- package/dist/index-CqMZL0FV.cjs +0 -2
- package/dist/index-CqMZL0FV.cjs.map +0 -1
- package/dist/index-CxasuX80.js +0 -5212
- package/dist/index-CxasuX80.js.map +0 -1
- package/dist/index-DxwppshT.cjs +0 -29
- package/dist/index-DxwppshT.cjs.map +0 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -69
- package/dist/index.es.js.map +0 -1
- package/dist/lib/ConnectedMotionGroup.d.ts +0 -90
- package/dist/lib/ConnectedMotionGroup.d.ts.map +0 -1
- package/dist/lib/JoggerConnection.d.ts +0 -113
- package/dist/lib/JoggerConnection.d.ts.map +0 -1
- package/dist/lib/JoggerConnection.test.d.ts +0 -2
- package/dist/lib/JoggerConnection.test.d.ts.map +0 -1
- package/dist/lib/MotionStreamConnection.d.ts +0 -24
- package/dist/lib/MotionStreamConnection.d.ts.map +0 -1
- package/dist/lib/MotionStreamConnection.test.d.ts +0 -2
- package/dist/lib/MotionStreamConnection.test.d.ts.map +0 -1
- package/dist/lib/motionStateUpdate.d.ts +0 -7
- package/dist/lib/motionStateUpdate.d.ts.map +0 -1
- package/dist/lib/motionStateUpdate.test.d.ts +0 -2
- package/dist/lib/motionStateUpdate.test.d.ts.map +0 -1
- package/dist/manufacturerHomePositions-Ca80ycLi.cjs +0 -2
- package/dist/manufacturerHomePositions-Ca80ycLi.cjs.map +0 -1
- package/dist/manufacturerHomePositions-CgaG5vaK.js +0 -976
- package/dist/manufacturerHomePositions-CgaG5vaK.js.map +0 -1
- package/dist/theming-Bd0vaauc.js +0 -23460
- package/dist/theming-Bd0vaauc.js.map +0 -1
- package/dist/theming-j4s40Rk-.cjs +0 -133
- package/dist/theming-j4s40Rk-.cjs.map +0 -1
- package/dist/wandelscript.cjs.js +0 -2
- package/dist/wandelscript.cjs.js.map +0 -1
- package/dist/wandelscript.d.ts +0 -2
- package/dist/wandelscript.d.ts.map +0 -1
- package/dist/wandelscript.es.js +0 -5
- package/dist/wandelscript.es.js.map +0 -1
- package/src/3d.ts +0 -15
- package/src/components/jogging/JoggingBlocked.tsx +0 -37
- package/src/components/utils/errorHandling.test.ts +0 -41
- package/src/core.ts +0 -33
- package/src/lib/ConnectedMotionGroup.ts +0 -444
- package/src/lib/JoggerConnection.test.ts +0 -120
- package/src/lib/JoggerConnection.ts +0 -674
- package/src/lib/MotionStreamConnection.test.ts +0 -23
- package/src/lib/MotionStreamConnection.ts +0 -189
- package/src/lib/motionStateUpdate.test.ts +0 -28
- package/src/lib/motionStateUpdate.ts +0 -117
- package/src/wandelscript.ts +0 -2
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Button, Stack } from "@mui/material"
|
|
2
|
-
import { poseToWandelscriptString
|
|
2
|
+
import { poseToWandelscriptString } from "@wandelbots/nova-js"
|
|
3
|
+
import type { TcpPose } from "@wandelbots/nova-js/v1"
|
|
3
4
|
import { observer } from "mobx-react-lite"
|
|
4
5
|
import { useState } from "react"
|
|
5
6
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
6
7
|
import { CopyableText } from "../CopyableText"
|
|
7
8
|
|
|
8
9
|
export type PoseCartesianValuesProps = {
|
|
9
|
-
tcpPose:
|
|
10
|
+
tcpPose: TcpPose
|
|
10
11
|
showCopyButton?: boolean
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -43,7 +44,7 @@ export const PoseCartesianValues = externalizeComponent(
|
|
|
43
44
|
onClick={handleCopy}
|
|
44
45
|
sx={{ flexShrink: 0 }}
|
|
45
46
|
>
|
|
46
|
-
{copyMessage ? copyMessage : "Copy"}
|
|
47
|
+
{ copyMessage ? copyMessage : "Copy"}
|
|
47
48
|
</Button>
|
|
48
49
|
)}
|
|
49
50
|
</Stack>
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { Button, Stack } from "@mui/material"
|
|
2
|
+
import type { Joints } from "@wandelbots/nova-api/v1"
|
|
2
3
|
import { observer } from "mobx-react-lite"
|
|
3
4
|
import { useState } from "react"
|
|
4
5
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
5
6
|
import { CopyableText } from "../CopyableText"
|
|
6
7
|
|
|
7
8
|
export type PoseJointValuesProps = {
|
|
8
|
-
joints:
|
|
9
|
+
joints: Joints
|
|
9
10
|
showCopyButton?: boolean
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export const PoseJointValues = externalizeComponent(
|
|
13
14
|
observer(({ joints, showCopyButton = false }: PoseJointValuesProps) => {
|
|
14
15
|
const [copyMessage, setCopyMessage] = useState<string | null>(null)
|
|
15
|
-
const poseString = `[${joints.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
16
|
+
const poseString = `[${joints.joints.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
16
17
|
|
|
17
18
|
const handleCopy = async () => {
|
|
18
19
|
try {
|
|
@@ -42,7 +43,7 @@ export const PoseJointValues = externalizeComponent(
|
|
|
42
43
|
onClick={handleCopy}
|
|
43
44
|
sx={{ flexShrink: 0 }}
|
|
44
45
|
>
|
|
45
|
-
{copyMessage ? copyMessage : "Copy"}
|
|
46
|
+
{ copyMessage ? copyMessage : "Copy"}
|
|
46
47
|
</Button>
|
|
47
48
|
)}
|
|
48
49
|
</Stack>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Line } from "@react-three/drei"
|
|
2
|
-
import type { DHParameter } from "@wandelbots/nova-
|
|
2
|
+
import type { DHParameter } from "@wandelbots/nova-api/v1"
|
|
3
3
|
import React, { useRef } from "react"
|
|
4
4
|
import type * as THREE from "three"
|
|
5
5
|
import { Matrix4, Quaternion, Vector3 } from "three"
|
|
@@ -113,7 +113,8 @@ export function DHRobot({
|
|
|
113
113
|
{dhParameters!.map((param, index) => {
|
|
114
114
|
const { a, b } = getLinePoints(
|
|
115
115
|
param,
|
|
116
|
-
rapidlyChangingMotionState.joint_position[index] ??
|
|
116
|
+
rapidlyChangingMotionState.state.joint_position.joints[index] ??
|
|
117
|
+
0,
|
|
117
118
|
)
|
|
118
119
|
const jointName = `dhrobot_J0${index}`
|
|
119
120
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ThreeElements } from "@react-three/fiber"
|
|
2
2
|
|
|
3
|
+
import type { ConnectedMotionGroup } from "@wandelbots/nova-js/v1"
|
|
3
4
|
import type { Group } from "three"
|
|
4
|
-
import type { ConnectedMotionGroup } from "../../lib/ConnectedMotionGroup"
|
|
5
5
|
import { defaultGetModel } from "./robotModelLogic"
|
|
6
6
|
import { SupportedRobot } from "./SupportedRobot"
|
|
7
7
|
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
DHParameter,
|
|
3
|
+
MotionGroupStateResponse,
|
|
4
|
+
} from "@wandelbots/nova-api/v1"
|
|
2
5
|
import { describe, expect, it, vi } from "vitest"
|
|
3
6
|
import RobotAnimator from "./RobotAnimator"
|
|
4
7
|
|
|
@@ -23,8 +26,12 @@ describe("RobotAnimator", () => {
|
|
|
23
26
|
|
|
24
27
|
it("should handle props with different numbers of joints", () => {
|
|
25
28
|
// Test that the component accepts different numbers of DH parameters
|
|
26
|
-
const mockMotionState4Joints:
|
|
27
|
-
|
|
29
|
+
const mockMotionState4Joints: MotionGroupStateResponse = {
|
|
30
|
+
state: {
|
|
31
|
+
joint_position: {
|
|
32
|
+
joints: [0.1, 0.2, 0.3, 0.4],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
28
35
|
} as any
|
|
29
36
|
|
|
30
37
|
const mockDHParameters4Joints: DHParameter[] = [
|
|
@@ -34,8 +41,12 @@ describe("RobotAnimator", () => {
|
|
|
34
41
|
{ theta: 0, reverse_rotation_direction: false },
|
|
35
42
|
]
|
|
36
43
|
|
|
37
|
-
const mockMotionState7Joints:
|
|
38
|
-
|
|
44
|
+
const mockMotionState7Joints: MotionGroupStateResponse = {
|
|
45
|
+
state: {
|
|
46
|
+
joint_position: {
|
|
47
|
+
joints: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
39
50
|
} as any
|
|
40
51
|
|
|
41
52
|
const mockDHParameters7Joints: DHParameter[] = Array(7).fill({
|
|
@@ -52,7 +63,9 @@ describe("RobotAnimator", () => {
|
|
|
52
63
|
}
|
|
53
64
|
// Verify props are correctly typed
|
|
54
65
|
expect(props4.dhParameters).toHaveLength(4)
|
|
55
|
-
expect(
|
|
66
|
+
expect(
|
|
67
|
+
props4.rapidlyChangingMotionState.state.joint_position.joints,
|
|
68
|
+
).toHaveLength(4)
|
|
56
69
|
}).not.toThrow()
|
|
57
70
|
|
|
58
71
|
expect(() => {
|
|
@@ -62,7 +75,9 @@ describe("RobotAnimator", () => {
|
|
|
62
75
|
children: null,
|
|
63
76
|
}
|
|
64
77
|
expect(props7.dhParameters).toHaveLength(7)
|
|
65
|
-
expect(
|
|
78
|
+
expect(
|
|
79
|
+
props7.rapidlyChangingMotionState.state.joint_position.joints,
|
|
80
|
+
).toHaveLength(7)
|
|
66
81
|
}).not.toThrow()
|
|
67
82
|
})
|
|
68
83
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { useFrame, useThree } from "@react-three/fiber"
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
DHParameter,
|
|
4
|
+
MotionGroupStateResponse,
|
|
5
|
+
} from "@wandelbots/nova-api/v1"
|
|
3
6
|
import React, { useEffect, useRef } from "react"
|
|
4
7
|
import type { Group, Object3D } from "three"
|
|
5
8
|
import { useAutorun } from "../utils/hooks"
|
|
@@ -7,7 +10,7 @@ import { ValueInterpolator } from "../utils/interpolation"
|
|
|
7
10
|
import { collectJoints } from "./robotModelLogic"
|
|
8
11
|
|
|
9
12
|
type RobotAnimatorProps = {
|
|
10
|
-
rapidlyChangingMotionState:
|
|
13
|
+
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
11
14
|
dhParameters: DHParameter[]
|
|
12
15
|
onRotationChanged?: (joints: Object3D[], jointValues: number[]) => void
|
|
13
16
|
children: React.ReactNode
|
|
@@ -26,9 +29,10 @@ export default function RobotAnimator({
|
|
|
26
29
|
|
|
27
30
|
// Initialize interpolator
|
|
28
31
|
useEffect(() => {
|
|
29
|
-
const initialJointValues =
|
|
30
|
-
(
|
|
31
|
-
|
|
32
|
+
const initialJointValues =
|
|
33
|
+
rapidlyChangingMotionState.state.joint_position.joints.filter(
|
|
34
|
+
(item) => item !== undefined,
|
|
35
|
+
)
|
|
32
36
|
|
|
33
37
|
interpolatorRef.current = new ValueInterpolator(initialJointValues, {
|
|
34
38
|
tension: 120, // Controls spring stiffness - higher values create faster, more responsive motion
|
|
@@ -87,9 +91,10 @@ export default function RobotAnimator({
|
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
useAutorun(() => {
|
|
90
|
-
const newJointValues =
|
|
91
|
-
(
|
|
92
|
-
|
|
94
|
+
const newJointValues =
|
|
95
|
+
rapidlyChangingMotionState.state.joint_position.joints.filter(
|
|
96
|
+
(item) => item !== undefined,
|
|
97
|
+
)
|
|
93
98
|
|
|
94
99
|
requestAnimationFrame(() => updateJoints(newJointValues))
|
|
95
100
|
})
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { ThreeElements } from "@react-three/fiber"
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
DHParameter,
|
|
4
|
+
MotionGroupStateResponse,
|
|
5
|
+
} from "@wandelbots/nova-api/v1"
|
|
3
6
|
import { Suspense, useCallback, useEffect, useState } from "react"
|
|
4
7
|
import { DHRobot } from "./DHRobot"
|
|
5
8
|
|
|
@@ -13,12 +16,12 @@ import { applyGhostStyle, removeGhostStyle } from "./ghostStyle"
|
|
|
13
16
|
import { defaultGetModel } from "./robotModelLogic"
|
|
14
17
|
|
|
15
18
|
export type DHRobotProps = {
|
|
16
|
-
rapidlyChangingMotionState:
|
|
19
|
+
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
17
20
|
dhParameters: Array<DHParameter>
|
|
18
21
|
} & ThreeElements["group"]
|
|
19
22
|
|
|
20
23
|
export type SupportedRobotProps = {
|
|
21
|
-
rapidlyChangingMotionState:
|
|
24
|
+
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
22
25
|
modelFromController: string
|
|
23
26
|
dhParameters: DHParameter[]
|
|
24
27
|
flangeRef?: React.Ref<THREE.Group>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useTheme, type PopoverOrigin } from "@mui/material"
|
|
2
2
|
import { observer } from "mobx-react-lite"
|
|
3
|
-
import { useId } from "react"
|
|
4
3
|
import { Trans, useTranslation } from "react-i18next"
|
|
5
4
|
import ControllerTypePhysicalIcon from "./icons/controller-type-physical.svg"
|
|
6
5
|
import ControllerTypeVirtualIcon from "./icons/controller-type-virtual.svg"
|
|
@@ -23,13 +22,12 @@ export const ControllerTypeIndicator = observer(
|
|
|
23
22
|
compact,
|
|
24
23
|
}: ControllerTypeIndicatorProps) => {
|
|
25
24
|
const theme = useTheme()
|
|
26
|
-
const componentId = useId()
|
|
27
25
|
const { t } = useTranslation()
|
|
28
26
|
|
|
29
27
|
if (isVirtual) {
|
|
30
28
|
return (
|
|
31
29
|
<IndicatorWithExplanation
|
|
32
|
-
id=
|
|
30
|
+
id="motion-group-virtual"
|
|
33
31
|
icon={ControllerTypeVirtualIcon}
|
|
34
32
|
color={theme.palette.tertiary.main}
|
|
35
33
|
name={t("SafetyBar.ControllerType.Virtual.lb")}
|
|
@@ -54,7 +52,7 @@ export const ControllerTypeIndicator = observer(
|
|
|
54
52
|
|
|
55
53
|
return (
|
|
56
54
|
<IndicatorWithExplanation
|
|
57
|
-
id=
|
|
55
|
+
id="motion-group-physical"
|
|
58
56
|
icon={ControllerTypePhysicalIcon}
|
|
59
57
|
color={theme.palette.primary.main}
|
|
60
58
|
name={t("SafetyBar.ControllerType.Physical.lb")}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useTheme, type PopoverOrigin } from "@mui/material"
|
|
2
|
-
import type {
|
|
2
|
+
import type { RobotControllerStateOperationModeEnum } from "@wandelbots/nova-js/v1"
|
|
3
3
|
import { observer } from "mobx-react-lite"
|
|
4
|
-
import { useId } from "react"
|
|
5
4
|
import { Trans, useTranslation } from "react-i18next"
|
|
6
5
|
import OperationModeAutomaticIcon from "./icons/operation-mode-automatic.svg"
|
|
7
6
|
import OperationModeErrorIcon from "./icons/operation-mode-error.svg"
|
|
@@ -9,7 +8,7 @@ import OperationModeManualIcon from "./icons/operation-mode-manual.svg"
|
|
|
9
8
|
import { IndicatorWithExplanation } from "./IndicatorWithExplanation"
|
|
10
9
|
|
|
11
10
|
interface OperationModeIndicatorProps {
|
|
12
|
-
operationMode:
|
|
11
|
+
operationMode: RobotControllerStateOperationModeEnum
|
|
13
12
|
anchorOrigin?: PopoverOrigin
|
|
14
13
|
transformOrigin?: PopoverOrigin
|
|
15
14
|
compact: boolean
|
|
@@ -24,13 +23,12 @@ export const OperationModeIndicator = observer(
|
|
|
24
23
|
}: OperationModeIndicatorProps) => {
|
|
25
24
|
const { t } = useTranslation()
|
|
26
25
|
const theme = useTheme()
|
|
27
|
-
const componentId = useId()
|
|
28
26
|
|
|
29
27
|
switch (operationMode) {
|
|
30
28
|
case "OPERATION_MODE_AUTO":
|
|
31
29
|
return (
|
|
32
30
|
<IndicatorWithExplanation
|
|
33
|
-
id=
|
|
31
|
+
id="operation-mode-auto"
|
|
34
32
|
icon={OperationModeAutomaticIcon}
|
|
35
33
|
title={t("SafetyBar.OperationMode.ti")}
|
|
36
34
|
name={t("SafetyBar.OperationMode.Automatic.ti")}
|
|
@@ -51,7 +49,7 @@ export const OperationModeIndicator = observer(
|
|
|
51
49
|
case "OPERATION_MODE_MANUAL_T2": {
|
|
52
50
|
return (
|
|
53
51
|
<IndicatorWithExplanation
|
|
54
|
-
id=
|
|
52
|
+
id="operation-mode-manual"
|
|
55
53
|
icon={OperationModeManualIcon}
|
|
56
54
|
color={theme.palette.warning.main}
|
|
57
55
|
title={t("SafetyBar.OperationMode.ti")}
|
|
@@ -73,7 +71,7 @@ export const OperationModeIndicator = observer(
|
|
|
73
71
|
default:
|
|
74
72
|
return (
|
|
75
73
|
<IndicatorWithExplanation
|
|
76
|
-
id=
|
|
74
|
+
id="operation-mode-error"
|
|
77
75
|
icon={OperationModeErrorIcon}
|
|
78
76
|
color={theme.palette.warning.main}
|
|
79
77
|
title={t("SafetyBar.OperationMode.ti")}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Divider, Stack, type PopoverOrigin } from "@mui/material"
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
RobotControllerStateOperationModeEnum,
|
|
4
|
+
RobotControllerStateSafetyStateEnum,
|
|
5
|
+
} from "@wandelbots/nova-js/v1"
|
|
3
6
|
import { observer } from "mobx-react-lite"
|
|
4
7
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
5
8
|
import { ControllerTypeIndicator } from "./ControllerTypeIndicator"
|
|
@@ -9,8 +12,8 @@ import { SafetyStateIndicator } from "./SafetyStateIndicator"
|
|
|
9
12
|
export interface SafetyBarProps {
|
|
10
13
|
isVirtual: boolean
|
|
11
14
|
motionGroupId: string
|
|
12
|
-
operationMode:
|
|
13
|
-
safetyState:
|
|
15
|
+
operationMode: RobotControllerStateOperationModeEnum
|
|
16
|
+
safetyState: RobotControllerStateSafetyStateEnum
|
|
14
17
|
anchorOrigin?: PopoverOrigin
|
|
15
18
|
transformOrigin?: PopoverOrigin
|
|
16
19
|
compact?: boolean
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useTheme, type PopoverOrigin } from "@mui/material"
|
|
2
|
-
import type {
|
|
2
|
+
import type { RobotControllerStateSafetyStateEnum } from "@wandelbots/nova-js/v1"
|
|
3
3
|
import { observer } from "mobx-react-lite"
|
|
4
|
-
import { useId } from "react"
|
|
5
4
|
import { Trans, useTranslation } from "react-i18next"
|
|
6
5
|
import { assertUnreachable } from "../utils/errorHandling"
|
|
7
6
|
import SafetyStateErrorIcon from "./icons/safety-state-error.svg"
|
|
@@ -12,7 +11,7 @@ import SafetyStateStopIcon from "./icons/safety-state-stop.svg"
|
|
|
12
11
|
import { IndicatorWithExplanation } from "./IndicatorWithExplanation"
|
|
13
12
|
|
|
14
13
|
interface SafetyStateIndicatorProps {
|
|
15
|
-
safetyState:
|
|
14
|
+
safetyState: RobotControllerStateSafetyStateEnum
|
|
16
15
|
anchorOrigin?: PopoverOrigin
|
|
17
16
|
transformOrigin?: PopoverOrigin
|
|
18
17
|
compact: boolean
|
|
@@ -27,14 +26,13 @@ export const SafetyStateIndicator = observer(
|
|
|
27
26
|
}: SafetyStateIndicatorProps) => {
|
|
28
27
|
const { t } = useTranslation()
|
|
29
28
|
const theme = useTheme()
|
|
30
|
-
const componentId = useId()
|
|
31
29
|
|
|
32
30
|
switch (safetyState) {
|
|
33
31
|
// Normal state, robot can move
|
|
34
32
|
case "SAFETY_STATE_NORMAL":
|
|
35
33
|
return (
|
|
36
34
|
<IndicatorWithExplanation
|
|
37
|
-
id=
|
|
35
|
+
id="safety-state-normal"
|
|
38
36
|
title={t("SafetyBar.SafetyState.ti")}
|
|
39
37
|
name={t("SafetyBar.SafetyState.Normal.lb")}
|
|
40
38
|
label={compact ? null : t("SafetyBar.SafetyState.Normal.lb")}
|
|
@@ -56,7 +54,7 @@ export const SafetyStateIndicator = observer(
|
|
|
56
54
|
case "SAFETY_STATE_ROBOT_EMERGENCY_STOP":
|
|
57
55
|
return (
|
|
58
56
|
<IndicatorWithExplanation
|
|
59
|
-
id=
|
|
57
|
+
id="safety-state-estop"
|
|
60
58
|
title={t("SafetyBar.SafetyState.ti")}
|
|
61
59
|
name={t("SafetyBar.SafetyState.Estop.lb")}
|
|
62
60
|
label={compact ? null : t("SafetyBar.SafetyState.Estop.lb")}
|
|
@@ -83,7 +81,7 @@ export const SafetyStateIndicator = observer(
|
|
|
83
81
|
case "SAFETY_STATE_STOP":
|
|
84
82
|
return (
|
|
85
83
|
<IndicatorWithExplanation
|
|
86
|
-
id=
|
|
84
|
+
id="safety-state-stop"
|
|
87
85
|
icon={SafetyStateStopIcon}
|
|
88
86
|
title={t("SafetyBar.SafetyState.ti")}
|
|
89
87
|
name={t("SafetyBar.SafetyState.Stop.lb")}
|
|
@@ -110,7 +108,7 @@ export const SafetyStateIndicator = observer(
|
|
|
110
108
|
case "SAFETY_STATE_VIOLATION":
|
|
111
109
|
return (
|
|
112
110
|
<IndicatorWithExplanation
|
|
113
|
-
id=
|
|
111
|
+
id="safety-state-manual-action-required"
|
|
114
112
|
icon={SafetyStateManualActionRequiredIcon}
|
|
115
113
|
color={theme.palette.warning.main}
|
|
116
114
|
title={t("SafetyBar.SafetyState.ti")}
|
|
@@ -137,7 +135,7 @@ export const SafetyStateIndicator = observer(
|
|
|
137
135
|
case "SAFETY_STATE_FAULT":
|
|
138
136
|
return (
|
|
139
137
|
<IndicatorWithExplanation
|
|
140
|
-
id=
|
|
138
|
+
id="safety-state-error"
|
|
141
139
|
icon={SafetyStateErrorIcon}
|
|
142
140
|
color={theme.palette.error.main}
|
|
143
141
|
title={t("SafetyBar.SafetyState.ti")}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { AxiosError } from "axios"
|
|
2
2
|
import { tryStringifyJson } from "./converters"
|
|
3
3
|
|
|
4
|
-
// Please note: These helper functions also exist in nova.js
|
|
5
|
-
// (with slightly different formatting), and will be unified
|
|
6
|
-
// at some point in the future.
|
|
7
|
-
|
|
8
4
|
export function delay(ms: number) {
|
|
9
5
|
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
10
6
|
}
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
"Jogging.Velocity.lb": "Geschwindigkeit",
|
|
5
5
|
"General.degree.variable": "{{amount}}°",
|
|
6
6
|
"General.mm.variable": "{{amount}} mm",
|
|
7
|
-
"Jogging.Blocked.ti": "Verbindung blockiert",
|
|
8
|
-
"Jogging.Blocked.lb": "Ein anderer Client kontrolliert das Jogging.",
|
|
9
|
-
"Jogging.Blocked.Reenable.bt": "Neu verbinden",
|
|
10
7
|
"Jogging.Cartesian.MotionType.lb": "Bewegungstyp",
|
|
11
8
|
"Jogging.Cartesian.Translation.bt": "Translation",
|
|
12
9
|
"Jogging.Cartesian.Rotation.bt": "Rotation",
|
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
"Jogging.Velocity.lb": "Velocity",
|
|
5
5
|
"General.degree.variable": "{{amount}}°",
|
|
6
6
|
"General.mm.variable": "{{amount}} mm",
|
|
7
|
-
"Jogging.Blocked.ti": "Connection blocked",
|
|
8
|
-
"Jogging.Blocked.lb": "Another client is currently controlling the jogging.",
|
|
9
|
-
"Jogging.Blocked.Reenable.bt": "Reconnect",
|
|
10
7
|
"Jogging.Cartesian.MotionType.lb": "Motion type",
|
|
11
8
|
"Jogging.Cartesian.Translation.bt": "Translation",
|
|
12
9
|
"Jogging.Cartesian.Rotation.bt": "Rotation",
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "./3d"
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
1
|
+
export { default as CollisionSceneRenderer } from "./components/3d-viewport/collider/CollisionSceneRenderer"
|
|
2
|
+
export * from "./components/3d-viewport/PresetEnvironment"
|
|
3
|
+
export * from "./components/3d-viewport/SafetyZonesRenderer"
|
|
4
|
+
export * from "./components/3d-viewport/TrajectoryRenderer"
|
|
5
|
+
export * from "./components/AppHeader"
|
|
6
|
+
export * from "./components/CycleTimer"
|
|
7
|
+
export * from "./components/Timer"
|
|
8
|
+
export * from "./components/DataGrid"
|
|
9
|
+
export * from "./components/jogging/JoggingCartesianAxisControl"
|
|
10
|
+
export * from "./components/jogging/JoggingJointRotationControl"
|
|
11
|
+
export * from "./components/jogging/JoggingPanel"
|
|
12
|
+
export { JoggingStore } from "./components/jogging/JoggingStore"
|
|
13
|
+
export * from "./components/jogging/PoseCartesianValues"
|
|
14
|
+
export * from "./components/jogging/PoseJointValues"
|
|
15
|
+
export * from "./components/LoadingCover"
|
|
16
|
+
export * from "./components/LogPanel"
|
|
17
|
+
export { LogStore } from "./components/LogStore"
|
|
18
|
+
export * from "./components/LogViewer"
|
|
19
|
+
export * from "./components/modal/NoMotionGroupModal"
|
|
20
|
+
export * from "./components/ProgramControl"
|
|
21
|
+
export * from "./components/ProgramStateIndicator"
|
|
22
|
+
export * from "./components/RobotCard"
|
|
23
|
+
export * from "./components/RobotListItem"
|
|
24
|
+
export * from "./components/robots/AxisConfig"
|
|
25
|
+
export {
|
|
26
|
+
MANUFACTURER_HOME_CONFIGS,
|
|
27
|
+
extractManufacturer,
|
|
28
|
+
getDefaultHomeConfig,
|
|
29
|
+
} from "./components/robots/manufacturerHomePositions"
|
|
30
|
+
export * from "./components/robots/Robot"
|
|
31
|
+
export { defaultGetModel } from "./components/robots/robotModelLogic"
|
|
32
|
+
export * from "./components/robots/SupportedRobot"
|
|
33
|
+
export * from "./components/RobotSetupReadinessIndicator"
|
|
34
|
+
export * from "./components/safetyBar/SafetyBar"
|
|
35
|
+
export * from "./components/SelectableFab"
|
|
36
|
+
export * from "./components/TabBar"
|
|
37
|
+
export * from "./components/utils/hooks"
|
|
38
|
+
export * from "./components/utils/interpolation"
|
|
39
|
+
export * from "./components/VelocitySlider"
|
|
40
|
+
export * from "./components/wandelscript-editor/WandelscriptEditor"
|
|
41
|
+
export * from "./i18n/config"
|
|
42
|
+
export * from "./themes/themeTypes"
|
|
43
|
+
export { createNovaMuiTheme } from "./themes/theming"
|
package/dist/3d.cjs.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./manufacturerHomePositions-Ca80ycLi.cjs");exports.CollisionSceneRenderer=e.CollisionSceneRenderer;exports.MANUFACTURER_HOME_CONFIGS=e.MANUFACTURER_HOME_CONFIGS;exports.PresetEnvironment=e.PresetEnvironment;exports.Robot=e.Robot;exports.RobotCard=e.RobotCard;exports.SafetyZonesRenderer=e.SafetyZonesRenderer;exports.SupportedRobot=e.SupportedRobot;exports.TrajectoryRenderer=e.TrajectoryRenderer;exports.defaultAxisConfig=e.defaultAxisConfig;exports.defaultGetModel=e.defaultGetModel;exports.extractManufacturer=e.extractManufacturer;exports.getDefaultHomeConfig=e.getDefaultHomeConfig;
|
|
2
|
-
//# sourceMappingURL=3d.cjs.js.map
|
package/dist/3d.cjs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3d.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/3d.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { default as CollisionSceneRenderer } from "./components/3d-viewport/collider/CollisionSceneRenderer";
|
|
2
|
-
export * from "./components/3d-viewport/PresetEnvironment";
|
|
3
|
-
export * from "./components/3d-viewport/SafetyZonesRenderer";
|
|
4
|
-
export * from "./components/3d-viewport/TrajectoryRenderer";
|
|
5
|
-
export * from "./components/RobotCard";
|
|
6
|
-
export * from "./components/robots/AxisConfig";
|
|
7
|
-
export { MANUFACTURER_HOME_CONFIGS, extractManufacturer, getDefaultHomeConfig, } from "./components/robots/manufacturerHomePositions";
|
|
8
|
-
export * from "./components/robots/Robot";
|
|
9
|
-
export { defaultGetModel } from "./components/robots/robotModelLogic";
|
|
10
|
-
export * from "./components/robots/SupportedRobot";
|
|
11
|
-
//# sourceMappingURL=3d.d.ts.map
|
package/dist/3d.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3d.d.ts","sourceRoot":"","sources":["../src/3d.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0DAA0D,CAAA;AAC5G,cAAc,4CAA4C,CAAA;AAC1D,cAAc,8CAA8C,CAAA;AAC5D,cAAc,6CAA6C,CAAA;AAC3D,cAAc,wBAAwB,CAAA;AACtC,cAAc,gCAAgC,CAAA;AAC9C,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,+CAA+C,CAAA;AACtD,cAAc,2BAA2B,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AACrE,cAAc,oCAAoC,CAAA"}
|
package/dist/3d.es.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { C as o, M as r, P as t, b as s, R as n, S as d, c as R, T as f, a as C, d as i, e as l, g as u } from "./manufacturerHomePositions-CgaG5vaK.js";
|
|
2
|
-
export {
|
|
3
|
-
o as CollisionSceneRenderer,
|
|
4
|
-
r as MANUFACTURER_HOME_CONFIGS,
|
|
5
|
-
t as PresetEnvironment,
|
|
6
|
-
s as Robot,
|
|
7
|
-
n as RobotCard,
|
|
8
|
-
d as SafetyZonesRenderer,
|
|
9
|
-
R as SupportedRobot,
|
|
10
|
-
f as TrajectoryRenderer,
|
|
11
|
-
C as defaultAxisConfig,
|
|
12
|
-
i as defaultGetModel,
|
|
13
|
-
l as extractManufacturer,
|
|
14
|
-
u as getDefaultHomeConfig
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=3d.es.js.map
|
package/dist/3d.es.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3d.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { A as a, j as t } from "./index-CAib4NKw.js";
|
|
2
|
-
import { useTheme as c, Stack as i, CircularProgress as m, capitalize as g } from "@mui/material";
|
|
3
|
-
import { lowerFirst as d } from "lodash-es";
|
|
4
|
-
import { useState as u, useEffect as f } from "react";
|
|
5
|
-
function h(e) {
|
|
6
|
-
try {
|
|
7
|
-
return JSON.stringify(e);
|
|
8
|
-
} catch {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function S(e, r) {
|
|
13
|
-
throw new Error(r + ` ${JSON.stringify(e)}`);
|
|
14
|
-
}
|
|
15
|
-
function x(e) {
|
|
16
|
-
var r, s, o, n;
|
|
17
|
-
return e instanceof a && e.code === "ERR_NETWORK" ? "Failed to connect to the server. Please check your internet connection." : e instanceof a && e.response ? `${(r = e.response) == null ? void 0 : r.status} ${(s = e.response) == null ? void 0 : s.statusText} from ${(o = e.response) == null ? void 0 : o.config.url}: ${JSON.stringify((n = e.response) == null ? void 0 : n.data)}` : e instanceof Error ? e.message : `Unexpected error: ${h(e) || e}`;
|
|
18
|
-
}
|
|
19
|
-
const T = (e) => {
|
|
20
|
-
const r = e.softTimeout || 3e3, [s, o] = u(!1), n = c();
|
|
21
|
-
return f(() => {
|
|
22
|
-
const l = setTimeout(() => {
|
|
23
|
-
o(!0);
|
|
24
|
-
}, r);
|
|
25
|
-
return () => clearTimeout(l);
|
|
26
|
-
}), /* @__PURE__ */ t.jsx(
|
|
27
|
-
i,
|
|
28
|
-
{
|
|
29
|
-
width: "100%",
|
|
30
|
-
height: "100%",
|
|
31
|
-
alignItems: "center",
|
|
32
|
-
justifyContent: "center",
|
|
33
|
-
sx: { color: n.palette.text.primary },
|
|
34
|
-
children: e.error ? /* @__PURE__ */ t.jsx(
|
|
35
|
-
w,
|
|
36
|
-
{
|
|
37
|
-
loadingMessage: e.message,
|
|
38
|
-
error: e.error
|
|
39
|
-
}
|
|
40
|
-
) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
41
|
-
/* @__PURE__ */ t.jsx(m, { sx: { marginBottom: "24px" } }),
|
|
42
|
-
!!e.message && /* @__PURE__ */ t.jsx("div", { children: e.message }),
|
|
43
|
-
/* @__PURE__ */ t.jsx(
|
|
44
|
-
i,
|
|
45
|
-
{
|
|
46
|
-
sx: {
|
|
47
|
-
visibility: s ? "visible" : "hidden",
|
|
48
|
-
marginTop: "1rem",
|
|
49
|
-
color: n.palette.text.secondary
|
|
50
|
-
},
|
|
51
|
-
children: "This is taking longer than expected..."
|
|
52
|
-
}
|
|
53
|
-
)
|
|
54
|
-
] })
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
}, w = (e) => {
|
|
58
|
-
const r = x(e.error), s = e.error instanceof Error ? e.error.stack : null, o = c();
|
|
59
|
-
return /* @__PURE__ */ t.jsxs(
|
|
60
|
-
i,
|
|
61
|
-
{
|
|
62
|
-
sx: {
|
|
63
|
-
maxHeight: "100%",
|
|
64
|
-
maxWidth: "min(100%, 800px)",
|
|
65
|
-
padding: 2,
|
|
66
|
-
overflow: "auto",
|
|
67
|
-
color: o.palette.error.main,
|
|
68
|
-
"& pre": {
|
|
69
|
-
whiteSpace: "pre-wrap",
|
|
70
|
-
wordBreak: "break-word",
|
|
71
|
-
paddingBottom: "3rem"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
children: [
|
|
75
|
-
(e.loadingMessage ? `Error while ${d(g(e.loadingMessage))} - ` : "") + r,
|
|
76
|
-
/* @__PURE__ */ t.jsx("br", {}),
|
|
77
|
-
s && /* @__PURE__ */ t.jsx("pre", { children: s })
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
};
|
|
82
|
-
export {
|
|
83
|
-
T as L,
|
|
84
|
-
w as a,
|
|
85
|
-
S as b
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=LoadingCover-Dr9hDTku.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingCover-Dr9hDTku.js","sources":["../src/components/utils/converters.ts","../src/components/utils/errorHandling.ts","../src/components/LoadingCover.tsx"],"sourcesContent":["export function radiansToDegree(radians: number): number {\n return radians * (180 / Math.PI)\n}\n\nexport function degreesToRadians(degrees: number): number {\n return degrees * (Math.PI / 180)\n}\n\nexport function tryParseJson(json: unknown): any {\n try {\n return JSON.parse(json as string)\n } catch {\n return undefined\n }\n}\n\nexport function tryStringifyJson(json: unknown): string | undefined {\n try {\n return JSON.stringify(json)\n } catch {\n return undefined\n }\n}\n","import { AxiosError } from \"axios\"\nimport { tryStringifyJson } from \"./converters\"\n\n// Please note: These helper functions also exist in nova.js\n// (with slightly different formatting), and will be unified\n// at some point in the future.\n\nexport function delay(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n\nexport function makeShortErrorMessage(err: unknown) {\n if (err instanceof AxiosError && err.code === \"ERR_NETWORK\") {\n return \"Failed to connect to the server. Please check your internet connection.\"\n } else if (err instanceof AxiosError && err.response) {\n return `${err.response?.status} ${err.response?.statusText}: ${JSON.stringify(err.response?.data)}`\n } else if (err instanceof Error) {\n return err.message\n } else {\n return `Unexpected error: ${err}`\n }\n}\n\nexport function assertUnreachable(x: never, msg: string): never {\n throw new Error(msg + ` ${JSON.stringify(x)}`)\n}\n\nexport function makeErrorMessage(err: unknown) {\n if (err instanceof AxiosError && err.code === \"ERR_NETWORK\") {\n return \"Failed to connect to the server. Please check your internet connection.\"\n } else if (err instanceof AxiosError && err.response) {\n return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`\n } else if (err instanceof Error) {\n return err.message\n } else {\n return `Unexpected error: ${tryStringifyJson(err) || err}`\n }\n}\n","import { capitalize, CircularProgress, Stack, useTheme } from \"@mui/material\"\nimport { lowerFirst } from \"lodash-es\"\nimport { useEffect, useState } from \"react\"\nimport { makeErrorMessage } from \"./utils/errorHandling\"\n\nexport const LoadingCover = (props: {\n message?: string\n error?: unknown\n softTimeout?: number\n}) => {\n const softTimeout = props.softTimeout || 3000\n\n const [showSlowLoadingMessage, setShowSlowLoadingMessage] = useState(false)\n const theme = useTheme()\n\n useEffect(() => {\n const timeout = setTimeout(() => {\n setShowSlowLoadingMessage(true)\n }, softTimeout)\n\n return () => clearTimeout(timeout)\n })\n\n return (\n <Stack\n width=\"100%\"\n height=\"100%\"\n alignItems=\"center\"\n justifyContent=\"center\"\n sx={{ color: theme.palette.text.primary }}\n >\n {props.error ? (\n <LoadingErrorMessage\n loadingMessage={props.message}\n error={props.error}\n />\n ) : (\n <>\n <CircularProgress sx={{ marginBottom: \"24px\" }} />\n {!!props.message && <div>{props.message}</div>}\n <Stack\n sx={{\n visibility: showSlowLoadingMessage ? \"visible\" : \"hidden\",\n marginTop: \"1rem\",\n color: theme.palette.text.secondary,\n }}\n >\n {\"This is taking longer than expected...\"}\n </Stack>\n </>\n )}\n </Stack>\n )\n}\n\nexport const LoadingErrorMessage = (props: {\n loadingMessage?: string\n error: unknown\n}) => {\n const errorMessage = makeErrorMessage(props.error)\n const stack = props.error instanceof Error ? props.error.stack : null\n const theme = useTheme()\n\n return (\n <Stack\n sx={{\n maxHeight: \"100%\",\n maxWidth: \"min(100%, 800px)\",\n padding: 2,\n overflow: \"auto\",\n color: theme.palette.error.main,\n \"& pre\": {\n whiteSpace: \"pre-wrap\",\n wordBreak: \"break-word\",\n paddingBottom: \"3rem\",\n },\n }}\n >\n {(props.loadingMessage\n ? `Error while ${lowerFirst(capitalize(props.loadingMessage))} - `\n : \"\") + errorMessage}\n <br />\n {stack && <pre>{stack}</pre>}\n </Stack>\n )\n}\n"],"names":["tryStringifyJson","json","assertUnreachable","x","msg","makeErrorMessage","err","AxiosError","_a","_b","_c","_d","LoadingCover","props","softTimeout","showSlowLoadingMessage","setShowSlowLoadingMessage","useState","theme","useTheme","useEffect","timeout","jsx","Stack","LoadingErrorMessage","jsxs","Fragment","CircularProgress","errorMessage","stack","lowerFirst","capitalize"],"mappings":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const t=require("./index-DxwppshT.cjs"),n=require("@mui/material"),x=require("lodash-es"),a=require("react");function l(e){try{return JSON.stringify(e)}catch{return}}function m(e,s){throw new Error(s+` ${JSON.stringify(e)}`)}function g(e){var s,r,o,i;return e instanceof t.AxiosError&&e.code==="ERR_NETWORK"?"Failed to connect to the server. Please check your internet connection.":e instanceof t.AxiosError&&e.response?`${(s=e.response)==null?void 0:s.status} ${(r=e.response)==null?void 0:r.statusText} from ${(o=e.response)==null?void 0:o.config.url}: ${JSON.stringify((i=e.response)==null?void 0:i.data)}`:e instanceof Error?e.message:`Unexpected error: ${l(e)||e}`}const d=e=>{const s=e.softTimeout||3e3,[r,o]=a.useState(!1),i=n.useTheme();return a.useEffect(()=>{const u=setTimeout(()=>{o(!0)},s);return()=>clearTimeout(u)}),t.jsxRuntimeExports.jsx(n.Stack,{width:"100%",height:"100%",alignItems:"center",justifyContent:"center",sx:{color:i.palette.text.primary},children:e.error?t.jsxRuntimeExports.jsx(c,{loadingMessage:e.message,error:e.error}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(n.CircularProgress,{sx:{marginBottom:"24px"}}),!!e.message&&t.jsxRuntimeExports.jsx("div",{children:e.message}),t.jsxRuntimeExports.jsx(n.Stack,{sx:{visibility:r?"visible":"hidden",marginTop:"1rem",color:i.palette.text.secondary},children:"This is taking longer than expected..."})]})})},c=e=>{const s=g(e.error),r=e.error instanceof Error?e.error.stack:null,o=n.useTheme();return t.jsxRuntimeExports.jsxs(n.Stack,{sx:{maxHeight:"100%",maxWidth:"min(100%, 800px)",padding:2,overflow:"auto",color:o.palette.error.main,"& pre":{whiteSpace:"pre-wrap",wordBreak:"break-word",paddingBottom:"3rem"}},children:[(e.loadingMessage?`Error while ${x.lowerFirst(n.capitalize(e.loadingMessage))} - `:"")+s,t.jsxRuntimeExports.jsx("br",{}),r&&t.jsxRuntimeExports.jsx("pre",{children:r})]})};exports.LoadingCover=d;exports.LoadingErrorMessage=c;exports.assertUnreachable=m;
|
|
2
|
-
//# sourceMappingURL=LoadingCover-r2yhJZF9.cjs.map
|