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
14 changes: 11 additions & 3 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ they read against the sky.
## Typography

Atkinson Hyperlegible is the reading and display face. Azeret Mono is reserved
for paths, package names, versions, operations, and structural labels. Page
titles are large and regular (about 2.4rem); section headings are 1.3rem
semibold; body text is 17px. Reading columns use a 72ch measure.
for paths, package names, versions, operations, and structural labels, with
ligatures off so code shows every character as typed. Page titles are large
and regular (about 2.4rem); section headings are 1.3rem semibold; body text is
17px. Paragraphs keep to about 75 characters a line (`34em`), and no text
that carries meaning is set below 12px.

## Layout

Expand All @@ -58,6 +60,12 @@ visible title and lede (`.page-intro`) under a still band of sky at the top
right; documentation pages keep their three-column layout. Navigation, buttons,
tables, callouts, and footer links remain visually quiet.

The header is the same on every page: the wordmark (the link home), then
Search, the theme control and a boxed "Sign up" on one row, and the five
section links on a ruled row below. The current section is not underlined
and carries a short bar on the lower rule. Below 28rem the section links fold behind a "Menu" button. Header
controls keep a 44px-high target.

## Motion

Only the homepage moves: the sky drifts and the particle field explains the
Expand Down
2 changes: 1 addition & 1 deletion src/components/DocsLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const { label, navLabel, headerCurrent, sourcePath, meta, groups: docGroups } =
const docsNavigation = document.querySelector("[data-docs-nav]");
if (
docsNavigation instanceof HTMLDetailsElement
&& window.matchMedia("(max-width: 60rem)").matches
&& window.matchMedia("(max-width: 68rem)").matches
) {
docsNavigation.open = false;
}
Expand Down
50 changes: 39 additions & 11 deletions src/components/SiteHeader.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ interface Props {

const { current } = Astro.props;
const section = current === "sdk" || current === "runtime" || current === "spec" ? "developers" : current;
// The wordmark is the link home, so the list starts with the product pages.
const links = [
{ href: "/", label: "Home", key: "home" },
{ href: "/connect/", label: "Connect", key: "connect" },
{ href: "/downloads/", label: "Downloads", key: "downloads" },
{ href: "/apps/", label: "Apps", key: "apps" },
Expand All @@ -18,27 +18,55 @@ const links = [
] as const;
---

<header class="site-header" data-pagefind-ignore="all">
<header class="site-header" data-pagefind-ignore="all" data-site-header>
<div class="site-header__inner">
<div class="site-header__identity">
<a class="wordmark" href="/" aria-label="mdbase home"><BrandMark /><span>mdbase</span></a>
<a class="site-header__signup" href="https://connect.mdbase.dev/signup">Sign up</a>
<div class="site-header__tools">
<SiteSearch />
<button class="theme-toggle" type="button" aria-label="Use dark mode" title="Use dark mode" hidden>
<svg class="theme-toggle__icon" viewBox="0 0 16 16" aria-hidden="true">
<circle cx="8" cy="8" r="5.5"></circle>
<path d="M8 2.5a5.5 5.5 0 0 0 0 11Z"></path>
</svg>
</button>
<button class="site-nav__toggle" type="button" aria-expanded="false" aria-controls="site-nav" data-nav-toggle hidden>
Menu
</button>
<a class="site-header__signup" href="https://connect.mdbase.dev/signup">Sign up</a>
</div>
</div>
<nav class="site-nav" aria-label="Primary navigation">
<nav class="site-nav" id="site-nav" aria-label="Primary navigation">
{
links.map((link) => (
<a href={link.href} aria-current={section === link.key ? "page" : undefined}>
{link.label}
</a>
))
}
<SiteSearch />
<button class="theme-toggle" type="button" aria-label="Use dark mode" title="Use dark mode" hidden>
<svg class="theme-toggle__icon" viewBox="0 0 16 16" aria-hidden="true">
<circle cx="8" cy="8" r="5.5"></circle>
<path d="M8 2.5a5.5 5.5 0 0 0 0 11Z"></path>
</svg>
</button>
</nav>
</div>
</header>

<script is:inline>
// On narrow screens the page links fold behind a Menu button. Without
// scripts the button stays hidden and the links stay visible.
(() => {
const header = document.querySelector("[data-site-header]");
const toggle = header?.querySelector("[data-nav-toggle]");
if (!header || !toggle) return;
const setOpen = (open) => {
toggle.setAttribute("aria-expanded", String(open));
header.toggleAttribute("data-nav-open", open);
};
header.toggleAttribute("data-nav-collapsible", true);
toggle.hidden = false;
toggle.addEventListener("click", () => setOpen(toggle.getAttribute("aria-expanded") !== "true"));
header.addEventListener("keydown", (event) => {
if (event.key === "Escape" && header.hasAttribute("data-nav-open")) {
setOpen(false);
toggle.focus();
}
});
})();
</script>
6 changes: 4 additions & 2 deletions src/components/SiteSearch.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<button class="site-search__open" type="button" data-search-open aria-haspopup="dialog" aria-keyshortcuts="/ Control+K Meta+K">
<button class="site-search__open" type="button" data-search-open aria-haspopup="dialog" aria-keyshortcuts="/ Control+K Meta+K" title="Search (press /)">
<svg viewBox="0 0 16 16" aria-hidden="true"><circle cx="7" cy="7" r="4.5"></circle><path d="m10.4 10.4 3.6 3.6"></path></svg>
<span>Search</span>
</button>
Expand Down Expand Up @@ -80,9 +80,11 @@
<style is:global>
.site-search__open {
display: inline-flex;
margin-left: auto;
min-width: 32px;
min-height: 44px;
padding: 0;
align-items: center;
justify-content: center;
gap: 6px;
color: var(--color-text);
background: transparent;
Expand Down
2 changes: 1 addition & 1 deletion src/data/docs-sections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const docsSections: Record<DocsSectionId, DocsSection> = {
label: "Start",
docs: [
{ href: "/sdk/", label: "SDK overview", key: "overview" },
{ href: "/sdk/quickstart/", label: "Quickstart", key: "quickstart" },
{ href: "/sdk/connect-quickstart/", label: "Build an app", key: "connect-quickstart" },
{ href: "/sdk/quickstart/", label: "Try the SDK in memory", key: "quickstart" },
{ href: "/sdk/local-development/", label: "Develop on localhost", key: "local-development" }
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/pages/apps/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const applications: CatalogueEntry[] = [
declares the contracts and operations it needs.
</p>
<div class="button-row">
<a href="/sdk/quickstart/">SDK quickstart</a>
<a href="/sdk/connect-quickstart/">Build an app</a>
<a href="/sdk/">SDK overview</a>
</div>
</div>
Expand Down
22 changes: 19 additions & 3 deletions src/pages/downloads/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ const releaseSize = (bytes: number) => `${Math.round(bytes / 1_000_000)} MB`;
<div class="download-list">
{
desktopDownloads.map((download) => (
<article class="download-option">
<article class="download-option" data-platform={download.platform}>
<h3>{download.platform}</h3>
<div class="download-option__detail">
<p>{download.detail}</p>
<code>{download.trust} · {releaseSize(download.size)}</code>
<code><span>{download.trust}</span> <span>· {releaseSize(download.size)}</span></code>
<p class="download-option__match" hidden>This computer’s system</p>
</div>
<div class="download-option__actions">
<a class="button button--primary" href={`${releaseBase}/${download.file}`}>
Expand Down Expand Up @@ -99,7 +100,7 @@ const releaseSize = (bytes: number) => `${Math.round(bytes / 1_000_000)} MB`;
<h3>{download.platform}</h3>
<div class="download-option__detail">
<p>{download.detail}</p>
<code>{download.trust} · {releaseSize(download.size)}</code>
<code><span>{download.trust}</span> <span>· {releaseSize(download.size)}</span></code>
</div>
<div class="download-option__actions">
<a class="button button--primary" href={`${releaseBase}/${download.file}`}>
Expand Down Expand Up @@ -128,4 +129,19 @@ const releaseSize = (bytes: number) => `${Math.round(bytes / 1_000_000)} MB`;
<a class="button" href="https://github.com/mdbase-dev/mdbase-connect/releases">All releases</a>
</div>
</section>

<script is:inline>
// Point out the desktop packages for the system this page is open on.
// Phones and tablets have no desktop app, so they match nothing.
(() => {
const agent = navigator.userAgent;
if (/Android|iPhone|iPad/.test(agent) || (/Macintosh/.test(agent) && navigator.maxTouchPoints > 1)) return;
const platform = (navigator.userAgentData?.platform || navigator.platform || agent).toLowerCase();
const system = /mac/.test(platform) ? "macOS" : /win/.test(platform) ? "Windows" : /linux|x11/.test(platform) ? "Linux" : null;
if (!system) return;
document.querySelectorAll(`.download-option[data-platform="${system}"] .download-option__match`).forEach((note) => {
note.hidden = false;
});
})();
</script>
</BaseLayout>
4 changes: 2 additions & 2 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import AppShot from "../components/AppShot.astro";
>
<div id="material" aria-hidden="true"><canvas id="atmosphere"></canvas><div id="grain"></div></div>
<canvas id="diagram" aria-hidden="true"></canvas>
<button class="motion-control" type="button" data-motion-control>Pause motion</button>
<main id="main" tabindex="-1" data-pagefind-body>
<section id="intro" class="chapter is-active" data-scene="intro" aria-label="Introduction"><div class="chapter__inner">
<h1 class="home-title">Structured data in ordinary Markdown files</h1>
Expand Down Expand Up @@ -67,7 +66,7 @@ the field visit.</code></pre>
<section id="permission" class="chapter" data-scene="grant" aria-label="Application access"><div class="chapter__inner">
<h2>Apps ask first</h2>
<p>An app asks for access to one collection and lists the operations it needs. You might let a project planner find, create and edit project records while leaving deletion blocked.</p>
<p>You approve each app in Connect, and you can narrow or revoke its access at any time. Revoking it ends the app’s sessions.</p>
<p>You approve each app in your <a href="/connect/">Connect account</a>, and you can narrow or revoke its access at any time. Revoking it ends the app’s sessions.</p>
</div></section>

<section id="sharing" class="chapter" data-scene="sharing" aria-label="Sharing"><div class="chapter__inner">
Expand All @@ -87,4 +86,5 @@ the field visit.</code></pre>
</dl>
</div></section>
</main>
<button class="motion-control" type="button" data-motion-control>Pause motion</button>
</HomeLayout>
75 changes: 38 additions & 37 deletions src/pages/sdk/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export async function listOpenTasks(db: MdbaseClient) {
description="Build apps whose data lives in the user’s own mdbase collection. @mdbase-dev/sdk is the TypeScript client: local reads, optimistic writes, live queries and sign-in."
active="overview"
headings={[
{ href: "#why", label: "Why build on mdbase" },
{ href: "#start", label: "Where to start" },
{ href: "#why", label: "Why build on mdbase" },
{ href: "#model", label: "How the SDK works" },
{ href: "#choose-a-surface", label: "Getting a client" },
{ href: "#application-shape", label: "Application shape" },
Expand All @@ -39,6 +39,43 @@ export async function listOpenTasks(db: MdbaseClient) {
reads and writes the records in a collection its user chooses.
</p>

<h2 id="start">Where to start</h2>
<div class="start-options">
<div>
<strong>Build an app</strong>
<p>
Build Worklog, a small app that signs a user in and keeps its entries
in their collection, from an empty folder to a deployed site. It uses
React, and its last section shows the same app without React.
</p>
<a href="/sdk/connect-quickstart/">Follow the tutorial</a>
</div>
<div>
<strong>Try the SDK in memory</strong>
<p>
Run a short script against an in-memory collection. It needs no
account or service, and shows reads, writes and live queries.
</p>
<a href="/sdk/quickstart/">Run the script</a>
</div>
<div>
<strong>Develop on localhost</strong>
<p>
Run your app from a development server against real accounts and
collections.
</p>
<a href="/sdk/local-development/">Set up local development</a>
</div>
<div>
<strong>The format</strong>
<p>
Build tools that read and write mdbase collections as files, with no
SDK.
</p>
<a href="/spec/">Read the specification</a>
</div>
</div>

<h2 id="why">Why build on mdbase</h2>
<ul>
<li>
Expand Down Expand Up @@ -72,42 +109,6 @@ export async function listOpenTasks(db: MdbaseClient) {
</li>
</ul>

<h2 id="start">Where to start</h2>
<div class="start-options">
<div>
<strong>Quickstart</strong>
<p>
Run a short script against an in-memory collection. It needs no
account or service, and shows reads, writes and live queries.
</p>
<a href="/sdk/quickstart/">Run the quickstart</a>
</div>
<div>
<strong>Build an app</strong>
<p>
Build Worklog, a small React app, from an empty folder to a deployed
site: types, manifest, sign-in, live list and writes.
</p>
<a href="/sdk/connect-quickstart/">Follow the tutorial</a>
</div>
<div>
<strong>Develop on localhost</strong>
<p>
Run your app from a development server against real accounts and
collections.
</p>
<a href="/sdk/local-development/">Set up local development</a>
</div>
<div>
<strong>The format</strong>
<p>
Build tools that read and write mdbase collections as files, with no
SDK.
</p>
<a href="/spec/">Read the specification</a>
</div>
</div>

<h2 id="model">How the SDK works</h2>
<p>
Your app talks to a <strong>replica</strong> of the collection: a copy
Expand Down
12 changes: 9 additions & 3 deletions src/pages/sdk/quickstart/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ Open tasks: 1`;
---

<DocsLayout
title="Quickstart"
description="Run a short script against an in-memory replica: read, watch, write and see a stale write refused."
title="Try the SDK in memory"
description="Run a short script against an in-memory replica, with no account: read, watch, write and see a stale write refused."
active="quickstart"
headings={[
{ href: "#prerequisites", label: "Prerequisites" },
Expand Down Expand Up @@ -151,8 +151,14 @@ Open tasks: 1`;
</p>

<h2 id="next">5. Next steps</h2>
<p>
To sign a user in and work with one of their collections, follow
{" "}<a href="/sdk/connect-quickstart/">Build an app</a>. The code that
reads and writes records stays the same; only the connector changes.
</p>
<div class="button-row" style="margin-top: 1.5rem">
<a class="button button--primary" href="/sdk/operations/">Read and write records</a>
<a class="button button--primary" href="/sdk/connect-quickstart/">Build an app</a>
<a class="button" href="/sdk/operations/">Read and write records</a>
<a class="button" href="/sdk/offline-sync/">Pending writes and sync status</a>
<a class="button" href="/sdk/testing/">Test with MemoryReplica</a>
</div>
Expand Down
Loading
Loading