@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.
Files changed (120) hide show
  1. package/dist/Charts.cjs +1 -1
  2. package/dist/Charts.js +12 -8
  3. package/dist/ColorTool.cjs +1 -1
  4. package/dist/ColorTool.js +62 -59
  5. package/dist/LightCurvePlot.cjs +1 -0
  6. package/dist/LightCurvePlot.d.ts +1 -0
  7. package/dist/LightCurvePlot.js +6 -0
  8. package/dist/SupernovaThreeVector.cjs +1 -1
  9. package/dist/SupernovaThreeVector.js +71 -65
  10. package/dist/atomic/Button/patterns/Reset.js +9 -9
  11. package/dist/atomic/LiveRegion/index.cjs +1 -0
  12. package/dist/atomic/LiveRegion/index.d.ts +5 -0
  13. package/dist/atomic/LiveRegion/index.js +10 -0
  14. package/dist/charts/Base/index.cjs +1 -1
  15. package/dist/charts/Base/index.js +37 -23
  16. package/dist/charts/Base/styles.cjs +5 -2
  17. package/dist/charts/Base/styles.js +7 -4
  18. package/dist/charts/ForeignObject/index.cjs +1 -0
  19. package/dist/charts/ForeignObject/index.d.ts +5 -0
  20. package/dist/charts/ForeignObject/index.js +18 -0
  21. package/dist/charts/Tooltip/index.cjs +1 -1
  22. package/dist/charts/Tooltip/index.d.ts +2 -2
  23. package/dist/charts/Tooltip/index.js +23 -24
  24. package/dist/charts/Viewport/index.cjs +1 -0
  25. package/dist/charts/Viewport/index.d.ts +11 -0
  26. package/dist/charts/Viewport/index.js +26 -0
  27. package/dist/charts/XAxis/index.cjs +1 -1
  28. package/dist/charts/XAxis/index.js +21 -21
  29. package/dist/charts/YAxis/index.cjs +1 -1
  30. package/dist/charts/YAxis/index.js +19 -19
  31. package/dist/charts/hooks/useAxis.cjs +1 -0
  32. package/dist/charts/hooks/useAxis.d.ts +16 -0
  33. package/dist/charts/hooks/useAxis.js +29 -0
  34. package/dist/charts/index.d.ts +2 -0
  35. package/dist/hooks/usePrevious.cjs +1 -0
  36. package/dist/hooks/usePrevious.d.ts +1 -0
  37. package/dist/hooks/usePrevious.js +11 -0
  38. package/dist/lib/helpers.cjs +1 -0
  39. package/dist/lib/helpers.d.ts +2 -0
  40. package/dist/lib/helpers.js +4 -0
  41. package/dist/lib/helpers.test.d.ts +1 -0
  42. package/dist/lib/utils.cjs +1 -1
  43. package/dist/lib/utils.d.ts +5 -1
  44. package/dist/lib/utils.js +17 -12
  45. package/dist/localeStrings/en/epo-widget-lib.json +32 -0
  46. package/dist/widgets/ColorTool/Actions/index.js +9 -9
  47. package/dist/widgets/ColorTool/ImageComposite/ImageComposite.cjs +1 -1
  48. package/dist/widgets/ColorTool/ImageComposite/ImageComposite.d.ts +3 -0
  49. package/dist/widgets/ColorTool/ImageComposite/ImageComposite.js +42 -66
  50. package/dist/widgets/ColorTool/ImageComposite/styles.cjs +5 -7
  51. package/dist/widgets/ColorTool/ImageComposite/styles.js +9 -9
  52. package/dist/widgets/ColorTool/hooks/useFilteredImages.cjs +1 -0
  53. package/dist/widgets/ColorTool/hooks/useFilteredImages.d.ts +8 -0
  54. package/dist/widgets/ColorTool/hooks/useFilteredImages.js +36 -0
  55. package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/index.cjs +1 -0
  56. package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/index.d.ts +11 -0
  57. package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/index.js +38 -0
  58. package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/styles.cjs +9 -0
  59. package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/styles.d.ts +275 -0
  60. package/dist/widgets/LightCurvePlot/A11Y/LightCurveLabel/styles.js +14 -0
  61. package/dist/widgets/LightCurvePlot/DM15Display/index.cjs +1 -0
  62. package/dist/widgets/LightCurvePlot/DM15Display/index.d.ts +15 -0
  63. package/dist/widgets/LightCurvePlot/DM15Display/index.js +40 -0
  64. package/dist/widgets/LightCurvePlot/DM15Display/styles.cjs +12 -0
  65. package/dist/widgets/{ColorTool/ImageComposite → LightCurvePlot/DM15Display}/styles.d.ts +2 -2
  66. package/dist/widgets/LightCurvePlot/DM15Display/styles.js +18 -0
  67. package/dist/widgets/LightCurvePlot/LightCurve/index.cjs +1 -0
  68. package/dist/widgets/LightCurvePlot/LightCurve/index.d.ts +12 -0
  69. package/dist/widgets/LightCurvePlot/LightCurve/index.js +29 -0
  70. package/dist/widgets/LightCurvePlot/MagnitudeSlider/index.cjs +1 -0
  71. package/dist/widgets/LightCurvePlot/MagnitudeSlider/index.d.ts +10 -0
  72. package/dist/widgets/LightCurvePlot/MagnitudeSlider/index.js +52 -0
  73. package/dist/widgets/LightCurvePlot/MagnitudeSlider/styles.cjs +37 -0
  74. package/dist/widgets/LightCurvePlot/MagnitudeSlider/styles.js +46 -0
  75. package/dist/widgets/LightCurvePlot/PlotWithCurve/index.cjs +1 -0
  76. package/dist/widgets/LightCurvePlot/PlotWithCurve/index.d.ts +12 -0
  77. package/dist/widgets/LightCurvePlot/PlotWithCurve/index.js +132 -0
  78. package/dist/widgets/LightCurvePlot/PlotWithCurve/styles.cjs +29 -0
  79. package/dist/widgets/LightCurvePlot/PlotWithCurve/styles.d.ts +1378 -0
  80. package/dist/widgets/LightCurvePlot/PlotWithCurve/styles.js +41 -0
  81. package/dist/widgets/LightCurvePlot/PlotWithoutCurve/index.cjs +1 -0
  82. package/dist/widgets/LightCurvePlot/PlotWithoutCurve/index.d.ts +15 -0
  83. package/dist/widgets/LightCurvePlot/PlotWithoutCurve/index.js +20 -0
  84. package/dist/widgets/LightCurvePlot/Point/index.cjs +1 -0
  85. package/dist/widgets/LightCurvePlot/Point/index.d.ts +11 -0
  86. package/dist/widgets/LightCurvePlot/Point/index.js +68 -0
  87. package/dist/widgets/LightCurvePlot/ScatterPlot/index.cjs +1 -0
  88. package/dist/widgets/LightCurvePlot/ScatterPlot/index.d.ts +13 -0
  89. package/dist/widgets/LightCurvePlot/ScatterPlot/index.js +163 -0
  90. package/dist/widgets/LightCurvePlot/ScatterPlot/styles.cjs +31 -0
  91. package/dist/widgets/LightCurvePlot/ScatterPlot/styles.d.ts +557 -0
  92. package/dist/widgets/LightCurvePlot/ScatterPlot/styles.js +40 -0
  93. package/dist/widgets/LightCurvePlot/defaults.cjs +1 -0
  94. package/dist/widgets/LightCurvePlot/defaults.d.ts +17 -0
  95. package/dist/widgets/LightCurvePlot/defaults.js +19 -0
  96. package/dist/widgets/LightCurvePlot/helpers.cjs +1 -0
  97. package/dist/widgets/LightCurvePlot/helpers.d.ts +23 -0
  98. package/dist/widgets/LightCurvePlot/helpers.js +23 -0
  99. package/dist/widgets/LightCurvePlot/helpers.test.d.ts +1 -0
  100. package/dist/widgets/LightCurvePlot/index.d.ts +2 -0
  101. package/dist/widgets/SupernovaThreeVector/LiveLabel/index.cjs +1 -1
  102. package/dist/widgets/SupernovaThreeVector/LiveLabel/index.js +15 -15
  103. package/dist/widgets/SupernovaThreeVector/styles.cjs +30 -20
  104. package/dist/widgets/SupernovaThreeVector/styles.js +29 -18
  105. package/package.json +2 -1
  106. package/dist/hooks/useImage.cjs +0 -1
  107. package/dist/hooks/useImage.d.ts +0 -10
  108. package/dist/hooks/useImage.js +0 -31
  109. package/dist/widgets/ColorTool/CompositeRender/index.cjs +0 -1
  110. package/dist/widgets/ColorTool/CompositeRender/index.d.ts +0 -9
  111. package/dist/widgets/ColorTool/CompositeRender/index.js +0 -16
  112. package/dist/widgets/ColorTool/CompositeRender/styles.cjs +0 -3
  113. package/dist/widgets/ColorTool/CompositeRender/styles.d.ts +0 -274
  114. package/dist/widgets/ColorTool/CompositeRender/styles.js +0 -8
  115. package/dist/widgets/ColorTool/OffscreenFilter/index.cjs +0 -1
  116. package/dist/widgets/ColorTool/OffscreenFilter/index.d.ts +0 -15
  117. package/dist/widgets/ColorTool/OffscreenFilter/index.js +0 -27
  118. /package/dist/{widgets/SupernovaThreeVector/LiveLabel → atomic/LiveRegion}/styles.cjs +0 -0
  119. /package/dist/{widgets/SupernovaThreeVector/LiveLabel → atomic/LiveRegion}/styles.d.ts +0 -0
  120. /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 a = e.div`
3
+ const t = e.div`
4
+ --label-gutter: 2em;
5
+
4
6
  display: grid;
