@rubin-epo/epo-widget-lib 0.9.9 → 0.9.10
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),A=require("react-i18next"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),A=require("react-i18next"),T=require("@rubin-epo/epo-react-lib/HorizontalSlider"),t=require("../defaults.cjs"),B=require("../Plot/index.cjs"),M=require("./LightCurve/index.cjs"),N=require("./A11Y/LightCurveLabel/index.cjs"),L=require("../helpers.cjs"),J=require("../../../atomic/Button/patterns/Reset.cjs"),K=require("./MagnitudeSlider/index.cjs"),a=require("./styles.cjs"),Q=require("../../../charts/Viewport/index.cjs"),V=require("../../../layout/Controls/index.cjs"),X=require("../../../layout/AspectRatio/index.cjs"),Z=s=>s&&s.__esModule?s:{default:s},I=Z(T),W=({gaussianWidth:s=t.default.gaussianWidth,yOffset:i=t.default.yOffset,alerts:$,peakMjd:y,yMin:l=t.default.yMin,yMax:d=t.default.yMax,width:c=t.default.width,height:f=t.default.height,userMagnitude:P=(d-l)/2+l,onUserMagnitudeChangeCallback:u,onGaussianChangeCallback:o,onYOffsetChangeCallback:n,className:S,isDisplayOnly:x,...D})=>{const{t:h}=A.useTranslation(),j="lightCurveControls",q="gaussianWidthLabel",m="yOffsetLabel",v=L.useAlertsAsPoints($,y),H=()=>{u&&u((d-l)/2+l),n&&n(t.default.yOffset),o&&o(t.default.gaussianWidth)},g=L.estimateMagnitudeWithOffset(0,s,i),b=e.jsx(B.default,{slider:e.jsx(K.default,{magnitude:P,onMagnitudeChangeCallback:r=>u&&u(r),disabled:x,yMin:l,yMax:d,estimatedPeak:g}),plotChildren:({xScale:r,yScale:R,xDomain:F,yDomain:O,xStart:p,xEnd:w,yStart:z,yEnd:_})=>e.jsxs(e.Fragment,{children:[e.jsx(M.default,{gaussianWidth:s,yOffset:i,xDomain:F,xScale:r,yScale:R,yDomain:O}),e.jsx(Q.default,{x:p,y:_,outerHeight:z-_,outerWidth:w-p,innerWidth:c,innerHeight:f,children:e.jsx(a.DM15Display,{gaussianWidth:s})})]}),...D,data:v,width:c,height:f,yMin:l,yMax:d});return x?e.jsx(X.default,{ratio:"square",children:b}):e.jsxs(e.Fragment,{children:[e.jsx(V.default,{className:S,widget:b,controls:e.jsxs(a.Controls,{id:j,children:[e.jsxs("div",{children:[e.jsx(a.ControlLabel,{id:q,children:h("light_curve.curve.controls.gaussian_width")}),e.jsx(I.default,{label:"Gaussian Width",labelledbyId:q,color:"var(--turquoise85, #12726D)",min:t.default.gaussianMin,max:t.default.gaussianMax,step:t.default.gaussianStep,value:s,onChangeCallback:r=>typeof r=="number"&&o&&o(r)})]}),e.jsxs("div",{children:[e.jsx(a.ControlLabel,{id:m,children:h("light_curve.curve.controls.y_offset")}),e.jsx(I.default,{label:"Y Offset",labelledbyId:m,color:"var(--turquoise85, #12726D)",min:t.default.yOffsetMin,max:t.default.yOffsetMax,step:t.default.yOffsetStep,value:i,onChangeCallback:r=>typeof r=="number"&&n&&n(r)})]})]}),actions:e.jsx(J.default,{onResetCallback:H})}),e.jsx(N.default,{controlledById:j,data:v,gaussianWidth:s,yOffset:i,estimatedPeak:g})]})};W.displayName="Widgets.LightCurve";const E=W;exports.default=E;
|
|
@@ -1,139 +1,140 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as r, jsxs as s, Fragment as P } from "react/jsx-runtime";
|
|
3
3
|
import { useTranslation as N } from "react-i18next";
|
|
4
|
-
import
|
|
4
|
+
import y from "@rubin-epo/epo-react-lib/HorizontalSlider";
|
|
5
5
|
import t from "../defaults.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { useAlertsAsPoints as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { DM15Display as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
|
|
6
|
+
import T from "../Plot/index.js";
|
|
7
|
+
import V from "./LightCurve/index.js";
|
|
8
|
+
import $ from "./A11Y/LightCurveLabel/index.js";
|
|
9
|
+
import { useAlertsAsPoints as C, estimateMagnitudeWithOffset as J } from "../helpers.js";
|
|
10
|
+
import K from "../../../atomic/Button/patterns/Reset.js";
|
|
11
|
+
import Q from "./MagnitudeSlider/index.js";
|
|
12
|
+
import { DM15Display as X, Controls as Z, ControlLabel as R } from "./styles.js";
|
|
13
|
+
import E from "../../../charts/Viewport/index.js";
|
|
14
|
+
import M from "../../../layout/Controls/index.js";
|
|
15
|
+
import G from "../../../layout/AspectRatio/index.js";
|
|
16
|
+
const _ = ({
|
|
16
17
|
gaussianWidth: i = t.gaussianWidth,
|
|
17
18
|
yOffset: l = t.yOffset,
|
|
18
|
-
alerts:
|
|
19
|
-
peakMjd:
|
|
19
|
+
alerts: q,
|
|
20
|
+
peakMjd: w,
|
|
20
21
|
yMin: o = t.yMin,
|
|
21
22
|
yMax: d = t.yMax,
|
|
22
|
-
width:
|
|
23
|
-
height:
|
|
24
|
-
userMagnitude:
|
|
23
|
+
width: c = t.width,
|
|
24
|
+
height: f = t.height,
|
|
25
|
+
userMagnitude: A = (d - o) / 2 + o,
|
|
25
26
|
onUserMagnitudeChangeCallback: m,
|
|
26
27
|
onGaussianChangeCallback: n,
|
|
27
28
|
onYOffsetChangeCallback: u,
|
|
28
|
-
className:
|
|
29
|
-
isDisplayOnly:
|
|
30
|
-
...
|
|
29
|
+
className: D,
|
|
30
|
+
isDisplayOnly: p,
|
|
31
|
+
...H
|
|
31
32
|
}) => {
|
|
32
|
-
const { t:
|
|
33
|
+
const { t: a } = N(), h = "lightCurveControls", g = "gaussianWidthLabel", v = "yOffsetLabel", L = C(q, w), S = () => {
|
|
33
34
|
m && m((d - o) / 2 + o), u && u(t.yOffset), n && n(t.gaussianWidth);
|
|
34
|
-
}, b =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
}, b = J(0, i, l), W = /* @__PURE__ */ r(
|
|
36
|
+
T,
|
|
37
|
+
{
|
|
38
|
+
slider: /* @__PURE__ */ r(
|
|
39
|
+
Q,
|
|
40
|
+
{
|
|
41
|
+
magnitude: A,
|
|
42
|
+
onMagnitudeChangeCallback: (e) => m && m(e),
|
|
43
|
+
disabled: p,
|
|
44
|
+
yMin: o,
|
|
45
|
+
yMax: d,
|
|
46
|
+
estimatedPeak: b
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
plotChildren: ({
|
|
50
|
+
xScale: e,
|
|
51
|
+
yScale: j,
|
|
52
|
+
xDomain: F,
|
|
53
|
+
yDomain: O,
|
|
54
|
+
xStart: I,
|
|
55
|
+
xEnd: z,
|
|
56
|
+
yStart: B,
|
|
57
|
+
yEnd: x
|
|
58
|
+
}) => /* @__PURE__ */ s(P, { children: [
|
|
59
|
+
/* @__PURE__ */ r(
|
|
60
|
+
V,
|
|
42
61
|
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
yMin: o,
|
|
50
|
-
yMax: d,
|
|
51
|
-
estimatedPeak: b
|
|
52
|
-
}
|
|
53
|
-
),
|
|
54
|
-
plotChildren: ({
|
|
55
|
-
xScale: r,
|
|
56
|
-
yScale: A,
|
|
57
|
-
xDomain: D,
|
|
58
|
-
yDomain: F,
|
|
59
|
-
xStart: W,
|
|
60
|
-
xEnd: z,
|
|
61
|
-
yStart: B,
|
|
62
|
-
yEnd: I
|
|
63
|
-
}) => /* @__PURE__ */ s(x, { children: [
|
|
64
|
-
/* @__PURE__ */ e(
|
|
65
|
-
T,
|
|
66
|
-
{
|
|
67
|
-
gaussianWidth: i,
|
|
68
|
-
yOffset: l,
|
|
69
|
-
xDomain: D,
|
|
70
|
-
xScale: r,
|
|
71
|
-
yScale: A,
|
|
72
|
-
yDomain: F
|
|
73
|
-
}
|
|
74
|
-
),
|
|
75
|
-
/* @__PURE__ */ e(
|
|
76
|
-
Z,
|
|
77
|
-
{
|
|
78
|
-
x: W,
|
|
79
|
-
y: I,
|
|
80
|
-
outerHeight: B - I,
|
|
81
|
-
outerWidth: z - W,
|
|
82
|
-
innerWidth: f,
|
|
83
|
-
innerHeight: p,
|
|
84
|
-
children: /* @__PURE__ */ e(Q, { gaussianWidth: i })
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
] }),
|
|
88
|
-
...q,
|
|
89
|
-
data: L,
|
|
90
|
-
width: f,
|
|
91
|
-
height: p,
|
|
92
|
-
yMin: o,
|
|
93
|
-
yMax: d
|
|
62
|
+
gaussianWidth: i,
|
|
63
|
+
yOffset: l,
|
|
64
|
+
xDomain: F,
|
|
65
|
+
xScale: e,
|
|
66
|
+
yScale: j,
|
|
67
|
+
yDomain: O
|
|
94
68
|
}
|
|
95
69
|
),
|
|
96
|
-
|
|
70
|
+
/* @__PURE__ */ r(
|
|
71
|
+
E,
|
|
72
|
+
{
|
|
73
|
+
x: I,
|
|
74
|
+
y: x,
|
|
75
|
+
outerHeight: B - x,
|
|
76
|
+
outerWidth: z - I,
|
|
77
|
+
innerWidth: c,
|
|
78
|
+
innerHeight: f,
|
|
79
|
+
children: /* @__PURE__ */ r(X, { gaussianWidth: i })
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
] }),
|
|
83
|
+
...H,
|
|
84
|
+
data: L,
|
|
85
|
+
width: c,
|
|
86
|
+
height: f,
|
|
87
|
+
yMin: o,
|
|
88
|
+
yMax: d
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
return p ? /* @__PURE__ */ r(G, { ratio: "square", children: W }) : /* @__PURE__ */ s(P, { children: [
|
|
92
|
+
/* @__PURE__ */ r(
|
|
93
|
+
M,
|
|
94
|
+
{
|
|
95
|
+
className: D,
|
|
96
|
+
widget: W,
|
|
97
|
+
controls: /* @__PURE__ */ s(Z, { id: h, children: [
|
|
97
98
|
/* @__PURE__ */ s("div", { children: [
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
|
|
99
|
+
/* @__PURE__ */ r(R, { id: g, children: a("light_curve.curve.controls.gaussian_width") }),
|
|
100
|
+
/* @__PURE__ */ r(
|
|
101
|
+
y,
|
|
101
102
|
{
|
|
102
103
|
label: "Gaussian Width",
|
|
103
|
-
labelledbyId:
|
|
104
|
+
labelledbyId: g,
|
|
104
105
|
color: "var(--turquoise85, #12726D)",
|
|
105
106
|
min: t.gaussianMin,
|
|
106
107
|
max: t.gaussianMax,
|
|
107
108
|
step: t.gaussianStep,
|
|
108
109
|
value: i,
|
|
109
|
-
onChangeCallback: (
|
|
110
|
+
onChangeCallback: (e) => typeof e == "number" && n && n(e)
|
|
110
111
|
}
|
|
111
112
|
)
|
|
112
113
|
] }),
|
|
113
114
|
/* @__PURE__ */ s("div", { children: [
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
|
|
115
|
+
/* @__PURE__ */ r(R, { id: v, children: a("light_curve.curve.controls.y_offset") }),
|
|
116
|
+
/* @__PURE__ */ r(
|
|
117
|
+
y,
|
|
117
118
|
{
|
|
118
119
|
label: "Y Offset",
|
|
119
|
-
labelledbyId:
|
|
120
|
+
labelledbyId: v,
|
|
120
121
|
color: "var(--turquoise85, #12726D)",
|
|
121
122
|
min: t.yOffsetMin,
|
|
122
123
|
max: t.yOffsetMax,
|
|
123
124
|
step: t.yOffsetStep,
|
|
124
125
|
value: l,
|
|
125
|
-
onChangeCallback: (
|
|
126
|
+
onChangeCallback: (e) => typeof e == "number" && u && u(e)
|
|
126
127
|
}
|
|
127
128
|
)
|
|
128
129
|
] })
|
|
129
130
|
] }),
|
|
130
|
-
actions:
|
|
131
|
+
actions: /* @__PURE__ */ r(K, { onResetCallback: S })
|
|
131
132
|
}
|
|
132
133
|
),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
134
|
+
/* @__PURE__ */ r(
|
|
135
|
+
$,
|
|
135
136
|
{
|
|
136
|
-
controlledById:
|
|
137
|
+
controlledById: h,
|
|
137
138
|
data: L,
|
|
138
139
|
gaussianWidth: i,
|
|
139
140
|
yOffset: l,
|
|
@@ -142,8 +143,8 @@ const w = ({
|
|
|
142
143
|
)
|
|
143
144
|
] });
|
|
144
145
|
};
|
|
145
|
-
|
|
146
|
-
const
|
|
146
|
+
_.displayName = "Widgets.LightCurve";
|
|
147
|
+
const ct = _;
|
|
147
148
|
export {
|
|
148
|
-
|
|
149
|
+
ct as default
|
|
149
150
|
};
|
package/package.json
CHANGED