Skip to content

armgit / Piik

Public Imported from GitHub
0

Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。

feat(ui): polish living-room presentation and recovery (#328)

AAA2c93ab13435c
diff --git a/public/favicon.svg b/public/favicon.svg
index 8f1e994b..08bb32de 100644
--- a/public/favicon.svg
+++ b/public/favicon.svg
@@ -1,5 +1,7 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
- <rect width="32" height="32" rx="6" fill="#14271b"/>
- <rect x="5" y="6" width="22" height="15" rx="2.5" fill="none" stroke="#45d483" stroke-width="2"/>
- <path d="M16 19V12m0 0-3 3m3-3 3 3M11 26h10m-5-5v5" fill="none" stroke="#f1f3f1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">
+ <style>svg { color: #182535; } @media (prefers-color-scheme: dark) { svg { color: #dfe8f2; } }</style>
+ <path d="m11 4 5 4 5-4"/>
+ <rect x="4" y="8" width="24" height="18" rx="4"/>
+ <circle cx="11.5" cy="16.5" r="1.25" fill="currentColor" stroke="none"/>
+ <path d="M19 17c1.5-1.8 3.2-1.8 4.7 0M10 29l2-3m10 3-2-3"/>
</svg>
diff --git a/src/client/App.tsx b/src/client/App.tsx
index 8d3aff3f..2d6b18c9 100644
--- a/src/client/App.tsx
+++ b/src/client/App.tsx
@@ -10,6 +10,7 @@ import { HostPage } from "./pages/HostPage";
import { JoinPage } from "./pages/JoinPage";
import { ViewerPage } from "./pages/ViewerPage";
import { AppHeader } from "./components/living/Header";
+import { BrandLoader } from "./components/living/BrandMark";
import { Btn, Pill } from "./components/living/primitives";
import { ComicTooltip } from "./components/living/ComicTooltip";
import { Glyph, type GlyphName } from "./ui/icons";
@@ -206,8 +207,12 @@ function SiteAccessGate({
<AppHeader />
<main className="lr-join">
{access.kind === "checking" ? (
- <div className="lr-loading" role="status">
- <Glyph name="loader" size={22} className="lr-spin" />
+ <div
+ className="lr-loading"
+ role="status"
+ aria-label={t("gate.checking")}
+ >
+ <BrandLoader />
{vis ? null : (
<span className="lr-tv-msg" style={{ color: "var(--ink)", textShadow: "none" }}>
{t("gate.checking")}
diff --git a/src/client/components/living/BrandMark.tsx b/src/client/components/living/BrandMark.tsx
new file mode 100644
index 00000000..4cbc718d
--- /dev/null
+++ b/src/client/components/living/BrandMark.tsx
@@ -0,0 +1,80 @@
+import { useEffect, useRef } from "react";
+import { bindSvgReplayOnPointerEnter } from "../../ui/animation";
+
+export type BrandMotion = "static" | "once" | "loop";
+
+export function BrandMark({
+ size = 32,
+ motion = "static",
+}: {
+ size?: number;
+ motion?: BrandMotion;
+}) {
+ const animated = motion !== "static";
+ const motionClass =
+ motion === "loop" ? " is-animated" : motion === "once" ? " is-once" : "";
+ const markRef = useRef<SVGSVGElement>(null);
+
+ useEffect(() => {
+ if (motion !== "once" || !markRef.current) return;
+ return bindSvgReplayOnPointerEnter(markRef.current);
+ }, [motion]);
+
+ return (
+ <svg
+ ref={markRef}
+ className={`lr-brand-mark${motionClass}`}
+ width={size}
+ height={size}
+ viewBox="0 0 32 32"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth={animated ? 2 : 2.4}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ aria-hidden="true"
+ focusable="false"
+ >
+ <g className="lr-brand-shell">
+ <rect className="lr-brand-frame" pathLength={1} x="4" y="8" width="24" height="18" rx="4" />
+ <path className="lr-brand-antenna" pathLength={1} d="m11 4 5 4 5-4" />
+ <path className="lr-brand-feet" pathLength={1} d="M10 29l2-3m10 3-2-3" />
+ </g>
+ <g className="lr-brand-face">
+ <circle
+ className="lr-brand-eye-left"
+ cx="11.5"
+ cy="16.5"
+ r="1.25"
+ fill="currentColor"
+ stroke="none"
+ />
+ <circle
+ className="lr-brand-eye-open"
+ cx="21.35"
+ cy="16.5"
+ r="1.25"
+ fill="currentColor"
+ stroke="none"
+ />
+ <path
+ className="lr-brand-eye-wink"
+ pathLength={1}
+ d="M19 17c1.5-1.8 3.2-1.8 4.7 0"
+ />
+ </g>
+ <g className="lr-brand-sparkles">
+ <path pathLength={1} d="m25 11.5 .8 1.9 1.9.8-1.9.8-.8 1.9-.8-1.9-1.9-.8 1.9-.8.8-1.9Z" />
+ <path pathLength={1} d="m25 17.2 .45 1.1 1.1.45-1.1.45-.45 1.1-.45-1.1-1.1-.45 1.1-.45.45-1.1Z" />
+ </g>
+ </svg>
+ );
+}
+
+export function BrandLoader() {
+ return (
+ <span className="lr-brand-loader" aria-hidden="true">
+ <BrandMark size={64} motion="loop" />
+ </span>
+ );
+}
diff --git a/src/client/components/living/Comic.tsx b/src/client/components/living/Comic.tsx
index 4fb757e8..adc11f80 100644
--- a/src/client/components/living/Comic.tsx
+++ b/src/client/components/living/Comic.tsx
@@ -722,7 +722,7 @@ ${rmBlock(
);
}
-/** 7. route-failed: 4 panels, one-shot 3.6s entrance + idle green flow. */
+/** 7. route-failed: 4 panels, direct and SFU paths both end unavailable. */
function SceneRouteFailed({ theme }: { theme: ComicTheme }) {
return (
<>
@@ -733,25 +733,26 @@ function SceneRouteFailed({ theme }: { theme: ComicTheme }) {
.vls-rf-x{transform-box:fill-box;transform-origin:center;animation:vlsRfX 3.6s ease-out both}
.vls-rf-spark{animation:vlsRfSpark 3.6s ease-out both}
.vls-rf-dot{animation:vlsRfDot 3.6s ease-in-out both}
-.vls-rf-green{stroke-dasharray:5 5;animation:vlsRfGreen 3.6s ease-out both,vlsRfFlow 1.1s linear 3.6s infinite}
+.vls-rf-fallback{stroke-dasharray:5 5;animation:vlsRfFallback 3.6s ease-out both,vlsRfFailurePulse 2.6s ease-in-out 3.6s infinite}
+.vls-rf-fallback-x{transform-box:fill-box;transform-origin:center;animation:vlsRfFallbackX 3.6s ease-out both,vlsRfFailureX 2.6s ease-in-out 3.6s infinite}
.vls-rf-slots{animation:vlsRfSlots 3.6s ease-out both}
-.vls-rf-star{transform-box:fill-box;transform-origin:center;animation:vlsRfStar 3.6s cubic-bezier(.3,1.5,.5,1) both}
.vls-rf-grey{animation:vlsRfGrey 3.6s ease-out both}
@keyframes vlsRfIn{from{opacity:0;transform:translateY(6px) scale(.9)}}
@keyframes vlsRfMarch{from{stroke-dashoffset:0}to{stroke-dashoffset:-16}}
@keyframes vlsRfX{0%,32%{opacity:0;transform:scale(1.7) rotate(8deg)}40%,100%{opacity:1;transform:scale(1) rotate(8deg)}}
@keyframes vlsRfSpark{0%,32%{opacity:0}35%{opacity:1}44%,100%{opacity:0}}
@keyframes vlsRfDot{0%,44%{transform:translate(0,0);opacity:0}46%{opacity:1}54%{transform:translate(2px,-31px)}60%{transform:translate(18px,-31px)}70%,100%{transform:translate(28px,-11px);opacity:0}}
-@keyframes vlsRfGreen{0%,72%{opacity:0}80%,100%{opacity:1}}
-@keyframes vlsRfFlow{to{stroke-dashoffset:-20}}
+@keyframes vlsRfFallback{0%,72%{opacity:0}80%,100%{opacity:.42}}
+@keyframes vlsRfFallbackX{0%,78%{opacity:0;transform:scale(1.6) rotate(8deg)}86%,100%{opacity:1;transform:scale(1) rotate(8deg)}}
+@keyframes vlsRfFailurePulse{0%,100%{opacity:.42;stroke-dashoffset:0}50%{opacity:.72;stroke-dashoffset:-8}}
+@keyframes vlsRfFailureX{0%,100%{opacity:1}50%{opacity:.58}}
@keyframes vlsRfSlots{0%,60%{opacity:0}66%,100%{opacity:1}}
-@keyframes vlsRfStar{0%,82%{opacity:0;transform:scale(0)}90%{opacity:1;transform:scale(1.25)}96%,100%{opacity:1;transform:scale(1)}}
@keyframes vlsRfGrey{0%{opacity:.9}70%{opacity:.9}82%,100%{opacity:.15}}
${rmBlock(
- ["vls-rf-panel", "vls-rf-march", "vls-rf-x", "vls-rf-spark", "vls-rf-dot", "vls-rf-green", "vls-rf-slots", "vls-rf-star", "vls-rf-grey"],
+ ["vls-rf-panel", "vls-rf-march", "vls-rf-x", "vls-rf-spark", "vls-rf-dot", "vls-rf-fallback", "vls-rf-fallback-x", "vls-rf-slots", "vls-rf-grey"],
[
- [".vls-rf-green", "stroke-dasharray:none;opacity:1"],
- [".vls-rf-slots,.vls-rf-star", "opacity:1"],
+ [".vls-rf-fallback", "stroke-dasharray:none;opacity:.42"],
+ [".vls-rf-fallback-x,.vls-rf-slots", "opacity:1;transform:none"],
[".vls-rf-spark,.vls-rf-dot", "opacity:0"],
[".vls-rf-grey", "opacity:.15"],
],
@@ -800,21 +801,27 @@ ${rmBlock(
<circle className="vls-rf-dot" cx={188} cy={47} r={2.5} fill={MINT} opacity={0} />
</g>
<g className="vls-rf-panel vls-rf-p4">
- <Frame x={244} w={72} theme={theme} accent={LIVE} />
+ <Frame x={244} w={72} theme={theme} />
<path d="M249 68 c0-12 5-17 11-17 s11 5 11 17 Z" fill={YOU} />
<circle cx={260} cy={42} r={6.5} fill={YOU} />
<circle cx={257.5} cy={41} r={1.1} fill="#101a2c" />
<circle cx={262.5} cy={41} r={1.1} fill="#101a2c" />
<rect x={287} y={36} width={18} height={13} rx={2.5} fill={TV_BODY} stroke={TV_EDGE} strokeWidth={1.5} />
- <path d="M292 39 L300 42.5 L292 46 Z" fill={MINT} />
- <circle cx={296} cy={54} r={2} fill={LIVE} />
- <rect x={272} y={10} width={16} height={12} rx={2.5} fill="#0d1526" stroke={LIVE} strokeWidth={2} />
- <path d="M275 14 h10 M275 18 h10" stroke={LIVE} strokeWidth={2} strokeLinecap="round" />
- <g className="vls-rf-green" opacity={0} stroke={LIVE} strokeWidth={2.5} fill="none">
+ <circle cx={296} cy={54} r={2} fill={DANGER} />
+ <rect x={272} y={10} width={16} height={12} rx={2.5} fill="#0d1526" stroke={LINE} strokeWidth={2} />
+ <path d="M275 14 h10 M275 18 h10" stroke={LINE} strokeWidth={2} strokeLinecap="round" />
+ <g className="vls-rf-fallback" opacity={0} stroke={LINE} strokeWidth={2.5} fill="none">
<path d="M268 47 L272 16" />
<path d="M288 16 L296 34" />
</g>
- <Star x={296} y={26} className="vls-rf-star" baseOpacity={0} />
+ <path
+ className="vls-rf-fallback-x"
+ d="M288 25 L298 35 M298 25 L288 35"
+ stroke={DANGER}
+ strokeWidth={3}
+ strokeLinecap="round"
+ fill="none"
+ />
</g>
</>
);
diff --git a/src/client/components/living/ComicTooltip.tsx b/src/client/components/living/ComicTooltip.tsx
index 5f399119..edc36d4b 100644
--- a/src/client/components/living/ComicTooltip.tsx
+++ b/src/client/components/living/ComicTooltip.tsx
@@ -188,6 +188,9 @@ export function ComicTooltip({
}}
onPointerDown={(event) => {
if (event.pointerType !== "touch") return;
+ // A suppression token belongs only to the click synthesized for the
+ // completed long-press. A later touch starts a new, actionable gesture.
+ longPressed.current = false;
cancelPress();
pressPoint.current = { x: event.clientX, y: event.clientY };
pressTimer.current = window.setTimeout(() => {
@@ -240,6 +243,7 @@ export function ComicTooltip({
onClickCapture={(event) => {
// The synthetic click after a long-press must not fire the control.
if (longPressed.current) {
+ longPressed.current = false;
event.preventDefault();
event.stopPropagation();
}
diff --git a/src/client/components/living/Couch.tsx b/src/client/components/living/Couch.tsx
index 2895f241..eaafaad2 100644
--- a/src/client/components/living/Couch.tsx
+++ b/src/client/components/living/Couch.tsx
@@ -21,7 +21,7 @@ export function PawnSvg({ color, crown }: { color: string; crown?: boolean }) {
<svg viewBox="0 0 40 48" width="40" height="48" aria-hidden="true">
{crown ? (
<path
- d="M11 12.5 L8.5 2 L14 6.5 L17 0 L20 6.5 L25.5 2 L23 12.5 Z"
+ d="M14 12.5 L11.5 2 L17 6.5 L20 0 L23 6.5 L28.5 2 L26 12.5 Z"
fill="var(--pawn-2)"
/>
) : null}
diff --git a/src/client/components/living/Header.tsx b/src/client/components/living/Header.tsx
index cf2a6b48..94b92fe8 100644
--- a/src/client/components/living/Header.tsx
+++ b/src/client/components/living/Header.tsx
@@ -1,6 +1,7 @@
// App header: brand mark, LED connection state, language-mode pill
// (中文 / EN / 纯视觉), and theme toggle.
import { VisGlyph } from "./primitives";
+import { BrandMark } from "./BrandMark";
import { ComicTooltip } from "./ComicTooltip";
import { useCopy, type Lang } from "../../ui/copy";
import { useTheme } from "../../ui/theme";
@@ -82,8 +83,13 @@ export function AppHeader({ led }: { led?: React.ReactNode }) {
const { t, vis } = useCopy();
return (
<header className="lr-top">
- <a className="lr-brand" href="/" aria-label={t("brand.home")} title={vis ? undefined : t("brand.home")}>
- <VisGlyph name="tv" size={24} />
+ <a
+ className="lr-brand"
+ href="/"
+ aria-label={t("brand.home")}
+ title={vis ? undefined : t("brand.home")}
+ >
+ <BrandMark size={34} motion="once" />
</a>
<span className="lr-top-right">
{led}
diff --git a/src/client/components/living/RouteTree.tsx b/src/client/components/living/RouteTree.tsx
index 43c991b9..e037dcae 100644
--- a/src/client/components/living/RouteTree.tsx
+++ b/src/client/components/living/RouteTree.tsx
@@ -26,6 +26,16 @@ interface TreeNode {
const ROW_BASE = 40;
const NARROW_TOPOLOGY_QUERY = "(max-width: 640px)";
+const PAWN_CENTER_X = 20;
+const HOST_SCALE = 0.85;
+const ROOT_SCALE = 0.72;
+const CHILD_SCALE = 0.52;
+const ROOT_LABEL_OFFSET_Y = 36;
+const CHILD_LABEL_OFFSET_Y = 20;
+
+function centeredPawnX(centerX: number, scale: number): number {
+ return centerX - PAWN_CENTER_X * scale;
+}
function subscribeToNarrowViewport(listener: () => void): () => void {
if (typeof window === "undefined" || !window.matchMedia) return () => {};
@@ -122,7 +132,7 @@ export const RouteTree = memo(function RouteTree({
else add(null, node);
}
- const spacing = nodes.length > 10 ? 42 : 44;
+ const spacing = nodes.length > 10 ? 58 : 60;
let row = 0;
const pos = new Map<string, { x: number; y: number }>();
function layout(node: TreeNode, depth: number): void {
@@ -171,7 +181,7 @@ export const RouteTree = memo(function RouteTree({
...pendingPos.map((point) => point.y),
];
const hostPos = {
- x: layoutConfig.hostX,
+ x: rootYs.length > 0 ? layoutConfig.hostX : layoutConfig.baseWidth / 2,
y:
rootYs.length > 0
? rootYs.reduce((sum, y) => sum + y, 0) / rootYs.length
@@ -303,13 +313,13 @@ export const RouteTree = memo(function RouteTree({
<g
className="lr-route-node is-host"
- transform={`translate(${hostPos.x - 4}, ${hostPos.y - 20}) scale(0.85)`}
+ transform={`translate(${centeredPawnX(hostPos.x, HOST_SCALE)}, ${hostPos.y - 20}) scale(${HOST_SCALE})`}
>
<PawnSvg color="var(--couch)" crown />
</g>
<text
className="lr-route-label is-host"
- x={hostPos.x + 14}
+ x={hostPos.x}
y={hostPos.y + 30}
textAnchor="middle"
>
@@ -343,11 +353,12 @@ export const RouteTree = memo(function RouteTree({
const point = pos.get(node.key)!;
const child = node.via !== null && !node.sfu;
const selected = selectedPeerId === node.key;
+ const scale = child ? CHILD_SCALE : ROOT_SCALE;
return (
<g
key={node.key}
className={`lr-route-node${node.ready ? "" : " is-recovering"}${selected ? " is-selected" : ""}`}
- transform={`translate(${point.x - 14}, ${point.y - 15}) scale(${child ? 0.52 : 0.72})`}
+ transform={`translate(${centeredPawnX(point.x, scale)}, ${point.y - 15}) scale(${scale})`}
>
<PawnSvg color={pawnColor(node.key, node.you)} />
{selected ? (
@@ -364,7 +375,7 @@ export const RouteTree = memo(function RouteTree({
<g
key={`pending-${point.viewer.peerId}`}
className={`lr-route-node is-recovering${selectedPeerId === point.viewer.peerId ? " is-selected" : ""}`}
- transform={`translate(${point.x - 14}, ${point.y - 15}) scale(0.72)`}
+ transform={`translate(${centeredPawnX(point.x, ROOT_SCALE)}, ${point.y - 15}) scale(${ROOT_SCALE})`}
>
<PawnSvg
color={pawnColor(
@@ -388,8 +399,11 @@ export const RouteTree = memo(function RouteTree({
<text
key={`label-${node.key}`}
className={`lr-route-label${selectedPeerId === node.key ? " is-selected" : ""}`}
- x={point.x + 4}
- y={point.y + (child ? 20 : 26)}
+ x={point.x}
+ y={
+ point.y +
+ (child ? CHILD_LABEL_OFFSET_Y : ROOT_LABEL_OFFSET_Y)
+ }
textAnchor="middle"
>
{compactVisibleLabel(
@@ -403,8 +417,8 @@ export const RouteTree = memo(function RouteTree({
<text
key={`label-pending-${point.viewer.peerId}`}
className={`lr-route-label is-recovering${selectedPeerId === point.viewer.peerId ? " is-selected" : ""}`}
- x={point.x + 4}
- y={point.y + 26}
+ x={point.x}
+ y={point.y + ROOT_LABEL_OFFSET_Y}
textAnchor="middle"
>
{compactVisibleLabel(
diff --git a/src/client/components/living/Stage.tsx b/src/client/components/living/Stage.tsx
index 821b11e7..1193b4a9 100644
--- a/src/client/components/living/Stage.tsx
+++ b/src/client/components/living/Stage.tsx
@@ -5,6 +5,7 @@ import type { ReactNode } from "react";
import { Glyph, type GlyphName } from "../../ui/icons";
import { useCopy, type CopyKey } from "../../ui/copy";
import { Comic, type ComicKind } from "./Comic";
+import { BrandLoader, BrandMark } from "./BrandMark";
export type ChinState = "off" | "on" | "warn" | "bad" | "busy";
@@ -41,7 +42,13 @@ export function StaticNoise() {
return <div className="lr-tv-static" aria-hidden="true" />;
}
-export function StoryBoard({ step }: { step: 0 | 1 | 2 }) {
+export function StoryBoard({
+ step,
+ showBrand = false,
+}: {
+ step: 0 | 1 | 2;
+ showBrand?: boolean;
+}) {
const { vis, t } = useCopy();
const panels: [GlyphName, CopyKey][] = [
["door", "story.room"],
@@ -49,24 +56,27 @@ export function StoryBoard({ step }: { step: 0 | 1 | 2 }) {
["tv", "story.show"],
];
return (
- <div className="lr-story" role="status" aria-label={t("host.starting")}>
- {panels.map(([icon, key], index) => (
- <span key={key} style={{ display: "contents" }}>
- {index > 0 ? (
- <span className={`lr-story-link${step > index - 1 ? " is-done" : ""}`} />
- ) : null}
- <span
- className={`lr-story-item${step > index ? " is-done" : step === index ? " is-now" : ""}`}
- >
+ <div className="lr-storyboard" role="status" aria-label={t("host.starting")}>
+ {showBrand ? <BrandMark size={40} motion="loop" /> : null}
+ <div className="lr-story" aria-hidden="true">
+ {panels.map(([icon, key], index) => (
+ <span key={key} style={{ display: "contents" }}>
+ {index > 0 ? (
+ <span className={`lr-story-link${step > index - 1 ? " is-done" : ""}`} />
+ ) : null}
<span
- className={`lr-story-panel${step > index ? " is-done" : step === index ? " is-now" : ""}`}
+ className={`lr-story-item${step > index ? " is-done" : step === index ? " is-now" : ""}`}
>
- <Glyph name={step > index ? "check" : icon} size={22} />
+ <span
+ className={`lr-story-panel${step > index ? " is-done" : step === index ? " is-now" : ""}`}
+ >
+ <Glyph name={step > index ? "check" : icon} size={22} />
+ </span>
+ {vis ? null : <span className="lr-story-cap">{t(key)}</span>}
</span>
- {vis ? null : <span className="lr-story-cap">{t(key)}</span>}
</span>
- </span>
- ))}
+ ))}
+ </div>
</div>
);
}
@@ -75,6 +85,7 @@ export function StageOverlay({
icon,
message,
dim,
+ transition,
spin,
comic,
onActivate,
@@ -82,6 +93,7 @@ export function StageOverlay({
icon: GlyphName;
message: string;
dim?: boolean;
+ transition?: boolean;
spin?: boolean;
comic?: ComicKind;
onActivate?: () => void;
@@ -90,9 +102,13 @@ export function StageOverlay({
const content = (
<>
{vis && comic ? <Comic kind={comic} theme="stage" /> : null}
- <span className={`lr-tv-big${spin ? " lr-spin" : ""}${onActivate ? " is-action is-ripple" : ""}`}>
- <Glyph name={icon} size={30} draw="stage-overlay" />
- </span>
+ {transition ? (
+ <BrandLoader />
+ ) : (
+ <span className={`lr-tv-big${spin ? " lr-spin" : ""}${onActivate ? " is-action is-ripple" : ""}`}>
+ <Glyph name={icon} size={30} draw="stage-overlay" />
+ </span>
+ )}
{vis ? null : <span className="lr-tv-msg">{message}</span>}
</>
);
diff --git a/src/client/pages/HostPage.tsx b/src/client/pages/HostPage.tsx
index 2874b5ea..dc24bb1e 100644
--- a/src/client/pages/HostPage.tsx
+++ b/src/client/pages/HostPage.tsx
@@ -857,8 +857,8 @@ export function HostPage({ onAuthorizationRequired }: HostPageProps = {}) {
return;
}
const wasSharing = activeGenerationRef.current !== null;
+ const profile = creationProfileRef.current;
try {
- const profile = creationProfileRef.current;
const response = await replaceOwnedRoom(
activeRoom.roomId,
activeRoom.hostToken,
@@ -884,6 +884,43 @@ export function HostPage({ onAuthorizationRequired }: HostPageProps = {}) {
setPhase(wasSharing ? "ended" : "idle");
} catch (error) {
if (error instanceof ApiError && error.status === 404) {
+ if (!wasSharing) {
+ // A lease can disappear while the host is idle (for example after a
+ // server restart). Creation is the canonical recovery path; do not
+ // clear the visible room before it succeeds.
+ try {
+ const response = await createRoom(
+ profile.codeEntryPolicy,
+ profile.roomPassword,
+ readPreferredRoomId(),
+ );
+ const replacement = hostRoomFromCreated(response);
+ if (
+ roomMutationRef.current !== mutation ||
+ !isCurrentRoomAuthority(activeRoom)
+ ) {
+ closeAbandonedRoom(replacement);
+ return;
+ }
+ if (replacement.roomId !== activeRoom.roomId) {
+ replaceViewerInvite(activeRoom.roomId, null);
+ }
+ writeHostRoom(replacement);
+ writePreferredRoom(replacement.roomId);
+ roomRef.current = replacement;
+ setRoom(replacement);
+ setCopied(false);
+ setViewerPasswordEnabled(profile.roomPassword !== null);
+ setViewerPasswordDraft(profile.roomPassword ?? "");
+ setViewerPasswordVisible(false);
+ setNoticeKey("host.roomReplaced");
+ setPhase("idle");
+ return;
+ } catch (replacementError) {
+ setNoticeError(replacementError, "room");
+ return;
+ }
+ }
if (forgetRoom(activeRoom)) {
endSharing({ key: "host.roomInvalid" }, false);
}
@@ -2711,7 +2748,7 @@ export function HostPage({ onAuthorizationRequired }: HostPageProps = {}) {
role="status"
aria-label={t("host.starting")}
>
- <StoryBoard step={1} />
+ <StoryBoard step={1} showBrand={stream !== null} />
</div>
</>
) : stream && localPreviewPaused ? (
@@ -2798,7 +2835,7 @@ export function HostPage({ onAuthorizationRequired }: HostPageProps = {}) {
commitDisplayName();
}}
>
- <span className="lr-input" style={{ minWidth: 150 }}>
+ <span className="lr-input lr-name-editor">
<input
id="host-display-name"
type="text"
diff --git a/src/client/pages/ViewerPage.tsx b/src/client/pages/ViewerPage.tsx
index 699a72a5..fceb4594 100644
--- a/src/client/pages/ViewerPage.tsx
+++ b/src/client/pages/ViewerPage.tsx
@@ -36,6 +36,7 @@ import {
StageTv,
type ChinState,
} from "../components/living/Stage";
+import { BrandLoader } from "../components/living/BrandMark";
import {
Btn,
FieldCap,
@@ -182,8 +183,9 @@ function stageOverlayComic(
case "recovering":
return "recovering";
case "route-failed":
- case "server-error":
return "route-failed";
+ case "server-error":
+ return "warning";
case "playback-failed":
return "playback-failed";
case "host-offline":
@@ -2064,11 +2066,11 @@ export function ViewerPage({ roomId, viewerGrant }: ViewerPageProps) {
{accessState === "checking" ? (
<div className="lr-join-panel">
<span
- className="lr-tv-big lr-spin"
+ className="lr-viewer-entry-brand"
role="status"
aria-label={t(presentation.messageKey)}
>
- <Glyph name="loader" size={30} />
+ <BrandLoader />
</span>
{vis ? null : (
<span className="lr-tv-msg">{t(presentation.messageKey)}</span>
@@ -2280,7 +2282,7 @@ export function ViewerPage({ roomId, viewerGrant }: ViewerPageProps) {
<StageOverlay
dim
icon={overlayGlyph.icon}
- spin={overlayGlyph.spin}
+ transition={overlayGlyph.spin}
comic={overlayComic}
message={t(presentation.messageKey)}
/>
@@ -2304,9 +2306,9 @@ export function ViewerPage({ roomId, viewerGrant }: ViewerPageProps) {
<StageOverlay
dim
icon={overlayGlyph.icon}
- spin={overlayGlyph.spin}
comic={overlayComic}
message={t(presentation.messageKey)}
+ spin={overlayGlyph.spin}
/>
)}
</StageTv>
@@ -2377,7 +2379,7 @@ export function ViewerPage({ roomId, viewerGrant }: ViewerPageProps) {
>
{editingDisplayName ? (
<>
- <span className="lr-input" style={{ minWidth: 150 }}>
+ <span className="lr-input lr-name-editor">
<input
id="viewer-display-name"
type="text"
@@ -2483,10 +2485,10 @@ export function ViewerPage({ roomId, viewerGrant }: ViewerPageProps) {
) : null}
{routePresentation.evidence === peerSnapshot &&
peerSnapshot?.error ? (
- <Pill icon="alert" tone="bad" label={t("viewer.error.p2p")} comic="route-failed" />
+ <Pill icon="alert" tone="bad" label={t("viewer.error.p2p")} comic="warning" />
) : null}
{relaySnapshot?.error ? (
- <Pill icon="alert" tone="bad" label={t("viewer.error.relay")} comic="route-failed" />
+ <Pill icon="alert" tone="bad" label={t("viewer.error.relay")} comic="warning" />
) : null}
{qualityLimitation ? (
<Pill icon="alert" label={qualityLimitation} comic="warning" />
diff --git a/src/client/styles.css b/src/client/styles.css
index 84fab791..b3eefbe5 100644
--- a/src/client/styles.css
+++ b/src/client/styles.css
@@ -109,15 +109,133 @@ ul { margin: 0; padding: 0; list-style: none; }
display: grid;
width: 44px; height: 44px;
place-items: center;
- border: 2.5px solid var(--ink);
- border-radius: 14px;
- background: var(--paper);
+ border: 0;
+ border-radius: 12px;
+ background: transparent;
color: var(--ink);
transition: background 160ms ease, color 160ms ease, transform 160ms var(--spring);
}
-.lr-brand:hover { background: var(--ink); color: var(--paper); }
+.lr-brand:hover { background: var(--wall-2); }
.lr-brand:active { transform: scale(.92); }
+.lr-brand-mark {
+ display: block;
+ flex: 0 0 auto;
+ overflow: visible;
+}
+.lr-brand-loader {
+ display: grid;
+ width: 88px;
+ height: 88px;
+ place-items: center;
+ color: currentColor;
+}
+.lr-brand-eye-open,
+.lr-brand-sparkles { opacity: 0; }
+.lr-brand-sparkles > * { opacity: 0; }
+
+.lr-brand-mark.is-animated,
+.lr-brand-mark.is-once {
+ transform-box: fill-box;
+ transform-origin: center;
+}
+.lr-brand-mark.is-animated {
+ animation: lr-brand-bob 3.6s cubic-bezier(.3, .8, .35, 1) infinite;
+}
+.lr-brand-mark.is-once {
+ animation: lr-brand-bob 1.6s cubic-bezier(.3, .8, .35, 1) 1 both;
+}
+.lr-brand-mark:is(.is-animated, .is-once) .lr-brand-shell > * {
+ stroke-dasharray: 1;
+ stroke-dashoffset: 1;
+ animation: lr-brand-draw cubic-bezier(.45, .05, .35, 1) forwards;
+}
+.lr-brand-mark:is(.is-animated, .is-once) .lr-brand-frame { animation-duration: 380ms; }
+.lr-brand-mark:is(.is-animated, .is-once) .lr-brand-antenna {
+ animation-duration: 260ms;
+ animation-delay: 260ms;
+}
+.lr-brand-mark:is(.is-animated, .is-once) .lr-brand-feet {
+ animation-duration: 220ms;
+ animation-delay: 360ms;
+}
+.lr-brand-mark:is(.is-animated, .is-once) .lr-brand-face {
+ transform-box: fill-box;
+ transform-origin: center;
+ animation: lr-brand-face-in 180ms ease-out 500ms both;
+}
+.lr-brand-mark.is-animated .lr-brand-eye-open {
+ transform-box: fill-box;
+ transform-origin: center;
+ animation: lr-brand-eye-open 3.6s ease-in-out infinite;
+}
+.lr-brand-mark.is-animated .lr-brand-eye-wink {
+ animation: lr-brand-eye-wink 3.6s ease-in-out infinite;
+}
+.lr-brand-mark.is-animated .lr-brand-sparkles { opacity: 1; }
+.lr-brand-mark.is-animated .lr-brand-sparkles > * {
+ transform-box: fill-box;
+ transform-origin: center;
+ animation: lr-brand-sparkle 3.6s cubic-bezier(.3, 1.45, .45, 1) infinite both;
+}
+.lr-brand-mark.is-animated .lr-brand-sparkles > :nth-child(2) {
+ animation-name: lr-brand-sparkle-alt;
+ animation-delay: 90ms;
+}
+.lr-brand-mark.is-once .lr-brand-eye-open {
+ transform-box: fill-box;
+ transform-origin: center;
+ animation: lr-brand-eye-open 1.6s ease-in-out 1 both;
+}
+.lr-brand-mark.is-once .lr-brand-eye-wink {
+ animation: lr-brand-eye-wink 1.6s ease-in-out 1 both;
+}
+.lr-brand-mark.is-once .lr-brand-sparkles { opacity: 1; }
+.lr-brand-mark.is-once .lr-brand-sparkles > * {
+ transform-box: fill-box;
+ transform-origin: center;
+ animation: lr-brand-sparkle 1.6s cubic-bezier(.3, 1.45, .45, 1) 1 both;
+}
+.lr-brand-mark.is-once .lr-brand-sparkles > :nth-child(2) {
+ animation-name: lr-brand-sparkle-alt;
+ animation-delay: 45ms;
+}
+@keyframes lr-brand-draw { to { stroke-dashoffset: 0; } }
+@keyframes lr-brand-bob {
+ 0%, 20%, 42%, 100% { transform: translateY(0) rotate(0); }
+ 26% { transform: translateY(-.8px) rotate(-2deg); }
+ 32% { transform: translateY(.8px) rotate(1.5deg); }
+}
+@keyframes lr-brand-face-in {
+ from { opacity: 0; transform: scale(.35); }
+ to { opacity: 1; transform: scale(1); }
+}
+@keyframes lr-brand-eye-open {
+ 0%, 24%, 34%, 100% { opacity: 0; transform: scaleY(.15); }
+ 27%, 30% { opacity: 1; transform: scale(1); }
+}
+@keyframes lr-brand-eye-wink {
+ 0%, 24%, 35%, 100% { opacity: 1; stroke-dasharray: 1; stroke-dashoffset: 0; }
+ 27%, 30% { opacity: 0; stroke-dasharray: 1; stroke-dashoffset: 1; }
+ 32% { opacity: 1; stroke-dasharray: 1; stroke-dashoffset: 1; }
+}
+@keyframes lr-brand-sparkle {
+ 0%, 30% { opacity: 0; transform: translate(-1px, 2px) scale(.12) rotate(-20deg); }
+ 36% { opacity: 1; transform: translate(0, 0) scale(.85) rotate(0); }
+ 52% { opacity: .9; transform: translate(5px, -5px) scale(1) rotate(18deg); }
+ 70% { opacity: .35; transform: translate(9px, -9px) scale(.55) rotate(34deg); }
+ 78%, 100% { opacity: 0; transform: translate(12px, -12px) scale(.2) rotate(48deg); }
+}
+@keyframes lr-brand-sparkle-alt {
+ 0%, 30% { opacity: 0; transform: translate(-1px, -1px) scale(.12) rotate(18deg); }
+ 36% { opacity: .95; transform: translate(0, 0) scale(.75) rotate(0); }
+ 52% { opacity: .8; transform: translate(4px, 4px) scale(.95) rotate(-16deg); }
+ 70% { opacity: .3; transform: translate(8px, 8px) scale(.5) rotate(-30deg); }
+ 78%, 100% { opacity: 0; transform: translate(11px, 11px) scale(.18) rotate(-42deg); }
+}
+.lr-brand-sparkles { stroke: #d08a22; }
+html[data-theme="dark"] .lr-brand-sparkles { stroke: #f4c14d; }
+
.lr-top-right { display: inline-flex; gap: 10px; align-items: center; }
/* LED state strip */
@@ -323,6 +441,7 @@ ul { margin: 0; padding: 0; list-style: none; }
}
/* storyboard: connection beats */
+.lr-storyboard { display: grid; justify-items: center; gap: 10px; }
.lr-story { display: flex; align-items: center; justify-content: center; gap: 10px; }
.lr-story-item { display: grid; justify-items: center; gap: 6px; }
.lr-story-panel {
@@ -483,14 +602,16 @@ ul { margin: 0; padding: 0; list-style: none; }
.lr-row-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.lr-group-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.lr-viewer-summary-row {
- display: grid;
- grid-template-columns: auto minmax(140px, 220px) minmax(220px, 1fr);
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ column-gap: 12px;
+ row-gap: 10px;
}
-.lr-viewer-room-slot { grid-column: 1; grid-row: 1; }
+.lr-viewer-room-slot { flex: 0 0 auto; }
.lr-viewer-host-slot {
- grid-column: 2;
- grid-row: 1;
- max-width: 220px;
+ flex: 0 1 auto;
+ max-width: 180px;
flex-wrap: nowrap;
font-size: 13px;
}
@@ -498,21 +619,24 @@ ul { margin: 0; padding: 0; list-style: none; }
html[data-theme="dark"] .lr-viewer-host-slot svg { color: #9bb0c5; }
.lr-viewer-host-slot b {
min-width: 0;
- overflow-wrap: anywhere;
+ overflow: hidden;
line-height: 1.25;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
-.lr-viewer-state-slot { grid-column: 3; grid-row: 1; }
+.lr-viewer-state-slot { flex: 1 1 120px; }
+.lr-viewer-state-slot:empty { display: none; }
.lr-viewer-self-slot {
- display: grid;
- grid-column: 1 / 3;
- grid-row: 2;
- grid-template-columns: minmax(0, 1fr) auto auto;
+ display: flex;
+ flex: 0 1 auto;
+ align-items: center;
+ gap: 8px;
}
.lr-viewer-actions-slot {
- grid-column: 3;
- grid-row: 2;
- justify-self: end;
+ flex: 0 0 auto;
+ margin-left: auto;
}
+.lr-viewer-self-slot .lr-name-tag { flex: 0 1 auto; width: auto; }
.lr-spacer { flex: 1; }
.lr-divider { width: 2.5px; align-self: stretch; border-radius: 2px; background: var(--wall-2); }
.lr-row.is-sub .lr-divider { background: #c3d4cb; }
@@ -746,6 +870,11 @@ html[data-theme="dark"] .lr-invite-url { background: #1a2634; border-color: #334
.lr-input:focus-within { border-color: var(--action); outline: 3px solid var(--action); outline-offset: 2px; }
.lr-input input { min-width: 0; flex: 1; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; }
.lr-input input[type="password"]:not(:placeholder-shown) { letter-spacing: .25em; }
+.lr-input.lr-name-editor {
+ width: clamp(140px, 18vw, 200px);
+ height: 40px;
+ border-radius: 999px;
+}
.lr-name-tag {
display: inline-flex;
@@ -787,13 +916,23 @@ html[data-theme="dark"] .lr-pill.is-good { background: #14291d; }
.lr-meter { display: flex; flex-wrap: wrap; gap: 10px; }
.lr-meter-cell {
display: inline-flex;
+ min-width: 0;
+ max-width: 100%;
align-items: center;
gap: 8px;
padding: 9px 12px;
border-radius: 12px;
background: var(--wall-2);
}
-.lr-meter-cell b { font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
+.lr-meter-cell b {
+ min-width: 0;
+ max-width: 100%;
+ overflow-wrap: anywhere;
+ font-family: var(--mono);
+ font-size: 13px;
+ font-weight: 700;
+ letter-spacing: .02em;
+}
.lr-meter-cell svg { color: #53676a; }
html[data-theme="dark"] .lr-meter-cell svg { color: #7d92a8; }
.lr-meter-text { display: grid; line-height: 1.18; }
@@ -913,7 +1052,14 @@ html[data-theme="dark"] .lr-door-glyph { color: #7d92a8; }
place-items: center;
padding: 24px 16px 72px;
}
-.lr-join-panel { display: grid; justify-items: center; gap: 20px; }
+.lr-join-panel {
+ display: grid;
+ width: 100%;
+ min-width: 0;
+ max-width: 100%;
+ justify-items: center;
+ gap: 20px;
+}
.lr-join-door { color: var(--ink); }
.lr-join-door.is-shake { animation: lr-shake .4s ease; }
@keyframes lr-shake {
@@ -970,11 +1116,42 @@ html[data-theme="dark"] .lr-door-glyph { color: #7d92a8; }
.lr-join-go:disabled { background: var(--wall-2); border-color: transparent; color: #9db3a7; opacity: 1; }
html[data-theme="dark"] .lr-join-go:disabled { background: #1a2634; color: #48607a; }
-.lr-access-text { display: grid; gap: 7px; justify-items: center; max-width: 330px; text-align: center; }
-.lr-access-text h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
-.lr-access-text p { font-size: 13px; line-height: 1.6; opacity: .72; }
+.lr-access-text {
+ display: grid;
+ width: min(100%, 330px);
+ min-width: 0;
+ max-width: 100%;
+ gap: 7px;
+ justify-items: center;
+ text-align: center;
+}
+.lr-access-text h1 {
+ min-width: 0;
+ max-width: 100%;
+ overflow-wrap: anywhere;
+ font-size: 20px;
+ font-weight: 800;
+ letter-spacing: -0.01em;
+}
+.lr-access-text p {
+ min-width: 0;
+ max-width: 100%;
+ overflow-wrap: anywhere;
+ font-size: 13px;
+ line-height: 1.6;
+ opacity: .72;
+}
-.lr-loading { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; }
+.lr-loading {
+ display: inline-flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 12px;
+ color: var(--ink);
+ font-size: 14.5px;
+ font-weight: 600;
+}
+.lr-viewer-entry-brand { display: grid; place-items: center; color: var(--ink); }
.lr-spin { animation: lr-rotate .9s linear infinite; }
@keyframes lr-rotate { to { transform: rotate(360deg); } }
@@ -1009,17 +1186,13 @@ html[data-theme="dark"] .lr-switch::after { background: var(--ink); }
.lr-row > .lr-spacer,
.lr-row > .lr-divider { display: none; }
.lr-row-group { width: 100%; gap: 9px; }
- .lr-viewer-summary-row { grid-template-columns: minmax(0, 1fr); }
- .lr-viewer-room-slot,
- .lr-viewer-host-slot,
- .lr-viewer-state-slot,
- .lr-viewer-self-slot,
- .lr-viewer-actions-slot {
- grid-column: 1;
- grid-row: auto;
- max-width: 100%;
- }
- .lr-viewer-actions-slot { justify-self: stretch; }
+ .lr-viewer-summary-row { flex-direction: row; align-items: center; }
+ .lr-viewer-summary-row .lr-row-group { width: auto; }
+ .lr-viewer-host-slot { flex: 0 1 auto; max-width: 180px; }
+ .lr-viewer-state-slot { flex: 1 1 120px; }
+ .lr-viewer-self-slot { flex: 1 1 auto; gap: 6px; }
+ .lr-viewer-actions-slot { flex: 1 1 100%; margin-left: 0; }
+ .lr-input.lr-name-editor { width: min(136px, 40vw); }
.lr-group-actions { display: flex; width: 100%; gap: 8px; min-width: 0; }
.lr-group-actions .lr-btn { flex: 1 1 0; min-width: 0; min-height: 52px; padding: 4px 5px; gap: 6px; }
.lr-group-actions .lr-btn .lr-cap { white-space: normal; text-align: center; line-height: 1.25; font-size: 11px; }
@@ -1030,6 +1203,7 @@ html[data-theme="dark"] .lr-switch::after { background: var(--ink); }
.lr-pawn-detail .lr-meter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lr-meter-cell { justify-content: flex-start; }
.lr-group-name .lr-name-tag { flex: 1; }
+ .lr-viewer-self-slot .lr-name-tag { flex: 0 1 auto; }
.lr-toggle { flex: 1; }
.lr-door-body { padding: 12px; }
.lr-dial { width: 54px; height: 66px; font-size: 28px; }
@@ -1040,8 +1214,34 @@ html[data-theme="dark"] .lr-switch::after { background: var(--ink); }
.lr-header-controls .lr-btn .lr-cap { display: none; }
}
@media (max-width: 360px) {
+ .lr-top { gap: 6px; padding-inline: 10px; }
+ .lr-top-right { gap: 6px; }
+ .lr-leds { gap: 4px; padding: 6px; }
+ .lr-leds i { width: 8px; height: 8px; }
+ .lr-lang { gap: 1px; padding: 2px; border-width: 2px; }
+ .lr-lang button { min-width: 30px; height: 32px; padding-inline: 5px; }
+ .lr-header-controls .lr-btn {
+ min-width: 36px !important;
+ width: 36px;
+ height: 36px !important;
+ padding: 0;
+ }
.lr-tiles .lr-tile { padding-inline: 4px; }
.lr-tile small { font-size: 10px; letter-spacing: 0; }
+ /* Keep the three connection beats inside a narrow TV. Captions may wrap
+ to two lines instead of being clipped at the screen edge. */
+ .lr-storyboard { width: 100%; min-width: 0; gap: 4px; }
+ .lr-storyboard > .lr-brand-mark { width: 36px; height: 36px; }
+ .lr-story { width: 100%; min-width: 0; gap: 6px; }
+ .lr-story-panel { width: 44px; height: 44px; border-radius: 12px; }
+ .lr-story-link { width: 14px; }
+ .lr-story-cap {
+ width: 44px;
+ white-space: normal;
+ text-wrap: balance;
+ line-height: 1.1;
+ font-size: 9.5px;
+ }
}
/* ---------- comic tooltip ---------- */
@@ -1193,6 +1393,27 @@ html[data-theme="dark"] .lr-switch::after { background: var(--ink); }
.lr-tv-static { animation: none; opacity: .35; }
.lr-route-edge.is-pending,
.lr-route-edge.is-recovering { animation: none; }
+ .lr-brand-mark:is(.is-animated, .is-once) .lr-brand-shell > * {
+ animation: none !important;
+ stroke-dashoffset: 0 !important;
+ }
+ .lr-brand-mark:is(.is-animated, .is-once) .lr-brand-face {
+ animation: none !important;
+ opacity: 1 !important;
+ transform: none !important;
+ }
+ .lr-brand-mark:is(.is-animated, .is-once) .lr-brand-eye-left,
+ .lr-brand-mark:is(.is-animated, .is-once) .lr-brand-eye-wink {
+ animation: none !important;
+ opacity: 1 !important;
+ transform: none !important;
+ stroke-dashoffset: 0 !important;
+ }
+ .lr-brand-mark:is(.is-animated, .is-once) .lr-brand-eye-open,
+ .lr-brand-mark:is(.is-animated, .is-once) .lr-brand-sparkles {
+ animation: none !important;
+ opacity: 0 !important;
+ }
}
/* ---------- interaction and legibility constraints ---------- */
diff --git a/src/client/ui/animation.ts b/src/client/ui/animation.ts
new file mode 100644
index 00000000..163cb728
--- /dev/null
+++ b/src/client/ui/animation.ts
@@ -0,0 +1,29 @@
+/** Restart the CSS animations owned by one marked interactive graphic. */
+export function replaySvgAnimations(root: Element): void {
+ const elements = [root, ...Array.from(root.querySelectorAll("*"))];
+ for (const element of elements) {
+ for (const animation of element.getAnimations()) {
+ try {
+ animation.cancel();
+ animation.play();
+ } catch {
+ // The graphic can leave the document during a pointer transition.
+ }
+ }
+ }
+}
+
+/** Replay a marked graphic whenever its owning interactive surface is entered. */
+export function bindSvgReplayOnPointerEnter(
+ graphic: SVGSVGElement,
+): () => void {
+ const owner =
+ graphic.closest<HTMLElement>("button, a, [role='button']") ?? graphic;
+ const handlePointerEnter = (event: Event) => {
+ if ((event as PointerEvent).pointerType !== "touch") {
+ replaySvgAnimations(graphic);
+ }
+ };
+ owner.addEventListener("pointerenter", handlePointerEnter);
+ return () => owner.removeEventListener("pointerenter", handlePointerEnter);
+}
diff --git a/src/client/ui/icons.tsx b/src/client/ui/icons.tsx
index 886e78a9..1ca9898d 100644
--- a/src/client/ui/icons.tsx
+++ b/src/client/ui/icons.tsx
@@ -4,7 +4,8 @@
// render pass, which would restart the draw-in animation on unrelated state
// changes; reconciled children stay put, so the draw only replays on a true
// icon swap). pathLength={1} on every shape paces the draw-in evenly.
-import type { ReactNode } from "react";
+import { useEffect, useRef, type ReactNode } from "react";
+import { bindSvgReplayOnPointerEnter } from "./animation";
const PATHS: Record<string, { body: ReactNode; solid?: boolean }> = {
copy: { body: (<><rect pathLength={1} x="9" y="9" width="12" height="12" rx="2"/><path pathLength={1} d="M5 15V5a2 2 0 0 1 2-2h10"/></>) },
@@ -69,14 +70,8 @@ export function Glyph({
size?: number;
className?: string;
/**
- * Declares this icon a draw-in SPOT (the value is the spot's stable id,
- * used for documentation only). Spots are state-beat positions the author
- * chose deliberately: theatrical mounts (entry cast/door, stage overlay,
- * join/gate doors) and toggle icons whose form changes (pause↔play,
- * copy↔check, moon↔sun, eye↔eyeOff). The draw replays exactly when the
- * icon's innerHTML changes — a swap at the spot, or a genuine re-entry
- * remount. No runtime inference: icons without a spot never draw, so list
- * reconciliation and StrictMode can never cause a false trigger.
+ * Declares an explicit draw-in spot. Marked icons replay on state swaps,
+ * genuine remounts, and pointer entry; unmarked icons stay static.
*/
draw?: string;
}) {
@@ -89,8 +84,16 @@ export function Glyph({
]
.filter(Boolean)
.join(" ");
+ const graphicRef = useRef<SVGSVGElement>(null);
+
+ useEffect(() => {
+ if (!draw || !graphicRef.current) return;
+ return bindSvgReplayOnPointerEnter(graphicRef.current);
+ }, [draw]);
+
return (
<svg
+ ref={graphicRef}
width={size}
height={size}
viewBox="0 0 24 24"
diff --git a/tests/living-components.test.ts b/tests/living-components.test.ts
index 4478c9c6..4ef5e56d 100644
--- a/tests/living-components.test.ts
+++ b/tests/living-components.test.ts
@@ -3,6 +3,11 @@ import { renderToStaticMarkup } from "react-dom/server";
import { afterEach, describe, expect, it } from "vitest";
import { Couch } from "../src/client/components/living/Couch.tsx";
+import {
+ BrandLoader,
+ BrandMark,
+} from "../src/client/components/living/BrandMark.tsx";
+import { Comic } from "../src/client/components/living/Comic.tsx";
import { ComicTooltip } from "../src/client/components/living/ComicTooltip.tsx";
import { StageOverlay } from "../src/client/components/living/Stage.tsx";
import { NameTag } from "../src/client/components/living/primitives.tsx";
@@ -25,6 +30,45 @@ describe("living-room presentation", () => {
expect(html).not.toContain("lr-tv-msg");
});
+ it("uses one static brand shape and an aria-hidden animated loading variant", () => {
+ const mark = renderToStaticMarkup(createElement(BrandMark, { size: 32 }));
+ const loader = renderToStaticMarkup(createElement(BrandLoader));
+
+ expect(mark).toContain('class="lr-brand-mark"');
+ expect(mark).toContain("lr-brand-eye-wink");
+ expect(mark).not.toContain("is-animated");
+ expect(loader).toContain('class="lr-brand-loader"');
+ expect(loader).toContain("lr-brand-mark is-animated");
+ expect(loader).toContain('aria-hidden="true"');
+ });
+
+ it("uses the animated brand for transient stage states", () => {
+ const html = renderToStaticMarkup(
+ createElement(StageOverlay, {
+ icon: "loader",
+ transition: true,
+ message: "Allocating media route",
+ }),
+ );
+
+ expect(html).toContain('role="status"');
+ expect(html).toContain("lr-brand-loader");
+ expect(html).not.toContain("lr-tv-big");
+ });
+
+ it("ends the exhausted-route comic with a failed fallback", () => {
+ const html = renderToStaticMarkup(
+ createElement(Comic, { kind: "route-failed", size: 320 }),
+ );
+
+ expect(html).toContain("vls-rf-fallback-x");
+ expect(html).toContain("vls-rf-fallback");
+ expect(html).toContain("vlsRfFailurePulse");
+ expect(html).toContain("vlsRfFailureX");
+ expect(html).not.toContain("vls-rf-green");
+ expect(html).not.toContain("vls-rf-star");
+ });
+
it("announces the supplied state for a Viewer without committed media", () => {
setCopy({ lang: "en", vis: false });
const html = renderToStaticMarkup(
diff --git a/tests/route-tree.test.ts b/tests/route-tree.test.ts
index 3407f49c..bd82dd32 100644
--- a/tests/route-tree.test.ts
+++ b/tests/route-tree.test.ts
@@ -291,7 +291,7 @@ describe("RouteTree", () => {
expect(html).toContain(`style="width:${width}px;max-width:none"`);
expect(
new Set(
- [...html.matchAll(/translate\((\d+),/g)].map((match) => match[1]),
+ [...html.matchAll(/translate\(([\d.]+),/g)].map((match) => match[1]),
).size,
).toBeGreaterThanOrEqual(6);
});