@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.5d2eede → 6.4.0-pr.revamp.667.8c29b6b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -5
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +3 -0
- package/dist/3d.js +25 -20
- package/dist/CurrentPoseBar/index.cjs +1 -1
- package/dist/CurrentPoseBar/index.js +1 -1
- package/dist/JoggingButtons/index.cjs +1 -1
- package/dist/JoggingButtons/index.js +1 -1
- package/dist/JoggingGizmo/index.cjs +1 -1
- package/dist/JoggingGizmo/index.js +2 -2
- package/dist/JoggingJointSlider/index.cjs +1 -1
- package/dist/JoggingJointSlider/index.js +1 -1
- package/dist/RobotControl/index.cjs +1 -0
- package/dist/RobotControl/index.d.ts +3 -0
- package/dist/RobotControl/index.js +9 -0
- package/dist/RobotControlPanel/index.cjs +1 -1
- package/dist/RobotControlPanel/index.js +1 -1
- package/dist/RobotHeader/index.cjs +1 -1
- package/dist/RobotHeader/index.js +1 -1
- package/dist/SafetyBar/index.cjs +1 -1
- package/dist/SafetyBar/index.js +1 -1
- package/dist/chunks/{CurrentPoseBar-CyHUWmjM.cjs → CurrentPoseBar-CAEEifBY.cjs} +1 -1
- package/dist/chunks/{CurrentPoseBar-zTZi68tY.js → CurrentPoseBar-Cb_Pk2jp.js} +2 -2
- package/dist/chunks/{JoggingButtons-CbL-5LMK.cjs → JoggingButtons-DC0jII72.cjs} +1 -1
- package/dist/chunks/{JoggingButtons-CXaozFVz.js → JoggingButtons-DluWqNuO.js} +1 -1
- package/dist/chunks/{JoggingGizmo-DGbFLWgT.cjs → JoggingGizmo-DT7iX5Ka.cjs} +1 -1
- package/dist/chunks/{JoggingGizmo-SuS9MmL7.js → JoggingGizmo-Hy42DAQU.js} +1 -1
- package/dist/chunks/{JoggingGizmoOrientation-x_crT_64.js → JoggingGizmoOrientation-Bba8HLQJ.js} +1 -1
- package/dist/chunks/{JoggingGizmoOrientation-dzned4f4.cjs → JoggingGizmoOrientation-l2slmUE_.cjs} +1 -1
- package/dist/chunks/{JoggingJointSlider-R3_A9Ppj.cjs → JoggingJointSlider-C0lI_9W5.cjs} +1 -1
- package/dist/chunks/{JoggingJointSlider-CZ-k6XCa.js → JoggingJointSlider-DePZ3JHW.js} +1 -1
- package/dist/chunks/Pose3-B5hMUFVF.cjs +1 -0
- package/dist/chunks/Pose3-BZt7YsAr.js +103 -0
- package/dist/chunks/RobotControl-B08wkzfW.js +287 -0
- package/dist/chunks/RobotControl-gYiYneIr.cjs +1 -0
- package/dist/chunks/{RobotControlPanel-BXtBHEe9.cjs → RobotControlPanel-B4u3D3yO.cjs} +1 -1
- package/dist/chunks/{RobotControlPanel-BiLexAWI.js → RobotControlPanel-Cy5LwU1h.js} +5 -5
- package/dist/chunks/{RobotHeader-Daft80jq.cjs → RobotHeader-AYPFScwk.cjs} +1 -1
- package/dist/chunks/{RobotHeader-DDmDkUoV.js → RobotHeader-BV5966Uy.js} +2 -2
- package/dist/chunks/{SafetyBar-BVk-SH_0.cjs → SafetyBar-BoU0RTMl.cjs} +1 -1
- package/dist/chunks/{SafetyBar-RkN0I1Cb.js → SafetyBar-Dv5segte.js} +2 -2
- package/dist/chunks/{converters-DAr6IQbG.js → converters-D9KpJ2HD.js} +2 -2
- package/dist/chunks/{externalizeComponent-BdxGBLIv.cjs → externalizeComponent-Bl23ayrr.cjs} +1 -1
- package/dist/chunks/{externalizeComponent-_w2d1_pz.js → externalizeComponent-CSzPVfuG.js} +4 -2
- package/dist/chunks/loadRobotSession-6uBp3kVQ.cjs +3 -0
- package/dist/chunks/loadRobotSession-D24jM14h.js +4731 -0
- package/dist/chunks/robotModelSource-BhoD0PDR.js +1296 -0
- package/dist/chunks/robotModelSource-DAbozl9p.cjs +1 -0
- package/dist/chunks/useEveryFrame-CHxg25f4.cjs +1 -0
- package/dist/chunks/useEveryFrame-DAuNawGP.js +155 -0
- package/dist/chunks/{Pose3-pocKPrHN.js → useSmoothedMotionState-COMJRcOt.js} +63 -141
- package/dist/chunks/useSmoothedMotionState-Con0E5Bx.cjs +1 -0
- package/dist/components/robotControl/RobotControl.d.ts +23 -0
- package/dist/components/robotControl/poseText.d.ts +21 -5
- package/dist/components/robotControl/useRobotControlProps.d.ts +28 -0
- package/dist/components/robotSession/RobotSessionProvider.d.ts +13 -0
- package/dist/components/robots/LinearAxis.d.ts +12 -11
- package/dist/components/robots/Robot.d.ts +26 -9
- package/dist/components/robots/robotModelSource.d.ts +38 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +11 -0
- package/dist/core.js +62 -40
- package/dist/index.cjs +1 -1
- package/dist/index.js +91 -65
- package/dist/lib/ConnectedMotionGroup.d.ts +5 -1
- package/dist/lib/controllerStateSource.d.ts +6 -4
- package/dist/lib/motionGroupModelResources.d.ts +1 -0
- package/dist/lib/nats/natsControllerStateSource.d.ts +27 -0
- package/dist/lib/robotSession/RobotActivation.d.ts +48 -0
- package/dist/lib/robotSession/RobotDescription.d.ts +84 -0
- package/dist/lib/robotSession/RobotLiveState.d.ts +56 -0
- package/dist/lib/robotSession/RobotLoadProgress.d.ts +72 -0
- package/dist/lib/robotSession/RobotSafety.d.ts +59 -0
- package/dist/lib/robotSession/RobotSession.d.ts +78 -0
- package/dist/lib/robotSession/RobotTargetPose.d.ts +78 -0
- package/dist/lib/robotSession/loadRobotResources.d.ts +46 -0
- package/dist/lib/robotSession/loadRobotSession.d.ts +81 -0
- package/dist/lib/robotSession/robotPose.d.ts +28 -0
- package/dist/nats.cjs +1 -0
- package/dist/nats.d.ts +4 -0
- package/dist/nats.js +131 -0
- package/package.json +11 -1
- package/dist/chunks/Pose3-DIyg-aZA.cjs +0 -1
- package/dist/chunks/Robot-B3vKEVXP.cjs +0 -1
- package/dist/chunks/Robot-DXhaz1tq.js +0 -1272
- package/dist/chunks/TrajectoryExecutionStore-CKfEoKo8.cjs +0 -3
- package/dist/chunks/TrajectoryExecutionStore-DYVukgCz.js +0 -3613
- package/dist/chunks/useEveryFrame-G_-ma1nC.js +0 -142
- 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
|
-
-
|
|
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
|
|
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
|
-
- **
|
|
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** -
|
|
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/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/robotModelSource-DAbozl9p.cjs"),n=require("./chunks/JoggingGizmo-DT7iX5Ka.cjs"),i=require("./chunks/JoggingGizmoOrientation-l2slmUE_.cjs"),a=require("./chunks/RobotControlPanel-B4u3D3yO.cjs"),t=require("./chunks/RobotControl-gYiYneIr.cjs"),r=require("./chunks/useSmoothedMotionState-Con0E5Bx.cjs"),e=require("./chunks/Pose3-B5hMUFVF.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
|
|
2
|
-
import { J as c } from "./chunks/JoggingGizmo-
|
|
3
|
-
import { J as G } from "./chunks/JoggingGizmoOrientation-
|
|
4
|
-
import { R as
|
|
5
|
-
import {
|
|
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-BhoD0PDR.js";
|
|
2
|
+
import { J as c } from "./chunks/JoggingGizmo-Hy42DAQU.js";
|
|
3
|
+
import { J as G } from "./chunks/JoggingGizmoOrientation-Bba8HLQJ.js";
|
|
4
|
+
import { R as M } from "./chunks/RobotControlPanel-Cy5LwU1h.js";
|
|
5
|
+
import { R as z, u as C } from "./chunks/RobotControl-B08wkzfW.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-BZt7YsAr.js";
|
|
6
8
|
export {
|
|
7
|
-
|
|
9
|
+
t as CollisionSceneRenderer,
|
|
8
10
|
c as JoggingGizmo,
|
|
9
11
|
G as JoggingGizmoOrientation,
|
|
10
|
-
|
|
12
|
+
a as JointLimitGizmo,
|
|
11
13
|
r as LinearAxis,
|
|
12
14
|
s as MotionGroupVisualizer,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
n as MotionGroupVisualizerExact,
|
|
16
|
+
A as Pose3,
|
|
17
|
+
i as PresetEnvironment,
|
|
16
18
|
p as Robot,
|
|
17
|
-
|
|
19
|
+
z as RobotControl,
|
|
20
|
+
M as RobotControlPanel,
|
|
18
21
|
u as SafetyZonesRenderer,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/CurrentPoseBar-CAEEifBY.cjs");exports.CurrentPoseBar=e.CurrentPoseBar;exports.default=e.CurrentPoseBar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../chunks/JoggingButtons-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../chunks/JoggingButtons-DC0jII72.cjs");exports.JoggingButtons=t.JoggingButtons;exports.default=t.JoggingButtons;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../chunks/JoggingGizmo-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../chunks/JoggingGizmo-DT7iX5Ka.cjs"),o=require("../chunks/JoggingGizmoOrientation-l2slmUE_.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-
|
|
2
|
-
import { J as t } from "../chunks/JoggingGizmoOrientation-
|
|
1
|
+
import { J as i, J as a } from "../chunks/JoggingGizmo-Hy42DAQU.js";
|
|
2
|
+
import { J as t } from "../chunks/JoggingGizmoOrientation-Bba8HLQJ.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-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/JoggingJointSlider-C0lI_9W5.cjs");exports.JoggingJointSlider=e.JoggingJointSlider;exports.default=e.JoggingJointSlider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControl-gYiYneIr.cjs"),e=require("../chunks/Pose3-B5hMUFVF.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-B08wkzfW.js";
|
|
2
|
+
import { R as a, u } from "../chunks/Pose3-BZt7YsAr.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-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../chunks/RobotControlPanel-B4u3D3yO.cjs");exports.RobotControlPanel=o.RobotControlPanel;exports.default=o.RobotControlPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/RobotHeader-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/RobotHeader-AYPFScwk.cjs");exports.RobotHeader=e.RobotHeader;exports.default=e.RobotHeader;
|
package/dist/SafetyBar/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/SafetyBar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../chunks/SafetyBar-BoU0RTMl.cjs");exports.SafetyBar=e.SafetyBar;exports.default=e.SafetyBar;
|
package/dist/SafetyBar/index.js
CHANGED
|
@@ -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-
|
|
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-Bl23ayrr.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;
|
|
@@ -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-
|
|
12
|
-
import { P as B,
|
|
11
|
+
import { e as an } from "./externalizeComponent-CSzPVfuG.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 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-
|
|
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-Bl23ayrr.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-
|
|
9
|
+
import { e as v } from "./externalizeComponent-CSzPVfuG.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,
|
|
@@ -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-Bl23ayrr.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;
|
|
@@ -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-
|
|
6
|
+
import { e as Et } from "./externalizeComponent-CSzPVfuG.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" };
|
package/dist/chunks/{JoggingGizmoOrientation-dzned4f4.cjs → JoggingGizmoOrientation-l2slmUE_.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("@react-three/fiber"),o=require("three"),t=require("./JoggingGizmo-
|
|
1
|
+
"use strict";const n=require("@react-three/fiber"),o=require("three"),t=require("./JoggingGizmo-DT7iX5Ka.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 +1 @@
|
|
|
1
|
-
"use strict";const u=require("react/jsx-runtime"),w=require("@mui/material/Box"),P=require("@mui/material/Stack"),J=require("@mui/material/styles"),z=require("@mui/material/Typography"),h=require("react"),tt=require("./externalizeComponent-
|
|
1
|
+
"use strict";const u=require("react/jsx-runtime"),w=require("@mui/material/Box"),P=require("@mui/material/Stack"),J=require("@mui/material/styles"),z=require("@mui/material/Typography"),h=require("react"),tt=require("./externalizeComponent-Bl23ayrr.cjs"),S=require("./holdSafety-BtoZ5We3.cjs"),I=2*Math.PI;function nt({min:t,max:n,linear:o},f){const s=t!==void 0,c=n!==void 0;if(s&&c&&n>t)return{min:t,max:n};if(o)return null;if(s&&!c)return{min:t,max:t+I};if(c&&!s)return{min:n-I,max:n};const b=Math.round(f/I)*I;return{min:b-Math.PI,max:b+Math.PI}}function G(t,n){return Math.min(1,Math.max(0,(t-n.min)/(n.max-n.min)))}function et(t,n){const o=Math.min(1,Math.max(0,t));return n.min+o*(n.max-n.min)}function ot(t){return t.min>0||t.max<0?null:G(0,t)}function O(t,n,o){return Math.abs(n-t)<=o?null:n>t?"+":"-"}function rt(t,n,o){return o==="+"?t>=n:t<=n}function it(t,n){return t?"mm":n}const L={deg:{shown:t=>t*180/Math.PI,decimals:1,limitDecimals:0,suffix:"°"},rad:{shown:t=>t,decimals:3,limitDecimals:2,suffix:" rad"},mm:{shown:t=>t,decimals:1,limitDecimals:0,suffix:" mm"}};function W(t,n){const o=t.toFixed(n);return Number(o)===0?0 .toFixed(n):o}function v(t,n){return L[n].shown(t)}function st(t,n){const{shown:o,decimals:f,suffix:s}=L[n];return`${W(o(t),f)}${s}`}function K(t,n){const{shown:o,limitDecimals:f,suffix:s}=L[n],c=10**f,b=o(t),d=Math.sign(b)*Math.round(Math.abs(b)*c)/c;return`${d>0?"+":""}${W(d,f)}${s}`}const N=16,U=4;function V({railRef:t,at:n,goalAt:o,held:f,zeroAt:s,limits:c,disabled:b}){const d=J.useTheme(),x=d.palette.primary.main,l=`0 0 0 8px ${J.alpha(x,.16)}`;return u.jsxs(u.Fragment,{children:[u.jsxs(w,{ref:t,sx:{position:"absolute",left:0,right:0,top:"50%",height:U,transform:"translateY(-50%)"},children:[u.jsx(w,{sx:{position:"absolute",inset:0,borderRadius:U/2,backgroundColor:J.alpha(x,.38)}}),n!==null&&o!==null&&u.jsx(w,{sx:{position:"absolute",top:0,bottom:0,borderRadius:U/2,backgroundColor:x},style:{left:`${Math.min(n,o)*100}%`,width:`${Math.abs(o-n)*100}%`,opacity:f?1:.5}}),s!==null&&u.jsx(w,{"aria-hidden":!0,sx:{position:"absolute",top:"50%",width:2,height:12,transform:"translate(-50%, -50%)",borderRadius:1,backgroundColor:"text.secondary"},style:{left:`${s*100}%`}}),n!==null&&u.jsx(w,{sx:{position:"absolute",top:"50%",boxSizing:"border-box",width:N,height:N,transform:"translate(-50%, -50%)",borderRadius:"50%",border:`3px solid ${x}`,backgroundColor:"background.paper",boxShadow:f?l:d.shadows[2],transition:"box-shadow 150ms","&:hover":b?{}:{boxShadow:l}},style:{left:`${n*100}%`}})]}),c&&u.jsx(P,{direction:"row",sx:{position:"absolute",left:0,right:0,top:30,justifyContent:"space-between"},children:[c.min,c.max].map((k,j)=>u.jsx(z,{variant:"caption",color:"text.secondary",sx:{fontSize:10,lineHeight:"14px"},children:k},j))})]})}function ut({value:t,onJogStart:n,onJogStop:o,disabled:f}){const s=h.useRef(null),[c,b]=h.useState(null),d=h.useCallback(e=>{s.current=e,b(e)},[]),x=h.useRef({value:t,onJogStart:n,onJogStop:o});x.current={value:t,onJogStart:n,onJogStop:o};const l=h.useCallback((e,m,g)=>{const y=O(x.current.value,m,g);d({...e,goal:m,direction:y,settledAt:y?null:e.settledAt}),e.direction&&e.direction!==y&&x.current.onJogStop(),y&&y!==e.direction&&x.current.onJogStart(y)},[d]),k=h.useCallback(()=>s.current!==null,[]),j=h.useCallback((e,m,g)=>f||s.current?!1:(l({goal:e,direction:null,settledAt:null,by:g},e,m),!0),[f,l]),M=h.useCallback((e,m)=>{const g=s.current;if(g){if(g.direction===null&&g.settledAt!==null&&Math.abs(e-g.settledAt)<=m){d({...g,goal:e});return}l(g,e,m)}},[l,d]),C=h.useCallback(()=>{const e=s.current;e&&(d(null),e.direction&&x.current.onJogStop())},[d]),D=h.useCallback(()=>{var e;return((e=s.current)==null?void 0:e.by)??null},[]),$=h.useCallback(e=>{const m=s.current;m&&e(m.by)&&C()},[C]);return h.useEffect(()=>{const e=s.current;e!=null&&e.direction&&rt(t,e.goal,e.direction)&&(d({...e,direction:null,settledAt:e.goal}),x.current.onJogStop())},[t,d]),S.useEndHoldWhenUnattended(c!==null,f,C),{hold:c,isHolding:k,heldBy:D,begin:j,moveGoal:M,end:C,endIfHeldBy:$}}function lt(t){return t==="mouse"||t==="pen"?1:4}function at(t){return t==="ArrowRight"||t==="ArrowUp"?"+":t==="ArrowLeft"||t==="ArrowDown"?"-":null}const ct=tt.externalizeComponent(({label:t,name:n,value:o,min:f,max:s,linear:c=!1,angleUnit:b="deg",onJogStart:d,onJogStop:x,disabled:l=!1})=>{const k=J.useTheme(),j=h.useRef(null),{hold:M,isHolding:C,heldBy:D,begin:$,moveGoal:e,end:m,endIfHeldBy:g}=ut({value:o,onJogStart:d,onJogStop:x,disabled:l}),[y,q]=h.useState(null);h.useEffect(()=>{l&&q(null)},[l]);const a=nt({min:f,max:s,linear:c},o),R=it(c,b),B=r=>st(r,R);function E({clientX:r,pointerType:i}){if(!a||!j.current)return null;const p=j.current.getBoundingClientRect();return p.width<=0?null:{goal:et((r-p.left)/p.width,a),deadband:lt(i)/p.width*(a.max-a.min)}}function Y(r){var p,H;if(!S.startsPointerHold(r)||l||C())return;const i=E(r);if(i){try{(H=(p=r.currentTarget).setPointerCapture)==null||H.call(p,r.pointerId)}catch{}$(i.goal,i.deadband,{pointer:r.pointerId})}}function Z(r){const i=E(r);q(l?null:(i==null?void 0:i.goal)??null);const p=D();if(!(!p||!("pointer"in p)||p.pointer!==r.pointerId)){if(S.primaryReleased(r)){m();return}i&&e(i.goal,i.deadband)}}function T(r){g(i=>"pointer"in i&&i.pointer===r.pointerId)}function _(r){const i=at(r.key);if(i&&r.preventDefault(),C()){S.endsHold(r)&&m();return}if(!i||!S.startsKeyHold(r)||l||!a)return;const p=i==="+"?a.max:a.min,H=(a.max-a.min)*1e-4;O(o,p,H)===i&&$(p,H,{key:r.key})}function Q(r){g(i=>"key"in i&&i.key===r.key)}const A=(M==null?void 0:M.goal)??y,X=a&&{min:K(a.min,R),max:K(a.max,R)},F=u.jsxs(P,{direction:"row",sx:{justifyContent:"space-between",gap:1,mb:"-4px"},children:[u.jsxs(z,{variant:"body2",noWrap:!0,children:[t,n&&u.jsx(w,{component:"span",sx:{color:"text.secondary"},children:` - ${n}`})]}),u.jsxs(z,{variant:"body2",sx:{fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"},children:[B(o),a&&A!==null&&u.jsx(w,{component:"span",sx:{color:"text.secondary"},children:` / ${B(A)}`})]})]});return a?u.jsxs(P,{"data-testid":"jogging-joint-slider",children:[F,u.jsx(w,{role:"slider",tabIndex:l?-1:0,"aria-label":n?`${t} ${n}`:t,"aria-valuemin":v(a.min,R),"aria-valuemax":v(a.max,R),"aria-valuenow":v(o,R),"aria-valuetext":B(o),"aria-disabled":l||void 0,onPointerDown:Y,onPointerMove:Z,onPointerLeave:()=>q(null),onPointerUp:T,onPointerCancel:T,onLostPointerCapture:T,onKeyDown:_,onKeyUp:Q,onBlur:m,onContextMenu:S.preventContextMenu,sx:{position:"relative",height:44,borderRadius:1,opacity:l?.5:1,cursor:l?"default":"pointer",touchAction:"none",userSelect:"none",outline:"none","&:focus-visible":{outline:`2px solid ${k.palette.primary.main}`,outlineOffset:"2px"}},children:u.jsx(V,{railRef:j,at:G(o,a),goalAt:A===null?null:G(A,a),held:M!==null,zeroAt:ot(a),limits:X??void 0,disabled:l})})]}):u.jsxs(P,{"data-testid":"jogging-joint-slider",children:[F,u.jsx(w,{"aria-hidden":!0,sx:{position:"relative",height:44},children:u.jsx(V,{at:null,goalAt:null,held:!1,zeroAt:null,disabled:!0})})]})});exports.JoggingJointSlider=ct;
|
|
@@ -4,7 +4,7 @@ import J from "@mui/material/Stack";
|
|
|
4
4
|
import { useTheme as Y, alpha as N } from "@mui/material/styles";
|
|
5
5
|
import G from "@mui/material/Typography";
|
|
6
6
|
import { useRef as L, useState as Z, useCallback as y, useEffect as _ } from "react";
|
|
7
|
-
import { e as it } from "./externalizeComponent-
|
|
7
|
+
import { e as it } from "./externalizeComponent-CSzPVfuG.js";
|
|
8
8
|
import { u as st, p as at, b as lt, a as ut, e as ct, s as dt } from "./holdSafety-Di1GZAWg.js";
|
|
9
9
|
const k = 2 * Math.PI;
|
|
10
10
|
function ft({ min: t, max: n, linear: r }, d) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const p=require("react/jsx-runtime"),a=require("react"),i=require("three"),u=a.createContext(null);function w({session:t,children:n}){return p.jsx(u.Provider,{value:t,children:n})}function O(){return c(void 0)}function c(t){const n=a.useContext(u),o=t??n;if(!o)throw new Error("No robot session: put the component inside a RobotSessionProvider, or give it a `session`");return o}function s(t,n){if(n==="QUATERNION"&&t)return new i.Quaternion(...t);if(n==="ROTATION_VECTOR"&&t){if(t&&t.length<3)throw new Error(`Invalid rotation vector length: ${t.length}. Expected at least 3 values.`);const o=new i.Vector3(t[0],t[1],t[2]),e=o.length(),R=o.normalize();return new i.Quaternion().setFromAxisAngle(R,e)}else return console.warn(`Unsupported rotation type '${n}'. Only QUATERNION and ROTATION_VECTOR are supported for now.`),new i.Quaternion}function l(t){const n=new i.Vector3(t.x,t.y,t.z),o=2*Math.atan2(n.length(),Math.abs(t.w));n.normalize();const e=(t.w>=0?1:0)-(t.w<0?1:0);return n.multiplyScalar(e).multiplyScalar(o)}class r{constructor(n,o){this.position=n,this.quaternion=o}static fromPose(n){const o=n.orientation?s(n.orientation,"ROTATION_VECTOR"):new i.Quaternion,e=n.position??[0,0,0];return new r(new i.Vector3(e[0]??0,e[1]??0,e[2]??0),o)}static fromRobotTcp(n){const o=n.orientation?s(n.orientation,n.orientation_type??"ROTATION_VECTOR"):new i.Quaternion,e=n.position??[0,0,0];return new r(new i.Vector3(e[0]??0,e[1]??0,e[2]??0),o)}static fromCoordinateSystem(n){const o=n.orientation?s(n.orientation,n.orientation_type??"ROTATION_VECTOR"):new i.Quaternion,e=n.position??[0,0,0];return new r(new i.Vector3(e[0]??0,e[1]??0,e[2]??0),o)}inverse(){const n=this.quaternion.clone().invert();return new r(this.position.clone().applyQuaternion(n).multiplyScalar(-1),n)}multiply(n){return new r(this.position.clone().add(n.position.clone().applyQuaternion(this.quaternion)),this.quaternion.clone().multiply(n.quaternion).normalize())}get orientation(){return l(this.quaternion)}}exports.Pose3=r;exports.RobotSessionProvider=w;exports.parseRotationToQuaternion=s;exports.quaternionToRotationVector=l;exports.useRobotSession=O;exports.useRobotSessionOf=c;
|