@rubin-epo/epo-widget-lib 2.0.2 → 2.0.4

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 (77) 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/localeStrings/en/epo-widget-lib.json +12 -3
  13. package/dist/localeStrings/es/epo-widget-lib.json +8 -5
  14. package/dist/mock-data/OrbitalSim/index.d.ts +162 -0
  15. package/dist/widgets/OrbitalSim/Context/OrbitalSimContext.types.d.ts +57 -0
  16. package/dist/widgets/OrbitalSim/Context/index.cjs +1 -1
  17. package/dist/widgets/OrbitalSim/Context/index.d.ts +2 -38
  18. package/dist/widgets/OrbitalSim/Context/index.js +61 -39
  19. package/dist/widgets/OrbitalSim/Controls/PlaybackSpeed.cjs +1 -1
  20. package/dist/widgets/OrbitalSim/Controls/PlaybackSpeed.js +53 -68
  21. package/dist/widgets/OrbitalSim/Controls/styles.cjs +38 -32
  22. package/dist/widgets/OrbitalSim/Controls/styles.d.ts +1 -0
  23. package/dist/widgets/OrbitalSim/Controls/styles.js +53 -46
  24. package/dist/widgets/OrbitalSim/Observations/Observation.cjs +1 -1
  25. package/dist/widgets/OrbitalSim/Observations/Observation.js +11 -10
  26. package/dist/widgets/OrbitalSim/Observations/styles.cjs +11 -0
  27. package/dist/widgets/OrbitalSim/Observations/styles.d.ts +1 -0
  28. package/dist/widgets/OrbitalSim/Observations/styles.js +16 -0
  29. package/dist/widgets/OrbitalSim/OrbitalSim.cjs +1 -1
  30. package/dist/widgets/OrbitalSim/OrbitalSim.js +94 -77
  31. package/dist/widgets/OrbitalSim/OrbitalSim.module.css.cjs +1 -1
  32. package/dist/widgets/OrbitalSim/OrbitalSim.module.css.js +2 -4
  33. package/dist/widgets/OrbitalSim/Orbitals/Orbital.cjs +1 -1
  34. package/dist/widgets/OrbitalSim/Orbitals/Orbital.js +41 -41
  35. package/dist/widgets/OrbitalSim/Orbitals/OrbitalDetails.cjs +1 -1
  36. package/dist/widgets/OrbitalSim/Orbitals/OrbitalDetails.js +19 -17
  37. package/dist/widgets/OrbitalSim/Orbitals/Orbitals.cjs +1 -1
  38. package/dist/widgets/OrbitalSim/Orbitals/Orbitals.d.ts +2 -1
  39. package/dist/widgets/OrbitalSim/Orbitals/Orbitals.js +41 -40
  40. package/dist/widgets/OrbitalSim/Orbitals/styles.cjs +15 -8
  41. package/dist/widgets/OrbitalSim/Orbitals/styles.js +17 -10
  42. package/dist/widgets/OrbitalSim/Sun.cjs +1 -1
  43. package/dist/widgets/OrbitalSim/Sun.js +13 -14
  44. package/dist/widgets/OrbitalSim/orbitalUtilities.cjs +1 -1
  45. package/dist/widgets/OrbitalSim/orbitalUtilities.d.ts +65 -0
  46. package/dist/widgets/OrbitalSim/orbitalUtilities.js +100 -57
  47. package/dist/widgets/OrbitalSim/styles.cjs +47 -12
  48. package/dist/widgets/OrbitalSim/styles.d.ts +3 -0
  49. package/dist/widgets/OrbitalSim/styles.js +52 -14
  50. package/dist/widgets/SortableTable/SortableTable.cjs +1 -0
  51. package/dist/widgets/SortableTable/SortableTable.d.ts +19 -0
  52. package/dist/widgets/SortableTable/SortableTable.js +41 -0
  53. package/dist/widgets/SortableTable/index.d.ts +1 -0
  54. package/dist/widgets/SortableTable/styles.cjs +8 -0
  55. package/dist/widgets/SortableTable/styles.d.ts +1 -0
  56. package/dist/widgets/SortableTable/styles.js +13 -0
  57. package/dist/widgets/SourceSelector/MovingSourceMap/index.cjs +1 -0
  58. package/dist/widgets/SourceSelector/MovingSourceMap/index.d.ts +13 -0
  59. package/dist/widgets/SourceSelector/MovingSourceMap/index.js +42 -0
  60. package/dist/widgets/SourceSelector/MovingSourceMap/styles.cjs +14 -0
  61. package/dist/widgets/SourceSelector/MovingSourceMap/styles.d.ts +2 -0
  62. package/dist/widgets/SourceSelector/MovingSourceMap/styles.js +20 -0
  63. package/dist/widgets/SourceSelector/MovingSourceSelector.cjs +1 -0
  64. package/dist/widgets/SourceSelector/MovingSourceSelector.d.ts +24 -0
  65. package/dist/widgets/SourceSelector/MovingSourceSelector.js +119 -0
  66. package/dist/widgets/SourceSelector/SourceSelector.cjs +1 -1
  67. package/dist/widgets/SourceSelector/SourceSelector.d.ts +1 -1
  68. package/dist/widgets/SourceSelector/SourceSelector.js +43 -42
  69. package/dist/widgets/SourceSelector/index.d.ts +2 -1
  70. package/dist/widgets/SourceSelector/mocks/index.d.ts +1 -0
  71. package/package.json +2 -1
  72. package/dist/widgets/OrbitalSim/Context/OrbitalSimContext.d.ts +0 -0
  73. package/dist/widgets/SourceSelector/SelectionList/index.cjs +0 -1
  74. package/dist/widgets/SourceSelector/SelectionList/index.js +0 -31
  75. /package/dist/{widgets/SourceSelector → atomic}/SelectionList/styles.cjs +0 -0
  76. /package/dist/{widgets/SourceSelector → atomic}/SelectionList/styles.d.ts +0 -0
  77. /package/dist/{widgets/SourceSelector → atomic}/SelectionList/styles.js +0 -0
