@wandelbots/wandelbots-js-react-components 2.37.0-pr.feature-states-for-cycle-timer.379.b99a9af → 2.37.0-pr.feature-states-for-cycle-timer.379.6ceb08e
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 +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +166 -146
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CycleTimer/useTimerLogic.ts +2 -2
- package/src/components/jogging/PoseCartesianValues.tsx +27 -9
- package/src/components/jogging/PoseJointValues.tsx +27 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/wandelbots-js-react-components",
|
|
3
|
-
"version": "2.37.0-pr.feature-states-for-cycle-timer.379.
|
|
3
|
+
"version": "2.37.0-pr.feature-states-for-cycle-timer.379.6ceb08e",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -146,7 +146,7 @@ export const useTimerLogic = ({
|
|
|
146
146
|
setTimerState((prev) => ({ ...prev, isRunning: false }))
|
|
147
147
|
startTimeRef.current = null
|
|
148
148
|
if (onCycleEnd) {
|
|
149
|
-
|
|
149
|
+
queueMicrotask(() => onCycleEnd())
|
|
150
150
|
}
|
|
151
151
|
} else if (autoStart) {
|
|
152
152
|
setTimeout(() => {
|
|
@@ -305,7 +305,7 @@ export const useTimerLogic = ({
|
|
|
305
305
|
startTimeRef.current = null
|
|
306
306
|
progressInterpolator.setTarget([100])
|
|
307
307
|
if (onCycleEnd) {
|
|
308
|
-
|
|
308
|
+
queueMicrotask(() => onCycleEnd())
|
|
309
309
|
}
|
|
310
310
|
return
|
|
311
311
|
}
|
|
@@ -2,6 +2,7 @@ import { Button, Stack, Typography } from "@mui/material"
|
|
|
2
2
|
import { poseToWandelscriptString } from "@wandelbots/nova-js"
|
|
3
3
|
import type {
|
|
4
4
|
ConnectedMotionGroup,
|
|
5
|
+
MotionGroupStateResponse,
|
|
5
6
|
MotionStreamConnection,
|
|
6
7
|
} from "@wandelbots/nova-js/v1"
|
|
7
8
|
import { observer } from "mobx-react-lite"
|
|
@@ -9,6 +10,28 @@ import { useRef, useState } from "react"
|
|
|
9
10
|
import { CopyableText } from "../CopyableText"
|
|
10
11
|
import { useAnimationFrame } from "../utils/hooks"
|
|
11
12
|
|
|
13
|
+
/** Minimal interface for what PoseCartesianValues 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
|
+
}
|
|
34
|
+
|
|
12
35
|
export type PoseCartesianValuesProps = {
|
|
13
36
|
/** Either a MotionStreamConnection or ConnectedMotionGroup */
|
|
14
37
|
motionStream?: MotionStreamConnection
|
|
@@ -25,15 +48,10 @@ export const PoseCartesianValues = observer(
|
|
|
25
48
|
const poseHolderRef = useRef<HTMLDivElement>(null)
|
|
26
49
|
const [copyMessage, setCopyMessage] = useState("")
|
|
27
50
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
? ({
|
|
33
|
-
rapidlyChangingMotionState:
|
|
34
|
-
connectedMotionGroup.rapidlyChangingMotionState,
|
|
35
|
-
} as MotionStreamConnection)
|
|
36
|
-
: undefined)
|
|
51
|
+
const activeMotionStream = createMotionStateProvider(
|
|
52
|
+
motionStream,
|
|
53
|
+
connectedMotionGroup,
|
|
54
|
+
)
|
|
37
55
|
|
|
38
56
|
if (!activeMotionStream) {
|
|
39
57
|
throw new Error(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Button, Stack, Typography } from "@mui/material"
|
|
2
2
|
import type {
|
|
3
3
|
ConnectedMotionGroup,
|
|
4
|
+
MotionGroupStateResponse,
|
|
4
5
|
MotionStreamConnection,
|
|
5
6
|
} from "@wandelbots/nova-js/v1"
|
|
6
7
|
import { observer } from "mobx-react-lite"
|
|
@@ -8,6 +9,28 @@ import { useRef, useState } from "react"
|
|
|
8
9
|
import { CopyableText } from "../CopyableText"
|
|
9
10
|
import { useAnimationFrame } from "../utils/hooks"
|
|
10
11
|
|
|
12
|
+
/** Minimal interface for what PoseJointValues needs from motion stream */
|
|
13
|
+
type MotionStateProvider = {
|
|
14
|
+
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Creates a motion state provider from either a MotionStreamConnection or ConnectedMotionGroup */
|
|
18
|
+
function createMotionStateProvider(
|
|
19
|
+
motionStream?: MotionStreamConnection,
|
|
20
|
+
connectedMotionGroup?: ConnectedMotionGroup,
|
|
21
|
+
): MotionStateProvider | undefined {
|
|
22
|
+
if (motionStream) {
|
|
23
|
+
return motionStream
|
|
24
|
+
}
|
|
25
|
+
if (connectedMotionGroup) {
|
|
26
|
+
return {
|
|
27
|
+
rapidlyChangingMotionState:
|
|
28
|
+
connectedMotionGroup.rapidlyChangingMotionState,
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
11
34
|
export type PoseJointValuesProps = {
|
|
12
35
|
/** Either a MotionStreamConnection or ConnectedMotionGroup */
|
|
13
36
|
motionStream?: MotionStreamConnection
|
|
@@ -24,15 +47,10 @@ export const PoseJointValues = observer(
|
|
|
24
47
|
const poseHolderRef = useRef<HTMLDivElement>(null)
|
|
25
48
|
const [copyMessage, setCopyMessage] = useState("")
|
|
26
49
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
? ({
|
|
32
|
-
rapidlyChangingMotionState:
|
|
33
|
-
connectedMotionGroup.rapidlyChangingMotionState,
|
|
34
|
-
} as MotionStreamConnection)
|
|
35
|
-
: undefined)
|
|
50
|
+
const activeMotionStream = createMotionStateProvider(
|
|
51
|
+
motionStream,
|
|
52
|
+
connectedMotionGroup,
|
|
53
|
+
)
|
|
36
54
|
|
|
37
55
|
if (!activeMotionStream) {
|
|
38
56
|
throw new Error(
|