@rubin-epo/epo-widget-lib 2.0.13 → 2.2.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.
@@ -12,7 +12,6 @@ export declare const SwappableOrbitsData: {
12
12
  objectColor: string;
13
13
  objectRadius: number;
14
14
  }[];
15
- defaultZoom: number;
16
15
  };
17
16
  swappableOrbits: boolean;
18
17
  };
@@ -59,7 +58,6 @@ export declare const PrimaryData: {
59
58
  selectionCallback: () => void;
60
59
  paused: boolean;
61
60
  pov: string;
62
- defaultZoom: number;
63
61
  potentialOrbits: null;
64
62
  observations: null;
65
63
  noDetails: boolean;
@@ -98,7 +96,6 @@ export declare const PotentialOrbitsData: {
98
96
  selectionCallback: () => void;
99
97
  paused: null;
100
98
  pov: null;
101
- defaultZoom: number;
102
99
  potentialOrbits: boolean;
103
100
  observations: ({
104
101
  id: string;
@@ -127,8 +124,10 @@ export declare const PotentialOrbitsData: {
127
124
  export declare const ObjectDetailsData: {
128
125
  orbits: {
129
126
  neos: {
130
- H: number;
127
+ Number: null;
128
+ Name: null;
131
129
  Principal_desig: string;
130
+ Epoch: string;
132
131
  M: number;
133
132
  Peri: number;
134
133
  Node: number;
@@ -136,16 +135,23 @@ export declare const ObjectDetailsData: {
136
135
  e: number;
137
136
  n: number;
138
137
  a: number;
138
+ Tp: number;
139
+ Orbital_period: number;
140
+ H: number;
141
+ G: number;
142
+ Perihelion_dist: number;
143
+ Aphelion_dist: number;
144
+ Orbit_type: number;
145
+ Arc_length: number;
139
146
  Ref: string;
140
- Orbit_type: string;
141
- diameter: number;
142
- Earth_moid: number;
143
- Jupiter_moid: number;
144
- }[];
145
- detailsRows: {
146
- rowColor: string;
147
- rowTitle: string;
148
- rowContent: string;
147
+ "Earth MOID": number;
148
+ object_details: ({
149
+ rowTitle: string;
150
+ rowContent: string;
151
+ } | {
152
+ rowTitle: string;
153
+ rowContent: number;
154
+ })[];
149
155
  }[];
150
156
  };
151
157
  showTimeControls: boolean;
@@ -154,7 +160,6 @@ export declare const ObjectDetailsData: {
154
160
  selectionCallback: () => void;
155
161
  paused: null;
156
162
  pov: null;
157
- defaultZoom: number;
158
163
  potentialOrbits: null;
159
164
  observations: null;
160
165
  detailsSet: string;
@@ -3,23 +3,27 @@ import { ReactNode } from 'react';
3
3
  export interface OrbitalSimProviderProps {
4
4
  children: ReactNode;
5
5
  orbitData: Orbits;
6
+ defaultZoom: number;
6
7
  showDetailsTable?: boolean;
7
8
  allowOrbitRotation?: boolean;
8
9
  showTimeControls?: boolean;
9
- selectedAnswer: string | null;
10
- updateSelectedAnswer: (newSelectedAnswer: string | null) => void;
10
+ selectedAnswer?: string | null;
11
+ updateSelectedAnswer?: (newSelectedAnswer: string | null) => void;
11
12
  swappableOrbits?: boolean;
13
+ selectedNeoIndex?: number;
12
14
  }
13
15
  export type OrbitalSimContextValues = {
14
16
  orbits: Orbits;
17
+ defaultZoom: number;
15
18
  showDetailsTable?: boolean;
16
19
  allowOrbitRotation?: boolean;
17
20
  showTimeControls?: boolean;
18
21
  setOrbits: React.Dispatch<React.SetStateAction<Orbits>>;
19
22
  observations: Observation[];
20
23
  updateActiveObservation: (activeId: string) => void;
21
- selectedAnswer: string | null;
24
+ selectedAnswer?: string | null;
22
25
  swappableOrbits: boolean;
26
+ selectedNeoIndex?: number;
23
27
  };
24
28
  export type Observation = {
25
29
  id: string;
@@ -37,10 +41,11 @@ export type Neo = {
37
41
  Node: number;
38
42
  Ref: string;
39
43
  Principal_desig: string;
44
+ object_details?: DetailsRow[];
40
45
  };
41
46
  export type DetailsRow = {
42
47
  rowTitle: string;
43
- rowContent: string | TrustedHTML;
48
+ rowContent: string | number | TrustedHTML;
44
49
  };
45
50
  export type Orbits = {
46
51
  neos: Neo[] | null;
@@ -48,10 +53,9 @@ export type Orbits = {
48
53
  observations: Observation[];
49
54
  paused: boolean;
50
55
  pov: string | null;
51
- defaultZoom: number | null;
52
56
  potentialOrbits: boolean;
53
57
  noDetails: boolean;
54
- detailsRows: DetailsRow[] | null;
55
58
  refObjs: string[] | null;
56
59
  noControls: boolean;
60
+ selectedNeoIndex?: number;
57
61
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),c=t.createContext(null);function g(){const s=t.useContext(c);if(!s)throw new Error("OrbitalSim components cannot be rendered outside the OrbitalSimContext.Provider component.");return s}function j({children:s,orbitData:r,showDetailsTable:f=!1,allowOrbitRotation:b=!1,showTimeControls:v=!1,selectedAnswer:i,updateSelectedAnswer:x,swappableOrbits:m=!1}){const[l,u]=t.useState({neos:null,activeNeo:null,observations:[],paused:!1,pov:null,defaultZoom:null,potentialOrbits:!1,noDetails:!1,detailsRows:null,refObjs:null,noControls:!1}),[e,S]=t.useState(()=>l.observations??[]);t.useEffect(()=>{u(r),S(r.observations)},[r]);const d=t.useMemo(()=>e&&e.length>0?e.map(n=>({...n,isActive:n.label===i})):[],[i,e]),O=n=>{if(e&&e.length>0){let C=e.map(o=>o.id==n?{...o,isActive:!0}:{...o,isActive:!1});S(C);const a=e.find(o=>o.id===n);x((a==null?void 0:a.label)||null)}},p=t.useMemo(()=>({orbits:l,showDetailsTable:f,allowOrbitRotation:b,showTimeControls:v,setOrbits:u,observations:d,updateActiveObservation:O,selectedAnswer:i,swappableOrbits:m}),[l,f,b,v,u,d,O,i,m]);return P.jsx(c.Provider,{value:p,children:s})}exports.OrbitalSimContext=c;exports.OrbitalSimProvider=j;exports.useOrbitalSimContext=g;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react/jsx-runtime"),n=require("react"),a=n.createContext(null);function h(){const s=n.useContext(a);if(!s)throw new Error("OrbitalSim components cannot be rendered outside the OrbitalSimContext.Provider component.");return s}function M({children:s,orbitData:r,defaultZoom:c,showDetailsTable:b=!1,allowOrbitRotation:f=!1,showTimeControls:v=!1,selectedAnswer:o,updateSelectedAnswer:m,swappableOrbits:O=!1,selectedNeoIndex:S}){const[l,u]=n.useState({neos:null,activeNeo:null,observations:[],paused:!1,pov:null,potentialOrbits:!1,noDetails:!1,refObjs:null,noControls:!1}),[t,x]=n.useState(()=>l.observations??[]);n.useEffect(()=>{u(r),x(r.observations)},[r]);const C=n.useMemo(()=>t&&t.length>0?t.map(i=>({...i,isActive:i.label===o})):[],[o,t]),p=i=>{if(t&&t.length>0){let P=t.map(e=>e.id==i?{...e,isActive:!0}:{...e,isActive:!1});if(x(P),m){const e=t.find(g=>g.id===i);m((e==null?void 0:e.label)||null)}}},d=n.useMemo(()=>({orbits:l,defaultZoom:c,showDetailsTable:b,allowOrbitRotation:f,showTimeControls:v,setOrbits:u,observations:C,updateActiveObservation:p,selectedAnswer:o,swappableOrbits:O,selectedNeoIndex:S}),[l,c,b,f,v,u,C,p,o,O,S]);return j.jsx(a.Provider,{value:d,children:s})}exports.OrbitalSimContext=a;exports.OrbitalSimProvider=M;exports.useOrbitalSimContext=h;
@@ -27,4 +27,4 @@ export declare function useOrbitalSimContext(): OrbitalSimContextValues;
27
27
  *
28
28
  * @returns
29
29
  */
30
- export declare function OrbitalSimProvider({ children, orbitData, showDetailsTable, allowOrbitRotation, showTimeControls, selectedAnswer, updateSelectedAnswer, swappableOrbits }: OrbitalSimProviderProps): import("react/jsx-runtime").JSX.Element;
30
+ export declare function OrbitalSimProvider({ children, orbitData, defaultZoom, showDetailsTable, allowOrbitRotation, showTimeControls, selectedAnswer, updateSelectedAnswer, swappableOrbits, selectedNeoIndex }: OrbitalSimProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,78 +1,83 @@
1
1
  "use client";
2
- import { jsx as P } from "react/jsx-runtime";
3
- import { createContext as g, useState as p, useEffect as j, useMemo as x, useContext as A } from "react";
4
- const O = g(null);
5
- function N() {
6
- const o = A(O);
2
+ import { jsx as j } from "react/jsx-runtime";
3
+ import { createContext as E, useState as S, useEffect as A, useMemo as C, useContext as M } from "react";
4
+ const h = E(null);
5
+ function q() {
6
+ const o = M(h);
7
7
  if (!o)
8
8
  throw new Error(
9
9
  "OrbitalSim components cannot be rendered outside the OrbitalSimContext.Provider component."
10
10
  );
11
11
  return o;
12
12
  }
13
- function W({
13
+ function y({
14
14
  children: o,
15
15
  orbitData: i,
16
+ defaultZoom: u,
16
17
  showDetailsTable: a = !1,
17
18
  allowOrbitRotation: f = !1,
18
19
  showTimeControls: c = !1,
19
20
  selectedAnswer: s,
20
- updateSelectedAnswer: S,
21
- swappableOrbits: v = !1
21
+ updateSelectedAnswer: v,
22
+ swappableOrbits: b = !1,
23
+ selectedNeoIndex: m
22
24
  }) {
23
- const [l, r] = p({
25
+ const [r, l] = S({
24
26
  neos: null,
25
27
  activeNeo: null,
26
28
  observations: [],
27
29
  paused: !1,
28
30
  pov: null,
29
- defaultZoom: null,
30
31
  potentialOrbits: !1,
31
32
  noDetails: !1,
32
- detailsRows: null,
33
33
  refObjs: null,
34
34
  noControls: !1
35
- }), [t, b] = p(
36
- () => l.observations ?? []
35
+ }), [t, p] = S(
36
+ () => r.observations ?? []
37
37
  );
38
- j(() => {
39
- r(i), b(i.observations);
38
+ A(() => {
39
+ l(i), p(i.observations);
40
40
  }, [i]);
41
- const m = x(
42
- () => t && t.length > 0 ? t.map((e) => ({ ...e, isActive: e.label === s })) : [],
41
+ const O = C(
42
+ () => t && t.length > 0 ? t.map((n) => ({ ...n, isActive: n.label === s })) : [],
43
43
  [s, t]
44
- ), d = (e) => {
44
+ ), x = (n) => {
45
45
  if (t && t.length > 0) {
46
- let h = t.map((n) => n.id == e ? { ...n, isActive: !0 } : { ...n, isActive: !1 });
47
- b(h);
48
- const u = t.find((n) => n.id === e);
49
- S((u == null ? void 0 : u.label) || null);
46
+ let d = t.map((e) => e.id == n ? { ...e, isActive: !0 } : { ...e, isActive: !1 });
47
+ if (p(d), v) {
48
+ const e = t.find((g) => g.id === n);
49
+ v((e == null ? void 0 : e.label) || null);
50
+ }
50
51
  }
51
- }, C = x(() => ({
52
- orbits: l,
52
+ }, P = C(() => ({
53
+ orbits: r,
54
+ defaultZoom: u,
53
55
  showDetailsTable: a,
54
56
  allowOrbitRotation: f,
55
57
  showTimeControls: c,
56
- setOrbits: r,
57
- observations: m,
58
- updateActiveObservation: d,
58
+ setOrbits: l,
59
+ observations: O,
60
+ updateActiveObservation: x,
59
61
  selectedAnswer: s,
60
- swappableOrbits: v
62
+ swappableOrbits: b,
63
+ selectedNeoIndex: m
61
64
  }), [
62
- l,
65
+ r,
66
+ u,
63
67
  a,
64
68
  f,
65
69
  c,
66
- r,
67
- m,
68
- d,
70
+ l,
71
+ O,
72
+ x,
69
73
  s,
70
- v
74
+ b,
75
+ m
71
76
  ]);
72
- return /* @__PURE__ */ P(O.Provider, { value: C, children: o });
77
+ return /* @__PURE__ */ j(h.Provider, { value: P, children: o });
73
78
  }
74
79
  export {
75
- O as OrbitalSimContext,
76
- W as OrbitalSimProvider,
77
- N as useOrbitalSimContext
80
+ h as OrbitalSimContext,
81
+ y as OrbitalSimProvider,
82
+ q as useOrbitalSimContext
78
83
  };
@@ -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,{near:-1e3,far:1e3,position:[0,0,10],defaultZoom:c||3}),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"),N=require("./Camera/CameraController.cjs"),V=require("./Camera/Camera.cjs"),W=require("./Orbitals/Orbitals.cjs"),B=require("./Sun.cjs"),G=require("./Controls/PlaybackSpeed.cjs"),I=require("./Controls/PlaybackControls.cjs"),n=require("./styles.cjs"),A=require("./Context/index.cjs");function H(){const{orbits:i,defaultZoom:l,showDetailsTable:q,allowOrbitRotation:v,showTimeControls:m,swappableOrbits:x,selectedNeoIndex:y}=A.useOrbitalSimContext(),{paused:h,pov:P,potentialOrbits:w}=i,u={min:1157e-8,max:365.25,initial:11.574,step:1},[o,a]=s.useState(!h),[D,c]=s.useState(1),[k,j]=s.useState(0),[O,d]=s.useState(h?0:u.initial),[g,p]=s.useState(0),[r,b]=s.useState(0),[C,R]=s.useState(l),[f,T]=s.useState({neos:[{Principal_desig:""}]});s.useEffect(()=>{m||(a(!1),d(0)),r>0?(d(u.initial),c(1),p(0),b(-1)):r<0&&(p(0),a(!0),b(0))},[r]);const Z=t=>{d(+t)},_=()=>{o||c(1),a(!o)},F=()=>{a(t=>!1),b(t=>t+1)},z=t=>{a(!1),c(1),j(S=>S+1)},L=t=>{a(!1),c(-1),j(S=>S+1)},E=t=>{T({neos:[t]})};return e.jsxs(e.Fragment,{children:[e.jsx(n.GlobalStyles,{}),e.jsxs(n.OrbitalSimWrapper,{children:[x?e.jsx(n.SwappableOrbitsContainer,{children:i&&i.neos&&i.neos.map(t=>e.jsx(n.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:[q&&e.jsx(M.default,{}),m&&e.jsxs(e.Fragment,{children:[e.jsx(G.default,{elapsedTime:g,dayPerVizSec:O,speeds:u,sliderOnChangeCallback:Z}),e.jsx(I.default,{playing:o,handleStartStop:_,handleNext:z,handlePrevious:L,isDisabled:!1,handleReset:F})]})]}),e.jsxs(n.CanvasWrapper,{orthographic:!0,children:[e.jsx(N.default,{pov:v?null:P??"top",reset:r}),e.jsx(V.default,{near:-1e3,far:1e3,position:[0,0,10],defaultZoom:l||3}),e.jsx("ambientLight",{intensity:.9}),e.jsx(W.default,{defaultZoom:l||1,playing:o,stepDirection:D,dayPerVizSec:O,frameOverride:k,potentialOrbits:w,elapsedTime:g,setElapsedTime:p,reset:r,zoomLevel:C,setZoomLevel:R,selectedNeoIndex:y,orbits:x?f:i}),e.jsx(B.default,{zoomLevel:C,defaultZoom:l||1})]})]})]})}exports.default=H;
@@ -1,37 +1,35 @@
1
1
  "use client";
2
2
  import { jsxs as s, Fragment as h, jsx as t } from "react/jsx-runtime";
3
- import { useState as i, useEffect as B } from "react";
4
- import G from "./Orbitals/OrbitalDetails.js";
5
- import N from "./Camera/CameraController.js";
6
- import q from "./Camera/Camera.js";
7
- import A from "./Orbitals/Orbitals.js";
8
- import H from "./Sun.js";
9
- import I from "./Controls/PlaybackSpeed.js";
3
+ import { useState as i, useEffect as W } from "react";
4
+ import B from "./Orbitals/OrbitalDetails.js";
5
+ import G from "./Camera/CameraController.js";
6
+ import I from "./Camera/Camera.js";
7
+ import q from "./Orbitals/Orbitals.js";
8
+ import A from "./Sun.js";
9
+ import H from "./Controls/PlaybackSpeed.js";
10
10
  import J from "./Controls/PlaybackControls.js";
11
11
  import { GlobalStyles as K, OrbitalSimWrapper as M, SwappableOrbitsContainer as Q, SwappableOrbitButton as U, CanvasWrapper as X } from "./styles.js";
12
12
  import { useOrbitalSimContext as Y } from "./Context/index.js";
13
13
  function me() {
14
- const { orbits: o, showDetailsTable: P, allowOrbitRotation: D, showTimeControls: S, swappableOrbits: O } = Y(), {
14
+ const { orbits: o, defaultZoom: l, showDetailsTable: P, allowOrbitRotation: x, showTimeControls: S, swappableOrbits: O, selectedNeoIndex: D } = Y(), {
15
15
  paused: C,
16
- pov: x,
17
- defaultZoom: p,
18
- potentialOrbits: k,
19
- detailsRows: R
20
- } = o, c = { min: 1157e-8, max: 365.25, initial: 11.574, step: 1 }, [l, a] = i(!C), [Z, n] = i(1), [T, g] = i(0), [w, m] = i(C ? 0 : c.initial), [v, d] = i(0), [r, f] = i(0), [y, j] = i(1), [b, z] = i({ neos: [{ Principal_desig: "" }] });
21
- B(() => {
22
- S || (a(!1), m(0)), r > 0 ? (m(c.initial), n(1), d(0), f(-1)) : r < 0 && (d(0), a(!0), f(0));
16
+ pov: k,
17
+ potentialOrbits: Z
18
+ } = o, c = { min: 1157e-8, max: 365.25, initial: 11.574, step: 1 }, [n, a] = i(!C), [R, p] = i(1), [T, g] = i(0), [v, m] = i(C ? 0 : c.initial), [w, d] = i(0), [r, f] = i(0), [y, j] = i(l), [b, z] = i({ neos: [{ Principal_desig: "" }] });
19
+ W(() => {
20
+ S || (a(!1), m(0)), r > 0 ? (m(c.initial), p(1), d(0), f(-1)) : r < 0 && (d(0), a(!0), f(0));
23
21
  }, [r]);
24
22
  const L = (e) => {
25
23
  m(+e);
26
24
  }, _ = () => {
27
- l || n(1), a(!l);
25
+ n || p(1), a(!n);
28
26
  }, E = () => {
29
27
  a((e) => !1), f((e) => e + 1);
30
28
  }, F = (e) => {
31
- a(!1), n(1), g((u) => u + 1);
29
+ a(!1), p(1), g((u) => u + 1);
30
+ }, N = (e) => {
31
+ a(!1), p(-1), g((u) => u + 1);
32
32
  }, V = (e) => {
33
- a(!1), n(-1), g((u) => u + 1);
34
- }, W = (e) => {
35
33
  z({
36
34
  neos: [e]
37
35
  });
@@ -42,18 +40,18 @@ function me() {
42
40
  O ? /* @__PURE__ */ t(Q, { children: o && o.neos && o.neos.map((e) => /* @__PURE__ */ t(
43
41
  U,
44
42
  {
45
- onClick: () => W(e),
43
+ onClick: () => V(e),
46
44
  "data-active": Object.keys(b).length ? e.Principal_desig === b.neos[0].Principal_desig : !1,
47
45
  children: e.Ref
48
46
  }
49
47
  )) }) : /* @__PURE__ */ s(h, { children: [
50
- R && P && /* @__PURE__ */ t(G, {}),
48
+ P && /* @__PURE__ */ t(B, {}),
51
49
  S && /* @__PURE__ */ s(h, { children: [
52
50
  /* @__PURE__ */ t(
53
- I,
51
+ H,
54
52
  {
55
- elapsedTime: v,
56
- dayPerVizSec: w,
53
+ elapsedTime: w,
54
+ dayPerVizSec: v,
57
55
  speeds: c,
58
56
  sliderOnChangeCallback: L
59
57
  }
@@ -61,10 +59,10 @@ function me() {
61
59
  /* @__PURE__ */ t(
62
60
  J,
63
61
  {
64
- playing: l,
62
+ playing: n,
65
63
  handleStartStop: _,
66
64
  handleNext: F,
67
- handlePrevious: V,
65
+ handlePrevious: N,
68
66
  isDisabled: !1,
69
67
  handleReset: E
70
68
  }
@@ -72,39 +70,40 @@ function me() {
72
70
  ] })
73
71
  ] }),
74
72
  /* @__PURE__ */ s(X, { orthographic: !0, children: [
75
- /* @__PURE__ */ t(N, { pov: D ? null : x ?? "top", reset: r }),
73
+ /* @__PURE__ */ t(G, { pov: x ? null : k ?? "top", reset: r }),
76
74
  /* @__PURE__ */ t(
77
- q,
75
+ I,
78
76
  {
79
77
  near: -1e3,
80
78
  far: 1e3,
81
79
  position: [0, 0, 10],
82
- defaultZoom: p || 3
80
+ defaultZoom: l || 3
83
81
  }
84
82
  ),
85
83
  /* @__PURE__ */ t("ambientLight", { intensity: 0.9 }),
86
84
  /* @__PURE__ */ t(
87
- A,
85
+ q,
88
86
  {
89
- defaultZoom: p || 1,
90
- playing: l,
91
- stepDirection: Z,
92
- dayPerVizSec: w,
87
+ defaultZoom: l || 1,
88
+ playing: n,
89
+ stepDirection: R,
90
+ dayPerVizSec: v,
93
91
  frameOverride: T,
94
- potentialOrbits: k,
95
- elapsedTime: v,
92
+ potentialOrbits: Z,
93
+ elapsedTime: w,
96
94
  setElapsedTime: d,
97
95
  reset: r,
98
96
  zoomLevel: y,
99
97
  setZoomLevel: j,
98
+ selectedNeoIndex: D,
100
99
  orbits: O ? b : o
101
100
  }
102
101
  ),
103
102
  /* @__PURE__ */ t(
104
- H,
103
+ A,
105
104
  {
106
105
  zoomLevel: y,
107
- defaultZoom: p || 1
106
+ defaultZoom: l || 1
108
107
  }
109
108
  )
110
109
  ] })
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),n=require("react"),c=require("@rubin-epo/epo-react-lib/Button"),u=require("../Context/index.cjs"),s=require("./styles.cjs"),d=require("../styles.cjs"),a=t=>t&&t.__esModule?t:{default:t},x=a(c);function h(){const{orbits:t}=u.useOrbitalSimContext(),{detailsRows:l}=t,[i,o]=n.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(d.GlobalStyles,{}),e.jsx(s.ButtonWrapper,{styleAs:"secondary",isInactive:!l,onClick:()=>{o(!i)},children:i?"Hide Details":"Show Details"}),e.jsx(s.SlideoutWrapper,{slideFrom:"left",isOpen:i,children:e.jsxs(s.SlideoutPanel,{children:[e.jsx("h3",{children:"Orbital Details"}),l&&l.map(r=>e.jsxs(s.SlideoutRow,{children:[e.jsx(s.SlideoutColLeft,{children:e.jsx("p",{children:r.rowTitle})}),e.jsx(s.SlideoutColRight,{children:e.jsx("p",{children:r.rowContent})})]},r.rowTitle)),e.jsx(x.default,{isBlock:!0,onClick:()=>o(!i),children:"Close"})]})})]})}exports.default=h;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),d=require("@rubin-epo/epo-react-lib/Button"),a=require("../Context/index.cjs"),s=require("./styles.cjs"),x=require("../styles.cjs"),j=t=>t&&t.__esModule?t:{default:t},h=j(d);function S(){var r;const[t,o]=u.useState(!1),{orbits:n,selectedNeoIndex:c}=a.useOrbitalSimContext(),{object_details:l}=((r=n.neos)==null?void 0:r[c])||{};return e.jsxs(e.Fragment,{children:[e.jsx(x.GlobalStyles,{}),e.jsx(s.ButtonWrapper,{styleAs:"secondary",isInactive:!l,onClick:()=>{o(!t)},children:t?"Hide Details":"Show Details"}),e.jsx(s.SlideoutWrapper,{slideFrom:"left",isOpen:t,children:e.jsxs(s.SlideoutPanel,{children:[e.jsx("h3",{children:"Orbital Details"}),l&&l.map(i=>e.jsxs(s.SlideoutRow,{children:[e.jsx(s.SlideoutColLeft,{children:e.jsx("p",{children:i.rowTitle})}),e.jsx(s.SlideoutColRight,{children:e.jsx("p",{children:i.rowContent})})]},i.rowTitle)),e.jsx(h.default,{isBlock:!0,onClick:()=>o(!t),children:"Close"})]})})]})}exports.default=S;
@@ -1,38 +1,39 @@
1
1
  "use client";
2
- import { jsxs as l, Fragment as s, jsx as t } from "react/jsx-runtime";
3
- import { useState as c } from "react";
4
- import a from "@rubin-epo/epo-react-lib/Button";
5
- import { useOrbitalSimContext as d } from "../Context/index.js";
6
- import { ButtonWrapper as m, SlideoutWrapper as p, SlideoutPanel as h, SlideoutRow as u, SlideoutColLeft as f, SlideoutColRight as S } from "./styles.js";
2
+ import { jsxs as l, Fragment as d, jsx as e } from "react/jsx-runtime";
3
+ import { useState as a } from "react";
4
+ import m from "@rubin-epo/epo-react-lib/Button";
5
+ import { useOrbitalSimContext as p } from "../Context/index.js";
6
+ import { ButtonWrapper as h, SlideoutWrapper as u, SlideoutPanel as f, SlideoutRow as S, SlideoutColLeft as C, SlideoutColRight as b } from "./styles.js";
7
7
  import { GlobalStyles as w } from "../styles.js";
8
- function v() {
9
- const { orbits: n } = d(), {
10
- detailsRows: i
11
- } = n, [e, r] = c(!1);
12
- return /* @__PURE__ */ l(s, { children: [
13
- /* @__PURE__ */ t(w, {}),
14
- /* @__PURE__ */ t(
15
- m,
8
+ function y() {
9
+ var n;
10
+ const [t, r] = a(!1), { orbits: s, selectedNeoIndex: c } = p(), {
11
+ object_details: i
12
+ } = ((n = s.neos) == null ? void 0 : n[c]) || {};
13
+ return /* @__PURE__ */ l(d, { children: [
14
+ /* @__PURE__ */ e(w, {}),
15
+ /* @__PURE__ */ e(
16
+ h,
16
17
  {
17
18
  styleAs: "secondary",
18
19
  isInactive: !i,
19
20
  onClick: () => {
20
- r(!e);
21
+ r(!t);
21
22
  },
22
- children: e ? "Hide Details" : "Show Details"
23
+ children: t ? "Hide Details" : "Show Details"
23
24
  }
24
25
  ),
25
- /* @__PURE__ */ t(p, { slideFrom: "left", isOpen: e, children: /* @__PURE__ */ l(h, { children: [
26
- /* @__PURE__ */ t("h3", { children: "Orbital Details" }),
27
- i && i.map((o) => /* @__PURE__ */ l(u, { children: [
28
- /* @__PURE__ */ t(f, { children: /* @__PURE__ */ t("p", { children: o.rowTitle }) }),
29
- /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t("p", { children: o.rowContent }) })
26
+ /* @__PURE__ */ e(u, { slideFrom: "left", isOpen: t, children: /* @__PURE__ */ l(f, { children: [
27
+ /* @__PURE__ */ e("h3", { children: "Orbital Details" }),
28
+ i && i.map((o) => /* @__PURE__ */ l(S, { children: [
29
+ /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e("p", { children: o.rowTitle }) }),
30
+ /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e("p", { children: o.rowContent }) })
30
31
  ] }, o.rowTitle)),
31
- /* @__PURE__ */ t(
32
- a,
32
+ /* @__PURE__ */ e(
33
+ m,
33
34
  {
34
35
  isBlock: !0,
35
- onClick: () => r(!e),
36
+ onClick: () => r(!t),
36
37
  children: "Close"
37
38
  }
38
39
  )
@@ -40,5 +41,5 @@ function v() {
40
41
  ] });
41
42
  }
42
43
  export {
43
- v as default
44
+ y as default
44
45
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),O=require("react"),e=require("../../../node_modules/prop-types/index.cjs"),R=require("@react-three/fiber"),x=require("./Orbital.cjs"),F=require("./PotentialOrbits.cjs"),v=require("../orbitalUtilities.cjs");function h({playing:s,dayPerVizSec:i,stepDirection:u,frameOverride:a,defaultZoom:b,potentialOrbits:C,elapsedTime:m,setElapsedTime:p,reset:j,zoomLevel:l,setZoomLevel:M,orbits:$}){const{neos:n,refObjs:I,activeNeo:P}=$;function _(r){const{remainingInits:t}=r;return{remainingInits:t-1}}const{camera:g}=R.useThree(),[k,q]=O.useReducer(_,{remainingInits:n&&Array.isArray(n)?n.length:0});function T(){return(I||["earth","jupiter","mars","neptune"]).map(v.getRefObjProps).map(t=>{const{orbitColor:c,objectColor:f,objectRadius:d,Ref:y,Principal_desig:z,name:A}=t;return o.jsx(x.default,{type:"planet",data:t,position:[0,0,0],zoomMod:l,defaultZoom:b,playing:s,stepDirection:u,dayPerVizSec:i,frameOverride:a,orbitColor:c,objectColor:f,objectRadius:d,reset:j},`${y}-${z||A}`)})}return R.useFrame((r,t)=>{g.zoom!==l&&M(g.zoom),s&&p(m+u*t*i)}),O.useEffect(()=>{a&&p(m+u*(1/60)*i)},[a]),o.jsxs(o.Fragment,{children:[T(),C?o.jsx(F.default,{data:n,position:[0,0,0],initialized:!0,zoomMod:l,defaultZoom:b,playing:s,stepDirection:u,dayPerVizSec:i,frameOverride:a,initCallback:q}):n?n.map((r,t)=>{const{Ref:c,Principal_desig:f,name:d}=r;return o.jsx(x.default,{type:"neo",data:r,position:[0,0,0],active:r===P,initialized:k.remainingInits<=0,zoomMod:l,defaultZoom:b,playing:s,stepDirection:u,dayPerVizSec:i,frameOverride:a,reset:j,initCallback:q},c&&(f||d)?`${c}-${f||d}`:`orbit-${t}`)}):null]})}h.propTypes={playing:e.default.bool,dayPerVizSec:e.default.number,stepDirection:e.default.number,frameOverride:e.default.number,activeVelocityCallback:e.default.func,defaultZoom:e.default.number,zoomLevel:e.default.number,setZoomLevel:e.default.func,potentialOrbits:e.default.bool,elapsedTime:e.default.number,setElapsedTime:e.default.func,reset:e.default.number};exports.default=h;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),h=require("react"),e=require("../../../node_modules/prop-types/index.cjs"),x=require("@react-three/fiber"),C=require("./Orbital.cjs"),v=require("./PotentialOrbits.cjs"),E=require("../orbitalUtilities.cjs");function M({playing:s,dayPerVizSec:i,stepDirection:n,frameOverride:u,defaultZoom:d,potentialOrbits:$,elapsedTime:p,setElapsedTime:j,reset:g,zoomLevel:l,setZoomLevel:I,selectedNeoIndex:q,orbits:P}){const{neos:m,refObjs:_,activeNeo:k}=P,a=Number.isInteger(q)?[m[q]]:m;function T(r){const{remainingInits:t}=r;return{remainingInits:t-1}}const{camera:O}=x.useThree(),[y,R]=h.useReducer(T,{remainingInits:a&&Array.isArray(a)?a.length:0});function z(){return(_||["earth","jupiter","mars","neptune"]).map(E.getRefObjProps).map(t=>{const{orbitColor:f,objectColor:c,objectRadius:b,Ref:A,Principal_desig:F,name:N}=t;return o.jsx(C.default,{type:"planet",data:t,position:[0,0,0],zoomMod:l,defaultZoom:d,playing:s,stepDirection:n,dayPerVizSec:i,frameOverride:u,orbitColor:f,objectColor:c,objectRadius:b,reset:g},`${A}-${F||N}`)})}return x.useFrame((r,t)=>{O.zoom!==l&&I(O.zoom),s&&j(p+n*t*i)}),h.useEffect(()=>{u&&j(p+n*(1/60)*i)},[u]),o.jsxs(o.Fragment,{children:[z(),$?o.jsx(v.default,{data:m,position:[0,0,0],initialized:!0,zoomMod:l,defaultZoom:d,playing:s,stepDirection:n,dayPerVizSec:i,frameOverride:u,initCallback:R}):a?a.map((r,t)=>{const{Ref:f,Principal_desig:c,name:b}=r;return o.jsx(C.default,{type:"neo",data:r,position:[0,0,0],active:r===k,initialized:y.remainingInits<=0,zoomMod:l,defaultZoom:d,playing:s,stepDirection:n,dayPerVizSec:i,frameOverride:u,reset:g,initCallback:R},f&&(c||b)?`${f}-${c||b}`:`orbit-${t}`)}):null]})}M.propTypes={playing:e.default.bool,dayPerVizSec:e.default.number,stepDirection:e.default.number,frameOverride:e.default.number,activeVelocityCallback:e.default.func,defaultZoom:e.default.number,zoomLevel:e.default.number,setZoomLevel:e.default.func,potentialOrbits:e.default.bool,elapsedTime:e.default.number,setElapsedTime:e.default.func,reset:e.default.number};exports.default=M;
@@ -1,5 +1,5 @@
1
1
  export default Orbitals;
2
- declare function Orbitals({ playing, dayPerVizSec, stepDirection, frameOverride, defaultZoom, potentialOrbits, elapsedTime, setElapsedTime, reset, zoomLevel, setZoomLevel, orbits }: {
2
+ declare function Orbitals({ playing, dayPerVizSec, stepDirection, frameOverride, defaultZoom, potentialOrbits, elapsedTime, setElapsedTime, reset, zoomLevel, setZoomLevel, selectedNeoIndex, orbits }: {
3
3
  playing: any;
4
4
  dayPerVizSec: any;
5
5
  stepDirection: any;
@@ -11,6 +11,7 @@ declare function Orbitals({ playing, dayPerVizSec, stepDirection, frameOverride,
11
11
  reset: any;
12
12
  zoomLevel: any;
13
13
  setZoomLevel: any;
14
+ selectedNeoIndex: any;
14
15
  orbits: any;
15
16
  }): import("react/jsx-runtime").JSX.Element;
16
17
  declare namespace Orbitals {
@@ -1,113 +1,114 @@
1
1
  "use client";
2
- import { jsxs as A, Fragment as F, jsx as f } from "react/jsx-runtime";
3
- import { useReducer as _, useEffect as E } from "react";
2
+ import { jsxs as N, Fragment as _, jsx as l } from "react/jsx-runtime";
3
+ import { useReducer as E, useEffect as q } from "react";
4
4
  import t from "../../../node_modules/prop-types/index.js";
5
- import { useThree as N, useFrame as q } from "@react-three/fiber";
6
- import R from "./Orbital.js";
7
- import w from "./PotentialOrbits.js";
8
- import { getRefObjProps as B } from "../orbitalUtilities.js";
9
- function G({
5
+ import { useThree as w, useFrame as B } from "@react-three/fiber";
6
+ import C from "./Orbital.js";
7
+ import G from "./PotentialOrbits.js";
8
+ import { getRefObjProps as H } from "../orbitalUtilities.js";
9
+ function J({
10
10
  playing: a,
11
- dayPerVizSec: n,
11
+ dayPerVizSec: e,
12
12
  stepDirection: i,
13
- frameOverride: s,
14
- defaultZoom: c,
15
- potentialOrbits: h,
16
- elapsedTime: l,
17
- setElapsedTime: d,
18
- reset: j,
13
+ frameOverride: n,
14
+ defaultZoom: f,
15
+ potentialOrbits: $,
16
+ elapsedTime: d,
17
+ setElapsedTime: j,
18
+ reset: g,
19
19
  zoomLevel: m,
20
- setZoomLevel: C,
21
- orbits: $
20
+ setZoomLevel: I,
21
+ selectedNeoIndex: O,
22
+ orbits: P
22
23
  }) {
23
24
  const {
24
- neos: e,
25
- refObjs: I,
26
- activeNeo: P
27
- } = $;
28
- function k(o) {
25
+ neos: c,
26
+ refObjs: k,
27
+ activeNeo: M
28
+ } = P, s = Number.isInteger(O) ? [c[O]] : c;
29
+ function T(o) {
29
30
  const { remainingInits: r } = o;
30
31
  return { remainingInits: r - 1 };
31
32
  }
32
- const { camera: g } = N(), [x, O] = _(k, {
33
- remainingInits: e && Array.isArray(e) ? e.length : 0
33
+ const { camera: R } = w(), [x, h] = E(T, {
34
+ remainingInits: s && Array.isArray(s) ? s.length : 0
34
35
  });
35
- function M() {
36
- return (I || ["earth", "jupiter", "mars", "neptune"]).map(B).map((r) => {
36
+ function y() {
37
+ return (k || ["earth", "jupiter", "mars", "neptune"]).map(H).map((r) => {
37
38
  const {
38
39
  orbitColor: u,
39
40
  objectColor: p,
40
41
  objectRadius: b,
41
- Ref: T,
42
- Principal_desig: y,
43
- name: z
42
+ Ref: z,
43
+ Principal_desig: A,
44
+ name: F
44
45
  } = r;
45
- return /* @__PURE__ */ f(
46
- R,
46
+ return /* @__PURE__ */ l(
47
+ C,
47
48
  {
48
49
  type: "planet",
49
50
  data: r,
50
51
  position: [0, 0, 0],
51
52
  zoomMod: m,
52
- defaultZoom: c,
53
+ defaultZoom: f,
53
54
  playing: a,
54
55
  stepDirection: i,
55
- dayPerVizSec: n,
56
- frameOverride: s,
56
+ dayPerVizSec: e,
57
+ frameOverride: n,
57
58
  orbitColor: u,
58
59
  objectColor: p,
59
60
  objectRadius: b,
60
- reset: j
61
+ reset: g
61
62
  },
62
- `${T}-${y || z}`
63
+ `${z}-${A || F}`
63
64
  );
64
65
  });
65
66
  }
66
- return q((o, r) => {
67
- g.zoom !== m && C(g.zoom), a && d(l + i * r * n);
68
- }), E(() => {
69
- s && d(l + i * (1 / 60) * n);
70
- }, [s]), /* @__PURE__ */ A(F, { children: [
71
- M(),
72
- h ? /* @__PURE__ */ f(
73
- w,
67
+ return B((o, r) => {
68
+ R.zoom !== m && I(R.zoom), a && j(d + i * r * e);
69
+ }), q(() => {
70
+ n && j(d + i * (1 / 60) * e);
71
+ }, [n]), /* @__PURE__ */ N(_, { children: [
72
+ y(),
73
+ $ ? /* @__PURE__ */ l(
74
+ G,
74
75
  {
75
- data: e,
76
+ data: c,
76
77
  position: [0, 0, 0],
77
78
  initialized: !0,
78
79
  zoomMod: m,
79
- defaultZoom: c,
80
+ defaultZoom: f,
80
81
  playing: a,
81
82
  stepDirection: i,
82
- dayPerVizSec: n,
83
- frameOverride: s,
84
- initCallback: O
83
+ dayPerVizSec: e,
84
+ frameOverride: n,
85
+ initCallback: h
85
86
  }
86
- ) : e ? e.map((o, r) => {
87
+ ) : s ? s.map((o, r) => {
87
88
  const { Ref: u, Principal_desig: p, name: b } = o;
88
- return /* @__PURE__ */ f(
89
- R,
89
+ return /* @__PURE__ */ l(
90
+ C,
90
91
  {
91
92
  type: "neo",
92
93
  data: o,
93
94
  position: [0, 0, 0],
94
- active: o === P,
95
+ active: o === M,
95
96
  initialized: x.remainingInits <= 0,
96
97
  zoomMod: m,
97
- defaultZoom: c,
98
+ defaultZoom: f,
98
99
  playing: a,
99
100
  stepDirection: i,
100
- dayPerVizSec: n,
101
- frameOverride: s,
102
- reset: j,
103
- initCallback: O
101
+ dayPerVizSec: e,
102
+ frameOverride: n,
103
+ reset: g,
104
+ initCallback: h
104
105
  },
105
106
  u && (p || b) ? `${u}-${p || b}` : `orbit-${r}`
106
107
  );
107
108
  }) : null
108
109
  ] });
109
110
  }
110
- G.propTypes = {
111
+ J.propTypes = {
111
112
  playing: t.bool,
112
113
  dayPerVizSec: t.number,
113
114
  stepDirection: t.number,
@@ -122,5 +123,5 @@ G.propTypes = {
122
123
  reset: t.number
123
124
  };
124
125
  export {
125
- G as default
126
+ J as default
126
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubin-epo/epo-widget-lib",
3
- "version": "2.0.13",
3
+ "version": "2.2.0",
4
4
  "description": "Rubin Observatory Education & Public Outreach team React scientific and educational widgets.",
5
5
  "author": "Rubin EPO",
6
6
  "license": "MIT",
@@ -28,7 +28,7 @@
28
28
  "test": "jest --max-workers=2",
29
29
  "test:generate-output": "yarn test --json --outputFile=.jest-test-results.json || true",
30
30
  "prepublishOnly": "yarn build",
31
- "release-old": "semantic-release -e semantic-release-monorepo --debug"
31
+ "release": "semantic-release -e semantic-release-monorepo --debug"
32
32
  },
33
33
  "files": [
34
34
  "README.md",
@@ -69,7 +69,7 @@
69
69
  "@types/d3-array": "^3.2.1",
70
70
  "@types/d3-geo": "^3.1.0",
71
71
  "@types/react": "19.2.3",
72
- "@types/react-dom": "19.2.3`",
72
+ "@types/react-dom": "19.2.3",
73
73
  "@vitejs/plugin-react": "^4",
74
74
  "babel-loader": "^8.3.0",
75
75
  "eslint-plugin-storybook": "^0.11.4",