@rubin-epo/epo-widget-lib 2.0.11 → 2.1.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 (31) hide show
  1. package/dist/charts/Readout/index.cjs +1 -1
  2. package/dist/charts/Readout/index.js +25 -18
  3. package/dist/charts/ScatterPlot/index.cjs +1 -1
  4. package/dist/charts/ScatterPlot/index.js +53 -50
  5. package/dist/mock-data/OrbitalSim/index.d.ts +19 -10
  6. package/dist/widgets/OrbitalSim/Context/OrbitalSimContext.types.d.ts +5 -2
  7. package/dist/widgets/OrbitalSim/Context/index.cjs +1 -1
  8. package/dist/widgets/OrbitalSim/Context/index.d.ts +1 -1
  9. package/dist/widgets/OrbitalSim/Context/index.js +36 -34
  10. package/dist/widgets/OrbitalSim/OrbitalSim.cjs +1 -1
  11. package/dist/widgets/OrbitalSim/OrbitalSim.js +29 -29
  12. package/dist/widgets/OrbitalSim/Orbitals/Orbital.cjs +1 -1
  13. package/dist/widgets/OrbitalSim/Orbitals/Orbital.js +79 -79
  14. package/dist/widgets/OrbitalSim/Orbitals/OrbitalDetails.cjs +1 -1
  15. package/dist/widgets/OrbitalSim/Orbitals/OrbitalDetails.js +25 -24
  16. package/dist/widgets/OrbitalSim/Orbitals/Orbitals.cjs +1 -1
  17. package/dist/widgets/OrbitalSim/Orbitals/Orbitals.d.ts +2 -1
  18. package/dist/widgets/OrbitalSim/Orbitals/Orbitals.js +60 -59
  19. package/dist/widgets/OrbitalSim/Orbitals/styles.cjs +1 -1
  20. package/dist/widgets/OrbitalSim/Orbitals/styles.js +1 -1
  21. package/dist/widgets/OrbitalSim/Sun.cjs +1 -1
  22. package/dist/widgets/OrbitalSim/Sun.js +6 -6
  23. package/dist/widgets/OrbitalSim/orbitalUtilities.cjs +1 -1
  24. package/dist/widgets/OrbitalSim/orbitalUtilities.js +20 -21
  25. package/dist/widgets/OrbitalSim/styles.cjs +1 -1
  26. package/dist/widgets/OrbitalSim/styles.js +1 -1
  27. package/dist/widgets/SourceSelector/MovingSourceSelector.cjs +1 -1
  28. package/dist/widgets/SourceSelector/MovingSourceSelector.js +82 -85
  29. package/dist/widgets/SupernovaThreeVector/Skymap/index.cjs +1 -1
  30. package/dist/widgets/SupernovaThreeVector/Skymap/index.js +45 -39
  31. package/package.json +2 -3
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("three");function p(e){if(e&&e.__esModule)return e;const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const s=p(C),c=100,j=1,r={sun:{objectColor:"#f8da86"},earth:{objectColor:"#3f9ef0",orbitColor:"#3079b8"},mars:{objectColor:"#ed4c4c",orbitColor:"#b53a3a"},jupiter:{objectColor:"#f1b571",orbitColor:"#b98b57"},neptune:{objectColor:"#3cae3f",orbitColor:"#29762b"},asteroid:{objectColor:"#b1f2ef",orbitColor:"#6a6e6e",objectHighlight:"#00ffff",orbitHighlight:"#ffffff"},neos:{objectColor:"#0ff",orbitColor:"#b2ffff"}},b={a:1.4700451,e:.5598234,i:6.35515,H:16.25,Ref:"Apollo",name:"Apollo",Principal_desig:"1932 HA",Translated_desig_key:"neo.apollo",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},d={a:.740919,e:.3221221,i:25.62023,H:16.3,Ref:"Atira",Principal_desig:"2003 CP20",Translated_desig_key:"neo.atira",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},g={a:1.9194158,e:.4353207,i:11.87658,H:17.7,Ref:"Amor",Principal_desig:"1932 EA1",Translated_desig_key:"neo.amor",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},_={a:1,e:.01671022,i:0,H:-3.9,Ref:"Earth",Principal_desig:"Earth",Translated_desig_key:"planets.earth",orbitColor:r.earth.orbitColor,objectColor:r.earth.objectColor,objectRadius:5},m={a:1.52366231,e:.09341233,i:1.85061,H:-1.52,Ref:"Mars",Principal_desig:"Mars",Translated_desig_key:"planets.mars",orbitColor:r.mars.orbitColor,objectColor:r.mars.objectColor,objectRadius:4},A={a:5.2028,e:.048,i:1.31,H:-25.9,Ref:"Jupiter",Principal_desig:"Jupiter",Translated_desig_key:"planets.jupiter",orbitColor:r.jupiter.orbitColor,objectColor:r.jupiter.objectColor,objectRadius:7},R={a:30.06896348,e:.00858587,i:1.76917,H:-25.9,Ref:"Neptune",Principal_desig:"Neptune",Translated_desig_key:"planets.neptune",orbitColor:r.neptune.orbitColor,objectColor:r.neptune.objectColor,objectRadius:6},T=e=>({neptune:R,earth:_,mars:m,jupiter:A,atira:d,apollo:b,amor:g})[e]||null,P=function(e,o){return Number.parseFloat(Number.parseFloat(e).toFixed(o))},y=(e,o,t=0,n=0)=>new s.EllipseCurve(t,n,e,o,0,2*Math.PI,!1,0),h=e=>new s.BufferGeometry().setFromPoints(e),S=(e,o)=>{const t=e.distanceTo(o),{x:n,y:i}=e;return Math.acos((t**2+n**2-i**2)/(2*t*n))*180/Math.PI},O=(e,o)=>{const{x:t,y:n}=o.getPoint(e);return new s.Vector3(t,n,0)},f=e=>e*c,M=e=>e/c,x=(e,o)=>f(e*Math.sqrt(1-o**2)),E=e=>1496e8*e,a=e=>e*(Math.PI/180),z=(e,o)=>{const t=.000296005155*c**3;return Math.sqrt(t*(2/e-1/o))},L=(e,o)=>Math.sqrt(e**2-o**2),H=(e,o)=>{const{i:t,Peri:n,Node:i}=o,l=new s.Vector3(0,1,0),u=new s.Vector3(0,0,1);return new s.Vector3(e.x,e.y,0).applyAxisAngle(u,n?a(n+90):0).applyAxisAngle(l,a(t)).applyAxisAngle(u,i?a(i):0)},V=(e,o)=>{const i=15*(e/o);return i<=4?4:i>=15?15:i};exports.AU_TO_VIZ_SCALER=c;exports.DAY_PER_VIZ_SEC=j;exports.ORBITAL_COLORS=r;exports.amor=g;exports.apollo=b;exports.atira=d;exports.auToMeters=E;exports.auToUnit=f;exports.convert2dTo3d=H;exports.degsToRads=a;exports.formatValue=P;exports.getAngleFromPos=S;exports.getCurve=y;exports.getFocus=L;exports.getLabelSize=V;exports.getLineGeometry=h;exports.getMinorAxis=x;exports.getPosFromArcLength=O;exports.getRefObjProps=T;exports.getVelocity=z;exports.unitToAu=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("three");function p(o){if(o&&o.__esModule)return o;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const s=p(f),c=100,j=1,r={sun:{objectColor:"#f8da86"},earth:{objectColor:"#3f9ef0",orbitColor:"#3079b8"},mars:{objectColor:"#ed4c4c",orbitColor:"#b53a3a"},jupiter:{objectColor:"#f1b571",orbitColor:"#b98b57"},neptune:{objectColor:"#3cae3f",orbitColor:"#29762b"},asteroid:{objectColor:"#b1f2ef",orbitColor:"#6a6e6e",objectHighlight:"#00ffff",orbitHighlight:"#ffffff"},neos:{objectColor:"#0ff",orbitColor:"#b2ffff"}},u={a:1.4700451,e:.5598234,i:6.35515,H:16.25,Ref:"Apollo",name:"Apollo",Principal_desig:"1932 HA",Translated_desig_key:"neo.apollo",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},d={a:.740919,e:.3221221,i:25.62023,H:16.3,Ref:"Atira",Principal_desig:"2003 CP20",Translated_desig_key:"neo.atira",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},g={a:1.9194158,e:.4353207,i:11.87658,H:17.7,Ref:"Amor",Principal_desig:"1932 EA1",Translated_desig_key:"neo.amor",orbitColor:r.neos.orbitColor,objectColor:r.neos.objectColor,objectRadius:5},_={a:1,e:.01671022,i:0,H:-3.9,Ref:"Earth",Principal_desig:"Earth",Translated_desig_key:"planets.earth",orbitColor:r.earth.orbitColor,objectColor:r.earth.objectColor,objectRadius:5},m={a:1.52366231,e:.09341233,i:1.85061,H:-1.52,Ref:"Mars",Principal_desig:"Mars",Translated_desig_key:"planets.mars",orbitColor:r.mars.orbitColor,objectColor:r.mars.objectColor,objectRadius:4},A={a:5.2028,e:.048,i:1.31,H:-25.9,Ref:"Jupiter",Principal_desig:"Jupiter",Translated_desig_key:"planets.jupiter",orbitColor:r.jupiter.orbitColor,objectColor:r.jupiter.objectColor,objectRadius:7},R={a:30.06896348,e:.00858587,i:1.76917,H:-25.9,Ref:"Neptune",Principal_desig:"Neptune",Translated_desig_key:"planets.neptune",orbitColor:r.neptune.orbitColor,objectColor:r.neptune.objectColor,objectRadius:6},T=o=>({neptune:R,earth:_,mars:m,jupiter:A,atira:d,apollo:u,amor:g})[o]||null,P=function(o,e){return Number.parseFloat(Number.parseFloat(o).toFixed(e))},y=(o,e,t=0,n=0)=>new s.EllipseCurve(t,n,o,e,0,2*Math.PI,!1,0),h=(o,e)=>{const t=o.distanceTo(e),{x:n,y:i}=o;return Math.acos((t**2+n**2-i**2)/(2*t*n))*180/Math.PI},S=(o,e)=>{const{x:t,y:n}=e.getPoint(o);return new s.Vector3(t,n,0)},C=o=>o*c,O=o=>o/c,M=(o,e)=>C(o*Math.sqrt(1-e**2)),x=o=>1496e8*o,a=o=>o*(Math.PI/180),E=(o,e)=>{const t=.000296005155*c**3;return Math.sqrt(t*(2/o-1/e))},z=(o,e)=>Math.sqrt(o**2-e**2),H=(o,e)=>{const{i:t,Peri:n,Node:i}=e,l=new s.Vector3(0,1,0),b=new s.Vector3(0,0,1);return new s.Vector3(o.x,o.y,0).applyAxisAngle(b,n?a(n+90):0).applyAxisAngle(l,a(t)).applyAxisAngle(b,i?a(i):0)},V=(o,e)=>{const i=15*(o/e);return i<=12?12:i>=15?15:i};exports.AU_TO_VIZ_SCALER=c;exports.DAY_PER_VIZ_SEC=j;exports.ORBITAL_COLORS=r;exports.amor=g;exports.apollo=u;exports.atira=d;exports.auToMeters=x;exports.auToUnit=C;exports.convert2dTo3d=H;exports.degsToRads=a;exports.formatValue=P;exports.getAngleFromPos=h;exports.getCurve=y;exports.getFocus=z;exports.getLabelSize=V;exports.getMinorAxis=M;exports.getPosFromArcLength=S;exports.getRefObjProps=T;exports.getVelocity=E;exports.unitToAu=O;
@@ -63,7 +63,7 @@ const l = 100, m = 1, t = {
63
63
  orbitColor: t.neos.orbitColor,
64
64
  objectColor: t.neos.objectColor,
65
65
  objectRadius: 5
66
- }, f = {
66
+ }, p = {
67
67
  a: 1,
68
68
  e: 0.01671022,
69
69
  i: 0,
@@ -74,7 +74,7 @@ const l = 100, m = 1, t = {
74
74
  orbitColor: t.earth.orbitColor,
75
75
  objectColor: t.earth.objectColor,
76
76
  objectRadius: 5
77
- }, p = {
77
+ }, f = {
78
78
  a: 1.52366231,
79
79
  e: 0.09341233,
80
80
  i: 1.85061,
@@ -85,7 +85,7 @@ const l = 100, m = 1, t = {
85
85
  orbitColor: t.mars.orbitColor,
86
86
  objectColor: t.mars.objectColor,
87
87
  objectRadius: 4
88
- }, g = {
88
+ }, j = {
89
89
  a: 5.2028,
90
90
  e: 0.048,
91
91
  i: 1.31,
@@ -97,7 +97,7 @@ const l = 100, m = 1, t = {
97
97
  objectColor: t.jupiter.objectColor,
98
98
  // objectRadius: 69911000,
99
99
  objectRadius: 7
100
- }, j = {
100
+ }, g = {
101
101
  a: 30.06896348,
102
102
  e: 858587e-8,
103
103
  i: 1.76917,
@@ -110,10 +110,10 @@ const l = 100, m = 1, t = {
110
110
  // objectRadius: 24622000,
111
111
  objectRadius: 6
112
112
  }, R = (o) => ({
113
- neptune: j,
114
- earth: f,
115
- mars: p,
116
- jupiter: g,
113
+ neptune: g,
114
+ earth: p,
115
+ mars: f,
116
+ jupiter: j,
117
117
  atira: C,
118
118
  apollo: u,
119
119
  amor: d
@@ -136,24 +136,24 @@ const l = 100, m = 1, t = {
136
136
  // aClockwise
137
137
  0
138
138
  // aRotation
139
- ), P = (o) => new s.BufferGeometry().setFromPoints(o), y = (o, e) => {
139
+ ), P = (o, e) => {
140
140
  const r = o.distanceTo(e), { x: n, y: i } = o;
141
141
  return Math.acos((r ** 2 + n ** 2 - i ** 2) / (2 * r * n)) * 180 / Math.PI;
142
142
  }, T = (o, e) => {
143
143
  const { x: r, y: n } = e.getPoint(o);
144
144
  return new s.Vector3(r, n, 0);
145
- }, _ = (o) => o * l, x = (o) => o / l, M = (o, e) => _(o * Math.sqrt(1 - e ** 2)), S = (o) => 1496e8 * o, a = (o) => o * (Math.PI / 180), z = (o, e) => {
145
+ }, _ = (o) => o * l, x = (o) => o / l, y = (o, e) => _(o * Math.sqrt(1 - e ** 2)), M = (o) => 1496e8 * o, a = (o) => o * (Math.PI / 180), S = (o, e) => {
146
146
  const r = 296005155e-12 * l ** 3;
147
147
  return Math.sqrt(r * (2 / o - 1 / e));
148
- }, H = (o, e) => Math.sqrt(o ** 2 - e ** 2), E = (o, e) => {
148
+ }, z = (o, e) => Math.sqrt(o ** 2 - e ** 2), H = (o, e) => {
149
149
  const { i: r, Peri: n, Node: i } = e, c = new s.Vector3(0, 1, 0), b = new s.Vector3(0, 0, 1);
150
150
  return new s.Vector3(o.x, o.y, 0).applyAxisAngle(b, n ? a(n + 90) : 0).applyAxisAngle(c, a(r)).applyAxisAngle(
151
151
  b,
152
152
  i ? a(i) : 0
153
153
  );
154
- }, V = (o, e) => {
154
+ }, E = (o, e) => {
155
155
  const i = 15 * (o / e);
156
- return i <= 4 ? 4 : i >= 15 ? 15 : i;
156
+ return i <= 12 ? 12 : i >= 15 ? 15 : i;
157
157
  };
158
158
  export {
159
159
  l as AU_TO_VIZ_SCALER,
@@ -162,19 +162,18 @@ export {
162
162
  d as amor,
163
163
  u as apollo,
164
164
  C as atira,
165
- S as auToMeters,
165
+ M as auToMeters,
166
166
  _ as auToUnit,
167
- E as convert2dTo3d,
167
+ H as convert2dTo3d,
168
168
  a as degsToRads,
169
169
  A as formatValue,
170
- y as getAngleFromPos,
170
+ P as getAngleFromPos,
171
171
  h as getCurve,
172
- H as getFocus,
173
- V as getLabelSize,
174
- P as getLineGeometry,
175
- M as getMinorAxis,
172
+ z as getFocus,
173
+ E as getLabelSize,
174
+ y as getMinorAxis,
176
175
  T as getPosFromArcLength,
177
176
  R as getRefObjProps,
178
- z as getVelocity,
177
+ S as getVelocity,
179
178
  x as unitToAu
180
179
  };
@@ -45,7 +45,7 @@
45
45
  position: relative;
46
46
  z-index: 1;
47
47
  `,d=e.default.div`
48
- padding: 2px 4px;
48
+ padding: 0px 4px;
49
49
  margin-top: 4px;
50
50
  font-weight: var(--medium);
51
51
  color: var(--black);
@@ -48,7 +48,7 @@ const o = t`
48
48
  position: relative;
49
49
  z-index: 1;
50
50
  `, d = e.div`
51
- padding: 2px 4px;
51
+ padding: 0px 4px;
52
52
  margin-top: 4px;
53
53
  font-weight: var(--medium);
54
54
  color: var(--black);
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),l=require("react"),G=require("react-i18next"),J=require("../../layout/AspectRatio/index.cjs"),K=require("../../atomic/Loader/index.cjs"),Q=require("@rubin-epo/epo-react-lib/IconComposer"),U=require("./MovingSourceMap/index.cjs"),k=require("./utils.cjs"),Z=require("./styles.cjs"),O=require("../../hooks/useInterval.cjs"),ee=require("./Message/Message.cjs"),te=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),se=e=>e&&e.__esModule?e:{default:e},ne=se(Q),oe=(e,n)=>{var d;const t={day:0,hour:0},s=e[n];if(!s)return t;const c=(s==null?void 0:s.date)-((d=e[0])==null?void 0:d.date);return c?{day:Math.round(c)||0,hour:Math.round(24/c%24)||0}:t},re=(e,n,t)=>Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2)<=Math.pow(t,2),ce=(e,n,t)=>t?e[n]?[e[n].image]:[]:e.map(({image:s})=>s),y=({width:e=600,height:n=600,selectedSource:t=[],alerts:s=[],activeAlertIndex:c=0,alertChangeCallback:d,selectionCallback:q,blinkConfig:_,isDisplayOnly:i=!1,isLoading:P,className:w,movingSources:u=[]})=>{const[f,b]=l.useState(0),[B,F]=l.useState(!0),[p,L]=l.useState(!i),[R,I]=l.useState(),[T,m]=l.useState(!1),{t:S}=G.useTranslation(),j=!B&&!P,V=(r,g,h)=>{if(u)for(let a of u){const x=a.sources[f];if(re(r,{x:k.toDecimalPercent(x.x)*g,y:k.toDecimalPercent(x.y)*h},k.getRadius(a.type,a.radius)*g))return a.id}},v=()=>{I(S("source_selector.messages.failure")),m(!0)},N=()=>{L(r=>!r)},W=()=>{I(o.jsxs(o.Fragment,{children:[o.jsx(ne.default,{icon:"checkmark"}),S("source_selector.messages.success")]})),m(!0)},$=({clientX:r,clientY:g,target:h})=>{if(!j||i)return;const{tagName:a,clientWidth:x,clientHeight:C}=h;if(a.toLowerCase()!=="img")return;const{left:Y,top:A}=h.getBoundingClientRect(),M=V({x:r-Y,y:C-g+A},x,C);if(M){if(t.includes(M))return;q&&q(t.concat(M)),W()}else v()},z=()=>{m(!1)},{day:D,hour:E}=oe(s,c),H=ce(s,c,i),X=()=>{p&&(f>u[0].sources.length-2?b(0):b(r=>r+1))};return O.default(X,500),o.jsxs(J.default,{ratio:1,className:w,children:[!i&&o.jsx(ee.default,{onMessageChangeCallback:z,isVisible:T,children:R}),u&&o.jsx(Z.BackgroundBlinker,{images:H,activeIndex:f,blinkCallback:d,loadedCallback:()=>F(!1),onClickCallback:$,extraControls:s.length>0&&!i&&o.jsx(te.default,{day:D,hour:E}),interval:400,pauseCallback:N,..._,children:o.jsx(U.default,{width:e,height:n,isPlaying:p,currentIndex:f,movingSources:u,selectedSource:t})}),!j&&o.jsx(K.default,{})]})};y.displayName="Widgets.MovingSourceSelector";exports.default=y;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),h=require("react"),Y=require("react-i18next"),G=require("../../layout/AspectRatio/index.cjs"),J=require("../../atomic/Loader/index.cjs"),K=require("@rubin-epo/epo-react-lib/IconComposer"),Q=require("./MovingSourceMap/index.cjs"),C=require("./utils.cjs"),U=require("./styles.cjs"),Z=require("./Message/Message.cjs"),v=require("../../atomic/ElapsedTime/ElapsedTime.cjs"),A=e=>e&&e.__esModule?e:{default:e},O=A(K),ee=(e,n)=>{var u;const t={day:0,hour:0},s=e[n];if(!s)return t;const o=(s==null?void 0:s.date)-((u=e[0])==null?void 0:u.date);return o?{day:Math.round(o)||0,hour:Math.round(24/o%24)||0}:t},te=(e,n,t)=>Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2)<=Math.pow(t,2),se=(e,n,t)=>t?e[n]?[e[n].image]:[]:e.map(({image:s})=>s),S=({width:e=600,height:n=600,selectedSource:t=[],alerts:s=[],activeAlertIndex:o=0,alertChangeCallback:u,selectionCallback:k,blinkConfig:j,isDisplayOnly:a=!1,isLoading:y,className:_,movingSources:l=[]})=>{const[P,I]=h.useState(!0),[w,F]=h.useState(!a),[L,b]=h.useState(),[B,m]=h.useState(!1),{t:p}=Y.useTranslation(),q=!P&&!y,R=(i,d,f)=>{if(l)for(let c of l){const g=c.sources[o];if(te(i,{x:C.toDecimalPercent(g.x)*d,y:C.toDecimalPercent(g.y)*f},C.getRadius(c.type,c.radius)*d))return c.id}},T=()=>{b(p("source_selector.messages.failure")),m(!0)},V=()=>{F(i=>!i)},N=()=>{b(r.jsxs(r.Fragment,{children:[r.jsx(O.default,{icon:"checkmark"}),p("source_selector.messages.success")]})),m(!0)},W=({clientX:i,clientY:d,target:f})=>{if(!q||a)return;const{tagName:c,clientWidth:g,clientHeight:x}=f;if(c.toLowerCase()!=="img")return;const{left:H,top:X}=f.getBoundingClientRect(),M=R({x:i-H,y:x-d+X},g,x);if(M){if(t.includes(M))return;k&&k(t.concat(M)),N()}else T()},$=()=>{m(!1)},{day:z,hour:D}=ee(s,o),E=se(s,o,a);return r.jsxs(G.default,{ratio:1,className:_,children:[!a&&r.jsx(Z.default,{onMessageChangeCallback:$,isVisible:B,children:L}),l&&r.jsx(U.BackgroundBlinker,{images:E,activeIndex:o,blinkCallback:u,loadedCallback:()=>I(!1),onClickCallback:W,extraControls:s.length>0&&!a&&r.jsx(v.default,{day:z,hour:D}),interval:400,pauseCallback:V,...j,children:r.jsx(Q.default,{width:e,height:n,isPlaying:w,currentIndex:o,movingSources:l,selectedSource:t})}),!q&&r.jsx(J.default,{})]})};S.displayName="Widgets.MovingSourceSelector";exports.default=S;
@@ -1,129 +1,126 @@
1
1
  "use client";
2
- import { jsxs as B, jsx as a, Fragment as J } from "react/jsx-runtime";
3
- import { useState as u } from "react";
2
+ import { jsxs as S, jsx as i, Fragment as J } from "react/jsx-runtime";
3
+ import { useState as g } from "react";
4
4
  import { useTranslation as K } from "react-i18next";
5
5
  import Q from "../../layout/AspectRatio/index.js";
6
6
  import U from "../../atomic/Loader/index.js";
7
7
  import Z from "@rubin-epo/epo-react-lib/IconComposer";
8
8
  import $ from "./MovingSourceMap/index.js";
9
- import { getRadius as D, toDecimalPercent as L } from "./utils.js";
10
- import { BackgroundBlinker as O } from "./styles.js";
11
- import ee from "../../hooks/useInterval.js";
12
- import te from "./Message/Message.js";
13
- import oe from "../../atomic/ElapsedTime/ElapsedTime.js";
14
- const ne = (e, n) => {
15
- var d;
16
- const t = { day: 0, hour: 0 }, o = e[n];
17
- if (!o) return t;
18
- const r = (o == null ? void 0 : o.date) - ((d = e[0]) == null ? void 0 : d.date);
9
+ import { getRadius as D, toDecimalPercent as x } from "./utils.js";
10
+ import { BackgroundBlinker as v } from "./styles.js";
11
+ import A from "./Message/Message.js";
12
+ import O from "../../atomic/ElapsedTime/ElapsedTime.js";
13
+ const ee = (e, s) => {
14
+ var u;
15
+ const o = { day: 0, hour: 0 }, t = e[s];
16
+ if (!t) return o;
17
+ const r = (t == null ? void 0 : t.date) - ((u = e[0]) == null ? void 0 : u.date);
19
18
  return r ? {
20
19
  day: Math.round(r) || 0,
21
20
  hour: Math.round(24 / r % 24) || 0
22
- } : t;
23
- }, se = (e, n, t) => Math.pow(e.x - n.x, 2) + Math.pow(e.y - n.y, 2) <= Math.pow(t, 2), re = (e, n, t) => t ? e[n] ? [e[n].image] : [] : e.map(({ image: o }) => o), ie = ({
21
+ } : o;
22
+ }, oe = (e, s, o) => Math.pow(e.x - s.x, 2) + Math.pow(e.y - s.y, 2) <= Math.pow(o, 2), te = (e, s, o) => o ? e[s] ? [e[s].image] : [] : e.map(({ image: t }) => t), se = ({
24
23
  width: e = 600,
25
- height: n = 600,
26
- selectedSource: t = [],
27
- alerts: o = [],
24
+ height: s = 600,
25
+ selectedSource: o = [],
26
+ alerts: t = [],
28
27
  activeAlertIndex: r = 0,
29
- alertChangeCallback: d,
30
- selectionCallback: M,
31
- blinkConfig: P,
32
- isDisplayOnly: c = !1,
33
- isLoading: w,
34
- className: F,
28
+ alertChangeCallback: u,
29
+ selectionCallback: C,
30
+ blinkConfig: L,
31
+ isDisplayOnly: a = !1,
32
+ isLoading: P,
33
+ className: w,
35
34
  movingSources: l = []
36
35
  }) => {
37
- const [f, x] = u(0), [R, V] = u(!0), [b, j] = u(!c), [N, I] = u(), [T, p] = u(!1), { t: y } = K(), S = !R && !w, W = (s, m, g) => {
36
+ const [F, I] = g(!0), [B, R] = g(!a), [V, k] = g(), [j, h] = g(!1), { t: b } = K(), y = !F && !P, N = (c, d, f) => {
38
37
  if (l)
39
- for (let i of l) {
40
- const h = i.sources[f];
41
- if (se(
42
- s,
38
+ for (let n of l) {
39
+ const m = n.sources[r];
40
+ if (oe(
41
+ c,
43
42
  {
44
- x: L(h.x) * m,
45
- y: L(h.y) * g
43
+ x: x(m.x) * d,
44
+ y: x(m.y) * f
46
45
  },
47
- D(i.type, i.radius) * m
46
+ D(n.type, n.radius) * d
48
47
  ))
49
- return i.id;
48
+ return n.id;
50
49
  }
50
+ }, T = () => {
51
+ k(b("source_selector.messages.failure")), h(!0);
52
+ }, W = () => {
53
+ R((c) => !c);
51
54
  }, _ = () => {
52
- I(y("source_selector.messages.failure")), p(!0);
53
- }, v = () => {
54
- j((s) => !s);
55
- }, z = () => {
56
- I(
57
- /* @__PURE__ */ B(J, { children: [
58
- /* @__PURE__ */ a(Z, { icon: "checkmark" }),
59
- y("source_selector.messages.success")
55
+ k(
56
+ /* @__PURE__ */ S(J, { children: [
57
+ /* @__PURE__ */ i(Z, { icon: "checkmark" }),
58
+ b("source_selector.messages.success")
60
59
  ] })
61
- ), p(!0);
62
- }, A = ({
63
- clientX: s,
64
- clientY: m,
65
- target: g
60
+ ), h(!0);
61
+ }, z = ({
62
+ clientX: c,
63
+ clientY: d,
64
+ target: f
66
65
  }) => {
67
- if (!S || c) return;
66
+ if (!y || a) return;
68
67
  const {
69
- tagName: i,
70
- clientWidth: h,
71
- clientHeight: k
72
- } = g;
73
- if (i.toLowerCase() !== "img") return;
74
- const { left: q, top: G } = g.getBoundingClientRect(), C = W(
75
- { x: s - q, y: k - m + G },
76
- h,
77
- k
68
+ tagName: n,
69
+ clientWidth: m,
70
+ clientHeight: p
71
+ } = f;
72
+ if (n.toLowerCase() !== "img") return;
73
+ const { left: q, top: G } = f.getBoundingClientRect(), M = N(
74
+ { x: c - q, y: p - d + G },
75
+ m,
76
+ p
78
77
  );
79
- if (C) {
80
- if (t.includes(C)) return;
81
- M && M(t.concat(C)), z();
78
+ if (M) {
79
+ if (o.includes(M)) return;
80
+ C && C(o.concat(M)), _();
82
81
  } else
83
- _();
82
+ T();
84
83
  }, E = () => {
85
- p(!1);
86
- }, { day: H, hour: X } = ne(o, r), Y = re(o, r, c);
87
- return ee(() => {
88
- b && (f > l[0].sources.length - 2 ? x(0) : x((s) => s + 1));
89
- }, 500), /* @__PURE__ */ B(Q, { ratio: 1, className: F, children: [
90
- !c && /* @__PURE__ */ a(
91
- te,
84
+ h(!1);
85
+ }, { day: H, hour: X } = ee(t, r), Y = te(t, r, a);
86
+ return /* @__PURE__ */ S(Q, { ratio: 1, className: w, children: [
87
+ !a && /* @__PURE__ */ i(
88
+ A,
92
89
  {
93
90
  onMessageChangeCallback: E,
94
- isVisible: T,
95
- children: N
91
+ isVisible: j,
92
+ children: V
96
93
  }
97
94
  ),
98
- l && /* @__PURE__ */ a(
99
- O,
95
+ l && /* @__PURE__ */ i(
96
+ v,
100
97
  {
101
98
  images: Y,
102
- activeIndex: f,
103
- blinkCallback: d,
104
- loadedCallback: () => V(!1),
105
- onClickCallback: A,
106
- extraControls: o.length > 0 && !c && /* @__PURE__ */ a(oe, { day: H, hour: X }),
99
+ activeIndex: r,
100
+ blinkCallback: u,
101
+ loadedCallback: () => I(!1),
102
+ onClickCallback: z,
103
+ extraControls: t.length > 0 && !a && /* @__PURE__ */ i(O, { day: H, hour: X }),
107
104
  interval: 400,
108
- pauseCallback: v,
109
- ...P,
110
- children: /* @__PURE__ */ a(
105
+ pauseCallback: W,
106
+ ...L,
107
+ children: /* @__PURE__ */ i(
111
108
  $,
112
109
  {
113
110
  width: e,
114
- height: n,
115
- isPlaying: b,
116
- currentIndex: f,
111
+ height: s,
112
+ isPlaying: B,
113
+ currentIndex: r,
117
114
  movingSources: l,
118
- selectedSource: t
115
+ selectedSource: o
119
116
  }
120
117
  )
121
118
  }
122
119
  ),
123
- !S && /* @__PURE__ */ a(U, {})
120
+ !y && /* @__PURE__ */ i(U, {})
124
121
  ] });
125
122
  };
126
- ie.displayName = "Widgets.MovingSourceSelector";
123
+ se.displayName = "Widgets.MovingSourceSelector";
127
124
  export {
128
- ie as default
125
+ se as default
129
126
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),S=require("react"),_=require("d3-geo-projection"),M=require("d3-geo"),q=require("d3-array"),E=require("../../../atomic/ImageStack/index.cjs"),a=require("./styles.cjs"),N=require("../../../charts/Base/index.cjs"),U=require("../../../charts/Tooltip/index.cjs"),y=({className:L,objects:p=[],images:v=[],visibleImages:w=[],describedById:G})=>{const[O,P]=S.useState(!1),[x,f]=S.useState(),l=600,c=300,n={top:20,right:0,bottom:20,left:20},W=l+n.right+n.left,$=c+n.top+n.bottom,d=15,u=30,j=-90,m=90,g=-180,k=180,h=2,i=_.geoAitoff(),s=M.geoGraticule();s.step([u,d]),s.extent([[g,j],[k,m]]),i.fitExtent([[n.left,n.top],[n.left+l-h,n.top+c]],s.outline());const B=q.range(j+d,m,d),A=q.range(g+u,k,u),C=M.geoPath(i).pointRadius(6),r=t=>C(t)||void 0,o=typeof x<"u"?p[x]:void 0,b=(o?i([o==null?void 0:o.long,o==null?void 0:o.lat]):[0,0])||[0,0];return e.jsxs(N.default,{width:W,height:$,className:L,children:[e.jsx("mask",{id:"imageMask",children:e.jsx("path",{d:r(s.outline()),fill:"white"})}),e.jsx(a.Background,{d:r(s.outline())}),e.jsx(a.Graticule,{d:r(s())}),e.jsx(a.ImageStackerWrapper,{style:{"--image-stack-opacity":O&&1},x:n.left,y:n.top,width:l-h,height:c,mask:"url(#imageMask)",children:e.jsx(E.default,{images:v,describedById:G,visible:w,loadCallback:()=>P(!0),showBackdrop:!1,showLoader:!1})}),e.jsx("g",{children:p.map(({id:t,lat:H,long:R},T)=>e.jsx(a.UserObject,{d:r({type:"Point",coordinates:[R,H]}),onMouseOver:()=>f(T),onMouseOut:()=>f(void 0)},t))}),e.jsx("g",{"aria-hidden":"true",children:B.map(t=>t===0?null:e.jsxs(a.LatLabel,{style:{dominantBaseline:t>0?"text-after-edge":"text-before-edge"},transform:`translate(${i([g,t])})`,children:[t,"°"]},t))}),e.jsx("g",{"aria-hidden":"true",children:A.map(t=>e.jsxs(a.LongLabel,{transform:`translate(${i([t,0])})`,children:[t,"°"]},t))}),e.jsx(a.Outline,{strokeWidth:h,d:r(s.outline())}),e.jsx(U.default,{visible:!!o,x:b[0],y:b[1],children:o==null?void 0:o.id})]})};y.displayName="Widgets.SupernovaThreeVector.Skymap";exports.default=y;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),b=require("react"),_=require("d3-geo-projection"),S=require("d3-geo"),M=require("d3-array"),E=require("../../../charts/Base/index.cjs");require("../../../charts/XAxis/index.cjs");require("../../../charts/YAxis/index.cjs");require("../../../charts/Guidelines/index.cjs");const N=require("../../../charts/Tooltip/index.cjs");require("../../../charts/Bars/index.cjs");require("../../../charts/Viewport/index.cjs");require("../../../charts/ScatterPlot/index.cjs");const U=require("../../../atomic/ImageStack/index.cjs"),r=require("./styles.cjs"),y=({className:L,objects:p=[],images:v=[],visibleImages:w=[],describedById:G})=>{const[O,P]=b.useState(!1),[x,f]=b.useState(),l=600,c=300,n={top:20,right:0,bottom:20,left:20},W=l+n.right+n.left,$=c+n.top+n.bottom,d=15,u=30,j=-90,m=90,g=-180,q=180,h=2,i=_.geoAitoff(),s=S.geoGraticule();s.step([u,d]),s.extent([[g,j],[q,m]]),i.fitExtent([[n.left,n.top],[n.left+l-h,n.top+c]],s.outline());const B=M.range(j+d,m,d),A=M.range(g+u,q,u),C=S.geoPath(i).pointRadius(6),a=t=>C(t)||void 0,o=typeof x<"u"?p[x]:void 0,k=(o?i([o==null?void 0:o.long,o==null?void 0:o.lat]):[0,0])||[0,0];return e.jsxs(E.default,{width:W,height:$,className:L,children:[e.jsx("mask",{id:"imageMask",children:e.jsx("path",{d:a(s.outline()),fill:"white"})}),e.jsx(r.Background,{d:a(s.outline())}),e.jsx(r.Graticule,{d:a(s())}),e.jsx(r.ImageStackerWrapper,{style:{"--image-stack-opacity":O&&1},x:n.left,y:n.top,width:l-h,height:c,mask:"url(#imageMask)",children:e.jsx(U.default,{images:v,describedById:G,visible:w,loadCallback:()=>P(!0),showBackdrop:!1,showLoader:!1})}),e.jsx("g",{children:p.map(({id:t,lat:H,long:R},T)=>e.jsx(r.UserObject,{d:a({type:"Point",coordinates:[R,H]}),onMouseOver:()=>f(T),onMouseOut:()=>f(void 0)},t))}),e.jsx("g",{"aria-hidden":"true",children:B.map(t=>t===0?null:e.jsxs(r.LatLabel,{style:{dominantBaseline:t>0?"text-after-edge":"text-before-edge"},transform:`translate(${i([g,t])})`,children:[t,"°"]},t))}),e.jsx("g",{"aria-hidden":"true",children:A.map(t=>e.jsxs(r.LongLabel,{transform:`translate(${i([t,0])})`,children:[t,"°"]},t))}),e.jsx(r.Outline,{strokeWidth:h,d:a(s.outline())}),e.jsx(N.default,{visible:!!o,x:k[0],y:k[1],children:o==null?void 0:o.id})]})};y.displayName="Widgets.SupernovaThreeVector.Skymap";exports.default=y;
@@ -1,13 +1,19 @@
1
1
  "use client";
2
- import { jsxs as h, jsx as e } from "react/jsx-runtime";
2
+ import { jsxs as h, jsx as o } from "react/jsx-runtime";
3
3
  import { useState as L } from "react";
4
4
  import { geoAitoff as E } from "d3-geo-projection";
5
5
  import { geoGraticule as N, geoPath as R } from "d3-geo";
6
6
  import { range as M } from "d3-array";
7
- import U from "../../../atomic/ImageStack/index.js";
8
- import { Background as V, Graticule as q, ImageStackerWrapper as z, UserObject as D, LatLabel as F, LongLabel as J, Outline as K } from "./styles.js";
9
- import Q from "../../../charts/Base/index.js";
10
- import X from "../../../charts/Tooltip/index.js";
7
+ import U from "../../../charts/Base/index.js";
8
+ import "../../../charts/XAxis/index.js";
9
+ import "../../../charts/YAxis/index.js";
10
+ import "../../../charts/Guidelines/index.js";
11
+ import V from "../../../charts/Tooltip/index.js";
12
+ import "../../../charts/Bars/index.js";
13
+ import "../../../charts/Viewport/index.js";
14
+ import "../../../charts/ScatterPlot/index.js";
15
+ import q from "../../../atomic/ImageStack/index.js";
16
+ import { Background as z, Graticule as D, ImageStackerWrapper as F, UserObject as J, LatLabel as K, LongLabel as Q, Outline as X } from "./styles.js";
11
17
  const Y = ({
12
18
  className: y,
13
19
  objects: g = [],
@@ -15,38 +21,38 @@ const Y = ({
15
21
  visibleImages: w = [],
16
22
  describedById: B
17
23
  }) => {
18
- const [O, W] = L(!1), [f, u] = L(), s = 600, l = 300, a = {
24
+ const [O, W] = L(!1), [f, u] = L(), s = 600, l = 300, i = {
19
25
  top: 20,
20
26
  right: 0,
21
27
  bottom: 20,
22
28
  left: 20
23
- }, j = s + a.right + a.left, C = l + a.top + a.bottom, c = 15, d = 30, k = -90, x = 90, p = -180, b = 180, m = 2, i = E(), n = N();
24
- n.step([d, c]), n.extent([
29
+ }, j = s + i.right + i.left, C = l + i.top + i.bottom, c = 15, d = 30, k = -90, x = 90, p = -180, b = 180, m = 2, a = E(), r = N();
30
+ r.step([d, c]), r.extent([
25
31
  [p, k],
26
32
  [b, x]
27
- ]), i.fitExtent(
33
+ ]), a.fitExtent(
28
34
  [
29
- [a.left, a.top],
30
- [a.left + s - m, a.top + l]
35
+ [i.left, i.top],
36
+ [i.left + s - m, i.top + l]
31
37
  ],
32
- n.outline()
38
+ r.outline()
33
39
  );
34
- const G = M(k + c, x, c), H = M(p + d, b, d), P = R(i).pointRadius(6), r = (t) => P(t) || void 0, o = typeof f < "u" ? g[f] : void 0, S = (o ? i([o == null ? void 0 : o.long, o == null ? void 0 : o.lat]) : [0, 0]) || [0, 0];
35
- return /* @__PURE__ */ h(Q, { width: j, height: C, className: y, children: [
36
- /* @__PURE__ */ e("mask", { id: "imageMask", children: /* @__PURE__ */ e("path", { d: r(n.outline()), fill: "white" }) }),
37
- /* @__PURE__ */ e(V, { d: r(n.outline()) }),
38
- /* @__PURE__ */ e(q, { d: r(n()) }),
39
- /* @__PURE__ */ e(
40
- z,
40
+ const G = M(k + c, x, c), H = M(p + d, b, d), P = R(a).pointRadius(6), n = (t) => P(t) || void 0, e = typeof f < "u" ? g[f] : void 0, S = (e ? a([e == null ? void 0 : e.long, e == null ? void 0 : e.lat]) : [0, 0]) || [0, 0];
41
+ return /* @__PURE__ */ h(U, { width: j, height: C, className: y, children: [
42
+ /* @__PURE__ */ o("mask", { id: "imageMask", children: /* @__PURE__ */ o("path", { d: n(r.outline()), fill: "white" }) }),
43
+ /* @__PURE__ */ o(z, { d: n(r.outline()) }),
44
+ /* @__PURE__ */ o(D, { d: n(r()) }),
45
+ /* @__PURE__ */ o(
46
+ F,
41
47
  {
42
48
  style: { "--image-stack-opacity": O && 1 },
43
- x: a.left,
44
- y: a.top,
49
+ x: i.left,
50
+ y: i.top,
45
51
  width: s - m,
46
52
  height: l,
47
53
  mask: "url(#imageMask)",
48
- children: /* @__PURE__ */ e(
49
- U,
54
+ children: /* @__PURE__ */ o(
55
+ q,
50
56
  {
51
57
  images: v,
52
58
  describedById: B,
@@ -58,10 +64,10 @@ const Y = ({
58
64
  )
59
65
  }
60
66
  ),
61
- /* @__PURE__ */ e("g", { children: g.map(({ id: t, lat: T, long: $ }, A) => /* @__PURE__ */ e(
62
- D,
67
+ /* @__PURE__ */ o("g", { children: g.map(({ id: t, lat: T, long: $ }, A) => /* @__PURE__ */ o(
68
+ J,
63
69
  {
64
- d: r({
70
+ d: n({
65
71
  type: "Point",
66
72
  coordinates: [$, T]
67
73
  }),
@@ -70,14 +76,14 @@ const Y = ({
70
76
  },
71
77
  t
72
78
  )) }),
73
- /* @__PURE__ */ e("g", { "aria-hidden": "true", children: G.map(
79
+ /* @__PURE__ */ o("g", { "aria-hidden": "true", children: G.map(
74
80
  (t) => t === 0 ? null : /* @__PURE__ */ h(
75
- F,
81
+ K,
76
82
  {
77
83
  style: {
78
84
  dominantBaseline: t > 0 ? "text-after-edge" : "text-before-edge"
79
85
  },
80
- transform: `translate(${i([p, t])})`,
86
+ transform: `translate(${a([p, t])})`,
81
87
  children: [
82
88
  t,
83
89
  "°"
@@ -86,10 +92,10 @@ const Y = ({
86
92
  t
87
93
  )
88
94
  ) }),
89
- /* @__PURE__ */ e("g", { "aria-hidden": "true", children: H.map((t) => /* @__PURE__ */ h(
90
- J,
95
+ /* @__PURE__ */ o("g", { "aria-hidden": "true", children: H.map((t) => /* @__PURE__ */ h(
96
+ Q,
91
97
  {
92
- transform: `translate(${i([t, 0])})`,
98
+ transform: `translate(${a([t, 0])})`,
93
99
  children: [
94
100
  t,
95
101
  "°"
@@ -97,20 +103,20 @@ const Y = ({
97
103
  },
98
104
  t
99
105
  )) }),
100
- /* @__PURE__ */ e(
101
- K,
106
+ /* @__PURE__ */ o(
107
+ X,
102
108
  {
103
109
  strokeWidth: m,
104
- d: r(n.outline())
110
+ d: n(r.outline())
105
111
  }
106
112
  ),
107
- /* @__PURE__ */ e(
108
- X,
113
+ /* @__PURE__ */ o(
114
+ V,
109
115
  {
110
- visible: !!o,
116
+ visible: !!e,
111
117
  x: S[0],
112
118
  y: S[1],
113
- children: o == null ? void 0 : o.id
119
+ children: e == null ? void 0 : e.id
114
120
  }
115
121
  )
116
122
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubin-epo/epo-widget-lib",
3
- "version": "2.0.11",
3
+ "version": "2.1.0",
4
4
  "description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
5
5
  "author": "Rubin EPO",
6
6
  "license": "MIT",
@@ -102,8 +102,7 @@
102
102
  "dependencies": {
103
103
  "@react-three/drei": "^10.7.6",
104
104
  "@react-three/fiber": "9",
105
- "@rubin-epo/epo-react-lib": "3.0.2",
106
- "@rubin-epo/epo-widget-lib": "2.0.2",
105
+ "@rubin-epo/epo-react-lib": "3.0.3",
107
106
  "context-filter-polyfill": "^0.3.6",
108
107
  "d3-array": "^3.2.4",
109
108
  "d3-geo": "^3.1.1",