@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.5d2eede → 6.4.0-pr.revamp.667.6038f41

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 (109) hide show
  1. package/README.md +56 -5
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +3 -0
  4. package/dist/3d.js +25 -20
  5. package/dist/CurrentPose/index.cjs +1 -0
  6. package/dist/CurrentPose/index.d.ts +3 -0
  7. package/dist/CurrentPose/index.js +9 -0
  8. package/dist/CurrentPoseBar/index.cjs +1 -1
  9. package/dist/CurrentPoseBar/index.js +1 -1
  10. package/dist/JoggingButtons/index.cjs +1 -1
  11. package/dist/JoggingButtons/index.js +1 -1
  12. package/dist/JoggingGizmo/index.cjs +1 -1
  13. package/dist/JoggingGizmo/index.js +2 -2
  14. package/dist/JoggingJointSlider/index.cjs +1 -1
  15. package/dist/JoggingJointSlider/index.js +1 -1
  16. package/dist/RobotControl/index.cjs +1 -0
  17. package/dist/RobotControl/index.d.ts +3 -0
  18. package/dist/RobotControl/index.js +9 -0
  19. package/dist/RobotControlPanel/index.cjs +1 -1
  20. package/dist/RobotControlPanel/index.js +1 -1
  21. package/dist/RobotHeader/index.cjs +1 -1
  22. package/dist/RobotHeader/index.d.ts +4 -0
  23. package/dist/RobotHeader/index.js +8 -3
  24. package/dist/SafetyBar/index.cjs +1 -1
  25. package/dist/SafetyBar/index.d.ts +1 -0
  26. package/dist/SafetyBar/index.js +4 -3
  27. package/dist/chunks/CurrentPose-BStpfgEJ.cjs +1 -0
  28. package/dist/chunks/CurrentPose-UJbSKPRp.js +51 -0
  29. package/dist/chunks/{CurrentPoseBar-zTZi68tY.js → CurrentPoseBar-BmsPnLVP.js} +2 -2
  30. package/dist/chunks/{CurrentPoseBar-CyHUWmjM.cjs → CurrentPoseBar-ZUhFaVdM.cjs} +1 -1
  31. package/dist/chunks/{JoggingButtons-CbL-5LMK.cjs → JoggingButtons-9nBrKbUa.cjs} +1 -1
  32. package/dist/chunks/{JoggingButtons-CXaozFVz.js → JoggingButtons-I_Y70pg8.js} +1 -1
  33. package/dist/chunks/{JoggingGizmo-SuS9MmL7.js → JoggingGizmo-DBpDIbzl.js} +1 -1
  34. package/dist/chunks/{JoggingGizmo-DGbFLWgT.cjs → JoggingGizmo-DtWw6KWg.cjs} +1 -1
  35. package/dist/chunks/{JoggingGizmoOrientation-dzned4f4.cjs → JoggingGizmoOrientation-BwkW76fE.cjs} +1 -1
  36. package/dist/chunks/{JoggingGizmoOrientation-x_crT_64.js → JoggingGizmoOrientation-DU97IUWq.js} +1 -1
  37. package/dist/chunks/{JoggingJointSlider-R3_A9Ppj.cjs → JoggingJointSlider-DHBB7MwU.cjs} +1 -1
  38. package/dist/chunks/{JoggingJointSlider-CZ-k6XCa.js → JoggingJointSlider-DeMqm9Jh.js} +1 -1
  39. package/dist/chunks/Pose3-B_fLR-Wv.js +80 -0
  40. package/dist/chunks/Pose3-Ch4xVeXV.cjs +1 -0
  41. package/dist/chunks/RobotControl-BDcNKq32.js +285 -0
  42. package/dist/chunks/RobotControl-DXbcloVq.cjs +1 -0
  43. package/dist/chunks/{RobotControlPanel-BiLexAWI.js → RobotControlPanel-CzhYCBAm.js} +5 -5
  44. package/dist/chunks/{RobotControlPanel-BXtBHEe9.cjs → RobotControlPanel-DHQga5uu.cjs} +1 -1
  45. package/dist/chunks/{converters-DAr6IQbG.js → converters-D9KpJ2HD.js} +2 -2
  46. package/dist/chunks/coordSystemLabel-BJKeaGA3.cjs +1 -0
  47. package/dist/chunks/coordSystemLabel-C1jfhEh5.js +29 -0
  48. package/dist/chunks/{externalizeComponent-_w2d1_pz.js → externalizeComponent-CPAVvPKk.js} +10 -2
  49. package/dist/chunks/externalizeComponent-CkWiNBu0.cjs +2 -0
  50. package/dist/chunks/loadRobotSession-68wS5Tn1.cjs +3 -0
  51. package/dist/chunks/loadRobotSession-C1g2yivF.js +4624 -0
  52. package/dist/chunks/robotActivationOf-DXC0E2DS.cjs +1 -0
  53. package/dist/chunks/robotActivationOf-E1GLe_69.js +477 -0
  54. package/dist/chunks/robotModelSource-BCX1Jrrd.cjs +1 -0
  55. package/dist/chunks/robotModelSource-C57_9QYT.js +1296 -0
  56. package/dist/chunks/{SafetyBar-BVk-SH_0.cjs → robotSafetyOf-CwfVV9__.cjs} +1 -1
  57. package/dist/chunks/{SafetyBar-RkN0I1Cb.js → robotSafetyOf-P4RgO2LQ.js} +45 -35
  58. package/dist/chunks/useEveryFrame-CHxg25f4.cjs +1 -0
  59. package/dist/chunks/useEveryFrame-DAuNawGP.js +155 -0
  60. package/dist/chunks/{Pose3-pocKPrHN.js → useSmoothedMotionState-COMJRcOt.js} +63 -141
  61. package/dist/chunks/useSmoothedMotionState-Con0E5Bx.cjs +1 -0
  62. package/dist/components/connectionWarning/ConnectionWarning.d.ts +21 -0
  63. package/dist/components/connectionWarning/connectionWarningOf.d.ts +11 -0
  64. package/dist/components/connectionWarning/timeAgo.d.ts +5 -0
  65. package/dist/components/currentPoseBar/CurrentPose.d.ts +23 -0
  66. package/dist/components/currentPoseBar/useCurrentPoseProps.d.ts +16 -0
  67. package/dist/components/jogging/coordSystemLabel.d.ts +7 -0
  68. package/dist/components/robotControl/RobotControl.d.ts +23 -0
  69. package/dist/components/robotControl/poseText.d.ts +21 -5
  70. package/dist/components/robotControl/useRobotControlProps.d.ts +28 -0
  71. package/dist/components/robotHeader/robotActivationOf.d.ts +8 -0
  72. package/dist/components/robotHeader/robotSafetyOf.d.ts +11 -0
  73. package/dist/components/robotSession/RobotSessionProvider.d.ts +13 -0
  74. package/dist/components/robots/LinearAxis.d.ts +12 -11
  75. package/dist/components/robots/Robot.d.ts +26 -9
  76. package/dist/components/robots/robotModelSource.d.ts +38 -0
  77. package/dist/core.cjs +1 -1
  78. package/dist/core.d.ts +17 -0
  79. package/dist/core.js +69 -40
  80. package/dist/index.cjs +1 -1
  81. package/dist/index.js +99 -65
  82. package/dist/lib/ConnectedMotionGroup.d.ts +5 -1
  83. package/dist/lib/controllerStateSource.d.ts +6 -4
  84. package/dist/lib/motionGroupModelResources.d.ts +1 -0
  85. package/dist/lib/nats/natsControllerStateSource.d.ts +27 -0
  86. package/dist/lib/robotSession/RobotActivation.d.ts +48 -0
  87. package/dist/lib/robotSession/RobotDescription.d.ts +84 -0
  88. package/dist/lib/robotSession/RobotLiveState.d.ts +56 -0
  89. package/dist/lib/robotSession/RobotLoadProgress.d.ts +72 -0
  90. package/dist/lib/robotSession/RobotSafety.d.ts +59 -0
  91. package/dist/lib/robotSession/RobotSession.d.ts +78 -0
  92. package/dist/lib/robotSession/RobotTargetPose.d.ts +78 -0
  93. package/dist/lib/robotSession/loadRobotResources.d.ts +46 -0
  94. package/dist/lib/robotSession/loadRobotSession.d.ts +81 -0
  95. package/dist/lib/robotSession/robotPose.d.ts +28 -0
  96. package/dist/nats.cjs +1 -0
  97. package/dist/nats.d.ts +4 -0
  98. package/dist/nats.js +131 -0
  99. package/package.json +11 -1
  100. package/dist/chunks/Pose3-DIyg-aZA.cjs +0 -1
  101. package/dist/chunks/Robot-B3vKEVXP.cjs +0 -1
  102. package/dist/chunks/Robot-DXhaz1tq.js +0 -1272
  103. package/dist/chunks/RobotHeader-DDmDkUoV.js +0 -244
  104. package/dist/chunks/RobotHeader-Daft80jq.cjs +0 -1
  105. package/dist/chunks/TrajectoryExecutionStore-CKfEoKo8.cjs +0 -3
  106. package/dist/chunks/TrajectoryExecutionStore-DYVukgCz.js +0 -3613
  107. package/dist/chunks/externalizeComponent-BdxGBLIv.cjs +0 -2
  108. package/dist/chunks/useEveryFrame-G_-ma1nC.js +0 -142
  109. package/dist/chunks/useEveryFrame-dmPPTKtT.cjs +0 -1
package/README.md CHANGED
@@ -68,6 +68,7 @@ Browse the full icon set at https://wandelbotsgmbh.github.io/nova-design-system/
68
68
  - **`.`** (Main) — All components. Requires the peer dependencies of `/core` and `/3d`.
69
69
  - **`/core`** — The parts without 3D (jogging, `SafetyBar`, `AppHeader`, `LoadingCover`, `NoMotionGroupModal`), the NOVA connections and `JoggingStore`, the motion state helpers and `i18n`.
70
70
  - **`/3d`** — The 3D parts (`Robot`, `MotionGroupVisualizer`, `SafetyZonesRenderer`, …). Requires in addition three, three-stdlib, @react-three/fiber and @react-three/drei.
71
+ - **`/nats`** — A robot's live controller state over NOVA's NATS server (`natsControllerStateSource`, `natsUrlOf`), a source for `ControllerStateStream` of `/core` instead of its websocket (`controllerStateWebsocket`). Requires in addition nats.ws; no other entry point loads it.
71
72
  - **`/SafetyBar`** — Only `SafetyBar` (also as the default export).
72
73
  - **`/JoggingGizmo`** — Only `JoggingGizmo` (also as the default export) and `JoggingGizmoOrientation`. Requires in addition three and @react-three/fiber.
73
74
  - **`/JoggingButtons`** — Only `JoggingButtons` (also as the default export). No 3D packages needed.
@@ -94,6 +95,7 @@ import JoggingJointSlider from "@wandelbots/wandelbots-js-react-components/Joggi
94
95
  | `three-stdlib` (only `/3d`) | >=2 |
95
96
  | `@react-three/fiber` (only `/3d`, `/JoggingGizmo`, `/RobotControlPanel`) | ^9 |
96
97
  | `@react-three/drei` (only `/3d`) | ^10 |
98
+ | `nats.ws` (only `/nats`) | ^1.30.3 |
97
99
 
98
100
  These packages are peer dependencies because the app and the library must use the same copy: React, the MUI theme of the app, the MobX stores that the app reads with its own `observer`, and the `<Canvas>` of React Three Fiber.
99
101
 
@@ -130,6 +132,53 @@ These packages are peer dependencies because the app and the library must use th
130
132
  - **Look:** `AppHeader` and `LoadingCover` use the styles of the design system, so they look a little different.
131
133
  - **Release asset:** `no-draco-models.zip` is gone. The models come from the NOVA API (since 4.0.0).
132
134
 
135
+ ### From ConnectedMotionGroup to RobotSession
136
+
137
+ `ConnectedMotionGroup` is deprecated. `RobotSession` replaces it: one robot of a cell, loaded and connected, with its description, live state, safety, activation, jogging and Move to. `ConnectedMotionGroup` keeps working until a later major version removes it, and `Robot` and `LinearAxis` still take it.
138
+
139
+ ```tsx
140
+ // Before
141
+ const motionGroup = await ConnectedMotionGroup.connect(nova, "0@ur5e", { cellId })
142
+ <Robot connectedMotionGroup={motionGroup} />
143
+ motionGroup.dispose()
144
+
145
+ // After
146
+ const load = loadRobotSession(nova, "0@ur5e", { cellId })
147
+ const session = await load.ready
148
+ <Robot motionGroup={robotModelOf(session)} />
149
+ load.dispose()
150
+ ```
151
+
152
+ What changes besides the names:
153
+
154
+ - **Loading:** `loadRobotSession` returns at once. `load.state` ("loading", "ready", "failed") and `load.progress` tell how far it is, `load.retry()` loads again after a failure, `await load.ready` gives the session. A failed step is retried on its own, after 1 and 2 seconds unless `retryDelaysMs` says otherwise.
155
+ - **Jogging comes with it:** `session.jogging` is the robot's `JoggingStore`. An app no longer opens it with `JoggerConnection.open` and `JoggingStore.loadFor`.
156
+ - **Nothing happens unasked:** without `storage` the jogging settings are not kept (pass `localStorage` to keep them), and a virtual robot is activated only with `autoActivateVirtual: true`.
157
+ - **Errors:** what the app calls rejects (`session.activation.activate()` with a `RobotModeChangeError`); what fails in the background (a jog, a message of the live state) goes to `onError`.
158
+ - **Several robots:** load one session per robot instead of `ConnectedMotionGroup.connectMultiple`.
159
+
160
+ | `ConnectedMotionGroup` | `RobotSession` |
161
+ | --- | --- |
162
+ | `motionGroupId`, `controllerId` | `motionGroupId`, `controllerId` (and `cellId`) |
163
+ | `modelFromController` | `description.motionGroupModel` |
164
+ | `dhParameters` | `description.dhParameters` |
165
+ | `safetyZones` | `description.safetyZones` |
166
+ | `description` | `description.motionGroupDescription` |
167
+ | `isVirtual` | `description.isVirtual` |
168
+ | `tcps` | `description.tcps` (id and name), `description.tcpOffsetsById` (position and orientation) |
169
+ | `joints` | One per joint: `description.dhParameters`, or the joint limits in `description.jointLimits` |
170
+ | `mountingPosition`, `mountingQuaternion` | `robotModelOf(session)` of `/3d` (metres and a quaternion), or `description.mounting` (mm and a rotation vector) |
171
+ | `rapidlyChangingMotionState` | `state.rapidlyChangingMotionState` |
172
+ | `controllerState` | `state.controllerState` |
173
+ | `initialMotionState`, `controller`, `motionGroup`, `motionStateSocket` | No replacement: the session keeps its connections. Read `state` instead. |
174
+ | `activationState` | `activation.state` |
175
+ | `activate()`, `deactivate()`, `toggleActivation()` | `activation.activate()`, `activation.deactivate()`, `activation.toggle()` |
176
+ | `isEstopActive`, `isMoveableSafetyState`, `isMoveableOperationMode`, `canBeMoved` | `safety.isEstopActive`, `safety.isMoveableSafetyState`, `safety.isMoveableOperationMode`, `safety.canBeMoved`; why the robot may not move: `safety.notMoveableReason` |
177
+ | `joggingVelocity`, `joggingVelocityRads`, `setJoggingVelocity()` | The velocities of `jogging`: `rotationVelocityDegPerSec`, `rotationVelocityRadsPerSec`, `translationVelocityMmPerSec`, `setVelocityFromSlider()` |
178
+ | `connectedJoggingSocket`, `planData` | No replacement (unused) |
179
+ | `dispose()` | `load.dispose()`, or `session.dispose()` |
180
+ | `<Robot connectedMotionGroup={…}>`, `<LinearAxis connectedMotionGroup={…}>` | `<Robot motionGroup={robotModelOf(session)}>`, the same for `LinearAxis`. `motionGroup` also takes a `ConnectedMotionGroup`, or the app's own data (see `RobotModelSource`). |
181
+
133
182
  ### 4.x Core Changes
