@rubin-epo/epo-widget-lib 2.0.4 → 2.0.5

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 strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),c=require("@rubin-epo/epo-react-lib/styles");require("../Base/index.cjs");require("../XAxis/index.cjs");require("../YAxis/index.cjs");require("../Guidelines/index.cjs");require("../Tooltip/index.cjs");require("../Bars/index.cjs");const d=require("../Viewport/index.cjs"),y=require("../ForeignObject/index.cjs");require("../ScatterPlot/index.cjs");const o=require("./styles.cjs"),j=(r="")=>{const i=["top","right"],a=["center","center"],n=r?[...r.split(" "),...a].slice(0,2):i,e={justifyContent:null,alignItems:null};return n.forEach(s=>{switch(s){case"center":e.alignItems=e.alignItems??"center",e.justifyContent=e.justifyContent??"center";break;case"top":e.alignItems="start";break;case"right":e.justifyContent="end";break;case"bottom":e.alignItems="end";break;case"left":e.justifyContent="start";break}}),e},u=({className:r,children:i,position:a,viewport:n,forIds:e,forScreenreaders:s})=>{const l=t.jsx(y.default,{children:t.jsx(o.DisplayContainer,{style:j(a),children:t.jsxs(o.Display,{form:Array.isArray(e)?e.join(" "):e,className:r,children:[t.jsx("span",{"aria-hidden":!!s,children:i}),t.jsx(c.ScreenreaderText,{children:s})]})})});return n?t.jsx(d.default,{...n,children:l}):l};u.displayName="Charts.Readout";exports.default=u;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),u=require("@rubin-epo/epo-react-lib/styles"),o=require("./styles.cjs"),d=require("../ForeignObject/index.cjs"),y=require("../Viewport/index.cjs"),j=(n="")=>{const r=["top","right"],a=["center","center"],s=n?[...n.split(" "),...a].slice(0,2):r,e={justifyContent:null,alignItems:null};return s.forEach(i=>{switch(i){case"center":e.alignItems=e.alignItems??"center",e.justifyContent=e.justifyContent??"center";break;case"top":e.alignItems="start";break;case"right":e.justifyContent="end";break;case"bottom":e.alignItems="end";break;case"left":e.justifyContent="start";break}}),e},c=({className:n,children:r,position:a,viewport:s,forIds:e,forScreenreaders:i})=>{const l=t.jsx(d.default,{children:t.jsx(o.DisplayContainer,{style:j(a),children:t.jsxs(o.Display,{form:Array.isArray(e)?e.join(" "):e,className:n,children:[t.jsx("span",{"aria-hidden":!!i,children:r}),t.jsx(u.ScreenreaderText,{children:i})]})})});return s?t.jsx(y.default,{...s,children:l}):l};c.displayName="Charts.Readout";exports.default=c;
@@ -1,22 +1,15 @@
1
1
  import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
2
  import { ScreenreaderText as c } from "@rubin-epo/epo-react-lib/styles";
