@wandelbots/wandelbots-js-react-components 4.0.1 → 4.0.2

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.
@@ -1,16 +1,16 @@
1
1
  import { j as t, e as K } from "./externalizeComponent-Dc3fViZA.js";
2
2
  import * as m from "three";
3
- import { Matrix4 as I, Vector3 as E, Quaternion as ie } from "three";
3
+ import { Matrix4 as F, Vector3 as E, Quaternion as ie } from "three";
4
4
  import { ConvexGeometry as X } from "three-stdlib";
5
5
  import { useThree as ae, useFrame as le, Canvas as B } from "@react-three/fiber";
6
6
  import { Environment as ce, Lightformer as R, Line as Z, useGLTF as ue, Bounds as W } from "@react-three/drei";
7
7
  import { useTheme as fe, Card as de, Box as y, Typography as $, Divider as N, Button as H } from "@mui/material";
8
8
  import { observer as he } from "mobx-react-lite";
9
- import me, { useRef as v, useEffect as F, useState as _, useCallback as G, Suspense as pe } from "react";
9
+ import me, { useRef as _, useEffect as I, useCallback as v, useState as G, Suspense as pe } from "react";
10
10
  import { useTranslation as xe } from "react-i18next";
11
- import { N as ge, V as ye, c as je, b as J, M as j } from "./interpolation-DcPbemBD.js";
12
- import { ErrorBoundary as we } from "react-error-boundary";
13
- function be(e) {
11
+ import { N as ge, V as ye, b as J, M as j } from "./interpolation-CZsbXLpo.js";
12
+ import { ErrorBoundary as je } from "react-error-boundary";
13
+ function we(e) {
14
14
  switch (e.shape_type) {
15
15
  case "convex_hull":
16
16
  return new X(
@@ -47,7 +47,7 @@ function be(e) {
47
47
  return console.warn(`${e.shape_type} is not supported`), new m.BufferGeometry();
48
48
  }
49
49
  }
50
- function Me({
50
+ function be({
51
51
  name: e,
52
52
  collider: n,
53
53
  children: r
@@ -64,19 +64,19 @@ function Me({
64
64
  s[2]
65
65
  ).divideScalar(1e3),
66
66
  rotation: new m.Euler(o[0], o[1], o[2], "XYZ"),
67
- geometry: be(n.shape),
67
+ geometry: we(n.shape),
68
68
  children: r
69
69
  }
70
70
  );
71
71
  }
72
- function Re({
72
+ function Me({
73
73
  name: e,
74
74
  colliders: n,
75
75
  meshChildrenProvider: r,
76
76
  ...s
77
77
  }) {
78
78
  return /* @__PURE__ */ t.jsx("group", { name: e, ...s, children: Object.entries(n).map(([o, c]) => /* @__PURE__ */ t.jsx(
79
- Me,
79
+ be,
80
80
  {
81
81
  name: o,
82
82
  collider: c,
@@ -85,13 +85,13 @@ function Re({
85
85
  o
86
86
  )) });
87
87
  }
88
- function Qe({
88
+ function Ze({
89
89
  scene: e,
90
90
  meshChildrenProvider: n
91
91
  }) {
92
92
  const r = e.colliders;
93
93
  return /* @__PURE__ */ t.jsx("group", { children: r && /* @__PURE__ */ t.jsx(
94
- Re,
94
+ Me,
95
95
  {
96
96
  meshChildrenProvider: n,
97
97
  colliders: r
@@ -99,9 +99,9 @@ function Qe({
99
99
  ) });
100
100
  }
101
101
  function Y() {
102
- return /* @__PURE__ */ t.jsx(ce, { children: /* @__PURE__ */ t.jsx(ve, {}) });
102
+ return /* @__PURE__ */ t.jsx(ce, { children: /* @__PURE__ */ t.jsx(Re, {}) });
103
103
  }
104
- function ve({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
104
+ function Re({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
105
105
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
106
106
  /* @__PURE__ */ t.jsx(
107
107
  R,
@@ -172,7 +172,7 @@ function ve({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
172
172
  )
173
173
  ] });
174
174
  }
175
- function _e(e) {
175
+ function ve(e) {
176
176
  if (e.length < 3)
177
177
  return console.log("Not enough vertices to define a plane"), { isCoplanar: !1 };
178
178
  const n = new m.Vector3(e[0].x, e[0].y, e[0].z), r = new m.Vector3(e[1].x, e[1].y, e[1].z), s = new m.Vector3(e[2].x, e[2].y, e[2].z), o = new m.Vector3().subVectors(r, n), c = new m.Vector3().subVectors(s, n), a = new m.Vector3().crossVectors(o, c).normalize();
@@ -183,7 +183,7 @@ function _e(e) {
183
183
  }
184
184
  return { isCoplanar: !0, normal: a };
185
185
  }
186
- function et({
186
+ function Qe({
187
187
  safetyZones: e,
188
188
  ...n
189
189
  }) {
@@ -193,7 +193,7 @@ function et({
193
193
  if (!c.convex_hull) return null;
194
194
  const f = c.convex_hull.vertices.map(
195
195
  (h) => new m.Vector3(h.x / 1e3, h.y / 1e3, h.z / 1e3)
196
- ), i = _e(f);
196
+ ), i = ve(f);
197
197
  if (i.isCoplanar && i.normal) {
198
198
  const l = new m.Vector3().addVectors(
199
199
  f[0],
@@ -224,7 +224,7 @@ function et({
224
224
  });
225
225
  }) });
226
226
  }
227
- function tt({
227
+ function et({
228
228
  trajectory: e,
229
229
  ...n
230
230
  }) {
@@ -265,7 +265,7 @@ async function Q(e) {
265
265
  })();
266
266
  return D.set(e, n), n;
267
267
  }
268
- function Ge(e) {
268
+ function _e(e) {
269
269
  function n(r) {
270
270
  return r.children.length === 0 ? [r] : [r, ...r.children.flatMap((s) => n(s))];
271
271
  }
@@ -277,7 +277,7 @@ function ee(e) {
277
277
  function te(e) {
278
278
  return /_J[0-9]+$/.test(e.name);
279
279
  }
280
- function Ie(e, n) {
280
+ function Ge(e, n) {
281
281
  let r;
282
282
  function s(o) {
283
283
  if (ee(o)) {
@@ -301,8 +301,8 @@ function re({
301
301
  onRotationChanged: r,
302
302
  children: s
303
303
  }) {
304
- const o = v([]), c = v([]), a = v(null), { invalidate: f } = ae();
305
- F(() => {
304
+ const o = _([]), c = _([]), a = _(null), { invalidate: f } = ae();
305
+ I(() => {
306
306
  const l = e.joint_position.filter(
307
307
  (u) => u !== void 0
308
308
  );
@@ -319,17 +319,13 @@ function re({
319
319
  }, []), le((l, u) => {
320
320
  if (a.current) {
321
321
  const p = a.current.update(u);
322
- h(), p || f();
322
+ d(), p || f();
323
323
  }
324
324
  });
325
325
  function i(l) {
326
- l && (c.current = Ge(l), h(), f());
326
+ l && (c.current = _e(l), d(), f());
327
327
  }
328
- function d(l) {
329
- var u;
330
- o.current = l, (u = a.current) == null || u.setTarget(l);
331
- }
332
- function h() {
328
+ function d() {
333
329
  var u;
334
330
  const l = ((u = a.current) == null ? void 0 : u.getCurrentValues()) || [];
335
331
  if (r)
@@ -340,29 +336,35 @@ function re({
340
336
  x.rotation.y = M * (l[p] || 0) + b;
341
337
  }
342
338
  }
343
- return je(() => {
339
+ const h = v(() => {
340
+ var u;
344
341
  const l = e.joint_position.filter(
345
- (u) => u !== void 0
342
+ (p) => p !== void 0
346
343
  );
347
- requestAnimationFrame(() => d(l));
348
- }), /* @__PURE__ */ t.jsx("group", { ref: i, children: s });
344
+ o.current = l, (u = a.current) == null || u.setTarget(l);
345
+ }, [e]);
346
+ return I(() => {
347
+ requestAnimationFrame(() => {
348
+ h();
349
+ });
350
+ }, [e, h]), /* @__PURE__ */ t.jsx("group", { ref: i, children: s });
349
351
  }
350
- const Fe = "line", Se = "mesh";
352
+ const Ie = "line", Fe = "mesh";
351
353
  function Ve({
352
354
  rapidlyChangingMotionState: e,
353
355
  dhParameters: n,
354
356
  ...r
355
357
  }) {
356
- const s = new I(), o = v([]), c = v([]);
358
+ const s = new F(), o = _([]), c = _([]);
357
359
  me.useEffect(() => {
358
360
  o.current = new Array(n.length).fill(null), c.current = new Array(n.length).fill(null);
359
361
  }, [n.length]);
360
362
  function a(d, h) {
361
363
  const l = new E(), u = new ie(), p = new E();
362
364
  s.decompose(l, u, p);
363
- const x = l.clone(), g = new I().makeRotationY(
365
+ const x = l.clone(), g = new F().makeRotationY(
364
366
  d.theta + h * (d.reverse_rotation_direction ? -1 : 1)
365
- ).multiply(new I().makeTranslation(0, d.d / 1e3, 0)).multiply(new I().makeTranslation(d.a / 1e3, 0, 0)).multiply(new I().makeRotationX(d.alpha));
367
+ ).multiply(new F().makeTranslation(0, d.d / 1e3, 0)).multiply(new F().makeTranslation(d.a / 1e3, 0, 0)).multiply(new F().makeRotationX(d.alpha));
366
368
  return s.multiply(g), s.decompose(l, u, p), { a: x, b: l };
367
369
  }
368
370
  function f(d, h, l, u) {
@@ -404,7 +406,7 @@ function Ve({
404
406
  ref: (x) => {
405
407
  o.current[h] = x;
406
408
  },
407
- name: Fe,
409
+ name: Ie,
408
410
  points: [l, u],
409
411
  color: "white",
410
412
  lineWidth: 5
@@ -416,7 +418,7 @@ function Ve({
416
418
  ref: (x) => {
417
419
  c.current[h] = x;
418
420
  },
419
- name: Se,
421
+ name: Fe,
420
422
  position: u,
421
423
  children: [
422
424
  /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
@@ -431,18 +433,18 @@ function Ve({
431
433
  }
432
434
  ) });
433
435
  }
434
- const Ce = console.warn;
435
- function Le() {
436
- return F(() => {
436
+ const Le = console.warn;
437
+ function Se() {
438
+ return I(() => {
437
439
  console.warn = (e) => {
438
- e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Ce(e);
440
+ e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Le(e);
439
441
  };
440
442
  }, []), /* @__PURE__ */ t.jsx(t.Fragment, {});
441
443
  }
442
444
  function Te(e) {
443
445
  return e.type === "Mesh";
444
446
  }
445
- function De({
447
+ function Ce({
446
448
  url: e,
447
449
  flangeRef: n,
448
450
  postModelRender: r,
@@ -451,11 +453,11 @@ function De({
451
453
  const o = ue(e);
452
454
  let c;
453
455
  try {
454
- c = Ie(o, "robot.glb").gltf;
456
+ c = Ge(o, "robot.glb").gltf;
455
457
  } catch (i) {
456
458
  throw i;
457
459
  }
458
- const a = G(
460
+ const a = v(
459
461
  (i) => {
460
462
  i && r && r();
461
463
  },
@@ -490,14 +492,14 @@ function De({
490
492
  }
491
493
  return /* @__PURE__ */ t.jsx("group", { ...s, dispose: null, ref: a, children: f(c.scene) });
492
494
  }
493
- function ke({
495
+ function De({
494
496
  modelURL: e,
495
497
  flangeRef: n,
496
498
  postModelRender: r,
497
499
  ...s
498
500
  }) {
499
- const [o, c] = _(null);
500
- return F(() => {
501
+ const [o, c] = G(null);
502
+ return I(() => {
501
503
  (async () => {
502
504
  try {
503
505
  if (typeof e == "string")
@@ -511,7 +513,7 @@ function ke({
511
513
  }
512
514
  })();
513
515
  }, [e]), o ? /* @__PURE__ */ t.jsx(
514
- De,
516
+ Ce,
515
517
  {
516
518
  url: o,
517
519
  flangeRef: n,
@@ -520,7 +522,7 @@ function ke({
520
522
  }
521
523
  ) : null;
522
524
  }
523
- const Ae = (e, n) => {
525
+ const ke = (e, n) => {
524
526
  e.userData.isGhost || (e.traverse((r) => {
525
527
  if (r instanceof m.Mesh) {
526
528
  r.material instanceof m.Material && (r.material.colorWrite = !1);
@@ -544,7 +546,7 @@ const Ae = (e, n) => {
544
546
  }), o.userData.isGhost = !0, r.parent && (r.parent.add(s), r.parent.add(o));
545
547
  }
546
548
  }), e.userData.isGhost = !0);
547
- }, Pe = (e) => {
549
+ }, Ae = (e) => {
548
550
  if (!e.userData.isGhost) return;
549
551
  const n = [];
550
552
  e.traverse((r) => {
@@ -553,7 +555,7 @@ const Ae = (e, n) => {
553
555
  }), n.forEach((r) => {
554
556
  r.parent && r.parent.remove(r);
555
557
  }), e.userData.isGhost = !1;
556
- }, ze = K(
558
+ }, Pe = K(
557
559
  ({
558
560
  rapidlyChangingMotionState: e,
559
561
  modelFromController: n,
@@ -564,11 +566,11 @@ const Ae = (e, n) => {
564
566
  transparentColor: a,
565
567
  ...f
566
568
  }) => {
567
- const [i, d] = _(null), h = G((u) => {
569
+ const [i, d] = G(null), h = v((u) => {
568
570
  d(u);
569
571
  }, []);
570
- F(() => {
571
- i && (a ? Ae(i, a) : Pe(i));
572
+ I(() => {
573
+ i && (a ? ke(i, a) : Ae(i));
572
574
  }, [i, a]);
573
575
  const l = /* @__PURE__ */ t.jsx(
574
576
  Ve,
@@ -579,7 +581,7 @@ const Ae = (e, n) => {
579
581
  }
580
582
  );
581
583
  return /* @__PURE__ */ t.jsxs(
582
- we,
584
+ je,
583
585
  {
584
586
  fallback: l,
585
587
  onError: (u) => {
@@ -592,7 +594,7 @@ const Ae = (e, n) => {
592
594
  rapidlyChangingMotionState: e,
593
595
  dhParameters: r,
594
596
  children: /* @__PURE__ */ t.jsx(
595
- ke,
597
+ De,
596
598
  {
597
599
  modelURL: (() => {
598
600
  const u = s(n);
@@ -609,13 +611,13 @@ const Ae = (e, n) => {
609
611
  )
610
612
  }
611
613
  ) }) }),
612
- /* @__PURE__ */ t.jsx(Le, {})
614
+ /* @__PURE__ */ t.jsx(Se, {})
613
615
  ]
614
616
  }
615
617
  );
616
618
  }
617
619
  );
618
- function Oe({
620
+ function ze({
619
621
  connectedMotionGroup: e,
620
622
  getModel: n = Q,
621
623
  flangeRef: r,
@@ -624,7 +626,7 @@ function Oe({
624
626
  ...c
625
627
  }) {
626
628
  return e.dhParameters ? /* @__PURE__ */ t.jsx(
627
- ze,
629
+ Pe,
628
630
  {
629
631
  rapidlyChangingMotionState: e.rapidlyChangingMotionState,
630
632
  modelFromController: e.modelFromController || "",
@@ -637,7 +639,7 @@ function Oe({
637
639
  }
638
640
  ) : null;
639
641
  }
640
- const rt = K(
642
+ const tt = K(
641
643
  he(
642
644
  ({
643
645
  robotName: e,
@@ -648,34 +650,34 @@ const rt = K(
648
650
  onDriveToHomePress: c,
649
651
  onDriveToHomeRelease: a,
650
652
  connectedMotionGroup: f,
651
- robotComponent: i = Oe,
653
+ robotComponent: i = ze,
652
654
  customContentComponent: d,
653
655
  className: h
654
656
  }) => {
655
657
  var P;
656
- const l = fe(), { t: u } = xe(), [p, x] = _(!1), g = v(null), b = v(null), [M, ne] = _(!1), [S, oe] = _({ width: 400, height: 600 }), [Ee, se] = _(0);
657
- F(() => {
658
- const T = () => {
658
+ const l = fe(), { t: u } = xe(), [p, x] = G(!1), g = _(null), b = _(null), [M, ne] = G(!1), [V, oe] = G({ width: 400, height: 600 }), [Ue, se] = G(0);
659
+ I(() => {
660
+ const C = () => {
659
661
  if (b.current) {
660
662
  const { offsetWidth: O, offsetHeight: U } = b.current;
661
663
  ne(O > U), oe({ width: O, height: U });
662
664
  }
663
665
  };
664
- T();
665
- const z = new ResizeObserver(T);
666
+ C();
667
+ const z = new ResizeObserver(C);
666
668
  return b.current && z.observe(b.current), () => {
667
669
  z.disconnect();
668
670
  };
669
671
  }, []);
670
- const k = G(() => {
671
- se((T) => T + 1);
672
- }, []), V = G(() => {
672
+ const k = v(() => {
673
+ se((C) => C + 1);
674
+ }, []), L = v(() => {
673
675
  !o || !c || (x(!0), c());
674
- }, [o, c]), C = G(() => {
676
+ }, [o, c]), S = v(() => {
675
677
  !o || !a || (x(!1), a());
676
- }, [o, a]), A = G(() => {
678
+ }, [o, a]), A = v(() => {
677
679
  p && a && (x(!1), a());
678
- }, [p, a]), w = M ? S.width < 350 : S.height < 200, L = M ? S.height < 310 : S.height < 450;
680
+ }, [p, a]), w = M ? V.width < 350 : V.height < 200, T = M ? V.height < 310 : V.height < 450;
679
681
  return /* @__PURE__ */ t.jsx(
680
682
  de,
681
683
  {
@@ -794,7 +796,7 @@ const rt = K(
794
796
  justifyContent: "space-between"
795
797
  },
796
798
  children: [
797
- !L && d && /* @__PURE__ */ t.jsxs(y, { children: [
799
+ !T && d && /* @__PURE__ */ t.jsxs(y, { children: [
798
800
  /* @__PURE__ */ t.jsx(d, {}),
799
801
  /* @__PURE__ */ t.jsx(
800
802
  N,
@@ -812,7 +814,7 @@ const rt = K(
812
814
  y,
813
815
  {
814
816
  sx: {
815
- mt: !L && d ? "auto" : 0
817
+ mt: !T && d ? "auto" : 0
816
818
  },
817
819
  children: /* @__PURE__ */ t.jsx(
818
820
  y,
@@ -831,11 +833,11 @@ const rt = K(
831
833
  color: "secondary",
832
834
  size: "small",
833
835
  disabled: !o,
834
- onMouseDown: V,
835
- onMouseUp: C,
836
+ onMouseDown: L,
837
+ onMouseUp: S,
836
838
  onMouseLeave: A,
837
- onTouchStart: V,
838
- onTouchEnd: C,
839
+ onTouchStart: L,
840
+ onTouchEnd: S,
839
841
  sx: {
840
842
  textTransform: "none",
841
843
  px: 1.5,
@@ -921,7 +923,7 @@ const rt = K(
921
923
  }
922
924
  ),
923
925
  /* @__PURE__ */ t.jsxs(y, { children: [
924
- !L && d && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
926
+ !T && d && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
925
927
  /* @__PURE__ */ t.jsx(d, {}),
926
928
  /* @__PURE__ */ t.jsx(
927
929
  N,
@@ -941,7 +943,7 @@ const rt = K(
941
943
  sx: {
942
944
  display: "flex",
943
945
  justifyContent: "flex-start",
944
- mt: !L && d ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
946
+ mt: !T && d ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
945
947
  mb: { xs: 0.5, sm: 0.75, md: 1 }
946
948
  },
947
949
  children: /* @__PURE__ */ t.jsx(
@@ -952,11 +954,11 @@ const rt = K(
952
954
  color: "secondary",
953
955
  size: "small",
954
956
  disabled: !o,
955
- onMouseDown: V,
956
- onMouseUp: C,
957
+ onMouseDown: L,
958
+ onMouseUp: S,
957
959
  onMouseLeave: A,
958
- onTouchStart: V,
959
- onTouchEnd: C,
960
+ onTouchStart: L,
961
+ onTouchEnd: S,
960
962
  sx: {
961
963
  textTransform: "none",
962
964
  px: 1.5,
@@ -975,7 +977,7 @@ const rt = K(
975
977
  );
976
978
  }
977
979
  )
978
- ), nt = Array(6).fill(2 * Math.PI), q = {
980
+ ), rt = Array(6).fill(2 * Math.PI), q = {
979
981
  [j.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
980
982
  [j.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
981
983
  [j.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
@@ -998,7 +1000,7 @@ const rt = K(
998
1000
  0
999
1001
  ]
1000
1002
  };
1001
- function Ue(e) {
1003
+ function Oe(e) {
1002
1004
  const [n] = e.split("_");
1003
1005
  switch (n) {
1004
1006
  case "ABB":
@@ -1015,22 +1017,22 @@ function Ue(e) {
1015
1017
  return null;
1016
1018
  }
1017
1019
  }
1018
- function ot(e, n) {
1019
- const r = Ue(e);
1020
+ function nt(e, n) {
1021
+ const r = Oe(e);
1020
1022
  return r && r in q ? q[r] : n || null;
1021
1023
  }
1022
1024
  export {
1023
- Qe as C,
1025
+ Ze as C,
1024
1026
  q as M,
1025
1027
  Y as P,
1026
- Oe as R,
1027
- et as S,
1028
- tt as T,
1029
- rt as a,
1030
- ze as b,
1028
+ ze as R,
1029
+ Qe as S,
1030
+ et as T,
1031
+ tt as a,
1032
+ Pe as b,
1031
1033
  Q as c,
1032
- nt as d,
1033
- Ue as e,
1034
- ot as g
1034
+ rt as d,
1035
+ Oe as e,
1036
+ nt as g
1035
1037
  };
1036
- //# sourceMappingURL=manufacturerHomePositions-j75MUgMb.js.map
1038
+ //# sourceMappingURL=manufacturerHomePositions-h7G6BCs7.js.map