@@ -1,4 +1,4 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("styled-components"),i=require("@react-three/fiber"),r=e=>e&&e.__esModule?e:{default:e},t=r(a),l=a.createGlobalStyle`
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("styled-components"),r=require("@react-three/fiber"),i=t=>t&&t.__esModule?t:{default:t},e=i(a),o=a.createGlobalStyle`
2
2
  :root {
3
3
  --white: #ffffff;
4
4
  --black: #000000;
@@ -27,22 +27,57 @@
27
27
 
28
28
  --siteProgressHeight: 26px;
29
29
  --siteToolbarHeight: 64px;
30
- --siteHeaderHeight: var(--siteProgressHeight) + var(--siteToolbarHeight);
30
+ --siteHeaderHeight: calc(var(--siteProgressHeight) + var(--siteToolbarHeight));
31
31
  --pageNavHeight: 64px;
32
32
  --headingWithSpaceHeight: 90px;
33
- // --tallestSquareWidget: calc(100vh - var(--pageNavHeight) - var(--siteHeaderHeight) - var(--headingWithSpaceHeight) - var(--minPadding));
33
+ --tallestSquareWidget: calc(100vh - var(--pageNavHeight) - var(--siteHeaderHeight) - var(--headingWithSpaceHeight) - var(--minPadding));
34
34
  }
35
- `,o=t.default.div`
35
+ `,l=e.default.div`
36
36
  position: relative;
37
- // height: var(--tallestSquareWidget);
38
- height: 750px; // revisit this close to MVP
39
- // min-height: var(--break40);
37
+ height: var(--tallestSquareWidget);
40
38
  min-height: 500px;
41
- background-color: var(--black);
39
+ background-color: #000000;
42
40
  color-adjust: exact;
43
- `,s=t.default(i.Canvas)`
44
- display: inline;
41
+ `,n=e.default(r.Canvas)`
45
42
  position: relative;
