@rubin-epo/epo-widget-lib 2.0.11 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts/Readout/index.cjs +1 -1
- package/dist/charts/Readout/index.js +25 -18
- package/dist/charts/ScatterPlot/index.cjs +1 -1
- package/dist/charts/ScatterPlot/index.js +53 -50
- package/dist/mock-data/OrbitalSim/index.d.ts +19 -10
- package/dist/widgets/OrbitalSim/Context/OrbitalSimContext.types.d.ts +5 -2
- 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 +36 -34
- package/dist/widgets/OrbitalSim/OrbitalSim.cjs +1 -1
- package/dist/widgets/OrbitalSim/OrbitalSim.js +29 -29
- package/dist/widgets/OrbitalSim/Orbitals/Orbital.cjs +1 -1
- package/dist/widgets/OrbitalSim/Orbitals/Orbital.js +79 -79
- 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/dist/widgets/OrbitalSim/Orbitals/styles.cjs +1 -1
- package/dist/widgets/OrbitalSim/Orbitals/styles.js +1 -1
- package/dist/widgets/OrbitalSim/Sun.cjs +1 -1
- package/dist/widgets/OrbitalSim/Sun.js +6 -6
- package/dist/widgets/OrbitalSim/orbitalUtilities.cjs +1 -1
- package/dist/widgets/OrbitalSim/orbitalUtilities.js +20 -21
- package/dist/widgets/OrbitalSim/styles.cjs +1 -1
- package/dist/widgets/OrbitalSim/styles.js +1 -1
- package/dist/widgets/SourceSelector/MovingSourceSelector.cjs +1 -1
- package/dist/widgets/SourceSelector/MovingSourceSelector.js +82 -85
- package/dist/widgets/SupernovaThreeVector/Skymap/index.cjs +1 -1
- package/dist/widgets/SupernovaThreeVector/Skymap/index.js +45 -39
- package/package.json +2 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),
|
|
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,15 +1,22 @@
|
|
|
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
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 = {
|
|
8
15
|
justifyContent: null,
|
|
9
16
|
alignItems: null
|
|
10
17
|
};
|
|
11
|
-
return
|
|
12
|
-
switch (
|
|
18
|
+
return r.forEach((n) => {
|
|
19
|
+
switch (n) {
|
|
13
20
|
case "center":
|
|
14
21
|
t.alignItems = t.alignItems ?? "center", t.justifyContent = t.justifyContent ?? "center";
|
|
15
22
|
break;
|
|
@@ -28,25 +35,25 @@ const p = (n = "") => {
|
|
|
28
35
|
}
|
|
29
36
|
}), t;
|
|
30
37
|
}, y = ({
|
|
31
|
-
className:
|
|
32
|
-
children:
|
|
33
|
-
position:
|
|
34
|
-
viewport:
|
|
38
|
+
className: i,
|
|
39
|
+
children: o,
|
|
40
|
+
position: s,
|
|
41
|
+
viewport: r,
|
|
35
42
|
forIds: t,
|
|
36
|
-
forScreenreaders:
|
|
43
|
+
forScreenreaders: n
|
|
37
44
|
}) => {
|
|
38
|
-
const a = /* @__PURE__ */ e(
|
|
39
|
-
|
|
45
|
+
const a = /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(f, { style: d(s), children: /* @__PURE__ */ l(
|
|
46
|
+
u,
|
|
40
47
|
{
|
|
41
48
|
form: Array.isArray(t) ? t.join(" ") : t,
|
|
42
|
-
className:
|
|
49
|
+
className: i,
|
|
43
50
|
children: [
|
|
44
|
-
/* @__PURE__ */ e("span", { "aria-hidden": !!
|
|
45
|
-
/* @__PURE__ */ e(c, { children:
|
|
51
|
+
/* @__PURE__ */ e("span", { "aria-hidden": !!n, children: o }),
|
|
52
|
+
/* @__PURE__ */ e(c, { children: n })
|
|
46
53
|
]
|
|
47
54
|
}
|
|
48
55
|
) }) });
|
|
49
|
-
return
|
|
56
|
+
return r ? /* @__PURE__ */ e(m, { ...r, children: a }) : a;
|
|
50
57
|
};
|
|
51
58
|
y.displayName = "Charts.Readout";
|
|
52
59
|
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")
|
|
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,19 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as u, jsx as
|
|
2
|
+
import { jsxs as u, jsx as s } from "react/jsx-runtime";
|
|
3
3
|
import { useState as F } from "react";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import Q from "../
|
|
9
|
-
import U from "../
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
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";
|
|
14
17
|
const $ = {
|
|
15
|
-
svg:
|
|
16
|
-
canvas:
|
|
18
|
+
svg: Q,
|
|
19
|
+
canvas: _
|
|
17
20
|
}, w = ({
|
|
18
21
|
data: j,
|
|
19
22
|
className: z,
|
|
@@ -29,32 +32,32 @@ const $ = {
|
|
|
29
32
|
renderer: G = "svg",
|
|
30
33
|
plotChildren: x
|
|
31
34
|
}) => {
|
|
32
|
-
const [y, h] = F(), { label: N, points: f } = j,
|
|
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(
|
|
33
36
|
Y,
|
|
34
37
|
{
|
|
35
38
|
data: f,
|
|
36
|
-
onHoverCallback: n ? (
|
|
39
|
+
onHoverCallback: n ? (v) => h(v) : void 0,
|
|
37
40
|
onHoverOutCallback: n ? () => h(void 0) : void 0,
|
|
38
41
|
width: d,
|
|
39
42
|
height: m,
|
|
40
|
-
xScale:
|
|
41
|
-
yScale:
|
|
43
|
+
xScale: o,
|
|
44
|
+
yScale: e,
|
|
42
45
|
label: N,
|
|
43
46
|
onLoadedCallback: A
|
|
44
47
|
}
|
|
45
48
|
), q = {
|
|
46
49
|
Data: H,
|
|
47
|
-
xScale:
|
|
48
|
-
yScale:
|
|
50
|
+
xScale: o,
|
|
51
|
+
yScale: e,
|
|
49
52
|
yStart: S,
|
|
50
53
|
yEnd: k,
|
|
51
|
-
xStart:
|
|
54
|
+
xStart: g,
|
|
52
55
|
xEnd: O,
|
|
53
|
-
yDomain:
|
|
54
|
-
xDomain:
|
|
56
|
+
yDomain: r,
|
|
57
|
+
xDomain: i
|
|
55
58
|
};
|
|
56
59
|
return /* @__PURE__ */ u(
|
|
57
|
-
|
|
60
|
+
Z,
|
|
58
61
|
{
|
|
59
62
|
verticalLabel: c.label,
|
|
60
63
|
verticalLabelId: L,
|
|
@@ -65,66 +68,66 @@ const $ = {
|
|
|
65
68
|
height: m,
|
|
66
69
|
title: B,
|
|
67
70
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
71
|
+
/* @__PURE__ */ s(
|
|
72
|
+
K,
|
|
70
73
|
{
|
|
71
74
|
ticks: P,
|
|
72
|
-
x:
|
|
75
|
+
x: g,
|
|
73
76
|
labelledById: L,
|
|
74
|
-
yDomain:
|
|
75
|
-
yScale:
|
|
77
|
+
yDomain: r,
|
|
78
|
+
yScale: e
|
|
76
79
|
}
|
|
77
80
|
),
|
|
78
81
|
/* @__PURE__ */ u(
|
|
79
|
-
|
|
82
|
+
V,
|
|
80
83
|
{
|
|
81
|
-
x:
|
|
84
|
+
x: g,
|
|
82
85
|
y: k,
|
|
83
86
|
width: W,
|
|
84
87
|
height: X,
|
|
85
88
|
children: [
|
|
86
|
-
l.guidelines && /* @__PURE__ */
|
|
87
|
-
|
|
89
|
+
l.guidelines && /* @__PURE__ */ s(
|
|
90
|
+
R,
|
|
88
91
|
{
|
|
89
92
|
guides: I.length,
|
|
90
93
|
direction: "vertical",
|
|
91
|
-
xDomain:
|
|
92
|
-
yDomain:
|
|
93
|
-
xScale:
|
|
94
|
-
yScale:
|
|
94
|
+
xDomain: i,
|
|
95
|
+
yDomain: r,
|
|
96
|
+
xScale: o,
|
|
97
|
+
yScale: e
|
|
95
98
|
}
|
|
96
99
|
),
|
|
97
|
-
c.guidelines && /* @__PURE__ */
|
|
98
|
-
|
|
100
|
+
c.guidelines && /* @__PURE__ */ s(
|
|
101
|
+
R,
|
|
99
102
|
{
|
|
100
103
|
guides: P.length,
|
|
101
|
-
xDomain:
|
|
102
|
-
yDomain:
|
|
103
|
-
xScale:
|
|
104
|
-
yScale:
|
|
104
|
+
xDomain: i,
|
|
105
|
+
yDomain: r,
|
|
106
|
+
xScale: o,
|
|
107
|
+
yScale: e
|
|
105
108
|
}
|
|
106
109
|
),
|
|
107
110
|
x ? x(q) : H
|
|
108
111
|
]
|
|
109
112
|
}
|
|
110
113
|
),
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
|
|
114
|
+
/* @__PURE__ */ s(
|
|
115
|
+
J,
|
|
113
116
|
{
|
|
114
117
|
ticks: I,
|
|
115
118
|
y: S,
|
|
116
119
|
labelledById: C,
|
|
117
|
-
xDomain:
|
|
118
|
-
xScale:
|
|
120
|
+
xDomain: i,
|
|
121
|
+
xScale: o
|
|
119
122
|
}
|
|
120
123
|
),
|
|
121
124
|
n && /* @__PURE__ */ u(
|
|
122
|
-
|
|
125
|
+
U,
|
|
123
126
|
{
|
|
124
|
-
x: t ?
|
|
125
|
-
y: t ?
|
|
127
|
+
x: t ? o(t.x) : void 0,
|
|
128
|
+
y: t ? e(t.y) : void 0,
|
|
126
129
|
visible: !!t,
|
|
127
|
-
offset:
|
|
130
|
+
offset: T.pointRadius,
|
|
128
131
|
children: [
|
|
129
132
|
t && typeof n == "function" && n(t),
|
|
130
133
|
t && typeof n == "string" && n
|
|
@@ -127,8 +127,10 @@ export declare const PotentialOrbitsData: {
|
|
|
127
127
|
export declare const ObjectDetailsData: {
|
|
128
128
|
orbits: {
|
|
129
129
|
neos: {
|
|
130
|
-
|
|
130
|
+
Number: null;
|
|
131
|
+
Name: null;
|
|
131
132
|
Principal_desig: string;
|
|
133
|
+
Epoch: string;
|
|
132
134
|
M: number;
|
|
133
135
|
Peri: number;
|
|
134
136
|
Node: number;
|
|
@@ -136,16 +138,23 @@ export declare const ObjectDetailsData: {
|
|
|
136
138
|
e: number;
|
|
137
139
|
n: number;
|
|
138
140
|
a: number;
|
|
141
|
+
Tp: number;
|
|
142
|
+
Orbital_period: number;
|
|
143
|
+
H: number;
|
|
144
|
+
G: number;
|
|
145
|
+
Perihelion_dist: number;
|
|
146
|
+
Aphelion_dist: number;
|
|
147
|
+
Orbit_type: number;
|
|
148
|
+
Arc_length: number;
|
|
139
149
|
Ref: string;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
rowContent: string;
|
|
150
|
+
"Earth MOID": number;
|
|
151
|
+
object_details: ({
|
|
152
|
+
rowTitle: string;
|
|
153
|
+
rowContent: string;
|
|
154
|
+
} | {
|
|
155
|
+
rowTitle: string;
|
|
156
|
+
rowContent: number;
|
|
157
|
+
})[];
|
|
149
158
|
}[];
|
|
150
159
|
};
|
|
151
160
|
showTimeControls: boolean;
|
|
@@ -9,6 +9,7 @@ export interface OrbitalSimProviderProps {
|
|
|
9
9
|
selectedAnswer: string | null;
|
|
10
10
|
updateSelectedAnswer: (newSelectedAnswer: string | null) => void;
|
|
11
11
|
swappableOrbits?: boolean;
|
|
12
|
+
selectedNeoIndex?: number;
|
|
12
13
|
}
|
|
13
14
|
export type OrbitalSimContextValues = {
|
|
14
15
|
orbits: Orbits;
|
|
@@ -20,6 +21,7 @@ export type OrbitalSimContextValues = {
|
|
|
20
21
|
updateActiveObservation: (activeId: string) => void;
|
|
21
22
|
selectedAnswer: string | null;
|
|
22
23
|
swappableOrbits: boolean;
|
|
24
|
+
selectedNeoIndex?: number;
|
|
23
25
|
};
|
|
24
26
|
export type Observation = {
|
|
25
27
|
id: string;
|
|
@@ -37,10 +39,11 @@ export type Neo = {
|
|
|
37
39
|
Node: number;
|
|
38
40
|
Ref: string;
|
|
39
41
|
Principal_desig: string;
|
|
42
|
+
object_details?: DetailsRow[];
|
|
40
43
|
};
|
|
41
44
|
export type DetailsRow = {
|
|
42
45
|
rowTitle: string;
|
|
43
|
-
rowContent: string | TrustedHTML;
|
|
46
|
+
rowContent: string | number | TrustedHTML;
|
|
44
47
|
};
|
|
45
48
|
export type Orbits = {
|
|
46
49
|
neos: Neo[] | null;
|
|
@@ -51,7 +54,7 @@ export type Orbits = {
|
|
|
51
54
|
defaultZoom: number | null;
|
|
52
55
|
potentialOrbits: boolean;
|
|
53
56
|
noDetails: boolean;
|
|
54
|
-
detailsRows: DetailsRow[] | null;
|
|
55
57
|
refObjs: string[] | null;
|
|
56
58
|
noControls: boolean;
|
|
59
|
+
selectedNeoIndex?: number;
|
|
57
60
|
};
|
|
@@ -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 g=require("react/jsx-runtime"),e=require("react"),c=e.createContext(null);function j(){const s=e.useContext(c);if(!s)throw new Error("OrbitalSim components cannot be rendered outside the OrbitalSimContext.Provider component.");return s}function h({children:s,orbitData:r,showDetailsTable:f=!1,allowOrbitRotation:b=!1,showTimeControls:v=!1,selectedAnswer:i,updateSelectedAnswer:p,swappableOrbits:m=!1,selectedNeoIndex:S}){const[l,u]=e.useState({neos:null,activeNeo:null,observations:[],paused:!1,pov:null,defaultZoom:null,potentialOrbits:!1,noDetails:!1,refObjs:null,noControls:!1}),[t,O]=e.useState(()=>l.observations??[]);e.useEffect(()=>{u(r),O(r.observations)},[r]);const d=e.useMemo(()=>t&&t.length>0?t.map(n=>({...n,isActive:n.label===i})):[],[i,t]),x=n=>{if(t&&t.length>0){let P=t.map(o=>o.id==n?{...o,isActive:!0}:{...o,isActive:!1});O(P);const a=t.find(o=>o.id===n);p((a==null?void 0:a.label)||null)}},C=e.useMemo(()=>({orbits:l,showDetailsTable:f,allowOrbitRotation:b,showTimeControls:v,setOrbits:u,observations:d,updateActiveObservation:x,selectedAnswer:i,swappableOrbits:m,selectedNeoIndex:S}),[l,f,b,v,u,d,x,i,m,S]);return g.jsx(c.Provider,{value:C,children:s})}exports.OrbitalSimContext=c;exports.OrbitalSimProvider=h;exports.useOrbitalSimContext=j;
|
|
@@ -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, showDetailsTable, allowOrbitRotation, showTimeControls, selectedAnswer, updateSelectedAnswer, swappableOrbits, selectedNeoIndex }: OrbitalSimProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { createContext as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
const o =
|
|
2
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as j, useState as x, useEffect as A, useMemo as S, useContext as E } from "react";
|
|
4
|
+
const d = j(null);
|
|
5
|
+
function Z() {
|
|
6
|
+
const o = E(d);
|
|
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 k({
|
|
14
14
|
children: o,
|
|
15
15
|
orbitData: i,
|
|
16
16
|
showDetailsTable: a = !1,
|
|
17
17
|
allowOrbitRotation: f = !1,
|
|
18
18
|
showTimeControls: c = !1,
|
|
19
19
|
selectedAnswer: s,
|
|
20
|
-
updateSelectedAnswer:
|
|
21
|
-
swappableOrbits: v = !1
|
|
20
|
+
updateSelectedAnswer: C,
|
|
21
|
+
swappableOrbits: v = !1,
|
|
22
|
+
selectedNeoIndex: b
|
|
22
23
|
}) {
|
|
23
|
-
const [
|
|
24
|
+
const [r, l] = x({
|
|
24
25
|
neos: null,
|
|
25
26
|
activeNeo: null,
|
|
26
27
|
observations: [],
|
|
@@ -29,50 +30,51 @@ function W({
|
|
|
29
30
|
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, m] = x(
|
|
36
|
+
() => r.observations ?? []
|
|
37
37
|
);
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
A(() => {
|
|
39
|
+
l(i), m(i.observations);
|
|
40
40
|
}, [i]);
|
|
41
|
-
const
|
|
41
|
+
const p = S(
|
|
42
42
|
() => t && t.length > 0 ? t.map((e) => ({ ...e, isActive: e.label === s })) : [],
|
|
43
43
|
[s, t]
|
|
44
|
-
),
|
|
44
|
+
), O = (e) => {
|
|
45
45
|
if (t && t.length > 0) {
|
|
46
|
-
let
|
|
47
|
-
|
|
46
|
+
let P = t.map((n) => n.id == e ? { ...n, isActive: !0 } : { ...n, isActive: !1 });
|
|
47
|
+
m(P);
|
|
48
48
|
const u = t.find((n) => n.id === e);
|
|
49
|
-
|
|
49
|
+
C((u == null ? void 0 : u.label) || null);
|
|
50
50
|
}
|
|
51
|
-
},
|
|
52
|
-
orbits:
|
|
51
|
+
}, h = S(() => ({
|
|
52
|
+
orbits: r,
|
|
53
53
|
showDetailsTable: a,
|
|
54
54
|
allowOrbitRotation: f,
|
|
55
55
|
showTimeControls: c,
|
|
56
|
-
setOrbits:
|
|
57
|
-
observations:
|
|
58
|
-
updateActiveObservation:
|
|
56
|
+
setOrbits: l,
|
|
57
|
+
observations: p,
|
|
58
|
+
updateActiveObservation: O,
|
|
59
59
|
selectedAnswer: s,
|
|
60
|
-
swappableOrbits: v
|
|
60
|
+
swappableOrbits: v,
|
|
61
|
+
selectedNeoIndex: b
|
|
61
62
|
}), [
|
|
62
|
-
|
|
63
|
+
r,
|
|
63
64
|
a,
|
|
64
65
|
f,
|
|
65
66
|
c,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
l,
|
|
68
|
+
p,
|
|
69
|
+
O,
|
|
69
70
|
s,
|
|
70
|
-
v
|
|
71
|
+
v,
|
|
72
|
+
b
|
|
71
73
|
]);
|
|
72
|
-
return /* @__PURE__ */
|
|
74
|
+
return /* @__PURE__ */ g(d.Provider, { value: h, children: o });
|
|
73
75
|
}
|
|
74
76
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
d as OrbitalSimContext,
|
|
78
|
+
k as OrbitalSimProvider,
|
|
79
|
+
Z as useOrbitalSimContext
|
|
78
80
|
};
|
|
@@ -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,showDetailsTable:q,allowOrbitRotation:v,showTimeControls:m,swappableOrbits:x,selectedNeoIndex:y}=A.useOrbitalSimContext(),{paused:h,pov:P,defaultZoom:c,potentialOrbits:w}=i,u={min:1157e-8,max:365.25,initial:11.574,step:1},[l,a]=s.useState(!h),[D,o]=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(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)},_=()=>{l||o(1),a(!l)},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(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:l,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:c||3}),e.jsx("ambientLight",{intensity:.9}),e.jsx(W.default,{defaultZoom:c||1,playing:l,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:c||1})]})]})]})}exports.default=H;
|
|
@@ -1,24 +1,23 @@
|
|
|
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, showDetailsTable: P, allowOrbitRotation: x, showTimeControls: S, swappableOrbits: O, selectedNeoIndex: D } = Y(), {
|
|
15
15
|
paused: C,
|
|
16
|
-
pov:
|
|
16
|
+
pov: k,
|
|
17
17
|
defaultZoom: p,
|
|
18
|
-
potentialOrbits:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
B(() => {
|
|
18
|
+
potentialOrbits: Z
|
|
19
|
+
} = o, c = { min: 1157e-8, max: 365.25, initial: 11.574, step: 1 }, [l, a] = i(!C), [R, n] = i(1), [T, g] = i(0), [v, m] = i(C ? 0 : c.initial), [w, d] = i(0), [r, f] = i(0), [y, j] = i(1), [b, z] = i({ neos: [{ Principal_desig: "" }] });
|
|
20
|
+
W(() => {
|
|
22
21
|
S || (a(!1), m(0)), r > 0 ? (m(c.initial), n(1), d(0), f(-1)) : r < 0 && (d(0), a(!0), f(0));
|
|
23
22
|
}, [r]);
|
|
24
23
|
const L = (e) => {
|
|
@@ -29,9 +28,9 @@ function me() {
|
|
|
29
28
|
a((e) => !1), f((e) => e + 1);
|
|
30
29
|
}, F = (e) => {
|
|
31
30
|
a(!1), n(1), g((u) => u + 1);
|
|
32
|
-
},
|
|
31
|
+
}, N = (e) => {
|
|
33
32
|
a(!1), n(-1), g((u) => u + 1);
|
|
34
|
-
},
|
|
33
|
+
}, V = (e) => {
|
|
35
34
|
z({
|
|
36
35
|
neos: [e]
|
|
37
36
|
});
|
|
@@ -42,18 +41,18 @@ function me() {
|
|
|
42
41
|
O ? /* @__PURE__ */ t(Q, { children: o && o.neos && o.neos.map((e) => /* @__PURE__ */ t(
|
|
43
42
|
U,
|
|
44
43
|
{
|
|
45
|
-
onClick: () =>
|
|
44
|
+
onClick: () => V(e),
|
|
46
45
|
"data-active": Object.keys(b).length ? e.Principal_desig === b.neos[0].Principal_desig : !1,
|
|
47
46
|
children: e.Ref
|
|
48
47
|
}
|
|
49
48
|
)) }) : /* @__PURE__ */ s(h, { children: [
|
|
50
|
-
|
|
49
|
+
P && /* @__PURE__ */ t(B, {}),
|
|
51
50
|
S && /* @__PURE__ */ s(h, { children: [
|
|
52
51
|
/* @__PURE__ */ t(
|
|
53
|
-
|
|
52
|
+
H,
|
|
54
53
|
{
|
|
55
|
-
elapsedTime:
|
|
56
|
-
dayPerVizSec:
|
|
54
|
+
elapsedTime: w,
|
|
55
|
+
dayPerVizSec: v,
|
|
57
56
|
speeds: c,
|
|
58
57
|
sliderOnChangeCallback: L
|
|
59
58
|
}
|
|
@@ -64,7 +63,7 @@ function me() {
|
|
|
64
63
|
playing: l,
|
|
65
64
|
handleStartStop: _,
|
|
66
65
|
handleNext: F,
|
|
67
|
-
handlePrevious:
|
|
66
|
+
handlePrevious: N,
|
|
68
67
|
isDisabled: !1,
|
|
69
68
|
handleReset: E
|
|
70
69
|
}
|
|
@@ -72,9 +71,9 @@ function me() {
|
|
|
72
71
|
] })
|
|
73
72
|
] }),
|
|
74
73
|
/* @__PURE__ */ s(X, { orthographic: !0, children: [
|
|
75
|
-
/* @__PURE__ */ t(
|
|
74
|
+
/* @__PURE__ */ t(G, { pov: x ? null : k ?? "top", reset: r }),
|
|
76
75
|
/* @__PURE__ */ t(
|
|
77
|
-
|
|
76
|
+
I,
|
|
78
77
|
{
|
|
79
78
|
near: -1e3,
|
|
80
79
|
far: 1e3,
|
|
@@ -84,24 +83,25 @@ function me() {
|
|
|
84
83
|
),
|
|
85
84
|
/* @__PURE__ */ t("ambientLight", { intensity: 0.9 }),
|
|
86
85
|
/* @__PURE__ */ t(
|
|
87
|
-
|
|
86
|
+
q,
|
|
88
87
|
{
|
|
89
88
|
defaultZoom: p || 1,
|
|
90
89
|
playing: l,
|
|
91
|
-
stepDirection:
|
|
92
|
-
dayPerVizSec:
|
|
90
|
+
stepDirection: R,
|
|
91
|
+
dayPerVizSec: v,
|
|
93
92
|
frameOverride: T,
|
|
94
|
-
potentialOrbits:
|
|
95
|
-
elapsedTime:
|
|
93
|
+
potentialOrbits: Z,
|
|
94
|
+
elapsedTime: w,
|
|
96
95
|
setElapsedTime: d,
|
|
97
96
|
reset: r,
|
|
98
97
|
zoomLevel: y,
|
|
99
98
|
setZoomLevel: j,
|
|
99
|
+
selectedNeoIndex: D,
|
|
100
100
|
orbits: O ? b : o
|
|
101
101
|
}
|
|
102
102
|
),
|
|
103
103
|
/* @__PURE__ */ t(
|
|
104
|
-
|
|
104
|
+
A,
|
|
105
105
|
{
|
|
106
106
|
zoomLevel: y,
|
|
107
107
|
defaultZoom: p || 1
|