@wandelbots/wandelbots-js-react-components 6.3.0 → 6.4.0-pr.feat-jogging-gizmo.649.179415f

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 (99) hide show
  1. package/README.md +202 -120
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +3 -3
  4. package/dist/3d.js +19 -22
  5. package/dist/SafetyBar/index.cjs +1 -1
  6. package/dist/SafetyBar/index.js +1 -1
  7. package/dist/chunks/ConnectedMotionGroup-_YUOhOLL.cjs +4 -0
  8. package/dist/chunks/ConnectedMotionGroup-neDeA3uW.js +2617 -0
  9. package/dist/chunks/Robot-CvviE5MR.js +1684 -0
  10. package/dist/chunks/Robot-VZaqKPxi.cjs +1 -0
  11. package/dist/chunks/{SafetyBar-Cy9DiXp9.js → SafetyBar-B9OQgerp.js} +1 -1
  12. package/dist/chunks/{SafetyBar-DPrv_OQA.cjs → SafetyBar-D7QT6J0m.cjs} +1 -1
  13. package/dist/chunks/{externalizeComponent-EDymnaGR.js → externalizeComponent-CZu38L-d.js} +29 -105
  14. package/dist/chunks/externalizeComponent-CdX5L_lW.cjs +2 -0
  15. package/dist/chunks/useSmoothedMotionState-BidFV3kQ.js +255 -0
  16. package/dist/chunks/useSmoothedMotionState-CdhkBCqt.cjs +1 -0
  17. package/dist/components/AppHeader.d.ts +1 -1
  18. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +1 -1
  19. package/dist/components/jogging/JoggingJointTab.d.ts +1 -1
  20. package/dist/components/jogging/JoggingPanel.d.ts +6 -3
  21. package/dist/components/jogging/JoggingStore.d.ts +5 -1
  22. package/dist/components/jogging/gizmo/JoggingGizmo.d.ts +42 -0
  23. package/dist/components/jogging/gizmo/JoggingGizmoOrientation.d.ts +31 -0
  24. package/dist/components/jogging/gizmo/gizmoShared.d.ts +60 -0
  25. package/dist/components/jogging/gizmo/gizmoTranslation.d.ts +11 -0
  26. package/dist/components/jogging/gizmo/jogGizmoProjection.d.ts +65 -0
  27. package/dist/components/jogging/jogHandle.d.ts +26 -0
  28. package/dist/components/jogging/joggingColors.d.ts +18 -0
  29. package/dist/components/jogging/useHold.d.ts +33 -0
  30. package/dist/components/jogging/useHoldToJog.d.ts +23 -0
  31. package/dist/components/robots/GenericRobot.d.ts +2 -1
  32. package/dist/components/robots/LinearAxis.d.ts +1 -1
  33. package/dist/components/robots/LinearAxisAnimator.d.ts +11 -2
  34. package/dist/components/robots/Robot.d.ts +1 -1
  35. package/dist/components/robots/robotModelLogic.d.ts +11 -9
  36. package/dist/components/utils/hooks.d.ts +1 -6
  37. package/dist/core.cjs +1 -1
  38. package/dist/core.d.ts +3 -18
  39. package/dist/core.js +27 -54
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.js +42 -72
  42. package/dist/lib/ConnectedMotionGroup.d.ts +5 -7
  43. package/dist/lib/JoggerConnection.d.ts +29 -5
  44. package/dist/lib/MotionStreamConnection.d.ts +4 -6
  45. package/dist/lib/novaConnection.d.ts +23 -0
  46. package/package.json +31 -66
  47. package/dist/Setup.d.ts +0 -11
  48. package/dist/chunks/MotionGroupVisualizer-DshWR1wY.js +0 -1653
  49. package/dist/chunks/MotionGroupVisualizer-eD7yFEcF.cjs +0 -1
  50. package/dist/chunks/externalizeComponent-OO4jcrz5.cjs +0 -2
  51. package/dist/chunks/theming-DfSy4-Ic.cjs +0 -4
  52. package/dist/chunks/theming-mF9Rt8SS.js +0 -5542
  53. package/dist/chunks/useSmoothedMotionState-DyDgSVYX.js +0 -478
  54. package/dist/chunks/useSmoothedMotionState-VYxEIyfr.cjs +0 -1
  55. package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +0 -11
  56. package/dist/components/AdornedTextField.d.ts +0 -7
  57. package/dist/components/CopyableText.d.ts +0 -6
  58. package/dist/components/CycleTimer/CycleTimer.d.ts +0 -3
  59. package/dist/components/CycleTimer/DefaultVariant.d.ts +0 -9
  60. package/dist/components/CycleTimer/SmallVariant.d.ts +0 -10
  61. package/dist/components/CycleTimer/index.d.ts +0 -27
  62. package/dist/components/CycleTimer/types.d.ts +0 -49
  63. package/dist/components/CycleTimer/useAnimations.d.ts +0 -14
  64. package/dist/components/CycleTimer/useTimerLogic.d.ts +0 -24
  65. package/dist/components/CycleTimer/utils.d.ts +0 -21
  66. package/dist/components/CycleTimer.d.ts +0 -3
  67. package/dist/components/DataGrid.d.ts +0 -66
  68. package/dist/components/LogPanel.d.ts +0 -38
  69. package/dist/components/LogStore.d.ts +0 -12
  70. package/dist/components/LogViewer.d.ts +0 -46
  71. package/dist/components/ProgramControl.d.ts +0 -55
  72. package/dist/components/ProgramStateIndicator.d.ts +0 -26
  73. package/dist/components/RobotCard.d.ts +0 -98
  74. package/dist/components/RobotListItem.d.ts +0 -34
  75. package/dist/components/RobotSetupReadinessIndicator.d.ts +0 -37
  76. package/dist/components/SelectableFab.d.ts +0 -7
  77. package/dist/components/TabBar.d.ts +0 -45
  78. package/dist/components/ThemeSelect.d.ts +0 -6
  79. package/dist/components/Timer/Timer.d.ts +0 -3
  80. package/dist/components/Timer/TimerDefaultVariant.d.ts +0 -9
  81. package/dist/components/Timer/TimerSmallVariant.d.ts +0 -10
  82. package/dist/components/Timer/index.d.ts +0 -19
  83. package/dist/components/Timer/types.d.ts +0 -35
  84. package/dist/components/Timer/useTimerAnimations.d.ts +0 -10
  85. package/dist/components/Timer/useTimerLogic.d.ts +0 -19
  86. package/dist/components/Timer/utils.d.ts +0 -17
  87. package/dist/components/Timer.d.ts +0 -3
  88. package/dist/components/TransparentOverlay.d.ts +0 -4
  89. package/dist/components/jogging/JoggingFreedriveTab.d.ts +0 -1
  90. package/dist/components/jogging/PoseCartesianValues.d.ts +0 -9
  91. package/dist/components/jogging/PoseJointValues.d.ts +0 -8
  92. package/dist/components/robots/AxisConfig.d.ts +0 -2
  93. package/dist/components/robots/manufacturerHomePositions.d.ts +0 -20
  94. package/dist/icons/DropdownArrowIcon.d.ts +0 -2
  95. package/dist/icons/index.d.ts +0 -12
  96. package/dist/lib/novaCompat.d.ts +0 -16
  97. package/dist/themes/createDarkTheme.d.ts +0 -7
  98. package/dist/themes/themeTypes.d.ts +0 -40
  99. package/dist/themes/theming.d.ts +0 -24
