@rubin-epo/epo-widget-lib 0.8.0 → 0.9.0
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.cjs +1 -1
- package/dist/Charts.js +12 -8
- package/dist/ColorTool.cjs +1 -1
- package/dist/ColorTool.js +62 -59
- package/dist/LightCurvePlot.cjs +1 -0
- package/dist/LightCurvePlot.d.ts +1 -0
- package/dist/LightCurvePlot.js +6 -0
- package/dist/SupernovaThreeVector.cjs +1 -1
- package/dist/SupernovaThreeVector.js +71 -65
- package/dist/atomic/Button/patterns/Reset.js +9 -9
- package/dist/atomic/LiveRegion/index.cjs +1 -0
- package/dist/atomic/LiveRegion/index.d.ts +5 -0
- package/dist/atomic/LiveRegion/index.js +10 -0
- package/dist/charts/Base/index.cjs +1 -1
- package/dist/charts/Base/index.js +37 -23
- package/dist/charts/Base/styles.cjs +5 -2
- package/dist/charts/Base/styles.js +7 -4
- package/dist/charts/ForeignObject/index.cjs +1 -0
- package/dist/charts/ForeignObject/index.d.ts +5 -0
- package/dist/charts/ForeignObject/index.js +18 -0
- package/dist/charts/Tooltip/index.cjs +1 -1
- package/dist/charts/Tooltip/index.d.ts +2 -2
- package/dist/charts/Tooltip/index.js +23 -24
- package/dist/charts/Viewport/index.cjs +1 -0
- package/dist/charts/Viewport/index.d.ts +11 -0
- package/dist/charts/Viewport/index.js +26 -0
- package/dist/charts/XAxis/index.cjs +1 -1
- package/dist/charts/XAxis/index.js +21 -21
- package/dist/charts/YAxis/index.cjs +1 -1
- package/dist/charts/YAxis/index.js +19 -19
- package/dist/charts/hooks/useAxis.cjs +1 -0
- package/dist/charts/hooks/useAxis.d.ts +16 -0
- package/dist/charts/hooks/useAxis.js +29 -0
- package/dist/charts/index.d.ts +2 -0
- package/dist/hooks/usePrevious.cjs +1 -0
- package/dist/hooks/usePrevious.d.ts +1 -0
- package/dist/hooks/usePrevious.js +11 -0
- package/dist/lib/helpers.cjs +1 -0
- package/dist/lib/helpers.d.ts +2 -0
- package/dist/lib/helpers.js +4 -0
- package/dist/lib/helpers.test.d.ts +1 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts +5 -1
- package/dist/lib/utils.js +17 -12
- package/dist/localeStrings/en/epo-widget-lib.json +32 -0
- package/dist/widgets/ColorTool/Actions/index.js +9 -9
- package/dist/widgets/ColorTool/ImageComposite/ImageComposite.cjs +1 -1
- package/dist/widgets/ColorTool/ImageComposite/ImageComposite.d.ts +3 -0
- package/dist/widgets/ColorTool/ImageComposite/ImageComposite.js +42 -66
- package/dist/widgets/ColorTool/ImageComposite/styles.cjs +5 -7
- package/dist/widgets/ColorTool/ImageComposite/styles.js +9 -9
- package/dist/widgets/ColorTool/hooks/useFilteredImages.cjs +1 -0
- package/dist/widgets/ColorTool/hooks/useFilteredImages.d.ts +8 -0
- package/dist/widgets/ColorTool/hooks/useFilteredImages.js +36 -0
- package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/index.cjs +1 -0
- package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/index.d.ts +11 -0
- package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/index.js +38 -0
- package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/styles.cjs +9 -0
- package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/styles.d.ts +275 -0
- package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/styles.js +14 -0
- package/dist/widgets/LightCurvePlot/DM15Display/index.cjs +1 -0
- package/dist/widgets/LightCurvePlot/DM15Display/index.d.ts +15 -0
- package/dist/widgets/LightCurvePlot/DM15Display/index.js +40 -0
- package/dist/widgets/LightCurvePlot/DM15Display/styles.cjs +12 -0
- package/dist/widgets/{ColorTool/ImageComposite → LightCurvePlot/DM15Display}/styles.d.ts +2 -2
- package/dist/widgets/LightCurvePlot/DM15Display/styles.js +18 -0
- package/dist/widgets/LightCurvePlot/LightCurve/index.cjs +1 -0
- package/dist/widgets/LightCurvePlot/LightCurve/index.d.ts +12 -0
- package/dist/widgets/LightCurvePlot/LightCurve/index.js +29 -0
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/index.cjs +1 -0
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/index.d.ts +10 -0
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/index.js +52 -0
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/styles.cjs +37 -0
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/styles.js +46 -0
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.cjs +1 -0
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.d.ts +12 -0
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.js +132 -0
- package/dist/widgets/LightCurvePlot/PlotWithCurve/styles.cjs +29 -0
- package/dist/widgets/LightCurvePlot/PlotWithCurve/styles.d.ts +1378 -0
- package/dist/widgets/LightCurvePlot/PlotWithCurve/styles.js +41 -0
- package/dist/widgets/LightCurvePlot/PlotWithoutCurve/index.cjs +1 -0
- package/dist/widgets/LightCurvePlot/PlotWithoutCurve/index.d.ts +15 -0
- package/dist/widgets/LightCurvePlot/PlotWithoutCurve/index.js +20 -0
- package/dist/widgets/LightCurvePlot/Point/index.cjs +1 -0
- package/dist/widgets/LightCurvePlot/Point/index.d.ts +11 -0
- package/dist/widgets/LightCurvePlot/Point/index.js +68 -0
- package/dist/widgets/LightCurvePlot/ScatterPlot/index.cjs +1 -0
- package/dist/widgets/LightCurvePlot/ScatterPlot/index.d.ts +13 -0
- package/dist/widgets/LightCurvePlot/ScatterPlot/index.js +163 -0
- package/dist/widgets/LightCurvePlot/ScatterPlot/styles.cjs +31 -0
- package/dist/widgets/LightCurvePlot/ScatterPlot/styles.d.ts +557 -0
- package/dist/widgets/LightCurvePlot/ScatterPlot/styles.js +40 -0
- package/dist/widgets/LightCurvePlot/defaults.cjs +1 -0
- package/dist/widgets/LightCurvePlot/defaults.d.ts +17 -0
- package/dist/widgets/LightCurvePlot/defaults.js +19 -0
- package/dist/widgets/LightCurvePlot/helpers.cjs +1 -0
- package/dist/widgets/LightCurvePlot/helpers.d.ts +23 -0
- package/dist/widgets/LightCurvePlot/helpers.js +23 -0
- package/dist/widgets/LightCurvePlot/helpers.test.d.ts +1 -0
- package/dist/widgets/LightCurvePlot/index.d.ts +2 -0
- package/dist/widgets/SupernovaThreeVector/LiveLabel/index.cjs +1 -1
- package/dist/widgets/SupernovaThreeVector/LiveLabel/index.js +15 -15
- package/dist/widgets/SupernovaThreeVector/styles.cjs +30 -20
- package/dist/widgets/SupernovaThreeVector/styles.js +29 -18
- package/package.json +2 -1
- package/dist/hooks/useImage.cjs +0 -1
- package/dist/hooks/useImage.d.ts +0 -10
- package/dist/hooks/useImage.js +0 -31
- package/dist/widgets/ColorTool/CompositeRender/index.cjs +0 -1
- package/dist/widgets/ColorTool/CompositeRender/index.d.ts +0 -9
- package/dist/widgets/ColorTool/CompositeRender/index.js +0 -16
- package/dist/widgets/ColorTool/CompositeRender/styles.cjs +0 -3
- package/dist/widgets/ColorTool/CompositeRender/styles.d.ts +0 -274
- package/dist/widgets/ColorTool/CompositeRender/styles.js +0 -8
- package/dist/widgets/ColorTool/OffscreenFilter/index.cjs +0 -1
- package/dist/widgets/ColorTool/OffscreenFilter/index.d.ts +0 -15
- package/dist/widgets/ColorTool/OffscreenFilter/index.js +0 -27
- /package/dist/{widgets/SupernovaThreeVector/LiveLabel → atomic/LiveRegion}/styles.cjs +0 -0
- /package/dist/{widgets/SupernovaThreeVector/LiveLabel → atomic/LiveRegion}/styles.d.ts +0 -0
- /package/dist/{widgets/SupernovaThreeVector/LiveLabel → atomic/LiveRegion}/styles.js +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import e from "styled-components";
|
|
3
|
-
const
|
|
3
|
+
const t = e.div`
|
|
4
|
+
--label-gutter: 2em;
|
|
5
|
+
|
|
4
6
|
display: grid;
|
|
5
|
-
grid-template-columns:
|
|
6
|
-
grid-template-rows: 1fr
|
|
7
|
+
grid-template-columns: var(--label-gutter) 1fr;
|
|
8
|
+
grid-template-rows: 1fr var(--label-gutter);
|
|
7
9
|
grid-template-areas:
|
|
8
10
|
"vertical-label chart"
|
|
9
11
|
". horizontal-label";
|
|
12
|
+
padding-inline-end: var(--label-gutter);
|
|
10
13
|
`, r = e.span`
|
|
11
14
|
font-size: 80%;
|
|
12
15
|
grid-area: horizontal-label;
|
|
@@ -26,7 +29,7 @@ const a = e.div`
|
|
|
26
29
|
aspect-ratio: var(--aspect-ratio);
|
|
27
30
|
`;
|
|
28
31
|
export {
|
|
29
|
-
|
|
32
|
+
t as ChartContainer,
|
|
30
33
|
r as HorizontalLabel,
|
|
31
34
|
i as SVG,
|
|
32
35
|
l as VerticalLabel
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),e=({children:t,className:n})=>r.jsx("foreignObject",{className:n,x:0,y:0,width:"100%",height:"100%",pointerEvents:"none",children:t});e.displayName="Charts.ForeignObject";const i=e;exports.default=i;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
const e = ({ children: t, className: n }) => /* @__PURE__ */ o(
|
|
3
|
+
"foreignObject",
|
|
4
|
+
{
|
|
5
|
+
className: n,
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0,
|
|
8
|
+
width: "100%",
|
|
9
|
+
height: "100%",
|
|
10
|
+
pointerEvents: "none",
|
|
11
|
+
children: t
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
e.displayName = "Charts.ForeignObject";
|
|
15
|
+
const i = e;
|
|
16
|
+
export {
|
|
17
|
+
i as default
|
|
18
|
+
};
|
|
@@ -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 i=require("react/jsx-runtime"),b=require("../ForeignObject/index.cjs"),u=require("./styles.cjs"),w=(t,e)=>t.includes("left")?`calc(0% + ${e}px)`:t.includes("right")?`calc(-100% - ${e}px)`:(t.includes("center"),"-50%"),y=(t,e)=>t.includes("top")?`calc(0% + ${e}px)`:t.includes("bottom")?`calc(-100% - ${e}px)`:(t.includes("center"),"-50%"),O=t=>{let e="0",n="0",r="0",s="0",l="0deg";return t.includes("center")&&(e="50%",n="50%",r="-50%",s="-50%"),t.includes("top")&&(n="0",s="-100%",l="180deg"),t.includes("right")&&(e="100%",r="-25%",l="-90deg"),t.includes("left")&&(e="0",r="-75%",l="90deg"),t.includes("bottom")&&(n="100%",s="0"),{left:e,top:n,transform:`translate(${r}, ${s}) rotate(${l})`}},a=({x:t,y:e,visible:n=!0,offset:r=5,origin:s="center bottom",children:l,className:d})=>{const f="center center",c=[...s.split(" "),...f.split(" ")].slice(0,2).join(" "),o=6,p=w(c,o+r),$=y(c,o+r),x=c.includes("center")&&c.split(" ").filter(h=>h!=="center").length===1,m=O(c);return i.jsx(b.default,{children:typeof t=="number"&&typeof e=="number"&&i.jsxs(u.Tooltip,{className:d,style:{transform:`translate(calc(${p} + ${t}px), calc(${$} + ${e}px))`},hidden:!n,children:[l,x&&i.jsx(u.Arrow,{style:{"--arrow-size":`${o}px`,...m}})]})})};a.displayName="Charts.Tooltip";const g=a;exports.default=g;
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as i, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import w from "../ForeignObject/index.js";
|
|
3
|
+
import { Tooltip as O, Arrow as b } from "./styles.js";
|
|
3
4
|
const g = (t, e) => t.includes("left") ? `calc(0% + ${e}px)` : t.includes("right") ? `calc(-100% - ${e}px)` : (t.includes("center"), "-50%"), y = (t, e) => t.includes("top") ? `calc(0% + ${e}px)` : t.includes("bottom") ? `calc(-100% - ${e}px)` : (t.includes("center"), "-50%"), T = (t) => {
|
|
4
|
-
let e = "0",
|
|
5
|
-
return t.includes("center") && (e = "50%",
|
|
5
|
+
let e = "0", n = "0", r = "0", l = "0", c = "0deg";
|
|
6
|
+
return t.includes("center") && (e = "50%", n = "50%", r = "-50%", l = "-50%"), t.includes("top") && (n = "0", l = "-100%", c = "180deg"), t.includes("right") && (e = "100%", r = "-25%", c = "-90deg"), t.includes("left") && (e = "0", r = "-75%", c = "90deg"), t.includes("bottom") && (n = "100%", l = "0"), {
|
|
6
7
|
left: e,
|
|
7
|
-
top:
|
|
8
|
-
transform: `translate(${
|
|
8
|
+
top: n,
|
|
9
|
+
transform: `translate(${r}, ${l}) rotate(${c})`
|
|
9
10
|
};
|
|
10
|
-
},
|
|
11
|
+
}, a = ({
|
|
11
12
|
x: t,
|
|
12
13
|
y: e,
|
|
13
|
-
visible:
|
|
14
|
-
offset:
|
|
14
|
+
visible: n = !0,
|
|
15
|
+
offset: r = 5,
|
|
15
16
|
origin: l = "center bottom",
|
|
16
|
-
children:
|
|
17
|
+
children: c,
|
|
17
18
|
className: u
|
|
18
19
|
}) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return /* @__PURE__ */ i("foreignObject", { x: 0, y: 0, width: "100%", height: "100%", pointerEvents: "none", children: /* @__PURE__ */ m(
|
|
23
|
-
w,
|
|
20
|
+
const f = "center center", s = [...l.split(" "), ...f.split(" ")].slice(0, 2).join(" "), o = 6, p = g(s, o + r), d = y(s, o + r), m = s.includes("center") && s.split(" ").filter((x) => x !== "center").length === 1, $ = T(s);
|
|
21
|
+
return /* @__PURE__ */ i(w, { children: typeof t == "number" && typeof e == "number" && /* @__PURE__ */ h(
|
|
22
|
+
O,
|
|
24
23
|
{
|
|
25
24
|
className: u,
|
|
26
25
|
style: {
|
|
27
|
-
transform: `translate(calc(${
|
|
26
|
+
transform: `translate(calc(${p} + ${t}px), calc(${d} + ${e}px))`
|
|
28
27
|
},
|
|
29
|
-
hidden: !
|
|
28
|
+
hidden: !n,
|
|
30
29
|
children: [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
c,
|
|
31
|
+
m && /* @__PURE__ */ i(
|
|
32
|
+
b,
|
|
34
33
|
{
|
|
35
34
|
style: {
|
|
36
35
|
"--arrow-size": `${o}px`,
|
|
37
|
-
|
|
36
|
+
...$
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
)
|
|
@@ -42,8 +41,8 @@ const g = (t, e) => t.includes("left") ? `calc(0% + ${e}px)` : t.includes("right
|
|
|
42
41
|
}
|
|
43
42
|
) });
|
|
44
43
|
};
|
|
45
|
-
|
|
46
|
-
const
|
|
44
|
+
a.displayName = "Charts.Tooltip";
|
|
45
|
+
const X = a;
|
|
47
46
|
export {
|
|
48
|
-
|
|
47
|
+
X as default
|
|
49
48
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),e=({innerWidth:t,innerHeight:i,outerWidth:r,outerHeight:s,x:o,y:u,children:n})=>a.jsx("svg",{preserveAspectRatio:"none",x:o,y:u,width:r,height:s,viewBox:`0 0 ${t} ${i}`,children:n});e.displayName="Widgets.Charts.Viewport";const d=e;exports.default=d;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FunctionComponent, PropsWithChildren } from "react";
|
|
2
|
+
export interface ViewportProps {
|
|
3
|
+
innerWidth: number;
|
|
4
|
+
innerHeight: number;
|
|
5
|
+
outerWidth: number;
|
|
6
|
+
outerHeight: number;
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
declare const Viewport: FunctionComponent<PropsWithChildren<ViewportProps>>;
|
|
11
|
+
export default Viewport;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
const e = ({
|
|
3
|
+
innerWidth: t,
|
|
4
|
+
innerHeight: o,
|
|
5
|
+
outerWidth: r,
|
|
6
|
+
outerHeight: i,
|
|
7
|
+
x: s,
|
|
8
|
+
y: p,
|
|
9
|
+
children: a
|
|
10
|
+
}) => /* @__PURE__ */ n(
|
|
11
|
+
"svg",
|
|
12
|
+
{
|
|
13
|
+
preserveAspectRatio: "none",
|
|
14
|
+
x: s,
|
|
15
|
+
y: p,
|
|
16
|
+
width: r,
|
|
17
|
+
height: i,
|
|
18
|
+
viewBox: `0 0 ${t} ${o}`,
|
|
19
|
+
children: a
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
e.displayName = "Widgets.Charts.Viewport";
|
|
23
|
+
const d = e;
|
|
24
|
+
export {
|
|
25
|
+
d as default
|
|
26
|
+
};
|
|
@@ -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 e=require("react/jsx-runtime"),M=require("d3-array"),u=require("../styles.cjs"),h=({xDomain:r=[0,1],xScale:n=c=>c,y:t=0,ticks:i=0,labelRender:a,labelledById:j,margin:b,tickHeight:d=5,showBaseline:x=!0,className:A})=>{if(r.length<2)return console.error("Failed to render: invalid domain",r),null;const g={...{top:0,right:0,bottom:0,left:0},...b},f=Array.isArray(i)?i:M.ticks(r[0],r[1],i);return e.jsxs(e.Fragment,{children:[x&&e.jsx(u.BaseLine,{x1:n(r[0])-g.left,x2:n(r[1])+g.right,y1:t,y2:t}),f.length>0&&e.jsx("g",{role:"list","aria-labelledby":j,className:A,children:f.map((s,y)=>{if(s>=r[1])return null;const o=t+d,l=n(s);return e.jsxs("g",{role:"listitem",children:[d>0&&e.jsx(u.Tick,{x1:l,x2:l,y1:t,y2:o}),a?a(s,l,o,y):e.jsx(u.XLabel,{x:l,y:o,children:s})]},y)})})]})};h.displayName="Charts.XAxis";const X=h;exports.default=X;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as p, Fragment as X, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { ticks as x } from "d3-array";
|
|
3
|
-
import { BaseLine as M, Tick as j, XLabel as
|
|
4
|
-
const
|
|
3
|
+
import { BaseLine as M, Tick as j, XLabel as F } from "../styles.js";
|
|
4
|
+
const u = ({
|
|
5
5
|
xDomain: r = [0, 1],
|
|
6
|
-
xScale: i = (
|
|
6
|
+
xScale: i = (c) => c,
|
|
7
7
|
y: t = 0,
|
|
8
|
-
ticks:
|
|
9
|
-
labelRender:
|
|
10
|
-
labelledById:
|
|
11
|
-
margin:
|
|
8
|
+
ticks: n = 0,
|
|
9
|
+
labelRender: a,
|
|
10
|
+
labelledById: m,
|
|
11
|
+
margin: y,
|
|
12
12
|
tickHeight: d = 5,
|
|
13
|
-
showBaseline:
|
|
14
|
-
className:
|
|
13
|
+
showBaseline: A = !0,
|
|
14
|
+
className: b
|
|
15
15
|
}) => {
|
|
16
16
|
if (r.length < 2)
|
|
17
17
|
return console.error("Failed to render: invalid domain", r), null;
|
|
18
|
-
const f = { ...{ top: 0, right: 0, bottom: 0, left: 0 }, ...
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
|
|
18
|
+
const f = { ...{ top: 0, right: 0, bottom: 0, left: 0 }, ...y }, g = Array.isArray(n) ? n : x(r[0], r[1], n);
|
|
19
|
+
return /* @__PURE__ */ p(X, { children: [
|
|
20
|
+
A && /* @__PURE__ */ s(
|
|
21
21
|
M,
|
|
22
22
|
{
|
|
23
23
|
x1: i(r[0]) - f.left,
|
|
@@ -26,19 +26,19 @@ const p = ({
|
|
|
26
26
|
y2: t
|
|
27
27
|
}
|
|
28
28
|
),
|
|
29
|
-
|
|
29
|
+
g.length > 0 && /* @__PURE__ */ s("g", { role: "list", "aria-labelledby": m, className: b, children: g.map((e, h) => {
|
|
30
30
|
if (e >= r[1])
|
|
31
31
|
return null;
|
|
32
|
-
const
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
d > 0 && /* @__PURE__ */ s(j, { x1: l, x2: l, y1: t, y2:
|
|
35
|
-
|
|
36
|
-
] },
|
|
32
|
+
const o = t + d, l = i(e);
|
|
33
|
+
return /* @__PURE__ */ p("g", { role: "listitem", children: [
|
|
34
|
+
d > 0 && /* @__PURE__ */ s(j, { x1: l, x2: l, y1: t, y2: o }),
|
|
35
|
+
a ? a(e, l, o, h) : /* @__PURE__ */ s(F, { x: l, y: o, children: e })
|
|
36
|
+
] }, h);
|
|
37
37
|
}) })
|
|
38
38
|
] });
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
const C =
|
|
40
|
+
u.displayName = "Charts.XAxis";
|
|
41
|
+
const C = u;
|
|
42
42
|
export {
|
|
43
43
|
C as default
|
|
44
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),y=require("d3-array"),a=require("../styles.cjs"),j=({yDomain:r=[0,1],yScale:l=c=>c,x:t=0,margin:f,ticks:i=0,labelRender:d,labelledById:h,showBaseline:A=!0,tickLength:u=5,className:p})=>{if(r.length<2)return console.error("Failed to render: invalid domain",r),null;const x={...{top:0,right:0,bottom:0,left:0},...f},g=Array.isArray(i)?i:y.ticks(r[0],r[1],i);return e.jsxs(e.Fragment,{children:[A&&e.jsx(a.BaseLine,{x1:t,x2:t,y1:l(r[0])+x.top,y2:l(r[1])-x.bottom}),g.length>0&&e.jsx("g",{role:"list","aria-labelledby":h,className:p,children:g.map((n,b)=>{const s=l(n),o=t-u;return e.jsxs("g",{role:"listitem",children:[u>0&&e.jsx(a.Tick,{x1:o,x2:t,y1:s,y2:s}),d?d(n,o,s,b):e.jsx(a.YLabel,{x:o,y:s,children:n})]},b)})})]})};j.displayName="Charts.YAxis";const M=j;exports.default=M;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { jsxs as p, Fragment as
|
|
1
|
+
import { jsxs as p, Fragment as Y, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { ticks as M } from "d3-array";
|
|
3
|
-
import { BaseLine as j, Tick as
|
|
3
|
+
import { BaseLine as j, Tick as y, YLabel as F } from "../styles.js";
|
|
4
4
|
const x = ({
|
|
5
5
|
yDomain: r = [0, 1],
|
|
6
|
-
yScale:
|
|
6
|
+
yScale: l = (c) => c,
|
|
7
7
|
x: t = 0,
|
|
8
|
-
margin:
|
|
9
|
-
ticks:
|
|
8
|
+
margin: h,
|
|
9
|
+
ticks: i = 0,
|
|
10
10
|
labelRender: a,
|
|
11
11
|
labelledById: b,
|
|
12
|
-
showBaseline:
|
|
13
|
-
tickLength:
|
|
14
|
-
className:
|
|
12
|
+
showBaseline: u = !0,
|
|
13
|
+
tickLength: d = 5,
|
|
14
|
+
className: A
|
|
15
15
|
}) => {
|
|
16
16
|
if (r.length < 2)
|
|
17
17
|
return console.error("Failed to render: invalid domain", r), null;
|
|
18
|
-
const f = { ...{ top: 0, right: 0, bottom: 0, left: 0 }, ...
|
|
19
|
-
return /* @__PURE__ */ p(
|
|
20
|
-
|
|
18
|
+
const f = { ...{ top: 0, right: 0, bottom: 0, left: 0 }, ...h }, g = Array.isArray(i) ? i : M(r[0], r[1], i);
|
|
19
|
+
return /* @__PURE__ */ p(Y, { children: [
|
|
20
|
+
u && /* @__PURE__ */ s(
|
|
21
21
|
j,
|
|
22
22
|
{
|
|
23
23
|
x1: t,
|
|
24
24
|
x2: t,
|
|
25
|
-
y1:
|
|
26
|
-
y2:
|
|
25
|
+
y1: l(r[0]) + f.top,
|
|
26
|
+
y2: l(r[1]) - f.bottom
|
|
27
27
|
}
|
|
28
28
|
),
|
|
29
|
-
|
|
30
|
-
const
|
|
29
|
+
g.length > 0 && /* @__PURE__ */ s("g", { role: "list", "aria-labelledby": b, className: A, children: g.map((o, m) => {
|
|
30
|
+
const e = l(o), n = t - d;
|
|
31
31
|
return /* @__PURE__ */ p("g", { role: "listitem", children: [
|
|
32
|
-
|
|
33
|
-
a ? a(
|
|
32
|
+
d > 0 && /* @__PURE__ */ s(y, { x1: n, x2: t, y1: e, y2: e }),
|
|
33
|
+
a ? a(o, n, e, m) : /* @__PURE__ */ s(F, { x: n, y: e, children: o })
|
|
34
34
|
] }, m);
|
|
35
35
|
}) })
|
|
36
36
|
] });
|
|
37
37
|
};
|
|
38
38
|
x.displayName = "Charts.YAxis";
|
|
39
|
-
const
|
|
39
|
+
const L = x;
|
|
40
40
|
export {
|
|
41
|
-
|
|
41
|
+
L as default
|
|
42
42
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),i=require("d3-array"),M=require("../../lib/utils.cjs"),g={linear:M.getLinearScale},b=({min:t,max:r,step:s,range:o,scale:u="linear",scaleOptions:l})=>{const n=c.useMemo(()=>Math.ceil((r-t+1)/10)*10/s,[t,r,s]),e=c.useMemo(()=>i.nice(t,r,n),[t,r,n]),a=i.range(e[0],e[1],s),d=c.useCallback(g[u](e,o,l),[e,o,u]);return[e,a,d]};exports.default=b;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Domain, Scale, ScaleFunction } from '../../charts/types';
|
|
2
|
+
interface UseAxisProps {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
step: number;
|
|
6
|
+
scale?: Scale;
|
|
7
|
+
scaleOptions?: any;
|
|
8
|
+
range: Array<number>;
|
|
9
|
+
}
|
|
10
|
+
type Axis = [Domain, Array<number>, ScaleFunction];
|
|
11
|
+
/**
|
|
12
|
+
* Creates an axis with ticks defined by a min, max, and desired step.
|
|
13
|
+
* @returns [domain, ticks, scale]
|
|
14
|
+
*/
|
|
15
|
+
declare const useAxis: ({ min, max, step, range: scaleRange, scale: scaleType, scaleOptions, }: UseAxisProps) => Axis;
|
|
16
|
+
export default useAxis;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMemo as i, useCallback as f } from "react";
|
|
3
|
+
import { nice as k, range as d } from "d3-array";
|
|
4
|
+
import { getLinearScale as g } from "../../lib/utils.js";
|
|
5
|
+
const m = {
|
|
6
|
+
linear: g
|
|
7
|
+
}, h = ({
|
|
8
|
+
min: t,
|
|
9
|
+
max: e,
|
|
10
|
+
step: c,
|
|
11
|
+
range: r,
|
|
12
|
+
scale: s = "linear",
|
|
13
|
+
scaleOptions: a
|
|
14
|
+
}) => {
|
|
15
|
+
const n = i(
|
|
16
|
+
() => Math.ceil((e - t + 1) / 10) * 10 / c,
|
|
17
|
+
[t, e, c]
|
|
18
|
+
), o = i(
|
|
19
|
+
() => k(t, e, n),
|
|
20
|
+
[t, e, n]
|
|
21
|
+
), l = d(o[0], o[1], c), u = f(
|
|
22
|
+
m[s](o, r, a),
|
|
23
|
+
[o, r, s]
|
|
24
|
+
);
|
|
25
|
+
return [o, l, u];
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
h as default
|
|
29
|
+
};
|
package/dist/charts/index.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export { default as Points } from "./Points";
|
|
|
6
6
|
export { default as Tooltip } from "./Tooltip";
|
|
7
7
|
export { default as ClippingContainer } from "./ClippingContainer";
|
|
8
8
|
export { default as Bars } from "./Bars";
|
|
9
|
+
export { default as Viewport } from "./Viewport";
|
|
10
|
+
export { default as ForeignObject } from "./ForeignObject";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react");function u(e){const t=r.useRef();return r.useEffect(()=>{t.current=e},[e]),t.current}exports.default=u;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function usePrevious<T = any>(value: T): T | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=t=>(t-40587)*864e5;exports.timestampFromMJD=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/lib/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=(t,e)=>{switch(!0){case t>e:return 0;case t<0:return e;default:return t}},a=(t,e,r)=>t>=e&&t<=r,f=(t=[],e=[])=>{const r=t[0]<e[0]?t:e,n=r===t?e:t;return r[1]<n[0]?null:[n[0],r[1]<n[1]?r[1]:n[1]]},m=(t=[0,1],e=[0,1],r)=>{const n={clamp:!1,fractionDigits:2},{clamp:i,fractionDigits:o}={...n,...r};return u=>{const s=t[1]-t[0];if(s===0)return(e[0]+e[1])/2;let c=(u-t[0])/s;return i&&(c=Math.min(Math.max(c,0),1)),Number((c*(e[1]-e[0])+e[0]).toFixed(o))}};exports.between=a;exports.getClampedArrayIndex=l;exports.getLinearScale=m;exports.intersection=f;
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -20,4 +20,8 @@ export declare const intersection: (a?: number[], b?: number[]) => number[] | nu
|
|
|
20
20
|
* @param clamp should values outside the domain be clamped to the range
|
|
21
21
|
* @returns (domainValue: number) => rangeValue: number
|
|
22
22
|
*/
|
|
23
|
-
export declare const getLinearScale: (domain?: number[], range?: number[],
|
|
23
|
+
export declare const getLinearScale: (domain?: number[], range?: number[], options?: {
|
|
24
|
+
clamp?: boolean;
|
|
25
|
+
fractionDigits?: number;
|
|
26
|
+
}) => (domainValue: number) => number;
|
|
27
|
+
export declare const precision: (number: number, precision: number) => number;
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l = (t, e) => {
|
|
2
2
|
switch (!0) {
|
|
3
3
|
case t > e:
|
|
4
4
|
return 0;
|
|
@@ -7,19 +7,24 @@ const u = (t, e) => {
|
|
|
7
7
|
default:
|
|
8
8
|
return t;
|
|
9
9
|
}
|
|
10
|
-
},
|
|
10
|
+
}, f = (t, e, r) => t >= e && t <= r, a = (t = [], e = []) => {
|
|
11
11
|
const r = t[0] < e[0] ? t : e, n = r === t ? e : t;
|
|
12
12
|
return r[1] < n[0] ? null : [n[0], r[1] < n[1] ? r[1] : n[1]];
|
|
13
|
-
},
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
}, m = (t = [0, 1], e = [0, 1], r) => {
|
|
14
|
+
const n = { clamp: !1, fractionDigits: 2 }, { clamp: u, fractionDigits: i } = { ...n, ...r };
|
|
15
|
+
return (o) => {
|
|
16
|
+
const s = t[1] - t[0];
|
|
17
|
+
if (s === 0)
|
|
18
|
+
return (e[0] + e[1]) / 2;
|
|
19
|
+
let c = (o - t[0]) / s;
|
|
20
|
+
return u && (c = Math.min(Math.max(c, 0), 1)), Number(
|
|
21
|
+
(c * (e[1] - e[0]) + e[0]).toFixed(i)
|
|
22
|
+
);
|
|
23
|
+
};
|
|
19
24
|
};
|
|
20
25
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
f as between,
|
|
27
|
+
l as getClampedArrayIndex,
|
|
28
|
+
m as getLinearScale,
|
|
29
|
+
a as intersection
|
|
25
30
|
};
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
"supernova_three_vector": {
|
|
84
84
|
"histogram": {
|
|
85
|
+
"title": "Supernova Distances",
|
|
85
86
|
"x_label": "Distance [kpc]",
|
|
86
87
|
"bar_label_one": "{{binMin}} to {{binMax}} kiloparsecs: {{count}} supernova",
|
|
87
88
|
"bar_label_other": "{{binMin}} to {{binMax}} kiloparsecs: {{count}} supernovae"
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
"valueLabel": "{{value}} kiloparsecs"
|
|
92
93
|
},
|
|
93
94
|
"skymap": {
|
|
95
|
+
"title": "Supernova Distribution",
|
|
94
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}}})",
|
|
95
97
|
"supernova_count_one": "Sky map projection showing {{count}} supernova between the distances of {{min}} and {{max}} kiloparsecs.",
|
|
96
98
|
"supernova_count_other": "Sky map projection showing {{count}} supernovae between the distances of {{min}} and {{max}} kiloparsecs.",
|
|
@@ -98,5 +100,35 @@
|
|
|
98
100
|
"user_supernova_count_one": "{{count}} of your supernovae is visible near {{coords}}.",
|
|
99
101
|
"user_supernova_count_other": "{{count}} of your supernovae are visible near {{coords}}."
|
|
100
102
|
}
|
|
103
|
+
},
|
|
104
|
+
"light_curve": {
|
|
105
|
+
"deltaM15": {
|
|
106
|
+
"label": "Delta m 15:"
|
|
107
|
+
},
|
|
108
|
+
"curve": {
|
|
109
|
+
"controls": {
|
|
110
|
+
"gaussian_width": "Gaussian Width",
|
|
111
|
+
"y_offset": "Y Offset"
|
|
112
|
+
},
|
|
113
|
+
"description_above": "Mean distance from observations is {{residual}}, your peak is above the brightest measurement of {{brightest}}",
|
|
114
|
+
"description_below": "Mean distance from observations is {{residual}}, your peak is below the brightest measurement of {{brightest}}"
|
|
115
|
+
},
|
|
116
|
+
"magnitude_slider": {
|
|
117
|
+
"label": "Estimate the apparent magnitude",
|
|
118
|
+
"value_above": "Apparent magnitude is {{magnitude}}, {{distance}} higher than the peak of the light curve.",
|
|
119
|
+
"value_below": "Apparent magnitude is {{magnitude}}, {{distance}} lower than the peak of the light curve.",
|
|
120
|
+
"value_equal": "Apparent magnitude is {{magnitude}}, equal to the peak of the light curve."
|
|
121
|
+
},
|
|
122
|
+
"plot": {
|
|
123
|
+
"x_label": "Days",
|
|
124
|
+
"y_label": "Apparent Magnitude (m)",
|
|
125
|
+
"plot_label": "Supernovae magnitude before and after peak magnitude",
|
|
126
|
+
"point_label_before_one": "Apparent Magnitude: {{magnitude}} {{count}} day before peak",
|
|
127
|
+
"point_label_before_other": "Apparent Magnitude: {{magnitude}} {{count}} days before peak",
|
|
128
|
+
"point_label_peak": "Apparent Magnitude: {{magnitude}} at peak",
|
|
129
|
+
"point_label_after_one": "Apparent Magnitude: {{magnitude}} {{count}} day after peak",
|
|
130
|
+
"point_label_after_other": "Apparent Magnitude: {{magnitude}} {{count}} days after peak",
|
|
131
|
+
"tooltip": "Apparent Magnitude: {{magnitude}}<br/>Date: {{date}}"
|
|
132
|
+
}
|
|
101
133
|
}
|
|
102
134
|
}
|
|
@@ -6,22 +6,22 @@ import d from "./Export/index.js";
|
|
|
6
6
|
import { Actions as A } from "./styles.js";
|
|
7
7
|
import { areActionsActive as x, getBrightnessValue as h } from "../lib/utils.js";
|
|
8
8
|
const b = (r) => r.map((s) => {
|
|
9
|
-
const { defaultValue: t, min:
|
|
9
|
+
const { defaultValue: t, min: e, max: n } = s, o = t || 1;
|
|
10
10
|
return {
|
|
11
11
|
...s,
|
|
12
12
|
active: !1,
|
|
13
13
|
color: "",
|
|
14
|
-
brightness: h(
|
|
15
|
-
value:
|
|
14
|
+
brightness: h(e, n, o),
|
|
15
|
+
value: o
|
|
16
16
|
};
|
|
17
17
|
}), c = ({
|
|
18
18
|
actions: r,
|
|
19
19
|
isDisabled: s,
|
|
20
20
|
selectedData: t,
|
|
21
|
-
selectionCallback:
|
|
21
|
+
selectionCallback: e,
|
|
22
22
|
canvas: n
|
|
23
23
|
}) => {
|
|
24
|
-
const { t:
|
|
24
|
+
const { t: o } = p(), { name: m, filters: u } = t, a = s || !x(t);
|
|
25
25
|
return /* @__PURE__ */ l(A, { children: r.map((i) => {
|
|
26
26
|
switch (i) {
|
|
27
27
|
case "reset":
|
|
@@ -29,7 +29,7 @@ const b = (r) => r.map((s) => {
|
|
|
29
29
|
f,
|
|
30
30
|
{
|
|
31
31
|
isDisabled: a,
|
|
32
|
-
onResetCallback: () =>
|
|
32
|
+
onResetCallback: () => e && e({
|
|
33
33
|
...t,
|
|
34
34
|
filters: b(u)
|
|
35
35
|
})
|
|
@@ -43,7 +43,7 @@ const b = (r) => r.map((s) => {
|
|
|
43
43
|
isDisabled: a,
|
|
44
44
|
canvas: n,
|
|
45
45
|
filename: m,
|
|
46
|
-
children:
|
|
46
|
+
children: o("colorTool.actions.export")
|
|
47
47
|
},
|
|
48
48
|
i
|
|
49
49
|
);
|
|
@@ -55,7 +55,7 @@ const b = (r) => r.map((s) => {
|
|
|
55
55
|
}) });
|
|
56
56
|
};
|
|
57
57
|
c.displayName = "Widgets.ColorTool.Actions";
|
|
58
|
-
const
|
|
58
|
+
const j = c;
|
|
59
59
|
export {
|
|
60
|
-
|
|
60
|
+
j as default
|
|
61
61
|
};
|
|
@@ -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"),m=require("react"),I=require("../lib/utils.cjs"),j=require("../hooks/useFilteredImages.cjs"),R=require("../lib/canvas.cjs"),r=require("./styles.cjs"),g=m.forwardRef(({filters:c,width:e=600,height:s=600,selectedObjectName:i,className:d,children:p,isDisplayOnly:v,images:x},o)=>{var u;const[y,C]=m.useState(i),l=I.isFilterActive(c);i!==y&&C(i);const[q,t]=j.default({images:x,filters:c}),n=(u=o==null?void 0:o.current)==null?void 0:u.getContext("2d");return n&&(n.clearRect(0,0,e,s),R.mergeCanvases(n,q,e,s)),a.jsxs(r.ImageContainer,{style:{aspectRatio:`${e} / ${s}`,maxWidth:v?`${e}px`:void 0,"--image-container-opacity":!t&&l?1:.1},className:d,children:[t&&l&&a.jsx(r.Loader,{isVisible:t}),a.jsx(r.Image,{style:{"--loading-opacity":t?0:1},ref:o,role:"img",hidden:t,width:e,height:s}),p]})});g.displayName="Widgets.ColorTool.ImageComposite";const $=g;exports.default=$;
|