@rubin-epo/epo-widget-lib 0.9.0 → 0.9.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.
- package/dist/SourceSelector.cjs +1 -1
- package/dist/SourceSelector.d.ts +2 -0
- package/dist/SourceSelector.js +8 -8
- package/dist/charts/Base/index.cjs +1 -1
- package/dist/charts/Base/index.d.ts +3 -5
- package/dist/charts/Base/index.js +21 -19
- package/dist/charts/Base/styles.cjs +15 -7
- package/dist/charts/Base/styles.d.ts +272 -0
- package/dist/charts/Base/styles.js +17 -8
- package/dist/charts/Tooltip/index.cjs +1 -1
- package/dist/charts/Tooltip/index.js +13 -14
- package/dist/charts/Tooltip/styles.cjs +5 -3
- package/dist/charts/Tooltip/styles.d.ts +7 -0
- package/dist/charts/Tooltip/styles.js +9 -5
- package/dist/localeStrings/en/epo-widget-lib.json +1 -1
- package/dist/widgets/ColorTool/hooks/useFilteredImages.cjs +1 -1
- package/dist/widgets/ColorTool/hooks/useFilteredImages.js +15 -18
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/index.d.ts +1 -0
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/index.js +25 -23
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/styles.cjs +21 -16
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/styles.js +24 -19
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.d.ts +7 -6
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.js +55 -53
- package/dist/widgets/LightCurvePlot/PlotWithoutCurve/index.d.ts +2 -8
- package/dist/widgets/LightCurvePlot/ScatterPlot/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/ScatterPlot/index.d.ts +3 -5
- package/dist/widgets/LightCurvePlot/ScatterPlot/index.js +148 -153
- package/dist/widgets/LightCurvePlot/ScatterPlot/styles.cjs +7 -8
- package/dist/widgets/LightCurvePlot/ScatterPlot/styles.d.ts +7 -276
- package/dist/widgets/LightCurvePlot/ScatterPlot/styles.js +10 -12
- package/dist/widgets/LightCurvePlot/defaults.cjs +1 -1
- package/dist/widgets/LightCurvePlot/defaults.d.ts +2 -0
- package/dist/widgets/LightCurvePlot/defaults.js +2 -0
- package/dist/widgets/SourceSelector/SourceSelector.cjs +1 -1
- package/dist/widgets/SourceSelector/SourceSelector.d.ts +2 -2
- package/dist/widgets/SourceSelector/SourceSelector.js +28 -28
- package/dist/widgets/SourceSelector/index.d.ts +2 -1
- package/dist/widgets/SupernovaThreeVector/Histogram/index.cjs +1 -1
- package/dist/widgets/SupernovaThreeVector/Histogram/index.js +35 -35
- package/package.json +1 -1
- package/dist/lib/helpers.cjs +0 -1
- package/dist/lib/helpers.js +0 -4
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import o from "styled-components";
|
|
3
|
+
import r from "../ForeignObject/index.js";
|
|
4
|
+
const i = o(r)`
|
|
5
|
+
overflow: visible;
|
|
6
|
+
`, d = o.div`
|
|
4
7
|
background-color: #dce0e3;
|
|
5
8
|
border-radius: 4px;
|
|
6
9
|
font-size: 0.5em;
|
|
@@ -8,7 +11,7 @@ const t = r.div`
|
|
|
8
11
|
padding: 2px 4px;
|
|
9
12
|
text-align: center;
|
|
10
13
|
position: absolute;
|
|
11
|
-
`,
|
|
14
|
+
`, n = o.div`
|
|
12
15
|
width: 0;
|
|
13
16
|
height: 0;
|
|
14
17
|
border-left: var(--arrow-width, 6px) solid transparent;
|
|
@@ -20,6 +23,7 @@ const t = r.div`
|
|
|
20
23
|
left: 0;
|
|
21
24
|
`;
|
|
22
25
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
n as Arrow,
|
|
27
|
+
d as Tooltip,
|
|
28
|
+
i as TooltipContainer
|
|
25
29
|
};
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"point_label_peak": "Apparent Magnitude: {{magnitude}} at peak",
|
|
129
129
|
"point_label_after_one": "Apparent Magnitude: {{magnitude}} {{count}} day after peak",
|
|
130
130
|
"point_label_after_other": "Apparent Magnitude: {{magnitude}} {{count}} days after peak",
|
|
131
|
-
"tooltip": "Apparent Magnitude: {{magnitude}}
|
|
131
|
+
"tooltip": "Apparent Magnitude: {{magnitude}}"
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react"),_=require("lodash/isEqual"),q=require("../../../hooks/usePrevious.cjs"),f=require("../lib/canvas.cjs"),w=t=>t&&t.__esModule?t:{default:t},y=w(_),S=({images:t,filters:l})=>{const g=q.default(t),[v,d]=i.useState(0),[n,m]=i.useState(),I=n==null?void 0:n.some(({complete:s})=>!s),u=v!==t.length&&I;return i.useLayoutEffect(()=>{y.default(g,t)||(d(0),m(t.map(({url:s,width:o,height:r})=>{const e=new Image(o,r);return e.crossOrigin="anonymous",e.onload=()=>{d(a=>a+1)},e.src=s,e})))},[t]),u?[[],!!u]:[[...n||[]].map((s,o)=>{if(!l[o].active)return;const r=document.createElement("canvas"),e=r.getContext("2d");if(e){const{width:a,height:c}=s,{color:h="transparent",brightness:p}=l[o];e.canvas.width=a,e.canvas.height=c,e.clearRect(0,0,a,c),e.filter=f.getFilters({brightness:p,contrast:1.3}),e.drawImage(s,0,0,a,c),f.updateColor(e,h,a,c)}return r}).filter(s=>!!s),!!u]},b=S;exports.default=b;
|
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { getFilters as
|
|
6
|
-
const
|
|
2
|
+
import { useState as d, useLayoutEffect as h } from "react";
|
|
3
|
+
import w from "lodash/isEqual";
|
|
4
|
+
import x from "../../../hooks/usePrevious.js";
|
|
5
|
+
import { getFilters as y, updateColor as F } from "../lib/canvas.js";
|
|
6
|
+
const L = ({
|
|
7
7
|
images: s,
|
|
8
8
|
filters: u
|
|
9
9
|
}) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const l = x(s), [f, m] = d(0), [n, g] = d(), p = n == null ? void 0 : n.some(({ complete: e }) => !e), i = f !== s.length && p;
|
|
11
|
+
return h(() => {
|
|
12
|
+
w(l, s) || (m(0), g(
|
|
13
13
|
s.map(({ url: e, width: a, height: r }) => {
|
|
14
14
|
const t = new Image(a, r);
|
|
15
|
-
return t.onload = () => {
|
|
15
|
+
return t.crossOrigin = "anonymous", t.onload = () => {
|
|
16
16
|
m((o) => o + 1);
|
|
17
17
|
}, t.src = e, t;
|
|
18
18
|
})
|
|
19
19
|
));
|
|
20
|
-
}, [s]), i)
|
|
21
|
-
return [[], !!i];
|
|
22
|
-
const d = [...n || []].map((e, a) => {
|
|
20
|
+
}, [s]), i ? [[], !!i] : [[...n || []].map((e, a) => {
|
|
23
21
|
if (!u[a].active)
|
|
24
22
|
return;
|
|
25
23
|
const r = document.createElement("canvas"), t = r.getContext("2d");
|
|
26
24
|
if (t) {
|
|
27
|
-
const { width: o, height: c } = e, { color:
|
|
28
|
-
t.canvas.width = o, t.canvas.height = c, t.clearRect(0, 0, o, c), t.filter =
|
|
25
|
+
const { width: o, height: c } = e, { color: v = "transparent", brightness: I } = u[a];
|
|
26
|
+
t.canvas.width = o, t.canvas.height = c, t.clearRect(0, 0, o, c), t.filter = y({ brightness: I, contrast: 1.3 }), t.drawImage(e, 0, 0, o, c), F(t, v, o, c);
|
|
29
27
|
}
|
|
30
28
|
return r;
|
|
31
|
-
}).filter((e) => !!e);
|
|
32
|
-
|
|
33
|
-
}, R = C;
|
|
29
|
+
}).filter((e) => !!e), !!i];
|
|
30
|
+
}, P = L;
|
|
34
31
|
export {
|
|
35
|
-
|
|
32
|
+
P as default
|
|
36
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),g=require("react-i18next"),x=require("../../../charts/ForeignObject/index.cjs"),a=require("./styles.cjs"),b=(t,r,s)=>{const i=Number(Math.abs(r-t).toFixed(1)),u=i.toLocaleString(s,{minimumFractionDigits:1,maximumFractionDigits:1});let e;return i<=.05?(e="equal",{distance:i,context:e}):(t<r?e="above":e="below",{distance:u,context:e})},c=({magnitude:t,yMin:r,yMax:s,onMagnitudeChangeCallback:i,estimatedPeak:u,disabled:e})=>{const{t:l,i18n:{language:o}}=g.useTranslation();return n.jsx(x.default,{children:n.jsx(a.Slider,{ariaLabel:l("light_curve.magnitude_slider.label")||void 0,orientation:"vertical",value:t,min:r,max:s,step:.1,disabled:e,ariaValuetext:()=>l("light_curve.magnitude_slider.value",{...b(u,t,o),magnitude:t.toLocaleString(o,{minimumFractionDigits:1,maximumFractionDigits:1})}),onChange:i,renderThumb:({key:d,...m})=>n.jsxs(a.ThumbContainer,{...m,children:[n.jsx(a.ThumbBar,{}),n.jsx(a.ThumbHandle,{})]},d)})})};c.displayName="Widgets.LightCurve.MagnitudeSlider";const h=c;exports.default=h;
|
|
@@ -1,52 +1,54 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import
|
|
5
|
-
import { Slider as
|
|
6
|
-
const
|
|
2
|
+
import { jsx as r, jsxs as d } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslation as g } from "react-i18next";
|
|
4
|
+
import b from "../../../charts/ForeignObject/index.js";
|
|
5
|
+
import { Slider as h, ThumbContainer as x, ThumbBar as f, ThumbHandle as v } from "./styles.js";
|
|
6
|
+
const p = (t, n, a) => {
|
|
7
7
|
const e = Number(Math.abs(n - t).toFixed(1)), o = e.toLocaleString(a, {
|
|
8
8
|
minimumFractionDigits: 1,
|
|
9
9
|
maximumFractionDigits: 1
|
|
10
10
|
});
|
|
11
11
|
let i;
|
|
12
12
|
return e <= 0.05 ? (i = "equal", { distance: e, context: i }) : (t < n ? i = "above" : i = "below", { distance: o, context: i });
|
|
13
|
-
},
|
|
13
|
+
}, u = ({
|
|
14
14
|
magnitude: t,
|
|
15
15
|
yMin: n,
|
|
16
16
|
yMax: a,
|
|
17
17
|
onMagnitudeChangeCallback: e,
|
|
18
|
-
estimatedPeak: o
|
|
18
|
+
estimatedPeak: o,
|
|
19
|
+
disabled: i
|
|
19
20
|
}) => {
|
|
20
21
|
const {
|
|
21
|
-
t:
|
|
22
|
-
i18n: { language:
|
|
23
|
-
} =
|
|
24
|
-
return /* @__PURE__ */ r(
|
|
25
|
-
|
|
22
|
+
t: l,
|
|
23
|
+
i18n: { language: m }
|
|
24
|
+
} = g();
|
|
25
|
+
return /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(
|
|
26
|
+
h,
|
|
26
27
|
{
|
|
27
|
-
ariaLabel:
|
|
28
|
+
ariaLabel: l("light_curve.magnitude_slider.label") || void 0,
|
|
28
29
|
orientation: "vertical",
|
|
29
30
|
value: t,
|
|
30
31
|
min: n,
|
|
31
32
|
max: a,
|
|
32
33
|
step: 0.1,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
disabled: i,
|
|
35
|
+
ariaValuetext: () => l("light_curve.magnitude_slider.value", {
|
|
36
|
+
...p(o, t, m),
|
|
37
|
+
magnitude: t.toLocaleString(m, {
|
|
36
38
|
minimumFractionDigits: 1,
|
|
37
39
|
maximumFractionDigits: 1
|
|
38
40
|
})
|
|
39
41
|
}),
|
|
40
42
|
onChange: e,
|
|
41
|
-
renderThumb: (
|
|
42
|
-
/* @__PURE__ */ r(
|
|
43
|
-
/* @__PURE__ */ r(
|
|
44
|
-
] })
|
|
43
|
+
renderThumb: ({ key: s, ...c }) => /* @__PURE__ */ d(x, { ...c, children: [
|
|
44
|
+
/* @__PURE__ */ r(f, {}),
|
|
45
|
+
/* @__PURE__ */ r(v, {})
|
|
46
|
+
] }, s)
|
|
45
47
|
}
|
|
46
48
|
) });
|
|
47
49
|
};
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
+
u.displayName = "Widgets.LightCurve.MagnitudeSlider";
|
|
51
|
+
const C = u;
|
|
50
52
|
export {
|
|
51
|
-
|
|
53
|
+
C as default
|
|
52
54
|
};
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("styled-components"),d=require("react-slider"),r=e=>e&&e.__esModule?e:{default:e},t=r(i),a=r(d),b=t.default(a.default)`
|
|
2
2
|
--thumb-size: 20px;
|
|
3
3
|
--thumb-border-width: 2px;
|
|
4
4
|
|
|
5
5
|
width: 100%;
|
|
6
6
|
height: 100%;
|
|
7
|
-
`,
|
|
7
|
+
`,u=t.default.div`
|
|
8
8
|
box-sizing: border-box;
|
|
9
9
|
border: none;
|
|
10
10
|
border-bottom: var(--thumb-border-width) dashed var(--black, #000);
|
|
11
11
|
flex-grow: 1;
|
|
12
|
-
`,
|
|
12
|
+
`,o=t.default.div`
|
|
13
|
+
aspect-ratio: 1;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
background-color: var(--white, #fff);
|
|
16
|
+
border: var(--thumb-border-width) solid var(--black, #000);
|
|
17
|
+
border-radius: 50%;
|
|
18
|
+
pointer-events: auto;
|
|
19
|
+
width: var(--thumb-size);
|
|
20
|
+
`,l=t.default.div`
|
|
13
21
|
box-sizing: border-box;
|
|
14
22
|
display: flex;
|
|
15
23
|
align-items: center;
|
|
@@ -20,18 +28,15 @@
|
|
|
20
28
|
&:focus {
|
|
21
29
|
outline: none;
|
|
22
30
|
}
|
|
23
|
-
`,l=t.default.div`
|
|
24
|
-
aspect-ratio: 1;
|
|
25
|
-
box-sizing: border-box;
|
|
26
|
-
cursor: grab;
|
|
27
|
-
background-color: var(--white, #fff);
|
|
28
|
-
border: var(--thumb-border-width) solid var(--black, #000);
|
|
29
|
-
border-radius: 50%;
|
|
30
|
-
pointer-events: auto;
|
|
31
|
-
width: var(--thumb-size);
|
|
32
31
|
|
|
33
|
-
&:not([aria-disabled="true"])
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
&:not([aria-disabled="true"]) {
|
|
33
|
+
${o} {
|
|
34
|
+
cursor: grab;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:active,
|
|
38
|
+
&.active {
|
|
39
|
+
cursor: grabbing;
|
|
40
|
+
}
|
|
36
41
|
}
|
|
37
|
-
`;exports.Slider=
|
|
42
|
+
`;exports.Slider=b;exports.ThumbBar=u;exports.ThumbContainer=l;exports.ThumbHandle=o;
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import r from "styled-components";
|
|
3
3
|
import o from "react-slider";
|
|
4
|
-
const
|
|
4
|
+
const b = r(o)`
|
|
5
5
|
--thumb-size: 20px;
|
|
6
6
|
--thumb-border-width: 2px;
|
|
7
7
|
|
|
8
8
|
width: 100%;
|
|
9
9
|
height: 100%;
|
|
10
|
-
`,
|
|
10
|
+
`, d = r.div`
|
|
11
11
|
box-sizing: border-box;
|
|
12
12
|
border: none;
|
|
13
13
|
border-bottom: var(--thumb-border-width) dashed var(--black, #000);
|
|
14
14
|
flex-grow: 1;
|
|
15
|
-
`,
|
|
15
|
+
`, e = r.div`
|
|
16
|
+
aspect-ratio: 1;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
background-color: var(--white, #fff);
|
|
19
|
+
border: var(--thumb-border-width) solid var(--black, #000);
|
|
20
|
+
border-radius: 50%;
|
|
21
|
+
pointer-events: auto;
|
|
22
|
+
width: var(--thumb-size);
|
|
23
|
+
`, a = r.div`
|
|
16
24
|
box-sizing: border-box;
|
|
17
25
|
display: flex;
|
|
18
26
|
align-items: center;
|
|
@@ -23,24 +31,21 @@ const t = r(o)`
|
|
|
23
31
|
&:focus {
|
|
24
32
|
outline: none;
|
|
25
33
|
}
|
|
26
|
-
`, a = r.div`
|
|
27
|
-
aspect-ratio: 1;
|
|
28
|
-
box-sizing: border-box;
|
|
29
|
-
cursor: grab;
|
|
30
|
-
background-color: var(--white, #fff);
|
|
31
|
-
border: var(--thumb-border-width) solid var(--black, #000);
|
|
32
|
-
border-radius: 50%;
|
|
33
|
-
pointer-events: auto;
|
|
34
|
-
width: var(--thumb-size);
|
|
35
34
|
|
|
36
|
-
&:not([aria-disabled="true"])
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
&:not([aria-disabled="true"]) {
|
|
36
|
+
${e} {
|
|
37
|
+
cursor: grab;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:active,
|
|
41
|
+
&.active {
|
|
42
|
+
cursor: grabbing;
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
`;
|
|
41
46
|
export {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
b as Slider,
|
|
48
|
+
d as ThumbBar,
|
|
49
|
+
a as ThumbContainer,
|
|
50
|
+
e as ThumbHandle
|
|
46
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),F=require("react-i18next"),g=require("d3-array"),H=require("@rubin-epo/epo-react-lib/HorizontalSlider"),_=require("../../../charts/hooks/useAxis.cjs"),t=require("../defaults.cjs"),w=require("../ScatterPlot/index.cjs"),B=require("../LightCurve/index.cjs"),N=require("../A11Y/LightCurveLabel/index.cjs"),S=require("../helpers.cjs"),E=require("../../../atomic/Button/patterns/Reset.cjs"),J=require("../MagnitudeSlider/index.cjs"),d=require("./styles.cjs"),K=l=>l&&l.__esModule?l:{default:l},y=K(H),L=({gaussianWidth:l=t.default.gaussianWidth,yOffset:a=t.default.yOffset,alerts:I,peakMjd:D,yMin:r=t.default.yMin,yMax:i=t.default.yMax,width:f=t.default.width,height:x=t.default.height,userMagnitude:P=(i-r)/2+r,onUserMagnitudeChangeCallback:o,onGaussianChangeCallback:n,onYOffsetChangeCallback:c,className:M,isDisplayOnly:m,...R})=>{const{t:h}=F.useTranslation(),j="lightCurveControls",p="gaussianWidthLabel",q="yOffsetLabel",u=S.formatMagnitudePoints(I,D),T=g.min(u,({x:s})=>s)||Math.min(...u.map(({x:s})=>s)),W=g.max(u,({x:s})=>s)||Math.max(...u.map(({x:s})=>s)),$=()=>{o&&o((i-r)/2+r),c&&c(t.default.yOffset),n&&n(t.default.gaussianWidth)},[O,V,z]=_.default({min:T,max:W,step:t.default.xStep,range:[0,f]}),[A,X,v]=_.default({min:r,max:i,step:t.default.yStep,range:[0,x]}),b=S.estimateMagnitudeWithOffset(0,l,a);return e.jsxs(d.Container,{className:M,children:[e.jsx(w.default,{...R,data:u,width:f,height:x,yMin:r,yMax:i,children:u.length>0?e.jsxs(e.Fragment,{children:[e.jsx(B.default,{gaussianWidth:l,yOffset:a,xDomain:O,xScale:z,yScale:v,yDomain:A}),e.jsx(J.default,{magnitude:P,onMagnitudeChangeCallback:s=>o&&o(s),disabled:m,yMin:r,yMax:i,yScale:v,estimatedPeak:b}),e.jsx(d.DM15Display,{gaussianWidth:l})]}):null}),!m&&e.jsxs(d.Controls,{id:j,children:[e.jsxs("div",{children:[e.jsx(d.ControlLabel,{id:p,children:h("light_curve.curve.controls.gaussian_width")}),e.jsx(y.default,{label:"Gaussian Width",labelledbyId:p,color:"var(--turquoise85, #12726D)",min:t.default.gaussianMin,max:t.default.gaussianMax,step:t.default.gaussianStep,value:l,onChangeCallback:s=>typeof s=="number"&&n&&n(s)})]}),e.jsxs("div",{children:[e.jsx(d.ControlLabel,{id:q,children:h("light_curve.curve.controls.y_offset")}),e.jsx(y.default,{label:"Y Offset",labelledbyId:q,color:"var(--turquoise85, #12726D)",min:t.default.yOffsetMin,max:t.default.yOffsetMax,step:t.default.yOffsetStep,value:a,onChangeCallback:s=>typeof s=="number"&&c&&c(s)})]}),e.jsx(E.default,{onResetCallback:$})]}),e.jsx(N.default,{controlledById:j,data:u,gaussianWidth:l,yOffset:a,estimatedPeak:b})]})};L.displayName="Widgets.LightCurve";const Q=L;exports.default=Q;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { FunctionComponent } from "react";
|
|
2
2
|
import { PlotWithoutCurveProps } from "../PlotWithoutCurve";
|
|
3
3
|
interface PlotWithLightCurveProps extends PlotWithoutCurveProps {
|
|
4
|
-
gaussianWidth
|
|
5
|
-
yOffset
|
|
6
|
-
userMagnitude
|
|
7
|
-
onUserMagnitudeChangeCallback
|
|
8
|
-
onGaussianChangeCallback
|
|
9
|
-
onYOffsetChangeCallback
|
|
4
|
+
gaussianWidth?: number;
|
|
5
|
+
yOffset?: number;
|
|
6
|
+
userMagnitude?: number;
|
|
7
|
+
onUserMagnitudeChangeCallback?: (value: number) => void;
|
|
8
|
+
onGaussianChangeCallback?: (value: number) => void;
|
|
9
|
+
onYOffsetChangeCallback?: (value: number) => void;
|
|
10
|
+
isDisplayOnly?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const PlotWithLightCurve: FunctionComponent<PlotWithLightCurveProps>;
|
|
12
13
|
export default PlotWithLightCurve;
|
|
@@ -1,91 +1,93 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { min as
|
|
5
|
-
import
|
|
2
|
+
import { jsxs as l, jsx as o, Fragment as z } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslation as A } from "react-i18next";
|
|
4
|
+
import { min as B, max as H } from "d3-array";
|
|
5
|
+
import S from "@rubin-epo/epo-react-lib/HorizontalSlider";
|
|
6
6
|
import y from "../../../charts/hooks/useAxis.js";
|
|
7
7
|
import t from "../defaults.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { formatMagnitudePoints as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { Container as
|
|
8
|
+
import N from "../ScatterPlot/index.js";
|
|
9
|
+
import $ from "../LightCurve/index.js";
|
|
10
|
+
import E from "../A11Y/LightCurveLabel/index.js";
|
|
11
|
+
import { formatMagnitudePoints as J, estimateMagnitudeWithOffset as K } from "../helpers.js";
|
|
12
|
+
import Q from "../../../atomic/Button/patterns/Reset.js";
|
|
13
|
+
import V from "../MagnitudeSlider/index.js";
|
|
14
|
+
import { Container as X, DM15Display as Z, Controls as C, ControlLabel as I } from "./styles.js";
|
|
15
15
|
const D = ({
|
|
16
16
|
gaussianWidth: m = t.gaussianWidth,
|
|
17
17
|
yOffset: n = t.yOffset,
|
|
18
|
-
alerts:
|
|
19
|
-
peakMjd:
|
|
18
|
+
alerts: P,
|
|
19
|
+
peakMjd: W,
|
|
20
20
|
yMin: r = t.yMin,
|
|
21
21
|
yMax: s = t.yMax,
|
|
22
22
|
width: p = t.width,
|
|
23
|
-
height:
|
|
24
|
-
userMagnitude:
|
|
23
|
+
height: u = t.height,
|
|
24
|
+
userMagnitude: _ = (s - r) / 2 + r,
|
|
25
25
|
onUserMagnitudeChangeCallback: a,
|
|
26
26
|
onGaussianChangeCallback: d,
|
|
27
27
|
onYOffsetChangeCallback: c,
|
|
28
|
-
className:
|
|
29
|
-
|
|
28
|
+
className: R,
|
|
29
|
+
isDisplayOnly: f,
|
|
30
|
+
...T
|
|
30
31
|
}) => {
|
|
31
|
-
const { t:
|
|
32
|
+
const { t: h } = A(), x = "lightCurveControls", v = "gaussianWidthLabel", g = "yOffsetLabel", i = J(P, W), j = B(i, ({ x: e }) => e) || Math.min(...i.map(({ x: e }) => e)), q = H(i, ({ x: e }) => e) || Math.max(...i.map(({ x: e }) => e)), F = () => {
|
|
32
33
|
a && a((s - r) / 2 + r), c && c(t.yOffset), d && d(t.gaussianWidth);
|
|
33
|
-
}, [
|
|
34
|
-
min:
|
|
35
|
-
max:
|
|
34
|
+
}, [M, k, O] = y({
|
|
35
|
+
min: j,
|
|
36
|
+
max: q,
|
|
36
37
|
step: t.xStep,
|
|
37
38
|
range: [0, p]
|
|
38
|
-
}), [w,
|
|
39
|
+
}), [w, G, L] = y({
|
|
39
40
|
min: r,
|
|
40
41
|
max: s,
|
|
41
42
|
step: t.yStep,
|
|
42
|
-
range: [0,
|
|
43
|
-
}),
|
|
44
|
-
return /* @__PURE__ */ l(
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
|
|
43
|
+
range: [0, u]
|
|
44
|
+
}), b = K(0, m, n);
|
|
45
|
+
return /* @__PURE__ */ l(X, { className: R, children: [
|
|
46
|
+
/* @__PURE__ */ o(
|
|
47
|
+
N,
|
|
47
48
|
{
|
|
48
|
-
...
|
|
49
|
+
...T,
|
|
49
50
|
data: i,
|
|
50
51
|
width: p,
|
|
51
|
-
height:
|
|
52
|
+
height: u,
|
|
52
53
|
yMin: r,
|
|
53
54
|
yMax: s,
|
|
54
|
-
children: [
|
|
55
|
+
children: i.length > 0 ? /* @__PURE__ */ l(z, { children: [
|
|
55
56
|
/* @__PURE__ */ o(
|
|
56
|
-
|
|
57
|
+
$,
|
|
57
58
|
{
|
|
58
59
|
gaussianWidth: m,
|
|
59
60
|
yOffset: n,
|
|
60
|
-
xDomain:
|
|
61
|
-
xScale:
|
|
62
|
-
yScale:
|
|
61
|
+
xDomain: M,
|
|
62
|
+
xScale: O,
|
|
63
|
+
yScale: L,
|
|
63
64
|
yDomain: w
|
|
64
65
|
}
|
|
65
66
|
),
|
|
66
67
|
/* @__PURE__ */ o(
|
|
67
|
-
|
|
68
|
+
V,
|
|
68
69
|
{
|
|
69
|
-
magnitude:
|
|
70
|
+
magnitude: _,
|
|
70
71
|
onMagnitudeChangeCallback: (e) => a && a(e),
|
|
72
|
+
disabled: f,
|
|
71
73
|
yMin: r,
|
|
72
74
|
yMax: s,
|
|
73
|
-
yScale:
|
|
74
|
-
estimatedPeak:
|
|
75
|
+
yScale: L,
|
|
76
|
+
estimatedPeak: b
|
|
75
77
|
}
|
|
76
78
|
),
|
|
77
|
-
/* @__PURE__ */ o(
|
|
78
|
-
]
|
|
79
|
+
/* @__PURE__ */ o(Z, { gaussianWidth: m })
|
|
80
|
+
] }) : null
|
|
79
81
|
}
|
|
80
82
|
),
|
|
81
|
-
/* @__PURE__ */ l(
|
|
83
|
+
!f && /* @__PURE__ */ l(C, { id: x, children: [
|
|
82
84
|
/* @__PURE__ */ l("div", { children: [
|
|
83
|
-
/* @__PURE__ */ o(
|
|
85
|
+
/* @__PURE__ */ o(I, { id: v, children: h("light_curve.curve.controls.gaussian_width") }),
|
|
84
86
|
/* @__PURE__ */ o(
|
|
85
|
-
|
|
87
|
+
S,
|
|
86
88
|
{
|
|
87
89
|
label: "Gaussian Width",
|
|
88
|
-
labelledbyId:
|
|
90
|
+
labelledbyId: v,
|
|
89
91
|
color: "var(--turquoise85, #12726D)",
|
|
90
92
|
min: t.gaussianMin,
|
|
91
93
|
max: t.gaussianMax,
|
|
@@ -96,12 +98,12 @@ const D = ({
|
|
|
96
98
|
)
|
|
97
99
|
] }),
|
|
98
100
|
/* @__PURE__ */ l("div", { children: [
|
|
99
|
-
/* @__PURE__ */ o(
|
|
101
|
+
/* @__PURE__ */ o(I, { id: g, children: h("light_curve.curve.controls.y_offset") }),
|
|
100
102
|
/* @__PURE__ */ o(
|
|
101
|
-
|
|
103
|
+
S,
|
|
102
104
|
{
|
|
103
105
|
label: "Y Offset",
|
|
104
|
-
labelledbyId:
|
|
106
|
+
labelledbyId: g,
|
|
105
107
|
color: "var(--turquoise85, #12726D)",
|
|
106
108
|
min: t.yOffsetMin,
|
|
107
109
|
max: t.yOffsetMax,
|
|
@@ -111,22 +113,22 @@ const D = ({
|
|
|
111
113
|
}
|
|
112
114
|
)
|
|
113
115
|
] }),
|
|
114
|
-
/* @__PURE__ */ o(
|
|
116
|
+
/* @__PURE__ */ o(Q, { onResetCallback: F })
|
|
115
117
|
] }),
|
|
116
118
|
/* @__PURE__ */ o(
|
|
117
|
-
|
|
119
|
+
E,
|
|
118
120
|
{
|
|
119
|
-
controlledById:
|
|
121
|
+
controlledById: x,
|
|
120
122
|
data: i,
|
|
121
123
|
gaussianWidth: m,
|
|
122
124
|
yOffset: n,
|
|
123
|
-
estimatedPeak:
|
|
125
|
+
estimatedPeak: b
|
|
124
126
|
}
|
|
125
127
|
)
|
|
126
128
|
] });
|
|
127
129
|
};
|
|
128
130
|
D.displayName = "Widgets.LightCurve";
|
|
129
|
-
const
|
|
131
|
+
const ct = D;
|
|
130
132
|
export {
|
|
131
|
-
|
|
133
|
+
ct as default
|
|
132
134
|
};
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { FunctionComponent } from "react";
|
|
2
2
|
import { Alert } from '../../../types/astro';
|
|
3
|
-
|
|
3
|
+
import { ScatterPlotProps } from "../ScatterPlot";
|
|
4
|
+
export interface PlotWithoutCurveProps extends Omit<ScatterPlotProps, "data"> {
|
|
4
5
|
alerts: Array<Alert>;
|
|
5
|
-
name: string;
|
|
6
|
-
activeAlertId?: number;
|
|
7
6
|
peakMjd: number;
|
|
8
|
-
yMin: number;
|
|
9
|
-
yMax?: number;
|
|
10
|
-
width?: number;
|
|
11
|
-
height?: number;
|
|
12
|
-
className?: string;
|
|
13
7
|
}
|
|
14
8
|
declare const PlotWithoutCurve: FunctionComponent<PlotWithoutCurveProps>;
|
|
15
9
|
export default PlotWithoutCurve;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),E=require("react"),G=require("react-i18next"),L=require("d3-array"),_=require("../../../charts/hooks/useAxis.cjs"),J=require("../../../charts/XAxis/index.cjs"),K=require("../../../charts/YAxis/index.cjs"),Q=require("../../../charts/Tooltip/index.cjs"),U=require("../../../charts/ClippingContainer/index.cjs"),V=require("../../../charts/Viewport/index.cjs"),l=require("../defaults.cjs"),X=require("../Point/index.cjs"),M=require("./styles.cjs"),S=({data:s,activeAlertId:A,xMin:I,xMax:k,yMin:F=l.default.yMin,yMax:P=l.default.yMax,width:x=l.default.width,height:f=l.default.height,name:R,children:$,className:D})=>{const{t:a,i18n:{language:T}}=G.useTranslation(),[h,b]=E.useState(),C=a("light_curve.plot.x_label"),m="xAxisLabel",H=a("light_curve.plot.y_label"),p="yAxisLabel",i=typeof h<"u"?s[h]:s.find(({id:o})=>o===A),d={top:10,left:40,right:10,bottom:25},u=[0+d.left,x-d.right],[v,O,n]=_.default({min:I||L.min(s,({x:o})=>o)||l.default.xMin,max:k||L.max(s,({x:o})=>o)||l.default.xMax,step:l.default.xStep,range:u}),g=n(v[0]),c=[0+d.top,f-d.bottom],[r,W,e]=_.default({min:F,max:P,step:l.default.yStep,range:c}),q=e(r[1]);return t.jsx(M.PlotContainer,{className:D,children:t.jsxs(M.Chart,{width:x,height:f,horizontalLabel:C,horizontalLabelId:m,verticalLabel:H,verticalLabelId:p,title:R,children:[t.jsx("rect",{x:n(0),y:e(r[0]),width:n(15)-n(0),height:q-e(r[0]),fill:"#F5F5F5"}),t.jsx(J.default,{ticks:O,y:q,labelledById:m,xDomain:v,xScale:n}),t.jsx(K.default,{ticks:W,x:g,labelledById:p,yDomain:r,yScale:e}),t.jsx(U.default,{x:g,y:e(r[0]),width:u[1]-u[0],height:c[1]-c[0],children:t.jsx("g",{role:"list","aria-label":a("light_curve.plot.plot_label")||void 0,children:s.map(({x:o,y:j,error:z,id:B},w)=>{const y=Math.round(o),N=y>0?"after":y===0?"peak":"before";return t.jsx(X.default,{x:n(o),y:e(j),error:e(z)-e(0),onMouseOver:()=>b(w),onMouseOut:()=>b(void 0),description:a("light_curve.plot.point_label",{magnitude:j,count:Math.abs(y),context:N})||void 0},B)})})}),t.jsx(V.default,{x:g,y:e(r[0]),outerWidth:u[1]-u[0],outerHeight:c[1]-c[0],innerWidth:x,innerHeight:f,children:$}),t.jsx(Q.default,{x:i?n(i.x):void 0,y:i?e(i.y):void 0,visible:!!i,offset:6,children:a("light_curve.plot.tooltip",{magnitude:i==null?void 0:i.y.toLocaleString(T,{minimumFractionDigits:2,maximumFractionDigits:2})})})]})})};S.displayName="Widgets.LightCurve.ScatterPlot";const Y=S;exports.default=Y;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { FunctionComponent, PropsWithChildren } from "react";
|
|
2
|
+
import { Bounds } from '../../../charts/types';
|
|
2
3
|
import { formatMagnitudePoints } from "../helpers";
|
|
3
|
-
export interface ScatterPlotProps {
|
|
4
|
+
export interface ScatterPlotProps extends Partial<Bounds> {
|
|
4
5
|
data: ReturnType<typeof formatMagnitudePoints>;
|
|
5
6
|
name?: string;
|
|
6
7
|
activeAlertId?: number;
|
|
7
|
-
|
|
8
|
-
yMax?: number;
|
|
9
|
-
width?: number;
|
|
10
|
-
height?: number;
|
|
8
|
+
className?: string;
|
|
11
9
|
}
|
|
12
10
|
declare const ScatterPlot: FunctionComponent<PropsWithChildren<ScatterPlotProps>>;
|
|
13
11
|
export default ScatterPlot;
|