@@ -0,0 +1,255 @@
1
+ import { Nova as b } from "@wandelbots/nova-js/v2";
2
+ import { autorun as A, observable as y, runInAction as T } from "mobx";
3
+ import C, { useEffect as v, useState as k, useRef as V } from "react";
4
+ const m = "rgba(255, 255, 255, 1)", R = {
5
+ X: {
6
+ backgroundColor: "rgba(215, 66, 56, 1)",
7
+ borderColor: "rgba(215, 66, 56, 1)",
8
+ buttonBackgroundColor: {
9
+ default: "rgba(241, 77, 66, 1)",
10
+ pressed: "rgba(138, 41, 35, 1)",
11
+ hovered: "rgba(241, 77, 66, 1)",
12
+ disabled: "rgba(241, 77, 66, 1)"
13
+ },
14
+ color: "rgba(255, 198, 198, 1)",
15
+ labelColor: m
16
+ },
17
+ Y: {
18
+ backgroundColor: "rgba(20, 151, 108, 1)",
19
+ borderColor: "rgba(20, 151, 108, 1)",
20
+ buttonBackgroundColor: {
21
+ default: "rgba(28, 188, 135, 1)",
22
+ pressed: "rgba(11, 89, 63, 1)",
23
+ disabled: "rgba(28, 188, 135, 1)",
24
+ hovered: "rgba(28, 188, 135, 1)"
25
+ },
26
+ color: "rgba(215, 255, 242, 1)",
27
+ labelColor: m
28
+ },
29
+ Z: {
30
+ backgroundColor: "rgba(1, 87, 155, 1)",
31
+ borderColor: "rgba(1, 87, 155, 1)",
32
+ buttonBackgroundColor: {
33
+ default: "rgba(2, 136, 209, 1)",
34
+ pressed: "rgba(2, 64, 114, 1)",
35
+ disabled: "rgba(2, 136, 209, 1)",
36
+ hovered: "rgba(2, 136, 209, 1)"
37
+ },
38
+ color: "rgba(210, 239, 255, 1)",
39
+ labelColor: m
40
+ }
41
+ }, _ = m, q = m;
42
+ function I(e) {
43
+ v(e, []);
44
+ }
45
+ function O(e) {
46
+ I(() => A(e));
47
+ }
48
+ function L(e) {
49
+ return I(() => {
50
+ let t;
51
+ function r() {
52
+ e(), t = requestAnimationFrame(r);
53
+ }
54
+ return t = requestAnimationFrame(r), () => {
55
+ cancelAnimationFrame(t);
56
+ };
57
+ });
58
+ }
59
+ function x(e) {
60
+ return e instanceof b ? e : typeof e == "string" ? new b({ instanceUrl: e }) : new b({
61
+ instanceUrl: e.config.instanceUrl,
62
+ accessToken: e.accessToken ?? e.config.accessToken ?? void 0
63
+ });
64
+ }
65
+ function B(e) {
66
+ return typeof e == "string" ? void 0 : e.config.cellId;
67
+ }
68
+ class F {
69
+ constructor(t = [], r = {}) {
70
+ this.currentValues = [], this.targetValues = [], this.previousTargetValues = [], this.targetUpdateTime = 0, this.animationId = null, this.updateCount = 0, this.velocities = [], this.animate = () => {
71
+ this.update(0.016666666666666666) ? this.animationId = null : this.animationId = requestAnimationFrame(this.animate);
72
+ }, this.options = {
73
+ tension: 120,
74
+ friction: 20,
75
+ threshold: 1e-3,
76
+ onChange: () => {
77
+ },
78
+ onComplete: () => {
79
+ },
80
+ ...r
81
+ }, this.currentValues = [...t], this.targetValues = [...t], this.previousTargetValues = [...t], this.velocities = new Array(t.length).fill(0), this.targetUpdateTime = performance.now(), this.updateCount = 0;
82
+ }
83
+ /**
84
+ * Update interpolation using spring physics
85
+ *
86
+ * Call this method every frame for smooth animation. In React Three Fiber,
87
+ * call from within useFrame callback with the provided delta time.
88
+ *
89
+ * @param delta - Time elapsed since last update in seconds (e.g., 1/60 ≈ 0.0167 for 60fps)
90
+ * @returns true when interpolation is complete (all values reached their targets)
91
+ */
92
+ update(t = 1 / 60) {
93
+ let r = !1, n = !0;
94
+ this.updateCount++;
95
+ const i = Math.min(t, 1 / 15), u = this.updateCount === 1 ? 0.7 : 1;
96
+ for (let s = 0; s < this.currentValues.length; s++) {
97
+ const l = this.currentValues[s], h = this.targetValues[s], d = this.velocities[s], o = h - l, a = o * this.options.tension * u, p = d * this.options.friction, c = a - p, f = d + c * i, g = l + f * i;
98
+ Math.abs(o) < this.options.threshold && Math.abs(f) < this.options.threshold * 10 ? this.currentValues[s] !== h && (this.currentValues[s] = h, this.velocities[s] = 0, r = !0) : (n = !1, this.currentValues[s] = g, this.velocities[s] = f, r = !0);
99
+ }
100
+ return r && this.options.onChange(this.currentValues), n && this.options.onComplete(this.currentValues), n;
101
+ }
102
+ /**
103
+ * Set new target values for the interpolation to move towards
104
+ *
105
+ * Includes smart blending for very rapid target updates (faster than 120fps)
106
+ * to prevent jarring movements when targets change frequently.
107
+ */
108
+ setTarget(t) {
109
+ const r = performance.now(), n = r - this.targetUpdateTime;
110
+ this.previousTargetValues = [...this.targetValues], this.targetValues = [...t], this.targetUpdateTime = r, this.updateCount = 0;
111
+ const i = this.previousTargetValues.every(
112
+ (u, s) => u === this.currentValues[s]
113
+ );
114
+ if (n < 8 && n > 0 && this.previousTargetValues.length > 0 && !i) {
115
+ const u = Math.min(n / 8, 1);
116
+ for (let s = 0; s < this.targetValues.length; s++) {
117
+ const l = this.previousTargetValues[s] || 0, h = t[s] || 0;
118
+ Math.abs(h - l) > 0.1 && (this.targetValues[s] = l + (h - l) * u);
119
+ }
120
+ }
121
+ for (; this.currentValues.length < t.length; )
122
+ this.currentValues.push(t[this.currentValues.length]), this.velocities.push(0);
123
+ this.currentValues.length > t.length && (this.currentValues = this.currentValues.slice(0, t.length), this.velocities = this.velocities.slice(0, t.length));
124
+ }
125
+ /**
126
+ * Get a copy of all current interpolated values
127
+ */
128
+ getCurrentValues() {
129
+ return [...this.currentValues];
130
+ }
131
+ /**
132
+ * Get a single interpolated value by its array index
133
+ */
134
+ getValue(t) {
135
+ return this.currentValues[t] ?? 0;
136
+ }
137
+ /**
138
+ * Check if automatic interpolation is currently running
139
+ *
140
+ * This only tracks auto-interpolation started with startAutoInterpolation().
141
+ * Manual update() calls are not tracked by this method.
142
+ */
143
+ isInterpolating() {
144
+ return this.animationId !== null;
145
+ }
146
+ /**
147
+ * Stop automatic interpolation if it's running
148
+ *
149
+ * This cancels the internal animation frame loop but does not affect
150
+ * manual update() calls.
151
+ */
152
+ stop() {
153
+ this.animationId !== null && (cancelAnimationFrame(this.animationId), this.animationId = null);
154
+ }
155
+ /**
156
+ * Instantly set values without interpolation
157
+ */
158
+ setImmediate(t) {
159
+ this.stop(), this.currentValues = [...t], this.targetValues = [...t], this.previousTargetValues = [...t], this.velocities = new Array(t.length).fill(0), this.targetUpdateTime = performance.now(), this.updateCount = 0, this.options.onChange(this.currentValues);
160
+ }
161
+ /**
162
+ * Update interpolation options
163
+ */
164
+ updateOptions(t) {
165
+ this.options = { ...this.options, ...t };
166
+ }
167
+ /**
168
+ * Start automatic interpolation with an animation loop
169
+ *
170
+ * This begins a requestAnimationFrame loop that calls update() automatically.
171
+ * For React Three Fiber components, prefer using manual update() calls
172
+ * within useFrame hooks instead.
173
+ */
174
+ startAutoInterpolation() {
175
+ this.startInterpolation();
176
+ }
177
+ /**
178
+ * Clean up all resources and stop any running animations
179
+ *
180
+ * This cancels any active animation frames and resets internal state.
181
+ * Call this when the component unmounts or is no longer needed.
182
+ */
183
+ destroy() {
184
+ this.stop();
185
+ }
186
+ startInterpolation() {
187
+ this.animationId === null && this.animate();
188
+ }
189
+ }
190
+ function E(e = [], t = {}) {
191
+ const r = C.useRef(null);
192
+ return r.current || (r.current = new F(e, t)), C.useEffect(() => {
193
+ var n;
194
+ (n = r.current) == null || n.updateOptions(t);
195
+ }, [t]), C.useEffect(() => () => {
196
+ var n;
197
+ (n = r.current) == null || n.destroy();
198
+ }, []), [r.current];
199
+ }
200
+ function S(e, t) {
201
+ const [r] = k(
202
+ () => y({ ...e })
203
+ ), n = V(null), i = V(null), u = V(0);
204
+ function s() {
205
+ i.current !== null && (cancelAnimationFrame(i.current), i.current = null);
206
+ }
207
+ function l() {
208
+ const o = n.current;
209
+ if (!o) return;
210
+ const a = performance.now(), p = (a - u.current) / 1e3;
211
+ u.current = a;
212
+ const c = o.update(p);
213
+ T(() => {
214
+ r.joint_position = o.getCurrentValues();
215
+ }), i.current = c ? null : requestAnimationFrame(l);
216
+ }
217
+ function h() {
218
+ i.current === null && (u.current = performance.now(), i.current = requestAnimationFrame(l));
219
+ }
220
+ function d(o) {
221
+ var p;
222
+ const a = o.joint_position.filter(
223
+ (c) => c !== void 0
224
+ );
225
+ (p = n.current) == null || p.setTarget(a), T(() => {
226
+ const c = o, f = r;
227
+ for (const g of Object.keys(c))
228
+ g !== "joint_position" && f[g] !== c[g] && (f[g] = c[g]);
229
+ }), h();
230
+ }
231
+ return I(() => {
232
+ const o = e.joint_position.filter(
233
+ (a) => a !== void 0
234
+ );
235
+ return n.current = new F(o, t), () => {
236
+ var a;
237
+ s(), (a = n.current) == null || a.destroy();
238
+ };
239
+ }), v(() => {
240
+ var o;
241
+ t && ((o = n.current) == null || o.updateOptions(t));
242
+ }, [t]), v(() => A(() => d(e)), [e]), r;
243
+ }
244
+ export {
245
+ F as V,
246
+ S as a,
247
+ L as b,
248
+ x as c,
249
+ B as d,
250
+ R as e,
251
+ O as f,
252
+ _ as j,
253
+ E as u,
254
+ q as v
255
+ };
@@ -0,0 +1 @@
1
+ "use strict";const V=require("@wandelbots/nova-js/v2"),b=require("mobx"),u=require("react"),C="rgba(255, 255, 255, 1)",A={X:{backgroundColor:"rgba(215, 66, 56, 1)",borderColor:"rgba(215, 66, 56, 1)",buttonBackgroundColor:{default:"rgba(241, 77, 66, 1)",pressed:"rgba(138, 41, 35, 1)",hovered:"rgba(241, 77, 66, 1)",disabled:"rgba(241, 77, 66, 1)"},color:"rgba(255, 198, 198, 1)",labelColor:C},Y:{backgroundColor:"rgba(20, 151, 108, 1)",borderColor:"rgba(20, 151, 108, 1)",buttonBackgroundColor:{default:"rgba(28, 188, 135, 1)",pressed:"rgba(11, 89, 63, 1)",disabled:"rgba(28, 188, 135, 1)",hovered:"rgba(28, 188, 135, 1)"},color:"rgba(215, 255, 242, 1)",labelColor:C},Z:{backgroundColor:"rgba(1, 87, 155, 1)",borderColor:"rgba(1, 87, 155, 1)",buttonBackgroundColor:{default:"rgba(2, 136, 209, 1)",pressed:"rgba(2, 64, 114, 1)",disabled:"rgba(2, 136, 209, 1)",hovered:"rgba(2, 136, 209, 1)"},color:"rgba(210, 239, 255, 1)",labelColor:C}},T=C,F=C;function v(e){u.useEffect(e,[])}function y(e){v(()=>b.autorun(e))}function k(e){return v(()=>{let t;function r(){e(),t=requestAnimationFrame(r)}return t=requestAnimationFrame(r),()=>{cancelAnimationFrame(t)}})}function w(e){return e instanceof V.Nova?e:typeof e=="string"?new V.Nova({instanceUrl:e}):new V.Nova({instanceUrl:e.config.instanceUrl,accessToken:e.accessToken??e.config.accessToken??void 0})}function R(e){return typeof e=="string"?void 0:e.config.cellId}class I{constructor(t=[],r={}){this.currentValues=[],this.targetValues=[],this.previousTargetValues=[],this.targetUpdateTime=0,this.animationId=null,this.updateCount=0,this.velocities=[],this.animate=()=>{this.update(.016666666666666666)?this.animationId=null:this.animationId=requestAnimationFrame(this.animate)},this.options={tension:120,friction:20,threshold:.001,onChange:()=>{},onComplete:()=>{},...r},this.currentValues=[...t],this.targetValues=[...t],this.previousTargetValues=[...t],this.velocities=new Array(t.length).fill(0),this.targetUpdateTime=performance.now(),this.updateCount=0}update(t=1/60){let r=!1,n=!0;this.updateCount++;const i=Math.min(t,1/15),l=this.updateCount===1?.7:1;for(let o=0;o<this.currentValues.length;o++){const c=this.currentValues[o],g=this.targetValues[o],m=this.velocities[o],s=g-c,a=s*this.options.tension*l,p=m*this.options.friction,h=a-p,d=m+h*i,f=c+d*i;Math.abs(s)<this.options.threshold&&Math.abs(d)<this.options.threshold*10?this.currentValues[o]!==g&&(this.currentValues[o]=g,this.velocities[o]=0,r=!0):(n=!1,this.currentValues[o]=f,this.velocities[o]=d,r=!0)}return r&&this.options.onChange(this.currentValues),n&&this.options.onComplete(this.currentValues),n}setTarget(t){const r=performance.now(),n=r-this.targetUpdateTime;this.previousTargetValues=[...this.targetValues],this.targetValues=[...t],this.targetUpdateTime=r,this.updateCount=0;const i=this.previousTargetValues.every((l,o)=>l===this.currentValues[o]);if(n<8&&n>0&&this.previousTargetValues.length>0&&!i){const l=Math.min(n/8,1);for(let o=0;o<this.targetValues.length;o++){const c=this.previousTargetValues[o]||0,g=t[o]||0;Math.abs(g-c)>.1&&(this.targetValues[o]=c+(g-c)*l)}}for(;this.currentValues.length<t.length;)this.currentValues.push(t[this.currentValues.length]),this.velocities.push(0);this.currentValues.length>t.length&&(this.currentValues=this.currentValues.slice(0,t.length),this.velocities=this.velocities.slice(0,t.length))}getCurrentValues(){return[...this.currentValues]}getValue(t){return this.currentValues[t]??0}isInterpolating(){return this.animationId!==null}stop(){this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null)}setImmediate(t){this.stop(),this.currentValues=[...t],this.targetValues=[...t],this.previousTargetValues=[...t],this.velocities=new Array(t.length).fill(0),this.targetUpdateTime=performance.now(),this.updateCount=0,this.options.onChange(this.currentValues)}updateOptions(t){this.options={...this.options,...t}}startAutoInterpolation(){this.startInterpolation()}destroy(){this.stop()}startInterpolation(){this.animationId===null&&this.animate()}}function U(e=[],t={}){const r=u.useRef(null);return r.current||(r.current=new I(e,t)),u.useEffect(()=>{var n;(n=r.current)==null||n.updateOptions(t)},[t]),u.useEffect(()=>()=>{var n;(n=r.current)==null||n.destroy()},[]),[r.current]}function q(e,t){const[r]=u.useState(()=>b.observable({...e})),n=u.useRef(null),i=u.useRef(null),l=u.useRef(0);function o(){i.current!==null&&(cancelAnimationFrame(i.current),i.current=null)}function c(){const s=n.current;if(!s)return;const a=performance.now(),p=(a-l.current)/1e3;l.current=a;const h=s.update(p);b.runInAction(()=>{r.joint_position=s.getCurrentValues()}),i.current=h?null:requestAnimationFrame(c)}function g(){i.current===null&&(l.current=performance.now(),i.current=requestAnimationFrame(c))}function m(s){var p;const a=s.joint_position.filter(h=>h!==void 0);(p=n.current)==null||p.setTarget(a),b.runInAction(()=>{const h=s,d=r;for(const f of Object.keys(h))f!=="joint_position"&&d[f]!==h[f]&&(d[f]=h[f])}),g()}return v(()=>{const s=e.joint_position.filter(a=>a!==void 0);return n.current=new I(s,t),()=>{var a;o(),(a=n.current)==null||a.destroy()}}),u.useEffect(()=>{var s;t&&((s=n.current)==null||s.updateOptions(t))},[t]),u.useEffect(()=>b.autorun(()=>m(e)),[e]),r}exports.ValueInterpolator=I;exports.cartesianAxisColors=A;exports.cellIdOf=R;exports.createNovaClient=w;exports.jointArrowColor=T;exports.useAnimationFrame=k;exports.useAutorun=y;exports.useInterpolation=U;exports.useSmoothedMotionState=q;exports.velocitySliderLegendColor=F;
@@ -1,4 +1,4 @@
1
- import { type SxProps } from "@mui/material/styles";
1
+ import type { SxProps } from "@mui/material/styles";
2
2
  import { type ReactNode } from "react";
