@wandelbots/wandelbots-js-react-components 5.5.0-pr.fix-esm-extensions.590.0a9a3ff → 5.5.0

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 (26) hide show
  1. package/dist/components/ThemeSelect.d.ts.map +1 -1
  2. package/dist/components/VelocitySlider.cjs +1 -1
  3. package/dist/components/VelocitySlider.cjs.map +1 -1
  4. package/dist/components/VelocitySlider.d.ts.map +1 -1
  5. package/dist/components/VelocitySlider.js +8 -8
  6. package/dist/components/VelocitySlider.js.map +1 -1
  7. package/dist/components/jogging/JoggingJointLimitDetector.cjs +1 -1
  8. package/dist/components/jogging/JoggingJointLimitDetector.cjs.map +1 -1
  9. package/dist/components/jogging/JoggingJointLimitDetector.js +4 -4
  10. package/dist/components/jogging/JoggingJointLimitDetector.js.map +1 -1
  11. package/dist/components/jogging/JoggingJointValueControl.cjs +1 -1
  12. package/dist/components/jogging/JoggingJointValueControl.cjs.map +1 -1
  13. package/dist/components/jogging/JoggingJointValueControl.d.ts.map +1 -1
  14. package/dist/components/jogging/JoggingJointValueControl.js +6 -6
  15. package/dist/components/jogging/JoggingJointValueControl.js.map +1 -1
  16. package/dist/components/jogging/JoggingStore.cjs +1 -1
  17. package/dist/components/jogging/JoggingStore.cjs.map +1 -1
  18. package/dist/components/jogging/JoggingStore.js +2 -2
  19. package/dist/components/jogging/JoggingStore.js.map +1 -1
  20. package/package.json +1 -1
  21. package/src/components/ThemeSelect.tsx +2 -2
  22. package/src/components/VelocitySlider.tsx +3 -3
  23. package/src/components/jogging/JoggingJointLimitDetector.tsx +1 -1
  24. package/src/components/jogging/JoggingJointValueControl.tsx +3 -3
  25. package/src/components/jogging/JoggingStore.ts +2 -2
  26. package/src/test/consumer.test.ts +0 -27
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeSelect.d.ts","sourceRoot":"","sources":["../../src/components/ThemeSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAIzC,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAA;CACrC,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAA;AAEvC,eAAO,MAAM,WAAW,GAAI,uBAAuB,gBAAgB,4CAsClE,CAAA;AAED,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"ThemeSelect.d.ts","sourceRoot":"","sources":["../../src/components/ThemeSelect.tsx"],"names":[],"mappings":"AAGA,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAGzC,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAA;CACrC,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,CAAA;AAEvC,eAAO,MAAM,WAAW,GAAI,uBAAuB,gBAAgB,4CAsClE,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),b=require("@mui/material/Slider"),s=require("@mui/material/Stack"),d=require("@mui/material/styles"),u=require("@mui/material/Typography"),m=require("lodash-es/isNumber.js"),h=require("mobx-react-lite"),S=require("react-i18next"),x=h.observer(e=>{var o,a,c;const r=d.useTheme(),{store:i}=e,{t:n}=S.useTranslation();function y(v,l){l===e.velocity||!m(l)||e.onVelocityChange(l,e.useDegree)}return t.jsxs(s,{direction:"row",gap:2,alignItems:"center","data-testid":"velocity-slider","aria-label":"velocity-slider",children:[i.showVelocityLegend&&t.jsx(u,{sx:{color:(c=(a=(o=r.componentsExt)==null?void 0:o.JoggingPanel)==null?void 0:a.VelocitySlider)==null?void 0:c.sliderLegendColor,fontSize:"14px"},children:n("Jogging.Velocity.bt")}),t.jsx(b,{value:e.velocity,color:"secondary",onChange:y,min:e.min,max:e.max,"aria-labelledby":"input-slider",disabled:e.disabled,sx:{"& .MuiSlider-valueLabelOpen":{zIndex:100,backgroundColor:"transparent",top:"0px"}}}),i.showVelocitySliderLabel&&(e.renderValue?e.renderValue(e.velocity):t.jsx(g,{value:e.velocity.toString()}))]})});function g({value:e,sx:r}){var n;const i=d.useTheme();return t.jsx(s,{direction:"row",justifyContent:"center",alignItems:"center",gap:"5px",sx:{padding:"6px 12px",background:(n=i.palette.backgroundPaperElevation)==null?void 0:n[8],borderRadius:"10px",minWidth:"111px",...r},children:t.jsx(u,{component:"span",sx:{textAlign:"right",fontSize:"14px",opacity:.8,color:i.palette.text.primary,whiteSpace:"nowrap"},children:e})})}exports.VelocitySlider=x;exports.VelocitySliderLabel=g;exports.default=x;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),s=require("@mui/material/styles"),d=require("@mui/material/Stack"),u=require("@mui/material/Typography"),b=require("@mui/material/Slider"),m=require("lodash-es/isNumber"),h=require("mobx-react-lite"),S=require("react-i18next"),x=h.observer(e=>{var o,a,c;const r=s.useTheme(),{store:i}=e,{t:n}=S.useTranslation();function y(v,l){l===e.velocity||!m(l)||e.onVelocityChange(l,e.useDegree)}return t.jsxs(d,{direction:"row",gap:2,alignItems:"center","data-testid":"velocity-slider","aria-label":"velocity-slider",children:[i.showVelocityLegend&&t.jsx(u,{sx:{color:(c=(a=(o=r.componentsExt)==null?void 0:o.JoggingPanel)==null?void 0:a.VelocitySlider)==null?void 0:c.sliderLegendColor,fontSize:"14px"},children:n("Jogging.Velocity.bt")}),t.jsx(b,{value:e.velocity,color:"secondary",onChange:y,min:e.min,max:e.max,"aria-labelledby":"input-slider",disabled:e.disabled,sx:{"& .MuiSlider-valueLabelOpen":{zIndex:100,backgroundColor:"transparent",top:"0px"}}}),i.showVelocitySliderLabel&&(e.renderValue?e.renderValue(e.velocity):t.jsx(g,{value:e.velocity.toString()}))]})});function g({value:e,sx:r}){var n;const i=s.useTheme();return t.jsx(d,{direction:"row",justifyContent:"center",alignItems:"center",gap:"5px",sx:{padding:"6px 12px",background:(n=i.palette.backgroundPaperElevation)==null?void 0:n[8],borderRadius:"10px",minWidth:"111px",...r},children:t.jsx(u,{component:"span",sx:{textAlign:"right",fontSize:"14px",opacity:.8,color:i.palette.text.primary,whiteSpace:"nowrap"},children:e})})}exports.VelocitySlider=x;exports.VelocitySliderLabel=g;exports.default=x;
2
2
  //# sourceMappingURL=VelocitySlider.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"VelocitySlider.cjs","sources":["../../src/components/VelocitySlider.tsx"],"sourcesContent":["import Slider from \"@mui/material/Slider\"\nimport Stack from \"@mui/material/Stack\"\nimport { useTheme, type SxProps } from \"@mui/material/styles\"\nimport Typography from \"@mui/material/Typography\"\nimport isNumber from \"lodash-es/isNumber.js\"\nimport { observer } from \"mobx-react-lite\"\nimport type { ReactNode } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport type { JoggingStore } from \"./jogging/JoggingStore\"\n\ntype VelocitySliderProps = {\n min: number\n max: number\n velocity: number\n onVelocityChange: (newVelocity: number, useDegree: boolean) => void\n disabled?: boolean\n renderValue?: (value: number) => ReactNode\n useDegree: boolean\n store: JoggingStore\n}\n\n/** A slider for controlling the movement velocity of a robot */\nexport const VelocitySlider = observer((props: VelocitySliderProps) => {\n const theme = useTheme()\n const { store } = props\n const { t } = useTranslation()\n\n function onSliderChange(_event: Event, newVelocity: number | number[]) {\n if (newVelocity === props.velocity || !isNumber(newVelocity)) return\n\n props.onVelocityChange(newVelocity, props.useDegree)\n }\n\n return (\n <Stack\n direction=\"row\"\n gap={2}\n alignItems=\"center\"\n data-testid=\"velocity-slider\"\n aria-label=\"velocity-slider\"\n >\n {store.showVelocityLegend && (\n <Typography\n sx={{\n color:\n theme.componentsExt?.JoggingPanel?.VelocitySlider\n ?.sliderLegendColor,\n fontSize: \"14px\",\n }}\n >\n {t(\"Jogging.Velocity.bt\")}\n </Typography>\n )}\n <Slider\n value={props.velocity}\n color=\"secondary\"\n onChange={onSliderChange}\n min={props.min}\n max={props.max}\n aria-labelledby=\"input-slider\"\n disabled={props.disabled}\n sx={{\n \"& .MuiSlider-valueLabelOpen\": {\n zIndex: 100,\n backgroundColor: \"transparent\",\n top: \"0px\",\n },\n }}\n />\n {store.showVelocitySliderLabel &&\n (props.renderValue ? (\n props.renderValue(props.velocity)\n ) : (\n <VelocitySliderLabel value={props.velocity.toString()} />\n ))}\n </Stack>\n )\n})\n\ntype VelocitySliderLabelProps = {\n value: string\n sx?: SxProps\n}\n\nexport function VelocitySliderLabel({ value, sx }: VelocitySliderLabelProps) {\n const theme = useTheme()\n return (\n <Stack\n direction={\"row\"}\n justifyContent={\"center\"}\n alignItems={\"center\"}\n gap={\"5px\"}\n sx={{\n padding: \"6px 12px\",\n background: theme.palette.backgroundPaperElevation?.[8],\n borderRadius: \"10px\",\n minWidth: \"111px\",\n ...sx,\n }}\n >\n <Typography\n component=\"span\"\n sx={{\n textAlign: \"right\",\n fontSize: \"14px\",\n opacity: 0.8,\n color: theme.palette.text.primary,\n whiteSpace: \"nowrap\",\n }}\n >\n {value}\n </Typography>\n </Stack>\n )\n}\n\nexport default VelocitySlider\n"],"names":["VelocitySlider","observer","props","theme","useTheme","store","t","useTranslation","onSliderChange","_event","newVelocity","isNumber","jsxs","Stack","jsx","Typography","_c","_b","_a","Slider","VelocitySliderLabel","value","sx"],"mappings":"uXAsBaA,EAAiBC,EAAAA,SAAUC,GAA+B,WACrE,MAAMC,EAAQC,EAAAA,SAAA,EACR,CAAE,MAAAC,GAAUH,EACZ,CAAE,EAAAI,CAAA,EAAMC,iBAAA,EAEd,SAASC,EAAeC,EAAeC,EAAgC,CACjEA,IAAgBR,EAAM,UAAY,CAACS,EAASD,CAAW,GAE3DR,EAAM,iBAAiBQ,EAAaR,EAAM,SAAS,CACrD,CAEA,OACEU,EAAAA,KAACC,EAAA,CACC,UAAU,MACV,IAAK,EACL,WAAW,SACX,cAAY,kBACZ,aAAW,kBAEV,SAAA,CAAAR,EAAM,oBACLS,EAAAA,IAACC,EAAA,CACC,GAAI,CACF,OACEC,GAAAC,GAAAC,EAAAf,EAAM,gBAAN,YAAAe,EAAqB,eAArB,YAAAD,EAAmC,iBAAnC,YAAAD,EACI,kBACN,SAAU,MAAA,EAGX,WAAE,qBAAqB,CAAA,CAAA,EAG5BF,EAAAA,IAACK,EAAA,CACC,MAAOjB,EAAM,SACb,MAAM,YACN,SAAUM,EACV,IAAKN,EAAM,IACX,IAAKA,EAAM,IACX,kBAAgB,eAChB,SAAUA,EAAM,SAChB,GAAI,CACF,8BAA+B,CAC7B,OAAQ,IACR,gBAAiB,cACjB,IAAK,KAAA,CACP,CACF,CAAA,EAEDG,EAAM,0BACJH,EAAM,YACLA,EAAM,YAAYA,EAAM,QAAQ,QAE/BkB,EAAA,CAAoB,MAAOlB,EAAM,SAAS,WAAY,EAAA,CAAA,CAAA,CAIjE,CAAC,EAOM,SAASkB,EAAoB,CAAE,MAAAC,EAAO,GAAAC,GAAgC,OAC3E,MAAMnB,EAAQC,EAAAA,SAAA,EACd,OACEU,EAAAA,IAACD,EAAA,CACC,UAAW,MACX,eAAgB,SAChB,WAAY,SACZ,IAAK,MACL,GAAI,CACF,QAAS,WACT,YAAYK,EAAAf,EAAM,QAAQ,2BAAd,YAAAe,EAAyC,GACrD,aAAc,OACd,SAAU,QACV,GAAGI,CAAA,EAGL,SAAAR,EAAAA,IAACC,EAAA,CACC,UAAU,OACV,GAAI,CACF,UAAW,QACX,SAAU,OACV,QAAS,GACT,MAAOZ,EAAM,QAAQ,KAAK,QAC1B,WAAY,QAAA,EAGb,SAAAkB,CAAA,CAAA,CACH,CAAA,CAGN"}
