+
+
+
Follow the show
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/starpod/src/pages/about.astro b/packages/starpod/src/pages/about.astro
index 32356e13..ebbbd22c 100644
--- a/packages/starpod/src/pages/about.astro
+++ b/packages/starpod/src/pages/about.astro
@@ -3,90 +3,223 @@ import type { ImageMetadata } from 'astro';
import { Image } from 'astro:assets';
import Layout from '../layouts/Layout.astro';
+import PageHeader from '../components/PageHeader.astro';
+import Tiles from '../components/episode/Tiles.astro';
+import { ArrowOutIcon, GithubIcon, LinkIcon, XIcon } from '../components/icons';
+import { matchNames } from '../lib/cast';
+import { optimizeImage } from '../lib/optimize-episode-image';
+import { peopleBySlug } from '../lib/people';
+import { getAllEpisodes, getShowInfo, type Episode } from '../lib/rss';
import starpodConfig from 'virtual:starpod/config';
import LargePlatforms from 'virtual:starpod/components/LargePlatforms';
-import avatarLight from '../assets/avatar-light.png';
+import avatar from '../assets/avatar.svg?url';
const { hosts } = starpodConfig;
const images = import.meta.glob<{ default: ImageMetadata }>(
'/src/img/people/*.{jpeg,jpg,png}'
);
-// Fall back to the packaged avatar when the site has not provided a photo in
-// src/img/people yet.
-const hostImage = (img: string) =>
- images[`/src/img/people/${img}`]?.() ?? avatarLight;
+// Fall back to the packaged avatar, which follows light and dark, when the
+// site has not provided a photo in src/img/people yet.
+const hostImage = async (img: string) =>
+ (await images[`/src/img/people/${img}`]?.())?.default;
+
+const linksFor = (host: (typeof hosts)[number]) =>
+ [
+ host.twitter && { href: host.twitter, label: 'Twitter', Icon: XIcon },
+ host.github && { href: host.github, label: 'GitHub', Icon: GithubIcon },
+ host.website && { href: host.website, label: 'Website', Icon: LinkIcon }
+ ].filter(Boolean) as Array<{
+ href: string;
+ label: string;
+ Icon: typeof LinkIcon;
+ }>;
+
+// What each host has done on the show, wherever episodes name them (the
+// guests database or the feed: src/lib/people.ts): how many episodes, since
+// when, how many hours, and the two latest.
+const castBySlug = await peopleBySlug();
+const everyone = [
+ ...new Map(
+ [...castBySlug.values()].flat().map((person) => [person.id, person])
+ ).values()
+];
+const show = everyone.length ? await getShowInfo() : undefined;
+const bySlug = new Map(
+ (everyone.length ? await getAllEpisodes() : []).map((item) => [
+ item.episodeSlug,
+ item
+ ])
+);
+
+const tile = async (item: Episode) => ({
+ href: `/${item.episodeSlug}`,
+ number: item.episodeNumber === 'Bonus' ? 'Bonus' : `Ep ${item.episodeNumber}`,
+ title: item.title,
+ art:
+ (await optimizeImage(item.episodeImage ?? show!.image, {
+ width: 320,
+ height: 320
+ })) ?? show!.image
+});
+
+// Each configured host's record: the same name, or surely the same person,
+// one each, whatever order the episodes name them in.
+const recordOf = matchNames(
+ hosts.map((host) => host.name),
+ everyone.map((candidate) => candidate.name)
+);
+
+const posters = await Promise.all(
+ hosts.map(async (host, index) => {
+ const person = everyone.find(
+ (candidate) => candidate.name === recordOf.get(host.name)
+ );
+ const theirs = person
+ ? [...castBySlug]
+ .filter(([, cast]) => cast.some((one) => one.id === person.id))
+ .map(([slug]) => bySlug.get(slug))
+ .filter((item): item is Episode => Boolean(item))
+ .sort((a, b) => b.published - a.published)
+ : [];
+ const hours = Math.round(
+ theirs.reduce((sum, item) => sum + (item.duration || 0), 0) / 3600
+ );
+ return {
+ ...host,
+ id: person?.id,
+ photo: await hostImage(host.img),
+ voice: index < 2 ? index : undefined,
+ count: theirs.length,
+ stats: theirs.length
+ ? [
+ `${theirs.length} ${theirs.length === 1 ? 'episode' : 'episodes'}`,
+ `since ${new Date(theirs.at(-1)!.published).getFullYear()}`,
+ `${hours} ${hours === 1 ? 'hour' : 'hours'}`
+ ].join(' · ')
+ : undefined,
+ theirs,
+ recent: await Promise.all(theirs.slice(0, 2).map(tile))
+ };
+ })
+);
+
+// When every host's latest two are the same episodes, each poster would
+// repeat one row: show it once beneath them instead, as the latest episodes
+// they made together, and keep each poster's way to all of theirs.
+const recentOf = (poster: (typeof posters)[number]) =>
+ poster.recent.map((item) => item.href).join(' ');
+const together =
+ posters.length > 1 &&
+ posters[0].recent.length > 0 &&
+ posters.every((poster) => recentOf(poster) === recentOf(posters[0]))
+ ? await Promise.all(
+ posters[0].theirs
+ .filter((item) =>
+ posters.every((poster) => poster.theirs.includes(item))
+ )
+ .slice(0, 4)
+ .map(tile)
+ )
+ : [];
---
-
-
- About the show
-
+
+
+ {starpodConfig.description}
+
-
{starpodConfig.description}
+
-
+
+ Meet the hosts
- Meet the hosts
-
-
- {
- hosts.map((host, index) => (
-
-
-
-
-
- {host.name}
-
-
-
{host.bio}
-
-
- {host?.twitter && (
-
- Twitter
-
+
+ {
+ posters.map((host) => (
+ -
+
+ {host.photo ? (
+
+ ) : (
+

)}
+
+
+
+
{host.name}
+ {host.stats &&
{host.stats}
}
+ {host.bio &&
{host.bio}
}
- {host?.github && (
+ {together.length === 0 && host.recent.length > 0 && (
+
+ )}
+ {together.length > 0 && host.id && (
- GitHub
+ All {host.count}
+
)}
- {host?.website && (
-
- Website
-
+ {linksFor(host).length > 0 && (
+
+ {linksFor(host).map(({ href, Icon, label }) => (
+ -
+
+
+ {label}
+
+
+ ))}
+
)}
-
+
+ ))
+ }
+
+
+ {
+ together.length > 0 && (
+
+
Latest episodes
+
- ))
+ )
}
-
+
diff --git a/packages/starpod/src/pages/contact.astro b/packages/starpod/src/pages/contact.astro
index 37404e5f..b26fa5ee 100644
--- a/packages/starpod/src/pages/contact.astro
+++ b/packages/starpod/src/pages/contact.astro
@@ -1,20 +1,17 @@
---
import Layout from '../layouts/Layout.astro';
import ContactForm from '../components/ContactForm';
+import PageHeader from '../components/PageHeader.astro';
---
-
-
- Get in touch
-
-
-
- Have a question for us or a topic you would like us to cover on the show?
- Reach out here and we'll be in touch soon!
-
+
+
+
+ Have a question for us or a topic you would like us to cover on the show?
+ Reach out here and we'll be in touch soon!
+
+
diff --git a/packages/starpod/src/pages/for-llms.astro b/packages/starpod/src/pages/for-llms.astro
index 09527a52..f7b12f83 100644
--- a/packages/starpod/src/pages/for-llms.astro
+++ b/packages/starpod/src/pages/for-llms.astro
@@ -1,5 +1,6 @@
---
import Layout from '../layouts/Layout.astro';
+import SectionBar from '../components/episode/SectionBar.astro';
import { getAllEpisodes, getShowInfo } from '../lib/rss';
import { formatDate, formatDuration } from '../lib/llms';
import starpodConfig from 'virtual:starpod/config';
@@ -23,6 +24,17 @@ if (episodes.length > 0) {
episodesPerWeek = (episodes.length / daysBetween) * 7;
}
}
+
+const sections = [
+ { id: 'overview', label: 'Overview' },
+ { id: 'hosts', label: 'Hosts' },
+ { id: 'episodes', label: 'Episodes' },
+ { id: 'recent', label: 'Recent' },
+ { id: 'transcripts', label: 'Transcripts' },
+ { id: 'listen', label: 'Listen' },
+ { id: 'rss', label: 'RSS' },
+ { id: 'all', label: 'All episodes' }
+];
---
0) {
>
{show.title} - Guide for AI Assistants
+
+
+
+
+
-
- Podcast Overview
+
+ Podcast Overview
Tagline:
{starpodConfig.blurb}
@@ -45,12 +62,12 @@ if (episodes.length > 0) {
{starpodConfig.description}
-
- Hosts
+
+ Hosts
{
starpodConfig.hosts.map((host) => (
-
+
{host.name}
{host.bio}
@@ -61,7 +78,7 @@ if (episodes.length > 0) {
<>
Website
@@ -72,7 +89,7 @@ if (episodes.length > 0) {
<>
GitHub
@@ -82,7 +99,7 @@ if (episodes.length > 0) {
{host.twitter && (
Twitter
@@ -94,8 +111,8 @@ if (episodes.length > 0) {
}
-
- Episode Information
+
+ Episode Information
-
Total Episodes:
@@ -120,8 +137,8 @@ if (episodes.length > 0) {
-
- Recent Episodes
+
+ Recent Episodes
{
recentEpisodes.map((episode) => (
@@ -129,7 +146,7 @@ if (episodes.length > 0) {
Episode {episode.episodeNumber}:{' '}
{episode.title}
{' '}
@@ -140,8 +157,8 @@ if (episodes.length > 0) {
-
- Transcript Availability
+
+ Transcript Availability
Transcripts are available for many episodes and are included in the
individual episode markdown files. Access any episode at
@@ -150,15 +167,15 @@ if (episodes.length > 0) {
-
- How to Listen
+
+ How to Listen
{
starpodConfig.platforms.apple && (
-
Apple Podcasts
@@ -170,7 +187,7 @@ if (episodes.length > 0) {
-
Spotify
@@ -182,7 +199,7 @@ if (episodes.length > 0) {
-
YouTube
@@ -194,7 +211,7 @@ if (episodes.length > 0) {
-
Overcast
@@ -206,7 +223,7 @@ if (episodes.length > 0) {
-
Pocket Casts
@@ -216,33 +233,34 @@ if (episodes.length > 0) {
-
- RSS Feed
+
-
- Complete Episode List
+
+
diff --git a/packages/starpod/src/styles/buttons.css b/packages/starpod/src/styles/buttons.css
deleted file mode 100644
index 85d23f8f..00000000
--- a/packages/starpod/src/styles/buttons.css
+++ /dev/null
@@ -1,43 +0,0 @@
-@property --complete {
- initial-value: 0;
- syntax: '
';
- inherits: true;
-}
-
-.btn {
- @apply dark:bg-dark-button relative box-border flex cursor-pointer rounded-full border border-transparent bg-white bg-clip-padding p-[1px] text-sm font-bold shadow-sm shadow-[#D9E4F0E5] dark:shadow-md dark:shadow-[rgba(0,0,0,0.25)];
- @apply before:absolute before:-inset-[1px] before:-z-[1] before:rounded-[inherit] before:content-[''];
- @apply after:absolute after:-inset-[1px] after:-z-[1] after:rounded-[inherit] after:content-[''];
-
- &:after {
- @apply bg-gradient-to-br from-[#D8CCFF] to-[#8A63FF] dark:from-[#42C8F3] dark:to-[#B6EDFF];
- mask: conic-gradient(
- from calc(var(--from, 0) * 1deg),
- #000 calc(var(--complete) * 1%),
- #0000 calc(var(--complete) * 1%)
- );
- transition: --complete 500ms;
- transition-timing-function: linear(
- 0 0%,
- 0.0027 3.64%,
- 0.0106 7.29%,
- 0.0425 14.58%,
- 0.0957 21.87%,
- 0.1701 29.16%,
- 0.2477 35.19%,
- 0.3401 41.23%,
- 0.5982 55.18%,
- 0.7044 61.56%,
- 0.7987 68.28%,
- 0.875 75%,
- 0.9297 81.25%,
- 0.9687 87.5%,
- 0.9922 93.75%,
- 1 100%
- );
- }
-}
-
-.btn:is(:hover, :focus-visible) {
- --complete: 100;
-}
diff --git a/packages/starpod/src/styles/global.css b/packages/starpod/src/styles/global.css
index 0c4fb1b4..87598862 100644
--- a/packages/starpod/src/styles/global.css
+++ b/packages/starpod/src/styles/global.css
@@ -1,78 +1,76 @@
@import './tailwind.css';
-@import './gradient-icon.css';
-@import './buttons.css';
+@import 'anchored-auto-layout';
+@import '../motion/propflip.css';
+@import './tilt.css';
@import './search-icon.css';
-
-@import 'atropos/css';
+@import './tokens.css';
+@import './people.css';
+@import './shell.css';
+@import './stage.css';
+@import './worlds.css';
+@import './interactions.css';
+@import './rail.css';
+@import './explorer.css';
+@import './player.css';
+@import './episode.css';
@view-transition {
navigation: auto;
}
-main:has(+ * + #audio-player .player) {
- @media (min-width: 1024px) {
- @apply mb-28;
- }
-}
-html {
- color-scheme: light dark;
-}
+/* ---------- Shared utilities for pages and overrides ---------- */
-html,
-.custom-scrollbar {
- scrollbar-color: var(--color-light-input-border) transparent;
-
- @media (prefers-color-scheme: dark) {
- scrollbar-color: var(--color-dark-input-border) transparent;
- }
+.animated-bottom-border {
+ position: relative;
+ display: inline-block;
+ padding-bottom: 0.35rem;
+ border-bottom: 1px solid var(--line);
}
-footer:has(+ #audio-player .player) {
- @media (max-width: 1024px) {
- @apply mb-40;
- }
+.animated-bottom-border::after {
+ content: '';
+ position: absolute;
+ left: 0;
+ bottom: -1px;
+ height: 1px;
+ width: 0;
+ background: linear-gradient(90deg, var(--glow-a), var(--glow-b));
+ transition: width 500ms var(--ease-out);
}
-[aria-label='EpisodeList'] li {
- > div {
- content-visibility: auto;
- contain-intrinsic-block-size: auto 400px;
- }
-
- @media (width >= 1024px) {
- & h2 > a {
- animation: toggle-vt-names linear both;
- animation-timeline: view();
- }
- }
+.animated-bottom-border:hover::after {
+ width: 100%;
}
-@keyframes toggle-vt-names {
- entry 0% {
- --should-vt: none;
- }
- entry 1%,
- exit 99% {
- --should-vt: var(--vt-name);
- }
- exit 100% {
- --should-vt: none;
- }
+.input {
+ border: 1px solid var(--line-strong);
+ border-radius: var(--radius);
+ background: var(--surface);
+ color: var(--ink);
+ padding: 0.9rem 1rem;
+ font: inherit;
+ outline: none;
+ transition: border-color 200ms var(--ease-out);
}
-.animated-bottom-border {
- @apply dark:border-dark-border border-b after:block after:h-[1px] after:w-0 after:bg-gradient-to-r after:from-[#C6B2FF] after:to-[#8D67FF] after:transition-all after:duration-500 after:ease-in-out hover:after:w-full dark:after:from-[#43C9F5] dark:after:to-[#B4EDFF];
+.input::placeholder {
+ color: var(--muted);
}
-.input {
- @apply border-light-input-border bg-light-input-bg focus:border-light-input-border-focused dark:border-dark-input-border dark:bg-dark-input-bg dark:focus:border-dark-input-border-focused rounded border p-4 !ring-0 transition-colors !outline-none;
+.input:focus {
+ border-color: var(--accent);
}
@utility section-heading {
- @apply text-xs font-bold tracking-wide uppercase;
+ font-size: 0.75rem;
+ font-weight: 700;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
}
@utility section-heading-underlined {
- @apply section-heading dark:border-dark-border border-b pb-4;
+ @apply section-heading;
+ border-bottom: 1px solid var(--line);
+ padding-bottom: 1rem;
}
diff --git a/packages/starpod/src/styles/gradient-icon.css b/packages/starpod/src/styles/gradient-icon.css
deleted file mode 100644
index 6c3708be..00000000
--- a/packages/starpod/src/styles/gradient-icon.css
+++ /dev/null
@@ -1,45 +0,0 @@
-@property --gradient-start {
- syntax: '';
- inherits: false;
- initial-value: oklch(67.65% 0.043 285.21);
-}
-
-@property --gradient-stop {
- syntax: '';
- inherits: false;
- initial-value: oklch(67.65% 0.043 285.21);
-}
-
-@media (prefers-color-scheme: dark) {
- @property --gradient-start {
- syntax: '';
- inherits: false;
- initial-value: oklch(71.44% 0.019 264.45);
- }
-
- @property --gradient-stop {
- syntax: '';
- inherits: false;
- initial-value: oklch(71.44% 0.019 264.45);
- }
-}
-
-@utility gradient-icon {
- background: linear-gradient(
- 180deg,
- var(--gradient-start) 0%,
- var(--gradient-stop) 100%
- );
- transition:
- --gradient-start 300ms,
- --gradient-stop 300ms;
-
- &:hover {
- --gradient-start: oklch(77.32% 0.129 294.81);
- --gradient-stop: oklch(67.59% 0.18851878808119876 292.4954219580293);
- @media (prefers-color-scheme: dark) {
- --gradient-start: oklch(88.52% 0.079 220.53);
- --gradient-stop: oklch(78.86% 0.125 223.67);
- }
- }
-}
diff --git a/packages/starpod/src/styles/interactions.css b/packages/starpod/src/styles/interactions.css
new file mode 100644
index 00000000..40e3d659
--- /dev/null
+++ b/packages/starpod/src/styles/interactions.css
@@ -0,0 +1,238 @@
+/* Loaded last so these states win over each control's base styles. */
+
+/*
+ Hover language. Three rules, carried over from the original site:
+
+ 1. Outlined controls (a border on the page's own background) draw the
+ gradient outline: an Iris (light) / Aqua (dark) ring that sweeps
+ clockwise from the top over the 1px border. Add `.halo` to opt in.
+ 2. Solid controls (the play buttons, primary actions) fill with the
+ gradient, left to right.
+ 3. Icon controls turn the icon itself into the gradient, top to bottom.
+
+ All three fade; nothing swaps instantly. A key press stands in for a
+ hover via [data-flash].
+*/
+
+@property --icon-a {
+ syntax: '';
+ inherits: true;
+ initial-value: oklch(0% 0 0 / 0);
+}
+
+@property --icon-b {
+ syntax: '';
+ inherits: true;
+ initial-value: oklch(0% 0 0 / 0);
+}
+
+@property --fill-a {
+ syntax: '';
+ inherits: false;
+ initial-value: oklch(0% 0 0 / 0);
+}
+
+@property --fill-b {
+ syntax: '';
+ inherits: false;
+ initial-value: oklch(0% 0 0 / 0);
+}
+
+/* 1. The gradient outline. */
+:where(
+ .halo,
+ .btn,
+ .button-secondary,
+ .text-button,
+ .medium-switch
+ ) {
+ --halo: 0;
+ position: relative;
+ isolation: isolate;
+}
+
+:where(
+ .halo,
+ .btn,
+ .button-secondary,
+ .text-button,
+ .medium-switch
+ )::after {
+ content: '';
+ position: absolute;
+ inset: -1px;
+ border-radius: inherit;
+ padding: 1px;
+ background: linear-gradient(to bottom right, var(--glow-a), var(--glow-b));
+ mask:
+ conic-gradient(
+ from calc(var(--from, 0) * 1deg),
+ oklch(0% 0 0) calc(var(--halo) * 1%),
+ oklch(0% 0 0 / 0) calc(var(--halo) * 1%)
+ ),
+ linear-gradient(oklch(0% 0 0) 0 0) content-box,
+ linear-gradient(oklch(0% 0 0) 0 0);
+ mask-composite: intersect, exclude;
+ -webkit-mask-composite: source-in, xor;
+ /* Fully gone at rest: no antialiasing slivers left at rounded corners. */
+ opacity: clamp(0, var(--halo), 1);
+ pointer-events: none;
+ transition: --halo 500ms var(--ease-halo);
+}
+
+:where(
+ .halo,
+ .btn,
+ .button-secondary,
+ .text-button,
+ .medium-switch
+ ):is(:focus-visible, [data-flash]) {
+ --halo: 100;
+}
+
+/* 2. Solid fills. Each control states its resting colour in both stops so
+ the gradient can grow out of it. */
+.dock-play,
+.stage-play,
+.button-primary,
+.topbar-follow,
+[data-episode-row][data-current] .row-play {
+ --fill-a: var(--ink);
+ --fill-b: var(--ink);
+ /* Each solid button anchors its own buffering ring (::before). */
+ position: relative;
+ background: linear-gradient(to right, var(--fill-a), var(--fill-b));
+ transition:
+ --fill-a 300ms var(--ease-out),
+ --fill-b 300ms var(--ease-out),
+ color 300ms var(--ease-out),
+ border-color 300ms var(--ease-out),
+ opacity 400ms var(--ease-out),
+ transform 400ms var(--ease-spring),
+ scale 400ms var(--ease-spring);
+}
+
+.stage-play {
+ --fill-a: oklch(98% 0.005 285);
+ --fill-b: oklch(98% 0.005 285);
+}
+
+[data-episode-row][data-current] .row-play {
+ border-color: transparent;
+}
+
+[data-episode-row][data-current] .row-play::after {
+ display: none;
+}
+
+:is(.dock-play, .stage-play, .button-primary, .topbar-follow, [data-episode-row][data-current] .row-play):is(
+ :focus-visible,
+ [data-flash]
+ ) {
+ --fill-a: var(--glow-a);
+ --fill-b: var(--glow-b);
+ color: var(--on-glow);
+}
+
+/* The round play buttons also swell a little, as the original did. */
+:is(.dock-play, [data-episode-row][data-current] .row-play):is(:focus-visible, [data-flash]) {
+ scale: 1.08;
+}
+
+/* 3. Gradient icons. */
+.icon-stop-a {
+ stop-color: var(--icon-a);
+}
+
+.icon-stop-b {
+ stop-color: var(--icon-b);
+}
+
+/* The fade lives on whatever actually paints. An SVG gradient isn't
+ repainted while an inherited value animates on its ancestor, so the stops
+ transition their own colour; the platform marks (masked boxes) transition
+ their own copy of the stops. */
+.icon-stop-a,
+.icon-stop-b {
+ transition: stop-color 300ms ease;
+}
+
+.platform-icon {
+ transition:
+ --icon-a 300ms ease,
+ --icon-b 300ms ease;
+}
+
+.icon-button,
+.mini-button,
+.search-trigger,
+.platform,
+.rail-nav a,
+.sheet-nav a {
+ --icon-a: var(--text);
+ --icon-b: var(--text);
+ transition:
+ background 200ms var(--ease-out),
+ color 200ms var(--ease-out);
+}
+
+:is(.search-trigger, .rail-nav a, .sheet-nav a) {
+ --icon-a: var(--muted);
+ --icon-b: var(--muted);
+}
+
+:is(.rail-nav a, .sheet-nav a)[aria-current='page'] {
+ --icon-a: var(--accent-ink);
+ --icon-b: var(--accent-ink);
+}
+
+:is(.icon-button, .mini-button, .search-trigger, .rail-nav a, .sheet-nav a) svg {
+ stroke: var(--icon-paint);
+}
+
+:is(.icon-button, .mini-button, .search-trigger, .rail-nav a, .sheet-nav a)
+ svg
+ :is([fill='currentColor'], text) {
+ fill: var(--icon-paint);
+}
+
+/* Platform marks are masked artwork, so the gradient is their background. */
+.platform-icon {
+ background: linear-gradient(180deg, var(--icon-a), var(--icon-b)) !important;
+}
+
+:is(.icon-button, .mini-button, .search-trigger, .platform, .rail-nav a, .sheet-nav a):is(
+ :focus-visible,
+ [data-flash]
+ ) {
+ --icon-a: var(--glow-a);
+ --icon-b: var(--glow-b);
+}
+
+/* Pointer hover, for real pointers only: touch keeps :hover after a tap. */
+@media (hover: hover) {
+ :where(
+ .halo,
+ .btn,
+ .button-secondary,
+ .text-button,
+ .medium-switch
+ ):hover {
+ --halo: 100;
+ }
+
+ :is(.dock-play, .stage-play, .button-primary, .topbar-follow, [data-episode-row][data-current] .row-play):hover {
+ --fill-a: var(--glow-a);
+ --fill-b: var(--glow-b);
+ color: var(--on-glow);
+ }
+
+ :is(.dock-play, [data-episode-row][data-current] .row-play):hover {
+ scale: 1.08;
+ }
+
+ :is(.icon-button, .mini-button, .search-trigger, .platform, .rail-nav a, .sheet-nav a):hover {
+ --icon-a: var(--glow-a);
+ --icon-b: var(--glow-b);
+ }
+}
diff --git a/packages/starpod/src/styles/rail.css b/packages/starpod/src/styles/rail.css
new file mode 100644
index 00000000..a6bfc724
--- /dev/null
+++ b/packages/starpod/src/styles/rail.css
@@ -0,0 +1,2061 @@
+/*
+ The collapsible sidebar (desktop, ≥1024px), held by one divider: the line
+ between the rail and the page is an anchor (--rail-edge) you can drag,
+ fling, double-click or step with the arrow keys (demos/split.html).
+
+ Contract: at rest, and --rail-w (the
+ rail's width, published where it is read: on the dock and the player's
+ layers; inside .app the grid carries it). Live, the
+ divider: anything may anchor to --rail-edge and ride it through a drag or a
+ glide.
+
+ Nothing about the rail ever changes a custom property on :root. One that
+ every element inherits restyles the whole page (measured: 81ms on the
+ longest episode page, 21ms on home); an attribute on :root costs 0.1ms.
+
+ The rail is anchored to the divider. Its form (open, or the icon rail) is
+ html[data-rail] at rest and html[data-rail-form] while the divider is held,
+ written when the hand crosses the middle, so the contents re-form mid-drag
+ and back. (A size container would say the same, but re-evaluating it and
+ laying out the anchored pieces on every frame of a drag cost ~4ms; between
+ crossings the pieces that fill their slots simply sit in them, in flow.)
+ Inside, it is laid out twice. Slots are in-flow
+ boxes sized for the form, so they snap; every slot is named --slot and scopes
+ that name to itself (data-⚓️-scope-name). Each visible piece is anchored to
+ the slot it sits in with Anchored Auto Layout and tweens left/top/width/height
+ to wherever the slot lands: x eases out, y springs, sizes ease, and each group
+ cascades across by its slot's sibling-index(). Nothing measures; a second
+ change of mind reverses from wherever the pieces are.
+*/
+
+@property --rail-i {
+ syntax: '';
+ inherits: true;
+ initial-value: 0;
+}
+
+:root {
+ --rail-open: 272px;
+ --rail-shut: 72px;
+}
+
+.rail-edge {
+ display: none;
+}
+
+@media (min-width: 1024px) {
+ :root {
+ --rail-w: var(--rail-open);
+ }
+
+ :root[data-rail='collapsed'] {
+ .app {
+ grid-template-columns: var(--rail-shut) minmax(0, 1fr);
+ }
+
+ .rail-edge {
+ left: var(--rail-shut);
+ }
+
+ :is(.dock, .player-air) {
+ --rail-w: var(--rail-shut);
+ }
+ }
+
+ /* The shell's clock: the rail's pieces and the divider's glide. */
+ .rail,
+ .rail-edge {
+ --flip-dx: 0.55s;
+ --flip-ex: var(--ease-out);
+ --flip-dy: 0.7s;
+ --flip-ey: var(--ease-spring);
+ --flip-ds: 0.55s;
+ --flip-es: var(--ease-out);
+ }
+
+ /* A gliding main column must never scroll the page sideways. */
+ .app {
+ overflow-x: clip;
+ }
+
+ /* After a release the main column glides on the divider's x clock. Only its
+ own transition changes, never a custom property it would pass down: on a
+ long page that would restyle every element under it. */
+ .main[data-gliding] {
+ transition: translate calc(0.55s * var(--slomo)) var(--ease-out);
+ }
+
+ /* ---------- The divider ---------- */
+
+ /* A 1px line at the rail's width. While held it follows the pointer (one
+ inline number); released, PropFLIP glides it to a stop and everything
+ anchored to it rides along. */
+ .rail-edge {
+ position: fixed;
+ inset-block: 0;
+ left: var(--rail-open);
+ z-index: 26;
+ display: block;
+ width: 1px;
+ background: var(--line);
+ cursor: col-resize;
+ outline: none;
+ touch-action: none;
+ user-select: none;
+ }
+
+ .rail-edge::before {
+ content: '';
+ position: absolute;
+ inset-block: 0;
+ inset-inline: -6px;
+ }
+
+ .rail-edge::after {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: -2px;
+ width: 5px;
+ height: 2.5rem;
+ margin-top: -1.25rem;
+ border-radius: 3px;
+ background: var(--line-strong);
+ opacity: 0;
+ transition:
+ opacity calc(0.2s * var(--slomo)) ease,
+ background-color calc(0.2s * var(--slomo)) ease,
+ scale calc(0.25s * var(--slomo)) var(--ease-spring);
+ }
+
+ .rail-edge:is(:hover, :focus-visible, [data-held])::after {
+ opacity: 1;
+ }
+
+ .rail-edge:is(:focus-visible, [data-held])::after {
+ background: var(--ink);
+ scale: 1 1.3;
+ }
+
+ .rail-edge[data-held] {
+ background: var(--muted);
+ }
+
+ /* ---------- The surface ---------- */
+
+ /* Above main's sticky bars (20), below the dock (45). The divider draws
+ the edge. */
+ .rail {
+ z-index: 25;
+ display: block;
+ padding: 0;
+ border-right: 0;
+ }
+
+ .rail-in {
+ --pad: 22px;
+ --gap: 1.25rem;
+ /* The open form's spacing, which the icon form leaves alone: the title
+ block keeps to it while it fades out (see .rail-about below). */
+ --open-pad: 22px;
+ --open-top: 28px;
+ --open-gap: 1.25rem;
+ display: flex;
+ flex-direction: column;
+ gap: var(--gap);
+ box-sizing: border-box;
+ min-height: 100%;
+ padding: 28px var(--pad) 24px;
+ }
+
+ .rail-in > * {
+ flex-shrink: 0;
+ }
+
+ /* On shorter screens, or while the now-playing island lives in the rail,
+ the open rail still fits without scrolling: the blurb gives way. */
+ @media (max-height: 880px) {
+ .rail-in {
+ --gap: 14px;
+ --open-top: 20px;
+ --open-gap: 14px;
+ padding-top: 20px;
+ }
+
+ .rail-blurb {
+ display: none;
+ }
+ }
+
+ :root[data-island='rail'] .rail-blurb {
+ display: none;
+ }
+
+ /* On a short screen the playing island takes the title's room too (the
+ art still names the show), so the follow marks and hosts stay on it. */
+ @media (max-height: 800px) {
+ :root[data-island='rail'] .rail-about {
+ display: none;
+ }
+ }
+
+ /* The island's home in the rail takes no room until the player sizes it. */
+ .rail-island-slot {
+ display: block;
+ margin-bottom: calc(-1 * var(--gap));
+ }
+
+ /* ---------- Slots: the skeleton, sized per form ---------- */
+
+ .rail-slot {
+ display: block;
+ }
+
+ .rail-head {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ }
+
+ /* A slot keeps its size while the rail is narrower than the form it is
+ in (an expand starts in the open form at the icon rail's width): a
+ squeezed slot would pull its piece smaller, and out of square, before
+ it grows. */
+ .rail-head > .rail-slot {
+ flex-shrink: 0;
+ }
+
+ :is(.rail-nav .rail-slot, .rail-slot-search) {
+ min-width: 48px;
+ }
+
+ .rail-slot-art {
+ width: 72px;
+ height: 72px;
+ }
+
+ .rail-slot-toggle {
+ width: 32px;
+ height: 32px;
+ }
+
+ .rail-slot-search {
+ height: 40px;
+ }
+
+ /* In the open rail the icons, not their fills, keep to the column's
+ inline-start line with the art, the headers and the faces: a search or
+ nav slot reaches past the column by the inset its icon keeps inside its
+ pill (the padding, and the search pill's border), so the hover and
+ current fills, the focus ring and the hit area grow outward instead.
+ Both sides, so the labels and the shortcut keep to the column too. */
+ .rail-slot-search {
+ margin-inline: -15px;
+ }
+
+ .rail-nav .rail-slot {
+ margin-inline: -14px;
+ }
+
+ /* Groups cascade from the top. Only across and in size: a group travels
+ up or down as one, so its pieces never bunch or cross. */
+ :is(.rail-nav .rail-slot, .rail .platforms > .platform-item) {
+ --rail-i: calc(sibling-index() - 1);
+ }
+
+ .rail-nav .rail-slot {
+ height: 42px;
+ }
+
+ /* The marks sit in one row, their icons from the column's inline-start
+ line to its end: six 36px circles 6px apart, the first reaching past
+ the line by an icon's inset in its circle and the last as far past the
+ end, as the nav's fills do. The list's own box (which the label rides)
+ keeps to the column, and the places are fixed, so a glide's targets
+ hold still. */
+ .rail .platforms {
+ display: flex;
+ flex-wrap: nowrap;
+ gap: 6px;
+ }
+
+ .rail .platforms > .platform-item:where(:first-child) {
+ margin-inline-start: -9px;
+ }
+
+ /* The label's room above the group is the layout's own box, so it is
+ kept whatever an overriding Platforms renders. */
+ .rail-follow-body {
+ margin-top: 26px;
+ }
+
+ /* A mark's place in the list, for the deck below: sibling-index(), or
+ where that's missing (Firefox) a count by nth-child, so the first mark
+ still lies in front and each after it smaller and further back. */
+ @supports not (z-index: sibling-index()) {
+ .rail .platforms > .platform-item {
+ &:nth-child(1) {
+ --sib: 1;
+ }
+
+ &:nth-child(2) {
+ --sib: 2;
+ }
+
+ &:nth-child(3) {
+ --sib: 3;
+ }
+
+ &:nth-child(4) {
+ --sib: 4;
+ }
+
+ &:nth-child(5) {
+ --sib: 5;
+ }
+
+ &:nth-child(n + 6) {
+ --sib: 6;
+ }
+ }
+ }
+
+ .rail .platforms > .platform-item {
+ z-index: calc(20 - var(--sib, sibling-index()));
+ flex: none;
+ width: 36px;
+ height: 36px;
+ }
+
+ /* Hosted by. At rest, one co-author credit: the faces overlapped in a
+ tight stack beside a line naming them together. Hovered, focused within
+ or tapped, the stack fans out into a row per host and gathers again;
+ each face travels on its anchor, first out is last back, and a name
+ arrives once its face has landed. The rows' room is kept below the
+ stack, so nothing moves when it opens. One host is simply that host. */
+ .rail .host-list {
+ display: flex;
+ align-items: flex-start;
+ min-height: calc(var(--hosts, 1) * 46px - 6px);
+ margin-top: 26px;
+ }
+
+ .rail-host {
+ --rail-i: calc((sibling-count() - sibling-index()) * 2);
+ display: block;
+ flex: none;
+ width: 40px;
+ height: 40px;
+ margin: 0;
+ border-radius: 50%;
+ }
+
+ .rail-host + .rail-host {
+ margin-left: -12px;
+ }
+
+ /* The resting stack shows three faces at most, so the credit beside it
+ fits the open rail whatever the cast (the config allows eight): the
+ rest wait unseen under the third, and fan out with the others. */
+ .rail-hosts-in {
+ --stacked: min(var(--hosts), 3);
+ }
+
+ :where(:root[data-rail-form='open'], :root:not([data-rail='collapsed']):not([data-rail-form])) {
+ .rail-hosts:not(:hover, :focus-within, [data-open], :has(.is-fanned))
+ .rail-host:nth-child(n + 4) {
+ margin-left: -40px;
+
+ .person-face {
+ opacity: 0;
+ }
+ }
+ }
+
+ :where(:root[data-rail-form='open'], :root:not([data-rail='collapsed']):not([data-rail-form])) {
+ :is(
+ .rail-hosts:is(:hover, :focus-within, [data-open]),
+ .rail-hosts:has(.is-fanned)
+ ) {
+ .host-list {
+ flex-direction: column;
+ gap: 6px;
+ }
+
+ .rail-host {
+ --rail-i: calc((sibling-index() - 1) * 2);
+ width: 100%;
+ height: 40px;
+ border-radius: 999px;
+ }
+
+ .rail-host + .rail-host {
+ margin-left: 0;
+ }
+ }
+ }
+
+ /* The icon rail: whenever the rail is narrower than the midpoint between
+ its two stops, at rest or under the hand. */
+ :where(:root[data-rail-form='icons'], :root[data-rail='collapsed']:not([data-rail-form])) {
+ /* The icon column keeps to the leading edge: the form can switch while
+ the rail is still wide (a glide starts in its new form), and the icons
+ then travel straight to their places. */
+ .rail-in {
+ --pad: 12px;
+ --gap: 12px;
+ align-items: flex-start;
+ padding-block: 20px;
+ }
+
+ .rail-head {
+ flex-direction: column;
+ gap: 8px;
+ }
+
+ /* Every item a 48px circle on a 56px pitch (the art a tile). */
+ :is(
+ .rail-slot-art,
+ .rail-slot-toggle,
+ .rail-slot-search,
+ .rail-nav .rail-slot
+ ) {
+ width: 48px;
+ height: 48px;
+ margin-inline: 0;
+ }
+
+ .rail-nav {
+ gap: 8px;
+ }
+
+ /* The marks gather into a deck, the first on top and each one behind it
+ a little smaller and 4px lower, so only its rim shows. Hovering the
+ deck fans it. The faces gather into an overlapping stack. */
+ .rail .platforms {
+ display: flex;
+ flex-direction: column;
+ flex-wrap: nowrap;
+ align-items: center;
+ gap: 0;
+ width: 48px;
+ }
+
+ .rail-follow-body {
+ margin-top: 0;
+ }
+
+ .rail .platforms > .platform-item {
+ width: calc(34px - 2px * var(--sib, sibling-index()));
+ height: calc(34px - 2px * var(--sib, sibling-index()));
+ margin-inline-start: 0;
+ }
+
+ .rail .platforms > .platform-item + .platform-item {
+ margin-top: calc(2px * var(--sib, sibling-index()) - 30px);
+ }
+
+ .rail-follow:has(.rail-stack:is(:hover, :focus-visible))
+ .platforms
+ > .platform-item
+ + .platform-item {
+ margin-top: calc(2px * var(--sib, sibling-index()) - 24px);
+ }
+
+ .rail .host-list {
+ flex-direction: column;
+ align-items: center;
+ width: 48px;
+ min-height: 0;
+ margin-top: 0;
+ }
+
+ .rail-host {
+ width: 36px;
+ height: 36px;
+ }
+
+ .rail-host + .rail-host {
+ margin-top: -18px;
+ margin-left: 0;
+ }
+
+ /* Content from an overriding component, which knows nothing of the
+ pieces, keeps to the icon column too: a group's stack still opens the
+ whole component in its flyout, and a nav link is named by the
+ tooltip. (The built-in pieces ride the rail itself, unclipped.) */
+ :is(.rail-nav, .rail-follow-body, .rail-hosts-body) {
+ max-width: 48px;
+ overflow-x: clip;
+ }
+ }
+
+ /* ---------- Pieces ---------- */
+
+ .rail-toggle {
+ --icon-a: var(--muted);
+ --icon-b: var(--muted);
+ display: grid;
+ place-items: center;
+ padding: 0;
+ border: 0;
+ border-radius: 999px;
+ background: none;
+ color: var(--muted);
+ cursor: pointer;
+ }
+
+ .rail-toggle svg {
+ stroke: var(--icon-paint);
+ }
+
+ .rail-toggle:is(:hover, :focus-visible) {
+ --icon-a: var(--glow-a);
+ --icon-b: var(--glow-b);
+ background: var(--raised);
+ }
+
+ .rail-chevron {
+ transform-box: fill-box;
+ transform-origin: center;
+ transition: rotate calc(0.6s * var(--slomo)) var(--ease-spring);
+ }
+
+ /* Icons keep one inline offset in both forms, so only the box changes
+ around them and the labels leave or return. */
+ .rail-search .search-trigger {
+ height: 100%;
+ padding-inline: 14px;
+ overflow: clip;
+ white-space: nowrap;
+ }
+
+ .rail-search .search-trigger > * {
+ flex: none;
+ }
+
+ /* Pressable, so a pill; in the icon rail the same pill is a circle, its
+ 20px icon centred by the inset. */
+ .rail-nav a {
+ padding-inline: 14px;
+ border-radius: 999px;
+ overflow: clip;
+ white-space: nowrap;
+ }
+
+ /* A label too long for the open rail ends in an ellipsis; prop-for-that's
+ `truncated` reports it, and the link is then named by the tooltip. */
+ .rail-nav a > span {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ /* Labels return once the boxes have room, and leave at once. The form
+ reaches them through the nav's and search box's own properties (set in
+ the icon form below), never as a root-keyed rule on the labels: such a
+ rule's subject, :not(svg), gave Chrome nothing to aim its invalidation
+ at, so every change of the rail's form restyled the whole document. */
+ :is(.rail-nav a, .rail-search .search-trigger) > :not(svg) {
+ opacity: var(--rail-label-o, 1);
+ translate: var(--rail-label-x, 0) 0;
+ transition: var(
+ --rail-label-fade,
+ opacity calc(0.26s * var(--slomo)) ease calc(0.2s * var(--slomo)),
+ translate calc(0.4s * var(--slomo)) var(--ease-out)
+ calc(0.16s * var(--slomo))
+ );
+ }
+
+ /* The title and blurb keep the open width (never re-wrapping) and fade
+ where they stand; in the icon rail they take no room. */
+ .rail-about {
+ display: flex;
+ flex-direction: column;
+ gap: 1.25rem;
+ width: calc(var(--rail-open) - 44px);
+ transform-origin: 0 0;
+ transition:
+ opacity calc(0.3s * var(--slomo)) ease calc(0.2s * var(--slomo)),
+ scale calc(0.5s * var(--slomo)) var(--ease-out) calc(0.15s * var(--slomo)),
+ filter calc(0.4s * var(--slomo)) ease calc(0.15s * var(--slomo));
+ }
+
+ .rail .rail-label {
+ margin: 0;
+ padding: 0 0 10px;
+ line-height: 16px;
+ white-space: nowrap;
+ }
+
+ /* Faces are the shared people identity (people.css): a ringed circle,
+ 2px clear of the photo, with the hairline. Here the clear gap is filled
+ with Surface, so where the stack overlaps one face from the next. One
+ size in the open rail, stacked or fanned; a little smaller in the icon
+ rail's column. */
+ .rail-host .person-face {
+ --person-size: 40px;
+ margin: 0;
+ background: var(--surface);
+ }
+
+ .rail .rail-label {
+ --fade: calc(0.3s * var(--slomo)) ease calc(0.2s * var(--slomo));
+ }
+
+ /* Stacked, the names wait unseen (still the links' names) and leave at
+ once; the credit line speaks for them. */
+ .rail-host-name {
+ --fade: calc(0.1s * var(--slomo)) ease;
+ margin: 10px 0 0 52px;
+ white-space: nowrap;
+ opacity: 0;
+ pointer-events: none;
+ }
+
+ .host-credit {
+ --fade: calc(0.25s * var(--slomo)) ease calc(0.3s * var(--slomo));
+ --stack-w: calc(40px + (var(--stacked) - 1) * 28px);
+ display: flex;
+ align-items: center;
+ box-sizing: border-box;
+ width: calc(anchor-size(width) - var(--stack-w) - 10px);
+ min-height: 40px;
+ margin: 0 0 0 calc(var(--stack-w) + 10px);
+ color: var(--ink);
+ font-size: 0.8125rem;
+ font-weight: 650;
+ line-height: 1.25;
+ text-wrap: balance;
+ pointer-events: none;
+ }
+
+ .rail-host {
+ transition: background-color var(--quick);
+ }
+
+ .rail-host:is(:hover, :focus-visible) {
+ background: var(--raised);
+ }
+
+ :where(:root[data-rail-form='open'], :root:not([data-rail='collapsed']):not([data-rail-form])) {
+ :is(
+ .rail-hosts:is(:hover, :focus-within, [data-open]),
+ .rail-hosts:has(.is-fanned)
+ ) {
+ .rail-host-name {
+ --fade: calc(0.25s * var(--slomo)) ease
+ calc((0.3s + var(--rail-i) * 20ms) * var(--slomo));
+ opacity: 1;
+ pointer-events: auto;
+ }
+
+ .host-credit {
+ --fade: calc(0.1s * var(--slomo)) ease;
+ opacity: 0;
+ }
+ }
+ }
+
+ /* Collapsed, a stack is one button that opens its flyout. */
+ .rail-stack {
+ display: none;
+ padding: 0;
+ border: 0;
+ border-radius: 999px;
+ background: none;
+ cursor: pointer;
+ }
+
+ :where(:root[data-rail-form='icons'], :root[data-rail='collapsed']:not([data-rail-form])) {
+ .rail-chevron {
+ rotate: 180deg;
+ }
+
+ .rail-nav,
+ .rail-search {
+ --rail-label-o: 0;
+ --rail-label-x: -6px;
+ --rail-label-fade:
+ opacity calc(0.1s * var(--slomo)) ease,
+ translate calc(0.2s * var(--slomo)) ease;
+ }
+
+ /* Out of the column, where the open form had it, so the title and blurb
+ fade where they stand: in flow, the icon form's padding and its
+ taller head would move them 10px across and 16px down in the
+ collapse's first frame. */
+ .rail-about {
+ position: absolute;
+ top: calc(var(--open-top) + 72px + var(--open-gap));
+ left: var(--open-pad);
+ opacity: 0;
+ scale: 0.94;
+ filter: blur(4px);
+ visibility: hidden;
+ transition:
+ opacity calc(0.12s * var(--slomo)) ease,
+ scale calc(0.3s * var(--slomo)) ease,
+ filter calc(0.3s * var(--slomo)) ease,
+ visibility 0s calc(0.3s * var(--slomo));
+ }
+
+ :is(.rail .rail-label, .rail-host-name, .host-credit) {
+ --fade: calc(0.12s * var(--slomo)) ease;
+ opacity: 0;
+ visibility: hidden;
+ }
+
+ .rail .platform {
+ box-shadow: 0 0 0 2px var(--surface);
+ }
+
+ .rail-host .person-face {
+ --person-size: 36px;
+ }
+
+ .rail-stack {
+ display: block;
+ }
+ }
+}
+
+/* ---------- The rail follows the media and the pointer ---------- */
+
+@media (min-width: 1024px) {
+ /* While an episode is loaded the show art wears its progress as a ring:
+ lit while it plays, dim while paused; in the icon rail it is the
+ now-playing mark. The ring is a leaf that opts into the media clock
+ itself (data-props-for="media-clock" writes --live-progress and
+ --live-paused on it four times a second). On the art, an anchored
+ piece, each write re-laid every anchored box in the rail; on this leaf
+ it repaints the ring and nothing else. The drawing is its ::before, so
+ the style query reads the clock from the ring. Until there is media the
+ clock reads 0 and 0, so playing also waits for the player's attribute. */
+ .rail-ring {
+ position: absolute;
+ inset: -4px;
+ display: none;
+ pointer-events: none;
+ }
+
+ :root:not([data-episode=''])[data-episode] .rail-ring {
+ display: block;
+ }
+
+ .rail-ring::before {
+ content: '';
+ position: absolute;
+ inset: 0;
+ padding: 2px;
+ border-radius: 15px;
+ background: conic-gradient(
+ var(--accent) calc(var(--live-progress) * 1turn),
+ var(--line-strong) 0
+ );
+ mask:
+ linear-gradient(oklch(0% 0 0) 0 0) content-box,
+ linear-gradient(oklch(0% 0 0) 0 0);
+ mask-composite: exclude;
+ opacity: 0.45;
+ transition: opacity calc(0.4s * var(--slomo)) ease;
+ }
+
+ @container style(--live-paused: 0) {
+ :root[data-playing='true'] .rail-ring::before {
+ opacity: 1;
+ }
+ }
+
+ /* Held, the art's lean stands down: the hand is on the divider, and it
+ would only chase it across a rail that is moving. */
+ :root[data-rail-held] .rail-art .tilt {
+ --tilt-in: 0;
+ }
+}
+
+/* Without typed attr() the links stay in flow, but the nav's one highlight
+ still glides between them (as below, where it rides their slots): it
+ rides the hovered or focused link, or else the current page, and the
+ links keep only their ink. Without anchor positioning at all, each link
+ keeps its own hover and current fills (shell.css). */
+@supports (anchor-name: --a) and
+ (not (anchor-name: attr(data-a type()))) {
+ @media (min-width: 1024px) {
+ .rail-nav {
+ isolation: isolate;
+ }
+
+ .rail-nav a:is(:hover, :focus-visible),
+ .rail-nav:not(:has(a:is(:hover, :focus-visible))) a[aria-current='page'] {
+ anchor-name: --rail-hl;
+ }
+
+ /* (The link the collapsed rail's tooltip names keeps that anchor too.) */
+ .rail-nav a[data-tip-at]:is(:hover, :focus-visible),
+ .rail-nav:not(:has(a:is(:hover, :focus-visible)))
+ a[data-tip-at][aria-current='page'] {
+ anchor-name: --rail-hl, --rail-tip-at;
+ }
+
+ .rail-nav a,
+ .rail-nav a:hover,
+ .rail-nav a[aria-current='page'] {
+ background: none;
+ }
+
+ .rail-hl {
+ position: absolute;
+ position-anchor: --rail-hl;
+ position-visibility: anchors-valid;
+ top: anchor(top);
+ left: anchor(left);
+ z-index: -1;
+ width: anchor-size(width);
+ height: anchor-size(height);
+ border-radius: var(--radius);
+ background: var(--raised);
+ pointer-events: none;
+ transition:
+ top calc(0.3s * var(--slomo)) var(--ease-out),
+ left calc(0.3s * var(--slomo)) var(--ease-out),
+ width calc(0.3s * var(--slomo)) var(--ease-out),
+ height calc(0.3s * var(--slomo)) var(--ease-out),
+ background-color calc(0.2s * var(--slomo)) ease,
+ scale calc(0.35s * var(--slomo)) var(--ease-spring);
+ }
+
+ .rail-nav:not(:has(a:is(:hover, :focus-visible):not([aria-current])))
+ .rail-hl {
+ background: var(--accent-soft);
+ }
+
+ .rail-nav:has(a:active) .rail-hl {
+ scale: 0.97;
+ }
+ }
+}
+
+/* The travelling pieces need typed attr() for their anchors. Elsewhere the
+ same slots hold the pieces in flow: the rail still collapses and lays out,
+ it just doesn't travel. */
+@supports (anchor-name: attr(data-a type())) {
+ @media (min-width: 1024px) {
+ /* The rail rides the divider: pinned top, bottom and left, its right
+ side anchored to the line (data-⚓️-before), even while the line is
+ mid-glide on a transform. */
+ .rail {
+ position: fixed;
+ }
+
+ /* Under the hand nothing animates: the pieces follow the pane's width
+ directly. Only a re-form (crossing the threshold) travels. Nor does
+ the switch into anchoring for a re-form (data-anchoring, one style
+ flush): in flow a piece is 100% of its slot, anchored it is the
+ anchor's size, and eased between the two while anchored the 100%
+ resolves against the rail, so the art grew to the rail's whole box
+ and shrank back before travelling. */
+ .rail[data-held]:not([data-reforming]) [data-⚓️-to],
+ .rail[data-anchoring][data-reforming] [data-⚓️-to] {
+ transition-duration: 0s;
+ transition-delay: 0s;
+ }
+
+ .rail .platforms [data-⚓️-fill] {
+ width: anchor-size(width);
+ height: anchor-size(height);
+ }
+
+ /* The hosts fan out and gather down the column as well as across. */
+ .rail-host > [data-⚓️-to] {
+ --lag-y: var(--lag);
+ }
+
+ /* The shared face is position: relative; as a piece it rides its slot. */
+ .rail-host > .person-face {
+ position: absolute;
+ }
+
+ /* One highlight for the nav (island.html's track list): it glides to
+ the hovered or focused link, or else rests on the current page, and
+ gives a little under a press. It rides the links' slots, so in a
+ collapse it travels on its own clock beside the icons. The slotted
+ links keep only their ink; a link from an overriding InfoCard, outside
+ any slot, keeps its own hover and current fills. */
+ .rail-nav .rail-slot:has(> a:is(:hover, :focus-visible)),
+ .rail-nav:not(:has(a:is(:hover, :focus-visible)))
+ .rail-slot:has(> a[aria-current='page']) {
+ anchor-name: --slot, --rail-hl;
+ }
+
+ .rail-nav .rail-slot > a,
+ .rail-nav .rail-slot > a:hover,
+ .rail-nav .rail-slot > a[aria-current='page'] {
+ background: none;
+ }
+
+ .rail-hl {
+ position: absolute;
+ position-anchor: --rail-hl;
+ position-visibility: anchors-valid;
+ top: anchor(top);
+ left: anchor(left);
+ z-index: -1;
+ width: anchor-size(width);
+ height: anchor-size(height);
+ border-radius: 999px;
+ background: color-mix(in oklch, var(--raised) 60%, transparent);
+ pointer-events: none;
+ transition:
+ top calc(0.3s * var(--slomo)) var(--ease-out),
+ left calc(0.3s * var(--slomo)) var(--ease-out),
+ width calc(0.3s * var(--slomo)) var(--ease-out),
+ height calc(0.3s * var(--slomo)) var(--ease-out),
+ background-color calc(0.2s * var(--slomo)) ease,
+ scale calc(0.35s * var(--slomo)) var(--ease-spring);
+ }
+
+ .rail-nav:not(:has(a:is(:hover, :focus-visible):not([aria-current])))
+ .rail-hl {
+ background: color-mix(in oklch, var(--accent-soft) 80%, transparent);
+ }
+
+ .rail-nav:has(a:active) .rail-hl {
+ scale: 0.97;
+ }
+
+ /* Through a re-form the highlight rides its link's travelling box, not
+ the slot the link is bound for, and takes no glide of its own: on its
+ own clock it led the link, and mid-expand sat under the next one. */
+ .rail[data-reforming] .rail-nav {
+ .rail-slot:has(> a:is(:hover, :focus-visible)),
+ &:not(:has(a:is(:hover, :focus-visible)))
+ .rail-slot:has(> a[aria-current='page']) {
+ anchor-name: --slot;
+
+ > a {
+ anchor-name: --rail-hl;
+ }
+
+ > a[data-tip-at] {
+ anchor-name: --rail-hl, --rail-tip-at;
+ }
+ }
+
+ .rail-hl {
+ transition:
+ background-color calc(0.2s * var(--slomo)) ease,
+ scale calc(0.35s * var(--slomo)) var(--ease-spring);
+ }
+ }
+
+ /* Between the stops (under the hand, and through a glide either way)
+ the title and blurb shrink with the rail instead of being cut by its
+ edge: the width ratio via tan(atan2()), against the inner column. That
+ column is a size container for this one block only, so a frame of
+ drag re-evaluates one element rather than the rail. At either stop
+ they are full size. (100cqi is that column's content box, inside its
+ padding, which the forms set differently: the fit is taken from the
+ rail's own width, so the switch of form doesn't change it. Taken
+ from the column alone, less the padding a second time, it drew the
+ title at 81% at rest and grew it as a collapse began.) */
+ .rail-in {
+ container-type: inline-size;
+ }
+
+ .rail-about {
+ /* The rail's width (the column plus its padding, whichever form)
+ against the open one: the same number through the switch of form. */
+ transform: scale(
+ min(
+ 1,
+ tan(
+ atan2(
+ 100cqi + 2 * var(--pad) - 2 * var(--open-pad),
+ var(--rail-open) - 2 * var(--open-pad)
+ )
+ )
+ )
+ );
+ }
+
+ /* At rest and under the hand, the pieces that fill their slots sit in
+ them in flow; only a re-form (data-reforming: a toggle, a release, a
+ crossing) anchors them, so it travels. Chrome lays every anchored box
+ out again whenever anything on the page lays out, so pieces anchored
+ at rest cost every hover's layout about twice as much, page-wide.
+ Relative, not static, so what they hold (the art's ring, a mark's
+ halo) keeps them as its containing block. In the icon rail the follow
+ marks stay anchored at rest: hovering their deck fans them. */
+ .rail:not([data-reforming]) [data-⚓️-fill]:not(.rail-stack, .rail-hl) {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ /* Back into flow at once: the anchored size and the slot's 100% are
+ the same pixels, and easing between them would lay the rail out
+ every frame for nothing. */
+ transition:
+ background-color var(--quick),
+ color var(--quick),
+ opacity var(--fade, 0s),
+ visibility var(--fade, 0s);
+ }
+
+ :where(:root[data-rail-form='icons'], :root[data-rail='collapsed']:not([data-rail-form]))
+ .rail:not([data-held]):not([data-reforming])
+ .platforms
+ [data-⚓️-fill] {
+ position: absolute;
+ width: anchor-size(width);
+ height: anchor-size(height);
+ }
+
+ /* Expanding, the open form's slots are as wide as the column, which
+ widens with the rail every frame of the glide: a size that waits out
+ its stagger would restart the wait on each new target and stay put
+ until the rail lands, then snap open. Sizes there follow at once;
+ positions keep the stagger. */
+ :where(:root[data-rail-form='open'], :root:not([data-rail='collapsed']):not([data-rail-form]))
+ .rail {
+ --lag-size: 0s;
+ }
+
+ .rail[data-ready] [data-⚓️-to] {
+ --lag: calc(min(var(--rail-i) * 18ms, 144ms) * var(--slomo));
+ transition:
+ left calc(var(--flip-dx) * var(--slomo)) var(--flip-ex) var(--lag),
+ right calc(var(--flip-dx) * var(--slomo)) var(--flip-ex) var(--lag),
+ top calc(var(--flip-dy) * var(--slomo)) var(--flip-ey) var(--lag-y, 0s),
+ bottom calc(var(--flip-dy) * var(--slomo)) var(--flip-ey)
+ var(--lag-y, 0s),
+ width calc(var(--flip-ds) * var(--slomo)) var(--flip-es)
+ var(--lag-size, var(--lag)),
+ height calc(var(--flip-ds) * var(--slomo)) var(--flip-es)
+ var(--lag-size, var(--lag)),
+ border-radius calc(var(--flip-ds) * var(--slomo)) var(--flip-es)
+ var(--lag-size, var(--lag)),
+ background-color var(--quick),
+ color var(--quick),
+ opacity var(--fade, 0s),
+ visibility var(--fade, 0s);
+ }
+ }
+}
+
+@supports not (anchor-name: attr(data-a type())) {
+ @media (min-width: 1024px) {
+ /* The rail stays a sticky grid item and fills its column, which follows
+ the divider while it is held. */
+ .rail {
+ inset: auto;
+ top: 0;
+ }
+
+ .rail [data-⚓️-to] {
+ position: static;
+ }
+
+ /* Pieces that draw on absolute pseudo-elements stay position: relative
+ (a face's hairline and speaking light, a follow mark's halo), so the
+ drawing keeps to the piece rather than spreading over its block. */
+ .rail :is(.person-face, .platform) {
+ position: relative;
+ }
+
+ .rail [data-⚓️-fill] {
+ width: 100%;
+ height: 100%;
+ }
+
+ .rail-follow-body,
+ .rail .host-list {
+ min-height: 0;
+ margin-top: 0;
+ }
+
+ /* The stack and the rows without the travel: stacked, the names are
+ for assistive tech and the credit sits beside the faces, over the
+ rows' room kept below the stack, as it does on anchors. */
+ .rail-host {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ }
+
+ .rail .rail-host-name {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ margin: 0;
+ overflow: hidden;
+ clip-path: inset(50%);
+ }
+
+ :where(:root[data-rail-form='open'], :root:not([data-rail='collapsed']):not([data-rail-form])) {
+ .rail-hosts-in {
+ display: grid;
+ grid-template-columns: calc(40px + (var(--stacked) - 1) * 28px) 1fr;
+ column-gap: 10px;
+ }
+
+ .rail :is(.rail-label, .host-list) {
+ grid-column: 1 / -1;
+ }
+
+ .rail .host-list {
+ grid-row: 2;
+ min-height: calc(var(--hosts, 1) * 46px - 6px);
+ }
+
+ .rail .host-credit {
+ grid-row: 2;
+ grid-column: 2;
+ align-self: start;
+ width: auto;
+ margin: 0;
+ }
+
+ :is(
+ .rail-hosts:is(:hover, :focus-within, [data-open]),
+ .rail-hosts:has(.is-fanned)
+ ) {
+ .rail-host-name {
+ position: static;
+ width: auto;
+ height: auto;
+ overflow: visible;
+ clip-path: none;
+ }
+
+ .host-credit {
+ display: none;
+ }
+ }
+ }
+
+ :where(:root[data-rail-form='icons'], :root[data-rail='collapsed']:not([data-rail-form])) {
+ :is(.rail .rail-label, .rail-host-name, .host-credit) {
+ display: none;
+ }
+ }
+
+ .rail-art,
+ .rail-follow,
+ .rail-hosts {
+ position: relative;
+ }
+
+ .rail .rail-stack {
+ position: absolute;
+ inset: 0;
+ }
+ }
+
+ /* WebKit has anchor positioning, only not typed attr(): the flyouts and
+ the tooltip take plain anchor names, on the layout's own boxes, so they
+ still open beside what they name, and a flyout near the bottom flips
+ up as it does on attributes. */
+ @supports (anchor-name: --a) {
+ .rail-follow-body {
+ anchor-name: --rail-platforms;
+ }
+
+ .rail-hosts-body {
+ anchor-name: --rail-hosts;
+ }
+
+ #rail-follow-fly {
+ position-anchor: --rail-platforms;
+ }
+
+ #rail-hosts-fly {
+ position-anchor: --rail-hosts;
+ }
+
+ .rail-fly {
+ inset: auto;
+ top: anchor(top);
+ left: anchor(right);
+ position-try-fallbacks: flip-block, --rail-fly-fit;
+ }
+
+ .rail-tip {
+ position-anchor: --rail-tip-at;
+ left: anchor(right);
+ }
+ }
+}
+
+/* ---------- Names for the collapsed rail ---------- */
+
+/* One tooltip for every icon. Whichever icon it names owns the anchor, so
+ moving along the rail it glides from name to name on the anchor alone. */
+[data-tip-at] {
+ anchor-name: --rail-tip-at;
+}
+
+.rail-tip {
+ position: fixed;
+ top: anchor(center);
+ margin: 0 0 0 12px;
+ padding: 0;
+ border: 0;
+ background: none;
+ overflow: visible;
+ translate: 0 -50%;
+ pointer-events: none;
+ transition:
+ top calc(0.35s * var(--slomo)) var(--ease-out),
+ display calc(0.15s * var(--slomo)) allow-discrete,
+ overlay calc(0.15s * var(--slomo)) allow-discrete;
+}
+
+.rail-tip-box {
+ position: relative;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 6px 12px;
+ border-radius: var(--r-card);
+ background: var(--ink);
+ color: var(--on-ink);
+ font-size: 0.8125rem;
+ font-weight: 650;
+ line-height: 1.3;
+ white-space: nowrap;
+ box-shadow: var(--shadow-soft);
+ transition:
+ opacity calc(0.15s * var(--slomo)) ease,
+ translate calc(0.25s * var(--slomo)) var(--ease-out);
+}
+
+.rail-tip-box::before {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: -4px;
+ width: 8px;
+ height: 8px;
+ margin-top: -4px;
+ border-radius: 1px;
+ background: inherit;
+ rotate: 45deg;
+}
+
+.rail-tip-box kbd {
+ padding: 0 5px;
+ border-radius: 4px;
+ background: color-mix(in oklch, var(--on-ink) 16%, transparent);
+ font: inherit;
+ font-size: 0.75rem;
+}
+
+.rail-tip-box kbd:empty {
+ display: none;
+}
+
+.rail-tip:not(:popover-open) .rail-tip-box {
+ opacity: 0;
+ translate: -4px 0;
+}
+
+@starting-style {
+ .rail-tip:popover-open .rail-tip-box {
+ opacity: 0;
+ translate: -4px 0;
+ }
+}
+
+/* A stack's flyout hangs off the stack's top edge and points at its first
+ mark. Near the bottom of the screen it flips up (position-try), and the
+ flyout's own anchored container query moves the caret and the origin it
+ grows from to the bottom, where the stack's last mark is. The anchored box
+ never transforms; the box inside it does. Fixed, so the fallback is
+ chosen against the viewport rather than the whole scrolling page. */
+.rail-fly {
+ position: fixed;
+ margin: 0 0 0 14px;
+ padding: 0;
+ border: 0;
+ background: none;
+ color: var(--text);
+ overflow: visible;
+ transition:
+ display calc(0.2s * var(--slomo)) allow-discrete,
+ overlay calc(0.2s * var(--slomo)) allow-discrete;
+}
+
+/* A screen too short for the flyout either way up: it keeps inside it, and
+ its list scrolls (the box itself can't, or it would clip the caret). */
+.rail-fly[popover] {
+ position-try-fallbacks: flip-block, --rail-fly-fit;
+}
+
+@position-try --rail-fly-fit {
+ top: 8px;
+ bottom: auto;
+}
+
+/* Kept inside the screen, it no longer sits beside what it names: no caret. */
+@container anchored(fallback: --rail-fly-fit) {
+ .rail-fly-box::before {
+ display: none;
+ }
+}
+
+.rail-fly-box > :last-child {
+ min-height: 0;
+ overflow-y: auto;
+ overscroll-behavior: contain;
+}
+
+.rail-fly-box {
+ --caret: 10px;
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ max-height: calc(100dvh - 16px);
+ width: 15rem;
+ padding: 8px;
+ border: 1px solid var(--line);
+ border-radius: var(--r-card);
+ background: var(--surface);
+ box-shadow: var(--shadow-float);
+ transform-origin: 0 calc(var(--caret) + 6px);
+ transition:
+ opacity calc(0.2s * var(--slomo)) ease,
+ scale calc(0.4s * var(--slomo)) var(--ease-spring),
+ translate calc(0.3s * var(--slomo)) var(--ease-out);
+}
+
+.rail-fly-box::before {
+ content: '';
+ position: absolute;
+ top: var(--caret);
+ left: -7px;
+ width: 12px;
+ height: 12px;
+ border: solid var(--line);
+ border-width: 0 0 1px 1px;
+ border-radius: 0 0 0 2px;
+ background: var(--surface);
+ rotate: 45deg;
+}
+
+@container anchored(fallback: flip-block) {
+ .rail-fly-box {
+ transform-origin: 0 calc(100% - var(--caret) - 6px);
+ }
+
+ .rail-fly-box::before {
+ top: auto;
+ bottom: var(--caret);
+ }
+}
+
+/* The same, where the flip is measured as the flyout opens (WebKit has no
+ anchored container queries; Layout.astro sets data-flipped). */
+.rail-fly[data-flipped] .rail-fly-box {
+ transform-origin: 0 calc(100% - var(--caret) - 6px);
+}
+
+.rail-fly[data-flipped] .rail-fly-box::before {
+ top: auto;
+ bottom: var(--caret);
+}
+
+.rail-fly:not(:popover-open) .rail-fly-box {
+ opacity: 0;
+ scale: 0.9;
+ translate: -6px 0;
+}
+
+@starting-style {
+ .rail-fly:popover-open .rail-fly-box {
+ opacity: 0;
+ scale: 0.9;
+ translate: -6px 0;
+ }
+}
+
+.rail-fly-title {
+ margin: 6px 10px 4px;
+ color: var(--muted);
+ font-size: 0.75rem;
+ font-weight: 600;
+}
+
+/* Every flyout row is the same list row: 44px, a 32px leading circle (a
+ ringed face, or a platform's glyph on Ground), the name, a pill-shaped
+ hover 8px inside the flyout's corners. */
+.rail-fly .platforms {
+ flex-direction: column;
+ flex-wrap: nowrap;
+ gap: 0;
+}
+
+.rail-fly :is(.platform, .host-row) {
+ position: relative;
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+ gap: 12px;
+ box-sizing: border-box;
+ width: 100%;
+ min-height: 44px;
+ margin: 0;
+ padding: 6px 10px;
+ border: 0;
+ border-radius: calc(var(--r-card) - 8px);
+ background: none;
+ color: var(--ink);
+ font-weight: 600;
+ text-decoration: none;
+ transition: background-color var(--quick);
+}
+
+.rail-fly :is(.platform, .host-row):is(:hover, :focus-visible) {
+ background: var(--raised);
+}
+
+.rail-fly .platform::before {
+ content: '';
+ position: absolute;
+ top: 50%;
+ left: 10px;
+ width: 32px;
+ height: 32px;
+ margin-top: -16px;
+ border-radius: 50%;
+ background: var(--ground);
+ box-shadow: inset 0 0 0 1px var(--line);
+}
+
+.rail-fly .platform-icon {
+ position: relative;
+ margin-inline: 7px;
+}
+
+.rail-fly .host-row .person-face {
+ --person-size: 32px;
+ margin: 0;
+}
+
+/* Stacked, the hosts' names are hidden, so under reduced motion (which
+ otherwise shows a label by the name) the speaker's ring lights, at once. */
+@media (prefers-reduced-motion: reduce) {
+ .rail-host[data-speaking] .person-face::after {
+ opacity: 1;
+ transition: none;
+ }
+}
+
+/* A host speaking on the episode playing: their ring lights (people.css),
+ or under reduced motion a "Speaking" label follows their name. */
+:is(.rail-host-name, :is(.rail-fly, .sheet) .host-row) .person-speaking {
+ margin-left: 6px;
+ vertical-align: middle;
+}
+
+/* The rows follow the box in, one after another by their place in the list.
+ Without sibling-index() they arrive together, a beat behind the box. */
+.rail-fly :is(.platforms > li, .host-row) {
+ transition:
+ opacity calc(0.2s * var(--slomo)) ease,
+ translate calc(0.3s * var(--slomo)) var(--ease-out);
+}
+
+.rail-fly:popover-open :is(.platforms > li, .host-row) {
+ transition-delay: calc(40ms * var(--slomo));
+ transition-delay: calc(
+ min(40ms + (sibling-index() - 1) * 18ms, 160ms) * var(--slomo)
+ );
+}
+
+@starting-style {
+ .rail-fly:popover-open :is(.platforms > li, .host-row) {
+ opacity: 0;
+ translate: -4px 0;
+ }
+}
+
+/* ---------- Search: the command palette ---------- */
+
+/* The dialog covers the viewport (a click on it, outside the panel, closes
+ it) and is never transformed. The panel inside is the PropFLIP box that
+ grows out of the search trigger, its corners easing from the trigger's
+ pill to the panel's; its one child is un-squished (.fix-kids), so the
+ contents are revealed at full size rather than scaled. */
+.sp-pal {
+ --flip-dx: 0.5s;
+ --flip-ex: var(--ease-out);
+ --flip-dy: 0.6s;
+ --flip-ey: var(--ease-spring);
+ --flip-ds: 0.5s;
+ --flip-es: var(--ease-out);
+ position: fixed;
+ inset: 0;
+ width: 100%;
+ max-width: none;
+ height: 100%;
+ max-height: none;
+ margin: 0;
+ padding: max(10vh, env(safe-area-inset-top)) 16px 0;
+ border: 0;
+ background: none;
+ color: var(--text);
+}
+
+.sp-pal[open] {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
+
+.sp-pal::backdrop {
+ background: color-mix(in oklch, var(--ground) 70%, transparent);
+ backdrop-filter: blur(4px);
+ opacity: 0;
+ transition: opacity calc(0.3s * var(--slomo)) ease;
+}
+
+.sp-pal[data-state='open']::backdrop {
+ opacity: 1;
+}
+
+.sp-box {
+ --r: 20px;
+ --also: --r calc(var(--flip-ds) * var(--slomo)) var(--flip-es);
+ width: 100%;
+ max-width: 36rem;
+ overflow: clip;
+ background: var(--surface);
+ outline: 1px solid var(--line);
+ outline-offset: -1px;
+ box-shadow: var(--shadow-float);
+}
+
+.sp-pal[data-state='open'] .sp-box {
+ --r: var(--r-card);
+}
+
+.sp-field {
+ display: flex;
+ align-items: center;
+ padding-inline: 12px;
+ border-bottom: 1px solid var(--line);
+ transition: border-color 200ms var(--ease-out);
+}
+
+.sp-field:focus-within {
+ border-color: var(--accent);
+}
+
+/* A steady height, so the panel never jumps as the results change. */
+.sp-results {
+ position: relative;
+ height: min(20rem, 46dvh);
+ padding: 8px;
+ overflow-y: auto;
+ overscroll-behavior: contain;
+}
+
+/* Rows sit 8px inside the panel, so their corners are the panel's less 8. */
+.sp-row {
+ --r: var(--r-tile);
+ --also:
+ opacity calc(0.25s * var(--slomo)) ease,
+ translate calc(0.35s * var(--slomo)) var(--ease-out);
+ position: relative;
+ z-index: 1;
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ padding: 8px;
+ color: inherit;
+ text-decoration: none;
+ cursor: pointer;
+}
+
+/* Rows arrive and re-sort top to bottom, by their place among the results
+ (the highlight is the first child). Together without sibling-index(). */
+.sp-results > .sp-row {
+ transition-delay: 0s;
+ transition-delay: calc(
+ min((sibling-index() - 2) * 18ms, 126ms) * var(--slomo)
+ );
+}
+
+@starting-style {
+ .sp-row {
+ opacity: 0;
+ translate: 0 8px;
+ }
+}
+
+.sp-text {
+ display: grid;
+ flex: 1;
+ gap: 2px;
+ min-width: 0;
+}
+
+.sp-head {
+ display: flex;
+ align-items: baseline;
+ gap: 8px;
+ min-width: 0;
+}
+
+.sp-num {
+ color: var(--muted);
+ font-size: 0.75rem;
+ font-weight: 500;
+}
+
+.sp-title,
+.sp-desc {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.sp-title {
+ color: var(--ink);
+ font-size: 0.875rem;
+ font-weight: 500;
+}
+
+/* On a phone a title has two lines before it ends in an ellipsis. */
+@media (max-width: 639px) {
+ .sp-title {
+ display: -webkit-box;
+ white-space: normal;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 2;
+ }
+}
+
+/* Touch has no Escape key: a Cancel takes the key's place. (The field
+ gives way to it: an input's own minimum width would push it out of a
+ 320px phone's palette.) */
+.sp-field input {
+ min-width: 0;
+}
+
+.sp-cancel {
+ display: none;
+}
+
+@media (pointer: coarse) {
+ .sp-field .sp-esc {
+ display: none;
+ }
+
+ .sp-cancel {
+ display: inline-flex;
+ flex: none;
+ align-items: center;
+ min-height: 44px;
+ margin-inline-end: -8px;
+ padding-inline: 8px;
+ border: 0;
+ border-radius: var(--r-thumb);
+ background: none;
+ color: var(--accent-ink);
+ font: inherit;
+ font-size: 0.9375rem;
+ font-weight: 600;
+ cursor: pointer;
+ }
+}
+
+/* What the visitor typed stays plain; the completion is bold. */
+:is(.sp-title, .sp-name) b {
+ font-weight: 700;
+}
+
+/* "People" and "Episodes": sentence case captions over their rows. */
+.sp-group {
+ margin: 6px 8px 4px;
+ color: var(--muted);
+ font-size: 0.75rem;
+ font-weight: 600;
+}
+
+.sp-group:not(:nth-child(2)) {
+ margin-top: 12px;
+}
+
+/* A person: the shared 32px face, the name, and their fact line ("Host ·
+ 106 episodes"), which carries the count. */
+.sp-person {
+ min-height: 44px;
+ box-sizing: border-box;
+ padding-block: 4px;
+}
+
+.sp-name {
+ min-width: 0;
+ overflow: hidden;
+ color: var(--ink);
+ font-size: 0.875rem;
+ font-weight: 500;
+ line-height: 1.125rem;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.sp-desc {
+ color: var(--text);
+ font-size: 0.75rem;
+}
+
+/* A light follows the pointer across the panel, under the field and rows. */
+.sp-light {
+ position: absolute;
+ inset: 0;
+ z-index: -1;
+ background: radial-gradient(
+ 16rem circle at calc(var(--live-local-pointer-x-ratio) * 100%)
+ calc(var(--live-local-pointer-y-ratio) * 100%),
+ color-mix(in oklch, var(--glow-a) 14%, transparent),
+ transparent 70%
+ );
+ opacity: var(--live-local-pointer-inside);
+ pointer-events: none;
+ transition: opacity calc(0.3s * var(--slomo)) ease;
+}
+
+.sp-thumb {
+ flex: none;
+ width: 40px;
+ height: 40px;
+ border-radius: var(--r-thumb);
+ object-fit: cover;
+ outline: 1px solid var(--hairline);
+ outline-offset: -1px;
+}
+
+/* The selection is one anchored highlight: the selected row owns the anchor
+ name, and the highlight glides to it. */
+.sp-row[aria-selected='true'] {
+ anchor-name: --sp-on;
+}
+
+.sp-hl {
+ position: absolute;
+ position-anchor: --sp-on;
+ inset: anchor(inside);
+ width: anchor-size(width);
+ height: anchor-size(height);
+ border-radius: var(--r-tile);
+ background: color-mix(in oklch, var(--raised) 80%, transparent);
+ pointer-events: none;
+ transition:
+ inset calc(0.28s * var(--slomo)) var(--ease-out),
+ width calc(0.28s * var(--slomo)) var(--ease-out),
+ height calc(0.28s * var(--slomo)) var(--ease-out);
+}
+
+@supports not (anchor-name: --a) {
+ .sp-hl {
+ display: none;
+ }
+
+ /* Without anchor positioning a stack's flyout can't open beside its
+ stack: it opens in one fixed place beside the icon rail, low, where the
+ stacks are, with no caret to point at one. */
+ .rail-fly {
+ inset: auto auto 16px calc(var(--rail-shut) + 8px);
+ margin: 0;
+ }
+
+ .rail-fly-box::before {
+ display: none;
+ }
+
+ .sp-row[aria-selected='true'] {
+ background: var(--raised);
+ }
+}
+
+/* ---------- Small screens: the top bar and the sheets ---------- */
+
+/* At the top of the page the bar lies flat on it. Once the page scrolls
+ under it (the bar is stuck), it frosts over, gains its hairline, and the
+ show's mark tucks in. The bar's own height never changes. */
+@supports (container-type: scroll-state) {
+ .topbar {
+ container-type: scroll-state;
+ border-bottom-color: transparent;
+ background: none;
+ backdrop-filter: none;
+ }
+
+ .topbar::before {
+ content: '';
+ position: absolute;
+ inset: 0;
+ z-index: -1;
+ border-bottom: 1px solid var(--line);
+ background: color-mix(in oklch, var(--ground) 86%, transparent);
+ backdrop-filter: blur(14px) saturate(1.4);
+ opacity: 0;
+ transition: opacity calc(0.3s * var(--slomo)) ease;
+ }
+
+ .topbar-show img {
+ transform-origin: 0 50%;
+ transition: scale calc(0.45s * var(--slomo)) var(--ease-out);
+ }
+
+ @container scroll-state(stuck: top) {
+ .topbar::before {
+ opacity: 1;
+ }
+
+ .topbar-show img {
+ scale: 0.86;
+ }
+ }
+}
+
+/* ---------- Balanced rows ---------- */
+
+/* Rows of pills, balanced from the tree: no row more than one shorter than
+ another, the longer rows first, and never a lone item at the end when a
+ row can take one more. Each item works out how many share its row from
+ sibling-index() and sibling-count() and the list's --balance-max (how
+ many fit across). Six make 3 + 3, five 3 + 2, seven 4 + 3, eight 4 + 4,
+ four or fewer one row. */
+@supports (z-index: sibling-count()) {
+ .platforms > li {
+ --bal-n: sibling-count();
+ --bal-i: calc(sibling-index() - 1);
+ --bal-rows: round(up, var(--bal-n) / var(--balance-max, 4));
+ --bal-base: round(down, var(--bal-n) / var(--bal-rows));
+ --bal-extra: calc(var(--bal-n) - var(--bal-base) * var(--bal-rows));
+ --bal-cut: calc(var(--bal-extra) * (var(--bal-base) + 1));
+ /* 0 in the longer rows, 1 in the shorter ones after them */
+ --bal-late: sign(max(var(--bal-i) - var(--bal-cut) + 1, 0));
+ /* how many share this item's row */
+ --bal-per-row: calc(var(--bal-base) + 1 - var(--bal-late));
+ }
+}
+
+/* The hairline over the show's art, wherever the shell shows it. */
+:is(.show-art, .topbar-show) img {
+ outline: 1px solid var(--hairline);
+ outline-offset: -1px;
+}
+
+/* ---------- Sheets: the tray radius, a round close, nested lists ---------- */
+
+.sheet {
+ border-radius: var(--r-tray) var(--r-tray) 0 0;
+ overscroll-behavior: contain;
+}
+
+/* An open sheet holds the page still. A sheet rarely overflows, so a swipe
+ on it (or on its scrim) found nothing to scroll there and scrolled the
+ page behind instead. */
+:root:has(.sheet:popover-open) {
+ overflow: hidden;
+}
+
+.sheet-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ margin: -8px 0 12px;
+}
+
+.sheet-head .sheet-title {
+ margin: 0;
+}
+
+.sheet-close {
+ display: grid;
+ flex: none;
+ place-items: center;
+ width: 44px;
+ height: 44px;
+ padding: 0;
+ border: 0;
+ border-radius: 50%;
+ background: var(--raised);
+ color: var(--ink);
+ cursor: pointer;
+ transition: background-color var(--quick);
+}
+
+.sheet-close:is(:hover, :focus-visible) {
+ background: color-mix(in oklch, var(--raised) 80%, var(--line-strong));
+}
+
+/* A link list is a panel nested in the sheet (4px in, so its rows' corners
+ are the panel's less 4), 48px rows with a 32px leading circle. */
+.sheet-nav {
+ gap: 0;
+ padding: 4px;
+ border-radius: var(--r-tray);
+ background: var(--raised);
+}
+
+.sheet-nav a {
+ gap: 12px;
+ box-sizing: border-box;
+ min-height: 48px;
+ padding: 8px 12px 8px 8px;
+ border-radius: calc(var(--r-tray) - 4px);
+ transition:
+ background-color var(--quick),
+ color var(--quick);
+}
+
+.sheet-nav a:hover {
+ background: color-mix(in oklch, var(--surface) 70%, transparent);
+}
+
+.sheet-nav a svg {
+ box-sizing: border-box;
+ width: 32px;
+ height: 32px;
+ padding: 6px;
+ border-radius: 50%;
+ background: var(--surface);
+}
+
+.sheet .platform {
+ min-height: 44px;
+}
+
+/* The hosts, under the follow marks: titled like that group, their rows a
+ panel like the links above (48px, a 32px face). */
+.sheet .rail-fly-title {
+ margin: 0 0 0.6rem;
+ font-weight: 650;
+ letter-spacing: 0.04em;
+}
+
+.sheet .host-list {
+ display: flex;
+ flex-direction: column;
+ padding: 4px;
+ border-radius: var(--r-tray);
+ background: var(--raised);
+}
+
+.sheet .host-row {
+ gap: 12px;
+ box-sizing: border-box;
+ min-height: 48px;
+ margin: 0;
+ padding: 8px 12px 8px 8px;
+ border-radius: calc(var(--r-tray) - 4px);
+ text-decoration: none;
+ transition: background-color var(--quick);
+}
+
+.sheet .host-row:hover {
+ background: color-mix(in oklch, var(--surface) 70%, transparent);
+}
+
+.sheet .host-row .person-face {
+ --person-size: 32px;
+}
+
+/* The follow sheet's labelled pills: two to a row on a phone, three where
+ there is room, each row filled edge to edge. Without sibling-count() the
+ same grid without the balance. */
+.sheet .platforms {
+ --balance-max: 2;
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
+}
+
+@media (min-width: 560px) {
+ .sheet .platforms {
+ --balance-max: 3;
+ }
+}
+
+/* A name keeps to one line, so a row's pills stay one height: under
+ 360px a pill's padding, gap and type tighten for "Apple Podcasts" to fit
+ half a 320px phone. */
+.sheet .platform-name {
+ white-space: nowrap;
+}
+
+@media (max-width: 359px) {
+ .sheet .platform {
+ gap: 6px;
+ padding-inline: 0.65rem;
+ }
+
+ .sheet .platform-name {
+ font-size: 0.8125rem;
+ }
+}
+
+.sheet .platform {
+ justify-content: center;
+}
+
+@supports (z-index: sibling-count()) {
+ .sheet .platforms {
+ display: flex;
+ }
+
+ .sheet .platforms > li {
+ /* A hair under the share, then grow: a row never overfills by rounding. */
+ flex: 1 0
+ calc((100% - (var(--bal-per-row) - 1) * 8px) / var(--bal-per-row) - 1px);
+ }
+
+ .sheet .platforms .platform {
+ width: 100%;
+ }
+}
+
+/* The collapsed rail's flyout lists them one to a row, labelled; one is
+ always balanced. */
+
+/* A sheet's scrim fades with it, and its contents rise in behind it, one
+ after another. */
+.sheet::backdrop {
+ opacity: 0;
+ transition:
+ opacity calc(0.42s * var(--slomo)) ease,
+ display calc(0.42s * var(--slomo)) allow-discrete,
+ overlay calc(0.42s * var(--slomo)) allow-discrete;
+}
+
+.sheet:popover-open::backdrop {
+ opacity: 1;
+}
+
+@starting-style {
+ .sheet:popover-open::backdrop {
+ opacity: 0;
+ }
+}
+
+.sheet > * {
+ transition:
+ opacity calc(0.3s * var(--slomo)) ease,
+ translate calc(0.5s * var(--slomo)) var(--ease-out);
+ transition-delay: calc(100ms * var(--slomo));
+ transition-delay: calc(
+ min(60ms + 40ms * sibling-index(), 220ms) * var(--slomo)
+ );
+}
+
+@starting-style {
+ .sheet:popover-open > * {
+ opacity: 0;
+ translate: 0 14px;
+ }
+}
diff --git a/packages/starpod/src/styles/shell.css b/packages/starpod/src/styles/shell.css
new file mode 100644
index 00000000..032c0534
--- /dev/null
+++ b/packages/starpod/src/styles/shell.css
@@ -0,0 +1,1069 @@
+/* ---------- App shell: rail, top bar, main, tab bar, dock, sheets ---------- */
+
+.skip-link {
+ position: fixed;
+ top: 8px;
+ left: 8px;
+ z-index: 100;
+ padding: 0.6rem 1rem;
+ border-radius: var(--radius);
+ background: var(--ink);
+ color: var(--on-ink);
+ translate: 0 -200%;
+ transition: translate 200ms var(--ease-out);
+}
+
+.skip-link:focus {
+ translate: 0 0;
+}
+
+/* The player is there only while an episode is loaded (the island renders
+ nothing before), so its skip link waits for one. */
+:root:is(:not([data-episode]), [data-episode='']) .skip-link[href='#player'] {
+ display: none;
+}
+
+.app {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr);
+ align-content: start;
+ min-height: 100dvh;
+}
+
+@media (min-width: 1024px) {
+ .app {
+ grid-template-columns: var(--rail-w) minmax(0, 1fr);
+ }
+}
+
+/* Rail (desktop): everything a visitor came for, always on screen. */
+.rail {
+ display: none;
+}
+
+@media (min-width: 1024px) {
+ .rail {
+ position: sticky;
+ top: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 1.25rem;
+ height: 100dvh;
+ padding: 28px 22px calc(var(--dock-h) + 20px);
+ border-right: 1px solid var(--line);
+ background: var(--surface);
+ overflow-x: hidden;
+ overflow-y: auto;
+ scrollbar-width: none;
+ }
+
+ .topbar,
+ .tabbar {
+ display: none !important;
+ }
+}
+
+.rail > * {
+ flex-shrink: 0;
+}
+
+.rail-title {
+ margin: 0;
+ color: var(--ink);
+ font-family: var(--font-display);
+ font-size: 1.3rem;
+ font-weight: 700;
+ line-height: 1.15;
+ letter-spacing: -0.015em;
+}
+
+.rail-title a {
+ text-decoration: none;
+}
+
+.rail-blurb {
+ margin: -0.6rem 0 0;
+ color: var(--muted);
+ font-size: 0.875rem;
+ line-height: 1.45;
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+}
+
+.search-trigger {
+ display: flex;
+ align-items: center;
+ gap: 0.6rem;
+ width: 100%;
+ padding: 0.6rem 0.75rem;
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ background: var(--ground);
+ color: var(--muted);
+ font: inherit;
+ font-size: 0.875rem;
+ cursor: pointer;
+ transition: color 200ms var(--ease-out);
+}
+
+@media (hover: hover) {
+ .search-trigger:hover {
+ color: var(--text);
+ }
+}
+
+.search-trigger kbd {
+ margin-left: auto;
+ padding: 0.1rem 0.4rem;
+ border: 1px solid var(--line);
+ border-radius: 6px;
+ font: inherit;
+ font-size: 0.75rem;
+}
+
+.rail-nav,
+.sheet-nav {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+}
+
+.rail-nav a,
+.sheet-nav a {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+ padding: 0.55rem 0.7rem;
+ border-radius: var(--radius);
+ color: var(--text);
+ font-weight: 600;
+ text-decoration: none;
+ transition:
+ background 200ms var(--ease-out),
+ color 200ms var(--ease-out);
+}
+
+.rail-nav a svg,
+.sheet-nav a svg {
+ flex: none;
+ color: var(--muted);
+}
+
+.rail-nav a:hover,
+.sheet-nav a:hover {
+ background: var(--raised);
+ color: var(--ink);
+}
+
+.rail-nav a[aria-current='page'],
+.sheet-nav a[aria-current='page'] {
+ background: var(--accent-soft);
+ color: var(--accent-ink);
+}
+
+.rail-nav a[aria-current='page'] svg {
+ color: var(--accent-ink);
+}
+
+.rail-follow {
+ margin-top: auto;
+}
+
+.rail-label {
+ margin: 0 0 0.6rem;
+ color: var(--muted);
+ font-size: 0.75rem;
+ font-weight: 650;
+ letter-spacing: 0.04em;
+}
+
+.platforms {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.platform {
+ display: grid;
+ place-items: center;
+ width: 40px;
+ height: 40px;
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ background: var(--ground);
+}
+
+.platform-icon {
+ display: block;
+ width: 18px;
+ height: 18px;
+ background: var(--text);
+ mask-size: contain;
+ mask-repeat: no-repeat;
+ mask-position: center;
+ transition: background 300ms var(--ease-out);
+}
+
+.platform-name {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ overflow: hidden;
+ clip: rect(0, 0, 0, 0);
+}
+
+:root[data-world='stage'] [data-world-link='stage'] {
+ background: var(--ink);
+ color: var(--on-ink);
+}
+
+/* Top bar (phones, tablets, foldables). */
+.topbar {
+ position: sticky;
+ top: 0;
+ z-index: 30;
+ grid-column: 1 / -1;
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ height: var(--topbar-h);
+ padding: 0 var(--gutter);
+ padding-top: env(safe-area-inset-top);
+ box-sizing: content-box;
+ background: color-mix(in oklch, var(--ground) 86%, transparent);
+ backdrop-filter: blur(14px) saturate(1.4);
+ border-bottom: 1px solid var(--line);
+}
+
+.topbar-show {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ min-width: 0;
+ color: var(--ink);
+ font-weight: 700;
+}
+
+.topbar-art {
+ flex: none;
+ width: 36px;
+}
+
+.topbar-show :is(.tilt-body, img) {
+ border-radius: 8px;
+}
+
+.topbar-title {
+ overflow: hidden;
+ text-decoration: none;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.topbar-follow {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin-left: auto;
+ padding: 0.5rem 0.9rem;
+ border: 0;
+ border-radius: 999px;
+ background: var(--ink);
+ color: var(--on-ink);
+ font: inherit;
+ font-size: 0.875rem;
+ font-weight: 650;
+ cursor: pointer;
+}
+
+/* Main column. */
+.main {
+ min-width: 0;
+ /* Stage light may spill past the column; it never scrolls the page. */
+ overflow-x: clip;
+ padding: var(--gutter) var(--gutter) calc(var(--dock-h) + var(--tabbar-h) + 48px);
+}
+
+@media (min-width: 1024px) {
+ .main {
+ grid-column: 2;
+ padding-bottom: calc(var(--dock-h) + 64px);
+ }
+}
+
+.main-page {
+ max-width: 1280px;
+}
+
+.main:has(.stage[data-variant='page']) .crumbs {
+ display: none;
+}
+
+.crumbs {
+ margin-bottom: 1.25rem;
+ font-size: 0.8125rem;
+}
+
+/* On touch a crumb's link is 44px tall, its line where it was. */
+@media (pointer: coarse) {
+ .crumbs a {
+ margin-block: -12px;
+ padding-block: 12px;
+ }
+}
+
+
+.section-title {
+ display: flex;
+ align-items: baseline;
+ gap: 0.6rem;
+ margin: 0 0 1.25rem;
+ font-family: var(--font-display);
+ font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.75rem);
+ font-weight: 700;
+ letter-spacing: -0.015em;
+ line-height: 1.15;
+}
+
+.section-count {
+ color: var(--muted);
+ font-size: 0.9rem;
+ font-weight: 500;
+}
+
+/* Tab bar (phones, tablets). */
+.tabbar {
+ position: fixed;
+ inset: auto 0 0;
+ z-index: 40;
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ height: var(--tabbar-h);
+ padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom)
+ env(safe-area-inset-left);
+ box-sizing: border-box;
+ background: var(--surface);
+ border-top: 1px solid var(--line);
+}
+
+.tabbar > a,
+.tabbar > button,
+.tabbar astro-island > button {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 3px;
+ width: 100%;
+ height: 100%;
+ border: 0;
+ background: none;
+ color: var(--muted);
+ font: inherit;
+ font-size: 0.6875rem;
+ font-weight: 650;
+ text-decoration: none;
+ cursor: pointer;
+}
+
+.rail-nav astro-island,
+.tabbar astro-island {
+ display: contents;
+}
+
+.tabbar [aria-current='page'] {
+ color: var(--accent-ink);
+}
+
+/* Below the desktop form, whatever the browser scrolls into view (a
+ focused field, find in page, a skip link's target) clears the stuck top
+ bar and the tab bar, and the dock once an episode is loaded. The amounts
+ are tokens, 0 on the desktop form, for a target that sets its own
+ scroll-margin past the bars to subtract. */
+:root {
+ --scroll-pad-top: 0px;
+ --scroll-pad-bottom: 0px;
+}
+
+@media (max-width: 1023px) {
+ :root {
+ --scroll-pad-top: calc(var(--topbar-h) + env(safe-area-inset-top) + 8px);
+ --scroll-pad-bottom: calc(var(--tabbar-h) + 8px);
+ scroll-padding: var(--scroll-pad-top) 0 var(--scroll-pad-bottom);
+ }
+
+ :root[data-episode]:not([data-episode='']) {
+ --scroll-pad-bottom: calc(var(--tabbar-h) + var(--dock-h) + 8px);
+ }
+}
+
+/* Landscape phones, a short screen: the top bar scrolls away with the page
+ instead of holding 60px of it, and the tab bar is one 48px line, each
+ tab's icon beside its label. (The query every part of the site uses for
+ this form.) */
+@media (orientation: landscape) and (max-height: 500px) {
+ /* Only where there is a tab bar: a short desktop window keeps its form. */
+ @media (max-width: 1023px) {
+ :root {
+ --tabbar-h: calc(48px + env(safe-area-inset-bottom));
+ }
+ }
+
+ .topbar {
+ position: relative;
+ }
+
+ @media (max-width: 1023px) {
+ :root {
+ --scroll-pad-top: calc(env(safe-area-inset-top) + 8px);
+ }
+ }
+
+ .tabbar > a,
+ .tabbar > button,
+ .tabbar astro-island > button {
+ flex-direction: row;
+ gap: 8px;
+ font-size: 0.75rem;
+ }
+}
+
+/* The 404's art keeps to its column. */
+.four-zero-four svg {
+ max-width: 100%;
+ height: auto;
+}
+
+/* The 404's helpful links: on touch, 44px pills in a wrapping row. */
+@media (pointer: coarse) {
+ .nf-links ul {
+ gap: 8px;
+ }
+
+ .nf-links a {
+ display: inline-flex;
+ align-items: center;
+ min-height: 44px;
+ padding-inline: 16px;
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ background: var(--surface);
+ text-decoration: none;
+ }
+}
+
+/* Bottom sheets (native popovers). */
+.sheet {
+ inset: auto 0 0;
+ width: 100%;
+ max-width: 560px;
+ max-height: 80dvh;
+ margin: 0 auto;
+ padding: 22px var(--gutter) calc(28px + env(safe-area-inset-bottom));
+ box-sizing: border-box;
+ border: 1px solid var(--line);
+ border-bottom: 0;
+ border-radius: 22px 22px 0 0;
+ background: var(--surface);
+ color: var(--text);
+ box-shadow: var(--shadow-float);
+ overflow: auto;
+ translate: 0 0;
+ transition:
+ translate calc(420ms * var(--slomo)) var(--ease-out),
+ display calc(420ms * var(--slomo)) allow-discrete,
+ overlay calc(420ms * var(--slomo)) allow-discrete;
+}
+
+.sheet:not(:popover-open) {
+ translate: 0 105%;
+}
+
+@starting-style {
+ .sheet:popover-open {
+ translate: 0 105%;
+ }
+}
+
+.sheet::backdrop {
+ background: oklch(10% 0.02 280 / 0.45);
+}
+
+.sheet-title {
+ margin: 0 0 1rem;
+ color: var(--ink);
+ font-size: 1.05rem;
+ font-weight: 700;
+}
+
+.sheet .platforms {
+ margin-bottom: 1.25rem;
+}
+
+/* Labelled pills: the follow sheet and the collapsed rail's flyout. */
+:is(.sheet, .rail-fly) .platform {
+ width: auto;
+ height: auto;
+ display: flex;
+ gap: 0.5rem;
+ padding: 0.6rem 0.9rem;
+}
+
+:is(.sheet, .rail-fly) .platform-name {
+ position: static;
+ width: auto;
+ height: auto;
+ overflow: visible;
+ clip: auto;
+ font-size: 0.875rem;
+ font-weight: 600;
+}
+
+.sheet-nav {
+ margin-bottom: 1.25rem;
+}
+
+.icon-button {
+ display: grid;
+ place-items: center;
+ width: 40px;
+ height: 40px;
+ border: 0;
+ border-radius: 999px;
+ background: none;
+ color: var(--text);
+ cursor: pointer;
+ transition:
+ background 200ms var(--ease-out),
+ color 200ms var(--ease-out);
+}
+
+.text-button {
+ min-width: 48px;
+ height: 34px;
+ padding: 0 0.6rem;
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ background: none;
+ color: var(--text);
+ font: inherit;
+ font-size: 0.8125rem;
+ font-weight: 650;
+ font-variant-numeric: tabular-nums;
+ cursor: pointer;
+ transition:
+ background 200ms var(--ease-out),
+ color 200ms var(--ease-out);
+}
+
+.text-button:hover {
+ color: var(--ink);
+}
+
+.dock-play {
+ display: grid;
+ place-items: center;
+ width: 44px;
+ height: 44px;
+ border: 0;
+ border-radius: 999px;
+ background: var(--ink);
+ color: var(--on-ink);
+ cursor: pointer;
+ transition: transform 300ms var(--ease-spring);
+}
+
+.dock-play:active {
+ transform: scale(0.92);
+}
+
+/* Every play button (PlayToggle) carries its own buffering ring, anchored
+ here so it can never escape to a distant positioned ancestor. */
+.play-toggle {
+ position: relative;
+}
+
+.play-toggle[data-buffering]::before {
+ content: '';
+ position: absolute;
+ inset: -4px;
+ border-radius: inherit;
+ border: 2px solid transparent;
+ border-top-color: var(--accent);
+ pointer-events: none;
+ animation: spin 900ms linear infinite;
+}
+
+@keyframes spin {
+ to {
+ rotate: 360deg;
+ }
+}
+
+.scrubber {
+ flex: 1;
+ height: 20px;
+ margin: 0;
+ background: transparent;
+ appearance: none;
+ cursor: pointer;
+ --fill: 0%;
+}
+
+.scrubber::-webkit-slider-runnable-track {
+ height: 4px;
+ border-radius: 4px;
+ background: linear-gradient(90deg, var(--glow-b), var(--glow-a)) 0 0 / var(--fill) 100% no-repeat,
+ var(--line);
+}
+
+.scrubber::-moz-range-track {
+ height: 4px;
+ border-radius: 4px;
+ background: linear-gradient(90deg, var(--glow-b), var(--glow-a)) 0 0 / var(--fill) 100% no-repeat,
+ var(--line);
+}
+
+.scrubber::-webkit-slider-thumb {
+ width: 14px;
+ height: 14px;
+ margin-top: -5px;
+ border: 0;
+ border-radius: 999px;
+ background: var(--ink);
+ appearance: none;
+ transition: transform 200ms var(--ease-spring);
+}
+
+.scrubber::-moz-range-thumb {
+ width: 14px;
+ height: 14px;
+ border: 0;
+ border-radius: 999px;
+ background: var(--ink);
+}
+
+.scrubber:hover::-webkit-slider-thumb {
+ transform: scale(1.25);
+}
+
+/* ---------- Medium switch ---------- */
+
+.medium-switch {
+ position: relative;
+ display: inline-grid;
+ grid-template-columns: 1fr 1fr;
+ padding: 3px;
+ border: 1px solid var(--line-strong);
+ border-radius: 999px;
+ background: var(--ground);
+}
+
+.medium-option {
+ position: relative;
+ z-index: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ padding: 0.45rem 0.9rem;
+ border: 0;
+ border-radius: 999px;
+ background: none;
+ color: var(--muted);
+ font: inherit;
+ font-size: 0.875rem;
+ font-weight: 650;
+ cursor: pointer;
+ transition: color 300ms var(--ease-out);
+}
+
+.medium-option[aria-checked='true'] {
+ color: var(--on-ink);
+}
+
+.medium-thumb {
+ position: absolute;
+ inset: 3px auto 3px 3px;
+ width: calc(50% - 3px);
+ border-radius: 999px;
+ background: var(--ink);
+ transition: translate 520ms var(--ease-spring);
+}
+
+.medium-switch:has(.medium-option:last-of-type[aria-checked='true']) .medium-thumb {
+ translate: 100% 0;
+}
+
+.medium-switch[data-compact] .medium-option {
+ padding: 0.3rem 0.65rem;
+ font-size: 0.75rem;
+}
+
+/* ---------- Buttons ---------- */
+
+.button-primary,
+.button-secondary {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.55rem;
+ padding: 0.75rem 1.25rem;
+ border-radius: 999px;
+ font: inherit;
+ font-size: 0.9375rem;
+ font-weight: 700;
+ text-decoration: none;
+ cursor: pointer;
+ transition: transform 300ms var(--ease-spring);
+}
+
+.button-primary {
+ border: 0;
+ background: var(--ink);
+ color: var(--on-ink);
+}
+
+.button-secondary {
+ border: 1px solid var(--line-strong);
+ background: var(--surface);
+ color: var(--ink);
+}
+
+.button-primary:active,
+.button-secondary:active {
+ transform: scale(0.97);
+}
+
+/* ---------- Empty states ---------- */
+
+.empty {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 1rem;
+ padding: 2rem 0 3rem;
+ color: var(--text);
+ text-align: center;
+}
+
+.empty-art {
+ width: min(280px, 70vw);
+}
+
+/* ---------- Search dialog: keep it in the palette ---------- */
+
+[role='dialog'] input[type='search'],
+[role='dialog'] input[type='text'] {
+ font-family: var(--font-ui);
+}
+
+/* ---------- Play glyph and on-air bars ---------- */
+
+.glyph {
+ display: grid;
+ place-items: center;
+}
+
+.glyph[data-swap] {
+ animation: glyph-in 380ms var(--ease-spring) both;
+}
+
+@keyframes glyph-in {
+ from {
+ opacity: 0;
+ scale: 0.45;
+ rotate: -24deg;
+ }
+}
+
+/* Live levels on the row that is playing; the pause glyph waits underneath
+ for a hover or focus. */
+.row-play > * {
+ grid-area: 1 / 1;
+}
+
+.onair {
+ display: flex;
+ align-items: flex-end;
+ gap: 2.5px;
+ height: 14px;
+ transition:
+ opacity 200ms var(--ease-out),
+ scale 260ms var(--ease-out);
+}
+
+.onair i {
+ width: 3px;
+ height: 100%;
+ border-radius: 1.5px;
+ background: currentColor;
+ transform-origin: 50% 100%;
+ animation: onair 820ms ease-in-out infinite alternate;
+}
+
+.onair i:nth-child(2) {
+ animation-duration: 560ms;
+ animation-delay: -240ms;
+}
+
+.onair i:nth-child(3) {
+ animation-duration: 700ms;
+ animation-delay: -460ms;
+}
+
+@keyframes onair {
+ from {
+ scale: 1 0.22;
+ }
+
+ to {
+ scale: 1 1;
+ }
+}
+
+:root:not([data-playing='true']) .onair i {
+ animation-play-state: paused;
+}
+
+/* Off screen the bars rest: a view timeline marks the bars' box as seen
+ only while it is in the viewport, and the bars run only then. */
+@property --onair-seen {
+ syntax: '';
+ inherits: true;
+ initial-value: 0;
+}
+
+@keyframes onair-seen {
+ from,
+ to {
+ --onair-seen: 1;
+ }
+}
+
+@supports (animation-timeline: view()) {
+ .onair {
+ animation: onair-seen linear none;
+ animation-timeline: view();
+ animation-range: cover;
+ }
+
+ @container style(--onair-seen: 0) {
+ .onair i {
+ animation-play-state: paused;
+ }
+ }
+}
+
+.onair + .glyph {
+ opacity: 0;
+ scale: 0.6;
+ transition:
+ opacity 200ms var(--ease-out),
+ scale 260ms var(--ease-spring);
+}
+
+.row-play:is(:hover, :focus-visible) .onair {
+ opacity: 0;
+ scale: 0.6;
+}
+
+.row-play:is(:hover, :focus-visible) .onair + .glyph {
+ opacity: 1;
+ scale: 1;
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .onair i {
+ animation: none;
+ }
+
+ .onair i:nth-child(1) {
+ scale: 1 0.55;
+ }
+
+ .onair i:nth-child(3) {
+ scale: 1 0.75;
+ }
+}
+
+/* ---------- Scrubber preview ---------- */
+
+.scrub-preview {
+ position: fixed;
+ top: var(--top, 100vh);
+ left: var(--x, 50vw);
+ z-index: 60;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ box-sizing: border-box;
+ width: max-content;
+ max-width: min(320px, calc(100vw - 24px));
+ padding: 10px 13px 11px;
+ border: 1px solid var(--line);
+ border-radius: 12px;
+ background: var(--surface);
+ box-shadow: var(--shadow-float);
+ opacity: 0;
+ scale: 0.94;
+ transform-origin: 50% 100%;
+ translate: -50% calc(-100% - 14px);
+ pointer-events: none;
+ transition:
+ opacity 160ms var(--ease-out),
+ scale 240ms var(--ease-out);
+}
+
+.scrub-preview[data-open] {
+ opacity: 1;
+ scale: 1;
+}
+
+.scrub-preview-time {
+ color: var(--accent-ink);
+ font-size: 0.75rem;
+ font-weight: 700;
+ font-variant-numeric: tabular-nums;
+}
+
+.scrub-preview-name {
+ color: var(--muted);
+ font-weight: 600;
+}
+
+.scrub-preview-line {
+ display: -webkit-box;
+ overflow: hidden;
+ color: var(--ink);
+ font-size: 0.875rem;
+ line-height: 1.35;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 3;
+ text-wrap: pretty;
+}
+
+/* ---------- Page transitions ---------- */
+
+/* The app frame holds still; only the page moves. */
+.rail {
+ view-transition-name: rail;
+}
+
+/* The top bar is named only through a page transition: a named element is a
+ backdrop root, so at rest the name kept its glass from frosting the page
+ under it. */
+:root[data-astro-transition] .topbar {
+ view-transition-name: topbar;
+}
+
+.tabbar {
+ view-transition-name: tabbar;
+}
+
+:root::view-transition-old(rail),
+:root::view-transition-new(rail),
+:root::view-transition-old(topbar),
+:root::view-transition-new(topbar),
+:root::view-transition-old(tabbar),
+:root::view-transition-new(tabbar) {
+ animation-duration: 180ms;
+}
+
+/* The dock persists across pages, so it holds still. Astro moves it into
+ the new page during the swap, which can leave the new snapshot unpaired;
+ the :only-child forms keep the curtain rules below from claiming it. */
+:root::view-transition-group(dock),
+:root::view-transition-new(dock),
+:root::view-transition-new(dock):only-child {
+ animation: none;
+}
+
+:root::view-transition-old(dock),
+:root::view-transition-old(dock):only-child {
+ display: none;
+}
+
+/* The old page steps back into the dark; the new one rises in behind a
+ soft-edged curtain. Going back, the curtain falls from the top instead. */
+:root::view-transition-old(root) {
+ animation: page-out 240ms cubic-bezier(0.4, 0, 1, 1) both;
+}
+
+:root::view-transition-new(root) {
+ mask-image: linear-gradient(to top, oklch(0% 0 0) 40%, oklch(0% 0 0 / 0) 60%);
+ mask-repeat: no-repeat;
+ mask-size: 100% 250%;
+ animation: page-in 640ms var(--ease-out) 60ms both;
+}
+
+:root[data-astro-transition='back']::view-transition-new(root) {
+ mask-image: linear-gradient(to bottom, oklch(0% 0 0) 40%, oklch(0% 0 0 / 0) 60%);
+ animation-name: page-in-back;
+}
+
+/* Named elements with no partner on the other page (a headline arriving,
+ artwork leaving) travel with the curtain rather than fading on their own. */
+:root::view-transition-old(*):only-child {
+ animation: page-out 240ms cubic-bezier(0.4, 0, 1, 1) both;
+}
+
+:root::view-transition-new(*):only-child {
+ animation: page-in-solo 640ms var(--ease-out) 160ms both;
+}
+
+@keyframes page-in-solo {
+ from {
+ opacity: 0;
+ translate: 0 24px;
+ }
+}
+
+@keyframes page-out {
+ to {
+ opacity: 0;
+ scale: 0.985;
+ filter: blur(3px);
+ }
+}
+
+@keyframes page-in {
+ from {
+ opacity: 0;
+ translate: 0 24px;
+ mask-position: 0 0%;
+ }
+
+ 35% {
+ opacity: 1;
+ }
+
+ to {
+ mask-position: 0 100%;
+ }
+}
+
+@keyframes page-in-back {
+ from {
+ opacity: 0;
+ translate: 0 -24px;
+ mask-position: 0 100%;
+ }
+
+ 35% {
+ opacity: 1;
+ }
+
+ to {
+ mask-position: 0 0%;
+ }
+}
+
+:root::view-transition-group(*) {
+ animation-duration: 480ms;
+ animation-timing-function: var(--ease-out);
+}
diff --git a/packages/starpod/src/styles/tailwind.css b/packages/starpod/src/styles/tailwind.css
index dcb26567..269829be 100644
--- a/packages/starpod/src/styles/tailwind.css
+++ b/packages/starpod/src/styles/tailwind.css
@@ -8,53 +8,39 @@
@source '../components';
@source '../layouts';
@source '../pages';
+@source '../lib';
@plugin '@tailwindcss/forms';
@plugin '@tailwindcss/typography';
-@theme {
- --background-image-dots-dark: url('../assets/dots-dark.svg');
- --background-image-dots-light: url('../assets/dots-light.svg');
- --background-image-gradient-light: background: radial-gradient(
- 77% 77% at 50% 0%,
- #edecfc 0%,
- rgba(237, 236, 252, 0) 100%
- );
- --background-image-gradient-dark: radial-gradient(
- 77% 77% at 50% 0%,
- #586984 0%,
- rgba(88, 105, 132, 0) 100%
- );
-
- --color-dark-background: oklch(13.85% 0.025 273.24);
- --color-dark-border: oklch(23.8% 0.04 266.76);
- --color-dark-button: oklch(21.57% 0.029 280.68);
- --color-dark-card: oklch(18.74% 0.024 280.08);
- --color-dark-icon: oklch(71.44% 0.019 264.45);
- --color-dark-input-bg: oklch(21.63% 0.031 280.68);
- --color-dark-input-border: oklch(28.08% 0.048 281.19);
- --color-dark-input-border-focused: oklch(45.84% 0.078 281.04);
- --color-dark-player: oklch(22.61% 0.035 280.78);
- --color-dark-text-body: oklch(61.91% 0.019 264.42);
- --color-light-card: oklch(97.65% 0.005 274.97);
- --color-light-icon: oklch(67.65% 0.043 285.21);
- --color-light-input-bg: oklch(100% 0 0);
- --color-light-input-border: oklch(88.09% 0.018 234.53);
- --color-light-input-border-focused: oklch(57.79% 0.03 234.37);
- --color-light-player: oklch(95.94% 0.009 279.69);
- --color-light-text-body: oklch(59.68% 0.017 285.89);
- --color-light-text-heading: oklch(30.55% 0.052 292.57);
-
- --font-inter: var(--astro-font-inter);
+/*
+ Starpod's palette as Tailwind utilities (bg-accent-soft, text-on-glow,
+ from-glow-a…). `inline` keeps them pointing at the live tokens, so they
+ follow light and dark without a dark: variant.
+*/
+@theme inline {
+ --color-ground: var(--ground);
+ --color-surface: var(--surface);
+ --color-raised: var(--raised);
+ --color-line: var(--line);
+ --color-line-strong: var(--line-strong);
+ --color-ink: var(--ink);
+ --color-text: var(--text);
+ --color-muted: var(--muted);
+ --color-accent: var(--accent);
+ --color-accent-ink: var(--accent-ink);
+ --color-accent-soft: var(--accent-soft);
+ --color-on-ink: var(--on-ink);
+ --color-glow-a: var(--glow-a);
+ --color-glow-b: var(--glow-b);
+ --color-on-glow: var(--on-glow);
+ --color-voice-0: var(--voice-0);
+ --color-voice-1: var(--voice-1);
}
/*
- The default border color has changed to `currentColor` in Tailwind CSS v4,
- so we've added these compatibility styles to make sure everything still
- looks the same as it did with Tailwind CSS v3.
-
- If we ever want to remove these styles, we need to add an explicit border
- color utility to any element that depends on these defaults.
+ Tailwind v4 defaults borders to currentColor; Starpod's hairline is the
+ line token, so a bare `border` matches the rest of the design.
*/
@layer base {
*,
@@ -62,6 +48,6 @@
::before,
::backdrop,
::file-selector-button {
- border-color: var(--color-gray-200, currentColor);
+ border-color: var(--line, currentColor);
}
}
diff --git a/packages/starpod/src/styles/tilt.css b/packages/starpod/src/styles/tilt.css
new file mode 100644
index 00000000..1e0acc9d
--- /dev/null
+++ b/packages/starpod/src/styles/tilt.css
@@ -0,0 +1,77 @@
+/*
+ Tilt: art that leans toward the pointer while its layers part, from
+ prop-for-that's pointer-local ratios (data-props-for="pointer-local").
+ Transforms and opacity only. Nothing runs at rest, and the source pauses
+ off screen. The lean eases through a registered copy of the ratios, so it
+ settles rather than snaps, and it levels when the pointer leaves.
+
+
+
+ Layers marked data-depth="n" shift n% of their box toward the pointer
+ (read with typed attr(); flat where that is missing).
+*/
+
+@property --tilt-x {
+ syntax: '';
+ inherits: true;
+ initial-value: 0;
+}
+
+@property --tilt-y {
+ syntax: '';
+ inherits: true;
+ initial-value: 0;
+}
+
+@property --tilt-in {
+ syntax: '';
+ inherits: true;
+ initial-value: 0;
+}
+
+.tilt {
+ /* -1…1 from the centre while the pointer is over the art, else 0. */
+ --tilt-in: var(--live-local-pointer-inside, 0);
+ --tilt-x: calc(
+ (var(--live-local-pointer-x-ratio, 0.5) * 2 - 1) * var(--tilt-in)
+ );
+ --tilt-y: calc(
+ (var(--live-local-pointer-y-ratio, 0.5) * 2 - 1) * var(--tilt-in)
+ );
+ display: block;
+ perspective: 1200px;
+ transition:
+ --tilt-x 0.3s var(--ease-out),
+ --tilt-y 0.3s var(--ease-out),
+ --tilt-in 0.3s var(--ease-out);
+}
+
+.tilt-body {
+ position: relative;
+ display: block;
+ /* The hovered side presses in, as much as 15deg at the edges, and the
+ art lifts a little toward the viewer. */
+ transform: rotateX(calc(var(--tilt-y) * -15deg))
+ rotateY(calc(var(--tilt-x) * 15deg));
+ scale: calc(1 + 0.04 * var(--tilt-in));
+ /* Its own layer always: the lean is a 3D transform driven from the main
+ thread, so without this the art would be promoted as a lean starts and
+ dropped as it levels, re-rastering what it sits on each time. */
+ will-change: transform;
+}
+
+.tilt [data-depth] {
+ translate: calc(var(--tilt-x) * attr(data-depth type(), 0) * 1%)
+ calc(var(--tilt-y) * attr(data-depth type(), 0) * 1%);
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .tilt-body,
+ .tilt [data-depth] {
+ transform: none;
+ translate: none;
+ scale: none;
+ }
+}
diff --git a/playwright.config.ts b/playwright.config.ts
index dd74667b..7924a548 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -17,8 +17,9 @@ export default defineConfig({
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
- /* Opt out of parallel tests on CI. */
- workers: process.env.CI ? 1 : undefined,
+ /* CI runs one browser per job; two workers fit its four cores beside the
+ dev server. */
+ workers: process.env.CI ? 2 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index aa30b3fb..bf78cfb0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -150,9 +150,6 @@ importers:
astro-seo-schema:
specifier: ^5.2.0
version: 5.2.0(astro@6.4.2(@types/node@24.12.4)(@vercel/functions@3.6.1)(jiti@2.7.0)(lightningcss@1.32.0)(rollup@4.60.4)(tsx@4.22.4)(yaml@2.9.0))(schema-dts@1.1.5)
- atropos:
- specifier: ^2.0.2
- version: 2.0.2
drizzle-orm:
specifier: ^0.45.2
version: 0.45.2(@libsql/client@0.17.3)
@@ -2184,10 +2181,6 @@ packages:
asynckit@0.4.0:
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
- atropos@2.0.2:
- resolution: {integrity: sha512-8f0u0hEOlBTWTSvzY17TcHuQjxUIpkTBq70/I4+UF5B43ORtOoRjm8TPBYEgLM8Ba9AWf6PDtkagbYoybdjaKg==}
- engines: {node: '>= 12.0.0'}
-
available-typed-arrays@1.0.7:
resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}
engines: {node: '>= 0.4'}
@@ -7074,8 +7067,6 @@ snapshots:
asynckit@0.4.0: {}
- atropos@2.0.2: {}
-
available-typed-arrays@1.0.7:
dependencies:
possible-typed-array-names: 1.1.0
diff --git a/src/pages/sponsor.astro b/src/pages/sponsor.astro
index 9586f80f..f62f36e7 100644
--- a/src/pages/sponsor.astro
+++ b/src/pages/sponsor.astro
@@ -7,6 +7,7 @@ import type { ImageMetadata } from 'astro';
import { Image } from 'astro:assets';
import AdPackageCard from 'starpod/components/AdPackageCard';
+import PageHeader from 'starpod/components/PageHeader';
import Layout from 'starpod/layout';
import { getShowInfo } from 'starpod/rss';
@@ -27,35 +28,35 @@ const countries = [
---
-
-
- Sponsor {title}
-
-
-
- Want to dazzle a crowd of tech nerds and whiskey connoisseurs? Throw your
- brand into the mix! Our listeners love innovation, good banter, and a
- stiff drink—so get in on the fun and make some magic happen. Stay classy,
- sponsor.
-
+
+
+
+ Want to dazzle a crowd of tech nerds and whiskey connoisseurs? Throw
+ your brand into the mix! Our listeners love innovation, good banter,
+ and a stiff drink—so get in on the fun and make some magic happen. Stay
+ classy, sponsor.
+
+
Your overall ad reach
@@ -63,9 +64,9 @@ const countries = [
Listener Metrics
-
+
1,000
@@ -73,9 +74,9 @@ const countries = [
listeners per episode
-
+
15,000
@@ -88,7 +89,7 @@ const countries = [
Top Listeners By Location
-
+
{
countries.map((country) => {
return (
@@ -106,7 +107,7 @@ const countries = [
diff --git a/starpod.config.ts b/starpod.config.ts
index 7d29a543..dfbd091e 100644
--- a/starpod.config.ts
+++ b/starpod.config.ts
@@ -34,7 +34,7 @@ export default defineStarpodConfig({
},
rssFeed: 'https://rss.flightcast.com/w7bqgc792i30fd43a32uawx0.xml',
links: [
- { label: 'Store', href: 'https://whiskey.fund/' },
- { label: 'Become a sponsor', href: '/sponsor' }
+ { label: 'Become a sponsor', href: '/sponsor', icon: 'sponsor' },
+ { label: 'Store', href: 'https://whiskey.fund/', icon: 'store' }
]
});
diff --git a/tests/e2e/episode.spec.ts b/tests/e2e/episode.spec.ts
index b0535c7c..001a51c8 100644
--- a/tests/e2e/episode.spec.ts
+++ b/tests/e2e/episode.spec.ts
@@ -123,12 +123,81 @@ test.describe('transcripts', () => {
await expect(timestampButtons(page).first()).toHaveText(/^\d{1,2}:\d{2}/);
// Speaker names (bold in the markdown) prove the markdown transcript
// rendered; feed transcripts carry no speakers.
- await expect(page.locator('article.transcript strong').first()).toBeVisible();
+ await expect(
+ page.locator('article.transcript strong').first()
+ ).toBeVisible();
await expect(
page.getByText('No transcript for this one yet.', { exact: false })
).toHaveCount(0);
});
+ // A real mouse on its way to a timestamp crosses the turn's head, which
+ // can open the speaker's card; the click must still reach the timestamp.
+ test('a timestamp takes a mouse click, with the speaker card about', async ({
+ page
+ }) => {
+ await page.setViewportSize({ width: 1440, height: 900 });
+ await page.goto('/230');
+ await page.evaluate(() => {
+ const clicks: Array
= ((window as any).__clicks = []);
+ document.addEventListener(
+ 'click',
+ (event) => clicks.push(event.target as Element),
+ true
+ );
+ });
+ const heads = page
+ .locator('article.transcript .ep-turn-head')
+ .filter({ has: page.locator('strong') });
+ // What a new click landed on: this head's own timestamp, or what took
+ // it instead (or that no click came at all).
+ const clickOn = async (head: number) => {
+ const chip = heads.nth(head).locator('[data-seek]');
+ const before = await page.evaluate(
+ () => (window as any).__clicks.length as number
+ );
+ const box = (await chip.boundingBox())!;
+ await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2, {
+ steps: 5
+ });
+ await page.waitForTimeout(500);
+ await page.mouse.down();
+ await page.mouse.up();
+ return chip.evaluate((el, before) => {
+ const clicks = (window as any).__clicks as Array;
+ const hit = clicks.length > before ? clicks.at(-1)! : null;
+ return !hit
+ ? 'no click'
+ : el.contains(hit)
+ ? String(el.className)
+ : `elsewhere: ${String(hit.className)}`;
+ }, before);
+ };
+ // Once the card's island is up, the turns in the middle of the screen.
+ await expect(page.locator('.ep-who')).toBeAttached();
+ await heads
+ .nth(1)
+ .evaluate((head) => head.scrollIntoView({ block: 'center' }));
+ await expect
+ .poll(() =>
+ heads.nth(1).evaluate((head) => head.getBoundingClientRect().top)
+ )
+ .toBeLessThan(900);
+
+ // Straight onto a timestamp: it seeks, loading the episode.
+ expect(await clickOn(1)).toContain('seek-chip');
+ await expect(page.locator('.dock-controls')).toBeVisible();
+
+ // Its speaker's name opens the card; from there onto the timestamp.
+ await heads.nth(2).locator('strong').hover();
+ await expect
+ .poll(() =>
+ page.locator('.ep-who').evaluate((el) => el.matches(':popover-open'))
+ )
+ .toBe(true);
+ expect(await clickOn(2)).toContain('seek-chip');
+ });
+
// Clicking a timestamp should load the episode into the audio player. We
// assert the player mounts with the episode (a real click is a trusted user
// gesture); we don't assert the exact seek position because that depends on
@@ -143,15 +212,785 @@ test.describe('transcripts', () => {
}) => {
await page.goto(`/${episode}`);
- // The player only exists in the DOM once an episode is playing.
- await expect(page.locator('.player')).toHaveCount(0);
+ // The dock's controls only exist once an episode is loaded.
+ await expect(page.locator('.dock-controls')).toHaveCount(0);
await timestampButtons(page).first().click();
- const player = page.locator('.player');
- await expect(player).toBeVisible();
- await expect(player).toContainText(marker);
- await expect(player.locator('audio')).toHaveAttribute('src', /.+\.mp3/);
+ const dock = page.locator('.dock-controls');
+ await expect(dock).toBeVisible();
+ await expect(dock).toContainText(marker);
+ // These episodes have no video, so the one media element plays the MP3.
+ await expect(page.locator('video.starpod-media')).toHaveAttribute(
+ 'src',
+ /.+\.mp3/
+ );
});
}
});
+
+test.describe('episode page navigation', () => {
+ // Episode 239 has video, a feed transcript, two hosts, two guests and a
+ // sponsor, so every section of the page is present.
+ const page239 = '/239';
+
+ test('a sticky bar docks the episode once the stage scrolls away, and plays it', async ({
+ page
+ }) => {
+ await page.goto(page239);
+ const bar = page.locator('.ep-bar');
+ const identity = bar.locator('.ep-bar-id');
+ const play = bar.getByRole('button', { name: 'Play this episode' });
+
+ // The identity waits for the scroll trigger (or, without trigger
+ // animations, the script's stand-in), out of reach until then, with the
+ // bar in view under the stage too.
+ await bar.evaluate((el) =>
+ scrollBy(0, el.getBoundingClientRect().top - 300)
+ );
+ await expect
+ .poll(() => identity.evaluate((el) => el.getBoundingClientRect().width))
+ .toBeLessThan(1);
+ await expect(play).toBeHidden();
+
+ await page.locator('#people').evaluate((el) => el.scrollIntoView());
+ await expect
+ .poll(() => bar.evaluate((el) => el.getBoundingClientRect().top))
+ .toBeLessThan(2);
+ await expect
+ .poll(() => identity.evaluate((el) => el.getBoundingClientRect().width))
+ .toBeGreaterThan(100);
+ await expect(bar.locator('.ep-bar-name')).toHaveText(/Flogging Margins/);
+
+ await play.click();
+ await expect(page.locator('.dock-controls')).toContainText(
+ 'Flogging Margins'
+ );
+ });
+
+ test('section links track the section in view and the indicator follows', async ({
+ page,
+ browserName
+ }) => {
+ await page.goto(page239);
+ const nav = page.getByRole('navigation', { name: 'Episode sections' });
+ await expect(nav.getByRole('link')).toHaveText([
+ 'Notes',
+ 'People',
+ 'Sponsors',
+ 'Transcript',
+ 'More episodes'
+ ]);
+ await expect(nav.getByRole('link', { name: 'Notes' })).toHaveAttribute(
+ 'aria-current',
+ 'true'
+ );
+
+ const transcript = nav.getByRole('link', { name: 'Transcript' });
+ await transcript.click();
+ await expect(page).toHaveURL(/#transcript$/);
+ await expect(transcript).toHaveAttribute('aria-current', 'true');
+ await expect(nav.getByRole('link', { name: 'Notes' })).not.toHaveAttribute(
+ 'aria-current'
+ );
+
+ if (browserName === 'chromium') {
+ // One indicator, anchored to the current link, settles on it.
+ await expect
+ .poll(async () => {
+ const here = await nav.locator('.ep-nav-here').boundingBox();
+ const link = await transcript.boundingBox();
+ return (
+ Math.abs(here!.x - link!.x) + Math.abs(here!.width - link!.width)
+ );
+ })
+ .toBeLessThan(2);
+ }
+ });
+
+ // Focus moves to the section's heading either way; it is ringed only when
+ // the link was followed from the keyboard (WebKit ringed it after a click).
+ test('a clicked section link focuses its heading without a ring; Enter rings it', async ({
+ page
+ }) => {
+ await page.goto(page239);
+ const nav = page.getByRole('navigation', { name: 'Episode sections' });
+ const ringed = (id: string) =>
+ page.locator(`#${id} h2`).evaluate((h) => ({
+ focused: h === document.activeElement,
+ ring: h.matches(':focus-visible')
+ }));
+
+ await nav.getByRole('link', { name: 'Transcript' }).click();
+ await expect
+ .poll(() => ringed('transcript'))
+ .toEqual({ focused: true, ring: false });
+
+ await nav.getByRole('link', { name: 'People' }).focus();
+ await page.keyboard.press('Enter');
+ await expect
+ .poll(() => ringed('people'))
+ .toEqual({ focused: true, ring: true });
+ });
+
+ // With reduced motion a link jumps rather than glides. The link marked is
+ // the one clicked, a short section included (Ep 230's sponsors), down the
+ // page and back up, and the indicator sits on it.
+ test('with reduced motion, the clicked section link is the one marked', async ({
+ page
+ }) => {
+ await page.emulateMedia({ reducedMotion: 'reduce' });
+ await page.setViewportSize({ width: 1440, height: 900 });
+ await page.goto('/230');
+ const nav = page.getByRole('navigation', { name: 'Episode sections' });
+ // The bar's script is up once it marks the first section.
+ await expect(nav.locator('a[aria-current]')).toHaveCount(1);
+ const names = await nav.getByRole('link').allTextContents();
+ const anchored = await page.evaluate(() =>
+ CSS.supports('position-anchor', '--a')
+ );
+ for (const name of [...names, ...names.slice(0, -1).reverse()]) {
+ const link = nav.getByRole('link', { name, exact: true });
+ await link.click();
+ await expect(link).toHaveAttribute('aria-current', 'true');
+ await expect(nav.locator('a[aria-current]')).toHaveCount(1);
+ // Where anchors place it, the indicator is drawn, on the link.
+ if (anchored) {
+ await expect
+ .poll(async () => {
+ const here = await nav.locator('.ep-nav-here').boundingBox();
+ const box = (await link.boundingBox())!;
+ return here && here.width > 0
+ ? Math.max(
+ Math.abs(here.x - box.x),
+ Math.abs(here.width - box.width)
+ )
+ : Infinity;
+ })
+ .toBeLessThan(2);
+ }
+ }
+ });
+
+ test('a section link lands on its section across an open transcript', async ({
+ page
+ }) => {
+ // Turn groups the glide passes render at their real height on the way.
+ await page.goto(page239);
+ await page.locator('#transcript').scrollIntoViewIfNeeded();
+ await page.locator('.transcript-section .ep-more').click();
+ await page
+ .getByRole('navigation', { name: 'Episode sections' })
+ .getByRole('link', { name: 'More episodes' })
+ .click();
+ await expect
+ .poll(() =>
+ page.locator('#more').evaluate((el) => {
+ const margin = parseFloat(getComputedStyle(el).scrollMarginTop);
+ return Math.abs(el.getBoundingClientRect().top - margin);
+ })
+ )
+ .toBeLessThan(3);
+ });
+
+ // On phones the root's scroll padding adds to the sections' own margins,
+ // and in landscape the bar sticks at the top: every link, clicked first
+ // on a fresh page and then again from section to section, lands its
+ // section 16px under the bar, and stays there.
+ for (const [form, viewport] of [
+ ['portrait', { width: 412, height: 839 }],
+ ['landscape', { width: 839, height: 412 }]
+ ] as const) {
+ test(`on a ${form} phone, every section link lands its section just under the bar`, async ({
+ page
+ }) => {
+ // Fifteen landings, each held 400ms: on CI's runners near 30s.
+ test.slow();
+ await page.setViewportSize(viewport);
+ const nav = page.getByRole('navigation', { name: 'Episode sections' });
+ const underBar = (href: string) =>
+ page.evaluate((href) => {
+ const bar = document
+ .querySelector('.ep-bar')!
+ .getBoundingClientRect();
+ const top = document.querySelector(href)!.getBoundingClientRect().top;
+ return Math.round(top - bar.bottom);
+ }, href);
+ // Where it settles: the same for 400ms, so a late re-aim can't pass.
+ // Within a pixel of 16: WebKit scrolls by whole pixels and the bar's
+ // edge can fall between two, so it lands a rounding either side.
+ const settled = (href: string) =>
+ expect
+ .poll(async () => {
+ const before = await underBar(href);
+ await page.waitForTimeout(400);
+ const after = await underBar(href);
+ return after === before && Math.abs(after - 16) <= 1
+ ? 'under the bar'
+ : `${after}px`;
+ })
+ .toBe('under the bar');
+
+ await page.goto(page239);
+ const hrefs = await nav
+ .getByRole('link')
+ .evaluateAll((links) =>
+ links.map((link) => link.getAttribute('href')!)
+ );
+ expect(hrefs.length).toBe(5);
+
+ // First click, each on a fresh page at the top.
+ for (const href of hrefs) {
+ await page.goto(page239);
+ await nav.locator(`a[href="${href}"]`).click();
+ await settled(href);
+ }
+
+ // Repeated: from section to section, back up the page, the same link
+ // twice, and across an open transcript.
+ for (const href of [...hrefs].reverse()) {
+ await nav.locator(`a[href="${href}"]`).click();
+ await settled(href);
+ }
+ await nav.locator(`a[href="${hrefs[0]}"]`).click();
+ await settled(hrefs[0]);
+ await page.locator('.transcript-section .ep-more').click();
+ for (const href of ['#more', '#notes', '#more']) {
+ await nav.locator(`a[href="${href}"]`).click();
+ await settled(href);
+ }
+ });
+ }
+
+ test('a person opens in place to their other episodes', async ({ page }) => {
+ await page.goto(page239);
+ const person = page.getByRole('button', { name: /Chris Coyier/ });
+ await person.scrollIntoViewIfNeeded();
+ await expect(person).toHaveAttribute('aria-expanded', 'false');
+
+ await person.click();
+ await expect(person).toHaveAttribute('aria-expanded', 'true');
+ const panel = page.locator(
+ `#${await person.getAttribute('aria-controls')}`
+ );
+ await expect(panel).toBeVisible();
+ await expect(
+ panel.getByRole('link', { name: /Open-Source Ethics/ })
+ ).toBeVisible();
+ await expect(
+ panel.getByRole('link', { name: 'All 3 episodes with Chris Coyier' })
+ ).toHaveAttribute('href', '/#guest=chriscoyier');
+
+ await person.click();
+ await expect(person).toHaveAttribute('aria-expanded', 'false');
+ await expect(panel).toBeHidden();
+ });
+
+ test('guests lead, hosts follow compactly, and a first line plays', async ({
+ page
+ }) => {
+ // Episode 216: one guest and two hosts, with a transcript naming them.
+ await page.goto('/216');
+ const people = page.locator('#people');
+ await people.scrollIntoViewIfNeeded();
+
+ const guest = people.locator('[data-ep-person]');
+ await expect(guest).toHaveCount(1);
+ await expect(guest).toContainText('Shruti Kapoor');
+ await expect(guest).toContainText('First time on the show');
+
+ const hosted = people.locator('.ep-hosted');
+ await expect(hosted).toContainText('Hosted by');
+ await expect(
+ hosted.getByRole('link', { name: /Jason Lengstorf/ })
+ ).toHaveAttribute('href', /\/#guest=/);
+
+ await guest.getByRole('button', { name: /^First speaks at/ }).click();
+ await expect(page.locator('.dock-controls')).toContainText(
+ 'Why Open Source'
+ );
+ // Her first line is hers: her own row lights up.
+ await expect(guest).toHaveAttribute('data-speaking', '', {
+ timeout: 15000
+ });
+ });
+
+ test('onward: previous, next, and a related shelf led by the guests', async ({
+ page
+ }) => {
+ await page.goto(page239);
+ const pager = page.getByRole('navigation', {
+ name: 'Previous and next episode'
+ });
+ await expect(pager.locator('a[rel="prev"]')).toContainText('Ep 238');
+ await expect(pager.locator('a[rel="next"]')).toContainText('Ep 240');
+
+ const shelf = page.getByRole('list', { name: 'Related episodes' });
+ await shelf.scrollIntoViewIfNeeded();
+ const cards = shelf.getByRole('link');
+ expect(await cards.count()).toBeGreaterThan(3);
+ await expect(cards.first()).toContainText('With Chris Coyier');
+
+ const href = await cards.first().getAttribute('href');
+ await cards.first().click();
+ // Client-side navigations take 5–9s in CI's Firefox under the suite's load.
+ await expect(page).toHaveURL(new RegExp(`${href}$`), { timeout: 15_000 });
+ await expect(page.locator('h1.stage-title')).toHaveText(
+ /Open-Source Ethics/
+ );
+ });
+
+ test('the transcript follows playback and jumps back to the live line', async ({
+ page,
+ browserName
+ }) => {
+ // Pinning to an edge is read from scroll-state queries (Chromium).
+ test.skip(
+ browserName !== 'chromium',
+ 'scroll-state queries are Chromium-only'
+ );
+ await page.goto('/230');
+ // The button shows once prop-for-that finds the preview really clips.
+ await page.locator('#transcript').scrollIntoViewIfNeeded();
+ await page
+ .getByRole('button', { name: 'Read the full transcript' })
+ .click();
+
+ const chip = page
+ .locator('article.transcript .ep-turn-head [data-seek]')
+ .first();
+ await chip.click();
+ const live = page.locator('article.transcript .ep-turn[data-live]');
+ await expect(live).toHaveCount(1);
+
+ // A marker pinned to the edge the live turn is past shows its button;
+ // while any of the turn is on screen, none does.
+ const jump = (click: boolean) =>
+ page.evaluate((click) => {
+ const button = [
+ ...document.querySelectorAll('.ep-now-jump')
+ ].find((candidate) => {
+ const box = candidate.getBoundingClientRect();
+ return (
+ getComputedStyle(candidate).visibility === 'visible' &&
+ box.bottom > 0 &&
+ box.top < innerHeight
+ );
+ });
+ if (click) {
+ button?.click();
+ }
+ return Boolean(button);
+ }, click);
+ await live.scrollIntoViewIfNeeded();
+ await expect.poll(() => jump(false)).toBe(false);
+ await page.evaluate(() => window.scrollBy(0, 4000));
+ await expect.poll(() => jump(false)).toBe(true);
+
+ await jump(true);
+ await expect(live).toBeInViewport();
+ await expect(live.locator('[data-seek]')).toBeFocused();
+ });
+});
+
+// WebKit's Tab, like Safari's by default, moves between form fields only;
+// Option-Tab reaches links and buttons.
+const tabKey = (browserName: string) =>
+ browserName === 'webkit' ? 'Alt+Tab' : 'Tab';
+
+test.describe('episode page review fixes', () => {
+ test("each person gets their own lines, not a namesake's (Ep 184)", async ({
+ page
+ }) => {
+ await page.goto('/184');
+ const travis = page.locator('[data-ep-person]', {
+ hasText: 'Travis Wagner'
+ });
+ await expect(travis).toHaveAttribute('data-speaks-as', 'Travis Wagner');
+ await expect(travis.locator('.ep-chip')).toHaveText('00:01:00');
+ await expect(
+ page.locator('.ep-hosted .person-chip', { hasText: 'RobbieTheWagner' })
+ ).toHaveAttribute('data-speaks-as', 'Robbie Wagner');
+ await expect(
+ page.locator('.cast-member', { hasText: 'Travis Wagner' })
+ ).toHaveAttribute('data-speaks-as', 'Travis Wagner');
+ });
+
+ test('a clamped transcript keeps what it hides out of reach, and opens to what it hid', async ({
+ page
+ }) => {
+ await page.goto('/184');
+ const controls = page.locator('.transcript-section .transcript button');
+ const reachable = () =>
+ controls.evaluateAll(
+ (buttons) =>
+ buttons.filter((button) => !button.closest('[hidden]')).length
+ );
+ expect(await reachable()).toBeLessThan(30);
+
+ await page.locator('#transcript').scrollIntoViewIfNeeded();
+ const open = page.locator('.transcript-section [data-ep-expand]');
+ // It shows once the preview is measured as cut off.
+ await expect(open).toBeVisible();
+ await open.focus();
+ await page.keyboard.press('Enter');
+ await expect(page.locator('.transcript')).not.toHaveAttribute(
+ 'data-clamped'
+ );
+ const focused = page.locator('.transcript [data-seek]:focus');
+ await expect(focused).toBeInViewport();
+ expect(await reachable()).toBeGreaterThan(600);
+ });
+
+ test('keyboard focus on what it cuts off, and find in page, open a clamped transcript', async ({
+ page,
+ browserName
+ }) => {
+ await page.goto('/184');
+ await page.locator('#transcript').scrollIntoViewIfNeeded();
+ await page
+ .locator('#transcript-heading')
+ .evaluate((heading: HTMLElement) => {
+ heading.tabIndex = -1;
+ heading.focus();
+ });
+ // Tabbing through what the preview shows leaves it a preview...
+ await page.keyboard.press(tabKey(browserName));
+ await expect(page.locator('.transcript')).toHaveAttribute('data-clamped');
+ // ...and reaching something it cuts off opens it.
+ await expect(async () => {
+ await page.keyboard.press(tabKey(browserName));
+ await expect(page.locator('.transcript')).not.toHaveAttribute(
+ 'data-clamped',
+ { timeout: 100 }
+ );
+ }).toPass({ timeout: 10_000 });
+
+ await page.goto('/184');
+ await page
+ .locator('.ep-turns[hidden]')
+ .first()
+ .evaluate((group) =>
+ group.dispatchEvent(new Event('beforematch', { bubbles: true }))
+ );
+ await expect(page.locator('.transcript')).not.toHaveAttribute(
+ 'data-clamped'
+ );
+ await expect(page.locator('.ep-turns[hidden]')).toHaveCount(0);
+ });
+
+ test('a section link carries keyboard focus into its section, clear of the bar', async ({
+ page,
+ browserName
+ }) => {
+ await page.goto('/239');
+ const link = page
+ .getByRole('navigation', { name: 'Episode sections' })
+ .getByRole('link', { name: 'Transcript' });
+ await link.focus();
+ await page.keyboard.press('Enter');
+ await page.keyboard.press(tabKey(browserName));
+ await expect
+ .poll(() =>
+ page.evaluate(() => document.activeElement?.closest('section')?.id)
+ )
+ .toBe('transcript');
+ await expect
+ .poll(() =>
+ page.evaluate(() => {
+ const control = document.activeElement!.getBoundingClientRect();
+ const bar = document
+ .querySelector('.ep-bar')!
+ .getBoundingClientRect();
+ return control.top >= bar.bottom;
+ })
+ )
+ .toBe(true);
+ });
+
+ test("a host's lines light no namesake on another episode's page", async ({
+ page,
+ browserName
+ }) => {
+ test.skip(browserName !== 'chromium', 'plays media');
+ // Ep 216's transcript calls the host "Robbie Wagner"; Ep 184 has a guest
+ // called Travis Wagner.
+ await page.goto('/216');
+ await page.locator('.stage-play').click();
+ await page.waitForFunction(
+ () =>
+ (document.querySelector('video.starpod-media') as HTMLVideoElement)
+ ?.currentTime > 0.5
+ );
+ await page.evaluate(() => {
+ const link = document.createElement('a');
+ link.href = '/184';
+ link.id = 'to-184';
+ link.textContent = 'Ep 184';
+ document.body.append(link);
+ });
+ await page.locator('#to-184').evaluate((link: HTMLElement) => link.click());
+ // Client-side navigations take up to ~9s on CI's runners under load.
+ await expect(page).toHaveURL(/\/184$/, { timeout: 15_000 });
+ // Play on from one of Robbie's lines.
+ const robbie = await page.evaluate(async () => {
+ const cues = await (
+ await fetch(
+ '/api/cues/why-open-source-might-be-your-best-career-move-w-shruti-kapoor.json'
+ )
+ ).json();
+ return cues.find(
+ (cue: { n?: string; s: number }) =>
+ cue.n === 'Robbie Wagner' && cue.s > 60
+ ).s;
+ });
+ await page.evaluate((at) => {
+ const media = document.querySelector(
+ '.starpod-media'
+ ) as HTMLMediaElement;
+ media.currentTime = at + 0.5;
+ void media.play();
+ }, robbie);
+ const hostChip = page.locator('.ep-hosted .person-chip', {
+ hasText: 'RobbieTheWagner'
+ });
+ await expect(hostChip).toHaveAttribute('data-speaking', '');
+ await expect(
+ page.locator('[data-ep-person]', { hasText: 'Travis Wagner' })
+ ).not.toHaveAttribute('data-speaking');
+ });
+});
+
+test.describe('the section bar and the dock', () => {
+ test('at scroll 0 the bar sits under the dock, whose play button takes the click', async ({
+ page
+ }) => {
+ // Ep 50's stage is short enough that, at this size, the bar falls right
+ // where the dock floats before the page has scrolled at all.
+ await page.setViewportSize({ width: 1460, height: 880 });
+ await page.goto('/50');
+ await page.locator('.stage-play').click();
+ const media = page.locator('.starpod-media');
+ await expect
+ .poll(() => media.evaluate((m: HTMLMediaElement) => !m.paused))
+ .toBe(true);
+ await page.evaluate(() => scrollTo(0, 0));
+
+ const dock = page.locator('.island');
+ const play = dock.locator('.dock-play');
+ await expect(play).toBeVisible();
+ const [bar, island] = await Promise.all([
+ page.locator('.ep-bar').boundingBox(),
+ dock.boundingBox()
+ ]);
+ // The bar really is under the dock here.
+ expect(bar!.y + bar!.height).toBeGreaterThan(island!.y);
+ expect(bar!.y).toBeLessThan(island!.y + island!.height);
+
+ await play.click();
+ await expect
+ .poll(() => media.evaluate((m: HTMLMediaElement) => m.paused))
+ .toBe(true);
+ });
+});
+
+test.describe('the stage, split', () => {
+ test('presets, keys and a drag move one divider, and the choice persists', async ({
+ page,
+ browserName
+ }) => {
+ test.skip(
+ browserName !== 'chromium',
+ 'anchored-auto-layout needs typed attr() (Chromium); elsewhere the stage keeps its grid'
+ );
+ await page.goto('/230');
+ await page.evaluate(() => localStorage.removeItem('starpod:split'));
+ await page.reload();
+
+ const divider = page.getByRole('separator', {
+ name: 'Resize the picture and the transcript'
+ });
+ const presets = page.getByRole('group', { name: 'Stage layout' });
+ const pressed = (name: string) =>
+ expect(presets.getByRole('button', { name })).toHaveAttribute(
+ 'aria-pressed',
+ 'true'
+ );
+ const width = (selector: string) => () =>
+ page
+ .locator(selector)
+ .evaluate((el) => Math.round(el.getBoundingClientRect().width));
+ const picture = width('[data-media-slot]');
+ const transcript = width('.stage-script');
+
+ await pressed('Balanced');
+ const balanced = await picture();
+ const balancedTranscript = await transcript();
+
+ // The picture gives up room and the transcript takes it.
+ await presets.getByRole('button', { name: 'Read' }).click();
+ await pressed('Read');
+ await expect.poll(picture).toBeLessThan(balanced - 50);
+ await expect.poll(transcript).toBeGreaterThan(balancedTranscript + 50);
+
+ // Alt+Arrow is the browser's Back and Forward: the divider leaves it.
+ await divider.focus();
+ await page.keyboard.down('Alt');
+ await page.keyboard.press('ArrowRight');
+ await page.keyboard.up('Alt');
+ await pressed('Read');
+
+ // Arrow keys step between the stops.
+ await divider.focus();
+ await page.keyboard.press('ArrowRight');
+ await pressed('Balanced');
+ await page.keyboard.press('End');
+ await pressed('Watch');
+ await expect.poll(picture).toBeGreaterThan(balanced + 50);
+
+ // A drag writes the position straight away; let go after stopping and
+ // it settles on the nearest stop.
+ await expect
+ .poll(() => divider.evaluate((el) => el.getAnimations().length))
+ .toBe(0);
+ const box = (await divider.boundingBox())!;
+ await page.mouse.move(box.x + 1, box.y + 100);
+ await page.mouse.down();
+ await page.mouse.move(box.x - 260, box.y + 100, { steps: 8 });
+ await expect(presets.locator('[aria-pressed="true"]')).toHaveCount(0);
+ await page.waitForTimeout(150);
+ await page.mouse.up();
+ await pressed('Read');
+
+ await page.reload();
+ await pressed('Read');
+ await expect.poll(picture).toBeLessThan(balanced - 50);
+ });
+
+ test('a chosen preset stays pressed, its indicator on it, as the window changes width', async ({
+ page,
+ browserName
+ }) => {
+ test.skip(
+ browserName !== 'chromium',
+ 'anchored-auto-layout needs typed attr() (Chromium); elsewhere the stage keeps its grid'
+ );
+ // Read chosen (Home on the divider) where its stop is clamped, then the
+ // window widened and narrowed: it stays Read, and the indicator never
+ // animates.
+ await page.setViewportSize({ width: 1040, height: 800 });
+ await page.goto('/230');
+ await page.evaluate(() => localStorage.removeItem('starpod:split'));
+ await page.reload();
+ const read = page.locator('.ep-presets [data-preset=read]');
+ await page.locator('.ep-split').focus();
+ await page.keyboard.press('Home');
+ await expect(read).toHaveAttribute('aria-pressed', 'true');
+ const thumb = page.locator('.ep-presets-on');
+ await expect
+ .poll(() => thumb.evaluate((el) => el.getAnimations().length))
+ .toBe(0);
+ for (const width of [1440, 1200, 1040]) {
+ await page.setViewportSize({ width, height: 800 });
+ await expect(read).toHaveAttribute('aria-pressed', 'true');
+ expect(await thumb.evaluate((el) => el.getAnimations().length)).toBe(0);
+ const [a, b] = await Promise.all([
+ thumb.boundingBox(),
+ read.boundingBox()
+ ]);
+ expect(
+ Math.abs(a!.x - b!.x) + Math.abs(a!.width - b!.width)
+ ).toBeLessThan(1);
+ }
+ });
+
+ test('presets and a resize leave no ResizeObserver loop', async ({
+ page,
+ browserName
+ }) => {
+ test.skip(
+ browserName !== 'chromium',
+ 'anchored-auto-layout needs typed attr() (Chromium); elsewhere the stage keeps its grid'
+ );
+ await page.addInitScript(() => {
+ (window as any).__loops = 0;
+ addEventListener('error', (event) => {
+ if (String(event.message).includes('ResizeObserver')) {
+ (window as any).__loops++;
+ }
+ });
+ });
+ await page.setViewportSize({ width: 1440, height: 900 });
+ await page.goto('/230');
+ const presets = page.getByRole('group', { name: 'Stage layout' });
+ for (const name of ['Watch', 'Read', 'Balanced']) {
+ await presets.getByRole('button', { name }).click();
+ await page.waitForTimeout(400);
+ }
+ await page.setViewportSize({ width: 1100, height: 900 });
+ await page.waitForTimeout(300);
+ expect(await page.evaluate(() => (window as any).__loops)).toBe(0);
+ });
+
+ test('phones keep the stacked stage with no divider', async ({ page }) => {
+ await page.setViewportSize({ width: 390, height: 844 });
+ await page.goto('/230');
+ await expect(page.locator('.stage-room')).toBeVisible();
+ await expect(page.locator('.ep-split')).toBeHidden();
+ await expect(page.locator('.ep-presets')).toBeHidden();
+ });
+});
+
+test.describe('the stage on phones', () => {
+ const top = (page: Page, selector: string) =>
+ page
+ .locator(selector)
+ .first()
+ .evaluate((el) => Math.round(el.getBoundingClientRect().top));
+
+ test('the title comes before the transcript preview, and the live script takes its place once playing', async ({
+ page
+ }) => {
+ await page.setViewportSize({ width: 393, height: 659 });
+ await page.goto('/230');
+ await expect(page.locator('.script[data-state="preview"]')).toBeVisible();
+
+ // Before playback: picture, then the title on the first screen, then
+ // the preview.
+ const title = await top(page, '.stage-title');
+ expect(title).toBeLessThan(await top(page, '.stage-script'));
+ expect(title).toBeLessThan(await top(page, '.tabbar'));
+
+ // Playing: the script moves up under the picture, which stays put.
+ const frame = await top(page, '.stage-frame');
+ await page.locator('.stage-play').click();
+ await expect(page.locator('.stage[data-current]')).toBeVisible();
+ await expect
+ .poll(
+ async () =>
+ (await top(page, '.stage-script')) < (await top(page, '.stage-title'))
+ )
+ .toBe(true);
+ expect(await top(page, '.stage-frame')).toBe(frame);
+ });
+
+ test('landscape: the picture fits between the bars, with the title and Play beside it', async ({
+ page
+ }) => {
+ await page.setViewportSize({ width: 734, height: 343 });
+ await page.goto('/230');
+ const box = async (selector: string) =>
+ (await page.locator(selector).first().boundingBox())!;
+ const floor = (await box('.tabbar')).y;
+ const frame = await box('.stage-frame');
+ const title = await box('.stage-title');
+
+ expect(frame.y + frame.height).toBeLessThanOrEqual(floor);
+ expect(frame.width / frame.height).toBeCloseTo(16 / 9, 1);
+ expect(title.x).toBeGreaterThan(frame.x + frame.width);
+ for (const play of ['.stage-play', '.stage-actions .button-primary']) {
+ const { y, height } = await box(play);
+ expect(y + height).toBeLessThanOrEqual(floor);
+ }
+ });
+});
diff --git a/tests/e2e/explorer.spec.ts b/tests/e2e/explorer.spec.ts
new file mode 100644
index 00000000..c37476d4
--- /dev/null
+++ b/tests/e2e/explorer.spec.ts
@@ -0,0 +1,800 @@
+import { expect, test, type Page } from '@playwright/test';
+
+/*
+ The home page's explorer: everything happens in the page (no reload), and
+ the state lives in the URL query. Counts depend on the live feed, so these
+ check what the cards say about themselves rather than fixed numbers.
+*/
+
+const cards = (page: Page) => page.locator('.xp-card:not([hidden])');
+
+/** What every shown card a reader meets carries, in the order shown (a sort
+ may set `order` rather than move them; a card fading out where it stood
+ is inert until it parks). */
+const shown = (page: Page) =>
+ page.locator('.xp-card:not([hidden], [inert])').evaluateAll((items) =>
+ items
+ .map((li, dom) => ({
+ li,
+ rank: Number((li as HTMLElement).style.order || dom)
+ }))
+ .sort((a, b) => a.rank - b.rank)
+ .map(({ li }) => ({
+ duration: Number((li as HTMLElement).dataset.duration),
+ index: Number((li as HTMLElement).dataset.index),
+ people: (li as HTMLElement).dataset.people ?? '',
+ title: li.querySelector('.xp-title')!.textContent!.trim(),
+ video: (li as HTMLElement).dataset.video !== undefined,
+ year: (li as HTMLElement).dataset.year
+ }))
+ );
+
+const count = (page: Page) => page.locator('[data-xp-shown]');
+
+async function pick(page: Page, menu: string, value: string) {
+ await page.locator(`[popovertarget="${menu}"]`).click();
+ await page.locator(`#${menu} label:has(input[value="${value}"])`).click();
+ await expect(page.locator(`#${menu}`)).not.toBeVisible();
+}
+
+test.beforeEach(async ({ page }) => {
+ await page.goto('/');
+ await expect(page.locator('[data-explorer][data-live]')).toBeAttached();
+});
+
+test('opens on the latest episode, ready to play', async ({ page }) => {
+ const hero = page.locator('.xp-hero');
+ const first = (await shown(page))[0]!;
+ await expect(hero.locator('.xp-hero-title')).toHaveText(first.title);
+ await expect(
+ hero.getByRole('button', { name: 'Play episode', exact: true })
+ ).toBeVisible();
+});
+
+test('searches titles and descriptions as you type', async ({ page }) => {
+ const total = await cards(page).count();
+ await page.getByRole('searchbox', { name: 'Search episodes' }).fill('css');
+ await expect(page).toHaveURL(/#q=css$/);
+ const results = await cards(page).count();
+ expect(results).toBeGreaterThan(0);
+ expect(results).toBeLessThan(total);
+ await expect(count(page)).toHaveText(String(results));
+ for (const text of await cards(page).allTextContents()) {
+ expect(text.toLowerCase()).toContain('css');
+ }
+});
+
+test('filters by video and audio', async ({ page }) => {
+ await page.locator('label:has(input[name=kind][value=video])').click();
+ await expect(page).toHaveURL(/#kind=video$/);
+ const videos = await shown(page);
+ expect(videos.length).toBeGreaterThan(0);
+ expect(videos.every((card) => card.video)).toBe(true);
+
+ await page.locator('label:has(input[name=kind][value=audio])').click();
+ await expect(page).toHaveURL(/#kind=audio$/);
+ const audio = await shown(page);
+ expect(audio.length).toBeGreaterThan(0);
+ expect(audio.every((card) => !card.video)).toBe(true);
+});
+
+test('filters by year', async ({ page }) => {
+ await pick(page, 'xp-year', '2024');
+ await expect(page).toHaveURL(/#year=2024$/);
+ await expect(page.locator('[data-xp-label="year"]')).toHaveText('2024');
+ const results = await shown(page);
+ expect(results.length).toBeGreaterThan(0);
+ expect(results.every((card) => card.year === '2024')).toBe(true);
+});
+
+test('a set filter turns solid, and its × clears it', async ({ page }) => {
+ const year = page.locator('[popovertarget="xp-year"]');
+ const clear = page.getByRole('button', { name: 'Any year' });
+ await expect(clear).toBeHidden();
+ await pick(page, 'xp-year', '2024');
+ await expect(year).toHaveAttribute('data-on', '');
+ await clear.click();
+ await expect(page).toHaveURL(/\/#all$/);
+ await expect(page.locator('[data-xp-label="year"]')).toHaveText('Any');
+ await expect(year).not.toHaveAttribute('data-on', '');
+ await expect(clear).toBeHidden();
+ await expect(year).toBeFocused();
+});
+
+test('every toolbar control is one height', async ({ page }) => {
+ // (Polled: the chips arrive scaling up from 0.8 as the page loads.)
+ await expect
+ .poll(
+ async () =>
+ new Set(
+ await page
+ .locator(
+ '.xp-search, .xp-seg, .xp-chips > .xp-filter > .xp-pick, .xp-sort'
+ )
+ .evaluateAll((items) =>
+ items.map((item) => item.getBoundingClientRect().height)
+ )
+ )
+ )
+ .toEqual(new Set([40]));
+});
+
+test('filters by host or guest when the database is on', async ({ page }) => {
+ const menu = page.locator('#xp-people');
+ test.skip((await menu.count()) === 0, 'No guests database for this site');
+ const person = await menu
+ .locator('input[value]:not([value=""])')
+ .nth(3)
+ .getAttribute('value');
+ await pick(page, 'xp-people', person!);
+ await expect(page).toHaveURL(new RegExp(`#guest=${person}$`));
+ // The With chip wears their face.
+ await expect(
+ page.locator('[popovertarget="xp-people"] .person-face')
+ ).toBeVisible();
+ const results = await shown(page);
+ expect(results.length).toBeGreaterThan(0);
+ expect(
+ results.every((card) => card.people.split(' ').includes(person!))
+ ).toBe(true);
+});
+
+test('filters to the episodes you have started', async ({ page }) => {
+ const id = await page.locator('.xp-card').nth(4).getAttribute('data-id');
+ await page.evaluate(
+ (key) => localStorage.setItem(key, '900'),
+ `starpod:pos:${id}`
+ );
+ await page.reload();
+ const chip = page.getByRole('button', { name: /In progress/ });
+ await expect(chip).toBeVisible();
+ await chip.click();
+ await expect(chip).toHaveAttribute('aria-pressed', 'true');
+ await expect(page).toHaveURL(/#progress=1$/);
+ await expect(cards(page)).toHaveCount(1);
+ await expect(cards(page).first()).toHaveAttribute('data-id', id!);
+});
+
+test('sorts newest, oldest, longest and shortest', async ({ page }) => {
+ // Four trips through the sort menu; give it room on a busy dev server.
+ test.slow();
+ const order = async () => (await shown(page)).slice(0, 12);
+
+ await pick(page, 'xp-sort', 'oldest');
+ await expect(page).toHaveURL(/#sort=oldest$/);
+ let results = await order();
+ expect(results.map((card) => card.index)).toEqual(
+ [...results].sort((a, b) => b.index - a.index).map((card) => card.index)
+ );
+
+ await pick(page, 'xp-sort', 'longest');
+ results = await order();
+ expect(results.map((card) => card.duration)).toEqual(
+ [...results].map((card) => card.duration).sort((a, b) => b - a)
+ );
+
+ await pick(page, 'xp-sort', 'shortest');
+ results = await order();
+ expect(results.map((card) => card.duration)).toEqual(
+ [...results].map((card) => card.duration).sort((a, b) => a - b)
+ );
+
+ await pick(page, 'xp-sort', 'newest');
+ await expect(page).toHaveURL(/\/#all$/);
+ results = await order();
+ expect(results.map((card) => card.index)).toEqual(results.map((_, i) => i));
+});
+
+/** Where the browser can open a parked block for find in page (hidden until
+ found), only the cards around the viewport are in the grid. */
+const windowed = (page: Page) =>
+ page.evaluate(
+ () =>
+ 'onbeforematch' in HTMLElement.prototype &&
+ CSS.supports('position-anchor', '--x')
+ );
+
+const parksInView = (page: Page) =>
+ page.evaluate(() =>
+ [...document.querySelectorAll('.xp-park:not([data-empty])')].some(
+ (park) => {
+ const box = park.getBoundingClientRect();
+ return box.bottom > 0 && box.top < innerHeight;
+ }
+ )
+ );
+
+test('keeps only the cards around the viewport in the grid', async ({
+ page
+}) => {
+ test.skip(!(await windowed(page)), 'Every card stays in the grid here');
+ const total = await cards(page).count();
+ const inGrid = page.locator('.xp-list > .xp-card:not([hidden])');
+ await expect.poll(() => inGrid.count()).toBeLessThan(total / 2);
+ const height = await page.evaluate(
+ () => document.documentElement.scrollHeight
+ );
+ for (const at of [0.3, 0.7, 0.1]) {
+ await page.evaluate(
+ (at) => scrollTo(0, document.documentElement.scrollHeight * at),
+ at
+ );
+ await expect.poll(() => parksInView(page)).toBe(false);
+ }
+ expect(await page.evaluate(() => document.documentElement.scrollHeight)).toBe(
+ height
+ );
+});
+
+test('keeps every card in its place as the window moves', async ({ page }) => {
+ test.skip(!(await windowed(page)), 'Every card stays in the grid here');
+ const place = (index?: string) =>
+ page.evaluate((index) => {
+ const card = index
+ ? document.querySelector(
+ `.xp-card[data-index="${index}"]`
+ )!
+ : [
+ ...document.querySelectorAll('.xp-list > .xp-card')
+ ].find((li) => li.getBoundingClientRect().top > 200)!;
+ return {
+ index: card.dataset.index!,
+ top: Math.round(card.getBoundingClientRect().top + scrollY)
+ };
+ }, index);
+ await page.evaluate(() =>
+ scrollTo(0, document.documentElement.scrollHeight * 0.3)
+ );
+ await expect.poll(() => parksInView(page)).toBe(false);
+ const before = await place();
+ // Down, back past it to the top, and back: cards leave the grid and come
+ // into it again from either side.
+ for (const at of [0.8, 0.02, 0.3]) {
+ await page.evaluate(
+ (at) => scrollTo(0, document.documentElement.scrollHeight * at),
+ at
+ );
+ await expect.poll(() => parksInView(page)).toBe(false);
+ }
+ expect(await place(before.index)).toEqual(before);
+ // Back up a screen at a time: cards come into the grid above the ones
+ // already there, and take their own places, in order.
+ for (let i = 0; i < 8; i++) {
+ await page.mouse.wheel(0, -450);
+ await page.waitForTimeout(120);
+ }
+ await expect.poll(() => parksInView(page)).toBe(false);
+ const seen = await page.evaluate(() =>
+ [...document.querySelectorAll('.xp-list > .xp-card')]
+ .map((li) => ({ li, box: li.getBoundingClientRect() }))
+ .filter(({ box }) => box.bottom > 0 && box.top < innerHeight)
+ .sort((a, b) => a.box.top - b.box.top || a.box.left - b.box.left)
+ .map(({ li }) => Number(li.dataset.index))
+ );
+ expect(seen.length).toBeGreaterThan(3);
+ expect(seen).toEqual([...seen].sort((a, b) => a - b));
+});
+
+test('finds a far card from a link into it', async ({ page }) => {
+ test.skip(!(await windowed(page)), 'Every card stays in the grid here');
+ await expect(page.locator('.xp-park[data-below] .xp-card')).not.toHaveCount(
+ 0
+ );
+ await page.evaluate(() => {
+ const parked = [...document.querySelectorAll('.xp-park .xp-card')];
+ parked[Math.floor(parked.length * 0.7)]!.querySelector('.xp-title a')!.id =
+ 'far-card';
+ location.hash = 'far-card';
+ });
+ const link = page.locator('#far-card');
+ await expect(link).toBeInViewport();
+ await expect(page.locator('.xp-list > .xp-card:has(#far-card)')).toHaveCount(
+ 1
+ );
+ await expect.poll(() => parksInView(page)).toBe(false);
+});
+
+test('switches between grid and list', async ({ page }) => {
+ const list = page.locator('.xp-list');
+ await expect(list).toHaveAttribute('data-view', 'grid');
+ await page.locator('label:has(input[name=view][value=list])').click();
+ await expect(list).toHaveAttribute('data-view', 'list');
+ await expect(page).toHaveURL(/#view=list$/);
+ await page.locator('label:has(input[name=view][value=grid])').click();
+ await expect(list).toHaveAttribute('data-view', 'grid');
+ await expect(page).toHaveURL(/\/#all$/);
+});
+
+test('arrives filtered from a link, and steps back and forward', async ({
+ page
+}) => {
+ await page.goto('/#q=ai&kind=audio&sort=oldest&view=list');
+ await expect(page.locator('[data-explorer][data-live]')).toBeAttached();
+ await expect(
+ page.getByRole('searchbox', { name: 'Search episodes' })
+ ).toHaveValue('ai');
+ await expect(page.locator('input[name=kind][value=audio]')).toBeChecked();
+ await expect(page.locator('[data-xp-label="sort"]')).toHaveText(
+ 'Oldest first'
+ );
+ await expect(page.locator('.xp-list')).toHaveAttribute('data-view', 'list');
+ const results = await shown(page);
+ expect(results.every((card) => !card.video)).toBe(true);
+ await expect(count(page)).toHaveText(String(results.length));
+
+ await page.locator('label:has(input[name=view][value=grid])').click();
+ await expect(page).toHaveURL(/#q=ai&kind=audio&sort=oldest$/);
+ await page.goBack();
+ await expect(page.locator('.xp-list')).toHaveAttribute('data-view', 'list');
+ await page.goForward();
+ await expect(page.locator('.xp-list')).toHaveAttribute('data-view', 'grid');
+
+ await page.getByRole('button', { name: 'Reset' }).click();
+ await expect(page).toHaveURL(/#sort=oldest$/);
+ await expect(
+ page.getByRole('searchbox', { name: 'Search episodes' })
+ ).toHaveValue('');
+});
+
+test('says so when nothing matches, and offers a way back', async ({
+ page
+}) => {
+ await page
+ .getByRole('searchbox', { name: 'Search episodes' })
+ .fill('zzqx nothing at all');
+ await expect(cards(page)).toHaveCount(0);
+ await expect(page.locator('[data-xp-empty]')).toBeVisible();
+ await page.getByRole('button', { name: 'Show every episode' }).click();
+ await expect(page.locator('[data-xp-empty]')).toBeHidden();
+ await expect(cards(page)).toHaveCount(await page.locator('.xp-card').count());
+});
+
+/** Where a part is on screen, rounded to the pixel. */
+const rect = (page: Page, selector: string) =>
+ page.locator(selector).evaluate((el) => {
+ const r = el.getBoundingClientRect();
+ return [r.left, r.top, r.width].map(Math.round);
+ });
+
+test('opens a card in the close-up, its parts in their slots', async ({
+ page,
+ browserName
+}) => {
+ const card = cards(page).nth(2);
+ const toggle = card.locator('.xp-art');
+ await toggle.click();
+ const explorer = page.locator('[data-explorer]');
+ await expect(explorer).toHaveAttribute('data-open', '');
+ await expect(card).toHaveAttribute('data-on', '');
+ await expect(toggle).toHaveAttribute('aria-expanded', 'true');
+ // The artwork, facts line and title land in the close-up's own slots. Both
+ // sides are measured on every poll: the close-up may still be settling.
+ // Firefox resolves anchor(top) here about 2px above the slot it names, so
+ // it gets that much room.
+ const slack = browserName === 'firefox' ? 3 : 0;
+ const lands = (part: string, slot: string) =>
+ expect
+ .poll(async () => {
+ const [a, b] = await Promise.all([rect(page, part), rect(page, slot)]);
+ return a.every((value, i) => Math.abs(value - b[i]!) <= slack)
+ ? 'in its slot'
+ : `${a} vs ${b}`;
+ })
+ .toBe('in its slot');
+ await lands('.xp-card[data-on] .xp-art', '.xp-cu-art');
+ await lands('.xp-card[data-on] .xp-title', '.xp-cu-title');
+ // The detail column: the episode link, play, and Up next.
+ const detail = card.locator('.xp-detail');
+ await expect(
+ detail.getByRole('link', { name: /Open episode/ })
+ ).toBeVisible();
+ await expect(detail.getByRole('button', { name: /Up next/ })).toBeVisible();
+ await expect(
+ card.getByRole('button', { name: /^Play episode/ })
+ ).toBeVisible();
+
+ await page.keyboard.press('Escape');
+ await expect(explorer).not.toHaveAttribute('data-open', '');
+ await expect(card).not.toHaveAttribute('data-on', '');
+ await expect(toggle).toHaveAttribute('aria-expanded', 'false');
+ await expect(toggle).toBeFocused();
+ await expect(detail).toBeHidden();
+});
+
+test('steps through the results with the arrow keys', async ({ page }) => {
+ await pick(page, 'xp-sort', 'oldest');
+ const order = await shown(page);
+ await cards(page)
+ .filter({ hasText: order[3]!.title })
+ .locator('.xp-art')
+ .click();
+ const on = page.locator('.xp-card[data-on]');
+ await expect(on).toHaveAttribute('data-index', String(order[3]!.index));
+ await page.keyboard.press('ArrowRight');
+ await expect(on).toHaveAttribute('data-index', String(order[4]!.index));
+ // Swapping mid-flight: the last key wins and only one card is open.
+ await page.keyboard.press('ArrowLeft');
+ await page.keyboard.press('ArrowLeft');
+ await expect(on).toHaveAttribute('data-index', String(order[2]!.index));
+ await expect(on).toHaveCount(1);
+ // A cell of the filmstrip opens its episode too.
+ const next = cards(page).filter({ hasText: order[5]!.title });
+ await next.locator('.xp-art-box').click();
+ await expect(next).toHaveAttribute('data-on', '');
+});
+
+test('leans the strip cells in view, and the ones it scrolls to', async ({
+ page
+}) => {
+ await cards(page).nth(2).locator('.xp-art').click();
+ await expect(page.locator('[data-explorer]')).toHaveAttribute(
+ 'data-open',
+ ''
+ );
+ // In view every cell is in depth and leans; two screens off, none is.
+ const depth = () =>
+ page.evaluate(() => {
+ const cells = [
+ ...document.querySelectorAll(
+ '.xp-list > .xp-card:not([hidden], [data-on])'
+ )
+ ].map((li) => ({ li, box: li.getBoundingClientRect() }));
+ const seen = cells.filter(
+ ({ box }) => box.bottom > 0 && box.top < innerHeight
+ );
+ return {
+ seen: seen.length,
+ flat: seen.filter(({ li }) => li.dataset.depth === undefined).length,
+ upright: seen.filter(
+ ({ li }) =>
+ getComputedStyle(li.querySelector('.xp-turn')!).rotate === 'none'
+ ).length,
+ far: cells.filter(
+ ({ li, box }) =>
+ li.dataset.depth !== undefined &&
+ (box.top > innerHeight * 3 || box.bottom < -innerHeight * 2)
+ ).length
+ };
+ });
+ // (Polled together: opened from the top of the page, the page scrolls up
+ // to the archive as the cards fly.)
+ await expect
+ .poll(async () => {
+ const { seen, ...rest } = await depth();
+ return { many: seen > 2, ...rest };
+ })
+ .toMatchObject({ many: true, flat: 0, upright: 0, far: 0 });
+ // A screen down the strip and back: cells take depth as they come.
+ const screen = await page.evaluate(() => innerHeight);
+ for (const by of [screen, -screen]) {
+ await page.mouse.wheel(0, by);
+ await expect.poll(depth).toMatchObject({ flat: 0, upright: 0, far: 0 });
+ }
+});
+
+test('carries cards through the sidebar glide without re-rendering them', async ({
+ page
+}) => {
+ const toggle = page.locator('.rail-toggle').first();
+ const glides = await page.evaluate(() =>
+ CSS.supports('anchor-name', 'attr(data-a type())')
+ );
+ test.skip(
+ !glides || !(await toggle.isVisible()),
+ 'The sidebar folds without a glide here'
+ );
+ await page.evaluate(() =>
+ scrollTo(0, document.documentElement.scrollHeight * 0.4)
+ );
+ await expect.poll(() => parksInView(page)).toBe(false);
+ await toggle.click();
+ // Cards in view keep their containment (no flying mark, which renders a
+ // card in full) and widen their clip to where their parts set out from.
+ const marks = await page.evaluate(() => ({
+ flying: document.querySelectorAll('.xp-card[data-flying]').length,
+ wide: [...document.querySelectorAll('.xp-card')].filter((li) =>
+ li.style.getPropertyValue('overflow-clip-margin')
+ ).length
+ }));
+ expect(marks.flying).toBe(0);
+ expect(marks.wide).toBeGreaterThan(0);
+ await expect
+ .poll(
+ () =>
+ page.evaluate(
+ () =>
+ [...document.querySelectorAll('.xp-card')].filter(
+ (li) => li.style.getPropertyValue('overflow-clip-margin')
+ ).length
+ ),
+ { timeout: 5000 }
+ )
+ .toBe(0);
+ await toggle.click();
+});
+
+test('comes home from an episode already sized', async ({ page }) => {
+ // Seen before the explorer starts on the way back (capture listeners on
+ // the document run first).
+ await page.evaluate(() =>
+ document.addEventListener(
+ 'astro:after-swap',
+ () => {
+ (window as unknown as { sized?: boolean }).sized = document
+ .querySelector('.xp-stage')
+ ?.hasAttribute('data-sized');
+ },
+ { capture: true }
+ )
+ );
+ const link = cards(page).nth(3).locator('.xp-title a');
+ const href = (await link.getAttribute('href'))!;
+ await link.click();
+ // Client-side navigations take 5–9s in CI's Firefox under the suite's load.
+ await page.waitForURL('**' + href, { timeout: 15_000 });
+ await page.goBack();
+ await expect(page.locator('[data-explorer][data-live]')).toBeAttached({
+ timeout: 15_000
+ });
+ expect(
+ await page.evaluate(() => (window as unknown as { sized?: boolean }).sized)
+ ).toBe(true);
+});
+
+test('a card grows under the pointer, in the grid and the list, and is flat at rest', async ({
+ page
+}) => {
+ const card = cards(page).nth(1);
+ const art = card.locator('.xp-art');
+ // The artwork's scale, as a number (1 at rest, however it is written).
+ const scale = () =>
+ art.evaluate((el) => {
+ const value = getComputedStyle(el).scale;
+ return value === 'none' ? 1 : Number(value.split(' ')[0]);
+ });
+ const hover = await page.evaluate(
+ () =>
+ matchMedia('(hover: hover) and (prefers-reduced-motion: no-preference)')
+ .matches
+ );
+ await expect.poll(scale).toBe(1);
+ await art.hover();
+ await expect.poll(scale).toBe(hover ? 1.06 : 1);
+ await page.mouse.move(5, 5);
+ await expect.poll(scale).toBe(1);
+ // A list row's thumb grows by more, so it reads at its size.
+ await page.locator('label:has(input[name=view][value=list])').click();
+ await expect(page.locator('.xp-list')).toHaveAttribute('data-view', 'list');
+ await expect.poll(scale).toBe(1);
+ await art.hover();
+ await expect.poll(scale).toBe(hover ? 1.12 : 1);
+ await page.mouse.move(5, 5);
+ await expect.poll(scale).toBe(1);
+ await page.locator('label:has(input[name=view][value=grid])').click();
+ await expect(page.locator('.xp-list')).toHaveAttribute('data-view', 'grid');
+ // No card in the wall is in 3D: no transform, perspective or 3D context
+ // anywhere inside one.
+ const deep = await page.evaluate(
+ () =>
+ [...document.querySelectorAll('.xp-list > .xp-card *')].filter((el) => {
+ const style = getComputedStyle(el);
+ return (
+ style.perspective !== 'none' ||
+ style.transformStyle === 'preserve-3d' ||
+ /matrix3d/.test(style.transform) ||
+ style.rotate !== 'none'
+ );
+ }).length
+ );
+ expect(deep).toBe(0);
+});
+
+test('leaves keys to the widgets that take them', async ({ page }) => {
+ const first = (await shown(page))[1]!;
+ await cards(page).filter({ hasText: first.title }).locator('.xp-art').click();
+ const on = page.locator('.xp-card[data-on]');
+ await expect(on).toHaveAttribute('data-index', String(first.index));
+ // A key pressed in another part of the page belongs to it.
+ await page.locator('a[href="/about"]').first().focus();
+ await page.keyboard.press('ArrowRight');
+ // A key another widget handled is not ours either.
+ await page.evaluate(() =>
+ document.addEventListener('keydown', (event) => event.preventDefault(), {
+ once: true
+ })
+ );
+ await on.locator('.xp-art').focus();
+ await page.keyboard.press('ArrowRight');
+ // Escape in the search field is the field's.
+ await page.getByRole('searchbox', { name: 'Search episodes' }).focus();
+ await page.keyboard.press('Escape');
+ await expect(on).toHaveAttribute('data-index', String(first.index));
+ await expect(on).toHaveCount(1);
+ // From the card itself the keys still step and close.
+ await on.locator('.xp-art').focus();
+ await page.keyboard.press('ArrowRight');
+ await expect(on).not.toHaveAttribute('data-index', String(first.index));
+ await page.keyboard.press('Escape');
+ await expect(on).toHaveCount(0);
+});
+
+test('finds a host or guest by name', async ({ page }) => {
+ const menu = page.locator('#xp-people');
+ test.skip((await menu.count()) === 0, 'No guests database for this site');
+ const option = menu.locator('label:has(input[value]:not([value=""]))').nth(3);
+ const person = await option.locator('input').getAttribute('value');
+ const name = (await option.locator('span:not([class])').textContent())!;
+ await page
+ .getByRole('searchbox', { name: 'Search episodes' })
+ .fill(name.toLowerCase());
+ const results = await shown(page);
+ const theirs = results.filter((card) =>
+ card.people.split(' ').map(decodeURIComponent).includes(person!)
+ );
+ // Every episode they are on is found, whatever its description says.
+ const all = await page
+ .locator('.xp-card')
+ .evaluateAll(
+ (items, id) =>
+ items.filter((li) =>
+ ((li as HTMLElement).dataset.people ?? '')
+ .split(' ')
+ .map(decodeURIComponent)
+ .includes(id)
+ ).length,
+ person!
+ );
+ expect(theirs.length).toBe(all);
+});
+
+test('keeps focus clear of the sticky toolbar', async ({ page }) => {
+ await page.evaluate(() => scrollTo(0, document.body.scrollHeight / 3));
+ await expect(page.locator('[data-xp-bar]')).toBeInViewport();
+ // Start from a card in the middle of the screen and back up through the
+ // archive from the keyboard: once the page has scrolled, each focused
+ // control is below the toolbar, never under it.
+ await page.evaluate(() => {
+ const middle = document
+ .elementFromPoint(innerWidth / 2, innerHeight / 2)!
+ .closest('.xp-card') as HTMLElement;
+ middle.querySelector('.xp-title a')!.focus();
+ });
+ for (let i = 0; i < 12; i++) {
+ await page.keyboard.press('Shift+Tab');
+ await expect
+ .poll(() =>
+ page.evaluate(() => {
+ const focused = document.activeElement!;
+ if (!focused.closest('.xp-card')) {
+ return true;
+ }
+ const bar = document.querySelector('[data-xp-bar]')!;
+ return (
+ focused.getBoundingClientRect().top >=
+ bar.getBoundingClientRect().bottom - 1
+ );
+ })
+ )
+ .toBe(true);
+ }
+});
+
+test('treats a filter the menus do not offer as no filter', async ({
+ page
+}) => {
+ await page.goto('/#year=1899&guest=nobody-at-all');
+ await expect(page.locator('[data-explorer][data-live]')).toBeAttached();
+ await expect(page.locator('[data-xp-label="year"]')).toHaveText('Any');
+ await expect(page.locator('[popovertarget="xp-year"]')).not.toHaveAttribute(
+ 'data-on',
+ ''
+ );
+ expect(await cards(page).count()).toBeGreaterThan(100);
+});
+
+test('hides the In progress chip once it is off and nothing is started', async ({
+ page
+}) => {
+ const chip = page.locator('[data-xp-progress]');
+ await page.goto('/#progress=1');
+ await expect(page.locator('[data-explorer][data-live]')).toBeAttached();
+ await expect(chip).toBeVisible();
+ await chip.click();
+ await expect(page).toHaveURL(/\/#all$/);
+ await expect(chip).toBeHidden();
+});
+
+test('comes back to the card it left, closing or returning', async ({
+ page
+}) => {
+ // Two navigations, each up to 15s in CI's Firefox.
+ test.slow();
+ const inView = (index: string) =>
+ page.evaluate((index) => {
+ const box = document
+ .querySelector(`.xp-card[data-index="${index}"] .xp-art-box`)!
+ .getBoundingClientRect();
+ const bar = document
+ .querySelector('[data-xp-bar]')!
+ .getBoundingClientRect();
+ return (
+ box.height > 0 &&
+ box.top >= bar.bottom - 2 &&
+ box.bottom <= innerHeight + 2
+ );
+ }, index);
+ await page.evaluate(() =>
+ scrollTo(0, document.documentElement.scrollHeight * 0.4)
+ );
+ await expect.poll(() => page.evaluate(() => scrollY)).toBeGreaterThan(0);
+ // The whole card nearest the middle of the view, once the window has
+ // followed there. Cards run tall, so pick by distance rather than a band.
+ const middle = () =>
+ page.evaluate(() => {
+ const bar = document
+ .querySelector('[data-xp-bar]')!
+ .getBoundingClientRect().bottom;
+ const whole = [
+ ...document.querySelectorAll('.xp-list > .xp-card')
+ ].filter((li) => {
+ const box = li.getBoundingClientRect();
+ return box.top >= bar && box.bottom <= innerHeight;
+ });
+ const off = (li: HTMLElement) => {
+ const box = li.getBoundingClientRect();
+ return Math.abs((box.top + box.bottom) / 2 - innerHeight / 2);
+ };
+ return whole.sort((a, b) => off(a) - off(b))[0]?.dataset.index;
+ });
+ await expect.poll(middle).toBeTruthy();
+ const index = (await middle())!;
+ const card = page.locator(`.xp-card[data-index="${index}"]`);
+ // Stepping on from it and closing comes back to the card in the close-up.
+ await card.locator('.xp-art').click();
+ await page.keyboard.press('ArrowRight');
+ const on = page.locator('.xp-card[data-on]');
+ await expect(on).not.toHaveAttribute('data-index', index);
+ const stepped = (await on.getAttribute('data-index'))!;
+ await page.keyboard.press('Escape');
+ await expect(on).toHaveCount(0);
+ await expect.poll(() => inView(stepped)).toBe(true);
+ // Opening its episode from the close-up and coming back does too.
+ await page.locator(`.xp-card[data-index="${stepped}"] .xp-art`).click();
+ await page.locator('.xp-card[data-on] .xp-open').click();
+ await expect(page).not.toHaveURL(/\/$/, { timeout: 15_000 });
+ await page.goBack();
+ await expect(page.locator('[data-explorer][data-live]')).toBeAttached({
+ timeout: 15_000
+ });
+ await expect.poll(() => inView(stepped)).toBe(true);
+});
+
+test('adds the open episode to Up next', async ({ page }) => {
+ await cards(page).nth(1).locator('.xp-art').click();
+ const queue = page.locator('.xp-card[data-on] .xp-queue');
+ await queue.click();
+ await expect(queue).toHaveAttribute('aria-pressed', 'true');
+ await expect(queue).toContainText('In Up next');
+ const id = await page.locator('.xp-card[data-on]').getAttribute('data-id');
+ expect(
+ await page.evaluate(() => localStorage.getItem('starpod:queue'))
+ ).toContain(id!);
+ await queue.click();
+ await expect(queue).toHaveAttribute('aria-pressed', 'false');
+});
+
+test('plays an episode from its card', async ({ page }) => {
+ const card = cards(page).nth(1);
+ const title = (await shown(page))[1]!.title;
+ // At rest the disc is plain markup; pressed, it plays its episode, and
+ // the card gets the live control.
+ await card.scrollIntoViewIfNeeded();
+ await card.getByRole('button', { name: /^Play episode/ }).click();
+ const dock = page.locator('.dock-controls');
+ await expect(dock).toBeVisible();
+ await expect(dock).toContainText(title);
+ await expect(card).toHaveAttribute('data-current', '');
+ await expect(
+ card.getByRole('button', { name: /^Pause episode/ })
+ ).toBeVisible();
+});
diff --git a/tests/e2e/player-phone.spec.ts b/tests/e2e/player-phone.spec.ts
new file mode 100644
index 00000000..a21f5494
--- /dev/null
+++ b/tests/e2e/player-phone.spec.ts
@@ -0,0 +1,101 @@
+import { expect, test, type Page } from '@playwright/test';
+
+// The player on a phone's screen (the site's phone query: up to 767px wide,
+// or a landscape screen up to 500px tall).
+test.use({ viewport: { width: 393, height: 659 }, hasTouch: true });
+
+// Episode 260 has video and a transcript of seek chips.
+const VIDEO_EPISODE = '/will-ai-kill-us-all-jev-says-87';
+
+const media = (page: Page) => page.locator('video.starpod-media');
+const home = (page: Page) => media(page).evaluate((video) => video.parentElement?.className ?? '');
+
+async function open(page: Page, path: string) {
+ await page.goto(path);
+ await expect(page.locator('astro-island:has(.stage-play)').first()).not.toHaveAttribute('ssr', {
+ timeout: 30_000
+ });
+}
+
+async function play(page: Page) {
+ await page.locator('.stage[data-variant="page"] .stage-play').click();
+ const from = await media(page).evaluate((video) => (video as HTMLVideoElement).currentTime);
+ await expect
+ .poll(() => media(page).evaluate((video) => (video as HTMLVideoElement).currentTime), { timeout: 15_000 })
+ .toBeGreaterThan(from);
+}
+
+test("the picture plays in the dock, clear of the transcript's seek chips", async ({ page }) => {
+ await open(page, VIDEO_EPISODE);
+ await play(page);
+ // Reading the transcript, the stage has scrolled away: the picture goes
+ // to the dock rather than floating over the page.
+ await page.evaluate(() =>
+ document.querySelector('article.transcript')!.scrollIntoView({ block: 'start' })
+ );
+ await expect.poll(() => home(page)).toBe('player-cell-media');
+ // No seek chip on screen above the dock is under the picture (the page's
+ // own sticky chrome may cover one at the top; the player may not).
+ const covered = await page.evaluate(() => {
+ const dockTop = document.getElementById('player')!.getBoundingClientRect().top;
+ return [...document.querySelectorAll('article.transcript .seek-chip')]
+ .map((chip) => chip.getBoundingClientRect())
+ .filter((box) => box.top > 0 && box.bottom < dockTop)
+ .map((box) => document.elementFromPoint(box.left + box.width / 2, box.top + box.height / 2))
+ .filter((hit) => hit?.closest('.player-air, #player')).length;
+ });
+ expect(covered).toBe(0);
+});
+
+test('the card closes from its visible close, and from a swipe down its top', async ({ page }) => {
+ await open(page, VIDEO_EPISODE);
+ await play(page);
+ const island = page.locator('#player');
+ await island.locator('.island-name').click();
+ await expect(island).toHaveAttribute('data-state', 'card');
+ // No home control on a phone: the card's own close stands in for it.
+ await expect(island.getByRole('radiogroup', { name: 'Player home' }).first()).toBeHidden();
+ const close = page.getByRole('button', { name: 'Close the now-playing card', exact: true });
+ await expect(close).toBeVisible();
+ await expect(close).toBeFocused();
+ const box = (await close.boundingBox())!;
+ expect(Math.min(box.width, box.height)).toBeGreaterThanOrEqual(44);
+ await close.click();
+ await expect(island).toHaveAttribute('data-state', 'dock');
+
+ await island.locator('.island-name').click();
+ await expect(island).toHaveAttribute('data-state', 'card');
+ // Once it has landed (the journey takes under a second).
+ await expect(island).not.toHaveAttribute('data-moving');
+ const strip = (await island.locator('.island-grab').boundingBox())!;
+ const x = strip.x + strip.width / 2;
+ await page.mouse.move(x, strip.y + 10);
+ await page.mouse.down();
+ for (let step = 1; step <= 10; step++) {
+ await page.mouse.move(x, strip.y + 10 + step * 40);
+ }
+ await page.mouse.up();
+ await expect(island).toHaveAttribute('data-state', 'dock');
+});
+
+test("a queued episode's remove shows on a touch screen, off its cover", async ({ page }) => {
+ await open(page, VIDEO_EPISODE);
+ await play(page);
+ const island = page.locator('#player');
+ await island.locator('.island-name').click();
+ await expect(island).not.toHaveAttribute('data-moving');
+ const cover = island.locator('.tile[data-slot="--slot-s0"]');
+ await expect(cover).toBeVisible({ timeout: 15_000 });
+ const queued = await cover.getAttribute('data-id');
+ await cover.locator('.tile-hit').click();
+ const row = island.locator('.board-row').first();
+ const remove = row.getByRole('button', { name: /^Remove .+ from Up next$/ });
+ // Shown without hover, 44px, and clear of the cover (a tap there plays it).
+ await expect(remove).toBeVisible();
+ const box = (await remove.boundingBox())!;
+ expect(Math.min(box.width, box.height)).toBeGreaterThanOrEqual(44);
+ const art = (await island.locator(`.tile[data-id="${queued}"] .tile-face`).boundingBox())!;
+ expect(box.x >= art.x + art.width || box.y >= art.y + art.height).toBe(true);
+ await remove.click();
+ expect(await page.evaluate(() => JSON.parse(localStorage.getItem('starpod:queue')!).length)).toBe(0);
+});
diff --git a/tests/e2e/player.spec.ts b/tests/e2e/player.spec.ts
new file mode 100644
index 00000000..8a1e4f07
--- /dev/null
+++ b/tests/e2e/player.spec.ts
@@ -0,0 +1,366 @@
+import { expect, test, type Page } from '@playwright/test';
+
+// Episode 260 has video; episode 120 is audio only.
+const VIDEO_EPISODE = '/will-ai-kill-us-all-jev-says-87';
+
+const media = (page: Page) => page.locator('video.starpod-media');
+const home = (page: Page) =>
+ media(page).evaluate((video) => video.parentElement?.className ?? '');
+const playhead = (page: Page) =>
+ media(page).evaluate((video) => (video as HTMLVideoElement).currentTime);
+
+// The app's own ready signals, rather than fixed waits: a page is ready
+// once its stage controls have hydrated (Astro drops `ssr` from the island),
+// and a client-side navigation has arrived when Astro fires astro:page-load.
+async function open(page: Page, path: string) {
+ await page.goto(path);
+ await expect(page.locator('astro-island:has(.stage-play)').first()).not.toHaveAttribute(
+ 'ssr',
+ { timeout: 30_000 }
+ );
+}
+
+async function navigateBy(page: Page, link: ReturnType) {
+ const arrived = page.evaluate(
+ () =>
+ new Promise((resolve) =>
+ document.addEventListener('astro:page-load', () => resolve(location.pathname), {
+ once: true
+ })
+ )
+ );
+ await link.click();
+ return arrived;
+}
+
+// CI's Playwright image has no sound server (Firefox logs "Unable to use
+// PulseAudio"), so its Firefox can't play any audio: an episode's MP3 errors
+// with MEDIA_ERR_DECODE, never plays and never ends. Chromium and WebKit
+// cover these tests there; video episodes play in all three.
+const noAudioOutput = (browserName: string) =>
+ browserName === 'firefox' && !!process.env.CI;
+
+async function expectPlaying(page: Page) {
+ const from = await playhead(page);
+ await expect.poll(() => playhead(page), { timeout: 15_000 }).toBeGreaterThan(from);
+}
+
+test('the picture leaves its stage for a corner, comes back, moves, expands and keeps playing across pages', async ({
+ page
+}) => {
+ // A long journey: on CI's runners it takes 15–40s.
+ test.slow();
+ await open(page, VIDEO_EPISODE);
+ await page.getByRole('button', { name: /^Play episode 260/ }).first().click();
+ await expectPlaying(page);
+ await expect.poll(() => home(page)).toBe('stage-slot');
+
+ // Scroll the stage away: the picture flies out to its corner.
+ await page.mouse.wheel(0, 1200);
+ await expect.poll(() => home(page)).toBe('player-media-frame');
+ const picture = page.locator('[data-player-media]');
+ await expect(picture).toHaveAttribute('data-station', 'corner');
+ await expect(picture).toHaveAttribute('data-corner', 'se');
+ await expectPlaying(page);
+
+ // Keyboard: move it round to the next corner, and it remembers.
+ await page.getByRole('button', { name: 'Move the picture to the bottom left corner' }).click();
+ await expect(picture).toHaveAttribute('data-corner', 'sw');
+ expect(await page.evaluate(() => localStorage.getItem('starpod:pip-corner'))).toBe('"sw"');
+
+ // Drag it to the top right and let go: it lands in that corner. Wait for
+ // the move above to land first, so the drag starts on the picture.
+ const settled = async () => {
+ const a = await page.locator('.player-media-box').boundingBox();
+ await page.waitForTimeout(150);
+ const b = await page.locator('.player-media-box').boundingBox();
+ return Math.abs(a!.x - b!.x) + Math.abs(a!.y - b!.y);
+ };
+ await expect.poll(settled, { timeout: 10_000 }).toBeLessThan(1);
+ const box = (await page.locator('.player-media-box').boundingBox())!;
+ await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
+ await page.mouse.down();
+ const viewport = page.viewportSize()!;
+ for (let step = 1; step <= 8; step++) {
+ await page.mouse.move(
+ box.x + box.width / 2 + ((viewport.width * 0.85 - box.x - box.width / 2) * step) / 8,
+ box.y + box.height / 2 + ((viewport.height * 0.2 - box.y - box.height / 2) * step) / 8
+ );
+ await page.waitForTimeout(16);
+ }
+ await page.mouse.up();
+ await expect(picture).toHaveAttribute('data-corner', 'ne');
+
+ // The island: one element with four homes, chosen by number as in the
+ // demo, and published on .
+ const island = page.locator('#player');
+ await page.keyboard.press('1');
+ await expect(island).toHaveAttribute('data-state', 'pill');
+ await expect(page.locator('html')).toHaveAttribute('data-island', 'pill');
+ await page.keyboard.press('4');
+ await expect(island).toHaveAttribute('data-state', 'rail');
+ // In the rail it sits inside the sidebar.
+ await expect
+ .poll(async () => (await island.boundingBox())!.x + (await island.boundingBox())!.width)
+ .toBeLessThan(300);
+
+ // Its body opens the card, where the picture docks large and Up next waits.
+ await island.locator('.island-name').click();
+ await expect(island).toHaveAttribute('data-state', 'card');
+ await expect(page.getByRole('heading', { name: 'Up next' })).toBeVisible();
+ await expect.poll(() => home(page)).toBe('player-cell-media');
+
+ // A tap on a shelf cover queues it to play next; its cover flies to Up next.
+ const shelfCover = island.locator('.tile[data-slot="--slot-s0"]');
+ await expect(shelfCover).toBeVisible();
+ const queued = await shelfCover.getAttribute('data-id');
+ await shelfCover.click();
+ await expect(island.locator(`.tile[data-id="${queued}"]`)).toHaveAttribute('data-slot', '--slot-q0');
+ expect(await page.evaluate(() => JSON.parse(localStorage.getItem('starpod:queue')!)[0].id)).toBe(
+ queued
+ );
+
+ // Escape closes the card back to the home it came from.
+ await page.keyboard.press('Escape');
+ await expect(island).toHaveAttribute('data-state', 'rail');
+ await expect.poll(() => home(page)).toBe('player-media-frame');
+ await page.keyboard.press('3');
+ await expect(island).toHaveAttribute('data-state', 'dock');
+
+ // Scroll back up: the picture returns to its stage.
+ await page.mouse.wheel(0, -5000);
+ await expect.poll(() => home(page)).toBe('stage-slot');
+
+ // Navigate away with it playing: it keeps playing, floating in its corner.
+ expect(await navigateBy(page, page.locator('a[href="/"]:visible').first())).toBe('/');
+ await expect.poll(() => home(page), { timeout: 15_000 }).toBe('player-media-frame');
+ await expectPlaying(page);
+});
+
+test('an audio episode docks its artwork in the player and plays Up next when it ends', async ({
+ page,
+ browserName
+}) => {
+ test.skip(noAudioOutput(browserName), "CI's Firefox has no audio output");
+ // Queue an episode from its own page; the queue outlives the visit.
+ await open(page, VIDEO_EPISODE);
+ await page.getByRole('button', { name: 'Up next' }).click();
+ await expect(page.getByRole('button', { name: 'Up next' })).toHaveAttribute(
+ 'aria-pressed',
+ 'true'
+ );
+
+ await open(page, '/120');
+ await page.getByRole('button', { name: /^Play episode 120/ }).first().click();
+ await expectPlaying(page);
+
+ // Listening docks by default: the artwork goes to the player bar.
+ await page.mouse.wheel(0, 1500);
+ await expect.poll(() => home(page)).toBe('player-cell-media');
+
+ // Jump to the end; the queued episode plays next and leaves the queue.
+ await media(page).evaluate((video) => {
+ const element = video as HTMLVideoElement;
+ element.currentTime = element.duration - 1;
+ });
+ await expect(page.locator('.island-name b')).toContainText('Will AI Kill Us All', {
+ timeout: 20_000
+ });
+ expect(await page.evaluate(() => localStorage.getItem('starpod:queue'))).toBe('[]');
+});
+
+test('an episode that ends is not heard again while the next one loads its player', async ({
+ page,
+ browserName
+}) => {
+ // Where HLS is not native (Firefox, for one) the next video waits for
+ // hls.js. Stand in for such a browser and hold that import back.
+ test.skip(browserName === 'webkit', 'WebKit plays HLS itself and never loads hls.js');
+ test.skip(noAudioOutput(browserName), "CI's Firefox has no audio output");
+ // It waits on a held-back hls.js and two episodes' players: ~23s locally.
+ test.slow();
+ await page.addInitScript(() => {
+ const can = HTMLMediaElement.prototype.canPlayType;
+ HTMLMediaElement.prototype.canPlayType = function (type: string) {
+ return /mpegurl/i.test(type) ? '' : can.call(this, type);
+ };
+ localStorage.setItem('starpod:medium', 'watch');
+ });
+ await page.route(/hls/, async (route) => {
+ await new Promise((resolve) => setTimeout(resolve, 3000));
+ await route.continue();
+ });
+
+ await open(page, VIDEO_EPISODE);
+ await page.getByRole('button', { name: 'Up next' }).click();
+ await open(page, '/120');
+ await page.getByRole('button', { name: /^Play episode 120/ }).first().click();
+ await expectPlaying(page);
+
+ const audio = await media(page).evaluate((video) => (video as HTMLVideoElement).currentSrc);
+ await media(page).evaluate((video) => {
+ const element = video as HTMLVideoElement;
+ element.currentTime = element.duration - 1;
+ });
+ await expect(page.locator('.island-name b')).toContainText('Will AI Kill Us All', { timeout: 20_000 });
+ // While hls.js loads, the finished episode's audio does not start over.
+ for (let i = 0; i < 8; i++) {
+ const replaying = await media(page).evaluate(
+ (video, audio) => !(video as HTMLVideoElement).paused && (video as HTMLVideoElement).currentSrc === audio,
+ audio
+ );
+ expect(replaying).toBe(false);
+ await page.waitForTimeout(250);
+ }
+ // Then the next episode plays.
+ await expectPlaying(page);
+});
+
+test("a new episode played from its hero starts on its own stage, not from another's picture", async ({
+ page
+}) => {
+ await open(page, VIDEO_EPISODE);
+ await page.locator('.stage-play').click();
+ await expectPlaying(page);
+ // The next episode's page, with this one still playing in its corner.
+ await navigateBy(page, page.locator('a.ep-pager-link').first());
+ await expect(page.locator('astro-island:has(.stage-play)').first()).not.toHaveAttribute('ssr');
+ const picture = page.locator('[data-player-media]');
+ await expect(picture).toHaveAttribute('data-station', 'corner');
+ await expect(picture).not.toHaveAttribute('data-parked');
+ // Let it land in its corner first.
+ const at = async () => JSON.stringify(await picture.locator('> *').first().boundingBox());
+ let last = '';
+ await expect.poll(async () => last === (last = await at()), { timeout: 10_000 }).toBe(true);
+ const corner = (await picture.locator('> *').first().boundingBox())!;
+ // And let the page change finish: until then the page under it takes no clicks.
+ await page.waitForFunction(
+ () =>
+ !document
+ .getAnimations()
+ .some((a) => (a.effect as KeyframeEffect | null)?.pseudoElement?.startsWith('::view-transition'))
+ );
+
+ await page.evaluate(() => {
+ const frames: Array<[boolean, number, number, number, number]> = ((
+ window as unknown as { flight: typeof frames }
+ ).flight = []);
+ const start = performance.now();
+ const tick = () => {
+ const outer = document.querySelector('[data-player-media]')!;
+ const box = outer.firstElementChild!.getBoundingClientRect();
+ frames.push([outer.hasAttribute('data-parked'), box.left, box.top, box.width, box.height]);
+ if (performance.now() - start < 2000) requestAnimationFrame(tick);
+ };
+ requestAnimationFrame(tick);
+ });
+ await page.locator('.stage[data-variant="page"] .stage-play').click();
+ await expect.poll(() => home(page)).toBe('stage-slot');
+ await page.waitForTimeout(2100);
+ // Every frame the floating box still shows, it is where it was: nothing
+ // flies up from the corner, and nothing grows from its size.
+ const frames = await page.evaluate(
+ () => (window as unknown as { flight: Array<[boolean, number, number, number, number]> }).flight
+ );
+ for (const [parked, x, y, width] of frames) {
+ if (!parked) {
+ expect(Math.abs(x - corner.x)).toBeLessThan(1);
+ expect(Math.abs(y - corner.y)).toBeLessThan(1);
+ expect(Math.abs(width - corner.width)).toBeLessThan(1);
+ }
+ }
+});
+
+test('flies back to its own stage from its corner after a client-side navigation', async ({
+ page
+}) => {
+ await open(page, VIDEO_EPISODE);
+ await page.locator('.stage-play').click();
+ await expectPlaying(page);
+ await navigateBy(page, page.locator('a[href="/about"]:visible').first());
+ await expect(page.locator('[data-player-media]')).toHaveAttribute('data-station', 'corner');
+
+ await page.evaluate(() => {
+ const frames: Array = ((window as unknown as { flight: Array }).flight = []);
+ const start = performance.now();
+ const tick = () => {
+ const box = document.querySelector('[data-player-media]')!.firstElementChild!.getBoundingClientRect();
+ frames.push([box.left, box.top, box.width, box.height]);
+ if (performance.now() - start < 8000) requestAnimationFrame(tick);
+ };
+ requestAnimationFrame(tick);
+ });
+ // The floating picture's bar names its episode and links to it.
+ await navigateBy(page, page.locator('.pip-title'));
+ // It lands on its slot…
+ const slot = page.locator('.stage[data-current] [data-media-slot]');
+ await expect
+ .poll(
+ async () => {
+ const [box, target] = await Promise.all([
+ page.locator('[data-player-media] > *').first().boundingBox(),
+ slot.boundingBox()
+ ]);
+ return box && target ? Math.max(Math.abs(box.x - target.x), Math.abs(box.y - target.y)) : Infinity;
+ },
+ { timeout: 10_000 }
+ )
+ .toBeLessThan(2);
+ // …and no frame on the way left the screen (a target measured before the
+ // stage was marked current sent the picture thousands of pixels away).
+ const frames = await page.evaluate(() => (window as unknown as { flight: Array }).flight);
+ for (const [, top, width] of frames) {
+ expect(top).toBeGreaterThan(-60);
+ expect(width).toBeGreaterThan(0);
+ }
+});
+
+test('a queued cover dragged onto another slot reorders Up next', async ({ page }) => {
+ await open(page, VIDEO_EPISODE);
+ await page.locator('.stage-play').click();
+ await expectPlaying(page);
+ const island = page.locator('#player');
+ await page.keyboard.press('2');
+ await expect(island).toHaveAttribute('data-state', 'card');
+
+ // Queue two from the shelf: each tap puts its cover first in Up next.
+ const shelfCover = island.locator('.tile[data-slot="--slot-s0"]');
+ const second = await shelfCover.getAttribute('data-id');
+ await shelfCover.click();
+ await expect(island.locator(`.tile[data-id="${second}"]`)).toHaveAttribute('data-slot', '--slot-q0');
+ const first = await shelfCover.getAttribute('data-id');
+ await shelfCover.click();
+ await expect(island.locator(`.tile[data-id="${first}"]`)).toHaveAttribute('data-slot', '--slot-q0');
+ await expect(island.locator(`.tile[data-id="${second}"]`)).toHaveAttribute('data-slot', '--slot-q1');
+ // Let the covers land before taking hold of one.
+ await expect
+ .poll(() =>
+ page.evaluate(
+ () =>
+ document
+ .getAnimations()
+ .filter((animation) => (animation.effect as KeyframeEffect)?.target?.closest('.tile'))
+ .length
+ )
+ )
+ .toBe(0);
+
+ // Drag the second by its art, with real pointer moves, onto the first's
+ // slot (Up next scrolled back into view: the taps scrolled to the shelf).
+ await island.locator('.board-next').evaluate((tray) => tray.scrollIntoView({ block: 'nearest' }));
+ const from = (await island.locator(`.tile[data-id="${second}"] .tile-face`).boundingBox())!;
+ const to = (await island.locator('.slot[data-slot="--slot-q0"]').boundingBox())!;
+ await page.mouse.move(from.x + from.width / 2, from.y + from.height / 2);
+ await page.mouse.down();
+ await page.mouse.move(to.x + to.width / 2, to.y + to.height / 2, { steps: 12 });
+ await expect(island.locator(`.tile[data-id="${second}"]`)).toHaveAttribute('data-held', '');
+ await page.mouse.up();
+
+ await expect(island.locator(`.tile[data-id="${second}"]`)).toHaveAttribute('data-slot', '--slot-q0');
+ await expect(island.locator(`.tile[data-id="${first}"]`)).toHaveAttribute('data-slot', '--slot-q1');
+ expect(
+ await page.evaluate(() =>
+ JSON.parse(localStorage.getItem('starpod:queue')!).map((episode: { id: string }) => episode.id)
+ )
+ ).toEqual([second, first]);
+});
diff --git a/tests/e2e/shell.spec.ts b/tests/e2e/shell.spec.ts
new file mode 100644
index 00000000..5397ec52
--- /dev/null
+++ b/tests/e2e/shell.spec.ts
@@ -0,0 +1,1013 @@
+import { expect, test, type Page } from '@playwright/test';
+
+// The collapsible rail, its names and flyouts, and the search palette.
+
+const rail = (page: Page) => page.locator('.rail');
+const toggle = (page: Page) => page.locator('.rail-toggle');
+const state = (page: Page) =>
+ page.evaluate(() => document.documentElement.dataset.rail);
+// The search island owns ⌘K; it drops its ssr attribute once hydrated.
+const hydrated = (page: Page) =>
+ page.waitForSelector(
+ 'astro-island[component-url*="SearchDialog"]:not([ssr])',
+ {
+ state: 'attached'
+ }
+ );
+// Wait for the rail's pieces to land before pointing at them. (Only the
+// rail's own transitions: scroll-driven animations elsewhere always run.)
+// A click or a release settles in the next frame, so wait two first.
+const settled = async (page: Page) => {
+ await page.evaluate(
+ () =>
+ new Promise((done) =>
+ requestAnimationFrame(() => requestAnimationFrame(done))
+ )
+ );
+ await page.waitForFunction(() =>
+ document
+ .querySelector('.rail')!
+ .getAnimations({ subtree: true })
+ .every((animation) => animation.playState !== 'running')
+ );
+};
+// The page column the rail holds open, at rest.
+const railWidth = (page: Page) =>
+ page.evaluate(
+ () =>
+ getComputedStyle(
+ document.querySelector('.app')!
+ ).gridTemplateColumns.split(' ')[0]
+ );
+const divider = (page: Page) =>
+ page.getByRole('separator', { name: 'Resize sidebar' });
+const anchors = (page: Page) =>
+ page.evaluate(() =>
+ CSS.supports('anchor-name', 'attr(data-a type())')
+ );
+// Plain anchor positioning, which places the flyouts and the tooltip even
+// where typed attr() is missing (WebKit).
+const placeable = (page: Page) =>
+ page.evaluate(() => CSS.supports('anchor-name', '--a'));
+// Where the divider is drawn, transforms included.
+const edgeX = (page: Page) =>
+ page.evaluate(() =>
+ Math.round(document.querySelector('.rail-edge')!.getBoundingClientRect().x)
+ );
+
+test.describe('desktop rail', () => {
+ test.use({ viewport: { width: 1440, height: 900 } });
+
+ test('collapses to an icon rail and expands again', async ({ page }) => {
+ await page.goto('/');
+ expect(await state(page)).toBe('expanded');
+ await expect(toggle(page)).toHaveAttribute('aria-expanded', 'true');
+ expect(await railWidth(page)).toBe('272px');
+
+ await toggle(page).click();
+ await expect.poll(() => state(page)).toBe('collapsed');
+ await expect(toggle(page)).toHaveAttribute('aria-expanded', 'false');
+ expect(await railWidth(page)).toBe('72px');
+ await expect
+ .poll(async () => (await rail(page).boundingBox())?.width)
+ .toBe(72);
+ // Every nav link is still there, as a named icon.
+ await expect(
+ page.locator('.rail-nav').getByRole('link', { name: 'About' })
+ ).toBeVisible();
+
+ await toggle(page).click();
+ await expect.poll(() => state(page)).toBe('expanded');
+ await expect
+ .poll(async () => (await rail(page).boundingBox())?.width)
+ .toBe(272);
+ });
+
+ test('keeps its icons on the line the art, headers and faces share', async ({
+ page
+ }) => {
+ // The inline-start edge, or the centre, of everything a selector finds.
+ const xs = (selector: string, at: 'start' | 'centre') =>
+ page.evaluate(
+ ([selector, at]) =>
+ [...document.querySelectorAll(selector)].map((el) => {
+ const box = el.getBoundingClientRect();
+ return at === 'start' ? box.left : box.left + box.width / 2;
+ }),
+ [selector, at] as const
+ );
+ const spread = (values: number[]) =>
+ Math.max(...values) - Math.min(...values);
+
+ await page.goto('/');
+ await settled(page);
+ // Open, the icons start on the column's line, not their pills (which
+ // reach past it so the fills have room).
+ const open = await xs(
+ [
+ '.rail-art',
+ '.rail-title',
+ '.rail-search .search-trigger > svg',
+ '.rail-nav .rail-slot > a > svg',
+ '.rail .rail-label',
+ '.rail .platforms > .platform-item:first-child .platform-icon',
+ '.rail-host:first-child .person-face'
+ ].join(', '),
+ 'start'
+ );
+ expect(open.length).toBeGreaterThanOrEqual(9);
+ expect(spread(open)).toBeLessThanOrEqual(0.5);
+
+ // Collapsed, they share one centre line instead.
+ await toggle(page).click();
+ await expect.poll(() => state(page)).toBe('collapsed');
+ await settled(page);
+ const icons = await xs(
+ [
+ '.rail-art',
+ '.rail-toggle',
+ '.rail-search .search-trigger > svg',
+ '.rail-nav .rail-slot > a > svg',
+ '.rail .platforms .platform',
+ '.rail-host .person-face'
+ ].join(', '),
+ 'centre'
+ );
+ expect(spread(icons)).toBeLessThanOrEqual(0.5);
+ });
+
+ test('is held by a divider you can drag, throw, double-click and step', async ({
+ page,
+ browserName
+ }) => {
+ await page.goto('/');
+ await hydrated(page);
+ const edge = divider(page);
+ await expect(edge).toHaveAttribute('aria-valuenow', '272');
+ await expect(edge).toHaveAttribute('aria-valuemin', '72');
+ await expect(edge).toHaveAttribute('aria-valuemax', '272');
+ await expect(edge).toHaveAttribute('aria-controls', 'rail');
+
+ // Under the hand the rail and the page follow the divider exactly.
+ const box = (await edge.boundingBox())!;
+ const y = box.y + box.height / 2;
+ await page.mouse.move(box.x, y);
+ await page.mouse.down();
+ await page.mouse.move(190, y, { steps: 8 });
+ await expect
+ .poll(async () => Math.round((await rail(page).boundingBox())!.width))
+ .toBe(190);
+ expect(await edgeX(page)).toBe(190);
+ // The page follows too: re-laid under the hand, or (on a page too long
+ // to re-lay every frame) riding on a translate until it is let go.
+ expect(
+ await page.evaluate(() =>
+ Math.round(document.querySelector('.main')!.getBoundingClientRect().x)
+ )
+ ).toBe(190);
+ expect(await state(page)).toBe('expanded');
+ // Let go after stopping: no throw, so the nearest stop wins.
+ await page.mouse.move(120, y, { steps: 6 });
+ await page.waitForTimeout(250);
+ await page.mouse.up();
+ await expect.poll(() => state(page)).toBe('collapsed');
+ await expect(edge).toHaveAttribute('aria-valuenow', '72');
+ await expect
+ .poll(async () => (await rail(page).boundingBox())?.width)
+ .toBe(72);
+
+ // A short fast throw carries past the middle to the far stop. The moves
+ // are timed in the page, a frame apart as a hand's arrive: the driver's
+ // own round trips can space them past the 80ms that reads as a stop.
+ // Headless WebKit handles each move here in 50–150ms, which reads as a
+ // hand that stopped, so there the divider is carried past the middle.
+ // Elsewhere the real mouse presses the divider, so its pointer is active
+ // and can be captured, and the moves and the release are fired in the
+ // page under the id that press came with.
+ await page.evaluate(() =>
+ addEventListener(
+ 'pointerdown',
+ (event) =>
+ ((window as unknown as { mouseId?: number }).mouseId =
+ event.pointerId),
+ { capture: true, once: true }
+ )
+ );
+ await page.mouse.move(72, y);
+ await page.mouse.down();
+ if (browserName === 'webkit') {
+ await page.mouse.move(232, y, { steps: 4 });
+ } else {
+ await page.evaluate((y) => {
+ const edge = document.querySelector('.rail-edge')!;
+ const pointerId = (window as unknown as { mouseId: number }).mouseId;
+ const fire = (type: string, x: number) =>
+ edge.dispatchEvent(
+ new PointerEvent(type, {
+ bubbles: true,
+ button: 0,
+ buttons: type === 'pointerup' ? 0 : 1,
+ cancelable: true,
+ clientX: x,
+ clientY: y,
+ isPrimary: true,
+ pointerId,
+ pointerType: 'mouse'
+ })
+ );
+ // A frame apart, waited for in place: under load a timer can fire
+ // far later, which reads as a hand that stopped.
+ const frame = () => {
+ const end = performance.now() + 16;
+ while (performance.now() < end) {
+ // Spin.
+ }
+ };
+ fire('pointermove', 102);
+ frame();
+ fire('pointermove', 132);
+ fire('pointerup', 132);
+ }, y);
+ }
+ await page.mouse.up();
+ await expect.poll(() => state(page)).toBe('expanded');
+ await expect
+ .poll(async () => (await rail(page).boundingBox())?.width)
+ .toBe(272);
+
+ await settled(page);
+ await edge.dblclick();
+ expect(await state(page)).toBe('collapsed');
+
+ await edge.focus();
+ await page.keyboard.press('ArrowRight');
+ expect(await state(page)).toBe('expanded');
+ await expect(edge).toHaveAttribute('aria-valuenow', '272');
+ await page.keyboard.press('ArrowLeft');
+ expect(await state(page)).toBe('collapsed');
+ await page.keyboard.press('Enter');
+ expect(await state(page)).toBe('expanded');
+ await expect(edge).toBeFocused();
+
+ // A held modifier is the browser's (Alt+Left is Back on Windows and
+ // Linux): the divider stays put and leaves the key alone.
+ const prevented = await edge.evaluate((el) =>
+ (['altKey', 'ctrlKey', 'metaKey'] as const).map((modifier) => {
+ const key = new KeyboardEvent('keydown', {
+ key: 'ArrowLeft',
+ bubbles: true,
+ cancelable: true,
+ [modifier]: true
+ });
+ el.dispatchEvent(key);
+ return key.defaultPrevented;
+ })
+ );
+ expect(prevented).toEqual([false, false, false]);
+ expect(await state(page)).toBe('expanded');
+ });
+
+ test('can be caught mid-glide', async ({ page }) => {
+ await page.goto('/');
+ test.skip(!(await anchors(page)), 'The glide needs anchor positioning.');
+ await hydrated(page);
+ await page.evaluate(() =>
+ document.documentElement.style.setProperty('--slomo', '60')
+ );
+ // Slow enough that the divider is still under the pointer when it lands.
+ await divider(page).dblclick();
+ await page.waitForTimeout(2500);
+ const x = await edgeX(page);
+ expect(x).toBeGreaterThan(80);
+ expect(x).toBeLessThan(264);
+
+ // Grabbed, the layout becomes what is on screen at that instant (read
+ // before the shell's own handler runs) and stays there.
+ await page.evaluate(() =>
+ window.addEventListener(
+ 'pointerdown',
+ () =>
+ ((window as unknown as { grabbedAt: number }).grabbedAt = Math.round(
+ document.querySelector('.rail-edge')!.getBoundingClientRect().x
+ )),
+ { capture: true, once: true }
+ )
+ );
+ await page.mouse.move(x, 450);
+ await page.mouse.down();
+ await expect(divider(page)).toHaveAttribute('data-held', '');
+ const grabbedAt = await page.evaluate(
+ () => (window as unknown as { grabbedAt: number }).grabbedAt
+ );
+ await page.waitForTimeout(300);
+ const held = await edgeX(page);
+ expect(Math.abs(held - grabbedAt)).toBeLessThan(2);
+ await page.waitForTimeout(300);
+ expect(await edgeX(page)).toBe(held);
+ expect(
+ Math.abs(Math.round((await rail(page).boundingBox())!.width) - held)
+ ).toBeLessThan(2);
+
+ await page.evaluate(() =>
+ document.documentElement.style.setProperty('--slomo', '1')
+ );
+ await page.mouse.move(held - 40, 450, { steps: 4 });
+ await page.waitForTimeout(250);
+ await page.mouse.up();
+ await expect.poll(() => state(page)).toBe('collapsed');
+ await expect.poll(() => edgeX(page)).toBe(72);
+ });
+
+ test('toggles with the [ key, but not while typing', async ({ page }) => {
+ await page.goto('/');
+ await hydrated(page);
+ await page.locator('body').press('[');
+ expect(await state(page)).toBe('collapsed');
+ await page.locator('body').press('[');
+ expect(await state(page)).toBe('expanded');
+
+ await page.keyboard.press('ControlOrMeta+k');
+ await page.getByPlaceholder('Search episodes...').press('[');
+ expect(await state(page)).toBe('expanded');
+ });
+
+ test('keeps its state across reloads and navigation', async ({ page }) => {
+ await page.goto('/');
+ await toggle(page).click();
+ await expect.poll(() => state(page)).toBe('collapsed');
+
+ // Applied before first paint, so the first frame is already collapsed.
+ await page.addInitScript(() => {
+ document.addEventListener('DOMContentLoaded', () => {
+ (window as unknown as { firstState: string }).firstState =
+ document.documentElement.dataset.rail ?? '';
+ });
+ });
+ await page.reload();
+ expect(
+ await page.evaluate(
+ () => (window as unknown as { firstState: string }).firstState
+ )
+ ).toBe('collapsed');
+ await expect(toggle(page)).toHaveAttribute('aria-expanded', 'false');
+
+ // Client-side navigation swaps the page, not the state.
+ await page.locator('.rail-nav a[href="/about"]').click();
+ await expect(page).toHaveURL(/\/about$/, { timeout: 15_000 });
+ expect(await state(page)).toBe('collapsed');
+ await expect
+ .poll(async () => (await rail(page).boundingBox())?.width)
+ .toBe(72);
+ await expect(toggle(page)).toHaveAttribute('aria-expanded', 'false');
+ });
+
+ test('names the collapsed icons', async ({ page }) => {
+ await page.goto('/');
+ await toggle(page).click();
+ await settled(page);
+ const about = page.locator('.rail-nav a[href="/about"]');
+ if (await placeable(page)) {
+ // One tooltip, anchored to whichever icon it names.
+ await about.hover();
+ const tip = page.locator('#rail-tip');
+ await expect(tip).toHaveText('About');
+ await expect
+ .poll(() => tip.evaluate((el) => el.matches(':popover-open')))
+ .toBe(true);
+ await page.locator('.rail-nav a[href="/contact"]').hover();
+ await expect(tip).toHaveText('Contact');
+ } else {
+ await expect(about).toHaveAttribute('title', 'About');
+ }
+ await expect(about).toHaveAccessibleName('About');
+ });
+
+ test('names an open-rail link only when its label is clipped', async ({
+ page
+ }) => {
+ await page.goto('/');
+ await settled(page);
+ const label = page.locator('.rail-nav a[href="/contact"] > span');
+ // prop-for-that's truncated source reports the clip as --live-truncated.
+ const clipped = () =>
+ label.evaluate((el) =>
+ getComputedStyle(el).getPropertyValue('--live-truncated').trim()
+ );
+ await expect.poll(clipped).toBe('0');
+ await label.evaluate(
+ (el) => (el.textContent = 'Contact the hosts and producers of the show')
+ );
+ await expect.poll(clipped).toBe('1');
+
+ if (await placeable(page)) {
+ await page.locator('.rail-nav a[href="/contact"]').hover();
+ await expect(page.locator('#rail-tip')).toHaveText(
+ 'Contact the hosts and producers of the show'
+ );
+ await page.locator('.rail-nav a[href="/about"]').hover();
+ await page.waitForTimeout(500);
+ await expect
+ .poll(() =>
+ page
+ .locator('#rail-tip')
+ .evaluate((el) => el.matches(':popover-open'))
+ )
+ .toBe(false);
+ }
+ });
+
+ test('sets the six follow marks in one row, evenly, inside the rail', async ({
+ page
+ }) => {
+ await page.goto('/');
+ await settled(page);
+ const { rows, gaps, inside } = await page.evaluate(() => {
+ const marks = [
+ ...document.querySelectorAll('.rail .platforms .platform')
+ ].map((mark) => mark.getBoundingClientRect());
+ const rail = document.querySelector('.rail')!.getBoundingClientRect();
+ const byTop: Record = {};
+ for (const mark of marks) {
+ const top = Math.round(mark.top);
+ byTop[top] = (byTop[top] ?? 0) + 1;
+ }
+ return {
+ rows: Object.values(byTop),
+ gaps: marks.slice(1).map((mark, i) => mark.left - marks[i]!.right),
+ inside: marks.every(
+ (mark) => mark.left >= rail.left && mark.right <= rail.right
+ )
+ };
+ });
+ expect(rows).toEqual([6]);
+ expect(Math.max(...gaps) - Math.min(...gaps)).toBeLessThanOrEqual(0.5);
+ expect(Math.min(...gaps)).toBeGreaterThan(0);
+ expect(inside).toBe(true);
+ });
+
+ test('credits the hosts as co-authors and fans them out', async ({
+ page
+ }) => {
+ await page.goto('/');
+ await settled(page);
+ const hosts = page.locator('.rail-hosts');
+ const faces = () =>
+ hosts.locator('.rail-host img').evaluateAll((imgs) =>
+ imgs.map((img) => {
+ const box = img.getBoundingClientRect();
+ return { x: Math.round(box.x), y: Math.round(box.y) };
+ })
+ );
+ // Shown: opaque and not the visually hidden 1px box of the fallback.
+ const namesShown = () =>
+ hosts
+ .locator('.rail-host-name')
+ .evaluateAll((names) =>
+ names.every(
+ (name) =>
+ getComputedStyle(name).opacity === '1' &&
+ name.getBoundingClientRect().width > 1
+ )
+ );
+
+ // At rest: one credit line beside overlapping faces, and the links
+ // still each named for assistive tech.
+ await expect(hosts.locator('.host-credit')).toHaveText(
+ 'RobbieTheWagner & Adam Argyle'
+ );
+ await expect(hosts.locator('.host-credit')).toHaveAttribute(
+ 'aria-hidden',
+ 'true'
+ );
+ const rest = await faces();
+ expect(rest[1]!.y).toBe(rest[0]!.y);
+ expect(rest[1]!.x - rest[0]!.x).toBeLessThan(36);
+ expect(await namesShown()).toBe(false);
+ // The credit sits beside the stack, not under it, and each face is
+ // positioned, so its drawn hairline and light keep to the face.
+ const credit = await hosts.locator('.host-credit').boundingBox();
+ expect(credit!.x).toBeGreaterThanOrEqual(rest[1]!.x + 32);
+ expect(Math.abs(credit!.y - rest[0]!.y)).toBeLessThan(8);
+ expect(
+ await hosts
+ .locator('.rail-host .person-face')
+ .evaluateAll((faces) =>
+ faces.every((face) => getComputedStyle(face).position !== 'static')
+ )
+ ).toBe(true);
+ for (const name of ['RobbieTheWagner', 'Adam Argyle']) {
+ await expect(hosts.getByRole('link', { name })).toHaveAttribute(
+ 'href',
+ /^https:/
+ );
+ }
+
+ // Hovered: a row per host, each face over the next, names shown.
+ await hosts.locator('.rail-host').first().hover();
+ await expect
+ .poll(async () => {
+ const [a, b] = await faces();
+ return a!.x === b!.x && b!.y - a!.y >= 40;
+ })
+ .toBe(true);
+ await expect.poll(namesShown).toBe(true);
+
+ // Gathered again once the pointer leaves.
+ await page.mouse.move(700, 300);
+ await expect.poll(async () => (await faces())[1]!.y).toBe(rest[1]!.y);
+
+ // Focus inside fans it out too, and the link keeps its name.
+ await hosts.getByRole('link', { name: 'Adam Argyle' }).focus();
+ await expect.poll(namesShown).toBe(true);
+ await expect(
+ hosts.getByRole('link', { name: 'Adam Argyle' })
+ ).toBeFocused();
+ });
+
+ test('opens the follow and host flyouts from the stacks', async ({
+ page
+ }) => {
+ await page.goto('/');
+ await toggle(page).click();
+ await settled(page);
+
+ const follow = page.getByRole('button', { name: 'Follow the show' });
+ await follow.click();
+ const followFly = page.locator('#rail-follow-fly');
+ await expect(
+ followFly.getByRole('link', { name: /Spotify/ })
+ ).toBeVisible();
+ await page.keyboard.press('Escape');
+ await expect(followFly).toBeHidden();
+
+ await page.getByRole('button', { name: 'Hosted by' }).click();
+ await expect(page.locator('#rail-hosts-fly')).toContainText('Adam Argyle');
+
+ // Stacked, the platform links are left to the flyout.
+ expect(
+ await page
+ .locator('.rail-follow .platforms a')
+ .evaluateAll((links) => links.every((a) => a.closest('[inert]')))
+ ).toBe(true);
+ });
+
+ test('keeps its groups whole whatever the components render', async ({
+ page
+ }) => {
+ await page.goto('/');
+ await settled(page);
+ // An overriding Platforms or Hosts knows nothing of anchors. Take the
+ // built-in lists' own anchor names away: the layout's boxes stand in.
+ await page.evaluate(() =>
+ document
+ .querySelectorAll('.rail .platforms, .rail .host-list')
+ .forEach((list) => list.removeAttribute('data-⚓️-name'))
+ );
+ const label = await page
+ .locator('.rail-follow > .rail-label')
+ .boundingBox();
+ const first = await page.locator('.rail-follow a').first().boundingBox();
+ expect(label!.y + label!.height).toBeLessThanOrEqual(first!.y + 1);
+
+ await toggle(page).click();
+ await settled(page);
+ for (const [group, fly] of [
+ ['.rail-follow', '#rail-follow-fly'],
+ ['.rail-hosts', '#rail-hosts-fly']
+ ] as const) {
+ expect(
+ await page
+ .locator(`${group} a`)
+ .evaluateAll((links) => links.every((a) => a.closest('[inert]')))
+ ).toBe(true);
+ const stack = page.locator(`${group} .rail-stack`);
+ const box = await stack.boundingBox();
+ expect(box!.width).toBeGreaterThanOrEqual(40);
+ await stack.click();
+ await expect(page.locator(fly)).toBeVisible();
+ if (await placeable(page)) {
+ // Beside the stack it opened from.
+ const opened = await page.locator(fly).boundingBox();
+ expect(opened!.x).toBeGreaterThanOrEqual(box!.x + box!.width);
+ }
+ await page.keyboard.press('Escape');
+ await expect(page.locator(fly)).toBeHidden();
+ }
+ });
+});
+
+test.describe('rail popovers', () => {
+ // A short window, so the stacks sit near its bottom.
+ test.use({ viewport: { width: 1440, height: 640 } });
+
+ test('open beside what they name, flipping up near the bottom', async ({
+ page
+ }) => {
+ await page.goto('/');
+ await settled(page);
+ test.skip(!(await placeable(page)), 'no anchor positioning');
+
+ // Open, the toggle is named beside it.
+ const tip = page.locator('#rail-tip .rail-tip-box');
+ await toggle(page).hover();
+ await expect(tip).toBeVisible();
+ const toggleBox = await toggle(page).boundingBox();
+ const tipBox = await tip.boundingBox();
+ expect(tipBox!.x).toBeGreaterThanOrEqual(toggleBox!.x + toggleBox!.width);
+ expect(
+ Math.abs(
+ tipBox!.y + tipBox!.height / 2 - (toggleBox!.y + toggleBox!.height / 2)
+ )
+ ).toBeLessThan(3);
+
+ await toggle(page).click();
+ await settled(page);
+ // Collapsed, so is an icon.
+ const icon = page.locator('.rail-nav a').nth(1);
+ await icon.hover();
+ await expect(tip).toHaveText('About');
+ const iconBox = await icon.boundingBox();
+ await expect
+ .poll(async () => {
+ const box = await tip.boundingBox();
+ return Math.abs(
+ box!.y + box!.height / 2 - (iconBox!.y + iconBox!.height / 2)
+ );
+ })
+ .toBeLessThan(3);
+
+ for (const fly of ['#rail-follow-fly', '#rail-hosts-fly']) {
+ const stack = page.locator(`[popovertarget="${fly.slice(1)}"]`);
+ await page.mouse.move(900, 300);
+ await stack.click();
+ const box = page.locator(`${fly} .rail-fly-box`);
+ await expect(box).toBeVisible();
+ const s = (await stack.boundingBox())!;
+ const f = (await box.boundingBox())!;
+ // Beside its stack, level with it, on screen, and here flipped up:
+ // its bottom meets the stack's, and its caret moved down with it.
+ expect(f.x).toBeGreaterThanOrEqual(s.x + s.width);
+ expect(f.y + f.height).toBeLessThanOrEqual(640);
+ expect(Math.abs(f.y + f.height - (s.y + s.height))).toBeLessThan(24);
+ expect(
+ await box.evaluate(
+ (el) =>
+ parseFloat(getComputedStyle(el, '::before').top) >
+ (el as HTMLElement).offsetHeight / 2
+ )
+ ).toBe(true);
+ await page.keyboard.press('Escape');
+ await expect(box).toBeHidden();
+ }
+ });
+});
+
+test.describe('skip links', () => {
+ test.use({ viewport: { width: 1440, height: 900 } });
+
+ test('offer the player only once an episode is loaded', async ({
+ page,
+ browserName
+ }) => {
+ // WebKit reaches links with Option-Tab, as Safari does by default.
+ const tab = browserName === 'webkit' ? 'Alt+Tab' : 'Tab';
+ const toContent = page.getByRole('link', { name: 'Skip to content' });
+ const toPlayer = page.locator('.skip-link[href="#player"]');
+ await page.goto('/');
+ await expect(page.locator('[data-explorer][data-live]')).toBeAttached();
+
+ // A first visit: nothing is loaded and there is no player, so the next
+ // stop after the first skip link is not a link that leads nowhere.
+ await page.keyboard.press(tab);
+ await expect(toContent).toBeFocused();
+ await expect(toPlayer).toBeHidden();
+ await page.keyboard.press(tab);
+ await expect(toPlayer).not.toBeFocused();
+
+ // Once an episode is loaded the link is the second stop and lands in
+ // the player.
+ await page
+ .locator('.xp-hero')
+ .getByRole('button', { name: 'Play episode', exact: true })
+ .click();
+ await expect(page.locator('#player')).toBeAttached();
+ await toContent.focus();
+ await page.keyboard.press(tab);
+ await expect(
+ page.getByRole('link', { name: 'Skip to the player' })
+ ).toBeFocused();
+ await page.keyboard.press('Enter');
+ await expect
+ .poll(() =>
+ page.evaluate(() => Boolean(document.activeElement?.closest('#player')))
+ )
+ .toBe(true);
+ });
+
+ test('jump in place after the explorer has pushed its state', async ({
+ page,
+ browserName
+ }) => {
+ const tab = browserName === 'webkit' ? 'Alt+Tab' : 'Tab';
+ await page.goto('/');
+ await expect(page.locator('[data-explorer][data-live]')).toBeAttached();
+ // A search moves the address to #q=, through the router.
+ await page.getByRole('searchbox', { name: 'Search episodes' }).fill('css');
+ await expect(page).toHaveURL(/#q=css$/);
+ await page.evaluate(() => {
+ (window as Window & { routed?: number }).routed = 0;
+ document.addEventListener('astro:before-preparation', () => {
+ (window as Window & { routed?: number }).routed! += 1;
+ });
+ document.querySelector('[data-explorer]')!.dataset.kept = '';
+ // Back to the top of the tab order.
+ const start = document.createElement('a');
+ start.href = '#';
+ document.body.prepend(start);
+ start.focus();
+ start.remove();
+ });
+
+ await page.keyboard.press(tab);
+ await expect(
+ page.getByRole('link', { name: 'Skip to content' })
+ ).toBeFocused();
+ await page.keyboard.press('Enter');
+
+ // A fragment jump in this document: the explorer and its search stay,
+ // and the router never starts a navigation.
+ await expect(page).toHaveURL(/\/#main$/);
+ await page.waitForTimeout(500);
+ expect(
+ await page.evaluate(() => (window as Window & { routed?: number }).routed)
+ ).toBe(0);
+ await expect(page.locator('[data-explorer][data-kept]')).toBeAttached();
+ await expect(
+ page.getByRole('searchbox', { name: 'Search episodes' })
+ ).toHaveValue('css');
+ });
+});
+
+test.describe('search palette', () => {
+ test.use({ viewport: { width: 1440, height: 900 } });
+
+ test('opens from the rail, filters, and returns focus on close', async ({
+ page
+ }) => {
+ await page.goto('/');
+ const trigger = page.locator('.rail-search [data-search-trigger]');
+ // From the keyboard, so every engine has focus on the trigger to return.
+ await hydrated(page);
+ await trigger.focus();
+ await page.keyboard.press('Enter');
+
+ const dialog = page.getByRole('dialog', { name: 'Search episodes' });
+ await expect(dialog).toBeVisible();
+ const input = page.getByPlaceholder('Search episodes...');
+ await expect(input).toBeFocused();
+
+ await input.fill('css');
+ await expect(page.getByRole('option').first()).toBeVisible();
+ for (const option of await page.getByRole('option').all()) {
+ await expect(option).toContainText(/css/i);
+ }
+
+ await page.keyboard.press('Escape');
+ await expect(dialog).toBeHidden();
+ await expect(trigger).toBeFocused();
+ });
+
+ test('closes the now-playing card first, so ⌘K always works', async ({
+ page
+ }) => {
+ await page.goto('/');
+ await hydrated(page);
+ await page
+ .locator('.xp-hero')
+ .getByRole('button', { name: 'Play episode', exact: true })
+ .click();
+ const island = page.locator('#player');
+ await expect(island).toBeAttached();
+ await page.keyboard.press('2');
+ await expect(island).toHaveAttribute('data-state', 'card');
+ await expect(page.locator('body > [inert]').first()).toBeAttached();
+
+ // The card is modal: the rail's [ belongs to the page behind it, even
+ // from one of the card's buttons (focus starts on its home radio, where
+ // typing already keeps [ out).
+ await island.locator('button:visible').first().focus();
+ const rest = await state(page);
+ await page.keyboard.press('[');
+ await page.waitForTimeout(300);
+ expect(await state(page)).toBe(rest);
+
+ // ⌘K closes the card, then opens the palette, ready to type in.
+ await page.keyboard.press('ControlOrMeta+k');
+ await expect(island).not.toHaveAttribute('data-state', 'card');
+ await expect(
+ page.getByRole('dialog', { name: 'Search episodes' })
+ ).toBeVisible();
+ const input = page.getByPlaceholder('Search episodes...');
+ await expect(input).toBeFocused();
+ // It takes a search at once, while the island is still flying home
+ // (the page stays inert until it lands; the modal palette escapes that).
+ await input.fill('css');
+ await expect(page.getByRole('option').first()).toContainText(/css/i);
+ // And once it has landed, nothing on the page is left inert.
+ await expect.poll(() => page.locator('body > [inert]').count()).toBe(0);
+ });
+
+ test('lands with its contents at their own size, where clicks find them', async ({
+ page
+ }) => {
+ await page.goto('/');
+ await hydrated(page);
+ await page.locator('.rail-search [data-search-trigger]').click();
+ await expect(
+ page.getByRole('dialog', { name: 'Search episodes' })
+ ).toBeVisible();
+
+ // The box flies in on a scale its inner box undoes. Landed, that inner
+ // box is back to identity (WebKit used to keep the counter-scale it was
+ // first given, with the text about ten times tall).
+ await expect
+ .poll(
+ () =>
+ page.locator('.sp-in').evaluate((inner) => {
+ const m = new DOMMatrix(getComputedStyle(inner).transform);
+ return Math.max(
+ Math.abs(m.a - 1),
+ Math.abs(m.d - 1),
+ Math.abs(m.e),
+ Math.abs(m.f)
+ );
+ }),
+ { timeout: 4000 }
+ )
+ .toBeLessThan(0.01);
+
+ // A row is where it is drawn: the point at its centre hits it, and a
+ // click there chooses it.
+ const first = page.getByRole('option').first();
+ expect(
+ await first.evaluate((row) => {
+ const box = row.getBoundingClientRect();
+ const hit = document.elementFromPoint(
+ box.x + box.width / 2,
+ box.y + box.height / 2
+ );
+ return hit?.closest('[role="option"]') === row;
+ })
+ ).toBe(true);
+ // Chosen: the explorer shows the person's episodes.
+ await first.click();
+ await expect(page).toHaveURL(/\/#guest=[^&]+$/);
+ });
+
+ test('opens from the collapsed rail with ⌘K and goes to the chosen episode', async ({
+ page
+ }) => {
+ await page.goto('/');
+ await hydrated(page);
+ await toggle(page).click();
+ await expect.poll(() => state(page)).toBe('collapsed');
+ await page.evaluate(
+ () => ((window as unknown as { kept: boolean }).kept = true)
+ );
+
+ await page.keyboard.press('ControlOrMeta+k');
+ await expect(
+ page.getByRole('dialog', { name: 'Search episodes' })
+ ).toBeVisible();
+ await page.getByPlaceholder('Search episodes...').fill('css');
+ await expect(page.getByRole('option').nth(1)).toBeVisible();
+ await page.keyboard.press('ArrowDown');
+ await expect(page.getByRole('option').nth(1)).toHaveAttribute(
+ 'aria-selected',
+ 'true'
+ );
+ const href = await page.getByRole('option').nth(1).getAttribute('href');
+ await page.keyboard.press('Enter');
+
+ // An episode page renders slowly on a busy dev server.
+ await expect(page).toHaveURL(new RegExp(`${href}$`), { timeout: 15_000 });
+ await expect(
+ page.getByRole('dialog', { name: 'Search episodes' })
+ ).toBeHidden();
+ // A client-side navigation: the page (and any playback) was never reloaded.
+ expect(
+ await page.evaluate(() => (window as unknown as { kept?: boolean }).kept)
+ ).toBe(true);
+ });
+});
+
+test.describe('phone shell', () => {
+ test.use({ viewport: { width: 390, height: 844 } });
+
+ test('searches from the tab bar and keeps the top bar', async ({ page }) => {
+ await page.goto('/');
+ // The dev server's toolbar sits over the middle of the tab bar.
+ await page.addStyleTag({
+ content: 'astro-dev-toolbar { display: none !important; }'
+ });
+ await expect(page.locator('.rail')).toBeHidden();
+ await expect(divider(page)).toBeHidden();
+ await expect(page.locator('.topbar')).toBeVisible();
+
+ await page.locator('.tabbar [data-search-trigger]').click();
+ await expect(
+ page.getByRole('dialog', { name: 'Search episodes' })
+ ).toBeVisible();
+ await page.keyboard.press('Escape');
+ await expect(
+ page.getByRole('dialog', { name: 'Search episodes' })
+ ).toBeHidden();
+
+ await page.locator('.tabbar').getByRole('button', { name: 'More' }).click();
+ await expect(
+ page.locator('#more-sheet').getByRole('link', { name: 'About' })
+ ).toBeVisible();
+ });
+
+ test('holds the page still under an open sheet', async ({ page }) => {
+ await page.goto('/');
+ await page.addStyleTag({
+ content: 'astro-dev-toolbar { display: none !important; }'
+ });
+ await page.evaluate(() => scrollTo(0, 300));
+ const scrolled = () => page.evaluate(() => Math.round(scrollY));
+ const before = await scrolled();
+
+ await page.locator('.tabbar').getByRole('button', { name: 'More' }).click();
+ const sheet = page.locator('#more-sheet');
+ await expect(sheet).toBeVisible();
+ // The sheet has nothing of its own to scroll, nor has its scrim.
+ const box = (await sheet.boundingBox())!;
+ for (const y of [box.y + 60, 40]) {
+ await page.mouse.move(box.x + box.width / 2, y);
+ await page.mouse.wheel(0, 600);
+ await page.waitForTimeout(250);
+ expect(await scrolled()).toBe(before);
+ }
+ // The hosts are listed under the follow marks.
+ await expect(sheet.locator('.host-row')).not.toHaveCount(0);
+
+ await sheet.getByRole('button', { name: 'Close' }).click();
+ await expect(sheet).toBeHidden();
+ await page.mouse.wheel(0, 300);
+ await expect.poll(scrolled).toBeGreaterThan(before);
+ });
+
+ test('keeps the gutter and bars clear of the safe areas', async ({
+ page,
+ browserName
+ }) => {
+ test.skip(browserName !== 'chromium', 'insets are emulated through CDP');
+ await page.setViewportSize({ width: 844, height: 390 });
+ const cdp = await page.context().newCDPSession(page);
+ await cdp.send('Emulation.setSafeAreaInsetsOverride', {
+ insets: { top: 0, left: 47, bottom: 21, right: 47 }
+ });
+ await page.goto('/');
+ const edges = await page.evaluate(() => {
+ const box = (selector: string) =>
+ document.querySelector(selector)!.getBoundingClientRect();
+ const tabs = document.querySelectorAll('.tabbar > *');
+ return {
+ show: box('.topbar-show').left,
+ follow: box('.topbar-follow').right,
+ main: parseFloat(
+ getComputedStyle(document.querySelector('.main')!).paddingLeft
+ ),
+ firstTab: tabs[0]!.getBoundingClientRect().left,
+ lastTab: tabs[tabs.length - 1]!.getBoundingClientRect().right
+ };
+ });
+ expect(edges.show).toBeGreaterThanOrEqual(47);
+ expect(edges.main).toBeGreaterThanOrEqual(47);
+ expect(edges.firstTab).toBeGreaterThanOrEqual(47);
+ expect(edges.follow).toBeLessThanOrEqual(844 - 47);
+ expect(edges.lastTab).toBeLessThanOrEqual(844 - 47);
+ });
+
+ test('sets the tab bar on one 48px line in landscape, and lets the top bar go', async ({
+ page
+ }) => {
+ await page.setViewportSize({ width: 844, height: 390 });
+ await page.goto('/');
+ expect((await page.locator('.tabbar').boundingBox())!.height).toBe(48);
+ // Each tab's icon sits beside its label.
+ const tab = page.locator('.tabbar > a').first();
+ const icon = (await tab.locator('svg').boundingBox())!;
+ const label = (await tab.locator('span').boundingBox())!;
+ expect(icon.x + icon.width).toBeLessThanOrEqual(label.x);
+ expect(
+ Math.abs(icon.y + icon.height / 2 - (label.y + label.height / 2))
+ ).toBeLessThan(2);
+
+ await page.evaluate(() => scrollTo(0, 400));
+ await expect
+ .poll(async () => (await page.locator('.topbar').boundingBox())!.y)
+ .toBeLessThan(0);
+ });
+});
diff --git a/tests/unit/ForwardButton.test.tsx b/tests/unit/ForwardButton.test.tsx
deleted file mode 100644
index 0a8e7420..00000000
--- a/tests/unit/ForwardButton.test.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-import { render, screen, fireEvent } from '@testing-library/preact';
-import { beforeEach, describe, expect, it } from 'vitest';
-import ForwardButton from 'starpod/src/components/player/ForwardButton';
-import { createRef } from 'preact';
-
-// Mock audio element
-const mockAudioElement = {
- currentTime: 0,
- duration: 180
-};
-
-describe('ForwardButton', () => {
- let audioPlayerRef: any;
-
- beforeEach(() => {
- mockAudioElement.currentTime = 0;
- audioPlayerRef = createRef();
- audioPlayerRef.current = mockAudioElement;
- });
-
- it('renders forward button with correct label', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toBeInTheDocument();
- expect(button).toHaveAttribute('aria-label', 'Fast-forward 10 seconds');
- });
-
- it('advances audio by 10 seconds when clicked', () => {
- render();
-
- const button = screen.getByRole('button');
-
- expect(mockAudioElement.currentTime).toBe(0);
-
- fireEvent.click(button);
- expect(mockAudioElement.currentTime).toBe(10);
-
- fireEvent.click(button);
- expect(mockAudioElement.currentTime).toBe(20);
- });
-
- it('handles null audio player gracefully', () => {
- const nullRef = createRef();
- nullRef.current = null;
-
- render();
-
- const button = screen.getByRole('button');
-
- // Should render without crashing
- expect(button).toBeInTheDocument();
-
- // Clicking should not crash when audio player is null
- expect(() => fireEvent.click(button)).not.toThrow();
- });
-
- it('has proper styling classes', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toHaveClass('forward-button');
- expect(button).toHaveClass('gradient-icon');
- expect(button).toHaveClass('relative');
- expect(button).toHaveClass('rounded-full');
- expect(button).toHaveClass('focus:outline-hidden');
- });
-
- it('allows forwarding from any current position', () => {
- mockAudioElement.currentTime = 45;
-
- render();
-
- const button = screen.getByRole('button');
-
- fireEvent.click(button);
- expect(mockAudioElement.currentTime).toBe(55);
- });
-
- it('adds 10 seconds even near track end (browser handles clamping)', () => {
- mockAudioElement.currentTime = 175; // Near end of 180 second track
-
- render();
-
- const button = screen.getByRole('button');
-
- fireEvent.click(button);
- // Current implementation just adds 10 seconds without bounds checking
- // In a real browser, the audio element would clamp this to duration
- expect(mockAudioElement.currentTime).toBe(185);
- });
-});
diff --git a/tests/unit/MuteButton.test.tsx b/tests/unit/MuteButton.test.tsx
deleted file mode 100644
index c458bd27..00000000
--- a/tests/unit/MuteButton.test.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import { render, screen, fireEvent } from '@testing-library/preact';
-import { beforeEach, describe, expect, it } from 'vitest';
-import MuteButton from 'starpod/src/components/player/MuteButton';
-import { isMuted } from 'starpod/src/components/state';
-
-describe('MuteButton', () => {
- beforeEach(() => {
- isMuted.value = false;
- });
-
- it('renders mute button when not muted', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toBeInTheDocument();
- expect(button).toHaveAttribute('aria-label', 'Mute');
- expect(button).toHaveClass('mute-button');
- expect(button).not.toHaveClass('unmute-button');
- });
-
- it('renders unmute button when muted', () => {
- isMuted.value = true;
-
- render();
-
- const button = screen.getByRole('button');
- expect(button).toHaveAttribute('aria-label', 'Unmute');
- expect(button).toHaveClass('unmute-button');
- expect(button).not.toHaveClass('mute-button');
- });
-
- it('toggles mute state when clicked', () => {
- render();
-
- const button = screen.getByRole('button');
-
- expect(isMuted.value).toBe(false);
- expect(button).toHaveAttribute('aria-label', 'Mute');
-
- fireEvent.click(button);
-
- expect(isMuted.value).toBe(true);
- expect(button).toHaveAttribute('aria-label', 'Unmute');
-
- fireEvent.click(button);
-
- expect(isMuted.value).toBe(false);
- expect(button).toHaveAttribute('aria-label', 'Mute');
- });
-
- it('has proper styling classes', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toHaveClass('gradient-icon');
- expect(button).toHaveClass('group');
- expect(button).toHaveClass('relative');
- });
-
- it('updates class when mute state changes externally', () => {
- const { rerender } = render();
-
- const button = screen.getByRole('button');
- expect(button).toHaveClass('mute-button');
-
- // Change state externally
- isMuted.value = true;
- rerender();
-
- expect(button).toHaveClass('unmute-button');
- expect(button).not.toHaveClass('mute-button');
- });
-
- it('maintains proper button type', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toHaveAttribute('type', 'button');
- });
-});
diff --git a/tests/unit/PlayButton.test.tsx b/tests/unit/PlayButton.test.tsx
deleted file mode 100644
index f736f2b7..00000000
--- a/tests/unit/PlayButton.test.tsx
+++ /dev/null
@@ -1,114 +0,0 @@
-import { render, screen, fireEvent } from '@testing-library/preact';
-import { beforeEach, describe, expect, it } from 'vitest';
-import PlayButton from 'starpod/src/components/player/PlayButton';
-import { currentEpisode, isPlaying } from 'starpod/src/components/state';
-
-const mockEpisode = {
- id: 'test-episode-1',
- title: 'Test Episode',
- audio: { src: 'test.mp3', type: 'audio/mpeg' },
- episodeNumber: '1'
-};
-
-const mockEpisode2 = {
- id: 'test-episode-2',
- title: 'Test Episode 2',
- audio: { src: 'test2.mp3', type: 'audio/mpeg' },
- episodeNumber: '2'
-};
-
-describe('PlayButton', () => {
- beforeEach(() => {
- currentEpisode.value = null;
- isPlaying.value = false;
- });
-
- it('renders play icon when not playing', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toBeInTheDocument();
- expect(screen.getByText('Play')).toBeInTheDocument();
- });
-
- it('renders pause icon when playing current episode', () => {
- currentEpisode.value = mockEpisode;
- isPlaying.value = true;
-
- render();
-
- expect(screen.getByText('Pause')).toBeInTheDocument();
- });
-
- it('starts playing when clicked on a new episode', () => {
- render();
-
- const button = screen.getByRole('button');
- fireEvent.click(button);
-
- expect(currentEpisode.value).toEqual(mockEpisode);
- expect(isPlaying.value).toBe(true);
- });
-
- it('toggles play/pause when clicked on current episode', () => {
- currentEpisode.value = mockEpisode;
- isPlaying.value = true;
-
- render();
-
- const button = screen.getByRole('button');
- fireEvent.click(button);
-
- expect(currentEpisode.value).toEqual(mockEpisode);
- expect(isPlaying.value).toBe(false);
- });
-
- it('switches to new episode when clicked while another episode is playing', () => {
- currentEpisode.value = mockEpisode;
- isPlaying.value = true;
-
- render();
-
- const button = screen.getByRole('button');
- fireEvent.click(button);
-
- expect(currentEpisode.value).toEqual(mockEpisode2);
- expect(isPlaying.value).toBe(true);
- });
-
- it('renders without episode prop and shows play/pause based on global state', () => {
- isPlaying.value = false;
-
- render();
-
- expect(screen.getByText('Play')).toBeInTheDocument();
- });
-
- it('toggles global playing state when no episode provided', () => {
- isPlaying.value = false;
-
- render();
-
- const button = screen.getByRole('button');
- fireEvent.click(button);
-
- expect(isPlaying.value).toBe(true);
- expect(currentEpisode.value).toBeNull();
- });
-
- it('shows pause icon when no episode provided but globally playing', () => {
- isPlaying.value = true;
-
- render();
-
- expect(screen.getByText('Pause')).toBeInTheDocument();
- });
-
- it('has proper accessibility attributes', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toBeInTheDocument();
- expect(screen.getByText('Play')).toBeInTheDocument();
- });
-});
diff --git a/tests/unit/PlaybackRateButton.test.tsx b/tests/unit/PlaybackRateButton.test.tsx
deleted file mode 100644
index c54cda50..00000000
--- a/tests/unit/PlaybackRateButton.test.tsx
+++ /dev/null
@@ -1,125 +0,0 @@
-import { render, screen, fireEvent } from '@testing-library/preact';
-import { beforeEach, describe, expect, it } from 'vitest';
-import PlaybackRateButton from 'starpod/src/components/player/PlaybackRateButton';
-import { createRef } from 'preact';
-
-// Mock audio element
-const mockAudioElement = {
- playbackRate: 1,
- currentTime: 0,
- duration: 180
-};
-
-describe('PlaybackRateButton', () => {
- let audioPlayerRef: any;
-
- beforeEach(() => {
- mockAudioElement.playbackRate = 1;
- audioPlayerRef = createRef();
- audioPlayerRef.current = mockAudioElement;
- });
-
- it('renders with initial playback rate of 1x', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toBeInTheDocument();
- expect(button).toHaveAttribute('aria-label', 'Playback rate');
- expect(screen.getByText('1')).toBeInTheDocument();
- expect(screen.getByText('x')).toBeInTheDocument();
- });
-
- it('cycles through playback rates when clicked', () => {
- render();
-
- const button = screen.getByRole('button');
-
- // Initial state: 1x
- expect(screen.getByText('1')).toBeInTheDocument();
- expect(mockAudioElement.playbackRate).toBe(1);
-
- // Click 1: should go to 1.2x
- fireEvent.click(button);
- expect(screen.getByText('1.2')).toBeInTheDocument();
- expect(mockAudioElement.playbackRate).toBe(1.2);
-
- // Click 2: should go to 1.5x
- fireEvent.click(button);
- expect(screen.getByText('1.5')).toBeInTheDocument();
- expect(mockAudioElement.playbackRate).toBe(1.5);
-
- // Click 3: should go to 2x
- fireEvent.click(button);
- expect(screen.getByText('2')).toBeInTheDocument();
- expect(mockAudioElement.playbackRate).toBe(2);
-
- // Click 4: should cycle back to 1x
- fireEvent.click(button);
- expect(screen.getByText('1')).toBeInTheDocument();
- expect(mockAudioElement.playbackRate).toBe(1);
- });
-
- it('handles null audio player gracefully', () => {
- const nullRef = createRef();
- nullRef.current = null;
-
- render();
-
- const button = screen.getByRole('button');
-
- // Should render without crashing
- expect(button).toBeInTheDocument();
- expect(screen.getByText('1')).toBeInTheDocument();
-
- // Clicking should not crash when audio player is null
- expect(() => fireEvent.click(button)).not.toThrow();
- expect(screen.getByText('1.2')).toBeInTheDocument();
- });
-
- it('has proper styling classes', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toHaveClass('gradient-icon');
- expect(button).toHaveClass('relative');
- expect(button).toHaveClass('rounded-md');
- expect(button).toHaveClass('transition-colors');
- expect(button).toHaveClass('focus:outline-hidden');
- });
-
- it('displays rate with x suffix correctly', () => {
- render();
-
- const button = screen.getByRole('button');
-
- // Test different rates maintain x suffix
- fireEvent.click(button); // 1.2x
- expect(screen.getByText('1.2')).toBeInTheDocument();
- expect(screen.getByText('x')).toBeInTheDocument();
-
- fireEvent.click(button); // 1.5x
- expect(screen.getByText('1.5')).toBeInTheDocument();
- expect(screen.getByText('x')).toBeInTheDocument();
-
- fireEvent.click(button); // 2x
- expect(screen.getByText('2')).toBeInTheDocument();
- expect(screen.getByText('x')).toBeInTheDocument();
- });
-
- it('maintains state independently across renders', () => {
- const { rerender } = render(
-
- );
-
- const button = screen.getByRole('button');
-
- // Change to 1.5x
- fireEvent.click(button);
- fireEvent.click(button);
- expect(screen.getByText('1.5')).toBeInTheDocument();
-
- // Rerender should maintain the same state
- rerender();
- expect(screen.getByText('1.5')).toBeInTheDocument();
- });
-});
diff --git a/tests/unit/Player.test.tsx b/tests/unit/Player.test.tsx
deleted file mode 100644
index 17f5fe23..00000000
--- a/tests/unit/Player.test.tsx
+++ /dev/null
@@ -1,170 +0,0 @@
-import { render, screen } from '@testing-library/preact';
-import { beforeEach, describe, expect, it, vi } from 'vitest';
-import Player from 'starpod/src/components/Player';
-import { currentEpisode, isPlaying, isMuted } from 'starpod/src/components/state';
-
-const mockEpisode = {
- id: 'test-episode-1',
- title: 'Test Episode',
- audio: { src: 'test.mp3', type: 'audio/mpeg' },
- episodeNumber: '1'
-};
-
-// Mock audio element
-class MockAudio {
- src = '';
- currentTime = 0;
- duration = 180;
- playbackRate = 1;
- paused = true;
- muted = false;
-
- play = vi.fn().mockResolvedValue(undefined);
- pause = vi.fn();
-
- constructor() {
- Object.defineProperty(this, 'duration', {
- get: () => this.duration,
- set: (value) => {
- this.duration = value;
- }
- });
- }
-}
-
-// Mock requestAnimationFrame and cancelAnimationFrame
-global.requestAnimationFrame = vi.fn((callback) => {
- setTimeout(callback, 16);
- return 1;
-});
-global.cancelAnimationFrame = vi.fn();
-
-// Mock querySelector for DOM manipulation
-const mockSlider = {
- clientWidth: 400,
- style: {
- setProperty: vi.fn()
- }
-};
-
-const mockParticles = {
- style: {
- setProperty: vi.fn()
- }
-};
-
-global.document.querySelector = vi.fn((selector) => {
- if (selector === '.slider') return mockSlider;
- if (selector === '.ship-particles') return mockParticles;
- return null;
-});
-
-describe('Player', () => {
- beforeEach(() => {
- currentEpisode.value = null;
- isPlaying.value = false;
- isMuted.value = false;
- vi.clearAllMocks();
-
- // Mock HTMLAudioElement
- global.HTMLAudioElement = MockAudio as any;
- });
-
- it('returns early when no current episode', () => {
- currentEpisode.value = null;
-
- const result = render();
- expect(result.container.firstChild).toBeNull();
- });
-
- it('renders player with current episode', () => {
- currentEpisode.value = mockEpisode;
-
- render();
-
- expect(screen.getByText('Test Episode')).toBeInTheDocument();
- expect(screen.getByRole('region')).toBeInTheDocument();
- });
-
- it('displays episode link with correct href', () => {
- currentEpisode.value = mockEpisode;
-
- render();
-
- const link = screen.getByRole('link', { name: 'Test Episode' });
- expect(link).toHaveAttribute('href', '/1');
- });
-
- it('renders all player controls', () => {
- currentEpisode.value = mockEpisode;
-
- render();
-
- // Should have play buttons (one hidden on desktop, one hidden on mobile)
- const playButtons = screen.getAllByLabelText(/play|pause/i);
- expect(playButtons.length).toBeGreaterThan(0);
-
- // Should have forward and rewind buttons
- expect(
- screen.getByLabelText('Fast-forward 10 seconds')
- ).toBeInTheDocument();
- expect(screen.getByLabelText('Rewind 10 seconds')).toBeInTheDocument();
-
- // Should have mute buttons (one hidden on desktop, one hidden on mobile)
- const muteButtons = screen.getAllByLabelText(/mute|unmute/i);
- expect(muteButtons.length).toBeGreaterThan(0);
-
- // Should have playback rate button
- expect(screen.getByLabelText('Playback rate')).toBeInTheDocument();
-
- // Should have slider
- expect(screen.getByLabelText('audio timeline')).toBeInTheDocument();
- });
-
- it('has proper accessibility attributes', () => {
- currentEpisode.value = mockEpisode;
-
- render();
-
- const player = screen.getByRole('region');
- expect(player).toBeInTheDocument();
-
- const slider = screen.getByRole('slider');
- expect(slider).toHaveAttribute('aria-orientation', 'horizontal');
- expect(slider).toHaveAttribute('aria-label', 'audio timeline');
- });
-
- it('renders audio element', () => {
- currentEpisode.value = mockEpisode;
-
- const { container } = render();
-
- // Audio element should exist in the component tree
- const audioElement = container.querySelector('audio');
- expect(audioElement).toBeTruthy();
- });
-
- it('applies view transition name for animations', () => {
- currentEpisode.value = mockEpisode;
-
- render();
-
- const playerContainer = screen.getByRole('region');
- expect(playerContainer).toHaveStyle({ viewTransitionName: 'player' });
- });
-
- it('truncates long episode titles', () => {
- const longTitleEpisode = {
- ...mockEpisode,
- title:
- 'This is a very long episode title that should be truncated when displayed in the player'
- };
- currentEpisode.value = longTitleEpisode;
-
- render();
-
- const titleLink = screen.getByRole('link');
- expect(titleLink).toHaveClass('truncate');
- expect(titleLink).toHaveAttribute('title', longTitleEpisode.title);
- });
-});
diff --git a/tests/unit/RewindButton.test.tsx b/tests/unit/RewindButton.test.tsx
deleted file mode 100644
index 75559327..00000000
--- a/tests/unit/RewindButton.test.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-import { render, screen, fireEvent } from '@testing-library/preact';
-import { beforeEach, describe, expect, it } from 'vitest';
-import RewindButton from 'starpod/src/components/player/RewindButton';
-import { createRef } from 'preact';
-
-// Mock audio element
-const mockAudioElement = {
- currentTime: 60,
- duration: 180
-};
-
-describe('RewindButton', () => {
- let audioPlayerRef: any;
-
- beforeEach(() => {
- mockAudioElement.currentTime = 60;
- audioPlayerRef = createRef();
- audioPlayerRef.current = mockAudioElement;
- });
-
- it('renders rewind button with correct label', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toBeInTheDocument();
- expect(button).toHaveAttribute('aria-label', 'Rewind 10 seconds');
- });
-
- it('rewinds audio by 10 seconds when clicked', () => {
- render();
-
- const button = screen.getByRole('button');
-
- expect(mockAudioElement.currentTime).toBe(60);
-
- fireEvent.click(button);
- expect(mockAudioElement.currentTime).toBe(50);
-
- fireEvent.click(button);
- expect(mockAudioElement.currentTime).toBe(40);
- });
-
- it('handles null audio player gracefully', () => {
- const nullRef = createRef();
- nullRef.current = null;
-
- render();
-
- const button = screen.getByRole('button');
-
- // Should render without crashing
- expect(button).toBeInTheDocument();
-
- // Clicking should not crash when audio player is null
- expect(() => fireEvent.click(button)).not.toThrow();
- });
-
- it('has proper styling classes', () => {
- render();
-
- const button = screen.getByRole('button');
- expect(button).toHaveClass('rewind-button');
- expect(button).toHaveClass('gradient-icon');
- expect(button).toHaveClass('relative');
- expect(button).toHaveClass('rounded-full');
- expect(button).toHaveClass('focus:outline-hidden');
- });
-
- it('subtracts 10 seconds even near track beginning (browser handles clamping)', () => {
- mockAudioElement.currentTime = 5; // Near beginning
-
- render();
-
- const button = screen.getByRole('button');
-
- fireEvent.click(button);
- // Current implementation just subtracts 10 seconds without bounds checking
- // In a real browser, the audio element would clamp this to 0
- expect(mockAudioElement.currentTime).toBe(-5);
- });
-
- it('allows rewinding from any current position', () => {
- mockAudioElement.currentTime = 120;
-
- render();
-
- const button = screen.getByRole('button');
-
- fireEvent.click(button);
- expect(mockAudioElement.currentTime).toBe(110);
- });
-});
diff --git a/tests/unit/SearchButton.test.tsx b/tests/unit/SearchButton.test.tsx
index 1b65e44c..a8f397a0 100644
--- a/tests/unit/SearchButton.test.tsx
+++ b/tests/unit/SearchButton.test.tsx
@@ -1,4 +1,4 @@
-import { render, screen, fireEvent } from '@testing-library/preact';
+import { fireEvent, render, screen } from '@testing-library/preact';
import { beforeEach, describe, expect, it } from 'vitest';
import SearchButton from 'starpod/src/components/SearchButton';
import { isSearchOpen } from 'starpod/src/components/state';
@@ -8,41 +8,30 @@ describe('SearchButton', () => {
isSearchOpen.value = false;
});
- it('renders the search button', () => {
+ it('renders the rail search with its shortcut', () => {
render();
const button = screen.getByRole('button');
- expect(button).toBeInTheDocument();
expect(button).toHaveAttribute('aria-label', 'Search episodes (⌘K)');
+ expect(screen.getByText('Search episodes')).toBeInTheDocument();
+ expect(screen.getByText('⌘K')).toBeInTheDocument();
+ // The palette grows out of whichever trigger is on screen.
+ expect(button).toHaveAttribute('data-search-trigger');
});
it('opens search dialog when clicked', () => {
render();
-
- const button = screen.getByRole('button');
- fireEvent.click(button);
-
+ fireEvent.click(screen.getByRole('button'));
expect(isSearchOpen.value).toBe(true);
});
- it('contains search text', () => {
- render();
+ it('renders as a tab for the phone tab bar', () => {
+ render();
+ const button = screen.getByRole('button', { name: 'Search episodes' });
expect(screen.getByText('Search')).toBeInTheDocument();
- });
-
- it('displays keyboard shortcut hint', () => {
- render();
-
- expect(screen.getByText('⌘')).toBeInTheDocument();
- expect(screen.getByText('K')).toBeInTheDocument();
- });
-
- it('contains search icon', () => {
- render();
-
- const icon = screen.getByRole('button').querySelector('.search-icon');
- expect(icon).toBeInTheDocument();
- expect(icon).toHaveAttribute('aria-hidden', 'true');
+ expect(button).toHaveAttribute('data-search-trigger');
+ fireEvent.click(button);
+ expect(isSearchOpen.value).toBe(true);
});
});
diff --git a/tests/unit/SearchDialog.test.tsx b/tests/unit/SearchDialog.test.tsx
index d3dec7a7..81775f58 100644
--- a/tests/unit/SearchDialog.test.tsx
+++ b/tests/unit/SearchDialog.test.tsx
@@ -1,7 +1,18 @@
-import { render, screen, fireEvent } from '@testing-library/preact';
-import { beforeEach, describe, expect, it, vi, afterEach } from 'vitest';
+import { render, screen, fireEvent, waitFor } from '@testing-library/preact';
+import {
+ beforeAll,
+ beforeEach,
+ describe,
+ expect,
+ it,
+ vi,
+ afterEach
+} from 'vitest';
import SearchDialog from 'starpod/src/components/SearchDialog';
import { isSearchOpen } from 'starpod/src/components/state';
+import { navigate } from 'astro:transitions/client';
+
+vi.mock('astro:transitions/client', () => ({ navigate: vi.fn() }));
// Mock fetch for episodes
const mockEpisodes = [
@@ -32,6 +43,19 @@ const mockEpisodes = [
];
describe('SearchDialog', () => {
+ // jsdom has the