3
3
  export type AppItem = {
4
4
  /** Unique identifier for the app */
@@ -1,6 +1,6 @@
1
1
  import Stack from "@mui/material/Stack";
2
2
  import React, { type ReactNode } from "react";
3
- import type { AxisControlComponentColors } from "../../themes/themeTypes";
3
+ import type { AxisControlComponentColors } from "./joggingColors";
4
4
  import type { JoggingDirection } from "./JoggingStore";
5
5
  type JoggingCartesianAxisControlProps = {
6
6
  colors?: AxisControlComponentColors;
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  import type { JoggingStore } from "./JoggingStore";
3
3
  export declare const JoggingJointTab: (({ store, children }: {
4
4
  store: JoggingStore;
@@ -1,10 +1,13 @@
1
1
  import type { SxProps } from "@mui/material/styles";
2
- import type { AnyNovaClient } from "../../lib/novaCompat";
2
+ import type { NovaConnection } from "../../lib/novaConnection";
3
3
  import { JoggingStore } from "./JoggingStore";
4
4
  export type JoggingPanelTabId = "cartesian" | "joint";
5
5
  export type JoggingPanelProps = {
6
- /** Either an existing Nova client or the base url of a deployed Nova instance */
7
- nova: AnyNovaClient | string;
6
+ /**
7
+ * The base url of a deployed Nova instance, or a Nova client of the app.
8
+ * The panel reads only the url and the access token of the client.
9
+ */
10
+ nova: NovaConnection;
8
11
  /** Id of the motion group to move e.g. 0@ur5e */
9
12
  motionGroupId: string;
10
13
  /** Cell id on the Nova instance. Defaults to "cell". */
@@ -114,7 +114,11 @@ export declare class JoggingStore {
114
114
  dispose(): void;
115
115
  get coordSystemCountByName(): import("lodash").Dictionary<number>;
116
116
  deactivate(): Promise<void>;
117
- /** Activate the jogger with current settings */
117
+ /**
118
+ * Activate the jogger with current settings. Resolves when the jogging
119
+ * websocket is initialized, or when the jogging was stopped before that
120
+ * (`deactivate`).
121
+ */
118
122
  activate(): Promise<JoggerConnection>;
119
123
  loadFromLocalStorage(): void;
120
124
  saveToLocalStorage(): void;
@@ -0,0 +1,42 @@
1
+ import { type RefObject } from "react";
2
+ import type { Quaternion } from "three";
3
+ import { type JogAxis, type JogDirection, type JogHandle } from "../jogHandle";
4
+ /**
5
+ * Props of {@link JoggingGizmo}
6
+ *
7
+ * @beta
8
+ */
9
+ export type JoggingGizmoProps = {
10
+ /**
11
+ * The jog frame as the camera sees it, read every frame. Fill it with a
12
+ * {@link JoggingGizmoOrientation} inside the app's 3D scene. Start it
13
+ * empty (`useRef<Quaternion | null>(null)`): until a first orientation
14
+ * arrives, the gizmo stays disabled rather than point its arrows a way the
15
+ * 3D view does not.
16
+ */
17
+ orientation: RefObject<Quaternion | null>;
18
+ /** A handle was pressed: jog until `onJogStop` */
19
+ onJogStart: (axis: JogAxis, direction: JogDirection) => void;
20
+ /** The held handle was let go */
21
+ onJogStop: () => void;
22
+ /** Shows a handle as pressed while it is not held, e.g. a running step */
23
+ activeHandle?: JogHandle | null;
24
+ disabled?: boolean;
25
+ /** Side of the square the gizmo takes, in px. Defaults to 200. */
26
+ size?: number;
27
+ };
28
+ /**
29
+ * Jogging by a gizmo drawn in the jog frame's axes as the camera sees them:
30
+ * the handle that points right on screen moves the robot right on screen, and
31
+ * orbiting the scene turns the gizmo with it.
32
+ *
33
+ * Each axis is an arrow with a handle per direction, grabbed anywhere along
34
+ * its half of the axis and held to jog.
35
+ *
36
+ * The gizmo is drawn in 3D; the handles are laid over it as buttons, so it
37
+ * works from the keyboard and tests can find a handle by its name. It draws
38
+ * only when it turns or its state changes, not every frame.
39
+ *
40
+ * @beta
41
+ */
42
+ export declare const JoggingGizmo: ({ orientation, onJogStart, onJogStop, activeHandle, disabled: disabledByApp, size, }: JoggingGizmoProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import type { RefObject } from "react";
2
+ import { Quaternion } from "three";
3
+ /**
4
+ * Props of {@link JoggingGizmoOrientation}
5
+ *
6
+ * @beta
7
+ */
8
+ export type JoggingGizmoOrientationProps = {
9
+ /**
10
+ * Receives the jog frame as the camera sees it; pass the same ref to the
11
+ * gizmo as its `orientation`. It may start empty (`null`).
12
+ */
13
+ target: RefObject<Quaternion | null>;
14
+ /**
15
+ * World orientation of the frame the gizmo jogs along, as the 3D scene has
16
+ * it. Defaults to the scene's own axes, the world frame of a scene that is
17
+ * Z up like NOVA. A frame that turns, such as the tool's, can be a
18
+ * function: it is called every frame the scene renders, so the gizmo turns
19
+ * with the tool without re-rendering React.
20
+ */
21
+ frameQuaternion?: Quaternion | (() => Quaternion);
22
+ };
23
+ /**
24
+ * Goes inside the app's 3D scene and tells a {@link JoggingGizmo} how the jog
25
+ * frame looks from the scene's camera, every frame the scene renders. Writes
26
+ * into `target` instead of setting state, so orbiting does not re-render
27
+ * React.
28
+ *
29
+ * @beta
30
+ */
31
+ export declare function JoggingGizmoOrientation({ target, frameQuaternion, }: JoggingGizmoOrientationProps): null;
@@ -0,0 +1,60 @@
1
+ import type { RefObject } from "react";
2
+ import { type Quaternion, Vector3 } from "three";
3
+ import type { JogAxis, JogHandle } from "../jogHandle";
4
+ import type { useHoldToJog } from "../useHoldToJog";
5
+ export declare const UP: Vector3;
6
+ export declare const handleKey: (handle: JogHandle) => string;
7
+ /**
8
+ * The color of an axis: the button color of that axis in the cartesian
9
+ * jogging tab, so a gizmo and the jog buttons always agree
10
+ */
11
+ export declare function axisColor(axis: JogAxis): string;
12
+ /**
13
+ * The px measures of a gizmo `size` px wide, in proportion to it, so that a
14
+ * small gizmo looks like a large one, only smaller: the halo of a held or
15
+ * hovered handle, its grab bar and the room around the gizmo
16
+ */
17
+ export declare function gizmoMeasures(size: number): {
18
+ /** Room around the gizmo for the labels, arrowheads and grab bars */
19
+ marginPx: number;
20
+ /** Thickness of a handle's grab bar, which shows as its halo */
21
+ gripPx: number;
22
+ grab: {
23
+ innerPx: number;
24
+ beyondTipPx: number;
25
+ minLengthPx: number;
26
+ };
27
+ /** The axis labels, which stay readable on a small gizmo */
28
+ labelFontPx: number;
29
+ };
30
+ /**
31
+ * The elements laid over the gizmo, by key. The 3D scene places them every
32
+ * frame the gizmo turns, directly, so that orbiting does not re-render React.
33
+ */
34
+ export type GizmoOverlay = Map<string, Element>;
35
+ /** A ref callback that registers an overlay element under `key` */
36
+ export declare function overlayRef(overlay: RefObject<GizmoOverlay>, key: string): (node: Element | null) => void;
37
+ /** What the 3D half of a gizmo (inside the canvas) gets */
38
+ export type GizmoSceneProps = {
39
+ orientation: RefObject<Quaternion | null>;
40
+ /** The handle to draw highlighted: held, active or hovered */
41
+ lit: JogHandle | null;
42
+ disabled: boolean;
43
+ /** Side of the gizmo, in px */
44
+ size: number;
45
+ /** Px per gizmo unit */
46
+ radius: number;
47
+ overlay: RefObject<GizmoOverlay>;
48
+ };
49
+ /** What the handle half of a gizmo (laid over the canvas) gets */
50
+ export type GizmoHandlesProps = {
51
+ held: JogHandle | null;
52
+ activeHandle?: JogHandle | null;
53
+ disabled: boolean;
54
+ size: number;
55
+ onHover: (handle: JogHandle | null) => void;
56
+ handlersFor: ReturnType<typeof useHoldToJog>["handlersFor"];
57
+ /** The accessible name of a handle, e.g. "Jog X+" */
58
+ label: (handle: JogHandle) => string;
59
+ overlay: RefObject<GizmoOverlay>;
60
+ };
@@ -0,0 +1,11 @@
1
+ import { type GizmoHandlesProps, type GizmoSceneProps } from "./gizmoShared";
2
+ /**
3
+ * The translation gizmo's arrows, turned by `orientation` whenever it turns.
4
+ * Also lays the grab bars and labels over them.
5
+ */
6
+ export declare function TranslationScene({ orientation, lit, disabled, size, radius, overlay, }: GizmoSceneProps): import("react/jsx-runtime").JSX.Element;
7
+ /**
8
+ * The translation handles: a button per direction, a bar along its half of
9
+ * the axis, so it can be grabbed anywhere along it. And the axis labels.
10
+ */
11
+ export declare function TranslationHandles({ held, activeHandle, disabled, onHover, handlersFor, label, overlay, size, }: GizmoHandlesProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,65 @@
1
+ import { Quaternion, Vector3 } from "three";
2
+ import { type JogAxis, type JogDirection } from "../jogHandle";
3
+ /** A jog handle where the gizmo draws it */
4
+ export type ProjectedJogHandle = {
5
+ axis: JogAxis;
6
+ direction: JogDirection;
7
+ /** Screen position of the arrow tip, in gizmo radii from the center */
8
+ x: number;
9
+ /** Like `x`, pointing down as on screen */
10
+ y: number;
11
+ /** Toward the viewer is positive; nearer handles are drawn on top */
12
+ depth: number;
13
+ };
14
+ /** The unit vector along each axis */
15
+ export declare const UNIT_VECTOR: Record<JogAxis, Vector3>;
16
+ /**
17
+ * The jog frame as the camera sees it, `camera⁻¹ · frame`: what turns the
18
+ * gizmo so that the handle pointing right on screen moves the robot right on
19
+ * screen.
20
+ *
21
+ * Both are world orientations, so this works whichever axis is up in the
22
+ * scene.
23
+ */
24
+ export declare function jogFrameInCamera(cameraWorldQuaternion: Quaternion, frameWorldQuaternion: Quaternion, target?: Quaternion): Quaternion;
25
+ /**
26
+ * Where the six handles of a gizmo turned by `frameInCamera` appear. three.js
27
+ * cameras look down −Z with +Y up, so a view-space vector lands on screen at
28
+ * (x, −y); z only decides what is in front.
29
+ */
30
+ export declare function projectJogHandles(frameInCamera: Quaternion): ProjectedJogHandle[];
31
+ /**
32
+ * The gizmo radius, in px, that fits a `width` × `height` canvas whichever
33
+ * way the gizmo is turned, keeping `marginPx` free for the labels and grab
34
+ * areas around the tips. At least 1, so an unmeasured canvas still draws.
35
+ */
36
+ export declare function fitGizmoRadiusPx(width: number, height: number, marginPx: number): number;
37
+ /** Where a handle can be grabbed: a bar along its half of the axis */
38
+ export type JogGrabArea = {
39
+ /** Start of the bar, in px from the gizmo center, y pointing down */
40
+ x: number;
41
+ y: number;
42
+ /** Length of the bar in px */
43
+ length: number;
44
+ /** Direction of the bar on screen, in radians, y pointing down */
45
+ angle: number;
46
+ };
47
+ /**
48
+ * The bar a handle can be grabbed along: its half of the axis, from `innerPx`
49
+ * out from the center (which no handle owns) to `beyondTipPx` past the tip.
50
+ * An axis pointing at the viewer has no length on screen, so its handle keeps
51
+ * a bar of `minLengthPx` centered on the tip.
52
+ */
53
+ export declare function grabAreaOf(handle: ProjectedJogHandle, sizes: {
54
+ radiusPx: number;
55
+ innerPx: number;
56
+ beyondTipPx: number;
57
+ minLengthPx: number;
58
+ }): JogGrabArea;
59
+ /**
60
+ * Whether `next` is a different rotation from `previous`, so the gizmo has to
61
+ * be drawn anew. A camera orientation computed afresh each frame differs in
62
+ * its last digits without turning, and a quaternion and its negation are the
63
+ * same rotation, so this compares rotations, not numbers.
64
+ */
65
+ export declare function hasTurned(previous: Quaternion | null, next: Quaternion): boolean;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * An axis of a cartesian jog
3
+ *
4
+ * @beta
5
+ */
6
+ export type JogAxis = "x" | "y" | "z";
7
+ /**
8
+ * Which way along an axis
9
+ *
10
+ * @beta
11
+ */
12
+ export type JogDirection = "+" | "-";
13
+ /**
14
+ * One jog control, e.g. +X
15
+ *
16
+ * @beta
17
+ */
18
+ export type JogHandle = {
19
+ axis: JogAxis;
20
+ direction: JogDirection;
21
+ };
22
+ export declare const JOG_AXES: readonly JogAxis[];
23
+ export declare const JOG_DIRECTIONS: readonly JogDirection[];
24
+ export declare function isSameJogHandle(a: JogHandle | null | undefined, b: JogHandle | null | undefined): boolean;
25
+ /** How a handle is named on screen, e.g. X+ */
26
+ export declare function jogHandleName(handle: JogHandle): string;
@@ -0,0 +1,18 @@
1
+ export interface AxisControlComponentColors {
2
+ color?: string;
3
+ borderColor?: string;
4
+ backgroundColor?: string;
5
+ buttonBackgroundColor?: {
6
+ default?: string;
7
+ pressed?: string;
8
+ disabled?: string;
9
+ hovered?: string;
10
+ };
11
+ labelColor?: string;
12
+ }
13
+ /** Colors of the X, Y and Z axis controls of the cartesian jogging tab */
14
+ export declare const cartesianAxisColors: Record<"X" | "Y" | "Z", AxisControlComponentColors>;
15
+ /** Color of the arrows of the joint jogging controls */
16
+ export declare const jointArrowColor = "rgba(255, 255, 255, 1)";
17
+ /** Color of the velocity legend of the velocity slider */
18
+ export declare const velocitySliderLegendColor = "rgba(255, 255, 255, 1)";
@@ -0,0 +1,33 @@
1
+ import { type FocusEvent, type KeyboardEvent, type PointerEvent } from "react";
2
+ export type HoldOptions<T> = {
3
+ /** A control was pressed: act on `target` until `onStop` */
4
+ onStart: (target: T) => void;
5
+ onStop: () => void;
6
+ disabled?: boolean;
7
+ /** Whether two targets are the same control */
8
+ isSame: (a: T, b: T) => boolean;
9
+ };
10
+ /**
11
+ * Press-and-hold for a set of controls that move the robot: the motion runs
12
+ * exactly as long as one control is held, by pointer or by Space/Enter.
13
+ *
14
+ * Only one runs at a time; pressing a second control while one is held does
15
+ * nothing. Every way a hold can end (release, cancel, lost pointer capture,
16
+ * blur, the window losing focus, the tab being hidden, becoming disabled,
17
+ * unmount) stops it, and stops it once. Pointer capture keeps a drag off the
18
+ * control from leaving the robot moving. The controls can be any element,
19
+ * e.g. buttons or the handles of a gizmo.
20
+ */
21
+ export declare function useHold<T>({ onStart, onStop, disabled, isSame, }: HoldOptions<T>): {
22
+ held: T | null;
23
+ handlersFor: (target: T) => {
24
+ onPointerDown: (event: PointerEvent<Element>) => void;
25
+ onPointerUp: () => void;
26
+ onPointerCancel: () => void;
27
+ onLostPointerCapture: () => void;
28
+ onKeyDown: (event: KeyboardEvent<Element>) => void;
29
+ onKeyUp: (event: KeyboardEvent<Element>) => void;
30
+ onBlur: (_event: FocusEvent<Element>) => void;
31
+ };
32
+ stop: () => void;
33
+ };
@@ -0,0 +1,23 @@
1
+ import { type JogAxis, type JogDirection, type JogHandle } from "./jogHandle";
2
+ export type HoldToJogOptions = {
3
+ onJogStart: (axis: JogAxis, direction: JogDirection) => void;
4
+ onJogStop: () => void;
5
+ disabled?: boolean;
6
+ };
7
+ /**
8
+ * Hold-to-jog for a set of jog controls, one per jog handle (e.g. +X): see
9
+ * {@link useHold} for how a hold starts and ends
10
+ */
11
+ export declare function useHoldToJog({ onJogStart, onJogStop, disabled, }: HoldToJogOptions): {
12
+ held: JogHandle | null;
13
+ handlersFor: (target: JogHandle) => {
14
+ onPointerDown: (event: import("react").PointerEvent<Element>) => void;
15
+ onPointerUp: () => void;
16
+ onPointerCancel: () => void;
17
+ onLostPointerCapture: () => void;
18
+ onKeyDown: (event: import("react").KeyboardEvent<Element>) => void;
19
+ onKeyUp: (event: import("react").KeyboardEvent<Element>) => void;
20
+ onBlur: (_event: import("react").FocusEvent<Element>) => void;
21
+ };
22
+ stop: () => void;
23
+ };
@@ -5,7 +5,8 @@ export type RobotModelProps = {
5
5
  modelURL: string | Promise<string>;
6
6
  /**
7
7
  * Called after a robot model has been loaded and
8
- * rendered into the threejs scene
8
+ * rendered into the threejs scene, when the components above it
9
+ * (RobotAnimator, LinearAxisAnimator) have mounted
9
10
  */
10
11
  postModelRender?: () => void;
11
12
  flangeRef?: React.Ref<Group>;
@@ -15,7 +15,7 @@ export type LinearAxisProps = {
15
15
  *
16
16
  * @param {LinearAxisProps} props - The properties for the LinearAxis component.
17
17
  * @param {ConnectedMotionGroup} props.connectedMotionGroup - The connected motion group containing motion state and parameters.
18
- * @param {Function} [props.getModel=defaultGetModel] - Optional function to get the model URL. Defaults to defaultGetModel.
18
+ * @param {Function} [props.getModel] - Optional function to get the model URL. Defaults to defaultGetModel with the connection of the connected motion group (its URL and access token).
19
19
  * @param {Object} props - Additional properties passed to the underlying component.
20
20
  *
21
21
  * @returns {JSX.Element} The rendered SupportedLinearAxis or DHLinearAxis component.