@rubin-epo/epo-widget-lib 2.0.3 → 2.0.5

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 (68) hide show
  1. package/dist/SortableTable.cjs +1 -0
  2. package/dist/SortableTable.d.ts +3 -0
  3. package/dist/SortableTable.js +5 -0
  4. package/dist/SourceSelector.cjs +1 -1
  5. package/dist/SourceSelector.js +6 -4
  6. package/dist/atomic/Blinker/Blinker.cjs +1 -1
  7. package/dist/atomic/Blinker/Blinker.d.ts +1 -0
  8. package/dist/atomic/Blinker/Blinker.js +27 -25
  9. package/dist/atomic/SelectionList/index.cjs +1 -0
  10. package/dist/{widgets/SourceSelector → atomic}/SelectionList/index.d.ts +1 -1
  11. package/dist/atomic/SelectionList/index.js +31 -0
  12. package/dist/charts/Readout/index.cjs +1 -1
  13. package/dist/charts/Readout/index.js +18 -25
  14. package/dist/charts/ScatterPlot/index.cjs +1 -1
  15. package/dist/charts/ScatterPlot/index.js +50 -53
  16. package/dist/localeStrings/en/epo-widget-lib.json +11 -3
  17. package/dist/localeStrings/es/epo-widget-lib.json +8 -5
  18. package/dist/mock-data/OrbitalSim/index.d.ts +162 -0
  19. package/dist/widgets/OrbitalSim/Camera/Camera.cjs +1 -1
  20. package/dist/widgets/OrbitalSim/Camera/Camera.js +9 -8
  21. package/dist/widgets/OrbitalSim/Context/OrbitalSimContext.types.d.ts +12 -0
  22. package/dist/widgets/OrbitalSim/Context/index.cjs +1 -1
  23. package/dist/widgets/OrbitalSim/Context/index.d.ts +1 -1
  24. package/dist/widgets/OrbitalSim/Context/index.js +58 -32
  25. package/dist/widgets/OrbitalSim/OrbitalSim.cjs +1 -1
  26. package/dist/widgets/OrbitalSim/OrbitalSim.js +95 -78
  27. package/dist/widgets/OrbitalSim/Orbitals/Orbital.cjs +1 -1
  28. package/dist/widgets/OrbitalSim/Orbitals/Orbital.js +41 -41
  29. package/dist/widgets/OrbitalSim/Orbitals/OrbitalDetails.cjs +1 -1
  30. package/dist/widgets/OrbitalSim/Orbitals/OrbitalDetails.js +21 -23
  31. package/dist/widgets/OrbitalSim/Orbitals/Orbitals.cjs +1 -1
  32. package/dist/widgets/OrbitalSim/Orbitals/Orbitals.d.ts +2 -1
  33. package/dist/widgets/OrbitalSim/Orbitals/Orbitals.js +41 -40
  34. package/dist/widgets/OrbitalSim/orbitalUtilities.cjs +1 -1
  35. package/dist/widgets/OrbitalSim/orbitalUtilities.d.ts +65 -0
  36. package/dist/widgets/OrbitalSim/orbitalUtilities.js +100 -57
  37. package/dist/widgets/OrbitalSim/styles.cjs +33 -5
  38. package/dist/widgets/OrbitalSim/styles.d.ts +2 -0
  39. package/dist/widgets/OrbitalSim/styles.js +36 -6
  40. package/dist/widgets/SortableTable/SortableTable.cjs +1 -0
  41. package/dist/widgets/SortableTable/SortableTable.d.ts +19 -0
  42. package/dist/widgets/SortableTable/SortableTable.js +41 -0
  43. package/dist/widgets/SortableTable/index.d.ts +1 -0
  44. package/dist/widgets/SortableTable/styles.cjs +8 -0
  45. package/dist/widgets/SortableTable/styles.d.ts +1 -0
  46. package/dist/widgets/SortableTable/styles.js +13 -0
  47. package/dist/widgets/SourceSelector/MovingSourceMap/index.cjs +1 -0
  48. package/dist/widgets/SourceSelector/MovingSourceMap/index.d.ts +13 -0
  49. package/dist/widgets/SourceSelector/MovingSourceMap/index.js +42 -0
  50. package/dist/widgets/SourceSelector/MovingSourceMap/styles.cjs +14 -0
  51. package/dist/widgets/SourceSelector/MovingSourceMap/styles.d.ts +2 -0
  52. package/dist/widgets/SourceSelector/MovingSourceMap/styles.js +20 -0
  53. package/dist/widgets/SourceSelector/MovingSourceSelector.cjs +1 -0
  54. package/dist/widgets/SourceSelector/MovingSourceSelector.d.ts +24 -0
  55. package/dist/widgets/SourceSelector/MovingSourceSelector.js +119 -0
  56. package/dist/widgets/SourceSelector/SourceSelector.cjs +1 -1
  57. package/dist/widgets/SourceSelector/SourceSelector.d.ts +1 -1
  58. package/dist/widgets/SourceSelector/SourceSelector.js +43 -42
  59. package/dist/widgets/SourceSelector/index.d.ts +2 -1
  60. package/dist/widgets/SourceSelector/mocks/index.d.ts +1 -0
  61. package/dist/widgets/SupernovaThreeVector/Skymap/index.cjs +1 -1
  62. package/dist/widgets/SupernovaThreeVector/Skymap/index.js +39 -45
  63. package/package.json +1 -1
  64. package/dist/widgets/SourceSelector/SelectionList/index.cjs +0 -1
  65. package/dist/widgets/SourceSelector/SelectionList/index.js +0 -31
  66. /package/dist/{widgets/SourceSelector → atomic}/SelectionList/styles.cjs +0 -0
  67. /package/dist/{widgets/SourceSelector → atomic}/SelectionList/styles.d.ts +0 -0
  68. /package/dist/{widgets/SourceSelector → atomic}/SelectionList/styles.js +0 -0