5
- grid-template-columns: min-content 1fr;
6
- grid-template-rows: 1fr min-content;
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
- a as ChartContainer,
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,5 @@
1
+ import { FunctionComponent, PropsWithChildren } from "react";
2
+ declare const ForeignObject: FunctionComponent<PropsWithChildren<{
3
+ className?: string;
4
+ }>>;
5
+ export default ForeignObject;
@@ -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 o=require("react/jsx-runtime"),u=require("./styles.cjs"),m=(e,t)=>e.includes("left")?`calc(0% + ${t}px)`:e.includes("right")?`calc(-100% - ${t}px)`:(e.includes("center"),"-50%"),w=(e,t)=>e.includes("top")?`calc(0% + ${t}px)`:e.includes("bottom")?`calc(-100% - ${t}px)`:(e.includes("center"),"-50%"),y=e=>{let t="0",r="0",n="0",l="0",s="0deg";return e.includes("center")&&(t="50%",r="50%",n="-50%",l="-50%"),e.includes("top")&&(r="0",l="-100%",s="180deg"),e.includes("right")&&(t="100%",n="-25%",s="-90deg"),e.includes("left")&&(t="0",n="-75%",s="90deg"),e.includes("bottom")&&(r="100%",l="0"),{left:t,top:r,transform:`translate(${n}, ${l}) rotate(${s})`}},d=({x:e,y:t,visible:r=!0,offset:n=5,origin:l="center bottom",children:s,className:a})=>{if(typeof e>"u"||typeof t>"u")return null;const f="center center",c=[...l.split(" "),...f.split(" ")].slice(0,2).join(" "),i=6,p=m(c,i+n),$=w(c,i+n),h=c.includes("center")&&c.split(" ").filter(g=>g!=="center").length===1,x=y(c);return o.jsx("foreignObject",{x:0,y:0,width:"100%",height:"100%",pointerEvents:"none",children:o.jsxs(u.Tooltip,{className:a,style:{transform:`translate(calc(${p} + ${e}px), calc(${$} + ${t}px))`},hidden:!r,children:[s,h&&o.jsx(u.Arrow,{style:{"--arrow-size":`${i}px`,...x}})]})})};d.displayName="Charts.Tooltip";const O=d;exports.default=O;
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,7 +1,7 @@
1
1
  import { FunctionComponent, PropsWithChildren } from "react";
