@johnmorrisdotca/uchusen-rockets 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/CHANGELOG.md +31 -5
  2. package/NOTICE.md +2 -0
  3. package/README.md +316 -4
  4. package/dist/assets/droneship-asog-landed.glb +0 -0
  5. package/dist/assets/droneship-asog.glb +0 -0
  6. package/dist/assets/droneship-jrti-landed.glb +0 -0
  7. package/dist/assets/droneship-jrti.glb +0 -0
  8. package/dist/assets/droneship-ocisly-landed.glb +0 -0
  9. package/dist/assets/droneship-ocisly.glb +0 -0
  10. package/dist/assets/falcon-9-block-5-dragon-2-first-stage.glb +0 -0
  11. package/dist/assets/falcon-9-block-5-dragon-2.glb +0 -0
  12. package/dist/assets/falcon-9-block-5-first-stage.glb +0 -0
  13. package/dist/assets/falcon-9-block-5.glb +0 -0
  14. package/dist/assets/falcon-9-ft-first-stage.glb +0 -0
  15. package/dist/assets/falcon-9-ft.glb +0 -0
  16. package/dist/assets/falcon-9-v1.1-first-stage.glb +0 -0
  17. package/dist/assets/falcon-9-v1.1.glb +0 -0
  18. package/dist/assets/falcon-heavy-falcon-heavy-centre.glb +0 -0
  19. package/dist/assets/falcon-heavy-falcon-heavy-side-left.glb +0 -0
  20. package/dist/assets/falcon-heavy-falcon-heavy-side-right.glb +0 -0
  21. package/dist/assets/falcon-heavy-falcon-heavy.glb +0 -0
  22. package/dist/assets/landing-zone-lz-1-landed.glb +0 -0
  23. package/dist/assets/landing-zone-lz-1.glb +0 -0
  24. package/dist/assets/landing-zone-lz-4-landed.glb +0 -0
  25. package/dist/assets/landing-zone-lz-4.glb +0 -0
  26. package/dist/assets/launch-tower-catch-booster.glb +0 -0
  27. package/dist/assets/launch-tower-catch.glb +0 -0
  28. package/dist/assets/launch-tower-stack-booster.glb +0 -0
  29. package/dist/assets/launch-tower-stack-ship.glb +0 -0
  30. package/dist/assets/launch-tower-stack.glb +0 -0
  31. package/dist/assets/starship-2019.glb +0 -0
  32. package/dist/assets/starship-v1-booster.glb +0 -0
  33. package/dist/assets/starship-v1-flight1-booster.glb +0 -0
  34. package/dist/assets/starship-v1-flight1-ship.glb +0 -0
  35. package/dist/assets/starship-v1-flight1.glb +0 -0
  36. package/dist/assets/starship-v1-ship.glb +0 -0
  37. package/dist/assets/starship-v1.glb +0 -0
  38. package/dist/assets/starship-v2-booster.glb +0 -0
  39. package/dist/assets/starship-v2-ship.glb +0 -0
  40. package/dist/assets/starship-v2.glb +0 -0
  41. package/dist/assets/starship-v3-booster.glb +0 -0
  42. package/dist/assets/starship-v3-ship.glb +0 -0
  43. package/dist/assets/starship-v3.glb +0 -0
  44. package/dist/assets/starship-v4-booster.glb +0 -0
  45. package/dist/assets/starship-v4-ship.glb +0 -0
  46. package/dist/assets/starship-v4.glb +0 -0
  47. package/dist/attrs.d.ts +70 -4
  48. package/dist/attrs.js +59 -4
  49. package/dist/build/glb.d.ts +25 -0
  50. package/dist/build/glb.js +29 -7
  51. package/dist/build/index.d.ts +94 -4
  52. package/dist/build/index.js +71 -7
  53. package/dist/build/lineup.d.ts +56 -2
  54. package/dist/build/lineup.js +23 -2
  55. package/dist/builder.d.ts +47 -1
  56. package/dist/builder.js +14 -1
  57. package/dist/crossfade.d.ts +44 -2
  58. package/dist/crossfade.js +44 -2
  59. package/dist/data/credits.d.ts +44 -1
  60. package/dist/data/credits.js +22 -1
  61. package/dist/data/flight-log.d.ts +33 -1
  62. package/dist/data/flight-log.js +22 -1
  63. package/dist/data/flights.d.ts +61 -2
  64. package/dist/data/flights.js +160 -3
  65. package/dist/data/makers.d.ts +21 -0
  66. package/dist/data/makers.js +10 -0
  67. package/dist/data/propellants.d.ts +59 -0
  68. package/dist/data/propellants.js +43 -0
  69. package/dist/data/sources.d.ts +102 -0
  70. package/dist/data/sources.js +19 -0
  71. package/dist/data/types.d.ts +81 -1
  72. package/dist/data/types.js +26 -1
  73. package/dist/draw/plume.d.ts +10 -1
  74. package/dist/draw/plume.js +15 -5
  75. package/dist/element/plumes.d.ts +7 -8
  76. package/dist/element/plumes.js +36 -21
  77. package/dist/element/scene.js +30 -5
  78. package/dist/element.d.ts +61 -3
  79. package/dist/element.js +53 -5
  80. package/dist/embed.d.ts +110 -5
  81. package/dist/embed.js +88 -5
  82. package/dist/engines.d.ts +86 -4
  83. package/dist/engines.js +75 -4
  84. package/dist/fit.d.ts +68 -0
  85. package/dist/fit.js +13 -0
  86. package/dist/flight.d.ts +136 -9
  87. package/dist/flight.js +130 -10
  88. package/dist/flightbar.d.ts +12 -0
  89. package/dist/flightbar.js +13 -1
  90. package/dist/framing.d.ts +182 -8
  91. package/dist/framing.js +127 -6
  92. package/dist/index.d.ts +3 -0
  93. package/dist/index.js +2 -0
  94. package/dist/layout.d.ts +65 -1
  95. package/dist/layout.js +43 -1
  96. package/dist/looks.d.ts +64 -1
  97. package/dist/looks.js +42 -1
  98. package/dist/model/falcon.js +2 -2
  99. package/dist/model/materials.d.ts +32 -0
  100. package/dist/model/materials.js +10 -0
  101. package/dist/model/moves.d.ts +36 -0
  102. package/dist/model/moves.js +70 -0
  103. package/dist/model/pieces.d.ts +31 -0
  104. package/dist/model/pieces.js +51 -9
  105. package/dist/model/registry.d.ts +22 -0
  106. package/dist/model/registry.js +22 -0
  107. package/dist/model/starship.d.ts +6 -3
  108. package/dist/model/starship.js +12 -7
  109. package/dist/parts.d.ts +33 -1
  110. package/dist/pixels.d.ts +44 -4
  111. package/dist/pixels.js +44 -4
  112. package/dist/react.d.ts +26 -2
  113. package/dist/react.js +13 -0
  114. package/dist/rockets.d.ts +91 -3
  115. package/dist/rockets.js +58 -2
  116. package/dist/spin.d.ts +57 -2
  117. package/dist/spin.js +35 -2
  118. package/dist/tilt.d.ts +48 -4
  119. package/dist/tilt.js +26 -4
  120. package/package.json +27 -7
