@celestia-island/hikari 0.55.523 → 0.55.524
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/types/components/HkStatusBar.d.ts +23 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/theme/solarGlobeMap.d.ts +21 -0
- package/package.json +1 -1
- package/src/components/HkStatusBar.test.tsx +45 -0
- package/src/components/HkStatusBar.tsx +13 -1
- package/src/components/statusBarSheet.contract.test.ts +86 -0
- package/src/errorLandingStandalone/error-landing.html +1 -1
- package/src/index.ts +12 -0
- package/src/styles/admin-tokens.scss +28 -0
- package/src/theme/solarGlobeAlignment.test.ts +42 -0
- package/src/theme/solarGlobeMap.export.contract.test.ts +49 -0
- package/src/theme/solarGlobeMap.test.ts +31 -0
- package/src/theme/solarGlobeMap.ts +27 -0
|
@@ -68,6 +68,17 @@ export declare const HkStatusBar: import("vue").DefineComponent<import("vue").Ex
|
|
|
68
68
|
type: BooleanConstructor;
|
|
69
69
|
default: boolean;
|
|
70
70
|
};
|
|
71
|
+
/** Keep the version rows INLINE even when `compact` (module-page
|
|
72
|
+
* footers that share the band with a centered switcher but are wide
|
|
73
|
+
* enough to afford them: the dot stays, the versions come back).
|
|
74
|
+
* The shared sheet folds the rows away again below 1024px, where
|
|
75
|
+
* the switcher's width wins — so the popover/aria fallback of
|
|
76
|
+
* `compact` remains the narrow-screen behavior unchanged. Without
|
|
77
|
+
* `compact` this prop is a no-op (the rows already render). */
|
|
78
|
+
inlineVersions: {
|
|
79
|
+
type: BooleanConstructor;
|
|
80
|
+
default: boolean;
|
|
81
|
+
};
|
|
71
82
|
onRetry: {
|
|
72
83
|
type: PropType<() => void>;
|
|
73
84
|
default: undefined;
|
|
@@ -145,6 +156,17 @@ export declare const HkStatusBar: import("vue").DefineComponent<import("vue").Ex
|
|
|
145
156
|
type: BooleanConstructor;
|
|
146
157
|
default: boolean;
|
|
147
158
|
};
|
|
159
|
+
/** Keep the version rows INLINE even when `compact` (module-page
|
|
160
|
+
* footers that share the band with a centered switcher but are wide
|
|
161
|
+
* enough to afford them: the dot stays, the versions come back).
|
|
162
|
+
* The shared sheet folds the rows away again below 1024px, where
|
|
163
|
+
* the switcher's width wins — so the popover/aria fallback of
|
|
164
|
+
* `compact` remains the narrow-screen behavior unchanged. Without
|
|
165
|
+
* `compact` this prop is a no-op (the rows already render). */
|
|
166
|
+
inlineVersions: {
|
|
167
|
+
type: BooleanConstructor;
|
|
168
|
+
default: boolean;
|
|
169
|
+
};
|
|
148
170
|
onRetry: {
|
|
149
171
|
type: PropType<() => void>;
|
|
150
172
|
default: undefined;
|
|
@@ -195,6 +217,7 @@ export declare const HkStatusBar: import("vue").DefineComponent<import("vue").Ex
|
|
|
195
217
|
connectionStatus: "idle" | "connected" | "disconnected" | "connecting" | "reconnecting";
|
|
196
218
|
connectionInfo: HkConnectionInfo | null;
|
|
197
219
|
standalone: boolean;
|
|
220
|
+
inlineVersions: boolean;
|
|
198
221
|
transportTier: string;
|
|
199
222
|
attemptNumber: number;
|
|
200
223
|
countdown: number;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -174,6 +174,7 @@ export { default as HkThemeDecor, type HkThemeDecorSize } from "./components/HkT
|
|
|
174
174
|
export { initTheme, useTheme, themePresets, tokensToCSSVars, getThemeTokens, loadCustomThemes, saveCustomThemes, addCustomTheme, removeCustomTheme, registerTokenGroup, getTokenGroups, resolveGroupTokens, clampToSlot, clampRgbToBands, clampHue, hueDelta, wrapHue, groupTokensToCSSVars, rgbToHsl, hslToRgb, tokenGroupsVersion, tokenGroupSlotKind, tokenGroupSlotCssVar, isColorSlot, isNumberSlot, isEnumSlot, registerStandardThemeGroups, STANDARD_SHAPE_GROUP_ID, registerStandardThemeDecor, STANDARD_THEME_DECOR_SLOTS, registerThemeDecor, registerThemeDecorBuiltin, getThemeDecor, themeDecorSlots, themeDecorVersion, isThemeDecorSlot, THEME_DECOR_SLOT_PATTERN, THEME_DECOR_WILDCARD, allGroupSlots, resolveLocalizedText, parseTokenGroupConfig, registerTokenGroupConfig, startLuminanceSampler, stopLuminanceSampler, sampleLuminanceNow, invalidateLuminanceCache, registerWallpaperSurfaceSources, resolveWallpaperSurfaceElement, retainLuminanceSampler, releaseLuminanceSampler, luminanceSamplerRefCount, type WallpaperSurfaceKind, type WallpaperSurfaceSources, getTimePeriod, getGeolocation, solarAltitude, DEFAULT_GEO_LOCATION, timezoneFallback, setGeolocationProvider, refreshThemeClock, stopThemeClock, SOLAR_LOCATION_STRATEGY_STORAGE_KEY, SOLAR_MANUAL_LOCATION_STORAGE_KEY, hydrateSolarLocationState, solarLocationStrategy, setSolarLocationStrategy, solarManualLocation, setSolarManualLocation, manualLocationOf, listTimeZones, systemTimeZoneId, initFontContext, applyFontContext, resetFontContext, useFontContext, resolveThemeDisplayName, resolveThemeDisplayNameT, HIKARI_FONT_SANS, HIKARI_FONT_MONO, HIKARI_FONT_READING, type ThemeTokenRGB, type ThemeSchemeTokens, type ThemePreset, type ThemeMode, type ThemeId, type ThemeTokens, type CustomThemePreset, type TimePeriod, type ThemeNameI18n, type GeoLocation, type GeoLocationProvider, type SolarLocationStrategy, type SolarHemisphere, type SolarManualLocation, type ThemeTokenGroupValues, type ThemeTokenGroupModes, type ThemeTokenValue, type TokenGroupDefinition, type TokenGroupSlot, type TokenGroupSection, type HueClamp, type TokenGroupSlotKind, type TokenColorSlot, type TokenNumberSlot, type TokenEnumSlot, type ResolvedGroupTokens, type ColorHSL, type LocalizedText, type ParseTokenGroupResult, type ThemeDecorSlot, type ThemeDecorRegistration, type ThemeDecorBuiltinRegistration, type FontContextOverrides, } from "./theme";
|
|
175
175
|
export { deriveSemanticPalette, CANONICAL_SEMANTIC, contrastRatio, hueDistance, rgbToOklch, oklchToRgb } from "./theme/semanticPalette";
|
|
176
176
|
export type { SemanticPalette, SemanticFills, OKLCH } from "./theme/semanticPalette";
|
|
177
|
+
export { SOLAR_GLOBE_MAP_WIDTH, SOLAR_GLOBE_MAP_HEIGHT, solarGlobeMapDataUrl, globePointAt, } from "./theme/solarGlobeMap";
|
|
177
178
|
export { FALLBACK_WALLPAPER_ID, DEFAULT_WALLPAPER_ID, DEFAULT_PRESETS, DEFAULT_DISPLAY_SETTINGS, DEFAULT_WALLPAPER_STORAGE_PREFIX, registerWallpaperPack, configureWallpaperStorage, wallpaperStorageKey, isWallpaperSource, isTimeAware, loadActiveWallpaperId, hasStoredWallpaperId, saveActiveWallpaperId, loadCustomWallpapers, saveCustomWallpapers, addCustomWallpaper, removeCustomWallpaper, updateCustomWallpaper, loadCachedGeolocation, saveCachedGeolocation, loadDisplaySettings, saveDisplaySettings, getDisplaySettings, setDisplaySettings, buildWallpaperFilter, initWallpaper, destroyWallpaper, useWallpaper, ensureWallpaperState, configureWallpaper, registerWallpaperBrandDefaults, registerServerThemeWallpaper, brandDefaultWallpaperFor, resolveThemeFollowSwitch, setWallpaperPipelineLookup, geo, currentPeriod, hasStorage, readStorageItem, writeStorageItem, removeStorageItem, type WallpaperType, type SolidSource, type ImageSource, type VideoSource, type PipelineSource, type WallpaperSource, type TimeAwareWallpaper, type WallpaperPreset, type WallpaperPackEntry, type CustomWallpaper, type WallpaperPosition, type WallpaperScale, type WallpaperEffect, type WallpaperDisplaySettings, type WallpaperStorageSlot, type WallpaperStorageConfig, type WallpaperInitConfig, type WallpaperPipelineLookup, type WallpaperPipelinePreset, } from "./theme";
|
|
178
179
|
export { registerShaderPresets, getShaderPreset, listShaderPresetIds, SHADER_VERTEX, WallpaperShaderPipeline, createWallpaperShaderSurface, type WallpaperShaderPreset, type WallpaperShaderPresetInput, type WallpaperShaderScaleConfig, type WallpaperShaderScaleInput, type WallpaperShaderOverlayConfig, } from "./theme";
|
|
179
180
|
export { default as HkWallpaperBackdrop, WALLPAPER_REDUCED_MOTION_QUERY, type HkWallpaperBackdropMode, type HkWallpaperSurface, type HkWallpaperSurfaceContext, type HkWallpaperSurfaceFactory, } from "./components/HkWallpaperBackdrop";
|
|
@@ -33,3 +33,24 @@ export declare const SOLAR_GLOBE_MAP_SVG: string;
|
|
|
33
33
|
/** Data URL form for `new Image()` rasterization (no bundler asset
|
|
34
34
|
* pipeline involved — the SVG travels inside the package as source). */
|
|
35
35
|
export declare function solarGlobeMapDataUrl(): string;
|
|
36
|
+
/** Surface position [x, y, z] of a geographic point on the base-map
|
|
37
|
+
* sphere (hikari's own globe renderer and any board page that pins
|
|
38
|
+
* markers to the map). Pure math — no three import, so callers hand
|
|
39
|
+
* the tuple to `new THREE.Vector3(...)` themselves. (No relation to
|
|
40
|
+
* the components crate's `globe_point_at` — that one projects a
|
|
41
|
+
* lat/lng onto the picker's 2-D orthographic SCREEN disc; this one is
|
|
42
|
+
* the sphere's 3-D surface coordinate.)
|
|
43
|
+
*
|
|
44
|
+
* The convention is THE globe's texture alignment (solarTimeZones.ts,
|
|
45
|
+
* measured against the installed three by solarGlobeAlignment.test.ts):
|
|
46
|
+
* an equirectangular texture puts longitude L at sphere azimuth
|
|
47
|
+
* atan2(x, z) = L + 90°, and latitude runs from the sphere's own +Y.
|
|
48
|
+
* This helper is the single place that converts, so a page marker and
|
|
49
|
+
* the picker's wedges can never disagree about where a coordinate is.
|
|
50
|
+
*
|
|
51
|
+
* @param latDeg geographic latitude, degrees, north positive.
|
|
52
|
+
* @param lngDeg geographic longitude, degrees, east positive.
|
|
53
|
+
* @param radius sphere radius (markers ride `radius` exactly; lift a
|
|
54
|
+
* chip by scaling the radius up a hair, the way the picker's wedges
|
|
55
|
+
* sit above the base sphere). */
|
|
56
|
+
export declare function globePointAt(latDeg: number, lngDeg: number, radius: number): [number, number, number];
|
package/package.json
CHANGED
|
@@ -267,6 +267,51 @@ describe("HkStatusBar", () => {
|
|
|
267
267
|
expect(tag.getAttribute("aria-label")).toBe("Connected · 1.2.3 · 9.8.7");
|
|
268
268
|
});
|
|
269
269
|
|
|
270
|
+
it("inlineVersions opts a compact tag back into the visible version rows", async () => {
|
|
271
|
+
const container = mountBar({
|
|
272
|
+
version: "1.2.3",
|
|
273
|
+
engineVersion: "9.8.7",
|
|
274
|
+
connectionStatus: "connected",
|
|
275
|
+
connectionInfo: INFO,
|
|
276
|
+
compact: true,
|
|
277
|
+
inlineVersions: true,
|
|
278
|
+
});
|
|
279
|
+
await nextTick();
|
|
280
|
+
|
|
281
|
+
const tag = container.querySelector<HTMLElement>(".s-status-bar-tag")!;
|
|
282
|
+
// Both markers ride the tag: compact keeps the dot-only shape and the
|
|
283
|
+
// sheet's narrow fold; inline-versions lets the version grid through.
|
|
284
|
+
expect(tag.getAttribute("data-compact")).toBe("true");
|
|
285
|
+
expect(tag.getAttribute("data-inline-versions")).toBe("true");
|
|
286
|
+
// The version rows render into the pill (the sheet's
|
|
287
|
+
// [data-compact][data-inline-versions] rule shows what [data-compact]
|
|
288
|
+
// alone hides) — panel row, then engine row, same anatomy as full mode.
|
|
289
|
+
const values = tag.querySelectorAll<HTMLElement>(".s-status-bar-version");
|
|
290
|
+
expect(values.length).toBe(2);
|
|
291
|
+
expect(values[0].textContent).toContain("1.2.3");
|
|
292
|
+
expect(values[1].textContent).toContain("9.8.7");
|
|
293
|
+
// The dot still renders: the traffic light is not replaced.
|
|
294
|
+
expect(tag.querySelector(".s-status-bar-dot"), "traffic-light dot renders").toBeTruthy();
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it("inlineVersions without compact is a no-op (the rows already render)", async () => {
|
|
298
|
+
const container = mountBar({
|
|
299
|
+
version: "1.2.3",
|
|
300
|
+
engineVersion: "9.8.7",
|
|
301
|
+
connectionStatus: "connected",
|
|
302
|
+
connectionInfo: INFO,
|
|
303
|
+
inlineVersions: true,
|
|
304
|
+
});
|
|
305
|
+
await nextTick();
|
|
306
|
+
|
|
307
|
+
const tag = container.querySelector<HTMLElement>(".s-status-bar-tag")!;
|
|
308
|
+
expect(tag.hasAttribute("data-compact")).toBe(false);
|
|
309
|
+
// The marker only ever pairs with compact — a full tag needs no
|
|
310
|
+
// opt-in for rows it already shows.
|
|
311
|
+
expect(tag.hasAttribute("data-inline-versions")).toBe(false);
|
|
312
|
+
expect(tag.querySelectorAll<HTMLElement>(".s-status-bar-version").length).toBe(2);
|
|
313
|
+
});
|
|
314
|
+
|
|
270
315
|
it("a touch tap on a disconnected light fires onRetry exactly once and opens the popover", async () => {
|
|
271
316
|
const onRetry = vi.fn();
|
|
272
317
|
const container = mountBar({
|
|
@@ -27,7 +27,10 @@ import { HkPlaceholderMarquee } from "./HkPlaceholderMarquee";
|
|
|
27
27
|
* re-introduced once by an upstreaming wave and reported again on
|
|
28
28
|
* 2026-08-25). The state stays reachable via the tap popover and the
|
|
29
29
|
* compact-mode aria-label; the version rows likewise move into the
|
|
30
|
-
* popover.
|
|
30
|
+
* popover. `inlineVersions` opts a compact host back INTO the inline
|
|
31
|
+
* version rows (wide module-page footers): the sheet restores them and
|
|
32
|
+
* folds them away again below 1024px, so the narrow-screen contract of
|
|
33
|
+
* `compact` is untouched.
|
|
31
34
|
*
|
|
32
35
|
* Styling rides the shared `s-status-bar*` classes from
|
|
33
36
|
* `styles/admin-tokens.scss` (the `[data-compact]` rules hide the inline
|
|
@@ -199,6 +202,14 @@ export const HkStatusBar = defineComponent({
|
|
|
199
202
|
* the connection state rides the aria-label, and the version rows
|
|
200
203
|
* move into the hover/tap popover. */
|
|
201
204
|
compact: { type: Boolean, default: false },
|
|
205
|
+
/** Keep the version rows INLINE even when `compact` (module-page
|
|
206
|
+
* footers that share the band with a centered switcher but are wide
|
|
207
|
+
* enough to afford them: the dot stays, the versions come back).
|
|
208
|
+
* The shared sheet folds the rows away again below 1024px, where
|
|
209
|
+
* the switcher's width wins — so the popover/aria fallback of
|
|
210
|
+
* `compact` remains the narrow-screen behavior unchanged. Without
|
|
211
|
+
* `compact` this prop is a no-op (the rows already render). */
|
|
212
|
+
inlineVersions: { type: Boolean, default: false },
|
|
202
213
|
onRetry: { type: Function as PropType<() => void>, default: undefined },
|
|
203
214
|
latencyMs: { type: Number, default: null },
|
|
204
215
|
// The sentinel tier "none" suppresses BOTH the protocol and the
|
|
@@ -440,6 +451,7 @@ export const HkStatusBar = defineComponent({
|
|
|
440
451
|
ref={anchorRef}
|
|
441
452
|
class={tagClass}
|
|
442
453
|
data-compact={props.compact || undefined}
|
|
454
|
+
data-inline-versions={props.compact && props.inlineVersions ? "true" : undefined}
|
|
443
455
|
role="button"
|
|
444
456
|
tabindex={0}
|
|
445
457
|
aria-label={props.compact
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sheet-level guard for compact-with-inline-versions (the fold).
|
|
3
|
+
*
|
|
4
|
+
* Why this pin and not documentation: the fold lives in the SHARED sheet
|
|
5
|
+
* (`styles/admin-tokens.scss`, mirrored into the Rust crate), not in the
|
|
6
|
+
* component — so HkStatusBar.test.tsx can only see the ATTR wiring, and
|
|
7
|
+
* jsdom cannot evaluate a media query to see the fold. PR #1675's
|
|
8
|
+
* mutation M2 (fold media `1023px` → `4095px`) compiled clean, kept the
|
|
9
|
+
* whole vitest suite green, and swallowed the restore at every real
|
|
10
|
+
* desktop width — the component tests never noticed.
|
|
11
|
+
*
|
|
12
|
+
* This file reads the sheet SOURCE and pins the structural facts the
|
|
13
|
+
* compiled CSS depends on:
|
|
14
|
+
* 1. the restore rule (`[data-compact][data-inline-versions]` →
|
|
15
|
+
* `.s-status-bar-tag-value` shown) exists;
|
|
16
|
+
* 2. the fold media query `(max-width: 1023px)` sits INSIDE the
|
|
17
|
+
* restore block, so it compiles after it at equal specificity and
|
|
18
|
+
* wins inside the range;
|
|
19
|
+
* 3. the fold restates the compact contract (gap/padding/min-height
|
|
20
|
+
* and the hidden value grid), so a folded pill is byte-for-byte
|
|
21
|
+
* the bare-dot pill compact always rendered.
|
|
22
|
+
*/
|
|
23
|
+
import { describe, expect, it } from "vitest";
|
|
24
|
+
import { readFileSync } from "node:fs";
|
|
25
|
+
import { dirname, join } from "node:path";
|
|
26
|
+
import { fileURLToPath } from "node:url";
|
|
27
|
+
|
|
28
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
29
|
+
const sheet = readFileSync(join(here, "../styles/admin-tokens.scss"), "utf-8");
|
|
30
|
+
|
|
31
|
+
/** The `[data-compact]` block's source, from its selector to the close
|
|
32
|
+
* of its rule (the sheet nests, so the block owns the fold). */
|
|
33
|
+
function compactBlock(): string {
|
|
34
|
+
const start = sheet.indexOf(".s-status-bar-tag[data-compact] {");
|
|
35
|
+
expect(start, "the compact block must exist in admin-tokens.scss").toBeGreaterThan(-1);
|
|
36
|
+
// The block ends at the matching close brace (the touch-slop pseudo
|
|
37
|
+
// nests inside it — count braces from the selector).
|
|
38
|
+
let depth = 0;
|
|
39
|
+
let end = start;
|
|
40
|
+
for (let i = sheet.indexOf("{", start); i < sheet.length; i++) {
|
|
41
|
+
if (sheet[i] === "{") depth++;
|
|
42
|
+
if (sheet[i] === "}") {
|
|
43
|
+
depth--;
|
|
44
|
+
if (depth === 0) {
|
|
45
|
+
end = i;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return sheet.slice(start, end + 1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
describe("the compact inline-versions sheet contract", () => {
|
|
54
|
+
it("restores the version grid inside [data-compact][data-inline-versions]", () => {
|
|
55
|
+
const block = compactBlock();
|
|
56
|
+
const restore = block.match(
|
|
57
|
+
/&\[data-inline-versions\] \{[\s\S]*?\n \}/,
|
|
58
|
+
);
|
|
59
|
+
expect(restore, "the inline-versions restore block must exist").toBeTruthy();
|
|
60
|
+
expect(restore![0]).toContain(".s-status-bar-tag-value");
|
|
61
|
+
expect(restore![0]).toContain("display: inline-grid");
|
|
62
|
+
expect(restore![0]).toContain("gap: 10px");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("folds the rows back below 1024px, inside the restore block", () => {
|
|
66
|
+
const block = compactBlock();
|
|
67
|
+
const restore = block.match(/&\[data-inline-versions\] \{[\s\S]*?\n \}/)!;
|
|
68
|
+
const fold = restore[0].match(/@media \(max-width: 1023px\) \{[\s\S]*?\n \}/);
|
|
69
|
+
expect(fold, "the 1023px fold must sit inside the restore block").toBeTruthy();
|
|
70
|
+
expect(fold![0]).toContain("display: none");
|
|
71
|
+
// The fold restates the bare-dot contract, not something new.
|
|
72
|
+
expect(fold![0]).toContain("gap: 0");
|
|
73
|
+
expect(fold![0]).toContain("padding: 8px");
|
|
74
|
+
expect(fold![0]).toContain("min-height: 28px");
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("never widens the fold past the compact base block", () => {
|
|
78
|
+
// The fold must NOT appear outside the restore block (a stray
|
|
79
|
+
// top-level fold would hide versions in full-mode footers too).
|
|
80
|
+
const block = compactBlock();
|
|
81
|
+
const foldCount = (block.match(/@media \(max-width: 1023px\)/g) ?? []).length;
|
|
82
|
+
expect(foldCount, "exactly one fold, scoped to the restore").toBe(1);
|
|
83
|
+
const before = sheet.slice(0, sheet.indexOf(".s-status-bar-tag[data-compact] {"));
|
|
84
|
+
expect(before).not.toContain("data-inline-versions");
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
|
-
<meta name="hk-error-landing" content="v1 0.55.
|
|
4
|
+
<meta name="hk-error-landing" content="v1 0.55.524 <dev>">
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
7
|
<meta name="robots" content="noindex" />
|
package/src/index.ts
CHANGED
|
@@ -364,6 +364,18 @@ export {
|
|
|
364
364
|
export { deriveSemanticPalette, CANONICAL_SEMANTIC, contrastRatio, hueDistance, rgbToOklch, oklchToRgb } from "./theme/semanticPalette";
|
|
365
365
|
export type { SemanticPalette, SemanticFills, OKLCH } from "./theme/semanticPalette";
|
|
366
366
|
|
|
367
|
+
// The globe base map (the borderless world-plate stencil the solar zone
|
|
368
|
+
// picker rasterizes onto its sphere) + the shared lat/lng → surface
|
|
369
|
+
// conversion. Hosts that build marker content on HkBoard3D (a traffic
|
|
370
|
+
// globe, a fleet map) reuse the SAME map and alignment the picker uses,
|
|
371
|
+
// instead of each shipping its own world image and projection.
|
|
372
|
+
export {
|
|
373
|
+
SOLAR_GLOBE_MAP_WIDTH,
|
|
374
|
+
SOLAR_GLOBE_MAP_HEIGHT,
|
|
375
|
+
solarGlobeMapDataUrl,
|
|
376
|
+
globePointAt,
|
|
377
|
+
} from "./theme/solarGlobeMap";
|
|
378
|
+
|
|
367
379
|
// Wallpaper logic layer (ported from shittim-chest). The pack, the brand map
|
|
368
380
|
// and the pipeline registry arrive as host registrations.
|
|
369
381
|
export {
|
|
@@ -261,6 +261,34 @@
|
|
|
261
261
|
display: none;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
+
/* Compact WITH inline versions (module-page footers that share the
|
|
265
|
+
band with a centered switcher but are wide enough to afford the
|
|
266
|
+
rows): the dot keeps its touch slop, the version grid comes back.
|
|
267
|
+
The fold below undoes it again where the switcher's width wins. */
|
|
268
|
+
&[data-inline-versions] {
|
|
269
|
+
gap: 10px;
|
|
270
|
+
padding: 3px 8px;
|
|
271
|
+
min-height: 24px;
|
|
272
|
+
|
|
273
|
+
.s-status-bar-tag-value {
|
|
274
|
+
display: inline-grid;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* Below 1024px the centered module switcher wins the band's width:
|
|
278
|
+
the compact dot left ~177px free at an 820px viewport — less than
|
|
279
|
+
the two-row version block needs — so the rows fold back into the
|
|
280
|
+
popover and the pill returns to the bare-dot narrow contract. */
|
|
281
|
+
@media (max-width: 1023px) {
|
|
282
|
+
gap: 0;
|
|
283
|
+
padding: 8px;
|
|
284
|
+
min-height: 28px;
|
|
285
|
+
|
|
286
|
+
.s-status-bar-tag-value {
|
|
287
|
+
display: none;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
264
292
|
/* Invisible touch slop around the pill: the visible light is
|
|
265
293
|
intentionally tiny, but its tap target must satisfy the same
|
|
266
294
|
thumb-reach standard as the mobile sheet/confirm controls (the
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
textureLngToAzimuthDeg,
|
|
11
11
|
wedgePhiStartDeg,
|
|
12
12
|
} from "./solarTimeZones";
|
|
13
|
+
import { globePointAt } from "./solarGlobeMap";
|
|
13
14
|
|
|
14
15
|
const DEG = Math.PI / 180;
|
|
15
16
|
|
|
@@ -85,4 +86,45 @@ describe("three sphere texture alignment (measured, installed three)", () => {
|
|
|
85
86
|
expect(normDiff(az, textureLngToAzimuthDeg(center))).toBeLessThan(0.001);
|
|
86
87
|
}
|
|
87
88
|
});
|
|
89
|
+
|
|
90
|
+
it("aims globePointAt at the geometry vertex that carries the same texture coordinate", () => {
|
|
91
|
+
// globePointAt is the shared conversion page markers use to pin chips
|
|
92
|
+
// onto the base-map sphere; measured here against real geometry so the
|
|
93
|
+
// conversion can never drift from the picker's wedges (the defect
|
|
94
|
+
// class is "the marker hovers over the wrong coast").
|
|
95
|
+
const geo = new THREE.SphereGeometry(1, 96, 48);
|
|
96
|
+
const pos = geo.attributes.position;
|
|
97
|
+
const uv = geo.attributes.uv;
|
|
98
|
+
const samples: [number, number][] = [
|
|
99
|
+
[0, 0],
|
|
100
|
+
[18, 73],
|
|
101
|
+
[-34.9, -56.2],
|
|
102
|
+
[52.4, 4.9],
|
|
103
|
+
[-27.5, 153],
|
|
104
|
+
[60, -97],
|
|
105
|
+
];
|
|
106
|
+
for (const [lat, lng] of samples) {
|
|
107
|
+
const want = globePointAt(lat, lng, 1);
|
|
108
|
+
// three's sphere UVs: u = (lng + 180) / 360 (uv.x = 0.5 at azimuth
|
|
109
|
+
// +90, the alignment above) and v = (lat + 90) / 180 — uv.y runs
|
|
110
|
+
// SOUTH → NORTH (v = 1 at the north pole, the top of the texture
|
|
111
|
+
// image), the opposite of the raster's pixel-y direction.
|
|
112
|
+
const u = (lng + 180) / 360;
|
|
113
|
+
const v = (lat + 90) / 180;
|
|
114
|
+
let best: { d2: number; p: THREE.Vector3 } | null = null;
|
|
115
|
+
for (let i = 0; i < uv.count; i++) {
|
|
116
|
+
const du = Math.abs(uv.getX(i) - u);
|
|
117
|
+
const dv = Math.abs(uv.getY(i) - v);
|
|
118
|
+
const d2 = du * du + dv * dv;
|
|
119
|
+
if (!best || d2 < best.d2) {
|
|
120
|
+
best = { d2, p: new THREE.Vector3(pos.getX(i), pos.getY(i), pos.getZ(i)) };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
expect(best).not.toBeNull();
|
|
124
|
+
const got = new THREE.Vector3(...want);
|
|
125
|
+
// The nearest-uv vertex sits within the 96×48 lattice (≤ 1 cell away).
|
|
126
|
+
expect(got.distanceTo(best!.p)).toBeLessThan(0.09);
|
|
127
|
+
}
|
|
128
|
+
geo.dispose();
|
|
129
|
+
});
|
|
88
130
|
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The globe base map is public API (the HkAddTile barrel-guard shape,
|
|
3
|
+
* closing the same #1222 defect class: the component's own tests reach
|
|
4
|
+
* the module directly, so deleting the export lines from index.ts kept
|
|
5
|
+
* the ENTIRE suite green while only an external consumer would notice —
|
|
6
|
+
* PR #1674's mutation M4 did exactly that and nothing went red).
|
|
7
|
+
*
|
|
8
|
+
* A host building marker content on HkBoard3D (ayane's traffic globe is
|
|
9
|
+
* the first) must reuse THE shared map and THE shared lat/lng
|
|
10
|
+
* conversion, not ship its own world image or its own projection — so
|
|
11
|
+
* the four names are load-bearing API surface and this file fails if
|
|
12
|
+
* any of them leaves the barrel.
|
|
13
|
+
*
|
|
14
|
+
* This file deliberately does NOT mock "@celestia-island/hikari": the
|
|
15
|
+
* package's self-reference resolves to the very same src/index.ts
|
|
16
|
+
* module as "../index".
|
|
17
|
+
*/
|
|
18
|
+
import { describe, expect, it } from "vitest";
|
|
19
|
+
|
|
20
|
+
import * as barrel from "../index";
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
SOLAR_GLOBE_MAP_HEIGHT,
|
|
24
|
+
SOLAR_GLOBE_MAP_WIDTH,
|
|
25
|
+
globePointAt,
|
|
26
|
+
solarGlobeMapDataUrl,
|
|
27
|
+
} from "./solarGlobeMap";
|
|
28
|
+
|
|
29
|
+
describe("the globe base-map barrel contract", () => {
|
|
30
|
+
it("hands out the identical conversion and map sources", () => {
|
|
31
|
+
expect(barrel.globePointAt, "globePointAt must be re-exported").toBe(globePointAt);
|
|
32
|
+
expect(barrel.solarGlobeMapDataUrl, "solarGlobeMapDataUrl must be re-exported").toBe(
|
|
33
|
+
solarGlobeMapDataUrl,
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("hands out the raster constants the map rasterizes into", () => {
|
|
38
|
+
expect(barrel.SOLAR_GLOBE_MAP_WIDTH).toBe(SOLAR_GLOBE_MAP_WIDTH);
|
|
39
|
+
expect(barrel.SOLAR_GLOBE_MAP_HEIGHT).toBe(SOLAR_GLOBE_MAP_HEIGHT);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("keeps the conversion's behavior through the barrel (azimuth pinned)", () => {
|
|
43
|
+
// Not just identity — the export must BE the function, and the
|
|
44
|
+
// function must still face longitude 0 at azimuth +90°.
|
|
45
|
+
const [x, , z] = barrel.globePointAt(0, 0, 1);
|
|
46
|
+
const az = (Math.atan2(x, z) * 180) / Math.PI;
|
|
47
|
+
expect(((az % 360) + 360) % 360).toBeCloseTo(90, 6);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
SOLAR_GLOBE_MAP_HEIGHT,
|
|
6
6
|
SOLAR_GLOBE_MAP_WIDTH,
|
|
7
7
|
buildSolarGlobeMapSvg,
|
|
8
|
+
globePointAt,
|
|
8
9
|
projectToEquirectangular,
|
|
9
10
|
solarGlobeMapDataUrl,
|
|
10
11
|
} from "./solarGlobeMap";
|
|
@@ -18,6 +19,36 @@ describe("projectToEquirectangular", () => {
|
|
|
18
19
|
});
|
|
19
20
|
});
|
|
20
21
|
|
|
22
|
+
describe("globePointAt", () => {
|
|
23
|
+
const DEG = Math.PI / 180;
|
|
24
|
+
|
|
25
|
+
it("puts longitude 0 at azimuth +90 (the texture's central meridian)", () => {
|
|
26
|
+
const [x, , z] = globePointAt(0, 0, 1);
|
|
27
|
+
expect((Math.atan2(x, z) / DEG + 360) % 360).toBeCloseTo(90, 6);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("keeps latitude on the sphere's Y axis", () => {
|
|
31
|
+
const [, yEq] = globePointAt(0, 0, 1);
|
|
32
|
+
const [, yN] = globePointAt(45, 0, 1);
|
|
33
|
+
const [, yS] = globePointAt(-90, 123, 2);
|
|
34
|
+
expect(yEq).toBeCloseTo(0, 9);
|
|
35
|
+
expect(yN).toBeCloseTo(Math.SQRT1_2, 6);
|
|
36
|
+
expect(yS).toBeCloseTo(-2, 9);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("honors the radius (markers ride the given sphere)", () => {
|
|
40
|
+
const [x, y, z] = globePointAt(18, 73, 1.004);
|
|
41
|
+
expect(Math.hypot(x, y, z)).toBeCloseTo(1.004, 9);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("clamps latitude to the poles instead of leaving the sphere", () => {
|
|
45
|
+
const [, yN] = globePointAt(120, 0, 1);
|
|
46
|
+
const [, yS] = globePointAt(-120, 73, 1);
|
|
47
|
+
expect(yN).toBeCloseTo(1, 9);
|
|
48
|
+
expect(yS).toBeCloseTo(-1, 9);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
21
52
|
describe("buildSolarGlobeMapSvg", () => {
|
|
22
53
|
const svg = buildSolarGlobeMapSvg();
|
|
23
54
|
|
|
@@ -191,3 +191,30 @@ export const SOLAR_GLOBE_MAP_SVG: string = buildSolarGlobeMapSvg();
|
|
|
191
191
|
export function solarGlobeMapDataUrl(): string {
|
|
192
192
|
return `data:image/svg+xml,${encodeURIComponent(SOLAR_GLOBE_MAP_SVG)}`;
|
|
193
193
|
}
|
|
194
|
+
|
|
195
|
+
/** Surface position [x, y, z] of a geographic point on the base-map
|
|
196
|
+
* sphere (hikari's own globe renderer and any board page that pins
|
|
197
|
+
* markers to the map). Pure math — no three import, so callers hand
|
|
198
|
+
* the tuple to `new THREE.Vector3(...)` themselves. (No relation to
|
|
199
|
+
* the components crate's `globe_point_at` — that one projects a
|
|
200
|
+
* lat/lng onto the picker's 2-D orthographic SCREEN disc; this one is
|
|
201
|
+
* the sphere's 3-D surface coordinate.)
|
|
202
|
+
*
|
|
203
|
+
* The convention is THE globe's texture alignment (solarTimeZones.ts,
|
|
204
|
+
* measured against the installed three by solarGlobeAlignment.test.ts):
|
|
205
|
+
* an equirectangular texture puts longitude L at sphere azimuth
|
|
206
|
+
* atan2(x, z) = L + 90°, and latitude runs from the sphere's own +Y.
|
|
207
|
+
* This helper is the single place that converts, so a page marker and
|
|
208
|
+
* the picker's wedges can never disagree about where a coordinate is.
|
|
209
|
+
*
|
|
210
|
+
* @param latDeg geographic latitude, degrees, north positive.
|
|
211
|
+
* @param lngDeg geographic longitude, degrees, east positive.
|
|
212
|
+
* @param radius sphere radius (markers ride `radius` exactly; lift a
|
|
213
|
+
* chip by scaling the radius up a hair, the way the picker's wedges
|
|
214
|
+
* sit above the base sphere). */
|
|
215
|
+
export function globePointAt(latDeg: number, lngDeg: number, radius: number): [number, number, number] {
|
|
216
|
+
const azimuth = ((lngDeg + 90) * Math.PI) / 180;
|
|
217
|
+
const lat = (Math.max(-90, Math.min(90, latDeg)) * Math.PI) / 180;
|
|
218
|
+
const cos = Math.cos(lat);
|
|
219
|
+
return [radius * cos * Math.sin(azimuth), radius * Math.sin(lat), radius * cos * Math.cos(azimuth)];
|
|
220
|
+
}
|