@rubin-epo/epo-widget-lib 0.10.3 → 1.0.0-beta.1
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/SupernovaThreeVector.cjs +1 -1
- package/dist/SupernovaThreeVector.js +66 -66
- package/dist/atomic/Blinker/Blinker.cjs +1 -1
- package/dist/atomic/Blinker/Blinker.d.ts +2 -1
- package/dist/atomic/Blinker/Blinker.js +43 -41
- package/dist/charts/Base/styles.cjs +5 -3
- package/dist/charts/Base/styles.js +12 -10
- package/dist/charts/ScatterPlot/index.cjs +1 -1
- package/dist/charts/ScatterPlot/index.js +34 -33
- package/dist/charts/ScatterPlot/styles.cjs +3 -4
- package/dist/charts/ScatterPlot/styles.js +5 -6
- package/dist/charts/hooks/useAxis.cjs +1 -1
- package/dist/charts/hooks/useAxis.d.ts +1 -1
- package/dist/charts/hooks/useAxis.js +18 -14
- package/dist/charts/hooks/useAxis.test.d.ts +1 -0
- package/dist/localeStrings/en/epo-widget-lib.json +7 -7
- package/dist/widgets/LightCurvePlot/Plot/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/Plot/index.js +46 -62
- package/dist/widgets/LightCurvePlot/PlotWithCurve/MagnitudeSlider/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/PlotWithCurve/MagnitudeSlider/index.js +1 -1
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.js +94 -80
- package/dist/widgets/LightCurvePlot/PlotWithoutCurve/index.d.ts +2 -2
- package/dist/widgets/LightCurvePlot/defaults.cjs +1 -1
- package/dist/widgets/LightCurvePlot/defaults.d.ts +1 -1
- package/dist/widgets/LightCurvePlot/defaults.js +1 -1
- package/dist/widgets/LightCurvePlot/helpers.d.ts +2 -2
- package/dist/widgets/SourceSelector/SourceSelector.cjs +1 -1
- package/dist/widgets/SourceSelector/SourceSelector.js +53 -55
- package/dist/widgets/SourceSelector/styles.cjs +2 -6
- package/dist/widgets/SourceSelector/styles.d.ts +0 -12
- package/dist/widgets/SourceSelector/styles.js +2 -8
- package/dist/widgets/SupernovaThreeVector/Histogram/index.cjs +1 -1
- package/dist/widgets/SupernovaThreeVector/Histogram/index.js +43 -43
- package/dist/widgets/SupernovaThreeVector/styles.cjs +6 -7
- package/dist/widgets/SupernovaThreeVector/styles.js +11 -12
- package/package.json +1 -1
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { getLinearScale as
|
|
2
|
-
import { tickStep as
|
|
3
|
-
const
|
|
4
|
-
linear:
|
|
5
|
-
},
|
|
6
|
-
min:
|
|
7
|
-
max:
|
|
8
|
-
step:
|
|
9
|
-
ticks:
|
|
1
|
+
import { getLinearScale as u } from "../../lib/utils.js";
|
|
2
|
+
import { tickStep as l, ticks as p } from "d3-array";
|
|
3
|
+
const b = {
|
|
4
|
+
linear: u
|
|
5
|
+
}, h = (n, t, e) => n > t ? -Math.abs(e) : Math.abs(e), k = (n, t) => n.map((e, a) => a === 0 ? e - t : e + t), S = ({
|
|
6
|
+
min: n,
|
|
7
|
+
max: t,
|
|
8
|
+
step: e,
|
|
9
|
+
ticks: a = 5,
|
|
10
10
|
range: r,
|
|
11
|
-
scale:
|
|
12
|
-
scaleOptions:
|
|
11
|
+
scale: s = "linear",
|
|
12
|
+
scaleOptions: m
|
|
13
13
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
return [
|
|
14
|
+
const c = (typeof e == "number" ? Math.floor(Math.abs((t - n) / e)) : void 0) || a, i = (typeof e == "number" ? h(n, t, e) : l(n, t, a)) / 2, o = k([n, t], i);
|
|
15
|
+
return [
|
|
16
|
+
o,
|
|
17
|
+
p(n, t, c),
|
|
18
|
+
b[s](o, r, m)
|
|
19
|
+
];
|
|
16
20
|
};
|
|
17
21
|
export {
|
|
18
|
-
|
|
22
|
+
S as default
|
|
19
23
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -83,19 +83,19 @@
|
|
|
83
83
|
"supernova_three_vector": {
|
|
84
84
|
"histogram": {
|
|
85
85
|
"title": "Supernova Distances",
|
|
86
|
-
"x_label": "Distance [
|
|
87
|
-
"bar_label_one": "{{binMin}} to {{binMax}}
|
|
88
|
-
"bar_label_other": "{{binMin}} to {{binMax}}
|
|
86
|
+
"x_label": "Distance [Mlyr]",
|
|
87
|
+
"bar_label_one": "{{binMin}} to {{binMax}} mega-lightyears: {{count}} supernova",
|
|
88
|
+
"bar_label_other": "{{binMin}} to {{binMax}} mega-lightyears: {{count}} supernovae"
|
|
89
89
|
},
|
|
90
90
|
"slider": {
|
|
91
91
|
"label": "Select visible range",
|
|
92
|
-
"valueLabel": "{{value}}
|
|
92
|
+
"valueLabel": "{{value}} mega-lightyears"
|
|
93
93
|
},
|
|
94
94
|
"skymap": {
|
|
95
95
|
"title": "Supernova Distribution",
|
|
96
96
|
"description": "$t(supernova_three_vector.skymap.supernova_count, {\"count\": {{supernovaCount}}, \"min\": {{min}}, \"max\": {{max}}}) $t(supernova_three_vector.skymap.user_supernova_count, {\"count\": {{userObjectCount}}})",
|
|
97
|
-
"supernova_count_one": "Sky map projection showing {{count}} supernova between the distances of {{min}} and {{max}}
|
|
98
|
-
"supernova_count_other": "Sky map projection showing {{count}} supernovae between the distances of {{min}} and {{max}}
|
|
97
|
+
"supernova_count_one": "Sky map projection showing {{count}} supernova between the distances of {{min}} and {{max}} mega-lightyears.",
|
|
98
|
+
"supernova_count_other": "Sky map projection showing {{count}} supernovae between the distances of {{min}} and {{max}} mega-lightyears.",
|
|
99
99
|
"user_supernova_count_zero": "None of your supernovae are visible.",
|
|
100
100
|
"user_supernova_count_one": "{{count}} of your supernovae is visible near {{coords}}.",
|
|
101
101
|
"user_supernova_count_other": "{{count}} of your supernovae are visible near {{coords}}."
|
|
@@ -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": "
|
|
131
|
+
"tooltip": "m: {{magnitude}}"
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
"isochrone_plot": {
|
|
@@ -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 a=require("react/jsx-runtime"),D=require("react-i18next"),f=require("d3-array"),M=require("../../../charts/ScatterPlot/index.cjs");require("../../../atomic/PlotWrapper/index.cjs");const m=require("../../../lib/utils.cjs"),u=require("../defaults.cjs"),_=require("./styles.cjs"),I=require("../../../atomic/PlotWrapper/styles.cjs"),O=(l,c,p)=>{const o={};return Object.keys(l).forEach(e=>{const r=e==="top"||e==="bottom"?p:c,n=`${e.charAt(0).toUpperCase()}${e.slice(1)}`;o[`padding${n}`]=`${l[e]/r*100}%`}),o},y=({data:l,activeAlertId:c,xMin:p,xMax:o,yMin:x,yMax:e,width:r=u.default.width,height:n=u.default.height,name:q,slider:d,className:A,plotChildren:g})=>{const{t:i,i18n:{language:v}}=D.useTranslation(),j=m.mergeWithDefaults({min:f.min(l,({x:t})=>t),max:f.max(l,({x:t})=>t)},u.default.xAxis),W=m.mergeWithDefaults({min:p,max:o,label:i("light_curve.plot.x_label")},{...j,label:i("isochrone_plot.plot.x_label")}),s=m.mergeWithDefaults({min:x,max:e,label:i("light_curve.plot.y_label")},{...u.default.yAxis,label:i("isochrone_plot.plot.y_label")}),h={top:10,right:10,bottom:25,left:40};return a.jsxs(I.PlotWrapper,{className:A,children:[a.jsx(M.default,{width:r,height:n,margins:h,activePointId:c,title:q,xAxis:{...W},yAxis:{...s,step:s.min<s.max?Math.abs(s.step):s.step},data:{label:i("light_curve.plot.plot_label"),points:l},tooltip:({y:t})=>i("light_curve.plot.tooltip",{magnitude:t.toLocaleString(v,{minimumFractionDigits:2,maximumFractionDigits:2})}),plotChildren:({xScale:t,yStart:P,yEnd:$,Data:b,...S})=>g?g({xScale:t,yStart:P,yEnd:$,Data:b,...S}):b}),d&&a.jsx(_.SliderOuterWrapper,{children:a.jsx(_.SliderInnerWrapper,{style:{...O(h,r,n)},children:d})})]})};y.displayName="Widgets.LightCurve.Plot";const C=y;exports.default=C;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as j, jsx as c } from "react/jsx-runtime";
|
|
3
3
|
import { useTranslation as C } from "react-i18next";
|
|
4
|
-
import { min as
|
|
4
|
+
import { min as D, max as F } from "d3-array";
|
|
5
5
|
import I from "../../../charts/ScatterPlot/index.js";
|
|
6
6
|
import "../../../atomic/PlotWrapper/index.js";
|
|
7
|
-
import { mergeWithDefaults as
|
|
8
|
-
import
|
|
7
|
+
import { mergeWithDefaults as x } from "../../../lib/utils.js";
|
|
8
|
+
import n from "../defaults.js";
|
|
9
9
|
import { SliderOuterWrapper as L, SliderInnerWrapper as M } from "./styles.js";
|
|
10
10
|
import { PlotWrapper as N } from "../../../atomic/PlotWrapper/styles.js";
|
|
11
|
-
const O = (i,
|
|
12
|
-
const
|
|
13
|
-
return Object.keys(i).forEach((
|
|
14
|
-
const s =
|
|
15
|
-
|
|
16
|
-
}),
|
|
17
|
-
},
|
|
11
|
+
const O = (i, m, p) => {
|
|
12
|
+
const r = {};
|
|
13
|
+
return Object.keys(i).forEach((t) => {
|
|
14
|
+
const s = t === "top" || t === "bottom" ? p : m, a = `${t.charAt(0).toUpperCase()}${t.slice(1)}`;
|
|
15
|
+
r[`padding${a}`] = `${i[t] / s * 100}%`;
|
|
16
|
+
}), r;
|
|
17
|
+
}, f = ({
|
|
18
18
|
data: i,
|
|
19
|
-
activeAlertId:
|
|
20
|
-
xMin:
|
|
21
|
-
xMax:
|
|
22
|
-
yMin:
|
|
23
|
-
yMax:
|
|
24
|
-
width: s =
|
|
25
|
-
height: a =
|
|
26
|
-
name:
|
|
19
|
+
activeAlertId: m,
|
|
20
|
+
xMin: p,
|
|
21
|
+
xMax: r,
|
|
22
|
+
yMin: u,
|
|
23
|
+
yMax: t,
|
|
24
|
+
width: s = n.width,
|
|
25
|
+
height: a = n.height,
|
|
26
|
+
name: _,
|
|
27
27
|
slider: g,
|
|
28
|
-
className:
|
|
29
|
-
plotChildren:
|
|
28
|
+
className: y,
|
|
29
|
+
plotChildren: h
|
|
30
30
|
}) => {
|
|
31
31
|
const {
|
|
32
32
|
t: e,
|
|
33
|
-
i18n: { language:
|
|
34
|
-
} = C(),
|
|
33
|
+
i18n: { language: A }
|
|
34
|
+
} = C(), v = x(
|
|
35
35
|
{
|
|
36
|
-
min:
|
|
37
|
-
max: F(i, ({ x:
|
|
36
|
+
min: D(i, ({ x: o }) => o),
|
|
37
|
+
max: F(i, ({ x: o }) => o)
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
),
|
|
41
|
-
{ min:
|
|
39
|
+
n.xAxis
|
|
40
|
+
), P = x(
|
|
41
|
+
{ min: p, max: r, label: e("light_curve.plot.x_label") },
|
|
42
42
|
{
|
|
43
|
-
|
|
43
|
+
...v,
|
|
44
44
|
label: e("isochrone_plot.plot.x_label")
|
|
45
45
|
}
|
|
46
|
-
),
|
|
47
|
-
{ min:
|
|
46
|
+
), l = x(
|
|
47
|
+
{ min: u, max: t, label: e("light_curve.plot.y_label") },
|
|
48
48
|
{
|
|
49
|
-
...
|
|
49
|
+
...n.yAxis,
|
|
50
50
|
label: e("isochrone_plot.plot.y_label")
|
|
51
51
|
}
|
|
52
52
|
), b = {
|
|
@@ -55,52 +55,36 @@ const O = (i, p, c) => {
|
|
|
55
55
|
bottom: 25,
|
|
56
56
|
left: 40
|
|
57
57
|
};
|
|
58
|
-
return /* @__PURE__ */
|
|
59
|
-
/* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ j(N, { className: y, children: [
|
|
59
|
+
/* @__PURE__ */ c(
|
|
60
60
|
I,
|
|
61
61
|
{
|
|
62
62
|
width: s,
|
|
63
63
|
height: a,
|
|
64
64
|
margins: b,
|
|
65
|
-
activePointId:
|
|
66
|
-
title:
|
|
65
|
+
activePointId: m,
|
|
66
|
+
title: _,
|
|
67
67
|
xAxis: {
|
|
68
|
-
...
|
|
69
|
-
ticks: 6
|
|
68
|
+
...P
|
|
70
69
|
},
|
|
71
70
|
yAxis: {
|
|
72
|
-
...
|
|
73
|
-
step:
|
|
71
|
+
...l,
|
|
72
|
+
step: l.min < l.max ? Math.abs(l.step) : l.step
|
|
74
73
|
},
|
|
75
74
|
data: {
|
|
76
75
|
label: e("light_curve.plot.plot_label"),
|
|
77
76
|
points: i
|
|
78
77
|
},
|
|
79
|
-
tooltip: ({ y:
|
|
80
|
-
magnitude:
|
|
78
|
+
tooltip: ({ y: o }) => e("light_curve.plot.tooltip", {
|
|
79
|
+
magnitude: o.toLocaleString(A, {
|
|
81
80
|
minimumFractionDigits: 2,
|
|
82
81
|
maximumFractionDigits: 2
|
|
83
82
|
})
|
|
84
83
|
}),
|
|
85
|
-
plotChildren: ({ xScale:
|
|
86
|
-
/* @__PURE__ */ n(
|
|
87
|
-
"rect",
|
|
88
|
-
{
|
|
89
|
-
x: t(0),
|
|
90
|
-
y: h,
|
|
91
|
-
width: t(15) - t(0),
|
|
92
|
-
height: d - h,
|
|
93
|
-
stroke: "var(--neutral60,##6A6E6E)",
|
|
94
|
-
strokeDasharray: 6,
|
|
95
|
-
fill: "var(--neutral20,#DCE0E3)"
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
_,
|
|
99
|
-
f && f({ xScale: t, yStart: d, yEnd: h, Data: _, ...j })
|
|
100
|
-
] })
|
|
84
|
+
plotChildren: ({ xScale: o, yStart: W, yEnd: $, Data: d, ...S }) => h ? h({ xScale: o, yStart: W, yEnd: $, Data: d, ...S }) : d
|
|
101
85
|
}
|
|
102
86
|
),
|
|
103
|
-
g && /* @__PURE__ */
|
|
87
|
+
g && /* @__PURE__ */ c(L, { children: /* @__PURE__ */ c(
|
|
104
88
|
M,
|
|
105
89
|
{
|
|
106
90
|
style: { ...O(b, s, a) },
|
|
@@ -109,8 +93,8 @@ const O = (i, p, c) => {
|
|
|
109
93
|
) })
|
|
110
94
|
] });
|
|
111
95
|
};
|
|
112
|
-
|
|
113
|
-
const
|
|
96
|
+
f.displayName = "Widgets.LightCurve.Plot";
|
|
97
|
+
const G = f;
|
|
114
98
|
export {
|
|
115
|
-
|
|
99
|
+
G as default
|
|
116
100
|
};
|
|
@@ -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-i18next"),s=require("./styles.cjs"),v=(t,i,a)=>{const n=Number(Math.abs(i-t).toFixed(1)),u=n.toLocaleString(a,{minimumFractionDigits:1,maximumFractionDigits:1});let e;return n<=.05?(e="equal",{distance:n,context:e}):(t<i?e="above":e="below",{distance:u,context:e})},c=({magnitude:t,yMin:i,yMax:a,onMagnitudeChangeCallback:n,estimatedPeak:u,disabled:e})=>{const{t:o,i18n:{language:l}}=h.useTranslation(),m=Math.min(i,a),d=Math.max(i,a);return r.jsx(s.Slider,{ariaLabel:o("light_curve.magnitude_slider.label"),orientation:"vertical",value:t,step:.
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),h=require("react-i18next"),s=require("./styles.cjs"),v=(t,i,a)=>{const n=Number(Math.abs(i-t).toFixed(1)),u=n.toLocaleString(a,{minimumFractionDigits:1,maximumFractionDigits:1});let e;return n<=.05?(e="equal",{distance:n,context:e}):(t<i?e="above":e="below",{distance:u,context:e})},c=({magnitude:t,yMin:i,yMax:a,onMagnitudeChangeCallback:n,estimatedPeak:u,disabled:e})=>{const{t:o,i18n:{language:l}}=h.useTranslation(),m=Math.min(i,a),d=Math.max(i,a);return r.jsx(s.Slider,{ariaLabel:o("light_curve.magnitude_slider.label"),orientation:"vertical",value:t,step:.05,ariaValuetext:()=>o("light_curve.magnitude_slider.value",{...v(u,t,l),magnitude:t.toLocaleString(l,{minimumFractionDigits:1,maximumFractionDigits:1})}),onChange:n,renderThumb:({key:g,style:x,...b})=>r.jsxs(s.ThumbContainer,{...b,style:x,children:[r.jsx(s.ThumbBar,{}),r.jsx(s.ThumbHandle,{})]},g),min:m,max:d,disabled:e})};c.displayName="Widgets.LightCurve.MagnitudeSlider";const S=c;exports.default=S;
|
|
@@ -27,7 +27,7 @@ const D = (i, e, a) => {
|
|
|
27
27
|
ariaLabel: m("light_curve.magnitude_slider.label"),
|
|
28
28
|
orientation: "vertical",
|
|
29
29
|
value: i,
|
|
30
|
-
step: 0.
|
|
30
|
+
step: 0.05,
|
|
31
31
|
ariaValuetext: () => m("light_curve.magnitude_slider.value", {
|
|
32
32
|
...D(r, i, l),
|
|
33
33
|
magnitude: i.toLocaleString(l, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),E=require("react"),N=require("react-i18next"),J=require("d3-array"),K=require("@rubin-epo/epo-react-lib/HorizontalSlider"),t=require("../defaults.cjs"),O=require("../Plot/index.cjs"),Q=require("./A11Y/LightCurveLabel/index.cjs"),c=require("../helpers.cjs"),S=require("../../../atomic/Button/patterns/Reset.cjs"),V=require("./MagnitudeSlider/index.cjs"),X=require("./styles.cjs"),Z=require("../../../charts/Viewport/index.cjs"),k=require("../../../layout/Controls/index.cjs"),$=require("../../../atomic/ControlLabel/index.cjs"),G=require("../../../charts/PathFromPoints/index.cjs"),U=require("../../../lib/utils.cjs"),Y=r=>r&&r.__esModule?r:{default:r},A=Y(K),D=({gaussianWidth:r=t.default.gaussianWidth,yOffset:l=t.default.yOffset,alerts:I,peakMjd:P,yMin:f,yMax:x,width:m=t.default.width,height:q=t.default.height,userMagnitude:W,onUserMagnitudeChangeCallback:n,onGaussianChangeCallback:d,onYOffsetChangeCallback:o,className:F,isDisplayOnly:j,...H})=>{const{t:p}=N.useTranslation(),i=U.mergeWithDefaults({min:f,max:x},t.default.yAxis),g=(i.max-i.min)/2+i.min,h=c.useAlertsAsPoints(I,P),R=E.useId(),w=()=>{n&&n(g),o&&o(t.default.yOffset),d&&d(t.default.gaussianWidth)},v=c.estimateMagnitudeWithOffset(0,r,l),B=e.jsx(O.default,{slider:e.jsx(V.default,{magnitude:W||g,onMagnitudeChangeCallback:s=>n&&n(s),disabled:j,yMin:i.min-i.step/2,yMax:i.max+i.step/2,estimatedPeak:v}),plotChildren:({xScale:s,yScale:u,xDomain:y,yDomain:L,xStart:_,xEnd:z,yStart:M,yEnd:a,Data:T})=>e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:s(0),y:a,width:s(15)-s(0),height:M-a,stroke:"var(--neutral60,##6A6E6E)",strokeDasharray:6,fill:"var(--neutral20,#DCE0E3)"}),T,e.jsx(G.default,{points:J.range(y[0],y[1],.5).map(b=>({x:s(b),y:u(c.estimateMagnitude(b,r))})),svgProps:{transform:`translate(0,${u(L[1]-l)})`}}),e.jsx(Z.default,{x:_,y:a,outerHeight:M-a,outerWidth:z-_,innerWidth:m,innerHeight:q,children:e.jsx(X.DM15Display,{gaussianWidth:r})})]}),...H,data:h,width:m,height:q,yMin:f,yMax:x});return e.jsx(e.Fragment,{children:e.jsx(k.default,{className:F,isDisplayOnly:j,widget:B,controls:e.jsxs(e.Fragment,{children:[e.jsx($.default,{label:p("light_curve.curve.controls.gaussian_width"),input:s=>e.jsx(A.default,{labelledbyId:s,color:"var(--turquoise85, #12726D)",min:t.default.gaussianMin,max:t.default.gaussianMax,step:t.default.gaussianStep,value:r,onChangeCallback:u=>typeof u=="number"&&d&&d(u)}),labelBy:!0}),e.jsx($.default,{label:p("light_curve.curve.controls.y_offset"),input:s=>e.jsx(A.default,{labelledbyId:s,color:"var(--turquoise85, #12726D)",min:t.default.yOffsetMin,max:t.default.yOffsetMax,step:t.default.yOffsetStep,value:l,onChangeCallback:u=>typeof u=="number"&&o&&o(u)}),labelBy:!0}),e.jsx(Q.default,{controlledById:R,data:h,gaussianWidth:r,yOffset:l,estimatedPeak:v})]}),actions:e.jsx(S.default,{onResetCallback:w})})})};D.displayName="Widgets.LightCurve";const C=D;exports.default=C;
|
|
@@ -1,120 +1,134 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as t, jsxs as
|
|
3
|
-
import { useId as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { range as
|
|
6
|
-
import
|
|
2
|
+
import { jsx as t, jsxs as A, Fragment as d } from "react/jsx-runtime";
|
|
3
|
+
import { useId as T } from "react";
|
|
4
|
+
import { useTranslation as V } from "react-i18next";
|
|
5
|
+
import { range as J } from "d3-array";
|
|
6
|
+
import D from "@rubin-epo/epo-react-lib/HorizontalSlider";
|
|
7
7
|
import r from "../defaults.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { useAlertsAsPoints as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { DM15Display as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { mergeWithDefaults as
|
|
19
|
-
const
|
|
20
|
-
gaussianWidth:
|
|
8
|
+
import K from "../Plot/index.js";
|
|
9
|
+
import Q from "./A11Y/LightCurveLabel/index.js";
|
|
10
|
+
import { useAlertsAsPoints as X, estimateMagnitudeWithOffset as Z, estimateMagnitude as O } from "../helpers.js";
|
|
11
|
+
import k from "../../../atomic/Button/patterns/Reset.js";
|
|
12
|
+
import S from "./MagnitudeSlider/index.js";
|
|
13
|
+
import { DM15Display as C } from "./styles.js";
|
|
14
|
+
import G from "../../../charts/Viewport/index.js";
|
|
15
|
+
import U from "../../../layout/Controls/index.js";
|
|
16
|
+
import I from "../../../atomic/ControlLabel/index.js";
|
|
17
|
+
import Y from "../../../charts/PathFromPoints/index.js";
|
|
18
|
+
import { mergeWithDefaults as tt } from "../../../lib/utils.js";
|
|
19
|
+
const w = ({
|
|
20
|
+
gaussianWidth: m = r.gaussianWidth,
|
|
21
21
|
yOffset: s = r.yOffset,
|
|
22
|
-
alerts:
|
|
23
|
-
peakMjd:
|
|
24
|
-
yMin:
|
|
22
|
+
alerts: B,
|
|
23
|
+
peakMjd: _,
|
|
24
|
+
yMin: a,
|
|
25
25
|
yMax: f,
|
|
26
|
-
width:
|
|
27
|
-
height:
|
|
28
|
-
userMagnitude:
|
|
26
|
+
width: c = r.width,
|
|
27
|
+
height: h = r.height,
|
|
28
|
+
userMagnitude: F,
|
|
29
29
|
onUserMagnitudeChangeCallback: n,
|
|
30
30
|
onGaussianChangeCallback: l,
|
|
31
31
|
onYOffsetChangeCallback: u,
|
|
32
|
-
className:
|
|
32
|
+
className: H,
|
|
33
33
|
isDisplayOnly: g,
|
|
34
|
-
...
|
|
34
|
+
...R
|
|
35
35
|
}) => {
|
|
36
|
-
const { t:
|
|
37
|
-
{ min:
|
|
36
|
+
const { t: v } = V(), i = tt(
|
|
37
|
+
{ min: a, max: f },
|
|
38
38
|
r.yAxis
|
|
39
|
-
), y = (
|
|
39
|
+
), y = (i.max - i.min) / 2 + i.min, x = X(B, _), j = T(), q = () => {
|
|
40
40
|
n && n(y), u && u(r.yOffset), l && l(r.gaussianWidth);
|
|
41
|
-
},
|
|
42
|
-
|
|
41
|
+
}, b = Z(0, m, s), $ = /* @__PURE__ */ t(
|
|
42
|
+
K,
|
|
43
43
|
{
|
|
44
44
|
slider: /* @__PURE__ */ t(
|
|
45
|
-
|
|
45
|
+
S,
|
|
46
46
|
{
|
|
47
|
-
magnitude:
|
|
47
|
+
magnitude: F || y,
|
|
48
48
|
onMagnitudeChangeCallback: (e) => n && n(e),
|
|
49
49
|
disabled: g,
|
|
50
|
-
yMin:
|
|
51
|
-
yMax:
|
|
52
|
-
estimatedPeak:
|
|
50
|
+
yMin: i.min - i.step / 2,
|
|
51
|
+
yMax: i.max + i.step / 2,
|
|
52
|
+
estimatedPeak: b
|
|
53
53
|
}
|
|
54
54
|
),
|
|
55
55
|
plotChildren: ({
|
|
56
56
|
xScale: e,
|
|
57
57
|
yScale: o,
|
|
58
|
-
xDomain:
|
|
59
|
-
yDomain:
|
|
60
|
-
xStart:
|
|
61
|
-
xEnd:
|
|
62
|
-
yStart:
|
|
63
|
-
yEnd:
|
|
64
|
-
|
|
58
|
+
xDomain: P,
|
|
59
|
+
yDomain: z,
|
|
60
|
+
xStart: M,
|
|
61
|
+
xEnd: E,
|
|
62
|
+
yStart: W,
|
|
63
|
+
yEnd: p,
|
|
64
|
+
Data: N
|
|
65
|
+
}) => /* @__PURE__ */ A(d, { children: [
|
|
65
66
|
/* @__PURE__ */ t(
|
|
66
|
-
|
|
67
|
+
"rect",
|
|
67
68
|
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
x: e(0),
|
|
70
|
+
y: p,
|
|
71
|
+
width: e(15) - e(0),
|
|
72
|
+
height: W - p,
|
|
73
|
+
stroke: "var(--neutral60,##6A6E6E)",
|
|
74
|
+
strokeDasharray: 6,
|
|
75
|
+
fill: "var(--neutral20,#DCE0E3)"
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
N,
|
|
79
|
+
/* @__PURE__ */ t(
|
|
80
|
+
Y,
|
|
81
|
+
{
|
|
82
|
+
points: J(P[0], P[1], 0.5).map((L) => ({
|
|
83
|
+
x: e(L),
|
|
84
|
+
y: o(O(L, m))
|
|
71
85
|
})),
|
|
72
86
|
svgProps: {
|
|
73
|
-
transform: `translate(0,${o(
|
|
87
|
+
transform: `translate(0,${o(z[1] - s)})`
|
|
74
88
|
}
|
|
75
89
|
}
|
|
76
90
|
),
|
|
77
91
|
/* @__PURE__ */ t(
|
|
78
|
-
|
|
92
|
+
G,
|
|
79
93
|
{
|
|
80
|
-
x:
|
|
81
|
-
y:
|
|
82
|
-
outerHeight:
|
|
83
|
-
outerWidth:
|
|
84
|
-
innerWidth:
|
|
85
|
-
innerHeight:
|
|
86
|
-
children: /* @__PURE__ */ t(
|
|
94
|
+
x: M,
|
|
95
|
+
y: p,
|
|
96
|
+
outerHeight: W - p,
|
|
97
|
+
outerWidth: E - M,
|
|
98
|
+
innerWidth: c,
|
|
99
|
+
innerHeight: h,
|
|
100
|
+
children: /* @__PURE__ */ t(C, { gaussianWidth: m })
|
|
87
101
|
}
|
|
88
102
|
)
|
|
89
103
|
] }),
|
|
90
|
-
...
|
|
91
|
-
data:
|
|
92
|
-
width:
|
|
93
|
-
height:
|
|
94
|
-
yMin:
|
|
104
|
+
...R,
|
|
105
|
+
data: x,
|
|
106
|
+
width: c,
|
|
107
|
+
height: h,
|
|
108
|
+
yMin: a,
|
|
95
109
|
yMax: f
|
|
96
110
|
}
|
|
97
111
|
);
|
|
98
112
|
return /* @__PURE__ */ t(d, { children: /* @__PURE__ */ t(
|
|
99
|
-
|
|
113
|
+
U,
|
|
100
114
|
{
|
|
101
|
-
className:
|
|
115
|
+
className: H,
|
|
102
116
|
isDisplayOnly: g,
|
|
103
|
-
widget:
|
|
104
|
-
controls: /* @__PURE__ */
|
|
117
|
+
widget: $,
|
|
118
|
+
controls: /* @__PURE__ */ A(d, { children: [
|
|
105
119
|
/* @__PURE__ */ t(
|
|
106
|
-
|
|
120
|
+
I,
|
|
107
121
|
{
|
|
108
|
-
label:
|
|
122
|
+
label: v("light_curve.curve.controls.gaussian_width"),
|
|
109
123
|
input: (e) => /* @__PURE__ */ t(
|
|
110
|
-
|
|
124
|
+
D,
|
|
111
125
|
{
|
|
112
126
|
labelledbyId: e,
|
|
113
127
|
color: "var(--turquoise85, #12726D)",
|
|
114
128
|
min: r.gaussianMin,
|
|
115
129
|
max: r.gaussianMax,
|
|
116
130
|
step: r.gaussianStep,
|
|
117
|
-
value:
|
|
131
|
+
value: m,
|
|
118
132
|
onChangeCallback: (o) => typeof o == "number" && l && l(o)
|
|
119
133
|
}
|
|
120
134
|
),
|
|
@@ -122,11 +136,11 @@ const B = ({
|
|
|
122
136
|
}
|
|
123
137
|
),
|
|
124
138
|
/* @__PURE__ */ t(
|
|
125
|
-
|
|
139
|
+
I,
|
|
126
140
|
{
|
|
127
|
-
label:
|
|
141
|
+
label: v("light_curve.curve.controls.y_offset"),
|
|
128
142
|
input: (e) => /* @__PURE__ */ t(
|
|
129
|
-
|
|
143
|
+
D,
|
|
130
144
|
{
|
|
131
145
|
labelledbyId: e,
|
|
132
146
|
color: "var(--turquoise85, #12726D)",
|
|
@@ -141,22 +155,22 @@ const B = ({
|
|
|
141
155
|
}
|
|
142
156
|
),
|
|
143
157
|
/* @__PURE__ */ t(
|
|
144
|
-
|
|
158
|
+
Q,
|
|
145
159
|
{
|
|
146
|
-
controlledById:
|
|
147
|
-
data:
|
|
148
|
-
gaussianWidth:
|
|
160
|
+
controlledById: j,
|
|
161
|
+
data: x,
|
|
162
|
+
gaussianWidth: m,
|
|
149
163
|
yOffset: s,
|
|
150
|
-
estimatedPeak:
|
|
164
|
+
estimatedPeak: b
|
|
151
165
|
}
|
|
152
166
|
)
|
|
153
167
|
] }),
|
|
154
|
-
actions: /* @__PURE__ */ t(
|
|
168
|
+
actions: /* @__PURE__ */ t(k, { onResetCallback: q })
|
|
155
169
|
}
|
|
156
170
|
) });
|
|
157
171
|
};
|
|
158
|
-
|
|
159
|
-
const yt =
|
|
172
|
+
w.displayName = "Widgets.LightCurve";
|
|
173
|
+
const yt = w;
|
|
160
174
|
export {
|
|
161
175
|
yt as default
|
|
162
176
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseAlert } from '../../../types/astro';
|
|
3
3
|
import { PlotProps } from '../Plot';
|
|
4
4
|
|
|
5
5
|
export interface PlotWithoutCurveProps extends Omit<PlotProps, "data"> {
|
|
6
|
-
alerts: Array<
|
|
6
|
+
alerts: Array<BaseAlert>;
|
|
7
7
|
peakMjd: number;
|
|
8
8
|
}
|
|
9
9
|
declare const PlotWithoutCurve: FunctionComponent<PlotWithoutCurveProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s={xAxis:{min:-10,max:50,ticks:6},yAxis:{min:20,max:14,step:-.5},width:600,height:600,gaussianMin:-4,gaussianMax:4,gaussianStep:.01,gaussianWidth:-2,yOffsetMin:-50,yOffsetMax:50,yOffsetStep:.1,yOffset:-2},e=s;exports.default=e;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseAlert } from '../../types/astro';
|
|
2
2
|
import { PlotPoint, Point } from '../../types/charts';
|
|
3
3
|
|
|
4
4
|
export declare const daysSincePeak: (current: number, peak: number) => number;
|
|
5
|
-
export declare const useAlertsAsPoints: (alerts: Array<
|
|
5
|
+
export declare const useAlertsAsPoints: (alerts: Array<BaseAlert>, phaseCorrection: number) => Array<PlotPoint>;
|
|
6
6
|
export declare const gaussianBump: (x: number, gaussianWidth: number) => number;
|
|
7
7
|
export declare const exponentialRise: (x: number, magnitude: number) => number;
|
|
8
8
|
/**
|
|
@@ -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"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),l=require("react"),B=require("react-i18next"),E=require("@rubin-epo/epo-react-lib/IconComposer"),I=require("../../layout/AspectRatio/index.cjs"),N=require("../../atomic/Loader/index.cjs"),R=require("./PointSelector/index.cjs"),U=require("./Message/Message.cjs"),w=require("../../atomic/Blinker/Blinker.cjs"),y=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),D=e=>e&&e.__esModule?e:{default:e},G=D(E),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},q=({width:e=600,height:u=600,selectedSource:n=[],sources:o,alerts:t=[],activeAlertIndex:r=0,alertChangeCallback:M,selectionCallback:d,blinkConfig:j,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}=B.useTranslation(),h="sourceSelectorWidget",m=!_&&!b,x=()=>{f(g("source_selector.messages.failure")),i(!0)},L=a=>{if(!(!m||c))if(a){const P=!!o.find(({id:z})=>z===a),W=!n.includes(a);P&&W?(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),F=c?[(S=t[r])==null?void 0:S.image]:t.map(({image:a})=>a);return s.jsxs(I.default,{ratio:"square",className:C,children:[!c&&s.jsx(U.default,{onMessageChangeCallback:T,isVisible:V,forIds:[h],children:p}),s.jsx(w.default,{images:F,activeIndex:r,blinkCallback:M,loadedCallback:()=>k(!1),extraControls:t.length>0&&!c&&s.jsx(y.default,{day:$,hour:v}),...j,children:s.jsx(R.default,{id:h,onSelectCallback:L,width:e,height:u,sources:o,selectedSource:n})}),!m&&s.jsx(N.default,{})]})};q.displayName="Widgets.SourceSelector";const J=q;exports.default=J;
|