@rubin-epo/epo-widget-lib 0.8.1 → 0.9.1
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/SourceSelector.cjs +1 -1
- package/dist/SourceSelector.d.ts +2 -0
- package/dist/SourceSelector.js +8 -8
- package/dist/SupernovaThreeVector.js +4 -4
- 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.d.ts +3 -5
- package/dist/charts/Base/index.js +40 -24
- package/dist/charts/Base/styles.cjs +18 -7
- package/dist/charts/Base/styles.d.ts +272 -0
- package/dist/charts/Base/styles.js +18 -6
- 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 +20 -22
- package/dist/charts/Tooltip/styles.cjs +5 -3
- package/dist/charts/Tooltip/styles.d.ts +7 -0
- package/dist/charts/Tooltip/styles.js +9 -5
- 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.d.ts +2 -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 +30 -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 +33 -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 +11 -0
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/index.js +54 -0
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/styles.cjs +42 -0
- package/dist/widgets/LightCurvePlot/MagnitudeSlider/styles.js +51 -0
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.cjs +1 -0
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.d.ts +13 -0
- package/dist/widgets/LightCurvePlot/PlotWithCurve/index.js +134 -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 +9 -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 +11 -0
- package/dist/widgets/LightCurvePlot/ScatterPlot/index.js +158 -0
- package/dist/widgets/LightCurvePlot/ScatterPlot/styles.cjs +30 -0
- package/dist/widgets/LightCurvePlot/ScatterPlot/styles.d.ts +288 -0
- package/dist/widgets/LightCurvePlot/ScatterPlot/styles.js +38 -0
- package/dist/widgets/LightCurvePlot/defaults.cjs +1 -0
- package/dist/widgets/LightCurvePlot/defaults.d.ts +19 -0
- package/dist/widgets/LightCurvePlot/defaults.js +21 -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/SourceSelector/SourceSelector.cjs +1 -1
- package/dist/widgets/SourceSelector/SourceSelector.d.ts +2 -2
- package/dist/widgets/SourceSelector/SourceSelector.js +28 -28
- package/dist/widgets/SourceSelector/index.d.ts +2 -1
- package/dist/widgets/SupernovaThreeVector/Histogram/index.cjs +1 -1
- package/dist/widgets/SupernovaThreeVector/Histogram/index.js +35 -35
- package/dist/widgets/SupernovaThreeVector/LiveLabel/index.cjs +1 -1
- package/dist/widgets/SupernovaThreeVector/LiveLabel/index.js +15 -15
- 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,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
|
+
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
|
};
|
|
@@ -100,5 +100,35 @@
|
|
|
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}}."
|
|
102
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}}"
|
|
132
|
+
}
|
|
103
133
|
}
|
|
104
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=$;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ImageFilter } from "../ColorTool";
|
|
3
|
+
import { ImageShape } from "@rubin-epo/epo-react-lib/Image";
|
|
3
4
|
interface ImageCompositeProps {
|
|
4
5
|
filters: ImageFilter[];
|
|
6
|
+
images: Array<ImageShape>;
|
|
5
7
|
width: number;
|
|
6
8
|
height: number;
|
|
7
9
|
selectedObjectName: string;
|
|
10
|
+
isDisplayOnly?: boolean;
|
|
8
11
|
className?: string;
|
|
9
12
|
}
|
|
10
13
|
declare const ImageComposite: import("react").ForwardRefExoticComponent<ImageCompositeProps & {
|
|
@@ -1,82 +1,58 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const C = j(
|
|
2
|
+
import { jsxs as y, jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as I, useState as f } from "react";
|
|
4
|
+
import { isFilterActive as $ } from "../lib/utils.js";
|
|
5
|
+
import A from "../hooks/useFilteredImages.js";
|
|
6
|
+
import { mergeCanvases as R } from "../lib/canvas.js";
|
|
7
|
+
import { ImageContainer as j, Loader as F, Image as W } from "./styles.js";
|
|
8
|
+
const p = I(
|
|
10
9
|
({
|
|
11
|
-
filters:
|
|
12
|
-
width:
|
|
13
|
-
height:
|
|
14
|
-
selectedObjectName:
|
|
15
|
-
className:
|
|
16
|
-
children:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
filters: r,
|
|
11
|
+
width: o = 600,
|
|
12
|
+
height: e = 600,
|
|
13
|
+
selectedObjectName: s,
|
|
14
|
+
className: l,
|
|
15
|
+
children: g,
|
|
16
|
+
isDisplayOnly: d,
|
|
17
|
+
images: x
|
|
18
|
+
}, i) => {
|
|
19
|
+
var n;
|
|
20
|
+
const [C, u] = f(s), a = $(r);
|
|
21
|
+
s !== C && u(s);
|
|
22
|
+
const [v, t] = A({
|
|
23
|
+
images: x,
|
|
24
|
+
filters: r
|
|
25
|
+
}), m = (n = i == null ? void 0 : i.current) == null ? void 0 : n.getContext("2d");
|
|
26
|
+
return m && (m.clearRect(0, 0, o, e), R(m, v, o, e)), /* @__PURE__ */ y(
|
|
27
|
+
j,
|
|
28
28
|
{
|
|
29
|
-
className: f,
|
|
30
29
|
style: {
|
|
31
|
-
|
|
30
|
+
aspectRatio: `${o} / ${e}`,
|
|
31
|
+
maxWidth: d ? `${o}px` : void 0,
|
|
32
|
+
"--image-container-opacity": !t && a ? 1 : 0.1
|
|
32
33
|
},
|
|
34
|
+
className: l,
|
|
33
35
|
children: [
|
|
34
|
-
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
|
|
36
|
+
t && a && /* @__PURE__ */ c(F, { isVisible: t }),
|
|
37
|
+
/* @__PURE__ */ c(
|
|
38
|
+
W,
|
|
37
39
|
{
|
|
38
|
-
style: { "--loading-opacity":
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
onChangeCallback: (R) => v(a, R),
|
|
46
|
-
url: k,
|
|
47
|
-
color: x,
|
|
48
|
-
width: s,
|
|
49
|
-
height: i,
|
|
50
|
-
filters: {
|
|
51
|
-
brightness: A,
|
|
52
|
-
contrast: 1.3
|
|
53
|
-
},
|
|
54
|
-
onLoadCallback: h
|
|
55
|
-
},
|
|
56
|
-
F
|
|
57
|
-
);
|
|
58
|
-
}),
|
|
59
|
-
/* @__PURE__ */ n(
|
|
60
|
-
$,
|
|
61
|
-
{
|
|
62
|
-
layers: l.current,
|
|
63
|
-
renderLayers: o.map(({ active: e }) => e),
|
|
64
|
-
width: s,
|
|
65
|
-
height: i,
|
|
66
|
-
ref: y
|
|
67
|
-
}
|
|
68
|
-
)
|
|
69
|
-
]
|
|
40
|
+
style: { "--loading-opacity": t ? 0 : 1 },
|
|
41
|
+
ref: i,
|
|
42
|
+
role: "img",
|
|
43
|
+
hidden: t,
|
|
44
|
+
width: o,
|
|
45
|
+
height: e
|
|
70
46
|
}
|
|
71
47
|
),
|
|
72
|
-
|
|
48
|
+
g
|
|
73
49
|
]
|
|
74
50
|
}
|
|
75
51
|
);
|
|
76
52
|
}
|
|
77
53
|
);
|
|
78
|
-
|
|
79
|
-
const
|
|
54
|
+
p.displayName = "Widgets.ColorTool.ImageComposite";
|
|
55
|
+
const V = p;
|
|
80
56
|
export {
|
|
81
|
-
|
|
57
|
+
V as default
|
|
82
58
|
};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("styled-components"),i=require("@rubin-epo/epo-react-lib/CircularLoader"),t=e=>e&&e.__esModule?e:{default:e},a=t(o),r=t(i),n=a.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: center;
|
|
4
4
|
align-items: center;
|
|
5
5
|
position: relative;
|
|
6
|
-
aspect-ratio: 1 / 1;
|
|
7
6
|
grid-area: image;
|
|
8
7
|
background-color: rgba(0, 0, 0, var(--image-container-opacity, 0.1));
|
|
9
8
|
transition: background-color ease var(--DURATION, 0.2s);
|
|
10
|
-
`,n=e.default.div`
|
|
11
9
|
width: 100%;
|
|
12
|
-
|
|
10
|
+
`,s=a.default.canvas`
|
|
13
11
|
opacity: var(--loading-opacity, 0);
|
|
14
12
|
transition: opacity ease var(--DURATION_SLOW, 0.4s);
|
|
13
|
+
width: 100%;
|
|
14
|
+
`,c=a.default(r.default)`
|
|
15
15
|
position: absolute;
|
|
16
|
-
|
|
17
|
-
left: 0;
|
|
18
|
-
`;exports.ImageContainer=o;exports.LoadingContainer=n;
|
|
16
|
+
`;exports.Image=s;exports.ImageContainer=n;exports.Loader=c;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import a from "styled-components";
|
|
3
|
+
import o from "@rubin-epo/epo-react-lib/CircularLoader";
|
|
4
|
+
const e = a.div`
|
|
4
5
|
display: flex;
|
|
5
6
|
justify-content: center;
|
|
6
7
|
align-items: center;
|
|
7
8
|
position: relative;
|
|
8
|
-
aspect-ratio: 1 / 1;
|
|
9
9
|
grid-area: image;
|
|
10
10
|
background-color: rgba(0, 0, 0, var(--image-container-opacity, 0.1));
|
|
11
11
|
transition: background-color ease var(--DURATION, 0.2s);
|
|
12
|
-
`, o = t.div`
|
|
13
12
|
width: 100%;
|
|
14
|
-
|
|
13
|
+
`, r = a.canvas`
|
|
15
14
|
opacity: var(--loading-opacity, 0);
|
|
16
15
|
transition: opacity ease var(--DURATION_SLOW, 0.4s);
|
|
16
|
+
width: 100%;
|
|
17
|
+
`, n = a(o)`
|
|
17
18
|
position: absolute;
|
|
18
|
-
top: 0;
|
|
19
|
-
left: 0;
|
|
20
19
|
`;
|
|
21
20
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
r as Image,
|
|
22
|
+
e as ImageContainer,
|
|
23
|
+
n as Loader
|
|
24
24
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react"),_=require("lodash/isEqual"),q=require("../../../hooks/usePrevious.cjs"),f=require("../lib/canvas.cjs"),w=t=>t&&t.__esModule?t:{default:t},S=w(_),b=({images:t,filters:i})=>{const g=q.default(t),[v,d]=l.useState(0),[n,m]=l.useState(),I=n==null?void 0:n.some(({complete:s})=>!s),u=v!==t.length&&I;return l.useLayoutEffect(()=>{S.default(g,t)||(d(0),m(t.map(({url:s,width:o,height:c})=>{const e=new Image(o,c);return e.onload=()=>{d(a=>a+1)},e.src=s,e})))},[t]),u?[[],!!u]:[[...n||[]].map((s,o)=>{if(!i[o].active)return;const c=document.createElement("canvas"),e=c.getContext("2d");if(e){const{width:a,height:r}=s,{color:h="transparent",brightness:p}=i[o];e.canvas.width=a,e.canvas.height=r,e.clearRect(0,0,a,r),e.filter=f.getFilters({brightness:p,contrast:1.3}),e.drawImage(s,0,0,a,r),f.updateColor(e,h,a,r)}return c}).filter(s=>!!s),!!u]},y=b;exports.default=y;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ImageShape } from "@rubin-epo/epo-react-lib/Image";
|
|
2
|
+
import { ImageFilter } from "../ColorTool";
|
|
3
|
+
interface useFilteredImagesProps {
|
|
4
|
+
images: Array<ImageShape>;
|
|
5
|
+
filters: Array<ImageFilter>;
|
|
6
|
+
}
|
|
7
|
+
declare const useFilteredImages: ({ images, filters, }: useFilteredImagesProps) => [Array<HTMLCanvasElement>, boolean];
|
|
8
|
+
export default useFilteredImages;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as d, useLayoutEffect as h } from "react";
|
|
3
|
+
import w from "lodash/isEqual";
|
|
4
|
+
import x from "../../../hooks/usePrevious.js";
|
|
5
|
+
import { getFilters as F, updateColor as L } from "../lib/canvas.js";
|
|
6
|
+
const y = ({
|
|
7
|
+
images: s,
|
|
8
|
+
filters: u
|
|
9
|
+
}) => {
|
|
10
|
+
const l = x(s), [f, m] = d(0), [a, g] = d(), p = a == null ? void 0 : a.some(({ complete: e }) => !e), i = f !== s.length && p;
|
|
11
|
+
return h(() => {
|
|
12
|
+
w(l, s) || (m(0), g(
|
|
13
|
+
s.map(({ url: e, width: n, height: r }) => {
|
|
14
|
+
const t = new Image(n, r);
|
|
15
|
+
return t.onload = () => {
|
|
16
|
+
m((o) => o + 1);
|
|
17
|
+
}, t.src = e, t;
|
|
18
|
+
})
|
|
19
|
+
));
|
|
20
|
+
}, [s]), i ? [[], !!i] : [[...a || []].map((e, n) => {
|
|
21
|
+
if (!u[n].active)
|
|
22
|
+
return;
|
|
23
|
+
const r = document.createElement("canvas"), t = r.getContext("2d");
|
|
24
|
+
if (t) {
|
|
25
|
+
const { width: o, height: c } = e, { color: v = "transparent", brightness: I } = u[n];
|
|
26
|
+
t.canvas.width = o, t.canvas.height = c, t.clearRect(0, 0, o, c), t.filter = F({ brightness: I, contrast: 1.3 }), t.drawImage(e, 0, 0, o, c), L(t, v, o, c);
|
|
27
|
+
}
|
|
28
|
+
return r;
|
|
29
|
+
}).filter((e) => !!e), !!i];
|
|
30
|
+
}, R = y;
|
|
31
|
+
export {
|
|
32
|
+
R as default
|
|
33
|
+
};
|