diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4a32ac..07b5784 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,7 +130,7 @@ jobs: env: MDBASE_SPEC_DIR: .sources/mdbase-spec - - name: Build search index and Markdown copies + - name: Build Markdown copies run: pnpm index:site - name: Check local links diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e44e886..59669d6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -119,7 +119,7 @@ jobs: env: MDBASE_SPEC_DIR: .sources/mdbase-spec - - name: Build search index and Markdown copies + - name: Build Markdown copies run: pnpm index:site - name: Check local links diff --git a/README.md b/README.md index f8e5bcd..70a0a1a 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,7 @@ pnpm index:site pnpm check:links ``` -`pnpm index:site` builds the Pagefind index for the header's search dialog, -then writes a Markdown copy of each page (`index.md` beside its `index.html`), +`pnpm index:site` writes a Markdown copy of each page (`index.md` beside its `index.html`), `/llms.txt` and `/llms-full.txt` (`scripts/build-llms.mjs`). It runs after the specification import so the specification is included. Each page's `
` is used; headers, footers and documentation sidebars are excluded, as are pages @@ -127,8 +126,7 @@ pnpm deploy:dev ``` The command builds the current working tree for -`https://mdbase-dev.pages.dev`, imports the specification, builds the search -index and Markdown copies, checks local links, and deploys the `main` branch of +`https://mdbase-dev.pages.dev`, imports the specification, builds the Markdown copies, checks local links, and deploys the `main` branch of the standalone `mdbase-dev` Cloudflare Pages project. It verifies the live homepage, specification, canonical URLs, and indexing controls after deployment. The production GitHub Pages deployment and `mdbase.dev` domain are unchanged. diff --git a/astro.config.mjs b/astro.config.mjs index f7c4f12..02183bb 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -11,6 +11,8 @@ export default defineConfig({ // Compression drops the line break before an inline link, gluing it to the previous word. compressHTML: false, integrations: [sitemap()], + // Fetch a page when its link is hovered or touched, so it is ready by the click. + prefetch: { prefetchAll: true, defaultStrategy: "hover" }, build: { format: "directory" }, diff --git a/content/_types/doc-page.md b/content/_types/doc-page.md index bac1007..75ace5c 100644 --- a/content/_types/doc-page.md +++ b/content/_types/doc-page.md @@ -36,7 +36,7 @@ address, so `apps/reader/index.md` is `/apps/reader/`. `section` is the documentation set the page belongs to, which picks its sidebar. -The body is ordinary Markdown with three additions the site understands: +The body is ordinary Markdown with four additions the site understands: - A heading can keep a fixed anchor: `## Saved views {#views}`. - A code block can name its file: ` ```ts title="src/mdbase.ts" `. With @@ -45,3 +45,6 @@ The body is ordinary Markdown with three additions the site understands: JSON file. - An image whose address is a recording in `/videos/` is shown as that recording, with its captions and text description. +- A heading marked `{.cards}` shows the list under it as cards, two to a row. + Each item is a bold title, a sentence or two, and a link, each in its own + paragraph. diff --git a/content/sdk/index.md b/content/sdk/index.md index 69b9f98..a7521ea 100644 --- a/content/sdk/index.md +++ b/content/sdk/index.md @@ -6,31 +6,31 @@ section: sdk An mdbase collection is a folder of Markdown files with typed frontmatter, synced across a person’s devices. An app built with the SDK reads and writes the records in a collection its user chooses. -## Where to start {#start} +## Where to start {#start .cards} -**Build an app** +- **Build an app** -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. + 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. -[Follow the tutorial](/sdk/connect-quickstart/) + [Follow the tutorial](/sdk/connect-quickstart/) -**Try the SDK in memory** +- **Try the SDK in memory** -Run a short script against an in-memory collection. It needs no account or service, and shows reads, writes and live queries. + Run a short script against an in-memory collection. It needs no account or service, and shows reads, writes and live queries. -[Run the script](/sdk/quickstart/) + [Run the script](/sdk/quickstart/) -**Develop on localhost** +- **Develop on localhost** -Run your app from a development server against real accounts and collections. + Run your app from a development server against real accounts and collections. -[Set up local development](/sdk/local-development/) + [Set up local development](/sdk/local-development/) -**The format** +- **The format** -Build tools that read and write mdbase collections as files, with no SDK. + Build tools that read and write mdbase collections as files, with no SDK. -[Read the specification](/spec/) + [Read the specification](/spec/) ## Why build on mdbase {#why} diff --git a/docs/app-documentation.md b/docs/app-documentation.md index 97887fb..b6e1ed3 100644 --- a/docs/app-documentation.md +++ b/docs/app-documentation.md @@ -51,3 +51,22 @@ and opt-in accessible video controls. Site CI and the production build run it to Production is the repository's GitHub Pages workflow (`.github/workflows/deploy.yml`), triggered by a merge to `main`. Cloudflare Pages is only the separate development deployment. Verify `/apps/`, both documentation roots, all five video files and their posters after deployment. + +## Screenshots + +`AppShot.astro` frames the screenshots in `public/images/apps`. Each has a light and a dark +capture, 1600×1000 WebP, taken from a 1120×700 window at 2×. + +The Connect and desktop app screenshots use made-up accounts from the apps' own review +fixtures, with no real account or collection content. Retake them from an mdbase-connect +checkout with `scripts/screenshots/capture-connect.mjs` (the web screens, against +`pnpm portal:review`) and `scripts/screenshots/capture-desktop.mjs` (the desktop app's +renderer in a browser). Each script's header gives the steps. Retake them when those screens +change. + +On a phone each screenshot shows only the part of the window named for it in +`AppShot.astro` (`crops`), and opening it shows the whole capture; set a crop when you add +a screenshot. + +The social share image, `public/og-card.jpg`, is drawn from the homepage's sky by +`scripts/screenshots/capture-og-card.mjs`. Redraw it when the typefaces or the mark change. diff --git a/package.json b/package.json index ebad77e..d4e1496 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "sync:mcp-tools": "node scripts/sync-mcp-tools.mjs", "sync:contracts": "node scripts/sync-contracts.mjs", "import:spec": "node scripts/import-spec.mjs", - "index:site": "pagefind --site dist && node scripts/build-llms.mjs", + "index:site": "node scripts/build-llms.mjs", "check:links": "node scripts/check-links.mjs", "build:sdk-api": "node scripts/build-sdk-api.mjs", "check:sdk-api": "node scripts/build-sdk-api.mjs --check", @@ -29,14 +29,13 @@ "dependencies": { "@astrojs/markdown-satteri": "0.3.4", "@astrojs/sitemap": "^3.7.3", - "@fontsource/atkinson-hyperlegible": "^5.3.0", "@fontsource/azeret-mono": "^5.3.0", + "@fontsource/ibm-plex-sans": "^5.3.0", "astro": "^7.1.3", "yaml": "^2.9.0" }, "devDependencies": { "@astrojs/check": "^0.9.9", - "pagefind": "1.5.2", "turndown": "7.2.4", "typescript": "^6.0.3" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 561528c..8ee6d03 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,10 +14,10 @@ importers: '@astrojs/sitemap': specifier: ^3.7.3 version: 3.7.3 - '@fontsource/atkinson-hyperlegible': + '@fontsource/azeret-mono': specifier: ^5.3.0 version: 5.3.0 - '@fontsource/azeret-mono': + '@fontsource/ibm-plex-sans': specifier: ^5.3.0 version: 5.3.0 astro: @@ -30,9 +30,6 @@ importers: '@astrojs/check': specifier: ^0.9.9 version: 0.9.9(prettier@3.9.6)(typescript@6.0.3) - pagefind: - specifier: 1.5.2 - version: 1.5.2 turndown: specifier: 7.2.4 version: 7.2.4 @@ -415,12 +412,12 @@ packages: cpu: [x64] os: [win32] - '@fontsource/atkinson-hyperlegible@5.3.0': - resolution: {integrity: sha512-Sp8Ve8+rQmENY2Lv02VH7sLpntzTTvnncnJMTbRE7DX6TLxGraN4ykZfzaUWIoCFmaomwkvNiqmlPkrKBuDoSA==} - '@fontsource/azeret-mono@5.3.0': resolution: {integrity: sha512-Ag/+gN67fUry7i1yLlTnk16Rr1nnTQI2YefA/G7tYcCSr/+TC/ayMrE8Km7O0OKRgI/B5Mfel46Gq9IGY50Uaw==} + '@fontsource/ibm-plex-sans@5.3.0': + resolution: {integrity: sha512-CbE4CbbEEZJX860XyUiRpsksXIQR8Rp2XDva2VO53NJox9tVNtusrysd2x5YkUEY3ErQ66W1IiiQL8/wihhw5w==} + '@img/colour@1.1.0': resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==} engines: {node: '>=18'} @@ -601,41 +598,6 @@ packages: '@oxc-project/types@0.139.0': resolution: {integrity: sha512-r9gHphtCs+1M7J0pw6Sn/hh/Wpa/iQrOOkrNAlVLF/gHq+/CJmHIWKKUUhdWjcD6CIa8idarspCsASiXCXvFUw==} - '@pagefind/darwin-arm64@1.5.2': - resolution: {integrity: sha512-MXpI+7HsAdPkvJ0gk9xj9g541BCqBZOBbdwj9g6lB5LCj6kSV6nqDSjzcAJwvOsfu0fjwvC8hQU+ecfhp+MpiQ==} - cpu: [arm64] - os: [darwin] - - '@pagefind/darwin-x64@1.5.2': - resolution: {integrity: sha512-IojxFWMEJe0RQ7PQ3KXQsPIImNsbpPYpoZ+QUDrL8fAl/O27IX+LVLs74/UzEZy5uA2LD8Nz1AiwKr72vrkZQw==} - cpu: [x64] - os: [darwin] - - '@pagefind/freebsd-x64@1.5.2': - resolution: {integrity: sha512-7EVzo9+0w+2cbe671BtMj10UlNo83I+HrLVLfRxO731svHRJKUfJ/mo05gU14pe9PCfpKNQT8FS3Xc/oDN6pOA==} - cpu: [x64] - os: [freebsd] - - '@pagefind/linux-arm64@1.5.2': - resolution: {integrity: sha512-Ovt9+K35sqzn8H3ZMXGwls4TD/wMJuvRtShHIsmUQREmaxjrDEX7gHckRCrwYJ4XE1H1p6HkLz3wukrAnsfXQw==} - cpu: [arm64] - os: [linux] - - '@pagefind/linux-x64@1.5.2': - resolution: {integrity: sha512-V+tFqHKXhQKq/WqPBD67AFy7scn1/aZID00ws4fSDd+1daSi5UHR9VVlRrOUYKxn3VuFQYRD7lYXdZK1WED1YA==} - cpu: [x64] - os: [linux] - - '@pagefind/windows-arm64@1.5.2': - resolution: {integrity: sha512-hN9Nh90fNW61nNRCW9ZyQrAj/mD0eRvmJ8NlTUzkbuW8kIzGJUi3cxjFkEcMZ5h/8FsKWD/VcouZl4yo1F7B6g==} - cpu: [arm64] - os: [win32] - - '@pagefind/windows-x64@1.5.2': - resolution: {integrity: sha512-Fa2Iyw7kaDRzGMfNYNUXNW2zbL5FQVDgSOcbDHdzBrDEdpqOqg8TcZ68F22ol6NJ9IGzvUdmeyZypLW5dyhqsg==} - cpu: [x64] - os: [win32] - '@rolldown/binding-android-arm64@1.1.5': resolution: {integrity: sha512-lZg8fqIv2v7FF237bwMgzGZEJvGL79/s5knJ/i6FmsGF4XXlzccZ4jb+TrFIxtSSxFtIpdsgrPZeMk1I9AFcyQ==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1329,10 +1291,6 @@ packages: package-manager-detector@1.8.0: resolution: {integrity: sha512-yQA4H19AmPEoMUeavPMDIe1higySl/gH/yaQrkT/s07Qp+7pp2hYz30N3z2l5BkjVkF9Ow6o0wjJamm2y7Sn0A==} - pagefind@1.5.2: - resolution: {integrity: sha512-XTUaK0hXMCu2jszWE584JGQT7y284TmMV9l/HX3rnG5uo3rHI/uHU56XTyyyPFjeWEBxECbAi0CaFDJOONtG0Q==} - hasBin: true - parse5@7.3.0: resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==} @@ -2143,10 +2101,10 @@ snapshots: '@esbuild/win32-x64@0.28.1': optional: true - '@fontsource/atkinson-hyperlegible@5.3.0': {} - '@fontsource/azeret-mono@5.3.0': {} + '@fontsource/ibm-plex-sans@5.3.0': {} + '@img/colour@1.1.0': optional: true @@ -2269,27 +2227,6 @@ snapshots: '@oxc-project/types@0.139.0': {} - '@pagefind/darwin-arm64@1.5.2': - optional: true - - '@pagefind/darwin-x64@1.5.2': - optional: true - - '@pagefind/freebsd-x64@1.5.2': - optional: true - - '@pagefind/linux-arm64@1.5.2': - optional: true - - '@pagefind/linux-x64@1.5.2': - optional: true - - '@pagefind/windows-arm64@1.5.2': - optional: true - - '@pagefind/windows-x64@1.5.2': - optional: true - '@rolldown/binding-android-arm64@1.1.5': optional: true @@ -3034,16 +2971,6 @@ snapshots: package-manager-detector@1.8.0: {} - pagefind@1.5.2: - optionalDependencies: - '@pagefind/darwin-arm64': 1.5.2 - '@pagefind/darwin-x64': 1.5.2 - '@pagefind/freebsd-x64': 1.5.2 - '@pagefind/linux-arm64': 1.5.2 - '@pagefind/linux-x64': 1.5.2 - '@pagefind/windows-arm64': 1.5.2 - '@pagefind/windows-x64': 1.5.2 - parse5@7.3.0: dependencies: entities: 6.0.1 diff --git a/public/images/apps/connect-approve-dark.webp b/public/images/apps/connect-approve-dark.webp new file mode 100644 index 0000000..8181e54 Binary files /dev/null and b/public/images/apps/connect-approve-dark.webp differ diff --git a/public/images/apps/connect-approve-light.webp b/public/images/apps/connect-approve-light.webp new file mode 100644 index 0000000..0560986 Binary files /dev/null and b/public/images/apps/connect-approve-light.webp differ diff --git a/public/images/apps/connect-collections-dark.webp b/public/images/apps/connect-collections-dark.webp new file mode 100644 index 0000000..ad2079b Binary files /dev/null and b/public/images/apps/connect-collections-dark.webp differ diff --git a/public/images/apps/connect-collections-light.webp b/public/images/apps/connect-collections-light.webp new file mode 100644 index 0000000..42f96db Binary files /dev/null and b/public/images/apps/connect-collections-light.webp differ diff --git a/public/images/apps/connect-sharing-dark.webp b/public/images/apps/connect-sharing-dark.webp new file mode 100644 index 0000000..0084ad5 Binary files /dev/null and b/public/images/apps/connect-sharing-dark.webp differ diff --git a/public/images/apps/connect-sharing-light.webp b/public/images/apps/connect-sharing-light.webp new file mode 100644 index 0000000..b7a7078 Binary files /dev/null and b/public/images/apps/connect-sharing-light.webp differ diff --git a/public/images/apps/desktop-collections-dark.webp b/public/images/apps/desktop-collections-dark.webp new file mode 100644 index 0000000..028813c Binary files /dev/null and b/public/images/apps/desktop-collections-dark.webp differ diff --git a/public/images/apps/desktop-collections-light.webp b/public/images/apps/desktop-collections-light.webp new file mode 100644 index 0000000..cc85d59 Binary files /dev/null and b/public/images/apps/desktop-collections-light.webp differ diff --git a/public/images/apps/desktop-home-dark.webp b/public/images/apps/desktop-home-dark.webp new file mode 100644 index 0000000..c1d4620 Binary files /dev/null and b/public/images/apps/desktop-home-dark.webp differ diff --git a/public/images/apps/desktop-home-light.webp b/public/images/apps/desktop-home-light.webp new file mode 100644 index 0000000..5d6360d Binary files /dev/null and b/public/images/apps/desktop-home-light.webp differ diff --git a/public/mdbase-atmosphere.js b/public/mdbase-atmosphere.js index 20c3574..72b3d28 100644 --- a/public/mdbase-atmosphere.js +++ b/public/mdbase-atmosphere.js @@ -56,7 +56,12 @@ }; function readBase() { - const base = getComputedStyle(root).getPropertyValue('--color-canvas').trim(); + // The token can be a light-dark() expression, which a canvas cannot parse, so an element resolves it. + const probe = document.createElement('span'); + probe.style.cssText = 'display:none;color:var(--color-canvas)'; + root.append(probe); + const base = getComputedStyle(probe).color; + probe.remove(); colorContext.fillStyle = base; colorContext.fillRect(0, 0, 1, 1); baseRgb = [...colorContext.getImageData(0, 0, 1, 1).data].slice(0, 3).join(','); diff --git a/public/mdbase-murmuration.js b/public/mdbase-murmuration.js index 7bccb6e..91af2f7 100644 --- a/public/mdbase-murmuration.js +++ b/public/mdbase-murmuration.js @@ -39,6 +39,7 @@ muted: "rgb(111 116 124)", line: "rgb(204 208 213)", lineSoft: "rgb(226 229 232)", + box: "rgb(165 170 177)", accent: "rgb(42 104 143)", particle: "rgb(25 27 31 / 0.88)", particleIntro: "rgb(25 27 31 / 0.88)", @@ -64,6 +65,8 @@ palette.muted = resolveColor("--color-text-muted", palette.muted); palette.line = dark ? resolveColor("--color-text-faint", palette.muted) : palette.muted; palette.lineSoft = resolveColor("--color-border", palette.lineSoft); + // Box outlines are quieter than text, like the apps' card borders. + palette.box = resolveColor("--color-text-faint", palette.muted); palette.accent = resolveColor("--color-accent", palette.accent); palette.particle = dark ? palette.muted : palette.ink; palette.particleIntro = dark ? palette.soft : palette.ink; @@ -100,7 +103,8 @@ function diagramBounds() { if (width <= 820) { const headerBottom = document.querySelector(".site-header")?.getBoundingClientRect().bottom || 76; - const top = Math.max(headerBottom + 12, height * 0.10); + // The motion control has its own row between the header and the diagram. + const top = Math.max(headerBottom + 46, height * 0.10); return { x: width * 0.07, y: top, @@ -109,17 +113,26 @@ }; } + // The diagram takes the room to the right of the chapters' text column, which + // starts at the centred page's left edge, and may run past the page's right edge. + const x = textColumnRight() + 56; return { - x: width * 0.52, + x, y: height * 0.17, - w: width * 0.43, + w: Math.max(240, Math.min(width - x - 40, 760)), h: height * 0.68 }; } + function textColumnRight() { + const column = document.querySelector(".chapter__inner")?.getBoundingClientRect?.(); + return column && column.width ? column.right : width * 0.48; + } + function introBounds() { if (width <= 820) return diagramBounds(); - return { x: width * 0.45, y: height * 0.08, w: width * 0.53, h: height * 0.84 }; + const x = textColumnRight() + 16; + return { x, y: height * 0.08, w: Math.max(240, width - x - 24), h: height * 0.84 }; } function rect(bounds, x, y, w, h) { @@ -147,7 +160,7 @@ let lines = []; let size = compact ? 14 : 17; for (; size >= (compact ? 11 : 12); size--) { - context.font = `${size}px "Atkinson Hyperlegible", sans-serif`; + context.font = `${size}px "IBM Plex Sans", sans-serif`; lines = []; let line = ""; for (const word of label.split(" ")) { @@ -166,7 +179,7 @@ const maxLines = Math.max(1, Math.floor(availableHeight / lineHeight)); const overflow = lines.length > maxLines; lines = lines.slice(0, maxLines); - context.font = `${size}px "Atkinson Hyperlegible", sans-serif`; + context.font = `${size}px "IBM Plex Sans", sans-serif`; lines = lines.map((line, index) => { if (context.measureText(line).width <= availableWidth && !(overflow && index === lines.length - 1)) return line; @@ -897,14 +910,16 @@ context.fillStyle = palette.surface; context.strokeStyle = node.kind === "held" ? palette.warning : node.kind === "log" || node.kind === "accent" ? palette.accent - : node.kind === "boundary" ? palette.lineSoft : palette.muted; + : node.kind === "boundary" ? palette.lineSoft : palette.box; context.globalAlpha *= node.kind === "boundary" ? 0.5 : 0.94; context.lineWidth = 1; context.setLineDash( node.kind === "boundary" || node.kind === "replica" ? [3, 5] : [] ); + // The apps' card corners; older canvases fall back to square ones. context.beginPath(); - context.rect(x, y, w, h); + if (context.roundRect) context.roundRect(x, y, w, h, node.kind === "boundary" ? 10 : 8); + else context.rect(x, y, w, h); context.fill(); context.stroke(); context.setLineDash([]); @@ -922,7 +937,7 @@ context.textBaseline = "top"; context.fillStyle = palette.ink; context.globalAlpha *= 0.95; - context.font = `${size}px "Atkinson Hyperlegible", sans-serif`; + context.font = `${size}px "IBM Plex Sans", sans-serif`; lines.forEach((line, index) => { context.fillText(line, x + padding, y + padding + index * lineHeight); }); @@ -966,7 +981,7 @@ context.save(); context.fillStyle = palette.muted; - context.font = `${compact ? 14 : 17}px "Atkinson Hyperlegible", sans-serif`; + context.font = `${compact ? 14 : 17}px "IBM Plex Sans", sans-serif`; context.textAlign = "center"; note.text.split("\n").forEach((line, index) => context.fillText(line, note.x, note.y + index * (compact ? 18 : 22))); diff --git a/public/og-card.jpg b/public/og-card.jpg index 6f9792c..2353f0c 100644 Binary files a/public/og-card.jpg and b/public/og-card.jpg differ diff --git a/public/videos/mdbase-in-two-minutes-dark.jpg b/public/videos/mdbase-in-two-minutes-dark.jpg new file mode 100644 index 0000000..1805549 Binary files /dev/null and b/public/videos/mdbase-in-two-minutes-dark.jpg differ diff --git a/public/videos/mdbase-in-two-minutes-dark.mp4 b/public/videos/mdbase-in-two-minutes-dark.mp4 new file mode 100644 index 0000000..68ee7ab Binary files /dev/null and b/public/videos/mdbase-in-two-minutes-dark.mp4 differ diff --git a/scripts/build-llms.mjs b/scripts/build-llms.mjs index f95d052..1caf7d8 100644 --- a/scripts/build-llms.mjs +++ b/scripts/build-llms.mjs @@ -1,9 +1,10 @@ // Writes Markdown copies of the built pages for language models and other -// text tools: an index.md beside each searchable page, /llms.txt listing them, +// text tools: an index.md beside each page, /llms.txt listing them, // and /llms-full.txt with every page in one file. // -// A page is included when its
carries data-pagefind-body, the same rule -// the site search uses, so noIndex pages and the archived specification stay out. +// A page is included when its
carries data-markdown-body, so noIndex pages +// and the archived specification stay out. Elements marked data-markdown-ignore +// (headers, footers, sidebars) are left out of the copy. import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs"; import { dirname, join, relative, resolve, sep } from "node:path"; import { fileURLToPath } from "node:url"; @@ -28,7 +29,7 @@ const sections = [ export function pageToMarkdown(html, turndown = createTurndown()) { const main = html.match(/]*)>([\s\S]*?)<\/main>/); - if (!main || !/\bdata-pagefind-body\b/.test(main[1])) return null; + if (!main || !/\bdata-markdown-body\b/.test(main[1])) return null; const title = decode(html.match(/([\s\S]*?)<\/title>/)?.[1] ?? "").replace(/ \| mdbase$/, ""); const description = decode(html.match(/<meta name="description" content="([^"]*)"/)?.[1] ?? ""); const body = turndown.turndown(main[2]).replace(/\n{3,}/g, "\n\n").trim(); @@ -44,7 +45,7 @@ export function createTurndown() { }); turndown.remove(["script", "style", "canvas", "svg", "button", "video", "noscript"]); turndown.addRule("ignored", { - filter: (node) => node.getAttribute?.("data-pagefind-ignore") != null || node.getAttribute?.("aria-hidden") === "true", + filter: (node) => node.getAttribute?.("data-markdown-ignore") != null || node.getAttribute?.("aria-hidden") === "true", replacement: () => "" }); // The docs title block repeats the title and description given above the body, @@ -84,6 +85,8 @@ export function createTurndown() { turndown.addRule("images", { filter: "img", replacement: (_content, node) => { + // A screenshot's dark capture repeats its light one. + if (node.getAttribute("data-markdown-ignore") != null) return ""; const alt = node.getAttribute("alt"); return alt ? `\n\n*Image: ${alt}*\n\n` : ""; } @@ -104,7 +107,7 @@ function decode(text) { function walk(directory) { return readdirSync(directory, { withFileTypes: true }).flatMap((entry) => { const path = join(directory, entry.name); - if (entry.isDirectory()) return entry.name === "pagefind" ? [] : walk(path); + if (entry.isDirectory()) return walk(path); return entry.name === "index.html" ? [path] : []; }); } diff --git a/scripts/deploy-pages-dev.mjs b/scripts/deploy-pages-dev.mjs index e16cf3a..cbffb33 100644 --- a/scripts/deploy-pages-dev.mjs +++ b/scripts/deploy-pages-dev.mjs @@ -71,7 +71,8 @@ export async function prepareDevelopmentBuild() { ), writeFile( resolve(projectRoot, "dist", "_headers"), - "/*\n X-Robots-Tag: noindex, nofollow\n", + // Files under /_astro are named by their content, so they never need revalidating. + "/*\n X-Robots-Tag: noindex, nofollow\n\n/_astro/*\n Cache-Control: public, max-age=31536000, immutable\n", ), ]); } diff --git a/scripts/screenshots/capture-connect.mjs b/scripts/screenshots/capture-connect.mjs new file mode 100644 index 0000000..191fd84 --- /dev/null +++ b/scripts/screenshots/capture-connect.mjs @@ -0,0 +1,59 @@ +// Captures the Connect web screens shown on the site (public/images/apps/connect-*). +// +// Run from an mdbase-connect checkout, with its review server running: +// PORT=4811 pnpm portal:review --no-build +// node <site>/scripts/screenshots/capture-connect.mjs <outdir> +// +// The review server serves the real portal over a made-up account. The captures are +// 1120×700 at 2×, light and dark; convert each PNG to a 1600×1000 WebP named +// connect-<shot>-<theme>.webp. The fixture's app address and one collection name are +// rewritten so the screens match the rest of the site. +import { createRequire } from "node:module"; +import { pathToFileURL } from "node:url"; +const require = createRequire(process.cwd() + "/"); +const { chromium } = require("@playwright/test"); +const { scenarios, clock } = await import(pathToFileURL(process.cwd() + "/apps/portal/tests/review/scenarios.mjs")); +const out = process.argv[2]; +const base = "http://127.0.0.1:4811"; +const shots = [ + { file: "approve", scenario: "authorization-review", keepPending: true }, + { file: "collections", scenario: "typical-account" }, + { file: "sharing", scenario: "collection-access", scrollTo: "People & sharing" }, + { file: "account-home", scenario: "home" } +]; +const strip = value => { + if (Array.isArray(value)) return value.map(strip); + if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, k === "pending_authorizations" ? [] : strip(v)])); + return value; +}; +const browser = await chromium.launch({ channel: "chrome", args: ["--proxy-server=http://127.0.0.1:9", "--proxy-bypass-list=127.0.0.1;localhost;[::1]"] }); +for (const shot of shots) { + const scenario = scenarios.find(s => s.name === shot.scenario); + for (const theme of ["light", "dark"]) { + const context = await browser.newContext({ viewport: { width: 1120, height: 700 }, deviceScaleFactor: 2, colorScheme: theme, reducedMotion: "reduce", locale: "en-AU", timezoneId: "Australia/Melbourne" }); + const page = await context.newPage(); + await page.clock.setFixedTime(new Date(clock)); + await page.route("**/v1/**", async route => { + const response = await route.fetch(); + let body = await response.text(); + if (!(response.headers()["content-type"] ?? "").includes("json")) return route.fulfill({ response, body }); + body = body.replaceAll("https://tasknotes.mdbase.dev", "https://app.tasknotes.dev").replaceAll("Research index", "Journal"); + if (!shot.keepPending) { try { body = JSON.stringify(strip(JSON.parse(body))); } catch {} } + await route.fulfill({ response, body }); + }); + await page.goto(`${base}/__review/scenario/${shot.scenario}?latency=0`); + await page.getByText(scenario.ready, { exact: false }).filter({ visible: true }).first().waitFor({ timeout: 15000 }); + await page.evaluate(() => document.fonts.ready); + if (shot.scrollTo) await page.getByText(shot.scrollTo, { exact: false }).first().evaluate(node => { + const top = node.getBoundingClientRect().top; + let scroller = node.parentElement; + while (scroller && !(scroller.scrollHeight > scroller.clientHeight + 4 && /auto|scroll/.test(getComputedStyle(scroller).overflowY))) scroller = scroller.parentElement; + (scroller ?? document.scrollingElement).scrollBy(0, top - 150); + }); + await page.waitForTimeout(500); + await page.screenshot({ path: `${out}/${shot.file}-${theme}.png` }); + await context.close(); + console.log(shot.file, theme); + } +} +await browser.close(); diff --git a/scripts/screenshots/capture-desktop.mjs b/scripts/screenshots/capture-desktop.mjs new file mode 100644 index 0000000..56a3206 --- /dev/null +++ b/scripts/screenshots/capture-desktop.mjs @@ -0,0 +1,154 @@ +// Captures the desktop app's screens shown on the site (public/images/apps/desktop-*). +// +// Copy this file into apps/desktop of an mdbase-connect checkout (it resolves +// playwright-core from there), build the renderer, and run: +// node capture-desktop.mjs <outdir> +// +// The renderer is loaded in a browser with a stand-in for the preload API, as the +// desktop app's own renderer tests do, over a made-up account. The captures are +// 1120×700 at 2×, light and dark; convert each PNG to a 1600×1000 WebP named +// desktop-<screen>-<theme>.webp. +import { createServer } from "node:http"; +import { readFile } from "node:fs/promises"; +import { extname, resolve, sep } from "node:path"; +import { chromium } from "playwright-core"; +const root = resolve(process.cwd(), "dist/renderer"); +const out = process.argv[2]; +let THEME = "light"; +const unavailableUpdate = { phase: "unavailable", current_version: "0.1.33", channel: "beta", message: "", can_check: false, can_install: false }; +const server = createServer(async (request, response) => { + const pathname = new URL(request.url, "http://localhost").pathname; + const file = resolve(root, `.${pathname === "/" ? "/index.html" : pathname}`); + if (!file.startsWith(`${root}${sep}`)) { response.writeHead(403).end(); return; } + try { + const types = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".woff2": "font/woff2", ".woff": "font/woff", ".svg": "image/svg+xml" }; + response.setHeader("Content-Type", types[extname(file)] ?? "application/octet-stream"); + response.end(await readFile(file)); + } catch { response.writeHead(404).end(); } +}); +await new Promise((ready, reject) => { server.once("error", reject); server.listen(0, "127.0.0.1", ready); }); +const origin = `http://127.0.0.1:${server.address().port}`; +const browser = await chromium.launch({ headless: true, channel: "chrome" }); +async function desktop({ signedIn = true, collections = [], access = [], devices = [], activity = [], apps = [], updateStatus = unavailableUpdate } = {}) { + const page = await browser.newPage({ viewport: { width: 1120, height: 700 }, deviceScaleFactor: 2, colorScheme: THEME, reducedMotion: "reduce" }); + await page.route("**/*", (route) => new URL(route.request().url()).origin === origin ? route.continue() : route.abort()); + const errors = []; + page.on("pageerror", (error) => errors.push(error.message)); + await page.clock.install(); + await page.addInitScript(({ signedIn, collections, access, devices, activity, apps, updateStatus }) => { + const calls = []; + const record = (name) => async (...args) => { calls.push([name, ...args]); return null; }; + const fixture = { + calls, collections, access, devices, activity, apps, updateStatus, requireApproval: false, + account: { configured: signedIn, serverUrl: signedIn ? "https://connect.example.test" : null, online: signedIn, pairing: null, lastError: null }, + status: () => ({ target: "isolated_profile", state_dir: "/disposable", account: { + signed_in: fixture.account.configured, online: fixture.account.online, environment: "production", + pairing: fixture.account.pairing ?? undefined, last_error: fixture.account.lastError ?? undefined, + server: fixture.account.serverUrl ?? undefined, computer_name: fixture.account.computerName ?? undefined + }, collections: fixture.collections }), + counts: {} + }; + window.fixture = fixture; + // Electron reports a window hidden to the tray as a hidden page. + let visibility = "visible"; + Object.defineProperty(document, "visibilityState", { configurable: true, get: () => visibility }); + Object.defineProperty(document, "hidden", { configurable: true, get: () => visibility !== "visible" }); + fixture.setVisibility = (next) => { visibility = next; document.dispatchEvent(new Event("visibilitychange")); }; + window.mdbaseConnect = { + getLocale: async () => localStorage.getItem("fixture:locale") ?? "en", + setLocale: async (locale) => { calls.push(["setLocale", locale]); localStorage.setItem("fixture:locale", locale); }, + status: async () => fixture.status(), + updateStatus: async () => fixture.updateStatus, + checkForUpdates: async () => { calls.push(["checkForUpdates"]); return fixture.updateStatus; }, + installUpdate: async () => { calls.push(["installUpdate"]); return fixture.updateStatus; }, + migrationStatus: async () => fixture.migration ?? { record: null, running: false }, + listCollections: async () => fixture.collections, + listAccess: async () => fixture.access, + listApps: async () => ({ applications: fixture.apps }), + openApp: record("openApp"), + openAccount: record("openAccount"), + getSettings: async () => ({ require_grant_approval: fixture.requireApproval }), + getLaunchAtLogin: async () => ({ enabled: false, available: false }), + addCollection: record("addCollection"), + openCollectionFolder: record("openCollectionFolder"), + setCollectionEnabled: record("setCollectionEnabled"), + chooseCreateFolder: async () => "/disposable/parent", + createCollection: async (input) => { calls.push(["createCollection", input]); return { name: input.name }; }, + enableSync: async (...args) => { + calls.push(["enableSync", ...args]); + const failure = fixture.failEnableSync; + fixture.failEnableSync = null; + if (failure) throw new Error(failure); + return null; + }, + removeCollection: record("removeCollection"), + syncFiles: async () => fixture.syncFiles ?? { include: ["image", "audio", "video", "pdf", "other"], exclude: [] }, + setSyncFiles: async (id, files) => { calls.push(["setSyncFiles", id, files]); fixture.syncFiles = files; return files; }, + listHolds: async () => fixture.holds ?? [], + resolveHold: async (id, hold, how) => { calls.push(["resolveHold", id, hold, how]); fixture.holds = (fixture.holds ?? []).filter((h) => h.id !== hold); + const held = fixture.migration?.holds?.[id]; + if (held) fixture.migration.holds[id] = held.filter((h) => h.id !== hold); + return null; + }, + listActivity: async () => fixture.activity ?? [], + updateCollection: async (id, changes) => { calls.push(["updateCollection", id, changes]); if (fixture.failUpdate) throw new Error(fixture.failUpdate); return { ...fixture.collections[0], ...changes }; }, + renameComputer: async (name) => { calls.push(["renameComputer", name]); fixture.account = { ...fixture.account, computerName: name }; return { name }; }, + approveAccess: record("approveAccess"), + acknowledgeAccess: record("acknowledgeAccess"), + revokeAccess: record("revokeAccess"), + denyAccess: record("denyAccess"), + listPendingDevices: async () => fixture.devices ?? [], + approveDevice: async (...args) => { calls.push(["approveDevice", ...args]); fixture.devices = []; return {}; }, + rejectDevice: record("rejectDevice"), + signIn: async () => { + calls.push(["signIn"]); + fixture.account = { ...fixture.account, pairing: "https://connect.example.test/pair/same-request", lastError: null }; + return { verificationUri: fixture.account.pairing, expiresIn: 600 }; + }, + reopenSignIn: async () => {}, + onNavigate: () => () => {}, onUpdateStatus: () => () => {} + }; + for (const [name, method] of Object.entries(window.mdbaseConnect)) { + window.mdbaseConnect[name] = (...args) => { fixture.counts[name] = (fixture.counts[name] ?? 0) + 1; return method(...args); }; + } + }, { signedIn, collections, access, devices, activity, apps, updateStatus }); + await page.goto(origin); + await page.getByText(signedIn ? "Connected securely" : "Not signed in", { exact: true }).first().waitFor().catch(error => { throw new Error(`${error.message}\nRenderer errors: ${errors.join("; ")}`); }); + const calls = (name) => page.evaluate((name) => window.fixture.calls.filter((call) => call[0] === name).map((call) => call.slice(1)), name); + return { page, errors, calls }; +} + + +const collection = (overrides = {}) => ({ id: "c-notes", name: "Notes", root: "/home/maya/Documents/Notes", mode: "local", origin: "local", log: "none", state: "ready", notices: [], ...overrides }); +const online = { pending: 0, holds: 0, unresolved: 0, connection: "online" }; +const fixture = { + collections: [ + collection({ id: "c-field", name: "Field research", root: "/home/maya/Documents/Field research", mode: "synced", log: "hosted", sync: online }), + collection({ id: "c-garden", name: "Garden journal", root: "/home/maya/Documents/Garden journal", mode: "synced", log: "hosted", sync: online }), + collection({ id: "c-reading", name: "Reading notes", root: "/home/maya/Documents/Reading notes", mode: "synced", log: "hosted", sync: online }), + collection({ id: "c-house", name: "Household projects", root: "/home/maya/Documents/Household projects" }) + ], + apps: [ + { id: "tasknotes", name: "TaskNotes", distribution: "web", homepage: "https://app.tasknotes.dev/", icon: "", collections: [{ id: "c-field", name: "Field research" }] }, + { id: "editor", name: "Editor", distribution: "web", homepage: "https://editor.mdbase.dev/", icon: "", collections: [{ id: "c-garden", name: "Garden journal" }] }, + { id: "reader", name: "Reader", distribution: "web", homepage: "https://reader.mdbase.dev/", icon: "", collections: [{ id: "c-reading", name: "Reading notes" }] } + ], + access: [ + { grant: "g1", collection: "c-field", app_id: "tasknotes", app_name: "TaskNotes", client_pk: "pk", capabilities: ["read", "write"], state: "active", first_seen_ms: Date.now(), acknowledged: true }, + { grant: "g2", collection: "c-reading", app_id: "reader", app_name: "Reader", client_pk: "pk2", capabilities: ["read", "write"], state: "active", first_seen_ms: Date.now(), acknowledged: true } + ] +}; +for (const theme of ["light", "dark"]) { + THEME = theme; + const { page, errors } = await desktop(fixture); + await page.evaluate(() => document.fonts.ready); + await page.waitForTimeout(500); + await page.screenshot({ path: `${out}/home-${theme}.png` }); + for (const name of ["Collections", "Apps"]) { + const link = page.locator(".product-sidebar-link").filter({ hasText: name }); + if (await link.count()) { await link.first().click(); await page.waitForTimeout(500); await page.screenshot({ path: `${out}/${name.toLowerCase()}-${theme}.png` }); } + } + console.log(theme, "errors:", errors.join("; ") || "none", "nav:", await page.locator(".product-sidebar-link").allInnerTexts()); + await page.close(); +} +await browser.close(); server.close(); diff --git a/scripts/screenshots/capture-og-card.mjs b/scripts/screenshots/capture-og-card.mjs new file mode 100644 index 0000000..4de999d --- /dev/null +++ b/scripts/screenshots/capture-og-card.mjs @@ -0,0 +1,41 @@ +// Draws the social share image (public/og-card.jpg, 1200×630) from the homepage's +// own sky, with the mark, the wordmark and the site's line in its typefaces. +// +// Run from an mdbase-connect checkout (for its Playwright), with this site's dev +// server running: +// node <site>/scripts/screenshots/capture-og-card.mjs http://127.0.0.1:4321 <out.png> +// then convert the PNG to a JPEG at quality 88. +import { createRequire } from "node:module"; +const require = createRequire(process.cwd() + "/"); +const { chromium } = require("@playwright/test"); +const [base, out] = process.argv.slice(2); + +const bars = [ + [22, 22, 20], [50, 22, 20], [78, 22, 20], [22, 44, 12], [42, 44, 56, true], + [22, 66, 28], [58, 66, 40], [22, 88, 20], [50, 88, 20], [78, 88, 20] +]; + +const browser = await chromium.launch({ channel: "chrome" }); +const page = await (await browser.newContext({ viewport: { width: 1200, height: 630 }, colorScheme: "light", deviceScaleFactor: 1 })).newPage(); +await page.goto(base + "/", { waitUntil: "networkidle" }); +await page.evaluate(() => document.fonts.ready); +await page.evaluate((bars) => { + // Keep only the sky; the card's own contents go on top of it. + for (const selector of [".site-header", "main", "#diagram", ".site-footer", ".motion-control", ".home-skip-link"]) { + document.querySelectorAll(selector).forEach((node) => node.remove()); + } + const card = document.createElement("div"); + card.style.cssText = "position:fixed;inset:0;z-index:10;color:var(--color-text);"; + card.innerHTML = ` + <svg viewBox="18 18 84 84" style="position:absolute;right:140px;top:110px;width:300px;height:300px"> + ${bars.map(([x, y, width, accent]) => `<rect x="${x}" y="${y}" width="${width}" height="10" fill="${accent ? "var(--color-accent)" : "currentColor"}"/>`).join("")} + </svg> + <div style="position:absolute;left:84px;bottom:86px"> + <div style="font:500 64px/1 var(--mono);letter-spacing:-0.02em">mdbase</div> + <div style="margin-top:26px;max-width:11.5em;font:600 38px/1.2 var(--sans);letter-spacing:-0.015em">Structured data in ordinary Markdown files</div> + </div>`; + document.body.append(card); +}, bars); +await page.waitForTimeout(2500); +await page.screenshot({ path: out }); +await browser.close(); diff --git a/scripts/spec-page.mjs b/scripts/spec-page.mjs index c9ee377..b4b3bc4 100644 --- a/scripts/spec-page.mjs +++ b/scripts/spec-page.mjs @@ -12,8 +12,8 @@ export function renderSpecPage(shell, source, archive) { .replace(/<!-- spec-navigation:start -->[\s\S]*?<!-- spec-navigation:end -->/, () => `<!-- spec-navigation:start -->${navigation.replace(/<div class="spec-mobile-links"[^>]*>[\s\S]*?<\/div>/, "")}<!-- spec-navigation:end -->`) .replace(/<!-- spec-content:start -->[\s\S]*?<!-- spec-content:end -->/, () => - // Heading permalinks read as "#" in search results, so search skips them. - `<!-- spec-content:start -->${content.replaceAll('<a class="anchor" ', '<a class="anchor" data-pagefind-ignore ')}<!-- spec-content:end -->`) + // Heading permalinks read as "#" in the Markdown copy, so it skips them. + `<!-- spec-content:start -->${content.replaceAll('<a class="anchor" ', '<a class="anchor" data-markdown-ignore ')}<!-- spec-content:end -->`) .replace(/<meta name="mdbase-spec-channel"[^>]*>/g, "") .replace("</head>", `<meta name="mdbase-spec-channel" content="${archive ? "v0.2-archive" : "v0.3-current"}"></head>`); } diff --git a/src/components/AppIcon.astro b/src/components/AppIcon.astro new file mode 100644 index 0000000..e74bba5 --- /dev/null +++ b/src/components/AppIcon.astro @@ -0,0 +1,63 @@ +--- +// An app's tile, as Connect shows it: Editor, Reader and Writer carry the mark in +// their own colour (the @mdbase-dev/ui app marks); other apps show their initial. +interface Props { + name: string; + /** A sign in place of the initial, for a row that is not an app. */ + glyph?: "plus"; +} + +const { name, glyph } = Astro.props; +const key = name.toLowerCase().replace(/^mdbase\s+(for\s+)?/, ""); +const marked = key === "editor" || key === "reader" || key === "writer"; +const bars = [ + { x: 22, y: 22, width: 20 }, + { x: 50, y: 22, width: 20 }, + { x: 78, y: 22, width: 20 }, + { x: 22, y: 44, width: 12 }, + { x: 42, y: 44, width: 56, line: true }, + { x: 22, y: 66, width: 28 }, + { x: 58, y: 66, width: 40 }, + { x: 22, y: 88, width: 20 }, + { x: 50, y: 88, width: 20 }, + { x: 78, y: 88, width: 20 } +]; +--- + +<span class:list={["app-icon", marked && `app-icon--${key}`]} aria-hidden="true"> + { + marked ? ( + <svg viewBox="18 18 84 84" focusable="false"> + {bars.map((bar) => ( + <rect class={bar.line ? "app-icon__line" : "app-icon__bar"} x={bar.x} y={bar.y} width={bar.width} height="10" /> + ))} + </svg> + ) : glyph === "plus" ? ( + <svg class="app-icon__glyph" viewBox="0 0 16 16" focusable="false"><path d="M8 3.5v9M3.5 8h9" /></svg> + ) : ( + <span>{key.charAt(0).toUpperCase()}</span> + ) + } +</span> + +<style is:global> + .app-icon { + display: inline-grid; + flex: none; + width: 2.1rem; + height: 2.1rem; + place-items: center; + color: var(--color-text-soft); + background: var(--color-surface-subtle); + border-radius: var(--radius-md, 8px); + font: 600 0.95rem/1 var(--sans); + } + + .app-icon svg { width: 58%; height: 58%; } + .app-icon .app-icon__glyph { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; } + .app-icon__bar { fill: var(--app); } + .app-icon__line { fill: var(--color-text); } + .app-icon--editor { --app: var(--app-editor, #005c88); } + .app-icon--reader { --app: var(--app-reader, #a4467f); } + .app-icon--writer { --app: var(--app-writer, #d55e00); } +</style> diff --git a/src/components/AppShot.astro b/src/components/AppShot.astro index 41b9a36..45d841e 100644 --- a/src/components/AppShot.astro +++ b/src/components/AppShot.astro @@ -3,45 +3,79 @@ // light and dark (public/images/apps/<name>-light|dark.webp, 1600×1000 from a // 1120×700 window at 2×), and the frame shows the capture matching the site's // theme. The hidden capture is display: none, so the browser never loads it. +// The Connect and desktop captures come from the apps' own review fixtures (a made-up +// account), taken the same way with scripts/screenshots; see docs/app-documentation.md. interface Props { - name: "tasknotes" | "editor" | "reader" | "writer"; + name: + | "tasknotes" | "editor" | "reader" | "writer" + | "connect-approve" | "connect-collections" | "connect-sharing" + | "desktop-home" | "desktop-collections"; alt: string; eager?: boolean; } +// The window bar shows a web app's address, or the desktop app's name. const hosts = { tasknotes: "app.tasknotes.dev", editor: "editor.mdbase.dev", reader: "reader.mdbase.dev", - writer: "writer.mdbase.dev" + writer: "writer.mdbase.dev", + "connect-approve": "connect.mdbase.dev", + "connect-collections": "connect.mdbase.dev", + "connect-sharing": "connect.mdbase.dev", + "desktop-home": "mdbase Connect", + "desktop-collections": "mdbase Connect" +} as const; + +// On a phone a whole window is too small to read, so each capture names the part +// worth showing there: its left and top edges, width and height, as fractions of +// the capture. Opening the screenshot shows all of it. +const crops = { + tasknotes: [0.2, 0.02, 0.62, 0.62], + editor: [0.25, 0, 0.62, 0.62], + reader: [0.2, 0.08, 0.6, 0.6], + writer: [0, 0, 0.62, 0.62], + "connect-approve": [0.19, 0.09, 0.62, 0.89], + "connect-collections": [0.21, 0.02, 0.62, 0.62], + "connect-sharing": [0.19, 0.52, 0.79, 0.36], + "desktop-home": [0.22, 0.03, 0.4, 0.5], + "desktop-collections": [0.22, 0.03, 0.6, 0.5] } as const; const { name, alt, eager = false } = Astro.props; const hasCaption = Astro.slots.has("caption"); const loading = eager ? "eager" : "lazy"; +const [cropX, cropY, cropW, cropH] = crops[name]; +const crop = `--crop-x: ${cropX}; --crop-y: ${cropY}; --crop-w: ${cropW}; --crop-ratio: ${((1.6 * cropW) / cropH).toFixed(3)};`; --- <figure class="app-shot"> - <div class="app-shot__window"> - <div class="app-shot__bar" aria-hidden="true"><span>{hosts[name]}</span></div> - <img - class="app-shot__image app-shot__image--light" - src={`/images/apps/${name}-light.webp`} - alt={alt} - width="1600" - height="1000" - loading={loading} - decoding="async" - /> - <img - class="app-shot__image app-shot__image--dark" - src={`/images/apps/${name}-dark.webp`} - alt={alt} - width="1600" - height="1000" - loading={loading} - decoding="async" - /> + <div class="app-shot__window" data-view-image={hosts[name]} tabindex="0" role="button" aria-label={`Enlarge the screenshot: ${alt}`}> + <div class="app-shot__bar" aria-hidden="true"> + <span>{hosts[name]}</span> + <svg class="app-shot__enlarge" viewBox="0 0 16 16"><path d="M9.5 2.5h4v4M6.5 13.5h-4v-4M13.5 2.5l-4.5 4.5M2.5 13.5 7 9" /></svg> + </div> + <div class="app-shot__crop" style={crop}> + <img + class="app-shot__image app-shot__image--light" + src={`/images/apps/${name}-light.webp`} + alt={alt} + width="1600" + height="1000" + loading={loading} + decoding="async" + /> + <img + class="app-shot__image app-shot__image--dark" + src={`/images/apps/${name}-dark.webp`} + alt={alt} + width="1600" + height="1000" + loading={loading} + decoding="async" + data-markdown-ignore + /> + </div> </div> {hasCaption && <figcaption><slot name="caption" /></figcaption>} </figure> @@ -59,11 +93,15 @@ const loading = eager ? "eager" : "lazy"; overflow: hidden; background: var(--color-surface, var(--color-canvas)); border: 1px solid var(--color-border-strong, var(--color-border)); - border-radius: 8px; + border-radius: var(--radius-lg, 10px); box-shadow: var(--app-shot-shadow); } + .app-shot__window[data-view-image] { cursor: zoom-in; } + .app-shot__window[data-view-image]:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; } + .app-shot__bar { + position: relative; display: flex; height: 28px; align-items: center; @@ -75,12 +113,41 @@ const loading = eager ? "eager" : "lazy"; letter-spacing: 0.01em; } + /* The corner mark says the screenshot opens; it brightens with the window. */ + .app-shot__enlarge { + position: absolute; + top: 7px; + right: 9px; + width: 13px; + height: 13px; + fill: none; + stroke: currentColor; + stroke-width: 1.3; + stroke-linecap: round; + stroke-linejoin: round; + opacity: 0.55; + } + .app-shot__window:is(:hover, :focus-visible) .app-shot__enlarge { color: var(--color-text); opacity: 1; } + .app-shot__image { display: block; width: 100%; height: auto; } + /* On a phone, the named part of the capture fills the frame. */ + @media (max-width: 40rem) { + .app-shot__crop { position: relative; overflow: hidden; aspect-ratio: var(--crop-ratio); } + .app-shot__crop .app-shot__image { + position: absolute; + top: 0; + left: 0; + width: calc(100% / var(--crop-w)); + max-width: none; + transform: translate(calc(var(--crop-x) * -100%), calc(var(--crop-y) * -100%)); + } + } + .app-shot__image--dark { display: none; } :root[data-theme="dark"] .app-shot__image--light { display: none; } diff --git a/src/components/BuildYourOwn.astro b/src/components/BuildYourOwn.astro new file mode 100644 index 0000000..70c719d --- /dev/null +++ b/src/components/BuildYourOwn.astro @@ -0,0 +1,289 @@ +--- +// The picture beside "Build your own" on the apps page: twelve records that +// rearrange themselves as a list, a board, a calendar, a timeline and a graph. +// A record's status changes now and then and follows it into every view, which +// is the point: an app is one way of looking at the same records. +// +// The first view is drawn here, so the picture is whole without scripts. With +// them the views take turns; the tabs choose one and a record can be clicked to +// move its status on. Reduced motion keeps the tabs and drops the movement. +import { BAR_HEIGHT, BOARD, CALENDAR, EDGES, INITIAL_STATUS, STAGE, TIMELINE, VIEWS, layout } from "../scripts/record-views"; + +const first = "board"; +const labels = { list: "List", board: "Board", calendar: "Calendar", timeline: "Timeline", graph: "Graph" }; +const tiles = layout(first, INITIAL_STATUS); +const cells = Array.from({ length: CALENDAR.columns * CALENDAR.rows }, (_, day) => ({ + day, + x: CALENDAR.left + (day % CALENDAR.columns) * CALENDAR.stepX, + y: CALENDAR.top + Math.floor(day / CALENDAR.columns) * CALENDAR.stepY +})); +--- + +<figure class="app-shot byo" data-markdown-ignore> + <div class="app-shot__window" data-record-views data-view={first}> + <div class="app-shot__bar" aria-hidden="true"><span>your-app.example</span></div> + <div class="byo__toolbar"> + <div class="byo__tabs" role="group" aria-label="Arrange the records as" inert> + {VIEWS.map((view) => <button type="button" data-view={view} aria-pressed={view === first ? "true" : "false"}>{labels[view]}</button>)} + </div> + <span class="byo__count" aria-hidden="true">12 records</span> + </div> + <svg class="byo__stage" viewBox={`0 0 ${STAGE.width} ${STAGE.height}`} role="img" aria-label="The same twelve records arranged in turn as a list, a board, a calendar, a timeline and a graph."> + <g class="byo-decor byo-decor--board"> + {BOARD.columns.map((x, status) => ( + <g data-status={status}> + <rect class="byo-column" x={x - 8} y="12" width={BOARD.width + 16} height={STAGE.height - 24} rx="10" /> + <circle class="byo-dot" cx={x + 7} cy="30" r="4.5" /> + <rect class="byo-bar byo-bar--b" x={x + 20} y="27" width={[34, 40, 30][status]} height={BAR_HEIGHT} rx="3" /> + </g> + ))} + </g> + <g class="byo-decor byo-decor--calendar"> + {cells.map((cell) => ( + <g> + <rect class:list={["byo-cell", cell.day === CALENDAR.today && "byo-cell--today"]} x={cell.x} y={cell.y} width={CALENDAR.width} height={CALENDAR.height} rx="6" /> + <rect class="byo-bar byo-bar--b" x={cell.x + 7} y={cell.y + 8} width="10" height="5" rx="2.5" /> + </g> + ))} + </g> + <g class="byo-decor byo-decor--timeline"> + {Array.from({ length: TIMELINE.lines }, (_, line) => <line class="byo-rule" x1={28 + line * TIMELINE.step} y1="8" x2={28 + line * TIMELINE.step} y2={STAGE.height - 8} />)} + <line class="byo-today" x1={TIMELINE.today} y1="8" x2={TIMELINE.today} y2={STAGE.height - 8} /> + <circle class="byo-today-mark" cx={TIMELINE.today} cy="8" r="3" /> + </g> + <g class="byo-decor byo-decor--graph"> + {EDGES.map(() => <line class="byo-edge" />)} + </g> + {tiles.map((tile, index) => ( + <g class="byo-tile" data-status={INITIAL_STATUS[index]}> + <rect class="byo-card" x={tile.x} y={tile.y} width={tile.w} height={tile.h} rx={tile.r} /> + <rect class="byo-bar byo-bar--a" x={tile.ax} y={tile.ay} width={tile.aw} height={BAR_HEIGHT} rx="3" opacity={tile.ao} /> + <rect class="byo-bar byo-bar--b" x={tile.bx} y={tile.by} width={tile.bw} height={BAR_HEIGHT} rx="3" opacity={tile.bo} /> + <circle class="byo-dot" cx={tile.dx} cy={tile.dy} r={tile.dr} /> + </g> + ))} + <circle class="byo-pulse" r="0" /> + </svg> + </div> +</figure> + +<script> + import { COUNT, EDGES, INITIAL_STATUS, TILE_KEYS, VIEWS, layout } from "../scripts/record-views"; + import type { Status, Tile, View } from "../scripts/record-views"; + + const HOLD = 3.6; // seconds a view stays before the next takes its turn + const CHANGE_AT = 1.5; // when, within a hold, one record's status moves on + const STEP = [3, 5, 7, 0, 9, 2, 8, 1, 10, 6, 11, 4]; // the order records change in + const STIFFNESS = 130; + const DAMPING = 17; + + for (const root of document.querySelectorAll<HTMLElement>("[data-record-views]")) { + const svg = root.querySelector<SVGSVGElement>("svg"); + const tabs = root.querySelector<HTMLElement>(".byo__tabs"); + const groups = [...root.querySelectorAll<SVGGElement>(".byo-tile")]; + const edges = [...root.querySelectorAll<SVGLineElement>(".byo-edge")]; + const pulse = root.querySelector<SVGCircleElement>(".byo-pulse"); + if (!svg || !tabs || !pulse || groups.length !== COUNT) continue; + + const still = matchMedia("(prefers-reduced-motion: reduce)"); + const status: Status[] = [...INITIAL_STATUS]; + let view = (root.dataset.view as View) ?? "board"; + const parts = groups.map((group) => ({ + group, + card: group.querySelector<SVGRectElement>(".byo-card")!, + a: group.querySelector<SVGRectElement>(".byo-bar--a")!, + b: group.querySelector<SVGRectElement>(".byo-bar--b")!, + dot: group.querySelector<SVGCircleElement>(".byo-dot")! + })); + const now = layout(view, status); + const speed: Tile[] = now.map(() => Object.fromEntries(TILE_KEYS.map((key) => [key, 0])) as Tile); + const goal: Tile[] = now.map((tile) => ({ ...tile })); + const due = new Array<number>(COUNT).fill(0); // when each record takes its new place + const waiting: (Tile | null)[] = new Array(COUNT).fill(null); + + let clock = 0; // seconds of animation, counted only while on screen + let held = 0; // seconds in the current view + let changed = false; // whether this hold has had its status change + let stepIndex = 0; + let handsOffUntil = 0; // the views stop taking turns for a while after a click + let drift = 0; // 0 to 1: how far the graph's slow float is on + let pulseOn = -1, pulseAt = 0; + let frame = 0, last = 0, visible = false; + + const draw = () => { + for (let i = 0; i < COUNT; i++) { + const tile = now[i], part = parts[i]; + const ox = drift * 4 * Math.sin(clock * 0.7 + i * 1.7); + const oy = drift * 4 * Math.cos(clock * 0.6 + i * 2.3); + part.card.setAttribute("x", (tile.x + ox).toFixed(2)); + part.card.setAttribute("y", (tile.y + oy).toFixed(2)); + part.card.setAttribute("width", Math.max(0, tile.w).toFixed(2)); + part.card.setAttribute("height", Math.max(0, tile.h).toFixed(2)); + part.card.setAttribute("rx", Math.max(0, tile.r).toFixed(2)); + part.a.setAttribute("x", (tile.ax + ox).toFixed(2)); + part.a.setAttribute("y", (tile.ay + oy).toFixed(2)); + part.a.setAttribute("width", Math.max(0, tile.aw).toFixed(2)); + part.a.setAttribute("opacity", Math.min(1, Math.max(0, tile.ao)).toFixed(3)); + part.b.setAttribute("x", (tile.bx + ox).toFixed(2)); + part.b.setAttribute("y", (tile.by + oy).toFixed(2)); + part.b.setAttribute("width", Math.max(0, tile.bw).toFixed(2)); + part.b.setAttribute("opacity", Math.min(1, Math.max(0, tile.bo)).toFixed(3)); + part.dot.setAttribute("cx", (tile.dx + ox).toFixed(2)); + part.dot.setAttribute("cy", (tile.dy + oy).toFixed(2)); + part.dot.setAttribute("r", Math.max(0, tile.dr).toFixed(2)); + } + edges.forEach((edge, index) => { + const [from, to] = EDGES[index].map((i) => parts[i].dot); + edge.setAttribute("x1", from.getAttribute("cx")!); + edge.setAttribute("y1", from.getAttribute("cy")!); + edge.setAttribute("x2", to.getAttribute("cx")!); + edge.setAttribute("y2", to.getAttribute("cy")!); + }); + if (pulseOn >= 0) { + const age = (clock - pulseAt) / 0.7; + if (age >= 1) { pulseOn = -1; pulse.setAttribute("r", "0"); } + else { + const dot = parts[pulseOn].dot; + pulse.setAttribute("cx", dot.getAttribute("cx")!); + pulse.setAttribute("cy", dot.getAttribute("cy")!); + pulse.setAttribute("r", (4 + 18 * (1 - (1 - age) ** 3)).toFixed(2)); + pulse.setAttribute("opacity", (0.55 * (1 - age)).toFixed(3)); + } + } + }; + + /** Send every record to its place in the current view, one a moment after another. */ + const arrange = (stagger: number) => { + const next = layout(view, status); + for (let i = 0; i < COUNT; i++) { + if (still.matches) { goal[i] = next[i]; now[i] = { ...next[i] }; waiting[i] = null; } + else { waiting[i] = next[i]; due[i] = clock + i * stagger; } + } + if (still.matches) draw(); + }; + + const show = (next: View) => { + view = next; + root.dataset.view = next; + for (const tab of tabs.querySelectorAll("button")) tab.setAttribute("aria-pressed", String(tab.dataset.view === next)); + held = 0; + changed = false; + arrange(0.028); + }; + + const advance = (i: number) => { + status[i] = ((status[i] + 1) % 3) as Status; + groups[i].dataset.status = String(status[i]); + pulseOn = i; + pulseAt = clock; + arrange(0.012); + }; + + const tick = (time: number) => { + const dt = Math.min((time - last) / 1000, 1 / 20); + last = time; + clock += dt; + held += dt; + const taking = clock >= handsOffUntil; + if (taking && !changed && held > CHANGE_AT) { changed = true; advance(STEP[stepIndex++ % STEP.length]); } + if (taking && held > HOLD) show(VIEWS[(VIEWS.indexOf(view) + 1) % VIEWS.length]); + drift += ((view === "graph" ? 1 : 0) - drift) * Math.min(1, dt * 2.5); + + // Two half steps keep the springs steady at low frame rates. + for (let pass = 0; pass < 2; pass++) { + const h = dt / 2; + for (let i = 0; i < COUNT; i++) { + if (waiting[i] && clock >= due[i]) { goal[i] = waiting[i]!; waiting[i] = null; } + for (const key of TILE_KEYS) { + speed[i][key] += ((goal[i][key] - now[i][key]) * STIFFNESS - speed[i][key] * DAMPING) * h; + now[i][key] += speed[i][key] * h; + } + } + } + draw(); + frame = requestAnimationFrame(tick); + }; + + const run = () => { + cancelAnimationFrame(frame); + if (!visible || still.matches) return; + last = performance.now(); + frame = requestAnimationFrame(tick); + }; + + tabs.inert = false; + tabs.addEventListener("click", (event) => { + const tab = event.target instanceof Element ? event.target.closest<HTMLButtonElement>("button[data-view]") : null; + if (!tab) return; + handsOffUntil = clock + 12; + show(tab.dataset.view as View); + }); + groups.forEach((group, i) => group.addEventListener("click", () => { + handsOffUntil = clock + 12; + advance(i); + })); + + new IntersectionObserver(([entry]) => { visible = entry.isIntersecting; run(); }, { threshold: 0.2 }).observe(svg); + still.addEventListener("change", () => { arrange(0); run(); }); + draw(); + } +</script> + +<style is:global> + .byo__toolbar { + display: flex; + padding: 0.45rem 0.6rem; + align-items: center; + justify-content: space-between; + gap: 0.75rem; + border-bottom: 1px solid var(--color-border); + } + .byo__tabs { display: flex; flex-wrap: wrap; gap: 0.15rem; } + .byo__tabs button { + padding: 0.28rem 0.6rem; + color: var(--color-text-muted); + background: transparent; + border: 0; + border-radius: var(--radius-sm, 6px); + font: 500 0.76rem/1 var(--sans); + cursor: pointer; + } + .byo__tabs button:hover { color: var(--color-text); } + .byo__tabs button[aria-pressed="true"] { color: var(--color-text); background: var(--color-selected); } + .byo__tabs button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; } + .byo__count { flex: none; color: var(--color-text-muted); font: 400 0.68rem/1 var(--mono, monospace); } + + .byo__stage { display: block; width: 100%; height: auto; } + .byo-tile { cursor: pointer; } + .byo-card { fill: var(--color-surface-subtle); stroke: var(--color-border-strong); stroke-width: 1; } + .byo-tile:hover .byo-card { stroke: var(--color-text-faint); } + .byo-bar--a { fill: var(--color-text-soft); transition: fill 0.3s; } + .byo-bar--b { fill: var(--color-text-faint); } + .byo-dot { stroke-width: 1.5; transition: fill 0.3s, stroke 0.3s; } + [data-status="0"] > .byo-dot { fill: var(--color-surface); stroke: var(--color-text-faint); } + [data-status="1"] > .byo-dot { fill: var(--color-accent-soft); stroke: var(--color-accent); } + [data-status="2"] > .byo-dot { fill: var(--color-success); stroke: var(--color-success); } + [data-status="2"] > .byo-bar--a { fill: var(--color-text-faint); } + .byo-pulse { fill: none; stroke: var(--color-accent); stroke-width: 1.5; pointer-events: none; } + + /* What each view draws behind the records fades in with it. */ + .byo-decor { opacity: 0; transition: opacity 0.45s; pointer-events: none; } + [data-view="board"] .byo-decor--board, + [data-view="calendar"] .byo-decor--calendar, + [data-view="timeline"] .byo-decor--timeline, + [data-view="graph"] .byo-decor--graph { opacity: 1; } + .byo-column { fill: var(--color-surface-subtle); opacity: 0.45; } + .byo-cell { fill: none; stroke: var(--color-border); } + .byo-cell--today { stroke: var(--color-accent); } + .byo-rule { stroke: var(--color-border); } + .byo-today { stroke: var(--color-accent); stroke-dasharray: 3 4; } + .byo-today-mark { fill: var(--color-accent); } + .byo-edge { stroke: var(--color-border-strong); stroke-width: 1.2; } + [data-view="board"] .byo-card, + [data-view="calendar"] .byo-card { fill: var(--color-surface); } + + @media (max-width: 40rem) { + .byo__count { display: none; } + .byo__tabs button { padding: 0.28rem 0.45rem; font-size: 0.72rem; } + } +</style> diff --git a/src/components/DocsLayout.astro b/src/components/DocsLayout.astro index 92dabc9..49e4ad9 100644 --- a/src/components/DocsLayout.astro +++ b/src/components/DocsLayout.astro @@ -24,7 +24,7 @@ const editHref = record <BaseLayout title={`${title} · ${label}`} description={description} current={headerCurrent} wide> <div class="docs-shell" data-docs-shell> - <aside class="docs-nav" data-pagefind-ignore="all"> + <aside class="docs-nav" data-markdown-ignore> <details open data-docs-nav> <summary>{label}</summary> <nav aria-label={navLabel}> @@ -49,11 +49,11 @@ const editHref = record <strong>{meta.value}</strong> </div> </aside> - <article class="docs-article" data-pagefind-meta={`title:${title} · ${label}`}> + <article class="docs-article"> <header class="docs-title"> { record ? ( - <div class="record-bar" data-pagefind-ignore="all"> + <div class="record-bar" data-markdown-ignore> <p class="record-bar__file"> <span>{label}</span> <code>{record.path}</code> @@ -77,7 +77,7 @@ const editHref = record </div> { record && ( - <section class="record-source" aria-label={`Markdown source of ${title}`} data-record-source data-pagefind-ignore="all" hidden> + <section class="record-source" aria-label={`Markdown source of ${title}`} data-record-source data-markdown-ignore hidden> <p class="record-source__note"> This page is the file <code>content/{record.path}</code>, a record in the site’s <a href="https://github.com/mdbase-dev/mdbase.dev/tree/main/content">documentation collection</a>. @@ -87,7 +87,7 @@ const editHref = record </section> ) } - <footer class="docs-edit" data-pagefind-ignore="all"> + <footer class="docs-edit" data-markdown-ignore> <a href={editHref}> Edit this page on GitHub </a> @@ -95,7 +95,7 @@ const editHref = record </article> { headings.length > 0 && ( - <aside class="docs-toc" data-pagefind-ignore="all" data-record-page> + <aside class="docs-toc" data-markdown-ignore data-record-page> <strong>On this page</strong> <nav aria-label="On this page"> {headings.map((heading) => <a href={heading.href}>{heading.label}</a>)} diff --git a/src/components/FontPreloads.astro b/src/components/FontPreloads.astro new file mode 100644 index 0000000..b66c6bd --- /dev/null +++ b/src/components/FontPreloads.astro @@ -0,0 +1,16 @@ +--- +// The four font files every page's first screen uses. Preloading starts them with the +// page instead of after its stylesheet, so text paints in its own font rather than +// in a fallback that is swapped a frame later. The URLs are the same hashed files the +// @fontsource stylesheets point to. +import plex400 from "@fontsource/ibm-plex-sans/files/ibm-plex-sans-latin-400-normal.woff2?url"; +import plex500 from "@fontsource/ibm-plex-sans/files/ibm-plex-sans-latin-500-normal.woff2?url"; +import plex600 from "@fontsource/ibm-plex-sans/files/ibm-plex-sans-latin-600-normal.woff2?url"; +import azeret500 from "@fontsource/azeret-mono/files/azeret-mono-latin-500-normal.woff2?url"; +--- + +{ + [plex400, plex500, plex600, azeret500].map((href) => ( + <link rel="preload" as="font" type="font/woff2" href={href} crossorigin /> + )) +} diff --git a/src/components/MediaViewer.astro b/src/components/MediaViewer.astro new file mode 100644 index 0000000..d4b6a84 --- /dev/null +++ b/src/components/MediaViewer.astro @@ -0,0 +1,110 @@ +--- +// One full-window viewer for the page: a screenshot at full size. Anything with +// data-view-image (a screenshot window) opens it. Without scripts a screenshot +// stays as it is. +--- + +<dialog class="media-viewer" aria-label="Viewer" data-media-viewer> + <div class="media-viewer__bar"> + <span class="media-viewer__title" data-media-title></span> + <button type="button" class="media-viewer__close" data-media-close>Close</button> + </div> + <div class="media-viewer__stage" data-media-stage></div> +</dialog> + +<script> + const dialog = document.querySelector<HTMLDialogElement>("[data-media-viewer]"); + const stage = dialog?.querySelector<HTMLElement>("[data-media-stage]"); + const title = dialog?.querySelector<HTMLElement>("[data-media-title]"); + + if (dialog && stage && title) { + const show = (label: string, media: HTMLElement) => { + title.textContent = label; + stage.replaceChildren(media); + dialog.showModal(); + }; + + document.addEventListener("click", (event) => { + const target = event.target instanceof Element ? event.target : null; + const shot = target?.closest<HTMLElement>("[data-view-image]"); + if (shot) { + // The capture on show is the one matching the theme; the other is display: none. + const current = [...shot.querySelectorAll("img")].find((image) => image.offsetParent !== null); + if (!current) return; + const image = new Image(); + image.src = current.currentSrc || current.src; + image.alt = current.alt; + image.width = current.naturalWidth || 1600; + image.height = current.naturalHeight || 1000; + show(shot.dataset.viewImage ?? "", image); + } + }); + + // Enter and Space open a screenshot from the keyboard, as its Enlarge button does. + document.addEventListener("keydown", (event) => { + const shot = event.target instanceof HTMLElement && event.target.matches("[data-view-image]") ? event.target : null; + if (shot && (event.key === "Enter" || event.key === " ")) { + event.preventDefault(); + shot.click(); + } + }); + + dialog.querySelector("[data-media-close]")?.addEventListener("click", () => dialog.close()); + dialog.addEventListener("click", (event) => { + if (event.target === dialog || event.target === stage) dialog.close(); + }); + dialog.addEventListener("close", () => stage.replaceChildren()); + } +</script> + +<style is:global> + .media-viewer { + width: min(calc(100% - 32px), 1280px); + max-width: none; + max-height: calc(100dvh - 32px); + margin: auto; + padding: 0; + overflow: hidden; + color: var(--color-text); + background: var(--color-surface-overlay); + border: 1px solid var(--color-border-strong); + border-radius: var(--radius-lg, 10px); + box-shadow: var(--elevation-high); + } + .media-viewer[open] { display: flex; flex-direction: column; } + .media-viewer::backdrop { background: var(--color-scrim, rgb(0 0 0 / 0.5)); backdrop-filter: blur(3px); } + + .media-viewer__bar { + display: flex; + flex: none; + padding: 0.6rem 0.7rem 0.6rem 1rem; + align-items: center; + justify-content: space-between; + gap: 1rem; + border-bottom: 1px solid var(--color-border); + } + .media-viewer__title { + overflow: hidden; + color: var(--color-text-soft); + font-size: 0.82rem; + text-overflow: ellipsis; + white-space: nowrap; + } + .media-viewer__close { + flex: none; + padding: 0.25rem 0.6rem; + color: var(--color-text-soft); + background: transparent; + border: 1px solid var(--color-border-strong); + border-radius: var(--radius-sm, 6px); + font: inherit; + font-size: 0.8rem; + cursor: pointer; + } + .media-viewer__close:hover { color: var(--color-text); background: var(--color-selected); } + .media-viewer__close:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; } + + /* A screenshot is never shown smaller than it can be read; on a phone it scrolls sideways. */ + .media-viewer__stage { min-height: 0; overflow: auto; overscroll-behavior: contain; } + .media-viewer__stage img { display: block; width: 100%; min-width: 860px; height: auto; } +</style> diff --git a/src/components/SiteFooter.astro b/src/components/SiteFooter.astro index 818cd94..fd42087 100644 --- a/src/components/SiteFooter.astro +++ b/src/components/SiteFooter.astro @@ -1,4 +1,4 @@ -<footer class="site-footer" data-pagefind-ignore="all"> +<footer class="site-footer" data-markdown-ignore> <div class="site-footer__inner"> <div class="site-footer__identity"> <strong>mdbase</strong> diff --git a/src/components/SiteHeader.astro b/src/components/SiteHeader.astro index 17caa63..46cffc7 100644 --- a/src/components/SiteHeader.astro +++ b/src/components/SiteHeader.astro @@ -1,6 +1,5 @@ --- import BrandMark from "./BrandMark.astro"; -import SiteSearch from "./SiteSearch.astro"; interface Props { current?: "home" | "apps" | "downloads" | "connect" | "pricing" | "sdk" | "runtime" | "spec"; @@ -18,12 +17,11 @@ const links = [ ] as const; --- -<header class="site-header" data-pagefind-ignore="all" data-site-header> +<header class="site-header" data-markdown-ignore 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> <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> diff --git a/src/components/SiteSearch.astro b/src/components/SiteSearch.astro deleted file mode 100644 index 71c03ac..0000000 --- a/src/components/SiteSearch.astro +++ /dev/null @@ -1,176 +0,0 @@ -<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> - -<dialog class="site-search" aria-label="Search mdbase.dev" data-search-dialog> - <div class="site-search__bar"> - <strong>Search mdbase.dev</strong> - <button type="button" class="site-search__close" data-search-close>Close</button> - </div> - <div id="site-search-ui" class="site-search__ui"></div> - <p class="site-search__status" data-search-status hidden></p> -</dialog> - -<script is:inline> - (() => { - const dialog = document.querySelector("[data-search-dialog]"); - const opener = document.querySelector("[data-search-open]"); - if (!(dialog instanceof HTMLDialogElement) || !opener) return; - const status = dialog.querySelector("[data-search-status]"); - let loading; - - const load = () => { - loading ??= new Promise((resolve, reject) => { - const style = document.createElement("link"); - style.rel = "stylesheet"; - style.href = "/pagefind/pagefind-ui.css"; - document.head.append(style); - const script = document.createElement("script"); - script.src = "/pagefind/pagefind-ui.js"; - script.onload = () => { - // eslint-disable-next-line no-undef - new PagefindUI({ - element: "#site-search-ui", - showSubResults: true, - showImages: false, - resetStyles: false, - autofocus: true, - translations: { placeholder: "Search the docs, apps and specification" } - }); - resolve(); - }; - script.onerror = reject; - document.head.append(script); - }); - return loading; - }; - - const open = async () => { - if (dialog.open) return; - dialog.showModal(); - try { - await load(); - status.hidden = true; - dialog.querySelector("input")?.focus(); - } catch { - loading = undefined; - status.textContent = "Search isn’t available in this build. Run a production build to create the index."; - status.hidden = false; - } - }; - - opener.addEventListener("click", open); - dialog.querySelector("[data-search-close]")?.addEventListener("click", () => dialog.close()); - dialog.addEventListener("click", (event) => { - if (event.target === dialog) dialog.close(); - }); - document.addEventListener("keydown", (event) => { - const target = event.target; - const typing = target instanceof HTMLElement - && (target.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName)); - if ((event.key === "k" && (event.metaKey || event.ctrlKey)) || (event.key === "/" && !typing)) { - event.preventDefault(); - open(); - } - }); - })(); -</script> - -<style is:global> - .site-search__open { - display: inline-flex; - min-width: 32px; - min-height: 44px; - padding: 0; - align-items: center; - justify-content: center; - gap: 6px; - color: var(--color-text); - background: transparent; - border: 0; - font: inherit; - cursor: pointer; - } - - .site-search__open:hover { color: var(--color-text-soft); } - - @media (max-width: 35rem) { - .site-search__open span { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip-path: inset(50%); - white-space: nowrap; - } - } - - .site-search__open:focus-visible, - .site-search__close:focus-visible { - outline: 2px solid currentColor; - outline-offset: 3px; - } - - .site-search__open svg { - width: 14px; - height: 14px; - fill: none; - stroke: currentColor; - stroke-width: 1.4; - stroke-linecap: round; - } - - .site-search { - width: min(calc(100% - 32px), 44rem); - max-height: min(80vh, 46rem); - margin: 10vh auto auto; - padding: 1rem 1.25rem 1.25rem; - color: var(--color-text); - background: var(--color-canvas); - border: 1px solid var(--color-text); - border-radius: 4px; - } - - .site-search::backdrop { background: var(--color-scrim, rgb(0 0 0 / 0.35)); } - - .site-search__bar { - display: flex; - margin-bottom: 0.75rem; - align-items: baseline; - justify-content: space-between; - gap: 1rem; - } - - .site-search__bar strong { font-weight: 400; } - - .site-search__close { - padding: 0; - color: var(--color-text); - background: transparent; - border: 0; - font: inherit; - text-decoration: underline; - text-underline-offset: 0.2em; - cursor: pointer; - } - - .site-search__status { color: var(--color-text-soft); } - - .site-search .pagefind-ui { - --pagefind-ui-scale: 0.8; - --pagefind-ui-primary: var(--color-accent); - --pagefind-ui-text: var(--color-text); - --pagefind-ui-background: var(--color-canvas); - --pagefind-ui-border: var(--color-border-strong); - --pagefind-ui-tag: var(--color-surface-subtle); - --pagefind-ui-border-width: 1px; - --pagefind-ui-border-radius: 4px; - --pagefind-ui-font: var(--sans, inherit); - } - - .site-search .pagefind-ui mark { - color: inherit; - background: color-mix(in oklch, var(--color-accent) 22%, transparent); - } -</style> diff --git a/src/components/ThemeControlScript.astro b/src/components/ThemeControlScript.astro index e5b5b15..e8a7793 100644 --- a/src/components/ThemeControlScript.astro +++ b/src/components/ThemeControlScript.astro @@ -39,7 +39,7 @@ const dark = currentTheme() === "dark"; document .querySelector('meta[name="theme-color"]') - ?.setAttribute("content", dark ? "#121212" : "#ffffff"); + ?.setAttribute("content", dark ? "#11151a" : "#f6fafd"); updateControls(); dispatchEvent(new CustomEvent("mdbase:themechange")); }; diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index dee93bf..32e1c49 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -1,9 +1,14 @@ --- -import "@fontsource/atkinson-hyperlegible/400.css"; +import "@fontsource/ibm-plex-sans/400.css"; +import "@fontsource/ibm-plex-sans/400-italic.css"; +import "@fontsource/ibm-plex-sans/500.css"; +import "@fontsource/ibm-plex-sans/600.css"; import "@fontsource/azeret-mono/400.css"; import "@fontsource/azeret-mono/500.css"; import "../styles/shell.css"; import "../styles/global.css"; +import FontPreloads from "../components/FontPreloads.astro"; +import MediaViewer from "../components/MediaViewer.astro"; import SiteHeader from "../components/SiteHeader.astro"; import SiteFooter from "../components/SiteFooter.astro"; import ThemeControlScript from "../components/ThemeControlScript.astro"; @@ -13,14 +18,45 @@ interface Props { description: string; current?: "home" | "apps" | "downloads" | "connect" | "pricing" | "sdk" | "runtime" | "spec"; noIndex?: boolean; - /** Leave the page out of site search, as for an archived copy of current content. */ - searchable?: boolean; + /** Whether the page gets a Markdown copy and a place in llms.txt; off for an archived copy of current content. */ + markdownCopy?: boolean; wide?: boolean; + /** List the page's sections beside the text on wide screens, for long pages of prose. */ + contents?: boolean; } -const { title, description, current, noIndex = false, searchable = true, wide = false } = Astro.props; +const { title, description, current, noIndex = false, markdownCopy = true, wide = false, contents = false } = Astro.props; const canonical = new URL(Astro.url.pathname, Astro.site); const fullTitle = title === "mdbase" ? title : `${title} | mdbase`; + +// The section list is built from the page's own h2s, so a page opts in with one +// prop. Headings without an id are given one from their text. +let body = ""; +const sections: { id: string; label: string }[] = []; +if (contents) { + const seen = new Set<string>(); + const text = (html: string) => + html.replace(/<[^>]+>/g, "").replace(/&/g, "&").replace(/\s+/g, " ").trim(); + body = (await Astro.slots.render("default")).replace( + /<h2\b([^>]*)>([\s\S]*?)<\/h2>/g, + (heading: string, attributes: string, inner: string) => { + const label = text(inner); + let id = attributes.match(/\bid="([^"]+)"/)?.[1]; + if (id) { + seen.add(id); + sections.push({ id, label }); + return heading; + } + const base = label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "section"; + id = base; + for (let n = 2; seen.has(id); n += 1) id = `${base}-${n}`; + seen.add(id); + sections.push({ id, label }); + return `<h2 id="${id}"${attributes}>${inner}</h2>`; + } + ); +} +const showContents = sections.length > 2; --- <!doctype html> @@ -31,11 +67,12 @@ const fullTitle = title === "mdbase" ? title : `${title} | mdbase`; <title>{fullTitle} - {searchable && !noIndex && } + {markdownCopy && !noIndex && } + - + @@ -49,13 +86,24 @@ const fullTitle = title === "mdbase" ? title : `${title} | mdbase`; {noIndex && } - + -
- +
+ { + showContents && ( + + ) + } + {contents ? : }
+

diff --git a/src/markdown/doc-records.mjs b/src/markdown/doc-records.mjs index 1295d96..6b9955a 100644 --- a/src/markdown/doc-records.mjs +++ b/src/markdown/doc-records.mjs @@ -1,7 +1,8 @@ // Markdown pipeline for the documentation records in content/. // // The records stay ordinary Markdown. These plugins give three conventions -// their meaning on the site (content/_types/doc-page.md describes them): +// their meaning on the site (content/_types/doc-page.md describes them, and a +// fourth, card lists, that needs only a stylesheet rule): // - a code block's `title="…"` becomes its caption; // - `file="examples/…"` shows that file from this repository, so a listing // cannot drift from the example app CI builds, and `pick="key"` keeps one diff --git a/src/pages/account-deletion/index.astro b/src/pages/account-deletion/index.astro index 208d303..662e426 100644 --- a/src/pages/account-deletion/index.astro +++ b/src/pages/account-deletion/index.astro @@ -5,6 +5,7 @@ import BaseLayout from "../../layouts/BaseLayout.astro";

Delete a Connect account

diff --git a/src/pages/apps/index.astro b/src/pages/apps/index.astro index 9592b08..7b913a7 100644 --- a/src/pages/apps/index.astro +++ b/src/pages/apps/index.astro @@ -1,14 +1,13 @@ --- import BaseLayout from "../../layouts/BaseLayout.astro"; import AppShot from "../../components/AppShot.astro"; +import AppIcon from "../../components/AppIcon.astro"; +import BuildYourOwn from "../../components/BuildYourOwn.astro"; import "../../styles/apps.css"; type CatalogueEntry = { name: string; description: string; - status: "Public beta" | "Development build"; - runsOn: string; - collections: string; links: Array<{ label: string; href: string }>; shot?: { name: "tasknotes" | "editor" | "reader" | "writer"; alt: string }; }; @@ -16,10 +15,7 @@ type CatalogueEntry = { const applications: CatalogueEntry[] = [ { name: "TaskNotes", - description: "Task manager with lists, boards, calendars, recurrence, reminders, attachments, and time tracking.", - status: "Public beta", - runsOn: "Web, iOS, Android", - collections: "Cloud copy, or Private through one of your devices", + description: "Task manager for the web, iOS and Android, with lists, boards, calendars, recurrence, reminders, attachments, and time tracking.", links: [ { label: "Open TaskNotes", href: "https://app.tasknotes.dev/" }, { label: "Source", href: "https://github.com/callumalpass/tasknotes-app" } @@ -32,9 +28,6 @@ const applications: CatalogueEntry[] = [ { name: "mdbase Editor", description: "General collection editor for Markdown records, frontmatter, links, backlinks, and type definitions, with collection sharing and read-only access for viewers.", - status: "Public beta", - runsOn: "Web", - collections: "Cloud copy, or Private through one of your devices", links: [ { label: "Open Editor", href: "https://editor.mdbase.dev/" }, { label: "Documentation", href: "/apps/editor/" }, @@ -48,9 +41,6 @@ const applications: CatalogueEntry[] = [ { name: "mdbase Reader", description: "Read, highlight and organise PDFs, EPUBs and saved web pages, with Markdown notes and citation metadata.", - status: "Development build", - runsOn: "Web; optional Chrome extension", - collections: "Cloud copy, or Private through one of your devices", links: [ { label: "Open Reader", href: "https://reader.mdbase.dev/" }, { label: "Documentation", href: "/apps/reader/" }, @@ -64,9 +54,6 @@ const applications: CatalogueEntry[] = [ { name: "mdbase writer", description: "Write Markdown papers, theses and books with a typeset preview, citations from Reader, and PDF or Word export.", - status: "Development build", - runsOn: "Web", - collections: "Cloud copy, or Private through one of your devices", links: [ { label: "Open writer", href: "https://writer.mdbase.dev/" }, { label: "Documentation", href: "/apps/writer/" } @@ -79,9 +66,6 @@ const applications: CatalogueEntry[] = [ { name: "mdbase Journal", description: "A quiet page for writing and revisiting a journal, with each entry saved as a Markdown note in your collection.", - status: "Development build", - runsOn: "Web", - collections: "Cloud copy, or Private through one of your devices", links: [ { label: "Open Journal", href: "https://journal.mdbase.dev/" }, { label: "Source", href: "https://github.com/mdbase-dev/mdbase-journal" } @@ -90,17 +74,11 @@ const applications: CatalogueEntry[] = [ { name: "mdbase for Obsidian", description: "Obsidian plugin for collection setup, type editing, migration, and validation.", - status: "Development build", - runsOn: "Obsidian desktop and mobile", - collections: "Your Obsidian vault", links: [{ label: "Source", href: "https://github.com/callumalpass/mdbase-obsidian" }] }, { name: "mdbase MCP", description: "Remote MCP endpoint for reading and changing approved collections from compatible AI clients.", - status: "Public beta", - runsOn: "OAuth-capable MCP clients", - collections: "Cloud copy, or Private through one of your devices", links: [ { label: "Set up", href: "/apps/mcp/" }, { label: "Tool reference", href: "/apps/mcp/tools/" } @@ -126,38 +104,48 @@ const applications: CatalogueEntry[] = [
{ - applications.map((app) => ( -
- {app.shot && } -

{app.name}

-
+ applications.filter((app) => app.shot).map((app) => ( +
+
+

{app.name}

{app.description}

- {app.links.map((link) => {link.label})} + {app.links.map((link, index) => {link.label})}
-
-
Status
{app.status}
-
Runs on
{app.runsOn}
-
Collections
{app.collections}
-
+ {app.shot && }
)) }
-
- -
-
-

- Any app can work with an mdbase collection. The SDK asks for access, - reads and changes records, and follows changes. An app’s manifest - declares the contracts and operations it needs. -

- +
+ { + applications.filter((app) => !app.shot).map((app) => ( +
+

{app.name}

+

{app.description}

+
+ {app.links.map((link) => {link.label})} +
+
+ )) + }
+
+
+

Build your own

+

+ Any app can work with an mdbase collection. The TypeScript SDK asks + for access, reads and changes records, and follows changes as they + happen, so the same records can be a list, a board, a calendar or + whatever your app needs them to be. +

+
+ Build an app + SDK overview +
+
+ +
diff --git a/src/pages/beta/index.astro b/src/pages/beta/index.astro index eb6930c..863d11e 100644 --- a/src/pages/beta/index.astro +++ b/src/pages/beta/index.astro @@ -6,6 +6,7 @@ import BaseLayout from "../../layouts/BaseLayout.astro"; title="Create a Connect account" description="Create an mdbase Connect account with a verified email address, then start with a Cloud copy collection." current="connect" + contents >

Create a Connect account

diff --git a/src/pages/connect/index.astro b/src/pages/connect/index.astro index 580f980..07d0b66 100644 --- a/src/pages/connect/index.astro +++ b/src/pages/connect/index.astro @@ -1,5 +1,6 @@ --- import BaseLayout from "../../layouts/BaseLayout.astro"; +import AppShot from "../../components/AppShot.astro"; --- -
-

mdbase Connect

-

- Connect lets apps use your Markdown collections as their database. An app - doesn’t keep your data in its own storage. It asks for access to one of - your collections, then finds, creates and edits records there, and - every change is saved as a Markdown file you own. -

+
+
+

mdbase Connect

+

+ Connect lets apps use your Markdown collections as their database. An app + doesn’t keep your data in its own storage. It asks for access to one of + your collections, then finds, creates and edits records there, and + every change is saved as a Markdown file you own. +

+ +
+
-
-

How it works

-

- Say you keep your tasks in a collection. Each task is a Markdown file, - like tasks/renew-passport.md: -

-
---
+  
+
+

How it works

+

+ Say you keep your tasks in a collection. Each task is a Markdown file, + like tasks/renew-passport.md. +

+

+ Connect TaskNotes to that collection and it queries + the records of type task to build its lists. Mark this one + done and TaskNotes changes status in the file. Edit the due + date in a text editor and TaskNotes shows the new date. Any other app you + connect to the same collection sees the same records, so nothing has to + be exported from one app to another. +

+

+ Connect is the account that makes this work. It handles sign-in, the + permissions you grant, syncing between your devices, and sharing with + other people. +

+
+
---
 type: task
 title: Renew passport
 status: open
@@ -31,38 +58,32 @@ due: 2026-12-01
 ---
 
 Book a photo appointment first.
-

- Connect TaskNotes to that collection and it queries - the records of type task to build its lists. Mark this one - done and TaskNotes changes status in the file. Edit the due - date in a text editor and TaskNotes shows the new date. Any other app you - connect to the same collection sees the same records, so nothing has to - be exported from one app to another. -

-

- Connect is the account that makes this work. It handles sign-in, the - permissions you grant, syncing between your devices, and sharing with - other people. -

-
-

Apps ask first

-

- When you connect an app, you sign in to Connect, choose one collection, - and see the operations the app asks for before you approve it. You might - let a project planner find, create and edit project records while leaving - deletion blocked. -

-

- The permission is recorded with the collection, and every copy checks it: - your devices and, for Cloud copy, mdbase’s copy. You can narrow or revoke - a permission at any time. Removing an app never removes the collection, - and your other apps keep using it. -

+
+
+

Apps ask first

+

+ When you connect an app, you sign in to Connect, choose one collection, + and see the operations the app asks for before you approve it. You might + let a project planner find, create and edit project records while leaving + deletion blocked. +

+

+ The permission is recorded with the collection, and every copy checks it: + your devices and, for Cloud copy, mdbase’s copy. You can narrow or revoke + a permission at any time. Removing an app never removes the collection, + and your other apps keep using it. +

+
+
-
+
+

Cloud copy or Private

Connect keeps each collection in sync across your devices. Every device @@ -92,6 +113,11 @@ Book a photo appointment first.

The security page lists exactly what mdbase stores and can read in each case.

+ +
@@ -110,7 +136,8 @@ Book a photo appointment first.

-
+
+

Share a collection

Owners can invite people as viewers, who can read, or editors, who can @@ -135,6 +162,11 @@ Book a photo appointment first. field, and edits that change the same field are held for review. There is no live co-editing of a note.

+
+
diff --git a/src/pages/contracts/index.astro b/src/pages/contracts/index.astro index cc99469..a01dd3e 100644 --- a/src/pages/contracts/index.astro +++ b/src/pages/contracts/index.astro @@ -19,6 +19,7 @@ const advancedPacks = catalog.packs.filter((pack) => pack.installation.visibilit title="Contracts" description="Browse versioned data contracts and installable starter type packs for mdbase collections." current="sdk" + contents >

Contracts and type packs

diff --git a/src/pages/downloads/index.astro b/src/pages/downloads/index.astro index 29cf27e..f2118e0 100644 --- a/src/pages/downloads/index.astro +++ b/src/pages/downloads/index.astro @@ -1,5 +1,6 @@ --- import BaseLayout from "../../layouts/BaseLayout.astro"; +import AppShot from "../../components/AppShot.astro"; import release from "../../data/connect-release.json"; const { version, tag, releaseUrl: releasePage } = release; @@ -18,13 +19,43 @@ const releaseSize = (bytes: number) => `${Math.round(bytes / 1_000_000)} MB`; description="Download the mdbase Connect desktop app or the standalone command-line tools for macOS, Windows, and Linux." current="downloads" > -
-

Download

-

- Install the mdbase Connect desktop app to keep synced collections as - folders on your computer and let approved apps reach Private collections - through it. -

+
+
+

Download

+

+ Install the mdbase Connect desktop app to keep synced collections as + folders on your computer and let approved apps reach Private collections + through it. +

+ { + // The packages for the visitor's own system, shown by the script below. + // The full list further down has every one of them, so the Markdown copy skips these. + ["macOS", "Windows", "Linux"].map((platform) => ( + + )) + } + +
+
@@ -139,8 +170,15 @@ const releaseSize = (bytes: number) => `${Math.round(bytes / 1_000_000)} MB`; 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; + const primary = document.querySelector(`[data-primary-platform="${system}"]`); + if (primary) { + primary.hidden = false; + document.querySelector("[data-primary-fallback]")?.setAttribute("hidden", ""); + } document.querySelectorAll(`.download-option[data-platform="${system}"] .download-option__match`).forEach((note) => { note.hidden = false; + // The matching packages keep the filled button; the rest are secondary. + note.closest(".download-option")?.setAttribute("data-match", ""); }); })(); diff --git a/src/pages/index.astro b/src/pages/index.astro index e7a8ced..51c184c 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,6 +1,7 @@ --- import HomeLayout from "../layouts/HomeLayout.astro"; import AppShot from "../components/AppShot.astro"; +import AppIcon from "../components/AppIcon.astro"; --- -
+

Structured data in ordinary Markdown files

Keep notes, tasks and projects as Markdown files. mdbase syncs them between your devices and serves them to the apps you use, on any device, with the permissions you give each app.

-

mdbase is in beta. Keep independent backups of important collections.

-
+
+ +

mdbase is in beta. Keep independent backups of important collections.

@@ -41,10 +92,11 @@ the field visit.

One collection, many apps

Apps built on mdbase work on these files directly. Several can open the same collection at once, so nothing is exported from one app to another.

-
TaskNotes
Tasks, calendars and reminders, on the web, iOS and Android.
-
Editor
Any collection: records, frontmatter, links and types.
-
Reader
PDFs, EPUBs and web pages, with each highlight kept as a record.
-
Writer
Papers and books in Markdown, with citations from Reader.
+
TaskNotes
Tasks, calendars and reminders, on the web, iOS and Android.
+
Editor
Any collection: records, frontmatter, links and types.
+
Reader
PDFs, EPUBs and web pages, with each highlight kept as a record.
+
Writer
Papers and books in Markdown, with citations from Reader.
+
Build your own
Your own app on the same collections, with the TypeScript SDK.

All apps

@@ -54,6 +106,7 @@ the field visit.

With the desktop app, your computers keep a complete copy of the collection as ordinary files. Each copy works offline and catches up when it reconnects.

When the same record is edited in two places, mdbase works out what each edit changed, field by field, and combines edits to different fields.

Changes are encrypted and signed on the device that made them before they are sent.

+
@@ -67,12 +120,14 @@ the field visit.

Apps ask first

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.

You approve each app in your Connect account, and you can narrow or revoke its access at any time. Revoking it ends the app’s sessions.

+

Share a collection

Invite viewers, who can read, or editors, who can also change records. Each person uses their own apps, within the role you gave them.

You can change a member’s role or remove them at any time. A removed member stops receiving changes and keeps the files they already had.

+
diff --git a/src/pages/pricing/index.astro b/src/pages/pricing/index.astro index 05317f0..794d27f 100644 --- a/src/pages/pricing/index.astro +++ b/src/pages/pricing/index.astro @@ -7,57 +7,45 @@ import BaseLayout from "../../layouts/BaseLayout.astro"; description="mdbase Connect plans: Free, with a 30-day storage trial, and Plus for US$10 a month or US$96 a year." current="pricing" > -
-

Pricing

-

- Every Connect account starts on Free. Plus adds storage, collections and - people for US$10 a month or US$96 a year. -

-
- Sign up - Upgrade an account +
+
+

Pricing

+

+ Every Connect account starts on Free. Plus adds storage, collections and + people for US$10 a month or US$96 a year. +

+

+ Notes don’t count towards storage. Only uploaded files do, such as PDFs, + images and other attachments. +

+
+
+
+

Free

+

US$0

+

With 5 GB of storage for your first 30 days

+
    +
  • Storage for uploaded files 250 MB
  • +
  • Synced collections 1
  • +
  • People you can share each collection with 1
  • +
+ Sign up +
+
+

Plus

+

US$10 a month

+

Or US$96 a year, which is US$8 a month

+
    +
  • Storage for uploaded files 100 GB
  • +
  • Synced collections 10
  • +
  • People you can share each collection with 5
  • +
+ Upgrade an account +
-
-

Plans

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FreePlus
PriceFreeUS$10 a month, or US$96 a year
Storage for uploaded files250 MB, or 5 GB for your first 30 days100 GB
Synced collections110
People you can share each collection with15
-

- Notes don’t count towards storage. Only uploaded files do, such as PDFs, - images and other attachments. -

-
- +

Paying for Plus

@@ -108,4 +96,5 @@ import BaseLayout from "../../layouts/BaseLayout.astro"; independent backups of important collections.

+
diff --git a/src/pages/privacy/index.astro b/src/pages/privacy/index.astro index b940a1a..acfcb6d 100644 --- a/src/pages/privacy/index.astro +++ b/src/pages/privacy/index.astro @@ -5,6 +5,7 @@ import BaseLayout from "../../layouts/BaseLayout.astro";

Privacy

diff --git a/src/pages/runtime/index.astro b/src/pages/runtime/index.astro index 89d632b..0a62802 100644 --- a/src/pages/runtime/index.astro +++ b/src/pages/runtime/index.astro @@ -6,6 +6,7 @@ import BaseLayout from "../../layouts/BaseLayout.astro"; title="Runtime" description="Understand how Runtime profile 0.2 adds durable workflow execution to ordinary mdbase contracts and shared interoperability." current="runtime" + contents >

Runtime

diff --git a/src/pages/security/index.astro b/src/pages/security/index.astro index 4058db1..e59b564 100644 --- a/src/pages/security/index.astro +++ b/src/pages/security/index.astro @@ -5,6 +5,7 @@ import BaseLayout from "../../layouts/BaseLayout.astro";

Security

diff --git a/src/pages/spec/[...version].astro b/src/pages/spec/[...version].astro index bf2265c..5b982f8 100644 --- a/src/pages/spec/[...version].astro +++ b/src/pages/spec/[...version].astro @@ -13,9 +13,9 @@ const { archive } = Astro.props; const title = archive ? "Specification v0.2 archive" : "Specification v0.3"; --- - +
-