@rubin-epo/epo-widget-lib 0.10.4 → 1.0.0-beta.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/IsochronePlot.js +7 -7
- 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/Readout/index.cjs +1 -1
- package/dist/charts/Readout/index.js +6 -5
- package/dist/charts/ScatterPlot/index.cjs +1 -1
- package/dist/charts/ScatterPlot/index.js +77 -77
- package/dist/charts/ScatterPlot/styles.cjs +3 -4
- package/dist/charts/ScatterPlot/styles.js +5 -6
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.js +18 -16
- package/dist/localeStrings/en/epo-widget-lib.json +6 -6
- package/dist/widgets/LightCurvePlot/Plot/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/Plot/index.js +53 -68
- 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/SourceSelector/SourceSelector.cjs +1 -1
- package/dist/widgets/SourceSelector/SourceSelector.js +37 -39
- package/dist/widgets/SourceSelector/styles.d.ts +1 -0
- package/dist/widgets/SupernovaThreeVector/Histogram/index.cjs +1 -1
- package/dist/widgets/SupernovaThreeVector/Histogram/index.js +43 -43
- package/dist/widgets/SupernovaThreeVector/Skymap/index.cjs +1 -1
- package/dist/widgets/SupernovaThreeVector/Skymap/index.js +3 -2
- package/dist/widgets/SupernovaThreeVector/styles.cjs +6 -7
- package/dist/widgets/SupernovaThreeVector/styles.js +11 -12
- package/package.json +1 -1
|
@@ -1,130 +1,131 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as u, jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { jsxs as u, jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { useState as F } from "react";
|
|
4
|
+
import J from "../XAxis/index.js";
|
|
5
|
+
import K from "../YAxis/index.js";
|
|
6
6
|
import R from "../Guidelines/index.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { Chart as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
7
|
+
import Q from "../Points/index.js";
|
|
8
|
+
import U from "../Tooltip/index.js";
|
|
9
|
+
import V from "../ClippingContainer/index.js";
|
|
10
|
+
import D from "../hooks/useAxis.js";
|
|
11
|
+
import { Chart as Z } from "./styles.js";
|
|
12
|
+
import T from "../defaults.js";
|
|
13
|
+
import _ from "../canvas/Points/index.js";
|
|
14
|
+
import { isSafari as $ } from "../../lib/utils.js";
|
|
14
15
|
const w = {
|
|
15
|
-
svg:
|
|
16
|
-
canvas:
|
|
17
|
-
},
|
|
16
|
+
svg: Q,
|
|
17
|
+
canvas: _
|
|
18
|
+
}, tt = ({
|
|
18
19
|
data: j,
|
|
19
20
|
className: z,
|
|
20
|
-
xAxis:
|
|
21
|
-
yAxis:
|
|
21
|
+
xAxis: l,
|
|
22
|
+
yAxis: c,
|
|
22
23
|
width: d,
|
|
23
24
|
height: m,
|
|
24
|
-
title:
|
|
25
|
-
activePointId:
|
|
26
|
-
margins:
|
|
25
|
+
title: B,
|
|
26
|
+
activePointId: E,
|
|
27
|
+
margins: M,
|
|
27
28
|
tooltip: n,
|
|
28
|
-
onLoadedCallback:
|
|
29
|
-
renderer:
|
|
29
|
+
onLoadedCallback: A,
|
|
30
|
+
renderer: G = "svg",
|
|
30
31
|
plotChildren: x
|
|
31
32
|
}) => {
|
|
32
|
-
const [y, h] =
|
|
33
|
-
|
|
33
|
+
const [y, h] = F(), { label: N, points: f } = j, r = { ...T.margins, ...M }, t = typeof y < "u" ? f[y] : f.find(({ id: v }) => v === E), b = [0 + r.left, d - r.right], g = [m - r.bottom, 0 + r.top], [a, S, o] = D({ ...l, range: b }), [i, I, e] = D({ ...c, range: g }), P = e(i[0]), p = o(a[0]), k = e(i[1]), O = o(a[1]), C = "x-axis-label", L = "y-axis-label", W = Math.abs(b[1] - b[0]), X = Math.abs(g[1] - g[0]), Y = w[G], H = /* @__PURE__ */ s(
|
|
34
|
+
Y,
|
|
34
35
|
{
|
|
35
36
|
data: f,
|
|
36
|
-
onHoverCallback: n ? (
|
|
37
|
+
onHoverCallback: n ? (v) => h(v) : void 0,
|
|
37
38
|
onHoverOutCallback: n ? () => h(void 0) : void 0,
|
|
38
39
|
width: d,
|
|
39
40
|
height: m,
|
|
40
|
-
xScale:
|
|
41
|
-
yScale:
|
|
42
|
-
label:
|
|
43
|
-
onLoadedCallback:
|
|
41
|
+
xScale: o,
|
|
42
|
+
yScale: e,
|
|
43
|
+
label: N,
|
|
44
|
+
onLoadedCallback: A
|
|
44
45
|
}
|
|
45
|
-
),
|
|
46
|
+
), q = {
|
|
46
47
|
Data: H,
|
|
47
|
-
xScale:
|
|
48
|
-
yScale:
|
|
49
|
-
yStart:
|
|
48
|
+
xScale: o,
|
|
49
|
+
yScale: e,
|
|
50
|
+
yStart: P,
|
|
50
51
|
yEnd: k,
|
|
51
|
-
xStart:
|
|
52
|
-
xEnd:
|
|
53
|
-
yDomain:
|
|
54
|
-
xDomain:
|
|
52
|
+
xStart: p,
|
|
53
|
+
xEnd: O,
|
|
54
|
+
yDomain: i,
|
|
55
|
+
xDomain: a
|
|
55
56
|
};
|
|
56
57
|
return /* @__PURE__ */ u(
|
|
57
|
-
|
|
58
|
+
Z,
|
|
58
59
|
{
|
|
59
|
-
verticalLabel:
|
|
60
|
+
verticalLabel: c.label,
|
|
60
61
|
verticalLabelId: L,
|
|
61
|
-
horizontalLabel:
|
|
62
|
+
horizontalLabel: l.label,
|
|
62
63
|
horizontalLabelId: C,
|
|
63
64
|
className: z,
|
|
64
65
|
width: d,
|
|
65
66
|
height: m,
|
|
66
|
-
title:
|
|
67
|
+
title: B,
|
|
67
68
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
69
|
+
/* @__PURE__ */ s(
|
|
70
|
+
K,
|
|
70
71
|
{
|
|
71
|
-
ticks:
|
|
72
|
-
x:
|
|
72
|
+
ticks: I,
|
|
73
|
+
x: p,
|
|
73
74
|
labelledById: L,
|
|
74
|
-
yDomain:
|
|
75
|
-
yScale:
|
|
75
|
+
yDomain: i,
|
|
76
|
+
yScale: e
|
|
76
77
|
}
|
|
77
78
|
),
|
|
78
79
|
/* @__PURE__ */ u(
|
|
79
|
-
|
|
80
|
+
V,
|
|
80
81
|
{
|
|
81
|
-
x:
|
|
82
|
+
x: p,
|
|
82
83
|
y: k,
|
|
83
|
-
width:
|
|
84
|
-
height:
|
|
84
|
+
width: W,
|
|
85
|
+
height: X,
|
|
85
86
|
children: [
|
|
86
|
-
|
|
87
|
+
l.guidelines && /* @__PURE__ */ s(
|
|
87
88
|
R,
|
|
88
89
|
{
|
|
89
|
-
guides:
|
|
90
|
+
guides: S.length,
|
|
90
91
|
direction: "vertical",
|
|
91
|
-
xDomain:
|
|
92
|
-
yDomain:
|
|
93
|
-
xScale:
|
|
94
|
-
yScale:
|
|
92
|
+
xDomain: a,
|
|
93
|
+
yDomain: i,
|
|
94
|
+
xScale: o,
|
|
95
|
+
yScale: e
|
|
95
96
|
}
|
|
96
97
|
),
|
|
97
|
-
|
|
98
|
+
c.guidelines && /* @__PURE__ */ s(
|
|
98
99
|
R,
|
|
99
100
|
{
|
|
100
|
-
guides:
|
|
101
|
-
xDomain:
|
|
102
|
-
yDomain:
|
|
103
|
-
xScale:
|
|
104
|
-
yScale:
|
|
101
|
+
guides: I.length,
|
|
102
|
+
xDomain: a,
|
|
103
|
+
yDomain: i,
|
|
104
|
+
xScale: o,
|
|
105
|
+
yScale: e
|
|
105
106
|
}
|
|
106
107
|
),
|
|
107
|
-
x ? x(
|
|
108
|
+
x ? x(q) : H
|
|
108
109
|
]
|
|
109
110
|
}
|
|
110
111
|
),
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
|
|
112
|
+
/* @__PURE__ */ s(
|
|
113
|
+
J,
|
|
113
114
|
{
|
|
114
|
-
ticks:
|
|
115
|
-
y:
|
|
115
|
+
ticks: S,
|
|
116
|
+
y: P,
|
|
116
117
|
labelledById: C,
|
|
117
|
-
xDomain:
|
|
118
|
-
xScale:
|
|
118
|
+
xDomain: a,
|
|
119
|
+
xScale: o
|
|
119
120
|
}
|
|
120
121
|
),
|
|
121
|
-
n && /* @__PURE__ */ u(
|
|
122
|
-
|
|
122
|
+
n && !$() && /* @__PURE__ */ u(
|
|
123
|
+
U,
|
|
123
124
|
{
|
|
124
|
-
x: t ?
|
|
125
|
-
y: t ?
|
|
125
|
+
x: t ? o(t.x) : void 0,
|
|
126
|
+
y: t ? e(t.y) : void 0,
|
|
126
127
|
visible: !!t,
|
|
127
|
-
offset:
|
|
128
|
+
offset: T.pointRadius,
|
|
128
129
|
children: [
|
|
129
130
|
t && typeof n == "function" && n(t),
|
|
130
131
|
t && typeof n == "string" && n
|
|
@@ -135,8 +136,7 @@ const w = {
|
|
|
135
136
|
}
|
|
136
137
|
);
|
|
137
138
|
};
|
|
138
|
-
|
|
139
|
-
const ft = T;
|
|
139
|
+
tt.displayName = "Charts.ScatterPlot";
|
|
140
140
|
export {
|
|
141
|
-
|
|
141
|
+
tt as default
|
|
142
142
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("styled-components"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("styled-components"),n=require("@rubin-epo/epo-react-lib/styles"),o=require("../Base/index.cjs"),s=e=>e&&e.__esModule?e:{default:e},i=s(t),r=i.default(o.default)`
|
|
2
2
|
font-size: 1.5em;
|
|
3
|
-
overflow: visible;
|
|
4
3
|
|
|
5
4
|
@container (
|
|
6
|
-
min-width: ${
|
|
5
|
+
min-width: ${n.token("BREAK_PHABLET_MIN")}
|
|
7
6
|
) {
|
|
8
7
|
font-size: 1em;
|
|
9
8
|
}
|
|
10
|
-
`;exports.Chart=
|
|
9
|
+
`;exports.Chart=r;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import { token as
|
|
4
|
-
import
|
|
5
|
-
const n =
|
|
2
|
+
import t from "styled-components";
|
|
3
|
+
import { token as o } from "@rubin-epo/epo-react-lib/styles";
|
|
4
|
+
import e from "../Base/index.js";
|
|
5
|
+
const n = t(e)`
|
|
6
6
|
font-size: 1.5em;
|
|
7
|
-
overflow: visible;
|
|
8
7
|
|
|
9
8
|
@container (
|
|
10
|
-
min-width: ${
|
|
9
|
+
min-width: ${o("BREAK_PHABLET_MIN")}
|
|
11
10
|
) {
|
|
12
11
|
font-size: 1em;
|
|
13
12
|
}
|
package/dist/lib/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("lodash/mergeWith"),g=require("lodash/isNil"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("lodash/mergeWith"),g=require("lodash/isNil"),c=t=>t&&t.__esModule?t:{default:t},m=c(d),o=c(g),h=(t,e)=>{switch(!0){case t>e:return 0;case t<0:return e;default:return t}},p=(t,e,n)=>t>=e&&t<=n,M=(t=[],e=[])=>{const n=t[0]<e[0]?t:e,r=n===t?e:t;return n[1]<r[0]?null:[r[0],n[1]<r[1]?n[1]:r[1]]},A=t=>t[Math.round((t.length-1)/2)],S=(t=[0,1],e=[0,1],n)=>{const r={clamp:!1,fractionDigits:2},{clamp:i,fractionDigits:s}={...r,...n};return l=>{const a=t[1]-t[0];if(a===0)return(e[0]+e[1])/2;let u=(l-t[0])/a;return i&&(u=Math.min(Math.max(u,0),1)),Number((u*(e[1]-e[0])+e[0]).toFixed(s))}},_=()=>{if(typeof navigator>"u")return!1;const t=navigator.userAgent.indexOf("Chrome")>-1;return navigator.userAgent.indexOf("Safari")>-1&&!t},f=(t,e)=>o.default(e)&&t?o.default(t)?e:t:e,y=(t,e)=>m.default({},e,t,f),D=(t,e=[0,0])=>t.reduce((n,{x:r,y:i},s)=>n+=`${s===0?"M":" L"}${r+e[0]},${i+e[1]}`,"");exports.between=p;exports.buildPath=D;exports.defaultsMerger=f;exports.getClampedArrayIndex=h;exports.getLinearScale=S;exports.intersection=M;exports.isSafari=_;exports.mergeWithDefaults=y;exports.middle=A;
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import a from "lodash/mergeWith";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
2
|
+
import f from "lodash/isNil";
|
|
3
|
+
const d = (t, e) => {
|
|
4
4
|
switch (!0) {
|
|
5
5
|
case t > e:
|
|
6
6
|
return 0;
|
|
@@ -9,32 +9,34 @@ const l = (t, e) => {
|
|
|
9
9
|
default:
|
|
10
10
|
return t;
|
|
11
11
|
}
|
|
12
|
-
},
|
|
13
|
-
const
|
|
14
|
-
return
|
|
15
|
-
}, A = (t) => t[Math.round((t.length - 1) / 2)], M = (t = [0, 1], e = [0, 1],
|
|
16
|
-
const
|
|
17
|
-
return (
|
|
12
|
+
}, h = (t, e, n) => t >= e && t <= n, p = (t = [], e = []) => {
|
|
13
|
+
const n = t[0] < e[0] ? t : e, r = n === t ? e : t;
|
|
14
|
+
return n[1] < r[0] ? null : [r[0], n[1] < r[1] ? n[1] : r[1]];
|
|
15
|
+
}, A = (t) => t[Math.round((t.length - 1) / 2)], M = (t = [0, 1], e = [0, 1], n) => {
|
|
16
|
+
const r = { clamp: !1, fractionDigits: 2 }, { clamp: i, fractionDigits: s } = { ...r, ...n };
|
|
17
|
+
return (u) => {
|
|
18
18
|
const c = t[1] - t[0];
|
|
19
19
|
if (c === 0)
|
|
20
20
|
return (e[0] + e[1]) / 2;
|
|
21
|
-
let o = (
|
|
21
|
+
let o = (u - t[0]) / c;
|
|
22
22
|
return i && (o = Math.min(Math.max(o, 0), 1)), Number(
|
|
23
23
|
(o * (e[1] - e[0]) + e[0]).toFixed(s)
|
|
24
24
|
);
|
|
25
25
|
};
|
|
26
|
-
},
|
|
26
|
+
}, v = () => {
|
|
27
|
+
if (typeof navigator > "u")
|
|
28
|
+
return !1;
|
|
27
29
|
const t = navigator.userAgent.indexOf("Chrome") > -1;
|
|
28
30
|
return navigator.userAgent.indexOf("Safari") > -1 && !t;
|
|
29
|
-
}, m = (t, e) =>
|
|
31
|
+
}, m = (t, e) => f(e) && t ? f(t) ? e : t : e, x = (t, e) => a({}, e, t, m), D = (t, e = [0, 0]) => t.reduce((n, { x: r, y: i }, s) => n += `${s === 0 ? "M" : " L"}${r + e[0]},${i + e[1]}`, "");
|
|
30
32
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
h as between,
|
|
34
|
+
D as buildPath,
|
|
33
35
|
m as defaultsMerger,
|
|
34
|
-
|
|
36
|
+
d as getClampedArrayIndex,
|
|
35
37
|
M as getLinearScale,
|
|
36
38
|
p as intersection,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
v as isSafari,
|
|
40
|
+
x as mergeWithDefaults,
|
|
39
41
|
A as middle
|
|
40
42
|
};
|
|
@@ -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}}."
|
|
@@ -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,53 +1,53 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { min as
|
|
2
|
+
import { jsxs as j, jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslation as C } from "react-i18next";
|
|
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 = (
|
|
12
|
-
const
|
|
13
|
-
return Object.keys(
|
|
14
|
-
const s =
|
|
15
|
-
|
|
16
|
-
}),
|
|
17
|
-
},
|
|
18
|
-
data:
|
|
19
|
-
activeAlertId:
|
|
20
|
-
xMin:
|
|
21
|
-
xMax:
|
|
22
|
-
yMin:
|
|
23
|
-
yMax:
|
|
24
|
-
width: s =
|
|
25
|
-
height: a =
|
|
26
|
-
name:
|
|
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
|
+
data: i,
|
|
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
|
-
t:
|
|
33
|
-
i18n: { language:
|
|
34
|
-
} =
|
|
32
|
+
t: e,
|
|
33
|
+
i18n: { language: A }
|
|
34
|
+
} = C(), v = x(
|
|
35
35
|
{
|
|
36
|
-
min:
|
|
37
|
-
max:
|
|
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
|
-
|
|
44
|
-
label:
|
|
43
|
+
...v,
|
|
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
|
-
...
|
|
50
|
-
label:
|
|
49
|
+
...n.yAxis,
|
|
50
|
+
label: e("isochrone_plot.plot.y_label")
|
|
51
51
|
}
|
|
52
52
|
), b = {
|
|
53
53
|
top: 10,
|
|
@@ -55,51 +55,36 @@ const O = (e, 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
|
-
...
|
|
68
|
+
...P
|
|
69
69
|
},
|
|
70
70
|
yAxis: {
|
|
71
|
-
...
|
|
72
|
-
step:
|
|
71
|
+
...l,
|
|
72
|
+
step: l.min < l.max ? Math.abs(l.step) : l.step
|
|
73
73
|
},
|
|
74
74
|
data: {
|
|
75
|
-
label:
|
|
76
|
-
points:
|
|
75
|
+
label: e("light_curve.plot.plot_label"),
|
|
76
|
+
points: i
|
|
77
77
|
},
|
|
78
|
-
tooltip: ({ y:
|
|
79
|
-
magnitude:
|
|
78
|
+
tooltip: ({ y: o }) => e("light_curve.plot.tooltip", {
|
|
79
|
+
magnitude: o.toLocaleString(A, {
|
|
80
80
|
minimumFractionDigits: 2,
|
|
81
81
|
maximumFractionDigits: 2
|
|
82
82
|
})
|
|
83
83
|
}),
|
|
84
|
-
plotChildren: ({ xScale:
|
|
85
|
-
/* @__PURE__ */ n(
|
|
86
|
-
"rect",
|
|
87
|
-
{
|
|
88
|
-
x: t(0),
|
|
89
|
-
y: h,
|
|
90
|
-
width: t(15) - t(0),
|
|
91
|
-
height: d - h,
|
|
92
|
-
stroke: "var(--neutral60,##6A6E6E)",
|
|
93
|
-
strokeDasharray: 6,
|
|
94
|
-
fill: "var(--neutral20,#DCE0E3)"
|
|
95
|
-
}
|
|
96
|
-
),
|
|
97
|
-
_,
|
|
98
|
-
f && f({ xScale: t, yStart: d, yEnd: h, Data: _, ...j })
|
|
99
|
-
] })
|
|
84
|
+
plotChildren: ({ xScale: o, yStart: W, yEnd: $, Data: d, ...S }) => h ? h({ xScale: o, yStart: W, yEnd: $, Data: d, ...S }) : d
|
|
100
85
|
}
|
|
101
86
|
),
|
|
102
|
-
g && /* @__PURE__ */
|
|
87
|
+
g && /* @__PURE__ */ c(L, { children: /* @__PURE__ */ c(
|
|
103
88
|
M,
|
|
104
89
|
{
|
|
105
90
|
style: { ...O(b, s, a) },
|
|
@@ -108,8 +93,8 @@ const O = (e, p, c) => {
|
|
|
108
93
|
) })
|
|
109
94
|
] });
|
|
110
95
|
};
|
|
111
|
-
|
|
112
|
-
const
|
|
96
|
+
f.displayName = "Widgets.LightCurve.Plot";
|
|
97
|
+
const G = f;
|
|
113
98
|
export {
|
|
114
|
-
|
|
99
|
+
G as default
|
|
115
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;
|