@rubin-epo/epo-widget-lib 0.10.3 → 0.10.4
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/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 +1 -1
- package/dist/widgets/LightCurvePlot/Plot/index.cjs +1 -1
- package/dist/widgets/LightCurvePlot/Plot/index.js +20 -21
- 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/package.json +1 -1
|
@@ -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 m=require("../../lib/utils.cjs"),a=require("d3-array"),b={linear:m.getLinearScale},d=(n,e,t)=>n>e?-Math.abs(t):Math.abs(t),M=(n,e)=>n.map((t,r)=>r===0?t-e:t+e),h=({min:n,max:e,step:t,ticks:r=5,range:o,scale:u="linear",scaleOptions:i})=>{const c=(typeof t=="number"?Math.floor(Math.abs((e-n)/t)):void 0)||r,l=(typeof t=="number"?d(n,e,t):a.tickStep(n,e,r))/2,s=M([n,e],l);return[s,a.ticks(n,e,c),b[u](s,o,i)]};exports.default=h;
|
|
@@ -14,5 +14,5 @@ type Axis = [Domain, Array<number>, ScaleFunction];
|
|
|
14
14
|
* Creates an axis with ticks defined by a min, max, and desired step or number of ticks.
|
|
15
15
|
* @returns [domain, ticks, scale]
|
|
16
16
|
*/
|
|
17
|
-
declare const useAxis: ({ min: start, max: stop, step: configStep, ticks: configTicks, range
|
|
17
|
+
declare const useAxis: ({ min: start, max: stop, step: configStep, ticks: configTicks, range, scale, scaleOptions, }: UseAxisProps) => Axis;
|
|
18
18
|
export default useAxis;
|
|
@@ -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 {};
|
|
@@ -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 s=require("react/jsx-runtime"),M=require("react-i18next"),y=require("d3-array"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),M=require("react-i18next"),y=require("d3-array"),C=require("../../../charts/ScatterPlot/index.cjs");require("../../../atomic/PlotWrapper/index.cjs");const x=require("../../../lib/utils.cjs"),u=require("../defaults.cjs"),v=require("./styles.cjs"),E=require("../../../atomic/PlotWrapper/styles.cjs"),F=(l,c,p)=>{const o={};return Object.keys(l).forEach(e=>{const a=e==="top"||e==="bottom"?p:c,n=`${e.charAt(0).toUpperCase()}${e.slice(1)}`;o[`padding${n}`]=`${l[e]/a*100}%`}),o},A=({data:l,activeAlertId:c,xMin:p,xMax:o,yMin:d,yMax:e,width:a=u.default.width,height:n=u.default.height,name:j,slider:g,className:q,plotChildren:h})=>{const{t:i,i18n:{language:W}}=M.useTranslation(),D=x.mergeWithDefaults({min:y.min(l,({x:t})=>t),max:y.max(l,({x:t})=>t)},u.default.xAxis),P=x.mergeWithDefaults({min:p,max:o,label:i("light_curve.plot.x_label")},{...D,label:i("isochrone_plot.plot.x_label")}),r=x.mergeWithDefaults({min:d,max:e,label:i("light_curve.plot.y_label")},{...u.default.yAxis,label:i("isochrone_plot.plot.y_label")}),b={top:10,right:10,bottom:25,left:40};return s.jsxs(E.PlotWrapper,{className:q,children:[s.jsx(C.default,{width:a,height:n,margins:b,activePointId:c,title:j,xAxis:{...P},yAxis:{...r,step:r.min<r.max?Math.abs(r.step):r.step},data:{label:i("light_curve.plot.plot_label"),points:l},tooltip:({y:t})=>i("light_curve.plot.tooltip",{magnitude:t.toLocaleString(W,{minimumFractionDigits:2,maximumFractionDigits:2})}),plotChildren:({xScale:t,yStart:f,yEnd:m,Data:_,...$})=>s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:t(0),y:m,width:t(15)-t(0),height:f-m,stroke:"var(--neutral60,##6A6E6E)",strokeDasharray:6,fill:"var(--neutral20,#DCE0E3)"}),_,h&&h({xScale:t,yStart:f,yEnd:m,Data:_,...$})]})}),g&&s.jsx(v.SliderOuterWrapper,{children:s.jsx(v.SliderInnerWrapper,{style:{...F(b,a,n)},children:g})})]})};A.displayName="Widgets.LightCurve.Plot";const I=A;exports.default=I;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as A, jsx as n, Fragment as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { min as
|
|
2
|
+
import { jsxs as A, jsx as n, Fragment as C } from "react/jsx-runtime";
|
|
3
|
+
import { useTranslation as E } from "react-i18next";
|
|
4
|
+
import { min as F, max as k } from "d3-array";
|
|
5
5
|
import I from "../../../charts/ScatterPlot/index.js";
|
|
6
6
|
import "../../../atomic/PlotWrapper/index.js";
|
|
7
7
|
import { mergeWithDefaults as u } from "../../../lib/utils.js";
|
|
8
8
|
import m 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 = (
|
|
11
|
+
const O = (e, p, c) => {
|
|
12
12
|
const l = {};
|
|
13
|
-
return Object.keys(
|
|
13
|
+
return Object.keys(e).forEach((o) => {
|
|
14
14
|
const s = o === "top" || o === "bottom" ? c : p, a = `${o.charAt(0).toUpperCase()}${o.slice(1)}`;
|
|
15
|
-
l[`padding${a}`] = `${
|
|
15
|
+
l[`padding${a}`] = `${e[o] / s * 100}%`;
|
|
16
16
|
}), l;
|
|
17
17
|
}, v = ({
|
|
18
|
-
data:
|
|
18
|
+
data: e,
|
|
19
19
|
activeAlertId: p,
|
|
20
20
|
xMin: c,
|
|
21
21
|
xMax: l,
|
|
@@ -29,25 +29,25 @@ const O = (i, p, c) => {
|
|
|
29
29
|
plotChildren: f
|
|
30
30
|
}) => {
|
|
31
31
|
const {
|
|
32
|
-
t:
|
|
32
|
+
t: i,
|
|
33
33
|
i18n: { language: W }
|
|
34
|
-
} =
|
|
34
|
+
} = E(), $ = u(
|
|
35
35
|
{
|
|
36
|
-
min:
|
|
37
|
-
max:
|
|
36
|
+
min: F(e, ({ x: t }) => t),
|
|
37
|
+
max: k(e, ({ x: t }) => t)
|
|
38
38
|
},
|
|
39
39
|
m.xAxis
|
|
40
40
|
), D = u(
|
|
41
|
-
{ min: c, max: l, label:
|
|
41
|
+
{ min: c, max: l, label: i("light_curve.plot.x_label") },
|
|
42
42
|
{
|
|
43
43
|
...$,
|
|
44
|
-
label:
|
|
44
|
+
label: i("isochrone_plot.plot.x_label")
|
|
45
45
|
}
|
|
46
46
|
), r = u(
|
|
47
|
-
{ min: x, max: o, label:
|
|
47
|
+
{ min: x, max: o, label: i("light_curve.plot.y_label") },
|
|
48
48
|
{
|
|
49
49
|
...m.yAxis,
|
|
50
|
-
label:
|
|
50
|
+
label: i("isochrone_plot.plot.y_label")
|
|
51
51
|
}
|
|
52
52
|
), b = {
|
|
53
53
|
top: 10,
|
|
@@ -65,24 +65,23 @@ const O = (i, p, c) => {
|
|
|
65
65
|
activePointId: p,
|
|
66
66
|
title: y,
|
|
67
67
|
xAxis: {
|
|
68
|
-
...D
|
|
69
|
-
ticks: 6
|
|
68
|
+
...D
|
|
70
69
|
},
|
|
71
70
|
yAxis: {
|
|
72
71
|
...r,
|
|
73
72
|
step: r.min < r.max ? Math.abs(r.step) : r.step
|
|
74
73
|
},
|
|
75
74
|
data: {
|
|
76
|
-
label:
|
|
77
|
-
points:
|
|
75
|
+
label: i("light_curve.plot.plot_label"),
|
|
76
|
+
points: e
|
|
78
77
|
},
|
|
79
|
-
tooltip: ({ y: t }) =>
|
|
78
|
+
tooltip: ({ y: t }) => i("light_curve.plot.tooltip", {
|
|
80
79
|
magnitude: t.toLocaleString(W, {
|
|
81
80
|
minimumFractionDigits: 2,
|
|
82
81
|
maximumFractionDigits: 2
|
|
83
82
|
})
|
|
84
83
|
}),
|
|
85
|
-
plotChildren: ({ xScale: t, yStart: d, yEnd: h, Data: _, ...j }) => /* @__PURE__ */ A(
|
|
84
|
+
plotChildren: ({ xScale: t, yStart: d, yEnd: h, Data: _, ...j }) => /* @__PURE__ */ A(C, { children: [
|
|
86
85
|
/* @__PURE__ */ n(
|
|
87
86
|
"rect",
|
|
88
87
|
{
|
|
@@ -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
|
/**
|
package/package.json
CHANGED