@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.bd2ec84 → 6.4.0-pr.revamp.667.ca77f09

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 (154) hide show
  1. package/README.md +172 -40
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +3 -4
  4. package/dist/3d.js +35 -38
  5. package/dist/CurrentPose/index.cjs +1 -1
  6. package/dist/CurrentPose/index.js +2 -2
  7. package/dist/CurrentPoseBar/index.cjs +1 -1
  8. package/dist/CurrentPoseBar/index.js +1 -1
  9. package/dist/JoggingButtons/index.cjs +1 -1
  10. package/dist/JoggingButtons/index.js +1 -1
  11. package/dist/JoggingGizmo/index.cjs +1 -1
  12. package/dist/JoggingGizmo/index.js +2 -2
  13. package/dist/JoggingJointSlider/index.cjs +1 -1
  14. package/dist/JoggingJointSlider/index.js +1 -1
  15. package/dist/RobotControl/index.cjs +1 -1
  16. package/dist/RobotControl/index.js +2 -2
  17. package/dist/RobotControlPanel/index.cjs +1 -1
  18. package/dist/RobotControlPanel/index.d.ts +1 -1
  19. package/dist/RobotControlPanel/index.js +1 -1
  20. package/dist/RobotHeader/index.cjs +1 -1
  21. package/dist/RobotHeader/index.d.ts +3 -5
  22. package/dist/RobotHeader/index.js +6 -7
  23. package/dist/RobotScene/index.cjs +1 -1
  24. package/dist/RobotScene/index.js +3 -3
  25. package/dist/RobotView/index.cjs +1 -1
  26. package/dist/RobotView/index.js +2 -2
  27. package/dist/SafetyBar/IndicatorWithExplanation.d.ts +12 -1
  28. package/dist/SafetyBar/SafetyBar.d.ts +15 -1
  29. package/dist/SafetyBar/index.cjs +1 -1
  30. package/dist/SafetyBar/index.d.ts +0 -1
  31. package/dist/SafetyBar/index.js +3 -4
  32. package/dist/SafetyBar/robotSafetyOf.d.ts +1 -0
  33. package/dist/chunks/{ConnectedMotionGroup-BifrgwV1.js → ConnectedMotionGroup-DNYakgxy.js} +6 -5
  34. package/dist/chunks/ConnectedMotionGroup-IRTsTxwB.cjs +3 -0
  35. package/dist/chunks/{CurrentPose-CMqO8oqX.cjs → CurrentPose-CAq9e9JY.cjs} +1 -1
  36. package/dist/chunks/{CurrentPose-CdD2ZB7B.js → CurrentPose-CgdINEh2.js} +3 -3
  37. package/dist/chunks/{CurrentPoseBar-CX1xFBtm.js → CurrentPoseBar--HkZBGnN.js} +11 -11
  38. package/dist/chunks/{CurrentPoseBar-BTBAwIO4.cjs → CurrentPoseBar-DoOUfRRs.cjs} +1 -1
  39. package/dist/chunks/{JoggingButtons-aijK-3g6.js → JoggingButtons-BNOnpcTH.js} +1 -1
  40. package/dist/chunks/{JoggingButtons-BOHl7hVq.cjs → JoggingButtons-Boaym2hQ.cjs} +1 -1
  41. package/dist/chunks/{JoggingGizmo-CoKYUtXq.cjs → JoggingGizmo-CNFjpWDv.cjs} +1 -1
  42. package/dist/chunks/{JoggingGizmo-DHvrJouR.js → JoggingGizmo-RDiEVQes.js} +1 -1
  43. package/dist/chunks/{JoggingGizmoOrientation-CIvIAIeO.js → JoggingGizmoOrientation-Dzzz2gEz.js} +1 -1
  44. package/dist/chunks/{JoggingGizmoOrientation-DVcagPRJ.cjs → JoggingGizmoOrientation-laUrgY0N.cjs} +1 -1
  45. package/dist/chunks/{JoggingJointSlider-DQtt4-pa.js → JoggingJointSlider-BY-Tof8G.js} +1 -1
  46. package/dist/chunks/{JoggingJointSlider-CTFYKzsU.cjs → JoggingJointSlider-Dm3vILd3.cjs} +1 -1
  47. package/dist/chunks/{JoggingRefusedError-BIkUM6-g.js → JoggingRefusedError-C4D8_YR_.js} +5 -3
  48. package/dist/chunks/JoggingRefusedError-DqyrfUcc.cjs +1 -0
  49. package/dist/chunks/Pose3-BfBNPRDM.cjs +1 -0
  50. package/dist/chunks/{Pose3-B_fLR-Wv.js → Pose3-DWxfC6Dj.js} +1 -2
  51. package/dist/chunks/{Robot-C-IWfxP9.js → Robot-B-VAYuAr.js} +5 -5
  52. package/dist/chunks/{Robot-Cfhjv9Z8.cjs → Robot-DRf8T9Zf.cjs} +1 -1
  53. package/dist/chunks/RobotActivation-CRVxXvlx.cjs +1 -0
  54. package/dist/chunks/RobotActivation-oR-8Y0iq.js +143 -0
  55. package/dist/chunks/RobotControl-Dbe50ZKM.cjs +1 -0
  56. package/dist/chunks/RobotControl-Ms1F7fFe.js +332 -0
  57. package/dist/chunks/RobotControlPanel-B7NxoHsO.cjs +1 -0
  58. package/dist/chunks/RobotControlPanel-CkQlkq8x.js +1029 -0
  59. package/dist/chunks/RobotHeader-CjOaf9s6.cjs +1 -0
  60. package/dist/chunks/RobotHeader-LSuRTDFB.js +395 -0
  61. package/dist/chunks/RobotScene-Au6zpHH1.cjs +1 -0
  62. package/dist/chunks/RobotScene-C6XEgaVR.js +1284 -0
  63. package/dist/chunks/RobotSessionProvider-CoF_tX0O.cjs +1 -0
  64. package/dist/chunks/RobotSessionProvider-DuHi-dtw.js +30 -0
  65. package/dist/chunks/{RobotView-BGYlAWj-.cjs → RobotView-Cg6JfGiY.cjs} +1 -1
  66. package/dist/chunks/{RobotView-D-v8jCM7.js → RobotView-CrAxNkyG.js} +3 -3
  67. package/dist/chunks/{robotSafetyOf-DuKKma1_.js → SafetyBar-C85BAKsL.js} +244 -215
  68. package/dist/chunks/SafetyBar-D2l81Omq.cjs +1 -0
  69. package/dist/chunks/externalizeComponent-CA_sHzyH.cjs +2 -0
  70. package/dist/chunks/{externalizeComponent-4juwPKL5.js → externalizeComponent-CChY_1bN.js} +34 -8
  71. package/dist/chunks/{useSmoothedMotionState-BSSV8aZN.js → hooks-BWoeBWLV.js} +43 -87
  72. package/dist/chunks/hooks-BXe2bNMo.cjs +1 -0
  73. package/dist/chunks/loadRobotSession-BzY9H3F8.cjs +1 -0
  74. package/dist/chunks/{loadRobotSession-GHHtv5dv.js → loadRobotSession-Ts2MumBB.js} +1065 -679
  75. package/dist/chunks/poseText-BxG4Caa-.js +48 -0
  76. package/dist/chunks/poseText-CwplkbDM.cjs +1 -0
  77. package/dist/chunks/useSmoothedMotionState-CCXmMZ0S.cjs +1 -0
  78. package/dist/chunks/useSmoothedMotionState-CELh-YJa.js +50 -0
  79. package/dist/components/VelocitySlider.d.ts +14 -1
  80. package/dist/components/connectionWarning/ConnectionWarning.d.ts +18 -4
  81. package/dist/components/connectionWarning/connectionWarningOf.d.ts +1 -11
  82. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +7 -1
  83. package/dist/components/jogging/JoggingCartesianTab.d.ts +6 -0
  84. package/dist/components/jogging/JoggingJointTab.d.ts +5 -0
  85. package/dist/components/jogging/JoggingJointValueControl.d.ts +7 -1
  86. package/dist/components/jogging/JoggingPanel.d.ts +11 -0
  87. package/dist/components/jogging/JoggingRefusedError.d.ts +8 -3
  88. package/dist/components/jogging/JoggingStore.d.ts +206 -17
  89. package/dist/components/jogging/joggingColors.d.ts +6 -0
  90. package/dist/components/robotControl/CartesianJogTab.d.ts +14 -3
  91. package/dist/components/robotControl/JogArea.d.ts +6 -3
  92. package/dist/components/robotControl/JogDisabledReason.d.ts +15 -0
  93. package/dist/components/robotControl/JointJogTab.d.ts +10 -2
  94. package/dist/components/robotControl/MoveToTab.d.ts +24 -3
  95. package/dist/components/robotControl/PoseField.d.ts +3 -1
  96. package/dist/components/robotControl/RobotControl.d.ts +3 -0
  97. package/dist/components/robotControl/RobotControlPanel.d.ts +91 -22
  98. package/dist/components/robotControl/VelocityRow.d.ts +8 -2
  99. package/dist/components/robotControl/atPose.d.ts +6 -0
  100. package/dist/components/robotControl/poseText.d.ts +13 -1
  101. package/dist/components/robotControl/units.d.ts +10 -2
  102. package/dist/components/robotControl/useRobotControlProps.d.ts +7 -4
  103. package/dist/components/robotControl/velocityText.d.ts +18 -0
  104. package/dist/components/robotHeader/ActivationSwitch.d.ts +13 -2
  105. package/dist/components/robotHeader/RobotHeader.d.ts +25 -4
  106. package/dist/components/robotHeader/robotActivationOf.d.ts +1 -8
  107. package/dist/components/robotScene/RobotScene.d.ts +7 -1
  108. package/dist/components/robots/MotionGroupVisualizer.d.ts +6 -4
  109. package/dist/components/robots/SupportedLinearAxis.d.ts +6 -4
  110. package/dist/components/robots/SupportedRobot.d.ts +7 -5
  111. package/dist/components/robots/useFrameSmoothedMotionState.d.ts +25 -0
  112. package/dist/components/utils/useSmoothedMotionState.d.ts +11 -2
  113. package/dist/core.cjs +1 -1
  114. package/dist/core.d.ts +8 -10
  115. package/dist/core.js +60 -69
  116. package/dist/index.cjs +1 -1
  117. package/dist/index.js +100 -113
  118. package/dist/lib/ConnectedMotionGroup.d.ts +11 -0
  119. package/dist/lib/ControllerStateStream.d.ts +9 -9
  120. package/dist/lib/JoggerConnection.d.ts +48 -13
  121. package/dist/lib/MotionStreamConnection.d.ts +3 -2
  122. package/dist/lib/TrajectoryExecutionStore.d.ts +58 -20
  123. package/dist/lib/controllerStateSource.d.ts +6 -5
  124. package/dist/lib/robotSession/RobotActivation.d.ts +52 -21
  125. package/dist/lib/robotSession/RobotSession.d.ts +27 -8
  126. package/dist/lib/robotSession/RobotTargetPose.d.ts +4 -2
  127. package/dist/lib/robotSession/loadRobotSession.d.ts +1 -1
  128. package/dist/lib/robotSession/robotPose.d.ts +0 -6
  129. package/dist/session.cjs +1 -1
  130. package/dist/session.d.ts +6 -6
  131. package/dist/session.js +30 -38
  132. package/package.json +22 -1
  133. package/dist/chunks/ConnectedMotionGroup-CybwJHkh.cjs +0 -3
  134. package/dist/chunks/JoggingRefusedError-BuCGsVsa.cjs +0 -1
  135. package/dist/chunks/Pose3-Ch4xVeXV.cjs +0 -1
  136. package/dist/chunks/RobotActivation-Bb0oNSBN.cjs +0 -1
  137. package/dist/chunks/RobotActivation-C0rrwpQZ.js +0 -115
  138. package/dist/chunks/RobotControl-Cv6Sr1Ni.js +0 -289
  139. package/dist/chunks/RobotControl-DFnOYMAa.cjs +0 -1
  140. package/dist/chunks/RobotControlPanel-B1_9g9D-.js +0 -850
  141. package/dist/chunks/RobotControlPanel-BpTpRBgy.cjs +0 -1
  142. package/dist/chunks/RobotScene-0ZJzXL50.cjs +0 -1
  143. package/dist/chunks/RobotScene-DpFeFpnx.js +0 -1255
  144. package/dist/chunks/RobotSessionProvider--AekyPqD.cjs +0 -1
  145. package/dist/chunks/RobotSessionProvider-TVaKGzqa.js +0 -25
  146. package/dist/chunks/externalizeComponent-Br_U-QAr.cjs +0 -2
  147. package/dist/chunks/loadRobotSession-DYbeNnTI.cjs +0 -1
  148. package/dist/chunks/poseText-BXUaQWnK.cjs +0 -1
  149. package/dist/chunks/poseText-pg4cxE8R.js +0 -41
  150. package/dist/chunks/robotActivationOf-B4oV10Za.cjs +0 -1
  151. package/dist/chunks/robotActivationOf-EzcT9g07.js +0 -368
  152. package/dist/chunks/robotSafetyOf-Dxm6s7Pp.cjs +0 -1
  153. package/dist/chunks/useSmoothedMotionState-B9WO73k0.cjs +0 -1
  154. package/dist/components/robotHeader/robotSafetyOf.d.ts +0 -11