46
- height: 100%;
47
43
  z-index: 1;
48
- `;exports.CanvasWrapper=s;exports.GlobalStyles=l;exports.OrbitalSimWrapper=o;
44
+ `,d=e.default.div`
45
+ padding: 2px 4px;
46
+ margin-top: 4px;
47
+ font-weight: var(--medium);
48
+ color: var(--black);
49
+ background-color: color-mix(in srgb, var(--white) 75%, transparent);
50
+ border: 1px solid color-mix(in srgb, var(--white) 75%, transparent);;
51
+ border-radius: 5px;
52
+ color-adjust: exact;
53
+ z-index: 10000;
54
+ height: fit-content;
55
+ `,s=e.default.aside`
56
+ position: absolute;
57
+ top: 0px;
58
+ left: 0px;
59
+ bottom: 0px;
60
+ z-index: 10;
61
+ background-color: #fff;
62
+ width: 10%;
63
+ height: 100%;
64
+ display: flex;
65
+ flex-direction: column;
66
+ `,p=e.default.button`
67
+ width: 100%;
68
+ padding: 12px 16px;
69
+ text-align: left;
70
+ background-color: #F3F3F3;
71
+ color: #017F80;
72
+ text-align: center;
73
+
74
+ &:hover {
75
+ background-color: #017F80;
76
+ color: #fff;
77
+ }
78
+
79
+ &[data-active="true"] {
80
+ background-color: #017F80;
81
+ color: #fff;
82
+ }
83
+ `;exports.CanvasWrapper=n;exports.GlobalStyles=o;exports.OrbitalSimWrapper=l;exports.SunLabel=d;exports.SwappableOrbitButton=p;exports.SwappableOrbitsContainer=s;
@@ -3,3 +3,6 @@ import { Canvas } from '@react-three/fiber';
3
3
  export declare const GlobalStyles: import('react').NamedExoticComponent<import('styled-components').ExecutionProps & object>;
4
4
  export declare const OrbitalSimWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
5
  export declare const CanvasWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('@react-three/fiber').CanvasProps, never>> & string & Omit<typeof Canvas, keyof import('react').Component<any, {}, any>>;