2
2
  export interface TooltipProps {
3
- x: number;
4
- y: number;
3
+ x?: number;
4
+ y?: number;
5
5
  visible: boolean;
6
6
  offset?: number;
7
7
  origin?: string;
@@ -1,40 +1,39 @@
1
- import { jsx as i, jsxs as m } from "react/jsx-runtime";
2
- import { Tooltip as w, Arrow as O } from "./styles.js";
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", r = "0", n = "0", l = "0", s = "0deg";
5
- return t.includes("center") && (e = "50%", r = "50%", n = "-50%", l = "-50%"), t.includes("top") && (r = "0", l = "-100%", s = "180deg"), t.includes("right") && (e = "100%", n = "-25%", s = "-90deg"), t.includes("left") && (e = "0", n = "-75%", s = "90deg"), t.includes("bottom") && (r = "100%", l = "0"), {
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: r,
8
- transform: `translate(${n}, ${l}) rotate(${s})`
8
+ top: n,
9
+ transform: `translate(${r}, ${l}) rotate(${c})`
9
10
  };
10
- }, f = ({
11
+ }, a = ({
11
12
  x: t,
12
13
  y: e,
13
- visible: r = !0,
14
- offset: n = 5,
14
+ visible: n = !0,
15
+ offset: r = 5,
15
16
  origin: l = "center bottom",
16
- children: s,
17
+ children: c,
17
18
  className: u
18
19
  }) => {
19
- if (typeof t > "u" || typeof e > "u")
20
- return null;
21
- const d = "center center", c = [...l.split(" "), ...d.split(" ")].slice(0, 2).join(" "), o = 6, a = g(c, o + n), p = y(c, o + n), $ = c.includes("center") && c.split(" ").filter((x) => x !== "center").length === 1, h = T(c);
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(${a} + ${t}px), calc(${p} + ${e}px))`
26
+ transform: `translate(calc(${p} + ${t}px), calc(${d} + ${e}px))`
28
27
  },
29
- hidden: !r,
28
+ hidden: !n,
30
29
  children: [
31
- s,
32
- $ && /* @__PURE__ */ i(
33
- O,
30
+ c,
31
+ m && /* @__PURE__ */ i(
32
+ b,
34
33
  {
35
34
  style: {
36
35
  "--arrow-size": `${o}px`,
37
- ...h
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
- f.displayName = "Charts.Tooltip";
46
- const A = f;
44
+ a.displayName = "Charts.Tooltip";
45
+ const X = a;
47
46
  export {
48
- A as default
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 r=require("react/jsx-runtime"),M=require("d3-array"),o=require("../styles.cjs"),j=({xDomain:e=[0,1],xScale:n=a=>a,y:t=0,ticks:u=0,labelRender:c,labelledById:b,margin:h,tickHeight:d=5,showBaseline:x=!0,className:y})=>{if(e.length<2)return console.error("Failed to render: invalid domain",e),null;const g={...{top:0,right:0,bottom:0,left:0},...h},A=M.ticks(e[0],e[1],u);return r.jsxs(r.Fragment,{children:[x&&r.jsx(o.BaseLine,{x1:n(e[0])-g.left,x2:n(e[1])+g.right,y1:t,y2:t}),u>0&&r.jsx("g",{role:"list","aria-labelledby":b,className:y,children:A.map((s,f)=>{if(s>=e[1])return null;const i=t+d,l=n(s);return r.jsxs("g",{role:"listitem",children:[d>0&&r.jsx(o.Tick,{x1:l,x2:l,y1:t,y2:i}),c?c(s,l,i,f):r.jsx(o.XLabel,{x:l,y:i,children:s})]},f)})})]})};j.displayName="Charts.XAxis";const X=j;exports.default=X;
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 h, Fragment as A, jsx as s } from "react/jsx-runtime";
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 k } from "../styles.js";
4
- const p = ({
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 = (a) => a,
6
+ xScale: i = (c) => c,
7
7
  y: t = 0,
8
- ticks: o = 0,
9
- labelRender: c,
10
- labelledById: u,
11
- margin: m,
8
+ ticks: n = 0,
9
+ labelRender: a,
10
+ labelledById: m,
11
+ margin: y,
12
12
  tickHeight: d = 5,
13
- showBaseline: b = !0,
14
- className: X
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 }, ...m }, y = x(r[0], r[1], o);
19
- return /* @__PURE__ */ h(A, { children: [
20
- b && /* @__PURE__ */ s(
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
- o > 0 && /* @__PURE__ */ s("g", { role: "list", "aria-labelledby": u, className: X, children: y.map((e, g) => {
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 n = t + d, l = i(e);
33
- return /* @__PURE__ */ h("g", { role: "listitem", children: [
34
- d > 0 && /* @__PURE__ */ s(j, { x1: l, x2: l, y1: t, y2: n }),
35
- c ? c(e, l, n, g) : /* @__PURE__ */ s(k, { x: l, y: n, children: e })
36
- ] }, g);
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
- p.displayName = "Charts.XAxis";
41
- const C = p;
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"),M=require("d3-array"),o=require("../styles.cjs"),b=({yDomain:t=[0,1],yScale:l=u=>u,x:r=0,margin:j,ticks:a=0,labelRender:c,labelledById:f,showBaseline:h=!0,tickLength:d=5,className:p})=>{if(t.length<2)return console.error("Failed to render: invalid domain",t),null;const x={...{top:0,right:0,bottom:0,left:0},...j},A=M.ticks(t[0],t[1],a);return e.jsxs(e.Fragment,{children:[h&&e.jsx(o.BaseLine,{x1:r,x2:r,y1:l(t[0])+x.top,y2:l(t[1])-x.bottom}),a>0&&e.jsx("g",{role:"list","aria-labelledby":f,className:p,children:A.map((i,g)=>{const s=l(i),n=r-d;return e.jsxs("g",{role:"listitem",children:[d>0&&e.jsx(o.Tick,{x1:n,x2:r,y1:s,y2:s}),c?c(i,n,s,g):e.jsx(o.YLabel,{x:n,y:s,children:i})]},g)})})]})};b.displayName="Charts.YAxis";const Y=b;exports.default=Y;
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 A, jsx as e } from "react/jsx-runtime";
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 k, YLabel as F } from "../styles.js";
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: i = (d) => d,
6
+ yScale: l = (c) => c,
7
7
  x: t = 0,
8
- margin: g,
9
- ticks: n = 0,
8
+ margin: h,
9
+ ticks: i = 0,
10
10
  labelRender: a,
11
11
  labelledById: b,
12
- showBaseline: h = !0,
13
- tickLength: c = 5,
14
- className: u
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 }, ...g }, Y = M(r[0], r[1], n);
19
- return /* @__PURE__ */ p(A, { children: [
20
- h && /* @__PURE__ */ e(
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: i(r[0]) + f.top,
26
- y2: i(r[1]) - f.bottom
25
+ y1: l(r[0]) + f.top,
26
+ y2: l(r[1]) - f.bottom
27
27
  }
28
28
  ),
29
- n > 0 && /* @__PURE__ */ e("g", { role: "list", "aria-labelledby": b, className: u, children: Y.map((l, m) => {
30
- const s = i(l), o = t - c;
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
- c > 0 && /* @__PURE__ */ e(k, { x1: o, x2: t, y1: s, y2: s }),
33
- a ? a(l, o, s, m) : /* @__PURE__ */ e(F, { x: o, y: s, children: l })
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 N = x;
39
+ const L = x;
40
40
  export {
41
- N as default
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
+ };
@@ -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,11 @@
1
+ "use client";
2
+ import { useRef as t, useEffect as u } from "react";
3
+ function n(e) {
4
+ const r = t();
5
+ return u(() => {
6
+ r.current = e;
7
+ }, [e]), r.current;
8
+ }
9
+ export {
10
+ n as default
11
+ };
@@ -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,2 @@
1
+ export declare const timestampFromMJD: (mjd: number) => number;
2
+ export declare const mjdFromTimestamp: (timestamp: number, pre?: number) => number;
@@ -0,0 +1,4 @@
1
+ const e = (t) => (t - 40587) * 864e5;
2
+ export {
3
+ e as timestampFromMJD
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=(t,e)=>{switch(!0){case t>e:return 0;case t<0:return e;default:return t}},i=(t,e,r)=>t>=e&&t<=r,l=(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]]},o=(t=[0,1],e=[0,1],r=!1)=>n=>{const s=t[1]-t[0];if(s===0)return(e[0]+e[1])/2;let c=(n-t[0])/s;return r&&(c=Math.min(Math.max(c,0),1)),c*(e[1]-e[0])+e[0]};exports.between=i;exports.getClampedArrayIndex=u;exports.getLinearScale=o;exports.intersection=l;
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;
@@ -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[], clamp?: boolean) => (domainValue: number) => 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 u = (t, e) => {
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
- }, o = (t, e, r) => t >= e && t <= r, l = (t = [], e = []) => {
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
- }, f = (t = [0, 1], e = [0, 1], r = !1) => (n) => {
14
- const s = t[1] - t[0];
15
- if (s === 0)
16
- return (e[0] + e[1]) / 2;
17
- let c = (n - t[0]) / s;
18
- return r && (c = Math.min(Math.max(c, 0), 1)), c * (e[1] - e[0]) + e[0];
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
- o as between,
22
- u as getClampedArrayIndex,
23
- f as getLinearScale,
24
- l as intersection
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: o, max: n } = s, e = t || 1;
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(o, n, e),
15
- value: e
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: o,
21
+ selectionCallback: e,
22
22
  canvas: n
23
23
  }) => {
24
- const { t: e } = p(), { name: m, filters: u } = t, a = s || !x(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: () => o && o({
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: e("colorTool.actions.export")
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 $ = c;
58
+ const j = c;
59
59
  export {
60
- $ as default
60
+ j as default
61
61
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),o=require("react"),k=require("@rubin-epo/epo-react-lib/CircularLoader"),A=require("../OffscreenFilter/index.cjs"),m=require("./styles.cjs"),F=require("../lib/utils.cjs"),M=require("../CompositeRender/index.cjs"),R=e=>e&&e.__esModule?e:{default:e},D=R(k),C=o.forwardRef(({filters:e,width:i=600,height:l=600,selectedObjectName:r,className:p,children:y},b)=>{const c=o.useRef([]),[f,x]=o.useState(r),[a,u]=o.useState(0),d=F.isFilterActive(e),L=e.filter(t=>!t.isDisabled).length,g=a<L;r!==f&&(x(r),u(0));const j=o.useCallback(()=>u(t=>t+1),[a,e]),q=(t,n)=>{c.current[t]=n};return s.jsxs(m.ImageContainer,{className:p,style:{"--image-container-opacity":a&&d?1:.1},children:[!a&&d&&s.jsx(D.default,{isVisible:g}),s.jsxs(m.LoadingContainer,{style:{"--loading-opacity":g?0:1},children:[e&&e.map((t,n)=>{const{label:_,image:v,color:I,brightness:h}=t;return s.jsx(A.default,{onChangeCallback:S=>q(n,S),url:v,color:I,width:i,height:l,filters:{brightness:h,contrast:1.3},onLoadCallback:j},_)}),s.jsx(M.default,{layers:c.current,renderLayers:e.map(({active:t})=>t),width:i,height:l,ref:b})]}),y]})});C.displayName="Widgets.ColorTool.ImageComposite";const P=C;exports.default=P;
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=$;