@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.
- package/dist/mock-data/OrbitalSim/index.d.ts +19 -14
- package/dist/widgets/OrbitalSim/Context/OrbitalSimContext.types.d.ts +10 -6
- package/dist/widgets/OrbitalSim/Context/index.cjs +1 -1
- package/dist/widgets/OrbitalSim/Context/index.d.ts +1 -1
- package/dist/widgets/OrbitalSim/Context/index.js +42 -37
- package/dist/widgets/OrbitalSim/OrbitalSim.cjs +1 -1
- package/dist/widgets/OrbitalSim/OrbitalSim.js +37 -38
- package/dist/widgets/OrbitalSim/Orbitals/OrbitalDetails.cjs +1 -1
- package/dist/widgets/OrbitalSim/Orbitals/OrbitalDetails.js +25 -24
- package/dist/widgets/OrbitalSim/Orbitals/Orbitals.cjs +1 -1
- package/dist/widgets/OrbitalSim/Orbitals/Orbitals.d.ts +2 -1
- package/dist/widgets/OrbitalSim/Orbitals/Orbitals.js +60 -59
- package/package.json +3 -3
|
@@ -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
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
|
10
|
-
updateSelectedAnswer
|
|
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
|
|
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
|
|
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
|
|
3
|
-
import { createContext as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const 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
|
|
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:
|
|
21
|
-
swappableOrbits:
|
|
21
|
+
updateSelectedAnswer: v,
|
|
22
|
+
swappableOrbits: b = !1,
|
|
23
|
+
selectedNeoIndex: m
|
|
22
24
|
}) {
|
|
23
|
-
const [
|
|
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,
|
|
36
|
-
() =>
|
|
35
|
+
}), [t, p] = S(
|
|
36
|
+
() => r.observations ?? []
|
|
37
37
|
);
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
A(() => {
|
|
39
|
+
l(i), p(i.observations);
|
|
40
40
|
}, [i]);
|
|
41
|
-
const
|
|
42
|
-
() => t && t.length > 0 ? t.map((
|
|
41
|
+
const O = C(
|
|
42
|
+
() => t && t.length > 0 ? t.map((n) => ({ ...n, isActive: n.label === s })) : [],
|
|
43
43
|
[s, t]
|
|
44
|
-
),
|
|
44
|
+
), x = (n) => {
|
|
45
45
|
if (t && t.length > 0) {
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
},
|
|
52
|
-
orbits:
|
|
52
|
+
}, P = C(() => ({
|
|
53
|
+
orbits: r,
|
|
54
|
+
defaultZoom: u,
|
|
53
55
|
showDetailsTable: a,
|
|
54
56
|
allowOrbitRotation: f,
|
|
55
57
|
showTimeControls: c,
|
|
56
|
-
setOrbits:
|
|
57
|
-
observations:
|
|
58
|
-
updateActiveObservation:
|
|
58
|
+
setOrbits: l,
|
|
59
|
+
observations: O,
|
|
60
|
+
updateActiveObservation: x,
|
|
59
61
|
selectedAnswer: s,
|
|
60
|
-
swappableOrbits:
|
|
62
|
+
swappableOrbits: b,
|
|
63
|
+
selectedNeoIndex: m
|
|
61
64
|
}), [
|
|
62
|
-
|
|
65
|
+
r,
|
|
66
|
+
u,
|
|
63
67
|
a,
|
|
64
68
|
f,
|
|
65
69
|
c,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
l,
|
|
71
|
+
O,
|
|
72
|
+
x,
|
|
69
73
|
s,
|
|
70
|
-
|
|
74
|
+
b,
|
|
75
|
+
m
|
|
71
76
|
]);
|
|
72
|
-
return /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ j(h.Provider, { value: P, children: o });
|
|
73
78
|
}
|
|
74
79
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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"),
|
|
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
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:
|
|
14
|
+
const { orbits: o, defaultZoom: l, showDetailsTable: P, allowOrbitRotation: x, showTimeControls: S, swappableOrbits: O, selectedNeoIndex: D } = Y(), {
|
|
15
15
|
paused: C,
|
|
16
|
-
pov:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
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),
|
|
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: () =>
|
|
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
|
-
|
|
48
|
+
P && /* @__PURE__ */ t(B, {}),
|
|
51
49
|
S && /* @__PURE__ */ s(h, { children: [
|
|
52
50
|
/* @__PURE__ */ t(
|
|
53
|
-
|
|
51
|
+
H,
|
|
54
52
|
{
|
|
55
|
-
elapsedTime:
|
|
56
|
-
dayPerVizSec:
|
|
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:
|
|
62
|
+
playing: n,
|
|
65
63
|
handleStartStop: _,
|
|
66
64
|
handleNext: F,
|
|
67
|
-
handlePrevious:
|
|
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(
|
|
73
|
+
/* @__PURE__ */ t(G, { pov: x ? null : k ?? "top", reset: r }),
|
|
76
74
|
/* @__PURE__ */ t(
|
|
77
|
-
|
|
75
|
+
I,
|
|
78
76
|
{
|
|
79
77
|
near: -1e3,
|
|
80
78
|
far: 1e3,
|
|
81
79
|
position: [0, 0, 10],
|
|
82
|
-
defaultZoom:
|
|
80
|
+
defaultZoom: l || 3
|
|
83
81
|
}
|
|
84
82
|
),
|
|
85
83
|
/* @__PURE__ */ t("ambientLight", { intensity: 0.9 }),
|
|
86
84
|
/* @__PURE__ */ t(
|
|
87
|
-
|
|
85
|
+
q,
|
|
88
86
|
{
|
|
89
|
-
defaultZoom:
|
|
90
|
-
playing:
|
|
91
|
-
stepDirection:
|
|
92
|
-
dayPerVizSec:
|
|
87
|
+
defaultZoom: l || 1,
|
|
88
|
+
playing: n,
|
|
89
|
+
stepDirection: R,
|
|
90
|
+
dayPerVizSec: v,
|
|
93
91
|
frameOverride: T,
|
|
94
|
-
potentialOrbits:
|
|
95
|
-
elapsedTime:
|
|
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
|
-
|
|
103
|
+
A,
|
|
105
104
|
{
|
|
106
105
|
zoomLevel: y,
|
|
107
|
-
defaultZoom:
|
|
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"),
|
|
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
|
|
3
|
-
import { useState as
|
|
4
|
-
import
|
|
5
|
-
import { useOrbitalSimContext as
|
|
6
|
-
import { ButtonWrapper as
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
|
|
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(!
|
|
21
|
+
r(!t);
|
|
21
22
|
},
|
|
22
|
-
children:
|
|
23
|
+
children: t ? "Hide Details" : "Show Details"
|
|
23
24
|
}
|
|
24
25
|
),
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
i && i.map((o) => /* @__PURE__ */ l(
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
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__ */
|
|
32
|
-
|
|
32
|
+
/* @__PURE__ */ e(
|
|
33
|
+
m,
|
|
33
34
|
{
|
|
34
35
|
isBlock: !0,
|
|
35
|
-
onClick: () => r(!
|
|
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
|
-
|
|
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"),
|
|
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
|
|
3
|
-
import { useReducer as
|
|
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
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { getRefObjProps as
|
|
9
|
-
function
|
|
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:
|
|
11
|
+
dayPerVizSec: e,
|
|
12
12
|
stepDirection: i,
|
|
13
|
-
frameOverride:
|
|
14
|
-
defaultZoom:
|
|
15
|
-
potentialOrbits:
|
|
16
|
-
elapsedTime:
|
|
17
|
-
setElapsedTime:
|
|
18
|
-
reset:
|
|
13
|
+
frameOverride: n,
|
|
14
|
+
defaultZoom: f,
|
|
15
|
+
potentialOrbits: $,
|
|
16
|
+
elapsedTime: d,
|
|
17
|
+
setElapsedTime: j,
|
|
18
|
+
reset: g,
|
|
19
19
|
zoomLevel: m,
|
|
20
|
-
setZoomLevel:
|
|
21
|
-
|
|
20
|
+
setZoomLevel: I,
|
|
21
|
+
selectedNeoIndex: O,
|
|
22
|
+
orbits: P
|
|
22
23
|
}) {
|
|
23
24
|
const {
|
|
24
|
-
neos:
|
|
25
|
-
refObjs:
|
|
26
|
-
activeNeo:
|
|
27
|
-
} =
|
|
28
|
-
function
|
|
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:
|
|
33
|
-
remainingInits:
|
|
33
|
+
const { camera: R } = w(), [x, h] = E(T, {
|
|
34
|
+
remainingInits: s && Array.isArray(s) ? s.length : 0
|
|
34
35
|
});
|
|
35
|
-
function
|
|
36
|
-
return (
|
|
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:
|
|
42
|
-
Principal_desig:
|
|
43
|
-
name:
|
|
42
|
+
Ref: z,
|
|
43
|
+
Principal_desig: A,
|
|
44
|
+
name: F
|
|
44
45
|
} = r;
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
|
|
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:
|
|
53
|
+
defaultZoom: f,
|
|
53
54
|
playing: a,
|
|
54
55
|
stepDirection: i,
|
|
55
|
-
dayPerVizSec:
|
|
56
|
-
frameOverride:
|
|
56
|
+
dayPerVizSec: e,
|
|
57
|
+
frameOverride: n,
|
|
57
58
|
orbitColor: u,
|
|
58
59
|
objectColor: p,
|
|
59
60
|
objectRadius: b,
|
|
60
|
-
reset:
|
|
61
|
+
reset: g
|
|
61
62
|
},
|
|
62
|
-
`${
|
|
63
|
+
`${z}-${A || F}`
|
|
63
64
|
);
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
}),
|
|
69
|
-
|
|
70
|
-
}, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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:
|
|
76
|
+
data: c,
|
|
76
77
|
position: [0, 0, 0],
|
|
77
78
|
initialized: !0,
|
|
78
79
|
zoomMod: m,
|
|
79
|
-
defaultZoom:
|
|
80
|
+
defaultZoom: f,
|
|
80
81
|
playing: a,
|
|
81
82
|
stepDirection: i,
|
|
82
|
-
dayPerVizSec:
|
|
83
|
-
frameOverride:
|
|
84
|
-
initCallback:
|
|
83
|
+
dayPerVizSec: e,
|
|
84
|
+
frameOverride: n,
|
|
85
|
+
initCallback: h
|
|
85
86
|
}
|
|
86
|
-
) :
|
|
87
|
+
) : s ? s.map((o, r) => {
|
|
87
88
|
const { Ref: u, Principal_desig: p, name: b } = o;
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
|
|
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 ===
|
|
95
|
+
active: o === M,
|
|
95
96
|
initialized: x.remainingInits <= 0,
|
|
96
97
|
zoomMod: m,
|
|
97
|
-
defaultZoom:
|
|
98
|
+
defaultZoom: f,
|
|
98
99
|
playing: a,
|
|
99
100
|
stepDirection: i,
|
|
100
|
-
dayPerVizSec:
|
|
101
|
-
frameOverride:
|
|
102
|
-
reset:
|
|
103
|
-
initCallback:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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",
|