6
+ export declare const SunLabel: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
+ export declare const SwappableOrbitsContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
8
+ export declare const SwappableOrbitButton: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import e, { createGlobalStyle as a } from "styled-components";
3
- import { Canvas as i } from "@react-three/fiber";
4
- const o = a`
2
+ import e, { createGlobalStyle as t } from "styled-components";
3
+ import { Canvas as a } from "@react-three/fiber";
4
+ const o = t`
5
5
  :root {
6
6
  --white: #ffffff;
7
7
  --black: #000000;
@@ -30,27 +30,65 @@ const o = a`
30
30
 
31
31
  --siteProgressHeight: 26px;
32
32
  --siteToolbarHeight: 64px;
33
- --siteHeaderHeight: var(--siteProgressHeight) + var(--siteToolbarHeight);
33
+ --siteHeaderHeight: calc(var(--siteProgressHeight) + var(--siteToolbarHeight));
34
34
  --pageNavHeight: 64px;
35
35
  --headingWithSpaceHeight: 90px;
36
- // --tallestSquareWidget: calc(100vh - var(--pageNavHeight) - var(--siteHeaderHeight) - var(--headingWithSpaceHeight) - var(--minPadding));
36
+ --tallestSquareWidget: calc(100vh - var(--pageNavHeight) - var(--siteHeaderHeight) - var(--headingWithSpaceHeight) - var(--minPadding));
37
37
  }
38
38
  `, l = e.div`
39
39
  position: relative;
40
- // height: var(--tallestSquareWidget);
41
- height: 750px; // revisit this close to MVP
42
- // min-height: var(--break40);
40
+ height: var(--tallestSquareWidget);
43
41
  min-height: 500px;
44
- background-color: var(--black);
42
+ background-color: #000000;
45
43
  color-adjust: exact;
46
- `, s = e(i)`
47
- display: inline;
44
+ `, n = e(a)`
48
45
  position: relative;
49
- height: 100%;
50
46
  z-index: 1;
47
+ `, d = e.div`
48
+ padding: 2px 4px;
49
+ margin-top: 4px;
50
+ font-weight: var(--medium);
51
+ color: var(--black);
52
+ background-color: color-mix(in srgb, var(--white) 75%, transparent);
53
+ border: 1px solid color-mix(in srgb, var(--white) 75%, transparent);;
54
+ border-radius: 5px;
55
+ color-adjust: exact;
56
+ z-index: 10000;
57
+ height: fit-content;
58
+ `, c = e.aside`
59
+ position: absolute;
60
+ top: 0px;
61
+ left: 0px;
62
+ bottom: 0px;
63
+ z-index: 10;
64
+ background-color: #fff;
65
+ width: 10%;
66
+ height: 100%;
67
+ display: flex;
68
+ flex-direction: column;
69
+ `, p = e.button`
70
+ width: 100%;
71
+ padding: 12px 16px;
72
+ text-align: left;
73
+ background-color: #F3F3F3;
74
+ color: #017F80;
75
+ text-align: center;
76
+
77
+ &:hover {
78
+ background-color: #017F80;
79
+ color: #fff;
80
+ }
81
+
82
+ &[data-active="true"] {
83
+ background-color: #017F80;
84
+ color: #fff;
85
+ }
51
86
  `;
52
87
  export {
53
- s as CanvasWrapper,
88
+ n as CanvasWrapper,
54
89
  o as GlobalStyles,
55
- l as OrbitalSimWrapper
90
+ l as OrbitalSimWrapper,
91
+ d as SunLabel,
92
+ p as SwappableOrbitButton,
93
+ c as SwappableOrbitsContainer
56
94
  };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),d=require("react"),C=require("./styles.cjs"),r="asc",w="desc",j=({tableData:a})=>{const[i]=d.useState(a),o=a?Object.keys(i[0]):null,[s,f]=d.useState(o?o[0]:""),[c,S]=d.useState(r);function p(e){if(s===e){S(n=>n===r?w:r);return}f(e),S(r)}const m=d.useMemo(()=>{if(i)return[...i].sort((n,g)=>{const u=n[s],l=g[s];if(typeof u=="number"&&typeof l=="number")return c===r?u-l:l-u;const b=String(u).toLowerCase(),h=String(l).toLowerCase();return c===r?b.localeCompare(h):h.localeCompare(b)})},[i,s,c]);function x(e){return s!==e?"":c===r?"↑":"↓"}return t.jsx(t.Fragment,{children:a&&t.jsxs(C.Table,{children:[t.jsx("thead",{children:t.jsx("tr",{children:o&&o.map(e=>t.jsx("th",{scope:"col","aria-sort":s===e?c===r?"ascending":"descending":"none",children:t.jsxs("button",{type:"button",onClick:()=>p(e),children:[e," ",x(e)]})},e))})}),t.jsx("tbody",{children:m&&m.map(e=>t.jsx("tr",{children:o&&o.map(n=>t.jsx("td",{children:e[n]},n))}))})]})})};j.displayName="Widgets.SortableTable";exports.default=j;