134
183
 
135
184
  Robot data is now fetched from a running nova instance. This eliminates the need of shipping every react application with the robot data attached.
@@ -313,12 +362,13 @@ const orientation = useRef<Quaternion | null>(null)
313
362
 
314
363
  **Robot** - Real-time 3D robot rendering
315
364
 
316
- - Live pose updates from a `ConnectedMotionGroup`
365
+ - Takes the robot as plain data (`RobotModelSource`): `robotModelOf(session)` of a `RobotSession`, a `ConnectedMotionGroup`, or the app's own data
366
+ - Live pose updates from its motion state, at its mounting
317
367
  - The model of the motion group from the NOVA instance (`defaultGetModel`)
318
368
 
319
369
  **LinearAxis** - The same for a linear axis
320
370
 
321
- **SupportedRobot**, **SupportedLinearAxis** and **MotionGroupVisualizer** - The same without a `ConnectedMotionGroup`: they take a motion state, the model name and the DH parameters. `MotionGroupVisualizer` picks the robot or the linear axis. The `…Exact` variants show the pose without smoothing.
371
+ **SupportedRobot**, **SupportedLinearAxis** and **MotionGroupVisualizer** - The same with single props: they take a motion state, the model name and the DH parameters. `MotionGroupVisualizer` picks the robot or the linear axis. The `…Exact` variants show the pose without smoothing.
322
372
 
323
373
  **SafetyZonesRenderer** - 3D safety visualization
324
374
 
@@ -353,7 +403,8 @@ Safety components for production environments.
353
403
 
354
404
  ### Logic
355
405
 