package/dist/builder.d.ts CHANGED
@@ -1,10 +1,32 @@
1
1
  import { type Description, type FitReport } from "./fit.ts";
2
+ /**
3
+ * One part a row of the builder offers: its id, its name and the rocket it comes from.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { builderState, type BuilderOption } from "@johnmorrisdotca/uchusen-rockets";
8
+ *
9
+ * const first: BuilderOption | undefined = builderState().rows[0]?.options[0];
10
+ * console.log(first);
11
+ * ```
12
+ */
2
13
  export interface BuilderOption {
3
14
  id: string;
4
15
  name: string;
5
16
  /** Which rocket it comes from, to group a long list. */
6
17
  rocket: string;
7
18
  }
19
+ /**
20
+ * One row of the builder, from the bottom: what it chooses, the parts it offers, the one chosen, and whether the builder made the choice because only one part fits.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * import { builderState, type BuilderRow } from "@johnmorrisdotca/uchusen-rockets";
25
+ *
26
+ * const row: BuilderRow | undefined = builderState().rows[0];
27
+ * console.log(row?.label, row?.chosen, row?.auto);
28
+ * ```
29
+ */
8
30
  export interface BuilderRow {
9
31
  /** What this row chooses. */
10
32
  label: string;
@@ -13,10 +35,34 @@ export interface BuilderRow {
13
35
  /** One answer only: the builder made the choice. */
14
36
  auto: boolean;
15
37
  }
38
+ /**
39
+ * What the builder shows for a set of picks: its rows, the description they make and the fit report for it.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * import { builderState, type BuilderState } from "@johnmorrisdotca/uchusen-rockets";
44
+ *
45
+ * const state: BuilderState = builderState();
46
+ * console.log(state.rows.length, state.report.ok);
47
+ * ```
48
+ */
16
49
  export interface BuilderState {
17
50
  rows: readonly BuilderRow[];
18
51
  description: Description;
19
52
  report: FitReport;
20
53
  }
21
- /** The rows for these picks, from the bottom. A pick that is not offered, for a change lower down or a hostile value, gives way to the part that belongs with what is below, or else the first that fits. */
54
+ /**
55
+ * The rows for these picks, from the bottom. A pick that is not offered, for a change lower down or a hostile value, gives way to the part that belongs with what is below, or else the first that fits.
56
+ *
57
+ * @param picks The part ids chosen so far, row by row from the bottom. Leave it out to start.
58
+ * @returns The rows to show, the description they make and its fit report.
59
+ * @example
60
+ * ```ts
61
+ * import { builderState } from "@johnmorrisdotca/uchusen-rockets";
62
+ *
63
+ * const start = builderState();
64
+ * const next = builderState([start.rows[0]?.chosen ?? ""]);
65
+ * console.log(next.description, next.report.label);
66
+ * ```
67
+ */
22
68
  export declare function builderState(picks?: readonly string[]): BuilderState;
package/dist/builder.js CHANGED
@@ -24,7 +24,20 @@ const fitsOn = (part, below) => {
24
24
  };
25
25
  const REAL_PARTS = () => PART_ENTRIES.map(({ record }) => record).filter((record) => record.trueTo.length > 0);
26
26
  const optionOf = (part) => ({ id: part.id, name: part.name, rocket: ROCKETS[part.rocket]?.name ?? part.rocket });
27
- /** The rows for these picks, from the bottom. A pick that is not offered, for a change lower down or a hostile value, gives way to the part that belongs with what is below, or else the first that fits. */
27
+ /**
28
+ * The rows for these picks, from the bottom. A pick that is not offered, for a change lower down or a hostile value, gives way to the part that belongs with what is below, or else the first that fits.
29
+ *
30
+ * @param picks The part ids chosen so far, row by row from the bottom. Leave it out to start.
31
+ * @returns The rows to show, the description they make and its fit report.
32
+ * @example
33
+ * ```ts
34
+ * import { builderState } from "@johnmorrisdotca/uchusen-rockets";
35
+ *
36
+ * const start = builderState();
37
+ * const next = builderState([start.rows[0]?.chosen ?? ""]);
38
+ * console.log(next.description, next.report.label);
39
+ * ```
40
+ */
28
41
  export function builderState(picks = []) {
29
42
  const every = framesOf();
30
43
  const parts = REAL_PARTS();
@@ -1,6 +1,48 @@
1
- /** The drawing stays at least this long after it first comes on screen. */
1
+ /**
2
+ * The drawing stays at least this long after it first comes on screen.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { DRAWING_HOLD_MS } from "@johnmorrisdotca/uchusen-rockets";
7
+ *
8
+ * console.log(DRAWING_HOLD_MS);
9
+ * ```
10
+ */
2
11
  export declare const DRAWING_HOLD_MS = 1200;
12
+ /**
13
+ * How long the drawing and the 3D view cross-fade, in milliseconds.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { CROSSFADE_MS } from "@johnmorrisdotca/uchusen-rockets";
18
+ *
19
+ * console.log(CROSSFADE_MS);
20
+ * ```
21
+ */
3
22
  export declare const CROSSFADE_MS = 1500;
23
+ /**
24
+ * How long the cross-fade lasts for a reader who asked for reduced motion, in milliseconds.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { REDUCED_FADE_MS } from "@johnmorrisdotca/uchusen-rockets";
29
+ *
30
+ * console.log(REDUCED_FADE_MS);
31
+ * ```
32
+ */
4
33
  export declare const REDUCED_FADE_MS = 400;
5
- /** How long to wait, once the 3D view is ready at `readyAt`, before it takes over from a drawing first seen at `shownAt` (0 under reduced motion). */
34
+ /**
35
+ * How long to wait, once the 3D view is ready at `readyAt`, before it takes over from a drawing first seen at `shownAt` (0 under reduced motion).
36
+ *
37
+ * @param shownAt When the drawing first came on screen, in milliseconds.
38
+ * @param readyAt When the 3D view became ready, on the same clock.
39
+ * @param reducedMotion True when the reader asked for reduced motion.
40
+ * @returns The milliseconds to wait before the 3D view takes over.
41
+ * @example
42
+ * ```ts
43
+ * import { revealDelay } from "@johnmorrisdotca/uchusen-rockets";
44
+ *
45
+ * console.log(revealDelay(0, 300, false), revealDelay(0, 300, true));
46
+ * ```
47
+ */
6
48
  export declare function revealDelay(shownAt: number, readyAt: number, reducedMotion: boolean): number;
package/dist/crossfade.js CHANGED
@@ -1,9 +1,51 @@
1
1
  // The change from a rocket's drawing to its 3D view: the drawing stays a moment even when the 3D view is ready sooner, then a slow crossfade; under reduced motion, a plain short fade. Pure.
2
- /** The drawing stays at least this long after it first comes on screen. */
2
+ /**
3
+ * The drawing stays at least this long after it first comes on screen.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { DRAWING_HOLD_MS } from "@johnmorrisdotca/uchusen-rockets";
8
+ *
9
+ * console.log(DRAWING_HOLD_MS);
10
+ * ```
11
+ */
3
12
  export const DRAWING_HOLD_MS = 1200;
13
+ /**
14
+ * How long the drawing and the 3D view cross-fade, in milliseconds.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import { CROSSFADE_MS } from "@johnmorrisdotca/uchusen-rockets";
19
+ *
20
+ * console.log(CROSSFADE_MS);
21
+ * ```
22
+ */
4
23
  export const CROSSFADE_MS = 1500;
24
+ /**
25
+ * How long the cross-fade lasts for a reader who asked for reduced motion, in milliseconds.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import { REDUCED_FADE_MS } from "@johnmorrisdotca/uchusen-rockets";
30
+ *
31
+ * console.log(REDUCED_FADE_MS);
32
+ * ```
33
+ */
5
34
  export const REDUCED_FADE_MS = 400;
6
- /** How long to wait, once the 3D view is ready at `readyAt`, before it takes over from a drawing first seen at `shownAt` (0 under reduced motion). */
35
+ /**
36
+ * How long to wait, once the 3D view is ready at `readyAt`, before it takes over from a drawing first seen at `shownAt` (0 under reduced motion).
37
+ *
38
+ * @param shownAt When the drawing first came on screen, in milliseconds.
39
+ * @param readyAt When the 3D view became ready, on the same clock.
40
+ * @param reducedMotion True when the reader asked for reduced motion.
41
+ * @returns The milliseconds to wait before the 3D view takes over.
42
+ * @example
43
+ * ```ts
44
+ * import { revealDelay } from "@johnmorrisdotca/uchusen-rockets";
45
+ *
46
+ * console.log(revealDelay(0, 300, false), revealDelay(0, 300, true));
47
+ * ```
48
+ */
7
49
  export function revealDelay(shownAt, readyAt, reducedMotion) {
8
50
  if (reducedMotion)
9
51
  return 0;
@@ -1,3 +1,14 @@
1
+ /**
2
+ * The credit for one licensed model: its title, its creator and their page, where it came from, its licence and what this package changed.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { MODEL_CREDITS, type ModelCredit } from "@johnmorrisdotca/uchusen-rockets";
7
+ *
8
+ * const credit: ModelCredit = MODEL_CREDITS["clarence365-block3"];
9
+ * console.log(credit.creator, credit.licence);
10
+ * ```
11
+ */
1
12
  export interface ModelCredit {
2
13
  title: string;
3
14
  creator: string;
@@ -8,6 +19,16 @@ export interface ModelCredit {
8
19
  /** What this package changed. */
9
20
  changes: string;
10
21
  }
22
+ /**
23
+ * Every licensed model this package paints with, by credit id. A painted rocket must carry the credit of the parts that are showing; `embedCode` writes it for you.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { MODEL_CREDITS } from "@johnmorrisdotca/uchusen-rockets";
28
+ *
29
+ * console.log(Object.keys(MODEL_CREDITS).length > 10);
30
+ * ```
31
+ */
11
32
  export declare const MODEL_CREDITS: {
12
33
  readonly "clarence365-block3": {
13
34
  readonly title: "SpaceX Starship Block 3";
@@ -100,6 +121,28 @@ export declare const MODEL_CREDITS: {
100
121
  readonly "nasa-iss": ModelCredit;
101
122
  readonly "nasa-hubble": ModelCredit;
102
123
  };
124
+ /**
125
+ * The id of one model's credit in `MODEL_CREDITS`.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * import type { CreditId } from "@johnmorrisdotca/uchusen-rockets";
130
+ *
131
+ * const id: CreditId = "clarence365-block3";
132
+ * console.log(id);
133
+ * ```
134
+ */
103
135
  export type CreditId = keyof typeof MODEL_CREDITS;
104
- /** One credit as a line of text. */
136
+ /**
137
+ * One credit as a line of text.
138
+ *
139
+ * @param id The id of a credit in `MODEL_CREDITS`.
140
+ * @returns The credit as one line of text.
141
+ * @example
142
+ * ```ts
143
+ * import { creditLine } from "@johnmorrisdotca/uchusen-rockets";
144
+ *
145
+ * console.log(creditLine("clarence365-block3"));
146
+ * ```
147
+ */
105
148
  export declare function creditLine(id: CreditId): string;
@@ -11,6 +11,16 @@ const nasa = (title, slug, changes) => ({
11
11
  licenceUrl: "https://www.nasa.gov/nasa-brand-center/images-and-media/",
12
12
  changes,
13
13
  });
14
+ /**
15
+ * Every licensed model this package paints with, by credit id. A painted rocket must carry the credit of the parts that are showing; `embedCode` writes it for you.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { MODEL_CREDITS } from "@johnmorrisdotca/uchusen-rockets";
20
+ *
21
+ * console.log(Object.keys(MODEL_CREDITS).length > 10);
22
+ * ```
23
+ */
14
24
  export const MODEL_CREDITS = {
15
25
  "clarence365-block3": {
16
26
  title: "SpaceX Starship Block 3",
@@ -104,7 +114,18 @@ export const MODEL_CREDITS = {
104
114
  "nasa-hubble": nasa("Hubble Space Telescope", "nasa-3d-models-hubble-space-telescope", "A lettered plate painted out of its picture; rescaled to the sourced length; its materials made into one picture."),
105
115
  // new rows go here
106
116
  };
107
- /** One credit as a line of text. */
117
+ /**
118
+ * One credit as a line of text.
119
+ *
120
+ * @param id The id of a credit in `MODEL_CREDITS`.
121
+ * @returns The credit as one line of text.
122
+ * @example
123
+ * ```ts
124
+ * import { creditLine } from "@johnmorrisdotca/uchusen-rockets";
125
+ *
126
+ * console.log(creditLine("clarence365-block3"));
127
+ * ```
128
+ */
108
129
  export function creditLine(id) {
109
130
  const c = MODEL_CREDITS[id];
110
131
  return `"${c.title}" by ${c.creator} (${c.sourceUrl}), ${c.licence} (${c.licenceUrl}). ${c.changes}`;
@@ -1,4 +1,15 @@
1
1
  import type { SourceId } from "./sources.ts";
2
+ /**
3
+ * One flight from the flight log: its name, the rocket and variant that show it, the date, whether the launch succeeded, the source's own words on the outcome, and the source.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { FLIGHT_LOG, type LoggedFlight } from "@johnmorrisdotca/uchusen-rockets";
8
+ *
9
+ * const flight: LoggedFlight | undefined = FLIGHT_LOG[0];
10
+ * console.log(flight?.name, flight?.launch);
11
+ * ```
12
+ */
2
13
  export interface LoggedFlight {
3
14
  id: string;
4
15
  name: string;
@@ -13,6 +24,27 @@ export interface LoggedFlight {
13
24
  outcome: string;
14
25
  source: SourceId;
15
26
  }
27
+ /**
28
+ * The flights this package keeps a record of, each from a named source. Use `flightLogOf` for one rocket.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * import { FLIGHT_LOG } from "@johnmorrisdotca/uchusen-rockets";
33
+ *
34
+ * console.log(FLIGHT_LOG.length > 0);
35
+ * ```
36
+ */
16
37
  export declare const FLIGHT_LOG: readonly LoggedFlight[];
17
- /** A rocket's flights, in order. */
38
+ /**
39
+ * A rocket's flights, in order.
40
+ *
41
+ * @param rocket A rocket's id, such as `falcon-1`.
42
+ * @returns That rocket's logged flights, in order. It is empty for a rocket with none.
43
+ * @example
44
+ * ```ts
45
+ * import { flightLogOf } from "@johnmorrisdotca/uchusen-rockets";
46
+ *
47
+ * console.log(flightLogOf("falcon-1").map((flight) => flight.name));
48
+ * ```
49
+ */
18
50
  export declare const flightLogOf: (rocket: string) => readonly LoggedFlight[];
@@ -1,3 +1,13 @@
1
+ /**
2
+ * The flights this package keeps a record of, each from a named source. Use `flightLogOf` for one rocket.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { FLIGHT_LOG } from "@johnmorrisdotca/uchusen-rockets";
7
+ *
8
+ * console.log(FLIGHT_LOG.length > 0);
9
+ * ```
10
+ */
1
11
  export const FLIGHT_LOG = [
2
12
  { id: "falcon-1-flight-1", name: "Falcon 1, flight 1", rocket: "falcon-1", variant: "falcon-1", date: "2006-03-24", launch: "Failure", outcome: "Engine failure at T+33 seconds, and the vehicle was lost.", source: "wikipedia-falcon-1" },
3
13
  { id: "falcon-1-flight-2", name: "Falcon 1, flight 2", rocket: "falcon-1", variant: "falcon-1", date: "2007-03-21", launch: "Failure", outcome: "Reached 289 km and did not reach orbit: an oscillation of the second stage, and an early engine shutdown.", source: "wikipedia-falcon-1" },
@@ -19,5 +29,16 @@ export const FLIGHT_LOG = [
19
29
  { id: "starship-flight-13", name: "Starship flight 13", rocket: "starship", variant: "v3", date: "2026-07-24", launch: "Success", vehicles: "Booster B20, Ship S40", outcome: "Booster: Failure (gulf). Ship: Controlled (ocean).", source: "wikipedia-launches" },
20
30
  { id: "starship-flight-14", name: "Starship flight 14", rocket: "starship", variant: "v3", date: "2026-09-28", launch: "Success", vehicles: "Booster B21, Ship S41", outcome: "Booster: Controlled (gulf). Ship: Controlled (ocean).", source: "wikipedia-launches" },
21
31
  ];
22
- /** A rocket's flights, in order. */
32
+ /**
33
+ * A rocket's flights, in order.
34
+ *
35
+ * @param rocket A rocket's id, such as `falcon-1`.
36
+ * @returns That rocket's logged flights, in order. It is empty for a rocket with none.
37
+ * @example
38
+ * ```ts
39
+ * import { flightLogOf } from "@johnmorrisdotca/uchusen-rockets";
40
+ *
41
+ * console.log(flightLogOf("falcon-1").map((flight) => flight.name));
42
+ * ```
43
+ */
23
44
  export const flightLogOf = (rocket) => FLIGHT_LOG.filter((flight) => flight.rocket === rocket);
@@ -1,6 +1,16 @@
1
1
  import { type Figure } from "./types.ts";
2
2
  import type { SourceId } from "./sources.ts";
3
- /** How a part stands in the picture at a phase. A picture, not a measurement: `dx` and `dy` are in heights of the whole vehicle. */
3
+ /**
4
+ * How a part stands in the picture at a phase. A picture, not a measurement: `dx` and `dy` are in heights of the whole vehicle.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import type { PartPose } from "@johnmorrisdotca/uchusen-rockets";
9
+ *
10
+ * const pose: PartPose = { dx: 0.2, dy: -0.1, pitch: 12 };
11
+ * console.log(pose);
12
+ * ```
13
+ */
4
14
  export interface PartPose {
5
15
  dx?: number;
6
16
  dy?: number;
@@ -10,12 +20,35 @@ export interface PartPose {
10
20
  rest?: boolean;
11
21
  /** It has left the picture. */
12
22
  gone?: boolean;
23
+ /** Degrees each moving group of the part (`grid-fins`, `legs`, `forward-flaps`, `aft-flaps`) is turned from where it is drawn at rest. A picture, not a measurement. */
24
+ moves?: Readonly<Record<string, number>>;
13
25
  }
14
- /** How many engines of a part burn. `drawn` says how many flames to draw where no page says how many burned. */
26
+ /**
27
+ * How many engines of a part burn. `drawn` says how many flames to draw where no page says how many burned.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import type { FlightBurn } from "@johnmorrisdotca/uchusen-rockets";
32
+ *
33
+ * const burn: FlightBurn = { engines: { value: null, source: null, brief: "not given" }, drawn: 9 };
34
+ * console.log(burn);
35
+ * ```
36
+ */
15
37
  export interface FlightBurn {
16
38
  engines: Figure;
17
39
  drawn?: number;
18
40
  }
41
+ /**
42
+ * One phase of a flight: its id and name, what happens, when (a figure with its source), how many engines burn, how each part stands, and how far the ground has fallen away. The poses and the smoke are a picture, not a measurement.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * import { FLIGHTS, type FlightPhase } from "@johnmorrisdotca/uchusen-rockets";
47
+ *
48
+ * const phase: FlightPhase | undefined = FLIGHTS[0]?.phases[0];
49
+ * console.log(phase?.name, phase?.what);
50
+ * ```
51
+ */
19
52
  export interface FlightPhase {
20
53
  id: string;
21
54
  name: string;
@@ -34,6 +67,17 @@ export interface FlightPhase {
34
67
  altitude?: Figure<string>;
35
68
  speed?: Figure<string>;
36
69
  }
70
+ /**
71
+ * A flight, from a published timeline: its rocket and variant, whose timing it is, its source and its phases in order.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { FLIGHTS, type Flight } from "@johnmorrisdotca/uchusen-rockets";
76
+ *
77
+ * const flight: Flight | undefined = FLIGHTS[0];
78
+ * console.log(flight?.name, flight?.phases.length);
79
+ * ```
80
+ */
37
81
  export interface Flight {
38
82
  id: string;
39
83
  rocket: string;
@@ -44,6 +88,21 @@ export interface Flight {
44
88
  source: SourceId;
45
89
  /** What the picture leaves out. */
46
90
  note?: string;
91
+ /** What turns in it (grid fins, legs, flaps), and the page that says so. How far each turns is a picture. */
92
+ moves?: readonly {
93
+ source: SourceId;
94
+ says: string;
95
+ }[];
47
96
  phases: readonly FlightPhase[];
48
97
  }
98
+ /**
99
+ * Every flight the package can play, one for each variant that has a timeline. Use `flightOf` to find one.
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * import { FLIGHTS } from "@johnmorrisdotca/uchusen-rockets";
104
+ *
105
+ * console.log(FLIGHTS.map((flight) => `${flight.rocket}:${flight.variant}`));
106
+ * ```
107
+ */
49
108
  export declare const FLIGHTS: readonly Flight[];