@@ -1,850 +0,0 @@
1
- import { jsxs as m, jsx as o, Fragment as V } from "react/jsx-runtime";
2
- import Z from "@mui/material/IconButton";
3
- import R from "@mui/material/Stack";
4
- import G from "@mui/material/Tab";
5
- import tt from "@mui/material/Tabs";
6
- import F from "@mui/material/Typography";
7
- import { CloseFilled as j } from "@wandelbots/icons/CloseFilled";
8
- import { useState as A, useId as ot, useRef as J, useEffect as L } from "react";
9
- import { useTranslation as k } from "react-i18next";
10
- import { e as nt } from "./externalizeComponent-4juwPKL5.js";
11
- import X from "@mui/material/Divider";
12
- import z from "@mui/material/Tooltip";
13
- import { Jog as et } from "@wandelbots/icons/Jog";
14
- import { ViewModuleFilled as rt } from "@wandelbots/icons/ViewModuleFilled";
15
- import { J as lt } from "./JoggingGizmo-DHvrJouR.js";
16
- import { J as at } from "./JoggingButtons-aijK-3g6.js";
17
- import { i as it } from "./useWebGLRenderer-BozrbZz-.js";
18
- import { styled as ct } from "@mui/material/styles";
19
- import K from "@mui/material/ToggleButton";
20
- import st from "@mui/material/ToggleButtonGroup";
21
- import { P as O, I as ut, a as pt, u as Q } from "./useEveryFrame-D04ygIe7.js";
22
- import dt from "@mui/material/Slider";
23
- import { J as ft } from "./JoggingJointSlider-DQtt4-pa.js";
24
- import { CachedFilled as bt } from "@wandelbots/icons/CachedFilled";
25
- import { Undo as gt } from "@wandelbots/icons/Undo";
26
- import { PrimaryButton as mt, AdornedTextField as ht, RoundedIconButton as P } from "@wandelbots/mui";
27
- import { NorthEastFilled as Ct } from "@wandelbots/icons/NorthEastFilled";
28
- import { d as xt } from "./joggingColors-sb6IFdj2.js";
29
- import { CheckFilled as U } from "@wandelbots/icons/CheckFilled";
30
- import { ContentCopyFilled as vt } from "@wandelbots/icons/ContentCopyFilled";
31
- import { EditFilled as Rt } from "@wandelbots/icons/EditFilled";
32
- import { b as q, a as Mt } from "./poseText-pg4cxE8R.js";
33
- function Tt({
34
- view: t,
35
- onViewChange: n,
36
- mode: e,
37
- controls: a,
38
- gizmoOrientation: i,
39
- gizmoFrameQuaternion: p
40
- }) {
41
- const { t: r } = k(), [l, u] = A(it), d = i !== void 0 && l, c = t === "gizmo" && d, f = r(c ? e === "increment" ? "RobotControl.JogArea.Hint.ClickHandle.lb" : "RobotControl.JogArea.Hint.HoldHandle.lb" : e === "increment" ? "RobotControl.JogArea.Hint.ClickButton.lb" : "RobotControl.JogArea.Hint.HoldButton.lb"), g = r(c ? "RobotControl.JogArea.ShowButtons.bt" : "RobotControl.JogArea.ShowGizmo.bt");
42
- return /* @__PURE__ */ m(
43
- R,
44
- {
45
- "data-testid": "jog-area",
46
- sx: { position: "relative", alignItems: "center", gap: "16px" },
47
- children: [
48
- d && /* @__PURE__ */ o(z, { title: g, placement: "left", children: /* @__PURE__ */ o(
49
- Z,
50
- {
51
- "aria-label": g,
52
- onClick: () => n(c ? "buttons" : "gizmo"),
53
- size: "small",
54
- sx: (b) => {
55
- var s;
56
- return {
57
- position: "absolute",
58
- top: 0,
59
- right: 0,
60
- zIndex: 1,
61
- borderRadius: "8px",
62
- border: `1px solid ${b.palette.divider}`,
63
- background: (s = b.palette.backgroundPaperElevation) == null ? void 0 : s[11]
64
- };
65
- },
66
- children: c ? /* @__PURE__ */ o(rt, {}) : /* @__PURE__ */ o(et, {})
67
- }
68
- ) }),
69
- c ? /* @__PURE__ */ o(
70
- lt,
71
- {
72
- ...a,
73
- orientation: i,
74
- frameQuaternion: p,
75
- size: 180,
76
- onWebGLUnavailable: () => u(!1)
77
- }
78
- ) : /* @__PURE__ */ o(at, { ...a }),
79
- /* @__PURE__ */ o(F, { variant: "body2", color: "text.secondary", textAlign: "center", children: f })
80
- ]
81
- }
82
- );
83
- }
84
- const yt = ct(st)(({ theme: t }) => {
85
- var n;
86
- return {
87
- gap: "4px",
88
- "& .MuiToggleButton-root": {
89
- border: "none",
90
- borderRadius: "8px",
91
- padding: "6px 16px",
92
- textTransform: "none",
93
- fontSize: "14px",
94
- color: t.palette.text.secondary
95
- },
96
- "& .MuiToggleButton-root.Mui-selected": {
97
- color: t.palette.text.primary,
98
- background: (n = t.palette.backgroundPaperElevation) == null ? void 0 : n[11]
99
- }
100
- };
101
- });
102
- function St({
103
- value: t,
104
- onChange: n,
105
- disabled: e
106
- }) {
107
- const { t: a } = k();
108
- return /* @__PURE__ */ m(
109
- yt,
110
- {
111
- exclusive: !0,
112
- value: t,
113
- disabled: e,
114
- "aria-label": a("RobotControl.JogMode.lb"),
115
- onChange: (i, p) => {
116
- p !== null && n(p);
117
- },
118
- children: [
119
- /* @__PURE__ */ o(K, { value: "continuous", children: a("RobotControl.JogMode.Continuous.bt") }),
120
- /* @__PURE__ */ o(K, { value: "increment", children: a("RobotControl.JogMode.Increment.bt") })
121
- ]
122
- }
123
- );
124
- }
125
- function E({ children: t }) {
126
- return /* @__PURE__ */ o(R, { sx: { padding: "16px 20px", gap: "16px" }, children: t });
127
- }
128
- function wt(t) {
129
- return t * 180 / Math.PI;
130
- }
131
- function Jt(t) {
132
- return t * Math.PI / 180;
133
- }
134
- function _(t, n) {
135
- return t === "rotate" ? wt(n) : n;
136
- }
137
- function kt(t, n) {
138
- return t === "rotate" ? Jt(n) : n;
139
- }
140
- function It(t, n) {
141
- const e = String(Number(_(t, n).toFixed(2)));
142
- return t === "rotate" ? `${e}°` : `${e} mm`;
143
- }
144
- function At(t, n) {
145
- const e = Math.round(_(t, n));
146
- return t === "rotate" ? `${e}°/s` : `${e} mm/s`;
147
- }
148
- function D({
149
- motion: t,
150
- velocity: n,
151
- onChange: e,
152
- disabled: a
153
- }) {
154
- const { t: i } = k(), p = ot(), r = (l) => _(t, l);
155
- return /* @__PURE__ */ m(R, { gap: "4px", children: [
156
- /* @__PURE__ */ m(R, { direction: "row", sx: { justifyContent: "space-between" }, children: [
157
- /* @__PURE__ */ o(F, { id: p, variant: "body2", color: "text.secondary", children: i("RobotControl.Velocity.lb") }),
158
- /* @__PURE__ */ o(
159
- F,
160
- {
161
- variant: "body2",
162
- color: "text.primary",
163
- sx: { fontVariantNumeric: "tabular-nums" },
164
- children: At(t, n.value)
165
- }
166
- )
167
- ] }),
168
- /* @__PURE__ */ o(
169
- dt,
170
- {
171
- "aria-labelledby": p,
172
- size: "small",
173
- value: Math.round(r(n.value)),
174
- min: Math.ceil(r(n.min)),
175
- max: Math.floor(r(n.max)),
176
- disabled: a,
177
- onChange: (l, u) => {
178
- typeof u == "number" && e(kt(t, u));
179
- },
180
- sx: (l) => {
181
- var u;
182
- return {
183
- // The rail and the hollow thumb of the joint sliders, as in the
184
- // design: a 4 px rail (the small slider's is 2 px)
185
- height: 4,
186
- "& .MuiSlider-rail": { opacity: 0.38 },
187
- "& .MuiSlider-thumb": {
188
- width: 16,
189
- height: 16,
190
- border: `3px solid ${l.palette.primary.main}`,
191
- backgroundColor: (u = l.palette.backgroundPaperElevation) == null ? void 0 : u[5]
192
- }
193
- };
194
- }
195
- }
196
- )
197
- ] });
198
- }
199
- function Pt({
200
- motion: t,
201
- settings: n,
202
- onSettingsChange: e,
203
- disabled: a = !1,
204
- tcp: i,
205
- jogFrame: p,
206
- velocity: r,
207
- onVelocityChange: l,
208
- onJogStart: u,
209
- onJogStop: d,
210
- increments: c,
211
- gizmoOrientation: f,
212
- gizmoFrameQuaternion: g
213
- }) {
214
- const { t: b } = k(), s = c ? n.mode : "continuous", M = (c == null ? void 0 : c.steps[t]) ?? [], T = Math.min(n.step[t], M.length - 1), C = M[T], y = J(!1);
215
- function S(h, w) {
216
- if (s === "increment") {
217
- c && C !== void 0 && c.onStep(t, h, w, C);
218
- return;
219
- }
220
- y.current = !0, u(t, h, w);
221
- }
222
- function I() {
223
- y.current && (y.current = !1, d());
224
- }
225
- return /* @__PURE__ */ m(V, { children: [
226
- (i || p) && /* @__PURE__ */ m(V, { children: [
227
- /* @__PURE__ */ o(E, { children: /* @__PURE__ */ m(R, { direction: "row", sx: { gap: "12px" }, children: [
228
- i && /* @__PURE__ */ o(
229
- O,
230
- {
231
- label: b("RobotControl.Tcp.lb"),
232
- ...i,
233
- disabled: a
234
- }
235
- ),
236
- p && /* @__PURE__ */ o(
237
- O,
238
- {
239
- label: b("RobotControl.JogFrame.lb"),
240
- ...p,
241
- disabled: a
242
- }
243
- )
244
- ] }) }),
245
- /* @__PURE__ */ o(X, { sx: { marginX: "20px" } })
246
- ] }),
247
- /* @__PURE__ */ m(E, { children: [
248
- c && /* @__PURE__ */ o(
249
- St,
250
- {
251
- value: s,
252
- onChange: (h) => e({ ...n, mode: h }),
253
- disabled: a
254
- }
255
- ),
256
- /* @__PURE__ */ o(
257
- D,
258
- {
259
- motion: t,
260
- velocity: r[t],
261
- onChange: (h) => l(t, h),
262
- disabled: a
263
- }
264
- ),
265
- s === "increment" && C !== void 0 && /* @__PURE__ */ o(
266
- ut,
267
- {
268
- label: b("RobotControl.StepSize.lb"),
269
- value: String(T),
270
- options: M.map((h, w) => ({
271
- id: String(w),
272
- label: It(t, h)
273
- })),
274
- onChange: (h) => e({
275
- ...n,
276
- step: { ...n.step, [t]: Number(h) }
277
- }),
278
- disabled: a
279
- }
280
- )
281
- ] }),
282
- /* @__PURE__ */ o(X, { sx: { marginX: "20px" } }),
283
- /* @__PURE__ */ o(E, { children: /* @__PURE__ */ o(
284
- Tt,
285
- {
286
- view: n.view,
287
- onViewChange: (h) => e({ ...n, view: h }),
288
- mode: s,
289
- controls: {
290
- motion: t,
291
- onJogStart: S,
292
- onJogStop: I,
293
- activeHandle: s === "increment" ? c == null ? void 0 : c.running : null,
294
- disabled: a
295
- },
296
- gizmoOrientation: f,
297
- gizmoFrameQuaternion: g
298
- },
299
- s
300
- ) })
301
- ] });
302
- }
303
- function Et({
304
- joints: t,
305
- disabled: n
306
- }) {
307
- const e = J(null), [a, i] = A(null);
308
- function p(l, u) {
309
- e.current !== null && e.current !== l || (e.current = l, i(l), t.onJogStart(l, u));
310
- }
311
- function r(l) {
312
- e.current === l && (e.current = null, i(null), t.onJogStop());
313
- }
314
- return /* @__PURE__ */ m(V, { children: [
315
- /* @__PURE__ */ o(E, { children: /* @__PURE__ */ o(R, { sx: { gap: "8px", paddingX: "4px" }, children: t.joints.map((l, u) => /* @__PURE__ */ o(
316
- ft,
317
- {
318
- label: `J${u + 1}`,
319
- name: l.name,
320
- value: l.value,
321
- min: l.min,
322
- max: l.max,
323
- linear: t.linear,
324
- onJogStart: (d) => p(u, d),
325
- onJogStop: () => r(u),
326
- disabled: n || a !== null && a !== u
327
- },
328
- u
329
- )) }) }),
330
- /* @__PURE__ */ o(X, { sx: { marginX: "20px" } }),
331
- /* @__PURE__ */ o(E, { children: /* @__PURE__ */ o(
332
- D,
333
- {
334
- motion: t.linear ? "translate" : "rotate",
335
- velocity: t.velocity,
336
- onChange: t.onVelocityChange,
337
- disabled: n
338
- }
339
- ) })
340
- ] });
341
- }
342
- const zt = 0.5, Bt = 0.01;
343
- function Lt(t, n) {
344
- return t ? Math.hypot(
345
- t.position[0] - n.position[0],
346
- t.position[1] - n.position[1],
347
- t.position[2] - n.position[2]
348
- ) <= zt && Vt(t.orientation, n.orientation) <= Bt : !1;
349
- }
350
- function Y(t) {
351
- const n = Math.hypot(...t);
352
- if (n < 1e-12) return [1, 0, 0, 0];
353
- const e = Math.sin(n / 2) / n;
354
- return [
355
- Math.cos(n / 2),
356
- t[0] * e,
357
- t[1] * e,
358
- t[2] * e
359
- ];
360
- }
361
- function Vt(t, n) {
362
- const e = Y(t), a = Y(n), i = Math.abs(e[0] * a[0] + e[1] * a[1] + e[2] * a[2] + e[3] * a[3]);
363
- return 2 * Math.acos(Math.min(1, i));
364
- }
365
- const Ft = "move", Ht = 200;
366
- function Gt({
367
- state: t,
368
- ready: n,
369
- atPose: e,
370
- disabled: a,
371
- onMoveStart: i,
372
- onMoveStop: p,
373
- stopRef: r
374
- }) {
375
- const { t: l } = k(), [u, d] = A(!1), c = J(void 0), f = J(!1), g = J({ onMoveStart: i, onMoveStop: p });
376
- g.current = { onMoveStart: i, onMoveStop: p };
377
- const b = t === "planned", s = b || t === "moving", { handlersFor: M, stop: T } = xt({
378
- onStart: () => {
379
- d(!0), c.current = setTimeout(() => {
380
- c.current = void 0, f.current = !0, g.current.onMoveStart();
381
- }, Ht);
382
- },
383
- onStop: () => {
384
- d(!1), clearTimeout(c.current), c.current = void 0, f.current && (f.current = !1, g.current.onMoveStop());
385
- },
386
- disabled: u ? a || !n || !s : a || !n || e || !b,
387
- isSame: () => !0
388
- });
389
- r && (r.current = T), L(() => () => clearTimeout(c.current), []);
390
- const C = l(t === "moving" ? "RobotControl.MoveTo.Moving.bt" : t === "stopping" ? "RobotControl.MoveTo.Stopping.bt" : "RobotControl.MoveTo.MoveTo.bt");
391
- return /* @__PURE__ */ o(
392
- z,
393
- {
394
- title: l(e ? "RobotControl.MoveTo.AtPose.lb" : "RobotControl.MoveTo.HoldToMove.lb"),
395
- placement: "top",
396
- children: /* @__PURE__ */ o(
397
- "span",
398
- {
399
- ...M(Ft),
400
- style: {
401
- display: "block",
402
- flexGrow: 1,
403
- touchAction: "none",
404
- userSelect: "none"
405
- },
406
- children: /* @__PURE__ */ o(
407
- mt,
408
- {
409
- fullWidth: !0,
410
- disabled: a || !n || e || !s,
411
- loading: t === "planning" || t === "stopping",
412
- loadingPosition: "start",
413
- startIcon: /* @__PURE__ */ o(Ct, {}),
414
- "aria-pressed": u,
415
- children: C
416
- }
417
- )
418
- }
419
- )
420
- }
421
- );
422
- }
423
- function Ot({
424
- text: t,
425
- editing: n,
426
- onEdit: e,
427
- onDraftChange: a,
428
- onCancel: i,
429
- onConfirm: p,
430
- canConfirm: r,
431
- error: l,
432
- disabled: u
433
- }) {
434
- const { t: d } = k(), c = J(null), { copied: f, copy: g } = pt();
435
- L(() => {
436
- const s = c.current;
437
- s && (n ? (s.focus(), s.setSelectionRange(s.value.length, s.value.length)) : document.activeElement === s && (s.blur(), s.scrollLeft = 0));
438
- }, [n]);
439
- function b() {
440
- return g(t, () => {
441
- var s;
442
- return (s = c.current) == null ? void 0 : s.select();
443
- });
444
- }
445
- return /* @__PURE__ */ m(R, { direction: "row", sx: { gap: "8px", alignItems: "flex-start" }, children: [
446
- /* @__PURE__ */ o(
447
- ht,
448
- {
449
- label: d("RobotControl.MoveTo.Coordinates.lb"),
450
- value: t,
451
- inputRef: c,
452
- onChange: (s) => a(s.target.value),
453
- onClick: () => {
454
- !n && !u && e();
455
- },
456
- onKeyDown: (s) => {
457
- n && (s.key === "Enter" && r ? p() : s.key === "Escape" && i());
458
- },
459
- error: !!l,
460
- helperText: l ?? void 0,
461
- fullWidth: !0,
462
- autoComplete: "off",
463
- slotProps: {
464
- htmlInput: { readOnly: !n, spellCheck: !1 }
465
- },
466
- sx: {
467
- "& input": {
468
- fontVariantNumeric: "tabular-nums",
469
- cursor: n || u ? void 0 : "text"
470
- }
471
- }
472
- }
473
- ),
474
- /* @__PURE__ */ o(
475
- R,
476
- {
477
- direction: "row",
478
- sx: { gap: "8px", height: "56px", alignItems: "center" },
479
- children: n ? /* @__PURE__ */ m(V, { children: [
480
- /* @__PURE__ */ o(
481
- P,
482
- {
483
- icon: /* @__PURE__ */ o(j, {}),
484
- ariaLabel: d("RobotControl.MoveTo.Cancel.bt"),
485
- onClick: i
486
- }
487
- ),
488
- /* @__PURE__ */ o(
489
- z,
490
- {
491
- title: d("RobotControl.MoveTo.ConfirmEdit.lb"),
492
- placement: "left",
493
- children: /* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
494
- P,
495
- {
496
- icon: /* @__PURE__ */ o(U, {}),
497
- ariaLabel: d("RobotControl.MoveTo.ConfirmEdit.lb"),
498
- onClick: p,
499
- disabled: !r,
500
- sx: { color: "primary.main" }
501
- }
502
- ) })
503
- }
504
- )
505
- ] }) : /* @__PURE__ */ m(V, { children: [
506
- /* @__PURE__ */ o(
507
- z,
508
- {
509
- title: d("RobotControl.MoveTo.Copied.lb"),
510
- open: f,
511
- disableHoverListener: !0,
512
- placement: "left",
513
- children: /* @__PURE__ */ o(
514
- P,
515
- {
516
- icon: f ? /* @__PURE__ */ o(U, {}) : /* @__PURE__ */ o(vt, {}),
517
- ariaLabel: d("RobotControl.MoveTo.Copy.bt"),
518
- onClick: () => void b()
519
- }
520
- )
521
- }
522
- ),
523
- /* @__PURE__ */ o(
524
- P,
525
- {
526
- icon: /* @__PURE__ */ o(Rt, {}),
527
- ariaLabel: d("RobotControl.MoveTo.Edit.bt"),
528
- onClick: e,
529
- disabled: u
530
- }
531
- )
532
- ] })
533
- }
534
- )
535
- ] });
536
- }
537
- function Nt({
538
- moveTo: t,
539
- tcp: n,
540
- velocity: e,
541
- onVelocityChange: a,
542
- disabled: i
543
- }) {
544
- var x;
545
- const { t: p } = k(), [r, l] = A(null), [u, d] = A(null), c = Q(
546
- () => {
547
- const v = t.getCurrentPose();
548
- return v ? q(v) : "";
549
- },
550
- r === null && u === null
551
- ), f = (r == null ? void 0 : r.text) ?? c, g = u !== null, b = u === null ? null : Mt(u), s = r !== null && !t.error && !g, M = Q(
552
- () => r !== null && Lt(t.getCurrentPose(), r.pose),
553
- s
554
- ) && s, T = J(!1), C = J(null);
555
- function y() {
556
- var v;
557
- (v = C.current) == null || v.call(C), T.current = !1, l(null), d(null), t.onTargetChange(null);
558
- }
559
- function S() {
560
- b === null || i || (T.current = !1, l({ pose: b, text: q(b) }), d(null), t.onTargetChange(b));
561
- }
562
- function I() {
563
- r && t.onTargetChange(r.pose);
564
- }
565
- L(() => {
566
- if (s) {
567
- if (t.state === "moving") {
568
- T.current = !0;
569
- return;
570
- }
571
- T.current && M && t.state !== "stopping" && y();
572
- }
573
- }, [s, t.state, M]);
574
- const h = [n == null ? void 0 : n.value, (x = t.frame) == null ? void 0 : x.value].join("\0");
575
- L(() => {
576
- r && y();
577
- }, [h]);
578
- const w = J({ target: r, onTargetChange: t.onTargetChange });
579
- w.current = { target: r, onTargetChange: t.onTargetChange }, L(
580
- () => () => {
581
- var v;
582
- (v = C.current) == null || v.call(C), w.current.target && w.current.onTargetChange(null);
583
- },
584
- []
585
- );
586
- const N = u !== null ? b === null ? p("RobotControl.MoveTo.InvalidPose.lb") : null : r ? t.error ?? null : null;
587
- return /* @__PURE__ */ m(E, { children: [
588
- n && /* @__PURE__ */ o(
589
- O,
590
- {
591
- label: p("RobotControl.Tcp.lb"),
592
- ...n,
593
- disabled: i
594
- }
595
- ),
596
- /* @__PURE__ */ o(F, { variant: "body1", color: "text.primary", children: p("RobotControl.MoveTo.TargetPose.lb") }),
597
- /* @__PURE__ */ m(R, { sx: { gap: "8px" }, children: [
598
- t.frame && /* @__PURE__ */ o(
599
- O,
600
- {
601
- label: p("RobotControl.MoveTo.RelativeTo.lb"),
602
- ...t.frame,
603
- disabled: i
604
- }
605
- ),
606
- /* @__PURE__ */ o(
607
- Ot,
608
- {
609
- text: u ?? f,
610
- editing: g,
611
- onEdit: () => {
612
- i || d(f);
613
- },
614
- onDraftChange: d,
615
- onCancel: () => d(null),
616
- onConfirm: S,
617
- canConfirm: b !== null && !i && t.state !== "planning",
618
- error: N,
619
- disabled: i
620
- }
621
- )
622
- ] }),
623
- /* @__PURE__ */ o(
624
- D,
625
- {
626
- motion: "translate",
627
- velocity: e,
628
- onChange: a,
629
- disabled: i
630
- }
631
- ),
632
- /* @__PURE__ */ m(R, { direction: "row", sx: { gap: "12px", alignItems: "center" }, children: [
633
- r && !g && /* @__PURE__ */ o(z, { title: p("RobotControl.MoveTo.Reset.lb"), placement: "top", children: /* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
634
- P,
635
- {
636
- icon: /* @__PURE__ */ o(gt, {}),
637
- ariaLabel: p("RobotControl.MoveTo.Reset.lb"),
638
- onClick: y
639
- }
640
- ) }) }),
641
- r && !g && t.error && /* @__PURE__ */ o(
642
- z,
643
- {
644
- title: p("RobotControl.MoveTo.PlanAgain.lb"),
645
- placement: "top",
646
- children: /* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
647
- P,
648
- {
649
- icon: /* @__PURE__ */ o(bt, {}),
650
- ariaLabel: p("RobotControl.MoveTo.PlanAgain.lb"),
651
- onClick: I,
652
- disabled: i || t.state === "planning"
653
- }
654
- ) })
655
- }
656
- ),
657
- /* @__PURE__ */ o(
658
- Gt,
659
- {
660
- state: r ? t.state : "idle",
661
- ready: s,
662
- atPose: M,
663
- disabled: i,
664
- onMoveStart: () => {
665
- r && t.onMoveStart(r.pose);
666
- },
667
- onMoveStop: t.onMoveStop,
668
- stopRef: C
669
- }
670
- )
671
- ] })
672
- ] });
673
- }
674
- const Mo = nt(
675
- ({
676
- onClose: t,
677
- sx: n,
678
- joints: e,
679
- moveTo: a,
680
- jogDisabled: i = !1,
681
- cartesian: p = !0,
682
- tab: r,
683
- onTabChange: l,
684
- jogMode: u,
685
- onJogModeChange: d,
686
- ...c
687
- }) => {
688
- const { t: f } = k(), g = c.disabled ?? !1, [b, s] = A("translate"), [M, T] = A({
689
- mode: "continuous",
690
- view: "gizmo",
691
- step: { translate: 0, rotate: 0 }
692
- }), C = [
693
- ...p ? ["translate", "rotate"] : [],
694
- ...e ? ["joint"] : [],
695
- ...a ? ["moveTo"] : []
696
- ], y = r ?? b, S = C.includes(y) ? y : C[0], I = Xt(M, u, c.increments), h = f("RobotControl.Title.ti");
697
- function w(x) {
698
- s(x), l == null || l(x);
699
- }
700
- function N(x) {
701
- var v, H, W;
702
- T(x), x.mode !== I.mode && (d == null || d(x.mode));
703
- for (const B of ["translate", "rotate"]) {
704
- const $ = (v = c.increments) == null ? void 0 : v.steps[B][x.step[B]];
705
- x.step[B] !== I.step[B] && $ !== void 0 && ((W = (H = c.increments) == null ? void 0 : H.onStepChange) == null || W.call(H, B, $));
706
- }
707
- }
708
- return /* @__PURE__ */ m(
709
- R,
710
- {
711
- "data-testid": "robot-control-panel",
712
- sx: [
713
- (x) => {
714
- var v;
715
- return {
716
- minHeight: 0,
717
- overflow: "hidden",
718
- borderRadius: "16px",
719
- background: (v = x.palette.backgroundPaperElevation) == null ? void 0 : v[5]
720
- };
721
- },
722
- ...Array.isArray(n) ? n : [n]
723
- ],
724
- children: [
725
- /* @__PURE__ */ m(
726
- R,
727
- {
728
- direction: "row",
729
- sx: {
730
- alignItems: "center",
731
- justifyContent: "space-between",
732
- padding: "20px 20px 8px"
733
- },
734
- children: [
735
- /* @__PURE__ */ o(
736
- F,
737
- {
738
- component: "h2",
739
- color: "text.primary",
740
- sx: { fontSize: "20px" },
741
- children: h
742
- }
743
- ),
744
- t && /* @__PURE__ */ o(
745
- Z,
746
- {
747
- "aria-label": f("RobotControl.Close.bt"),
748
- onClick: t,
749
- size: "small",
750
- children: /* @__PURE__ */ o(j, {})
751
- }
752
- )
753
- ]
754
- }
755
- ),
756
- /* @__PURE__ */ m(
757
- tt,
758
- {
759
- value: S ?? !1,
760
- onChange: (x, v) => w(v),
761
- "aria-label": h,
762
- variant: "scrollable",
763
- scrollButtons: !1,
764
- sx: {
765
- marginX: "20px",
766
- borderBottom: 1,
767
- borderColor: "divider",
768
- // The theme gives tabs a background of their own; here they sit
769
- // on the panel
770
- background: "transparent"
771
- },
772
- children: [
773
- p && /* @__PURE__ */ o(
774
- G,
775
- {
776
- value: "translate",
777
- label: f("RobotControl.Tab.Translate.bt"),
778
- sx: { minWidth: 0, paddingX: "12px", textTransform: "none" }
779
- }
780
- ),
781
- p && /* @__PURE__ */ o(
782
- G,
783
- {
784
- value: "rotate",
785
- label: f("RobotControl.Tab.Rotate.bt"),
786
- sx: { minWidth: 0, paddingX: "12px", textTransform: "none" }
787
- }
788
- ),
789
- e && /* @__PURE__ */ o(
790
- G,
791
- {
792
- value: "joint",
793
- label: f("RobotControl.Tab.Joint.bt"),
794
- sx: { minWidth: 0, paddingX: "12px", textTransform: "none" }
795
- }
796
- ),
797
- a && /* @__PURE__ */ o(
798
- G,
799
- {
800
- value: "moveTo",
801
- label: f("RobotControl.Tab.MoveTo.bt"),
802
- sx: { minWidth: 0, paddingX: "12px", textTransform: "none" }
803
- }
804
- )
805
- ]
806
- }
807
- ),
808
- /* @__PURE__ */ o(R, { sx: { flexGrow: 1, overflowY: "auto", overflowX: "hidden" }, children: S === "joint" && e ? /* @__PURE__ */ o(Et, { joints: e, disabled: g || i }) : S === "moveTo" && a ? /* @__PURE__ */ o(
809
- Nt,
810
- {
811
- moveTo: a,
812
- tcp: c.tcp,
813
- velocity: c.velocity.translate,
814
- onVelocityChange: (x) => c.onVelocityChange("translate", x),
815
- disabled: g
816
- }
817
- ) : S === "translate" || S === "rotate" ? /* @__PURE__ */ o(
818
- Pt,
819
- {
820
- ...c,
821
- disabled: g || i,
822
- motion: S,
823
- settings: I,
824
- onSettingsChange: N
825
- }
826
- ) : null })
827
- ]
828
- }
829
- );
830
- }
831
- );
832
- function Xt(t, n, e) {
833
- const a = (i) => {
834
- var l;
835
- const p = (l = e == null ? void 0 : e.step) == null ? void 0 : l[i];
836
- if (p === void 0) return t.step[i];
837
- const r = e == null ? void 0 : e.steps[i].findIndex(
838
- (u) => Math.abs(u - p) <= 1e-9 * Math.max(1, Math.abs(u))
839
- );
840
- return r === void 0 || r < 0 ? t.step[i] : r;
841
- };
842
- return {
843
- ...t,
844
- mode: n ?? t.mode,
845
- step: { translate: a("translate"), rotate: a("rotate") }
846
- };
847
- }
848
- export {
849
- Mo as R
850
- };