@rubin-epo/epo-widget-lib 0.10.4 → 1.0.0-beta.2

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 (33) hide show
  1. package/dist/IsochronePlot.js +7 -7
  2. package/dist/SupernovaThreeVector.cjs +1 -1
  3. package/dist/SupernovaThreeVector.js +66 -66
  4. package/dist/atomic/Blinker/Blinker.cjs +1 -1
  5. package/dist/atomic/Blinker/Blinker.d.ts +2 -1
  6. package/dist/atomic/Blinker/Blinker.js +43 -41
  7. package/dist/charts/Base/styles.cjs +5 -3
  8. package/dist/charts/Base/styles.js +12 -10
  9. package/dist/charts/Readout/index.cjs +1 -1
  10. package/dist/charts/Readout/index.js +6 -5
  11. package/dist/charts/ScatterPlot/index.cjs +1 -1
  12. package/dist/charts/ScatterPlot/index.js +77 -77
  13. package/dist/charts/ScatterPlot/styles.cjs +3 -4
  14. package/dist/charts/ScatterPlot/styles.js +5 -6
  15. package/dist/lib/utils.cjs +1 -1
  16. package/dist/lib/utils.js +18 -16
  17. package/dist/localeStrings/en/epo-widget-lib.json +6 -6
  18. package/dist/widgets/LightCurvePlot/Plot/index.cjs +1 -1
  19. package/dist/widgets/LightCurvePlot/Plot/index.js +53 -68
  20. package/dist/widgets/LightCurvePlot/PlotWithCurve/MagnitudeSlider/index.cjs +1 -1
  21. package/dist/widgets/LightCurvePlot/PlotWithCurve/MagnitudeSlider/index.js +1 -1
  22. package/dist/widgets/LightCurvePlot/PlotWithCurve/index.cjs +1 -1
  23. package/dist/widgets/LightCurvePlot/PlotWithCurve/index.js +94 -80
  24. package/dist/widgets/SourceSelector/SourceSelector.cjs +1 -1
  25. package/dist/widgets/SourceSelector/SourceSelector.js +37 -39
  26. package/dist/widgets/SourceSelector/styles.d.ts +1 -0
  27. package/dist/widgets/SupernovaThreeVector/Histogram/index.cjs +1 -1
  28. package/dist/widgets/SupernovaThreeVector/Histogram/index.js +43 -43
  29. package/dist/widgets/SupernovaThreeVector/Skymap/index.cjs +1 -1
  30. package/dist/widgets/SupernovaThreeVector/Skymap/index.js +3 -2
  31. package/dist/widgets/SupernovaThreeVector/styles.cjs +6 -7
  32. package/dist/widgets/SupernovaThreeVector/styles.js +11 -12
  33. package/package.json +1 -1
@@ -1,130 +1,131 @@
1
1
  "use client";
2
- import { jsxs as u, jsx as i } from "react/jsx-runtime";
3
- import { useState as J } from "react";
4
- import K from "../XAxis/index.js";
5
- import Q from "../YAxis/index.js";
2
+ import { jsxs as u, jsx as s } from "react/jsx-runtime";
3
+ import { useState as F } from "react";
4
+ import J from "../XAxis/index.js";
5
+ import K from "../YAxis/index.js";
6
6
  import R from "../Guidelines/index.js";
