Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,4 @@ Not scheduled. Keep releasing `0.x` minors until the API stops changing; go thro
- 2026-10-22 — Widget feed panel: an "Earlier" divider separates read entries from unread ones; when `src` fails to load, the trigger opens the panel with an error message and retries the fetch (the panel fills in if it works); a refresh or locale change while the panel is open re-renders it, keeping scroll position and focus inside it, and new entries count as seen. The bell has an accessible name before the feed loads (it had none until then, and never when loading failed). Forced colors mode (Windows High Contrast) keeps the badge, unread dot and hotspot dots visible. One date formatter per render instead of one per entry. Widget 7.62 KB min+gzip.
- 2026-10-22 — Planning: "Before v1.0.0" checklist (not scheduled): when to leave `0.x`, freezing the public surface, a semver and deprecation policy, and the `v0` → `v1` references to update.
- 2026-10-22 — Docs playground: "Mark all unread" works again (the widget merges stored read IDs into the ones in memory, so it now switches to a fresh storage key); edits, mode, theme, locale and brand color live in the URL hash (deflate + base64url, validated on load), so a reload keeps them and "Copy link" shares them; "Restore samples" button; `llms.txt` output next to `shipdot.json`, both rendered only while open; the status live region only updates when its message changes; editors grow with their content and are named by their file name; focus stays in the list after removing an entry; new entries use today's date; Portuguese sample. Design: controls moved above the demo app, preview first on one column, a brand color picker that themes the demo app and the widget through `--shipdot-accent`, a teal demo brand distinct from the docs accent, Starlight's primary button tokens (the dark "Add entry" button was 4:1), no gradient, shadow, window dots, emoji or text under 13px.
- 2026-10-22 — Docs review: the home page is rebuilt around the real widget, live on the playground's demo app (shared `DemoApp.astro`, fed the playground samples as an inline `data:` feed) with language buttons and a "Show the dots again" reset, followed by drafting, theming/i18n (README panel screenshots, theme-aware), "nothing to run" and install sections in place of the six icon cards; sections rise in with scroll-driven animations where supported. The docs accent is the logo's red instead of indigo (AA in both themes), also applied to the header widget and its hotspots. Content fixes: widget size 6.5 KB → 7.6 KB, `@shipdot/cli` `^0.1.0` → `^0.2.0` in Getting started, the Action pin comment now says `v0.2.0`, "Why shipdot" no longer lists cross-device read state as unsupported (it is, through `markRead`), and the widget reference covers the load-error state and the "Earlier" divider.
4 changes: 3 additions & 1 deletion apps/docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ export default defineConfig({
editLink: { baseUrl: 'https://github.com/pipe1os/shipdot/edit/main/apps/docs/' },
lastUpdated: false,
// The header shows shipdot's own "What's new" widget next to the search button (dogfooding);
// page titles get a "Copy page" menu that copies the page as Markdown.
// page titles get a 'Copy page' menu that copies the page as Markdown; the home page hero shows
// the widget live on a demo app.
components: {
Hero: './src/components/Hero.astro',
Search: './src/components/Search.astro',
PageTitle: './src/components/PageTitle.astro',
},
Expand Down
103 changes: 103 additions & 0 deletions apps/docs/src/components/DemoApp.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
// The fake "Acme Analytics" app that shows <ship-dot> and its hotspots on real buttons (#btn-filter,
// #btn-share, #btn-export). Used by the playground and the home page.
interface Props {
storageKey: string
/** Feed URL. The playground leaves it out and feeds the widget itself. */
src?: string
theme?: string
'first-visit'?: string
}

const { storageKey, ...attrs } = Astro.props
const bars = [38, 52, 45, 61, 58, 72, 66, 80, 74, 88, 83, 96]
---

<div class="pg-window" data-app data-theme="light" data-ui>
<div class="pg-chrome" aria-hidden="true">
<div class="pg-url">app.acme.example/reports/revenue</div>
</div>
<div class="pg-app">
<header class="pg-top">
<div class="pg-brand"><span class="pg-mark"></span>Acme Analytics</div>
<nav class="pg-nav" aria-label="Demo app">
<span class="is-active">Reports</span>
<span>Customers</span>
<span>Settings</span>
</nav>
<ship-dot storage-key={storageKey} {...attrs} class="pg-widget"></ship-dot>
</header>
<main class="pg-main">
<div class="pg-head">
<div>
<p class="pg-crumb">Reports</p>
<p class="pg-title">Revenue overview</p>
</div>
<div class="pg-actions">
<button type="button" id="btn-filter">Filter</button>
<button type="button" id="btn-share">Share</button>
<button type="button" id="btn-export" class="is-primary">Export</button>
</div>
</div>
<div class="pg-kpis">
<div><p>Revenue</p><strong>$48.2k</strong><span class="up">+12.4%</span></div>
<div><p>Orders</p><strong>1,284</strong><span class="up">+3.1%</span></div>
<div><p>Refunds</p><strong>0.8%</strong><span class="down">−0.2%</span></div>
</div>
<div class="pg-chart" aria-hidden="true">
{bars.map((h) => <span style={`--h:${h}%`}></span>)}
</div>
</main>
</div>
</div>

<style is:global>
/* The fake app: its own palette, independent from the docs theme. --brand can be overridden. */
.pg-window {
--bg: #ffffff; --panel: #f4f6f8; --fg: #0f172a; --muted: #475569; --line: #e2e8f0;
--brand: #0f766e; --brand-fg: #ffffff; --up: #047857; --down: #b91c1c;
--bar: color-mix(in srgb, var(--brand) 30%, var(--panel));
border-radius: 0.9rem; overflow: hidden; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.pg-window[data-theme='dark'] {
--bg: #0b1120; --panel: #131b2c; --fg: #e5e7eb; --muted: #9ca3af; --line: #1f2937;
--brand: #2dd4bf; --brand-fg: #042f2e; --up: #34d399; --down: #f87171;
}
.pg-chrome { padding: 0.55rem 0.8rem; background: var(--panel); }
.pg-url {
max-width: 22rem; font-size: 13px; color: var(--muted); background: var(--bg);
border-radius: 999px; padding: 0.15rem 0.75rem;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pg-top { display: flex; align-items: center; gap: 1.25rem; padding: 0.6rem 1rem; border-bottom: 1px solid var(--line); }
.pg-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; white-space: nowrap; flex: 1; }
.pg-mark { width: 1.1rem; height: 1.1rem; border-radius: 0.35rem; background: var(--brand); }
.pg-nav { display: flex; gap: 1rem; color: var(--muted); font-size: 13px; }
.pg-nav .is-active { color: var(--fg); font-weight: 600; }
.pg-widget { color: var(--fg); --shipdot-accent: var(--brand); --shipdot-accent-contrast: var(--brand-fg); }
.pg-main { padding: 1.25rem 1rem 1.5rem; display: grid; gap: 1.1rem; }
.pg-head { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; justify-content: space-between; }
.pg-crumb { margin: 0; font-size: 13px; color: var(--muted); }
.pg-title { margin: 0; font-size: 18px; font-weight: 700; }
.pg-actions { display: flex; gap: 0.5rem; }
.pg-actions button {
font: inherit; font-size: 13px; font-weight: 600; padding: 0.4rem 0.85rem; border-radius: 0.5rem;
border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer;
}
.pg-actions .is-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.pg-actions button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pg-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.pg-kpis > div { border-radius: 0.6rem; padding: 0.7rem 0.8rem; background: var(--panel); }
.pg-kpis p { margin: 0; font-size: 13px; color: var(--muted); }
.pg-kpis strong { display: block; font-size: 20px; }
.pg-kpis .up { color: var(--up); font-size: 13px; font-weight: 600; }
.pg-kpis .down { color: var(--down); font-size: 13px; font-weight: 600; }
.pg-chart { display: flex; align-items: end; gap: 0.45rem; height: 9rem; padding: 0.9rem; border-radius: 0.6rem; background: var(--panel); }
.pg-chart span { flex: 1; height: var(--h); border-radius: 0.3rem 0.3rem 0 0; background: var(--bar); }
.pg-chart span:last-child { background: var(--brand); }
@media (max-width: 560px) {
.pg-nav { display: none; }
.pg-kpis { grid-template-columns: 1fr; }
}
</style>
178 changes: 178 additions & 0 deletions apps/docs/src/components/Hero.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
---
// Home page hero: the headline and actions from the page's `hero` frontmatter, next to the real
// <ship-dot> widget on the demo app, fed by the playground's sample entries.
import { LinkButton } from '@astrojs/starlight/components'
import { compile } from '@shipdot/core/compile'
import { SAMPLES } from '../playground/samples'
import DemoApp from './DemoApp.astro'

const { title, tagline, actions = [] } = Astro.locals.starlightRoute.entry.data.hero ?? {}
const { feed } = compile(SAMPLES, { defaultLocale: 'en', locales: ['en', 'es', 'pt'] })
// Inlined as a data: URL, so the demo needs no extra file and works offline.
const src = `data:application/json,${encodeURIComponent(JSON.stringify(feed))}`
const languages = [
['en', 'English'],
['es', 'Español'],
['pt', 'Português'],
]
---

<div class="home-hero">
<h1 id="_top" data-page-title set:html={title} />
<div class="home-hero-body">
<div class="home-hero-copy">
{tagline && <p class="home-tagline" set:html={tagline} />}
<div class="home-actions">
{
actions.map(({ link, text, variant, icon }) => (
<LinkButton href={link} variant={variant} icon={icon?.name}>
{text}
</LinkButton>
))
}
</div>
</div>
<div class="home-demo" data-home-demo>
<script is:inline>
// A new visitor sees every sample unread (the widget's first visit would mark them read).
try {
if (localStorage.getItem('shipdot:home-0') === null) localStorage.setItem('shipdot:home-0', '[]')
} catch {}
</script>
<DemoApp src={src} storageKey="home-0" theme="light" first-visit="show-latest" />
<div class="home-demo-bar">
<p>This is the real widget. Click the dot on <strong>Export</strong>, or open the bell.</p>
<div class="home-demo-controls">
<div role="group" aria-label="Widget language">
{
languages.map(([code, name]) => (
<button type="button" lang={code} data-locale={code} aria-pressed={String(code === 'en')}>
{name}
</button>
))
}
</div>
<button type="button" data-replay>Show the dots again</button>
</div>
</div>
</div>
</div>
</div>

<script>
const root = document.querySelector<HTMLElement>('[data-home-demo]')
const widget = root?.querySelector('ship-dot')
if (root && widget) {
widget.setAttribute('locale', 'en')
const languages = root.querySelectorAll<HTMLButtonElement>('[data-locale]')
for (const button of languages)
button.addEventListener('click', () => {
widget.setAttribute('locale', button.dataset.locale as string)
for (const other of languages) other.setAttribute('aria-pressed', String(other === button))
})

// Same trick as the playground: a fresh storage key resets the read state held in memory too.
let resets = 0
root.querySelector<HTMLButtonElement>('[data-replay]')?.addEventListener('click', () => {
const key = `home-${++resets % 2}`
try {
localStorage.setItem(`shipdot:${key}`, '[]')
} catch {
// Storage disabled: the widget keeps read state in memory.
}
widget.setAttribute('storage-key', key)
})
}
</script>

<style>
.home-hero {
padding-block: 1.5rem 2rem;
}
.home-hero h1 {
margin: 0;
max-width: 16ch;
font-size: clamp(2.25rem, 1rem + 6vw, 6rem);
font-weight: 700;
line-height: 0.98;
letter-spacing: -0.035em;
color: var(--sl-color-white);
}
.home-hero-body {
display: grid;
grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
gap: 2rem 3rem;
align-items: start;
margin-top: clamp(1.5rem, 4vw, 3rem);
}
.home-tagline {
margin: 0;
font-size: clamp(1.125rem, 1rem + 0.4vw, 1.3rem);
line-height: 1.5;
color: var(--sl-color-white);
}
.home-actions {
display: flex;
flex-wrap: wrap;
gap: 0.75rem 1rem;
margin-top: 2rem;
}
.home-demo-bar {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 0.75rem 1rem;
margin-top: 1rem;
}
.home-demo-bar p {
margin: 0;
font-size: var(--sl-text-sm);
color: var(--sl-color-gray-2);
}
.home-demo-controls,
.home-demo-controls > div {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.home-demo-controls button {
min-height: 2.25rem;
padding: 0 0.75rem;
border: 0;
border-radius: 999px;
background: var(--sl-color-gray-6);
color: var(--sl-color-white);
font: inherit;
font-size: var(--sl-text-sm);
cursor: pointer;
transition: background-color 120ms ease, transform 120ms ease;
}
.home-demo-controls button:hover {
background: var(--sl-color-gray-5);
}
.home-demo-controls button:active {
transform: translateY(1px);
}
.home-demo-controls button[aria-pressed='true'] {
background: var(--sl-color-text-accent);
color: var(--sl-color-black);
}
.home-demo-controls button:focus-visible {
outline: 2px solid var(--sl-color-text-accent);
outline-offset: 2px;
}
@media (max-width: 50rem) {
.home-hero-body {
grid-template-columns: minmax(0, 1fr);
}
}
@media (prefers-reduced-motion: reduce) {
.home-demo-controls button {
transition: none;
}
.home-demo-controls button:active {
transform: none;
}
}
</style>
Loading
Loading