1
+ {"version":3,"file":"VelocitySlider.cjs","sources":["../../src/components/VelocitySlider.tsx"],"sourcesContent":["import { useTheme, type SxProps } from \"@mui/material/styles\"\nimport Stack from \"@mui/material/Stack\"\nimport Typography from \"@mui/material/Typography\"\nimport Slider from \"@mui/material/Slider\"\nimport isNumber from \"lodash-es/isNumber\"\nimport { observer } from \"mobx-react-lite\"\nimport type { ReactNode } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport type { JoggingStore } from \"./jogging/JoggingStore\"\n\ntype VelocitySliderProps = {\n min: number\n max: number\n velocity: number\n onVelocityChange: (newVelocity: number, useDegree: boolean) => void\n disabled?: boolean\n renderValue?: (value: number) => ReactNode\n useDegree: boolean\n store: JoggingStore\n}\n\n/** A slider for controlling the movement velocity of a robot */\nexport const VelocitySlider = observer((props: VelocitySliderProps) => {\n const theme = useTheme()\n const { store } = props\n const { t } = useTranslation()\n\n function onSliderChange(_event: Event, newVelocity: number | number[]) {\n if (newVelocity === props.velocity || !isNumber(newVelocity)) return\n\n props.onVelocityChange(newVelocity, props.useDegree)\n }\n\n return (\n <Stack\n direction=\"row\"\n gap={2}\n alignItems=\"center\"\n data-testid=\"velocity-slider\"\n aria-label=\"velocity-slider\"\n >\n {store.showVelocityLegend && (\n <Typography\n sx={{\n color:\n theme.componentsExt?.JoggingPanel?.VelocitySlider\n ?.sliderLegendColor,\n fontSize: \"14px\",\n }}\n >\n {t(\"Jogging.Velocity.bt\")}\n </Typography>\n )}\n <Slider\n value={props.velocity}\n color=\"secondary\"\n onChange={onSliderChange}\n min={props.min}\n max={props.max}\n aria-labelledby=\"input-slider\"\n disabled={props.disabled}\n sx={{\n \"& .MuiSlider-valueLabelOpen\": {\n zIndex: 100,\n backgroundColor: \"transparent\",\n top: \"0px\",\n },\n }}\n />\n {store.showVelocitySliderLabel &&\n (props.renderValue ? (\n props.renderValue(props.velocity)\n ) : (\n <VelocitySliderLabel value={props.velocity.toString()} />\n ))}\n </Stack>\n )\n})\n\ntype VelocitySliderLabelProps = {\n value: string\n sx?: SxProps\n}\n\nexport function VelocitySliderLabel({ value, sx }: VelocitySliderLabelProps) {\n const theme = useTheme()\n return (\n <Stack\n direction={\"row\"}\n justifyContent={\"center\"}\n alignItems={\"center\"}\n gap={\"5px\"}\n sx={{\n padding: \"6px 12px\",\n background: theme.palette.backgroundPaperElevation?.[8],\n borderRadius: \"10px\",\n minWidth: \"111px\",\n ...sx,\n }}\n >\n <Typography\n component=\"span\"\n sx={{\n textAlign: \"right\",\n fontSize: \"14px\",\n opacity: 0.8,\n color: theme.palette.text.primary,\n whiteSpace: \"nowrap\",\n }}\n >\n {value}\n </Typography>\n </Stack>\n )\n}\n\nexport default VelocitySlider\n"],"names":["VelocitySlider","observer","props","theme","useTheme","store","t","useTranslation","onSliderChange","_event","newVelocity","isNumber","jsxs","Stack","jsx","Typography","_c","_b","_a","Slider","VelocitySliderLabel","value","sx"],"mappings":"oXAsBaA,EAAiBC,EAAAA,SAAUC,GAA+B,WACrE,MAAMC,EAAQC,EAAAA,SAAA,EACR,CAAE,MAAAC,GAAUH,EACZ,CAAE,EAAAI,CAAA,EAAMC,iBAAA,EAEd,SAASC,EAAeC,EAAeC,EAAgC,CACjEA,IAAgBR,EAAM,UAAY,CAACS,EAASD,CAAW,GAE3DR,EAAM,iBAAiBQ,EAAaR,EAAM,SAAS,CACrD,CAEA,OACEU,EAAAA,KAACC,EAAA,CACC,UAAU,MACV,IAAK,EACL,WAAW,SACX,cAAY,kBACZ,aAAW,kBAEV,SAAA,CAAAR,EAAM,oBACLS,EAAAA,IAACC,EAAA,CACC,GAAI,CACF,OACEC,GAAAC,GAAAC,EAAAf,EAAM,gBAAN,YAAAe,EAAqB,eAArB,YAAAD,EAAmC,iBAAnC,YAAAD,EACI,kBACN,SAAU,MAAA,EAGX,WAAE,qBAAqB,CAAA,CAAA,EAG5BF,EAAAA,IAACK,EAAA,CACC,MAAOjB,EAAM,SACb,MAAM,YACN,SAAUM,EACV,IAAKN,EAAM,IACX,IAAKA,EAAM,IACX,kBAAgB,eAChB,SAAUA,EAAM,SAChB,GAAI,CACF,8BAA+B,CAC7B,OAAQ,IACR,gBAAiB,cACjB,IAAK,KAAA,CACP,CACF,CAAA,EAEDG,EAAM,0BACJH,EAAM,YACLA,EAAM,YAAYA,E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,MAAM,cAAc,WAAoB,mBAAmB;;CAuDhE,CAAA;AAEF,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,OAAO,CAAA;CACb,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,wBAAwB,2CA8B1E;AAED,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"VelocitySlider.d.ts","sourceRoot":"","sources":["../../src/components/VelocitySlider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAM7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAE1D,KAAK,mBAAmB,GAAG;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,SAAS,CAAA;IAC1C,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,cAAc,WAAoB,mBAAmB;;CAuDhE,CAAA;AAEF,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,OAAO,CAAA;CACb,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,wBAAwB,2CA8B1E;AAED,eAAe,cAAc,CAAA"}
@@ -1,19 +1,19 @@
1
1
  import { jsxs as u, jsx as i } from "react/jsx-runtime";
2
- import x from "@mui/material/Slider";
3
- import d from "@mui/material/Stack";
4
- import { useTheme as m } from "@mui/material/styles";
2
+ import { useTheme as d } from "@mui/material/styles";
3
+ import m from "@mui/material/Stack";
5
4
  import s from "@mui/material/Typography";
6
- import y from "lodash-es/isNumber.js";
5
+ import x from "@mui/material/Slider";
6
+ import y from "lodash-es/isNumber";
7
7
  import { observer as h } from "mobx-react-lite";
8
8
  import { useTranslation as b } from "react-i18next";
9
9
  const z = h((e) => {
10
10
  var l, a, c;
11
- const r = m(), { store: t } = e, { t: o } = b();
11
+ const r = d(), { store: t } = e, { t: o } = b();
12
12
  function g(p, n) {
13
13
  n === e.velocity || !y(n) || e.onVelocityChange(n, e.useDegree);
14
14
  }
15
15
  return /* @__PURE__ */ u(
16
- d,
16
+ m,
17
17
  {
18
18
  direction: "row",
19
19
  gap: 2,
@@ -57,9 +57,9 @@ const z = h((e) => {
57
57
  });
58
58
  function f({ value: e, sx: r }) {
59
59
  var o;
60
- const t = m();
60
+ const t = d();
61
61
  return /* @__PURE__ */ i(
62
- d,
62
+ m,
63
63
  {
64
64
  direction: "row",
65
65
  justifyContent: "center",
@@ -1 +1 @@
1
- {"version":3,"file":"VelocitySlider.js","sources":["../../src/components/VelocitySlider.tsx"],"sourcesContent":["import Slider from \"@mui/material/Slider\"\nimport Stack from \"@mui/material/Stack\"\nimport { useTheme, type SxProps } from \"@mui/material/styles\"\nimport Typography from \"@mui/material/Typography\"\nimport isNumber from \"lodash-es/isNumber.js\"\nimport { observer } from \"mobx-react-lite\"\nimport type { ReactNode } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport type { JoggingStore } from \"./jogging/JoggingStore\"\n\ntype VelocitySliderProps = {\n min: number\n max: number\n velocity: number\n onVelocityChange: (newVelocity: number, useDegree: boolean) => void\n disabled?: boolean\n renderValue?: (value: number) => ReactNode\n useDegree: boolean\n store: JoggingStore\n}\n\n/** A slider for controlling the movement velocity of a robot */\nexport const VelocitySlider = observer((props: VelocitySliderProps) => {\n const theme = useTheme()\n const { store } = props\n const { t } = useTranslation()\n\n function onSliderChange(_event: Event, newVelocity: number | number[]) {\n if (newVelocity === props.velocity || !isNumber(newVelocity)) return\n\n props.onVelocityChange(newVelocity, props.useDegree)\n }\n\n return (\n <Stack\n direction=\"row\"\n gap={2}\n alignItems=\"center\"\n data-testid=\"velocity-slider\"\n aria-label=\"velocity-slider\"\n >\n {store.showVelocityLegend && (\n <Typography\n sx={{\n color:\n theme.componentsExt?.JoggingPanel?.VelocitySlider\n ?.sliderLegendColor,\n fontSize: \"14px\",\n }}\n >\n {t(\"Jogging.Velocity.bt\")}\n </Typography>\n )}\n <Slider\n value={props.velocity}\n color=\"secondary\"\n onChange={onSliderChange}\n min={props.min}\n max={props.max}\n aria-labelledby=\"input-slider\"\n disabled={props.disabled}\n sx={{\n \"& .MuiSlider-valueLabelOpen\": {\n zIndex: 100,\n backgroundColor: \"transparent\",\n top: \"0px\",\n },\n }}\n />\n {store.showVelocitySliderLabel &&\n (props.renderValue ? (\n props.renderValue(props.velocity)\n ) : (\n <VelocitySliderLabel value={props.velocity.toString()} />\n ))}\n </Stack>\n )\n})\n\ntype VelocitySliderLabelProps = {\n value: string\n sx?: SxProps\n}\n\nexport function VelocitySliderLabel({ value, sx }: VelocitySliderLabelProps) {\n const theme = useTheme()\n return (\n <Stack\n direction={\"row\"}\n justifyContent={\"center\"}\n alignItems={\"center\"}\n gap={\"5px\"}\n sx={{\n padding: \"6px 12px\",\n background: theme.palette.backgroundPaperElevation?.[8],\n borderRadius: \"10px\",\n minWidth: \"111px\",\n ...sx,\n }}\n >\n <Typography\n component=\"span\"\n sx={{\n textAlign: \"right\",\n fontSize: \"14px\",\n opacity: 0.8,\n color: theme.palette.text.primary,\n whiteSpace: \"nowrap\",\n }}\n >\n {value}\n </Typography>\n </Stack>\n )\n}\n\nexport default VelocitySlider\n"],"names":["VelocitySlider","observer","props","theme","useTheme","store","t","useTranslation","onSliderChange","_event","newVelocity","isNumber","jsxs","Stack","jsx","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,EAAA;AAIjE,CAAC;AAOM,SAASkB,EAAoB,EAAE,OAAAC,GAAO,IAAAC,KAAgC;;AAC3E,QAAMnB,IAAQC,EAAA;AACd,SACE,gBAAAU;AAAA,IAACD;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,MACX,gBAAgB;AAAA,MAChB,YAAY;AAAA,MACZ,KAAK;AAAA,MACL,IAAI;AAAA,QACF,SAAS;AAAA,QACT,aAAYK,IAAAf,EAAM,QAAQ,6BAAd,gBAAAe,EAAyC;AAAA,QACrD,cAAc;AAAA,QACd,UAAU;AAAA,QACV,GAAGI;AAAA,MAAA;AAAA,MAGL,UAAA,gBAAAR;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,IAAI;AAAA,YACF,WAAW;AAAA,YACX,UAAU;AAAA,YACV,SAAS;AAAA,YACT,OAAOZ,EAAM,QAAQ,KAAK;AAAA,YAC1B,YAAY;AAAA,UAAA;AAAA,UAGb,UAAAkB;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"VelocitySlider.js","sources":["../../src/components/VelocitySlider.tsx"],"sourcesContent":["import { useTheme, type SxProps } from \"@mui/material/styles\"\nimport Stack from \"@mui/material/Stack\"\nimport Typography from \"@mui/material/Typography\"\nimport Slider from \"@mui/material/Slider\"\nimport isNumber from \"lodash-es/isNumber\"\nimport { observer } from \"mobx-react-lite\"\nimport type { ReactNode } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport type { JoggingStore } from \"./jogging/JoggingStore\"\n\ntype VelocitySliderProps = {\n min: number\n max: number\n velocity: number\n onVelocityChange: (newVelocity: number, useDegree: boolean) => void\n disabled?: boolean\n renderValue?: (value: number) => ReactNode\n useDegree: boolean\n store: JoggingStore\n}\n\n/** A slider for controlling the movement velocity of a robot */\nexport const VelocitySlider = observer((props: VelocitySliderProps) => {\n const theme = useTheme()\n const { store } = props\n const { t } = useTranslation()\n\n function onSliderChange(_event: Event, newVelocity: number | number[]) {\n if (newVelocity === props.velocity || !isNumber(newVelocity)) return\n\n props.onVelocityChange(newVelocity, props.useDegree)\n }\n\n return (\n <Stack\n direction=\"row\"\n gap={2}\n alignItems=\"center\"\n data-testid=\"velocity-slider\"\n aria-label=\"velocity-slider\"\n >\n {store.showVelocityLegend && (\n <Typography\n sx={{\n color:\n theme.componentsExt?.JoggingPanel?.VelocitySlider\n ?.sliderLegendColor,\n fontSize: \"14px\",\n }}\n >\n {t(\"Jogging.Velocity.bt\")}\n </Typography>\n )}\n <Slider\n value={props.velocity}\n color=\"secondary\"\n onChange={onSliderChange}\n min={props.min}\n max={props.max}\n aria-labelledby=\"input-slider\"\n disabled={props.disabled}\n sx={{\n \"& .MuiSlider-valueLabelOpen\": {\n zIndex: 100,\n backgroundColor: \"transparent\",\n top: \"0px\",\n },\n }}\n />\n {store.showVelocitySliderLabel &&\n (props.renderValue ? (\n props.renderValue(props.velocity)\n ) : (\n <VelocitySliderLabel value={props.velocity.toString()} />\n ))}\n </Stack>\n )\n})\n\ntype VelocitySliderLabelProps = {\n value: string\n sx?: SxProps\n}\n\nexport function VelocitySliderLabel({ value, sx }: VelocitySliderLabelProps) {\n const theme = useTheme()\n return (\n <Stack\n direction={\"row\"}\n justifyContent={\"center\"}\n alignItems={\"center\"}\n gap={\"5px\"}\n sx={{\n padding: \"6px 12px\",\n background: theme.palette.backgroundPaperElevation?.[8],\n borderRadius: \"10px\",\n minWidth: \"111px\",\n ...sx,\n }}\n >\n <Typography\n component=\"span\"\n sx={{\n textAlign: \"right\",\n fontSize: \"14px\",\n opacity: 0.8,\n color: theme.palette.text.primary,\n whiteSpace: \"nowrap\",\n }}\n >\n {value}\n </Typography>\n </Stack>\n )\n}\n\nexport default VelocitySlider\n"],"names":["VelocitySlider","observer","props","theme","useTheme","store","t","useTranslation","onSliderChange","_event","newVelocity","isNumber","jsxs","Stack","jsx","Typography","_c","_b","_a","Slider","VelocitySliderLabel","value","sx"],"mappings":";;;;;;;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AAO,IAAAC,KAAgC;;AAC3E,QAAMnB,IAAQC,EAAA;AACd,SACE,gBAAAU;AAAA,IAACD;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,MACX,gBAAgB;AAAA,MAChB,YAAY;AAAA,MACZ,KAAK;AAAA,MACL,IAAI;AAAA,QACF,SAAS;AAAA,QACT,aAAYK,IAAAf,EAAM,QAAQ,6BAAd,gBAAAe,EAAyC;AAAA,QACrD,cAAc;AAAA,QACd,UAAU;AAAA,QACV,GAAGI;AAAA,MAAA;AAAA,MAGL,UAAA,gBAAAR;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,IAAI;AAAA,YACF,WAAW;AAAA,YACX,UAAU;AAAA,YACV,SAAS;AAAA,YACT,OAAOZ,EAAM,QAAQ,KAAK;AAAA,YAC1B,YAAY;AAAA,UAAA;AAAA,UAGb,UAAAkB;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),g=require("@mui/material/Typography"),d=require("lodash-es/isEqual.js"),l=require("mobx-react-lite"),r=require("react"),u=require("react-i18next"),h=require("../utils/hooks.cjs"),j=l.observer(({store:t})=>{const{t:c}=u.useTranslation(),[n,s]=r.useState(t.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached),o=r.useRef(n);h.useAnimationFrame(()=>{const e=t.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;d(o.current,e)||(o.current=e,s(e))});const i=[];for(const[e,a]of n.entries())a&&i.push(e);return m.jsx(g,{"data-testid":"jogging-joint-limit-detector","aria-label":"jogging-joint-limit-detector",color:"error",sx:{margin:"0.5rem 1rem",textAlign:"center",minHeight:"1.5rem",visibility:i.length?"visible":"hidden"},children:c("Jogging.JointLimitsReached.lb",{jointNumbers:i.map(e=>e+1).join(", ")})})});exports.JoggingJointLimitDetector=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),g=require("@mui/material/Typography"),d=require("mobx-react-lite"),l=require("lodash-es/isEqual"),r=require("react"),u=require("react-i18next"),h=require("../utils/hooks.cjs"),j=d.observer(({store:t})=>{const{t:c}=u.useTranslation(),[n,s]=r.useState(t.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached),o=r.useRef(n);h.useAnimationFrame(()=>{const e=t.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;l(o.current,e)||(o.current=e,s(e))});const i=[];for(const[e,a]of n.entries())a&&i.push(e);return m.jsx(g,{"data-testid":"jogging-joint-limit-detector","aria-label":"jogging-joint-limit-detector",color:"error",sx:{margin:"0.5rem 1rem",textAlign:"center",minHeight:"1.5rem",visibility:i.length?"visible":"hidden"},children:c("Jogging.JointLimitsReached.lb",{jointNumbers:i.map(e=>e+1).join(", ")})})});exports.JoggingJointLimitDetector=j;
2
2
  //# sourceMappingURL=JoggingJointLimitDetector.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"JoggingJointLimitDetector.cjs","sources":["../../../src/components/jogging/JoggingJointLimitDetector.tsx"],"sourcesContent":["import Typography from \"@mui/material/Typography\"\nimport isEqual from \"lodash-es/isEqual.js\"\nimport { observer } from \"mobx-react-lite\"\nimport { useRef, useState } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport { useAnimationFrame } from \"../utils/hooks\"\nimport type { JoggingStore } from \"./JoggingStore\"\n\n/**\n * Monitors the active robot motion state and displays a message if\n * any joint limits are reached.\n */\nexport const JoggingJointLimitDetector = observer(\n ({ store }: { store: JoggingStore }) => {\n const { t } = useTranslation()\n\n const [jointLimitsReached, setJointLimitsReached] = useState(\n store.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached\n .limit_reached,\n )\n const jointLimitsReachedRef = useRef(jointLimitsReached)\n\n useAnimationFrame(() => {\n const newLimitsReached =\n store.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached\n .limit_reached\n\n if (!isEqual(jointLimitsReachedRef.current, newLimitsReached)) {\n jointLimitsReachedRef.current = newLimitsReached\n setJointLimitsReached(newLimitsReached)\n }\n })\n\n const jointLimitReachedIndices: number[] = []\n for (const [index, limitReached] of jointLimitsReached.entries()) {\n if (limitReached) jointLimitReachedIndices.push(index)\n }\n\n return (\n <Typography\n data-testid=\"jogging-joint-limit-detector\"\n aria-label=\"jogging-joint-limit-detector\"\n color=\"error\"\n sx={{\n margin: \"0.5rem 1rem\",\n textAlign: \"center\",\n minHeight: \"1.5rem\",\n visibility: jointLimitReachedIndices.length ? \"visible\" : \"hidden\",\n }}\n >\n {t(\"Jogging.JointLimitsReached.lb\", {\n jointNumbers: jointLimitReachedIndices.map((i) => i + 1).join(\", \"),\n })}\n </Typography>\n )\n },\n)\n"],"names":["JoggingJointLimitDetector","observer","store","t","useTranslation","jointLimitsReached","setJointLimitsReached","useState","jointLimitsReachedRef","useRef","useAnimationFrame","newLimitsReached","isEqual","jointLimitReachedIndices","index","limitReached","jsx","Typography","i"],"mappings":"wSAYaA,EAA4BC,EAAAA,SACvC,CAAC,CAAE,MAAAC,CAAA,IAAqC,CACtC,KAAM,CAAE,EAAAC,CAAA,EAAMC,iBAAA,EAER,CAACC,EAAoBC,CAAqB,EAAIC,EAAAA,SAClDL,EAAM,OAAO,aAAa,2BAA2B,oBAClD,aAAA,EAECM,EAAwBC,EAAAA,OAAOJ,CAAkB,EAEvDK,EAAAA,kBAAkB,IAAM,CACtB,MAAMC,EACJT,EAAM,OAAO,aAAa,2BAA2B,oBAClD,cAEAU,EAAQJ,EAAsB,QAASG,CAAgB,IAC1DH,EAAsB,QAAUG,EAChCL,EAAsBK,CAAgB,EAE1C,CAAC,EAED,MAAME,EAAqC,CAAA,EAC3C,SAAW,CAACC,EAAOC,CAAY,IAAKV,EAAmB,UACjDU,GAAcF,EAAyB,KAAKC,CAAK,EAGvD,OACEE,EAAAA,IAACC,EAAA,CACC,cAAY,+BACZ,aAAW,+BACX,MAAM,QACN,GAAI,CACF,OAAQ,cACR,UAAW,SACX,UAAW,SACX,WAAYJ,EAAyB,OAAS,UAAY,QAAA,EAG3D,WAAE,gCAAiC,CAClC,aAAcA,EAAyB,IAAKK,GAAMA,EAAI,CAAC,EAAE,KAAK,IAAI,CAAA,CACnE,CAAA,CAAA,CAGP,CACF"}
1
+ {"version":3,"file":"JoggingJointLimitDetector.cjs","sources":["../../../src/components/jogging/JoggingJointLimitDetector.tsx"],"sourcesContent":["import Typography from \"@mui/material/Typography\"\nimport { observer } from \"mobx-react-lite\"\nimport isEqual from \"lodash-es/isEqual\"\nimport { useRef, useState } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport { useAnimationFrame } from \"../utils/hooks\"\nimport type { JoggingStore } from \"./JoggingStore\"\n\n/**\n * Monitors the active robot motion state and displays a message if\n * any joint limits are reached.\n */\nexport const JoggingJointLimitDetector = observer(\n ({ store }: { store: JoggingStore }) => {\n const { t } = useTranslation()\n\n const [jointLimitsReached, setJointLimitsReached] = useState(\n store.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached\n .limit_reached,\n )\n const jointLimitsReachedRef = useRef(jointLimitsReached)\n\n useAnimationFrame(() => {\n const newLimitsReached =\n store.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached\n .limit_reached\n\n if (!isEqual(jointLimitsReachedRef.current, newLimitsReached)) {\n jointLimitsReachedRef.current = newLimitsReached\n setJointLimitsReached(newLimitsReached)\n }\n })\n\n const jointLimitReachedIndices: number[] = []\n for (const [index, limitReached] of jointLimitsReached.entries()) {\n if (limitReached) jointLimitReachedIndices.push(index)\n }\n\n return (\n <Typography\n data-testid=\"jogging-joint-limit-detector\"\n aria-label=\"jogging-joint-limit-detector\"\n color=\"error\"\n sx={{\n margin: \"0.5rem 1rem\",\n textAlign: \"center\",\n minHeight: \"1.5rem\",\n visibility: jointLimitReachedIndices.length ? \"visible\" : \"hidden\",\n }}\n >\n {t(\"Jogging.JointLimitsReached.lb\", {\n jointNumbers: jointLimitReachedIndices.map((i) => i + 1).join(\", \"),\n })}\n </Typography>\n )\n },\n)\n"],"names":["JoggingJointLimitDetector","observer","store","t","useTranslation","jointLimitsReached","setJointLimitsReached","useState","jointLimitsReachedRef","useRef","useAnimationFrame","newLimitsReached","isEqual","jointLimitReachedIndices","index","limitReached","jsx","Typography","i"],"mappings":"qSAYaA,EAA4BC,EAAAA,SACvC,CAAC,CAAE,MAAAC,CAAA,IAAqC,CACtC,KAAM,CAAE,EAAAC,CAAA,EAAMC,iBAAA,EAER,CAACC,EAAoBC,CAAqB,EAAIC,EAAAA,SAClDL,EAAM,OAAO,aAAa,2BAA2B,oBAClD,aAAA,EAECM,EAAwBC,EAAAA,OAAOJ,CAAkB,EAEvDK,EAAAA,kBAAkB,IAAM,CACtB,MAAMC,EACJT,EAAM,OAAO,aAAa,2BAA2B,oBAClD,cAEAU,EAAQJ,EAAsB,QAASG,CAAgB,IAC1DH,EAAsB,QAAUG,EAChCL,EAAsBK,CAAgB,EAE1C,CAAC,EAED,MAAME,EAAqC,CAAA,EAC3C,SAAW,CAACC,EAAOC,CAAY,IAAKV,EAAmB,UACjDU,GAAcF,EAAyB,KAAKC,CAAK,EAGvD,OACEE,EAAAA,IAACC,EAAA,CACC,cAAY,+BACZ,aAAW,+BACX,MAAM,QACN,GAAI,CACF,OAAQ,cACR,UAAW,SACX,UAAW,SACX,WAAYJ,EAAyB,OAAS,UAAY,QAAA,EAG3D,WAAE,gCAAiC,CAClC,aAAcA,EAAyB,IAAKK,GAAMA,EAAI,CAAC,EAAE,KAAK,IAAI,CAAA,CACnE,CAAA,CAAA,CAGP,CACF"}
@@ -1,18 +1,18 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
2
  import c from "@mui/material/Typography";
3
- import g from "lodash-es/isEqual.js";
4
- import { observer as d } from "mobx-react-lite";
3
+ import { observer as g } from "mobx-react-lite";
4
+ import d from "lodash-es/isEqual";
5
5
  import { useState as l, useRef as h } from "react";
6
6
  import { useTranslation as j } from "react-i18next";
7
7
  import { useAnimationFrame as p } from "../utils/hooks.js";
8
- const y = d(
8
+ const y = g(
9
9
  ({ store: e }) => {
10
10
  const { t: n } = j(), [o, m] = l(
11
11
  e.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached
12
12
  ), r = h(o);
13
13
  p(() => {
14
14
  const i = e.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached.limit_reached;
15
- g(r.current, i) || (r.current = i, m(i));
15
+ d(r.current, i) || (r.current = i, m(i));
16
16
  });
17
17
  const t = [];
18
18
  for (const [i, a] of o.entries())
@@ -1 +1 @@
1
- {"version":3,"file":"JoggingJointLimitDetector.js","sources":["../../../src/components/jogging/JoggingJointLimitDetector.tsx"],"sourcesContent":["import Typography from \"@mui/material/Typography\"\nimport isEqual from \"lodash-es/isEqual.js\"\nimport { observer } from \"mobx-react-lite\"\nimport { useRef, useState } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport { useAnimationFrame } from \"../utils/hooks\"\nimport type { JoggingStore } from \"./JoggingStore\"\n\n/**\n * Monitors the active robot motion state and displays a message if\n * any joint limits are reached.\n */\nexport const JoggingJointLimitDetector = observer(\n ({ store }: { store: JoggingStore }) => {\n const { t } = useTranslation()\n\n const [jointLimitsReached, setJointLimitsReached] = useState(\n store.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached\n .limit_reached,\n )\n const jointLimitsReachedRef = useRef(jointLimitsReached)\n\n useAnimationFrame(() => {\n const newLimitsReached =\n store.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached\n .limit_reached\n\n if (!isEqual(jointLimitsReachedRef.current, newLimitsReached)) {\n jointLimitsReachedRef.current = newLimitsReached\n setJointLimitsReached(newLimitsReached)\n }\n })\n\n const jointLimitReachedIndices: number[] = []\n for (const [index, limitReached] of jointLimitsReached.entries()) {\n if (limitReached) jointLimitReachedIndices.push(index)\n }\n\n return (\n <Typography\n data-testid=\"jogging-joint-limit-detector\"\n aria-label=\"jogging-joint-limit-detector\"\n color=\"error\"\n sx={{\n margin: \"0.5rem 1rem\",\n textAlign: \"center\",\n minHeight: \"1.5rem\",\n visibility: jointLimitReachedIndices.length ? \"visible\" : \"hidden\",\n }}\n >\n {t(\"Jogging.JointLimitsReached.lb\", {\n jointNumbers: jointLimitReachedIndices.map((i) => i + 1).join(\", \"),\n })}\n </Typography>\n )\n },\n)\n"],"names":["JoggingJointLimitDetector","observer","store","t","useTranslation","jointLimitsReached","setJointLimitsReached","useState","jointLimitsReachedRef","useRef","useAnimationFrame","newLimitsReached","isEqual","jointLimitReachedIndices","index","limitReached","jsx","Typography"],"mappings":";;;;;;;AAYO,MAAMA,IAA4BC;AAAA,EACvC,CAAC,EAAE,OAAAC,EAAA,MAAqC;AACtC,UAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GAER,CAACC,GAAoBC,CAAqB,IAAIC;AAAA,MAClDL,EAAM,OAAO,aAAa,2BAA2B,oBAClD;AAAA,IAAA,GAECM,IAAwBC,EAAOJ,CAAkB;AAEvD,IAAAK,EAAkB,MAAM;AACtB,YAAMC,IACJT,EAAM,OAAO,aAAa,2BAA2B,oBAClD;AAEL,MAAKU,EAAQJ,EAAsB,SAASG,CAAgB,MAC1DH,EAAsB,UAAUG,GAChCL,EAAsBK,CAAgB;AAAA,IAE1C,CAAC;AAED,UAAME,IAAqC,CAAA;AAC3C,eAAW,CAACC,GAAOC,CAAY,KAAKV,EAAmB;AACrD,MAAIU,KAAcF,EAAyB,KAAKC,CAAK;AAGvD,WACE,gBAAAE;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,eAAY;AAAA,QACZ,cAAW;AAAA,QACX,OAAM;AAAA,QACN,IAAI;AAAA,UACF,QAAQ;AAAA,UACR,WAAW;AAAA,UACX,WAAW;AAAA,UACX,YAAYJ,EAAyB,SAAS,YAAY;AAAA,QAAA;AAAA,QAG3D,YAAE,iCAAiC;AAAA,UAClC,cAAcA,EAAyB,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI;AAAA,QAAA,CACnE;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;"}
1
+ {"version":3,"file":"JoggingJointLimitDetector.js","sources":["../../../src/components/jogging/JoggingJointLimitDetector.tsx"],"sourcesContent":["import Typography from \"@mui/material/Typography\"\nimport { observer } from \"mobx-react-lite\"\nimport isEqual from \"lodash-es/isEqual\"\nimport { useRef, useState } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport { useAnimationFrame } from \"../utils/hooks\"\nimport type { JoggingStore } from \"./JoggingStore\"\n\n/**\n * Monitors the active robot motion state and displays a message if\n * any joint limits are reached.\n */\nexport const JoggingJointLimitDetector = observer(\n ({ store }: { store: JoggingStore }) => {\n const { t } = useTranslation()\n\n const [jointLimitsReached, setJointLimitsReached] = useState(\n store.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached\n .limit_reached,\n )\n const jointLimitsReachedRef = useRef(jointLimitsReached)\n\n useAnimationFrame(() => {\n const newLimitsReached =\n store.jogger.motionStream.rapidlyChangingMotionState.joint_limit_reached\n .limit_reached\n\n if (!isEqual(jointLimitsReachedRef.current, newLimitsReached)) {\n jointLimitsReachedRef.current = newLimitsReached\n setJointLimitsReached(newLimitsReached)\n }\n })\n\n const jointLimitReachedIndices: number[] = []\n for (const [index, limitReached] of jointLimitsReached.entries()) {\n if (limitReached) jointLimitReachedIndices.push(index)\n }\n\n return (\n <Typography\n data-testid=\"jogging-joint-limit-detector\"\n aria-label=\"jogging-joint-limit-detector\"\n color=\"error\"\n sx={{\n margin: \"0.5rem 1rem\",\n textAlign: \"center\",\n minHeight: \"1.5rem\",\n visibility: jointLimitReachedIndices.length ? \"visible\" : \"hidden\",\n }}\n >\n {t(\"Jogging.JointLimitsReached.lb\", {\n jointNumbers: jointLimitReachedIndices.map((i) => i + 1).join(\", \"),\n })}\n </Typography>\n )\n },\n)\n"],"names":["JoggingJointLimitDetector","observer","store","t","useTranslation","jointLimitsReached","setJointLimitsReached","useState","jointLimitsReachedRef","useRef","useAnimationFrame","newLimitsReached","isEqual","jointLimitReachedIndices","index","limitReached","jsx","Typography"],"mappings":";;;;;;;AAYO,MAAMA,IAA4BC;AAAA,EACvC,CAAC,EAAE,OAAAC,EAAA,MAAqC;AACtC,UAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA,GAER,CAACC,GAAoBC,CAAqB,IAAIC;AAAA,MAClDL,EAAM,OAAO,aAAa,2BAA2B,oBAClD;AAAA,IAAA,GAECM,IAAwBC,EAAOJ,CAAkB;AAEvD,IAAAK,EAAkB,MAAM;AACtB,YAAMC,IACJT,EAAM,OAAO,aAAa,2BAA2B,oBAClD;AAEL,MAAKU,EAAQJ,EAAsB,SAASG,CAAgB,MAC1DH,EAAsB,UAAUG,GAChCL,EAAsBK,CAAgB;AAAA,IAE1C,CAAC;AAED,UAAME,IAAqC,CAAA;AAC3C,eAAW,CAACC,GAAOC,CAAY,KAAKV,EAAmB;AACrD,MAAIU,KAAcF,EAAyB,KAAKC,CAAK;AAGvD,WACE,gBAAAE;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,eAAY;AAAA,QACZ,cAAW;AAAA,QACX,OAAM;AAAA,QACN,IAAI;AAAA,UACF,QAAQ;AAAA,UACR,WAAW;AAAA,UACX,WAAW;AAAA,UACX,YAAYJ,EAAyB,SAAS,YAAY;AAAA,QAAA;AAAA,QAG3D,YAAE,iCAAiC;AAAA,UAClC,cAAcA,EAAyB,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI;AAAA,QAAA,CACnE;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),$=require("@mui/icons-material/ChevronLeft"),U=require("@mui/icons-material/ChevronRight"),V=require("@mui/material/IconButton"),H=require("@mui/material/Slider"),z=require("@mui/material/Stack"),K=require("@mui/material/styles"),Q=require("@mui/material/Typography"),X=require("@wandelbots/nova-js"),Y=require("lodash-es/throttle.js"),D=require("mobx-react-lite"),Z=require("react"),L=require("react-i18next"),tt=require("../../externalizeComponent.cjs"),et=require("../utils/hooks.cjs"),I=tt.externalizeComponent(D.observer(({startJogging:W,stopJogging:B,lowerLimit:r,upperLimit:i,useDegree:o,getValue:b,disabled:s,...F})=>{var J,m,k,P,C,q,y,S,j,E,M,R,w,N,T;const{t:h}=L.useTranslation(),[c,G]=Z.useState(),e=K.useTheme(),d={background:(J=e.palette.backgroundPaperElevation)==null?void 0:J[4],color:(m=e.palette.backgroundPaperElevation)==null?void 0:m[11]},l=D.useLocalObservable(()=>({activeJoggingDir:null,startJogging(t){this.activeJoggingDir=t,W(t)},stopJogging(){this.activeJoggingDir=null,B()}})),O=Y(()=>{const t=o?a(b()):b();(t===void 0||c===void 0||Math.abs(c-t)>1e-9)&&G(t)},50);et.useAnimationFrame(O);function a(t){if(t!==void 0)return X.radiansToDegrees(t)}function A(t){t.button===0&&l.startJogging("-")}function _(t){t.button===0&&l.startJogging("+")}function v(t){l.stopJogging()}function f(t){l.stopJogging()}function p(t,u=1){if(t===void 0||Number.isNaN(t))return"";const g=h("General.degree.variable",{amount:t.toFixed(u)});return t>0&&u===0?`+${g}`:g}function x(t,u=1){if(t===void 0||Number.isNaN(t))return"";const g=h("General.mm.variable",{amount:t.toFixed(u)});return t>0&&u===0?`+${g}`:g}return n.jsxs(z,{height:"64px",width:"100%",maxWidth:"260px",direction:"row",...F,sx:{"& .MuiIconButton-root":{width:"52px",color:e.palette.text.primary,alignContent:"center",backgroundColor:(k=e.palette.backgroundPaperElevation)==null?void 0:k[11],"& svg":{width:"42px",height:"42px"},"&.Mui-disabled":{backgroundColor:(P=e.palette.backgroundPaperElevation)==null?void 0:P[11],color:e.palette.action.disabled,opacity:1},"&:hover":{backgroundColor:(C=e.palette.backgroundPaperElevation)==null?void 0:C[9]},"&:active":{...d}}},children:[n.jsx(V,{onPointerDown:A,onPointerUp:v,onPointerOut:f,disabled:s,disableRipple:!0,sx:{borderRadius:"16px 0px 0px 16px",...l.activeJoggingDir==="-"?d:{}},children:n.jsx($,{sx:{pointerEvents:"none",color:(j=(S=(y=(q=e.componentsExt)==null?void 0:q.JoggingPanel)==null?void 0:y.JoggingJoint)==null?void 0:S.Joint)==null?void 0:j.arrowColor}})}),n.jsxs(z,{flexGrow:1,alignItems:"center",justifyContent:"center",sx:{borderStyle:"solid",borderLeftWidth:0,borderRightWidth:0,border:"none",backgroundColor:(E=e.palette.backgroundPaperElevation)==null?void 0:E[11],paddingLeft:"20px",paddingRight:"20px",zIndex:1},children:[n.jsx(Q,{sx:{fontSize:"15px",fontWeight:700,position:"relative",top:"5px",fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center",color:s?e.palette.action.disabled:e.palette.text.primary},children:o?p(c):x(c)}),n.jsx(H,{disabled:!0,"aria-label":"Joint position",min:o?a(r):r,max:o?a(i):i,value:c||0,track:!1,sx:{"& .MuiSlider-mark":{display:"none"},"& .MuiSlider-thumb":{width:"5px",height:"12px",borderRadius:"2px",color:s?e.palette.action.disabled:e.palette.text.primary},"& .MuiSlider-markLabel":{top:"20px",fontSize:"12px",color:s?e.palette.action.disabled:e.palette.text.secondary},"& .MuiSlider-rail":{backgroundColor:(M=e.palette.backgroundPaperElevation)==null?void 0:M[5],opacity:1}},marks:r!==void 0&&i!==void 0&&[{value:o?a(r):r,label:o?p(a(r),0):x(r)},{value:o?a(i):i,label:o?p(a(i),0):x(i)}]})]}),n.jsx(V,{onPointerDown:_,onPointerUp:v,onPointerOut:f,disabled:s,disableRipple:!0,sx:{borderRadius:"0px 16px 16px 0px",...l.activeJoggingDir==="+"?d:{}},children:n.jsx(U,{sx:{pointerEvents:"none",color:(T=(N=(w=(R=e.componentsExt)==null?void 0:R.JoggingPanel)==null?void 0:w.JoggingJoint)==null?void 0:N.Joint)==null?void 0:T.arrowColor}})})]})}));exports.JoggingJointValueControl=I;exports.default=I;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),$=require("@mui/icons-material/ChevronLeft"),U=require("@mui/icons-material/ChevronRight"),H=require("@mui/material/styles"),V=require("@mui/material/IconButton"),K=require("@mui/material/Slider"),Q=require("@mui/material/Typography"),z=require("@mui/material/Stack"),X=require("@wandelbots/nova-js"),Y=require("lodash-es/throttle"),D=require("mobx-react-lite"),Z=require("react"),L=require("react-i18next"),tt=require("../../externalizeComponent.cjs"),et=require("../utils/hooks.cjs"),I=tt.externalizeComponent(D.observer(({startJogging:W,stopJogging:B,lowerLimit:r,upperLimit:i,useDegree:o,getValue:b,disabled:s,...F})=>{var J,m,k,P,C,q,y,S,j,E,M,R,w,N,T;const{t:h}=L.useTranslation(),[c,G]=Z.useState(),e=H.useTheme(),d={background:(J=e.palette.backgroundPaperElevation)==null?void 0:J[4],color:(m=e.palette.backgroundPaperElevation)==null?void 0:m[11]},l=D.useLocalObservable(()=>({activeJoggingDir:null,startJogging(t){this.activeJoggingDir=t,W(t)},stopJogging(){this.activeJoggingDir=null,B()}})),O=Y(()=>{const t=o?a(b()):b();(t===void 0||c===void 0||Math.abs(c-t)>1e-9)&&G(t)},50);et.useAnimationFrame(O);function a(t){if(t!==void 0)return X.radiansToDegrees(t)}function A(t){t.button===0&&l.startJogging("-")}function _(t){t.button===0&&l.startJogging("+")}function v(t){l.stopJogging()}function f(t){l.stopJogging()}function p(t,u=1){if(t===void 0||Number.isNaN(t))return"";const g=h("General.degree.variable",{amount:t.toFixed(u)});return t>0&&u===0?`+${g}`:g}function x(t,u=1){if(t===void 0||Number.isNaN(t))return"";const g=h("General.mm.variable",{amount:t.toFixed(u)});return t>0&&u===0?`+${g}`:g}return n.jsxs(z,{height:"64px",width:"100%",maxWidth:"260px",direction:"row",...F,sx:{"& .MuiIconButton-root":{width:"52px",color:e.palette.text.primary,alignContent:"center",backgroundColor:(k=e.palette.backgroundPaperElevation)==null?void 0:k[11],"& svg":{width:"42px",height:"42px"},"&.Mui-disabled":{backgroundColor:(P=e.palette.backgroundPaperElevation)==null?void 0:P[11],color:e.palette.action.disabled,opacity:1},"&:hover":{backgroundColor:(C=e.palette.backgroundPaperElevation)==null?void 0:C[9]},"&:active":{...d}}},children:[n.jsx(V,{onPointerDown:A,onPointerUp:v,onPointerOut:f,disabled:s,disableRipple:!0,sx:{borderRadius:"16px 0px 0px 16px",...l.activeJoggingDir==="-"?d:{}},children:n.jsx($,{sx:{pointerEvents:"none",color:(j=(S=(y=(q=e.componentsExt)==null?void 0:q.JoggingPanel)==null?void 0:y.JoggingJoint)==null?void 0:S.Joint)==null?void 0:j.arrowColor}})}),n.jsxs(z,{flexGrow:1,alignItems:"center",justifyContent:"center",sx:{borderStyle:"solid",borderLeftWidth:0,borderRightWidth:0,border:"none",backgroundColor:(E=e.palette.backgroundPaperElevation)==null?void 0:E[11],paddingLeft:"20px",paddingRight:"20px",zIndex:1},children:[n.jsx(Q,{sx:{fontSize:"15px",fontWeight:700,position:"relative",top:"5px",fontVariantNumeric:"tabular-nums",minWidth:"80px",textAlign:"center",color:s?e.palette.action.disabled:e.palette.text.primary},children:o?p(c):x(c)}),n.jsx(K,{disabled:!0,"aria-label":"Joint position",min:o?a(r):r,max:o?a(i):i,value:c||0,track:!1,sx:{"& .MuiSlider-mark":{display:"none"},"& .MuiSlider-thumb":{width:"5px",height:"12px",borderRadius:"2px",color:s?e.palette.action.disabled:e.palette.text.primary},"& .MuiSlider-markLabel":{top:"20px",fontSize:"12px",color:s?e.palette.action.disabled:e.palette.text.secondary},"& .MuiSlider-rail":{backgroundColor:(M=e.palette.backgroundPaperElevation)==null?void 0:M[5],opacity:1}},marks:r!==void 0&&i!==void 0&&[{value:o?a(r):r,label:o?p(a(r),0):x(r)},{value:o?a(i):i,label:o?p(a(i),0):x(i)}]})]}),n.jsx(V,{onPointerDown:_,onPointerUp:v,onPointerOut:f,disabled:s,disableRipple:!0,sx:{borderRadius:"0px 16px 16px 0px",...l.activeJoggingDir==="+"?d:{}},children:n.jsx(U,{sx:{pointerEvents:"none",color:(T=(N=(w=(R=e.componentsExt)==null?void 0:R.JoggingPanel)==null?void 0:w.JoggingJoint)==null?void 0:N.Joint)==null?void 0:T.arrowColor}})})]})}));exports.JoggingJointValueControl=I;exports.default=I;
2
2
  //# sourceMappingURL=JoggingJointValueControl.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"JoggingJointValueControl.cjs","sources":["../../../src/components/jogging/JoggingJointValueControl.tsx"],"sourcesContent":["import ChevronLeft from \"@mui/icons-material/ChevronLeft\"\nimport ChevronRight from \"@mui/icons-material/ChevronRight\"\nimport IconButton from \"@mui/material/IconButton\"\nimport Slider from \"@mui/material/Slider\"\nimport Stack from \"@mui/material/Stack\"\nimport { useTheme } from \"@mui/material/styles\"\nimport Typography from \"@mui/material/Typography\"\nimport { radiansToDegrees } from \"@wandelbots/nova-js\"\nimport throttle from \"lodash-es/throttle.js\"\nimport { observer, useLocalObservable } from \"mobx-react-lite\"\nimport { useState } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport { externalizeComponent } from \"../../externalizeComponent\"\nimport { useAnimationFrame } from \"../utils/hooks\"\n\ntype JoggingJointValueControlProps = {\n startJogging: (direction: \"-\" | \"+\") => void\n stopJogging: () => void\n lowerLimit?: number\n upperLimit?: number\n useDegree: boolean\n getValue: () => number | undefined\n disabled?: boolean\n} & React.ComponentProps<typeof Stack>\n\n/** A input widget to control an individual joint */\nexport const JoggingJointValueControl = externalizeComponent(\n observer(\n ({\n startJogging,\n stopJogging,\n lowerLimit,\n upperLimit,\n useDegree,\n getValue,\n disabled,\n ...rest\n }: JoggingJointValueControlProps) => {\n const { t } = useTranslation()\n const [currentValue, setCurrentValue] = useState<number | undefined>()\n const theme = useTheme()\n\n const pressedButtonStyle = {\n background: theme.palette.backgroundPaperElevation?.[4],\n color: theme.palette.backgroundPaperElevation?.[11],\n }\n\n const state = useLocalObservable(() => ({\n activeJoggingDir: null as \"-\" | \"+\" | null,\n\n startJogging(dir: \"-\" | \"+\") {\n this.activeJoggingDir = dir\n startJogging(dir)\n },\n\n stopJogging() {\n this.activeJoggingDir = null\n stopJogging()\n },\n }))\n\n const updateValue = throttle(() => {\n const newValue = useDegree ? convertToDegree(getValue()) : getValue()\n if (\n newValue === undefined ||\n currentValue === undefined ||\n Math.abs(currentValue - newValue) > 1e-9\n ) {\n setCurrentValue(newValue)\n }\n }, 50)\n\n useAnimationFrame(updateValue)\n\n function convertToDegree(value: number | undefined) {\n if (value === undefined) {\n return undefined\n }\n return radiansToDegrees(value)\n }\n\n function onPointerDownMinus(ev: React.PointerEvent) {\n // Stop right click from triggering jog\n if (ev.button === 0) state.startJogging(\"-\")\n }\n\n function onPointerDownPlus(ev: React.PointerEvent) {\n if (ev.button === 0) state.startJogging(\"+\")\n }\n\n function onPointerUp(ev: React.PointerEvent) {\n state.stopJogging()\n }\n\n function onPointerOut(ev: React.PointerEvent) {\n state.stopJogging()\n }\n\n function formatDegrees(value: number | undefined, precision = 1) {\n if (value === undefined || Number.isNaN(value)) return \"\"\n\n const output = t(\"General.degree.variable\", {\n amount: value.toFixed(precision),\n })\n\n if (value > 0 && precision === 0) {\n return `+${output}`\n } else {\n return output\n }\n }\n function formatMm(value: number | undefined, precision = 1) {\n if (value === undefined || Number.isNaN(value)) return \"\"\n\n const output = t(\"General.mm.variable\", {\n amount: value.toFixed(precision),\n })\n\n if (value > 0 && precision === 0) {\n return `+${output}`\n } else {\n return output\n }\n }\n\n return (\n <Stack\n height=\"64px\"\n width=\"100%\"\n maxWidth=\"260px\"\n direction=\"row\"\n {...rest}\n sx={{\n \"& .MuiIconButton-root\": {\n width: \"52px\",\n color: theme.palette.text.primary,\n alignContent: \"center\",\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n \"& svg\": {\n width: \"42px\",\n height: \"42px\",\n },\n\n \"&.Mui-disabled\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n color: theme.palette.action.disabled,\n opacity: 1,\n },\n \"&:hover\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[9],\n },\n \"&:active\": {\n ...pressedButtonStyle,\n },\n },\n }}\n >\n <IconButton\n onPointerDown={onPointerDownMinus}\n onPointerUp={onPointerUp}\n onPointerOut={onPointerOut}\n disabled={disabled}\n disableRipple\n sx={{\n borderRadius: \"16px 0px 0px 16px\",\n ...(state.activeJoggingDir === \"-\" ? pressedButtonStyle : {}),\n }}\n >\n <ChevronLeft\n sx={{\n pointerEvents: \"none\",\n color:\n theme.componentsExt?.JoggingPanel?.JoggingJoint?.Joint\n ?.arrowColor,\n }}\n />\n </IconButton>\n\n <Stack\n flexGrow={1}\n alignItems=\"center\"\n justifyContent=\"center\"\n sx={{\n borderStyle: \"solid\",\n borderLeftWidth: 0,\n borderRightWidth: 0,\n border: \"none\",\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n paddingLeft: \"20px\",\n paddingRight: \"20px\",\n zIndex: 1,\n }}\n >\n <Typography\n sx={{\n fontSize: \"15px\",\n fontWeight: 700,\n position: \"relative\",\n top: \"5px\",\n fontVariantNumeric: \"tabular-nums\",\n minWidth: \"80px\",\n textAlign: \"center\",\n\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.primary,\n }}\n >\n {useDegree ? formatDegrees(currentValue) : formatMm(currentValue)}\n </Typography>\n\n <Slider\n disabled\n aria-label=\"Joint position\"\n min={useDegree ? convertToDegree(lowerLimit) : lowerLimit}\n max={useDegree ? convertToDegree(upperLimit) : upperLimit}\n value={currentValue || 0}\n track={false}\n sx={{\n \"& .MuiSlider-mark\": {\n display: \"none\",\n },\n \"& .MuiSlider-thumb\": {\n width: \"5px\",\n height: \"12px\",\n borderRadius: \"2px\",\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.primary,\n },\n \"& .MuiSlider-markLabel\": {\n top: \"20px\",\n fontSize: \"12px\",\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.secondary,\n },\n \"& .MuiSlider-rail\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[5],\n opacity: 1,\n },\n }}\n marks={\n lowerLimit !== undefined &&\n upperLimit !== undefined && [\n {\n value: (useDegree\n ? convertToDegree(lowerLimit)\n : lowerLimit) as number,\n label: useDegree\n ? formatDegrees(convertToDegree(lowerLimit), 0)\n : formatMm(lowerLimit),\n },\n {\n value: (useDegree\n ? convertToDegree(upperLimit)\n : upperLimit) as number,\n label: useDegree\n ? formatDegrees(convertToDegree(upperLimit), 0)\n : formatMm(upperLimit),\n },\n ]\n }\n />\n </Stack>\n\n <IconButton\n onPointerDown={onPointerDownPlus}\n onPointerUp={onPointerUp}\n onPointerOut={onPointerOut}\n disabled={disabled}\n disableRipple\n sx={{\n borderRadius: \"0px 16px 16px 0px\",\n ...(state.activeJoggingDir === \"+\" ? pressedButtonStyle : {}),\n }}\n >\n <ChevronRight\n sx={{\n pointerEvents: \"none\",\n color:\n theme.componentsExt?.JoggingPanel?.JoggingJoint?.Joint\n ?.arrowColor,\n }}\n />\n </IconButton>\n </Stack>\n )\n },\n ),\n)\n\nexport default JoggingJointValueControl\n"],"names":["JoggingJointValueControl","externalizeComponent","observer","startJogging","stopJogging","lowerLimit","upperLimit","useDegree","getValue","disabled","rest","t","useTranslation","currentValue","setCurrentValue","useState","theme","useTheme","pressedButtonStyle","_a","_b","state","useLocalObservable","dir","updateValue","throttle","newValue","convertToDegree","useAnimationFrame","value","radiansToDegrees","onPointerDownMinus","ev","onPointerDownPlus","onPointerUp","onPointerOut","formatDegrees","precision","output","formatMm","jsxs","Stack","_c","_d","_e","jsx","IconButton","ChevronLeft","_i","_h","_g","_f","_j","Typography","Slider","_k","ChevronRight","_o","_n","_m","_l"],"mappings":"0nBA0BaA,EAA2BC,GAAAA,qBACtCC,EAAAA,SACE,CAAC,CACC,aAAAC,EACA,YAAAC,EACA,WAAAC,EACA,WAAAC,EACA,UAAAC,EACA,SAAAC,EAC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,EACJoB,EAAgBrB,CAAU,EAC1BA,EACJ,MAAOC,EACH6B,EAAcT,EAAgBrB,CAAU,EAAG,CAAC,EAC5CiC,EAASjC,CAAU,CAAA,CACzB,CACF,CAAA,CAEJ,CAAA,CAAA,EAGFuC,EAAAA,IAACC,EAAA,CACC,cAAeb,EACf,YAAAC,EACA,aAAAC,EACA,SAAA1B,EACA,cAAa,GACb,GAAI,CACF,aAAc,oBACd,GAAIY,EAAM,mBAAqB,IAAMH,EAAqB,CAAA,CAAC,EAG7D,SAAA2B,EAAAA,IAACW,EAAA,CACC,GAAI,CACF,cAAe,OACf,OACEC,GAAAC,GAAAC,GAAAC,EAAA5C,EAAM,gBAAN,YAAA4C,EAAqB,eAArB,YAAAD,EAAmC,eAAnC,YAAAD,EAAiD,QAAjD,YAAAD,EACI,UAAA,CACR,CAAA,CACF,CAAA,CACF,CAAA,CAAA,CAGN,CAAA,CAEJ"}
