@rubin-epo/epo-widget-lib 1.0.5 → 1.0.6
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/IsochronePlot.cjs +1 -1
- package/dist/IsochronePlot.js +14 -15
- package/package.json +1 -1
package/dist/IsochronePlot.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),L=require("react"),X=require("react-i18next"),Y=require("use-resize-observer"),Z=require("lodash/round"),D=require("@rubin-epo/epo-react-lib/styles"),ee=require("./layout/Controls/index.cjs"),te=require("./charts/ScatterPlot/index.cjs"),se=require("./atomic/Button/patterns/Reset.cjs");require("./atomic/PlotWrapper/index.cjs");const ie=require("./charts/Readout/index.cjs"),re=require("./charts/PathFromPoints/index.cjs"),u=require("./lib/utils.cjs"),ne=require("./widgets/IsochronePlot/Controls/index.cjs"),r=require("./widgets/IsochronePlot/defaults.cjs"),oe=require("./widgets/IsochronePlot/A11Y/CurveFit.cjs"),W=require("./widgets/IsochronePlot/helpers.cjs"),ae=require("./atomic/PlotWrapper/styles.cjs"),I=e=>e&&e.__esModule?e:{default:e},le=I(Y),ue=I(Z),ce=e=>e?e<parseFloat(D.token("BREAK_PHABLET_MIN"))?r.default.pointRadius.md:e<parseFloat(D.token("BREAK_LARGE_TABLET"))?r.default.pointRadius.sm:r.default.pointRadius.lg:r.default.pointRadius.lg,de=({data:e,value:P,ageLibrary:T,isDisplayOnly:
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),L=require("react"),X=require("react-i18next"),Y=require("use-resize-observer"),Z=require("lodash/round"),D=require("@rubin-epo/epo-react-lib/styles"),ee=require("./layout/Controls/index.cjs"),te=require("./charts/ScatterPlot/index.cjs"),se=require("./atomic/Button/patterns/Reset.cjs");require("./atomic/PlotWrapper/index.cjs");const ie=require("./charts/Readout/index.cjs"),re=require("./charts/PathFromPoints/index.cjs"),u=require("./lib/utils.cjs"),ne=require("./widgets/IsochronePlot/Controls/index.cjs"),r=require("./widgets/IsochronePlot/defaults.cjs"),oe=require("./widgets/IsochronePlot/A11Y/CurveFit.cjs"),W=require("./widgets/IsochronePlot/helpers.cjs"),ae=require("./atomic/PlotWrapper/styles.cjs"),I=e=>e&&e.__esModule?e:{default:e},le=I(Y),ue=I(Z),ce=e=>e?e<parseFloat(D.token("BREAK_PHABLET_MIN"))?r.default.pointRadius.md:e<parseFloat(D.token("BREAK_LARGE_TABLET"))?r.default.pointRadius.sm:r.default.pointRadius.lg:r.default.pointRadius.lg,de=({data:e,value:P,ageLibrary:T,isDisplayOnly:M=!1,isLoading:$,xAxis:k,yAxis:z,name:B,onChangeCallback:c})=>{const{ref:E,width:K}=le.default(),{t:d,i18n:{language:h}}=X.useTranslation(),[O,H]=L.useState(!0),q=L.useId(),n=!$&&!O,S={top:0,right:0,bottom:20,left:20},{width:g,height:f}=r.default,{ages:_={}}=T,i=Object.keys(_).sort((s,l)=>parseFloat(s)-parseFloat(l)).map(parseFloat),V=u.mergeWithDefaults(k,{...r.default.xAxis,label:d("isochrone_plot.plot.x_label")}),b=u.mergeWithDefaults(z,{...r.default.yAxis,label:d("isochrone_plot.plot.y_label")}),o={age:{min:i.length>0?Math.min(...i):0,max:i.length>0?Math.max(...i):0,step:ue.default(i[1]-i[0],1)||.5},distance:{min:0,max:b.min+1,step:.05}},R={age:i.length>0?u.middle(i):0,distance:(o.distance.max-o.distance.min)/2+o.distance.min},{age:a,distance:p}=u.mergeWithDefaults(P,R),w=ce(K),m={age:s=>W.ageToGyrs(s).toLocaleString(h,{minimumFractionDigits:3,maximumFractionDigits:3}),distance:s=>W.distanceToLyrs(s).toLocaleString(h,{maximumFractionDigits:0})},j={age:m.age(a),distance:m.distance(p)},G=t.jsx(ae.PlotWrapper,{ref:E,children:t.jsx(te.default,{renderer:"canvas",title:B,onLoadedCallback:()=>H(!1),data:{label:"Star Cluster",points:e.map(s=>({...s,radius:w,stroke:"rgba(18,114,108,0.5)",fill:"rgba(18,114,108,0.25)"}))},plotChildren:({Data:s,xScale:l,yScale:x,yStart:C,yEnd:v,xStart:y,xEnd:N,yDomain:J})=>{const A=(_[a.toFixed(1)]||[]).map(({x:Q,y:U})=>({x:l(Q),y:x(U)}))||[],F=x(p+J[1]);return t.jsxs(t.Fragment,{children:[s,a&&t.jsx(re.default,{points:A,svgProps:{strokeWidth:2,transform:`translate(0,${F})`}}),n&&t.jsx(ie.default,{viewport:{x:y,y:v,outerHeight:C-v,outerWidth:N-y,innerWidth:g,innerHeight:f},position:"center right",forIds:q,forScreenreaders:t.jsx(oe.default,{points:e,value:j,isochrone:A,offset:F,xScale:l,yScale:x,width:g,height:f}),children:d("isochrone_plot.output",{...j})})]})},width:g,height:f,xAxis:V,yAxis:b,margins:S})});return t.jsx(ee.default,{ratio:{portrait:2/3,landscape:3/2},widget:G,controls:t.jsx(ne.default,{isDisabled:!n,value:{age:a,distance:p},localizers:m,configs:o,onChangeCallback:c}),actions:t.jsx(se.default,{isDisabled:!n,onResetCallback:()=>{c&&c(R)}}),isLoading:!n,isDisplayOnly:M,controlsId:q})};exports.default=de;
|
package/dist/IsochronePlot.js
CHANGED
|
@@ -31,8 +31,8 @@ const dt = (r) => r ? r < parseFloat(W("BREAK_PHABLET_MIN")) ? i.pointRadius.md
|
|
|
31
31
|
const { ref: j, width: z } = Z(), {
|
|
32
32
|
t: c,
|
|
33
33
|
i18n: { language: x }
|
|
34
|
-
} = Y(), [C, H] = U(!0), b = X(), s = !T && !C, M = { top: 0, right: 0, bottom: 20, left: 20 }, { width: p, height: d } = i, { ages: F = {} } = D,
|
|
35
|
-
(
|
|
34
|
+
} = Y(), [C, H] = U(!0), b = X(), s = !T && !C, M = { top: 0, right: 0, bottom: 20, left: 20 }, { width: p, height: d } = i, { ages: F = {} } = D, o = Object.keys(F).sort(
|
|
35
|
+
(t, m) => parseFloat(t) - parseFloat(m)
|
|
36
36
|
).map(parseFloat), V = h(k, {
|
|
37
37
|
...i.xAxis,
|
|
38
38
|
label: c("isochrone_plot.plot.x_label")
|
|
@@ -41,24 +41,23 @@ const dt = (r) => r ? r < parseFloat(W("BREAK_PHABLET_MIN")) ? i.pointRadius.md
|
|
|
41
41
|
label: c("isochrone_plot.plot.y_label")
|
|
42
42
|
}), n = {
|
|
43
43
|
age: {
|
|
44
|
-
min:
|
|
45
|
-
max:
|
|
46
|
-
step: tt(
|
|
47
|
-
marks: t
|
|
44
|
+
min: o.length > 0 ? Math.min(...o) : 0,
|
|
45
|
+
max: o.length > 0 ? Math.max(...o) : 0,
|
|
46
|
+
step: tt(o[1] - o[0], 1) || 0.5
|
|
48
47
|
},
|
|
49
48
|
distance: { min: 0, max: R.min + 1, step: 0.05 }
|
|
50
49
|
}, A = {
|
|
51
|
-
age:
|
|
50
|
+
age: o.length > 0 ? nt(o) : 0,
|
|
52
51
|
distance: (n.distance.max - n.distance.min) / 2 + n.distance.min
|
|
53
52
|
}, { age: a, distance: u } = h(
|
|
54
53
|
B,
|
|
55
54
|
A
|
|
56
55
|
), w = dt(z), g = {
|
|
57
|
-
age: (
|
|
58
|
-
minimumFractionDigits:
|
|
59
|
-
maximumFractionDigits:
|
|
56
|
+
age: (t) => lt(t).toLocaleString(x, {
|
|
57
|
+
minimumFractionDigits: 3,
|
|
58
|
+
maximumFractionDigits: 3
|
|
60
59
|
}),
|
|
61
|
-
distance: (
|
|
60
|
+
distance: (t) => ct(t).toLocaleString(x, {
|
|
62
61
|
maximumFractionDigits: 0
|
|
63
62
|
})
|
|
64
63
|
}, L = {
|
|
@@ -72,15 +71,15 @@ const dt = (r) => r ? r < parseFloat(W("BREAK_PHABLET_MIN")) ? i.pointRadius.md
|
|
|
72
71
|
onLoadedCallback: () => H(!1),
|
|
73
72
|
data: {
|
|
74
73
|
label: "Star Cluster",
|
|
75
|
-
points: r.map((
|
|
76
|
-
...
|
|
74
|
+
points: r.map((t) => ({
|
|
75
|
+
...t,
|
|
77
76
|
radius: w,
|
|
78
77
|
stroke: "rgba(18,114,108,0.5)",
|
|
79
78
|
fill: "rgba(18,114,108,0.25)"
|
|
80
79
|
}))
|
|
81
80
|
},
|
|
82
81
|
plotChildren: ({
|
|
83
|
-
Data:
|
|
82
|
+
Data: t,
|
|
84
83
|
xScale: m,
|
|
85
84
|
yScale: f,
|
|
86
85
|
yStart: O,
|
|
@@ -91,7 +90,7 @@ const dt = (r) => r ? r < parseFloat(W("BREAK_PHABLET_MIN")) ? i.pointRadius.md
|
|
|
91
90
|
}) => {
|
|
92
91
|
const v = (F[a.toFixed(1)] || []).map(({ x: $, y: q }) => ({ x: m($), y: f(q) })) || [], y = f(u + N[1]);
|
|
93
92
|
return /* @__PURE__ */ J(Q, { children: [
|
|
94
|
-
|
|
93
|
+
t,
|
|
95
94
|
a && /* @__PURE__ */ e(
|
|
96
95
|
st,
|
|
97
96
|
{
|
package/package.json
CHANGED