7
- import U from "../Points/index.js";
8
- import V from "../Tooltip/index.js";
9
- import Z from "../ClippingContainer/index.js";
10
- import B from "../hooks/useAxis.js";
11
- import { Chart as _ } from "./styles.js";
12
- import D from "../defaults.js";
13
- import $ from "../canvas/Points/index.js";
7
+ import Q from "../Points/index.js";
8
+ import U from "../Tooltip/index.js";
9
+ import V from "../ClippingContainer/index.js";
10
+ import D from "../hooks/useAxis.js";
11
+ import { Chart as Z } from "./styles.js";
12
+ import T from "../defaults.js";
13
+ import _ from "../canvas/Points/index.js";
14
+ import { isSafari as $ } from "../../lib/utils.js";
14
15
  const w = {
15
- svg: U,
16
- canvas: $
17
- }, T = ({
16
+ svg: Q,
17
+ canvas: _
18
+ }, tt = ({
18
19
  data: j,
19
20
  className: z,
20
- xAxis: c,
21
- yAxis: l,
21
+ xAxis: l,
22
+ yAxis: c,
22
23
  width: d,
23
24
  height: m,
24
- title: E,
25
- activePointId: M,
26
- margins: A,
25
+ title: B,
26
+ activePointId: E,
27
+ margins: M,
27
28
  tooltip: n,
28
- onLoadedCallback: G,
29
- renderer: N = "svg",
29
+ onLoadedCallback: A,
30
+ renderer: G = "svg",
30
31
  plotChildren: x
31
32
  }) => {
32
- const [y, h] = J(), { label: O, points: f } = j, r = { ...D.margins, ...A }, t = typeof y < "u" ? f[y] : f.find(({ id: p }) => p === M), b = [0 + r.left, d - r.right], g = [m - r.bottom, 0 + r.top], [s, P, e] = B({ ...c, range: b }), [a, S, o] = B({ ...l, range: g }), I = o(a[0]), v = e(s[0]), k = o(a[1]), W = e(s[1]), C = "x-axis-label", L = "y-axis-label", X = Math.abs(b[1] - b[0]), Y = Math.abs(g[1] - g[0]), q = w[N], H = /* @__PURE__ */ i(
33
- q,
33
+ const [y, h] = F(), { label: N, points: f } = j, r = { ...T.margins, ...M }, t = typeof y < "u" ? f[y] : f.find(({ id: v }) => v === E), b = [0 + r.left, d - r.right], g = [m - r.bottom, 0 + r.top], [a, S, o] = D({ ...l, range: b }), [i, I, e] = D({ ...c, range: g }), P = e(i[0]), p = o(a[0]), k = e(i[1]), O = o(a[1]), C = "x-axis-label", L = "y-axis-label", W = Math.abs(b[1] - b[0]), X = Math.abs(g[1] - g[0]), Y = w[G], H = /* @__PURE__ */ s(
34
+ Y,
34
35
  {
35
36
  data: f,
36
- onHoverCallback: n ? (p) => h(p) : void 0,
37
+ onHoverCallback: n ? (v) => h(v) : void 0,
37
38
  onHoverOutCallback: n ? () => h(void 0) : void 0,
38
39
  width: d,
39
40
  height: m,
40
- xScale: e,
41
- yScale: o,
42
- label: O,
43
- onLoadedCallback: G
41
+ xScale: o,
42
+ yScale: e,
43
+ label: N,
44
+ onLoadedCallback: A
44
45
  }
45
- ), F = {
46
+ ), q = {
46
47
  Data: H,
47
- xScale: e,
48
- yScale: o,
49
- yStart: I,
48
+ xScale: o,
49
+ yScale: e,
50
+ yStart: P,
50
51
  yEnd: k,
51
- xStart: v,
52
- xEnd: W,
53
- yDomain: a,
54
- xDomain: s
52
+ xStart: p,
53
+ xEnd: O,
54
+ yDomain: i,
55
+ xDomain: a
55
56
  };
56
57
  return /* @__PURE__ */ u(
57
- _,
58
+ Z,
58
59
  {
59
- verticalLabel: l.label,
60
+ verticalLabel: c.label,
60
61
  verticalLabelId: L,
61
- horizontalLabel: c.label,
62
+ horizontalLabel: l.label,
62
63
  horizontalLabelId: C,
63
64
  className: z,
64
65
  width: d,
65
66
  height: m,
66
- title: E,
67
+ title: B,
67
68
  children: [
68
- /* @__PURE__ */ i(
69
- Q,
69
+ /* @__PURE__ */ s(
70
+ K,
70
71
  {
71
- ticks: S,
72
- x: v,
72
+ ticks: I,
73
+ x: p,
73
74
  labelledById: L,
74
- yDomain: a,
75
- yScale: o
75
+ yDomain: i,
76
+ yScale: e
76
77
  }
77
78
  ),
78
79
  /* @__PURE__ */ u(
79
- Z,
80
+ V,
80
81
  {
81
- x: v,
82
+ x: p,
82
83
  y: k,
83
- width: X,
84
- height: Y,
84
+ width: W,
85
+ height: X,
85
86
  children: [
86
- c.guidelines && /* @__PURE__ */ i(
87
+ l.guidelines && /* @__PURE__ */ s(
87
88
  R,
88
89
  {
89
- guides: P.length,
90
+ guides: S.length,
90
91
  direction: "vertical",
91
- xDomain: s,
92
- yDomain: a,
93
- xScale: e,
94
- yScale: o
92
+ xDomain: a,
93
+ yDomain: i,
94
+ xScale: o,
95
+ yScale: e
95
96
  }
96
97
  ),
97
- l.guidelines && /* @__PURE__ */ i(
98
+ c.guidelines && /* @__PURE__ */ s(
98
99
  R,
99
100
  {
100
- guides: S.length,
101
- xDomain: s,
102
- yDomain: a,
103
- xScale: e,
104
- yScale: o
101
+ guides: I.length,
102
+ xDomain: a,
103
+ yDomain: i,
104
+ xScale: o,
105
+ yScale: e
105
106
  }
106
107
  ),
107
- x ? x(F) : H
108
+ x ? x(q) : H
108
109
  ]
109
110
  }
110
111
  ),
111
- /* @__PURE__ */ i(
112
- K,
112
+ /* @__PURE__ */ s(
113
+ J,
113
114
  {
114
- ticks: P,
115
- y: I,
115
+ ticks: S,
116
+ y: P,
116
117
  labelledById: C,
117
- xDomain: s,
118
- xScale: e
118
+ xDomain: a,
119
+ xScale: o
119
120
  }
120
121
  ),
121
- n && /* @__PURE__ */ u(
122
- V,
122
+ n && !$() && /* @__PURE__ */ u(
123
+ U,
123
124
  {
124
- x: t ? e(t.x) : void 0,
125
- y: t ? o(t.y) : void 0,
125
+ x: t ? o(t.x) : void 0,
126
+ y: t ? e(t.y) : void 0,
126
127
  visible: !!t,
127
- offset: D.pointRadius,
128
+ offset: T.pointRadius,
128
129
  children: [
129
130
  t && typeof n == "function" && n(t),
130
131
  t && typeof n == "string" && n
@@ -135,8 +136,7 @@ const w = {
135
136
  }
136
137
  );
137
138
  };
138
- T.displayName = "Charts.ScatterPlot";
139
- const ft = T;
139
+ tt.displayName = "Charts.ScatterPlot";
140
140
  export {
141
- ft as default
141
+ tt as default
142
142
  };
@@ -1,10 +1,9 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("styled-components"),o=require("@rubin-epo/epo-react-lib/styles"),n=require("../Base/index.cjs"),s=e=>e&&e.__esModule?e:{default:e},i=s(t),l=i.default(n.default)`
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("styled-components"),n=require("@rubin-epo/epo-react-lib/styles"),o=require("../Base/index.cjs"),s=e=>e&&e.__esModule?e:{default:e},i=s(t),r=i.default(o.default)`
2
2
  font-size: 1.5em;
3
- overflow: visible;
4
3
 
5
4
  @container (
6
- min-width: ${o.token("BREAK_PHABLET_MIN")}
5
+ min-width: ${n.token("BREAK_PHABLET_MIN")}
7
6
  ) {
8
7
  font-size: 1em;
9
8
  }
10
- `;exports.Chart=l;
9
+ `;exports.Chart=r;
@@ -1,13 +1,12 @@
1
1
  "use client";
2
- import o from "styled-components";
3
- import { token as e } from "@rubin-epo/epo-react-lib/styles";
4
- import t from "../Base/index.js";
5
- const n = o(t)`
2
+ import t from "styled-components";
3
+ import { token as o } from "@rubin-epo/epo-react-lib/styles";
4
+ import e from "../Base/index.js";
5
+ const n = t(e)`
6
6
  font-size: 1.5em;
7
- overflow: visible;
8
7
 
9
8
  @container (
10
- min-width: ${e("BREAK_PHABLET_MIN")}
9
+ min-width: ${o("BREAK_PHABLET_MIN")}
11
10
  ) {
12
11
  font-size: 1em;
13
12
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("lodash/mergeWith"),g=require("lodash/isNil"),o=t=>t&&t.__esModule?t:{default:t},m=o(d),c=o(g),h=(t,e)=>{switch(!0){case t>e:return 0;case t<0:return e;default:return t}},M=(t,e,r)=>t>=e&&t<=r,p=(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]]},A=t=>t[Math.round((t.length-1)/2)],S=(t=[0,1],e=[0,1],r)=>{const n={clamp:!1,fractionDigits:2},{clamp:i,fractionDigits:s}={...n,...r};return l=>{const a=t[1]-t[0];if(a===0)return(e[0]+e[1])/2;let u=(l-t[0])/a;return i&&(u=Math.min(Math.max(u,0),1)),Number((u*(e[1]-e[0])+e[0]).toFixed(s))}},_=()=>{const t=navigator.userAgent.indexOf("Chrome")>-1;return navigator.userAgent.indexOf("Safari")>-1&&!t},f=(t,e)=>c.default(e)&&t?c.default(t)?e:t:e,D=(t,e)=>m.default({},e,t,f),b=(t,e=[0,0])=>t.reduce((r,{x:n,y:i},s)=>r+=`${s===0?"M":" L"}${n+e[0]},${i+e[1]}`,"");exports.between=M;exports.buildPath=b;exports.defaultsMerger=f;exports.getClampedArrayIndex=h;exports.getLinearScale=S;exports.intersection=p;exports.isSafari=_;exports.mergeWithDefaults=D;exports.middle=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("lodash/mergeWith"),g=require("lodash/isNil"),c=t=>t&&t.__esModule?t:{default:t},m=c(d),o=c(g),h=(t,e)=>{switch(!0){case t>e:return 0;case t<0:return e;default:return t}},p=(t,e,n)=>t>=e&&t<=n,M=(t=[],e=[])=>{const n=t[0]<e[0]?t:e,r=n===t?e:t;return n[1]<r[0]?null:[r[0],n[1]<r[1]?n[1]:r[1]]},A=t=>t[Math.round((t.length-1)/2)],S=(t=[0,1],e=[0,1],n)=>{const r={clamp:!1,fractionDigits:2},{clamp:i,fractionDigits:s}={...r,...n};return l=>{const a=t[1]-t[0];if(a===0)return(e[0]+e[1])/2;let u=(l-t[0])/a;return i&&(u=Math.min(Math.max(u,0),1)),Number((u*(e[1]-e[0])+e[0]).toFixed(s))}},_=()=>{if(typeof navigator>"u")return!1;const t=navigator.userAgent.indexOf("Chrome")>-1;return navigator.userAgent.indexOf("Safari")>-1&&!t},f=(t,e)=>o.default(e)&&t?o.default(t)?e:t:e,y=(t,e)=>m.default({},e,t,f),D=(t,e=[0,0])=>t.reduce((n,{x:r,y:i},s)=>n+=`${s===0?"M":" L"}${r+e[0]},${i+e[1]}`,"");exports.between=p;exports.buildPath=D;exports.defaultsMerger=f;exports.getClampedArrayIndex=h;exports.getLinearScale=S;exports.intersection=M;exports.isSafari=_;exports.mergeWithDefaults=y;exports.middle=A;
package/dist/lib/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import a from "lodash/mergeWith";
2
- import u from "lodash/isNil";
3
- const l = (t, e) => {
2
+ import f from "lodash/isNil";
3
+ const d = (t, e) => {
4
4
  switch (!0) {
5
5
  case t > e:
6
6
  return 0;
@@ -9,32 +9,34 @@ const l = (t, e) => {
9
9
  default:
10
10
  return t;
11
11
  }
12
- }, d = (t, e, r) => t >= e && t <= r, p = (t = [], e = []) => {
13
- const r = t[0] < e[0] ? t : e, n = r === t ? e : t;
14
- return r[1] < n[0] ? null : [n[0], r[1] < n[1] ? r[1] : n[1]];
15
- }, A = (t) => t[Math.round((t.length - 1) / 2)], M = (t = [0, 1], e = [0, 1], r) => {
16
- const n = { clamp: !1, fractionDigits: 2 }, { clamp: i, fractionDigits: s } = { ...n, ...r };
17
- return (f) => {
12
+ }, h = (t, e, n) => t >= e && t <= n, p = (t = [], e = []) => {
13
+ const n = t[0] < e[0] ? t : e, r = n === t ? e : t;
14
+ return n[1] < r[0] ? null : [r[0], n[1] < r[1] ? n[1] : r[1]];
15
+ }, A = (t) => t[Math.round((t.length - 1) / 2)], M = (t = [0, 1], e = [0, 1], n) => {
16
+ const r = { clamp: !1, fractionDigits: 2 }, { clamp: i, fractionDigits: s } = { ...r, ...n };
17
+ return (u) => {
18
18
  const c = t[1] - t[0];
19
19
  if (c === 0)
20
20
  return (e[0] + e[1]) / 2;
21
- let o = (f - t[0]) / c;
21
+ let o = (u - t[0]) / c;
22
22
  return i && (o = Math.min(Math.max(o, 0), 1)), Number(
23
23
  (o * (e[1] - e[0]) + e[0]).toFixed(s)
24
24
  );
25
25
  };
26
- }, x = () => {
26
+ }, v = () => {
27
+ if (typeof navigator > "u")
28
+ return !1;
27
29
  const t = navigator.userAgent.indexOf("Chrome") > -1;
28
30
  return navigator.userAgent.indexOf("Safari") > -1 && !t;
29
- }, m = (t, e) => u(e) && t ? u(t) ? e : t : e, D = (t, e) => a({}, e, t, m), I = (t, e = [0, 0]) => t.reduce((r, { x: n, y: i }, s) => r += `${s === 0 ? "M" : " L"}${n + e[0]},${i + e[1]}`, "");
31
+ }, m = (t, e) => f(e) && t ? f(t) ? e : t : e, x = (t, e) => a({}, e, t, m), D = (t, e = [0, 0]) => t.reduce((n, { x: r, y: i }, s) => n += `${s === 0 ? "M" : " L"}${r + e[0]},${i + e[1]}`, "");
30
32
  export {
31
- d as between,
32
- I as buildPath,
33
+ h as between,
34
+ D as buildPath,
33
35
  m as defaultsMerger,
34
- l as getClampedArrayIndex,
36
+ d as getClampedArrayIndex,
35
37
  M as getLinearScale,
36
38
  p as intersection,
37
- x as isSafari,
38
- D as mergeWithDefaults,
39
+ v as isSafari,
40
+ x as mergeWithDefaults,
39
41
  A as middle
40
42
  };
@@ -83,19 +83,19 @@
83
83
  "supernova_three_vector": {
84
84
  "histogram": {
85
85
  "title": "Supernova Distances",
86
- "x_label": "Distance [kpc]",
87
- "bar_label_one": "{{binMin}} to {{binMax}} kiloparsecs: {{count}} supernova",
88
- "bar_label_other": "{{binMin}} to {{binMax}} kiloparsecs: {{count}} supernovae"
86
+ "x_label": "Distance [Mlyr]",
87
+ "bar_label_one": "{{binMin}} to {{binMax}} mega-lightyears: {{count}} supernova",
88
+ "bar_label_other": "{{binMin}} to {{binMax}} mega-lightyears: {{count}} supernovae"
89
89
  },
90
90
  "slider": {
91
91
  "label": "Select visible range",
92
- "valueLabel": "{{value}} kiloparsecs"
92
+ "valueLabel": "{{value}} mega-lightyears"
93
93
  },
94
94
  "skymap": {
95
95
  "title": "Supernova Distribution",
96
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}}})",
97
- "supernova_count_one": "Sky map projection showing {{count}} supernova between the distances of {{min}} and {{max}} kiloparsecs.",
98
- "supernova_count_other": "Sky map projection showing {{count}} supernovae between the distances of {{min}} and {{max}} kiloparsecs.",
97
+ "supernova_count_one": "Sky map projection showing {{count}} supernova between the distances of {{min}} and {{max}} mega-lightyears.",
98
+ "supernova_count_other": "Sky map projection showing {{count}} supernovae between the distances of {{min}} and {{max}} mega-lightyears.",
99
99
  "user_supernova_count_zero": "None of your supernovae are visible.",
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}}."
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),M=require("react-i18next"),y=require("d3-array"),C=require("../../../charts/ScatterPlot/index.cjs");require("../../../atomic/PlotWrapper/index.cjs");const x=require("../../../lib/utils.cjs"),u=require("../defaults.cjs"),v=require("./styles.cjs"),E=require("../../../atomic/PlotWrapper/styles.cjs"),F=(l,c,p)=>{const o={};return Object.keys(l).forEach(e=>{const a=e==="top"||e==="bottom"?p:c,n=`${e.charAt(0).toUpperCase()}${e.slice(1)}`;o[`padding${n}`]=`${l[e]/a*100}%`}),o},A=({data:l,activeAlertId:c,xMin:p,xMax:o,yMin:d,yMax:e,width:a=u.default.width,height:n=u.default.height,name:j,slider:g,className:q,plotChildren:h})=>{const{t:i,i18n:{language:W}}=M.useTranslation(),D=x.mergeWithDefaults({min:y.min(l,({x:t})=>t),max:y.max(l,({x:t})=>t)},u.default.xAxis),P=x.mergeWithDefaults({min:p,max:o,label:i("light_curve.plot.x_label")},{...D,label:i("isochrone_plot.plot.x_label")}),r=x.mergeWithDefaults({min:d,max:e,label:i("light_curve.plot.y_label")},{...u.default.yAxis,label:i("isochrone_plot.plot.y_label")}),b={top:10,right:10,bottom:25,left:40};return s.jsxs(E.PlotWrapper,{className:q,children:[s.jsx(C.default,{width:a,height:n,margins:b,activePointId:c,title:j,xAxis:{...P},yAxis:{...r,step:r.min<r.max?Math.abs(r.step):r.step},data:{label:i("light_curve.plot.plot_label"),points:l},tooltip:({y:t})=>i("light_curve.plot.tooltip",{magnitude:t.toLocaleString(W,{minimumFractionDigits:2,maximumFractionDigits:2})}),plotChildren:({xScale:t,yStart:f,yEnd:m,Data:_,...$})=>s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:t(0),y:m,width:t(15)-t(0),height:f-m,stroke:"var(--neutral60,##6A6E6E)",strokeDasharray:6,fill:"var(--neutral20,#DCE0E3)"}),_,h&&h({xScale:t,yStart:f,yEnd:m,Data:_,...$})]})}),g&&s.jsx(v.SliderOuterWrapper,{children:s.jsx(v.SliderInnerWrapper,{style:{...F(b,a,n)},children:g})})]})};A.displayName="Widgets.LightCurve.Plot";const I=A;exports.default=I;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),D=require("react-i18next"),f=require("d3-array"),M=require("../../../charts/ScatterPlot/index.cjs");require("../../../atomic/PlotWrapper/index.cjs");const m=require("../../../lib/utils.cjs"),u=require("../defaults.cjs"),_=require("./styles.cjs"),I=require("../../../atomic/PlotWrapper/styles.cjs"),O=(l,c,p)=>{const o={};return Object.keys(l).forEach(e=>{const r=e==="top"||e==="bottom"?p:c,n=`${e.charAt(0).toUpperCase()}${e.slice(1)}`;o[`padding${n}`]=`${l[e]/r*100}%`}),o},y=({data:l,activeAlertId:c,xMin:p,xMax:o,yMin:x,yMax:e,width:r=u.default.width,height:n=u.default.height,name:q,slider:d,className:A,plotChildren:g})=>{const{t:i,i18n:{language:v}}=D.useTranslation(),j=m.mergeWithDefaults({min:f.min(l,({x:t})=>t),max:f.max(l,({x:t})=>t)},u.default.xAxis),W=m.mergeWithDefaults({min:p,max:o,label:i("light_curve.plot.x_label")},{...j,label:i("isochrone_plot.plot.x_label")}),s=m.mergeWithDefaults({min:x,max:e,label:i("light_curve.plot.y_label")},{...u.default.yAxis,label:i("isochrone_plot.plot.y_label")}),h={top:10,right:10,bottom:25,left:40};return a.jsxs(I.PlotWrapper,{className:A,children:[a.jsx(M.default,{width:r,height:n,margins:h,activePointId:c,title:q,xAxis:{...W},yAxis:{...s,step:s.min<s.max?Math.abs(s.step):s.step},data:{label:i("light_curve.plot.plot_label"),points:l},tooltip:({y:t})=>i("light_curve.plot.tooltip",{magnitude:t.toLocaleString(v,{minimumFractionDigits:2,maximumFractionDigits:2})}),plotChildren:({xScale:t,yStart:P,yEnd:$,Data:b,...S})=>g?g({xScale:t,yStart:P,yEnd:$,Data:b,...S}):b}),d&&a.jsx(_.SliderOuterWrapper,{children:a.jsx(_.SliderInnerWrapper,{style:{...O(h,r,n)},children:d})})]})};y.displayName="Widgets.LightCurve.Plot";const C=y;exports.default=C;
@@ -1,53 +1,53 @@
1
1
  "use client";
2
- import { jsxs as A, jsx as n, Fragment as C } from "react/jsx-runtime";
3
- import { useTranslation as E } from "react-i18next";
4
- import { min as F, max as k } from "d3-array";
2
+ import { jsxs as j, jsx as c } from "react/jsx-runtime";
3
+ import { useTranslation as C } from "react-i18next";
4
+ import { min as D, max as F } from "d3-array";
5
5
  import I from "../../../charts/ScatterPlot/index.js";
6
6
  import "../../../atomic/PlotWrapper/index.js";
7
- import { mergeWithDefaults as u } from "../../../lib/utils.js";
8
- import m from "../defaults.js";
7
+ import { mergeWithDefaults as x } from "../../../lib/utils.js";
8
+ import n from "../defaults.js";
9
9
  import { SliderOuterWrapper as L, SliderInnerWrapper as M } from "./styles.js";
10
10
  import { PlotWrapper as N } from "../../../atomic/PlotWrapper/styles.js";
11
- const O = (e, p, c) => {
12
- const l = {};
13
- return Object.keys(e).forEach((o) => {
14
- const s = o === "top" || o === "bottom" ? c : p, a = `${o.charAt(0).toUpperCase()}${o.slice(1)}`;
15
- l[`padding${a}`] = `${e[o] / s * 100}%`;
16
- }), l;
17
- }, v = ({
18
- data: e,
19
- activeAlertId: p,
20
- xMin: c,
21
- xMax: l,
22
- yMin: x,
23
- yMax: o,
24
- width: s = m.width,
25
- height: a = m.height,
26
- name: y,
11
+ const O = (i, m, p) => {
12
+ const r = {};
13
+ return Object.keys(i).forEach((t) => {
14
+ const s = t === "top" || t === "bottom" ? p : m, a = `${t.charAt(0).toUpperCase()}${t.slice(1)}`;
15
+ r[`padding${a}`] = `${i[t] / s * 100}%`;
16
+ }), r;
17
+ }, f = ({
18
+ data: i,
19
+ activeAlertId: m,
20
+ xMin: p,
21
+ xMax: r,
22
+ yMin: u,
23
+ yMax: t,
24
+ width: s = n.width,
25
+ height: a = n.height,
26
+ name: _,
27
27
  slider: g,
28
- className: P,
29
- plotChildren: f
28
+ className: y,
29
+ plotChildren: h
30
30
  }) => {
31
31
  const {
32
- t: i,
33
- i18n: { language: W }
34
- } = E(), $ = u(
32
+ t: e,
33
+ i18n: { language: A }
34
+ } = C(), v = x(
35
35
  {
36
- min: F(e, ({ x: t }) => t),
37
- max: k(e, ({ x: t }) => t)
36
+ min: D(i, ({ x: o }) => o),
37
+ max: F(i, ({ x: o }) => o)
38
38
  },
39
- m.xAxis
40
- ), D = u(
41
- { min: c, max: l, label: i("light_curve.plot.x_label") },
39
+ n.xAxis
40
+ ), P = x(
41
+ { min: p, max: r, label: e("light_curve.plot.x_label") },
42
42
  {
43
- ...$,
44
- label: i("isochrone_plot.plot.x_label")
43
+ ...v,
44
+ label: e("isochrone_plot.plot.x_label")
45
45
  }
46
- ), r = u(
47
- { min: x, max: o, label: i("light_curve.plot.y_label") },
46
+ ), l = x(
47
+ { min: u, max: t, label: e("light_curve.plot.y_label") },
48
48
  {
49
- ...m.yAxis,
50
- label: i("isochrone_plot.plot.y_label")
49
+ ...n.yAxis,
50
+ label: e("isochrone_plot.plot.y_label")
51
51
  }
52
52
  ), b = {
53
53
  top: 10,
@@ -55,51 +55,36 @@ const O = (e, p, c) => {
55
55
  bottom: 25,
56
56
  left: 40
57
57
  };
58
- return /* @__PURE__ */ A(N, { className: P, children: [
59
- /* @__PURE__ */ n(
58
+ return /* @__PURE__ */ j(N, { className: y, children: [
59
+ /* @__PURE__ */ c(
60
60
  I,
61
61
  {
62
62
  width: s,
63
63
  height: a,
64
64
  margins: b,
65
- activePointId: p,
66
- title: y,
65
+ activePointId: m,
66
+ title: _,
67
67
  xAxis: {
68
- ...D
68
+ ...P
69
69
  },
70
70
  yAxis: {
71
- ...r,
72
- step: r.min < r.max ? Math.abs(r.step) : r.step
71
+ ...l,
72
+ step: l.min < l.max ? Math.abs(l.step) : l.step
73
73
  },
74
74
  data: {
75
- label: i("light_curve.plot.plot_label"),
76
- points: e
75
+ label: e("light_curve.plot.plot_label"),
76
+ points: i
77
77
  },
78
- tooltip: ({ y: t }) => i("light_curve.plot.tooltip", {
79
- magnitude: t.toLocaleString(W, {
78
+ tooltip: ({ y: o }) => e("light_curve.plot.tooltip", {
79
+ magnitude: o.toLocaleString(A, {
80
80
  minimumFractionDigits: 2,
81
81
  maximumFractionDigits: 2
82
82
  })
83
83
  }),
84
- plotChildren: ({ xScale: t, yStart: d, yEnd: h, Data: _, ...j }) => /* @__PURE__ */ A(C, { children: [
85
- /* @__PURE__ */ n(
86
- "rect",
87
- {
88
- x: t(0),
89
- y: h,
90
- width: t(15) - t(0),
91
- height: d - h,
92
- stroke: "var(--neutral60,##6A6E6E)",
93
- strokeDasharray: 6,
94
- fill: "var(--neutral20,#DCE0E3)"
95
- }
96
- ),
97
- _,
98
- f && f({ xScale: t, yStart: d, yEnd: h, Data: _, ...j })
99
- ] })
84
+ plotChildren: ({ xScale: o, yStart: W, yEnd: $, Data: d, ...S }) => h ? h({ xScale: o, yStart: W, yEnd: $, Data: d, ...S }) : d
100
85
  }
101
86
  ),
102
- g && /* @__PURE__ */ n(L, { children: /* @__PURE__ */ n(
87
+ g && /* @__PURE__ */ c(L, { children: /* @__PURE__ */ c(
103
88
  M,
104
89
  {
105
90
  style: { ...O(b, s, a) },
@@ -108,8 +93,8 @@ const O = (e, p, c) => {
108
93
  ) })
109
94
  ] });
110
95
  };
111
- v.displayName = "Widgets.LightCurve.Plot";
112
- const J = v;
96
+ f.displayName = "Widgets.LightCurve.Plot";
97
+ const G = f;
113
98
  export {
114
- J as default
99
+ G as default
115
100
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),h=require("react-i18next"),s=require("./styles.cjs"),v=(t,i,a)=>{const n=Number(Math.abs(i-t).toFixed(1)),u=n.toLocaleString(a,{minimumFractionDigits:1,maximumFractionDigits:1});let e;return n<=.05?(e="equal",{distance:n,context:e}):(t<i?e="above":e="below",{distance:u,context:e})},c=({magnitude:t,yMin:i,yMax:a,onMagnitudeChangeCallback:n,estimatedPeak:u,disabled:e})=>{const{t:o,i18n:{language:l}}=h.useTranslation(),m=Math.min(i,a),d=Math.max(i,a);return r.jsx(s.Slider,{ariaLabel:o("light_curve.magnitude_slider.label"),orientation:"vertical",value:t,step:.1,ariaValuetext:()=>o("light_curve.magnitude_slider.value",{...v(u,t,l),magnitude:t.toLocaleString(l,{minimumFractionDigits:1,maximumFractionDigits:1})}),onChange:n,renderThumb:({key:g,style:x,...b})=>r.jsxs(s.ThumbContainer,{...b,style:x,children:[r.jsx(s.ThumbBar,{}),r.jsx(s.ThumbHandle,{})]},g),min:m,max:d,disabled:e})};c.displayName="Widgets.LightCurve.MagnitudeSlider";const S=c;exports.default=S;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),h=require("react-i18next"),s=require("./styles.cjs"),v=(t,i,a)=>{const n=Number(Math.abs(i-t).toFixed(1)),u=n.toLocaleString(a,{minimumFractionDigits:1,maximumFractionDigits:1});let e;return n<=.05?(e="equal",{distance:n,context:e}):(t<i?e="above":e="below",{distance:u,context:e})},c=({magnitude:t,yMin:i,yMax:a,onMagnitudeChangeCallback:n,estimatedPeak:u,disabled:e})=>{const{t:o,i18n:{language:l}}=h.useTranslation(),m=Math.min(i,a),d=Math.max(i,a);return r.jsx(s.Slider,{ariaLabel:o("light_curve.magnitude_slider.label"),orientation:"vertical",value:t,step:.05,ariaValuetext:()=>o("light_curve.magnitude_slider.value",{...v(u,t,l),magnitude:t.toLocaleString(l,{minimumFractionDigits:1,maximumFractionDigits:1})}),onChange:n,renderThumb:({key:g,style:x,...b})=>r.jsxs(s.ThumbContainer,{...b,style:x,children:[r.jsx(s.ThumbBar,{}),r.jsx(s.ThumbHandle,{})]},g),min:m,max:d,disabled:e})};c.displayName="Widgets.LightCurve.MagnitudeSlider";const S=c;exports.default=S;
@@ -27,7 +27,7 @@ const D = (i, e, a) => {
27
27
  ariaLabel: m("light_curve.magnitude_slider.label"),
28
28
  orientation: "vertical",
29
29
  value: i,
30
- step: 0.1,
30
+ step: 0.05,
31
31
  ariaValuetext: () => m("light_curve.magnitude_slider.value", {
32
32
  ...D(r, i, l),
33
33
  magnitude: i.toLocaleString(l, {
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),z=require("react"),T=require("react-i18next"),N=require("d3-array"),J=require("@rubin-epo/epo-react-lib/HorizontalSlider"),t=require("../defaults.cjs"),K=require("../Plot/index.cjs"),O=require("./A11Y/LightCurveLabel/index.cjs"),a=require("../helpers.cjs"),Q=require("../../../atomic/Button/patterns/Reset.cjs"),V=require("./MagnitudeSlider/index.cjs"),X=require("./styles.cjs"),Z=require("../../../charts/Viewport/index.cjs"),E=require("../../../layout/Controls/index.cjs"),b=require("../../../atomic/ControlLabel/index.cjs"),G=require("../../../charts/PathFromPoints/index.cjs"),U=require("../../../lib/utils.cjs"),Y=r=>r&&r.__esModule?r:{default:r},$=Y(J),I=({gaussianWidth:r=t.default.gaussianWidth,yOffset:l=t.default.yOffset,alerts:P,peakMjd:W,yMin:c,yMax:f,width:x=t.default.width,height:m=t.default.height,userMagnitude:A,onUserMagnitudeChangeCallback:n,onGaussianChangeCallback:d,onYOffsetChangeCallback:o,className:D,isDisplayOnly:q,...F})=>{const{t:j}=T.useTranslation(),i=U.mergeWithDefaults({min:c,max:f},t.default.yAxis),g=(i.max-i.min)/2+i.min,p=a.useAlertsAsPoints(P,W),H=z.useId(),R=()=>{n&&n(g),o&&o(t.default.yOffset),d&&d(t.default.gaussianWidth)},y=a.estimateMagnitudeWithOffset(0,r,l),S=e.jsx(K.default,{slider:e.jsx(V.default,{magnitude:A||g,onMagnitudeChangeCallback:u=>n&&n(u),disabled:q,yMin:i.min,yMax:i.max,estimatedPeak:y}),plotChildren:({xScale:u,yScale:s,xDomain:h,yDomain:B,xStart:v,xEnd:L,yStart:w,yEnd:_})=>e.jsxs(e.Fragment,{children:[e.jsx(G.default,{points:N.range(h[0],h[1],.5).map(M=>({x:u(M),y:s(a.estimateMagnitude(M,r))})),svgProps:{transform:`translate(0,${s(B[1]-l)})`}}),e.jsx(Z.default,{x:v,y:_,outerHeight:w-_,outerWidth:L-v,innerWidth:x,innerHeight:m,children:e.jsx(X.DM15Display,{gaussianWidth:r})})]}),...F,data:p,width:x,height:m,yMin:c,yMax:f});return e.jsx(e.Fragment,{children:e.jsx(E.default,{className:D,isDisplayOnly:q,widget:S,controls:e.jsxs(e.Fragment,{children:[e.jsx(b.default,{label:j("light_curve.curve.controls.gaussian_width"),input:u=>e.jsx($.default,{labelledbyId:u,color:"var(--turquoise85, #12726D)",min:t.default.gaussianMin,max:t.default.gaussianMax,step:t.default.gaussianStep,value:r,onChangeCallback:s=>typeof s=="number"&&d&&d(s)}),labelBy:!0}),e.jsx(b.default,{label:j("light_curve.curve.controls.y_offset"),input:u=>e.jsx($.default,{labelledbyId:u,color:"var(--turquoise85, #12726D)",min:t.default.yOffsetMin,max:t.default.yOffsetMax,step:t.default.yOffsetStep,value:l,onChangeCallback:s=>typeof s=="number"&&o&&o(s)}),labelBy:!0}),e.jsx(O.default,{controlledById:H,data:p,gaussianWidth:r,yOffset:l,estimatedPeak:y})]}),actions:e.jsx(Q.default,{onResetCallback:R})})})};I.displayName="Widgets.LightCurve";const k=I;exports.default=k;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),E=require("react"),N=require("react-i18next"),J=require("d3-array"),K=require("@rubin-epo/epo-react-lib/HorizontalSlider"),t=require("../defaults.cjs"),O=require("../Plot/index.cjs"),Q=require("./A11Y/LightCurveLabel/index.cjs"),c=require("../helpers.cjs"),S=require("../../../atomic/Button/patterns/Reset.cjs"),V=require("./MagnitudeSlider/index.cjs"),X=require("./styles.cjs"),Z=require("../../../charts/Viewport/index.cjs"),k=require("../../../layout/Controls/index.cjs"),$=require("../../../atomic/ControlLabel/index.cjs"),G=require("../../../charts/PathFromPoints/index.cjs"),U=require("../../../lib/utils.cjs"),Y=r=>r&&r.__esModule?r:{default:r},A=Y(K),D=({gaussianWidth:r=t.default.gaussianWidth,yOffset:l=t.default.yOffset,alerts:I,peakMjd:P,yMin:f,yMax:x,width:m=t.default.width,height:q=t.default.height,userMagnitude:W,onUserMagnitudeChangeCallback:n,onGaussianChangeCallback:d,onYOffsetChangeCallback:o,className:F,isDisplayOnly:j,...H})=>{const{t:p}=N.useTranslation(),i=U.mergeWithDefaults({min:f,max:x},t.default.yAxis),g=(i.max-i.min)/2+i.min,h=c.useAlertsAsPoints(I,P),R=E.useId(),w=()=>{n&&n(g),o&&o(t.default.yOffset),d&&d(t.default.gaussianWidth)},v=c.estimateMagnitudeWithOffset(0,r,l),B=e.jsx(O.default,{slider:e.jsx(V.default,{magnitude:W||g,onMagnitudeChangeCallback:s=>n&&n(s),disabled:j,yMin:i.min-i.step/2,yMax:i.max+i.step/2,estimatedPeak:v}),plotChildren:({xScale:s,yScale:u,xDomain:y,yDomain:L,xStart:_,xEnd:z,yStart:M,yEnd:a,Data:T})=>e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:s(0),y:a,width:s(15)-s(0),height:M-a,stroke:"var(--neutral60,##6A6E6E)",strokeDasharray:6,fill:"var(--neutral20,#DCE0E3)"}),T,e.jsx(G.default,{points:J.range(y[0],y[1],.5).map(b=>({x:s(b),y:u(c.estimateMagnitude(b,r))})),svgProps:{transform:`translate(0,${u(L[1]-l)})`}}),e.jsx(Z.default,{x:_,y:a,outerHeight:M-a,outerWidth:z-_,innerWidth:m,innerHeight:q,children:e.jsx(X.DM15Display,{gaussianWidth:r})})]}),...H,data:h,width:m,height:q,yMin:f,yMax:x});return e.jsx(e.Fragment,{children:e.jsx(k.default,{className:F,isDisplayOnly:j,widget:B,controls:e.jsxs(e.Fragment,{children:[e.jsx($.default,{label:p("light_curve.curve.controls.gaussian_width"),input:s=>e.jsx(A.default,{labelledbyId:s,color:"var(--turquoise85, #12726D)",min:t.default.gaussianMin,max:t.default.gaussianMax,step:t.default.gaussianStep,value:r,onChangeCallback:u=>typeof u=="number"&&d&&d(u)}),labelBy:!0}),e.jsx($.default,{label:p("light_curve.curve.controls.y_offset"),input:s=>e.jsx(A.default,{labelledbyId:s,color:"var(--turquoise85, #12726D)",min:t.default.yOffsetMin,max:t.default.yOffsetMax,step:t.default.yOffsetStep,value:l,onChangeCallback:u=>typeof u=="number"&&o&&o(u)}),labelBy:!0}),e.jsx(Q.default,{controlledById:R,data:h,gaussianWidth:r,yOffset:l,estimatedPeak:v})]}),actions:e.jsx(S.default,{onResetCallback:w})})})};D.displayName="Widgets.LightCurve";const C=D;exports.default=C;