@buoy-gg/shared-ui 7.0.25 → 7.0.27
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/lib/commonjs/JsModal.js +156 -20
- package/lib/commonjs/JsModal.web.js +85 -39
- package/lib/commonjs/dataViewer/VirtualizedDataExplorer.js +14 -4
- package/lib/commonjs/dataViewer/diffThemes.js +20 -18
- package/lib/commonjs/dataViewer/tree/TreeDiffViewer.js +8 -8
- package/lib/commonjs/hooks/safe-area-impl.js +1 -1
- package/lib/commonjs/icons/lucide-icons.js +74 -15
- package/lib/commonjs/index.js +86 -0
- package/lib/commonjs/ui/backgrounds/BackgroundSwitcher.js +248 -74
- package/lib/commonjs/ui/backgrounds/README.md +102 -20
- package/lib/commonjs/ui/backgrounds/backgroundStore.js +20 -6
- package/lib/commonjs/ui/backgrounds/index.js +91 -1
- package/lib/commonjs/ui/backgrounds/primitives.js +50 -14
- package/lib/commonjs/ui/backgrounds/registry.js +41 -64
- package/lib/commonjs/ui/backgrounds/rng.js +21 -0
- package/lib/commonjs/ui/backgrounds/skyClock.js +45 -0
- package/lib/commonjs/ui/backgrounds/variants/daylight.js +453 -0
- package/lib/commonjs/ui/backgrounds/variants/deepField.js +60 -30
- package/lib/commonjs/ui/backgrounds/variants/hyperspace.js +218 -0
- package/lib/commonjs/ui/backgrounds/variants/liveSky.js +898 -0
- package/lib/commonjs/ui/backgrounds/variants/meteors.js +257 -0
- package/lib/commonjs/ui/backgrounds/variants/moonlight.js +472 -0
- package/lib/commonjs/ui/backgrounds/variants/underwater.js +757 -0
- package/lib/commonjs/ui/components/Badge.js +11 -10
- package/lib/commonjs/ui/components/CompactRow.js +30 -17
- package/lib/commonjs/ui/components/DevToolsCard.js +12 -8
- package/lib/commonjs/ui/components/DynamicFilterView.js +43 -41
- package/lib/commonjs/ui/components/EventStepperFooter.js +38 -10
- package/lib/commonjs/ui/components/FilterComponents.js +11 -11
- package/lib/commonjs/ui/components/ModalHeader.js +13 -13
- package/lib/commonjs/ui/components/SectionHeader.js +3 -1
- package/lib/commonjs/ui/components/StorageTypeBadge.js +3 -2
- package/lib/commonjs/ui/components/TabSelector.js +56 -38
- package/lib/commonjs/ui/components/ValueTypeBadge.js +7 -6
- package/lib/commonjs/ui/components/WindowControls.js +37 -10
- package/lib/commonjs/ui/gameUI/constants/gameUIColors.js +8 -0
- package/lib/commonjs/ui/night/nightTheme.js +120 -0
- package/lib/commonjs/ui/night/primitives.js +498 -0
- package/lib/module/JsModal.js +156 -20
- package/lib/module/JsModal.web.js +83 -39
- package/lib/module/dataViewer/VirtualizedDataExplorer.js +14 -4
- package/lib/module/dataViewer/diffThemes.js +20 -18
- package/lib/module/dataViewer/tree/TreeDiffViewer.js +9 -9
- package/lib/module/hooks/safe-area-impl.js +1 -1
- package/lib/module/icons/lucide-icons.js +74 -15
- package/lib/module/index.js +4 -0
- package/lib/module/ui/backgrounds/BackgroundSwitcher.js +250 -76
- package/lib/module/ui/backgrounds/README.md +102 -20
- package/lib/module/ui/backgrounds/backgroundStore.js +19 -5
- package/lib/module/ui/backgrounds/index.js +11 -2
- package/lib/module/ui/backgrounds/primitives.js +53 -16
- package/lib/module/ui/backgrounds/registry.js +41 -64
- package/lib/module/ui/backgrounds/rng.js +20 -0
- package/lib/module/ui/backgrounds/skyClock.js +39 -0
- package/lib/module/ui/backgrounds/variants/daylight.js +449 -0
- package/lib/module/ui/backgrounds/variants/deepField.js +62 -31
- package/lib/module/ui/backgrounds/variants/hyperspace.js +214 -0
- package/lib/module/ui/backgrounds/variants/liveSky.js +893 -0
- package/lib/module/ui/backgrounds/variants/meteors.js +253 -0
- package/lib/module/ui/backgrounds/variants/moonlight.js +468 -0
- package/lib/module/ui/backgrounds/variants/underwater.js +753 -0
- package/lib/module/ui/components/Badge.js +11 -10
- package/lib/module/ui/components/CompactRow.js +30 -17
- package/lib/module/ui/components/DevToolsCard.js +12 -8
- package/lib/module/ui/components/DynamicFilterView.js +43 -41
- package/lib/module/ui/components/EventStepperFooter.js +38 -10
- package/lib/module/ui/components/FilterComponents.js +11 -11
- package/lib/module/ui/components/ModalHeader.js +13 -13
- package/lib/module/ui/components/SectionHeader.js +3 -1
- package/lib/module/ui/components/StorageTypeBadge.js +3 -2
- package/lib/module/ui/components/TabSelector.js +57 -39
- package/lib/module/ui/components/ValueTypeBadge.js +7 -6
- package/lib/module/ui/components/WindowControls.js +37 -10
- package/lib/module/ui/gameUI/constants/gameUIColors.js +8 -0
- package/lib/module/ui/night/nightTheme.js +116 -0
- package/lib/module/ui/night/primitives.js +485 -0
- package/lib/typescript/commonjs/JsModal.d.ts +18 -0
- package/lib/typescript/commonjs/JsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/JsModal.web.d.ts +13 -0
- package/lib/typescript/commonjs/JsModal.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/VirtualizedDataExplorer.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/diffThemes.d.ts +3 -1
- package/lib/typescript/commonjs/dataViewer/diffThemes.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/tree/TreeDiffViewer.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/icons/lucide-icons.d.ts +12 -1
- package/lib/typescript/commonjs/icons/lucide-icons.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +3 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/backgrounds/BackgroundSwitcher.d.ts +26 -6
- package/lib/typescript/commonjs/ui/backgrounds/BackgroundSwitcher.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/backgrounds/backgroundStore.d.ts +3 -0
- package/lib/typescript/commonjs/ui/backgrounds/backgroundStore.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/backgrounds/index.d.ts +7 -1
- package/lib/typescript/commonjs/ui/backgrounds/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/backgrounds/primitives.d.ts +18 -3
- package/lib/typescript/commonjs/ui/backgrounds/primitives.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/backgrounds/registry.d.ts +8 -0
- package/lib/typescript/commonjs/ui/backgrounds/registry.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/backgrounds/rng.d.ts +6 -0
- package/lib/typescript/commonjs/ui/backgrounds/rng.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/backgrounds/skyClock.d.ts +17 -0
- package/lib/typescript/commonjs/ui/backgrounds/skyClock.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/backgrounds/types.d.ts +1 -1
- package/lib/typescript/commonjs/ui/backgrounds/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/backgrounds/variants/daylight.d.ts +30 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/daylight.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/deepField.d.ts +19 -4
- package/lib/typescript/commonjs/ui/backgrounds/variants/deepField.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/backgrounds/variants/hyperspace.d.ts +39 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/hyperspace.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/liveSky.d.ts +41 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/liveSky.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/meteors.d.ts +26 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/meteors.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/moonlight.d.ts +35 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/moonlight.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/underwater.d.ts +51 -0
- package/lib/typescript/commonjs/ui/backgrounds/variants/underwater.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/Badge.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/CompactRow.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/DynamicFilterView.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/EventStepperFooter.d.ts +2 -0
- package/lib/typescript/commonjs/ui/components/EventStepperFooter.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/StorageTypeBadge.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/TabSelector.d.ts +9 -0
- package/lib/typescript/commonjs/ui/components/TabSelector.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ValueTypeBadge.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/WindowControls.d.ts +4 -2
- package/lib/typescript/commonjs/ui/components/WindowControls.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts +8 -0
- package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/night/nightTheme.d.ts +113 -0
- package/lib/typescript/commonjs/ui/night/nightTheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/night/primitives.d.ts +111 -0
- package/lib/typescript/commonjs/ui/night/primitives.d.ts.map +1 -0
- package/lib/typescript/module/JsModal.d.ts +18 -0
- package/lib/typescript/module/JsModal.d.ts.map +1 -1
- package/lib/typescript/module/JsModal.web.d.ts +13 -0
- package/lib/typescript/module/JsModal.web.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/VirtualizedDataExplorer.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/diffThemes.d.ts +3 -1
- package/lib/typescript/module/dataViewer/diffThemes.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/tree/TreeDiffViewer.d.ts.map +1 -1
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/icons/lucide-icons.d.ts +12 -1
- package/lib/typescript/module/icons/lucide-icons.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +3 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/backgrounds/BackgroundSwitcher.d.ts +26 -6
- package/lib/typescript/module/ui/backgrounds/BackgroundSwitcher.d.ts.map +1 -1
- package/lib/typescript/module/ui/backgrounds/backgroundStore.d.ts +3 -0
- package/lib/typescript/module/ui/backgrounds/backgroundStore.d.ts.map +1 -1
- package/lib/typescript/module/ui/backgrounds/index.d.ts +7 -1
- package/lib/typescript/module/ui/backgrounds/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/backgrounds/primitives.d.ts +18 -3
- package/lib/typescript/module/ui/backgrounds/primitives.d.ts.map +1 -1
- package/lib/typescript/module/ui/backgrounds/registry.d.ts +8 -0
- package/lib/typescript/module/ui/backgrounds/registry.d.ts.map +1 -1
- package/lib/typescript/module/ui/backgrounds/rng.d.ts +6 -0
- package/lib/typescript/module/ui/backgrounds/rng.d.ts.map +1 -1
- package/lib/typescript/module/ui/backgrounds/skyClock.d.ts +17 -0
- package/lib/typescript/module/ui/backgrounds/skyClock.d.ts.map +1 -0
- package/lib/typescript/module/ui/backgrounds/types.d.ts +1 -1
- package/lib/typescript/module/ui/backgrounds/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/backgrounds/variants/daylight.d.ts +30 -0
- package/lib/typescript/module/ui/backgrounds/variants/daylight.d.ts.map +1 -0
- package/lib/typescript/module/ui/backgrounds/variants/deepField.d.ts +19 -4
- package/lib/typescript/module/ui/backgrounds/variants/deepField.d.ts.map +1 -1
- package/lib/typescript/module/ui/backgrounds/variants/hyperspace.d.ts +39 -0
- package/lib/typescript/module/ui/backgrounds/variants/hyperspace.d.ts.map +1 -0
- package/lib/typescript/module/ui/backgrounds/variants/liveSky.d.ts +41 -0
- package/lib/typescript/module/ui/backgrounds/variants/liveSky.d.ts.map +1 -0
- package/lib/typescript/module/ui/backgrounds/variants/meteors.d.ts +26 -0
- package/lib/typescript/module/ui/backgrounds/variants/meteors.d.ts.map +1 -0
- package/lib/typescript/module/ui/backgrounds/variants/moonlight.d.ts +35 -0
- package/lib/typescript/module/ui/backgrounds/variants/moonlight.d.ts.map +1 -0
- package/lib/typescript/module/ui/backgrounds/variants/underwater.d.ts +51 -0
- package/lib/typescript/module/ui/backgrounds/variants/underwater.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/Badge.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/CompactRow.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/DynamicFilterView.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/EventStepperFooter.d.ts +2 -0
- package/lib/typescript/module/ui/components/EventStepperFooter.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/StorageTypeBadge.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/TabSelector.d.ts +9 -0
- package/lib/typescript/module/ui/components/TabSelector.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ValueTypeBadge.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/WindowControls.d.ts +4 -2
- package/lib/typescript/module/ui/components/WindowControls.d.ts.map +1 -1
- package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts +8 -0
- package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
- package/lib/typescript/module/ui/night/nightTheme.d.ts +113 -0
- package/lib/typescript/module/ui/night/nightTheme.d.ts.map +1 -0
- package/lib/typescript/module/ui/night/primitives.d.ts +111 -0
- package/lib/typescript/module/ui/night/primitives.d.ts.map +1 -0
- package/package.json +4 -4
- package/lib/commonjs/ui/backgrounds/variants/lattice.js +0 -579
- package/lib/commonjs/ui/backgrounds/variants/starfield.js +0 -210
- package/lib/module/ui/backgrounds/variants/lattice.js +0 -575
- package/lib/module/ui/backgrounds/variants/starfield.js +0 -206
- package/lib/typescript/commonjs/ui/backgrounds/variants/lattice.d.ts +0 -33
- package/lib/typescript/commonjs/ui/backgrounds/variants/lattice.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/backgrounds/variants/starfield.d.ts +0 -12
- package/lib/typescript/commonjs/ui/backgrounds/variants/starfield.d.ts.map +0 -1
- package/lib/typescript/module/ui/backgrounds/variants/lattice.d.ts +0 -33
- package/lib/typescript/module/ui/backgrounds/variants/lattice.d.ts.map +0 -1
- package/lib/typescript/module/ui/backgrounds/variants/starfield.d.ts +0 -12
- package/lib/typescript/module/ui/backgrounds/variants/starfield.d.ts.map +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Hyperspace = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _absoluteFill = require("../../../utils/absoluteFill.js");
|
|
10
|
+
var _primitives = require("../primitives.js");
|
|
11
|
+
var _rng = require("../rng.js");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
/**
|
|
14
|
+
* Hyperspace — a faithful port of the Everlights `HyperspaceBackground`
|
|
15
|
+
* (components/hyperspace-background.tsx), the Star Wars "lightspeed" field:
|
|
16
|
+
* crisp ROUND points streaming out of a centre vanishing point on the 3D
|
|
17
|
+
* depth projection `screen = plane / z`.
|
|
18
|
+
*
|
|
19
|
+
* THE FIELD IS EXACT: one mulberry32 stream seeded `0x5747 ^ 260`, pulling
|
|
20
|
+
* `ang, rad, z0, tw` per star in the original's call order — same 260 stars,
|
|
21
|
+
* same sqrt-biased radii with the 12% clear centre, same palette pick
|
|
22
|
+
* formula, same z sweep (1.0 → 0.06), same speed (0.55 z-units/sec, the
|
|
23
|
+
* "lightspeed" tuning), same 0.15 + 0.85·near² brightness with 6% fade at
|
|
24
|
+
* both ends of a star's life. Stars are round dots, NOT streaks — the
|
|
25
|
+
* original never elongates anything.
|
|
26
|
+
*
|
|
27
|
+
* HOW THE PROJECTION RUNS WITHOUT SKIA: a star at plane offset p appears at
|
|
28
|
+
* `centre + (p/z)·centre`, so a LAYER scaled by S = 1/z about the centre
|
|
29
|
+
* carries every star along its exact trajectory. The z-sweep becomes scale
|
|
30
|
+
* keyframes on ONE looping value.
|
|
31
|
+
*
|
|
32
|
+
* WHAT COULDN'T COME ACROSS 1:1, and what was done instead:
|
|
33
|
+
*
|
|
34
|
+
* - **Continuous per-star start phase.** Every star has its own `z0`; per
|
|
35
|
+
* star that's 260 nodes. `z0` (and ONLY z0) is quantised into 8 shells —
|
|
36
|
+
* the same single-quantity discipline Deep Field applies to speed.
|
|
37
|
+
* Position, size, colour and brightness stay exact.
|
|
38
|
+
* - **The size CAP.** The original stamps its sprite at `dia = baseDia/z`
|
|
39
|
+
* capped at 4.5×base, but a scaling layer can't cap one star's size
|
|
40
|
+
* mid-flight. Instead each dot is drawn at the sprite's true lit-core
|
|
41
|
+
* size (12.5% of the stamp — 0.45px at z=1), which reaches the original's
|
|
42
|
+
* 2px cap at the cap's own z and only overshoots inside the final 6%
|
|
43
|
+
* fade-out, where brightness is already dying.
|
|
44
|
+
* - **The blurred sprite.** As in Deep Field: a solid core at the lit 12.5%
|
|
45
|
+
* plus one concentric disc at the halo's α0.30 stands in for the blur.
|
|
46
|
+
* - **Additive blend + the 5% twinkle** are dropped; over near-black at this
|
|
47
|
+
* density neither reads.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
const BASE_COLOR = "#050505";
|
|
51
|
+
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// The original's constants, verbatim (variant 1, "lightspeed").
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
const COUNT = 260;
|
|
56
|
+
const SPEED = 0.55; // z-units/sec → one life = 1/0.55 s
|
|
57
|
+
const BASE_DIA = 3.6; // sprite diameter px at z=1
|
|
58
|
+
const PLANE = 0.5;
|
|
59
|
+
const Z_FAR = 1.0;
|
|
60
|
+
const Z_NEAR = 0.06;
|
|
61
|
+
const Z_SPAN = Z_FAR - Z_NEAR;
|
|
62
|
+
/** The lit core of the 64px sprite is r=4 → 12.5% of the stamp. */
|
|
63
|
+
const CORE_FRAC = 0.125;
|
|
64
|
+
const CYCLE_MS = Math.round(1000 / SPEED);
|
|
65
|
+
const PALETTE = ["#FFFFFF", "#B3D9FF", "#8CB3FF"];
|
|
66
|
+
const SHELLS = 8;
|
|
67
|
+
/**
|
|
68
|
+
* The original field, regenerated — ONE rng stream, original call order
|
|
69
|
+
* (ang, rad, z0, tw per star), original seed. Any other order or seed is a
|
|
70
|
+
* different sky.
|
|
71
|
+
*/
|
|
72
|
+
function buildField() {
|
|
73
|
+
const rnd = (0, _rng.mulberry32)((0x5747 ^ COUNT) >>> 0);
|
|
74
|
+
const stars = [];
|
|
75
|
+
for (let i = 0; i < COUNT; i++) {
|
|
76
|
+
const ang = rnd() * Math.PI * 2;
|
|
77
|
+
// sqrt-biased outward, inner 12% clear of the vanishing point.
|
|
78
|
+
const rad = (0.12 + 0.88 * Math.sqrt(rnd())) * PLANE;
|
|
79
|
+
const z0 = rnd();
|
|
80
|
+
const tw = rnd() * Math.PI * 2;
|
|
81
|
+
stars.push({
|
|
82
|
+
px: Math.cos(ang) * rad,
|
|
83
|
+
py: Math.sin(ang) * rad,
|
|
84
|
+
shell: Math.min(SHELLS - 1, Math.floor(z0 * SHELLS)),
|
|
85
|
+
// The original's exact (quirky) pick: floor((tw·0.5 + 0.5)·n) % n.
|
|
86
|
+
color: PALETTE[Math.floor((tw * 0.5 + 0.5) * PALETTE.length) % PALETTE.length]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return stars;
|
|
90
|
+
}
|
|
91
|
+
const FIELD = buildField();
|
|
92
|
+
|
|
93
|
+
/** S(p) = 1/z with z falling linearly over the phase — the projection. */
|
|
94
|
+
function scaleAt(p) {
|
|
95
|
+
return 1 / (Z_FAR - p * Z_SPAN);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The original's brightness: 0.15 + 0.85·near², faded over the first and
|
|
99
|
+
* last 6% of a star's life (which also hides the shell's wrap snap). */
|
|
100
|
+
function opacityAt(p) {
|
|
101
|
+
let bright = 0.15 + 0.85 * p * p;
|
|
102
|
+
if (p < 0.06) bright *= p / 0.06;else if (p > 0.94) bright *= (1 - p) / 0.06;
|
|
103
|
+
return Math.min(1, bright);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Interpolate stops for shell k (phase = (v + k/K) mod 1); the wrap point is
|
|
107
|
+
* double-sampled 1e-4 apart inside the zero-opacity sliver. */
|
|
108
|
+
function shellStops(k) {
|
|
109
|
+
const offset = k / SHELLS;
|
|
110
|
+
const vs = [];
|
|
111
|
+
const SEGMENTS = 18;
|
|
112
|
+
for (let i = 0; i <= SEGMENTS; i++) vs.push(i / SEGMENTS);
|
|
113
|
+
const vWrap = (1 - offset) % 1;
|
|
114
|
+
if (vWrap > 1e-3 && vWrap < 1 - 1e-3) vs.push(vWrap - 1e-4, vWrap + 1e-4);
|
|
115
|
+
vs.sort((a, b) => a - b);
|
|
116
|
+
const input = [];
|
|
117
|
+
const scale = [];
|
|
118
|
+
const opacity = [];
|
|
119
|
+
for (const v of vs) {
|
|
120
|
+
// At the loop boundary the offset-0 shell's phase must read as END of
|
|
121
|
+
// life (p=1, max scale, zero opacity), not wrap to 0 — otherwise the
|
|
122
|
+
// last segment lerps scale back to 1 at visible opacity and the stars
|
|
123
|
+
// retract to the centre once per cycle.
|
|
124
|
+
const p = offset === 0 && v === 1 ? 1 : (v + offset) % 1;
|
|
125
|
+
input.push(v);
|
|
126
|
+
scale.push(scaleAt(p));
|
|
127
|
+
opacity.push(opacityAt(p));
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
input,
|
|
131
|
+
scale,
|
|
132
|
+
opacity
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const SHELL_STOPS = Array.from({
|
|
136
|
+
length: SHELLS
|
|
137
|
+
}, (_, k) => shellStops(k));
|
|
138
|
+
const Hyperspace = exports.Hyperspace = /*#__PURE__*/(0, _react.memo)(function Hyperspace({
|
|
139
|
+
width,
|
|
140
|
+
height,
|
|
141
|
+
animated
|
|
142
|
+
}) {
|
|
143
|
+
const drive = (0, _primitives.useLoop)(CYCLE_MS, animated);
|
|
144
|
+
const cx = width / 2;
|
|
145
|
+
const cy = height / 2;
|
|
146
|
+
|
|
147
|
+
// Core at the sprite's lit 12.5% (0.45px at z=1) with a floor so the far
|
|
148
|
+
// stars land on a pixel; halo disc at the sprite's α0.30, 2.4× the core.
|
|
149
|
+
const core = Math.max(0.5, BASE_DIA * CORE_FRAC);
|
|
150
|
+
const halo = core * 2.4;
|
|
151
|
+
const shells = [];
|
|
152
|
+
for (let k = 0; k < SHELLS; k++) {
|
|
153
|
+
const stops = SHELL_STOPS[k];
|
|
154
|
+
const stars = [];
|
|
155
|
+
for (let i = 0; i < FIELD.length; i++) {
|
|
156
|
+
const star = FIELD[i];
|
|
157
|
+
if (star.shell !== k) continue;
|
|
158
|
+
// The original's projection at z=1: sx = cx + px·cx, sy = cy + py·cy
|
|
159
|
+
// (offsets scale with the HALF-extent — elliptical, exactly as there).
|
|
160
|
+
const x = cx + star.px * cx;
|
|
161
|
+
const y = cy + star.py * cy;
|
|
162
|
+
stars.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
163
|
+
style: {
|
|
164
|
+
position: "absolute",
|
|
165
|
+
left: x - halo / 2,
|
|
166
|
+
top: y - halo / 2,
|
|
167
|
+
width: halo,
|
|
168
|
+
height: halo,
|
|
169
|
+
borderRadius: halo / 2,
|
|
170
|
+
backgroundColor: (0, _rng.withAlpha)(star.color, 0.3)
|
|
171
|
+
}
|
|
172
|
+
}, `${i}-h`), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
173
|
+
style: {
|
|
174
|
+
position: "absolute",
|
|
175
|
+
left: x - core / 2,
|
|
176
|
+
top: y - core / 2,
|
|
177
|
+
width: core,
|
|
178
|
+
height: core,
|
|
179
|
+
borderRadius: core / 2,
|
|
180
|
+
backgroundColor: star.color
|
|
181
|
+
}
|
|
182
|
+
}, i));
|
|
183
|
+
}
|
|
184
|
+
shells.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
185
|
+
style: [_absoluteFill.absoluteFill, {
|
|
186
|
+
opacity: drive.interpolate({
|
|
187
|
+
inputRange: stops.input,
|
|
188
|
+
outputRange: stops.opacity
|
|
189
|
+
}),
|
|
190
|
+
transform: [{
|
|
191
|
+
scale: drive.interpolate({
|
|
192
|
+
inputRange: stops.input,
|
|
193
|
+
outputRange: stops.scale
|
|
194
|
+
})
|
|
195
|
+
}]
|
|
196
|
+
}],
|
|
197
|
+
pointerEvents: "none",
|
|
198
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.RasterLayer, {
|
|
199
|
+
style: _absoluteFill.absoluteFill,
|
|
200
|
+
raster: false,
|
|
201
|
+
children: stars
|
|
202
|
+
})
|
|
203
|
+
}, k));
|
|
204
|
+
}
|
|
205
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
206
|
+
style: [_absoluteFill.absoluteFill, {
|
|
207
|
+
overflow: "hidden"
|
|
208
|
+
}],
|
|
209
|
+
pointerEvents: "none",
|
|
210
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Base, {
|
|
211
|
+
color: BASE_COLOR
|
|
212
|
+
}), shells, /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Vignette, {
|
|
213
|
+
color: "#000000",
|
|
214
|
+
alpha: 0.3,
|
|
215
|
+
spread: 0.3
|
|
216
|
+
})]
|
|
217
|
+
});
|
|
218
|
+
});
|