@rubin-epo/epo-widget-lib 1.0.3 → 1.0.5
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.cjs +1 -1
- package/dist/IsochronePlot.js +88 -85
- package/dist/charts/Points/index.cjs +1 -1
- package/dist/charts/Points/index.js +29 -18
- package/dist/widgets/ColorTool/FilterControls/styles.d.ts +5 -0
- package/dist/widgets/IsochronePlot/Controls/index.cjs +1 -1
- package/dist/widgets/IsochronePlot/Controls/index.d.ts +1 -0
- package/dist/widgets/IsochronePlot/Controls/index.js +28 -26
- package/dist/widgets/IsochronePlot/helpers.cjs +1 -0
- package/dist/widgets/IsochronePlot/helpers.d.ts +2 -0
- package/dist/widgets/IsochronePlot/helpers.js +6 -0
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.js +58 -58
- package/package.json +2 -2
package/dist/IsochronePlot.cjs
CHANGED
|
@@ -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"),L=require("react"),X=require("react-i18next"),Y=require("use-resize-observer"),Z=require("lodash/round"),D=require("@rubin-epo/epo-react-lib/styles"),ee=require("./layout/Controls/index.cjs"),te=require("./charts/ScatterPlot/index.cjs"),se=require("./atomic/Button/patterns/Reset.cjs");require("./atomic/PlotWrapper/index.cjs");const ie=require("./charts/Readout/index.cjs"),re=require("./charts/PathFromPoints/index.cjs"),u=require("./lib/utils.cjs"),ne=require("./widgets/IsochronePlot/Controls/index.cjs"),r=require("./widgets/IsochronePlot/defaults.cjs"),oe=require("./widgets/IsochronePlot/A11Y/CurveFit.cjs"),W=require("./widgets/IsochronePlot/helpers.cjs"),ae=require("./atomic/PlotWrapper/styles.cjs"),I=e=>e&&e.__esModule?e:{default:e},le=I(Y),ue=I(Z),ce=e=>e?e<parseFloat(D.token("BREAK_PHABLET_MIN"))?r.default.pointRadius.md:e<parseFloat(D.token("BREAK_LARGE_TABLET"))?r.default.pointRadius.sm:r.default.pointRadius.lg:r.default.pointRadius.lg,de=({data:e,value:P,ageLibrary:T,isDisplayOnly:k=!1,isLoading:M,xAxis:$,yAxis:z,name:B,onChangeCallback:c})=>{const{ref:E,width:K}=le.default(),{t:d,i18n:{language:h}}=X.useTranslation(),[O,H]=L.useState(!0),q=L.useId(),n=!M&&!O,S={top:0,right:0,bottom:20,left:20},{width:g,height:f}=r.default,{ages:_={}}=T,s=Object.keys(_).sort((i,l)=>parseFloat(i)-parseFloat(l)).map(parseFloat),V=u.mergeWithDefaults($,{...r.default.xAxis,label:d("isochrone_plot.plot.x_label")}),b=u.mergeWithDefaults(z,{...r.default.yAxis,label:d("isochrone_plot.plot.y_label")}),o={age:{min:s.length>0?Math.min(...s):0,max:s.length>0?Math.max(...s):0,step:ue.default(s[1]-s[0],1)||.5,marks:s},distance:{min:0,max:b.min+1,step:.05}},R={age:s.length>0?u.middle(s):0,distance:(o.distance.max-o.distance.min)/2+o.distance.min},{age:a,distance:p}=u.mergeWithDefaults(P,R),w=ce(K),m={age:i=>W.ageToGyrs(i).toLocaleString(h,{minimumFractionDigits:1,maximumFractionDigits:1}),distance:i=>W.distanceToLyrs(i).toLocaleString(h,{maximumFractionDigits:0})},j={age:m.age(a),distance:m.distance(p)},G=t.jsx(ae.PlotWrapper,{ref:E,children:t.jsx(te.default,{renderer:"canvas",title:B,onLoadedCallback:()=>H(!1),data:{label:"Star Cluster",points:e.map(i=>({...i,radius:w,stroke:"rgba(18,114,108,0.5)",fill:"rgba(18,114,108,0.25)"}))},plotChildren:({Data:i,xScale:l,yScale:x,yStart:C,yEnd:v,xStart:y,xEnd:N,yDomain:J})=>{const A=(_[a.toFixed(1)]||[]).map(({x:Q,y:U})=>({x:l(Q),y:x(U)}))||[],F=x(p+J[1]);return t.jsxs(t.Fragment,{children:[i,a&&t.jsx(re.default,{points:A,svgProps:{strokeWidth:2,transform:`translate(0,${F})`}}),n&&t.jsx(ie.default,{viewport:{x:y,y:v,outerHeight:C-v,outerWidth:N-y,innerWidth:g,innerHeight:f},position:"center right",forIds:q,forScreenreaders:t.jsx(oe.default,{points:e,value:j,isochrone:A,offset:F,xScale:l,yScale:x,width:g,height:f}),children:d("isochrone_plot.output",{...j})})]})},width:g,height:f,xAxis:V,yAxis:b,margins:S})});return t.jsx(ee.default,{ratio:{portrait:2/3,landscape:3/2},widget:G,controls:t.jsx(ne.default,{isDisabled:!n,value:{age:a,distance:p},localizers:m,configs:o,onChangeCallback:c}),actions:t.jsx(se.default,{isDisabled:!n,onResetCallback:()=>{c&&c(R)}}),isLoading:!n,isDisplayOnly:k,controlsId:q})};exports.default=de;
|
package/dist/IsochronePlot.js
CHANGED
|
@@ -1,161 +1,164 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
2
|
+
import { jsx as e, jsxs as J, Fragment as Q } from "react/jsx-runtime";
|
|
3
|
+
import { useState as U, useId as X } from "react";
|
|
4
|
+
import { useTranslation as Y } from "react-i18next";
|
|
5
|
+
import Z from "use-resize-observer";
|
|
6
|
+
import tt from "lodash/round";
|
|
7
7
|
import { token as W } from "@rubin-epo/epo-react-lib/styles";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import ot from "./layout/Controls/index.js";
|
|
9
|
+
import et from "./charts/ScatterPlot/index.js";
|
|
10
|
+
import it from "./atomic/Button/patterns/Reset.js";
|
|
11
11
|
import "./atomic/PlotWrapper/index.js";
|
|
12
12
|
import rt from "./charts/Readout/index.js";
|
|
13
|
-
import
|
|
14
|
-
import { mergeWithDefaults as
|
|
15
|
-
import { parsecsToLightyears as nt } from "./lib/helpers.js";
|
|
13
|
+
import st from "./charts/PathFromPoints/index.js";
|
|
14
|
+
import { mergeWithDefaults as h, middle as nt } from "./lib/utils.js";
|
|
16
15
|
import at from "./widgets/IsochronePlot/Controls/index.js";
|
|
17
|
-
import
|
|
16
|
+
import i from "./widgets/IsochronePlot/defaults.js";
|
|
18
17
|
import mt from "./widgets/IsochronePlot/A11Y/CurveFit.js";
|
|
19
|
-
import {
|
|
20
|
-
|
|
18
|
+
import { ageToGyrs as lt, distanceToLyrs as ct } from "./widgets/IsochronePlot/helpers.js";
|
|
19
|
+
import { PlotWrapper as pt } from "./atomic/PlotWrapper/styles.js";
|
|
20
|
+
const dt = (r) => r ? r < parseFloat(W("BREAK_PHABLET_MIN")) ? i.pointRadius.md : r < parseFloat(W("BREAK_LARGE_TABLET")) ? i.pointRadius.sm : i.pointRadius.lg : i.pointRadius.lg, kt = ({
|
|
21
21
|
data: r,
|
|
22
|
-
value:
|
|
23
|
-
ageLibrary:
|
|
22
|
+
value: B,
|
|
23
|
+
ageLibrary: D,
|
|
24
24
|
isDisplayOnly: I = !1,
|
|
25
|
-
isLoading:
|
|
26
|
-
xAxis:
|
|
27
|
-
yAxis:
|
|
28
|
-
name:
|
|
25
|
+
isLoading: T,
|
|
26
|
+
xAxis: k,
|
|
27
|
+
yAxis: E,
|
|
28
|
+
name: K,
|
|
29
29
|
onChangeCallback: l
|
|
30
30
|
}) => {
|
|
31
|
-
const { ref:
|
|
32
|
-
t:
|
|
33
|
-
i18n: { language:
|
|
34
|
-
} =
|
|
35
|
-
(
|
|
36
|
-
).map(parseFloat),
|
|
37
|
-
...
|
|
38
|
-
label:
|
|
39
|
-
}), R =
|
|
40
|
-
...
|
|
41
|
-
label:
|
|
31
|
+
const { ref: j, width: z } = Z(), {
|
|
32
|
+
t: c,
|
|
33
|
+
i18n: { language: x }
|
|
34
|
+
} = Y(), [C, H] = U(!0), b = X(), s = !T && !C, M = { top: 0, right: 0, bottom: 20, left: 20 }, { width: p, height: d } = i, { ages: F = {} } = D, t = Object.keys(F).sort(
|
|
35
|
+
(o, m) => parseFloat(o) - parseFloat(m)
|
|
36
|
+
).map(parseFloat), V = h(k, {
|
|
37
|
+
...i.xAxis,
|
|
38
|
+
label: c("isochrone_plot.plot.x_label")
|
|
39
|
+
}), R = h(E, {
|
|
40
|
+
...i.yAxis,
|
|
41
|
+
label: c("isochrone_plot.plot.y_label")
|
|
42
42
|
}), n = {
|
|
43
43
|
age: {
|
|
44
44
|
min: t.length > 0 ? Math.min(...t) : 0,
|
|
45
45
|
max: t.length > 0 ? Math.max(...t) : 0,
|
|
46
|
-
step:
|
|
46
|
+
step: tt(t[1] - t[0], 1) || 0.5,
|
|
47
47
|
marks: t
|
|
48
48
|
},
|
|
49
49
|
distance: { min: 0, max: R.min + 1, step: 0.05 }
|
|
50
50
|
}, A = {
|
|
51
|
-
age: t.length > 0 ?
|
|
51
|
+
age: t.length > 0 ? nt(t) : 0,
|
|
52
52
|
distance: (n.distance.max - n.distance.min) / 2 + n.distance.min
|
|
53
|
-
}, { age: a, distance: u } =
|
|
54
|
-
|
|
53
|
+
}, { age: a, distance: u } = h(
|
|
54
|
+
B,
|
|
55
55
|
A
|
|
56
|
-
),
|
|
57
|
-
age:
|
|
58
|
-
minimumFractionDigits: 1
|
|
56
|
+
), w = dt(z), g = {
|
|
57
|
+
age: (o) => lt(o).toLocaleString(x, {
|
|
58
|
+
minimumFractionDigits: 1,
|
|
59
|
+
maximumFractionDigits: 1
|
|
59
60
|
}),
|
|
60
|
-
distance:
|
|
61
|
-
Math.pow(10, u / 5 + 1)
|
|
62
|
-
).toLocaleString(h, {
|
|
61
|
+
distance: (o) => ct(o).toLocaleString(x, {
|
|
63
62
|
maximumFractionDigits: 0
|
|
64
63
|
})
|
|
65
|
-
},
|
|
66
|
-
|
|
64
|
+
}, L = {
|
|
65
|
+
age: g.age(a),
|
|
66
|
+
distance: g.distance(u)
|
|
67
|
+
}, G = /* @__PURE__ */ e(pt, { ref: j, children: /* @__PURE__ */ e(
|
|
68
|
+
et,
|
|
67
69
|
{
|
|
68
70
|
renderer: "canvas",
|
|
69
|
-
title:
|
|
70
|
-
onLoadedCallback: () =>
|
|
71
|
+
title: K,
|
|
72
|
+
onLoadedCallback: () => H(!1),
|
|
71
73
|
data: {
|
|
72
74
|
label: "Star Cluster",
|
|
73
|
-
points: r.map((
|
|
74
|
-
...
|
|
75
|
-
radius:
|
|
75
|
+
points: r.map((o) => ({
|
|
76
|
+
...o,
|
|
77
|
+
radius: w,
|
|
76
78
|
stroke: "rgba(18,114,108,0.5)",
|
|
77
79
|
fill: "rgba(18,114,108,0.25)"
|
|
78
80
|
}))
|
|
79
81
|
},
|
|
80
82
|
plotChildren: ({
|
|
81
|
-
Data:
|
|
83
|
+
Data: o,
|
|
82
84
|
xScale: m,
|
|
83
|
-
yScale:
|
|
85
|
+
yScale: f,
|
|
84
86
|
yStart: O,
|
|
85
|
-
yEnd:
|
|
86
|
-
xStart:
|
|
87
|
+
yEnd: P,
|
|
88
|
+
xStart: _,
|
|
87
89
|
xEnd: S,
|
|
88
|
-
yDomain:
|
|
90
|
+
yDomain: N
|
|
89
91
|
}) => {
|
|
90
|
-
const
|
|
91
|
-
return /* @__PURE__ */
|
|
92
|
-
|
|
93
|
-
a && /* @__PURE__ */
|
|
94
|
-
|
|
92
|
+
const v = (F[a.toFixed(1)] || []).map(({ x: $, y: q }) => ({ x: m($), y: f(q) })) || [], y = f(u + N[1]);
|
|
93
|
+
return /* @__PURE__ */ J(Q, { children: [
|
|
94
|
+
o,
|
|
95
|
+
a && /* @__PURE__ */ e(
|
|
96
|
+
st,
|
|
95
97
|
{
|
|
96
|
-
points:
|
|
98
|
+
points: v,
|
|
97
99
|
svgProps: {
|
|
98
100
|
strokeWidth: 2,
|
|
99
|
-
transform: `translate(0,${
|
|
101
|
+
transform: `translate(0,${y})`
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
),
|
|
103
|
-
s && /* @__PURE__ */
|
|
105
|
+
s && /* @__PURE__ */ e(
|
|
104
106
|
rt,
|
|
105
107
|
{
|
|
106
108
|
viewport: {
|
|
107
|
-
x:
|
|
108
|
-
y:
|
|
109
|
-
outerHeight: O -
|
|
110
|
-
outerWidth: S -
|
|
111
|
-
innerWidth:
|
|
109
|
+
x: _,
|
|
110
|
+
y: P,
|
|
111
|
+
outerHeight: O - P,
|
|
112
|
+
outerWidth: S - _,
|
|
113
|
+
innerWidth: p,
|
|
112
114
|
innerHeight: d
|
|
113
115
|
},
|
|
114
116
|
position: "center right",
|
|
115
|
-
forIds:
|
|
116
|
-
forScreenreaders: /* @__PURE__ */
|
|
117
|
+
forIds: b,
|
|
118
|
+
forScreenreaders: /* @__PURE__ */ e(
|
|
117
119
|
mt,
|
|
118
120
|
{
|
|
119
121
|
points: r,
|
|
120
|
-
value:
|
|
121
|
-
isochrone:
|
|
122
|
-
offset:
|
|
122
|
+
value: L,
|
|
123
|
+
isochrone: v,
|
|
124
|
+
offset: y,
|
|
123
125
|
xScale: m,
|
|
124
|
-
yScale:
|
|
125
|
-
width:
|
|
126
|
+
yScale: f,
|
|
127
|
+
width: p,
|
|
126
128
|
height: d
|
|
127
129
|
}
|
|
128
130
|
),
|
|
129
|
-
children:
|
|
130
|
-
...
|
|
131
|
+
children: c("isochrone_plot.output", {
|
|
132
|
+
...L
|
|
131
133
|
})
|
|
132
134
|
}
|
|
133
135
|
)
|
|
134
136
|
] });
|
|
135
137
|
},
|
|
136
|
-
width:
|
|
138
|
+
width: p,
|
|
137
139
|
height: d,
|
|
138
|
-
xAxis:
|
|
140
|
+
xAxis: V,
|
|
139
141
|
yAxis: R,
|
|
140
|
-
margins:
|
|
142
|
+
margins: M
|
|
141
143
|
}
|
|
142
144
|
) });
|
|
143
|
-
return /* @__PURE__ */
|
|
144
|
-
|
|
145
|
+
return /* @__PURE__ */ e(
|
|
146
|
+
ot,
|
|
145
147
|
{
|
|
146
148
|
ratio: { portrait: 2 / 3, landscape: 3 / 2 },
|
|
147
|
-
widget:
|
|
148
|
-
controls: /* @__PURE__ */
|
|
149
|
+
widget: G,
|
|
150
|
+
controls: /* @__PURE__ */ e(
|
|
149
151
|
at,
|
|
150
152
|
{
|
|
151
153
|
isDisabled: !s,
|
|
152
154
|
value: { age: a, distance: u },
|
|
155
|
+
localizers: g,
|
|
153
156
|
configs: n,
|
|
154
157
|
onChangeCallback: l
|
|
155
158
|
}
|
|
156
159
|
),
|
|
157
|
-
actions: /* @__PURE__ */
|
|
158
|
-
|
|
160
|
+
actions: /* @__PURE__ */ e(
|
|
161
|
+
it,
|
|
159
162
|
{
|
|
160
163
|
isDisabled: !s,
|
|
161
164
|
onResetCallback: () => {
|
|
@@ -165,7 +168,7 @@ const pt = (r) => r ? r < parseFloat(W("BREAK_PHABLET_MIN")) ? e.pointRadius.md
|
|
|
165
168
|
),
|
|
166
169
|
isLoading: !s,
|
|
167
170
|
isDisplayOnly: I,
|
|
168
|
-
controlsId:
|
|
171
|
+
controlsId: b
|
|
169
172
|
}
|
|
170
173
|
);
|
|
171
174
|
};
|
|
@@ -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"),$=require("./ErrorBar.cjs"),y=require("../defaults.cjs"),l=({data:r,label:a,xScale:t,yScale:s,onHoverCallback:i,onHoverOutCallback:n,onLoadedCallback:o,className:c})=>(E.useEffect(()=>{o&&o()},[]),r.length===0?null:e.jsx("g",{role:"list","aria-label":a,className:c,children:r.map((d,f)=>{const{stroke:p,fill:j,radius:m,x,y:g,description:h,error:u,id:q,index:M,props:P}={...y.default.point,...d};return e.jsxs("g",{role:"listitem","aria-label":h,transform:`translate(${t(x)},${s(g)})`,onMouseEnter:()=>i&&i(f),onMouseLeave:()=>n&&n(),children:[u&&e.jsx($.default,{error:u,xScale:t,yScale:s}),e.jsx("circle",{cursor:"pointer",r:m,stroke:p,fill:j,...P})]},q||M)})}));l.displayName="Charts.Points";const _=l;exports.default=_;
|
|
@@ -1,34 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { jsx as r, jsxs as M } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect as y } from "react";
|
|
4
|
+
import B from "./ErrorBar.js";
|
|
5
|
+
import N from "../defaults.js";
|
|
6
6
|
const m = ({
|
|
7
7
|
data: t,
|
|
8
8
|
label: p,
|
|
9
|
-
xScale:
|
|
10
|
-
yScale:
|
|
11
|
-
onHoverCallback:
|
|
9
|
+
xScale: e,
|
|
10
|
+
yScale: i,
|
|
11
|
+
onHoverCallback: s,
|
|
12
12
|
onHoverOutCallback: o,
|
|
13
13
|
onLoadedCallback: n,
|
|
14
14
|
className: f
|
|
15
|
-
}) => (
|
|
15
|
+
}) => (y(() => {
|
|
16
16
|
n && n();
|
|
17
17
|
}, []), t.length === 0 ? null : /* @__PURE__ */ r("g", { role: "list", "aria-label": p, className: f, children: t.map((u, a) => {
|
|
18
|
-
const {
|
|
19
|
-
|
|
18
|
+
const {
|
|
19
|
+
stroke: c,
|
|
20
|
+
fill: d,
|
|
21
|
+
radius: h,
|
|
22
|
+
x,
|
|
23
|
+
y: g,
|
|
24
|
+
description: E,
|
|
25
|
+
error: l,
|
|
26
|
+
id: P,
|
|
27
|
+
index: $,
|
|
28
|
+
props: j
|
|
29
|
+
} = {
|
|
30
|
+
...N.point,
|
|
20
31
|
...u
|
|
21
32
|
};
|
|
22
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ M(
|
|
23
34
|
"g",
|
|
24
35
|
{
|
|
25
36
|
role: "listitem",
|
|
26
37
|
"aria-label": E,
|
|
27
|
-
transform: `translate(${
|
|
28
|
-
onMouseEnter: () =>
|
|
38
|
+
transform: `translate(${e(x)},${i(g)})`,
|
|
39
|
+
onMouseEnter: () => s && s(a),
|
|
29
40
|
onMouseLeave: () => o && o(),
|
|
30
41
|
children: [
|
|
31
|
-
l && /* @__PURE__ */ r(
|
|
42
|
+
l && /* @__PURE__ */ r(B, { error: l, xScale: e, yScale: i }),
|
|
32
43
|
/* @__PURE__ */ r(
|
|
33
44
|
"circle",
|
|
34
45
|
{
|
|
@@ -36,16 +47,16 @@ const m = ({
|
|
|
36
47
|
r: h,
|
|
37
48
|
stroke: c,
|
|
38
49
|
fill: d,
|
|
39
|
-
|
|
50
|
+
...j
|
|
40
51
|
}
|
|
41
52
|
)
|
|
42
53
|
]
|
|
43
54
|
},
|
|
44
|
-
P
|
|
55
|
+
P || $
|
|
45
56
|
);
|
|
46
57
|
}) }));
|
|
47
58
|
m.displayName = "Charts.Points";
|
|
48
|
-
const
|
|
59
|
+
const D = m;
|
|
49
60
|
export {
|
|
50
|
-
|
|
61
|
+
D as default
|
|
51
62
|
};
|
|
@@ -1238,6 +1238,11 @@ export declare const Slider: import('styled-components').IStyledComponent<"web",
|
|
|
1238
1238
|
color?: string | undefined;
|
|
1239
1239
|
darkMode?: boolean | undefined;
|
|
1240
1240
|
isDisabled?: boolean | undefined;
|
|
1241
|
+
renderLabel?: ((state: {
|
|
1242
|
+
index: number;
|
|
1243
|
+
value: number | readonly number[];
|
|
1244
|
+
valueNow: number;
|
|
1245
|
+
}) => import('react').ReactNode) | undefined;
|
|
1241
1246
|
className?: string | undefined;
|
|
1242
1247
|
defaultValue?: number | readonly number[] | undefined;
|
|
1243
1248
|
value?: number | readonly number[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),_=require("@rubin-epo/epo-react-lib/HorizontalSlider"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),_=require("@rubin-epo/epo-react-lib/HorizontalSlider"),p=require("../../../atomic/ControlLabel/index.cjs"),x=require("react-i18next"),f=t=>t&&t.__esModule?t:{default:t},h=f(_),u=({value:t,onChangeCallback:n,configs:s,localizers:i,isDisabled:c=!1})=>{const{t:a}=x.useTranslation(),d=(e,l)=>{n&&n({...t,[e]:l})},b={isDisabled:c,color:"var(--turquoise85, #12726D)"};return o.jsx(o.Fragment,{children:Object.keys(s).map(e=>o.jsx(p.default,{label:a(`isochrone_plot.controls.${e}.label`),input:l=>o.jsx(h.default,{labelledbyId:l,value:t[e],ariaValuetext:a(`isochrone_plot.controls.${e}.textValue`,{value:t[e]})||void 0,renderLabel:({valueNow:r})=>i[e](r),onChangeCallback:r=>d(e,r),...b,...s[e]}),labelBy:!0},e))})};u.displayName="Widgets.IsochronePlot.Controls";const j=u;exports.default=j;
|
|
@@ -10,6 +10,7 @@ interface Config {
|
|
|
10
10
|
type Props = {
|
|
11
11
|
value: Required<IsochroneValue>;
|
|
12
12
|
configs: Record<keyof IsochroneValue, Config>;
|
|
13
|
+
localizers: Record<keyof IsochroneValue, (value: number) => string>;
|
|
13
14
|
onChangeCallback?: (value: IsochroneValue) => void;
|
|
14
15
|
isDisabled?: boolean;
|
|
15
16
|
};
|
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
const
|
|
7
|
-
value:
|
|
8
|
-
onChangeCallback:
|
|
9
|
-
configs:
|
|
10
|
-
|
|
2
|
+
import { jsx as e, Fragment as u } from "react/jsx-runtime";
|
|
3
|
+
import b from "@rubin-epo/epo-react-lib/HorizontalSlider";
|
|
4
|
+
import h from "../../../atomic/ControlLabel/index.js";
|
|
5
|
+
import { useTranslation as f } from "react-i18next";
|
|
6
|
+
const i = ({
|
|
7
|
+
value: r,
|
|
8
|
+
onChangeCallback: n,
|
|
9
|
+
configs: a,
|
|
10
|
+
localizers: c,
|
|
11
|
+
isDisabled: d = !1
|
|
11
12
|
}) => {
|
|
12
|
-
const { t: s } =
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
isDisabled:
|
|
13
|
+
const { t: s } = f(), m = (o, t) => {
|
|
14
|
+
n && n({ ...r, [o]: t });
|
|
15
|
+
}, p = {
|
|
16
|
+
isDisabled: d,
|
|
16
17
|
color: "var(--turquoise85, #12726D)"
|
|
17
18
|
};
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
19
|
+
return /* @__PURE__ */ e(u, { children: Object.keys(a).map((o) => /* @__PURE__ */ e(
|
|
20
|
+
h,
|
|
20
21
|
{
|
|
21
22
|
label: s(`isochrone_plot.controls.${o}.label`),
|
|
22
|
-
input: (
|
|
23
|
-
|
|
23
|
+
input: (t) => /* @__PURE__ */ e(
|
|
24
|
+
b,
|
|
24
25
|
{
|
|
25
|
-
labelledbyId:
|
|
26
|
-
value:
|
|
26
|
+
labelledbyId: t,
|
|
27
|
+
value: r[o],
|
|
27
28
|
ariaValuetext: s(`isochrone_plot.controls.${o}.textValue`, {
|
|
28
|
-
value:
|
|
29
|
+
value: r[o]
|
|
29
30
|
}) || void 0,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...
|
|
31
|
+
renderLabel: ({ valueNow: l }) => c[o](l),
|
|
32
|
+
onChangeCallback: (l) => m(o, l),
|
|
33
|
+
...p,
|
|
34
|
+
...a[o]
|
|
33
35
|
}
|
|
34
36
|
),
|
|
35
37
|
labelBy: !0
|
|
@@ -37,8 +39,8 @@ const a = ({
|
|
|
37
39
|
o
|
|
38
40
|
)) });
|
|
39
41
|
};
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
+
i.displayName = "Widgets.IsochronePlot.Controls";
|
|
43
|
+
const j = i;
|
|
42
44
|
export {
|
|
43
|
-
|
|
45
|
+
j as default
|
|
44
46
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../lib/helpers.cjs"),o=e=>Math.pow(10,e-9),t=e=>s.parsecsToLightyears(Math.pow(10,e/5+1));exports.ageToGyrs=o;exports.distanceToLyrs=t;
|
|
@@ -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"),T=require("react"),E=require("react-i18next"),N=require("d3-array"),J=require("@rubin-epo/epo-react-lib/HorizontalSlider"),t=require("../defaults.cjs"),K=require("../Plot/index.cjs"),O=require("./A11Y/LightCurveLabel/index.cjs"),c=require("../helpers.cjs"),Q=require("../../../atomic/Button/patterns/Reset.cjs"),S=require("./MagnitudeSlider/index.cjs"),V=require("./styles.cjs"),X=require("../../../charts/Viewport/index.cjs"),Z=require("../../../layout/Controls/index.cjs"),b=require("../../../atomic/ControlLabel/index.cjs"),k=require("../../../charts/PathFromPoints/index.cjs"),G=require("../../../lib/utils.cjs"),U=r=>r&&r.__esModule?r:{default:r},$=U(J),D=({gaussianWidth:r=t.default.gaussianWidth,yOffset:n=t.default.yOffset,alerts:A,peakMjd:I,yMin:f,yMax:x,width:m=t.default.width,height:p=t.default.height,userMagnitude:P,onUserMagnitudeChangeCallback:l,onGaussianChangeCallback:o,onYOffsetChangeCallback:d,className:W,isDisplayOnly:q,...F})=>{const{t:j}=E.useTranslation(),u=G.mergeWithDefaults({min:f,max:x},t.default.yAxis),g=(u.max-u.min)/2+u.min,h=c.useAlertsAsPoints(A,I),H=T.useId(),L=()=>{l&&l(g),d&&d(t.default.yOffset),o&&o(t.default.gaussianWidth)},v=c.estimateMagnitudeWithOffset(0,r,n),R=e.jsx(K.default,{slider:e.jsx(S.default,{magnitude:P||g,onMagnitudeChangeCallback:s=>l&&l(s),disabled:q,yMin:u.min-u.step/2,yMax:u.max+u.step/2,estimatedPeak:v}),plotChildren:({xScale:s,yScale:i,yDomain:w,xStart:y,xEnd:B,yStart:_,yEnd:a,Data:z})=>e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:s(0),y:a,width:s(15)-s(0),height:_-a,stroke:"var(--neutral60,##6A6E6E)",strokeDasharray:6,fill:"var(--neutral20,#DCE0E3)"}),z,e.jsx(k.default,{points:N.range(-10,40,.5).map(M=>({x:s(M),y:i(c.estimateMagnitude(M,r))})),svgProps:{transform:`translate(0,${i(w[1]-n)})`,strokeLinecap:"round"}}),e.jsx(X.default,{x:y,y:a,outerHeight:_-a,outerWidth:B-y,innerWidth:m,innerHeight:p,children:e.jsx(V.DM15Display,{gaussianWidth:r})})]}),...F,data:h,width:m,height:p,yMin:f,yMax:x});return e.jsx(e.Fragment,{children:e.jsx(Z.default,{className:W,isDisplayOnly:q,ratio:{landscape:3/2,portrait:2/3},widget:R,controls:e.jsxs(e.Fragment,{children:[e.jsx(b.default,{label:j("light_curve.curve.controls.gaussian_width"),input:s=>e.jsx($.default,{labelledbyId:s,color:"var(--turquoise85, #12726D)",min:t.default.gaussianMin,max:t.default.gaussianMax,step:t.default.gaussianStep,value:r,onChangeCallback:i=>typeof i=="number"&&o&&o(i)}),labelBy:!0}),e.jsx(b.default,{label:j("light_curve.curve.controls.y_offset"),input:s=>e.jsx($.default,{labelledbyId:s,color:"var(--turquoise85, #12726D)",min:t.default.yOffsetMin,max:t.default.yOffsetMax,step:t.default.yOffsetStep,value:n,onChangeCallback:i=>typeof i=="number"&&d&&d(i)}),labelBy:!0}),e.jsx(O.default,{controlledById:H,data:h,gaussianWidth:r,yOffset:n,estimatedPeak:v})]}),actions:e.jsx(Q.default,{onResetCallback:L})})})};D.displayName="Widgets.LightCurve";const Y=D;exports.default=Y;
|
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as t, jsxs as
|
|
3
|
-
import { useId as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { range as
|
|
2
|
+
import { jsx as t, jsxs as W, Fragment as a } from "react/jsx-runtime";
|
|
3
|
+
import { useId as N } from "react";
|
|
4
|
+
import { useTranslation as T } from "react-i18next";
|
|
5
|
+
import { range as V } from "d3-array";
|
|
6
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
|
|
8
|
+
import J from "../Plot/index.js";
|
|
9
|
+
import K from "./A11Y/LightCurveLabel/index.js";
|
|
10
|
+
import { useAlertsAsPoints as Q, estimateMagnitudeWithOffset as X, estimateMagnitude as Z } from "../helpers.js";
|
|
11
11
|
import k from "../../../atomic/Button/patterns/Reset.js";
|
|
12
|
-
import
|
|
13
|
-
import { DM15Display as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { mergeWithDefaults as
|
|
19
|
-
const
|
|
12
|
+
import O from "./MagnitudeSlider/index.js";
|
|
13
|
+
import { DM15Display as S } from "./styles.js";
|
|
14
|
+
import C from "../../../charts/Viewport/index.js";
|
|
15
|
+
import G from "../../../layout/Controls/index.js";
|
|
16
|
+
import A from "../../../atomic/ControlLabel/index.js";
|
|
17
|
+
import U from "../../../charts/PathFromPoints/index.js";
|
|
18
|
+
import { mergeWithDefaults as Y } from "../../../lib/utils.js";
|
|
19
|
+
const I = ({
|
|
20
20
|
gaussianWidth: m = r.gaussianWidth,
|
|
21
21
|
yOffset: s = r.yOffset,
|
|
22
|
-
alerts:
|
|
23
|
-
peakMjd:
|
|
22
|
+
alerts: w,
|
|
23
|
+
peakMjd: B,
|
|
24
24
|
yMin: d,
|
|
25
25
|
yMax: f,
|
|
26
26
|
width: c = r.width,
|
|
27
27
|
height: h = r.height,
|
|
28
|
-
userMagnitude:
|
|
28
|
+
userMagnitude: _,
|
|
29
29
|
onUserMagnitudeChangeCallback: n,
|
|
30
30
|
onGaussianChangeCallback: l,
|
|
31
31
|
onYOffsetChangeCallback: p,
|
|
32
|
-
className:
|
|
32
|
+
className: F,
|
|
33
33
|
isDisplayOnly: g,
|
|
34
|
-
...
|
|
34
|
+
...H
|
|
35
35
|
}) => {
|
|
36
|
-
const { t: v } =
|
|
36
|
+
const { t: v } = T(), i = Y(
|
|
37
37
|
{ min: d, max: f },
|
|
38
38
|
r.yAxis
|
|
39
|
-
), y = (i.max - i.min) / 2 + i.min, x =
|
|
39
|
+
), y = (i.max - i.min) / 2 + i.min, x = Q(w, B), R = N(), j = () => {
|
|
40
40
|
n && n(y), p && p(r.yOffset), l && l(r.gaussianWidth);
|
|
41
|
-
}, b =
|
|
42
|
-
|
|
41
|
+
}, b = X(0, m, s), q = /* @__PURE__ */ t(
|
|
42
|
+
J,
|
|
43
43
|
{
|
|
44
44
|
slider: /* @__PURE__ */ t(
|
|
45
|
-
|
|
45
|
+
O,
|
|
46
46
|
{
|
|
47
|
-
magnitude:
|
|
47
|
+
magnitude: _ || y,
|
|
48
48
|
onMagnitudeChangeCallback: (o) => n && n(o),
|
|
49
49
|
disabled: g,
|
|
50
50
|
yMin: i.min - i.step / 2,
|
|
@@ -55,53 +55,53 @@ const w = ({
|
|
|
55
55
|
plotChildren: ({
|
|
56
56
|
xScale: o,
|
|
57
57
|
yScale: e,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
yStart: W,
|
|
58
|
+
yDomain: $,
|
|
59
|
+
xStart: P,
|
|
60
|
+
xEnd: z,
|
|
61
|
+
yStart: L,
|
|
63
62
|
yEnd: u,
|
|
64
|
-
Data:
|
|
65
|
-
}) => /* @__PURE__ */
|
|
63
|
+
Data: E
|
|
64
|
+
}) => /* @__PURE__ */ W(a, { children: [
|
|
66
65
|
/* @__PURE__ */ t(
|
|
67
66
|
"rect",
|
|
68
67
|
{
|
|
69
68
|
x: o(0),
|
|
70
69
|
y: u,
|
|
71
70
|
width: o(15) - o(0),
|
|
72
|
-
height:
|
|
71
|
+
height: L - u,
|
|
73
72
|
stroke: "var(--neutral60,##6A6E6E)",
|
|
74
73
|
strokeDasharray: 6,
|
|
75
74
|
fill: "var(--neutral20,#DCE0E3)"
|
|
76
75
|
}
|
|
77
76
|
),
|
|
78
|
-
|
|
77
|
+
E,
|
|
79
78
|
/* @__PURE__ */ t(
|
|
80
|
-
|
|
79
|
+
U,
|
|
81
80
|
{
|
|
82
|
-
points:
|
|
83
|
-
x: o(
|
|
84
|
-
y: e(
|
|
81
|
+
points: V(-10, 40, 0.5).map((M) => ({
|
|
82
|
+
x: o(M),
|
|
83
|
+
y: e(Z(M, m))
|
|
85
84
|
})),
|
|
86
85
|
svgProps: {
|
|
87
|
-
transform: `translate(0,${e(
|
|
86
|
+
transform: `translate(0,${e($[1] - s)})`,
|
|
87
|
+
strokeLinecap: "round"
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
),
|
|
91
91
|
/* @__PURE__ */ t(
|
|
92
|
-
|
|
92
|
+
C,
|
|
93
93
|
{
|
|
94
|
-
x:
|
|
94
|
+
x: P,
|
|
95
95
|
y: u,
|
|
96
|
-
outerHeight:
|
|
97
|
-
outerWidth:
|
|
96
|
+
outerHeight: L - u,
|
|
97
|
+
outerWidth: z - P,
|
|
98
98
|
innerWidth: c,
|
|
99
99
|
innerHeight: h,
|
|
100
|
-
children: /* @__PURE__ */ t(
|
|
100
|
+
children: /* @__PURE__ */ t(S, { gaussianWidth: m })
|
|
101
101
|
}
|
|
102
102
|
)
|
|
103
103
|
] }),
|
|
104
|
-
...
|
|
104
|
+
...H,
|
|
105
105
|
data: x,
|
|
106
106
|
width: c,
|
|
107
107
|
height: h,
|
|
@@ -110,15 +110,15 @@ const w = ({
|
|
|
110
110
|
}
|
|
111
111
|
);
|
|
112
112
|
return /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(
|
|
113
|
-
|
|
113
|
+
G,
|
|
114
114
|
{
|
|
115
|
-
className:
|
|
115
|
+
className: F,
|
|
116
116
|
isDisplayOnly: g,
|
|
117
117
|
ratio: { landscape: 3 / 2, portrait: 2 / 3 },
|
|
118
|
-
widget:
|
|
119
|
-
controls: /* @__PURE__ */
|
|
118
|
+
widget: q,
|
|
119
|
+
controls: /* @__PURE__ */ W(a, { children: [
|
|
120
120
|
/* @__PURE__ */ t(
|
|
121
|
-
|
|
121
|
+
A,
|
|
122
122
|
{
|
|
123
123
|
label: v("light_curve.curve.controls.gaussian_width"),
|
|
124
124
|
input: (o) => /* @__PURE__ */ t(
|
|
@@ -137,7 +137,7 @@ const w = ({
|
|
|
137
137
|
}
|
|
138
138
|
),
|
|
139
139
|
/* @__PURE__ */ t(
|
|
140
|
-
|
|
140
|
+
A,
|
|
141
141
|
{
|
|
142
142
|
label: v("light_curve.curve.controls.y_offset"),
|
|
143
143
|
input: (o) => /* @__PURE__ */ t(
|
|
@@ -156,9 +156,9 @@ const w = ({
|
|
|
156
156
|
}
|
|
157
157
|
),
|
|
158
158
|
/* @__PURE__ */ t(
|
|
159
|
-
|
|
159
|
+
K,
|
|
160
160
|
{
|
|
161
|
-
controlledById:
|
|
161
|
+
controlledById: R,
|
|
162
162
|
data: x,
|
|
163
163
|
gaussianWidth: m,
|
|
164
164
|
yOffset: s,
|
|
@@ -166,12 +166,12 @@ const w = ({
|
|
|
166
166
|
}
|
|
167
167
|
)
|
|
168
168
|
] }),
|
|
169
|
-
actions: /* @__PURE__ */ t(k, { onResetCallback:
|
|
169
|
+
actions: /* @__PURE__ */ t(k, { onResetCallback: j })
|
|
170
170
|
}
|
|
171
171
|
) });
|
|
172
172
|
};
|
|
173
|
-
|
|
174
|
-
const
|
|
173
|
+
I.displayName = "Widgets.LightCurve";
|
|
174
|
+
const vt = I;
|
|
175
175
|
export {
|
|
176
|
-
|
|
176
|
+
vt as default
|
|
177
177
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rubin-epo/epo-widget-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
|
|
5
5
|
"author": "Rubin EPO",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-i18next": "^12.0.0 || ^13.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@rubin-epo/epo-react-lib": "
|
|
41
|
+
"@rubin-epo/epo-react-lib": "2.1.0",
|
|
42
42
|
"context-filter-polyfill": "^0.3.6",
|
|
43
43
|
"d3-array": "^3.2.4",
|
|
44
44
|
"d3-geo": "^3.1.0",
|