@rubin-epo/epo-widget-lib 1.0.1 → 1.0.3

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 (48) hide show
  1. package/dist/IsochronePlot.js +7 -7
  2. package/dist/SourceSelector.cjs +1 -1
  3. package/dist/SourceSelector.js +4 -6
  4. package/dist/atomic/Blinker/Blinker.cjs +1 -1
  5. package/dist/atomic/Blinker/Blinker.d.ts +7 -3
  6. package/dist/atomic/Blinker/Blinker.js +65 -55
  7. package/dist/atomic/Blinker/_mocks/index.d.ts +5 -3
  8. package/dist/atomic/Blinker/styles.cjs +9 -4
  9. package/dist/atomic/Blinker/styles.d.ts +0 -8
  10. package/dist/atomic/Blinker/styles.js +11 -8
  11. package/dist/atomic/ImageStack/index.d.ts +5 -2
  12. package/dist/charts/Readout/index.cjs +1 -1
  13. package/dist/charts/Readout/index.js +5 -6
  14. package/dist/charts/ScatterPlot/index.cjs +1 -1
  15. package/dist/charts/ScatterPlot/index.js +50 -49
  16. package/dist/localeStrings/es/epo-widget-lib.json +82 -0
  17. package/dist/widgets/SourceSelector/SelectionList/index.cjs +1 -1
  18. package/dist/widgets/SourceSelector/SelectionList/index.d.ts +1 -1
  19. package/dist/widgets/SourceSelector/SelectionList/index.js +27 -21
  20. package/dist/widgets/SourceSelector/SelectionList/styles.cjs +10 -41
  21. package/dist/widgets/SourceSelector/SelectionList/styles.d.ts +492 -503
  22. package/dist/widgets/SourceSelector/SelectionList/styles.js +12 -43
  23. package/dist/widgets/SourceSelector/SourceMap/index.cjs +1 -0
  24. package/dist/widgets/SourceSelector/SourceMap/index.d.ts +10 -0
  25. package/dist/widgets/SourceSelector/SourceMap/index.js +38 -0
  26. package/dist/widgets/SourceSelector/SourceMap/styles.cjs +14 -0
  27. package/dist/widgets/SourceSelector/{Point → SourceMap}/styles.d.ts +482 -0
  28. package/dist/widgets/SourceSelector/{Point → SourceMap}/styles.js +9 -3
  29. package/dist/widgets/SourceSelector/SourceSelector.cjs +1 -1
  30. package/dist/widgets/SourceSelector/SourceSelector.js +100 -78
  31. package/dist/widgets/SourceSelector/index.d.ts +0 -1
  32. package/dist/widgets/SourceSelector/styles.cjs +2 -6
  33. package/dist/widgets/SourceSelector/styles.d.ts +6 -484
  34. package/dist/widgets/SourceSelector/styles.js +3 -8
  35. package/dist/widgets/SourceSelector/utils.cjs +1 -0
  36. package/dist/widgets/SourceSelector/utils.d.ts +2 -0
  37. package/dist/widgets/SourceSelector/utils.js +14 -0
  38. package/dist/widgets/SupernovaThreeVector/Skymap/index.cjs +1 -1
  39. package/dist/widgets/SupernovaThreeVector/Skymap/index.js +2 -3
  40. package/package.json +1 -1
  41. package/dist/widgets/SourceSelector/Point/Point.cjs +0 -1
  42. package/dist/widgets/SourceSelector/Point/Point.d.ts +0 -11
  43. package/dist/widgets/SourceSelector/Point/Point.js +0 -48
  44. package/dist/widgets/SourceSelector/Point/index.d.ts +0 -1
  45. package/dist/widgets/SourceSelector/Point/styles.cjs +0 -9
  46. package/dist/widgets/SourceSelector/PointSelector/index.cjs +0 -1
  47. package/dist/widgets/SourceSelector/PointSelector/index.d.ts +0 -13
  48. package/dist/widgets/SourceSelector/PointSelector/index.js +0 -47
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),l=require("react"),y=require("react-i18next"),z=require("@rubin-epo/epo-react-lib/IconComposer"),E=require("../../layout/AspectRatio/index.cjs"),I=require("../../atomic/Loader/index.cjs"),N=require("./PointSelector/index.cjs"),R=require("./styles.cjs"),U=require("./Message/Message.cjs"),w=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),D=e=>e&&e.__esModule?e:{default:e},G=D(z),H=(e,u)=>{var r;const n={day:0,hour:0},o=e[u];if(!o)return n;const t=(o==null?void 0:o.date)-((r=e[0])==null?void 0:r.date);return t?{day:Math.round(t)||0,hour:Math.round(24/t%24)||0}:n},M=({width:e=600,height:u=600,selectedSource:n=[],sources:o,alerts:t=[],activeAlertIndex:r=0,alertChangeCallback:j,selectionCallback:d,blinkConfig:q,isDisplayOnly:c=!1,isLoading:b,className:C})=>{var S;const[_,k]=l.useState(!0),[p,f]=l.useState(),[V,i]=l.useState(!1),{t:g}=y.useTranslation(),h="sourceSelectorWidget",m=!_&&!b,x=()=>{f(g("source_selector.messages.failure")),i(!0)},L=a=>{if(!(!m||c))if(a){const F=!!o.find(({id:W})=>W===a),P=!n.includes(a);F&&P?(d&&d(n.concat(a)),f(s.jsxs(s.Fragment,{children:[s.jsx(G.default,{icon:"checkmark"}),g("source_selector.messages.success")]})),i(!0)):x()}else x()},T=()=>{i(!1)},{day:$,hour:v}=H(t,r),B=c?[(S=t[r])==null?void 0:S.image]:t.map(({image:a})=>a);return s.jsxs(E.default,{ratio:1,className:C,children:[!c&&s.jsx(U.default,{onMessageChangeCallback:T,isVisible:V,forIds:[h],children:p}),s.jsx(R.BackgroundBlinker,{images:B,activeIndex:r,blinkCallback:j,loadedCallback:()=>k(!1),extraControls:t.length>0&&!c&&s.jsx(w.default,{day:$,hour:v}),...q,children:s.jsx(N.default,{id:h,onSelectCallback:L,width:e,height:u,sources:o,selectedSource:n})}),!m&&s.jsx(I.default,{})]})};M.displayName="Widgets.SourceSelector";const J=M;exports.default=J;
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),q=({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:$,target:S})=>{if(!M||a)return;const{tagName:D,clientWidth:N,clientHeight:k}=S;if(D.toLowerCase()!=="img")return;const{left:W,top:v}=S.getBoundingClientRect(),g=O({x:f-W,y:k-$+v},N,k,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,{})]})};q.displayName="Widgets.SourceSelector";const te=q;exports.default=te;
@@ -1,93 +1,115 @@
1
1
  "use client";
