@celestia-island/hikari 0.55.72 → 0.55.74
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/package.json
CHANGED
|
@@ -529,6 +529,24 @@ export function useSizeMorph(
|
|
|
529
529
|
dir === "reveal"
|
|
530
530
|
? `inset(0px 0 0 0 round ${radii})`
|
|
531
531
|
: `inset(${insetPx}px 0 0 0 round ${radii})`;
|
|
532
|
+
// Reduced motion: the stylesheet collapses the clip transition to
|
|
533
|
+
// `none` — `transitionend` will never fire, and without this check the
|
|
534
|
+
// watchdog holds the clip for `durationMs + 350` ms while the page
|
|
535
|
+
// behind shows through it (round-24 phone report under
|
|
536
|
+
// `prefers-reduced-motion: reduce`: the sheet's top 254 px showed the
|
|
537
|
+
// page behind for 514 ms). Land now: the clip end state is already
|
|
538
|
+
// painted, the riders carry whatever motion survives, and the landing
|
|
539
|
+
// is the same `stopReveal()` that transitionend would have triggered.
|
|
540
|
+
let reduced = false;
|
|
541
|
+
try {
|
|
542
|
+
reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
543
|
+
} catch {
|
|
544
|
+
// matchMedia unavailable (SSR) — the sweep path is unreachable anyway.
|
|
545
|
+
}
|
|
546
|
+
if (reduced) {
|
|
547
|
+
stopReveal();
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
532
550
|
// The riders flip WITH the clip, in the same task, under a mirrored
|
|
533
551
|
// transform transition — same duration, same easing, same start
|
|
534
552
|
// moment, so the ride tracks the edge sample-for-sample. Their own
|
|
@@ -73,12 +73,40 @@ describe("pre-paint theme loader mirrors the stock preset table", () => {
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
it("keeps the stored-id default literal a declared, known id", () => {
|
|
76
|
-
|
|
76
|
+
// The chain is formatted across lines, so allow any whitespace between
|
|
77
|
+
// the operator and the literal.
|
|
78
|
+
const match = /__celestiaDefaultTheme\s*\|\|\s*"([A-Za-z0-9_-]+)"/.exec(source);
|
|
77
79
|
expect(match, "the stored-id chain ends in a literal id").toBeTruthy();
|
|
78
80
|
expect(declaredIds()).toContain(match![1]);
|
|
79
81
|
expect(Object.keys(themePresets)).toContain(match![1]);
|
|
80
82
|
});
|
|
81
83
|
|
|
84
|
+
it("consults the hikari engine keys ahead of the page default", () => {
|
|
85
|
+
// The running app persists its selection under these exact keys
|
|
86
|
+
// (useTheme.ts). Without them the loading screen repaints the default
|
|
87
|
+
// brand while the app restores another theme — the pre-paint and app
|
|
88
|
+
// halves would disagree on every non-default boot. The legacy per-app
|
|
89
|
+
// prefixed keys stay AHEAD of the engine keys for back-compat.
|
|
90
|
+
expect(source).toContain('localStorage.getItem("hikari-theme")');
|
|
91
|
+
expect(source).toContain('localStorage.getItem("hikari-theme-mode")');
|
|
92
|
+
// Order is asserted inside the tid chain itself — `window.__celestiaDefaultTheme`
|
|
93
|
+
// also appears earlier (the page-themes merge block), so a whole-file search
|
|
94
|
+
// would measure the wrong occurrence.
|
|
95
|
+
const chainStart = source.indexOf("var tid =");
|
|
96
|
+
const chainEnd = source.indexOf("var theme =", chainStart);
|
|
97
|
+
expect(chainStart, "the stored-id chain is still there").toBeGreaterThan(-1);
|
|
98
|
+
expect(chainEnd).toBeGreaterThan(chainStart);
|
|
99
|
+
const chain = source.slice(chainStart, chainEnd);
|
|
100
|
+
const prefixAt = chain.indexOf('storagePrefix() + "theme"');
|
|
101
|
+
const engineAt = chain.indexOf('localStorage.getItem("hikari-theme")');
|
|
102
|
+
const pageDefaultAt = chain.indexOf("window.__celestiaDefaultTheme");
|
|
103
|
+
expect(prefixAt, "the prefixed theme key is still read").toBeGreaterThan(-1);
|
|
104
|
+
expect(engineAt, "the engine theme key is read").toBeGreaterThan(-1);
|
|
105
|
+
expect(pageDefaultAt, "the page-declared default is still read").toBeGreaterThan(-1);
|
|
106
|
+
expect(engineAt, "prefixed key stays ahead of the engine key").toBeGreaterThan(prefixAt);
|
|
107
|
+
expect(engineAt, "engine key stays ahead of the page-declared default").toBeLessThan(pageDefaultAt);
|
|
108
|
+
});
|
|
109
|
+
|
|
82
110
|
it.each(["dark", "light"] as const)(
|
|
83
111
|
"mirrors every %s scheme's primary/bg/surface",
|
|
84
112
|
(mode) => {
|