@rubin-epo/epo-widget-lib 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
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:p=t.default.height,userMagnitude:W,onUserMagnitudeChangeCallback:n,onGaussianChangeCallback:o,onYOffsetChangeCallback:d,className:F,isDisplayOnly:q,...H})=>{const{t:j}=N.useTranslation(),u=U.mergeWithDefaults({min:f,max:x},t.default.yAxis),g=(u.max-u.min)/2+u.min,h=c.useAlertsAsPoints(I,P),R=E.useId(),w=()=>{n&&n(g),d&&d(t.default.yOffset),o&&o(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:q,yMin:u.min-u.step/2,yMax:u.max+u.step/2,estimatedPeak:v}),plotChildren:({xScale:s,yScale:i,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:i(c.estimateMagnitude(b,r))})),svgProps:{transform:`translate(0,${i(L[1]-l)})`}}),e.jsx(Z.default,{x:_,y:a,outerHeight:M-a,outerWidth:z-_,innerWidth:m,innerHeight:p,children:e.jsx(X.DM15Display,{gaussianWidth:r})})]}),...H,data:h,width:m,height:p,yMin:f,yMax:x});return e.jsx(e.Fragment,{children:e.jsx(k.default,{className:F,isDisplayOnly:q,ratio:{landscape:3/2,portrait:2/3},widget:B,controls:e.jsxs(e.Fragment,{children:[e.jsx($.default,{label:j("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:i=>typeof i=="number"&&o&&o(i)}),labelBy:!0}),e.jsx($.default,{label:j("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:i=>typeof i=="number"&&d&&d(i)}),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;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),T=require("react"),E=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"),c=require("../helpers.cjs"),Q=require("../../../atomic/Button/patterns/Reset.cjs"),S=require("./MagnitudeSlider/index.cjs"),V=require("./styles.cjs"),X=require("../../../charts/Viewport/index.cjs"),Z=require("../../../layout/Controls/index.cjs"),b=require("../../../atomic/ControlLabel/index.cjs"),k=require("../../../charts/PathFromPoints/index.cjs"),G=require("../../../lib/utils.cjs"),U=r=>r&&r.__esModule?r:{default:r},$=U(J),D=({gaussianWidth:r=t.default.gaussianWidth,yOffset:n=t.default.yOffset,alerts:A,peakMjd:I,yMin:f,yMax:x,width:m=t.default.width,height:p=t.default.height,userMagnitude:P,onUserMagnitudeChangeCallback:l,onGaussianChangeCallback:o,onYOffsetChangeCallback:d,className:W,isDisplayOnly:q,...F})=>{const{t:j}=E.useTranslation(),u=G.mergeWithDefaults({min:f,max:x},t.default.yAxis),g=(u.max-u.min)/2+u.min,h=c.useAlertsAsPoints(A,I),H=T.useId(),L=()=>{l&&l(g),d&&d(t.default.yOffset),o&&o(t.default.gaussianWidth)},v=c.estimateMagnitudeWithOffset(0,r,n),R=e.jsx(K.default,{slider:e.jsx(S.default,{magnitude:P||g,onMagnitudeChangeCallback:s=>l&&l(s),disabled:q,yMin:u.min-u.step/2,yMax:u.max+u.step/2,estimatedPeak:v}),plotChildren:({xScale:s,yScale:i,yDomain:w,xStart:y,xEnd:B,yStart:_,yEnd:a,Data:z})=>e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:s(0),y:a,width:s(15)-s(0),height:_-a,stroke:"var(--neutral60,##6A6E6E)",strokeDasharray:6,fill:"var(--neutral20,#DCE0E3)"}),z,e.jsx(k.default,{points:N.range(-10,40,.5).map(M=>({x:s(M),y:i(c.estimateMagnitude(M,r))})),svgProps:{transform:`translate(0,${i(w[1]-n)})`,strokeLinecap:"round"}}),e.jsx(X.default,{x:y,y:a,outerHeight:_-a,outerWidth:B-y,innerWidth:m,innerHeight:p,children:e.jsx(V.DM15Display,{gaussianWidth:r})})]}),...F,data:h,width:m,height:p,yMin:f,yMax:x});return e.jsx(e.Fragment,{children:e.jsx(Z.default,{className:W,isDisplayOnly:q,ratio:{landscape:3/2,portrait:2/3},widget:R,controls:e.jsxs(e.Fragment,{children:[e.jsx(b.default,{label:j("light_curve.curve.controls.gaussian_width"),input:s=>e.jsx($.default,{labelledbyId:s,color:"var(--turquoise85, #12726D)",min:t.default.gaussianMin,max:t.default.gaussianMax,step:t.default.gaussianStep,value:r,onChangeCallback:i=>typeof i=="number"&&o&&o(i)}),labelBy:!0}),e.jsx(b.default,{label:j("light_curve.curve.controls.y_offset"),input:s=>e.jsx($.default,{labelledbyId:s,color:"var(--turquoise85, #12726D)",min:t.default.yOffsetMin,max:t.default.yOffsetMax,step:t.default.yOffsetStep,value:n,onChangeCallback:i=>typeof i=="number"&&d&&d(i)}),labelBy:!0}),e.jsx(O.default,{controlledById:H,data:h,gaussianWidth:r,yOffset:n,estimatedPeak:v})]}),actions:e.jsx(Q.default,{onResetCallback:L})})})};D.displayName="Widgets.LightCurve";const Y=D;exports.default=Y;
@@ -1,50 +1,50 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as A, Fragment as a } from "react/jsx-runtime";
3
- import { useId as T } from "react";
4
- import { useTranslation as V } from "react-i18next";
5
- import { range as J } from "d3-array";
2
+ import { jsx as t, jsxs as W, Fragment as a } from "react/jsx-runtime";
3
+ import { useId as N } from "react";
4
+ import { useTranslation as T } from "react-i18next";
5
+ import { range as V } from "d3-array";
6
6
  import D from "@rubin-epo/epo-react-lib/HorizontalSlider";
7
7
  import r from "../defaults.js";
8
- import K from "../Plot/index.js";
9
- import Q from "./A11Y/LightCurveLabel/index.js";
10
- import { useAlertsAsPoints as X, estimateMagnitudeWithOffset as Z, estimateMagnitude as O } from "../helpers.js";
8
+ import J from "../Plot/index.js";
9
+ import K from "./A11Y/LightCurveLabel/index.js";
10
+ import { useAlertsAsPoints as Q, estimateMagnitudeWithOffset as X, estimateMagnitude as Z } from "../helpers.js";
11
11
  import k from "../../../atomic/Button/patterns/Reset.js";
12
- import S from "./MagnitudeSlider/index.js";
13
- import { DM15Display as C } from "./styles.js";
14
- import G from "../../../charts/Viewport/index.js";
15
- import U from "../../../layout/Controls/index.js";
16
- import I from "../../../atomic/ControlLabel/index.js";
17
- import Y from "../../../charts/PathFromPoints/index.js";
18
- import { mergeWithDefaults as tt } from "../../../lib/utils.js";
19
- const w = ({
12
+ import O from "./MagnitudeSlider/index.js";
13
+ import { DM15Display as S } from "./styles.js";
14
+ import C from "../../../charts/Viewport/index.js";
15
+ import G from "../../../layout/Controls/index.js";
16
+ import A from "../../../atomic/ControlLabel/index.js";
17
+ import U from "../../../charts/PathFromPoints/index.js";
18
+ import { mergeWithDefaults as Y } from "../../../lib/utils.js";
19
+ const I = ({
20
20
  gaussianWidth: m = r.gaussianWidth,
21
21
  yOffset: s = r.yOffset,
22
- alerts: B,
23
- peakMjd: _,
22
+ alerts: w,
23
+ peakMjd: B,
24
24
  yMin: d,
25
25
  yMax: f,
26
26
  width: c = r.width,
27
27
  height: h = r.height,
28
- userMagnitude: F,
28
+ userMagnitude: _,
29
29
  onUserMagnitudeChangeCallback: n,
30
30
  onGaussianChangeCallback: l,
31
31
  onYOffsetChangeCallback: p,
32
- className: H,
32
+ className: F,
33
33
  isDisplayOnly: g,
34
- ...R
34
+ ...H
35
35
  }) => {
36
- const { t: v } = V(), i = tt(
36
+ const { t: v } = T(), i = Y(
37
37
  { min: d, max: f },
38
38
  r.yAxis
39
- ), y = (i.max - i.min) / 2 + i.min, x = X(B, _), j = T(), q = () => {
39
+ ), y = (i.max - i.min) / 2 + i.min, x = Q(w, B), R = N(), j = () => {
40
40
  n && n(y), p && p(r.yOffset), l && l(r.gaussianWidth);
41
- }, b = Z(0, m, s), $ = /* @__PURE__ */ t(
42
- K,
41
+ }, b = X(0, m, s), q = /* @__PURE__ */ t(
42
+ J,
43
43
  {
44
44
  slider: /* @__PURE__ */ t(
45
- S,
45
+ O,
46
46
  {
47
- magnitude: F || y,
47
+ magnitude: _ || y,
48
48
  onMagnitudeChangeCallback: (o) => n && n(o),
49
49
  disabled: g,
50
50
  yMin: i.min - i.step / 2,
@@ -55,53 +55,53 @@ const w = ({
55
55
  plotChildren: ({
56
56
  xScale: o,
57
57
  yScale: e,
58
- xDomain: P,
59
- yDomain: z,
60
- xStart: M,
61
- xEnd: E,
62
- yStart: W,
58
+ yDomain: $,
59
+ xStart: P,
60
+ xEnd: z,
61
+ yStart: L,
63
62
  yEnd: u,
64
- Data: N
65
- }) => /* @__PURE__ */ A(a, { children: [
63
+ Data: E
64
+ }) => /* @__PURE__ */ W(a, { children: [
66
65
  /* @__PURE__ */ t(
67
66
  "rect",
68
67
  {
69
68
  x: o(0),
70
69
  y: u,
71
70
  width: o(15) - o(0),
72
- height: W - u,
71
+ height: L - u,
73
72
  stroke: "var(--neutral60,##6A6E6E)",
74
73
  strokeDasharray: 6,
75
74
  fill: "var(--neutral20,#DCE0E3)"
76
75
  }
77
76
  ),
78
- N,
77
+ E,
79
78
  /* @__PURE__ */ t(
80
- Y,
79
+ U,
81
80
  {
82
- points: J(P[0], P[1], 0.5).map((L) => ({
83
- x: o(L),
84
- y: e(O(L, m))
81
+ points: V(-10, 40, 0.5).map((M) => ({
82
+ x: o(M),
83
+ y: e(Z(M, m))
85
84
  })),
86
85
  svgProps: {
87
- transform: `translate(0,${e(z[1] - s)})`
86
+ transform: `translate(0,${e($[1] - s)})`,
87
+ strokeLinecap: "round"
88
88
  }
89
89
  }
90
90
  ),
91
91
  /* @__PURE__ */ t(
92
- G,
92
+ C,
93
93
  {
94
- x: M,
94
+ x: P,
95
95
  y: u,
96
- outerHeight: W - u,
97
- outerWidth: E - M,
96
+ outerHeight: L - u,
97
+ outerWidth: z - P,
98
98
  innerWidth: c,
99
99
  innerHeight: h,
100
- children: /* @__PURE__ */ t(C, { gaussianWidth: m })
100
+ children: /* @__PURE__ */ t(S, { gaussianWidth: m })
101
101
  }
102
102
  )
103
103
  ] }),
104
- ...R,
104
+ ...H,
105
105
  data: x,
106
106
  width: c,
107
107
  height: h,
@@ -110,15 +110,15 @@ const w = ({
110
110
  }
111
111
  );
112
112
  return /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(
113
- U,
113
+ G,
114
114
  {
115
- className: H,
115
+ className: F,
116
116
  isDisplayOnly: g,
117
117
  ratio: { landscape: 3 / 2, portrait: 2 / 3 },
118
- widget: $,
119
- controls: /* @__PURE__ */ A(a, { children: [
118
+ widget: q,
119
+ controls: /* @__PURE__ */ W(a, { children: [
120
120
  /* @__PURE__ */ t(
121
- I,
121
+ A,
122
122
  {
123
123
  label: v("light_curve.curve.controls.gaussian_width"),
124
124
  input: (o) => /* @__PURE__ */ t(
@@ -137,7 +137,7 @@ const w = ({
137
137
  }
138
138
  ),
139
139
  /* @__PURE__ */ t(
140
- I,
140
+ A,
141
141
  {
142
142
  label: v("light_curve.curve.controls.y_offset"),
143
143
  input: (o) => /* @__PURE__ */ t(
@@ -156,9 +156,9 @@ const w = ({
156
156
  }
157
157
  ),
158
158
  /* @__PURE__ */ t(
159
- Q,
159
+ K,
160
160
  {
161
- controlledById: j,
161
+ controlledById: R,
162
162
  data: x,
163
163
  gaussianWidth: m,
164
164
  yOffset: s,
@@ -166,12 +166,12 @@ const w = ({
166
166
  }
167
167
  )
168
168
  ] }),
169
- actions: /* @__PURE__ */ t(k, { onResetCallback: q })
169
+ actions: /* @__PURE__ */ t(k, { onResetCallback: j })
170
170
  }
171
171
  ) });
172
172
  };
173
- w.displayName = "Widgets.LightCurve";
174
- const yt = w;
173
+ I.displayName = "Widgets.LightCurve";
174
+ const vt = I;
175
175
  export {
176
- yt as default
176
+ vt as default
177
177
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubin-epo/epo-widget-lib",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
5
5
  "author": "Rubin EPO",
6
6
  "license": "MIT",