2
- import { jsxs as C, jsx as a, Fragment as U } from "react/jsx-runtime";
3
- import { useState as f } from "react";
4
- import { useTranslation as $ } from "react-i18next";
5
- import q from "@rubin-epo/epo-react-lib/IconComposer";
6
- import v from "../../layout/AspectRatio/index.js";
7
- import w from "../../atomic/Loader/index.js";
8
- import G from "./PointSelector/index.js";
9
- import { BackgroundBlinker as H } from "./styles.js";
10
- import J from "./Message/Message.js";
11
- import K from "../../atomic/ElapsedTime/ElapsedTime.js";
12
- const Q = (n, c) => {
13
- var t;
14
- const s = { day: 0, hour: 0 }, o = n[c];
15
- if (!o)
16
- return s;
17
- const e = (o == null ? void 0 : o.date) - ((t = n[0]) == null ? void 0 : t.date);
18
- return e ? {
19
- day: Math.round(e) || 0,
20
- hour: Math.round(24 / e % 24) || 0
21
- } : s;
22
- }, M = ({
23
- width: n = 600,
24
- height: c = 600,
25
- selectedSource: s = [],
26
- sources: o,
27
- alerts: e = [],
28
- activeAlertIndex: t = 0,
29
- alertChangeCallback: b,
30
- selectionCallback: l,
31
- blinkConfig: k,
32
- isDisplayOnly: i = !1,
33
- isLoading: L,
34
- className: V
2
+ import { jsxs as S, jsx as i, Fragment as $ } from "react/jsx-runtime";
3
+ import { useState as g } from "react";
4
+ import { useTranslation as q } from "react-i18next";
5
+ import A from "../../layout/AspectRatio/index.js";
6
+ import D from "../../atomic/Loader/index.js";
7
+ import G from "@rubin-epo/epo-react-lib/IconComposer";
8
+ import J from "./SourceMap/index.js";
9
+ import { getRadius as K, toDecimalPercent as b } from "./utils.js";
10
+ import { BackgroundBlinker as Q } from "./styles.js";
11
+ import U from "./Message/Message.js";
12
+ import Z from "../../atomic/ElapsedTime/ElapsedTime.js";
13
+ const v = (e, o) => {
14
+ var n;
15
+ const t = { day: 0, hour: 0 }, s = e[o];
16
+ if (!s)
17
+ return t;
18
+ const r = (s == null ? void 0 : s.date) - ((n = e[0]) == null ? void 0 : n.date);
19
+ return r ? {
20
+ day: Math.round(r) || 0,
21
+ hour: Math.round(24 / r % 24) || 0
22
+ } : t;
23
+ }, O = (e, o, t) => Math.pow(e.x - o.x, 2) + Math.pow(e.y - o.y, 2) <= Math.pow(t, 2), ee = (e, o, t, s) => {
24
+ var r;
25
+ return (r = s.find(({ x: n, y: l, radius: c, type: d }) => O(
26
+ e,
27
+ {
28
+ x: b(n) * o,
29
+ y: b(l) * t
30
+ },
31
+ K(d, c) * o
32
+ ))) == null ? void 0 : r.id;
33
+ }, oe = (e, o, t) => t ? e[o] ? [e[o].image] : [] : e.map(({ image: s }) => s), x = ({
34
+ width: e = 600,
35
+ height: o = 600,
36
+ selectedSource: t = [],
37
+ sources: s,
38
+ alerts: r = [],
39
+ activeAlertIndex: n = 0,
40
+ alertChangeCallback: l,
41
+ selectionCallback: c,
42
+ blinkConfig: d,
43
+ isDisplayOnly: a = !1,
44
+ isLoading: w,
45
+ className: y
35
46
  }) => {
36
- var S;
37
- const [x, j] = f(!0), [B, d] = f(), [F, m] = f(!1), { t: u } = $(), g = "sourceSelectorWidget", h = !x && !L, p = () => {
38
- d(u("source_selector.messages.failure")), m(!0);
39
- }, P = (r) => {
40
- if (!(!h || i))
41
- if (r) {
42
- const E = !!o.find(({ id: R }) => R === r), N = !s.includes(r);
43
- E && N ? (l && l(s.concat(r)), d(
44
- /* @__PURE__ */ C(U, { children: [
45
- /* @__PURE__ */ a(q, { icon: "checkmark" }),
46
- u("source_selector.messages.success")
47
- ] })
48
- ), m(!0)) : p();
49
- } else
50
- p();
47
+ const [L, I] = g(!0), [B, h] = g(), [F, u] = g(!1), { t: p } = q(), C = !L && !w, R = () => {
48
+ h(p("source_selector.messages.failure")), u(!0);
51
49
  }, T = () => {
52
- m(!1);
53
- }, { day: W, hour: _ } = Q(e, t), z = i ? [(S = e[t]) == null ? void 0 : S.image] : e.map(({ image: r }) => r);
54
- return /* @__PURE__ */ C(v, { ratio: 1, className: V, children: [
55
- !i && /* @__PURE__ */ a(
56
- J,
50
+ h(
51
+ /* @__PURE__ */ S($, { children: [
52
+ /* @__PURE__ */ i(G, { icon: "checkmark" }),
53
+ p("source_selector.messages.success")
54
+ ] })
55
+ ), u(!0);
56
+ }, V = ({
57
+ clientX: m,
58
+ clientY: z,
59
+ target: k
60
+ }) => {
61
+ if (!C || a)
62
+ return;
63
+ const {
64
+ tagName: E,
65
+ clientWidth: H,
66
+ clientHeight: M
67
+ } = k;
68
+ if (E.toLowerCase() !== "img")
69
+ return;
70
+ const { left: X, top: Y } = k.getBoundingClientRect(), f = ee(
71
+ { x: m - X, y: M - z + Y },
72
+ H,
73
+ M,
74
+ s
75
+ );
76
+ if (f) {
77
+ if (t.includes(f))
78
+ return;
79
+ c && c(t.concat(f)), T();
80
+ } else
81
+ R();
82
+ }, j = () => {
83
+ u(!1);
84
+ }, { day: N, hour: P } = v(r, n), W = oe(r, n, a), _ = s.filter(({ id: m }) => t.includes(m));
85
+ return /* @__PURE__ */ S(A, { ratio: 1, className: y, children: [
86
+ !a && /* @__PURE__ */ i(
87
+ U,
57
88
  {
58
- onMessageChangeCallback: T,
89
+ onMessageChangeCallback: j,
59
90
  isVisible: F,
60
- forIds: [g],
61
91
  children: B
62
92
  }
63
93
  ),
64
- /* @__PURE__ */ a(
65
- H,
94
+ /* @__PURE__ */ i(
95
+ Q,
66
96
  {
67
- images: z,
68
- activeIndex: t,
69
- blinkCallback: b,
70
- loadedCallback: () => j(!1),
71
- extraControls: e.length > 0 && !i && /* @__PURE__ */ a(K, { day: W, hour: _ }),
72
- ...k,
73
- children: /* @__PURE__ */ a(
74
- G,
75
- {
76
- id: g,
77
- onSelectCallback: P,
78
- width: n,
79
- height: c,
80
- sources: o,
81
- selectedSource: s
82
- }
83
- )
97
+ images: W,
98
+ activeIndex: n,
99
+ blinkCallback: l,
100
+ loadedCallback: () => I(!1),
101
+ onClickCallback: V,
102
+ extraControls: r.length > 0 && !a && /* @__PURE__ */ i(Z, { day: N, hour: P }),
103
+ interval: 400,
104
+ ...d,
105
+ children: /* @__PURE__ */ i(J, { sources: _, width: e, height: o })
84
106
  }
85
107
  ),
86
- !h && /* @__PURE__ */ a(w, {})
108
+ !C && /* @__PURE__ */ i(D, {})
87
109
  ] });
88
110
  };
89
- M.displayName = "Widgets.SourceSelector";
90
- const se = M;
111
+ x.displayName = "Widgets.SourceSelector";
112
+ const ge = x;
91
113
  export {
92
- se as default
114
+ ge as default
93
115
  };
@@ -1,6 +1,5 @@
1
1
  import { default as SourceSelector } from './SourceSelector';
2
2
 
3
- export { default as PointSelector } from './PointSelector';
4
3
  export { default as Message } from './Message';
5
4
  export { default as SelectionList } from './SelectionList';
6
5
  export default SourceSelector;
@@ -1,10 +1,6 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("styled-components"),l=require("../../atomic/Blinker/Blinker.cjs"),n=t=>t&&t.__esModule?t:{default:t},e=n(o),s=e.default.svg`
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("styled-components"),o=require("../../atomic/Blinker/Blinker.cjs"),r=e=>e&&e.__esModule?e:{default:e},l=r(t),n=l.default(o.default)`
2
2
  cursor: pointer;
3
- position: absolute;
4
- bottom: 0;
5
- left: 0;
6
- `,u=e.default(l.default)`
7
3
  position: absolute;
8
4
  width: 100%;
9
5
  height: 100%;
10
- `;exports.BackgroundBlinker=u;exports.SVG=s;
6
+ `;exports.BackgroundBlinker=n;