@rr0/ufoathome 0.4.0 → 0.6.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/README.md CHANGED
@@ -10,9 +10,9 @@ testimony is more faithful than an oral or written one.
10
10
  Originally a Java applet (2003), the project has been rewritten from scratch in TypeScript: a small,
11
11
  dependency-light engine (keyframe timeline, recording, playback, Canvas2D rendering) wrapped in four vanilla
12
12
  [Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) — no UI framework, no build step
13
- required by the consuming page. One of the four (`<rr0-scene>`) does pull in [Three.js](https://threejs.org/)
14
- for an optional 3D backdrop — see [`<rr0-scene>`](#rr0-scene--3d-decor) below for why that's an isolated,
15
- opt-in bundle rather than a project-wide dependency.
13
+ required by the consuming page. Two of the four (`<rr0-scene>`, and `<rr0-eyewitness>` which always composes it) pull
14
+ in [Three.js](https://threejs.org/) for the 3D backdrop — see [`<rr0-scene>`](#rr0-scene--3d-decor) below for why
15
+ that's an isolated, opt-in bundle rather than a project-wide dependency.
16
16
 
17
17
  ### Naming
18
18
 
@@ -22,9 +22,9 @@ its default behavior and `<rr0-ufo-recorder>` is the one that needs a qualifier
22
22
  real-world time and place, with no UFO-specific logic of its own — today it composes a nested `<rr0-ufo>` for the
23
23
  common case (see its section below), but the decor itself could back other kinds of reconstructions later. A fully
24
24
  generic version (accepting arbitrary overlay content instead of always creating its own `<rr0-ufo>`) is a natural
25
- follow-up, not implemented yet. `<rr0-ufo-witnesses>` follows the same "adds a qualifier" logic as the recorder:
26
- it *adds* a multi-witness selector on top of `<rr0-ufo>`, for cases that have more than one witness's own
27
- recording of the same sighting.
25
+ follow-up, not implemented yet. `<rr0-eyewitness>` (renamed from `<rr0-ufo-witnesses>` see below) is the standard
26
+ way to display any real sighting, whether it has one witness or several: a witness account always implies a real
27
+ place and time, so it always composes `<rr0-scene>`, never a bare `<rr0-ufo>`.
28
28
 
29
29
  See the [Wiki](https://github.com/RR0/UfoAtHome/wiki) for the project's history, and a live example embedded in
30
30
  [rr0.org's UFO@home page](https://rr0.org/science/crypto/ufo/enquete/projet/UfoAtHome.html) and in its
@@ -43,20 +43,21 @@ imported, no explicit setup call needed:
43
43
  <script type="module" src="/node_modules/@rr0/ufoathome/dist-embed-ufo/rr0-ufo.mjs"></script>
44
44
  <script type="module" src="/node_modules/@rr0/ufoathome/dist-embed/rr0-ufo-recorder.mjs"></script>
45
45
  <script type="module" src="/node_modules/@rr0/ufoathome/dist-embed-scene/rr0-scene.mjs"></script>
46
- <script type="module" src="/node_modules/@rr0/ufoathome/dist-embed-witnesses/rr0-ufo-witnesses.mjs"></script>
46
+ <script type="module" src="/node_modules/@rr0/ufoathome/dist-embed-eyewitness/rr0-eyewitness.mjs"></script>
47
47
  ```
48
48
 
49
49
  or, from a bundler:
50
50
 
51
51
  ```ts
52
- import "@rr0/ufoathome/ufo" // registers <rr0-ufo>
53
- import "@rr0/ufoathome/recorder" // registers <rr0-ufo-recorder> (and <rr0-ufo>, which it composes)
54
- import "@rr0/ufoathome/scene" // registers <rr0-scene> (and <rr0-ufo>, which it composes)
55
- import "@rr0/ufoathome/witnesses" // registers <rr0-ufo-witnesses> (and <rr0-ufo>, which it composes)
52
+ import "@rr0/ufoathome/ufo" // registers <rr0-ufo>
53
+ import "@rr0/ufoathome/recorder" // registers <rr0-ufo-recorder> (and <rr0-scene>, which it composes)
54
+ import "@rr0/ufoathome/scene" // registers <rr0-scene> (and <rr0-ufo>, which it composes)
55
+ import "@rr0/ufoathome/eyewitness" // registers <rr0-eyewitness> (and <rr0-scene>, which it composes)
56
56
  ```
57
57
 
58
- Only load the one(s) a given page actually needs — `rr0-scene.mjs` in particular pulls in Three.js and is far
59
- heavier than the others (see its section below), so pages that just need playback should stick to `rr0-ufo.mjs`.
58
+ Only load the one(s) a given page actually needs — `rr0-scene.mjs` and `rr0-eyewitness.mjs` in particular pull in
59
+ Three.js and are far heavier than the other two (see their sections below), so pages that just need playback of an
60
+ already-drawn shape with no astronomy backdrop should stick to `rr0-ufo.mjs`.
60
61
 
61
62
  ## `<rr0-ufo>` — read-only playback
62
63
 
@@ -186,25 +187,28 @@ The UFO shape itself deliberately stays a 2D overlay on top of the 3D decor, nev
186
187
  what the witness reported — possibly a misidentification or optical effect — not something to interpret as a real
187
188
  3D shape. Only the surrounding environment, independently computable from real astronomy, is rendered in 3D.
188
189
 
189
- ## `<rr0-ufo-witnesses>` — multi-witness selector
190
+ ## `<rr0-eyewitness>` — standard sighting view
190
191
 
191
- A case can have more than one witness, each with their own recording (their own `sighting.json`) of the same
192
- event. This component lets a page switch between them instead of only ever embedding one fixed `<rr0-ufo>` — it
193
- composes a nested `<rr0-ufo>` the same way `<rr0-scene>` does, and is otherwise just as lightweight.
192
+ The standard way to display any real sighting, whether it has one witness or several renamed from
193
+ `<rr0-ufo-witnesses>` once it stopped being just a multi-witness selector (see [Naming](#naming)). It composes a
194
+ nested `<rr0-scene>` (not a bare `<rr0-ufo>`) the same way `<rr0-ufo-recorder>` does, since a witness recording is
195
+ always a real sighting and always needs the real sky/ground backdrop.
194
196
 
195
197
  ```html
196
- <rr0-ufo-witnesses src="witnesses.json"></rr0-ufo-witnesses>
198
+ <rr0-eyewitness src="sighting.json"></rr0-eyewitness>
197
199
  ```
198
200
 
199
- `src` points not at a `sighting.json` directly, but at a small manifest a plain JSON array of each witness's own
200
- `SightingRecordingJson` URL (typically relative to the case's own page, same as `<rr0-ufo>`'s own `src`):
201
+ `src` accepts either a single witness's `sighting.json` directly (the common caseno extra file needed) or, for
202
+ a case with several witnesses, a small manifest: a plain JSON array of each witness's own `SightingRecordingJson`
203
+ URL (typically relative to the case's own page, same as `<rr0-ufo>`'s own `src`):
201
204
 
202
205
  ```json
203
206
  ["chiles-sighting.json", "whitted-sighting.json"]
204
207
  ```
205
208
 
206
- No labels or ids are duplicated in the manifest itself each witness's display name and the shared case id
207
- grouping them together are read from that witness's *own* file (`witnessName`/`caseId`, see
209
+ The two shapes are told apart automatically a fetched JSON array is a manifest, a plain object is one witness's
210
+ own recording. No labels or ids are duplicated in a manifest itself — each witness's display name and the shared
211
+ case id grouping them together are read from that witness's *own* file (`witnessName`/`caseId`, see
208
212
  [Data format](#data-format)), so there's a single source of truth and nothing to drift out of sync. This means
209
213
  every listed witness's recording is fetched upfront (to read its name), not lazily on selection — fine at the
210
214
  scale a case's witness list actually has. If a witness has no `witnessName`, its `witnessId` is shown instead, or
@@ -213,17 +217,25 @@ block) — likely means unrelated recordings got listed together by mistake.
213
217
 
214
218
  | Member | Kind | Description |
215
219
  |---|---|---|
216
- | `src` | attribute | URL of a witness manifest (above), fetched automatically on connect and whenever the attribute changes |
220
+ | `src` | attribute | URL of a single `sighting.json` or a witness manifest (above), fetched automatically on connect and whenever the attribute changes |
217
221
  | `witnessUrls` | property (get/set) | The manifest as a plain array of URLs, for programmatic use instead of `src` |
218
222
  | `loadFromSrc(url)` | method (async) | What the `src` attribute triggers internally; can be called directly too |
219
223
 
220
- The selector (a plain `<select>` of witness labels) is hidden entirely when there are 0 or 1 witnesses no point
221
- showing a dropdown with nothing to actually choose between. The first witness loads automatically once the list is
222
- known; switching the selector loads that witness's already-fetched recording into the nested `<rr0-ufo>` (no
223
- re-fetch). Setting `witnessUrls` again (e.g. a manifest refresh) keeps the current selection if that witness is
224
- still present, instead of resetting back to the first.
224
+ A toolbar row sits above the scene, holding a witness `<select>` and a round "?" info button. The `<select>` itself
225
+ is hidden when there's nothing to actually choose between (0 or 1 witness), but the row — and the info button —
226
+ stay reachable even for a single witness. The first witness loads automatically once the list is known; switching
227
+ the selector loads that witness's already-fetched recording into the nested `<rr0-scene>` (no re-fetch). Setting
228
+ `witnessUrls` again (e.g. a manifest refresh) keeps the current selection if that witness is still present,
229
+ instead of resetting back to the first.
225
230
 
226
- The "Witness" label itself is translated (English/French) the same way as `<rr0-ufo>`'s own labels.
231
+ Clicking "?" opens a panel with three sections: the app's own name/version, linking to
232
+ [ufoathome.org](https://ufoathome.org); the currently-selected witness's observation metadata (date, location,
233
+ witness name, case id — whichever are actually present in that witness's own `sighting.json`); and third-party
234
+ credits (the live terrain imagery attribution, once a real relief patch has resolved, plus the bundled thunder
235
+ sound's own required attribution — see [`CREDITS.md`](CREDITS.md)).
236
+
237
+ All of this component's own labels (Witness, About, Close, Observation/Date/Location/Case, Credits) are translated
238
+ (English/French) the same way as `<rr0-ufo>`'s own labels.
227
239
 
228
240
  ## Data format
229
241
 
@@ -238,7 +250,7 @@ interface SightingRecordingJson {
238
250
  place?: { lat: number, lng: number }[]
239
251
  witnessId?: string // opaque internal reference — no PII beyond a display name (see witnessName)
240
252
  witnessName?: string // for cases where the witness is already publicly named in the published material (e.g. Chiles-Whitted) — omit for anonymous witnesses
241
- caseId?: string // shared by every witness's own sighting.json for the same case — see <rr0-ufo-witnesses>
253
+ caseId?: string // shared by every witness's own sighting.json for the same case — see <rr0-eyewitness>
242
254
  timeline: {
243
255
  keyframes: Array<{
244
256
  t: number // milliseconds since recording start
@@ -275,12 +287,13 @@ case's `sighting.json` from its `RR0Event`).
275
287
  - `src/render3d/` — the Three.js decor renderer (`SceneRenderer`) and its pure, dependency-free color logic
276
288
  (`skyColors.ts`), kept separate so the latter is unit-testable without a WebGL context.
277
289
  - `src/component/` — the four Web Components. `UfoElement` (`<rr0-ufo>`) owns the canvas/playback; `SceneElement`
278
- (`<rr0-scene>`) and `WitnessSelectorElement` (`<rr0-ufo-witnesses>`) compose it directly (via
279
- `document.createElement`, not an inline template tag see the comment at that call site) rather than duplicating
280
- it, adding the 3D decor or the multi-witness selector on top, respectively. `UfoRecorderElement` composes a
281
- `SceneElement` (not `UfoElement` directly) and reaches through to its public `ufoElement` property for the
282
- actual canvas/timeline/appearance work — the toolbar edits the exact same `Sighting` instance the nested scene
283
- renders from, so an observer/time/appearance change needs no separate sync step to reach the sky.
290
+ (`<rr0-scene>`) composes it directly (via `document.createElement`, not an inline template tag — see the
291
+ comment at that call site) rather than duplicating it, adding the 3D decor on top. `UfoRecorderElement` and
292
+ `EyewitnessElement` (`<rr0-eyewitness>`) both compose a `SceneElement` in turn (not `UfoElement` directly)
293
+ the recorder reaches through to its public `ufoElement` property for the actual canvas/timeline/appearance work
294
+ (the toolbar edits the exact same `Sighting` instance the nested scene renders from, so an observer/time/
295
+ appearance change needs no separate sync step to reach the sky), while `EyewitnessElement` reaches through to
296
+ its public `sightingData`/`currentTerrainAttribution` for its own toolbar (witness picker) and info panel.
284
297
  - Playback linearly interpolates shapes between a source's surrounding keyframes for smooth motion
285
298
  (`Timeline.getInterpolatedShapeAt`/`Shape.lerpShape`), holding at the ends of its recorded range.
286
299
  - Recording samples the pointer position at a configurable rate via `requestAnimationFrame`, not on every
@@ -290,13 +303,14 @@ case's `sighting.json` from its `RR0Event`).
290
303
 
291
304
  ```bash
292
305
  npm install
293
- npm run dev # local demo (record + play), Vite dev server
294
- npm test # vitest
295
- npm run build # type-check + build the demo
296
- npm run build:embed # build dist-embed/rr0-ufo-recorder.mjs
297
- npm run build:embed-ufo # build dist-embed-ufo/rr0-ufo.mjs
298
- npm run build:embed-scene # build dist-embed-scene/rr0-scene.mjs
299
- npm run build:all # all four
306
+ npm run dev # local demo (record + play), Vite dev server
307
+ npm test # vitest
308
+ npm run build # type-check + build the demo
309
+ npm run build:embed # build dist-embed/rr0-ufo-recorder.mjs
310
+ npm run build:embed-ufo # build dist-embed-ufo/rr0-ufo.mjs
311
+ npm run build:embed-scene # build dist-embed-scene/rr0-scene.mjs
312
+ npm run build:embed-eyewitness # build dist-embed-eyewitness/rr0-eyewitness.mjs
313
+ npm run build:all # all four
300
314
  ```
301
315
 
302
316
  ## License