1
+ {"version":3,"file":"JoggingJointValueControl.cjs","sources":["../../../src/components/jogging/JoggingJointValueControl.tsx"],"sourcesContent":["import ChevronLeft from \"@mui/icons-material/ChevronLeft\"\nimport ChevronRight from \"@mui/icons-material/ChevronRight\"\nimport { useTheme } from \"@mui/material/styles\"\nimport IconButton from \"@mui/material/IconButton\"\nimport Slider from \"@mui/material/Slider\"\nimport Typography from \"@mui/material/Typography\"\nimport Stack from \"@mui/material/Stack\"\nimport { radiansToDegrees } from \"@wandelbots/nova-js\"\nimport throttle from \"lodash-es/throttle\"\nimport { observer, useLocalObservable } from \"mobx-react-lite\"\nimport { useState } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport { externalizeComponent } from \"../../externalizeComponent\"\nimport { useAnimationFrame } from \"../utils/hooks\"\n\ntype JoggingJointValueControlProps = {\n startJogging: (direction: \"-\" | \"+\") => void\n stopJogging: () => void\n lowerLimit?: number\n upperLimit?: number\n useDegree: boolean\n getValue: () => number | undefined\n disabled?: boolean\n} & React.ComponentProps<typeof Stack>\n\n/** A input widget to control an individual joint */\nexport const JoggingJointValueControl = externalizeComponent(\n observer(\n ({\n startJogging,\n stopJogging,\n lowerLimit,\n upperLimit,\n useDegree,\n getValue,\n disabled,\n ...rest\n }: JoggingJointValueControlProps) => {\n const { t } = useTranslation()\n const [currentValue, setCurrentValue] = useState<number | undefined>()\n const theme = useTheme()\n\n const pressedButtonStyle = {\n background: theme.palette.backgroundPaperElevation?.[4],\n color: theme.palette.backgroundPaperElevation?.[11],\n }\n\n const state = useLocalObservable(() => ({\n activeJoggingDir: null as \"-\" | \"+\" | null,\n\n startJogging(dir: \"-\" | \"+\") {\n this.activeJoggingDir = dir\n startJogging(dir)\n },\n\n stopJogging() {\n this.activeJoggingDir = null\n stopJogging()\n },\n }))\n\n const updateValue = throttle(() => {\n const newValue = useDegree ? convertToDegree(getValue()) : getValue()\n if (\n newValue === undefined ||\n currentValue === undefined ||\n Math.abs(currentValue - newValue) > 1e-9\n ) {\n setCurrentValue(newValue)\n }\n }, 50)\n\n useAnimationFrame(updateValue)\n\n function convertToDegree(value: number | undefined) {\n if (value === undefined) {\n return undefined\n }\n return radiansToDegrees(value)\n }\n\n function onPointerDownMinus(ev: React.PointerEvent) {\n // Stop right click from triggering jog\n if (ev.button === 0) state.startJogging(\"-\")\n }\n\n function onPointerDownPlus(ev: React.PointerEvent) {\n if (ev.button === 0) state.startJogging(\"+\")\n }\n\n function onPointerUp(ev: React.PointerEvent) {\n state.stopJogging()\n }\n\n function onPointerOut(ev: React.PointerEvent) {\n state.stopJogging()\n }\n\n function formatDegrees(value: number | undefined, precision = 1) {\n if (value === undefined || Number.isNaN(value)) return \"\"\n\n const output = t(\"General.degree.variable\", {\n amount: value.toFixed(precision),\n })\n\n if (value > 0 && precision === 0) {\n return `+${output}`\n } else {\n return output\n }\n }\n function formatMm(value: number | undefined, precision = 1) {\n if (value === undefined || Number.isNaN(value)) return \"\"\n\n const output = t(\"General.mm.variable\", {\n amount: value.toFixed(precision),\n })\n\n if (value > 0 && precision === 0) {\n return `+${output}`\n } else {\n return output\n }\n }\n\n return (\n <Stack\n height=\"64px\"\n width=\"100%\"\n maxWidth=\"260px\"\n direction=\"row\"\n {...rest}\n sx={{\n \"& .MuiIconButton-root\": {\n width: \"52px\",\n color: theme.palette.text.primary,\n alignContent: \"center\",\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n \"& svg\": {\n width: \"42px\",\n height: \"42px\",\n },\n\n \"&.Mui-disabled\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n color: theme.palette.action.disabled,\n opacity: 1,\n },\n \"&:hover\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[9],\n },\n \"&:active\": {\n ...pressedButtonStyle,\n },\n },\n }}\n >\n <IconButton\n onPointerDown={onPointerDownMinus}\n onPointerUp={onPointerUp}\n onPointerOut={onPointerOut}\n disabled={disabled}\n disableRipple\n sx={{\n borderRadius: \"16px 0px 0px 16px\",\n ...(state.activeJoggingDir === \"-\" ? pressedButtonStyle : {}),\n }}\n >\n <ChevronLeft\n sx={{\n pointerEvents: \"none\",\n color:\n theme.componentsExt?.JoggingPanel?.JoggingJoint?.Joint\n ?.arrowColor,\n }}\n />\n </IconButton>\n\n <Stack\n flexGrow={1}\n alignItems=\"center\"\n justifyContent=\"center\"\n sx={{\n borderStyle: \"solid\",\n borderLeftWidth: 0,\n borderRightWidth: 0,\n border: \"none\",\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n paddingLeft: \"20px\",\n paddingRight: \"20px\",\n zIndex: 1,\n }}\n >\n <Typography\n sx={{\n fontSize: \"15px\",\n fontWeight: 700,\n position: \"relative\",\n top: \"5px\",\n fontVariantNumeric: \"tabular-nums\",\n minWidth: \"80px\",\n textAlign: \"center\",\n\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.primary,\n }}\n >\n {useDegree ? formatDegrees(currentValue) : formatMm(currentValue)}\n </Typography>\n\n <Slider\n disabled\n aria-label=\"Joint position\"\n min={useDegree ? convertToDegree(lowerLimit) : lowerLimit}\n max={useDegree ? convertToDegree(upperLimit) : upperLimit}\n value={currentValue || 0}\n track={false}\n sx={{\n \"& .MuiSlider-mark\": {\n display: \"none\",\n },\n \"& .MuiSlider-thumb\": {\n width: \"5px\",\n height: \"12px\",\n borderRadius: \"2px\",\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.primary,\n },\n \"& .MuiSlider-markLabel\": {\n top: \"20px\",\n fontSize: \"12px\",\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.secondary,\n },\n \"& .MuiSlider-rail\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[5],\n opacity: 1,\n },\n }}\n marks={\n lowerLimit !== undefined &&\n upperLimit !== undefined && [\n {\n value: (useDegree\n ? convertToDegree(lowerLimit)\n : lowerLimit) as number,\n label: useDegree\n ? formatDegrees(convertToDegree(lowerLimit), 0)\n : formatMm(lowerLimit),\n },\n {\n value: (useDegree\n ? convertToDegree(upperLimit)\n : upperLimit) as number,\n label: useDegree\n ? formatDegrees(convertToDegree(upperLimit), 0)\n : formatMm(upperLimit),\n },\n ]\n }\n />\n </Stack>\n\n <IconButton\n onPointerDown={onPointerDownPlus}\n onPointerUp={onPointerUp}\n onPointerOut={onPointerOut}\n disabled={disabled}\n disableRipple\n sx={{\n borderRadius: \"0px 16px 16px 0px\",\n ...(state.activeJoggingDir === \"+\" ? pressedButtonStyle : {}),\n }}\n >\n <ChevronRight\n sx={{\n pointerEvents: \"none\",\n color:\n theme.componentsExt?.JoggingPanel?.JoggingJoint?.Joint\n ?.arrowColor,\n }}\n />\n </IconButton>\n </Stack>\n )\n },\n ),\n)\n\nexport default JoggingJointValueControl\n"],"names":["JoggingJointValueControl","externalizeComponent","observer","startJogging","stopJogging","lowerLimit","upperLimit","useDegree","getValue","disabled","rest","t","useTranslation","currentValue","setCurrentValue","useState","theme","useTheme","pressedButtonStyle","_a","_b","state","useLocalObservable","dir","updateValue","throttle","newValue","convertToDegree","useAnimationFrame","value","radiansToDegrees","onPointerDownMinus","ev","onPointerDownPlus","onPointerUp","onPointerOut","formatDegrees","precision","output","formatMm","jsxs","Stack","_c","_d","_e","jsx","IconButton","ChevronLeft","_i","_h","_g","_f","_j","Typography","Slider","_k","ChevronRight","_o","_n","_m","_l"],"mappings":"unBA0BaA,EAA2BC,GAAAA,qBACtCC,EAAAA,SACE,CAAC,CACC,aAAAC,EACA,YAAAC,EACA,WAAAC,EACA,WAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,GAAGC,CAAA,IACgC,mCACnC,KAAM,CAAE,EAAAC,CAAA,EAAMC,iBAAA,EACR,CAACC,EAAcC,CAAe,EAAIC,WAAA,EAClCC,EAAQC,EAAAA,SAAA,EAERC,EAAqB,CACzB,YAAYC,EAAAH,EAAM,QAAQ,2BAAd,YAAAG,EAAyC,GACrD,OAAOC,EAAAJ,EAAM,QAAQ,2BAAd,YAAAI,EAAyC,GAAE,EAG9CC,EAAQC,EAAAA,mBAAmB,KAAO,CACtC,iBAAkB,KAElB,aAAaC,EAAgB,CAC3B,KAAK,iBAAmBA,EACxBpB,EAAaoB,CAAG,CAClB,EAEA,aAAc,CACZ,KAAK,iBAAmB,KACxBnB,EAAA,CACF,CAAA,EACA,EAEIoB,EAAcC,EAAS,IAAM,CACjC,MAAMC,EAAWnB,EAAYoB,EAAgBnB,EAAA,CAAU,EAAIA,EAAA,GAEzDkB,IAAa,QACbb,IAAiB,QACjB,KAAK,IAAIA,EAAea,CAAQ,EAAI,OAEpCZ,EAAgBY,CAAQ,CAE5B,EAAG,EAAE,EAELE,GAAAA,kBAAkBJ,CAAW,EAE7B,SAASG,EAAgBE,EAA2B,CAClD,GAAIA,IAAU,OAGd,OAAOC,EAAAA,iBAAiBD,CAAK,CAC/B,CAEA,SAASE,EAAmBC,EAAwB,CAE9CA,EAAG,SAAW,GAAGX,EAAM,aAAa,GAAG,CAC7C,CAEA,SAASY,EAAkBD,EAAwB,CAC7CA,EAAG,SAAW,GAAGX,EAAM,aAAa,GAAG,CAC7C,CA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AqB,CACnB,iBAAiBuC,EAAAvC,EAAM,QAAQ,2BAAd,YAAAuC,EAAyC,GAC1D,QAAS,CAAA,CACX,EAEF,MACElD,IAAe,QACfC,IAAe,QAAa,CAC1B,CACE,MAAQC,EACJoB,EAAgBtB,CAAU,EAC1BA,EACJ,MAAOE,EACH6B,EAAcT,EAAgBtB,CAAU,EAAG,CAAC,EAC5CkC,EAASlC,CAAU,CAAA,EAEzB,CACE,MAAQE,EACJoB,EAAgBrB,CAAU,EAC1BA,EACJ,MAAOC,EACH6B,EAAcT,EAAgBrB,CAAU,EAAG,CAAC,EAC5CiC,EAASjC,CAAU,CAAA,CACzB,CACF,CAAA,CAEJ,CAAA,CAAA,EAGFuC,EAAAA,IAACC,EAAA,CACC,cAAeb,EACf,YAAAC,EACA,aAAAC,EACA,SAAA1B,EACA,cAAa,GACb,GAAI,CACF,aAAc,oBACd,GAAIY,EAAM,mBAAqB,IAAMH,EAAqB,CAAA,CAAC,EAG7D,SAAA2B,EAAAA,IAACW,EAAA,CACC,GAAI,CACF,cAAe,OACf,OACEC,GAAAC,GAAAC,GAAAC,EAAA5C,EAAM,gBAAN,YAAA4C,EAAqB,eAArB,YAAAD,EAAmC,eAAnC,YAAAD,EAAiD,QAAjD,YAAAD,EACI,UAAA,CACR,CAAA,CACF,CAAA,CACF,CAAA,CAAA,CAGN,CAAA,CAEJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"JoggingJointValueControl.d.ts","sourceRoot":"","sources":["../../../src/components/jogging/JoggingJointValueControl.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,qBAAqB,CAAA;AAWvC,KAAK,6BAA6B,GAAG;IACnC,YAAY,EAAE,CAAC,SAAS,EAAE,GAAG,GAAG,GAAG,KAAK,IAAI,CAAA;IAC5C,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,CAAA;AAEtC,oDAAoD;AACpD,eAAO,MAAM,wBAAwB,mGAW9B,6BAA6B;;CA6PnC,CAAA;AAED,eAAe,wBAAwB,CAAA"}
1
+ {"version":3,"file":"JoggingJointValueControl.d.ts","sourceRoot":"","sources":["../../../src/components/jogging/JoggingJointValueControl.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,qBAAqB,CAAA;AASvC,KAAK,6BAA6B,GAAG;IACnC,YAAY,EAAE,CAAC,SAAS,EAAE,GAAG,GAAG,GAAG,KAAK,IAAI,CAAA;IAC5C,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,CAAA;AAEtC,oDAAoD;AACpD,eAAO,MAAM,wBAAwB,mGAW9B,6BAA6B;;CA6PnC,CAAA;AAED,eAAe,wBAAwB,CAAA"}
@@ -1,13 +1,13 @@
1
1
  import { jsxs as W, jsx as l } from "react/jsx-runtime";
2
2
  import U from "@mui/icons-material/ChevronLeft";
3
3
  import q from "@mui/icons-material/ChevronRight";
4
+ import { useTheme as H } from "@mui/material/styles";
4
5
  import z from "@mui/material/IconButton";
5
- import H from "@mui/material/Slider";
6
- import I from "@mui/material/Stack";
7
- import { useTheme as K } from "@mui/material/styles";
6
+ import K from "@mui/material/Slider";
8
7
  import Q from "@mui/material/Typography";
8
+ import I from "@mui/material/Stack";
9
9
  import { radiansToDegrees as X } from "@wandelbots/nova-js";
10
- import Y from "lodash-es/throttle.js";
10
+ import Y from "lodash-es/throttle";
11
11
  import { observer as Z, useLocalObservable as _ } from "mobx-react-lite";
12
12
  import { useState as L } from "react";
13
13
  import { useTranslation as oo } from "react-i18next";
@@ -26,7 +26,7 @@ const vo = to(
26
26
  ...F
27
27
  }) => {
28
28
  var v, J, k, P, C, y, E, S, M, R, w, N, D, T, V;
29
- const { t: f } = oo(), [g, G] = L(), t = K(), s = {
29
+ const { t: f } = oo(), [g, G] = L(), t = H(), s = {
30
30
  background: (v = t.palette.backgroundPaperElevation) == null ? void 0 : v[4],
31
31
  color: (J = t.palette.backgroundPaperElevation) == null ? void 0 : J[11]
32
32
  }, a = _(() => ({
@@ -161,7 +161,7 @@ const vo = to(
161
161
  }
162
162
  ),
163
163
  /* @__PURE__ */ l(
164
- H,
164
+ K,
165
165
  {
166
166
  disabled: !0,
167
167
  "aria-label": "Joint position",
@@ -1 +1 @@
1
- {"version":3,"file":"JoggingJointValueControl.js","sources":["../../../src/components/jogging/JoggingJointValueControl.tsx"],"sourcesContent":["import ChevronLeft from \"@mui/icons-material/ChevronLeft\"\nimport ChevronRight from \"@mui/icons-material/ChevronRight\"\nimport IconButton from \"@mui/material/IconButton\"\nimport Slider from \"@mui/material/Slider\"\nimport Stack from \"@mui/material/Stack\"\nimport { useTheme } from \"@mui/material/styles\"\nimport Typography from \"@mui/material/Typography\"\nimport { radiansToDegrees } from \"@wandelbots/nova-js\"\nimport throttle from \"lodash-es/throttle.js\"\nimport { observer, useLocalObservable } from \"mobx-react-lite\"\nimport { useState } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport { externalizeComponent } from \"../../externalizeComponent\"\nimport { useAnimationFrame } from \"../utils/hooks\"\n\ntype JoggingJointValueControlProps = {\n startJogging: (direction: \"-\" | \"+\") => void\n stopJogging: () => void\n lowerLimit?: number\n upperLimit?: number\n useDegree: boolean\n getValue: () => number | undefined\n disabled?: boolean\n} & React.ComponentProps<typeof Stack>\n\n/** A input widget to control an individual joint */\nexport const JoggingJointValueControl = externalizeComponent(\n observer(\n ({\n startJogging,\n stopJogging,\n lowerLimit,\n upperLimit,\n useDegree,\n getValue,\n disabled,\n ...rest\n }: JoggingJointValueControlProps) => {\n const { t } = useTranslation()\n const [currentValue, setCurrentValue] = useState<number | undefined>()\n const theme = useTheme()\n\n const pressedButtonStyle = {\n background: theme.palette.backgroundPaperElevation?.[4],\n color: theme.palette.backgroundPaperElevation?.[11],\n }\n\n const state = useLocalObservable(() => ({\n activeJoggingDir: null as \"-\" | \"+\" | null,\n\n startJogging(dir: \"-\" | \"+\") {\n this.activeJoggingDir = dir\n startJogging(dir)\n },\n\n stopJogging() {\n this.activeJoggingDir = null\n stopJogging()\n },\n }))\n\n const updateValue = throttle(() => {\n const newValue = useDegree ? convertToDegree(getValue()) : getValue()\n if (\n newValue === undefined ||\n currentValue === undefined ||\n Math.abs(currentValue - newValue) > 1e-9\n ) {\n setCurrentValue(newValue)\n }\n }, 50)\n\n useAnimationFrame(updateValue)\n\n function convertToDegree(value: number | undefined) {\n if (value === undefined) {\n return undefined\n }\n return radiansToDegrees(value)\n }\n\n function onPointerDownMinus(ev: React.PointerEvent) {\n // Stop right click from triggering jog\n if (ev.button === 0) state.startJogging(\"-\")\n }\n\n function onPointerDownPlus(ev: React.PointerEvent) {\n if (ev.button === 0) state.startJogging(\"+\")\n }\n\n function onPointerUp(ev: React.PointerEvent) {\n state.stopJogging()\n }\n\n function onPointerOut(ev: React.PointerEvent) {\n state.stopJogging()\n }\n\n function formatDegrees(value: number | undefined, precision = 1) {\n if (value === undefined || Number.isNaN(value)) return \"\"\n\n const output = t(\"General.degree.variable\", {\n amount: value.toFixed(precision),\n })\n\n if (value > 0 && precision === 0) {\n return `+${output}`\n } else {\n return output\n }\n }\n function formatMm(value: number | undefined, precision = 1) {\n if (value === undefined || Number.isNaN(value)) return \"\"\n\n const output = t(\"General.mm.variable\", {\n amount: value.toFixed(precision),\n })\n\n if (value > 0 && precision === 0) {\n return `+${output}`\n } else {\n return output\n }\n }\n\n return (\n <Stack\n height=\"64px\"\n width=\"100%\"\n maxWidth=\"260px\"\n direction=\"row\"\n {...rest}\n sx={{\n \"& .MuiIconButton-root\": {\n width: \"52px\",\n color: theme.palette.text.primary,\n alignContent: \"center\",\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n \"& svg\": {\n width: \"42px\",\n height: \"42px\",\n },\n\n \"&.Mui-disabled\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n color: theme.palette.action.disabled,\n opacity: 1,\n },\n \"&:hover\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[9],\n },\n \"&:active\": {\n ...pressedButtonStyle,\n },\n },\n }}\n >\n <IconButton\n onPointerDown={onPointerDownMinus}\n onPointerUp={onPointerUp}\n onPointerOut={onPointerOut}\n disabled={disabled}\n disableRipple\n sx={{\n borderRadius: \"16px 0px 0px 16px\",\n ...(state.activeJoggingDir === \"-\" ? pressedButtonStyle : {}),\n }}\n >\n <ChevronLeft\n sx={{\n pointerEvents: \"none\",\n color:\n theme.componentsExt?.JoggingPanel?.JoggingJoint?.Joint\n ?.arrowColor,\n }}\n />\n </IconButton>\n\n <Stack\n flexGrow={1}\n alignItems=\"center\"\n justifyContent=\"center\"\n sx={{\n borderStyle: \"solid\",\n borderLeftWidth: 0,\n borderRightWidth: 0,\n border: \"none\",\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n paddingLeft: \"20px\",\n paddingRight: \"20px\",\n zIndex: 1,\n }}\n >\n <Typography\n sx={{\n fontSize: \"15px\",\n fontWeight: 700,\n position: \"relative\",\n top: \"5px\",\n fontVariantNumeric: \"tabular-nums\",\n minWidth: \"80px\",\n textAlign: \"center\",\n\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.primary,\n }}\n >\n {useDegree ? formatDegrees(currentValue) : formatMm(currentValue)}\n </Typography>\n\n <Slider\n disabled\n aria-label=\"Joint position\"\n min={useDegree ? convertToDegree(lowerLimit) : lowerLimit}\n max={useDegree ? convertToDegree(upperLimit) : upperLimit}\n value={currentValue || 0}\n track={false}\n sx={{\n \"& .MuiSlider-mark\": {\n display: \"none\",\n },\n \"& .MuiSlider-thumb\": {\n width: \"5px\",\n height: \"12px\",\n borderRadius: \"2px\",\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.primary,\n },\n \"& .MuiSlider-markLabel\": {\n top: \"20px\",\n fontSize: \"12px\",\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.secondary,\n },\n \"& .MuiSlider-rail\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[5],\n opacity: 1,\n },\n }}\n marks={\n lowerLimit !== undefined &&\n upperLimit !== undefined && [\n {\n value: (useDegree\n ? convertToDegree(lowerLimit)\n : lowerLimit) as number,\n label: useDegree\n ? formatDegrees(convertToDegree(lowerLimit), 0)\n : formatMm(lowerLimit),\n },\n {\n value: (useDegree\n ? convertToDegree(upperLimit)\n : upperLimit) as number,\n label: useDegree\n ? formatDegrees(convertToDegree(upperLimit), 0)\n : formatMm(upperLimit),\n },\n ]\n }\n />\n </Stack>\n\n <IconButton\n onPointerDown={onPointerDownPlus}\n onPointerUp={onPointerUp}\n onPointerOut={onPointerOut}\n disabled={disabled}\n disableRipple\n sx={{\n borderRadius: \"0px 16px 16px 0px\",\n ...(state.activeJoggingDir === \"+\" ? pressedButtonStyle : {}),\n }}\n >\n <ChevronRight\n sx={{\n pointerEvents: \"none\",\n color:\n theme.componentsExt?.JoggingPanel?.JoggingJoint?.Joint\n ?.arrowColor,\n }}\n />\n </IconButton>\n </Stack>\n )\n },\n ),\n)\n\nexport default JoggingJointValueControl\n"],"names":["JoggingJointValueControl","externalizeComponent","observer","startJogging","stopJogging","lowerLimit","upperLimit","useDegree","getValue","disabled","rest","t","useTranslation","currentValue","setCurrentValue","useState","theme","useTheme","pressedButtonStyle","_a","_b","state","useLocalObservable","dir","updateValue","throttle","newValue","convertToDegree","useAnimationFrame","value","radiansToDegrees","onPointerDownMinus","ev","onPointerDownPlus","onPointerUp","onPointerOut","formatDegrees","precision","output","formatMm","jsxs","Stack","_c","_d","_e","jsx","IconButton","ChevronLeft","_i","_h","_g","_f","_j","Typography","Slider","_k","ChevronRight","_o","_n","_m","_l"],"mappings":";;;;;;;;;;;;;;;AA0BO,MAAMA,KAA2BC;AAAA,EACtCC;AAAA,IACE,CAAC;AAAA,MACC,cAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,WAAAC;AAAA,MACA,UAAAC;AAAA,MACA,UAAAC;AAAA,MACA,GAAGC;AAAA,IAAA,MACgC;;AACnC,YAAM,EAAE,GAAAC,EAAA,IAAMC,GAAA,GACR,CAACC,GAAcC,CAAe,IAAIC,EAAA,GAClCC,IAAQC,EAAA,GAERC,IAAqB;AAAA,QACzB,aAAYC,IAAAH,EAAM,QAAQ,6BAAd,gBAAAG,EAAyC;AAAA,QACrD,QAAOC,IAAAJ,EAAM,QAAQ,6BAAd,gBAAAI,EAAyC;AAAA,MAAE,GAG9CC,IAAQC,EAAmB,OAAO;AAAA,QACtC,kBAAkB;AAAA,QAElB,aAAaC,GAAgB;AAC3B,eAAK,mBAAmBA,GACxBpB,EAAaoB,CAAG;AAAA,QAClB;AAAA,QAEA,cAAc;AACZ,eAAK,mBAAmB,MACxBnB,EAAA;AAAA,QACF;AAAA,MAAA,EACA,GAEIoB,IAAcC,EAAS,MAAM;AACjC,cAAMC,IAAWnB,IAAYoB,EAAgBnB,EAAA,CAAU,IAAIA,EAAA;AAC3D,SACEkB,MAAa,UACbb,MAAiB,UACjB,KAAK,IAAIA,IAAea,CAAQ,IAAI,SAEpCZ,EAAgBY,CAAQ;AAAA,MAE5B,GAAG,EAAE;AAEL,MAAAE,GAAkBJ,CAAW;AAE7B,eAASG,EAAgBE,GAA2B;AAClD,YAAIA,MAAU;AAGd,iBAAOC,EAAiBD,CAAK;AAAA,MAC/B;AAEA,eAASE,EAAmBC,GAAwB;AAEl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ACJ,OAAOE,IACH6B,EAAcT,EAAgBtB,CAAU,GAAG,CAAC,IAC5CkC,EAASlC,CAAU;AAAA,wBAAA;AAAA,wBAEzB;AAAA,0BACE,OAAQE,IACJoB,EAAgBrB,CAAU,IAC1BA;AAAA,0BACJ,OAAOC,IACH6B,EAAcT,EAAgBrB,CAAU,GAAG,CAAC,IAC5CiC,EAASjC,CAAU;AAAA,wBAAA;AAAA,sBACzB;AAAA,oBACF;AAAA,kBAAA;AAAA,gBAEJ;AAAA,cAAA;AAAA,YAAA;AAAA,YAGF,gBAAAuC;AAAA,cAACC;AAAA,cAAA;AAAA,gBACC,eAAeb;AAAA,gBACf,aAAAC;AAAA,gBACA,cAAAC;AAAA,gBACA,UAAA1B;AAAA,gBACA,eAAa;AAAA,gBACb,IAAI;AAAA,kBACF,cAAc;AAAA,kBACd,GAAIY,EAAM,qBAAqB,MAAMH,IAAqB,CAAA;AAAA,gBAAC;AAAA,gBAG7D,UAAA,gBAAA2B;AAAA,kBAACW;AAAA,kBAAA;AAAA,oBACC,IAAI;AAAA,sBACF,eAAe;AAAA,sBACf,QACEC,KAAAC,KAAAC,KAAAC,IAAA5C,EAAM,kBAAN,gBAAA4C,EAAqB,iBAArB,gBAAAD,EAAmC,iBAAnC,gBAAAD,EAAiD,UAAjD,gBAAAD,EACI;AAAA,oBAAA;AAAA,kBACR;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"JoggingJointValueControl.js","sources":["../../../src/components/jogging/JoggingJointValueControl.tsx"],"sourcesContent":["import ChevronLeft from \"@mui/icons-material/ChevronLeft\"\nimport ChevronRight from \"@mui/icons-material/ChevronRight\"\nimport { useTheme } from \"@mui/material/styles\"\nimport IconButton from \"@mui/material/IconButton\"\nimport Slider from \"@mui/material/Slider\"\nimport Typography from \"@mui/material/Typography\"\nimport Stack from \"@mui/material/Stack\"\nimport { radiansToDegrees } from \"@wandelbots/nova-js\"\nimport throttle from \"lodash-es/throttle\"\nimport { observer, useLocalObservable } from \"mobx-react-lite\"\nimport { useState } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport { externalizeComponent } from \"../../externalizeComponent\"\nimport { useAnimationFrame } from \"../utils/hooks\"\n\ntype JoggingJointValueControlProps = {\n startJogging: (direction: \"-\" | \"+\") => void\n stopJogging: () => void\n lowerLimit?: number\n upperLimit?: number\n useDegree: boolean\n getValue: () => number | undefined\n disabled?: boolean\n} & React.ComponentProps<typeof Stack>\n\n/** A input widget to control an individual joint */\nexport const JoggingJointValueControl = externalizeComponent(\n observer(\n ({\n startJogging,\n stopJogging,\n lowerLimit,\n upperLimit,\n useDegree,\n getValue,\n disabled,\n ...rest\n }: JoggingJointValueControlProps) => {\n const { t } = useTranslation()\n const [currentValue, setCurrentValue] = useState<number | undefined>()\n const theme = useTheme()\n\n const pressedButtonStyle = {\n background: theme.palette.backgroundPaperElevation?.[4],\n color: theme.palette.backgroundPaperElevation?.[11],\n }\n\n const state = useLocalObservable(() => ({\n activeJoggingDir: null as \"-\" | \"+\" | null,\n\n startJogging(dir: \"-\" | \"+\") {\n this.activeJoggingDir = dir\n startJogging(dir)\n },\n\n stopJogging() {\n this.activeJoggingDir = null\n stopJogging()\n },\n }))\n\n const updateValue = throttle(() => {\n const newValue = useDegree ? convertToDegree(getValue()) : getValue()\n if (\n newValue === undefined ||\n currentValue === undefined ||\n Math.abs(currentValue - newValue) > 1e-9\n ) {\n setCurrentValue(newValue)\n }\n }, 50)\n\n useAnimationFrame(updateValue)\n\n function convertToDegree(value: number | undefined) {\n if (value === undefined) {\n return undefined\n }\n return radiansToDegrees(value)\n }\n\n function onPointerDownMinus(ev: React.PointerEvent) {\n // Stop right click from triggering jog\n if (ev.button === 0) state.startJogging(\"-\")\n }\n\n function onPointerDownPlus(ev: React.PointerEvent) {\n if (ev.button === 0) state.startJogging(\"+\")\n }\n\n function onPointerUp(ev: React.PointerEvent) {\n state.stopJogging()\n }\n\n function onPointerOut(ev: React.PointerEvent) {\n state.stopJogging()\n }\n\n function formatDegrees(value: number | undefined, precision = 1) {\n if (value === undefined || Number.isNaN(value)) return \"\"\n\n const output = t(\"General.degree.variable\", {\n amount: value.toFixed(precision),\n })\n\n if (value > 0 && precision === 0) {\n return `+${output}`\n } else {\n return output\n }\n }\n function formatMm(value: number | undefined, precision = 1) {\n if (value === undefined || Number.isNaN(value)) return \"\"\n\n const output = t(\"General.mm.variable\", {\n amount: value.toFixed(precision),\n })\n\n if (value > 0 && precision === 0) {\n return `+${output}`\n } else {\n return output\n }\n }\n\n return (\n <Stack\n height=\"64px\"\n width=\"100%\"\n maxWidth=\"260px\"\n direction=\"row\"\n {...rest}\n sx={{\n \"& .MuiIconButton-root\": {\n width: \"52px\",\n color: theme.palette.text.primary,\n alignContent: \"center\",\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n \"& svg\": {\n width: \"42px\",\n height: \"42px\",\n },\n\n \"&.Mui-disabled\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n color: theme.palette.action.disabled,\n opacity: 1,\n },\n \"&:hover\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[9],\n },\n \"&:active\": {\n ...pressedButtonStyle,\n },\n },\n }}\n >\n <IconButton\n onPointerDown={onPointerDownMinus}\n onPointerUp={onPointerUp}\n onPointerOut={onPointerOut}\n disabled={disabled}\n disableRipple\n sx={{\n borderRadius: \"16px 0px 0px 16px\",\n ...(state.activeJoggingDir === \"-\" ? pressedButtonStyle : {}),\n }}\n >\n <ChevronLeft\n sx={{\n pointerEvents: \"none\",\n color:\n theme.componentsExt?.JoggingPanel?.JoggingJoint?.Joint\n ?.arrowColor,\n }}\n />\n </IconButton>\n\n <Stack\n flexGrow={1}\n alignItems=\"center\"\n justifyContent=\"center\"\n sx={{\n borderStyle: \"solid\",\n borderLeftWidth: 0,\n borderRightWidth: 0,\n border: \"none\",\n backgroundColor: theme.palette.backgroundPaperElevation?.[11],\n paddingLeft: \"20px\",\n paddingRight: \"20px\",\n zIndex: 1,\n }}\n >\n <Typography\n sx={{\n fontSize: \"15px\",\n fontWeight: 700,\n position: \"relative\",\n top: \"5px\",\n fontVariantNumeric: \"tabular-nums\",\n minWidth: \"80px\",\n textAlign: \"center\",\n\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.primary,\n }}\n >\n {useDegree ? formatDegrees(currentValue) : formatMm(currentValue)}\n </Typography>\n\n <Slider\n disabled\n aria-label=\"Joint position\"\n min={useDegree ? convertToDegree(lowerLimit) : lowerLimit}\n max={useDegree ? convertToDegree(upperLimit) : upperLimit}\n value={currentValue || 0}\n track={false}\n sx={{\n \"& .MuiSlider-mark\": {\n display: \"none\",\n },\n \"& .MuiSlider-thumb\": {\n width: \"5px\",\n height: \"12px\",\n borderRadius: \"2px\",\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.primary,\n },\n \"& .MuiSlider-markLabel\": {\n top: \"20px\",\n fontSize: \"12px\",\n color: disabled\n ? theme.palette.action.disabled\n : theme.palette.text.secondary,\n },\n \"& .MuiSlider-rail\": {\n backgroundColor: theme.palette.backgroundPaperElevation?.[5],\n opacity: 1,\n },\n }}\n marks={\n lowerLimit !== undefined &&\n upperLimit !== undefined && [\n {\n value: (useDegree\n ? convertToDegree(lowerLimit)\n : lowerLimit) as number,\n label: useDegree\n ? formatDegrees(convertToDegree(lowerLimit), 0)\n : formatMm(lowerLimit),\n },\n {\n value: (useDegree\n ? convertToDegree(upperLimit)\n : upperLimit) as number,\n label: useDegree\n ? formatDegrees(convertToDegree(upperLimit), 0)\n : formatMm(upperLimit),\n },\n ]\n }\n />\n </Stack>\n\n <IconButton\n onPointerDown={onPointerDownPlus}\n onPointerUp={onPointerUp}\n onPointerOut={onPointerOut}\n disabled={disabled}\n disableRipple\n sx={{\n borderRadius: \"0px 16px 16px 0px\",\n ...(state.activeJoggingDir === \"+\" ? pressedButtonStyle : {}),\n }}\n >\n <ChevronRight\n sx={{\n pointerEvents: \"none\",\n color:\n theme.componentsExt?.JoggingPanel?.JoggingJoint?.Joint\n ?.arrowColor,\n }}\n />\n </IconButton>\n </Stack>\n )\n },\n ),\n)\n\nexport default JoggingJointValueControl\n"],"names":["JoggingJointValueControl","externalizeComponent","observer","startJogging","stopJogging","lowerLimit","upperLimit","useDegree","getValue","disabled","rest","t","useTranslation","currentValue","setCurrentValue","useState","theme","useTheme","pressedButtonStyle","_a","_b","state","useLocalObservable","dir","updateValue","throttle","newValue","convertToDegree","useAnimationFrame","value","radiansToDegrees","onPointerDownMinus","ev","onPointerDownPlus","onPointerUp","onPointerOut","formatDegrees","precision","output","formatMm","jsxs","Stack","_c","_d","_e","jsx","IconButton","ChevronLeft","_i","_h","_g","_f","_j","Typography","Slider","_k","ChevronRight","_o","_n","_m","_l"],"mappings":";;;;;;;;;;;;;;;AA0BO,MAAMA,KAA2BC;AAAA,EACtCC;AAAA,IACE,CAAC;AAAA,MACC,cAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,WAAAC;AAAA,MACA,UAAAC;AAAA,MACA,UAAAC;AAAA,MACA,GAAGC;AAAA,IAAA,MACgC;;AACnC,YAAM,EAAE,GAAAC,EAAA,IAAMC,GAAA,GACR,CAACC,GAAcC,CAAe,IAAIC,EAAA,GAClCC,IAAQC,EAAA,GAERC,IAAqB;AAAA,QACzB,aAAYC,IAAAH,EAAM,QAAQ,6BAAd,gBAAAG,EAAyC;AAAA,QACrD,QAAOC,IAAAJ,EAAM,QAAQ,6BAAd,gBAAAI,EAAyC;AAAA,MAAE,GAG9CC,IAAQC,EAAmB,OAAO;AAAA,QACtC,kBAAkB;AAAA,QAElB,aAAaC,GAAgB;AAC3B,eAAK,mBAAmBA,GACxBpB,EAAaoB,CAAG;AAAA,QAClB;AAAA,QAEA,cAAc;AACZ,eAAK,mBAAmB,MACxBnB,EAAA;AAAA,QACF;AAAA,MAAA,EACA,GAEI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AAA;AAAA,UACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN;AAAA,EAAA;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("@wandelbots/nova-js"),m=require("@wandelbots/nova-js/v2"),u=require("lodash-es"),d=require("lodash-es/keyBy.js"),S=require("lodash-es/uniqueId.js"),y=require("mobx"),l=[{id:"0.1",mm:.1,degrees:.05},{id:"1",mm:1,degrees:.5},{id:"5",mm:5,degrees:2.5},{id:"10",mm:10,degrees:5}],p=[{id:"continuous"},...l],T=["coordsys","tool"];class a{constructor(e,t,s,i,n){var r,c,o,h;this.jogger=e,this.coordSystems=t,this.motionGroupDescription=s,this.tcps=i,this.inverseSolverValue=n,this.selectedTabId="cartesian",this.locks=new Set,this.blocked=!1,this.selectedCoordSystemId="world",this.selectedTcpId="",this.selectedOrientation="coordsys",this.selectedIncrementId="continuous",this.selectedCartesianMotionType="translate",this.incrementJogInProgress=null,this.translationVelocityMmPerSec=10,this.rotationVelocityDegPerSec=1,this.minTranslationVelocityMmPerSec=5,this.maxTranslationVelocityMmPerSec=250,this.minRotationVelocityDegPerSec=1,this.maxRotationVelocityDegPerSec=60,this.showCoordSystemSelect=!1,this.showTcpSelect=!0,this.showOrientationSelect=!0,this.showIncrementSelect=!0,this.showTabIcons=!1,this.showVelocitySliderLabel=!0,this.showVelocityLegend=!1,this.showJointsLegend=!1,this.disposers=[],this.inverseSolver=void 0,this.jointType=m.JointTypeEnum.RevoluteJoint;for(const g of t)if(g.coordinate_system===""){g.coordinate_system="world";break}this.selectedCoordSystemId=((r=t[0])==null?void 0:r.coordinate_system)||"world",this.selectedTcpId=((c=i[0])==null?void 0:c.id)||"",this.inverseSolver=n,this.jointType=((h=(o=s==null?void 0:s.dh_parameters)==null?void 0:o[0])==null?void 0:h.type)??m.JointTypeEnum.RevoluteJoint,y.makeAutoObservable(this,{},{autoBind:!0}),this.jogger.onBlocked=()=>{this.block()},this.loadFromLocalStorage(),this.disposers.push(y.autorun(()=>this.saveToLocalStorage())),window.joggingStore=this}static async loadFor(e){const{nova:t}=e,[s,i]=await Promise.all([t.api.controller.listCoordinateSystems(e.motionStream.controllerId,"ROTATION_VECTOR"),t.api.motionGroup.getMotionGroupDescription(e.motionStream.controllerId,e.motionGroupId)]),n=await t.api.motionGroupModels.getMotionGroupKinematicModel(i.motion_group_model),r=Object.entries(i.tcps||{}).map(([c,o])=>({id:c,readable_name:o.name,position:o.pose.position,orientation:o.pose.orientation}));return new a(e,s||[],i,r,n.inverse_solver)}dispose(){for(const e of this.disposers)e();this.jogger.dispose()}get coordSystemCountByName(){return u.countBy(this.coordSystems,e=>e.name)}async deactivate(){if(this.jogger.mode==="jogging")return this.jogger.stop()}async activate(){return this.currentTab.id==="cartesian"?((this.jogger.tcp!==this.selectedTcpId||this.jogger.orientation!==this.selectedOrientation)&&this.jogger.setOptions({tcp:this.selectedTcpId,orientation:this.selectedOrientation}),this.activeDiscreteIncrement?this.jogger.setJoggingMode("trajectory"):this.jogger.setJoggingMode("jogging")):this.jogger.setJoggingMode("jogging"),this.jogger}loadFromLocalStorage(){const e=I.tryParseJson(localStorage.getItem("joggingToolStore"));e&&(this.tabsById[e.selectedTabId]&&(this.selectedTabId=e.selectedTabId),this.coordSystemsById[e.selectedCoordSystemId]&&(this.selectedCoordSystemId=e.selectedCoordSystemId),this.tcpsById[e.selectedTcpId]&&(this.selectedTcpId=e.selectedTcpId),this.incrementOptionsById[e.selectedIncrementId]&&(this.selectedIncrementId=e.selectedIncrementId),["translate","rotate"].includes(e.selectedCartesianMotionType)&&(this.selectedCartesianMotionType=e.selectedCartesianMotionType),["coordsys","tool"].includes(e.selectedOrientation)&&(this.selectedOrientation=e.selectedOrientation))}saveToLocalStorage(){localStorage.setItem("joggingToolStore",JSON.stringify(this.localStorageSave))}get isLocked(){return this.locks.size>0}get localStorageSave(){return{selectedTabId:this.selectedTabId,selectedCoordSystemId:this.selectedCoordSystemId,selectedTcpId:this.selectedTcpId,selectedOrientation:this.selectedOrientation,selectedIncrementId:this.selectedIncrementId,selectedCartesianMotionType:this.selectedCartesianMotionType}}get tabs(){const e=[{id:"joint",label:"Joints"}];return this.inverseSolver!==null&&e.unshift({id:"cartesian",label:"Cartesian"}),e}get incrementOptions(){return p}get discreteIncrementOptions(){return l}get incrementOptionsById(){return d(this.incrementOptions,e=>e.id)}get tabsById(){return d(this.tabs,e=>e.id)}get currentTab(){return this.tabsById[this.selectedTabId]||this.tabs[0]}get tabIndex(){return this.tabs.indexOf(this.currentTab)}get coordSystemsById(){return d(this.coordSystems,e=>e.coordinate_system)}get activeCoordSystemId(){return this.selectedOrientation==="tool"?"tool":this.selectedCoordSystemId}get tcpsById(){return d(this.tcps,e=>e.id)}get activeDiscreteIncrement(){return this.selectedOrientation==="tool"?void 0:l.find(e=>e.id===this.selectedIncrementId)}get rotationVelocityRadsPerSec(){return this.rotationVelocityDegPerSec*Math.PI/180}velocityInDisplayUnits(e){return e?this.rotationVelocityDegPerSec:this.translationVelocityMmPerSec}minVelocityInDisplayUnits(e){return e?this.minRotationVelocityDegPerSec:this.minTranslationVelocityMmPerSec}maxVelocityInDisplayUnits(e){return e?this.maxRotationVelocityDegPerSec:this.maxTranslationVelocityMmPerSec}onTabChange(e,t){const s=this.tabs[t]||this.tabs[0];this.selectedTabId=s.id}setSelectedCoordSystemId(e){this.selectedCoordSystemId=e}setSelectedTcpId(e){this.selectedTcpId=e}setSelectedOrientation(e){this.selectedOrientation=e}setSelectedIncrementId(e){this.selectedIncrementId=e}setCurrentIncrementJog(e){this.incrementJogInProgress=e}setVelocityFromSlider(e,t){t?this.rotationVelocityDegPerSec=e:this.translationVelocityMmPerSec=e}setSelectedCartesianMotionType(e){this.selectedCartesianMotionType=e}lock(e){this.locks.add(e)}unlock(e){this.locks.delete(e)}block(){this.blocked=!0}unblock(){this.blocked=!1,this.jogger.mode==="jogging"&&this.jogger.initializeJoggingWebsocket()}async withMotionLock(e){const t=S();this.lock(t);try{return await e()}finally{this.unlock(t)}}}exports.JoggingStore=a;exports.ORIENTATION_IDS=T;exports.default=a;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("@wandelbots/nova-js"),m=require("@wandelbots/nova-js/v2"),u=require("lodash-es"),d=require("lodash-es/keyBy"),S=require("lodash-es/uniqueId"),y=require("mobx"),l=[{id:"0.1",mm:.1,degrees:.05},{id:"1",mm:1,degrees:.5},{id:"5",mm:5,degrees:2.5},{id:"10",mm:10,degrees:5}],p=[{id:"continuous"},...l],T=["coordsys","tool"];class a{constructor(e,t,s,i,n){var r,c,o,h;this.jogger=e,this.coordSystems=t,this.motionGroupDescription=s,this.tcps=i,this.inverseSolverValue=n,this.selectedTabId="cartesian",this.locks=new Set,this.blocked=!1,this.selectedCoordSystemId="world",this.selectedTcpId="",this.selectedOrientation="coordsys",this.selectedIncrementId="continuous",this.selectedCartesianMotionType="translate",this.incrementJogInProgress=null,this.translationVelocityMmPerSec=10,this.rotationVelocityDegPerSec=1,this.minTranslationVelocityMmPerSec=5,this.maxTranslationVelocityMmPerSec=250,this.minRotationVelocityDegPerSec=1,this.maxRotationVelocityDegPerSec=60,this.showCoordSystemSelect=!1,this.showTcpSelect=!0,this.showOrientationSelect=!0,this.showIncrementSelect=!0,this.showTabIcons=!1,this.showVelocitySliderLabel=!0,this.showVelocityLegend=!1,this.showJointsLegend=!1,this.disposers=[],this.inverseSolver=void 0,this.jointType=m.JointTypeEnum.RevoluteJoint;for(const g of t)if(g.coordinate_system===""){g.coordinate_system="world";break}this.selectedCoordSystemId=((r=t[0])==null?void 0:r.coordinate_system)||"world",this.selectedTcpId=((c=i[0])==null?void 0:c.id)||"",this.inverseSolver=n,this.jointType=((h=(o=s==null?void 0:s.dh_parameters)==null?void 0:o[0])==null?void 0:h.type)??m.JointTypeEnum.RevoluteJoint,y.makeAutoObservable(this,{},{autoBind:!0}),this.jogger.onBlocked=()=>{this.block()},this.loadFromLocalStorage(),this.disposers.push(y.autorun(()=>this.saveToLocalStorage())),window.joggingStore=this}static async loadFor(e){const{nova:t}=e,[s,i]=await Promise.all([t.api.controller.listCoordinateSystems(e.motionStream.controllerId,"ROTATION_VECTOR"),t.api.motionGroup.getMotionGroupDescription(e.motionStream.controllerId,e.motionGroupId)]),n=await t.api.motionGroupModels.getMotionGroupKinematicModel(i.motion_group_model),r=Object.entries(i.tcps||{}).map(([c,o])=>({id:c,readable_name:o.name,position:o.pose.position,orientation:o.pose.orientation}));return new a(e,s||[],i,r,n.inverse_solver)}dispose(){for(const e of this.disposers)e();this.jogger.dispose()}get coordSystemCountByName(){return u.countBy(this.coordSystems,e=>e.name)}async deactivate(){if(this.jogger.mode==="jogging")return this.jogger.stop()}async activate(){return this.currentTab.id==="cartesian"?((this.jogger.tcp!==this.selectedTcpId||this.jogger.orientation!==this.selectedOrientation)&&this.jogger.setOptions({tcp:this.selectedTcpId,orientation:this.selectedOrientation}),this.activeDiscreteIncrement?this.jogger.setJoggingMode("trajectory"):this.jogger.setJoggingMode("jogging")):this.jogger.setJoggingMode("jogging"),this.jogger}loadFromLocalStorage(){const e=I.tryParseJson(localStorage.getItem("joggingToolStore"));e&&(this.tabsById[e.selectedTabId]&&(this.selectedTabId=e.selectedTabId),this.coordSystemsById[e.selectedCoordSystemId]&&(this.selectedCoordSystemId=e.selectedCoordSystemId),this.tcpsById[e.selectedTcpId]&&(this.selectedTcpId=e.selectedTcpId),this.incrementOptionsById[e.selectedIncrementId]&&(this.selectedIncrementId=e.selectedIncrementId),["translate","rotate"].includes(e.selectedCartesianMotionType)&&(this.selectedCartesianMotionType=e.selectedCartesianMotionType),["coordsys","tool"].includes(e.selectedOrientation)&&(this.selectedOrientation=e.selectedOrientation))}saveToLocalStorage(){localStorage.setItem("joggingToolStore",JSON.stringify(this.localStorageSave))}get isLocked(){return this.locks.size>0}get localStorageSave(){return{selectedTabId:this.selectedTabId,selectedCoordSystemId:this.selectedCoordSystemId,selectedTcpId:this.selectedTcpId,selectedOrientation:this.selectedOrientation,selectedIncrementId:this.selectedIncrementId,selectedCartesianMotionType:this.selectedCartesianMotionType}}get tabs(){const e=[{id:"joint",label:"Joints"}];return this.inverseSolver!==null&&e.unshift({id:"cartesian",label:"Cartesian"}),e}get incrementOptions(){return p}get discreteIncrementOptions(){return l}get incrementOptionsById(){return d(this.incrementOptions,e=>e.id)}get tabsById(){return d(this.tabs,e=>e.id)}get currentTab(){return this.tabsById[this.selectedTabId]||this.tabs[0]}get tabIndex(){return this.tabs.indexOf(this.currentTab)}get coordSystemsById(){return d(this.coordSystems,e=>e.coordinate_system)}get activeCoordSystemId(){return this.selectedOrientation==="tool"?"tool":this.selectedCoordSystemId}get tcpsById(){return d(this.tcps,e=>e.id)}get activeDiscreteIncrement(){return this.selectedOrientation==="tool"?void 0:l.find(e=>e.id===this.selectedIncrementId)}get rotationVelocityRadsPerSec(){return this.rotationVelocityDegPerSec*Math.PI/180}velocityInDisplayUnits(e){return e?this.rotationVelocityDegPerSec:this.translationVelocityMmPerSec}minVelocityInDisplayUnits(e){return e?this.minRotationVelocityDegPerSec:this.minTranslationVelocityMmPerSec}maxVelocityInDisplayUnits(e){return e?this.maxRotationVelocityDegPerSec:this.maxTranslationVelocityMmPerSec}onTabChange(e,t){const s=this.tabs[t]||this.tabs[0];this.selectedTabId=s.id}setSelectedCoordSystemId(e){this.selectedCoordSystemId=e}setSelectedTcpId(e){this.selectedTcpId=e}setSelectedOrientation(e){this.selectedOrientation=e}setSelectedIncrementId(e){this.selectedIncrementId=e}setCurrentIncrementJog(e){this.incrementJogInProgress=e}setVelocityFromSlider(e,t){t?this.rotationVelocityDegPerSec=e:this.translationVelocityMmPerSec=e}setSelectedCartesianMotionType(e){this.selectedCartesianMotionType=e}lock(e){this.locks.add(e)}unlock(e){this.locks.delete(e)}block(){this.blocked=!0}unblock(){this.blocked=!1,this.jogger.mode==="jogging"&&this.jogger.initializeJoggingWebsocket()}async withMotionLock(e){const t=S();this.lock(t);try{return await e()}finally{this.unlock(t)}}}exports.JoggingStore=a;exports.ORIENTATION_IDS=T;exports.default=a;
2
2
  //# sourceMappingURL=JoggingStore.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"JoggingStore.cjs","sources":["../../../src/components/jogging/JoggingStore.ts"],"sourcesContent":["import { tryParseJson } from \"@wandelbots/nova-js\"\nimport {\n JointTypeEnum,\n type CoordinateSystem,\n type KinematicModel,\n type MotionGroupDescription,\n type RobotTcp,\n} from \"@wandelbots/nova-js/v2\"\nimport { countBy } from \"lodash-es\"\nimport keyBy from \"lodash-es/keyBy.js\"\nimport uniqueId from \"lodash-es/uniqueId.js\"\nimport { autorun, makeAutoObservable, type IReactionDisposer } from \"mobx\"\nimport type {\n JoggerConnection,\n JoggerOrientation,\n Vector3Simple,\n} from \"../../lib/JoggerConnection\"\n\nconst discreteIncrementOptions = [\n { id: \"0.1\", mm: 0.1, degrees: 0.05 },\n { id: \"1\", mm: 1, degrees: 0.5 },\n { id: \"5\", mm: 5, degrees: 2.5 },\n { id: \"10\", mm: 10, degrees: 5 },\n]\n\nconst incrementOptions = [\n { id: \"continuous\" },\n ...discreteIncrementOptions,\n] as const\n\nexport type JoggingAxis = \"x\" | \"y\" | \"z\"\nexport type JoggingDirection = \"+\" | \"-\"\nexport type DiscreteIncrementOption = (typeof discreteIncrementOptions)[number]\nexport type IncrementOption = (typeof incrementOptions)[number]\nexport type IncrementOptionId = IncrementOption[\"id\"]\n\nexport const ORIENTATION_IDS = [\"coordsys\", \"tool\"]\nexport type OrientationId = (typeof ORIENTATION_IDS)[number]\n\nexport type IncrementJogInProgress = {\n direction: JoggingDirection\n axis: JoggingAxis\n}\n\ntype TabType = \"cartesian\" | \"joint\" | \"debug\"\nexport type CartesianMotionType = \"translate\" | \"rotate\"\n\nexport class JoggingStore {\n selectedTabId: TabType = \"cartesian\"\n\n /** Locks to prevent UI interactions during certain operations */\n locks = new Set<string>()\n\n /** Block jogging UI interactions when connection is taken by another jogger */\n blocked: boolean = false\n\n /**\n * Id of selected coordinate system from among those defined on the API side\n */\n selectedCoordSystemId: string = \"world\"\n\n /** Id of selected tool center point from among the options available on the robot */\n selectedTcpId: string = \"\"\n\n /**\n * Whether the user is jogging in the coordinate system or tool orientation.\n * When in tool orientation, the robot moves in a direction relative to the\n * attached tool rotation.\n */\n selectedOrientation: OrientationId = \"coordsys\"\n\n /**\n * Id of selected increment amount for jogging. Options are defined by robot pad.\n * When non-continuous, jogging moves the robot by a fixed number of mm or degrees\n * each time the button is pressed, for extra precision\n */\n selectedIncrementId: IncrementOptionId = \"continuous\"\n\n /**\n * When on the cartesian tab, jogging can be either translating or rotating\n * around the TCP.\n */\n selectedCartesianMotionType: CartesianMotionType = \"translate\"\n\n /**\n * If the jogger is busy running an incremental jog, this will be set\n * with the information about the motion\n */\n incrementJogInProgress: IncrementJogInProgress | null = null\n\n /** How fast the robot goes when doing cartesian translate jogging in mm/s */\n translationVelocityMmPerSec: number = 10\n /** How fast the robot goes when doing cartesian or joint rotation jogging in °/s */\n rotationVelocityDegPerSec: number = 1\n\n /** Minimum translation velocity user can choose on the velocity slider in °/s */\n minTranslationVelocityMmPerSec: number = 5\n /** Maximum translation velocity user can choose on the velocity slider in °/s */\n maxTranslationVelocityMmPerSec: number = 250\n\n /** Minimum rotation velocity user can choose on the velocity slider in °/s */\n minRotationVelocityDegPerSec: number = 1\n /** Maximum rotation velocity user can choose on the velocity slider in °/s */\n maxRotationVelocityDegPerSec: number = 60\n\n /** Whether to show the coordinate system select dropdown in the UI */\n showCoordSystemSelect: boolean = false\n\n /** Whether to show the TCP select dropdown in the UI */\n showTcpSelect: boolean = true\n\n /** Whether to show the orientation select dropdown in the UI */\n showOrientationSelect: boolean = true\n\n /** Whether to show the increment select dropdown in the UI */\n showIncrementSelect: boolean = true\n\n /** Whether to show icons in the jogging tabs */\n showTabIcons: boolean = false\n\n /** Whether to show the label to the right of the velocity slider */\n showVelocitySliderLabel: boolean = true\n\n /** Whether to show the legend before the slider */\n showVelocityLegend: boolean = false\n\n /** Whether to show the legend before the joints */\n showJointsLegend: boolean = false\n\n disposers: IReactionDisposer[] = []\n\n /**\n * Inverse solver from the kinematic model of the motion group to determine, which tabs should be rendered\n */\n inverseSolver: string | null | undefined = undefined\n\n /**\n * Joint type to determine, whether the active robot should be displayed as Robot or Linear Axis and what tabs\n * should be rendered by the JoggingPanel component.\n */\n jointType: JointTypeEnum = JointTypeEnum.RevoluteJoint\n\n /**\n * Load a jogging store with the relevant data it needs\n * from the backend\n */\n static async loadFor(jogger: JoggerConnection) {\n const { nova } = jogger\n\n // Find out what TCPs this motion group has (we need it for jogging)\n const [coordinatesystems, description] = await Promise.all([\n // Fetch coord systems so user can select between them\n nova.api.controller.listCoordinateSystems(\n jogger.motionStream.controllerId,\n \"ROTATION_VECTOR\",\n ),\n\n // Same for TCPs and other info from description\n nova.api.motionGroup.getMotionGroupDescription(\n jogger.motionStream.controllerId,\n jogger.motionGroupId,\n ),\n ])\n\n const kinematicModel: KinematicModel =\n await nova.api.motionGroupModels.getMotionGroupKinematicModel(\n description.motion_group_model,\n )\n\n const tcps = Object.entries(description.tcps || {}).map(([id, tcp]) => ({\n id,\n readable_name: tcp.name,\n position: tcp.pose.position as Vector3Simple,\n orientation: tcp.pose.orientation as Vector3Simple,\n }))\n\n return new JoggingStore(\n jogger,\n coordinatesystems || [],\n description,\n tcps,\n kinematicModel.inverse_solver,\n )\n }\n\n constructor(\n readonly jogger: JoggerConnection,\n readonly coordSystems: CoordinateSystem[],\n readonly motionGroupDescription: MotionGroupDescription,\n readonly tcps: RobotTcp[],\n readonly inverseSolverValue: string | null | undefined,\n ) {\n // TODO workaround for default coord system on backend having a canonical id\n // of empty string. Can remove when fixed on API side\n for (const cs of coordSystems) {\n if (cs.coordinate_system === \"\") {\n cs.coordinate_system = \"world\"\n break\n }\n }\n this.selectedCoordSystemId = coordSystems[0]?.coordinate_system || \"world\"\n this.selectedTcpId = tcps[0]?.id || \"\"\n this.inverseSolver = inverseSolverValue\n this.jointType =\n motionGroupDescription?.dh_parameters?.[0]?.type ??\n JointTypeEnum.RevoluteJoint\n\n // Make all properties observable and actions auto-bound\n makeAutoObservable(this, {}, { autoBind: true })\n\n // Register blocked watching\n this.jogger.onBlocked = () => {\n this.block()\n }\n\n // Load user settings from local storage if available\n this.loadFromLocalStorage()\n\n // Automatically save user settings to local storage when save changes\n this.disposers.push(autorun(() => this.saveToLocalStorage()))\n\n // Assign joggingStore to window\n // biome-ignore lint/suspicious/noExplicitAny: pre-biome code\n ;(window as any).joggingStore = this\n }\n\n dispose() {\n for (const dispose of this.disposers) {\n dispose()\n }\n this.jogger.dispose()\n }\n\n get coordSystemCountByName() {\n return countBy(this.coordSystems, (cs) => cs.name)\n }\n\n async deactivate() {\n if (this.jogger.mode === \"jogging\") {\n return this.jogger.stop()\n }\n }\n\n /** Activate the jogger with current settings */\n async activate() {\n if (this.currentTab.id === \"cartesian\") {\n if (\n this.jogger.tcp !== this.selectedTcpId ||\n this.jogger.orientation !== this.selectedOrientation\n ) {\n this.jogger.setOptions({\n tcp: this.selectedTcpId,\n orientation: this.selectedOrientation as JoggerOrientation,\n })\n }\n\n if (this.activeDiscreteIncrement) {\n this.jogger.setJoggingMode(\"trajectory\")\n } else {\n this.jogger.setJoggingMode(\"jogging\")\n }\n } else {\n this.jogger.setJoggingMode(\"jogging\")\n }\n\n return this.jogger\n }\n\n loadFromLocalStorage() {\n const save = tryParseJson(localStorage.getItem(\"joggingToolStore\"))\n if (!save) return\n\n if (this.tabsById[save.selectedTabId]) {\n this.selectedTabId = save.selectedTabId\n }\n\n if (this.coordSystemsById[save.selectedCoordSystemId]) {\n this.selectedCoordSystemId = save.selectedCoordSystemId\n }\n\n if (this.tcpsById[save.selectedTcpId]) {\n this.selectedTcpId = save.selectedTcpId\n }\n\n if (this.incrementOptionsById[save.selectedIncrementId]) {\n this.selectedIncrementId = save.selectedIncrementId\n }\n\n if ([\"translate\", \"rotate\"].includes(save.selectedCartesianMotionType)) {\n this.selectedCartesianMotionType = save.selectedCartesianMotionType\n }\n\n if ([\"coordsys\", \"tool\"].includes(save.selectedOrientation)) {\n this.selectedOrientation = save.selectedOrientation\n }\n }\n\n saveToLocalStorage() {\n localStorage.setItem(\n \"joggingToolStore\",\n JSON.stringify(this.localStorageSave),\n )\n }\n\n get isLocked() {\n return this.locks.size > 0\n }\n\n get localStorageSave() {\n return {\n selectedTabId: this.selectedTabId,\n selectedCoordSystemId: this.selectedCoordSystemId,\n selectedTcpId: this.selectedTcpId,\n selectedOrientation: this.selectedOrientation,\n selectedIncrementId: this.selectedIncrementId,\n selectedCartesianMotionType: this.selectedCartesianMotionType,\n }\n }\n\n get tabs() {\n const tempTabs: { id: TabType; label: string }[] = [\n {\n id: \"joint\",\n label: \"Joints\",\n },\n ]\n // show the cartesian tab only : 1. when there is a solver or 2. when no solver could be loaded ( as a default )\n // do not show the cartesian tab when the solver is null this means, it cannot get jogged cartesian\n if (this.inverseSolver !== null) {\n tempTabs.unshift({\n id: \"cartesian\",\n label: \"Cartesian\",\n })\n }\n\n return tempTabs\n }\n\n get incrementOptions() {\n return incrementOptions\n }\n\n get discreteIncrementOptions() {\n return discreteIncrementOptions\n }\n\n get incrementOptionsById() {\n return keyBy(this.incrementOptions, (o) => o.id)\n }\n\n get tabsById() {\n return keyBy(this.tabs, (t) => t.id)\n }\n\n get currentTab() {\n // biome-ignore lint/style/noNonNullAssertion: pre-biome code\n return this.tabsById[this.selectedTabId] || this.tabs[0]!\n }\n\n get tabIndex() {\n return this.tabs.indexOf(this.currentTab)\n }\n\n get coordSystemsById() {\n return keyBy(this.coordSystems, (cs) => cs.coordinate_system)\n }\n\n /**\n * The id of the coordinate system to use for jogging.\n * If in tool orientation, this is set to \"tool\", not the\n * selected coordinate system.\n */\n get activeCoordSystemId() {\n return this.selectedOrientation === \"tool\"\n ? \"tool\"\n : this.selectedCoordSystemId\n }\n\n get tcpsById() {\n return keyBy(this.tcps, (tcp) => tcp.id)\n }\n\n get activeDiscreteIncrement() {\n return this.selectedOrientation === \"tool\"\n ? undefined\n : discreteIncrementOptions.find((d) => d.id === this.selectedIncrementId)\n }\n\n /** The selected rotation velocity converted to radians per second */\n get rotationVelocityRadsPerSec() {\n return (this.rotationVelocityDegPerSec * Math.PI) / 180\n }\n\n /** Selected velocity in mm/sec or deg/sec */\n velocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.rotationVelocityDegPerSec\n : this.translationVelocityMmPerSec\n }\n\n /** Minimum selectable velocity in mm/sec or deg/sec */\n minVelocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.minRotationVelocityDegPerSec\n : this.minTranslationVelocityMmPerSec\n }\n\n /** Maximum selectable velocity in mm/sec or deg/sec */\n maxVelocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.maxRotationVelocityDegPerSec\n : this.maxTranslationVelocityMmPerSec\n }\n\n onTabChange(_event: React.SyntheticEvent, newValue: number) {\n // biome-ignore lint/style/noNonNullAssertion: pre-biome code\n const tab = this.tabs[newValue] || this.tabs[0]!\n this.selectedTabId = tab.id\n }\n\n setSelectedCoordSystemId(id: string) {\n this.selectedCoordSystemId = id\n }\n\n setSelectedTcpId(id: string) {\n this.selectedTcpId = id\n }\n\n setSelectedOrientation(orientation: OrientationId) {\n this.selectedOrientation = orientation\n }\n\n setSelectedIncrementId(id: IncrementOptionId) {\n this.selectedIncrementId = id\n }\n\n setCurrentIncrementJog(incrementJog: IncrementJogInProgress | null) {\n this.incrementJogInProgress = incrementJog\n }\n\n setVelocityFromSlider(velocity: number, useDegree: boolean) {\n if (useDegree) {\n this.rotationVelocityDegPerSec = velocity\n } else {\n this.translationVelocityMmPerSec = velocity\n }\n }\n\n setSelectedCartesianMotionType(type: CartesianMotionType) {\n this.selectedCartesianMotionType = type\n }\n\n lock(id: string) {\n this.locks.add(id)\n }\n\n unlock(id: string) {\n this.locks.delete(id)\n }\n\n block() {\n this.blocked = true\n }\n\n unblock() {\n this.blocked = false\n if (this.jogger.mode === \"jogging\") {\n this.jogger.initializeJoggingWebsocket()\n }\n }\n\n /** Lock the UI until the given async callback resolves */\n async withMotionLock(fn: () => Promise<void>) {\n const lockId = uniqueId()\n this.lock(lockId)\n\n try {\n return await fn()\n } finally {\n this.unlock(lockId)\n }\n }\n}\n\nexport default JoggingStore\n"],"names":["discreteIncrementOptions","incrementOptions","ORIENTATION_IDS","JoggingStore","jogger","coordSystems","motionGroupDescription","tcps","inverseSolverValue","JointTypeEnum","cs","_a","_b","_d","_c","makeAutoObservable","autorun","nova","coordinatesystems","description","kinematicModel","id","tcp","dispose","countBy","save","tryParseJson","tempTabs","keyBy","o","t","d","useDegree","_event","newValue","tab","orientation","incrementJog","velocity","type","fn","lockId","uniqueId"],"mappings":"mSAkBMA,EAA2B,CAC/B,CAAE,GAAI,MAAO,GAAI,GAAK,QAAS,GAAA,EAC/B,CAAE,GAAI,IAAK,GAAI,EAAG,QAAS,EAAA,EAC3B,CAAE,GAAI,IAAK,GAAI,EAAG,QAAS,GAAA,EAC3B,CAAE,GAAI,KAAM,GAAI,GAAI,QAAS,CAAA,CAC/B,EAEMC,EAAmB,CACvB,CAAE,GAAI,YAAA,EACN,GAAGD,CACL,EAQaE,EAAkB,CAAC,WAAY,MAAM,EAW3C,MAAMC,CAAa,CA0IxB,YACWC,EACAC,EACAC,EACAC,EACAC,EACT,aALS,KAAA,OAAAJ,EACA,KAAA,aAAAC,EACA,KAAA,uBAAAC,EACA,KAAA,KAAAC,EACA,KAAA,mBAAAC,EA9IX,KAAA,cAAyB,YAGzB,KAAA,UAAY,IAGZ,KAAA,QAAmB,GAKnB,KAAA,sBAAgC,QAGhC,KAAA,cAAwB,GAOxB,KAAA,oBAAqC,WAOrC,KAAA,oBAAyC,aAMzC,KAAA,4BAAmD,YAMnD,KAAA,uBAAwD,KAGxD,KAAA,4BAAsC,GAEtC,KAAA,0BAAoC,EAGpC,KAAA,+BAAyC,EAEzC,KAAA,+BAAyC,IAGzC,KAAA,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"JoggingStore.cjs","sources":["../../../src/components/jogging/JoggingStore.ts"],"sourcesContent":["import { tryParseJson } from \"@wandelbots/nova-js\"\nimport {\n JointTypeEnum,\n type CoordinateSystem,\n type KinematicModel,\n type MotionGroupDescription,\n type RobotTcp,\n} from \"@wandelbots/nova-js/v2\"\nimport { countBy } from \"lodash-es\"\nimport keyBy from \"lodash-es/keyBy\"\nimport uniqueId from \"lodash-es/uniqueId\"\nimport { autorun, makeAutoObservable, type IReactionDisposer } from \"mobx\"\nimport type {\n JoggerConnection,\n JoggerOrientation,\n Vector3Simple,\n} from \"../../lib/JoggerConnection\"\n\nconst discreteIncrementOptions = [\n { id: \"0.1\", mm: 0.1, degrees: 0.05 },\n { id: \"1\", mm: 1, degrees: 0.5 },\n { id: \"5\", mm: 5, degrees: 2.5 },\n { id: \"10\", mm: 10, degrees: 5 },\n]\n\nconst incrementOptions = [\n { id: \"continuous\" },\n ...discreteIncrementOptions,\n] as const\n\nexport type JoggingAxis = \"x\" | \"y\" | \"z\"\nexport type JoggingDirection = \"+\" | \"-\"\nexport type DiscreteIncrementOption = (typeof discreteIncrementOptions)[number]\nexport type IncrementOption = (typeof incrementOptions)[number]\nexport type IncrementOptionId = IncrementOption[\"id\"]\n\nexport const ORIENTATION_IDS = [\"coordsys\", \"tool\"]\nexport type OrientationId = (typeof ORIENTATION_IDS)[number]\n\nexport type IncrementJogInProgress = {\n direction: JoggingDirection\n axis: JoggingAxis\n}\n\ntype TabType = \"cartesian\" | \"joint\" | \"debug\"\nexport type CartesianMotionType = \"translate\" | \"rotate\"\n\nexport class JoggingStore {\n selectedTabId: TabType = \"cartesian\"\n\n /** Locks to prevent UI interactions during certain operations */\n locks = new Set<string>()\n\n /** Block jogging UI interactions when connection is taken by another jogger */\n blocked: boolean = false\n\n /**\n * Id of selected coordinate system from among those defined on the API side\n */\n selectedCoordSystemId: string = \"world\"\n\n /** Id of selected tool center point from among the options available on the robot */\n selectedTcpId: string = \"\"\n\n /**\n * Whether the user is jogging in the coordinate system or tool orientation.\n * When in tool orientation, the robot moves in a direction relative to the\n * attached tool rotation.\n */\n selectedOrientation: OrientationId = \"coordsys\"\n\n /**\n * Id of selected increment amount for jogging. Options are defined by robot pad.\n * When non-continuous, jogging moves the robot by a fixed number of mm or degrees\n * each time the button is pressed, for extra precision\n */\n selectedIncrementId: IncrementOptionId = \"continuous\"\n\n /**\n * When on the cartesian tab, jogging can be either translating or rotating\n * around the TCP.\n */\n selectedCartesianMotionType: CartesianMotionType = \"translate\"\n\n /**\n * If the jogger is busy running an incremental jog, this will be set\n * with the information about the motion\n */\n incrementJogInProgress: IncrementJogInProgress | null = null\n\n /** How fast the robot goes when doing cartesian translate jogging in mm/s */\n translationVelocityMmPerSec: number = 10\n /** How fast the robot goes when doing cartesian or joint rotation jogging in °/s */\n rotationVelocityDegPerSec: number = 1\n\n /** Minimum translation velocity user can choose on the velocity slider in °/s */\n minTranslationVelocityMmPerSec: number = 5\n /** Maximum translation velocity user can choose on the velocity slider in °/s */\n maxTranslationVelocityMmPerSec: number = 250\n\n /** Minimum rotation velocity user can choose on the velocity slider in °/s */\n minRotationVelocityDegPerSec: number = 1\n /** Maximum rotation velocity user can choose on the velocity slider in °/s */\n maxRotationVelocityDegPerSec: number = 60\n\n /** Whether to show the coordinate system select dropdown in the UI */\n showCoordSystemSelect: boolean = false\n\n /** Whether to show the TCP select dropdown in the UI */\n showTcpSelect: boolean = true\n\n /** Whether to show the orientation select dropdown in the UI */\n showOrientationSelect: boolean = true\n\n /** Whether to show the increment select dropdown in the UI */\n showIncrementSelect: boolean = true\n\n /** Whether to show icons in the jogging tabs */\n showTabIcons: boolean = false\n\n /** Whether to show the label to the right of the velocity slider */\n showVelocitySliderLabel: boolean = true\n\n /** Whether to show the legend before the slider */\n showVelocityLegend: boolean = false\n\n /** Whether to show the legend before the joints */\n showJointsLegend: boolean = false\n\n disposers: IReactionDisposer[] = []\n\n /**\n * Inverse solver from the kinematic model of the motion group to determine, which tabs should be rendered\n */\n inverseSolver: string | null | undefined = undefined\n\n /**\n * Joint type to determine, whether the active robot should be displayed as Robot or Linear Axis and what tabs\n * should be rendered by the JoggingPanel component.\n */\n jointType: JointTypeEnum = JointTypeEnum.RevoluteJoint\n\n /**\n * Load a jogging store with the relevant data it needs\n * from the backend\n */\n static async loadFor(jogger: JoggerConnection) {\n const { nova } = jogger\n\n // Find out what TCPs this motion group has (we need it for jogging)\n const [coordinatesystems, description] = await Promise.all([\n // Fetch coord systems so user can select between them\n nova.api.controller.listCoordinateSystems(\n jogger.motionStream.controllerId,\n \"ROTATION_VECTOR\",\n ),\n\n // Same for TCPs and other info from description\n nova.api.motionGroup.getMotionGroupDescription(\n jogger.motionStream.controllerId,\n jogger.motionGroupId,\n ),\n ])\n\n const kinematicModel: KinematicModel =\n await nova.api.motionGroupModels.getMotionGroupKinematicModel(\n description.motion_group_model,\n )\n\n const tcps = Object.entries(description.tcps || {}).map(([id, tcp]) => ({\n id,\n readable_name: tcp.name,\n position: tcp.pose.position as Vector3Simple,\n orientation: tcp.pose.orientation as Vector3Simple,\n }))\n\n return new JoggingStore(\n jogger,\n coordinatesystems || [],\n description,\n tcps,\n kinematicModel.inverse_solver,\n )\n }\n\n constructor(\n readonly jogger: JoggerConnection,\n readonly coordSystems: CoordinateSystem[],\n readonly motionGroupDescription: MotionGroupDescription,\n readonly tcps: RobotTcp[],\n readonly inverseSolverValue: string | null | undefined,\n ) {\n // TODO workaround for default coord system on backend having a canonical id\n // of empty string. Can remove when fixed on API side\n for (const cs of coordSystems) {\n if (cs.coordinate_system === \"\") {\n cs.coordinate_system = \"world\"\n break\n }\n }\n this.selectedCoordSystemId = coordSystems[0]?.coordinate_system || \"world\"\n this.selectedTcpId = tcps[0]?.id || \"\"\n this.inverseSolver = inverseSolverValue\n this.jointType =\n motionGroupDescription?.dh_parameters?.[0]?.type ??\n JointTypeEnum.RevoluteJoint\n\n // Make all properties observable and actions auto-bound\n makeAutoObservable(this, {}, { autoBind: true })\n\n // Register blocked watching\n this.jogger.onBlocked = () => {\n this.block()\n }\n\n // Load user settings from local storage if available\n this.loadFromLocalStorage()\n\n // Automatically save user settings to local storage when save changes\n this.disposers.push(autorun(() => this.saveToLocalStorage()))\n\n // Assign joggingStore to window\n // biome-ignore lint/suspicious/noExplicitAny: pre-biome code\n ;(window as any).joggingStore = this\n }\n\n dispose() {\n for (const dispose of this.disposers) {\n dispose()\n }\n this.jogger.dispose()\n }\n\n get coordSystemCountByName() {\n return countBy(this.coordSystems, (cs) => cs.name)\n }\n\n async deactivate() {\n if (this.jogger.mode === \"jogging\") {\n return this.jogger.stop()\n }\n }\n\n /** Activate the jogger with current settings */\n async activate() {\n if (this.currentTab.id === \"cartesian\") {\n if (\n this.jogger.tcp !== this.selectedTcpId ||\n this.jogger.orientation !== this.selectedOrientation\n ) {\n this.jogger.setOptions({\n tcp: this.selectedTcpId,\n orientation: this.selectedOrientation as JoggerOrientation,\n })\n }\n\n if (this.activeDiscreteIncrement) {\n this.jogger.setJoggingMode(\"trajectory\")\n } else {\n this.jogger.setJoggingMode(\"jogging\")\n }\n } else {\n this.jogger.setJoggingMode(\"jogging\")\n }\n\n return this.jogger\n }\n\n loadFromLocalStorage() {\n const save = tryParseJson(localStorage.getItem(\"joggingToolStore\"))\n if (!save) return\n\n if (this.tabsById[save.selectedTabId]) {\n this.selectedTabId = save.selectedTabId\n }\n\n if (this.coordSystemsById[save.selectedCoordSystemId]) {\n this.selectedCoordSystemId = save.selectedCoordSystemId\n }\n\n if (this.tcpsById[save.selectedTcpId]) {\n this.selectedTcpId = save.selectedTcpId\n }\n\n if (this.incrementOptionsById[save.selectedIncrementId]) {\n this.selectedIncrementId = save.selectedIncrementId\n }\n\n if ([\"translate\", \"rotate\"].includes(save.selectedCartesianMotionType)) {\n this.selectedCartesianMotionType = save.selectedCartesianMotionType\n }\n\n if ([\"coordsys\", \"tool\"].includes(save.selectedOrientation)) {\n this.selectedOrientation = save.selectedOrientation\n }\n }\n\n saveToLocalStorage() {\n localStorage.setItem(\n \"joggingToolStore\",\n JSON.stringify(this.localStorageSave),\n )\n }\n\n get isLocked() {\n return this.locks.size > 0\n }\n\n get localStorageSave() {\n return {\n selectedTabId: this.selectedTabId,\n selectedCoordSystemId: this.selectedCoordSystemId,\n selectedTcpId: this.selectedTcpId,\n selectedOrientation: this.selectedOrientation,\n selectedIncrementId: this.selectedIncrementId,\n selectedCartesianMotionType: this.selectedCartesianMotionType,\n }\n }\n\n get tabs() {\n const tempTabs: { id: TabType; label: string }[] = [\n {\n id: \"joint\",\n label: \"Joints\",\n },\n ]\n // show the cartesian tab only : 1. when there is a solver or 2. when no solver could be loaded ( as a default )\n // do not show the cartesian tab when the solver is null this means, it cannot get jogged cartesian\n if (this.inverseSolver !== null) {\n tempTabs.unshift({\n id: \"cartesian\",\n label: \"Cartesian\",\n })\n }\n\n return tempTabs\n }\n\n get incrementOptions() {\n return incrementOptions\n }\n\n get discreteIncrementOptions() {\n return discreteIncrementOptions\n }\n\n get incrementOptionsById() {\n return keyBy(this.incrementOptions, (o) => o.id)\n }\n\n get tabsById() {\n return keyBy(this.tabs, (t) => t.id)\n }\n\n get currentTab() {\n // biome-ignore lint/style/noNonNullAssertion: pre-biome code\n return this.tabsById[this.selectedTabId] || this.tabs[0]!\n }\n\n get tabIndex() {\n return this.tabs.indexOf(this.currentTab)\n }\n\n get coordSystemsById() {\n return keyBy(this.coordSystems, (cs) => cs.coordinate_system)\n }\n\n /**\n * The id of the coordinate system to use for jogging.\n * If in tool orientation, this is set to \"tool\", not the\n * selected coordinate system.\n */\n get activeCoordSystemId() {\n return this.selectedOrientation === \"tool\"\n ? \"tool\"\n : this.selectedCoordSystemId\n }\n\n get tcpsById() {\n return keyBy(this.tcps, (tcp) => tcp.id)\n }\n\n get activeDiscreteIncrement() {\n return this.selectedOrientation === \"tool\"\n ? undefined\n : discreteIncrementOptions.find((d) => d.id === this.selectedIncrementId)\n }\n\n /** The selected rotation velocity converted to radians per second */\n get rotationVelocityRadsPerSec() {\n return (this.rotationVelocityDegPerSec * Math.PI) / 180\n }\n\n /** Selected velocity in mm/sec or deg/sec */\n velocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.rotationVelocityDegPerSec\n : this.translationVelocityMmPerSec\n }\n\n /** Minimum selectable velocity in mm/sec or deg/sec */\n minVelocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.minRotationVelocityDegPerSec\n : this.minTranslationVelocityMmPerSec\n }\n\n /** Maximum selectable velocity in mm/sec or deg/sec */\n maxVelocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.maxRotationVelocityDegPerSec\n : this.maxTranslationVelocityMmPerSec\n }\n\n onTabChange(_event: React.SyntheticEvent, newValue: number) {\n // biome-ignore lint/style/noNonNullAssertion: pre-biome code\n const tab = this.tabs[newValue] || this.tabs[0]!\n this.selectedTabId = tab.id\n }\n\n setSelectedCoordSystemId(id: string) {\n this.selectedCoordSystemId = id\n }\n\n setSelectedTcpId(id: string) {\n this.selectedTcpId = id\n }\n\n setSelectedOrientation(orientation: OrientationId) {\n this.selectedOrientation = orientation\n }\n\n setSelectedIncrementId(id: IncrementOptionId) {\n this.selectedIncrementId = id\n }\n\n setCurrentIncrementJog(incrementJog: IncrementJogInProgress | null) {\n this.incrementJogInProgress = incrementJog\n }\n\n setVelocityFromSlider(velocity: number, useDegree: boolean) {\n if (useDegree) {\n this.rotationVelocityDegPerSec = velocity\n } else {\n this.translationVelocityMmPerSec = velocity\n }\n }\n\n setSelectedCartesianMotionType(type: CartesianMotionType) {\n this.selectedCartesianMotionType = type\n }\n\n lock(id: string) {\n this.locks.add(id)\n }\n\n unlock(id: string) {\n this.locks.delete(id)\n }\n\n block() {\n this.blocked = true\n }\n\n unblock() {\n this.blocked = false\n if (this.jogger.mode === \"jogging\") {\n this.jogger.initializeJoggingWebsocket()\n }\n }\n\n /** Lock the UI until the given async callback resolves */\n async withMotionLock(fn: () => Promise<void>) {\n const lockId = uniqueId()\n this.lock(lockId)\n\n try {\n return await fn()\n } finally {\n this.unlock(lockId)\n }\n }\n}\n\nexport default JoggingStore\n"],"names":["discreteIncrementOptions","incrementOptions","ORIENTATION_IDS","JoggingStore","jogger","coordSystems","motionGroupDescription","tcps","inverseSolverValue","JointTypeEnum","cs","_a","_b","_d","_c","makeAutoObservable","autorun","nova","coordinatesystems","description","kinematicModel","id","tcp","dispose","countBy","save","tryParseJson","tempTabs","keyBy","o","t","d","useDegree","_event","newValue","tab","orientation","incrementJog","velocity","type","fn","lockId","uniqueId"],"mappings":"6RAkBMA,EAA2B,CAC/B,CAAE,GAAI,MAAO,GAAI,GAAK,QAAS,GAAA,EAC/B,CAAE,GAAI,IAAK,GAAI,EAAG,QAAS,EAAA,EAC3B,CAAE,GAAI,IAAK,GAAI,EAAG,QAAS,GAAA,EAC3B,CAAE,GAAI,KAAM,GAAI,GAAI,QAAS,CAAA,CAC/B,EAEMC,EAAmB,CACvB,CAAE,GAAI,YAAA,EACN,GAAGD,CACL,EAQaE,EAAkB,CAAC,WAAY,MAAM,EAW3C,MAAMC,CAAa,CA0IxB,YACWC,EACAC,EACAC,EACAC,EACAC,EACT,aALS,KAAA,OAAAJ,EACA,KAAA,aAAAC,EACA,KAAA,uBAAAC,EACA,KAAA,KAAAC,EACA,KAAA,mBAAAC,EA9IX,KAAA,cAAyB,YAGzB,KAAA,UAAY,IAGZ,KAAA,QAAmB,GAKnB,KAAA,sBAAgC,QAGhC,KAAA,cAAwB,GAOxB,KAAA,oBAAqC,WAOrC,KAAA,oBAAyC,aAMzC,KAAA,4BAAmD,YAMnD,KAAA,uBAAwD,KAGxD,KAAA,4BAAsC,GAEtC,KAAA,0BAAoC,EAGpC,KAAA,+BAAyC,EAEzC,KAAA,+BAAyC,IAGzC,KAAA,6BAAuC,EAEvC,KAAA,6BAAuC,GAGvC,KAAA,sBAAiC,GAGjC,KAAA,cAAyB,GAGzB,KAAA,sBAAiC,GAGjC,KAAA,oBAA+B,GAG/B,KAAA,aAAwB,GAGxB,KAAA,wBAAmC,G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CAGA,0BAA0BA,EAAoB,CAC5C,OAAOA,EACH,KAAK,6BACL,KAAK,8BACX,CAGA,0BAA0BA,EAAoB,CAC5C,OAAOA,EACH,KAAK,6BACL,KAAK,8BACX,CAEA,YAAYC,EAA8BC,EAAkB,CAE1D,MAAMC,EAAM,KAAK,KAAKD,CAAQ,GAAK,KAAK,KAAK,CAAC,EAC9C,KAAK,cAAgBC,EAAI,EAC3B,CAEA,yBAAyBd,EAAY,CACnC,KAAK,sBAAwBA,CAC/B,CAEA,iBAAiBA,EAAY,CAC3B,KAAK,cAAgBA,CACvB,CAEA,uBAAuBe,EAA4B,CACjD,KAAK,oBAAsBA,CAC7B,CAEA,uBAAuBf,EAAuB,CAC5C,KAAK,oBAAsBA,CAC7B,CAEA,uBAAuBgB,EAA6C,CAClE,KAAK,uBAAyBA,CAChC,CAEA,sBAAsBC,EAAkBN,EAAoB,CACtDA,EACF,KAAK,0BAA4BM,EAEjC,KAAK,4BAA8BA,CAEvC,CAEA,+BAA+BC,EAA2B,CACxD,KAAK,4BAA8BA,CACrC,CAEA,KAAKlB,EAAY,CACf,KAAK,MAAM,IAAIA,CAAE,CACnB,CAEA,OAAOA,EAAY,CACjB,KAAK,MAAM,OAAOA,CAAE,CACtB,CAEA,OAAQ,CACN,KAAK,QAAU,EACjB,CAEA,SAAU,CACR,KAAK,QAAU,GACX,KAAK,OAAO,OAAS,WACvB,KAAK,OAAO,2BAAA,CAEhB,CAGA,MAAM,eAAemB,EAAyB,CAC5C,MAAMC,EAASC,EAAA,EACf,KAAK,KAAKD,CAAM,EAEhB,GAAI,CACF,OAAO,MAAMD,EAAA,CACf,QAAA,CACE,KAAK,OAAOC,CAAM,CACpB,CACF,CACF"}
@@ -1,8 +1,8 @@
1
1
  import { tryParseJson as y } from "@wandelbots/nova-js";
2
2
  import { JointTypeEnum as m } from "@wandelbots/nova-js/v2";
3
3
  import { countBy as I } from "lodash-es";
4
- import d from "lodash-es/keyBy.js";
5
- import p from "lodash-es/uniqueId.js";
4
+ import d from "lodash-es/keyBy";
5
+ import p from "lodash-es/uniqueId";
6
6
  import { makeAutoObservable as S, autorun as u } from "mobx";
7
7
  const a = [
8
8
  { id: "0.1", mm: 0.1, degrees: 0.05 },
@@ -1 +1 @@
1
- {"version":3,"file":"JoggingStore.js","sources":["../../../src/components/jogging/JoggingStore.ts"],"sourcesContent":["import { tryParseJson } from \"@wandelbots/nova-js\"\nimport {\n JointTypeEnum,\n type CoordinateSystem,\n type KinematicModel,\n type MotionGroupDescription,\n type RobotTcp,\n} from \"@wandelbots/nova-js/v2\"\nimport { countBy } from \"lodash-es\"\nimport keyBy from \"lodash-es/keyBy.js\"\nimport uniqueId from \"lodash-es/uniqueId.js\"\nimport { autorun, makeAutoObservable, type IReactionDisposer } from \"mobx\"\nimport type {\n JoggerConnection,\n JoggerOrientation,\n Vector3Simple,\n} from \"../../lib/JoggerConnection\"\n\nconst discreteIncrementOptions = [\n { id: \"0.1\", mm: 0.1, degrees: 0.05 },\n { id: \"1\", mm: 1, degrees: 0.5 },\n { id: \"5\", mm: 5, degrees: 2.5 },\n { id: \"10\", mm: 10, degrees: 5 },\n]\n\nconst incrementOptions = [\n { id: \"continuous\" },\n ...discreteIncrementOptions,\n] as const\n\nexport type JoggingAxis = \"x\" | \"y\" | \"z\"\nexport type JoggingDirection = \"+\" | \"-\"\nexport type DiscreteIncrementOption = (typeof discreteIncrementOptions)[number]\nexport type IncrementOption = (typeof incrementOptions)[number]\nexport type IncrementOptionId = IncrementOption[\"id\"]\n\nexport const ORIENTATION_IDS = [\"coordsys\", \"tool\"]\nexport type OrientationId = (typeof ORIENTATION_IDS)[number]\n\nexport type IncrementJogInProgress = {\n direction: JoggingDirection\n axis: JoggingAxis\n}\n\ntype TabType = \"cartesian\" | \"joint\" | \"debug\"\nexport type CartesianMotionType = \"translate\" | \"rotate\"\n\nexport class JoggingStore {\n selectedTabId: TabType = \"cartesian\"\n\n /** Locks to prevent UI interactions during certain operations */\n locks = new Set<string>()\n\n /** Block jogging UI interactions when connection is taken by another jogger */\n blocked: boolean = false\n\n /**\n * Id of selected coordinate system from among those defined on the API side\n */\n selectedCoordSystemId: string = \"world\"\n\n /** Id of selected tool center point from among the options available on the robot */\n selectedTcpId: string = \"\"\n\n /**\n * Whether the user is jogging in the coordinate system or tool orientation.\n * When in tool orientation, the robot moves in a direction relative to the\n * attached tool rotation.\n */\n selectedOrientation: OrientationId = \"coordsys\"\n\n /**\n * Id of selected increment amount for jogging. Options are defined by robot pad.\n * When non-continuous, jogging moves the robot by a fixed number of mm or degrees\n * each time the button is pressed, for extra precision\n */\n selectedIncrementId: IncrementOptionId = \"continuous\"\n\n /**\n * When on the cartesian tab, jogging can be either translating or rotating\n * around the TCP.\n */\n selectedCartesianMotionType: CartesianMotionType = \"translate\"\n\n /**\n * If the jogger is busy running an incremental jog, this will be set\n * with the information about the motion\n */\n incrementJogInProgress: IncrementJogInProgress | null = null\n\n /** How fast the robot goes when doing cartesian translate jogging in mm/s */\n translationVelocityMmPerSec: number = 10\n /** How fast the robot goes when doing cartesian or joint rotation jogging in °/s */\n rotationVelocityDegPerSec: number = 1\n\n /** Minimum translation velocity user can choose on the velocity slider in °/s */\n minTranslationVelocityMmPerSec: number = 5\n /** Maximum translation velocity user can choose on the velocity slider in °/s */\n maxTranslationVelocityMmPerSec: number = 250\n\n /** Minimum rotation velocity user can choose on the velocity slider in °/s */\n minRotationVelocityDegPerSec: number = 1\n /** Maximum rotation velocity user can choose on the velocity slider in °/s */\n maxRotationVelocityDegPerSec: number = 60\n\n /** Whether to show the coordinate system select dropdown in the UI */\n showCoordSystemSelect: boolean = false\n\n /** Whether to show the TCP select dropdown in the UI */\n showTcpSelect: boolean = true\n\n /** Whether to show the orientation select dropdown in the UI */\n showOrientationSelect: boolean = true\n\n /** Whether to show the increment select dropdown in the UI */\n showIncrementSelect: boolean = true\n\n /** Whether to show icons in the jogging tabs */\n showTabIcons: boolean = false\n\n /** Whether to show the label to the right of the velocity slider */\n showVelocitySliderLabel: boolean = true\n\n /** Whether to show the legend before the slider */\n showVelocityLegend: boolean = false\n\n /** Whether to show the legend before the joints */\n showJointsLegend: boolean = false\n\n disposers: IReactionDisposer[] = []\n\n /**\n * Inverse solver from the kinematic model of the motion group to determine, which tabs should be rendered\n */\n inverseSolver: string | null | undefined = undefined\n\n /**\n * Joint type to determine, whether the active robot should be displayed as Robot or Linear Axis and what tabs\n * should be rendered by the JoggingPanel component.\n */\n jointType: JointTypeEnum = JointTypeEnum.RevoluteJoint\n\n /**\n * Load a jogging store with the relevant data it needs\n * from the backend\n */\n static async loadFor(jogger: JoggerConnection) {\n const { nova } = jogger\n\n // Find out what TCPs this motion group has (we need it for jogging)\n const [coordinatesystems, description] = await Promise.all([\n // Fetch coord systems so user can select between them\n nova.api.controller.listCoordinateSystems(\n jogger.motionStream.controllerId,\n \"ROTATION_VECTOR\",\n ),\n\n // Same for TCPs and other info from description\n nova.api.motionGroup.getMotionGroupDescription(\n jogger.motionStream.controllerId,\n jogger.motionGroupId,\n ),\n ])\n\n const kinematicModel: KinematicModel =\n await nova.api.motionGroupModels.getMotionGroupKinematicModel(\n description.motion_group_model,\n )\n\n const tcps = Object.entries(description.tcps || {}).map(([id, tcp]) => ({\n id,\n readable_name: tcp.name,\n position: tcp.pose.position as Vector3Simple,\n orientation: tcp.pose.orientation as Vector3Simple,\n }))\n\n return new JoggingStore(\n jogger,\n coordinatesystems || [],\n description,\n tcps,\n kinematicModel.inverse_solver,\n )\n }\n\n constructor(\n readonly jogger: JoggerConnection,\n readonly coordSystems: CoordinateSystem[],\n readonly motionGroupDescription: MotionGroupDescription,\n readonly tcps: RobotTcp[],\n readonly inverseSolverValue: string | null | undefined,\n ) {\n // TODO workaround for default coord system on backend having a canonical id\n // of empty string. Can remove when fixed on API side\n for (const cs of coordSystems) {\n if (cs.coordinate_system === \"\") {\n cs.coordinate_system = \"world\"\n break\n }\n }\n this.selectedCoordSystemId = coordSystems[0]?.coordinate_system || \"world\"\n this.selectedTcpId = tcps[0]?.id || \"\"\n this.inverseSolver = inverseSolverValue\n this.jointType =\n motionGroupDescription?.dh_parameters?.[0]?.type ??\n JointTypeEnum.RevoluteJoint\n\n // Make all properties observable and actions auto-bound\n makeAutoObservable(this, {}, { autoBind: true })\n\n // Register blocked watching\n this.jogger.onBlocked = () => {\n this.block()\n }\n\n // Load user settings from local storage if available\n this.loadFromLocalStorage()\n\n // Automatically save user settings to local storage when save changes\n this.disposers.push(autorun(() => this.saveToLocalStorage()))\n\n // Assign joggingStore to window\n // biome-ignore lint/suspicious/noExplicitAny: pre-biome code\n ;(window as any).joggingStore = this\n }\n\n dispose() {\n for (const dispose of this.disposers) {\n dispose()\n }\n this.jogger.dispose()\n }\n\n get coordSystemCountByName() {\n return countBy(this.coordSystems, (cs) => cs.name)\n }\n\n async deactivate() {\n if (this.jogger.mode === \"jogging\") {\n return this.jogger.stop()\n }\n }\n\n /** Activate the jogger with current settings */\n async activate() {\n if (this.currentTab.id === \"cartesian\") {\n if (\n this.jogger.tcp !== this.selectedTcpId ||\n this.jogger.orientation !== this.selectedOrientation\n ) {\n this.jogger.setOptions({\n tcp: this.selectedTcpId,\n orientation: this.selectedOrientation as JoggerOrientation,\n })\n }\n\n if (this.activeDiscreteIncrement) {\n this.jogger.setJoggingMode(\"trajectory\")\n } else {\n this.jogger.setJoggingMode(\"jogging\")\n }\n } else {\n this.jogger.setJoggingMode(\"jogging\")\n }\n\n return this.jogger\n }\n\n loadFromLocalStorage() {\n const save = tryParseJson(localStorage.getItem(\"joggingToolStore\"))\n if (!save) return\n\n if (this.tabsById[save.selectedTabId]) {\n this.selectedTabId = save.selectedTabId\n }\n\n if (this.coordSystemsById[save.selectedCoordSystemId]) {\n this.selectedCoordSystemId = save.selectedCoordSystemId\n }\n\n if (this.tcpsById[save.selectedTcpId]) {\n this.selectedTcpId = save.selectedTcpId\n }\n\n if (this.incrementOptionsById[save.selectedIncrementId]) {\n this.selectedIncrementId = save.selectedIncrementId\n }\n\n if ([\"translate\", \"rotate\"].includes(save.selectedCartesianMotionType)) {\n this.selectedCartesianMotionType = save.selectedCartesianMotionType\n }\n\n if ([\"coordsys\", \"tool\"].includes(save.selectedOrientation)) {\n this.selectedOrientation = save.selectedOrientation\n }\n }\n\n saveToLocalStorage() {\n localStorage.setItem(\n \"joggingToolStore\",\n JSON.stringify(this.localStorageSave),\n )\n }\n\n get isLocked() {\n return this.locks.size > 0\n }\n\n get localStorageSave() {\n return {\n selectedTabId: this.selectedTabId,\n selectedCoordSystemId: this.selectedCoordSystemId,\n selectedTcpId: this.selectedTcpId,\n selectedOrientation: this.selectedOrientation,\n selectedIncrementId: this.selectedIncrementId,\n selectedCartesianMotionType: this.selectedCartesianMotionType,\n }\n }\n\n get tabs() {\n const tempTabs: { id: TabType; label: string }[] = [\n {\n id: \"joint\",\n label: \"Joints\",\n },\n ]\n // show the cartesian tab only : 1. when there is a solver or 2. when no solver could be loaded ( as a default )\n // do not show the cartesian tab when the solver is null this means, it cannot get jogged cartesian\n if (this.inverseSolver !== null) {\n tempTabs.unshift({\n id: \"cartesian\",\n label: \"Cartesian\",\n })\n }\n\n return tempTabs\n }\n\n get incrementOptions() {\n return incrementOptions\n }\n\n get discreteIncrementOptions() {\n return discreteIncrementOptions\n }\n\n get incrementOptionsById() {\n return keyBy(this.incrementOptions, (o) => o.id)\n }\n\n get tabsById() {\n return keyBy(this.tabs, (t) => t.id)\n }\n\n get currentTab() {\n // biome-ignore lint/style/noNonNullAssertion: pre-biome code\n return this.tabsById[this.selectedTabId] || this.tabs[0]!\n }\n\n get tabIndex() {\n return this.tabs.indexOf(this.currentTab)\n }\n\n get coordSystemsById() {\n return keyBy(this.coordSystems, (cs) => cs.coordinate_system)\n }\n\n /**\n * The id of the coordinate system to use for jogging.\n * If in tool orientation, this is set to \"tool\", not the\n * selected coordinate system.\n */\n get activeCoordSystemId() {\n return this.selectedOrientation === \"tool\"\n ? \"tool\"\n : this.selectedCoordSystemId\n }\n\n get tcpsById() {\n return keyBy(this.tcps, (tcp) => tcp.id)\n }\n\n get activeDiscreteIncrement() {\n return this.selectedOrientation === \"tool\"\n ? undefined\n : discreteIncrementOptions.find((d) => d.id === this.selectedIncrementId)\n }\n\n /** The selected rotation velocity converted to radians per second */\n get rotationVelocityRadsPerSec() {\n return (this.rotationVelocityDegPerSec * Math.PI) / 180\n }\n\n /** Selected velocity in mm/sec or deg/sec */\n velocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.rotationVelocityDegPerSec\n : this.translationVelocityMmPerSec\n }\n\n /** Minimum selectable velocity in mm/sec or deg/sec */\n minVelocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.minRotationVelocityDegPerSec\n : this.minTranslationVelocityMmPerSec\n }\n\n /** Maximum selectable velocity in mm/sec or deg/sec */\n maxVelocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.maxRotationVelocityDegPerSec\n : this.maxTranslationVelocityMmPerSec\n }\n\n onTabChange(_event: React.SyntheticEvent, newValue: number) {\n // biome-ignore lint/style/noNonNullAssertion: pre-biome code\n const tab = this.tabs[newValue] || this.tabs[0]!\n this.selectedTabId = tab.id\n }\n\n setSelectedCoordSystemId(id: string) {\n this.selectedCoordSystemId = id\n }\n\n setSelectedTcpId(id: string) {\n this.selectedTcpId = id\n }\n\n setSelectedOrientation(orientation: OrientationId) {\n this.selectedOrientation = orientation\n }\n\n setSelectedIncrementId(id: IncrementOptionId) {\n this.selectedIncrementId = id\n }\n\n setCurrentIncrementJog(incrementJog: IncrementJogInProgress | null) {\n this.incrementJogInProgress = incrementJog\n }\n\n setVelocityFromSlider(velocity: number, useDegree: boolean) {\n if (useDegree) {\n this.rotationVelocityDegPerSec = velocity\n } else {\n this.translationVelocityMmPerSec = velocity\n }\n }\n\n setSelectedCartesianMotionType(type: CartesianMotionType) {\n this.selectedCartesianMotionType = type\n }\n\n lock(id: string) {\n this.locks.add(id)\n }\n\n unlock(id: string) {\n this.locks.delete(id)\n }\n\n block() {\n this.blocked = true\n }\n\n unblock() {\n this.blocked = false\n if (this.jogger.mode === \"jogging\") {\n this.jogger.initializeJoggingWebsocket()\n }\n }\n\n /** Lock the UI until the given async callback resolves */\n async withMotionLock(fn: () => Promise<void>) {\n const lockId = uniqueId()\n this.lock(lockId)\n\n try {\n return await fn()\n } finally {\n this.unlock(lockId)\n }\n }\n}\n\nexport default JoggingStore\n"],"names":["discreteIncrementOptions","incrementOptions","ORIENTATION_IDS","JoggingStore","jogger","coordSystems","motionGroupDescription","tcps","inverseSolverValue","JointTypeEnum","cs","_a","_b","_d","_c","makeAutoObservable","autorun","nova","coordinatesystems","description","kinematicModel","id","tcp","dispose","countBy","save","tryParseJson","tempTabs","keyBy","o","t","d","useDegree","_event","newValue","tab","orientation","incrementJog","velocity","type","fn","lockId","uniqueId"],"mappings":";;;;;;AAkBA,MAAMA,IAA2B;AAAA,EAC/B,EAAE,IAAI,OAAO,IAAI,KAAK,SAAS,KAAA;AAAA,EAC/B,EAAE,IAAI,KAAK,IAAI,GAAG,SAAS,IAAA;AAAA,EAC3B,EAAE,IAAI,KAAK,IAAI,GAAG,SAAS,IAAA;AAAA,EAC3B,EAAE,IAAI,MAAM,IAAI,IAAI,SAAS,EAAA;AAC/B,GAEMC,IAAmB;AAAA,EACvB,EAAE,IAAI,aAAA;AAAA,EACN,GAAGD;AACL,GAQaE,IAAkB,CAAC,YAAY,MAAM;AAW3C,MAAMC,EAAa;AAAA,EA0IxB,YACWC,GACAC,GACAC,GACAC,GACAC,GACT;;AALS,SAAA,SAAAJ,GACA,KAAA,eAAAC,GACA,KAAA,yBAAAC,GACA,KAAA,OAAAC,GACA,KAAA,qBAAAC,GA9IX,KAAA,gBAAyB,aAGzB,KAAA,4BAAY,IAAA,GAGZ,KAAA,UAAmB,IAKnB,KAAA,wBAAgC,SAGhC,KAAA,gBAAwB,IAOxB,KAAA,sBAAqC,YAOrC,KAAA,sBAAyC,cAMzC,KAAA,8BAAmD,aAMnD,KAAA,yBAAwD,MAGxD,KAAA,8BAAsC,I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,EAC/B;AAAA,EAEA,iBAAiBA,GAAY;AAC3B,SAAK,gBAAgBA;AAAA,EACvB;AAAA,EAEA,uBAAuBe,GAA4B;AACjD,SAAK,sBAAsBA;AAAA,EAC7B;AAAA,EAEA,uBAAuBf,GAAuB;AAC5C,SAAK,sBAAsBA;AAAA,EAC7B;AAAA,EAEA,uBAAuBgB,GAA6C;AAClE,SAAK,yBAAyBA;AAAA,EAChC;AAAA,EAEA,sBAAsBC,GAAkBN,GAAoB;AAC1D,IAAIA,IACF,KAAK,4BAA4BM,IAEjC,KAAK,8BAA8BA;AAAA,EAEvC;AAAA,EAEA,+BAA+BC,GAA2B;AACxD,SAAK,8BAA8BA;AAAA,EACrC;AAAA,EAEA,KAAKlB,GAAY;AACf,SAAK,MAAM,IAAIA,CAAE;AAAA,EACnB;AAAA,EAEA,OAAOA,GAAY;AACjB,SAAK,MAAM,OAAOA,CAAE;AAAA,EACtB;AAAA,EAEA,QAAQ;AACN,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,UAAU;AACR,SAAK,UAAU,IACX,KAAK,OAAO,SAAS,aACvB,KAAK,OAAO,2BAAA;AAAA,EAEhB;AAAA;AAAA,EAGA,MAAM,eAAemB,GAAyB;AAC5C,UAAMC,IAASC,EAAA;AACf,SAAK,KAAKD,CAAM;AAEhB,QAAI;AACF,aAAO,MAAMD,EAAA;AAAA,IACf,UAAA;AACE,WAAK,OAAOC,CAAM;AAAA,IACpB;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"JoggingStore.js","sources":["../../../src/components/jogging/JoggingStore.ts"],"sourcesContent":["import { tryParseJson } from \"@wandelbots/nova-js\"\nimport {\n JointTypeEnum,\n type CoordinateSystem,\n type KinematicModel,\n type MotionGroupDescription,\n type RobotTcp,\n} from \"@wandelbots/nova-js/v2\"\nimport { countBy } from \"lodash-es\"\nimport keyBy from \"lodash-es/keyBy\"\nimport uniqueId from \"lodash-es/uniqueId\"\nimport { autorun, makeAutoObservable, type IReactionDisposer } from \"mobx\"\nimport type {\n JoggerConnection,\n JoggerOrientation,\n Vector3Simple,\n} from \"../../lib/JoggerConnection\"\n\nconst discreteIncrementOptions = [\n { id: \"0.1\", mm: 0.1, degrees: 0.05 },\n { id: \"1\", mm: 1, degrees: 0.5 },\n { id: \"5\", mm: 5, degrees: 2.5 },\n { id: \"10\", mm: 10, degrees: 5 },\n]\n\nconst incrementOptions = [\n { id: \"continuous\" },\n ...discreteIncrementOptions,\n] as const\n\nexport type JoggingAxis = \"x\" | \"y\" | \"z\"\nexport type JoggingDirection = \"+\" | \"-\"\nexport type DiscreteIncrementOption = (typeof discreteIncrementOptions)[number]\nexport type IncrementOption = (typeof incrementOptions)[number]\nexport type IncrementOptionId = IncrementOption[\"id\"]\n\nexport const ORIENTATION_IDS = [\"coordsys\", \"tool\"]\nexport type OrientationId = (typeof ORIENTATION_IDS)[number]\n\nexport type IncrementJogInProgress = {\n direction: JoggingDirection\n axis: JoggingAxis\n}\n\ntype TabType = \"cartesian\" | \"joint\" | \"debug\"\nexport type CartesianMotionType = \"translate\" | \"rotate\"\n\nexport class JoggingStore {\n selectedTabId: TabType = \"cartesian\"\n\n /** Locks to prevent UI interactions during certain operations */\n locks = new Set<string>()\n\n /** Block jogging UI interactions when connection is taken by another jogger */\n blocked: boolean = false\n\n /**\n * Id of selected coordinate system from among those defined on the API side\n */\n selectedCoordSystemId: string = \"world\"\n\n /** Id of selected tool center point from among the options available on the robot */\n selectedTcpId: string = \"\"\n\n /**\n * Whether the user is jogging in the coordinate system or tool orientation.\n * When in tool orientation, the robot moves in a direction relative to the\n * attached tool rotation.\n */\n selectedOrientation: OrientationId = \"coordsys\"\n\n /**\n * Id of selected increment amount for jogging. Options are defined by robot pad.\n * When non-continuous, jogging moves the robot by a fixed number of mm or degrees\n * each time the button is pressed, for extra precision\n */\n selectedIncrementId: IncrementOptionId = \"continuous\"\n\n /**\n * When on the cartesian tab, jogging can be either translating or rotating\n * around the TCP.\n */\n selectedCartesianMotionType: CartesianMotionType = \"translate\"\n\n /**\n * If the jogger is busy running an incremental jog, this will be set\n * with the information about the motion\n */\n incrementJogInProgress: IncrementJogInProgress | null = null\n\n /** How fast the robot goes when doing cartesian translate jogging in mm/s */\n translationVelocityMmPerSec: number = 10\n /** How fast the robot goes when doing cartesian or joint rotation jogging in °/s */\n rotationVelocityDegPerSec: number = 1\n\n /** Minimum translation velocity user can choose on the velocity slider in °/s */\n minTranslationVelocityMmPerSec: number = 5\n /** Maximum translation velocity user can choose on the velocity slider in °/s */\n maxTranslationVelocityMmPerSec: number = 250\n\n /** Minimum rotation velocity user can choose on the velocity slider in °/s */\n minRotationVelocityDegPerSec: number = 1\n /** Maximum rotation velocity user can choose on the velocity slider in °/s */\n maxRotationVelocityDegPerSec: number = 60\n\n /** Whether to show the coordinate system select dropdown in the UI */\n showCoordSystemSelect: boolean = false\n\n /** Whether to show the TCP select dropdown in the UI */\n showTcpSelect: boolean = true\n\n /** Whether to show the orientation select dropdown in the UI */\n showOrientationSelect: boolean = true\n\n /** Whether to show the increment select dropdown in the UI */\n showIncrementSelect: boolean = true\n\n /** Whether to show icons in the jogging tabs */\n showTabIcons: boolean = false\n\n /** Whether to show the label to the right of the velocity slider */\n showVelocitySliderLabel: boolean = true\n\n /** Whether to show the legend before the slider */\n showVelocityLegend: boolean = false\n\n /** Whether to show the legend before the joints */\n showJointsLegend: boolean = false\n\n disposers: IReactionDisposer[] = []\n\n /**\n * Inverse solver from the kinematic model of the motion group to determine, which tabs should be rendered\n */\n inverseSolver: string | null | undefined = undefined\n\n /**\n * Joint type to determine, whether the active robot should be displayed as Robot or Linear Axis and what tabs\n * should be rendered by the JoggingPanel component.\n */\n jointType: JointTypeEnum = JointTypeEnum.RevoluteJoint\n\n /**\n * Load a jogging store with the relevant data it needs\n * from the backend\n */\n static async loadFor(jogger: JoggerConnection) {\n const { nova } = jogger\n\n // Find out what TCPs this motion group has (we need it for jogging)\n const [coordinatesystems, description] = await Promise.all([\n // Fetch coord systems so user can select between them\n nova.api.controller.listCoordinateSystems(\n jogger.motionStream.controllerId,\n \"ROTATION_VECTOR\",\n ),\n\n // Same for TCPs and other info from description\n nova.api.motionGroup.getMotionGroupDescription(\n jogger.motionStream.controllerId,\n jogger.motionGroupId,\n ),\n ])\n\n const kinematicModel: KinematicModel =\n await nova.api.motionGroupModels.getMotionGroupKinematicModel(\n description.motion_group_model,\n )\n\n const tcps = Object.entries(description.tcps || {}).map(([id, tcp]) => ({\n id,\n readable_name: tcp.name,\n position: tcp.pose.position as Vector3Simple,\n orientation: tcp.pose.orientation as Vector3Simple,\n }))\n\n return new JoggingStore(\n jogger,\n coordinatesystems || [],\n description,\n tcps,\n kinematicModel.inverse_solver,\n )\n }\n\n constructor(\n readonly jogger: JoggerConnection,\n readonly coordSystems: CoordinateSystem[],\n readonly motionGroupDescription: MotionGroupDescription,\n readonly tcps: RobotTcp[],\n readonly inverseSolverValue: string | null | undefined,\n ) {\n // TODO workaround for default coord system on backend having a canonical id\n // of empty string. Can remove when fixed on API side\n for (const cs of coordSystems) {\n if (cs.coordinate_system === \"\") {\n cs.coordinate_system = \"world\"\n break\n }\n }\n this.selectedCoordSystemId = coordSystems[0]?.coordinate_system || \"world\"\n this.selectedTcpId = tcps[0]?.id || \"\"\n this.inverseSolver = inverseSolverValue\n this.jointType =\n motionGroupDescription?.dh_parameters?.[0]?.type ??\n JointTypeEnum.RevoluteJoint\n\n // Make all properties observable and actions auto-bound\n makeAutoObservable(this, {}, { autoBind: true })\n\n // Register blocked watching\n this.jogger.onBlocked = () => {\n this.block()\n }\n\n // Load user settings from local storage if available\n this.loadFromLocalStorage()\n\n // Automatically save user settings to local storage when save changes\n this.disposers.push(autorun(() => this.saveToLocalStorage()))\n\n // Assign joggingStore to window\n // biome-ignore lint/suspicious/noExplicitAny: pre-biome code\n ;(window as any).joggingStore = this\n }\n\n dispose() {\n for (const dispose of this.disposers) {\n dispose()\n }\n this.jogger.dispose()\n }\n\n get coordSystemCountByName() {\n return countBy(this.coordSystems, (cs) => cs.name)\n }\n\n async deactivate() {\n if (this.jogger.mode === \"jogging\") {\n return this.jogger.stop()\n }\n }\n\n /** Activate the jogger with current settings */\n async activate() {\n if (this.currentTab.id === \"cartesian\") {\n if (\n this.jogger.tcp !== this.selectedTcpId ||\n this.jogger.orientation !== this.selectedOrientation\n ) {\n this.jogger.setOptions({\n tcp: this.selectedTcpId,\n orientation: this.selectedOrientation as JoggerOrientation,\n })\n }\n\n if (this.activeDiscreteIncrement) {\n this.jogger.setJoggingMode(\"trajectory\")\n } else {\n this.jogger.setJoggingMode(\"jogging\")\n }\n } else {\n this.jogger.setJoggingMode(\"jogging\")\n }\n\n return this.jogger\n }\n\n loadFromLocalStorage() {\n const save = tryParseJson(localStorage.getItem(\"joggingToolStore\"))\n if (!save) return\n\n if (this.tabsById[save.selectedTabId]) {\n this.selectedTabId = save.selectedTabId\n }\n\n if (this.coordSystemsById[save.selectedCoordSystemId]) {\n this.selectedCoordSystemId = save.selectedCoordSystemId\n }\n\n if (this.tcpsById[save.selectedTcpId]) {\n this.selectedTcpId = save.selectedTcpId\n }\n\n if (this.incrementOptionsById[save.selectedIncrementId]) {\n this.selectedIncrementId = save.selectedIncrementId\n }\n\n if ([\"translate\", \"rotate\"].includes(save.selectedCartesianMotionType)) {\n this.selectedCartesianMotionType = save.selectedCartesianMotionType\n }\n\n if ([\"coordsys\", \"tool\"].includes(save.selectedOrientation)) {\n this.selectedOrientation = save.selectedOrientation\n }\n }\n\n saveToLocalStorage() {\n localStorage.setItem(\n \"joggingToolStore\",\n JSON.stringify(this.localStorageSave),\n )\n }\n\n get isLocked() {\n return this.locks.size > 0\n }\n\n get localStorageSave() {\n return {\n selectedTabId: this.selectedTabId,\n selectedCoordSystemId: this.selectedCoordSystemId,\n selectedTcpId: this.selectedTcpId,\n selectedOrientation: this.selectedOrientation,\n selectedIncrementId: this.selectedIncrementId,\n selectedCartesianMotionType: this.selectedCartesianMotionType,\n }\n }\n\n get tabs() {\n const tempTabs: { id: TabType; label: string }[] = [\n {\n id: \"joint\",\n label: \"Joints\",\n },\n ]\n // show the cartesian tab only : 1. when there is a solver or 2. when no solver could be loaded ( as a default )\n // do not show the cartesian tab when the solver is null this means, it cannot get jogged cartesian\n if (this.inverseSolver !== null) {\n tempTabs.unshift({\n id: \"cartesian\",\n label: \"Cartesian\",\n })\n }\n\n return tempTabs\n }\n\n get incrementOptions() {\n return incrementOptions\n }\n\n get discreteIncrementOptions() {\n return discreteIncrementOptions\n }\n\n get incrementOptionsById() {\n return keyBy(this.incrementOptions, (o) => o.id)\n }\n\n get tabsById() {\n return keyBy(this.tabs, (t) => t.id)\n }\n\n get currentTab() {\n // biome-ignore lint/style/noNonNullAssertion: pre-biome code\n return this.tabsById[this.selectedTabId] || this.tabs[0]!\n }\n\n get tabIndex() {\n return this.tabs.indexOf(this.currentTab)\n }\n\n get coordSystemsById() {\n return keyBy(this.coordSystems, (cs) => cs.coordinate_system)\n }\n\n /**\n * The id of the coordinate system to use for jogging.\n * If in tool orientation, this is set to \"tool\", not the\n * selected coordinate system.\n */\n get activeCoordSystemId() {\n return this.selectedOrientation === \"tool\"\n ? \"tool\"\n : this.selectedCoordSystemId\n }\n\n get tcpsById() {\n return keyBy(this.tcps, (tcp) => tcp.id)\n }\n\n get activeDiscreteIncrement() {\n return this.selectedOrientation === \"tool\"\n ? undefined\n : discreteIncrementOptions.find((d) => d.id === this.selectedIncrementId)\n }\n\n /** The selected rotation velocity converted to radians per second */\n get rotationVelocityRadsPerSec() {\n return (this.rotationVelocityDegPerSec * Math.PI) / 180\n }\n\n /** Selected velocity in mm/sec or deg/sec */\n velocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.rotationVelocityDegPerSec\n : this.translationVelocityMmPerSec\n }\n\n /** Minimum selectable velocity in mm/sec or deg/sec */\n minVelocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.minRotationVelocityDegPerSec\n : this.minTranslationVelocityMmPerSec\n }\n\n /** Maximum selectable velocity in mm/sec or deg/sec */\n maxVelocityInDisplayUnits(useDegree: boolean) {\n return useDegree\n ? this.maxRotationVelocityDegPerSec\n : this.maxTranslationVelocityMmPerSec\n }\n\n onTabChange(_event: React.SyntheticEvent, newValue: number) {\n // biome-ignore lint/style/noNonNullAssertion: pre-biome code\n const tab = this.tabs[newValue] || this.tabs[0]!\n this.selectedTabId = tab.id\n }\n\n setSelectedCoordSystemId(id: string) {\n this.selectedCoordSystemId = id\n }\n\n setSelectedTcpId(id: string) {\n this.selectedTcpId = id\n }\n\n setSelectedOrientation(orientation: OrientationId) {\n this.selectedOrientation = orientation\n }\n\n setSelectedIncrementId(id: IncrementOptionId) {\n this.selectedIncrementId = id\n }\n\n setCurrentIncrementJog(incrementJog: IncrementJogInProgress | null) {\n this.incrementJogInProgress = incrementJog\n }\n\n setVelocityFromSlider(velocity: number, useDegree: boolean) {\n if (useDegree) {\n this.rotationVelocityDegPerSec = velocity\n } else {\n this.translationVelocityMmPerSec = velocity\n }\n }\n\n setSelectedCartesianMotionType(type: CartesianMotionType) {\n this.selectedCartesianMotionType = type\n }\n\n lock(id: string) {\n this.locks.add(id)\n }\n\n unlock(id: string) {\n this.locks.delete(id)\n }\n\n block() {\n this.blocked = true\n }\n\n unblock() {\n this.blocked = false\n if (this.jogger.mode === \"jogging\") {\n this.jogger.initializeJoggingWebsocket()\n }\n }\n\n /** Lock the UI until the given async callback resolves */\n async withMotionLock(fn: () => Promise<void>) {\n const lockId = uniqueId()\n this.lock(lockId)\n\n try {\n return await fn()\n } finally {\n this.unlock(lockId)\n }\n }\n}\n\nexport default JoggingStore\n"],"names":["discreteIncrementOptions","incrementOptions","ORIENTATION_IDS","JoggingStore","jogger","coordSystems","motionGroupDescription","tcps","inverseSolverValue","JointTypeEnum","cs","_a","_b","_d","_c","makeAutoObservable","autorun","nova","coordinatesystems","description","kinematicModel","id","tcp","dispose","countBy","save","tryParseJson","tempTabs","keyBy","o","t","d","useDegree","_event","newValue","tab","orientation","incrementJog","velocity","type","fn","lockId","uni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,IAAIA,CAAE;AAAA,EACnB;AAAA,EAEA,OAAOA,GAAY;AACjB,SAAK,MAAM,OAAOA,CAAE;AAAA,EACtB;AAAA,EAEA,QAAQ;AACN,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,UAAU;AACR,SAAK,UAAU,IACX,KAAK,OAAO,SAAS,aACvB,KAAK,OAAO,2BAAA;AAAA,EAEhB;AAAA;AAAA,EAGA,MAAM,eAAemB,GAAyB;AAC5C,UAAMC,IAASC,EAAA;AACf,SAAK,KAAKD,CAAM;AAEhB,QAAI;AACF,aAAO,MAAMD,EAAA;AAAA,IACf,UAAA;AACE,WAAK,OAAOC,CAAM;AAAA,IACpB;AAAA,EACF;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "5.5.0-pr.fix-esm-extensions.590.0a9a3ff",
3
+ "version": "5.5.0",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,8 +1,8 @@
1
1
  // TODO implement this as part of theme?
2
2
 
3
- import Select from "@mui/material/Select"
4
3
  import { useTheme, type SxProps } from "@mui/material/styles"
5
- import defaultsDeep from "lodash-es/defaultsDeep.js"
4
+ import Select from "@mui/material/Select"
5
+ import defaultsDeep from "lodash-es/defaultsDeep"
6
6
 
7
7
  type ThemeSelectProps = {
8
8
  kind: "filled" | "outlined" | "text"
@@ -1,8 +1,8 @@
1
- import Slider from "@mui/material/Slider"
2
- import Stack from "@mui/material/Stack"
3
1
  import { useTheme, type SxProps } from "@mui/material/styles"
2
+ import Stack from "@mui/material/Stack"
4
3
  import Typography from "@mui/material/Typography"
5
- import isNumber from "lodash-es/isNumber.js"
4
+ import Slider from "@mui/material/Slider"
5
+ import isNumber from "lodash-es/isNumber"
6
6
  import { observer } from "mobx-react-lite"
7
7
  import type { ReactNode } from "react"
8
8
  import { useTranslation } from "react-i18next"
@@ -1,6 +1,6 @@
1
1
  import Typography from "@mui/material/Typography"
2
- import isEqual from "lodash-es/isEqual.js"
3
2
  import { observer } from "mobx-react-lite"
3
+ import isEqual from "lodash-es/isEqual"
4
4
  import { useRef, useState } from "react"
5
5
  import { useTranslation } from "react-i18next"
6
6
  import { useAnimationFrame } from "../utils/hooks"
@@ -1,12 +1,12 @@
1
1
  import ChevronLeft from "@mui/icons-material/ChevronLeft"
2
2
  import ChevronRight from "@mui/icons-material/ChevronRight"
3
+ import { useTheme } from "@mui/material/styles"
3
4
  import IconButton from "@mui/material/IconButton"
4
5
  import Slider from "@mui/material/Slider"
5
- import Stack from "@mui/material/Stack"
6
- import { useTheme } from "@mui/material/styles"
7
6
  import Typography from "@mui/material/Typography"
7
+ import Stack from "@mui/material/Stack"
8
8
  import { radiansToDegrees } from "@wandelbots/nova-js"
9
- import throttle from "lodash-es/throttle.js"
9
+ import throttle from "lodash-es/throttle"
10
10
  import { observer, useLocalObservable } from "mobx-react-lite"
11
11
  import { useState } from "react"
12
12
  import { useTranslation } from "react-i18next"
@@ -7,8 +7,8 @@ import {
7
7
  type RobotTcp,
8
8
  } from "@wandelbots/nova-js/v2"
9
9
  import { countBy } from "lodash-es"
10
- import keyBy from "lodash-es/keyBy.js"
11
- import uniqueId from "lodash-es/uniqueId.js"
10
+ import keyBy from "lodash-es/keyBy"
11
+ import uniqueId from "lodash-es/uniqueId"
12
12
  import { autorun, makeAutoObservable, type IReactionDisposer } from "mobx"
13
13
  import type {
14
14
  JoggerConnection,
@@ -212,33 +212,6 @@ describe("CJS interop", () => {
212
212
  expect(Object.keys(cjs).sort()).toEqual(Object.keys(esm).sort())
213
213
  })
214
214
 
215
- // Regression test: Vitest's `await import()` goes through Vite's lenient
216
- // resolver, which happily accepts extensionless ESM specifiers like
217
- // `lodash-es/throttle`. Real downstream consumers hit Node's strict ESM
218
- // resolver, which requires `.js`. Spawn a real Node process so the whole
219
- // dependency graph (including transitive imports from dist/) is exercised
220
- // under strict resolution.
221
- it.each([
222
- "components/DataGrid",
223
- "components/VelocitySlider",
224
- "components/jogging/JoggingPanel",
225
- "components/jogging/JoggingJointValueControl",
226
- "components/jogging/JoggingJointLimitDetector",
227
- "components/jogging/JoggingStore",
228
- ])("Node strict ESM can import %s and its transitive deps", (sub) => {
229
- // Redirect stderr to stdout so the assertion message surfaces any
230
- // "Cannot find module" errors from the child process.
231
- execFileSync(
232
- process.execPath,
233
- [
234
- "--input-type=module",
235
- "-e",
236
- `await import(${JSON.stringify(`${pkgName}/${sub}`)})`,
237
- ],
238
- { cwd: sandbox, stdio: "pipe", encoding: "utf8" },
239
- )
240
- })
241
-
242
215
  it('Node can load the CJS output under `"type": "module"`', () => {
243
216
  // Sanity check that `.cjs` extension was emitted (not `.cjs.js`) so
244
217
  // that Node's CJS loader accepts it despite the package being ESM.