356
- - **ConnectedMotionGroup** - A motion group with its live motion state, safety state and operation mode
406
+ - **loadRobotSession** and **RobotSession** - A robot of a cell, loaded and connected: its description, live state, safety, activation, jogging and Move to
407
+ - **ConnectedMotionGroup** (deprecated, see [From ConnectedMotionGroup to RobotSession](#from-connectedmotiongroup-to-robotsession)) - A motion group with its live motion state, safety state and operation mode
357
408
  - **MotionStreamConnection** and **JoggerConnection** - The motion state stream and the jogging connection of a motion group
358
409
  - **jointValuesEqual**, **poseEqual**, **tcpMotionEqual**, **unwrapRotationVector** - Helpers for the motion state
359
410
  - **ValueInterpolator**, **useInterpolation**, **useSmoothedMotionState** - Smooth joint values for the 3D view
@@ -365,9 +416,9 @@ Safety components for production environments.
365
416
 
366
417
  Components integrate with the Wandelbots Nova ecosystem:
367
418
 
368
- - **NovaConnection** - Where the library connects to NOVA (`nova` of `JoggingPanel`, `ConnectedMotionGroup.connect`, `MotionStreamConnection.open`, `JoggerConnection.open`, `defaultGetModel`), it takes a `NovaConnection`: the URL of the instance, or the NOVA client of the app (`Nova` of `@wandelbots/nova-js`, of any version). The library reads only the URL and the access token of the client, and connects with its own client (nova-js 4.13.0). So the app configures the connection in one place.
419
+ - **NovaConnection** - Where the library connects to NOVA (`nova` of `JoggingPanel`, `loadRobotSession`, `ConnectedMotionGroup.connect`, `MotionStreamConnection.open`, `JoggerConnection.open`, `defaultGetModel`), it takes a `NovaConnection`: the URL of the instance, or the NOVA client of the app (`Nova` of `@wandelbots/nova-js`, of any version). The library reads only the URL and the access token of the client, and connects with its own client (nova-js 4.13.0). So the app configures the connection in one place.
369
420
  - **Real-time Updates** - WebSocket connections for live robot state updates
370
- - **Motion Group Management** - Direct integration with `ConnectedMotionGroup` objects
421
+ - **Motion Group Management** - One `RobotSession` per robot (`ConnectedMotionGroup` in earlier versions)
371
422
  - **State Synchronization** - Automatic state management with MobX reactivity
372
423
 
373
424
  ### Technical Foundation
package/dist/3d.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/Robot-B3vKEVXP.cjs"),t=require("./chunks/JoggingGizmo-DGbFLWgT.cjs"),i=require("./chunks/JoggingGizmoOrientation-dzned4f4.cjs"),r=require("./chunks/RobotControlPanel-BXtBHEe9.cjs"),e=require("./chunks/Pose3-DIyg-aZA.cjs");exports.CollisionSceneRenderer=o.CollisionSceneRenderer;exports.JointLimitGizmo=o.JointLimitGizmo;exports.LinearAxis=o.LinearAxis;exports.MotionGroupVisualizer=o.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=o.MotionGroupVisualizerExact;exports.PresetEnvironment=o.PresetEnvironment;exports.Robot=o.Robot;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedLinearAxis=o.SupportedLinearAxis;exports.SupportedLinearAxisExact=o.SupportedLinearAxisExact;exports.SupportedRobot=o.SupportedRobot;exports.SupportedRobotExact=o.SupportedRobotExact;exports.TrajectoryRenderer=o.TrajectoryRenderer;exports.defaultGetModel=o.defaultGetModel;exports.JoggingGizmo=t.JoggingGizmo;exports.JoggingGizmoOrientation=i.JoggingGizmoOrientation;exports.RobotControlPanel=r.RobotControlPanel;exports.Pose3=e.Pose3;exports.ValueInterpolator=e.ValueInterpolator;exports.parseRotationToQuaternion=e.parseRotationToQuaternion;exports.quaternionToRotationVector=e.quaternionToRotationVector;exports.useSmoothedMotionState=e.useSmoothedMotionState;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/robotModelSource-BCX1Jrrd.cjs"),n=require("./chunks/JoggingGizmo-DtWw6KWg.cjs"),i=require("./chunks/JoggingGizmoOrientation-BwkW76fE.cjs"),a=require("./chunks/RobotControlPanel-DHQga5uu.cjs"),t=require("./chunks/RobotControl-DXbcloVq.cjs"),r=require("./chunks/useSmoothedMotionState-Con0E5Bx.cjs"),e=require("./chunks/Pose3-Ch4xVeXV.cjs");exports.CollisionSceneRenderer=o.CollisionSceneRenderer;exports.JointLimitGizmo=o.JointLimitGizmo;exports.LinearAxis=o.LinearAxis;exports.MotionGroupVisualizer=o.MotionGroupVisualizer;exports.MotionGroupVisualizerExact=o.MotionGroupVisualizerExact;exports.PresetEnvironment=o.PresetEnvironment;exports.Robot=o.Robot;exports.SafetyZonesRenderer=o.SafetyZonesRenderer;exports.SupportedLinearAxis=o.SupportedLinearAxis;exports.SupportedLinearAxisExact=o.SupportedLinearAxisExact;exports.SupportedRobot=o.SupportedRobot;exports.SupportedRobotExact=o.SupportedRobotExact;exports.TrajectoryRenderer=o.TrajectoryRenderer;exports.defaultGetModel=o.defaultGetModel;exports.robotModelOf=o.robotModelOf;exports.JoggingGizmo=n.JoggingGizmo;exports.JoggingGizmoOrientation=i.JoggingGizmoOrientation;exports.RobotControlPanel=a.RobotControlPanel;exports.RobotControl=t.RobotControl;exports.useRobotControlProps=t.useRobotControlProps;exports.ValueInterpolator=r.ValueInterpolator;exports.useSmoothedMotionState=r.useSmoothedMotionState;exports.Pose3=e.Pose3;exports.parseRotationToQuaternion=e.parseRotationToQuaternion;exports.quaternionToRotationVector=e.quaternionToRotationVector;
package/dist/3d.d.ts CHANGED
@@ -8,10 +8,13 @@ export { JoggingGizmoOrientation, type JoggingGizmoOrientationProps, } from "./c
8
8
  export type { JogAxis, JogDirection, JogHandle, } from "./components/jogging/jogHandle";
9
9
  export type { JogControlsProps } from "./components/jogging/useJogControls";
10
10
  export { type JogMotion, RobotControlPanel, type RobotControlIncrements, type RobotControlJogMode, type RobotControlJoint, type RobotControlJoints, type RobotControlMoveState, type RobotControlMoveTo, type RobotControlOption, type RobotControlPanelProps, type RobotControlPose, type RobotControlSelect, type RobotControlTab, type RobotControlVelocity, } from "./components/robotControl/RobotControlPanel";
11
+ export { RobotControl, type RobotControlProps, } from "./components/robotControl/RobotControl";
12
+ export { type RobotControlOptions, useRobotControlProps, } from "./components/robotControl/useRobotControlProps";
11
13
  export * from "./components/robots/LinearAxis";
12
14
  export * from "./components/robots/MotionGroupVisualizer";
13
15
  export * from "./components/robots/Robot";
14
16
  export { defaultGetModel } from "./components/robots/robotModelLogic";
17
+ export { type RobotModelSource, robotModelOf, } from "./components/robots/robotModelSource";
15
18
  export * from "./components/robots/SupportedLinearAxis";
16
19
  export * from "./components/robots/SupportedRobot";
17
20
  export { ValueInterpolator, type InterpolationOptions, } from "./components/utils/interpolation";
package/dist/3d.js CHANGED
@@ -1,29 +1,34 @@
1
- import { C as a, J as t, L as r, M as s, a as i, P as n, R as p, S as u, b as d, c as m, d as x, e as R, T as l, f as S } from "./chunks/Robot-DXhaz1tq.js";
2
- import { J as c } from "./chunks/JoggingGizmo-SuS9MmL7.js";
3
- import { J as G } from "./chunks/JoggingGizmoOrientation-x_crT_64.js";
4
- import { R as b } from "./chunks/RobotControlPanel-BiLexAWI.js";
5
- import { P as L, V as M, p as P, q as V, a as E } from "./chunks/Pose3-pocKPrHN.js";
1
+ import { C as t, J as a, L as r, M as s, a as n, P as i, R as p, S as u, b as R, c as l, d as m, e as x, T as d, f, r as S } from "./chunks/robotModelSource-C57_9QYT.js";
2
+ import { J as c } from "./chunks/JoggingGizmo-DBpDIbzl.js";
3
+ import { J as G } from "./chunks/JoggingGizmoOrientation-DU97IUWq.js";
4
+ import { R as M } from "./chunks/RobotControlPanel-CzhYCBAm.js";
5
+ import { R as z, u as C } from "./chunks/RobotControl-BDcNKq32.js";
6
+ import { V, a as E } from "./chunks/useSmoothedMotionState-COMJRcOt.js";
7
+ import { P as A, p as q, q as y } from "./chunks/Pose3-B_fLR-Wv.js";
6
8
  export {
7
- a as CollisionSceneRenderer,
9
+ t as CollisionSceneRenderer,
8
10
  c as JoggingGizmo,
9
11
  G as JoggingGizmoOrientation,
10
- t as JointLimitGizmo,
12
+ a as JointLimitGizmo,
11
13
  r as LinearAxis,
12
14
  s as MotionGroupVisualizer,
13
- i as MotionGroupVisualizerExact,
14
- L as Pose3,
15
- n as PresetEnvironment,
15
+ n as MotionGroupVisualizerExact,
16
+ A as Pose3,
17
+ i as PresetEnvironment,
16
18
  p as Robot,
17
- b as RobotControlPanel,
19
+ z as RobotControl,
20
+ M as RobotControlPanel,
18
21
  u as SafetyZonesRenderer,
19
- d as SupportedLinearAxis,
20
- m as SupportedLinearAxisExact,
21
- x as SupportedRobot,
22
- R as SupportedRobotExact,
23
- l as TrajectoryRenderer,
24
- M as ValueInterpolator,
25
- S as defaultGetModel,
26
- P as parseRotationToQuaternion,
27
- V as quaternionToRotationVector,
22
+ R as SupportedLinearAxis,
23
+ l as SupportedLinearAxisExact,
24
+ m as SupportedRobot,
25
+ x as SupportedRobotExact,
26
+ d as TrajectoryRenderer,
27
+ V as ValueInterpolator,
28
+ f as defaultGetModel,
29
+ q as parseRotationToQuaternion,
30
+ y as quaternionToRotationVector,
31
+ S as robotModelOf,
32
+ C as useRobotControlProps,
28
33
  E as useSmoothedMotionState
29
34
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPose-BStpfgEJ.cjs"),o=require("../chunks/coordSystemLabel-BJKeaGA3.cjs");exports.CurrentPose=e.CurrentPose;exports.default=e.CurrentPose;exports.useCurrentPoseProps=e.useCurrentPoseProps;exports.RobotSessionProvider=o.RobotSessionProvider;exports.useRobotSession=o.useRobotSession;
@@ -0,0 +1,3 @@
1
+ export { CurrentPose, CurrentPose as default, type CurrentPoseProps, } from "../components/currentPoseBar/CurrentPose";
2
+ export { useCurrentPoseProps } from "../components/currentPoseBar/useCurrentPoseProps";
3
+ export { RobotSessionProvider, useRobotSession, } from "../components/robotSession/RobotSessionProvider";
@@ -0,0 +1,9 @@
1
+ import { C as e, C as r, u as t } from "../chunks/CurrentPose-UJbSKPRp.js";
2
+ import { R as a, u as n } from "../chunks/coordSystemLabel-C1jfhEh5.js";
3
+ export {
4
+ e as CurrentPose,
5
+ a as RobotSessionProvider,
6
+ r as default,
7
+ t as useCurrentPoseProps,
8
+ n as useRobotSession
9
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-CyHUWmjM.cjs");exports.CurrentPoseBar=e.CurrentPoseBar;exports.default=e.CurrentPoseBar;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-ZUhFaVdM.cjs");exports.CurrentPoseBar=e.CurrentPoseBar;exports.default=e.CurrentPoseBar;
@@ -1,4 +1,4 @@
1
- import { C as e, C as o } from "../chunks/CurrentPoseBar-zTZi68tY.js";
1
+ import { C as e, C as o } from "../chunks/CurrentPoseBar-BmsPnLVP.js";
2
2
  export {
3
3
  e as CurrentPoseBar,
4
4
  o as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../chunks/JoggingButtons-CbL-5LMK.cjs");exports.JoggingButtons=t.JoggingButtons;exports.default=t.JoggingButtons;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../chunks/JoggingButtons-9nBrKbUa.cjs");exports.JoggingButtons=t.JoggingButtons;exports.default=t.JoggingButtons;
@@ -1,4 +1,4 @@
1
- import { J as a, J as g } from "../chunks/JoggingButtons-CXaozFVz.js";
1
+ import { J as a, J as g } from "../chunks/JoggingButtons-I_Y70pg8.js";
2
2
  export {
3
3
  a as JoggingButtons,
4
4
  g as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../chunks/JoggingGizmo-DGbFLWgT.cjs"),o=require("../chunks/JoggingGizmoOrientation-dzned4f4.cjs");exports.JoggingGizmo=i.JoggingGizmo;exports.default=i.JoggingGizmo;exports.JoggingGizmoOrientation=o.JoggingGizmoOrientation;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../chunks/JoggingGizmo-DtWw6KWg.cjs"),o=require("../chunks/JoggingGizmoOrientation-BwkW76fE.cjs");exports.JoggingGizmo=i.JoggingGizmo;exports.default=i.JoggingGizmo;exports.JoggingGizmoOrientation=o.JoggingGizmoOrientation;
@@ -1,5 +1,5 @@
1
- import { J as i, J as a } from "../chunks/JoggingGizmo-SuS9MmL7.js";
2
- import { J as t } from "../chunks/JoggingGizmoOrientation-x_crT_64.js";
1
+ import { J as i, J as a } from "../chunks/JoggingGizmo-DBpDIbzl.js";
2
+ import { J as t } from "../chunks/JoggingGizmoOrientation-DU97IUWq.js";
3
3
  export {
4
4
  i as JoggingGizmo,
5
5
  t as JoggingGizmoOrientation,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/JoggingJointSlider-R3_A9Ppj.cjs");exports.JoggingJointSlider=e.JoggingJointSlider;exports.default=e.JoggingJointSlider;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/JoggingJointSlider-DHBB7MwU.cjs");exports.JoggingJointSlider=e.JoggingJointSlider;exports.default=e.JoggingJointSlider;
@@ -1,4 +1,4 @@
1
- import { J as a, J as e } from "../chunks/JoggingJointSlider-CZ-k6XCa.js";
1
+ import { J as a, J as e } from "../chunks/JoggingJointSlider-DeMqm9Jh.js";
2
2
  export {
3
3
  a as JoggingJointSlider,
4
4
  e as default
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControl-DXbcloVq.cjs"),e=require("../chunks/coordSystemLabel-BJKeaGA3.cjs");exports.RobotControl=o.RobotControl;exports.default=o.RobotControl;exports.useRobotControlProps=o.useRobotControlProps;exports.RobotSessionProvider=e.RobotSessionProvider;exports.useRobotSession=e.useRobotSession;
@@ -0,0 +1,3 @@
1
+ export { RobotControl, RobotControl as default, type RobotControlProps, } from "../components/robotControl/RobotControl";
2
+ export { type RobotControlOptions, useRobotControlProps, } from "../components/robotControl/useRobotControlProps";
3
+ export { RobotSessionProvider, useRobotSession, } from "../components/robotSession/RobotSessionProvider";
@@ -0,0 +1,9 @@
1
+ import { R as r, R as t, u as e } from "../chunks/RobotControl-BDcNKq32.js";
2
+ import { R as a, u } from "../chunks/coordSystemLabel-C1jfhEh5.js";
3
+ export {
4
+ r as RobotControl,
5
+ a as RobotSessionProvider,
6
+ t as default,
7
+ e as useRobotControlProps,
8
+ u as useRobotSession
9
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControlPanel-BXtBHEe9.cjs");exports.RobotControlPanel=o.RobotControlPanel;exports.default=o.RobotControlPanel;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControlPanel-DHQga5uu.cjs");exports.RobotControlPanel=o.RobotControlPanel;exports.default=o.RobotControlPanel;
@@ -1,4 +1,4 @@
1
- import { R as t, R as e } from "../chunks/RobotControlPanel-BiLexAWI.js";
1
+ import { R as t, R as e } from "../chunks/RobotControlPanel-CzhYCBAm.js";
2
2
  export {
3
3
  t as RobotControlPanel,
4
4
  e as default
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/RobotHeader-Daft80jq.cjs");exports.RobotHeader=e.RobotHeader;exports.default=e.RobotHeader;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/robotActivationOf-DXC0E2DS.cjs"),t=require("../chunks/robotSafetyOf-CwfVV9__.cjs");exports.ConnectionWarning=o.ConnectionWarning;exports.RobotHeader=o.RobotHeader;exports.connectionWarningOf=o.connectionWarningOf;exports.default=o.RobotHeader;exports.robotActivationOf=o.robotActivationOf;exports.robotSafetyOf=t.robotSafetyOf;
@@ -1,4 +1,8 @@
1
1
  export type { AppItem } from "../components/AppHeader";
2
2
  export type { RobotControlOption, RobotControlSelect, } from "../components/robotControl/RobotControlPanel";
3
3
  export { RobotHeader, RobotHeader as default, type RobotHeaderActivation, type RobotHeaderActivationState, type RobotHeaderProps, } from "../components/robotHeader/RobotHeader";
4
+ export { robotActivationOf } from "../components/robotHeader/robotActivationOf";
5
+ export { robotSafetyOf } from "../components/robotHeader/robotSafetyOf";
4
6
  export type { SafetyBarProps } from "../SafetyBar/SafetyBar";
7
+ export { type ConnectionQuality, ConnectionWarning, type ConnectionWarningProps, } from "../components/connectionWarning/ConnectionWarning";
8
+ export { connectionWarningOf } from "../components/connectionWarning/connectionWarningOf";
@@ -1,5 +1,10 @@
1
- import { R as o, R as r } from "../chunks/RobotHeader-DDmDkUoV.js";
1
+ import { C as n, a as r, c as t, a as e, r as f } from "../chunks/robotActivationOf-E1GLe_69.js";
2
+ import { r as s } from "../chunks/robotSafetyOf-P4RgO2LQ.js";
2
3
  export {
3
- o as RobotHeader,
4
- r as default
4
+ n as ConnectionWarning,
5
+ r as RobotHeader,
6
+ t as connectionWarningOf,
7
+ e as default,
8
+ f as robotActivationOf,
9
+ s as robotSafetyOf
5
10
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/SafetyBar-BVk-SH_0.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/robotSafetyOf-CwfVV9__.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;exports.robotSafetyOf=e.robotSafetyOf;
@@ -1,2 +1,3 @@
1
1
  export * from "./SafetyBar";
2
2
  export { SafetyBar as default } from "./SafetyBar";
3
+ export { robotSafetyOf } from "../components/robotHeader/robotSafetyOf";
@@ -1,5 +1,6 @@
1
- import { S as f, S as r } from "../chunks/SafetyBar-RkN0I1Cb.js";
1
+ import { S as r, S as t, r as e } from "../chunks/robotSafetyOf-P4RgO2LQ.js";
2
2
  export {
3
- f as SafetyBar,
4
- r as default
3
+ r as SafetyBar,
4
+ t as default,
5
+ e as robotSafetyOf
5
6
  };
@@ -0,0 +1 @@
1
+ "use strict";const S=require("react/jsx-runtime"),b=require("mobx-react-lite"),m=require("./coordSystemLabel-BJKeaGA3.cjs"),f=require("./CurrentPoseBar-ZUhFaVdM.cjs"),p=require("react"),q=require("react-i18next"),x=require("./externalizeComponent-CkWiNBu0.cjs");function g(s){var u,d,l;const e=s.jogging,{t:r}=q.useTranslation(void 0,{i18n:x.i18n}),[o,n]=p.useState(e.selectedTcpId),[i,C]=p.useState(e.selectedCoordSystemId),c=e.tcpsById[o]?o:e.selectedTcpId,a=e.coordSystemsById[i]?i:e.selectedCoordSystemId,y=(l=(d=(u=e.jogger.motionStream.rapidlyChangingMotionState.execute)==null?void 0:u.details)==null?void 0:d.state)==null?void 0:l.kind,I=e.lastJogErrorTranslationKey?r(e.lastJogErrorTranslationKey):e.lastJogError;function P(){const t=e.tcpPoseIn(c,a);return!(t!=null&&t.position)||!t.orientation?null:{position:t.position,orientation:t.orientation}}return{getCurrentPose:P,tcp:e.tcps.length>0?{options:e.tcps.map(t=>({id:t.id,label:t.id})),value:c,onChange:n}:void 0,frame:{options:e.coordSystems.map(t=>({id:t.coordinate_system,label:m.coordSystemLabel(e,t)})),value:a,onChange:C},state:y,error:I}}const T=b.observer(function({session:e,...r}){const o=m.useRobotSessionOf(e),n=g(o);return S.jsx(f.CurrentPoseBar,{...n,...r})});exports.CurrentPose=T;exports.useCurrentPoseProps=g;
@@ -0,0 +1,51 @@
1
+ import { jsx as y } from "react/jsx-runtime";
2
+ import { observer as I } from "mobx-react-lite";
3
+ import { c as S, a as P } from "./coordSystemLabel-C1jfhEh5.js";
4
+ import { C as b } from "./CurrentPoseBar-BmsPnLVP.js";
5
+ import { useState as l } from "react";
6
+ import { useTranslation as T } from "react-i18next";
7
+ import { i as v } from "./externalizeComponent-CPAVvPKk.js";
8
+ function h(n) {
9
+ var d, p, m;
10
+ const o = n.jogging, { t: r } = T(void 0, { i18n: v }), [e, s] = l(o.selectedTcpId), [i, u] = l(o.selectedCoordSystemId), a = o.tcpsById[e] ? e : o.selectedTcpId, c = o.coordSystemsById[i] ? i : o.selectedCoordSystemId, f = (m = (p = (d = o.jogger.motionStream.rapidlyChangingMotionState.execute) == null ? void 0 : d.details) == null ? void 0 : p.state) == null ? void 0 : m.kind, g = o.lastJogErrorTranslationKey ? r(o.lastJogErrorTranslationKey) : o.lastJogError;
11
+ function C() {
12
+ const t = o.tcpPoseIn(a, c);
13
+ return !(t != null && t.position) || !t.orientation ? null : {
14
+ position: t.position,
15
+ orientation: t.orientation
16
+ };
17
+ }
18
+ return {
19
+ getCurrentPose: C,
20
+ tcp: o.tcps.length > 0 ? {
21
+ // As the Robot control panel names them
22
+ options: o.tcps.map((t) => ({
23
+ id: t.id,
24
+ label: t.id
25
+ })),
26
+ value: a,
27
+ onChange: s
28
+ } : void 0,
29
+ frame: {
30
+ options: o.coordSystems.map((t) => ({
31
+ id: t.coordinate_system,
32
+ label: S(o, t)
33
+ })),
34
+ value: c,
35
+ onChange: u
36
+ },
37
+ state: f,
38
+ error: g
39
+ };
40
+ }
41
+ const F = I(function({
42
+ session: o,
43
+ ...r
44
+ }) {
45
+ const e = P(o), s = h(e);
46
+ return /* @__PURE__ */ y(b, { ...s, ...r });
47
+ });
48
+ export {
49
+ F as C,
50
+ h as u
51
+ };
@@ -8,8 +8,8 @@ import { ContentCopyFilled as tn } from "@wandelbots/icons/ContentCopyFilled";
8
8
  import { Settings as on } from "@wandelbots/icons/Settings";
9
9
  import { memo as rn, useId as K, useRef as $, useState as j, useCallback as T } from "react";
10
10
  import { useTranslation as U } from "react-i18next";
11
- import { e as an } from "./externalizeComponent-_w2d1_pz.js";
12
- import { P as B, u as sn, a as ln, p as cn } from "./useEveryFrame-G_-ma1nC.js";
11
+ import { e as an } from "./externalizeComponent-CPAVvPKk.js";
12
+ import { P as B, c as sn, u as ln, b as cn } from "./useEveryFrame-DAuNawGP.js";
13
13
  import { S as un } from "./SmallSelect-BdD9uLKK.js";
14
14
  import pn from "@mui/material/ListSubheader";
15
15
  import dn from "@mui/material/MenuItem";
@@ -1 +1 @@
1
- "use strict";const t=require("react/jsx-runtime"),$=require("@mui/material/Divider"),Z=require("@mui/material/IconButton"),b=require("@mui/material/Stack"),G=require("@mui/material/Tooltip"),R=require("@mui/material/Typography"),J=require("@wandelbots/icons/ContentCopyFilled"),H=require("@wandelbots/icons/Settings"),d=require("react"),F=require("react-i18next"),K=require("./externalizeComponent-BdxGBLIv.cjs"),y=require("./useEveryFrame-dmPPTKtT.cjs"),ee=require("./SmallSelect-Dcsd7_6_.cjs"),ne=require("@mui/material/ListSubheader"),te=require("@mui/material/MenuItem"),re=require("@mui/material/Popover"),oe=require("@wandelbots/mui"),ie=require("@mui/material/Box"),D=["XYZ","XZY","YXZ","YZX","ZXY","ZYX","XYX","XZX","YXY","YZY","ZXZ","ZYZ"],ae=[...D.map(e=>`EULER_ANGLES_INTRINSIC_${e}`),...D.map(e=>`EULER_ANGLES_EXTRINSIC_${e}`)];function N(e){const n=e.slice(e.lastIndexOf("_")+1);return{intrinsic:e.includes("_INTRINSIC_"),axes:[...n]}}function z([e,n,r]){const o=Math.hypot(e,n,r);if(o<1e-12)return[0,0,0,1];const c=Math.sin(o/2)/o;return[e*c,n*c,r*c,Math.cos(o/2)]}const U={X:0,Y:1,Z:2};function se(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function le(e,n){const{intrinsic:r,axes:o}=N(n),c=r?[...o].reverse():o,i=U[c[0]],s=U[c[1]],p=c[0]===c[2],a=p?3-i-s:U[c[2]],x=(i-s)*(s-a)*(a-i)/2,q=Math.hypot(...e)||1,[L,A,I,m]=e.map(V=>V/q),S=[L,A,I],j=S[i]??0,f=S[s]??0,v=(S[a]??0)*x,[T,g,O,_]=p?[m,j,f,v]:[m-f,j+v,f+m,v-j];let C=2*Math.atan2(Math.hypot(O,_),Math.hypot(T,g));const E=Math.atan2(g,T),P=Math.atan2(_,O);let l,u;const h=1e-7;return Math.abs(C)<=h?(l=2*E,u=0):Math.abs(C-Math.PI)<=h?(l=-2*P,u=0):(l=E-P,u=E+P),p||(u*=x,C-=Math.PI/2),(r?[u,C,l]:[l,C,u]).map(se)}function X({children:e}){return t.jsx(ne,{children:e})}X.muiSkipListHighlight=!0;function ce({value:e,onChange:n}){const{t:r}=F.useTranslation(),o=d.useId(),c=s=>{const{intrinsic:p,axes:a}=N(s);return r(p?"CurrentPose.EulerConvention.Intrinsic.lb":"CurrentPose.EulerConvention.Extrinsic.lb",{axes:a.join("")})},i=s=>ae.filter(p=>N(p).intrinsic===s).map(p=>t.jsx(te,{value:p,children:N(p).axes.join("")},p));return t.jsxs(oe.AdornedSelect,{label:r("CurrentPose.EulerConvention.lb"),labelId:o,value:e,renderValue:s=>c(s),onChange:s=>n(s.target.value),children:[t.jsx(X,{children:r("CurrentPose.EulerConvention.Intrinsic.hlb")}),i(!0),t.jsx(X,{children:r("CurrentPose.EulerConvention.Extrinsic.hlb")}),i(!1)]})}const ue=d.memo(pe,(e,n)=>e.anchor===n.anchor&&e.open===n.open&&e.onClose===n.onClose&&e.onChange===n.onChange&&e.format.type===n.format.type&&e.format.angleUnit===n.format.angleUnit&&e.format.eulerConvention===n.format.eulerConvention);function pe({anchor:e,open:n,onClose:r,format:o,onChange:c}){const{t:i}=F.useTranslation(),s=i("CurrentPose.OrientationFormat.ti"),p=a=>c({...o,...a});return t.jsxs(re,{open:n,anchorEl:e,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":s,sx:a=>{var x;return{width:"264px",padding:"16px",display:"flex",flexDirection:"column",gap:"16px",borderRadius:"10px",border:`1px solid ${a.palette.divider}`,background:(x=a.palette.backgroundPaperElevation)==null?void 0:x[2],backgroundImage:"none",boxShadow:a.shadows[16]}}}},children:[t.jsx(R,{variant:"subtitle2",color:"text.primary",children:s}),t.jsx($,{}),t.jsxs(b,{sx:{gap:"8px"},children:[t.jsx(y.PanelSelect,{label:i("CurrentPose.Format.lb"),options:[{id:"rotationVector",label:i("CurrentPose.Format.RotationVector.lb")},{id:"eulerAngles",label:i("CurrentPose.Format.EulerAngles.lb")},{id:"quaternion",label:i("CurrentPose.Format.Quaternion.lb")}],value:o.type,onChange:a=>p({type:a}),disabled:!1}),o.type!=="quaternion"&&t.jsx(y.PanelSelect,{label:i("CurrentPose.AngleUnit.lb"),options:[{id:"rad",label:i("CurrentPose.AngleUnit.Radians.lb")},{id:"deg",label:i("CurrentPose.AngleUnit.Degrees.lb")}],value:o.angleUnit,onChange:a=>p({angleUnit:a}),disabled:!1}),o.type==="eulerAngles"&&t.jsx(ce,{value:o.eulerConvention,onChange:a=>p({eulerConvention:a})})]})]})}const de={type:"rotationVector",angleUnit:"rad",eulerConvention:"EULER_ANGLES_EXTRINSIC_XYZ"};function w(e,n){const r=e.toFixed(n);return Number(r)===0?0 .toFixed(n):r}function B(e,n){return n==="deg"?`${w(e*180/Math.PI,1)}°`:`${w(e,3)} rad`}function xe(e){switch(e.type){case"quaternion":return["Qx","Qy","Qz","Qw"];case"eulerAngles":return N(e.eulerConvention).axes.map(n=>`R${n.toLowerCase()}`);default:return["Rx","Ry","Rz"]}}function he(e,n){switch(n.type){case"quaternion":return z(e).map(r=>w(r,3));case"eulerAngles":return le(z(e),n.eulerConvention).map(r=>B(r,n.angleUnit));default:return e.map(r=>B(r,n.angleUnit))}}function ge(e,n){const r=["x","y","z"].map((i,s)=>({label:i.toUpperCase(),value:e?w(e.position[s]??0,1):"–",kind:i})),o=e?he(e.orientation,n):null,c=xe(n).map((i,s)=>({label:i,value:(o==null?void 0:o[s])??"–",kind:"orientation"}));return[...r,...c]}const Ce={KIND_UNKNOWN:"success.main",RUNNING:"info.main",PAUSED_NEAR_COLLISION:"warning.main",PAUSED_NEAR_JOINT_LIMIT:"warning.main",PAUSED_NEAR_SINGULARITY:"warning.main"};function be({state:e,error:n}){const{t:r}=F.useTranslation(),o=e??"KIND_UNKNOWN",c=n||r(`Jogging.StreamStateSection.${o}.lb`),i=n?"error.main":Ce[o]??"text.secondary";return t.jsx(G,{title:n?c:"",placement:"top-end",children:t.jsxs(b,{direction:"row","data-testid":n?"JOG_ERROR":o,sx:{gap:"5px",alignItems:"center",minWidth:0},children:[t.jsx(ie,{sx:{width:"6px",height:"6px",borderRadius:"50%",flexShrink:0,bgcolor:i}}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{color:i,letterSpacing:"0.17px"},children:c})]})})}const k={letterSpacing:"0.17px"},me={x:"error.main",y:"success.main",z:"info.main",orientation:"grey.600"};function Q({children:e,id:n}){return t.jsx(R,{id:n,variant:"caption",color:"text.secondary",noWrap:!0,sx:k,children:e})}function W({label:e,...n}){const r=d.useId();return t.jsxs(b,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[t.jsx(Q,{id:r,children:e}),t.jsx(ee.SmallSelect,{labelId:r,width:"172px",...n})]})}const M=()=>t.jsx($,{orientation:"vertical",flexItem:!1,sx:{height:"16px"}}),ve=K.externalizeComponent(({getCurrentPose:e,tcp:n,frame:r,state:o,error:c,orientationFormat:i,onOrientationFormatChange:s,sx:p})=>{const{t:a}=F.useTranslation(),x=d.useRef(null),[q,L]=d.useState(de),A=i??q,[I,m]=d.useState(null),{copied:S,copy:j}=y.useCopyText(),f=y.useEveryFrame(()=>JSON.stringify(e()),!0),v=JSON.parse(f),T=ge(v,A),g=d.useRef({tcp:n,frame:r,onOrientationFormatChange:s});g.current={tcp:n,frame:r,onOrientationFormatChange:s};const O=d.useCallback(l=>{var u;return(u=g.current.tcp)==null?void 0:u.onChange(l)},[]),_=d.useCallback(l=>{var u;return(u=g.current.frame)==null?void 0:u.onChange(l)},[]),C=d.useCallback(l=>{var u,h;L(l),(h=(u=g.current).onOrientationFormatChange)==null||h.call(u,l)},[]),E=d.useCallback(()=>m(null),[]);function P(){const l=e();l&&j(y.poseToText(l))}return t.jsxs(b,{ref:x,direction:"row","data-testid":"current-pose-bar",sx:[l=>{var u;return{alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"8px 16px",minHeight:"54px",boxSizing:"border-box",borderRadius:"10px",border:`1px solid ${l.palette.divider}`,background:(u=l.palette.backgroundPaperElevation)==null?void 0:u[2],boxShadow:l.shadows[16]}},...Array.isArray(p)?p:[p]],children:[t.jsxs(b,{direction:"row",sx:{gap:"12px",alignItems:"center",minWidth:0},children:[t.jsx(Q,{children:a("CurrentPose.Title.lb")}),t.jsx(Z,{"aria-label":a("CurrentPose.OrientationFormat.ti"),"aria-haspopup":"dialog","aria-expanded":I!==null,onClick:()=>m(x.current),sx:{padding:"3px",margin:"-3px",color:"text.secondary"},children:t.jsx(H.Settings,{})}),n&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("RobotControl.Tcp.lb"),options:n.options,value:n.value,onChange:O})]}),r&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("CurrentPose.RelativeTo.lb"),options:r.options,value:r.value,onChange:_})]}),t.jsx(M,{}),t.jsx(b,{direction:"row","data-testid":"current-pose-values",sx:{gap:"12px",alignItems:"center",minWidth:0,overflow:"hidden"},children:T.map(({label:l,value:u,kind:h},Y)=>t.jsxs(b,{direction:"row",sx:{gap:h==="orientation"?"1px":"2px"},children:[t.jsx(R,{variant:"caption",sx:{...k,color:me[h]},children:l}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{...k,color:"text.secondary",fontVariantNumeric:"tabular-nums"},children:u})]},Y))}),t.jsx(G,{title:a("CurrentPose.Copied.lb"),open:S,disableHoverListener:!0,placement:"top",children:t.jsx("span",{children:t.jsx(Z,{"aria-label":a("CurrentPose.Copy.bt"),onClick:P,disabled:!v,sx:{width:"30px",height:"30px",padding:"5px",borderRadius:"10px",color:"text.secondary","& svg":{width:"20px",height:"20px"}},children:t.jsx(J.ContentCopyFilled,{})})})})]}),t.jsx(be,{state:o,error:c}),t.jsx(ue,{anchor:I,open:I!==null,onClose:E,format:A,onChange:C})]})});exports.CurrentPoseBar=ve;
1
+ "use strict";const t=require("react/jsx-runtime"),$=require("@mui/material/Divider"),Z=require("@mui/material/IconButton"),b=require("@mui/material/Stack"),G=require("@mui/material/Tooltip"),R=require("@mui/material/Typography"),J=require("@wandelbots/icons/ContentCopyFilled"),H=require("@wandelbots/icons/Settings"),d=require("react"),F=require("react-i18next"),K=require("./externalizeComponent-CkWiNBu0.cjs"),y=require("./useEveryFrame-CHxg25f4.cjs"),ee=require("./SmallSelect-Dcsd7_6_.cjs"),ne=require("@mui/material/ListSubheader"),te=require("@mui/material/MenuItem"),re=require("@mui/material/Popover"),oe=require("@wandelbots/mui"),ie=require("@mui/material/Box"),D=["XYZ","XZY","YXZ","YZX","ZXY","ZYX","XYX","XZX","YXY","YZY","ZXZ","ZYZ"],ae=[...D.map(e=>`EULER_ANGLES_INTRINSIC_${e}`),...D.map(e=>`EULER_ANGLES_EXTRINSIC_${e}`)];function N(e){const n=e.slice(e.lastIndexOf("_")+1);return{intrinsic:e.includes("_INTRINSIC_"),axes:[...n]}}function z([e,n,r]){const o=Math.hypot(e,n,r);if(o<1e-12)return[0,0,0,1];const c=Math.sin(o/2)/o;return[e*c,n*c,r*c,Math.cos(o/2)]}const U={X:0,Y:1,Z:2};function se(e){return e>Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e}function le(e,n){const{intrinsic:r,axes:o}=N(n),c=r?[...o].reverse():o,i=U[c[0]],s=U[c[1]],p=c[0]===c[2],a=p?3-i-s:U[c[2]],x=(i-s)*(s-a)*(a-i)/2,q=Math.hypot(...e)||1,[L,A,I,m]=e.map(V=>V/q),S=[L,A,I],j=S[i]??0,f=S[s]??0,v=(S[a]??0)*x,[T,g,O,_]=p?[m,j,f,v]:[m-f,j+v,f+m,v-j];let C=2*Math.atan2(Math.hypot(O,_),Math.hypot(T,g));const E=Math.atan2(g,T),P=Math.atan2(_,O);let l,u;const h=1e-7;return Math.abs(C)<=h?(l=2*E,u=0):Math.abs(C-Math.PI)<=h?(l=-2*P,u=0):(l=E-P,u=E+P),p||(u*=x,C-=Math.PI/2),(r?[u,C,l]:[l,C,u]).map(se)}function X({children:e}){return t.jsx(ne,{children:e})}X.muiSkipListHighlight=!0;function ce({value:e,onChange:n}){const{t:r}=F.useTranslation(),o=d.useId(),c=s=>{const{intrinsic:p,axes:a}=N(s);return r(p?"CurrentPose.EulerConvention.Intrinsic.lb":"CurrentPose.EulerConvention.Extrinsic.lb",{axes:a.join("")})},i=s=>ae.filter(p=>N(p).intrinsic===s).map(p=>t.jsx(te,{value:p,children:N(p).axes.join("")},p));return t.jsxs(oe.AdornedSelect,{label:r("CurrentPose.EulerConvention.lb"),labelId:o,value:e,renderValue:s=>c(s),onChange:s=>n(s.target.value),children:[t.jsx(X,{children:r("CurrentPose.EulerConvention.Intrinsic.hlb")}),i(!0),t.jsx(X,{children:r("CurrentPose.EulerConvention.Extrinsic.hlb")}),i(!1)]})}const ue=d.memo(pe,(e,n)=>e.anchor===n.anchor&&e.open===n.open&&e.onClose===n.onClose&&e.onChange===n.onChange&&e.format.type===n.format.type&&e.format.angleUnit===n.format.angleUnit&&e.format.eulerConvention===n.format.eulerConvention);function pe({anchor:e,open:n,onClose:r,format:o,onChange:c}){const{t:i}=F.useTranslation(),s=i("CurrentPose.OrientationFormat.ti"),p=a=>c({...o,...a});return t.jsxs(re,{open:n,anchorEl:e,onClose:r,anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"bottom",horizontal:"left"},slotProps:{paper:{role:"dialog","aria-label":s,sx:a=>{var x;return{width:"264px",padding:"16px",display:"flex",flexDirection:"column",gap:"16px",borderRadius:"10px",border:`1px solid ${a.palette.divider}`,background:(x=a.palette.backgroundPaperElevation)==null?void 0:x[2],backgroundImage:"none",boxShadow:a.shadows[16]}}}},children:[t.jsx(R,{variant:"subtitle2",color:"text.primary",children:s}),t.jsx($,{}),t.jsxs(b,{sx:{gap:"8px"},children:[t.jsx(y.PanelSelect,{label:i("CurrentPose.Format.lb"),options:[{id:"rotationVector",label:i("CurrentPose.Format.RotationVector.lb")},{id:"eulerAngles",label:i("CurrentPose.Format.EulerAngles.lb")},{id:"quaternion",label:i("CurrentPose.Format.Quaternion.lb")}],value:o.type,onChange:a=>p({type:a}),disabled:!1}),o.type!=="quaternion"&&t.jsx(y.PanelSelect,{label:i("CurrentPose.AngleUnit.lb"),options:[{id:"rad",label:i("CurrentPose.AngleUnit.Radians.lb")},{id:"deg",label:i("CurrentPose.AngleUnit.Degrees.lb")}],value:o.angleUnit,onChange:a=>p({angleUnit:a}),disabled:!1}),o.type==="eulerAngles"&&t.jsx(ce,{value:o.eulerConvention,onChange:a=>p({eulerConvention:a})})]})]})}const de={type:"rotationVector",angleUnit:"rad",eulerConvention:"EULER_ANGLES_EXTRINSIC_XYZ"};function w(e,n){const r=e.toFixed(n);return Number(r)===0?0 .toFixed(n):r}function B(e,n){return n==="deg"?`${w(e*180/Math.PI,1)}°`:`${w(e,3)} rad`}function xe(e){switch(e.type){case"quaternion":return["Qx","Qy","Qz","Qw"];case"eulerAngles":return N(e.eulerConvention).axes.map(n=>`R${n.toLowerCase()}`);default:return["Rx","Ry","Rz"]}}function he(e,n){switch(n.type){case"quaternion":return z(e).map(r=>w(r,3));case"eulerAngles":return le(z(e),n.eulerConvention).map(r=>B(r,n.angleUnit));default:return e.map(r=>B(r,n.angleUnit))}}function ge(e,n){const r=["x","y","z"].map((i,s)=>({label:i.toUpperCase(),value:e?w(e.position[s]??0,1):"–",kind:i})),o=e?he(e.orientation,n):null,c=xe(n).map((i,s)=>({label:i,value:(o==null?void 0:o[s])??"–",kind:"orientation"}));return[...r,...c]}const Ce={KIND_UNKNOWN:"success.main",RUNNING:"info.main",PAUSED_NEAR_COLLISION:"warning.main",PAUSED_NEAR_JOINT_LIMIT:"warning.main",PAUSED_NEAR_SINGULARITY:"warning.main"};function be({state:e,error:n}){const{t:r}=F.useTranslation(),o=e??"KIND_UNKNOWN",c=n||r(`Jogging.StreamStateSection.${o}.lb`),i=n?"error.main":Ce[o]??"text.secondary";return t.jsx(G,{title:n?c:"",placement:"top-end",children:t.jsxs(b,{direction:"row","data-testid":n?"JOG_ERROR":o,sx:{gap:"5px",alignItems:"center",minWidth:0},children:[t.jsx(ie,{sx:{width:"6px",height:"6px",borderRadius:"50%",flexShrink:0,bgcolor:i}}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{color:i,letterSpacing:"0.17px"},children:c})]})})}const k={letterSpacing:"0.17px"},me={x:"error.main",y:"success.main",z:"info.main",orientation:"grey.600"};function Q({children:e,id:n}){return t.jsx(R,{id:n,variant:"caption",color:"text.secondary",noWrap:!0,sx:k,children:e})}function W({label:e,...n}){const r=d.useId();return t.jsxs(b,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[t.jsx(Q,{id:r,children:e}),t.jsx(ee.SmallSelect,{labelId:r,width:"172px",...n})]})}const M=()=>t.jsx($,{orientation:"vertical",flexItem:!1,sx:{height:"16px"}}),ve=K.externalizeComponent(({getCurrentPose:e,tcp:n,frame:r,state:o,error:c,orientationFormat:i,onOrientationFormatChange:s,sx:p})=>{const{t:a}=F.useTranslation(),x=d.useRef(null),[q,L]=d.useState(de),A=i??q,[I,m]=d.useState(null),{copied:S,copy:j}=y.useCopyText(),f=y.useEveryFrame(()=>JSON.stringify(e()),!0),v=JSON.parse(f),T=ge(v,A),g=d.useRef({tcp:n,frame:r,onOrientationFormatChange:s});g.current={tcp:n,frame:r,onOrientationFormatChange:s};const O=d.useCallback(l=>{var u;return(u=g.current.tcp)==null?void 0:u.onChange(l)},[]),_=d.useCallback(l=>{var u;return(u=g.current.frame)==null?void 0:u.onChange(l)},[]),C=d.useCallback(l=>{var u,h;L(l),(h=(u=g.current).onOrientationFormatChange)==null||h.call(u,l)},[]),E=d.useCallback(()=>m(null),[]);function P(){const l=e();l&&j(y.poseToText(l))}return t.jsxs(b,{ref:x,direction:"row","data-testid":"current-pose-bar",sx:[l=>{var u;return{alignItems:"center",justifyContent:"space-between",gap:"12px",padding:"8px 16px",minHeight:"54px",boxSizing:"border-box",borderRadius:"10px",border:`1px solid ${l.palette.divider}`,background:(u=l.palette.backgroundPaperElevation)==null?void 0:u[2],boxShadow:l.shadows[16]}},...Array.isArray(p)?p:[p]],children:[t.jsxs(b,{direction:"row",sx:{gap:"12px",alignItems:"center",minWidth:0},children:[t.jsx(Q,{children:a("CurrentPose.Title.lb")}),t.jsx(Z,{"aria-label":a("CurrentPose.OrientationFormat.ti"),"aria-haspopup":"dialog","aria-expanded":I!==null,onClick:()=>m(x.current),sx:{padding:"3px",margin:"-3px",color:"text.secondary"},children:t.jsx(H.Settings,{})}),n&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("RobotControl.Tcp.lb"),options:n.options,value:n.value,onChange:O})]}),r&&t.jsxs(t.Fragment,{children:[t.jsx(M,{}),t.jsx(W,{label:a("CurrentPose.RelativeTo.lb"),options:r.options,value:r.value,onChange:_})]}),t.jsx(M,{}),t.jsx(b,{direction:"row","data-testid":"current-pose-values",sx:{gap:"12px",alignItems:"center",minWidth:0,overflow:"hidden"},children:T.map(({label:l,value:u,kind:h},Y)=>t.jsxs(b,{direction:"row",sx:{gap:h==="orientation"?"1px":"2px"},children:[t.jsx(R,{variant:"caption",sx:{...k,color:me[h]},children:l}),t.jsx(R,{variant:"caption",noWrap:!0,sx:{...k,color:"text.secondary",fontVariantNumeric:"tabular-nums"},children:u})]},Y))}),t.jsx(G,{title:a("CurrentPose.Copied.lb"),open:S,disableHoverListener:!0,placement:"top",children:t.jsx("span",{children:t.jsx(Z,{"aria-label":a("CurrentPose.Copy.bt"),onClick:P,disabled:!v,sx:{width:"30px",height:"30px",padding:"5px",borderRadius:"10px",color:"text.secondary","& svg":{width:"20px",height:"20px"}},children:t.jsx(J.ContentCopyFilled,{})})})})]}),t.jsx(be,{state:o,error:c}),t.jsx(ue,{anchor:I,open:I!==null,onClose:E,format:A,onChange:C})]})});exports.CurrentPoseBar=ve;
@@ -1 +1 @@
1
- "use strict";const o=require("react/jsx-runtime"),j=require("@mui/material/Box"),d=require("@mui/material/Button"),x=require("@mui/material/Stack"),l=require("@mui/material/styles"),m=require("@mui/material/Typography"),q=require("@wandelbots/icons/Rotation"),f=require("@wandelbots/mui"),I=require("./externalizeComponent-BdxGBLIv.cjs"),t=require("./joggingColors-ZDc_2UCp.cjs");function y({axis:e,motion:n,disabled:i}){const r=t.jogAxisColors[e];return o.jsx(j,{"aria-hidden":!0,sx:{opacity:i?.4:1,width:30,height:30,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1,backgroundColor:l.alpha(r,.15),border:`1px solid ${l.alpha(r,.4)}`},children:o.jsx(m,{variant:"caption",sx:{color:r},children:n==="rotate"?`R${e}`:e.toUpperCase()})})}function R(e){return o.jsx(q.Rotation,{style:e.direction==="-"?{transform:"scaleX(-1)"}:void 0})}const v=I.externalizeComponent(e=>{const{motion:n="translate",disabled:i=!1}=e,{handlersFor:r,label:C,isPressed:b}=t.useJogControls(e);return o.jsx(x,{"data-testid":"jogging-buttons",sx:{gap:"16px",width:280,maxWidth:"100%"},children:t.JOG_AXES.map(a=>o.jsxs(x,{direction:"row",sx:{alignItems:"center",gap:"16px"},children:[o.jsx(y,{axis:a,motion:n,disabled:i}),t.JOG_DIRECTIONS.map(c=>{const s={axis:a,direction:c},u=b(s),g=n==="rotate"?R(s):void 0,h=t.jogAxisColors[a],p={backgroundColor:l.alpha(h,.25),borderColor:l.alpha(h,.4)};return o.jsx(f.SecondaryButton,{size:"large",disabled:i,"aria-label":C(s),"aria-pressed":u,startIcon:c==="-"?g:void 0,endIcon:c==="+"?g:void 0,...r(s),sx:{flex:1,touchAction:"none",userSelect:"none","& svg":{width:24,height:24},[`& .${d.buttonClasses.startIcon}`]:{marginLeft:"-6px"},[`& .${d.buttonClasses.endIcon}`]:{marginRight:"-6px"},...u&&{...p,[`&.${d.buttonClasses.disabled}`]:p}},children:t.jogHandleName(s,n)},c)})]},a))})});exports.JoggingButtons=v;
1
+ "use strict";const o=require("react/jsx-runtime"),j=require("@mui/material/Box"),d=require("@mui/material/Button"),x=require("@mui/material/Stack"),l=require("@mui/material/styles"),m=require("@mui/material/Typography"),q=require("@wandelbots/icons/Rotation"),f=require("@wandelbots/mui"),I=require("./externalizeComponent-CkWiNBu0.cjs"),t=require("./joggingColors-ZDc_2UCp.cjs");function y({axis:e,motion:n,disabled:i}){const r=t.jogAxisColors[e];return o.jsx(j,{"aria-hidden":!0,sx:{opacity:i?.4:1,width:30,height:30,flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:1,backgroundColor:l.alpha(r,.15),border:`1px solid ${l.alpha(r,.4)}`},children:o.jsx(m,{variant:"caption",sx:{color:r},children:n==="rotate"?`R${e}`:e.toUpperCase()})})}function R(e){return o.jsx(q.Rotation,{style:e.direction==="-"?{transform:"scaleX(-1)"}:void 0})}const v=I.externalizeComponent(e=>{const{motion:n="translate",disabled:i=!1}=e,{handlersFor:r,label:C,isPressed:b}=t.useJogControls(e);return o.jsx(x,{"data-testid":"jogging-buttons",sx:{gap:"16px",width:280,maxWidth:"100%"},children:t.JOG_AXES.map(a=>o.jsxs(x,{direction:"row",sx:{alignItems:"center",gap:"16px"},children:[o.jsx(y,{axis:a,motion:n,disabled:i}),t.JOG_DIRECTIONS.map(c=>{const s={axis:a,direction:c},u=b(s),g=n==="rotate"?R(s):void 0,h=t.jogAxisColors[a],p={backgroundColor:l.alpha(h,.25),borderColor:l.alpha(h,.4)};return o.jsx(f.SecondaryButton,{size:"large",disabled:i,"aria-label":C(s),"aria-pressed":u,startIcon:c==="-"?g:void 0,endIcon:c==="+"?g:void 0,...r(s),sx:{flex:1,touchAction:"none",userSelect:"none","& svg":{width:24,height:24},[`& .${d.buttonClasses.startIcon}`]:{marginLeft:"-6px"},[`& .${d.buttonClasses.endIcon}`]:{marginRight:"-6px"},...u&&{...p,[`&.${d.buttonClasses.disabled}`]:p}},children:t.jogHandleName(s,n)},c)})]},a))})});exports.JoggingButtons=v;
@@ -6,7 +6,7 @@ import { alpha as d } from "@mui/material/styles";
6
6
  import I from "@mui/material/Typography";