@@ -0,0 +1,119 @@
1
+ "use client";
2
+ import { jsxs as B, jsx as a, Fragment as G } from "react/jsx-runtime";
3
+ import { useState as l } from "react";
4
+ import { useTranslation as J } from "react-i18next";
5
+ import K from "../../layout/AspectRatio/index.js";
6
+ import Q from "../../atomic/Loader/index.js";
7
+ import U from "@rubin-epo/epo-react-lib/IconComposer";
8
+ import Z from "./MovingSourceMap/index.js";
9
+ import { getRadius as $, toDecimalPercent as L } from "./utils.js";
10
+ import { BackgroundBlinker as O } from "./styles.js";
11
+ import ee from "../../hooks/useInterval.js";
12
+ import te from "./Message/Message.js";
13
+ import oe from "../../atomic/ElapsedTime/ElapsedTime.js";
14
+ const ne = (e, n) => {
15
+ var u;
16
+ const t = { day: 0, hour: 0 }, o = e[n];
17
+ if (!o) return t;
18
+ const r = (o == null ? void 0 : o.date) - ((u = e[0]) == null ? void 0 : u.date);
19
+ return r ? {
20
+ day: Math.round(r) || 0,
21
+ hour: Math.round(24 / r % 24) || 0
22
+ } : t;
23
+ }, se = (e, n, t) => Math.pow(e.x - n.x, 2) + Math.pow(e.y - n.y, 2) <= Math.pow(t, 2), re = (e, n, t) => t ? e[n] ? [e[n].image] : [] : e.map(({ image: o }) => o), ie = ({
24
+ width: e = 600,
25
+ height: n = 600,
26
+ selectedSource: t = [],
27
+ alerts: o = [],
28
+ activeAlertIndex: r = 0,
29
+ alertChangeCallback: u,
30
+ selectionCallback: M,
31
+ blinkConfig: P,
32
+ isDisplayOnly: d = !1,
33
+ isLoading: w,
34
+ className: F,
35
+ movingSources: c = []
36
+ }) => {
37
+ const [f, x] = l(0), [R, V] = l(!0), [b, j] = l(!0), [N, y] = l(), [T, p] = l(!1), { t: I } = J(), S = !R && !w, W = (s, m, g) => {
38
+ if (c)
39
+ for (let i of c) {
40
+ const h = i.sources[f];
41
+ if (se(
42
+ s,
43
+ {
44
+ x: L(h.x) * m,
45
+ y: L(h.y) * g
46
+ },
47
+ $(i.type, i.radius) * m
48
+ ))
49
+ return i.id;
50
+ }
51
+ }, _ = () => {
52
+ y(I("source_selector.messages.failure")), p(!0);
53
+ }, v = () => {
54
+ j((s) => !s);
55
+ }, z = () => {
56
+ y(
57
+ /* @__PURE__ */ B(G, { children: [
58
+ /* @__PURE__ */ a(U, { icon: "checkmark" }),
59
+ I("source_selector.messages.success")
60
+ ] })
61
+ ), p(!0);
62
+ }, A = ({
63
+ clientX: s,
64
+ clientY: m,
65
+ target: g
66
+ }) => {
67
+ if (!S || d) return;
68
+ const {
69
+ tagName: i,
70
+ clientWidth: h,
71
+ clientHeight: k
72
+ } = g;
73
+ if (i.toLowerCase() !== "img") return;
74
+ const { left: q, top: D } = g.getBoundingClientRect(), C = W(
75
+ { x: s - q, y: k - m + D },
76
+ h,
77
+ k
78
+ );
79
+ if (C) {
80
+ if (t.includes(C)) return;
81
+ M && M(t.concat(C)), z();
82
+ } else
83
+ _();
84
+ }, E = () => {
85
+ p(!1);
86
+ }, { day: H, hour: X } = ne(o, r), Y = re(o, r, d);
87
+ return ee(() => {
88
+ b && (f > c[0].sources.length - 2 ? x(0) : x((s) => s + 1));
89
+ }, 500), /* @__PURE__ */ B(K, { ratio: 1, className: F, children: [
90
+ !d && /* @__PURE__ */ a(
91
+ te,
92
+ {
93
+ onMessageChangeCallback: E,
94
+ isVisible: T,
95
+ children: N
96
+ }
97
+ ),
98
+ c && /* @__PURE__ */ a(
99
+ O,
100
+ {
101
+ images: Y,
102
+ activeIndex: f,
103
+ blinkCallback: u,
104
+ loadedCallback: () => V(!1),
105
+ onClickCallback: A,
106
+ extraControls: o.length > 0 && !d && /* @__PURE__ */ a(oe, { day: H, hour: X }),
107
+ interval: 400,
108
+ pauseCallback: v,
109
+ ...P,
110
+ children: /* @__PURE__ */ a(Z, { width: e, height: n, isPlaying: b, currentIndex: f, movingSources: c, selectedSource: t })
111
+ }
112
+ ),
113
+ !S && /* @__PURE__ */ a(Q, {})
114
+ ] });
115
+ };
116
+ ie.displayName = "Widgets.MovingSourceSelector";
117
+ export {
118
+ ie as default
119
+ };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),h=require("react"),z=require("react-i18next"),E=require("../../layout/AspectRatio/index.cjs"),H=require("../../atomic/Loader/index.cjs"),X=require("@rubin-epo/epo-react-lib/IconComposer"),Y=require("./SourceMap/index.cjs"),m=require("./utils.cjs"),G=require("./styles.cjs"),J=require("./Message/Message.cjs"),K=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),Q=e=>e&&e.__esModule?e:{default:e},U=Q(X),Z=(e,t)=>{var c;const s={day:0,hour:0},n=e[t];if(!n)return s;const o=(n==null?void 0:n.date)-((c=e[0])==null?void 0:c.date);return o?{day:Math.round(o)||0,hour:Math.round(24/o%24)||0}:s},A=(e,t,s)=>Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)<=Math.pow(s,2),O=(e,t,s,n)=>{var o;return(o=n.find(({x:c,y:u,radius:i,type:l})=>A(e,{x:m.toDecimalPercent(c)*t,y:m.toDecimalPercent(u)*s},m.getRadius(l,i)*t)))==null?void 0:o.id},ee=(e,t,s)=>s?e[t]?[e[t].image]:[]:e.map(({image:n})=>n),S=({width:e=600,height:t=600,selectedSource:s=[],sources:n,alerts:o=[],activeAlertIndex:c=0,alertChangeCallback:u,selectionCallback:i,blinkConfig:l,isDisplayOnly:a=!1,isLoading:b,className:j})=>{const[p,_]=h.useState(!0),[y,x]=h.useState(),[I,d]=h.useState(!1),{t:C}=z.useTranslation(),M=!p&&!b,w=()=>{x(C("source_selector.messages.failure")),d(!0)},L=()=>{x(r.jsxs(r.Fragment,{children:[r.jsx(U.default,{icon:"checkmark"}),C("source_selector.messages.success")]})),d(!0)},P=({clientX:f,clientY:D,target:k})=>{if(!M||a)return;const{tagName:N,clientWidth:W,clientHeight:q}=k;if(N.toLowerCase()!=="img")return;const{left:$,top:v}=k.getBoundingClientRect(),g=O({x:f-$,y:q-D+v},W,q,n);if(g){if(s.includes(g))return;i&&i(s.concat(g)),L()}else w()},T=()=>{d(!1)},{day:B,hour:F}=Z(o,c),R=ee(o,c,a),V=n.filter(({id:f})=>s.includes(f));return r.jsxs(E.default,{ratio:1,className:j,children:[!a&&r.jsx(J.default,{onMessageChangeCallback:T,isVisible:I,children:y}),r.jsx(G.BackgroundBlinker,{images:R,activeIndex:c,blinkCallback:u,loadedCallback:()=>_(!1),onClickCallback:P,extraControls:o.length>0&&!a&&r.jsx(K.default,{day:B,hour:F}),interval:400,...l,children:r.jsx(Y.default,{sources:V,width:e,height:t})}),!M&&r.jsx(H.default,{})]})};S.displayName="Widgets.SourceSelector";exports.default=S;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),h=require("react"),z=require("react-i18next"),E=require("../../layout/AspectRatio/index.cjs"),H=require("../../atomic/Loader/index.cjs"),X=require("@rubin-epo/epo-react-lib/IconComposer"),Y=require("./SourceMap/index.cjs"),m=require("./utils.cjs"),G=require("./styles.cjs"),J=require("./Message/Message.cjs"),K=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),Q=e=>e&&e.__esModule?e:{default:e},U=Q(X),Z=(e,s)=>{var r;const n={day:0,hour:0},t=e[s];if(!t)return n;const o=(t==null?void 0:t.date)-((r=e[0])==null?void 0:r.date);return o?{day:Math.round(o)||0,hour:Math.round(24/o%24)||0}:n},A=(e,s,n)=>Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2)<=Math.pow(n,2),O=(e,s,n,t)=>{var o;if(t)return(o=t.find(({x:r,y:u,radius:c,type:l})=>A(e,{x:m.toDecimalPercent(r)*s,y:m.toDecimalPercent(u)*n},m.getRadius(l,c)*s)))==null?void 0:o.id},ee=(e,s,n)=>n?e[s]?[e[s].image]:[]:e.map(({image:t})=>t),S=({width:e=600,height:s=600,selectedSource:n=[],sources:t,alerts:o=[],activeAlertIndex:r=0,alertChangeCallback:u,selectionCallback:c,blinkConfig:l,isDisplayOnly:a=!1,isLoading:b,className:j})=>{const[p,_]=h.useState(!0),[y,x]=h.useState(),[I,d]=h.useState(!1),{t:C}=z.useTranslation(),M=!p&&!b,w=()=>{x(C("source_selector.messages.failure")),d(!0)},L=()=>{x(i.jsxs(i.Fragment,{children:[i.jsx(U.default,{icon:"checkmark"}),C("source_selector.messages.success")]})),d(!0)},P=({clientX:f,clientY:D,target:k})=>{if(!M||a)return;const{tagName:N,clientWidth:W,clientHeight:q}=k;if(N.toLowerCase()!=="img")return;const{left:$,top:v}=k.getBoundingClientRect(),g=t?O({x:f-$,y:q-D+v},W,q,t):null;if(g){if(n.includes(g))return;c&&c(n.concat(g)),L()}else w()},T=()=>{d(!1)},{day:B,hour:F}=Z(o,r),R=ee(o,r,a),V=t?t.filter(({id:f})=>n.includes(f)):[];return i.jsxs(E.default,{ratio:1,className:j,children:[!a&&i.jsx(J.default,{onMessageChangeCallback:T,isVisible:I,children:y}),i.jsx(G.BackgroundBlinker,{images:R,activeIndex:r,blinkCallback:u,loadedCallback:()=>_(!1),onClickCallback:P,extraControls:o.length>0&&!a&&i.jsx(K.default,{day:B,hour:F}),interval:400,...l,children:i.jsx(Y.default,{sources:V,width:e,height:s})}),!M&&i.jsx(H.default,{})]})};S.displayName="Widgets.SourceSelector";exports.default=S;
@@ -9,7 +9,7 @@ interface BlinkConfig {
9
9
  interface SourceSelectorProps {
10
10
  width?: number;
11
11
  height?: number;
12
- sources: Source[];
12
+ sources?: Source[] | null;
13
13
  alerts: Alert[];
14
14
  selectedSource?: string[];
15
15
  activeAlertIndex?: number;
@@ -10,76 +10,77 @@ import { getRadius as K, toDecimalPercent as S } from "./utils.js";
10
10
  import { BackgroundBlinker as Q } from "./styles.js";
11
11
  import U from "./Message/Message.js";
12
12
  import Z from "../../atomic/ElapsedTime/ElapsedTime.js";
13
- const $ = (e, o) => {
13
+ const $ = (o, t) => {
14
14
  var n;
15
- const t = { day: 0, hour: 0 }, s = e[o];
16
- if (!s) return t;
17
- const r = (s == null ? void 0 : s.date) - ((n = e[0]) == null ? void 0 : n.date);
18
- return r ? {
19
- day: Math.round(r) || 0,
20
- hour: Math.round(24 / r % 24) || 0
21
- } : t;
22
- }, v = (e, o, t) => Math.pow(e.x - o.x, 2) + Math.pow(e.y - o.y, 2) <= Math.pow(t, 2), O = (e, o, t, s) => {
23
- var r;
24
- return (r = s.find(({ x: n, y: l, radius: c, type: d }) => v(
25
- e,
26
- {
27
- x: S(n) * o,
28
- y: S(l) * t
29
- },
30
- K(d, c) * o
31
- ))) == null ? void 0 : r.id;
32
- }, ee = (e, o, t) => t ? e[o] ? [e[o].image] : [] : e.map(({ image: s }) => s), oe = ({
33
- width: e = 600,
34
- height: o = 600,
35
- selectedSource: t = [],
36
- sources: s,
37
- alerts: r = [],
15
+ const r = { day: 0, hour: 0 }, e = o[t];
16
+ if (!e) return r;
17
+ const s = (e == null ? void 0 : e.date) - ((n = o[0]) == null ? void 0 : n.date);
18
+ return s ? {
19
+ day: Math.round(s) || 0,
20
+ hour: Math.round(24 / s % 24) || 0
21
+ } : r;
22
+ }, v = (o, t, r) => Math.pow(o.x - t.x, 2) + Math.pow(o.y - t.y, 2) <= Math.pow(r, 2), O = (o, t, r, e) => {
23
+ var s;
24
+ if (e)
25
+ return (s = e.find(({ x: n, y: l, radius: a, type: d }) => v(
26
+ o,
27
+ {
28
+ x: S(n) * t,
29
+ y: S(l) * r
30
+ },
31
+ K(d, a) * t
32
+ ))) == null ? void 0 : s.id;
33
+ }, ee = (o, t, r) => r ? o[t] ? [o[t].image] : [] : o.map(({ image: e }) => e), oe = ({
34
+ width: o = 600,
35
+ height: t = 600,
36
+ selectedSource: r = [],
37
+ sources: e,
38
+ alerts: s = [],
38
39
  activeAlertIndex: n = 0,
39
40
  alertChangeCallback: l,
40
- selectionCallback: c,
41
+ selectionCallback: a,
41
42
  blinkConfig: d,
42
- isDisplayOnly: a = !1,
43
+ isDisplayOnly: c = !1,
43
44
  isLoading: x,
44
45
  className: w
45
46
  }) => {
46
- const [y, L] = g(!0), [I, h] = g(), [B, u] = g(!1), { t: p } = q(), C = !y && !x, F = () => {
47
- h(p("source_selector.messages.failure")), u(!0);
47
+ const [y, L] = g(!0), [I, h] = g(), [B, m] = g(!1), { t: p } = q(), C = !y && !x, F = () => {
48
+ h(p("source_selector.messages.failure")), m(!0);
48
49
  }, R = () => {
49
50
  h(
50
51
  /* @__PURE__ */ b(Y, { children: [
51
52
  /* @__PURE__ */ i(G, { icon: "checkmark" }),
52
53
  p("source_selector.messages.success")
53
54
  ] })
54
- ), u(!0);
55
+ ), m(!0);
55
56
  }, T = ({
56
- clientX: m,
57
+ clientX: u,
57
58
  clientY: _,
58
59
  target: k
59
60
  }) => {
60
- if (!C || a) return;
61
+ if (!C || c) return;
61
62
  const {
62
63
  tagName: z,
63
64
  clientWidth: E,
64
65
  clientHeight: M
65
66
  } = k;
66
67
  if (z.toLowerCase() !== "img") return;
67
- const { left: H, top: X } = k.getBoundingClientRect(), f = O(
68
- { x: m - H, y: M - _ + X },
68
+ const { left: H, top: X } = k.getBoundingClientRect(), f = e ? O(
69
+ { x: u - H, y: M - _ + X },
69
70
  E,
70
71
  M,
71
- s
72
- );
72
+ e
73
+ ) : null;
73
74
  if (f) {
74
- if (t.includes(f)) return;
75
- c && c(t.concat(f)), R();
75
+ if (r.includes(f)) return;
76
+ a && a(r.concat(f)), R();
76
77
  } else
77
78
  F();
78
79
  }, V = () => {
79
- u(!1);
80
- }, { day: j, hour: N } = $(r, n), P = ee(r, n, a), W = s.filter(({ id: m }) => t.includes(m));
80
+ m(!1);
81
+ }, { day: j, hour: N } = $(s, n), P = ee(s, n, c), W = e ? e.filter(({ id: u }) => r.includes(u)) : [];
81
82
  return /* @__PURE__ */ b(A, { ratio: 1, className: w, children: [
82
- !a && /* @__PURE__ */ i(
83
+ !c && /* @__PURE__ */ i(
83
84
  U,
84
85
  {
85
86
  onMessageChangeCallback: V,
@@ -95,10 +96,10 @@ const $ = (e, o) => {
95
96
  blinkCallback: l,
96
97
  loadedCallback: () => L(!1),
97
98
  onClickCallback: T,
98
- extraControls: r.length > 0 && !a && /* @__PURE__ */ i(Z, { day: j, hour: N }),
99
+ extraControls: s.length > 0 && !c && /* @__PURE__ */ i(Z, { day: j, hour: N }),
99
100
  interval: 400,
100
101
  ...d,
101
- children: /* @__PURE__ */ i(J, { sources: W, width: e, height: o })
102
+ children: /* @__PURE__ */ i(J, { sources: W, width: o, height: t })
102
103
  }
103
104
  ),
104
105
  !C && /* @__PURE__ */ i(D, {})
@@ -1,5 +1,6 @@
1
1
  import { default as SourceSelector } from './SourceSelector';
2
2
 
3
+ export { default as MovingSourceSelector } from './MovingSourceSelector';
3
4
  export { default as Message } from './Message';
4
- export { default as SelectionList } from './SelectionList';
5
+ export { default as SelectionList } from '../../atomic/SelectionList';
5
6
  export default SourceSelector;
@@ -1,4 +1,5 @@
1
1
  import { SourceDataset } from '../../../types/astro';
2
2
 
3
+ export declare const movingData: SourceDataset;
3
4
  export declare const biggerData: SourceDataset;
4
5
  export declare const moreImages: never[];
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),b=require("react"),_=require("d3-geo-projection"),S=require("d3-geo"),M=require("d3-array"),E=require("../../../charts/Base/index.cjs");require("../../../charts/XAxis/index.cjs");require("../../../charts/YAxis/index.cjs");require("../../../charts/Guidelines/index.cjs");const N=require("../../../charts/Tooltip/index.cjs");require("../../../charts/Bars/index.cjs");require("../../../charts/Viewport/index.cjs");require("../../../charts/ScatterPlot/index.cjs");const U=require("../../../atomic/ImageStack/index.cjs"),r=require("./styles.cjs"),y=({className:L,objects:p=[],images:v=[],visibleImages:w=[],describedById:G})=>{const[O,P]=b.useState(!1),[x,f]=b.useState(),l=600,c=300,n={top:20,right:0,bottom:20,left:20},W=l+n.right+n.left,$=c+n.top+n.bottom,d=15,u=30,j=-90,m=90,g=-180,q=180,h=2,i=_.geoAitoff(),s=S.geoGraticule();s.step([u,d]),s.extent([[g,j],[q,m]]),i.fitExtent([[n.left,n.top],[n.left+l-h,n.top+c]],s.outline());const B=M.range(j+d,m,d),A=M.range(g+u,q,u),C=S.geoPath(i).pointRadius(6),a=t=>C(t)||void 0,o=typeof x<"u"?p[x]:void 0,k=(o?i([o==null?void 0:o.long,o==null?void 0:o.lat]):[0,0])||[0,0];return e.jsxs(E.default,{width:W,height:$,className:L,children:[e.jsx("mask",{id:"imageMask",children:e.jsx("path",{d:a(s.outline()),fill:"white"})}),e.jsx(r.Background,{d:a(s.outline())}),e.jsx(r.Graticule,{d:a(s())}),e.jsx(r.ImageStackerWrapper,{style:{"--image-stack-opacity":O&&1},x:n.left,y:n.top,width:l-h,height:c,mask:"url(#imageMask)",children:e.jsx(U.default,{images:v,describedById:G,visible:w,loadCallback:()=>P(!0),showBackdrop:!1,showLoader:!1})}),e.jsx("g",{children:p.map(({id:t,lat:H,long:R},T)=>e.jsx(r.UserObject,{d:a({type:"Point",coordinates:[R,H]}),onMouseOver:()=>f(T),onMouseOut:()=>f(void 0)},t))}),e.jsx("g",{"aria-hidden":"true",children:B.map(t=>t===0?null:e.jsxs(r.LatLabel,{style:{dominantBaseline:t>0?"text-after-edge":"text-before-edge"},transform:`translate(${i([g,t])})`,children:[t,"°"]},t))}),e.jsx("g",{"aria-hidden":"true",children:A.map(t=>e.jsxs(r.LongLabel,{transform:`translate(${i([t,0])})`,children:[t,"°"]},t))}),e.jsx(r.Outline,{strokeWidth:h,d:a(s.outline())}),e.jsx(N.default,{visible:!!o,x:k[0],y:k[1],children:o==null?void 0:o.id})]})};y.displayName="Widgets.SupernovaThreeVector.Skymap";exports.default=y;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),S=require("react"),_=require("d3-geo-projection"),M=require("d3-geo"),q=require("d3-array"),E=require("../../../atomic/ImageStack/index.cjs"),a=require("./styles.cjs"),N=require("../../../charts/Base/index.cjs"),U=require("../../../charts/Tooltip/index.cjs"),y=({className:L,objects:p=[],images:v=[],visibleImages:w=[],describedById:G})=>{const[O,P]=S.useState(!1),[x,f]=S.useState(),l=600,c=300,n={top:20,right:0,bottom:20,left:20},W=l+n.right+n.left,$=c+n.top+n.bottom,d=15,u=30,j=-90,m=90,g=-180,k=180,h=2,i=_.geoAitoff(),s=M.geoGraticule();s.step([u,d]),s.extent([[g,j],[k,m]]),i.fitExtent([[n.left,n.top],[n.left+l-h,n.top+c]],s.outline());const B=q.range(j+d,m,d),A=q.range(g+u,k,u),C=M.geoPath(i).pointRadius(6),r=t=>C(t)||void 0,o=typeof x<"u"?p[x]:void 0,b=(o?i([o==null?void 0:o.long,o==null?void 0:o.lat]):[0,0])||[0,0];return e.jsxs(N.default,{width:W,height:$,className:L,children:[e.jsx("mask",{id:"imageMask",children:e.jsx("path",{d:r(s.outline()),fill:"white"})}),e.jsx(a.Background,{d:r(s.outline())}),e.jsx(a.Graticule,{d:r(s())}),e.jsx(a.ImageStackerWrapper,{style:{"--image-stack-opacity":O&&1},x:n.left,y:n.top,width:l-h,height:c,mask:"url(#imageMask)",children:e.jsx(E.default,{images:v,describedById:G,visible:w,loadCallback:()=>P(!0),showBackdrop:!1,showLoader:!1})}),e.jsx("g",{children:p.map(({id:t,lat:H,long:R},T)=>e.jsx(a.UserObject,{d:r({type:"Point",coordinates:[R,H]}),onMouseOver:()=>f(T),onMouseOut:()=>f(void 0)},t))}),e.jsx("g",{"aria-hidden":"true",children:B.map(t=>t===0?null:e.jsxs(a.LatLabel,{style:{dominantBaseline:t>0?"text-after-edge":"text-before-edge"},transform:`translate(${i([g,t])})`,children:[t,"°"]},t))}),e.jsx("g",{"aria-hidden":"true",children:A.map(t=>e.jsxs(a.LongLabel,{transform:`translate(${i([t,0])})`,children:[t,"°"]},t))}),e.jsx(a.Outline,{strokeWidth:h,d:r(s.outline())}),e.jsx(U.default,{visible:!!o,x:b[0],y:b[1],children:o==null?void 0:o.id})]})};y.displayName="Widgets.SupernovaThreeVector.Skymap";exports.default=y;
@@ -1,19 +1,13 @@
1
1
  "use client";
2
- import { jsxs as h, jsx as o } from "react/jsx-runtime";
2
+ import { jsxs as h, jsx as e } from "react/jsx-runtime";
3
3
  import { useState as L } from "react";
4
4
  import { geoAitoff as E } from "d3-geo-projection";
5
5
  import { geoGraticule as N, geoPath as R } from "d3-geo";
6
6
  import { range as M } from "d3-array";
7
- import U from "../../../charts/Base/index.js";
8
- import "../../../charts/XAxis/index.js";
9
- import "../../../charts/YAxis/index.js";
10
- import "../../../charts/Guidelines/index.js";
11
- import V from "../../../charts/Tooltip/index.js";
12
- import "../../../charts/Bars/index.js";
13
- import "../../../charts/Viewport/index.js";
14
- import "../../../charts/ScatterPlot/index.js";
15
- import q from "../../../atomic/ImageStack/index.js";
16
- import { Background as z, Graticule as D, ImageStackerWrapper as F, UserObject as J, LatLabel as K, LongLabel as Q, Outline as X } from "./styles.js";
7
+ import U from "../../../atomic/ImageStack/index.js";
8
+ import { Background as V, Graticule as q, ImageStackerWrapper as z, UserObject as D, LatLabel as F, LongLabel as J, Outline as K } from "./styles.js";
9
+ import Q from "../../../charts/Base/index.js";
10
+ import X from "../../../charts/Tooltip/index.js";
17
11
  const Y = ({
18
12
  className: y,
19
13
  objects: g = [],
@@ -21,38 +15,38 @@ const Y = ({
21
15
  visibleImages: w = [],
22
16
  describedById: B
23
17
  }) => {
24
- const [O, W] = L(!1), [f, u] = L(), s = 600, l = 300, i = {
18
+ const [O, W] = L(!1), [f, u] = L(), s = 600, l = 300, a = {
25
19
  top: 20,
26
20
  right: 0,
27
21
  bottom: 20,
28
22
  left: 20
29
- }, j = s + i.right + i.left, C = l + i.top + i.bottom, c = 15, d = 30, k = -90, x = 90, p = -180, b = 180, m = 2, a = E(), r = N();
30
- r.step([d, c]), r.extent([
23
+ }, j = s + a.right + a.left, C = l + a.top + a.bottom, c = 15, d = 30, k = -90, x = 90, p = -180, b = 180, m = 2, i = E(), n = N();
24
+ n.step([d, c]), n.extent([
31
25
  [p, k],
32
26
  [b, x]
33
- ]), a.fitExtent(
27
+ ]), i.fitExtent(
34
28
  [
35
- [i.left, i.top],
36
- [i.left + s - m, i.top + l]
29
+ [a.left, a.top],
30
+ [a.left + s - m, a.top + l]
37
31
  ],
38
- r.outline()
32
+ n.outline()
39
33
  );
40
- const G = M(k + c, x, c), H = M(p + d, b, d), P = R(a).pointRadius(6), n = (t) => P(t) || void 0, e = typeof f < "u" ? g[f] : void 0, S = (e ? a([e == null ? void 0 : e.long, e == null ? void 0 : e.lat]) : [0, 0]) || [0, 0];
41
- return /* @__PURE__ */ h(U, { width: j, height: C, className: y, children: [
42
- /* @__PURE__ */ o("mask", { id: "imageMask", children: /* @__PURE__ */ o("path", { d: n(r.outline()), fill: "white" }) }),
43
- /* @__PURE__ */ o(z, { d: n(r.outline()) }),
44
- /* @__PURE__ */ o(D, { d: n(r()) }),
45
- /* @__PURE__ */ o(
46
- F,
34
+ const G = M(k + c, x, c), H = M(p + d, b, d), P = R(i).pointRadius(6), r = (t) => P(t) || void 0, o = typeof f < "u" ? g[f] : void 0, S = (o ? i([o == null ? void 0 : o.long, o == null ? void 0 : o.lat]) : [0, 0]) || [0, 0];
35
+ return /* @__PURE__ */ h(Q, { width: j, height: C, className: y, children: [
36
+ /* @__PURE__ */ e("mask", { id: "imageMask", children: /* @__PURE__ */ e("path", { d: r(n.outline()), fill: "white" }) }),
37
+ /* @__PURE__ */ e(V, { d: r(n.outline()) }),
38
+ /* @__PURE__ */ e(q, { d: r(n()) }),
39
+ /* @__PURE__ */ e(
40
+ z,
47
41
  {
48
42
  style: { "--image-stack-opacity": O && 1 },
49
- x: i.left,
50
- y: i.top,
43
+ x: a.left,
44
+ y: a.top,
51
45
  width: s - m,
52
46
  height: l,
53
47
  mask: "url(#imageMask)",
54
- children: /* @__PURE__ */ o(
55
- q,
48
+ children: /* @__PURE__ */ e(
49
+ U,
56
50
  {
57
51
  images: v,
58
52
  describedById: B,
@@ -64,10 +58,10 @@ const Y = ({
64
58
  )
65
59
  }
66
60
  ),
67
- /* @__PURE__ */ o("g", { children: g.map(({ id: t, lat: T, long: $ }, A) => /* @__PURE__ */ o(
68
- J,
61
+ /* @__PURE__ */ e("g", { children: g.map(({ id: t, lat: T, long: $ }, A) => /* @__PURE__ */ e(
62
+ D,
69
63
  {
70
- d: n({
64
+ d: r({
71
65
  type: "Point",
72
66
  coordinates: [$, T]
73
67
  }),
@@ -76,14 +70,14 @@ const Y = ({
76
70
  },
77
71
  t
78
72
  )) }),
79
- /* @__PURE__ */ o("g", { "aria-hidden": "true", children: G.map(
73
+ /* @__PURE__ */ e("g", { "aria-hidden": "true", children: G.map(
80
74
  (t) => t === 0 ? null : /* @__PURE__ */ h(
81
- K,
75
+ F,
82
76
  {
83
77
  style: {
84
78
  dominantBaseline: t > 0 ? "text-after-edge" : "text-before-edge"
85
79
  },
86
- transform: `translate(${a([p, t])})`,
80
+ transform: `translate(${i([p, t])})`,
87
81
  children: [
88
82
  t,
89
83
  "°"
@@ -92,10 +86,10 @@ const Y = ({
92
86
  t
93
87
  )
94
88
  ) }),
95
- /* @__PURE__ */ o("g", { "aria-hidden": "true", children: H.map((t) => /* @__PURE__ */ h(
96
- Q,
89
+ /* @__PURE__ */ e("g", { "aria-hidden": "true", children: H.map((t) => /* @__PURE__ */ h(
90
+ J,
97
91
  {
98
- transform: `translate(${a([t, 0])})`,
92
+ transform: `translate(${i([t, 0])})`,
99
93
  children: [
100
94
  t,
101
95
  "°"
@@ -103,20 +97,20 @@ const Y = ({
103
97
  },
104
98
  t
105
99
  )) }),
106
- /* @__PURE__ */ o(
107
- X,
100
+ /* @__PURE__ */ e(
101
+ K,
108
102
  {
109
103
  strokeWidth: m,
110
- d: n(r.outline())
104
+ d: r(n.outline())
111
105
  }
112
106
  ),
113
- /* @__PURE__ */ o(
114
- V,
107
+ /* @__PURE__ */ e(
108
+ X,
115
109
  {
116
- visible: !!e,
110
+ visible: !!o,
117
111
  x: S[0],
118
112
  y: S[1],
119
- children: e == null ? void 0 : e.id
113
+ children: o == null ? void 0 : o.id
120
114
  }
121
115
  )
122
116
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubin-epo/epo-widget-lib",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
5
5
  "author": "Rubin EPO",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react-i18next"),s=require("./styles.cjs"),a=require("../../../atomic/Button/patterns/Reset.cjs"),l=({className:n,onRemoveCallback:c,sources:t=[]})=>{const{t:r}=u.useTranslation();return e.jsxs(s.SelectionWrapper,{children:[t.length>0&&e.jsx(s.SelectionList,{className:n,children:t.map(({type:o,id:i})=>e.jsxs(s.DescriptionWrapper,{children:[e.jsx("dt",{children:r("source_selector.selected_source",{type:r(`source_selector.sources.${o}`)})}),e.jsx("dd",{children:i})]},i))}),e.jsx(a.default,{isDisabled:t.length<1,onResetCallback:c})]})};l.displayName="Widgets.SelectionList";exports.default=l;
@@ -1,31 +0,0 @@
1
- "use client";
2
- import { jsxs as s, jsx as e } from "react/jsx-runtime";
3
- import { useTranslation as c } from "react-i18next";
4
- import { SelectionWrapper as a, SelectionList as p, DescriptionWrapper as d } from "./styles.js";
5
- import m from "../../../atomic/Button/patterns/Reset.js";
6
- const u = ({
7
- className: o,
8
- onRemoveCallback: l,
9
- sources: t = []
10
- }) => {
11
- const { t: r } = c();
12
- return /* @__PURE__ */ s(a, { children: [
13
- t.length > 0 && /* @__PURE__ */ e(p, { className: o, children: t.map(({ type: n, id: i }) => /* @__PURE__ */ s(d, { children: [
14
- /* @__PURE__ */ e("dt", { children: r("source_selector.selected_source", {
15
- type: r(`source_selector.sources.${n}`)
16
- }) }),
17
- /* @__PURE__ */ e("dd", { children: i })
18
- ] }, i)) }),
19
- /* @__PURE__ */ e(
20
- m,
21
- {
22
- isDisabled: t.length < 1,
23
- onResetCallback: l
24
- }
25
- )
26
- ] });
27
- };
28
- u.displayName = "Widgets.SelectionList";
29
- export {
30
- u as default
31
- };