3
- import "../Base/index.js";
4
- import "../XAxis/index.js";
5
- import "../YAxis/index.js";
6
- import "../Guidelines/index.js";
7
- import "../Tooltip/index.js";
8
- import "../Bars/index.js";
9
- import m from "../Viewport/index.js";
10
- import p from "../ForeignObject/index.js";
11
- import "../ScatterPlot/index.js";
12
- import { DisplayContainer as f, Display as u } from "./styles.js";
13
- const d = (i = "") => {
14
- const o = ["top", "right"], s = ["center", "center"], r = i ? [...i.split(" "), ...s].slice(0, 2) : o, t = {
3
+ import { DisplayContainer as m, Display as f } from "./styles.js";
4
+ import u from "../ForeignObject/index.js";
5
+ import d from "../Viewport/index.js";
6
+ const p = (n = "") => {
7
+ const s = ["top", "right"], o = ["center", "center"], i = n ? [...n.split(" "), ...o].slice(0, 2) : s, t = {
15
8
  justifyContent: null,
16
9
  alignItems: null
17
10
  };
18
- return r.forEach((n) => {
19
- switch (n) {
11
+ return i.forEach((r) => {
12
+ switch (r) {
20
13
  case "center":
21
14
  t.alignItems = t.alignItems ?? "center", t.justifyContent = t.justifyContent ?? "center";
22
15
  break;
@@ -35,25 +28,25 @@ const d = (i = "") => {
35
28
  }
36
29
  }), t;
37
30
  }, y = ({
38
- className: i,
39
- children: o,
40
- position: s,
41
- viewport: r,
31
+ className: n,
32
+ children: s,
33
+ position: o,
34
+ viewport: i,
42
35
  forIds: t,
43
- forScreenreaders: n
36
+ forScreenreaders: r
44
37
  }) => {
45
- const a = /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(f, { style: d(s), children: /* @__PURE__ */ l(
46
- u,
38
+ const a = /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(m, { style: p(o), children: /* @__PURE__ */ l(
39
+ f,
47
40
  {
48
41
  form: Array.isArray(t) ? t.join(" ") : t,
49
- className: i,
42
+ className: n,
50
43
  children: [
51
- /* @__PURE__ */ e("span", { "aria-hidden": !!n, children: o }),
52
- /* @__PURE__ */ e(c, { children: n })
44
+ /* @__PURE__ */ e("span", { "aria-hidden": !!r, children: s }),
45
+ /* @__PURE__ */ e(c, { children: r })
53
46
  ]
54
47
  }
55
48
  ) }) });
56
- return r ? /* @__PURE__ */ e(m, { ...r, children: a }) : a;
49
+ return i ? /* @__PURE__ */ e(d, { ...i, children: a }) : a;
57
50
  };
58
51
  y.displayName = "Charts.Readout";
59
52
  export {
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),J=require("react");require("../Base/index.cjs");const K=require("../XAxis/index.cjs"),Q=require("../YAxis/index.cjs"),$=require("../Guidelines/index.cjs"),U=require("../Points/index.cjs"),V=require("../Tooltip/index.cjs"),X=require("../ClippingContainer/index.cjs");require("../Bars/index.cjs");require("../Viewport/index.cjs");const R=require("../hooks/useAxis.cjs"),Y=require("./styles.cjs"),H=require("../defaults.cjs"),Z=require("../canvas/Points/index.cjs"),w={svg:U.default,canvas:Z.default},M=({data:C,className:D,xAxis:l,yAxis:c,width:d,height:u,title:T,activePointId:p,margins:z,tooltip:a,onLoadedCallback:B,renderer:E="svg",plotChildren:y})=>{const[q,h]=J.useState(),{label:O,points:x}=C,o={...H.default.margins,...z},e=typeof q<"u"?x[q]:x.find(({id:v})=>v===p),f=[0+o.left,d-o.right],b=[u-o.bottom,0+o.top],[r,j,t]=R.default({...l,range:f}),[i,m,s]=R.default({...c,range:b}),S=s(i[0]),g=t(r[0]),I=s(i[1]),_=t(r[1]),k="x-axis-label",L="y-axis-label",N=Math.abs(f[1]-f[0]),W=Math.abs(b[1]-b[0]),F=w[E],P=n.jsx(F,{data:x,onHoverCallback:a?v=>h(v):void 0,onHoverOutCallback:a?()=>h(void 0):void 0,width:d,height:u,xScale:t,yScale:s,label:O,onLoadedCallback:B}),G={Data:P,xScale:t,yScale:s,yStart:S,yEnd:I,xStart:g,xEnd:_,yDomain:i,xDomain:r};return n.jsxs(Y.Chart,{verticalLabel:c.label,verticalLabelId:L,horizontalLabel:l.label,horizontalLabelId:k,className:D,width:d,height:u,title:T,children:[n.jsx(Q.default,{ticks:m,x:g,labelledById:L,yDomain:i,yScale:s}),n.jsxs(X.default,{x:g,y:I,width:N,height:W,children:[l.guidelines&&n.jsx($.default,{guides:j.length,direction:"vertical",xDomain:r,yDomain:i,xScale:t,yScale:s}),c.guidelines&&n.jsx($.default,{guides:m.length,xDomain:r,yDomain:i,xScale:t,yScale:s}),y?y(G):P]}),n.jsx(K.default,{ticks:j,y:S,labelledById:k,xDomain:r,xScale:t}),a&&n.jsxs(V.default,{x:e?t(e.x):void 0,y:e?s(e.y):void 0,visible:!!e,offset:H.default.pointRadius,children:[e&&typeof a=="function"&&a(e),e&&typeof a=="string"&&a]})]})};M.displayName="Charts.ScatterPlot";exports.default=M;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),J=require("react"),$=require("../hooks/useAxis.cjs"),K=require("./styles.cjs"),R=require("../defaults.cjs"),Q=require("../canvas/Points/index.cjs"),U=require("../YAxis/index.cjs"),V=require("../ClippingContainer/index.cjs"),H=require("../Guidelines/index.cjs"),X=require("../XAxis/index.cjs"),Y=require("../Tooltip/index.cjs"),Z=require("../Points/index.cjs"),w={svg:Z.default,canvas:Q.default},M=({data:C,className:D,xAxis:l,yAxis:c,width:d,height:u,title:T,activePointId:p,margins:z,tooltip:a,onLoadedCallback:B,renderer:E="svg",plotChildren:y})=>{const[q,h]=J.useState(),{label:O,points:x}=C,o={...R.default.margins,...z},e=typeof q<"u"?x[q]:x.find(({id:v})=>v===p),f=[0+o.left,d-o.right],b=[u-o.bottom,0+o.top],[r,j,t]=$.default({...l,range:f}),[i,m,s]=$.default({...c,range:b}),S=s(i[0]),g=t(r[0]),I=s(i[1]),_=t(r[1]),k="x-axis-label",L="y-axis-label",N=Math.abs(f[1]-f[0]),W=Math.abs(b[1]-b[0]),F=w[E],P=n.jsx(F,{data:x,onHoverCallback:a?v=>h(v):void 0,onHoverOutCallback:a?()=>h(void 0):void 0,width:d,height:u,xScale:t,yScale:s,label:O,onLoadedCallback:B}),G={Data:P,xScale:t,yScale:s,yStart:S,yEnd:I,xStart:g,xEnd:_,yDomain:i,xDomain:r};return n.jsxs(K.Chart,{verticalLabel:c.label,verticalLabelId:L,horizontalLabel:l.label,horizontalLabelId:k,className:D,width:d,height:u,title:T,children:[n.jsx(U.default,{ticks:m,x:g,labelledById:L,yDomain:i,yScale:s}),n.jsxs(V.default,{x:g,y:I,width:N,height:W,children:[l.guidelines&&n.jsx(H.default,{guides:j.length,direction:"vertical",xDomain:r,yDomain:i,xScale:t,yScale:s}),c.guidelines&&n.jsx(H.default,{guides:m.length,xDomain:r,yDomain:i,xScale:t,yScale:s}),y?y(G):P]}),n.jsx(X.default,{ticks:j,y:S,labelledById:k,xDomain:r,xScale:t}),a&&n.jsxs(Y.default,{x:e?t(e.x):void 0,y:e?s(e.y):void 0,visible:!!e,offset:R.default.pointRadius,children:[e&&typeof a=="function"&&a(e),e&&typeof a=="string"&&a]})]})};M.displayName="Charts.ScatterPlot";exports.default=M;
@@ -1,22 +1,19 @@
1
1
  "use client";
2
- import { jsxs as u, jsx as s } from "react/jsx-runtime";
2
+ import { jsxs as u, jsx as i } from "react/jsx-runtime";
3
3
  import { useState as F } from "react";
4
- import "../Base/index.js";
5
- import J from "../XAxis/index.js";
6
- import K from "../YAxis/index.js";
7
- import R from "../Guidelines/index.js";
8
- import Q from "../Points/index.js";
9
- import U from "../Tooltip/index.js";
10
- import V from "../ClippingContainer/index.js";
11
- import "../Bars/index.js";
12
- import "../Viewport/index.js";
13
- import D from "../hooks/useAxis.js";
14
- import { Chart as Z } from "./styles.js";
15
- import T from "../defaults.js";
16
- import _ from "../canvas/Points/index.js";
4
+ import R from "../hooks/useAxis.js";
5
+ import { Chart as J } from "./styles.js";
6
+ import D from "../defaults.js";
7
+ import K from "../canvas/Points/index.js";
8
+ import Q from "../YAxis/index.js";
9
+ import U from "../ClippingContainer/index.js";
10
+ import T from "../Guidelines/index.js";
11
+ import V from "../XAxis/index.js";
12
+ import Z from "../Tooltip/index.js";
13
+ import _ from "../Points/index.js";
17
14
  const $ = {
18
- svg: Q,
19
- canvas: _
15
+ svg: _,
16
+ canvas: K
20
17
  }, w = ({
21
18
  data: j,
22
19
  className: z,
@@ -32,32 +29,32 @@ const $ = {
32
29
  renderer: G = "svg",
33
30
  plotChildren: x
34
31
  }) => {
35
- const [y, h] = F(), { label: N, points: f } = j, a = { ...T.margins, ...M }, t = typeof y < "u" ? f[y] : f.find(({ id: v }) => v === E), p = [0 + a.left, d - a.right], b = [m - a.bottom, 0 + a.top], [i, I, o] = D({ ...l, range: p }), [r, P, e] = D({ ...c, range: b }), S = e(r[0]), g = o(i[0]), k = e(r[1]), O = o(i[1]), C = "x-axis-label", L = "y-axis-label", W = Math.abs(p[1] - p[0]), X = Math.abs(b[1] - b[0]), Y = $[G], H = /* @__PURE__ */ s(
32
+ const [y, h] = F(), { label: N, points: f } = j, r = { ...D.margins, ...M }, t = typeof y < "u" ? f[y] : f.find(({ id: p }) => p === E), b = [0 + r.left, d - r.right], g = [m - r.bottom, 0 + r.top], [s, I, e] = R({ ...l, range: b }), [a, P, o] = R({ ...c, range: g }), S = o(a[0]), v = e(s[0]), k = o(a[1]), O = e(s[1]), C = "x-axis-label", L = "y-axis-label", W = Math.abs(b[1] - b[0]), X = Math.abs(g[1] - g[0]), Y = $[G], H = /* @__PURE__ */ i(
36
33
  Y,
37
34
  {
38
35
  data: f,
39
- onHoverCallback: n ? (v) => h(v) : void 0,
36
+ onHoverCallback: n ? (p) => h(p) : void 0,
40
37
  onHoverOutCallback: n ? () => h(void 0) : void 0,
41
38
  width: d,
42
39
  height: m,
43
- xScale: o,
44
- yScale: e,
40
+ xScale: e,
41
+ yScale: o,
45
42
  label: N,
46
43
  onLoadedCallback: A
47
44
  }
48
45
  ), q = {
49
46
  Data: H,
50
- xScale: o,
51
- yScale: e,
47
+ xScale: e,
48
+ yScale: o,
52
49
  yStart: S,
53
50
  yEnd: k,
54
- xStart: g,
51
+ xStart: v,
55
52
  xEnd: O,
56
- yDomain: r,
57
- xDomain: i
53
+ yDomain: a,
54
+ xDomain: s
58
55
  };
59
56
  return /* @__PURE__ */ u(
60
- Z,
57
+ J,
61
58
  {
62
59
  verticalLabel: c.label,
63
60
  verticalLabelId: L,
@@ -68,66 +65,66 @@ const $ = {
68
65
  height: m,
69
66
  title: B,
70
67
  children: [
71
- /* @__PURE__ */ s(
72
- K,
68
+ /* @__PURE__ */ i(
69
+ Q,
73
70
  {
74
71
  ticks: P,
75
- x: g,
72
+ x: v,
76
73
  labelledById: L,
77
- yDomain: r,
78
- yScale: e
74
+ yDomain: a,
75
+ yScale: o
79
76
  }
80
77
  ),
81
78
  /* @__PURE__ */ u(
82
- V,
79
+ U,
83
80
  {
84
- x: g,
81
+ x: v,
85
82
  y: k,
86
83
  width: W,
87
84
  height: X,
88
85
  children: [
89
- l.guidelines && /* @__PURE__ */ s(
90
- R,
86
+ l.guidelines && /* @__PURE__ */ i(
87
+ T,
91
88
  {
92
89
  guides: I.length,
93
90
  direction: "vertical",
94
- xDomain: i,
95
- yDomain: r,
96
- xScale: o,
97
- yScale: e
91
+ xDomain: s,
92
+ yDomain: a,
93
+ xScale: e,
94
+ yScale: o
98
95
  }
99
96
  ),
100
- c.guidelines && /* @__PURE__ */ s(
101
- R,
97
+ c.guidelines && /* @__PURE__ */ i(
98
+ T,
102
99
  {
103
100
  guides: P.length,
104
- xDomain: i,
105
- yDomain: r,
106
- xScale: o,
107
- yScale: e
101
+ xDomain: s,
102
+ yDomain: a,
103
+ xScale: e,
104
+ yScale: o
108
105
  }
109
106
  ),
110
107
  x ? x(q) : H
111
108
  ]
112
109
  }
113
110
  ),
114
- /* @__PURE__ */ s(
115
- J,
111
+ /* @__PURE__ */ i(
112
+ V,
116
113
  {
117
114
  ticks: I,
118
115
  y: S,
119
116
  labelledById: C,
120
- xDomain: i,
121
- xScale: o
117
+ xDomain: s,
118
+ xScale: e
122
119
  }
123
120
  ),
124
121
  n && /* @__PURE__ */ u(
125
- U,
122
+ Z,
126
123
  {
127
- x: t ? o(t.x) : void 0,
128
- y: t ? e(t.y) : void 0,
124
+ x: t ? e(t.x) : void 0,
125
+ y: t ? o(t.y) : void 0,
129
126
  visible: !!t,
130
- offset: T.pointRadius,
127
+ offset: D.pointRadius,
131
128
  children: [
132
129
  t && typeof n == "function" && n(t),
133
130
  t && typeof n == "string" && n
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),u=require("react"),n=require("../../../node_modules/prop-types/index.cjs"),i=require("@react-three/fiber");function o({...r}){const e=u.useRef();return u.useEffect(()=>{const t=e.current;t.zoom=r.defaultZoom,t.updateProjectionMatrix()},[]),i.useFrame(()=>{e.current.updateMatrixWorld()}),a.jsx("orthographicCamera",{ref:e,...r,makeDefault:!0,zoom:100})}o.propTypes={defaultZoom:n.default.number};exports.default=o;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),u=require("react"),i=require("../../../node_modules/prop-types/index.cjs"),n=require("@react-three/fiber"),c=require("@react-three/drei");function o({...r}){const e=u.useRef();return u.useEffect(()=>{const t=e.current;t.zoom=r.defaultZoom,t.updateProjectionMatrix()},[]),n.useFrame(()=>{e.current.updateMatrixWorld()}),a.jsx(c.OrthographicCamera,{ref:e,...r,makeDefault:!0})}o.propTypes={defaultZoom:i.default.number};exports.default=o;
@@ -3,18 +3,19 @@ import { jsx as t } from "react/jsx-runtime";
3
3
  import { useRef as m, useEffect as a } from "react";
4
4
  import u from "../../../node_modules/prop-types/index.js";
5
5
  import { useFrame as f } from "@react-three/fiber";
6
- function p({ ...r }) {
7
- const e = m();
6
+ import { OrthographicCamera as p } from "@react-three/drei";
7
+ function i({ ...e }) {
8
+ const r = m();
8
9
  return a(() => {
9
- const o = e.current;
10
- o.zoom = r.defaultZoom, o.updateProjectionMatrix();
10
+ const o = r.current;
11
+ o.zoom = e.defaultZoom, o.updateProjectionMatrix();
11
12
  }, []), f(() => {
12
- e.current.updateMatrixWorld();
13
- }), /* @__PURE__ */ t("orthographicCamera", { ref: e, ...r, makeDefault: !0, zoom: 100 });
13
+ r.current.updateMatrixWorld();
14
+ }), /* @__PURE__ */ t(p, { ref: r, ...e, makeDefault: !0 });
14
15
  }
15
- p.propTypes = {
16
+ i.propTypes = {
16
17
  defaultZoom: u.number
17
18
  };
18
19
  export {
19
- p as default
20
+ i as default
20
21
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),t=require("react"),b=t.createContext(null);function P(){const o=t.useContext(b);if(!o)throw new Error("OrbitalSim components cannot be rendered outside the OrbitalSimContext.Provider component.");return o}function g({children:o,orbitData:u,showDetailsTable:v=!1,allowOrbitRotation:m=!1,showTimeControls:d=!1,selectedAnswer:i,updateSelectedAnswer:x,swappableOrbits:O=!1}){const[a,c]=t.useState({neos:null,activeNeo:null,observations:[],paused:!1,pov:null,defaultZoom:null,potentialOrbits:!1,noDetails:!1,detailsRows:null,refObjs:null,noControls:!1}),[e,n]=t.useState(()=>a.observations??[]);t.useEffect(()=>{c(u),n(u.observations)},[u]),t.useEffect(()=>{if(e&&e.length>0){let l=e.map(r=>({...r,isActive:r.id===i}));n(l)}},[i]);const S=l=>{if(e&&e.length>0){let r=e.map(s=>s.id==l?{...s,isActive:!0}:{...s,isActive:!1});n(r);const f=e.find(s=>s.id===l);x((f==null?void 0:f.label)||null)}},p=t.useMemo(()=>({orbits:a,showDetailsTable:v,allowOrbitRotation:m,showTimeControls:d,setOrbits:c,observations:e,setObservations:n,updateActiveObservation:S,selectedAnswer:i,swappableOrbits:O}),[a,v,m,d,c,e,n,S,i,O]);return C.jsx(b.Provider,{value:p,children:o})}exports.OrbitalSimContext=b;exports.OrbitalSimProvider=g;exports.useOrbitalSimContext=P;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),t=require("react"),b=t.createContext(null);function P(){const o=t.useContext(b);if(!o)throw new Error("OrbitalSim components cannot be rendered outside the OrbitalSimContext.Provider component.");return o}function g({children:o,orbitData:u,showDetailsTable:v=!1,allowOrbitRotation:m=!1,showTimeControls:O=!1,selectedAnswer:i,updateSelectedAnswer:x,swappableOrbits:d=!1}){const[a,c]=t.useState({neos:null,activeNeo:null,observations:[],paused:!1,pov:null,defaultZoom:null,potentialOrbits:!1,noDetails:!1,detailsRows:null,refObjs:null,noControls:!1}),[e,n]=t.useState(()=>a.observations??[]);t.useEffect(()=>{c(u),n(u.observations)},[u]),t.useEffect(()=>{if(e&&e.length>0){let l=e.map(r=>({...r,isActive:r.label===i}));n(l)}},[i]);const S=l=>{if(e&&e.length>0){let r=e.map(s=>s.id==l?{...s,isActive:!0}:{...s,isActive:!1});n(r);const f=e.find(s=>s.id===l);x((f==null?void 0:f.label)||null)}},p=t.useMemo(()=>({orbits:a,showDetailsTable:v,allowOrbitRotation:m,showTimeControls:O,setOrbits:c,observations:e,setObservations:n,updateActiveObservation:S,selectedAnswer:i,swappableOrbits:d}),[a,v,m,O,c,e,n,S,i,d]);return C.jsx(b.Provider,{value:p,children:o})}exports.OrbitalSimContext=b;exports.OrbitalSimProvider=g;exports.useOrbitalSimContext=P;
@@ -39,15 +39,15 @@ function N({
39
39
  a(r), e(r.observations);
40
40
  }, [r]), O(() => {
41
41
  if (t && t.length > 0) {
42
- let i = t.map((l) => ({ ...l, isActive: l.id === s }));
43
- e(i);
42
+ let l = t.map((i) => ({ ...i, isActive: i.label === s }));
43
+ e(l);
44
44
  }
45
45
  }, [s]);
46
- const d = (i) => {
46
+ const d = (l) => {
47
47
  if (t && t.length > 0) {
48
- let l = t.map((n) => n.id == i ? { ...n, isActive: !0 } : { ...n, isActive: !1 });
49
- e(l);
50
- const f = t.find((n) => n.id === i);
48
+ let i = t.map((n) => n.id == l ? { ...n, isActive: !0 } : { ...n, isActive: !1 });
49
+ e(i);
50
+ const f = t.find((n) => n.id === l);
51
51
  S((f == null ? void 0 : f.label) || null);
52
52
  }
53
53
  }, C = h(() => ({
@@ -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"),M=require("./Orbitals/OrbitalDetails.cjs"),V=require("./Camera/CameraController.cjs"),W=require("./Camera/Camera.cjs"),B=require("./Orbitals/Orbitals.cjs"),G=require("./Sun.cjs"),N=require("./Controls/PlaybackSpeed.cjs"),A=require("./Controls/PlaybackControls.cjs"),l=require("./styles.cjs"),H=require("./Context/index.cjs");function I(){const{orbits:i,showDetailsTable:q,allowOrbitRotation:v,showTimeControls:m,swappableOrbits:x}=H.useOrbitalSimContext(),{paused:h,pov:y,defaultZoom:c,potentialOrbits:w,detailsRows:P}=i,u={min:1157e-8,max:365.25,initial:11.574,step:1},[n,a]=s.useState(!h),[D,o]=s.useState(1),[R,j]=s.useState(0),[O,d]=s.useState(h?0:u.initial),[g,p]=s.useState(0),[r,b]=s.useState(0),[C,k]=s.useState(1),[f,T]=s.useState({neos:[{Principal_desig:""}]});s.useEffect(()=>{m||(a(!1),d(0)),r>0?(d(u.initial),o(1),p(0),b(-1)):r<0&&(p(0),a(!0),b(0))},[r]);const Z=t=>{d(+t)},_=()=>{n||o(1),a(!n)},F=()=>{a(t=>!1),b(t=>t+1)},z=t=>{a(!1),o(1),j(S=>S+1)},L=t=>{a(!1),o(-1),j(S=>S+1)},E=t=>{T({neos:[t]})};return e.jsxs(e.Fragment,{children:[e.jsx(l.GlobalStyles,{}),e.jsxs(l.OrbitalSimWrapper,{children:[x?e.jsx(l.SwappableOrbitsContainer,{children:i&&i.neos&&i.neos.map(t=>e.jsx(l.SwappableOrbitButton,{onClick:()=>E(t),"data-active":Object.keys(f).length?t.Principal_desig===f.neos[0].Principal_desig:!1,children:t.Ref}))}):e.jsxs(e.Fragment,{children:[P&&q&&e.jsx(M.default,{}),m&&e.jsxs(e.Fragment,{children:[e.jsx(N.default,{elapsedTime:g,dayPerVizSec:O,speeds:u,sliderOnChangeCallback:Z}),e.jsx(A.default,{playing:n,handleStartStop:_,handleNext:z,handlePrevious:L,isDisabled:!1,handleReset:F})]})]}),e.jsxs(l.CanvasWrapper,{orthographic:!0,children:[e.jsx(V.default,{pov:v?null:y??"top",reset:r}),e.jsx(W.default,{left:5e3,right:15e3,top:15e3,bottom:-15e3,near:.1,far:3e4,position:[0,0,8e3],defaultZoom:c||1}),e.jsx("ambientLight",{intensity:.9}),e.jsx(B.default,{defaultZoom:c||1,playing:n,stepDirection:D,dayPerVizSec:O,frameOverride:R,potentialOrbits:w,elapsedTime:g,setElapsedTime:p,reset:r,zoomLevel:C,setZoomLevel:k,orbits:x?f:i}),e.jsx(G.default,{zoomLevel:C,defaultZoom:c||1})]})]})]})}exports.default=I;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),s=require("react"),M=require("./Orbitals/OrbitalDetails.cjs"),V=require("./Camera/CameraController.cjs"),W=require("./Camera/Camera.cjs"),B=require("./Orbitals/Orbitals.cjs"),G=require("./Sun.cjs"),N=require("./Controls/PlaybackSpeed.cjs"),A=require("./Controls/PlaybackControls.cjs"),l=require("./styles.cjs"),H=require("./Context/index.cjs");function I(){const{orbits:i,showDetailsTable:q,allowOrbitRotation:v,showTimeControls:m,swappableOrbits:x}=H.useOrbitalSimContext(),{paused:h,pov:y,defaultZoom:c,potentialOrbits:w,detailsRows:P}=i,u={min:1157e-8,max:365.25,initial:11.574,step:1},[n,a]=s.useState(!h),[D,o]=s.useState(1),[R,j]=s.useState(0),[O,d]=s.useState(h?0:u.initial),[g,p]=s.useState(0),[r,b]=s.useState(0),[C,k]=s.useState(1),[f,T]=s.useState({neos:[{Principal_desig:""}]});s.useEffect(()=>{m||(a(!1),d(0)),r>0?(d(u.initial),o(1),p(0),b(-1)):r<0&&(p(0),a(!0),b(0))},[r]);const Z=t=>{d(+t)},_=()=>{n||o(1),a(!n)},F=()=>{a(t=>!1),b(t=>t+1)},z=t=>{a(!1),o(1),j(S=>S+1)},L=t=>{a(!1),o(-1),j(S=>S+1)},E=t=>{T({neos:[t]})};return e.jsxs(e.Fragment,{children:[e.jsx(l.GlobalStyles,{}),e.jsxs(l.OrbitalSimWrapper,{children:[x?e.jsx(l.SwappableOrbitsContainer,{children:i&&i.neos&&i.neos.map(t=>e.jsx(l.SwappableOrbitButton,{onClick:()=>E(t),"data-active":Object.keys(f).length?t.Principal_desig===f.neos[0].Principal_desig:!1,children:t.Ref}))}):e.jsxs(e.Fragment,{children:[P&&q&&e.jsx(M.default,{}),m&&e.jsxs(e.Fragment,{children:[e.jsx(N.default,{elapsedTime:g,dayPerVizSec:O,speeds:u,sliderOnChangeCallback:Z}),e.jsx(A.default,{playing:n,handleStartStop:_,handleNext:z,handlePrevious:L,isDisabled:!1,handleReset:F})]})]}),e.jsxs(l.CanvasWrapper,{orthographic:!0,children:[e.jsx(V.default,{pov:v?null:y??"top",reset:r}),e.jsx(W.default,{left:-15e3,right:15e3,top:15e3,bottom:-15e3,near:.1,far:3e4,position:[0,0,8e3],defaultZoom:c||1}),e.jsx("ambientLight",{intensity:.9}),e.jsx(B.default,{defaultZoom:c||1,playing:n,stepDirection:D,dayPerVizSec:O,frameOverride:R,potentialOrbits:w,elapsedTime:g,setElapsedTime:p,reset:r,zoomLevel:C,setZoomLevel:k,orbits:x?f:i}),e.jsx(G.default,{zoomLevel:C,defaultZoom:c||1})]})]})]})}exports.default=I;
@@ -76,7 +76,7 @@ function ce() {
76
76
  /* @__PURE__ */ t(
77
77
  q,
78
78
  {
79
- left: 5e3,
79
+ left: -15e3,
80
80
  right: 15e3,
81
81
  top: 15e3,
82
82
  bottom: -15e3,
@@ -1 +1 @@
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
+ "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,19 +1,13 @@
1
1
  "use client";
2
- import { jsxs as h, jsx as o } from "react/jsx-runtime";
2
+ import { jsxs as h, jsx as e } 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 "../../../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";
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";
17
11
  const Y = ({
18
12
  className: y,
19
13
  objects: g = [],
@@ -21,38 +15,38 @@ const Y = ({
21
15
  visibleImages: w = [],
22
16
  describedById: B
23
17
  }) => {
24
- const [O, W] = L(!1), [f, u] = L(), s = 600, l = 300, i = {
18
+ const [O, W] = L(!1), [f, u] = L(), s = 600, l = 300, a = {
25
19
  top: 20,
26
20
  right: 0,
27
21
  bottom: 20,
28
22
  left: 20
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([
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([
31
25
  [p, k],
32
26
  [b, x]
33
- ]), a.fitExtent(
27
+ ]), i.fitExtent(
34
28
  [
35
- [i.left, i.top],
36
- [i.left + s - m, i.top + l]
29
+ [a.left, a.top],
30
+ [a.left + s - m, a.top + l]
37
31
  ],
38
- r.outline()
32
+ n.outline()
39
33
  );
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,
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,
47
41
  {
48
42
  style: { "--image-stack-opacity": O && 1 },
49
- x: i.left,
50
- y: i.top,
43
+ x: a.left,
44
+ y: a.top,
51
45
  width: s - m,
52
46
  height: l,
53
47
  mask: "url(#imageMask)",
54
- children: /* @__PURE__ */ o(
55
- q,
48
+ children: /* @__PURE__ */ e(
49
+ U,
56
50
  {
57
51
  images: v,
58
52
  describedById: B,
@@ -64,10 +58,10 @@ const Y = ({
64
58
  )
65
59
  }
66
60
  ),
67
- /* @__PURE__ */ o("g", { children: g.map(({ id: t, lat: T, long: $ }, A) => /* @__PURE__ */ o(
68
- J,
61
+ /* @__PURE__ */ e("g", { children: g.map(({ id: t, lat: T, long: $ }, A) => /* @__PURE__ */ e(
62
+ D,
69
63
  {
70
- d: n({
64
+ d: r({
71
65
  type: "Point",
72
66
  coordinates: [$, T]
73
67
  }),
@@ -76,14 +70,14 @@ const Y = ({
76
70
  },
77
71
  t
78
72
  )) }),
79
- /* @__PURE__ */ o("g", { "aria-hidden": "true", children: G.map(
73
+ /* @__PURE__ */ e("g", { "aria-hidden": "true", children: G.map(
80
74
  (t) => t === 0 ? null : /* @__PURE__ */ h(
81
- K,
75
+ F,
82
76
  {
83
77
  style: {
84
78
  dominantBaseline: t > 0 ? "text-after-edge" : "text-before-edge"
85
79
  },
86
- transform: `translate(${a([p, t])})`,
80
+ transform: `translate(${i([p, t])})`,
87
81
  children: [
88
82
  t,
89
83
  "°"
@@ -92,10 +86,10 @@ const Y = ({
92
86
  t
93
87
  )
94
88
  ) }),
95
- /* @__PURE__ */ o("g", { "aria-hidden": "true", children: H.map((t) => /* @__PURE__ */ h(
96
- Q,
89
+ /* @__PURE__ */ e("g", { "aria-hidden": "true", children: H.map((t) => /* @__PURE__ */ h(
90
+ J,
97
91
  {
98
- transform: `translate(${a([t, 0])})`,
92
+ transform: `translate(${i([t, 0])})`,
99
93
  children: [
100
94
  t,
101
95
  "°"
@@ -103,20 +97,20 @@ const Y = ({
103
97
  },
104
98
  t
105
99
  )) }),
106
- /* @__PURE__ */ o(
107
- X,
100
+ /* @__PURE__ */ e(
101
+ K,
108
102
  {
109
103
  strokeWidth: m,
110
- d: n(r.outline())
104
+ d: r(n.outline())
111
105
  }
112
106
  ),
113
- /* @__PURE__ */ o(
114
- V,
107
+ /* @__PURE__ */ e(
108
+ X,
115
109
  {
116
- visible: !!e,
110
+ visible: !!o,
117
111
  x: S[0],
118
112
  y: S[1],
119
- children: e == null ? void 0 : e.id
113
+ children: o == null ? void 0 : o.id
120
114
  }
121
115
  )
122
116
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubin-epo/epo-widget-lib",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
5
5
  "author": "Rubin EPO",
6
6
  "license": "MIT",