7
7
  import { Rotation as j } from "@wandelbots/icons/Rotation";
8
8
  import { SecondaryButton as y } from "@wandelbots/mui";
9
- import { e as v } from "./externalizeComponent-_w2d1_pz.js";
9
+ import { e as v } from "./externalizeComponent-CPAVvPKk.js";
10
10
  import { u as J, J as S, a as k, j as u, b as R } from "./joggingColors-CuT5u0H8.js";
11
11
  function $({
12
12
  axis: o,
@@ -3,7 +3,7 @@ import T from "@mui/material/Box";
3
3
  import { useThree as Mt, useFrame as At, Canvas as wt } from "@react-three/fiber";
4
4
  import { Fragment as St, useRef as L, useEffect as k, useMemo as D, useState as et } from "react";
5
5
  import { Vector3 as A, Quaternion as v, Matrix4 as ot } from "three";
6
- import { e as Et } from "./externalizeComponent-_w2d1_pz.js";
6
+ import { e as Et } from "./externalizeComponent-CPAVvPKk.js";
7
7
  import { c as vt, i as Rt, J as _, a as F, u as Tt } from "./joggingColors-CuT5u0H8.js";
8
8
  import { alpha as U, useTheme as rt } from "@mui/material/styles";
9
9
  const st = new A(0, 1, 0), I = 0.26, at = 0.1, _t = { x: "X", y: "Y", z: "Z" };
@@ -1 +1 @@
1
- "use strict";const d=require("react/jsx-runtime"),R=require("@mui/material/Box"),z=require("@react-three/fiber"),M=require("react"),g=require("three"),pt=require("./externalizeComponent-BdxGBLIv.cjs"),E=require("./joggingColors-ZDc_2UCp.cjs"),$=require("@mui/material/styles"),Y=new g.Vector3(0,1,0),I=.26,Z=.1,dt={x:"X",y:"Y",z:"Z"};function V(t){var e;return((e=E.cartesianAxisColors[dt[t]].buttonBackgroundColor)==null?void 0:e.default)??"currentColor"}const ft=200;function F(t){const e=t/ft;return{marginPx:30*e,gripPx:30*e,grab:{innerPx:10*e,beyondTipPx:10*e,minTipPx:16*e},labelFontPx:Math.max(10,13*e)}}function xt(t,e,n){return Math.max(1,Math.min(t,e)/2-n)}function yt(t,e){const{gripPx:n,grab:l}=F(t);return{radiusPx:e,gripPx:n,headLength:I,...l}}function gt(t,e){const{gripPx:n,grab:l}=F(t);return{radiusPx:e,gripPx:n,beyondTipPx:l.beyondTipPx,headLength:I}}function _(t,e){return n=>{n?t.current.set(e,n):t.current.delete(e)}}const O=t=>`${t.axis}${t.direction}`,tt=t=>`label:${t}`,et=[0,1],nt=(t,e)=>`half:${O(t)}:${e}`,ot=t=>`halo:${O(t)}`,st=t=>`focus:${O(t)}`,C="polygon(0 0, 0 0, 0 0)";function rt(t,{isPressed:e,hovered:n,disabled:l}){const r=e(t),s=!l&&(r||E.isSameJogHandle(n,t));return{pressed:r,lit:s}}function at(t,{pressed:e,lit:n}){return e?$.alpha(t,.25):n?$.alpha(t,.12):"transparent"}function ct(t,{onHover:e,handlersFor:n}){return{onPointerEnter:()=>e(t),onPointerLeave:()=>e(null),...n(t)}}const q=t=>({cursor:t?"default":"pointer",touchAction:"none",userSelect:"none"}),it=t=>`2px solid ${t.palette.primary.main}`,J={x:new g.Vector3(1,0,0),y:new g.Vector3(0,1,0),z:new g.Vector3(0,0,1)};function mt(t,e,n=new g.Quaternion){return n.copy(t).invert().multiply(e)}const bt=new g.Quaternion().setFromRotationMatrix(new g.Matrix4().makeBasis(new g.Vector3(1,0,0),new g.Vector3(0,0,-1),new g.Vector3(0,1,0))),L=new g.Quaternion,St=new g.Quaternion;function At(t){return t.up.z>.5?St:bt}function Mt(t,e=new g.Quaternion){return t.getWorldQuaternion(L),mt(L,At(t),e)}function Et(t,e,n=new g.Quaternion){return n.copy(t).multiply(e)}const wt=1e-8;function B(t,e){return t?Math.abs(t.dot(e))<1-wt:!0}function jt(t){const{disabled:e,label:n,overlay:l,size:r}=t,s=$.useTheme(),{gripPx:a}=F(r);return E.JOG_AXES.flatMap(u=>E.JOG_DIRECTIONS.map(o=>{const i={axis:u,direction:o},x=rt(i,t),c=ct(i,t);return d.jsxs(M.Fragment,{children:[d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,ot(i)),sx:{position:"absolute",inset:0,clipPath:C,pointerEvents:"none",background:at(V(u),x)}}),et.map(h=>d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,nt(i,h)),...c,sx:{position:"absolute",inset:0,clipPath:C,...q(e)}},h)),d.jsx(R,{component:"button",type:"button",ref:_(l,O(i)),disabled:e,"aria-label":n(i),"aria-pressed":x.pressed,...c,sx:{position:"absolute",width:a,height:a,transform:"translate(-50%, -50%)",padding:0,border:"none",borderRadius:"50%",background:"transparent","&:focus-visible":{outline:it(s)},"&[data-band='shown']:focus-visible":{outline:"none"},...q(e)}}),d.jsx(R,{component:"svg","aria-hidden":!0,sx:{position:"absolute",left:0,top:0,width:r,height:r,overflow:"visible",pointerEvents:"none",display:"none",zIndex:100,"button[data-band='shown']:focus-visible + &":{display:"block"}},children:d.jsx("path",{ref:_(l,st(i)),fill:"none",stroke:s.palette.primary.main,strokeWidth:2,strokeLinejoin:"round"})})]},O(i))}))}const T=.8,Q=.45,lt=2.25,ut={x:[new g.Vector3(0,1,0),new g.Vector3(0,0,1)],y:[new g.Vector3(-1,0,0),new g.Vector3(0,0,1)],z:[new g.Vector3(1,0,0),new g.Vector3(0,1,0)]};function H(t){const e=t==="+"?Q:Q+Math.PI,n=e+lt;return{start:e,end:n,head:t==="+"?n:e}}const Ot=new g.Vector3,P=new g.Vector3,Rt=new g.Vector3;function _t(t,e=24){const n=[];for(const l of E.JOG_AXES){const[r,s]=ut[l],a=o=>Ot.copy(r).multiplyScalar(Math.cos(o)*T).addScaledVector(s,Math.sin(o)*T).applyQuaternion(t),u=Math.abs(Rt.copy(J[l]).applyQuaternion(t).z);for(const o of E.JOG_DIRECTIONS){const{start:i,end:x,head:c}=H(o),h=[];for(let A=0;A<=e;A++){const w=a(i+(x-i)*A/e);h.push({x:w.x+0,y:-w.y+0,depth:w.z})}const m=a(c),p={x:m.x+0,y:-m.y+0,depth:m.z},f=o==="+"?1:-1;P.copy(r).multiplyScalar(-Math.sin(c)*f).addScaledVector(s,Math.cos(c)*f).applyQuaternion(t);const y=Math.hypot(P.x,P.y),b=y>1e-9?P.x/y:0,S=y>1e-9?-P.y/y:0;n.push({axis:l,direction:o,points:h,head:{...p,dx:b+0,dy:S+0},openness:u})}}return n}function It(t,e,n){let l={distance:Number.POSITIVE_INFINITY,depth:0};for(let r=1;r<t.length;r++){const s=t[r-1],a=t[r],u=(a.x-s.x)**2+(a.y-s.y)**2,o=u===0?0:Math.min(1,Math.max(0,((e-s.x)*(a.x-s.x)+(n-s.y)*(a.y-s.y))/u)),i=Math.hypot(e-(s.x+o*(a.x-s.x)),n-(s.y+o*(a.y-s.y)));i<l.distance&&(l={distance:i,depth:s.depth+o*(a.depth-s.depth)})}return l}function Tt(t,e){const n=t.length,l=t.map(()=>new Array(n).fill(!1));for(let o=0;o<n;o++)for(let i=o+1;i<n;i++){if(t[o].arc===t[i].arc)continue;let x=0;for(const c of t[o].line){const h=It(t[i].line,c.x,c.y);h.distance<e&&(x+=c.depth-h.depth)}x>0?l[o][i]=!0:x<0&&(l[i][o]=!0)}const r=t.map(({line:o})=>o.reduce((i,x)=>i+x.depth,0)/o.length),s=(o,i)=>r[o]-r[i],a=new Array(n).fill(0),u=new Set(t.keys());for(let o=1;u.size>0;o++){const i=[...u],x=i.filter(h=>!i.some(m=>l[h][m])),c=(x.length>0?x:i).sort(s)[0];a[c]=o,u.delete(c)}return a}const k=8;function D(t,e){const n=[...t];if(e>=0){const r=n[n.length-1],s=n[n.length-2],a=Math.hypot(r.x-s.x,r.y-s.y)||1;return n.push({x:r.x+(r.x-s.x)/a*e,y:r.y+(r.y-s.y)/a*e,depth:r.depth}),n}let l=-e;for(;n.length>2;){const r=n[n.length-1],s=n[n.length-2],a=Math.hypot(r.x-s.x,r.y-s.y);if(a>l){const u=l/a;return n[n.length-1]={x:r.x+(s.x-r.x)*u,y:r.y+(s.y-r.y)*u,depth:r.depth+(s.depth-r.depth)*u},n}l-=a,n.pop()}return n}const X=(t,e)=>D([...t].reverse(),e).reverse();function vt(t,e){const n=e/2,l=[],r=[],s=[];let a={x:0,y:0};for(const[o,i]of t.entries()){const x=t[Math.max(0,o-1)],c=t[Math.min(t.length-1,o+1)],h=c.x-x.x,m=c.y-x.y,p=Math.hypot(h,m);p>1e-9&&(a={x:-m/p,y:h/p}),s.push(a),l.push({x:i.x+a.x*n,y:i.y+a.y*n}),r.push({x:i.x-a.x*n,y:i.y-a.y*n})}const u=(o,i)=>{const x=s[o],c={x:x.y,y:-x.x},h=i?1:-1;return Array.from({length:k-1},(m,p)=>{const f=Math.PI*(p+1)/k,y=Math.cos(f)*h,b=Math.sin(f)*h;return{x:t[o].x+(x.x*y+c.x*b)*n,y:t[o].y+(x.y*y+c.y*b)*n}})};return(o,i)=>[...l.slice(o,i+1),...i===t.length-1?u(i,!0):[],...r.slice(o,i+1).reverse(),...o===0?u(o,!1):[]]}function Gt(t,e){return[{from:0,to:Math.min(t-1,e+1)},{from:Math.max(0,e-1),to:t-1}]}function Pt(t,{radiusPx:e,gripPx:n,beyondTipPx:l,headLength:r}){const s=n/2,a=r/2*e+l-s,u=l-s,o=t.map(p=>{const f=p.points.map(S=>({x:S.x*e,y:S.y*e,depth:S.depth})),y=f[f.length>>1],b=p.direction==="+"?X(D(f,a),u):D(X(f,a),u);return{line:b,middle:b.indexOf(y)}}),i=o.map(({line:p})=>p),x=t.map(p=>2*T*e*p.openness>=n),c=i.flatMap((p,f)=>x[f]?Gt(p.length,o[f].middle).map(({from:y,to:b})=>({arc:f,from:y,to:b,line:p.slice(y,b+1)})):[]),h=Tt(c,n),m=t.map((p,f)=>f).sort((p,f)=>t[p].head.depth-t[f].head.depth);return t.map((p,f)=>{if(!x[f])return null;const y=vt(i[f],n),b=c.flatMap((S,A)=>S.arc===f?[{...S,layer:h[A]}]:[]);return{band:y(0,i[f].length-1),halves:b.map(({from:S,to:A,layer:w})=>({polygon:y(S,A),layer:w})),head:{x:p.head.x*e,y:p.head.y*e},headLayer:c.length+1+m.indexOf(f)}})}function ht(t,e,n,l){const r=M.useRef(null),s=z.useThree(a=>a.invalidate);M.useEffect(()=>{r.current=null,s()},[l,s]),M.useEffect(()=>{let a=requestAnimationFrame(function u(){const o=t.current;o&&B(r.current,o)&&s(),a=requestAnimationFrame(u)});return()=>cancelAnimationFrame(a)},[t,s]),z.useFrame(()=>{const a=t.current;!a||!e.current||B(r.current,a)&&(e.current.quaternion.copy(a),n(a)&&(r.current=a.clone()))})}const U=.03;function Vt({orientation:t,lit:e,disabled:n,size:l,radius:r,overlay:s}){const a=M.useRef(null),u=l/2,o=c=>`${(u+c).toFixed(2)}px`,i=c=>`polygon(${c.map(h=>`${o(h.x)} ${o(h.y)}`).join(", ")})`,x=c=>`M${c.map(h=>`${(u+h.x).toFixed(2)} ${(u+h.y).toFixed(2)}`).join("L")}Z`;return ht(t,a,c=>{let h=!0;const m=_t(c),p=Pt(m,gt(l,r));for(const[f,y]of m.entries()){const b=s.current.get(O(y)),S=s.current.get(ot(y)),A=s.current.get(st(y)),w=et.map(v=>s.current.get(nt(y,v)));if(!b||!S||!A||w.some(v=>!v)){h=!1;continue}const j=p[f];b.style.left=o(y.head.x*r),b.style.top=o(y.head.y*r),b.style.zIndex=j?String(j.headLayer):"0",b.style.pointerEvents=j?"":"none",b.dataset.band=j?"shown":"none",S.style.clipPath=j?i(j.band):C,A.setAttribute("d",j?x(j.band):"");for(const[v,N]of w.entries()){if(!N)continue;const G=j==null?void 0:j.halves[v];N.style.clipPath=G?i(G.polygon):C,N.style.zIndex=G?String(G.layer):"0",N.style.pointerEvents=G?"":"none"}}return h},`${l}:${r}`),d.jsxs("group",{ref:a,children:[d.jsxs("mesh",{children:[d.jsx("sphereGeometry",{args:[.07,16,16]}),d.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(c=>d.jsx(Ft,{axis:c,color:V(c),lit:(e==null?void 0:e.axis)===c?e.direction:null,disabled:n},c))]})}function Ft({axis:t,color:e,lit:n,disabled:l}){const r=M.useMemo(()=>{const[s,a]=ut[t];return new g.Quaternion().setFromRotationMatrix(new g.Matrix4().makeBasis(s,a,J[t]))},[t]);return d.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(s=>{const a=n===s,u=a?1:l?.35:.8,o=a?U*1.5:U;return d.jsxs("group",{children:[d.jsxs("mesh",{rotation:[0,0,H(s).start],children:[d.jsx("torusGeometry",{args:[T,o,12,48,lt]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:u})]}),d.jsx(Nt,{direction:s,color:e,opacity:u,lit:a})]},s)})})}function Nt({direction:t,color:e,opacity:n,lit:l}){const{position:r,rotation:s}=M.useMemo(()=>{const{head:a}=H(t),u=t==="+"?1:-1;return{position:new g.Vector3(Math.cos(a)*T,Math.sin(a)*T,0),rotation:new g.Quaternion().setFromUnitVectors(Y,new g.Vector3(-Math.sin(a)*u,Math.cos(a)*u,0))}},[t]);return d.jsxs("mesh",{position:r,quaternion:s,scale:l?1.2:1,children:[d.jsx("coneGeometry",{args:[Z,I,20]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:n})]})}function $t(t){const{disabled:e,label:n,overlay:l,size:r}=t,s=$.useTheme(),{gripPx:a,labelFontPx:u}=F(r);return d.jsxs(d.Fragment,{children:[E.JOG_AXES.map(o=>d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,tt(o)),sx:{position:"absolute",transform:"translate(-50%, -50%)",pointerEvents:"none",fontSize:u,color:V(o),opacity:e?.4:1},children:o.toUpperCase()},o)),E.JOG_AXES.flatMap(o=>E.JOG_DIRECTIONS.map(i=>{const x={axis:o,direction:i},c=rt(x,t);return d.jsx(R,{component:"button",type:"button",ref:_(l,O(x)),disabled:e,"aria-label":n(x),"aria-pressed":c.pressed,...ct(x,t),sx:{position:"absolute",height:a,transformOrigin:"0 50%",padding:0,borderRadius:`${a/2}px`,border:"none",background:at(V(o),c),"&:focus-visible":{outline:it(s)},...q(e)}},O(x))}))]})}function Ct(t){const e=[];for(const n of E.JOG_AXES)for(const l of E.JOG_DIRECTIONS){const r=J[n].clone().multiplyScalar(l==="+"?1:-1).applyQuaternion(t);e.push({axis:n,direction:l,x:r.x+0,y:-r.y+0,depth:r.z})}return e}function Jt(t,e){const{radiusPx:n,gripPx:l,innerPx:r,beyondTipPx:s,minTipPx:a,headLength:u}=e,o=t.map(c=>{const h=Math.hypot(c.x,c.y)*n;return{tip:h,angle:Math.atan2(c.y,c.x),start:r,end:h+s,depth:c.depth,grabbed:h>=a}});for(const[c,h]of o.entries())for(const m of o.slice(c+1)){if(!h.grabbed||!m.grabbed)continue;const[p,f]=h.tip<=m.tip?[h,m]:[m,h],y=h.angle-m.angle,b=p.tip*Math.abs(Math.sin(y));if(Math.cos(y)<=0||b>=l)continue;const S=f.tip*(1-u);if(p.tip>S){const A=h.depth<m.depth?h:m;A.grabbed=!1}else{const A=(p.tip+S)/2;p.end=Math.min(p.end,A),f.start=Math.max(f.start,A)}}const i=o.map((c,h)=>h);i.sort((c,h)=>o[c].depth-o[h].depth);const x=new Map(i.map((c,h)=>[c,h+1]));return o.map((c,h)=>!c.grabbed||c.end<=c.start?null:{x:Math.cos(c.angle)*c.start,y:Math.sin(c.angle)*c.start,length:c.end-c.start,angle:c.angle,layer:x.get(h)??0})}const W=.035,K=1.28;function zt({orientation:t,lit:e,disabled:n,size:l,radius:r,overlay:s}){const a=M.useRef(null),u=l/2;return ht(t,a,o=>{let i=!0;const x=Ct(o),c=Jt(x,yt(l,r));for(const[h,m]of x.entries()){const p=s.current.get(O(m)),f=c[h];if(p?f?(p.style.left=`${u+f.x}px`,p.style.top=`${u+f.y}px`,p.style.width=`${f.length}px`,p.style.transform=`translateY(-50%) rotate(${f.angle}rad)`,p.style.zIndex=String(f.layer),p.style.pointerEvents=""):p.style.pointerEvents="none":i=!1,m.direction!=="+")continue;const y=s.current.get(tt(m.axis));y?(y.style.left=`${u+m.x*r*K}px`,y.style.top=`${u+m.y*r*K}px`):i=!1}return i},`${l}:${r}`),d.jsxs("group",{ref:a,children:[d.jsxs("mesh",{children:[d.jsx("sphereGeometry",{args:[.07,16,16]}),d.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(o=>d.jsx(qt,{axis:o,color:V(o),lit:(e==null?void 0:e.axis)===o?e.direction:null,disabled:n},o))]})}function qt({axis:t,color:e,lit:n,disabled:l}){const r=M.useMemo(()=>new g.Quaternion().setFromUnitVectors(Y,J[t]),[t]),s=1-I;return d.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(a=>{const u=n===a,o=u?1:l?.35:.8,i=u?W*1.5:W;return d.jsxs("group",{rotation:[a==="+"?0:Math.PI,0,0],children:[d.jsxs("mesh",{position:[0,s/2,0],children:[d.jsx("cylinderGeometry",{args:[i,i,s,12]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]}),d.jsxs("mesh",{position:[0,1-I/2,0],scale:u?1.2:1,children:[d.jsx("coneGeometry",{args:[Z,I,20]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]})]},a)})})}const Dt=new g.Quaternion;function Ht(t,e=Dt){const n=M.useRef(e);return n.current=e,M.useMemo(()=>{const l=new g.Quaternion;return{get current(){const r=t.current;if(!r)return null;const s=n.current;return Et(r,typeof s=="function"?s():s,l)}}},[t])}const Lt=3e3;function Bt(t){const[e,n]=M.useState(()=>t.current!==null);return M.useEffect(()=>{if(e)return;let l=requestAnimationFrame(function s(){t.current!==null?n(!0):l=requestAnimationFrame(s)});const r=setTimeout(()=>{t.current===null&&console.warn("JoggingGizmo has no orientation, so it stays disabled. Put a JoggingGizmoOrientation with the same ref into the app's 3D scene.")},Lt);return()=>{cancelAnimationFrame(l),clearTimeout(r)}},[e,t]),e}const Qt=pt.externalizeComponent(({orientation:t,frameQuaternion:e,motion:n="translate",onJogStart:l,onJogStop:r,activeHandle:s,disabled:a=!1,size:u=200})=>{const o=Bt(t),i=a||!o,x=Ht(t,e),{held:c,handlersFor:h,label:m,isPressed:p}=E.useJogControls({motion:n,onJogStart:l,onJogStop:r,activeHandle:s,disabled:i}),[f,y]=M.useState(null);M.useEffect(()=>y(null),[n]);const b=n==="rotate"?Vt:zt,S=n==="rotate"?jt:$t,A=M.useRef(new Map),w=xt(u,u,F(u).marginPx);return d.jsxs(R,{"data-testid":"jogging-gizmo",sx:{position:"relative",width:u,height:u,flexShrink:0,isolation:"isolate"},children:[d.jsx(z.Canvas,{orthographic:!0,flat:!0,frameloop:"demand",camera:{position:[0,0,10],up:[0,1,0],zoom:w,near:.1,far:100},gl:{alpha:!0,antialias:!0},style:{position:"absolute",inset:0,pointerEvents:"none"},children:d.jsx(b,{orientation:x,lit:c??s??f,disabled:i,size:u,radius:w,overlay:A})}),d.jsx(S,{isPressed:p,hovered:f,disabled:i,size:u,onHover:y,handlersFor:h,label:m,overlay:A})]})});exports.JoggingGizmo=Qt;exports.novaAxesSeenBy=Mt;
1
+ "use strict";const d=require("react/jsx-runtime"),R=require("@mui/material/Box"),z=require("@react-three/fiber"),M=require("react"),g=require("three"),pt=require("./externalizeComponent-CkWiNBu0.cjs"),E=require("./joggingColors-ZDc_2UCp.cjs"),$=require("@mui/material/styles"),Y=new g.Vector3(0,1,0),I=.26,Z=.1,dt={x:"X",y:"Y",z:"Z"};function V(t){var e;return((e=E.cartesianAxisColors[dt[t]].buttonBackgroundColor)==null?void 0:e.default)??"currentColor"}const ft=200;function F(t){const e=t/ft;return{marginPx:30*e,gripPx:30*e,grab:{innerPx:10*e,beyondTipPx:10*e,minTipPx:16*e},labelFontPx:Math.max(10,13*e)}}function xt(t,e,n){return Math.max(1,Math.min(t,e)/2-n)}function yt(t,e){const{gripPx:n,grab:l}=F(t);return{radiusPx:e,gripPx:n,headLength:I,...l}}function gt(t,e){const{gripPx:n,grab:l}=F(t);return{radiusPx:e,gripPx:n,beyondTipPx:l.beyondTipPx,headLength:I}}function _(t,e){return n=>{n?t.current.set(e,n):t.current.delete(e)}}const O=t=>`${t.axis}${t.direction}`,tt=t=>`label:${t}`,et=[0,1],nt=(t,e)=>`half:${O(t)}:${e}`,ot=t=>`halo:${O(t)}`,st=t=>`focus:${O(t)}`,C="polygon(0 0, 0 0, 0 0)";function rt(t,{isPressed:e,hovered:n,disabled:l}){const r=e(t),s=!l&&(r||E.isSameJogHandle(n,t));return{pressed:r,lit:s}}function at(t,{pressed:e,lit:n}){return e?$.alpha(t,.25):n?$.alpha(t,.12):"transparent"}function ct(t,{onHover:e,handlersFor:n}){return{onPointerEnter:()=>e(t),onPointerLeave:()=>e(null),...n(t)}}const q=t=>({cursor:t?"default":"pointer",touchAction:"none",userSelect:"none"}),it=t=>`2px solid ${t.palette.primary.main}`,J={x:new g.Vector3(1,0,0),y:new g.Vector3(0,1,0),z:new g.Vector3(0,0,1)};function mt(t,e,n=new g.Quaternion){return n.copy(t).invert().multiply(e)}const bt=new g.Quaternion().setFromRotationMatrix(new g.Matrix4().makeBasis(new g.Vector3(1,0,0),new g.Vector3(0,0,-1),new g.Vector3(0,1,0))),L=new g.Quaternion,St=new g.Quaternion;function At(t){return t.up.z>.5?St:bt}function Mt(t,e=new g.Quaternion){return t.getWorldQuaternion(L),mt(L,At(t),e)}function Et(t,e,n=new g.Quaternion){return n.copy(t).multiply(e)}const wt=1e-8;function B(t,e){return t?Math.abs(t.dot(e))<1-wt:!0}function jt(t){const{disabled:e,label:n,overlay:l,size:r}=t,s=$.useTheme(),{gripPx:a}=F(r);return E.JOG_AXES.flatMap(u=>E.JOG_DIRECTIONS.map(o=>{const i={axis:u,direction:o},x=rt(i,t),c=ct(i,t);return d.jsxs(M.Fragment,{children:[d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,ot(i)),sx:{position:"absolute",inset:0,clipPath:C,pointerEvents:"none",background:at(V(u),x)}}),et.map(h=>d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,nt(i,h)),...c,sx:{position:"absolute",inset:0,clipPath:C,...q(e)}},h)),d.jsx(R,{component:"button",type:"button",ref:_(l,O(i)),disabled:e,"aria-label":n(i),"aria-pressed":x.pressed,...c,sx:{position:"absolute",width:a,height:a,transform:"translate(-50%, -50%)",padding:0,border:"none",borderRadius:"50%",background:"transparent","&:focus-visible":{outline:it(s)},"&[data-band='shown']:focus-visible":{outline:"none"},...q(e)}}),d.jsx(R,{component:"svg","aria-hidden":!0,sx:{position:"absolute",left:0,top:0,width:r,height:r,overflow:"visible",pointerEvents:"none",display:"none",zIndex:100,"button[data-band='shown']:focus-visible + &":{display:"block"}},children:d.jsx("path",{ref:_(l,st(i)),fill:"none",stroke:s.palette.primary.main,strokeWidth:2,strokeLinejoin:"round"})})]},O(i))}))}const T=.8,Q=.45,lt=2.25,ut={x:[new g.Vector3(0,1,0),new g.Vector3(0,0,1)],y:[new g.Vector3(-1,0,0),new g.Vector3(0,0,1)],z:[new g.Vector3(1,0,0),new g.Vector3(0,1,0)]};function H(t){const e=t==="+"?Q:Q+Math.PI,n=e+lt;return{start:e,end:n,head:t==="+"?n:e}}const Ot=new g.Vector3,P=new g.Vector3,Rt=new g.Vector3;function _t(t,e=24){const n=[];for(const l of E.JOG_AXES){const[r,s]=ut[l],a=o=>Ot.copy(r).multiplyScalar(Math.cos(o)*T).addScaledVector(s,Math.sin(o)*T).applyQuaternion(t),u=Math.abs(Rt.copy(J[l]).applyQuaternion(t).z);for(const o of E.JOG_DIRECTIONS){const{start:i,end:x,head:c}=H(o),h=[];for(let A=0;A<=e;A++){const w=a(i+(x-i)*A/e);h.push({x:w.x+0,y:-w.y+0,depth:w.z})}const m=a(c),p={x:m.x+0,y:-m.y+0,depth:m.z},f=o==="+"?1:-1;P.copy(r).multiplyScalar(-Math.sin(c)*f).addScaledVector(s,Math.cos(c)*f).applyQuaternion(t);const y=Math.hypot(P.x,P.y),b=y>1e-9?P.x/y:0,S=y>1e-9?-P.y/y:0;n.push({axis:l,direction:o,points:h,head:{...p,dx:b+0,dy:S+0},openness:u})}}return n}function It(t,e,n){let l={distance:Number.POSITIVE_INFINITY,depth:0};for(let r=1;r<t.length;r++){const s=t[r-1],a=t[r],u=(a.x-s.x)**2+(a.y-s.y)**2,o=u===0?0:Math.min(1,Math.max(0,((e-s.x)*(a.x-s.x)+(n-s.y)*(a.y-s.y))/u)),i=Math.hypot(e-(s.x+o*(a.x-s.x)),n-(s.y+o*(a.y-s.y)));i<l.distance&&(l={distance:i,depth:s.depth+o*(a.depth-s.depth)})}return l}function Tt(t,e){const n=t.length,l=t.map(()=>new Array(n).fill(!1));for(let o=0;o<n;o++)for(let i=o+1;i<n;i++){if(t[o].arc===t[i].arc)continue;let x=0;for(const c of t[o].line){const h=It(t[i].line,c.x,c.y);h.distance<e&&(x+=c.depth-h.depth)}x>0?l[o][i]=!0:x<0&&(l[i][o]=!0)}const r=t.map(({line:o})=>o.reduce((i,x)=>i+x.depth,0)/o.length),s=(o,i)=>r[o]-r[i],a=new Array(n).fill(0),u=new Set(t.keys());for(let o=1;u.size>0;o++){const i=[...u],x=i.filter(h=>!i.some(m=>l[h][m])),c=(x.length>0?x:i).sort(s)[0];a[c]=o,u.delete(c)}return a}const k=8;function D(t,e){const n=[...t];if(e>=0){const r=n[n.length-1],s=n[n.length-2],a=Math.hypot(r.x-s.x,r.y-s.y)||1;return n.push({x:r.x+(r.x-s.x)/a*e,y:r.y+(r.y-s.y)/a*e,depth:r.depth}),n}let l=-e;for(;n.length>2;){const r=n[n.length-1],s=n[n.length-2],a=Math.hypot(r.x-s.x,r.y-s.y);if(a>l){const u=l/a;return n[n.length-1]={x:r.x+(s.x-r.x)*u,y:r.y+(s.y-r.y)*u,depth:r.depth+(s.depth-r.depth)*u},n}l-=a,n.pop()}return n}const X=(t,e)=>D([...t].reverse(),e).reverse();function vt(t,e){const n=e/2,l=[],r=[],s=[];let a={x:0,y:0};for(const[o,i]of t.entries()){const x=t[Math.max(0,o-1)],c=t[Math.min(t.length-1,o+1)],h=c.x-x.x,m=c.y-x.y,p=Math.hypot(h,m);p>1e-9&&(a={x:-m/p,y:h/p}),s.push(a),l.push({x:i.x+a.x*n,y:i.y+a.y*n}),r.push({x:i.x-a.x*n,y:i.y-a.y*n})}const u=(o,i)=>{const x=s[o],c={x:x.y,y:-x.x},h=i?1:-1;return Array.from({length:k-1},(m,p)=>{const f=Math.PI*(p+1)/k,y=Math.cos(f)*h,b=Math.sin(f)*h;return{x:t[o].x+(x.x*y+c.x*b)*n,y:t[o].y+(x.y*y+c.y*b)*n}})};return(o,i)=>[...l.slice(o,i+1),...i===t.length-1?u(i,!0):[],...r.slice(o,i+1).reverse(),...o===0?u(o,!1):[]]}function Gt(t,e){return[{from:0,to:Math.min(t-1,e+1)},{from:Math.max(0,e-1),to:t-1}]}function Pt(t,{radiusPx:e,gripPx:n,beyondTipPx:l,headLength:r}){const s=n/2,a=r/2*e+l-s,u=l-s,o=t.map(p=>{const f=p.points.map(S=>({x:S.x*e,y:S.y*e,depth:S.depth})),y=f[f.length>>1],b=p.direction==="+"?X(D(f,a),u):D(X(f,a),u);return{line:b,middle:b.indexOf(y)}}),i=o.map(({line:p})=>p),x=t.map(p=>2*T*e*p.openness>=n),c=i.flatMap((p,f)=>x[f]?Gt(p.length,o[f].middle).map(({from:y,to:b})=>({arc:f,from:y,to:b,line:p.slice(y,b+1)})):[]),h=Tt(c,n),m=t.map((p,f)=>f).sort((p,f)=>t[p].head.depth-t[f].head.depth);return t.map((p,f)=>{if(!x[f])return null;const y=vt(i[f],n),b=c.flatMap((S,A)=>S.arc===f?[{...S,layer:h[A]}]:[]);return{band:y(0,i[f].length-1),halves:b.map(({from:S,to:A,layer:w})=>({polygon:y(S,A),layer:w})),head:{x:p.head.x*e,y:p.head.y*e},headLayer:c.length+1+m.indexOf(f)}})}function ht(t,e,n,l){const r=M.useRef(null),s=z.useThree(a=>a.invalidate);M.useEffect(()=>{r.current=null,s()},[l,s]),M.useEffect(()=>{let a=requestAnimationFrame(function u(){const o=t.current;o&&B(r.current,o)&&s(),a=requestAnimationFrame(u)});return()=>cancelAnimationFrame(a)},[t,s]),z.useFrame(()=>{const a=t.current;!a||!e.current||B(r.current,a)&&(e.current.quaternion.copy(a),n(a)&&(r.current=a.clone()))})}const U=.03;function Vt({orientation:t,lit:e,disabled:n,size:l,radius:r,overlay:s}){const a=M.useRef(null),u=l/2,o=c=>`${(u+c).toFixed(2)}px`,i=c=>`polygon(${c.map(h=>`${o(h.x)} ${o(h.y)}`).join(", ")})`,x=c=>`M${c.map(h=>`${(u+h.x).toFixed(2)} ${(u+h.y).toFixed(2)}`).join("L")}Z`;return ht(t,a,c=>{let h=!0;const m=_t(c),p=Pt(m,gt(l,r));for(const[f,y]of m.entries()){const b=s.current.get(O(y)),S=s.current.get(ot(y)),A=s.current.get(st(y)),w=et.map(v=>s.current.get(nt(y,v)));if(!b||!S||!A||w.some(v=>!v)){h=!1;continue}const j=p[f];b.style.left=o(y.head.x*r),b.style.top=o(y.head.y*r),b.style.zIndex=j?String(j.headLayer):"0",b.style.pointerEvents=j?"":"none",b.dataset.band=j?"shown":"none",S.style.clipPath=j?i(j.band):C,A.setAttribute("d",j?x(j.band):"");for(const[v,N]of w.entries()){if(!N)continue;const G=j==null?void 0:j.halves[v];N.style.clipPath=G?i(G.polygon):C,N.style.zIndex=G?String(G.layer):"0",N.style.pointerEvents=G?"":"none"}}return h},`${l}:${r}`),d.jsxs("group",{ref:a,children:[d.jsxs("mesh",{children:[d.jsx("sphereGeometry",{args:[.07,16,16]}),d.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(c=>d.jsx(Ft,{axis:c,color:V(c),lit:(e==null?void 0:e.axis)===c?e.direction:null,disabled:n},c))]})}function Ft({axis:t,color:e,lit:n,disabled:l}){const r=M.useMemo(()=>{const[s,a]=ut[t];return new g.Quaternion().setFromRotationMatrix(new g.Matrix4().makeBasis(s,a,J[t]))},[t]);return d.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(s=>{const a=n===s,u=a?1:l?.35:.8,o=a?U*1.5:U;return d.jsxs("group",{children:[d.jsxs("mesh",{rotation:[0,0,H(s).start],children:[d.jsx("torusGeometry",{args:[T,o,12,48,lt]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:u})]}),d.jsx(Nt,{direction:s,color:e,opacity:u,lit:a})]},s)})})}function Nt({direction:t,color:e,opacity:n,lit:l}){const{position:r,rotation:s}=M.useMemo(()=>{const{head:a}=H(t),u=t==="+"?1:-1;return{position:new g.Vector3(Math.cos(a)*T,Math.sin(a)*T,0),rotation:new g.Quaternion().setFromUnitVectors(Y,new g.Vector3(-Math.sin(a)*u,Math.cos(a)*u,0))}},[t]);return d.jsxs("mesh",{position:r,quaternion:s,scale:l?1.2:1,children:[d.jsx("coneGeometry",{args:[Z,I,20]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:n})]})}function $t(t){const{disabled:e,label:n,overlay:l,size:r}=t,s=$.useTheme(),{gripPx:a,labelFontPx:u}=F(r);return d.jsxs(d.Fragment,{children:[E.JOG_AXES.map(o=>d.jsx(R,{component:"span","aria-hidden":!0,ref:_(l,tt(o)),sx:{position:"absolute",transform:"translate(-50%, -50%)",pointerEvents:"none",fontSize:u,color:V(o),opacity:e?.4:1},children:o.toUpperCase()},o)),E.JOG_AXES.flatMap(o=>E.JOG_DIRECTIONS.map(i=>{const x={axis:o,direction:i},c=rt(x,t);return d.jsx(R,{component:"button",type:"button",ref:_(l,O(x)),disabled:e,"aria-label":n(x),"aria-pressed":c.pressed,...ct(x,t),sx:{position:"absolute",height:a,transformOrigin:"0 50%",padding:0,borderRadius:`${a/2}px`,border:"none",background:at(V(o),c),"&:focus-visible":{outline:it(s)},...q(e)}},O(x))}))]})}function Ct(t){const e=[];for(const n of E.JOG_AXES)for(const l of E.JOG_DIRECTIONS){const r=J[n].clone().multiplyScalar(l==="+"?1:-1).applyQuaternion(t);e.push({axis:n,direction:l,x:r.x+0,y:-r.y+0,depth:r.z})}return e}function Jt(t,e){const{radiusPx:n,gripPx:l,innerPx:r,beyondTipPx:s,minTipPx:a,headLength:u}=e,o=t.map(c=>{const h=Math.hypot(c.x,c.y)*n;return{tip:h,angle:Math.atan2(c.y,c.x),start:r,end:h+s,depth:c.depth,grabbed:h>=a}});for(const[c,h]of o.entries())for(const m of o.slice(c+1)){if(!h.grabbed||!m.grabbed)continue;const[p,f]=h.tip<=m.tip?[h,m]:[m,h],y=h.angle-m.angle,b=p.tip*Math.abs(Math.sin(y));if(Math.cos(y)<=0||b>=l)continue;const S=f.tip*(1-u);if(p.tip>S){const A=h.depth<m.depth?h:m;A.grabbed=!1}else{const A=(p.tip+S)/2;p.end=Math.min(p.end,A),f.start=Math.max(f.start,A)}}const i=o.map((c,h)=>h);i.sort((c,h)=>o[c].depth-o[h].depth);const x=new Map(i.map((c,h)=>[c,h+1]));return o.map((c,h)=>!c.grabbed||c.end<=c.start?null:{x:Math.cos(c.angle)*c.start,y:Math.sin(c.angle)*c.start,length:c.end-c.start,angle:c.angle,layer:x.get(h)??0})}const W=.035,K=1.28;function zt({orientation:t,lit:e,disabled:n,size:l,radius:r,overlay:s}){const a=M.useRef(null),u=l/2;return ht(t,a,o=>{let i=!0;const x=Ct(o),c=Jt(x,yt(l,r));for(const[h,m]of x.entries()){const p=s.current.get(O(m)),f=c[h];if(p?f?(p.style.left=`${u+f.x}px`,p.style.top=`${u+f.y}px`,p.style.width=`${f.length}px`,p.style.transform=`translateY(-50%) rotate(${f.angle}rad)`,p.style.zIndex=String(f.layer),p.style.pointerEvents=""):p.style.pointerEvents="none":i=!1,m.direction!=="+")continue;const y=s.current.get(tt(m.axis));y?(y.style.left=`${u+m.x*r*K}px`,y.style.top=`${u+m.y*r*K}px`):i=!1}return i},`${l}:${r}`),d.jsxs("group",{ref:a,children:[d.jsxs("mesh",{children:[d.jsx("sphereGeometry",{args:[.07,16,16]}),d.jsx("meshBasicMaterial",{color:"#c4c8d0"})]}),E.JOG_AXES.map(o=>d.jsx(qt,{axis:o,color:V(o),lit:(e==null?void 0:e.axis)===o?e.direction:null,disabled:n},o))]})}function qt({axis:t,color:e,lit:n,disabled:l}){const r=M.useMemo(()=>new g.Quaternion().setFromUnitVectors(Y,J[t]),[t]),s=1-I;return d.jsx("group",{quaternion:r,children:E.JOG_DIRECTIONS.map(a=>{const u=n===a,o=u?1:l?.35:.8,i=u?W*1.5:W;return d.jsxs("group",{rotation:[a==="+"?0:Math.PI,0,0],children:[d.jsxs("mesh",{position:[0,s/2,0],children:[d.jsx("cylinderGeometry",{args:[i,i,s,12]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]}),d.jsxs("mesh",{position:[0,1-I/2,0],scale:u?1.2:1,children:[d.jsx("coneGeometry",{args:[Z,I,20]}),d.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:o})]})]},a)})})}const Dt=new g.Quaternion;function Ht(t,e=Dt){const n=M.useRef(e);return n.current=e,M.useMemo(()=>{const l=new g.Quaternion;return{get current(){const r=t.current;if(!r)return null;const s=n.current;return Et(r,typeof s=="function"?s():s,l)}}},[t])}const Lt=3e3;function Bt(t){const[e,n]=M.useState(()=>t.current!==null);return M.useEffect(()=>{if(e)return;let l=requestAnimationFrame(function s(){t.current!==null?n(!0):l=requestAnimationFrame(s)});const r=setTimeout(()=>{t.current===null&&console.warn("JoggingGizmo has no orientation, so it stays disabled. Put a JoggingGizmoOrientation with the same ref into the app's 3D scene.")},Lt);return()=>{cancelAnimationFrame(l),clearTimeout(r)}},[e,t]),e}const Qt=pt.externalizeComponent(({orientation:t,frameQuaternion:e,motion:n="translate",onJogStart:l,onJogStop:r,activeHandle:s,disabled:a=!1,size:u=200})=>{const o=Bt(t),i=a||!o,x=Ht(t,e),{held:c,handlersFor:h,label:m,isPressed:p}=E.useJogControls({motion:n,onJogStart:l,onJogStop:r,activeHandle:s,disabled:i}),[f,y]=M.useState(null);M.useEffect(()=>y(null),[n]);const b=n==="rotate"?Vt:zt,S=n==="rotate"?jt:$t,A=M.useRef(new Map),w=xt(u,u,F(u).marginPx);return d.jsxs(R,{"data-testid":"jogging-gizmo",sx:{position:"relative",width:u,height:u,flexShrink:0,isolation:"isolate"},children:[d.jsx(z.Canvas,{orthographic:!0,flat:!0,frameloop:"demand",camera:{position:[0,0,10],up:[0,1,0],zoom:w,near:.1,far:100},gl:{alpha:!0,antialias:!0},style:{position:"absolute",inset:0,pointerEvents:"none"},children:d.jsx(b,{orientation:x,lit:c??s??f,disabled:i,size:u,radius:w,overlay:A})}),d.jsx(S,{isPressed:p,hovered:f,disabled:i,size:u,onHover:y,handlersFor:h,label:m,overlay:A})]})});exports.JoggingGizmo=Qt;exports.novaAxesSeenBy=Mt;
@@ -1 +1 @@
1
- "use strict";const n=require("@react-three/fiber"),o=require("three"),t=require("./JoggingGizmo-DGbFLWgT.cjs");function u({target:e}){const r=n.useThree(i=>i.camera);return n.useFrame(()=>{e.current=t.novaAxesSeenBy(r,e.current??new o.Quaternion)}),null}exports.JoggingGizmoOrientation=u;
1
+ "use strict";const n=require("@react-three/fiber"),o=require("three"),t=require("./JoggingGizmo-DtWw6KWg.cjs");function u({target:e}){const r=n.useThree(i=>i.camera);return n.useFrame(()=>{e.current=t.novaAxesSeenBy(r,e.current??new o.Quaternion)}),null}exports.JoggingGizmoOrientation=u;
@@ -1,6 +1,6 @@
1
1
  import { useThree as o, useFrame as m } from "@react-three/fiber";
2
2
  import { Quaternion as t } from "three";
3
- import { n as a } from "./JoggingGizmo-SuS9MmL7.js";
3
+ import { n as a } from "./JoggingGizmo-DBpDIbzl.js";
4
4
  function s({
5
5
  target: r
6
6
  }) {