@@ -0,0 +1,19 @@
1
+ type TableDataProps<T extends Record<string, string | number | null>> = {
2
+ tableData: T[];
3
+ };
4
+ /**
5
+ * This widget will take an array of uniform (same properties across all elements)
6
+ * objects and render a table from the values. The table headers will be created
7
+ * based on the property names. The table can be sorted ascending or descending
8
+ * by one column at a time. If non-uniform objects are contained in the array,
9
+ * the widget will only build out the columns specific by the properties on the
10
+ * first element of the array.
11
+ *
12
+ * @param tabledata: an array of objects that will be used to build the table
13
+ * @returns the sortable table
14
+ */
15
+ declare const SortableTable: {
16
+ <T extends Record<string, string | number | null>>({ tableData }: TableDataProps<T>): import("react/jsx-runtime").JSX.Element;
17
+ displayName: string;
18
+ };
19
+ export default SortableTable;
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { jsx as o, Fragment as j, jsxs as h } from "react/jsx-runtime";
3
+ import { useState as u, useMemo as x } from "react";
4
+ import { Table as N } from "./styles.js";
5
+ const r = "asc", T = "desc", y = ({
6
+ tableData: a
7
+ }) => {
8
+ const [i] = u(a), e = a ? Object.keys(i[0]) : null, [n, b] = u(e ? e[0] : ""), [c, m] = u(r);
9
+ function g(t) {
10
+ if (n === t) {
11
+ m((s) => s === r ? T : r);
12
+ return;
13
+ }
14
+ b(t), m(r);
15
+ }
16
+ const p = x(() => {
17
+ if (i)
18
+ return [...i].sort((s, w) => {
19
+ const l = s[n], d = w[n];
20
+ if (typeof l == "number" && typeof d == "number")
21
+ return c === r ? l - d : d - l;
22
+ const f = String(l).toLowerCase(), S = String(d).toLowerCase();
23
+ return c === r ? f.localeCompare(S) : S.localeCompare(f);
24
+ });
25
+ }, [i, n, c]);
26
+ function C(t) {
27
+ return n !== t ? "" : c === r ? "↑" : "↓";
28
+ }
29
+ return /* @__PURE__ */ o(j, { children: a && /* @__PURE__ */ h(N, { children: [
30
+ /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ o("tr", { children: e && e.map((t) => /* @__PURE__ */ o("th", { scope: "col", "aria-sort": n === t ? c === r ? "ascending" : "descending" : "none", children: /* @__PURE__ */ h("button", { type: "button", onClick: () => g(t), children: [
31
+ t,
32
+ " ",
33
+ C(t)
34
+ ] }) }, t)) }) }),
35
+ /* @__PURE__ */ o("tbody", { children: p && p.map((t) => /* @__PURE__ */ o("tr", { children: e && e.map((s) => /* @__PURE__ */ o("td", { children: t[s] }, s)) })) })
36
+ ] }) });
37
+ };
38
+ y.displayName = "Widgets.SortableTable";
39
+ export {
40
+ y as default
41
+ };
@@ -0,0 +1 @@
1
+ export { default, default as SortableTable } from './SortableTable';
@@ -0,0 +1,8 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("styled-components"),l=e=>e&&e.__esModule?e:{default:e},d=l(t),o=d.default.table`
2
+ border: 1px solid #000000;
3
+ text-align: center;
4
+ border-spacing: 0px;
5
+ & > th, td, thead, thead > tr > th{
6
+ border: 1px solid #000000;
7
+ }
8
+ `;exports.Table=o;
@@ -0,0 +1 @@
1
+ export declare const Table: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, never>> & string;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import t from "styled-components";
3
+ const r = t.table`
4
+ border: 1px solid #000000;
5
+ text-align: center;
6
+ border-spacing: 0px;
7
+ & > th, td, thead, thead > tr > th{
8
+ border: 1px solid #000000;
9
+ }
10
+ `;
11
+ export {
12
+ r as Table
13
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),o=require("../utils.cjs"),n=require("./styles.cjs"),p=(e,r)=>typeof e=="string"?e.includes("%")?`${100-parseFloat(e)}%`:r-parseFloat(e):r-e,a=({width:e,height:r,movingSources:i,selectedSource:d,currentIndex:c})=>s.jsxs(s.Fragment,{children:[" ",i&&i.map((t,u)=>{let l=t.sources[c];if(d.includes(t.id))return s.jsx(n.SVG,{preserveAspectRatio:"xMidYMid meet",viewBox:`0 0 ${e} ${r}`,children:s.jsx("g",{role:"list",children:s.jsx(n.Point,{cx:l.x,cy:p(l.y,r),fill:"transparent",stroke:t.color??"#fed828",strokeWidth:3,tabIndex:0,role:"listitem",r:`${o.getRadius(t.type,NaN)*100}%`,id:`${t.id}`},`${t.id}-${u}`)})})})]});a.displayName="Widgets.MovingSourceMap";exports.default=a;
@@ -0,0 +1,13 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { MovingSources } from '../../../types/astro';
3
+
4
+ export interface MovingSourceMapProps {
5
+ width: number;
6
+ height: number;
7
+ isPlaying: boolean;
8
+ movingSources: MovingSources[];
9
+ selectedSource: string[];
10
+ currentIndex: number;
11
+ }
12
+ declare const MovingSourceMap: FunctionComponent<MovingSourceMapProps>;
13
+ export default MovingSourceMap;
@@ -0,0 +1,42 @@
1
+ import { jsxs as o, Fragment as p, jsx as s } from "react/jsx-runtime";
2
+ import { getRadius as c } from "../utils.js";
3
+ import { SVG as f, Point as x } from "./styles.js";
4
+ const $ = (e, r) => typeof e == "string" ? e.includes("%") ? `${100 - parseFloat(e)}%` : r - parseFloat(e) : r - e, m = ({
5
+ width: e,
6
+ height: r,
7
+ movingSources: i,
8
+ selectedSource: d,
9
+ currentIndex: n
10
+ }) => /* @__PURE__ */ o(p, { children: [
11
+ " ",
12
+ i && i.map((t, l) => {
13
+ let a = t.sources[n];
14
+ if (d.includes(t.id))
15
+ return /* @__PURE__ */ s(
16
+ f,
17
+ {
18
+ preserveAspectRatio: "xMidYMid meet",
19
+ viewBox: `0 0 ${e} ${r}`,
20
+ children: /* @__PURE__ */ s("g", { role: "list", children: /* @__PURE__ */ s(
21
+ x,
22
+ {
23
+ cx: a.x,
24
+ cy: $(a.y, r),
25
+ fill: "transparent",
26
+ stroke: t.color ?? "#fed828",
27
+ strokeWidth: 3,
28
+ tabIndex: 0,
29
+ role: "listitem",
30
+ r: `${c(t.type, NaN) * 100}%`,
31
+ id: `${t.id}`
32
+ },
33
+ `${t.id}-${l}`
34
+ ) })
35
+ }
36
+ );
37
+ })
38
+ ] });
39
+ m.displayName = "Widgets.MovingSourceMap";
40
+ export {
41
+ m as default
42
+ };
@@ -0,0 +1,14 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("styled-components"),n=t=>t&&t.__esModule?t:{default:t},e=n(o),s=e.default.svg`
2
+ pointer-events: none;
3
+ position: absolute;
4
+ bottom: 0;
5
+ left: 0;
6
+ `,r=e.default.circle`
7
+ cursor: pointer;
8
+ transition: transform ease var(--DURATION, 0.2s);
9
+ transform-origin: center;
10
+
11
+ &:focus {
12
+ outline: none;
13
+ }
14
+ `;exports.Point=r;exports.SVG=s;
@@ -0,0 +1,2 @@
1
+ export declare const SVG: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').SVGProps<SVGSVGElement>, never>> & string;
2
+ export declare const Point: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').SVGProps<SVGCircleElement>, never>> & string;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import o from "styled-components";
3
+ const n = o.svg`
4
+ pointer-events: none;
5
+ position: absolute;
6
+ bottom: 0;
7
+ left: 0;
8
+ `, e = o.circle`
9
+ cursor: pointer;
10
+ transition: transform ease var(--DURATION, 0.2s);
11
+ transform-origin: center;
12
+
13
+ &:focus {
14
+ outline: none;
15
+ }
16
+ `;
17
+ export {
18
+ e as Point,
19
+ n as SVG
20
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),u=require("react"),G=require("react-i18next"),J=require("../../layout/AspectRatio/index.cjs"),K=require("../../atomic/Loader/index.cjs"),Q=require("@rubin-epo/epo-react-lib/IconComposer"),U=require("./MovingSourceMap/index.cjs"),k=require("./utils.cjs"),Z=require("./styles.cjs"),O=require("../../hooks/useInterval.cjs"),ee=require("./Message/Message.cjs"),te=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),se=e=>e&&e.__esModule?e:{default:e},ne=se(Q),oe=(e,n)=>{var l;const t={day:0,hour:0},s=e[n];if(!s)return t;const c=(s==null?void 0:s.date)-((l=e[0])==null?void 0:l.date);return c?{day:Math.round(c)||0,hour:Math.round(24/c%24)||0}:t},re=(e,n,t)=>Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2)<=Math.pow(t,2),ce=(e,n,t)=>t?e[n]?[e[n].image]:[]:e.map(({image:s})=>s),j=({width:e=600,height:n=600,selectedSource:t=[],alerts:s=[],activeAlertIndex:c=0,alertChangeCallback:l,selectionCallback:p,blinkConfig:_,isDisplayOnly:d=!1,isLoading:P,className:w,movingSources:i=[]})=>{const[f,q]=u.useState(0),[B,F]=u.useState(!0),[b,L]=u.useState(!0),[R,y]=u.useState(),[T,m]=u.useState(!1),{t:I}=G.useTranslation(),S=!B&&!P,V=(r,g,h)=>{if(i)for(let a of i){const x=a.sources[f];if(re(r,{x:k.toDecimalPercent(x.x)*g,y:k.toDecimalPercent(x.y)*h},k.getRadius(a.type,a.radius)*g))return a.id}},v=()=>{y(I("source_selector.messages.failure")),m(!0)},D=()=>{L(r=>!r)},N=()=>{y(o.jsxs(o.Fragment,{children:[o.jsx(ne.default,{icon:"checkmark"}),I("source_selector.messages.success")]})),m(!0)},W=({clientX:r,clientY:g,target:h})=>{if(!S||d)return;const{tagName:a,clientWidth:x,clientHeight:C}=h;if(a.toLowerCase()!=="img")return;const{left:Y,top:A}=h.getBoundingClientRect(),M=V({x:r-Y,y:C-g+A},x,C);if(M){if(t.includes(M))return;p&&p(t.concat(M)),N()}else v()},$=()=>{m(!1)},{day:z,hour:E}=oe(s,c),H=ce(s,c,d),X=()=>{b&&(f>i[0].sources.length-2?q(0):q(r=>r+1))};return O.default(X,500),o.jsxs(J.default,{ratio:1,className:w,children:[!d&&o.jsx(ee.default,{onMessageChangeCallback:$,isVisible:T,children:R}),i&&o.jsx(Z.BackgroundBlinker,{images:H,activeIndex:f,blinkCallback:l,loadedCallback:()=>F(!1),onClickCallback:W,extraControls:s.length>0&&!d&&o.jsx(te.default,{day:z,hour:E}),interval:400,pauseCallback:D,..._,children:o.jsx(U.default,{width:e,height:n,isPlaying:b,currentIndex:f,movingSources:i,selectedSource:t})}),!S&&o.jsx(K.default,{})]})};j.displayName="Widgets.MovingSourceSelector";exports.default=j;
@@ -0,0 +1,24 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { Alert, MovingSources } from '../../types/astro';
3
+
4
+ interface BlinkConfig {
5
+ autoplay?: boolean;
6
+ loop?: boolean;
7
+ duration?: number;
8
+ }
9
+ interface SourceSelectorProps {
10
+ width?: number;
11
+ height?: number;
12
+ alerts: Alert[];
13
+ selectedSource?: string[];
14
+ activeAlertIndex?: number;
15
+ alertChangeCallback?: (index: number) => void;
16
+ selectionCallback?: (data: string[]) => void;
17
+ blinkConfig?: BlinkConfig;
18
+ isDisplayOnly?: boolean;
19
+ isLoading?: boolean;
20
+ className?: string;
21
+ movingSources: MovingSources[];
22
+ }
23
+ declare const MovingSourceSelector: FunctionComponent<SourceSelectorProps>;
24
+ export default MovingSourceSelector;
@@ -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;