@wandelbots/wandelbots-js-react-components 2.41.0-pr.feature-seperate-timer.383.38eb55e → 2.41.0-pr.feature-seperate-timer.383.35a3a58
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/dist/components/jogging/PoseCartesianValues.d.ts.map +1 -1
- package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
- package/dist/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3039 -3071
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/jogging/PoseCartesianValues.tsx +13 -47
- package/src/components/jogging/PoseJointValues.tsx +15 -47
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/wandelbots-js-react-components",
|
|
3
|
-
"version": "2.41.0-pr.feature-seperate-timer.383.
|
|
3
|
+
"version": "2.41.0-pr.feature-seperate-timer.383.35a3a58",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
60
60
|
"@rollup/plugin-terser": "^0.4.4",
|
|
61
61
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
62
|
-
"@storybook/addon-docs": "^9.1.
|
|
63
|
-
"@storybook/react-vite": "^9.1.
|
|
62
|
+
"@storybook/addon-docs": "^9.1.6",
|
|
63
|
+
"@storybook/react-vite": "^9.1.6",
|
|
64
64
|
"@storybook/test-runner": "^0.23.0",
|
|
65
65
|
"@svgr/rollup": "^8.1.0",
|
|
66
66
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@vitejs/plugin-react": "^4.3.4",
|
|
73
73
|
"@wandelbots/nova-js": "^2.1.0",
|
|
74
74
|
"add": "^2.0.6",
|
|
75
|
-
"eslint-plugin-storybook": "^9.1.
|
|
75
|
+
"eslint-plugin-storybook": "^9.1.6",
|
|
76
76
|
"glob": "^11.0.1",
|
|
77
77
|
"http-server": "^14.1.1",
|
|
78
78
|
"husky": "^9.1.7",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
96
96
|
"rollup-plugin-postcss": "^4.0.2",
|
|
97
97
|
"semantic-release": "^24.2.3",
|
|
98
|
-
"storybook": "^9.1.
|
|
98
|
+
"storybook": "^9.1.6",
|
|
99
99
|
"storybook-preset-inline-svg": "^1.0.1",
|
|
100
100
|
"three": "^0.174.0",
|
|
101
101
|
"three-stdlib": "^2.35.14",
|
|
@@ -2,36 +2,13 @@ import { Button, Stack, Typography } from "@mui/material"
|
|
|
2
2
|
import { poseToWandelscriptString } from "@wandelbots/nova-js"
|
|
3
3
|
import type {
|
|
4
4
|
ConnectedMotionGroup,
|
|
5
|
-
MotionGroupStateResponse,
|
|
6
5
|
MotionStreamConnection,
|
|
7
6
|
} from "@wandelbots/nova-js/v1"
|
|
8
7
|
import { observer } from "mobx-react-lite"
|
|
9
8
|
import { useRef, useState } from "react"
|
|
10
9
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
11
10
|
import { CopyableText } from "../CopyableText"
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
/** Minimal interface for what PoseCartesianValues needs from motion stream */
|
|
15
|
-
type MotionStateProvider = {
|
|
16
|
-
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** Creates a motion state provider from either a MotionStreamConnection or ConnectedMotionGroup */
|
|
20
|
-
function createMotionStateProvider(
|
|
21
|
-
motionStream?: MotionStreamConnection,
|
|
22
|
-
connectedMotionGroup?: ConnectedMotionGroup,
|
|
23
|
-
): MotionStateProvider | undefined {
|
|
24
|
-
if (motionStream) {
|
|
25
|
-
return motionStream
|
|
26
|
-
}
|
|
27
|
-
if (connectedMotionGroup) {
|
|
28
|
-
return {
|
|
29
|
-
rapidlyChangingMotionState:
|
|
30
|
-
connectedMotionGroup.rapidlyChangingMotionState,
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return undefined
|
|
34
|
-
}
|
|
11
|
+
import { useAnimationFrame } from "../utils/hooks"
|
|
35
12
|
|
|
36
13
|
export type PoseCartesianValuesProps = {
|
|
37
14
|
/** Either a MotionStreamConnection or ConnectedMotionGroup */
|
|
@@ -50,20 +27,17 @@ export const PoseCartesianValues = externalizeComponent(
|
|
|
50
27
|
const poseHolderRef = useRef<HTMLDivElement>(null)
|
|
51
28
|
const [copyMessage, setCopyMessage] = useState("")
|
|
52
29
|
|
|
53
|
-
|
|
54
|
-
motionStream,
|
|
55
|
-
connectedMotionGroup,
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
if (!activeMotionStream) {
|
|
30
|
+
if (!motionStream && !connectedMotionGroup) {
|
|
59
31
|
throw new Error(
|
|
60
32
|
"PoseCartesianValues requires either motionStream or connectedMotionGroup prop",
|
|
61
33
|
)
|
|
62
34
|
}
|
|
63
35
|
|
|
64
36
|
function getCurrentPoseString() {
|
|
65
|
-
|
|
66
|
-
|
|
37
|
+
const tcpPose = motionStream
|
|
38
|
+
? motionStream.rapidlyChangingMotionState.tcp_pose
|
|
39
|
+
: connectedMotionGroup?.rapidlyChangingMotionState.tcp_pose
|
|
40
|
+
|
|
67
41
|
if (!tcpPose) return ""
|
|
68
42
|
return poseToWandelscriptString(tcpPose)
|
|
69
43
|
}
|
|
@@ -79,24 +53,16 @@ export const PoseCartesianValues = externalizeComponent(
|
|
|
79
53
|
}
|
|
80
54
|
}
|
|
81
55
|
|
|
82
|
-
|
|
83
|
-
if (!poseHolderRef.current
|
|
56
|
+
useAnimationFrame(() => {
|
|
57
|
+
if (!poseHolderRef.current) {
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
const newPoseContent = getCurrentPoseString()
|
|
61
|
+
if (poseHolderRef.current.textContent === newPoseContent) {
|
|
84
62
|
return
|
|
85
63
|
}
|
|
86
64
|
|
|
87
|
-
|
|
88
|
-
if (!tcpPose) return
|
|
89
|
-
|
|
90
|
-
const newPoseContent = poseToWandelscriptString(tcpPose)
|
|
91
|
-
|
|
92
|
-
requestAnimationFrame(() => {
|
|
93
|
-
if (
|
|
94
|
-
poseHolderRef.current &&
|
|
95
|
-
poseHolderRef.current.textContent !== newPoseContent
|
|
96
|
-
) {
|
|
97
|
-
poseHolderRef.current.textContent = newPoseContent
|
|
98
|
-
}
|
|
99
|
-
})
|
|
65
|
+
poseHolderRef.current.textContent = newPoseContent
|
|
100
66
|
})
|
|
101
67
|
|
|
102
68
|
return (
|
|
@@ -1,36 +1,13 @@
|
|
|
1
1
|
import { Button, Stack, Typography } from "@mui/material"
|
|
2
2
|
import type {
|
|
3
3
|
ConnectedMotionGroup,
|
|
4
|
-
MotionGroupStateResponse,
|
|
5
4
|
MotionStreamConnection,
|
|
6
5
|
} from "@wandelbots/nova-js/v1"
|
|
7
6
|
import { observer } from "mobx-react-lite"
|
|
8
7
|
import { useRef, useState } from "react"
|
|
9
8
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
10
9
|
import { CopyableText } from "../CopyableText"
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
/** Minimal interface for what PoseJointValues needs from motion stream */
|
|
14
|
-
type MotionStateProvider = {
|
|
15
|
-
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** Creates a motion state provider from either a MotionStreamConnection or ConnectedMotionGroup */
|
|
19
|
-
function createMotionStateProvider(
|
|
20
|
-
motionStream?: MotionStreamConnection,
|
|
21
|
-
connectedMotionGroup?: ConnectedMotionGroup,
|
|
22
|
-
): MotionStateProvider | undefined {
|
|
23
|
-
if (motionStream) {
|
|
24
|
-
return motionStream
|
|
25
|
-
}
|
|
26
|
-
if (connectedMotionGroup) {
|
|
27
|
-
return {
|
|
28
|
-
rapidlyChangingMotionState:
|
|
29
|
-
connectedMotionGroup.rapidlyChangingMotionState,
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return undefined
|
|
33
|
-
}
|
|
10
|
+
import { useAnimationFrame } from "../utils/hooks"
|
|
34
11
|
|
|
35
12
|
export type PoseJointValuesProps = {
|
|
36
13
|
/** Either a MotionStreamConnection or ConnectedMotionGroup */
|
|
@@ -49,21 +26,19 @@ export const PoseJointValues = externalizeComponent(
|
|
|
49
26
|
const poseHolderRef = useRef<HTMLDivElement>(null)
|
|
50
27
|
const [copyMessage, setCopyMessage] = useState("")
|
|
51
28
|
|
|
52
|
-
|
|
53
|
-
motionStream,
|
|
54
|
-
connectedMotionGroup,
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
if (!activeMotionStream) {
|
|
29
|
+
if (!motionStream && !connectedMotionGroup) {
|
|
58
30
|
throw new Error(
|
|
59
31
|
"PoseJointValues requires either motionStream or connectedMotionGroup prop",
|
|
60
32
|
)
|
|
61
33
|
}
|
|
62
34
|
|
|
63
35
|
function getCurrentPoseString() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
36
|
+
const joints = motionStream
|
|
37
|
+
? motionStream.rapidlyChangingMotionState.state.joint_position.joints
|
|
38
|
+
: connectedMotionGroup?.rapidlyChangingMotionState.state
|
|
39
|
+
.joint_position.joints
|
|
40
|
+
|
|
41
|
+
if (!joints) return ""
|
|
67
42
|
return `[${joints.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
68
43
|
}
|
|
69
44
|
|
|
@@ -78,23 +53,16 @@ export const PoseJointValues = externalizeComponent(
|
|
|
78
53
|
}
|
|
79
54
|
}
|
|
80
55
|
|
|
81
|
-
|
|
82
|
-
if (!poseHolderRef.current
|
|
56
|
+
useAnimationFrame(() => {
|
|
57
|
+
if (!poseHolderRef.current) {
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
const newPoseContent = getCurrentPoseString()
|
|
61
|
+
if (poseHolderRef.current.textContent === newPoseContent) {
|
|
83
62
|
return
|
|
84
63
|
}
|
|
85
64
|
|
|
86
|
-
|
|
87
|
-
activeMotionStream.rapidlyChangingMotionState.state.joint_position
|
|
88
|
-
const newPoseContent = `[${joints.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
89
|
-
|
|
90
|
-
requestAnimationFrame(() => {
|
|
91
|
-
if (
|
|
92
|
-
poseHolderRef.current &&
|
|
93
|
-
poseHolderRef.current.textContent !== newPoseContent
|
|
94
|
-
) {
|
|
95
|
-
poseHolderRef.current.textContent = newPoseContent
|
|
96
|
-
}
|
|
97
|
-
})
|
|
65
|
+
poseHolderRef.current.textContent = newPoseContent
|
|
98
66
|
})
|
|
99
67
|
|
|
100
68
|
return (
|