diff --git a/.claude/skills/marketing-site/SKILL.md b/.claude/skills/marketing-site/SKILL.md index e8cdb5f80..6bdb75666 100644 --- a/.claude/skills/marketing-site/SKILL.md +++ b/.claude/skills/marketing-site/SKILL.md @@ -9,10 +9,20 @@ Load `frontend-design` and follow its plan → review → build → critique pro 1. Ground it in the product: read `README.md`, the three tours (`docs/gifs/`) and the app's real tokens (`crates/ui/src/theme/tokens.rs`: palette, amber accent, density, dark base). The site should feel made by the same hands as the app, not from a template. 2. Real content only: encrypted multi-library vault, snippets with `{{fields}}`, Markdown notes, todo lists, canvas/board, quick-paste palette, HTTP/JSON/tools. Show real UI captures or live demos, not icons in cards. -3. Avoid: identical feature cards, SaaS hero with gradient and big stat, fade-up on every section, decorative blobs. One memorable element; the rest stays quiet. +3. Avoid: identical feature cards, SaaS hero with gradient and big stat, fade-up on every section, decorative blobs, a hue per section, a window redrawn where a capture would do. One memorable element; the rest stays quiet. + +## What the design rests on + +Chosen in #1655 among nine proposals; a new page is drawn from these, not from a template. + +- **A construction grid, drawn** (`src/styles/_frame.scss`): one column between two hairlines down the whole page, sections between rules with a cross where they meet, each headed by a mono row with its number and name (`01 / L'application`). Content sits in hairline cells (`.cells`), never in floating cards; a large screen is filled by the grid, not by empty bands. +- **The application itself**: a real capture at the top (`app::screens` at 2×, one per language and theme), with numbered marks and a legend that says what each part does. No animation at the top of a page. +- **A developer's day**: the home page's moments are rows, words on the left, a scene on the right that moves the application's own pieces in its own words (`src/styles/_pieces.scss`, `home/day/`). A scene is written in its end state and only plays, on screen, when script and motion allow; on a wide screen the hour stands in the right margin. +- The application's palette and its two faces, Inter and JetBrains Mono, self-hosted: no other face. + 4. It is an Angular project of its own in `website/`, outside the Cargo workspace: its own `package.json` and lockfile, `npm ci` from `website/`, and a dependency the site alone needs is still one the user approves first. It imports nothing from the application: the design tokens are a copy of `crates/ui/src/theme/tokens.rs` (`scripts/tokens.test.mjs` keeps them equal). The in-app desktop rules (egui, no router) do not apply there. A workflow publishes the build to the site's own repository; the public URL is a build input, never hard-coded, and canonical URLs, the sitemap and Open Graph tags are built from it. 5. Every route is prerendered (SSG): a client-rendered Angular page hands a crawler an empty ``. Prove it on the build output: each route's built HTML carries its text without running JavaScript. 6. SEO, per route (`seo`): its own `` and meta description, a canonical URL, an Open Graph image, a descriptive `<h1>`, real text rather than text in images, alt text on captures. `robots.txt` and `sitemap.xml` at the root. JSON-LD only for what the page shows (`SoftwareApplication` is the type that fits). `lang` on `<html>`, and `hreflang` pairs if the site ships in French and English. -7. Performance (`core-web-vitals`): the largest element above the fold, usually the hero capture, is in the initial HTML with explicit dimensions and priority (`NgOptimizedImage`: `ngSrc`, `width`, `height`, `priority`); fonts are self-hosted; nothing shifts when captures or fonts arrive. Measure before quoting a number. +7. Performance (`core-web-vitals`): the largest element above the fold, usually the hero capture, is in the initial HTML with explicit dimensions, `srcset` widths and `fetchpriority="high"`. A capture that differs by theme is a `<picture>` whose light source follows the system's theme until the site's is known: one file fetched, so no preload (it would fetch the other half's file). Fonts are self-hosted; nothing shifts when captures or fonts arrive. Measure before quoting a number. 8. Quality floor (`accessibility`): mobile to desktop, keyboard focus, reduced motion, AA contrast, 24×24 targets, no third-party trackers, download links to GitHub releases. 9. Tests assert the rendering, not the logic: Vitest + jsdom on the rendered page (heading outline, landmarks, accessible names, `alt` and dimensions, both locales holding the same keys), plus a check over the prerendered output. No HTML snapshots, and no e2e suite for the site; `webapp-testing` is only for looking at a built page in a real browser. diff --git a/docs/architecture.md b/docs/architecture.md index ee5854b5f..6acd69f9f 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -6769,17 +6769,31 @@ specs, `npm run lint` ESLint, `npm run test:scripts` the Node tests of the token home page's canonical link, checks every page (one `h1`, a title, a canonical, no local address, download links that answer, languages that name each other, structured data that parses, a social image of 1200 × 630), and writes `sitemap.xml`, with each page's languages, - `robots.txt` and `404.html`. The two social images, `public/social-{fr,en}.png`, are captures of - the home page's window under its headline, made by hand in a browser: made again when it changes. - `public/.htaccess` serves `/docs/x` from `docs/x/index.html` without a redirect on the Apache - host. -- **The home page redraws the application in HTML** rather than showing screenshots. Each - feature (`home/feature.ts`) is a section whose scene is a pure function of a step and its - progress `t` (`ScenePlayer`): it plays once well in view, rests when it leaves the - screen, and a step clicked shows that step. The scroll is never held, except by the hero - board, which stays centred while its cards are filed; a phone gets a window drawn for its - width. Code inside a scene is data (`home/code-view.ts`): the template compiler drops the - whitespace between two elements, and a formatter would reflow it. + `robots.txt` and `404.html`. The two social images, `public/social-{fr,en}.png`, show the home + page's headline over the capture of the notes list, drawn by hand in a browser: made again when + either changes. `public/.htaccess` serves `/docs/x` from `docs/x/index.html` without a redirect + on the Apache host. +- **Every page stands on one construction grid** (`styles/_frame.scss`): a column between two + hairlines down the whole page, drawn by the root (`app.ts`), sections between rules with a cross + where they meet each hairline, and above each section a mono row with its number and name. `.col` + sets text inside the column, `.cells` lays cells edge to edge against the hairlines; the line + between two cells is the hairline's colour showing through a one-pixel gap. The column grows with + the screen up to 1600 px; from 1380 px the right gutter is wide enough to hold a page's own index. +- **The home page shows the application itself**: a capture of the notes list (`public/shots/`, + `app::screens`' `notes-list` drawn at twice its size by hand, the locale set and the seed + translated for each language, in both themes, at two widths). A `<picture>` fetches one file: the + light one when the system's theme is light, until the site's own theme is known. Six numbered + marks stand on it, at each language's places (`MARKS`: English keeps the search on the toolbar's + first row), and a legend of six cells says what each part does. +- **The day** (`home/day/`): ten moments, each a row whose scene moves the application's pieces + (`styles/_pieces.scss`). A scene is written in its end state, which is what a crawler, a page + without script and reduced motion show; `SceneLoop` puts it back to its start (`anim`) and plays + it (`run`) while it is on screen, again and again, each piece at its own `--d`; what CSS cannot + move (the arrows of a dragged shape) is moved on its `replay`. The words are the application's + own (`scene-words.ts`, from `crates/i18n` and the capture's seed). The hour follows the reading + point, in the right margin from 1380 px, in a bar under the header below. Text inside a scene is + interpolated where its spaces matter: the template compiler drops the whitespace between two + elements and collapses the rest. - **The documentation is the Markdown of `docs/content/`**, one file per page and per language, under one `index.json` (the pages in reading order, their group, colour, address and name); `docs/content/README.md` says how to write a page, add one, add a language. Nothing is generated diff --git a/website/public/shots/notes-en-dark-1084.webp b/website/public/shots/notes-en-dark-1084.webp new file mode 100644 index 000000000..b7c585b9d Binary files /dev/null and b/website/public/shots/notes-en-dark-1084.webp differ diff --git a/website/public/shots/notes-en-dark-2168.webp b/website/public/shots/notes-en-dark-2168.webp new file mode 100644 index 000000000..213f4230e Binary files /dev/null and b/website/public/shots/notes-en-dark-2168.webp differ diff --git a/website/public/shots/notes-en-light-1084.webp b/website/public/shots/notes-en-light-1084.webp new file mode 100644 index 000000000..f95625269 Binary files /dev/null and b/website/public/shots/notes-en-light-1084.webp differ diff --git a/website/public/shots/notes-en-light-2168.webp b/website/public/shots/notes-en-light-2168.webp new file mode 100644 index 000000000..e51f2fff8 Binary files /dev/null and b/website/public/shots/notes-en-light-2168.webp differ diff --git a/website/public/shots/notes-fr-dark-1084.webp b/website/public/shots/notes-fr-dark-1084.webp new file mode 100644 index 000000000..46cea4c76 Binary files /dev/null and b/website/public/shots/notes-fr-dark-1084.webp differ diff --git a/website/public/shots/notes-fr-dark-2168.webp b/website/public/shots/notes-fr-dark-2168.webp new file mode 100644 index 000000000..efff0f31b Binary files /dev/null and b/website/public/shots/notes-fr-dark-2168.webp differ diff --git a/website/public/shots/notes-fr-light-1084.webp b/website/public/shots/notes-fr-light-1084.webp new file mode 100644 index 000000000..fca7c0a62 Binary files /dev/null and b/website/public/shots/notes-fr-light-1084.webp differ diff --git a/website/public/shots/notes-fr-light-2168.webp b/website/public/shots/notes-fr-light-2168.webp new file mode 100644 index 000000000..05d66a5be Binary files /dev/null and b/website/public/shots/notes-fr-light-2168.webp differ diff --git a/website/public/social-en.png b/website/public/social-en.png index e2f30b597..3b725b0c4 100644 Binary files a/website/public/social-en.png and b/website/public/social-en.png differ diff --git a/website/public/social-fr.png b/website/public/social-fr.png index 8aca592a7..cee64d04b 100644 Binary files a/website/public/social-fr.png and b/website/public/social-fr.png differ diff --git a/website/src/app/accessibility/accessibility-page.ts b/website/src/app/accessibility/accessibility-page.ts index cdbe4db5b..36b0dc3e6 100644 --- a/website/src/app/accessibility/accessibility-page.ts +++ b/website/src/app/accessibility/accessibility-page.ts @@ -10,6 +10,7 @@ const FR = { description: 'Ce que devnotes.fr vise en matière d’accessibilité, ce qui est vérifié, ce qui ne l’est pas encore, et comment signaler un problème.', heading: 'Accessibilité', + level: 'WCAG 2.2, niveau AA', lede: 'Ce site vise le niveau AA des WCAG 2.2. Voici ce qui est vérifié, ce qui ne l’est pas encore, et comment signaler un problème.', done: 'Ce qui est vérifié', checks: [ @@ -35,6 +36,7 @@ const EN: typeof FR = { description: 'What devnotes.fr aims at for accessibility, what is checked, what is not yet, and how to report a problem.', heading: 'Accessibility', + level: 'WCAG 2.2, level AA', lede: 'This site aims at WCAG 2.2, level AA. Here is what is checked, what is not yet, and how to report a problem.', done: 'What is checked', checks: [ @@ -60,41 +62,77 @@ const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; @Component({ selector: 'app-accessibility-page', template: ` - <section class="wrap statement" aria-labelledby="statement-h"> - <h1 id="statement-h">{{ text().heading }}</h1> - <p class="lede">{{ text().lede }}</p> - <h2>{{ text().done }}</h2> - <ul> - @for (check of text().checks; track $index) { - <li>{{ check }}</li> - } - </ul> - <h2>{{ text().limits }}</h2> - <ul> - @for (limit of text().missing; track $index) { - <li>{{ limit }}</li> - } - </ul> - <h2>{{ text().report }}</h2> - <p> - {{ text().reportBefore }}<a [href]="issues">{{ text().reportLink }}</a - >{{ text().reportAfter }} - </p> + <section class="sec" aria-labelledby="statement-h"> + <div class="sec-h col"> + <span><b>01</b> / {{ text().heading }}</span + ><span>{{ text().level }}</span> + </div> + <div class="head col"> + <h1 id="statement-h">{{ text().heading }}</h1> + <p class="lede">{{ text().lede }}</p> + </div> + <div class="parts cells"> + <div class="part"> + <h2>{{ text().done }}</h2> + <ul> + @for (check of text().checks; track $index) { + <li>{{ check }}</li> + } + </ul> + </div> + <div class="part"> + <h2>{{ text().limits }}</h2> + <ul> + @for (limit of text().missing; track $index) { + <li>{{ limit }}</li> + } + </ul> + </div> + </div> + <div class="report col"> + <h2>{{ text().report }}</h2> + <p> + {{ text().reportBefore }}<a [href]="issues">{{ text().reportLink }}</a + >{{ text().reportAfter }} + </p> + </div> </section> `, styles: ` - .statement { + .head { display: grid; gap: 18px; - padding-block: clamp(48px, 8vw, 96px) 0; + padding-block: clamp(44px, 5vw, 64px) clamp(32px, 4vw, 48px); } - .statement > * { + .head > *, + .report > * { max-width: 44rem; } + .parts { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 1px; + border-block: 1px solid var(--line-soft); + background: var(--line-soft) content-box; + } + + .part { + display: grid; + align-content: start; + gap: 14px; + padding: 32px var(--pad) 40px; + background: var(--bg-0); + } + + .report { + display: grid; + gap: 12px; + padding-block: 36px 56px; + } + h2 { - margin-top: 22px; font-size: 1.5rem; letter-spacing: -0.02em; } @@ -116,6 +154,12 @@ const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; color: var(--amber-text); text-underline-offset: 3px; } + + @media (max-width: 860px) { + .parts { + grid-template-columns: minmax(0, 1fr); + } + } `, changeDetection: ChangeDetectionStrategy.OnPush, }) diff --git a/website/src/app/app.spec.ts b/website/src/app/app.spec.ts index 1fc233440..430ff02b1 100644 --- a/website/src/app/app.spec.ts +++ b/website/src/app/app.spec.ts @@ -27,6 +27,6 @@ describe('App', () => { const page = await renderPage(App); const links = [...page.querySelectorAll<HTMLAnchorElement>('nav[aria-label="Principale"] a')]; - expect(links.map((link) => link.getAttribute('href'))).toEqual(['/#snippets', '/docs', '/telecharger']); + expect(links.map((link) => link.getAttribute('href'))).toEqual(['/#journee', '/docs', '/telecharger']); }); }); diff --git a/website/src/app/app.ts b/website/src/app/app.ts index 5192dc47d..d3dd84307 100644 --- a/website/src/app/app.ts +++ b/website/src/app/app.ts @@ -21,6 +21,21 @@ import { SiteHeader } from './shell/site-header'; <app-site-footer /> `, styles: ` + /* The two hairlines of the construction grid, down every page, header and footer included. */ + :host { + position: relative; + display: block; + } + + :host::before { + content: ''; + position: absolute; + inset: 0 var(--gr) 0 var(--gl); + z-index: 1; + border-inline: 1px solid var(--line-soft); + pointer-events: none; + } + .skip-link { position: absolute; left: 16px; diff --git a/website/src/app/core/page-progress.ts b/website/src/app/core/page-progress.ts deleted file mode 100644 index 6818be0b4..000000000 --- a/website/src/app/core/page-progress.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Injectable, signal } from '@angular/core'; - -/** A folder's colour, as the tokens name its RGB triplet (`--green-rgb`). */ -export type Tone = 'green' | 'blue' | 'purple' | 'teal' | 'olive' | 'pink' | 'grey' | 'amber'; - -export interface ProgressSegment { - readonly anchor: string; - readonly name: string; - readonly tone: Tone; -} - -export interface ProgressReading { - /** Each segment's length, as long as its section. */ - readonly weights: readonly number[]; - /** How much of each section has been read, 0…1. */ - readonly fills: readonly number[]; - /** The section the middle of the screen is in, or -1 above the first. */ - readonly current: number; -} - -const AT_REST: ProgressReading = { weights: [], fills: [], current: -1 }; - -const same = (a: ProgressReading, b: ProgressReading) => - a.current === b.current && - a.weights.length === b.weights.length && - a.weights.every((weight, i) => weight === b.weights[i] && a.fills[i] === b.fills[i]); - -/** - * The line under the header and the name beside the logo: what a long page has shown of - * itself. A page declares its sections and reports its scroll; the header draws them. - */ -@Injectable({ providedIn: 'root' }) -export class PageProgress { - private readonly _segments = signal<readonly ProgressSegment[]>([]); - private readonly _reading = signal<ProgressReading>(AT_REST, { equal: same }); - readonly segments = this._segments.asReadonly(); - readonly reading = this._reading.asReadonly(); - - show(segments: readonly ProgressSegment[]): void { - this._segments.set(segments); - this._reading.set({ weights: segments.map(() => 1), fills: segments.map(() => 0), current: -1 }); - } - - report(reading: ProgressReading): void { - this._reading.set(reading); - } - - clear(): void { - this._segments.set([]); - this._reading.set(AT_REST); - } -} diff --git a/website/src/app/core/seo.ts b/website/src/app/core/seo.ts index 7d3c59e1f..70a4edb19 100644 --- a/website/src/app/core/seo.ts +++ b/website/src/app/core/seo.ts @@ -19,10 +19,16 @@ export interface PageMeta { const SITE_NAME = 'DevNotes'; -/** The image of a shared link: the home page's window under its headline, one per language. */ +/** The image of a shared link: the home page's headline over the application's capture, one per language. */ const SOCIAL: Readonly<Record<Lang, { readonly file: string; readonly alt: string }>> = { - fr: { file: '/social-fr.png', alt: 'La fenêtre de DevNotes : un espace et ses dossiers, en tableau.' }, - en: { file: '/social-en.png', alt: 'The DevNotes window: a space and its folders, on a board.' }, + fr: { + file: '/social-fr.png', + alt: 'DevNotes : « Vos snippets, vos notes, vos requêtes. », au-dessus de la liste des notes de l’application.', + }, + en: { + file: '/social-en.png', + alt: 'DevNotes: “Your snippets, your notes, your requests.”, above the application’s list of notes.', + }, }; /** diff --git a/website/src/app/docs/doc-index.ts b/website/src/app/docs/doc-index.ts index a27a93196..5e254f44d 100644 --- a/website/src/app/docs/doc-index.ts +++ b/website/src/app/docs/doc-index.ts @@ -1,9 +1,11 @@ import index from '../../../../docs/content/index.json'; import { Lang } from '../core/lang'; -import { Tone } from '../core/page-progress'; type PerLang = Readonly<Record<Lang, string>>; +/** A page's colour in the sidebar, as the tokens name its RGB triplet (`--green-rgb`). */ +export type Tone = 'green' | 'blue' | 'purple' | 'teal' | 'olive' | 'pink' | 'grey' | 'amber'; + /** `docs/content/index.json`, as it is written there. */ interface DocsIndex { /** The version the pages were last checked against, by hand, in the application itself. */ diff --git a/website/src/app/docs/docs-page.html b/website/src/app/docs/docs-page.html index 6c669f69d..620e200dd 100644 --- a/website/src/app/docs/docs-page.html +++ b/website/src/app/docs/docs-page.html @@ -1,5 +1,5 @@ @let current = page(); -<div class="wrap docs"> +<div class="docs cells"> <div class="side"> <div class="find" role="search"> <label class="visually-hidden" for="docs-search">{{ text().search }}</label> diff --git a/website/src/app/docs/docs-page.scss b/website/src/app/docs/docs-page.scss index 45f4385eb..44e319f99 100644 --- a/website/src/app/docs/docs-page.scss +++ b/website/src/app/docs/docs-page.scss @@ -1,21 +1,18 @@ // The sidebar is drawn as the application's rail of spaces; the page, as a note opened beside it. -// Three columns kept together and centred: on a large screen the page grows wider and its text -// larger, rather than drifting apart. +// Three cells of the grid, the page between two hairlines: on a large screen it grows wider and its +// text larger, rather than drifting apart. .docs { display: grid; - grid-template-columns: minmax(220px, 264px) minmax(0, 62rem) minmax(180px, 220px); - justify-content: center; - gap: clamp(28px, 3.5vw, 64px); - max-width: clamp(86rem, 92vw, 120rem); - padding-top: clamp(28px, 4vw, 48px); + grid-template-columns: minmax(220px, 264px) minmax(0, 1fr) minmax(180px, 220px); } .side, .toc { position: sticky; - top: calc(var(--head-h) + 24px); + top: var(--head-h); + padding: 28px clamp(14px, 1.4vw, 22px); align-self: start; - max-height: calc(100vh - var(--head-h) - 48px); + max-height: calc(100vh - var(--head-h)); overflow-y: auto; } @@ -151,6 +148,8 @@ .article { min-width: 0; + padding: clamp(28px, 4vw, 48px) clamp(20px, 3.4vw, 56px) 72px; + border-inline: 1px solid var(--line-soft); font-size: clamp(16px, 0.3vw + 11px, 18px); display: grid; gap: 22px; @@ -263,7 +262,10 @@ @media (max-width: 1200px) { .docs { grid-template-columns: 220px minmax(0, 1fr); - justify-content: stretch; + } + + .article { + border-right: 0; } .toc { @@ -274,13 +276,18 @@ @media (max-width: 860px) { .docs { grid-template-columns: minmax(0, 1fr); - gap: 20px; } .side { position: static; max-height: none; overflow: visible; + padding-block: 20px; + border-bottom: 1px solid var(--line-soft); + } + + .article { + border-left: 0; } .side-toggle { diff --git a/website/src/app/download/download-page.html b/website/src/app/download/download-page.html index a4ae9e49f..5e7373070 100644 --- a/website/src/app/download/download-page.html +++ b/website/src/app/download/download-page.html @@ -1,58 +1,67 @@ -<section class="wrap head" aria-labelledby="download-h" style="--c: var(--amber-rgb)"> - <span class="zone-title"><span class="sw"></span>{{ text().label }}</span> - <h1 id="download-h">{{ text().heading }}</h1> - <p class="lede">{{ text().lede }}</p> - @if (onPhone()) { - <p class="phone">{{ text().phone }}</p> - } -</section> - -<section class="wrap systems" [attr.aria-label]="text().systems"> - @for (offer of offers(); track offer.system) { - <article - class="window system" - [class.yours]="yours() === offer.system" - [attr.aria-labelledby]="'system-' + offer.system" +<section class="sec" aria-labelledby="download-h"> + <div class="sec-h col"> + <span><b>01</b> / {{ text().label }}</span><span>Version {{ version }}</span> + </div> + <div class="head col"> + <h1 id="download-h">{{ text().heading }}</h1> + <p class="lede">{{ text().lede }}</p> + @if (onPhone()) { + <p class="phone">{{ text().phone }}</p> + } + </div> + <div + class="systems cells" + role="group" + [attr.aria-label]="text().systems" + [style.--count]="offers().length" > - <header class="win-head"> - <h2 class="win-title" [id]="'system-' + offer.system">{{ offer.label }}</h2> - @if (yours() === offer.system) { - <span class="mine">{{ text().yours }}</span> - } - <span class="arch">{{ text().arch }}</span> - </header> - <div class="body"> - <a class="btn btn-primary" [href]="offer.primary.url">{{ offer.action }}</a> - <p class="file"> - <code>{{ offer.primary.file }}</code> - @if (offer.primary.size) { - <span class="size">{{ offer.primary.size }}</span> + @for (offer of offers(); track offer.system) { + <article + class="system" + [class.yours]="yours() === offer.system" + [attr.aria-labelledby]="'system-' + offer.system" + > + <header class="system-head"> + <h2 [id]="'system-' + offer.system">{{ offer.label }}</h2> + @if (yours() === offer.system) { + <span class="mine">{{ text().yours }}</span> } - </p> - <p class="who">{{ offer.primary.who }}</p> - <p class="heads-up">{{ headsUp(offer.system) }}</p> - <h3>{{ text().others }}</h3> - <ul class="others"> - @for (other of offer.others; track other.file) { - <li> - <a [href]="other.url">{{ other.name }}</a> - <code>{{ other.file }}</code> - <span>{{ other.who }}</span> - </li> - } - </ul> - </div> - </article> - } + <span class="arch">{{ text().arch }}</span> + </header> + <div class="body"> + <a class="btn btn-primary" [href]="offer.primary.url">{{ offer.action }}</a> + <p class="file"> + <code>{{ offer.primary.file }}</code> + @if (offer.primary.size) { + <span class="size">{{ offer.primary.size }}</span> + } + </p> + <p class="who">{{ offer.primary.who }}</p> + <p class="heads-up">{{ headsUp(offer.system) }}</p> + <h3>{{ text().others }}</h3> + <ul class="others"> + @for (other of offer.others; track other.file) { + <li> + <a [href]="other.url">{{ other.name }}</a> + <code>{{ other.file }}</code> + <span>{{ other.who }}</span> + </li> + } + </ul> + </div> + </article> + } + </div> + <div class="beside col"> + <a class="notes" [href]="releasePage">{{ text().notes }}</a> + </div> </section> -<div class="wrap beside"> - <a class="notes" [href]="releasePage">{{ text().notes }}</a> -</div> - -<section class="wrap install" aria-labelledby="install-h"> - <h2 id="install-h">{{ text().install }}</h2> - <div class="columns"> +<section class="sec" aria-labelledby="install-h"> + <div class="sec-h col"> + <h2 id="install-h"><b>02</b> / {{ text().install }}</h2> + </div> + <div class="columns cells" [style.--count]="hasMacos ? 3 : 2"> <div class="column"> <h3>{{ text().onWindows }}</h3> <p>{{ text().windows }}</p> @@ -71,42 +80,49 @@ <h3>{{ text().onLinux }}</h3> </div> </section> -<section class="wrap verify" aria-labelledby="verify-h"> - <h2 id="verify-h">{{ text().verify }}</h2> - <p class="verify-lede">{{ text().verifyLede }} <a [href]="checksums">SHA256SUMS.txt</a>.</p> - <div class="sums"> - <table> - <caption class="visually-hidden"> - {{ text().verify }} - </caption> - <thead> - <tr> - <th scope="col">{{ text().file }}</th> - <th scope="col">{{ text().size }}</th> - <th scope="col">SHA-256</th> - </tr> - </thead> - <tbody> - @for (file of files(); track file.file) { - <tr> - <th scope="row"> - <code>{{ file.file }}</code> - </th> - <td>{{ file.size }}</td> - <td> - <code class="hash">{{ file.sha256 }}</code> - </td> - </tr> - } - </tbody> - </table> +<section class="sec" aria-labelledby="verify-h"> + <div class="sec-h col"> + <h2 id="verify-h"><b>03</b> / {{ text().verify }}</h2> + <span>SHA-256</span> + </div> + <div class="verify col"> + <p class="verify-lede">{{ text().verifyLede }} <a [href]="checksums">SHA256SUMS.txt</a>.</p> + <div class="sums"> + <table> + <caption class="visually-hidden"> + {{ text().verify }} + </caption> + <thead> + <tr> + <th scope="col">{{ text().file }}</th> + <th scope="col">{{ text().size }}</th> + <th scope="col">SHA-256</th> + </tr> + </thead> + <tbody> + @for (file of files(); track file.file) { + <tr> + <th scope="row"> + <code>{{ file.file }}</code> + </th> + <td>{{ file.size }}</td> + <td> + <code class="hash">{{ file.sha256 }}</code> + </td> + </tr> + } + </tbody> + </table> + </div> + <app-doc-blocks [blocks]="check()" /> </div> - <app-doc-blocks [blocks]="check()" /> </section> -<section class="wrap after" aria-labelledby="after-h"> - <h2 id="after-h">{{ text().after }}</h2> - <ul class="facts"> +<section class="sec" aria-labelledby="after-h"> + <div class="sec-h col"> + <h2 id="after-h"><b>04</b> / {{ text().after }}</h2> + </div> + <ul class="facts cells"> <li> <h3>{{ text().updates }}</h3> <p>{{ text().updatesText }}</p> diff --git a/website/src/app/download/download-page.scss b/website/src/app/download/download-page.scss index 7b1e996b4..81068b6df 100644 --- a/website/src/app/download/download-page.scss +++ b/website/src/app/download/download-page.scss @@ -1,39 +1,45 @@ .head { display: grid; gap: 18px; - padding-top: clamp(40px, 6vw, 80px); + padding-block: clamp(44px, 5vw, 64px) clamp(36px, 4vw, 56px); } .phone { color: var(--amber-text); } -// One window per system; the visitor's put first and outlined, once the browser has said which. +// One cell a system, side by side; the visitor's put first and marked, once the browser has said which. .systems { display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: clamp(16px, 2vw, 28px); - margin-top: clamp(32px, 4vw, 56px); + grid-template-columns: repeat(var(--count, 2), minmax(0, 1fr)); + gap: 1px; + border-top: 1px solid var(--line-soft); + border-bottom: 1px solid var(--line-soft); + background: var(--line-soft) content-box; } .system { display: grid; grid-template-rows: auto 1fr; - box-shadow: var(--shadow-soft); + background: var(--bg-0); } .system.yours { order: -1; - border-color: var(--amber-edge); } -.system .win-head { +.system-head { + display: flex; + align-items: center; + gap: 10px; min-height: 58px; - padding: 0 20px; + padding: 0 var(--pad); + border-bottom: 1px solid var(--line-soft); } .system h2 { font-size: 1.25rem; + letter-spacing: -0.015em; } .mine { @@ -56,7 +62,7 @@ gap: 10px; align-content: start; justify-items: start; - padding: 22px 20px 24px; + padding: 24px var(--pad) 28px; } .body .btn { @@ -137,11 +143,7 @@ } .beside { - display: flex; - flex-wrap: wrap; - gap: 8px 32px; - align-items: baseline; - margin-top: 20px; + padding-block: 18px 40px; } .notes { @@ -150,30 +152,28 @@ text-underline-offset: 3px; } -.mac { - color: var(--text-2); - font-size: 14.5px; -} - -.install, -.verify, -.after { +.verify { display: grid; gap: 24px; - padding-top: clamp(72px, 9vw, 120px); + padding-block: 36px 48px; } -.columns { +.columns, +.facts { display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: clamp(24px, 4vw, 64px); - align-items: start; + grid-template-columns: repeat(var(--count, 2), minmax(0, 1fr)); + gap: 1px; + background: var(--line-soft) content-box; } -.column { +.column, +.facts li { display: grid; + align-content: start; gap: 14px; min-width: 0; + padding: 32px var(--pad) 40px; + background: var(--bg-0); } .column p, @@ -240,19 +240,6 @@ user-select: all; } -.facts { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: clamp(20px, 3vw, 40px) clamp(24px, 4vw, 64px); -} - -.facts li { - display: grid; - gap: 10px; - align-content: start; - min-width: 0; -} - .facts a, .column a { color: var(--amber-text); diff --git a/website/src/app/home/board-words.ts b/website/src/app/home/board-words.ts deleted file mode 100644 index b9011ff5f..000000000 --- a/website/src/app/home/board-words.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { Lang } from '../core/lang'; - -/** The words of a board as the application writes them, in each of its languages. */ -const FR = { - file: 'Fichier', - about: 'À propos', - notes: 'Notes', - tools: 'Outils', - spaces: 'Espaces', - allSpaces: 'Tous les espaces', - personal: 'Personnel', - platform: 'Plateforme', - project: 'Projet perso', - client: 'Client Atlas', - trash: 'Corbeille', - deploy: 'Déploiement', - db: 'Base de données', - front: 'Frontend', - list: 'Liste', - board: 'Tableau', - search: 'Rechercher…', - all: 'Tout', - pinned: 'Épinglées', - untriaged: 'À trier', - newNote: '+ Nouvelle note', - toFile: (count: number) => (count === 1 ? '1 note à ranger' : `${count} notes à ranger`), - now: "à l'instant", - monday: 'lundi', - today: "Aujourd'hui", - week: 'Cette semaine', - pasteOrCreate: 'Coller ou créer', - release: 'Liste de mise en production', - releaseItems: ['Timeout CI à 30 min', 'Dry run de la release'], - postgres: 'Postgres en local', - slow: 'Quelles requêtes sont lentes', - diesel: 'Transaction Diesel annulée sur erreur', - debounce: 'Debounce sans bibliothèque', - store: 'Un store à signaux, en bref', - ssh: 'SSH vers un hôte', - cargo: 'Cache du registre cargo en CI', - tunnel: 'Tunnel vers la base de staging', - focus: 'Un focus ring que le thème déplace', - undo: 'Annuler le dernier commit', - window: - "La fenêtre de DevNotes : l'espace Plateforme affiché en tableau, ses dossiers Déploiement, Base de données et Frontend, et des notes restées en bas que le curseur glisse une à une dans leur dossier.", - phone: - "DevNotes : le dossier Base de données de l'espace Plateforme, et une note restée en bas que le curseur glisse dedans.", -}; - -const EN: typeof FR = { - file: 'File', - about: 'About', - notes: 'Notes', - tools: 'Tools', - spaces: 'Spaces', - allSpaces: 'All spaces', - personal: 'Personal', - platform: 'Platform', - project: 'Side project', - client: 'Client Atlas', - trash: 'Trash', - deploy: 'Deployment', - db: 'Database', - front: 'Frontend', - list: 'List', - board: 'Board', - search: 'Search…', - all: 'All', - pinned: 'Pinned', - untriaged: 'Untriaged', - newNote: '+ New note', - toFile: (count: number) => (count === 1 ? '1 note to file' : `${count} notes to file`), - now: 'just now', - monday: 'Monday', - today: 'Today', - week: 'This week', - pasteOrCreate: 'Paste or create', - release: 'Release checklist', - releaseItems: ['CI timeout at 30 min', 'Release dry run'], - postgres: 'Postgres on localhost', - slow: 'Which queries are slow', - diesel: 'Diesel transaction rolled back on error', - debounce: 'Debounce without a library', - store: 'A signal store, in short', - ssh: 'SSH to a host', - cargo: 'Cargo registry cache in CI', - tunnel: 'Tunnel to the staging database', - focus: 'A focus ring the theme moves', - undo: 'Undo the last commit', - window: - 'The DevNotes window: the Platform space shown as a board, its Deployment, Database and Frontend folders, and notes left at the bottom that the cursor drags one by one into their folder.', - phone: - 'DevNotes: the Database folder of the Platform space, and a note left at the bottom that the cursor drags into it.', -}; - -export type BoardWords = typeof FR; - -export const BOARD_WORDS: Readonly<Record<Lang, BoardWords>> = { fr: FR, en: EN }; diff --git a/website/src/app/home/code-view.ts b/website/src/app/home/code-view.ts deleted file mode 100644 index fdac45b17..000000000 --- a/website/src/app/home/code-view.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { ChangeDetectionStrategy, Component, input } from '@angular/core'; - -/** A run of plain text, or a highlighted one: `['k', 'const']` is a keyword. */ -export type Token = string | readonly [kind: 'k' | 's' | 'n' | 'f' | 'c' | 'fld', text: string]; - -export type Line = readonly Token[]; - -/** - * Numbered code, as the editor draws it. The lines are data rather than markup: their - * spaces are text, which the template compiler would collapse and a formatter reflow. - * Every token is an element of its own, so no whitespace node is left between two. - */ -@Component({ - selector: 'app-code', - host: { class: 'code' }, - template: ` - @for (line of lines(); track $index; let i = $index) { - <span class="ln" [class.lit]="lit().includes(i)" [class.mk]="marked()" [class.off]="i >= shown()">{{ - i + 1 - }}</span> - <span class="cl" [class.lit]="lit().includes(i)" [class.mk]="marked()" [class.off]="i >= shown()"> - @for (token of line; track $index) { - <span [class]="kind(token)">{{ text(token) }}</span> - } - </span> - } - `, - styles: ` - .ln, - .cl { - transition: background-color var(--motion); - } - - .lit { - background: rgba(var(--blue-rgb), 0.13); - } - - .mk { - background: rgba(var(--amber-rgb), 0.08); - } - - /* The bar in the margin, once per line rather than once per cell. */ - .ln.lit { - box-shadow: inset 2px 0 var(--blue); - } - - .ln.mk { - box-shadow: inset 3px 0 var(--amber-edge); - } - - .off { - visibility: hidden; - } - `, - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class CodeView { - readonly lines = input.required<readonly Line[]>(); - /** The lines that belong to what is selected elsewhere. */ - readonly lit = input<readonly number[]>([]); - /** Every line marked as just changed. */ - readonly marked = input(false); - /** How many lines are drawn so far; the rest keep their room. */ - readonly shown = input(Number.POSITIVE_INFINITY); - - protected kind(token: Token): string { - return typeof token === 'string' ? '' : token[0]; - } - - protected text(token: Token): string { - return typeof token === 'string' ? token : token[1]; - } -} diff --git a/website/src/app/home/day/day-scene.html b/website/src/app/home/day/day-scene.html new file mode 100644 index 000000000..41526ed3d --- /dev/null +++ b/website/src/app/home/day/day-scene.html @@ -0,0 +1,373 @@ +@let w = words(); @switch (scene()) { @case ('list') { +<div class="duo"> + <article class="piece" style="width: min(100%, 420px)"> + <header class="piece-h"> + <span class="kind k-list"><app-kind-icon name="list" /></span> + <b>{{ w.list.title }}</b><span class="tag-r">{{ w.list.priority }}</span> + </header> + <div class="piece-b"> + <div class="bar"><i style="--to: 33.3%; --d: 3s"></i></div> + <div class="item in" style="--d: 0.2s"> + <i class="tick done" style="--d: 3s"></i + ><span class="strike" style="--d: 3s" + ><span class="rv" style="--d: 0.3s; --t: 0.6s">{{ w.list.items[0] }}</span></span + > + </div> + <div class="item in" style="--d: 1s"> + <i class="tick"></i><span class="rv" style="--d: 1.1s; --t: 0.6s">{{ w.list.items[1] }}</span> + </div> + <div class="item in" style="--d: 1.8s"> + <i class="tick"></i><span class="rv" style="--d: 1.9s; --t: 0.6s">{{ w.list.items[2] }}</span> + </div> + </div> + </article> + <article class="piece mini pop" style="--d: 3.7s"> + <header class="piece-h"> + <span class="kind k-list"><app-kind-icon name="list" /></span><b>{{ w.list.title }}</b> + </header> + <div class="piece-b"> + <div class="bar"><i style="--to: 33.3%; --d: 4.1s"></i></div> + <div class="item"> + <i class="tick done" style="--d: 4.1s"></i + ><span class="strike" style="--d: 4.1s">{{ w.list.items[0] }}</span> + </div> + <div class="item"><i class="tick"></i><span>{{ w.list.items[1] }}</span></div> + </div> + <footer><span>{{ w.list.space }}</span><span>1/3</span></footer> + </article> +</div> +} @case ('snippet') { +<div class="stack" style="width: min(100%, 540px)"> + <div class="piece pal win" style="--d: 0s; --len: 3.3s"> + <div class="pal-in"> + <span class="ty mono" style="--d: 0.35s; --t: 0.6s">{{ w.snippet.query }}</span><i class="caret"></i> + </div> + <p class="label">{{ w.snippet.group }}</p> + <div class="found in" style="--d: 1.1s"> + <span class="kind k-snip"><app-kind-icon name="snip" /></span> + <span class="name">{{ w.snippet.title }}<em>{{ w.snippet.fields }}</em></span> + <kbd class="press" style="--d: 2.4s">↵</kbd> + <span class="mono" + >kubectl rollout restart deployment/{{ field('service') }} -n {{ field('namespace') }}</span + > + </div> + <div class="pal-keys"> + <span><kbd>↑</kbd><kbd>↓</kbd>{{ w.snippet.keys[0] }}</span> + <span><kbd>↵</kbd>{{ w.snippet.keys[1] }}</span> + <span><kbd>Ctrl</kbd><kbd>C</kbd>{{ w.snippet.keys[2] }}</span> + <span><kbd>Esc</kbd>{{ w.snippet.keys[3] }}</span> + </div> + </div> + <div class="piece fields win" style="--d: 3.3s; --len: 3.5s"> + <h4>{{ w.snippet.form }}</h4> + <p>{{ w.snippet.hint }}</p> + <div class="field"> + <code>{{ field('service') }}</code + ><span class="value mono" + ><span class="ty" style="--d: 3.8s; --t: 0.6s">{{ w.snippet.service }}</span></span + > + </div> + <div class="field"> + <code>{{ field('namespace') }}</code + ><span class="value mono" + ><span class="ty" style="--d: 4.6s; --t: 0.4s">{{ w.snippet.namespace }}</span></span + > + </div> + <div class="buttons"> + <span>{{ w.snippet.cancel }}</span + ><span class="btn-a press" style="--d: 5.7s">{{ w.snippet.copy }}</span> + </div> + </div> + <div class="term in" style="--d: 6.9s"> + <p class="label">Terminal</p> + <span class="prompt">$</span>{{ terminal() }}<i class="caret"></i> + <span class="toast pop" style="--d: 7s"><app-kind-icon name="check" />{{ w.copied }}</span> + </div> +</div> +} @case ('drawing') { +<article class="piece" style="width: min(100%, 680px)"> + <header class="piece-h"> + <span class="kind k-draw"><app-kind-icon name="draw" /></span><b>{{ w.drawing.title }}</b> + </header> + <svg class="drawing" viewBox="0 0 660 300"> + <defs> + <marker + id="piece-head" + class="head" + viewBox="0 0 10 10" + refX="8" + refY="5" + markerWidth="7" + markerHeight="7" + orient="auto" + > + <path d="M0 0 10 5 0 10z" /> + </marker> + </defs> + <g class="shape s0 pop" style="--d: 0.2s"> + <rect x="20" y="125" width="110" height="46" rx="6" /> + <text x="75" y="153">{{ w.drawing.browser }}</text> + </g> + <g class="shape s1 pop" style="--d: 0.4s"> + <rect x="180" y="118" width="120" height="60" rx="6" /> + <text x="240" y="144">{{ w.drawing.balancer[0] }}</text> + <text x="240" y="162">{{ w.drawing.balancer[1] }}</text> + </g> + <g class="shape s2 pop" style="--d: 0.6s"> + <rect x="360" y="50" width="120" height="46" rx="6" /> + <text x="420" y="78">{{ w.drawing.api[0] }}</text> + </g> + <g class="shape s2 pop" style="--d: 0.7s"> + <rect x="360" y="200" width="120" height="46" rx="6" /> + <text x="420" y="228">{{ w.drawing.api[1] }}</text> + </g> + <g class="dragged"> + <g class="shape s3 pop" style="--d: 0.9s"> + <ellipse cx="570" cy="148" rx="56" ry="28" /> + <text x="570" y="153">Postgres</text> + </g> + </g> + <path class="arrow" pathLength="1" style="--d: 1.3s" d="M130 148 L174 148" /> + <path class="arrow" pathLength="1" style="--d: 1.45s" d="M300 140 L354 80" /> + <path class="arrow" pathLength="1" style="--d: 1.55s" d="M300 156 L354 216" /> + <path class="arrow held-1" pathLength="1" style="--d: 1.75s" d="M480 73 L522 132" /> + <path class="arrow held-2" pathLength="1" style="--d: 1.85s" d="M480 223 L522 164" /> + <text class="note in" x="240" y="204" style="--d: 2.3s">{{ w.drawing.note }}</text> + <g class="cursor"><path d="M0 0 L0 17 L4.6 12.6 L7.6 19.4 L10.4 18.2 L7.4 11.6 L13 11.6 Z" /></g> + </svg> + <div class="piece-f"> + <span class="export pop" style="--d: 5s">{{ w.drawing.exports[0] }}</span> + <span class="export pop" style="--d: 5.15s">{{ w.drawing.exports[1] }}</span> + </div> +</article> +} @case ('request') { +<article class="piece" style="width: min(100%, 660px)"> + <header class="piece-h"> + <span class="kind k-http"><app-kind-icon name="http" /></span><b>{{ w.request.title }}</b + ><span class="env"><i></i>{{ w.request.env }}</span> + </header> + <div class="piece-b"> + <div class="url"> + <span class="verb">GET</span + ><span class="address" + ><span class="ph" style="--d: 2.2s">{{ field('baseUrl') }}</span + ><span class="ty" style="--d: 2.45s; --t: 0.7s">{{ w.request.host }}</span>{{ w.request.path }}</span + ><span class="btn-a press" style="--d: 3.7s">{{ w.request.send }}</span> + </div> + <div class="chain"> + <b>baseUrl</b> + @for (link of w.request.links; track link; let i = $index) { + <span class="link miss" [style.--d]="0.4 + i * 0.35 + 's'">{{ link }}</span> + } + <span class="link hit" style="--d: 1.5s">{{ w.request.found }}</span> + </div> + <div class="answer"> + <div class="stack"> + <span class="sending win" style="--d: 3.85s; --len: 0.7s">{{ w.request.sending }}</span> + <span class="status in" style="--d: 4.5s" + ><b>200 OK</b><span>84 ms</span><span>{{ w.request.size }}</span></span + > + </div> + <div class="body mono in" style="--d: 4.8s">[]</div> + </div> + </div> +</article> +} @case ('jwt') { +<article class="piece" style="width: min(100%, 660px)"> + <header class="piece-h"> + <span class="kind k-tool"><app-kind-icon name="tool" /></span><span class="dim">{{ w.jwt.tools }}</span + ><b>JWT</b> + </header> + <div class="piece-b"> + <p class="label">{{ w.jwt.input }}</p> + <div class="token rv" style="--d: 0.2s; --t: 0.9s"> + <span class="t1">eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9</span>.<span class="t2">{{ w.jwt.load }}</span + >.<span class="t3">Qm9xJ3n7t1aVYkq8vS0dW2cH5rLx4uEoZpN6fGyTbM</span> + </div> + <div class="parts"> + <div class="part head in" style="--d: 1.3s"> + <p class="label">{{ w.jwt.header }}</p> + <div class="mono">{{ header }}</div> + </div> + <div class="part load in" style="--d: 1.6s"> + <p class="label">{{ w.jwt.payload }}</p> + <div class="mono">{{ claims() }}</div> + </div> + </div> + <div class="dates"> + <span class="in" style="--d: 2.3s">{{ w.jwt.issued }}</span + ><span class="mono in" style="--d: 2.3s">2026-11-26T11:18:00Z</span> + <span class="in" style="--d: 2.5s">{{ w.jwt.expires }}</span + ><span class="mono in" style="--d: 2.5s">2026-11-26T12:18:00Z</span> + </div> + <span class="state pop" style="--d: 3.1s">{{ w.jwt.state }}</span> + </div> +</article> +} @case ('diff') { +<article class="piece" style="width: min(100%, 720px)"> + <header class="piece-h"> + <span class="kind k-tool"><app-kind-icon name="tool" /></span><span class="dim">{{ w.jwt.tools }}</span + ><b>Diff</b> + <span class="counts" + ><span class="plus pop" style="--d: 3s">{{ w.diff.plus }}</span + ><span class="minus pop" style="--d: 3.1s">{{ w.diff.minus }}</span></span + > + </header> + <div class="sides"> + <div class="was"> + <p class="side-h">{{ w.diff.was }}</p> + <div class="line"><u>1</u><s>{{ open }}</s></div> + <div class="line ch" style="--d: 0.8s"> + <u>2</u><s>{{ indent }}listen <em style="--d: 2.2s">80</em>;</s> + </div> + <div class="line ch" style="--d: 1.1s"><u>3</u><s>{{ indent }}server_name devnotes.fr;</s></div> + <div class="line"><u>4</u><s>{{ indent }}root /var/www/devnotes;</s></div> + <div class="line ch" style="--d: 1.4s"> + <u>5</u><s>{{ indent }}gzip <em style="--d: 2.4s">off</em>;</s> + </div> + <div class="line gap" style="--d: 1.7s"><u></u><s> </s></div> + <div class="line"><u>6</u><s>{{ close }}</s></div> + </div> + <div class="now"> + <p class="side-h">{{ w.diff.now }}</p> + <div class="line"><u>1</u><s>{{ open }}</s></div> + <div class="line ch" style="--d: 0.8s"> + <u>2</u><s>{{ indent }}listen <em style="--d: 2.2s">443 ssl</em>;</s> + </div> + <div class="line ch" style="--d: 1.1s"> + <u>3</u><s>{{ indent }}server_name devnotes.fr<em style="--d: 2.3s"> www.devnotes.fr</em>;</s> + </div> + <div class="line"><u>4</u><s>{{ indent }}root /var/www/devnotes;</s></div> + <div class="line ch" style="--d: 1.4s"> + <u>5</u><s>{{ indent }}gzip <em style="--d: 2.4s">on</em>;</s> + </div> + <div class="line add" style="--d: 1.7s"> + <u>6</u><s>{{ indent }}ssl_certificate /etc/ssl/devnotes.pem;</s> + </div> + <div class="line"><u>7</u><s>{{ close }}</s></div> + </div> + </div> +</article> +} @case ('search') { +<div class="piece" style="width: min(100%, 580px)"> + <div class="find"> + <app-kind-icon name="search" /><span class="rv" style="--d: 0.3s; --t: 0.8s">{{ w.search.query }}</span + ><span class="count pop" style="--d: 1.7s">{{ w.search.count }}</span> + </div> + <div class="rows"> + @for (row of searchRows(); track row.title; let i = $index) { @if (i === 1) { + <div class="row"> + <span class="kind k-snip"><app-kind-icon name="snip" /></span> + <b + >{{ w.search.match[0] }}<mark class="hit" style="--d: 1.5s">{{ w.search.match[1] }}</mark>{{ + w.search.match[2] }}</b + > + <span class="where">{{ row.where }}</span> + <span class="cite mono" style="--d: 1.7s" + >{{ w.search.cite[0] }}<mark class="hit" style="--d: 1.95s">{{ w.search.cite[1] }}</mark>{{ + w.search.cite[2] }}</span + > + </div> + } @else { + <div class="row gone" [style.--d]="1.3 + i * 0.05 + 's'"> + <span class="kind" [class]="'k-' + row.kind"><app-kind-icon [name]="row.kind" /></span> + <b>{{ row.title }}</b><span class="where">{{ row.where }}</span> + </div> + } } + </div> +</div> +} @case ('calc') { +<article class="piece" style="width: min(100%, 560px)"> + <header class="piece-h"> + <span class="kind k-calc"><app-kind-icon name="calc" /></span><b>{{ w.calc.title }}</b> + </header> + <div class="piece-b calc"> + <u>1</u><span class="rv" style="--d: 0.2s; --t: 0.5s">{{ w.calc.train }}</span + ><b class="in" style="--d: 0.8s">{{ w.calc.results[0] }}</b> <u>2</u + ><span class="rv" style="--d: 1s; --t: 0.5s" + >{{ w.calc.hotel[0] }}<span class="swap" + ><span class="o" style="--d: 4s">{{ w.calc.hotel[1] }}</span + ><span class="in" style="--d: 4.2s">{{ w.calc.hotel[2] }}</span></span + >{{ w.calc.hotel[3] }}</span + ><b class="swap" + ><span class="o2" style="--d: 1.6s; --d2: 4.5s">{{ w.calc.results[1] }}</span + ><span class="in" style="--d: 4.6s">{{ w.calc.results[2] }}</span></b + > + <u>3</u><span class="rv" style="--d: 1.8s; --t: 0.5s">{{ w.calc.meals }}</span + ><b class="in" style="--d: 2.4s">{{ w.calc.results[3] }}</b> <u>4</u + ><span class="rv" style="--d: 2.6s; --t: 0.7s">{{ w.calc.total }}</span + ><b class="swap sum flash" style="--d: 4.8s" + ><span class="o2" style="--d: 3.4s; --d2: 4.8s">{{ w.calc.results[4] }}</span + ><span class="in" style="--d: 4.9s">{{ w.calc.results[5] }}</span></b + > + </div> +</article> +} @case ('note') { +<div class="stack" style="width: min(100%, 560px)"> + <article class="piece win" style="--d: 0s; --len: 4.6s"> + <header class="piece-h"> + <span class="kind k-note"><app-kind-icon name="note" /></span><b>{{ w.note.title }}</b + ><span class="tag-r">{{ w.note.tag }}</span> + </header> + <div class="piece-b md"> + <h4 class="rv" style="--d: 0.2s; --t: 0.5s">{{ w.note.heading }}</h4> + <p class="in" style="--d: 0.7s">{{ w.note.lead[0] }}<b>{{ w.note.lead[1] }}</b>{{ w.note.lead[2] }}</p> + <ol> + <li class="in" style="--d: 1s"> + {{ w.note.first[0] }}<code>{{ w.note.first[1] }}</code>{{ w.note.first[2] }} + </li> + <li class="in" style="--d: 1.25s">{{ w.note.steps[0] }}</li> + <li class="in" style="--d: 1.5s">{{ w.note.steps[1] }}</li> + </ol> + <table class="in" style="--d: 1.9s"> + <tbody> + <tr> + <th>{{ w.note.head[0] }}</th> + <th>{{ w.note.head[1] }}</th> + </tr> + @for (row of w.note.rows; track row[0]) { + <tr> + <td>{{ row[0] }}</td> + <td>{{ row[1] }}</td> + </tr> + } + </tbody> + </table> + </div> + </article> + <article class="piece win" style="--d: 4.6s; --len: 2.8s"> + <header class="piece-h"> + <span class="kind k-note"><app-kind-icon name="note" /></span><b>{{ w.note.saved }}</b> + </header> + <div class="piece-b mono">{{ w.note.markdown }}</div> + </article> + <div class="slide in" style="--d: 7.4s"> + <p class="label">{{ w.note.present }}</p> + <h4>{{ w.note.heading }}</h4> + <ol> + <li>{{ w.note.first[0] }}{{ w.note.first[1] }}{{ w.note.first[2] }}</li> + <li>{{ w.note.steps[0] }}</li> + <li>{{ w.note.steps[1] }}</li> + </ol> + </div> +</div> +} @case ('lock') { +<article class="piece" style="width: min(100%, 540px)"> + <header class="piece-h"> + <span class="lock" + ><svg viewBox="0 0 24 24" aria-hidden="true"> + <rect width="18" height="11" x="3" y="11" rx="2" /> + <path class="o" style="--d: 1.1s" d="M7 11V7a5 5 0 0 1 9.9-1" /> + <path class="in" style="--d: 1.15s" d="M7 11V7a5 5 0 0 1 10 0v4" /></svg></span + ><b>{{ w.lock.library }}</b><span class="tag-r pop" style="--d: 2.6s">{{ w.lock.state }}</span> + </header> + <div class="piece-b"> + @for (row of w.lock.rows; track row[0]; let i = $index) { + <div class="kept"> + <span class="sealed" [style.--d]="1.4 + i * 0.2 + 's'">{{ row[0] }}</span + ><span class="tag">{{ row[1] }}</span><time>{{ row[2] }}</time> + </div> + } + </div> +</article> +} } diff --git a/website/src/app/home/day/day-scene.scss b/website/src/app/home/day/day-scene.scss new file mode 100644 index 000000000..eaad4ec16 --- /dev/null +++ b/website/src/app/home/day/day-scene.scss @@ -0,0 +1,51 @@ +// The cell a scene stands in: the board's dotted paper, the piece in its middle. +:host { + position: relative; + display: grid; + grid-template-columns: minmax(0, 1fr); + place-items: center; + min-height: 460px; + padding: 56px var(--pad); + overflow: hidden; + background-image: radial-gradient(circle, var(--dot) 1.1px, transparent 1.7px); + background-size: 24px 24px; +} + +.duo { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; + gap: 24px; + width: 100%; +} + +.sending { + font-size: 12.5px; + color: var(--text-2); +} + +.stack, +.piece { + min-width: 0; +} + +// A wide screen gives the pieces their room. +@media (min-width: 1500px) { + :host > * { + zoom: 1.1; + } +} + +@media (max-width: 1000px) { + :host { + min-height: 0; + padding-block: 36px; + } +} + +@media (max-width: 640px) { + :host { + padding: 28px 12px; + } +} diff --git a/website/src/app/home/day/day-scene.ts b/website/src/app/home/day/day-scene.ts new file mode 100644 index 000000000..b24c0b1c1 --- /dev/null +++ b/website/src/app/home/day/day-scene.ts @@ -0,0 +1,115 @@ +import { + ChangeDetectionStrategy, + Component, + DestroyRef, + ElementRef, + afterNextRender, + computed, + inject, + input, +} from '@angular/core'; + +import { clamp, ease, field } from '../../core/browser'; +import { Lang } from '../../core/lang'; +import { Scene } from './day-text'; +import { IconName, KindIcon } from './kind-icon'; +import { SceneLoop } from './scene-loop'; +import { SCENE_WORDS } from './scene-words'; + +/** How long a scene's turn lasts, the pause at its end included, in milliseconds. */ +export const LOOPS: Readonly<Record<Scene, number>> = { + list: 7200, + snippet: 9000, + drawing: 8000, + request: 8600, + jwt: 8000, + diff: 7600, + search: 7600, + calc: 9000, + note: 10000, + lock: 7000, +}; + +/** The kinds of the notes the search goes through, in their order. */ +const ROW_KINDS: readonly IconName[] = ['snip', 'snip', 'list', 'calc', 'note']; + +/** Where the drawing's database is dragged to, and when, in the turn. */ +const DRAG = { dx: 24, dy: 40, from: 3000, lasts: 1300 }; + +/** One moment's scene: the application's pieces, moving as the moment says. */ +@Component({ + selector: 'app-day-scene', + imports: [KindIcon], + templateUrl: './day-scene.html', + styleUrl: './day-scene.scss', + hostDirectives: [{ directive: SceneLoop, inputs: ['appSceneLoop: loop'] }], + host: { 'aria-hidden': 'true' }, + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class DayScene { + readonly scene = input.required<Scene>(); + readonly lang = input.required<Lang>(); + + protected readonly words = computed(() => SCENE_WORDS[this.lang()]); + protected readonly field = field; + /** A code view keeps its indent: the template's own spaces would be collapsed. */ + protected readonly indent = ' '; + protected readonly open = 'server {'; + protected readonly close = '}'; + protected readonly header = '{ "alg": "HS256", "typ": "JWT" }'; + protected readonly claims = computed(() => { + const [sub, scope] = this.words().jwt.claims; + return `{ ${sub}\n ${scope} }`; + }); + protected readonly terminal = computed(() => { + const { service, namespace } = this.words().snippet; + return ` kubectl rollout restart \\\n deployment/${service} -n ${namespace}`; + }); + /** The notes the search goes through, each with its kind's icon. */ + protected readonly searchRows = computed(() => + this.words().search.rows.map((row, i) => ({ ...row, kind: ROW_KINDS[i] ?? 'note' })), + ); + + constructor() { + const loop = inject(SceneLoop); + const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement; + const destroyRef = inject(DestroyRef); + + // The drawing's arrows hold on to the shape they point at: they are drawn again as it moves. + afterNextRender(() => { + if (this.scene() !== 'drawing') return; + const dragged = host.querySelector('.dragged'); + const held = [host.querySelector('.held-1'), host.querySelector('.held-2')]; + const cursor = host.querySelector<SVGGElement>('.cursor'); + if (!dragged || !held[0] || !held[1] || !cursor) return; + + const put = (t: number) => { + const dx = DRAG.dx * t; + const dy = DRAG.dy * t; + dragged.setAttribute('transform', `translate(${dx} ${dy})`); + held[0]?.setAttribute('d', `M480 73 L${522 + dx} ${132 + dy}`); + held[1]?.setAttribute('d', `M480 223 L${522 + dx} ${164 + dy}`); + cursor.setAttribute('transform', `translate(${586 + dx} ${154 + dy})`); + }; + let frame = 0; + let start = 0; + const step = (now: number) => { + const elapsed = now - start; + put(ease(clamp((elapsed - DRAG.from) / DRAG.lasts))); + cursor.style.opacity = + elapsed > DRAG.from - 400 && elapsed < DRAG.from + DRAG.lasts + 500 ? '1' : '0'; + frame = elapsed < DRAG.from + DRAG.lasts + 700 ? requestAnimationFrame(step) : 0; + }; + const replay = loop.replay.subscribe(() => { + cancelAnimationFrame(frame); + start = performance.now(); + put(0); + frame = requestAnimationFrame(step); + }); + destroyRef.onDestroy(() => { + replay.unsubscribe(); + cancelAnimationFrame(frame); + }); + }); + } +} diff --git a/website/src/app/home/day/day-section.html b/website/src/app/home/day/day-section.html new file mode 100644 index 000000000..b88d2fe57 --- /dev/null +++ b/website/src/app/home/day/day-section.html @@ -0,0 +1,51 @@ +@let day = t(); +<section class="sec" id="journee" aria-labelledby="day-h"> + <div class="sec-h col"> + <span><b>02</b> / {{ day.section }}</span><span>{{ day.span }}</span> + </div> + <div class="bridge col"><h2 id="day-h">{{ day.bridge }}</h2></div> + + <aside + class="rail col" + [class.shown]="shown()" + [class]="'t-' + (day.moments[current()]?.tone ?? 'list')" + aria-hidden="true" + > + <div> + <p class="clock">{{ clock() }}</p> + <p class="say">{{ day.moments[current()]?.kind ?? day.before }}</p> + </div> + <div class="ruler" [style.--now]="now()"> + <i class="fill"></i><i class="now"></i> + @for (hour of hours; track hour.label) { + <span class="hour" [class.minor]="hour.minor" [style.--at]="hour.at">{{ hour.label }}</span> + } @for (mark of marks(); track $index; let i = $index) { + <span class="mark" [class.past]="i < current()" [class.here]="i === current()" [style.--at]="mark.at" + ><b>{{ mark.kind }}</b></span + > + } + </div> + </aside> + + <div class="cells"> + @for (moment of day.moments; track moment.id; let i = $index) { + <article + class="mo" + [class]="'t-' + moment.tone" + [class.on]="i === current()" + [id]="moment.id" + [attr.aria-labelledby]="moment.id + '-h'" + > + <div class="mo-t"> + <p class="when"><time>{{ moment.time }}</time> <span>{{ moment.kind }}</span></p> + <h3 [id]="moment.id + '-h'">{{ moment.title }}</h3> + <p><app-runs [runs]="moment.text" /></p> + @if (moment.gesture) { + <p class="gesture"><app-runs [runs]="moment.gesture" /></p> + } + </div> + <app-day-scene [scene]="moment.scene" [lang]="lang()" [loop]="loop(moment.scene)" /> + </article> + } + </div> +</section> diff --git a/website/src/app/home/day/day-section.scss b/website/src/app/home/day/day-section.scss new file mode 100644 index 000000000..5ba286fa3 --- /dev/null +++ b/website/src/app/home/day/day-section.scss @@ -0,0 +1,329 @@ +.bridge { + padding-block: clamp(52px, 7vw, 88px) clamp(40px, 5vw, 64px); +} + +.bridge h2 { + max-width: 21ch; + font-size: clamp(1.9rem, 3.6vw, 3.1rem); +} + +// A moment is a row: what happens, then the application doing it. +.mo { + display: grid; + grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); + border-top: 1px solid var(--line-soft); +} + +.mo-t { + display: grid; + align-content: start; + gap: 16px; + padding: 56px var(--pad); +} + +.mo-t p { + max-width: 46ch; + font-size: 17px; + line-height: 1.62; + color: var(--text-1); +} + +.mo-t strong { + font-weight: 600; + color: var(--text-0); +} + +.mo h3 { + font-size: clamp(1.55rem, 2.4vw, 2.1rem); + line-height: 1.14; + letter-spacing: -0.022em; + font-weight: 600; + text-wrap: balance; +} + +.mo-t .when { + display: flex; + align-items: baseline; + gap: 14px; + font: 500 15px var(--font-mono); + font-variant-numeric: tabular-nums; + color: var(--text-2); + transition: color var(--motion); +} + +.when span { + font: 600 14px var(--font-sans); + color: var(--tone, var(--text-2)); +} + +.mo.on .when { + color: var(--amber-text); +} + +.mo-t .gesture { + font-size: 15.5px; +} + +.mo app-day-scene { + border-left: 1px solid var(--line-soft); +} + +// Each moment in its kind's colour, as the application paints its cards. +.t-list, +.t-find { + --tone: var(--text-1); +} + +.t-snip { + --tone: var(--green); +} + +.t-draw { + --tone: var(--teal); +} + +.t-http { + --tone: var(--blue); +} + +.t-tool, +.t-lock { + --tone: var(--amber-text); +} + +.t-calc { + --tone: var(--pink); +} + +.t-note { + --tone: var(--purple); +} + +// The hour: in the right margin, named moment by moment, while the day is on screen. +.rail { + position: fixed; + top: var(--head-h); + right: 0; + bottom: 0; + z-index: 4; + width: var(--gr); + padding: 56px 24px 40px 28px; + display: grid; + grid-template-rows: auto minmax(0, 1fr); + opacity: 0; + visibility: hidden; + transition: + opacity var(--motion-scene), + visibility var(--motion-scene); +} + +.rail.shown { + opacity: 1; + visibility: visible; +} + +.clock { + font: 500 clamp(40px, 3.4vw, 54px) / 1 var(--font-mono); + letter-spacing: -0.04em; + font-variant-numeric: tabular-nums; + color: var(--text-0); +} + +.say { + margin-top: 10px; + min-height: 1.4em; + font-size: 14.5px; + font-weight: 600; + color: var(--tone, var(--text-2)); +} + +.ruler { + position: relative; + margin: 36px 0 0 30px; + border-left: 1px solid var(--line); +} + +.hour { + position: absolute; + top: calc(var(--at) * 100%); + left: -30px; + width: 24px; + transform: translateY(-50%); + font: 400 11px var(--font-mono); + color: var(--text-2); + text-align: right; +} + +.hour.minor { + color: transparent; +} + +.hour::after { + content: ''; + position: absolute; + left: 26px; + top: 50%; + width: 6px; + border-top: 1px solid var(--line); +} + +.mark { + position: absolute; + top: calc(var(--at) * 100%); + left: -4px; + width: 7px; + height: 7px; + border-radius: 50%; + border: 1px solid var(--text-2); + background: var(--bg-0); + transform: translateY(-50%); +} + +.mark b { + position: absolute; + left: 16px; + top: 50%; + transform: translateY(-50%); + font: 500 12.5px var(--font-sans); + white-space: nowrap; + color: var(--text-2); + transition: color var(--motion); +} + +.mark.past { + background: var(--amber-dim); + border-color: var(--amber-dim); +} + +.mark.here { + background: var(--amber-fill); + border-color: var(--amber-fill); +} + +.mark.here b { + font-weight: 600; + color: var(--text-0); +} + +.fill { + position: absolute; + left: -1px; + top: 0; + width: 1px; + height: calc(var(--now, 0) * 100%); + background: var(--amber-fill); +} + +.now { + position: absolute; + top: calc(var(--now, 0) * 100%); + left: -5px; + width: 9px; + margin-top: -1px; + border-top: 2px solid var(--amber-fill); +} + +// Below a wide screen, the margin is too narrow: the hour becomes a bar under the header. +@media (max-width: 1379px) { + .rail { + position: sticky; + top: calc(env(safe-area-inset-top, 0px) + var(--head-h)); + bottom: auto; + width: auto; + display: flex; + align-items: center; + gap: 18px; + padding-block: 10px; + border-bottom: 1px solid var(--line-soft); + background: var(--bg-0); + opacity: 1; + visibility: visible; + } + + .clock { + font-size: 24px; + } + + .say { + flex: none; + width: 8.5em; + min-height: 0; + margin: 0; + } + + .ruler { + flex: 1; + height: 24px; + margin: 0; + border-left: 0; + border-top: 1px solid var(--line); + align-self: center; + translate: 0 6px; + } + + .hour { + top: 0; + left: calc(var(--at) * 100%); + width: auto; + padding-top: 7px; + transform: translateX(-50%); + font-size: 10px; + } + + .hour::after { + left: 50%; + top: 0; + width: 0; + height: 5px; + border-top: 0; + border-left: 1px solid var(--line); + } + + .mark { + top: -4px; + left: calc(var(--at) * 100%); + transform: translateX(-50%); + } + + .mark b { + display: none; + } + + .fill { + top: -1px; + left: 0; + width: calc(var(--now, 0) * 100%); + height: 1px; + } + + .now { + top: -9px; + left: calc(var(--now, 0) * 100%); + width: 0; + height: 17px; + margin: 0 0 0 -1px; + border-top: 0; + border-left: 2px solid var(--amber-fill); + } +} + +@media (max-width: 1000px) { + .mo { + grid-template-columns: minmax(0, 1fr); + } + + .mo-t { + padding-bottom: 28px; + } + + .mo app-day-scene { + border-left: 0; + border-top: 1px solid var(--line-soft); + } +} + +@media (max-width: 640px) { + .say { + display: none; + } +} diff --git a/website/src/app/home/day/day-section.ts b/website/src/app/home/day/day-section.ts new file mode 100644 index 000000000..9d28bc901 --- /dev/null +++ b/website/src/app/home/day/day-section.ts @@ -0,0 +1,99 @@ +import { + ChangeDetectionStrategy, + Component, + DestroyRef, + ElementRef, + afterNextRender, + computed, + inject, + signal, +} from '@angular/core'; + +import { Language } from '../../core/language'; +import { ScrollFrame } from '../../core/scroll-frame'; +import { Runs } from '../runs'; +import { DayScene, LOOPS } from './day-scene'; +import { DAY_TEXT, Scene } from './day-text'; + +const FIRST = 8 * 60; +const LAST = 19 * 60; + +const minutes = (time: string) => { + const [hours = 0, rest = 0] = time.split(':').map(Number); + return hours * 60 + rest; +}; +const hhmm = (at: number) => + `${String(Math.floor(at / 60)).padStart(2, '0')}:${String(Math.floor(at % 60)).padStart(2, '0')}`; +/** Where an hour stands on the day's ruler, 0…1. */ +const place = (at: number) => (at - FIRST) / (LAST - FIRST); + +/** + * A developer's day, moment by moment. The hour follows the reading point: between two moments + * it runs from one time to the next. On a wide screen the day's ruler stands in the right margin, + * each moment named; below, it is a bar under the header. + */ +@Component({ + selector: 'app-day-section', + imports: [DayScene, Runs], + templateUrl: './day-section.html', + styleUrl: './day-section.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class DaySection { + protected readonly lang = inject(Language).lang; + protected readonly t = computed(() => DAY_TEXT[this.lang()]); + protected readonly hours = Array.from({ length: LAST / 60 - FIRST / 60 + 1 }, (_, i) => ({ + label: String(FIRST / 60 + i).padStart(2, '0'), + minor: i % 2 === 1, + at: place(FIRST + i * 60), + })); + protected readonly marks = computed(() => + this.t().moments.map((moment) => ({ kind: moment.kind, at: place(minutes(moment.time)) })), + ); + + /** The moment being read, -1 above the first. */ + protected readonly current = signal(-1); + protected readonly clock = signal(this.t().moments[0]?.time ?? ''); + protected readonly now = signal(0); + /** The margin's ruler is shown while the day is on screen. */ + protected readonly shown = signal(false); + + constructor() { + const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement; + const frame = inject(ScrollFrame); + const destroyRef = inject(DestroyRef); + + afterNextRender(() => { + const section = host.querySelector('section'); + const rows = [...host.querySelectorAll<HTMLElement>('.mo')]; + const times = this.t().moments.map(({ time }) => minutes(time)); + if (!section || !rows.length) return; + + const stop = frame.watch(() => { + const line = scrollY + innerHeight * 0.4; + const tops = rows.map((row) => row.getBoundingClientRect().top + scrollY); + let at = times[0] ?? FIRST; + let current = -1; + for (let i = 0; i < rows.length; i++) { + const top = tops[i] ?? 0; + if (line < top) break; + current = i; + const next = tops[i + 1]; + const from = times[i] ?? FIRST; + const to = times[i + 1] ?? from; + at = next === undefined ? from : from + (to - from) * Math.min(1, (line - top) / (next - top)); + } + this.current.set(current); + this.clock.set(hhmm(at)); + this.now.set(Number(place(at).toFixed(4))); + const box = section.getBoundingClientRect(); + this.shown.set(box.top < innerHeight * 0.25 && box.bottom > innerHeight * 0.5); + }); + destroyRef.onDestroy(stop); + }); + } + + protected loop(scene: Scene): number { + return LOOPS[scene]; + } +} diff --git a/website/src/app/home/day/day-text.ts b/website/src/app/home/day/day-text.ts new file mode 100644 index 000000000..15c84cfd8 --- /dev/null +++ b/website/src/app/home/day/day-text.ts @@ -0,0 +1,312 @@ +import { Lang } from '../../core/lang'; +import { Run } from '../runs'; + +export type Scene = + 'list' | 'snippet' | 'drawing' | 'request' | 'jwt' | 'diff' | 'search' | 'calc' | 'note' | 'lock'; + +/** The kind's colour in the application, which names the moment. */ +export type MomentTone = 'list' | 'snip' | 'draw' | 'http' | 'tool' | 'find' | 'calc' | 'note' | 'lock'; + +export interface Moment { + /** Its anchor, its hour without the colon: `m0852`. */ + readonly id: string; + readonly time: string; + readonly tone: MomentTone; + readonly scene: Scene; + readonly kind: string; + readonly title: string; + readonly text: readonly Run[]; + readonly gesture?: readonly Run[]; +} + +interface DayText { + readonly section: string; + readonly span: string; + readonly bridge: string; + /** What the hour says before the first moment is reached. */ + readonly before: string; + readonly moments: readonly Moment[]; +} + +const FR: DayText = { + section: 'Une journée', + span: 'Dix moments, de 08:52 à 18:10', + bridge: + "Vous voulez voir comment DevNotes s'utilise, concrètement ? Voici une journée dans la peau d'un développeur.", + before: 'Une journée de développeur', + moments: [ + { + id: 'm0852', + time: '08:52', + tone: 'list', + scene: 'list', + kind: 'Liste de tâches', + title: 'La liste du jour', + text: [ + "La démonstration est à 10 h, et il reste trois choses à faire. Une liste les garde, et sa carte montre où vous en êtes sans l'ouvrir.", + ], + }, + { + id: 'm0940', + time: '09:40', + tone: 'snip', + scene: 'snippet', + kind: 'Snippet', + title: 'Relancer le paiement en recette', + text: [ + 'Le ticket demande de relancer le service. La commande est dans un snippet, avec deux champs : ', + { b: 'service' }, + ' et ', + { b: 'namespace' }, + '. Vous restez dans le terminal.', + ], + gesture: [ + { keys: ['Ctrl', 'Alt', 'P'] }, + ' ouvre la palette, ', + { keys: ['Entrée'] }, + ' demande les deux valeurs, puis la commande remplie est copiée.', + ], + }, + { + id: 'm1030', + time: '10:30', + tone: 'draw', + scene: 'drawing', + kind: 'Dessin', + title: 'Le réseau expliqué au nouvel arrivant', + text: [ + "Une recrue demande par où passe un paiement. Cinq formes, et des flèches accrochées aux formes, qui les suivent quand on les déplace. Le Dessin reste avec les notes, une Note peut l'afficher, et il part en ", + { b: 'PNG' }, + ' ou en ', + { b: 'SVG' }, + ' pour le wiki.', + ], + }, + { + id: 'm1115', + time: '11:15', + tone: 'http', + scene: 'request', + kind: 'Requête HTTP', + title: 'La liste des factures revient vide', + text: [ + 'La requête ', + { b: 'Lister les factures' }, + " part sur l'environnement de recette. Ses variables viennent de la requête, du dossier, de la collection, puis de l'environnement : une variable définie nulle part bloque l'envoi.", + ], + gesture: [{ keys: ['Ctrl', 'Entrée'] }, ' envoie la requête.'], + }, + { + id: 'm1330', + time: '13:30', + tone: 'tool', + scene: 'jwt', + kind: 'Outil JWT', + title: 'Un jeton dans les journaux', + text: [ + "Un JWT traîne dans un log. L'outil le décode sur votre machine, sans rien envoyer, et lit ses dates : émis quand, valable jusqu'à quand. Avec le secret, il vérifie aussi la signature.", + ], + gesture: [{ keys: ['Ctrl', 'Maj', 'T'] }, ' cherche parmi les 32 outils.'], + }, + { + id: 'm1420', + time: '14:20', + tone: 'tool', + scene: 'diff', + kind: 'Outil Diff', + title: "La recette et la prod n'ont pas la même config", + text: [ + "La recette répond en HTTP, la production en HTTPS. Les deux fichiers côte à côte : Diff montre les lignes changées et, dans chaque ligne, ce qui change. Chaque côté peut venir d'une note, et l'écart peut en devenir une.", + ], + }, + { + id: 'm1505', + time: '15:05', + tone: 'find', + scene: 'search', + kind: 'Recherche', + title: 'La requête SQL de mars', + text: [ + 'Elle est quelque part. Vous tapez « impayee », sans accent : la recherche lit les titres, le code, les listes et les tags, et cite la ligne trouvée.', + ], + gesture: [{ keys: ['Ctrl', 'K'] }, ' cherche dans la bibliothèque.'], + }, + { + id: 'm1620', + time: '16:20', + tone: 'calc', + scene: 'calc', + kind: 'Calcul', + title: 'Le budget du déplacement', + text: [ + "Le train, l'hôtel, les repas : une ligne chacun, le total en dessous. Un Calcul compte en euros, en heures ou en octets, et refait le compte dès qu'un chiffre change.", + ], + }, + { + id: 'm1730', + time: '17:30', + tone: 'note', + scene: 'note', + kind: 'Note', + title: 'La mise en production de demain', + text: [ + "Les étapes s'écrivent une fois, mises en forme : la liste numérotée, le tableau des durées, la commande à lancer. La Note est enregistrée en ", + { b: 'Markdown' }, + ", et « Présenter » l'affiche en plein écran pour la réunion de demain.", + ], + }, + { + id: 'm1810', + time: '18:10', + tone: 'lock', + scene: 'lock', + kind: 'Fermeture', + title: 'On ferme. Tout est écrit, et chiffré.', + text: [ + 'En quittant, DevNotes écrit ce qui reste et ferme la bibliothèque. Sur le disque, vos titres et vos contenus sont chiffrés ; demain, la première ouverture demandera la phrase de passe et prendra une copie.', + ], + }, + ], +}; + +const EN: DayText = { + section: 'A day', + span: 'Ten moments, from 08:52 to 18:10', + bridge: 'Want to see how DevNotes is used, day to day? Here is a day in the life of a developer.', + before: "A developer's day", + moments: [ + { + id: 'm0852', + time: '08:52', + tone: 'list', + scene: 'list', + kind: 'To-do list', + title: "The day's list", + text: [ + 'The demo is at 10, and three things are left to do. A list keeps them, and its card shows where you stand without opening it.', + ], + }, + { + id: 'm0940', + time: '09:40', + tone: 'snip', + scene: 'snippet', + kind: 'Snippet', + title: 'Restarting payments on staging', + text: [ + 'The ticket asks to restart the service. The command is in a snippet, with two fields: ', + { b: 'service' }, + ' and ', + { b: 'namespace' }, + '. You stay in the terminal.', + ], + gesture: [ + { keys: ['Ctrl', 'Alt', 'P'] }, + ' opens the palette, ', + { keys: ['Enter'] }, + ' asks for both values, then the filled command is copied.', + ], + }, + { + id: 'm1030', + time: '10:30', + tone: 'draw', + scene: 'drawing', + kind: 'Drawing', + title: 'The network, explained to a newcomer', + text: [ + 'A new hire asks which way a payment goes. Five shapes, and arrows attached to the shapes, which follow them when they move. The Drawing stays with the notes, a Note can show it, and it leaves as ', + { b: 'PNG' }, + ' or ', + { b: 'SVG' }, + ' for the wiki.', + ], + }, + { + id: 'm1115', + time: '11:15', + tone: 'http', + scene: 'request', + kind: 'HTTP request', + title: 'The invoice list comes back empty', + text: [ + 'The ', + { b: 'List invoices' }, + ' request goes to the staging environment. Its variables come from the request, the folder, the collection, then the environment: a variable set nowhere stops the send.', + ], + gesture: [{ keys: ['Ctrl', 'Enter'] }, ' sends the request.'], + }, + { + id: 'm1330', + time: '13:30', + tone: 'tool', + scene: 'jwt', + kind: 'JWT tool', + title: 'A token in the logs', + text: [ + 'A JWT is lying in a log. The tool decodes it on your machine, sending nothing, and reads its dates: issued when, valid until when. Given the secret, it checks the signature too.', + ], + gesture: [{ keys: ['Ctrl', 'Shift', 'T'] }, ' searches the 32 tools.'], + }, + { + id: 'm1420', + time: '14:20', + tone: 'tool', + scene: 'diff', + kind: 'Diff tool', + title: 'Staging and production differ', + text: [ + 'Staging answers over HTTP, production over HTTPS. Both files side by side: Diff shows the lines that changed and, within each line, what changed. Either side can come from a note, and the difference can become one.', + ], + }, + { + id: 'm1505', + time: '15:05', + tone: 'find', + scene: 'search', + kind: 'Search', + title: 'The March SQL query', + text: [ + 'It is somewhere. The search reads titles, code, lists and tags, ignoring case and accents, and quotes the line it found.', + ], + gesture: [{ keys: ['Ctrl', 'K'] }, ' searches the library.'], + }, + { + id: 'm1620', + time: '16:20', + tone: 'calc', + scene: 'calc', + kind: 'Calculation', + title: 'The trip budget', + text: [ + 'Train, hotel, meals: one line each, the total underneath. A Calculation counts in euros, hours or bytes, and redoes the sum as soon as a figure changes.', + ], + }, + { + id: 'm1730', + time: '17:30', + tone: 'note', + scene: 'note', + kind: 'Note', + title: "Tomorrow's release", + text: [ + 'The steps are written once, formatted: the numbered list, the table of durations, the command to run. The Note is saved as ', + { b: 'Markdown' }, + ', and “Present” shows it full screen for tomorrow’s meeting.', + ], + }, + { + id: 'm1810', + time: '18:10', + tone: 'lock', + scene: 'lock', + kind: 'Closing', + title: 'Closing time. Everything is written, and encrypted.', + text: [ + 'On quitting, DevNotes writes what is left and closes the library. On disk, your titles and contents are encrypted; tomorrow, the first launch will ask for the passphrase and take a copy.', + ], + }, + ], +}; + +export const DAY_TEXT: Readonly<Record<Lang, DayText>> = { fr: FR, en: EN }; diff --git a/website/src/app/home/day/kind-icon.ts b/website/src/app/home/day/kind-icon.ts new file mode 100644 index 000000000..9da7234b4 --- /dev/null +++ b/website/src/app/home/day/kind-icon.ts @@ -0,0 +1,57 @@ +import { ChangeDetectionStrategy, Component, input } from '@angular/core'; + +export type IconName = 'list' | 'snip' | 'calc' | 'note' | 'draw' | 'http' | 'tool' | 'search' | 'check'; + +/** The application's own icons for a kind of note and its tools, drawn on a 24-unit grid. */ +@Component({ + selector: 'app-kind-icon', + template: ` + <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"> + @switch (name()) { + @case ('list') { + <svg:rect width="18" height="18" x="3" y="3" rx="2" /> + <svg:path d="m9 12 2 2 4-4" /> + } + @case ('snip') { + <svg:path d="m16 18 6-6-6-6M8 6l-6 6 6 6" /> + } + @case ('calc') { + <svg:path d="M18 7V4H6l6 8-6 8h12v-3" /> + } + @case ('note') { + <svg:path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" /> + <svg:path d="M14 2v4a2 2 0 0 0 2 2h4M16 13H8M16 17H8M10 9H8" /> + } + @case ('draw') { + <svg:path + d="M21.2 6.8a1 1 0 0 0-4-4L3.8 16.2a2 2 0 0 0-.5.8l-1.3 4.4a.5.5 0 0 0 .6.6l4.4-1.3a2 2 0 0 0 .8-.5z" + /> + } + @case ('http') { + <svg:path d="M8 3 4 7l4 4M4 7h16M16 21l4-4-4-4M20 17H4" /> + } + @case ('tool') { + <svg:path + d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.8-3.8a6 6 0 0 1-7.9 7.9l-6.9 6.9a2.1 2.1 0 0 1-3-3l6.9-6.9a6 6 0 0 1 7.9-7.9z" + /> + } + @case ('search') { + <svg:circle cx="11" cy="11" r="7" /> + <svg:path d="m21 21-4.3-4.3" /> + } + @case ('check') { + <svg:path d="M20 6 9 17l-5-5" /> + } + } + </svg> + `, + styles: ` + :host { + display: contents; + } + `, + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class KindIcon { + readonly name = input.required<IconName>(); +} diff --git a/website/src/app/home/day/scene-loop.ts b/website/src/app/home/day/scene-loop.ts new file mode 100644 index 000000000..78a94acd9 --- /dev/null +++ b/website/src/app/home/day/scene-loop.ts @@ -0,0 +1,53 @@ +import { DestroyRef, Directive, ElementRef, afterNextRender, inject, input, output } from '@angular/core'; + +import { canObserve, prefersReducedMotion } from '../../core/browser'; + +/** + * Plays a scene again and again while it is on screen (`_pieces.scss` says how each piece moves). + * Without script, under reduced motion, or where nothing observes, the scene keeps the end it is + * written in. Typing and revealing go a character at a time: each piece is told how many it has. + */ +@Directive({ + selector: '[appSceneLoop]', + host: { class: 'scene' }, +}) +export class SceneLoop { + /** How long one turn lasts, the pause at its end included, in milliseconds. */ + readonly appSceneLoop = input.required<number>(); + /** Each time the scene starts again: what CSS cannot move is moved by its listener. */ + readonly replay = output<void>(); + + constructor() { + const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement; + const destroyRef = inject(DestroyRef); + + afterNextRender(() => { + if (prefersReducedMotion() || !canObserve()) return; + for (const piece of host.querySelectorAll<HTMLElement>('.ty, .ph, .rv')) + piece.style.setProperty('--n', String([...(piece.textContent ?? '')].length)); + host.classList.add('anim'); + + let timer = 0; + const restart = () => { + host.classList.remove('run'); + void host.offsetWidth; + host.classList.add('run'); + this.replay.emit(); + timer = window.setTimeout(restart, this.appSceneLoop()); + }; + const watch = new IntersectionObserver( + ([entry]) => { + clearTimeout(timer); + if (entry?.isIntersecting) restart(); + else host.classList.remove('run'); + }, + { threshold: 0.2 }, + ); + watch.observe(host); + destroyRef.onDestroy(() => { + clearTimeout(timer); + watch.disconnect(); + }); + }); + } +} diff --git a/website/src/app/home/day/scene-words.ts b/website/src/app/home/day/scene-words.ts new file mode 100644 index 000000000..d91fa5da0 --- /dev/null +++ b/website/src/app/home/day/scene-words.ts @@ -0,0 +1,224 @@ +import { Lang } from '../../core/lang'; + +/** + * What the scenes show, in each language: the application's own wording (crates/i18n), and the + * notes of the capture above them (`app::screens`' seed), so that both pages tell one story. + */ +const FR = { + copied: 'Copié', + list: { + title: 'Avant la démonstration', + priority: 'Haute', + items: ['Vider le cache du navigateur', 'Préparer le jeu de données', 'Couper les notifications'], + space: 'Projets', + }, + snippet: { + query: 'relancer', + group: 'NOTES', + title: 'Relancer le service de paiement', + fields: '2 champs à remplir', + keys: ['naviguer', 'ouvrir', 'copier', 'fermer'], + form: 'Remplir les champs', + hint: 'Ce snippet attend 2 valeurs.', + cancel: 'Annuler', + copy: 'Copier rempli', + service: 'paiement-api', + namespace: 'recette', + }, + drawing: { + title: 'Schéma du réseau', + browser: 'Navigateur', + balancer: ['Répartiteur', 'de charge'], + api: ['API paiement 1', 'API paiement 2'], + note: 'HTTPS terminé ici', + exports: ['Exporter en PNG', 'Exporter en SVG'], + }, + request: { + title: 'Lister les factures', + env: 'recette', + host: 'https://api.recette.interne', + path: '/factures?statut=impayee', + links: ['requête', 'dossier', 'collection'], + found: 'environnement « recette »', + send: 'Envoyer', + sending: 'Envoi…', + size: '2 o', + }, + jwt: { + tools: 'Outils ›', + input: 'ENTRÉE', + header: 'EN-TÊTE', + payload: 'CHARGE UTILE', + load: 'eyJzdWIiOiJmYWN0dXJhdGlvbiIsInNjb3BlIjoiZmFjdHVyZXM6bGVjdHVyZSIsImlhdCI6MTc5NTY5MTg4MCwiZXhwIjoxNzk1Njk1NDgwfQ', + claims: ['"sub": "facturation",', '"scope": "factures:lecture"'], + issued: 'Émis · iat', + expires: 'Expiration · exp', + state: 'Expiré · il y a 12 minutes', + }, + diff: { + plus: '+ 4 lignes', + minus: '− 3 lignes', + was: 'A nginx recette', + now: 'B nginx production', + }, + search: { + query: 'impayee', + count: '1 résultat', + rows: [ + { title: 'Relancer le service de paiement', where: 'Exploitation' }, + { title: 'Factures impayées de mars', where: 'Projets' }, + { title: 'Avant la démonstration', where: 'Projets' }, + { title: 'Budget du déplacement', where: 'Découverte' }, + { title: 'Procédure de mise en production', where: 'Livraisons' }, + ], + /** The found title around its match, and the line quoted. */ + match: ['Factures ', 'impayées', ' de mars'], + cite: ["WHERE statut = '", 'impayee', "'"], + }, + calc: { + title: 'Budget du déplacement', + train: 'train = 2 × 89 €', + hotel: ['hôtel = 3 × ', '112', '104', ' €'], + meals: 'repas = 6 × 18 €', + total: 'total = train + hôtel + repas', + results: ['178,00 €', '336,00 €', '312,00 €', '108,00 €', '622,00 €', '598,00 €'], + }, + note: { + title: 'Procédure de mise en production', + tag: '#livraison', + heading: 'Mise en production', + lead: ['Trois étapes, ', 'dans cet ordre', ' :'], + first: ['Geler la branche ', 'dev', ''], + steps: ['Lancer la chaîne de publication', 'Prévenir l’astreinte'], + head: ['Étape', 'Durée'], + rows: [ + ['Build', '12 min'], + ['Déploiement', '4 min'], + ], + saved: 'Enregistrée en Markdown', + markdown: + '# Mise en production\nTrois étapes, **dans cet ordre** :\n1. Geler la branche `dev`\n2. Lancer la chaîne de publication\n3. Prévenir l’astreinte\n\n| Étape | Durée |\n| ----------- | ------ |\n| Build | 12 min |\n| Déploiement | 4 min |', + present: 'Présenter', + }, + lock: { + library: 'Bibliothèque « Travail »', + state: 'Chiffrée sur le disque', + rows: [ + ['Relancer le service de paiement', '#exploitation', 'il y a 1j'], + ['Factures impayées de mars', '#sql', 'il y a 2j'], + ['Budget du déplacement', '#voyage', '16:20'], + ['Procédure de mise en production', '#livraison', '17:30'], + ], + }, +}; + +export type SceneWords = typeof FR; + +const EN: SceneWords = { + copied: 'Copied', + list: { + title: 'Before the demo', + priority: 'High', + items: ['Clear the browser cache', 'Prepare the data set', 'Turn off notifications'], + space: 'Projects', + }, + snippet: { + query: 'restart', + group: 'NOTES', + title: 'Restart the payment service', + fields: '2 fields to fill', + keys: ['move', 'open', 'copy', 'close'], + form: 'Fill the fields', + hint: 'This snippet expects 2 values.', + cancel: 'Cancel', + copy: 'Copy filled', + service: 'payment-api', + namespace: 'staging', + }, + drawing: { + title: 'Network diagram', + browser: 'Browser', + balancer: ['Load', 'balancer'], + api: ['Payment API 1', 'Payment API 2'], + note: 'HTTPS ends here', + exports: ['Export as PNG', 'Export as SVG'], + }, + request: { + title: 'List invoices', + env: 'staging', + host: 'https://api.staging.internal', + path: '/invoices?status=unpaid', + links: ['request', 'folder', 'collection'], + found: '“staging” environment', + send: 'Send', + sending: 'Sending…', + size: '2 B', + }, + jwt: { + tools: 'Tools ›', + input: 'INPUT', + header: 'HEADER', + payload: 'PAYLOAD', + load: 'eyJzdWIiOiJiaWxsaW5nIiwic2NvcGUiOiJpbnZvaWNlczpyZWFkIiwiaWF0IjoxNzk1NjkxODgwLCJleHAiOjE3OTU2OTU0ODB9', + claims: ['"sub": "billing",', '"scope": "invoices:read"'], + issued: 'Issued · iat', + expires: 'Expires · exp', + state: 'Expired · 12 minutes ago', + }, + diff: { + plus: '+ 4 lines', + minus: '− 3 lines', + was: 'A nginx staging', + now: 'B nginx production', + }, + search: { + query: 'unpaid', + count: '1 result', + rows: [ + { title: 'Restart the payment service', where: 'Operations' }, + { title: 'Unpaid invoices for March', where: 'Projects' }, + { title: 'Before the demo', where: 'Projects' }, + { title: 'Trip budget', where: 'Getting started' }, + { title: 'Release procedure', where: 'Releases' }, + ], + match: ['', 'Unpaid', ' invoices for March'], + cite: ["WHERE status = '", 'unpaid', "'"], + }, + calc: { + title: 'Trip budget', + train: 'train = 2 × 89 €', + hotel: ['hotel = 3 × ', '112', '104', ' €'], + meals: 'meals = 6 × 18 €', + total: 'total = train + hotel + meals', + results: ['178.00 €', '336.00 €', '312.00 €', '108.00 €', '622.00 €', '598.00 €'], + }, + note: { + title: 'Release procedure', + tag: '#release', + heading: 'Release', + lead: ['Three steps, ', 'in this order', ':'], + first: ['Freeze the ', 'dev', ' branch'], + steps: ['Run the release pipeline', 'Warn the on-call engineer'], + head: ['Step', 'Duration'], + rows: [ + ['Build', '12 min'], + ['Deployment', '4 min'], + ], + saved: 'Saved as Markdown', + markdown: + '# Release\nThree steps, **in this order**:\n1. Freeze the `dev` branch\n2. Run the release pipeline\n3. Warn the on-call engineer\n\n| Step | Duration |\n| ---------- | -------- |\n| Build | 12 min |\n| Deployment | 4 min |', + present: 'Present', + }, + lock: { + library: 'Library “Work”', + state: 'Encrypted on disk', + rows: [ + ['Restart the payment service', '#operations', '1d ago'], + ['Unpaid invoices for March', '#sql', '2d ago'], + ['Trip budget', '#travel', '16:20'], + ['Release procedure', '#release', '17:30'], + ], + }, +}; + +export const SCENE_WORDS: Readonly<Record<Lang, SceneWords>> = { fr: FR, en: EN }; diff --git a/website/src/app/home/feature.html b/website/src/app/home/feature.html deleted file mode 100644 index d827347a6..000000000 --- a/website/src/app/home/feature.html +++ /dev/null @@ -1,35 +0,0 @@ -<section - class="feature" - [class.flip]="flip()" - [class.wide]="wide()" - [id]="anchor()" - [attr.aria-labelledby]="anchor() + '-h'" - [style.--c]="rgb()" -> - <div class="wrap feature-grid"> - <div class="feature-copy"> - <span class="zone-title"><span class="sw"></span>{{ label() }}</span> - <h2 [id]="anchor() + '-h'">{{ heading() }}</h2> - <div class="feature-lede"><ng-content select="[lede]" /></div> - <ol class="steps" [attr.aria-label]="'Les étapes : ' + label()"> - @for (step of steps(); track $index) { - <li> - <button - type="button" - [class.is-on]="state($index) === 'on'" - [class.is-done]="state($index) === 'done' || (state($index) === 'on' && player.t() >= 1)" - [attr.aria-pressed]="state($index) === 'on'" - [style.--t]="fill($index)" - (click)="player.show($index)" - > - <span class="num">{{ $index + 1 }}</span><span>{{ step }}</span><span class="fill"></span> - </button> - </li> - } - </ol> - </div> - <div class="story-stage" #stage aria-hidden="true"> - <ng-content /> - </div> - </div> -</section> diff --git a/website/src/app/home/feature.scss b/website/src/app/home/feature.scss deleted file mode 100644 index 91ed2ac04..000000000 --- a/website/src/app/home/feature.scss +++ /dev/null @@ -1,185 +0,0 @@ -.feature { - padding-top: clamp(110px, 16vh, 190px); -} - -.feature-grid { - display: grid; - grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); - gap: clamp(32px, 5vw, 88px); - align-items: center; -} - -// The scene keeps the wide column on whichever side it sits. -.flip .feature-grid { - grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); -} - -.flip .feature-copy { - order: 2; -} - -.feature-copy { - display: grid; - gap: 20px; - align-content: center; -} - -.feature-copy h2 { - font-size: clamp(1.7rem, 2.8vw, 3.2rem); -} - -// Inherited by the paragraph the page projects here. -.feature-lede { - color: var(--text-1); - font-size: clamp(1.06rem, 0.45vw + 0.7rem, 1.3rem); - line-height: 1.6; - max-width: 32em; -} - -.steps { - display: grid; - gap: 4px; - margin-top: 4px; -} - -.steps button { - position: relative; - overflow: hidden; - width: 100%; - min-height: 44px; - padding: 7px 10px; - display: grid; - grid-template-columns: 26px minmax(0, 1fr); - align-items: center; - gap: 12px; - border: 0; - border-radius: 8px; - background: transparent; - color: var(--text-1); - font: 500 clamp(15px, 0.4vw + 9px, 18px) / 1.35 var(--font-sans); - text-align: left; - cursor: pointer; -} - -.steps button:hover { - background: var(--bg-2); - color: var(--text-0); -} - -.steps .num { - width: 24px; - height: 24px; - border-radius: 50%; - display: grid; - place-items: center; - border: 1.5px solid var(--line); - font: 650 12px var(--font-mono); - color: var(--text-2); -} - -.steps button.is-done .num { - background: rgba(var(--c), 0.18); - border-color: rgba(var(--c), 0.6); - color: var(--text-0); -} - -.steps button.is-on { - background: rgba(var(--c), 0.1); - color: var(--text-0); -} - -.steps button.is-on .num { - background: rgb(var(--c)); - border-color: rgb(var(--c)); - color: var(--bg-0); -} - -.steps .fill { - position: absolute; - left: 0; - right: 0; - bottom: 0; - height: 2px; - background: rgb(var(--c)); - transform-origin: left; - transform: scaleX(var(--t, 0)); - opacity: 0; -} - -.steps button.is-on .fill { - opacity: 1; -} - -// The wide form: one column, the words centred, the steps side by side, the scene full width. -.wide .feature-grid { - grid-template-columns: minmax(0, 1fr); - gap: clamp(28px, 3vw, 48px); -} - -.wide .feature-copy { - justify-items: center; - max-width: 52rem; - margin-inline: auto; - text-align: center; -} - -.wide .feature-lede { - max-width: 40em; -} - -.wide .steps { - grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); - gap: 6px; - width: min(100%, 64rem); - text-align: left; -} - -.wide .story-stage { - height: 540px; -} - -// Tied to the scroll but never holding it: the window settles as it comes up the screen. -.story-stage { - position: relative; - height: 480px; - container-type: inline-size; - transform-origin: 50% 100%; - transform: perspective(1400px) translateY(calc((1 - var(--q, 1)) * 48px)) - rotateX(calc((1 - var(--q, 1)) * 9deg)) scale(calc(0.94 + 0.06 * var(--q, 1))); - opacity: calc(0.4 + 0.6 * var(--q, 1)); -} - -// On a large screen the scene is drawn larger, as the application would be on it. -@media (min-width: 1700px) { - .story-stage { - zoom: 1.12; - } -} - -@media (min-width: 2000px) { - .story-stage { - zoom: 1.25; - } -} - -@media (min-width: 2400px) { - .story-stage { - zoom: 1.4; - } -} - -@media (max-width: 900px) { - .feature-grid, - .flip .feature-grid { - grid-template-columns: minmax(0, 1fr); - gap: 28px; - } - - .flip .feature-copy { - order: 0; - } - - .story-stage { - height: 440px; - } -} diff --git a/website/src/app/home/feature.ts b/website/src/app/home/feature.ts deleted file mode 100644 index 670b39544..000000000 --- a/website/src/app/home/feature.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { - ChangeDetectionStrategy, - Component, - DestroyRef, - ElementRef, - afterNextRender, - booleanAttribute, - computed, - inject, - input, - viewChild, -} from '@angular/core'; - -import { canObserve, clamp, prefersReducedMotion } from '../core/browser'; -import { Tone } from '../core/page-progress'; -import { ScrollFrame } from '../core/scroll-frame'; -import { ScenePlayer } from './scene-player'; - -/** How much of the scene must be in view before it plays. */ -const IN_VIEW = 0.55; - -/** - * One feature: a plain headline, a paragraph, its steps — always visible, each one a - * button — and the scene beside them. The scene plays by itself once well in view, and - * again each time it comes back after leaving the screen. The page is never held. - */ -@Component({ - selector: 'app-feature', - providers: [ScenePlayer], - templateUrl: './feature.html', - styleUrl: './feature.scss', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class Feature { - readonly anchor = input.required<string>(); - readonly tone = input.required<Tone>(); - readonly label = input.required<string>(); - readonly heading = input.required<string>(); - readonly steps = input.required<readonly string[]>(); - /** How long each step plays, in milliseconds: one per step. */ - readonly durations = input.required<readonly number[]>(); - /** The scene on the left, the words on the right. */ - readonly flip = input(false, { transform: booleanAttribute }); - /** The words centred above, the steps in a row, the scene across the page: a change of pace. */ - readonly wide = input(false, { transform: booleanAttribute }); - - protected readonly player = inject(ScenePlayer); - protected readonly rgb = computed(() => `var(--${this.tone()}-rgb)`); - private readonly stage = viewChild.required<ElementRef<HTMLElement>>('stage'); - - constructor() { - const frame = inject(ScrollFrame); - const destroyRef = inject(DestroyRef); - - afterNextRender(() => { - const stage = this.stage().nativeElement; - const reduce = prefersReducedMotion(); - if (reduce) { - this.player.show(this.steps().length - 1); - return; - } - - // The window settles as it rises up the screen; the scroll is never held for it. - const stop = frame.watch(() => { - const rise = clamp((innerHeight - stage.getBoundingClientRect().top) / (innerHeight * IN_VIEW)); - stage.style.setProperty('--q', rise.toFixed(3)); - }); - destroyRef.onDestroy(stop); - - if (!canObserve()) return; - let armed = true; - const watch = new IntersectionObserver( - ([entry]) => { - if (!entry) return; - if (!entry.isIntersecting) { - this.player.rest(); - armed = true; - } else if (entry.intersectionRatio >= IN_VIEW && armed) { - armed = false; - void this.player.play(this.durations()); - } - }, - { threshold: [0, IN_VIEW] }, - ); - watch.observe(stage); - destroyRef.onDestroy(() => watch.disconnect()); - }); - } - - protected state(index: number): 'on' | 'done' | 'next' { - const step = this.player.step(); - if (index < step) return 'done'; - return index === step ? 'on' : 'next'; - } - - /** How much of a step's line is drawn under it: the one playing grows, the past ones are full. */ - protected fill(index: number): number { - const step = this.player.step(); - if (index < step) return 1; - return index === step ? Number(this.player.t().toFixed(3)) : 0; - } -} diff --git a/website/src/app/home/hero-board.html b/website/src/app/home/hero-board.html deleted file mode 100644 index f67a02748..000000000 --- a/website/src/app/home/hero-board.html +++ /dev/null @@ -1,297 +0,0 @@ -<div class="wrap track" #track> - <div class="pin" #pin> - <div class="scroller" #scroller> - <div class="app-window" #frame role="img" [attr.aria-label]="w().window"> - <div class="titlebar"> - <span class="menus"><span>{{ w().file }}</span><span>{{ w().about }}</span></span> - <span class="areas" - ><span class="on">{{ w().notes }}</span><span>{{ w().tools }}</span><span>HTTP</span></span - > - <span class="controls"><i></i><i></i><i></i></span> - </div> - <div class="rail"> - <span class="rail-h">{{ w().spaces }}</span> - <span class="row">{{ w().allSpaces }}</span> - <span class="row">{{ w().personal }}</span> - <span class="row on">{{ w().platform }}</span> - <span class="row sub" style="--c: var(--blue-rgb)" - ><i class="sw"></i>{{ w().deploy }}<b>{{ placed().cards.dep.filed ? 3 : 2 }}</b></span - > - <span class="row sub" style="--c: var(--amber-rgb)" - ><i class="sw"></i>{{ w().db }}<b>{{ placed().cards.db.filed ? 3 : 2 }}</b></span - > - <span class="row sub" style="--c: var(--purple-rgb)" - ><i class="sw"></i>{{ w().front }}<b>{{ placed().cards.front.filed ? 3 : 2 }}</b></span - > - <span class="row">{{ w().project }}</span> - <span class="row">{{ w().client }}</span> - <span class="rail-foot">{{ w().trash }}</span> - </div> - <div class="toolbar"> - <span class="views"><span>{{ w().list }}</span><span class="on">{{ w().board }}</span></span> - <span class="search">{{ w().search }}<kbd>Ctrl</kbd><kbd>K</kbd></span> - <span class="filters" - ><span class="on">{{ w().all }}</span><span>{{ w().pinned }}</span - ><span>{{ w().untriaged }}</span></span - > - <span class="new">{{ w().newNote }}</span> - </div> - <div class="board"> - <span class="untriaged">{{ w().toFile(6 - placed().filed) }}</span> - <div - class="zone" - style="--c: var(--blue-rgb); left: 24px" - [class.drop-target]="placed().cards.dep.dropping" - > - <div class="zone-head"> - <span class="sw"></span>{{ w().deploy }} - <span class="count">{{ placed().cards.dep.filed ? 3 : 2 }}</span> - </div> - </div> - <div - class="zone" - style="--c: var(--amber-rgb); left: 388px" - [class.drop-target]="placed().cards.db.dropping" - > - <div class="zone-head"> - <span class="sw"></span>{{ w().db }} - <span class="count">{{ placed().cards.db.filed ? 3 : 2 }}</span> - </div> - </div> - <div - class="zone" - style="--c: var(--purple-rgb); left: 752px" - [class.drop-target]="placed().cards.front.dropping" - > - <div class="zone-head"> - <span class="sw"></span>{{ w().front }} - <span class="count">{{ placed().cards.front.filed ? 3 : 2 }}</span> - </div> - </div> - - <div class="card" style="left: 36px; top: 98px"> - <div class="card-top"><span class="tick"></span><strong>{{ w().release }}</strong></div> - <div class="bar"><span></span></div> - <div class="items"> - @for (item of w().releaseItems; track item) { - <span>{{ item }}</span> - } - </div> - <div class="card-foot"><span>{{ w().now }}</span><span>#ci</span></div> - </div> - <div class="card" style="left: 204px; top: 98px"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().postgres }}</strong - ><span class="chip-lang l-sh">SH</span> - </div> - <pre><span class="k">docker</span> run --rm \ - -p <span class="n">5432</span>:<span class="n">5432</span> \ - -e PW=<span class="fld">{{ field('password') }}</span></pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#docker</span></div> - </div> - <div class="card" style="left: 400px; top: 98px"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().slow }}</strong - ><span class="chip-lang l-sql">SQL</span> - </div> - <pre><span class="k">SELECT</span> calls, - mean_exec_time -<span class="k">FROM</span> pg_stat_st…</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#sql</span></div> - </div> - <div class="card" style="left: 568px; top: 98px"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().diesel }}</strong - ><span class="chip-lang l-rs">RS</span> - </div> - <pre>conn.<span class="f">transaction</span>(|tx| { - <span class="k">let</span> id = <span class="f">insert</span>( - tx, &note)?;</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#rust</span></div> - </div> - <div class="card" style="left: 764px; top: 98px"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().debounce }}</strong - ><span class="chip-lang l-js">JS</span> - </div> - <pre><span class="k">const</span> <span class="f">debounce</span> = - (fn, ms) => { - <span class="k">let</span> at;</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#js</span></div> - </div> - <div class="card" style="left: 932px; top: 98px"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().store }}</strong><span class="chip-lang l-ts">TS</span> - </div> - <pre><span class="k">export class</span> - <span class="f">CounterStore</span> { - count = <span class="f">signal</span>(<span class="n">0</span>);</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#angular</span></div> - </div> - - <div class="card loose" style="left: 24px; top: 400px"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().ssh }}</strong><span class="chip-lang l-sh">SH</span> - </div> - <pre><span class="k">ssh</span> -p <span class="fld">{{ field('port=22') }}</span> -<span class="fld">{{ field('user') }}</span>@<span class="fld">{{ field('host') }}</span></pre> - <div class="card-foot"><span>OpenSSH</span><span>#ops</span></div> - </div> - <div - class="card loose mover" - style="left: 192px; top: 400px" - [style.transform]="placed().cards.dep.transform" - [class.lifted]="placed().cards.dep.lifted" - > - <div class="card-top"> - <span class="tick"></span><strong>{{ w().cargo }}</strong - ><span class="chip-lang l-yml">YML</span> - </div> - <pre>- <span class="f">uses</span>: <span class="s">actions/cache@v4</span> - <span class="f">with</span>: - <span class="f">path</span>: <span class="s">~/.cargo</span></pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#ci #rust</span></div> - </div> - <div - class="card loose mover" - style="left: 360px; top: 400px" - [style.transform]="placed().cards.db.transform" - [class.lifted]="placed().cards.db.lifted" - > - <div class="card-top"> - <span class="tick"></span><strong>{{ w().tunnel }}</strong - ><span class="chip-lang l-sh">SH</span> - </div> - <pre><span class="k">ssh</span> -N -L <span class="n">5433</span>: -<span class="fld">{{ field('db_host') }}</span>:<span class="n">5432</span> -<span class="fld">{{ field('user') }}</span>@bastion</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#ops #sql</span></div> - </div> - <div - class="card loose mover" - style="left: 528px; top: 400px" - [style.transform]="placed().cards.front.transform" - [class.lifted]="placed().cards.front.lifted" - > - <div class="card-top"> - <span class="tick"></span><strong>{{ w().focus }}</strong - ><span class="chip-lang l-css">CSS</span> - </div> - <pre>:<span class="f">focus-visible</span> { - outline: <span class="n">2px</span> - solid <span class="f">var</span>(…);</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#a11y</span></div> - </div> - <div class="card loose" style="left: 696px; top: 400px"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().undo }}</strong><span class="chip-lang l-sh">SH</span> - </div> - <pre><span class="k">git</span> reset --soft - HEAD~<span class="n">1</span> -<span class="k">git</span> restore --staged</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#git</span></div> - </div> - - <svg - class="cursor" - [class.on]="placed().cursor" - [style.transform]="placed().cursor" - viewBox="0 0 24 24" - aria-hidden="true" - > - <path - d="M5 2.5 19 11l-6.3 1.7L9.6 19z" - fill="#f4f5f8" - stroke="#15171c" - stroke-width="1.6" - stroke-linejoin="round" - /> - </svg> - </div> - </div> - - <div class="phone-window" role="img" [attr.aria-label]="w().phone"> - <div class="titlebar"> - <span class="areas" - ><span class="on">{{ w().notes }}</span><span>{{ w().tools }}</span><span>HTTP</span></span - > - <span class="controls"><i></i><i></i><i></i></span> - </div> - <div class="toolbar"> - <span class="space">{{ w().platform }}</span> - <span class="views"><span>{{ w().list }}</span><span class="on">{{ w().board }}</span></span> - </div> - <div class="phone-board" #phoneBoard> - <div class="zone" style="--c: var(--amber-rgb)" [class.drop-target]="placed().cards.db.dropping"> - <div class="zone-head"> - <span class="sw"></span>{{ w().db }} - <span class="count">{{ placed().cards.db.filed ? 3 : 2 }}</span> - </div> - <div class="slots"> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().slow }}</strong - ><span class="chip-lang l-sql">SQL</span> - </div> - <pre><span class="k">SELECT</span> calls, - mean_exec_time</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#sql</span></div> - </div> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().diesel }}</strong - ><span class="chip-lang l-rs">RS</span> - </div> - <pre>conn.<span class="f">transaction</span>( - |tx| <span class="f">insert</span>(tx))?;</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#rust</span></div> - </div> - <div class="slot" #phoneSlot></div> - </div> - </div> - <span class="untriaged">{{ w().toFile(placed().cards.db.filed ? 1 : 2) }}</span> - <div class="slots loose-row"> - <div - class="card loose mover" - #phoneCard - [style.transform]="placed().cards.db.transform" - [class.lifted]="placed().cards.db.lifted" - > - <div class="card-top"> - <span class="tick"></span><strong>{{ w().tunnel }}</strong - ><span class="chip-lang l-sh">SH</span> - </div> - <pre><span class="k">ssh</span> -N -L <span class="n">5433</span>: -<span class="fld">{{ field('db_host') }}</span>:<span class="n">5432</span></pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#ops</span></div> - </div> - <div class="card loose"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().ssh }}</strong><span class="chip-lang l-sh">SH</span> - </div> - <pre><span class="k">ssh</span> -p <span class="fld">{{ field('port=22') }}</span> -<span class="fld">{{ field('user') }}</span>@<span class="fld">{{ field('host') }}</span></pre> - <div class="card-foot"><span>OpenSSH</span><span>#ops</span></div> - </div> - </div> - - <svg - class="cursor" - [class.on]="placed().cursor" - [style.transform]="placed().cursor" - viewBox="0 0 24 24" - aria-hidden="true" - > - <path - d="M5 2.5 19 11l-6.3 1.7L9.6 19z" - fill="#f4f5f8" - stroke="#15171c" - stroke-width="1.6" - stroke-linejoin="round" - /> - </svg> - </div> - </div> - </div> - </div> -</div> diff --git a/website/src/app/home/hero-board.scss b/website/src/app/home/hero-board.scss deleted file mode 100644 index 94da3fd01..000000000 --- a/website/src/app/home/hero-board.scss +++ /dev/null @@ -1,469 +0,0 @@ -// The one place the page holds a moment: the window stays centred while its cards are filed. -.track { - position: relative; - height: calc(var(--bh, 640px) + 160vh); - margin-top: clamp(32px, 5vw, 56px); -} - -.pin { - position: sticky; - top: max(calc(var(--head-h) + 12px), calc((100vh + var(--head-h) - var(--bh, 640px)) / 2)); -} - -// Clipped rather than scrolled: the window is never panned. The margin keeps its shadow. -.scroller { - overflow: clip; - overflow-clip-margin: 64px; -} - -// The application's window, drawn at its own size and scaled to the column by `HeroBoard`; the -// steps below are its defaults before the script has measured anything. -.app-window { - display: grid; - grid-template-columns: 210px 1120px; - grid-template-rows: 34px 50px 552px; - grid-template-areas: - 'title title' - 'rail tools' - 'rail board'; - width: max-content; - margin-inline: auto; - border: 1px solid var(--line); - border-radius: 12px; - overflow: hidden; - background: var(--bg-1); - box-shadow: var(--shadow); - zoom: 0.85; -} - -.titlebar { - grid-area: title; - display: flex; - align-items: center; - gap: 18px; - padding: 0 12px; - border-bottom: 1px solid var(--line-soft); - font-size: 12px; - color: var(--text-2); -} - -.menus { - display: flex; - gap: 14px; -} - -.areas, -.views, -.filters { - display: inline-flex; - gap: 2px; - padding: 2px; - border: 1px solid var(--line); - border-radius: 7px; -} - -.areas { - margin-left: auto; -} - -.areas span, -.views span, -.filters span { - padding: 3px 10px; - border-radius: 5px; -} - -.areas .on, -.filters .on { - background: var(--bg-3); - color: var(--text-0); -} - -.controls { - margin-left: auto; - display: flex; - align-items: center; - gap: 16px; -} - -.controls i { - position: relative; - width: 10px; - height: 10px; -} - -// Minimise, maximise, close: a line, a square, a cross. -.controls i:nth-child(1)::before { - content: ''; - position: absolute; - left: 0; - right: 0; - top: 5px; - border-top: 1.4px solid currentColor; -} - -.controls i:nth-child(2) { - border: 1.4px solid currentColor; - border-radius: 2px; -} - -.controls i:nth-child(3)::before, -.controls i:nth-child(3)::after { - content: ''; - position: absolute; - left: -1px; - right: -1px; - top: 4px; - border-top: 1.4px solid currentColor; - transform: rotate(45deg); -} - -.controls i:nth-child(3)::after { - transform: rotate(-45deg); -} - -.rail { - grid-area: rail; - display: grid; - gap: 2px; - align-content: start; - padding: 12px 8px; - border-right: 1px solid var(--line-soft); - font-size: 13px; -} - -.rail-h { - padding: 2px 8px 6px; - font-size: 11.5px; - font-weight: 650; - color: var(--text-2); -} - -.rail .row { - display: flex; - align-items: center; - gap: 8px; - padding: 6px 8px; - border-radius: 6px; - color: var(--text-1); - white-space: nowrap; -} - -.rail .row.sub { - padding-left: 22px; -} - -.rail .row.on { - background: rgba(var(--amber-rgb), 0.13); - color: var(--amber-text); - font-weight: 600; -} - -.rail .sw { - flex: none; - width: 8px; - height: 8px; - border-radius: 2px; - background: rgb(var(--c)); -} - -.rail b { - margin-left: auto; - font-weight: 500; - color: var(--text-2); - font-variant-numeric: tabular-nums; -} - -.rail-foot { - margin-top: 12px; - padding: 10px 8px 0; - border-top: 1px solid var(--line-soft); - color: var(--text-2); -} - -.toolbar { - grid-area: tools; - display: flex; - align-items: center; - gap: 10px; - padding: 0 14px; - border-bottom: 1px solid var(--line-soft); - font-size: 12.5px; - color: var(--text-1); -} - -.views .on { - background: var(--amber-fill); - color: var(--amber-ink); - font-weight: 600; -} - -.search { - flex: 0 1 300px; - display: flex; - align-items: center; - gap: 4px; - min-height: 30px; - padding: 0 8px 0 10px; - border: 1px solid var(--line); - border-radius: 7px; - background: var(--bg-0); - color: var(--text-2); -} - -.search kbd:first-of-type { - margin-left: auto; -} - -.search kbd { - font-size: 10px; -} - -.new { - margin-left: auto; - padding: 6px 12px; - border-radius: 7px; - background: var(--amber-fill); - color: var(--amber-ink); - font-weight: 650; -} - -// The canvas the folders are drawn on. -.board { - grid-area: board; - position: relative; - width: 1120px; - height: 552px; - background-color: var(--bg-0); - background-image: radial-gradient(var(--dot) 1.1px, transparent 1.4px); - background-size: 16px 16px; -} - -.board .zone { - position: absolute; - top: 48px; - width: 344px; - height: 330px; -} - -.zone { - transition: - background-color var(--motion), - border-color var(--motion); -} - -.zone.drop-target { - background: rgba(var(--c), 0.15); - border-color: rgb(var(--c)); -} - -.card { - box-shadow: var(--shadow-soft); -} - -.board .card { - position: absolute; -} - -.card.loose { - box-shadow: none; -} - -.card.mover { - z-index: 2; -} - -.card.lifted { - z-index: 3; - box-shadow: var(--shadow); - border-color: var(--line); -} - -.board .untriaged { - position: absolute; - left: 24px; - top: 12px; -} - -.untriaged { - display: inline-flex; - align-items: center; - gap: 8px; - padding: 4px 10px; - border-radius: 999px; - background: var(--bg-2); - border: 1px solid var(--line); - font-size: 12px; - font-weight: 600; - color: var(--text-1); -} - -.untriaged::before { - content: ''; - width: 7px; - height: 7px; - border-radius: 50%; - background: var(--amber-fill); -} - -.cursor { - position: absolute; - left: 0; - top: 0; - z-index: 5; - width: 22px; - height: 22px; - pointer-events: none; - opacity: 0; - filter: drop-shadow(0 2px 3px rgba(var(--black-rgb), 0.45)); -} - -.cursor.on { - opacity: 1; -} - -@media (min-width: 1500px) { - .app-window { - zoom: 1; - } -} - -@media (min-width: 1800px) { - .app-window { - zoom: 1.12; - } -} - -@media (min-width: 2100px) { - .app-window { - zoom: 1.25; - } -} - -// A tablet: the window without its rail, the board taking the room. -@media (max-width: 1099px) { - .app-window { - grid-template-columns: 1120px; - grid-template-areas: - 'title' - 'tools' - 'board'; - zoom: 0.75; - } - - .rail { - display: none; - } -} - -.phone-window { - display: none; -} - -// A phone: a window drawn for its width, one folder and the note filed into it, at a size -// that reads. -@media (max-width: 720px) { - .track { - height: calc(var(--bh, 540px) + 90vh); - } - - .app-window { - display: none; - } - - .phone-window { - display: block; - max-width: 440px; - margin-inline: auto; - border: 1px solid var(--line); - border-radius: 12px; - overflow: hidden; - background: var(--bg-1); - box-shadow: var(--shadow); - } - - .phone-window .titlebar { - height: 34px; - } - - .phone-window .areas { - margin-left: 0; - } - - .phone-window .toolbar { - justify-content: space-between; - height: 44px; - } - - .space { - font-weight: 650; - color: var(--text-0); - } - - .phone-board { - position: relative; - display: grid; - gap: 10px; - padding: 12px; - background-color: var(--bg-0); - background-image: radial-gradient(var(--dot) 1.1px, transparent 1.4px); - background-size: 16px 16px; - } - - .slots { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 8px; - } - - .zone .slots { - padding: 0 10px 10px; - } - - // Under the folder's own columns: the note filed rises straight into its place. - .loose-row { - padding-inline: 11px; - } - - .phone-board .card, - .slot { - width: auto; - height: 112px; - } - - .phone-board .card { - font-size: 12px; - } - - .phone-board .card-top strong { - font-size: 12.5px; - } - - .phone-board .card-top .chip-lang { - font-size: 9.5px; - } - - .phone-board .card pre { - font-size: 11px; - line-height: 1.55; - } - - .phone-board .card-foot { - font-size: 10.5px; - } - - .phone-board .untriaged { - justify-self: start; - height: 26px; - } -} - -@media (prefers-reduced-motion: reduce) { - .track { - height: auto; - } - - .pin { - position: static; - } -} diff --git a/website/src/app/home/hero-board.ts b/website/src/app/home/hero-board.ts deleted file mode 100644 index 726105e18..000000000 --- a/website/src/app/home/hero-board.ts +++ /dev/null @@ -1,179 +0,0 @@ -import { - ChangeDetectionStrategy, - Component, - DestroyRef, - ElementRef, - afterNextRender, - computed, - inject, - signal, - viewChild, -} from '@angular/core'; - -import { clamp, ease, field, matches, part, prefersReducedMotion } from '../core/browser'; -import { Language } from '../core/language'; -import { ScrollFrame } from '../core/scroll-frame'; -import { BOARD_WORDS } from './board-words'; - -type Folder = 'dep' | 'db' | 'front'; - -/** The window as drawn: its rail and board side by side, then the board alone on a tablet. */ -const WINDOW = { width: 1332, height: 638 } as const; -const BOARD_ONLY = 1122; - -/** As large as the column allows and the screen can show at once while it is held, within reason. */ -const LARGEST = 1.6; - -/** Kept clear around the window while it is held: the header, and a little air. */ -const AIR = 140; - -/** The stylesheet's own breakpoints: the rail goes first, then the whole window. */ -const TABLET = '(max-width: 1099px)'; -const PHONE = '(max-width: 720px)'; - -/** Where the cursor takes a card: a little inside its top left corner. */ -const GRIP: readonly [number, number] = [92, 30]; - -/** Where the cursor comes from before it takes the first card, from that card's grip. */ -const APPROACH = { window: [220, -150], phone: [70, -120] } as const; - -interface Move { - readonly folder: Folder; - readonly from: readonly [number, number]; - readonly to: readonly [number, number]; -} - -/** The three loose notes, in the order the cursor files them, from where they lie to their folder. */ -const MOVES: readonly Move[] = [ - { folder: 'db', from: [360, 400], to: [400, 238] }, - { folder: 'front', from: [528, 400], to: [764, 238] }, - { folder: 'dep', from: [192, 400], to: [36, 238] }, -]; - -interface Placed { - readonly transform: string; - readonly lifted: boolean; - /** Its folder lights up while the card hovers over it. */ - readonly dropping: boolean; - readonly filed: boolean; -} - -const AT_REST: Placed = { transform: 'none', lifted: false, dropping: false, filed: false }; - -/** - * The hero: a tidy board, and three notes left at the bottom that a cursor files one by - * one. The one place the page holds a moment: the board stays centred while the scroll - * moves the cards, then lets go. - */ -@Component({ - selector: 'app-hero-board', - templateUrl: './hero-board.html', - styleUrl: './hero-board.scss', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class HeroBoard { - protected readonly field = field; - /** 0 with every note loose, 1 with all of them filed. */ - private readonly sorted = signal(0); - private readonly lang = inject(Language).lang; - protected readonly w = computed(() => BOARD_WORDS[this.lang()]); - /** A phone sees one folder drawn for it, and the one note filed there, measured where it lies. */ - private readonly phone = signal<Move | null>(null); - - private readonly track = viewChild.required<ElementRef<HTMLElement>>('track'); - private readonly pin = viewChild.required<ElementRef<HTMLElement>>('pin'); - private readonly scroller = viewChild.required<ElementRef<HTMLElement>>('scroller'); - private readonly frame = viewChild.required<ElementRef<HTMLElement>>('frame'); - private readonly phoneCard = viewChild.required<ElementRef<HTMLElement>>('phoneCard'); - private readonly phoneSlot = viewChild.required<ElementRef<HTMLElement>>('phoneSlot'); - - protected readonly placed = computed(() => { - const p = this.sorted(); - const phone = this.phone(); - const moves = phone ? [phone] : MOVES; - const approach = phone ? APPROACH.phone : APPROACH.window; - const placed: Record<Folder, Placed> = { dep: AT_REST, db: AT_REST, front: AT_REST }; - let pointer: readonly [number, number] | null = null; - - for (const [i, move] of moves.entries()) { - const local = clamp(p * moves.length - i); - const carried = ease(part(local, 0.3, 0.85)); - const dx = (move.to[0] - move.from[0]) * carried; - const dy = (move.to[1] - move.from[1]) * carried; - const lifted = local > 0.25 && local < 0.9; - placed[move.folder] = { - transform: `translate(${dx}px, ${dy}px)${lifted ? ' scale(1.04) rotate(1.5deg)' : ''}`, - lifted, - dropping: local > 0.6 && local < 0.92, - filed: local >= 0.9, - }; - if (pointer || local <= 0 || local >= 1) continue; - - const grab = [move.from[0] + GRIP[0], move.from[1] + GRIP[1]] as const; - if (local < 0.25) { - // On its way to the card: from where it dropped the last one, or from above the first. - const previous = moves[i - 1]; - const before: readonly [number, number] = previous - ? [previous.to[0] + GRIP[0], previous.to[1] + GRIP[1]] - : [grab[0] + approach[0], grab[1] + approach[1]]; - const t = ease(local / 0.25); - pointer = [before[0] + (grab[0] - before[0]) * t, before[1] + (grab[1] - before[1]) * t]; - } else { - pointer = [grab[0] + dx, grab[1] + dy]; - } - } - - return { - cards: placed, - filed: Object.values(placed).filter((card) => card.filed).length, - cursor: pointer ? `translate(${pointer[0]}px, ${pointer[1]}px)` : null, - }; - }); - - constructor() { - const frame = inject(ScrollFrame); - const destroyRef = inject(DestroyRef); - - afterNextRender(() => { - const fit = () => { - if (matches(PHONE)) { - this.phone.set(this.measurePhone()); - } else { - const width = this.scroller().nativeElement.clientWidth; - const drawn = matches(TABLET) ? BOARD_ONLY : WINDOW.width; - const zoom = Math.min(LARGEST, width / drawn, (innerHeight - AIR) / WINDOW.height); - this.frame().nativeElement.style.setProperty('zoom', zoom.toFixed(3)); - this.phone.set(null); - } - this.track().nativeElement.style.setProperty('--bh', `${this.pin().nativeElement.offsetHeight}px`); - }; - fit(); - addEventListener('resize', fit); - destroyRef.onDestroy(() => removeEventListener('resize', fit)); - - if (prefersReducedMotion()) { - this.sorted.set(1); - return; - } - destroyRef.onDestroy(frame.watch(() => this.sorted.set(this.progress()))); - }); - } - - /** The phone's note, from where it lies to the free place in its folder, in board pixels. */ - private measurePhone(): Move { - // Offsets rather than rectangles: the card may be carried, and a transform moves its rectangle. - const card = this.phoneCard().nativeElement; - const slot = this.phoneSlot().nativeElement; - return { folder: 'db', from: [card.offsetLeft, card.offsetTop], to: [slot.offsetLeft, slot.offsetTop] }; - } - - /** How far the cards have moved: only while the board is held in the middle of the screen. */ - private progress(): number { - const pin = this.pin().nativeElement; - const track = this.track().nativeElement.getBoundingClientRect(); - const stuckAt = parseFloat(getComputedStyle(pin).top) || 80; - const releasedAt = stuckAt - (track.height - pin.offsetHeight); - const from = stuckAt + 40; - return clamp((from - track.top) / (from - releasedAt)); - } -} diff --git a/website/src/app/home/home-page.html b/website/src/app/home/home-page.html index a34bd0f62..4332b03e1 100644 --- a/website/src/app/home/home-page.html +++ b/website/src/app/home/home-page.html @@ -1,183 +1,106 @@ -<section class="hero" aria-labelledby="hero-h"> - <div class="wrap hero-text"> - <h1 id="hero-h">{{ t().headline }}</h1> +@let text = t(); +<section class="sec" id="app" aria-labelledby="hero-h"> + <div class="sec-h col"> + <span><b>01</b> / {{ text.section }}</span><span>Version {{ version }}</span> + </div> + <div class="hero col"> + <h1 id="hero-h">{{ text.headline }}</h1> <div class="hero-side"> - <p class="lede">{{ t().lede }}</p> + <p class="lede">{{ text.lede }}</p> @if (offer(); as get) { <div class="cta-row"> - <a class="btn btn-primary get" [href]="get.primary.url" - ><span>{{ t().downloadFor }} {{ get.label }}</span><span class="ver">v{{ version }}</span></a - > - <a class="btn btn-ghost" [routerLink]="links().docs">{{ t().docs }}</a> + <a class="btn btn-primary" [href]="get.primary.url" + >{{ text.downloadFor }} {{ get.label }} @if (note(get); as says) { + <small>{{ says }}</small> + } + </a> + <a class="btn btn-ghost" [routerLink]="downloadPath()">{{ text.others }}</a> </div> } <ul class="facts"> - @for (fact of t().facts; track fact; let i = $index) { - <li> - @if (i === t().sourceFact) { - <a [href]="repository">{{ fact }}</a> - } @else { - <span>{{ fact }}</span> - } - </li> + <li><a [href]="repository">{{ text.free }}</a></li> + @for (fact of text.facts; track fact) { + <li>{{ fact }}</li> } - <li class="more"> - <a [routerLink]="links().download">{{ t().others }}</a> - </li> + <li>{{ systems() }}</li> </ul> </div> </div> - <app-hero-board /> + <div class="screen col"> + <figure class="shot"> + <picture> + <source + type="image/webp" + [attr.media]="lightWhen()" + [attr.srcset]="srcset('light')" + sizes="(min-width: 1380px) 1300px, 100vw" + /> + <img + [src]="file('dark', shot.width)" + [attr.srcset]="srcset('dark')" + sizes="(min-width: 1380px) 1300px, 100vw" + width="2168" + height="1362" + [alt]="text.alt" + fetchpriority="high" + /> + </picture> + @for (mark of marks(); track $index; let i = $index) { + <span + class="mark" + [class.on]="pointed() === i" + [style.left.%]="mark[0]" + [style.top.%]="mark[1]" + aria-hidden="true" + >{{ i + 1 }}</span + > + } + </figure> + </div> + <ol class="legend cells" [attr.aria-label]="text.legendName"> + @for (item of text.legend; track item.name; let i = $index) { + <li (mouseenter)="pointed.set(i)" (mouseleave)="pointed.set(-1)"> + <span class="n" aria-hidden="true">{{ i + 1 }}</span> + <b class="name">{{ item.name }}</b> + <p><app-runs [runs]="item.text" /></p> + </li> + } + </ol> </section> -<app-feature - anchor="snippets" - tone="green" - [label]="t().snippets.label" - [heading]="t().snippets.heading" - [steps]="t().snippets.steps" - [durations]="[1150, 1550, 1700, 1200]" -> - @if (lang() === 'fr') { - <p lede> - Un snippet peut contenir des champs comme <code>{{ field('host') }}</code> ou - <code>{{ field('port=22') }}</code>. DevNotes vous demande leurs valeurs, puis copie la commande complète. - Depuis n'importe quelle application, avec - <span class="keys"><kbd>Ctrl</kbd><kbd>Alt</kbd><kbd>P</kbd></span - >. - </p> - } @else { - <p lede> - A snippet can hold fields like <code>{{ field('host') }}</code> or <code>{{ field('port=22') }}</code>. - DevNotes asks for their values, then copies the whole command. From any application, with - <span class="keys"><kbd>Ctrl</kbd><kbd>Alt</kbd><kbd>P</kbd></span - >. - </p> - } - <app-snippets-scene /> -</app-feature> - -<app-feature - anchor="ranger" - tone="blue" - wide - [label]="t().organise.label" - [heading]="t().organise.heading" - [steps]="t().organise.steps" - [durations]="[1100, 1350, 1450, 1200]" -> - @if (lang() === 'fr') { - <p lede> - Un espace par contexte, des dossiers dedans, et une vue Tableau où chaque dossier est une zone. La - recherche lit les titres, le code, les listes et les tags. - </p> - } @else { - <p lede> - A space for each context, folders inside it, and a Board view where each folder is a zone. The search - reads titles, code, lists and tags. - </p> - } - <app-organise-scene /> -</app-feature> - -<app-feature - anchor="code" - tone="purple" - flip - [label]="t().code.label" - [heading]="t().code.heading" - [steps]="t().code.steps" - [durations]="[1700, 1350, 1950]" -> - @if (lang() === 'fr') { - <p lede> - Vingt-six langages colorés, Prettier en un clic, et vos JSON, YAML, TOML ou XML lisibles en graphe à côté - du code. - </p> - } @else { - <p lede> - Twenty-six highlighted languages, Prettier in one click, and your JSON, YAML, TOML or XML readable as a - graph beside the code. - </p> - } - <app-code-scene /> -</app-feature> - -<app-feature - anchor="outils" - tone="teal" - [label]="t().tools.label" - [heading]="t().tools.heading" - [steps]="t().tools.steps" - [durations]="[1300, 1800, 1700, 1700]" -> - @if (lang() === 'fr') { - <p lede> - Encoder, hacher, convertir, lire une date ou une expression cron. Chaque outil tourne sur votre machine et - n'appelle rien. Un résultat se garde comme une note. - </p> - } @else { - <p lede> - Encode, hash, convert, read a date or a cron expression. Every tool runs on your machine and calls - nothing. A result can be kept as a note. - </p> - } - <app-tools-scene /> -</app-feature> - -<app-feature - anchor="client-api" - tone="olive" - wide - [label]="t().api.label" - [heading]="t().api.heading" - [steps]="t().api.steps" - [durations]="[1350, 1600, 1700, 1600]" -> - @if (lang() === 'fr') { - <p lede> - HTTP, GraphQL et WebSocket, avec des collections, des environnements et des variables. L'historique est - chiffré comme le reste. - </p> - } @else { - <p lede> - HTTP, GraphQL and WebSocket, with collections, environments and variables. The history is encrypted like - everything else. - </p> - } - <app-api-scene /> -</app-feature> +<app-day-section /> -<app-feature - anchor="chiffrement" - tone="pink" - flip - [label]="t().vault.label" - [heading]="t().vault.heading" - [steps]="t().vault.steps" - [durations]="[1450, 1700, 1350]" -> - @if (lang() === 'fr') { - <p lede> - Vos notes sont chiffrées sur le disque, derrière une phrase de passe que DevNotes n'enregistre nulle part. - Pas de compte, pas de cloud. Perdue, elle ne se récupère pas : gardez un export. - </p> - } @else { - <p lede> - Your notes are encrypted on disk, behind a passphrase DevNotes stores nowhere. No account, no cloud. Lost, - it cannot be recovered: keep an export. - </p> - } - <app-vault-scene /> -</app-feature> - -<app-more-section /> - -<section class="wrap closing" aria-labelledby="closing-h"> - <h2 id="closing-h">{{ t().closing }}</h2> - <p class="lede">{{ t().closingLede(version) }}</p> - <div class="cta-row"> - <a class="btn btn-primary" [routerLink]="links().download">{{ t().closingDownload }}</a> - <a class="btn btn-ghost" [routerLink]="links().docs">{{ t().docs }}</a> +<section class="sec" id="telecharger" aria-labelledby="get-h"> + <div class="sec-h col"> + <span><b>03</b> / {{ text.get }}</span><span>{{ text.free }}</span> + </div> + <div class="get col"> + <div> + <h2 id="get-h">{{ text.getHeading(version) }}</h2> + <p>{{ text.getLede }}</p> + </div> + @if (offer(); as get) { + <a class="btn btn-primary" [href]="get.primary.url" + >{{ text.downloadFor }} {{ get.label }} @if (note(get); as says) { + <small>{{ says }}</small> + } + </a> + } + </div> + <div class="oses cells" [style.--count]="offers().length + 1"> + @for (system of offers(); track system.system) { + <div class="os"> + <h3>{{ system.label }}</h3> + @for (each of system.files; track each.file) { + <a [href]="each.url"><span>{{ each.name }}</span><span>{{ each.size }}</span></a> + } + </div> + } + <div class="os"> + <h3>{{ text.code }}</h3> + <p>{{ text.codeText }}</p> + <a [href]="repository"><span>{{ text.source }}</span><span>GitHub</span></a> + <a [href]="releasePage"><span>{{ text.notes }}</span><span>{{ version }}</span></a> + </div> </div> </section> diff --git a/website/src/app/home/home-page.scss b/website/src/app/home/home-page.scss index b2e99dfee..a96063ad2 100644 --- a/website/src/app/home/home-page.scss +++ b/website/src/app/home/home-page.scss @@ -1,90 +1,237 @@ +// The opening: what it is, the screen itself, and what each part of it does. .hero { - padding-top: clamp(40px, 7vw, 88px); + display: grid; + grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); + align-items: end; + gap: 28px 64px; + padding-block: clamp(44px, 5vw, 64px) clamp(36px, 4vw, 56px); } -.hero-text { +.hero-side { display: grid; gap: 22px; } -.hero-text h1 { - max-width: 13em; +// The two buttons one above the other at every width: side by side, whether they fit would depend on +// the face, and the page would move when Inter replaces its stand-in. +.hero .cta-row { + flex-direction: column; + align-items: flex-start; } -.hero-side { +.btn small { + font-weight: 450; + font-size: 13px; + opacity: 0.75; +} + +.facts { + display: flex; + flex-wrap: wrap; + gap: 4px 18px; + font-size: 14px; + color: var(--text-2); +} + +.facts a { + color: inherit; + text-underline-offset: 3px; +} + +.screen { + padding-bottom: 8px; +} + +.shot { + position: relative; + border: 1px solid var(--line); + border-radius: 12px; + background: var(--bg-1); + box-shadow: 0 50px 90px -60px rgba(var(--black-rgb), 0.6); +} + +.shot img { + display: block; + width: 100%; + height: auto; + border-radius: 11px; +} + +.mark { + position: absolute; display: grid; - gap: 22px; + place-items: center; + width: 28px; + height: 28px; + margin: -14px 0 0 -14px; + border-radius: 50%; + background: var(--amber-fill); + color: var(--amber-ink); + font: 650 13px var(--font-mono); + box-shadow: + 0 0 0 4px rgba(var(--amber-rgb), 0.3), + 0 6px 16px -6px rgba(var(--black-rgb), 0.5); + transition: + transform var(--motion), + box-shadow var(--motion); } -// A wide screen sets the promise beside the headline rather than under it, and shows more of -// the window in the first screen. -@media (min-width: 1200px) { - .hero-text { - grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); - column-gap: clamp(48px, 5vw, 112px); - align-items: end; - } +.mark.on { + transform: scale(1.18); + box-shadow: + 0 0 0 8px rgba(var(--amber-rgb), 0.34), + 0 6px 16px -6px rgba(var(--black-rgb), 0.5); +} - .hero-text h1 { - max-width: none; - } +// Six cells with hairlines: each mark's name and what it does. +.legend { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 1px; + margin-top: clamp(32px, 4vw, 48px); + border-top: 1px solid var(--line-soft); + // The gap between the cells is the hairline: the line's colour shows through it, not in the gutters. + background: var(--line-soft) content-box; } -// The end of the page: no frame, the two ways on. -.closing { +.legend li { display: grid; - gap: 20px; - justify-items: start; - padding-top: clamp(110px, 16vh, 190px); + grid-template-columns: auto minmax(0, 1fr); + align-content: start; + gap: 8px 14px; + padding: 28px var(--pad) 32px; + background: var(--bg-0); } +.legend .n { + grid-row: span 2; + display: grid; + place-items: center; + width: 28px; + height: 28px; + border: 1px solid var(--amber-edge); + border-radius: 50%; + color: var(--amber-text); + font: 600 13px var(--font-mono); + transition: + background-color var(--motion-fast), + color var(--motion-fast); +} + +.legend li:hover .n { + background: var(--amber-fill); + color: var(--amber-ink); +} + +.legend .name { + align-self: center; + font-size: 17.5px; + line-height: 1.3; + font-weight: 600; + letter-spacing: -0.01em; +} + +.legend p { + grid-column: 2; + font-size: 15.5px; + line-height: 1.6; + color: var(--text-1); +} + +// Downloading: one cell a system, every file with its size, and the code beside them. .get { - gap: 10px; + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + align-items: end; + gap: 24px 48px; + padding-block: clamp(48px, 6vw, 64px) clamp(40px, 5vw, 56px); } -.ver { - padding: 2px 7px; - border-radius: 999px; - background: rgba(var(--black-rgb), 0.14); - font: 600 12px var(--font-mono); +.get h2 { + max-width: 18ch; } -// What makes it worth a try, said where the eye already is. -.facts { - display: flex; - flex-wrap: wrap; - gap: 8px; +.get p { + max-width: 52ch; + margin-top: 14px; + font-size: 17px; + color: var(--text-1); } -.facts li { - display: inline-flex; +.oses { + display: grid; + grid-template-columns: repeat(var(--count, 3), minmax(0, 1fr)); + gap: 1px; + border-top: 1px solid var(--line-soft); + background: var(--line-soft) content-box; +} + +.os { + display: grid; + align-content: start; + gap: 4px; + padding: 28px var(--pad) 36px; + background: var(--bg-0); +} + +.os h3 { + margin-bottom: 10px; + font-size: 18px; +} + +.os a { + display: flex; + justify-content: space-between; align-items: center; - gap: 7px; - min-height: 32px; - padding: 0 12px; - border: 1px solid var(--line); - border-radius: 999px; - color: var(--text-1); - font-size: 14px; - font-weight: 560; + gap: 16px; + min-height: 44px; + padding-block: 10px; + border-bottom: 1px solid var(--line-soft); + text-decoration: none; } -.facts li:not(.more)::before { - content: ''; - width: 9px; - height: 5px; - margin-top: -3px; - border-left: 2px solid var(--green); - border-bottom: 2px solid var(--green); - transform: rotate(-45deg); +.os a span:last-child { + font: 400 14px var(--font-mono); + white-space: nowrap; + color: var(--text-2); } -.facts a { - padding-block: 4px; - color: var(--text-0); - text-underline-offset: 3px; +.os a:hover span:first-child { + text-decoration: underline; + text-underline-offset: 4px; } -.facts .more { - border-style: dashed; +.os p { + font-size: 15px; + line-height: 1.6; + color: var(--text-1); +} + +@media (max-width: 1000px) { + .hero, + .get { + grid-template-columns: minmax(0, 1fr); + } + + .legend { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .oses { + grid-template-columns: minmax(0, 1fr); + } +} + +@media (max-width: 640px) { + .legend { + grid-template-columns: minmax(0, 1fr); + } + + .mark { + width: 20px; + height: 20px; + margin: -10px 0 0 -10px; + font-size: 11px; + box-shadow: 0 0 0 3px rgba(var(--amber-rgb), 0.3); + } } diff --git a/website/src/app/home/home-page.spec.ts b/website/src/app/home/home-page.spec.ts index ee9d009a4..9fde59af2 100644 --- a/website/src/app/home/home-page.spec.ts +++ b/website/src/app/home/home-page.spec.ts @@ -1,43 +1,88 @@ import { describe, expect, it } from 'vitest'; -import { accessibleName, renderPage } from '../../testing/render-page'; +import { renderPage } from '../../testing/render-page'; +import { DAY_TEXT } from './day/day-text'; +import { SCENE_WORDS } from './day/scene-words'; import { HomePage } from './home-page'; +/** Every key of a dictionary, nested ones as `a.b`, and how many items each list holds. */ +function shape(value: unknown, path = ''): string[] { + if (Array.isArray(value)) + return [`${path}[${value.length}]`, ...value.flatMap((item, i) => shape(item, `${path}.${i}`))]; + if (value && typeof value === 'object') + return Object.entries(value).flatMap(([key, item]) => shape(item, path ? `${path}.${key}` : key)); + return [path]; +} + describe('HomePage', () => { - it('has one h1, then a h2 for every section the progress line follows', async () => { + it('has one h1, then three sections, each named by its own heading', async () => { const page = await renderPage(HomePage); expect(page.querySelectorAll('h1')).toHaveLength(1); - const sections = [...page.querySelectorAll('section[id]')].map((section) => section.id); - expect(sections).toEqual([ - 'snippets', - 'ranger', - 'code', - 'outils', - 'client-api', - 'chiffrement', - 'et-aussi', - ]); - for (const id of sections) { - const section = page.querySelector(`section#${id}`); - expect(section?.querySelector('h2')).not.toBeNull(); - expect(section?.getAttribute('aria-labelledby')).toBe(section?.querySelector('h2')?.id); + const sections = [...page.querySelectorAll('section[id]')]; + expect(sections.map((section) => section.id)).toEqual(['app', 'journee', 'telecharger']); + for (const section of sections) { + const heading = section.querySelector(`#${section.getAttribute('aria-labelledby')}`); + expect(heading?.tagName).toMatch(/^H[12]$/); + expect(heading?.textContent?.trim()).not.toBe(''); + } + }); + + it('shows the application itself, described and at its own size, its six marks named by the legend', async () => { + const page = await renderPage(HomePage); + const capture = page.querySelector<HTMLImageElement>('.shot img'); + + expect(capture?.getAttribute('alt')).toMatch(/^DevNotes : /); + expect(capture?.getAttribute('width')).toBe('2168'); + expect(capture?.getAttribute('height')).toBe('1362'); + expect(capture?.getAttribute('srcset')).toContain('/shots/notes-fr-dark-1084.webp 1084w'); + expect(page.querySelector('.shot source')?.getAttribute('srcset')).toContain( + '/shots/notes-fr-light-2168.webp', + ); + const marks = [...page.querySelectorAll('.shot .mark')]; + expect(marks).toHaveLength(6); + for (const mark of marks) expect(mark.getAttribute('aria-hidden')).toBe('true'); + expect(page.querySelectorAll('.legend li')).toHaveLength(6); + }); + + it('tells the day in ten moments, each row named by its h3', async () => { + const page = await renderPage(HomePage); + const moments = [...page.querySelectorAll('article.mo')]; + + expect(moments).toHaveLength(10); + for (const moment of moments) { + const heading = moment.querySelector('h3'); + expect(heading?.id).toBe(moment.getAttribute('aria-labelledby')); + expect(moment.querySelector('time')?.textContent).toMatch(/^\d\d:\d\d$/); } }); - it('shows every feature’s steps as buttons a visitor can press', async () => { + it('keeps the scenes out of the accessibility tree, and shows them finished without a script', async () => { const page = await renderPage(HomePage); - const steps = [...page.querySelectorAll('.steps button')]; + const scenes = [...page.querySelectorAll('app-day-scene')]; - expect(steps).toHaveLength(22); - for (const step of steps) expect(accessibleName(step)).not.toBe(''); + expect(scenes).toHaveLength(10); + for (const scene of scenes) { + expect(scene.getAttribute('aria-hidden')).toBe('true'); + expect(scene.classList).toContain('scene'); + expect(scene.classList).not.toContain('anim'); + } + expect(page.querySelector('.rail')?.getAttribute('aria-hidden')).toBe('true'); }); - it('keeps the scenes out of the accessibility tree, and the board described', async () => { + it('offers every file of the release, each with its size', async () => { const page = await renderPage(HomePage); + const files = [...page.querySelectorAll<HTMLAnchorElement>('.os a[href*="/releases/download/"]')]; + + expect(files.length).toBeGreaterThanOrEqual(6); + for (const file of files) expect(file.querySelector('span:last-child')?.textContent).toMatch(/\d Mo$/); + }); + + it('tells the same day in both languages, scene for scene', () => { + const outline = (lang: 'fr' | 'en') => + DAY_TEXT[lang].moments.map(({ id, time, scene, tone }) => [id, time, scene, tone]); - for (const stage of page.querySelectorAll('.story-stage')) - expect(stage.getAttribute('aria-hidden')).toBe('true'); - expect(page.querySelector('[role="img"]')?.getAttribute('aria-label')).toContain('tableau'); + expect(outline('en')).toEqual(outline('fr')); + expect(shape(SCENE_WORDS.en)).toEqual(shape(SCENE_WORDS.fr)); }); }); diff --git a/website/src/app/home/home-page.ts b/website/src/app/home/home-page.ts index df2c2adc8..5980c2eb0 100644 --- a/website/src/app/home/home-page.ts +++ b/website/src/app/home/home-page.ts @@ -1,232 +1,207 @@ -import { - ChangeDetectionStrategy, - Component, - DOCUMENT, - DestroyRef, - afterNextRender, - computed, - inject, - signal, -} from '@angular/core'; +import { ChangeDetectionStrategy, Component, afterNextRender, computed, inject, signal } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { clamp, field } from '../core/browser'; import { Lang, downloadPath, homePath } from '../core/lang'; import { Language } from '../core/language'; -import { PageProgress, ProgressSegment } from '../core/page-progress'; -import { System, VERSION, offers, systems, visitorSystem } from '../core/release'; -import { ScrollFrame } from '../core/scroll-frame'; +import { Offer, RELEASE_PAGE, System, VERSION, offers, systems, visitorSystem } from '../core/release'; import { Seo } from '../core/seo'; import { REPOSITORY, absolute } from '../core/site'; -import { docPath } from '../docs/doc-index'; -import { Feature } from './feature'; -import { HeroBoard } from './hero-board'; -import { MoreSection } from './more-section'; -import { ApiScene } from './scenes/api-scene'; -import { CodeScene } from './scenes/code-scene'; -import { OrganiseScene } from './scenes/organise-scene'; -import { SnippetsScene } from './scenes/snippets-scene'; -import { ToolsScene } from './scenes/tools-scene'; -import { VaultScene } from './scenes/vault-scene'; +import { ThemeStore } from '../core/theme.store'; +import { DaySection } from './day/day-section'; +import { Run, Runs } from './runs'; -const FR = { - title: 'DevNotes : snippets, outils et client API pour développeurs', +interface HomeText { + readonly title: string; + readonly description: string; + readonly section: string; + readonly headline: string; + readonly lede: string; + readonly downloadFor: string; + readonly others: string; + readonly free: string; + readonly facts: readonly string[]; + readonly alt: string; + readonly legendName: string; + /** What each mark on the capture points at, in its order. */ + readonly legend: readonly { readonly name: string; readonly text: readonly Run[] }[]; + readonly get: string; + readonly getHeading: (version: string) => string; + readonly getLede: string; + readonly code: string; + readonly codeText: string; + readonly source: string; + readonly notes: string; +} + +const FR: HomeText = { + title: 'DevNotes : snippets, notes et client API pour développeurs', description: - 'Une application de bureau pour développeurs : snippets à champs, notes rangées en tableau, outils hors ligne et client API, chiffrés sur votre machine.', - headline: 'Le board où vivent vos snippets.', - lede: "Commandes, requêtes, bouts de code, notes et listes, rangés en espaces et en dossiers. Une trentaine d'outils et un client API à côté, le tout chiffré sur votre machine.", + 'Application de bureau pour développeurs : snippets à champs, notes Markdown, listes, calculs, dessins, client API et 32 outils, chiffrés sur votre machine.', + section: "L'application", + headline: 'Vos snippets, vos notes, vos requêtes.', + lede: "Une application de bureau pour tout ce qu'un développeur garde sous la main : des snippets à champs, des notes en Markdown, des listes, des calculs et des dessins, avec un client API et 32 outils à côté. Chiffrée sur votre machine, sans compte.", downloadFor: 'Télécharger pour', - docs: 'Lire la documentation', - facts: ['Gratuit', 'Libre, GPL-3.0', 'Sans compte', 'Hors ligne'], - /** The fact that links to the source code. */ - sourceFact: 1, others: 'Autres systèmes et formats', - snippets: { - label: 'Snippets à champs', - heading: 'Vos commandes, prêtes à coller.', - steps: [ - 'Un snippet avec deux champs', - 'DevNotes demande leurs valeurs', - 'Ctrl Alt P depuis votre terminal', - 'La commande remplie est copiée', - ], - }, - organise: { - label: 'Ranger et retrouver', - heading: 'Tout est rangé, tout se retrouve.', - steps: [ - 'Un espace et ses dossiers, en tableau', - 'Un dossier s’agrandit à la souris', - 'La recherche cite la ligne trouvée', - 'Les mêmes notes, en liste par date', - ], - }, - code: { - label: 'Le code', - heading: 'Un vrai éditeur pour vos snippets.', - steps: ['Choisir le langage au clavier', 'Formater avec Prettier', 'Lire un JSON en graphe'], - }, - tools: { - label: 'Outils', - heading: 'Une trentaine d’outils, sans réseau.', - steps: [ - 'Chercher un outil, Ctrl Maj T', - 'Une expression cron, lue à voix haute', - 'Un JWT décodé, ses dates lues', - 'Le résultat gardé comme une note', - ], - }, - api: { - label: 'Client API', - heading: 'Testez vos API à côté de vos notes.', - steps: [ - 'Une variable prise dans l’environnement', - 'Envoyer, lire la réponse', - 'Le code pour vingt cibles', - 'Un WebSocket et son journal', - ], - }, - vault: { - label: 'Chiffrement', - heading: 'Rien ne quitte votre machine.', - steps: [ - 'Sur le disque, la note est chiffrée', - 'Votre phrase de passe la déverrouille', - 'Plusieurs bibliothèques, sauvegardées chaque jour', - ], - }, - sections: ['Snippets', 'Ranger', 'Code', 'Outils', 'Client API', 'Chiffrement', 'Et aussi'], - closing: 'Vos snippets, rangés et à portée de raccourci.', - closingLede: (version: string) => - `DevNotes ${version}, pour ${systems('fr')}. Gratuit, libre, et rien ne quitte votre machine.`, - closingDownload: 'Télécharger DevNotes', + free: 'Gratuit, sous GPL-3.0', + facts: ['Sans compte', 'Hors ligne'], + alt: 'DevNotes : la liste des notes, avec ses espaces à gauche, la recherche en haut et des cartes de snippet, de Calcul et de liste à cocher.', + legendName: 'Ce que montre la capture', + legend: [ + { name: 'Trois zones', text: ['Les notes, les 32 outils et le client API, dans la même fenêtre.'] }, + { + name: 'Espaces et dossiers', + text: ['Vos notes rangées par projet, avec des tags, en liste ou sur un tableau.'], + }, + { + name: 'Une recherche', + text: [ + { keys: ['Ctrl', 'K'] }, + ' lit les titres, le code, les listes et les tags, sans tenir compte des accents.', + ], + }, + { + name: 'Des snippets à champs', + text: [ + { code: '{{namespace}}' }, + ' se remplit au moment de copier, même depuis une autre application avec ', + { keys: ['Ctrl', 'Alt', 'P'] }, + '.', + ], + }, + { + name: 'Des Calculs', + text: ["Un résultat par ligne, en euros, en heures ou en octets, refait dès qu'un chiffre change."], + }, + { name: 'Des listes', text: ['Leur carte montre où vous en êtes, sans ouvrir la liste.'] }, + ], + get: 'Télécharger', + getHeading: (version) => `DevNotes ${version}, pour ${systems('fr')}`, + getLede: + "Une application, sans compte ni serveur. Votre bibliothèque reste sur votre machine, chiffrée, et l'application se met à jour d'elle-même.", + code: 'Le code', + codeText: + 'DevNotes est écrit en Rust et publié sous GPL-3.0 : tout le code est lisible, et chaque version a ses notes.', + source: 'Code source', + notes: 'Notes de version', }; -const EN: typeof FR = { - title: 'DevNotes: snippets, tools and an API client for developers', +const EN: HomeText = { + title: 'DevNotes: snippets, notes and an API client for developers', description: - 'A desktop app for developers: snippets with fields, notes filed on a board, offline tools and an API client, encrypted on your machine.', - headline: 'The board where your snippets live.', - lede: 'Commands, queries, bits of code, notes and lists, filed in spaces and folders. Thirty-odd tools and an API client beside them, all encrypted on your machine.', + 'A desktop app for developers: snippets with fields, Markdown notes, lists, calculations, drawings, an API client and 32 tools, encrypted on your machine.', + section: 'The application', + headline: 'Your snippets, your notes, your requests.', + lede: 'A desktop application for everything a developer keeps at hand: snippets with fields, Markdown notes, lists, calculations and drawings, with an API client and 32 tools beside them. Encrypted on your machine, no account.', downloadFor: 'Download for', - docs: 'Read the documentation', - facts: ['Free', 'Open source, GPL-3.0', 'No account', 'Works offline'], - sourceFact: 1, others: 'Other systems and formats', - snippets: { - label: 'Snippets with fields', - heading: 'Your commands, ready to paste.', - steps: [ - 'A snippet with two fields', - 'DevNotes asks for their values', - 'Ctrl Alt P from your terminal', - 'The filled command is copied', - ], - }, - organise: { - label: 'Organise and find', - heading: 'Everything filed, everything found.', - steps: [ - 'A space and its folders, as a board', - 'A folder grows with the mouse', - 'The search quotes the matching line', - 'The same notes, listed by date', - ], - }, - code: { - label: 'The code', - heading: 'A real editor for your snippets.', - steps: ['Pick the language from the keyboard', 'Format with Prettier', 'Read a JSON as a graph'], - }, - tools: { - label: 'Tools', - heading: 'Thirty-odd tools, no network.', - steps: [ - 'Find a tool, Ctrl Shift T', - 'A cron expression, read aloud', - 'A JWT decoded, its dates read', - 'The result kept as a note', - ], - }, - api: { - label: 'API client', - heading: 'Test your APIs next to your notes.', - steps: [ - 'A variable taken from the environment', - 'Send, read the answer', - 'The code for twenty targets', - 'A WebSocket and its log', - ], - }, - vault: { - label: 'Encryption', - heading: 'Nothing leaves your machine.', - steps: [ - 'On disk, the note is encrypted', - 'Your passphrase unlocks it', - 'Several libraries, backed up every day', - ], - }, - sections: ['Snippets', 'Organise', 'Code', 'Tools', 'API client', 'Encryption', 'And more'], - closing: 'Your snippets, filed and one shortcut away.', - closingLede: (version: string) => - `DevNotes ${version}, for ${systems('en')}. Free, open source, and nothing leaves your machine.`, - closingDownload: 'Download DevNotes', + free: 'Free, under the GPL-3.0', + facts: ['No account', 'Works offline'], + alt: 'DevNotes: the list of notes, with its spaces on the left, the search at the top, and cards of a snippet, a calculation and a to-do list.', + legendName: 'What the capture shows', + legend: [ + { name: 'Three areas', text: ['The notes, the 32 tools and the API client, in the same window.'] }, + { + name: 'Spaces and folders', + text: ['Your notes filed by project, with tags, as a list or on a board.'], + }, + { + name: 'A search', + text: [{ keys: ['Ctrl', 'K'] }, ' reads titles, code, lists and tags, ignoring case and accents.'], + }, + { + name: 'Snippets with fields', + text: [ + { code: '{{namespace}}' }, + ' is filled in when you copy, even from another application with ', + { keys: ['Ctrl', 'Alt', 'P'] }, + '.', + ], + }, + { + name: 'Calculations', + text: ['One result a line, in euros, hours or bytes, redone as soon as a figure changes.'], + }, + { name: 'Lists', text: ['Their card shows where you stand, without opening the list.'] }, + ], + get: 'Download', + getHeading: (version) => `DevNotes ${version}, for ${systems('en')}`, + getLede: + 'One application, no account and no server. Your library stays on your machine, encrypted, and the application updates itself.', + code: 'The code', + codeText: + 'DevNotes is written in Rust and released under the GPL-3.0: all of its code can be read, and every version has its notes.', + source: 'Source code', + notes: 'Release notes', }; -const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; +const TEXT: Readonly<Record<Lang, HomeText>> = { fr: FR, en: EN }; + +/** + * Where each legend's mark stands on the capture, in percent of its width and height. The two + * languages lay the toolbar out differently: English keeps the search on the first row. + */ +const MARKS: Readonly<Record<Lang, readonly (readonly [number, number])[]>> = { + fr: [ + [16, 8], + [16, 33], + [67, 13.6], + [42.5, 36], + [70.6, 56.5], + [70.6, 83.5], + ], + en: [ + [16, 8], + [16, 33], + [61, 8], + [42.5, 30], + [70.6, 50.5], + [96.5, 77.5], + ], +}; -/** The sections the line under the header follows, in page order. */ -const SECTIONS: readonly Omit<ProgressSegment, 'name'>[] = [ - { anchor: 'snippets', tone: 'green' }, - { anchor: 'ranger', tone: 'blue' }, - { anchor: 'code', tone: 'purple' }, - { anchor: 'outils', tone: 'teal' }, - { anchor: 'client-api', tone: 'olive' }, - { anchor: 'chiffrement', tone: 'pink' }, - { anchor: 'et-aussi', tone: 'grey' }, -]; +/** The capture is `app::screens`' notes list, drawn at twice its size, in each language and theme. */ +const SHOT = { width: 2168, height: 1362, widths: [1084, 2168] } as const; @Component({ selector: 'app-home-page', - imports: [ - RouterLink, - HeroBoard, - Feature, - SnippetsScene, - OrganiseScene, - CodeScene, - ToolsScene, - ApiScene, - VaultScene, - MoreSection, - ], + imports: [RouterLink, DaySection, Runs], templateUrl: './home-page.html', styleUrl: './home-page.scss', changeDetection: ChangeDetectionStrategy.OnPush, }) export class HomePage { - protected readonly field = field; protected readonly version = VERSION; protected readonly repository = REPOSITORY; + protected readonly releasePage = RELEASE_PAGE; + protected readonly shot = SHOT; protected readonly lang = inject(Language).lang; protected readonly t = computed(() => TEXT[this.lang()]); + protected readonly marks = computed(() => MARKS[this.lang()]); + /** The legend's item under the pointer, whose mark on the capture grows. */ + protected readonly pointed = signal(-1); /** Put forward once the browser says which it is; Windows until then. */ protected readonly system = signal<System>('windows'); - protected readonly offer = computed(() => { - const all = offers(this.lang()); - return all.find(({ system }) => system === this.system()) ?? all[0]; + protected readonly offers = computed(() => + offers(this.lang()).map((offer) => ({ ...offer, files: [offer.primary, ...offer.others] })), + ); + protected readonly offer = computed( + () => this.offers().find(({ system }) => system === this.system()) ?? this.offers()[0], + ); + protected readonly systems = computed(() => systems(this.lang())); + protected readonly downloadPath = computed(() => downloadPath(this.lang())); + + /** + * When the capture's light file is the one shown: from the system's theme before any script, + * then from the site's own once it is known. The browser fetches one file, the one on screen. + */ + private readonly connected = signal(false); + private readonly theme = inject(ThemeStore); + protected readonly lightWhen = computed(() => { + if (!this.connected()) return '(prefers-color-scheme: light)'; + return this.theme.theme() === 'light' ? 'all' : 'not all'; }); - protected readonly links = computed(() => ({ - download: downloadPath(this.lang()), - docs: docPath('overview', this.lang()), - })); constructor() { - const progress = inject(PageProgress); - const document = inject(DOCUMENT); - const frame = inject(ScrollFrame); - const destroyRef = inject(DestroyRef); const lang = this.lang(); const t = TEXT[lang]; @@ -244,6 +219,8 @@ export class HomePage { .map(({ label }) => label) .join(', '), softwareVersion: VERSION, + description: t.description, + screenshot: absolute(this.file('dark', SHOT.width)), url: absolute(homePath(lang)), downloadUrl: absolute(downloadPath(lang)), inLanguage: lang, @@ -255,33 +232,26 @@ export class HomePage { ], }); - progress.show(SECTIONS.map((section, i) => ({ ...section, name: t.sections[i] ?? '' }))); - destroyRef.onDestroy(() => progress.clear()); - afterNextRender(() => { this.system.set(visitorSystem()); - const sections = SECTIONS.map(({ anchor }) => document.getElementById(anchor)); - const stop = frame.watch(() => { - // Read at the middle of the screen; the gap above a section is not the section yet. - const probe = innerHeight * 0.5; - let current = -1; - const weights: number[] = []; - const fills: number[] = []; - sections.forEach((section, i) => { - if (!section) { - weights.push(1); - fills.push(0); - return; - } - const box = section.getBoundingClientRect(); - const start = (section.firstElementChild ?? section).getBoundingClientRect().top; - weights.push(Math.round(box.height)); - fills.push(Number(clamp((probe - start) / Math.max(1, box.bottom - start)).toFixed(3))); - if (start <= probe) current = i; - }); - progress.report({ weights, fills, current }); - }); - destroyRef.onDestroy(stop); + this.connected.set(true); }); } + + protected file(theme: 'dark' | 'light', width: number): string { + return `/shots/notes-${this.lang()}-${theme}-${width}.webp`; + } + + protected srcset(theme: 'dark' | 'light'): string { + return SHOT.widths.map((width) => `${this.file(theme, width)} ${width}w`).join(', '); + } + + /** + * What the button's file is: its size, and for a Mac its chip, since the browser does not say + * which a Mac has. An Intel Mac finds its own file on the download page. + */ + protected note(offer: Offer): string { + const parts = offer.system === 'macos' ? [offer.primary.name, offer.primary.size] : [offer.primary.size]; + return parts.filter(Boolean).join(', '); + } } diff --git a/website/src/app/home/more-section.html b/website/src/app/home/more-section.html deleted file mode 100644 index 62b5d36d7..000000000 --- a/website/src/app/home/more-section.html +++ /dev/null @@ -1,129 +0,0 @@ -<section class="wrap plain" id="et-aussi" aria-labelledby="et-aussi-h" style="--c: var(--grey-rgb)"> - <div class="plain-head"> - <span class="zone-title"><span class="sw"></span>{{ text().label }}</span> - <h2 id="et-aussi-h">{{ text().heading }}</h2> - </div> - <ul class="more-grid"> - <li class="tile"> - <h3>{{ text().notes.title }}</h3> - <p>{{ text().notes.line }}</p> - <div class="mini" aria-hidden="true"> - <span class="md-h">{{ text().notes.heading }}</span> - @for (item of text().notes.items; track item) { - <span class="md-li">{{ item }}</span> - } - <code>nginx -s reload</code> - </div> - </li> - <li class="tile" #list> - <h3>{{ text().lists.title }}</h3> - <p>{{ text().lists.line }}</p> - <div class="mini" aria-hidden="true"> - <span class="bar" [style.--w]="(ticked() / text().lists.items.length) * 100 + '%'" - ><span></span - ></span> - @for (item of text().lists.items; track item) { - <span class="ck" [class.on]="$index < ticked()">{{ item }}</span> - } - </div> - </li> - <li class="tile" #trash> - <h3>{{ text().trash.title }}</h3> - <p> - {{ text().trash.before }} <span class="keys"><kbd>Ctrl</kbd><kbd>Z</kbd></span> - {{ text().trash.after }} - </p> - <div class="mini" aria-hidden="true"> - <span class="undo-bar"><span>{{ text().trash.toast }}</span><b>{{ text().trash.undo }}</b></span> - <span class="bar countdown" [class.running]="countingDown()"><span></span></span> - </div> - </li> - <li class="tile"> - <h3>{{ text().versions.title }}</h3> - <p>{{ text().versions.line }}</p> - <div class="mini" aria-hidden="true"> - @for (version of text().versions.items; track version[0]; let first = $first) { - <span class="ver" [class.cur]="first" - ><span>{{ version[0] }}</span><span>{{ version[1] }}</span></span - > - } - </div> - </li> - <li class="tile"> - <h3>{{ text().attachments.title }}</h3> - <p>{{ text().attachments.line }}</p> - <div class="mini" aria-hidden="true"> - @for (file of text().attachments.items; track file) { - <span class="file"><i></i>{{ file }}</span> - } - </div> - </li> - <li class="tile"> - <h3>{{ text().selection.title }}</h3> - <p>{{ text().selection.line }}</p> - <div class="mini" aria-hidden="true"> - <span class="sel">{{ text().selection.count }}</span> - <span class="acts"> - @for (action of text().selection.actions; track action) { - <span>{{ action }}</span> - } - </span> - </div> - </li> - <li class="tile"> - <h3>{{ text().transfer.title }}</h3> - <p>{{ text().transfer.before }} <code>.devnotes</code>{{ text().transfer.after }}</p> - <div class="mini" aria-hidden="true"> - @for (file of text().transfer.items; track file) { - <span class="file"><i></i>{{ file }}</span> - } - </div> - </li> - <li class="tile"> - <h3>{{ text().calc.title }}</h3> - <p>{{ text().calc.line }}</p> - <div class="mini" aria-hidden="true"> - @for (line of text().calc.items; track line[0]) { - <span class="ver"><span>{{ line[0] }}</span><span>{{ line[1] }}</span></span> - } - </div> - </li> - <li class="tile"> - <h3>{{ text().diagrams.title }}</h3> - <p>{{ text().diagrams.line }}</p> - <div class="mini" aria-hidden="true"> - @for (item of text().diagrams.items; track item) { - <span class="md-li">{{ item }}</span> - } - </div> - </li> - <li class="tile"> - <h3>{{ text().scripts.title }}</h3> - <p>{{ text().scripts.line }}</p> - <div class="mini" aria-hidden="true"> - @for (item of text().scripts.items; track item) { - <span class="md-li">{{ item }}</span> - } - </div> - </li> - <li class="tile"> - <h3>{{ text().palette.title }}</h3> - <p>{{ text().palette.line }}</p> - <div class="mini" aria-hidden="true"> - @for (item of text().palette.items; track item) { - <span class="md-li">{{ item }}</span> - } - </div> - </li> - <li class="tile"> - <h3>{{ text().themes.title }}</h3> - <p>{{ text().themes.line }}</p> - <div class="mini" aria-hidden="true"> - <span class="themes" - ><span class="th dark"><i></i><i></i><i></i></span - ><span class="th light"><i></i><i></i><i></i></span - ></span> - </div> - </li> - </ul> -</section> diff --git a/website/src/app/home/more-section.scss b/website/src/app/home/more-section.scss deleted file mode 100644 index 49f59ffe1..000000000 --- a/website/src/app/home/more-section.scss +++ /dev/null @@ -1,249 +0,0 @@ -.plain { - padding-top: clamp(110px, 16vh, 190px); -} - -.plain-head { - display: grid; - gap: 16px; - max-width: 44rem; -} - -.more-grid { - display: grid; - grid-template-columns: repeat(4, minmax(0, 1fr)); - gap: 14px; - margin-top: 32px; -} - -.tile { - display: grid; - grid-template-rows: auto auto 1fr; - gap: 8px; - min-width: 0; - padding: 16px; - border: 1px solid var(--line-soft); - border-radius: 10px; - background: var(--bg-1); -} - -.tile h3 { - font-size: 15px; -} - -.tile > p { - color: var(--text-1); - font-size: 14px; -} - -.mini { - align-self: end; - display: grid; - gap: 6px; - align-content: start; - min-height: 96px; - margin-top: 8px; - padding: 10px; - border-radius: 8px; - background: var(--bg-0); - border: 1px solid var(--line-soft); - font-size: 12px; -} - -.md-h { - font-weight: 700; - font-size: 13px; -} - -.md-li::before { - content: '•'; - margin-right: 6px; - color: var(--amber-text); -} - -.mini code { - font-size: 11px; - color: var(--green); -} - -.ck { - display: flex; - align-items: center; - gap: 8px; - color: var(--text-1); - transition: color var(--motion); -} - -.ck::before { - content: ''; - flex: none; - width: 11px; - height: 11px; - border-radius: 3px; - border: 1.5px solid var(--text-2); - transition: - background-color var(--motion), - border-color var(--motion); -} - -.ck.on { - color: var(--text-2); - text-decoration: line-through; -} - -.ck.on::before { - background: var(--green); - border-color: var(--green); -} - -.bar { - height: 4px; - border-radius: 2px; - background: var(--bg-3); - overflow: hidden; -} - -.bar span { - display: block; - height: 100%; - width: var(--w, 25%); - background: var(--amber-fill); - transition: width 300ms; -} - -.undo-bar { - display: flex; - align-items: center; - justify-content: space-between; - gap: 8px; - padding: 8px 10px; - border-radius: 7px; - background: var(--bg-2); - border: 1px solid var(--line); -} - -.undo-bar b { - color: var(--amber-text); -} - -// The banner's own countdown, before the deletion can no longer be taken back from it. -.countdown span { - width: 100%; -} - -.countdown.running span { - width: 0; - transition: width 5s linear; -} - -.ver { - display: flex; - justify-content: space-between; - color: var(--text-1); -} - -.ver.cur { - color: var(--text-0); - font-weight: 600; -} - -.file { - display: flex; - align-items: center; - gap: 8px; - min-width: 0; - color: var(--text-1); - overflow-wrap: anywhere; -} - -.file i { - flex: none; - width: 22px; - height: 26px; - border-radius: 3px; - border: 1px solid var(--line); - background: var(--bg-2); -} - -.sel { - padding: 6px 10px; - border-radius: 7px; - background: rgba(var(--amber-rgb), 0.13); - border: 1px solid rgba(var(--amber-rgb), 0.5); - font-weight: 600; -} - -.acts { - display: flex; - flex-wrap: wrap; - gap: 6px; - color: var(--text-1); -} - -.acts span { - padding: 3px 8px; - border-radius: 6px; - border: 1px solid var(--line); -} - -// The two themes, drawn in their own colours whatever the page's. -.themes { - display: grid; - grid-template-columns: 1fr 1fr; - gap: 8px; -} - -.th { - height: 60px; - padding: 7px; - display: grid; - gap: 5px; - align-content: start; - border-radius: 6px; - border: 1px solid; -} - -.th i { - display: block; - height: 5px; - border-radius: 3px; -} - -.th.dark { - background: #1b1e25; - border-color: #333947; -} - -.th.dark i { - background: #3f4454; -} - -.th.dark i:nth-child(2) { - width: 60%; - background: #e8a33d; -} - -.th.light { - background: #ffffff; - border-color: #cdd2dc; -} - -.th.light i { - background: #e1e5ec; -} - -.th.light i:nth-child(2) { - width: 60%; - background: #cf6a08; -} - -@media (max-width: 1100px) { - .more-grid { - grid-template-columns: repeat(2, minmax(0, 1fr)); - } -} - -@media (max-width: 560px) { - .more-grid { - grid-template-columns: minmax(0, 1fr); - } -} diff --git a/website/src/app/home/more-section.ts b/website/src/app/home/more-section.ts deleted file mode 100644 index 2501c2d89..000000000 --- a/website/src/app/home/more-section.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { - ChangeDetectionStrategy, - Component, - DestroyRef, - ElementRef, - afterNextRender, - computed, - inject, - signal, - viewChild, -} from '@angular/core'; - -import { canObserve, prefersReducedMotion, sleep } from '../core/browser'; -import { Lang } from '../core/lang'; -import { Language } from '../core/language'; - -const FR = { - label: 'Et aussi', - heading: 'Et tout ce qui va autour.', - notes: { - title: 'Des notes', - line: 'Écrites mises en forme, enregistrées en Markdown.', - heading: 'Rotation du certificat', - items: ["Émettre depuis l'ACME", 'Recharger nginx'], - }, - lists: { - title: 'Des listes', - line: 'À cocher, avec leur avancement sur la carte.', - items: ['Geler la branche', 'Lancer la CI', 'Publier la release', "Prévenir l'équipe"], - }, - trash: { - title: 'Une corbeille', - before: "Trente jours pour changer d'avis, et", - after: 'juste après une suppression.', - toast: 'Note mise à la corbeille', - undo: 'Annuler', - }, - versions: { - title: 'Des versions', - line: "Les vingt dernières versions d'un snippet, à relire et à rétablir.", - items: [ - ['Version actuelle', "à l'instant"], - ['Avant le formatage', 'il y a 2 min'], - ['Port changé', 'hier'], - ] as readonly (readonly [string, string])[], - }, - attachments: { - title: 'Des pièces jointes', - line: 'Des fichiers et des images collées, chiffrés avec la note.', - items: ['schema-factures.png', 'contrat-api.pdf'], - }, - selection: { - title: 'La sélection multiple', - line: "Déplacez, étiquetez ou supprimez vingt notes d'un coup.", - count: '20 sélectionnées', - actions: ['Déplacer vers…', 'Priorité', '+ tag'], - }, - transfer: { - title: 'Import et export', - before: 'Une archive', - after: ', protégée si vous le voulez, ou la sélection copiée en Markdown.', - items: ['travail-2026-10-14.devnotes', 'Copier la sélection en Markdown'], - }, - calc: { - title: 'Des calculs', - line: 'Une ligne, un résultat : unités, dates, pourcentages.', - items: [ - ['prix = 120 €', '120 €'], - ['3 h 20 min en min', '200 min'], - ['20 % de 340', '68'], - ] as readonly (readonly [string, string])[], - }, - diagrams: { - title: 'Des dessins', - line: 'Boîtes, flèches et texte, seuls ou dans une Note présentée en plein écran.', - items: ['Flèches attachées aux formes', 'Export en PNG ou SVG', 'Présentation plein écran'], - }, - scripts: { - title: 'Des scripts et des tests', - line: 'Du JavaScript autour de chaque requête, et des tests nommés.', - items: ['Avant l’envoi', 'Après la réponse', 'Tests : 3/3 réussis'], - }, - palette: { - title: 'Une palette', - line: 'Notes, requêtes, outils et espaces, d’une seule recherche.', - items: ['@ où chercher', '# un tag', '> une commande'], - }, - themes: { title: 'Deux thèmes, deux langues', line: 'Clair ou sombre, français ou anglais.' }, -}; - -const EN: typeof FR = { - label: 'And also', - heading: 'And everything around it.', - notes: { - title: 'Notes', - line: 'Written formatted, saved as Markdown.', - heading: 'Certificate rotation', - items: ['Issue from ACME', 'Reload nginx'], - }, - lists: { - title: 'Lists', - line: 'To tick off, their progress on the card.', - items: ['Freeze the branch', 'Run the CI', 'Publish the release', 'Tell the team'], - }, - trash: { - title: 'A trash', - before: 'Thirty days to change your mind, and', - after: 'right after a deletion.', - toast: 'Note moved to the trash', - undo: 'Undo', - }, - versions: { - title: 'Versions', - line: 'The last twenty versions of a snippet, to read again and restore.', - items: [ - ['Current version', 'just now'], - ['Before formatting', '2 min ago'], - ['Port changed', 'yesterday'], - ], - }, - attachments: { - title: 'Attachments', - line: 'Files and pasted images, encrypted with the note.', - items: ['invoice-schema.png', 'api-contract.pdf'], - }, - selection: { - title: 'Multiple selection', - line: 'Move, tag or delete twenty notes at once.', - count: '20 selected', - actions: ['Move to…', 'Priority', '+ tag'], - }, - transfer: { - title: 'Import and export', - before: 'A', - after: ' archive, protected if you wish, or the selection copied as Markdown.', - items: ['work-2026-10-14.devnotes', 'Copy the selection as Markdown'], - }, - calc: { - title: 'Calculations', - line: 'One line, one result: units, dates, percentages.', - items: [ - ['price = 120 €', '120 €'], - ['3 h 20 min in min', '200 min'], - ['20 % of 340', '68'], - ] as readonly (readonly [string, string])[], - }, - diagrams: { - title: 'Drawings', - line: 'Boxes, arrows and text, alone or in a Note presented full screen.', - items: ['Arrows attached to shapes', 'Exported as PNG or SVG', 'Full-screen presentation'], - }, - scripts: { - title: 'Scripts and tests', - line: 'JavaScript around each request, and named tests.', - items: ['Before the send', 'After the response', 'Tests: 3/3 passed'], - }, - palette: { - title: 'A palette', - line: 'Notes, requests, tools and spaces, from one search.', - items: ['@ where to search', '# a tag', '> a command'], - }, - themes: { title: 'Two themes, two languages', line: 'Light or dark, French or English.' }, -}; - -const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; - -/** Everything around the notes, a tile each. Two of them play once in view: a list ticks itself, a deletion counts down. */ -@Component({ - selector: 'app-more-section', - templateUrl: './more-section.html', - styleUrl: './more-section.scss', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class MoreSection { - private readonly lang = inject(Language).lang; - protected readonly text = computed(() => TEXT[this.lang()]); - /** How many items of the list are ticked. */ - protected readonly ticked = signal(1); - protected readonly countingDown = signal(false); - private readonly list = viewChild.required<ElementRef<HTMLElement>>('list'); - private readonly trash = viewChild.required<ElementRef<HTMLElement>>('trash'); - - constructor() { - const destroyRef = inject(DestroyRef); - afterNextRender(() => { - if (!canObserve()) return; - const list = this.list().nativeElement; - const watch = new IntersectionObserver( - (entries) => { - for (const entry of entries) { - if (!entry.isIntersecting) continue; - watch.unobserve(entry.target); - if (entry.target === list) void this.tick(); - else this.countingDown.set(true); - } - }, - { threshold: 0.7 }, - ); - watch.observe(list); - watch.observe(this.trash().nativeElement); - destroyRef.onDestroy(() => watch.disconnect()); - }); - } - - private async tick(): Promise<void> { - const reduce = prefersReducedMotion(); - while (this.ticked() < this.text().lists.items.length) { - if (!reduce) await sleep(650); - this.ticked.update((count) => count + 1); - } - } -} diff --git a/website/src/app/home/runs.ts b/website/src/app/home/runs.ts new file mode 100644 index 000000000..a423762d0 --- /dev/null +++ b/website/src/app/home/runs.ts @@ -0,0 +1,39 @@ +import { ChangeDetectionStrategy, Component, input } from '@angular/core'; + +/** A run of a sentence: plain, strong, keys pressed together, or code. */ +export type Run = + string | { readonly b: string } | { readonly keys: readonly string[] } | { readonly code: string }; + +/** + * A sentence written as runs, so a dictionary can hold its keys and its code without markup. A + * plain run is wrapped: alone in its block, the template compiler would pad it with a space, and a + * full stop after a strong word would stand apart. + */ +@Component({ + selector: 'app-runs', + template: ` + @for (run of runs(); track $index) { + @if (isText(run)) { + <ng-container>{{ run }}</ng-container> + } @else if ('b' in run) { + <strong>{{ run.b }}</strong> + } @else if ('keys' in run) { + <span class="keys"> + @for (key of run.keys; track key) { + <kbd>{{ key }}</kbd> + } + </span> + } @else { + <code>{{ run.code }}</code> + } + } + `, + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class Runs { + readonly runs = input.required<readonly Run[]>(); + + protected isText(run: Run): run is string { + return typeof run === 'string'; + } +} diff --git a/website/src/app/home/scene-player.ts b/website/src/app/home/scene-player.ts deleted file mode 100644 index 9fa786e06..000000000 --- a/website/src/app/home/scene-player.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { Injectable, signal } from '@angular/core'; - -import { sleep } from '../core/browser'; - -/** The pause between two steps, so the eye can read the one that ended. */ -const BETWEEN_STEPS_MS = 280; - -/** - * The clock of one feature's scene: which step it is on, and how far into it (`t`, 0…1). - * A scene is a pure function of the two, so a step clicked, a replay and the reduced-motion - * end state are all the same render. One per feature, provided by `Feature`. - */ -@Injectable() -export class ScenePlayer { - /** - * The end of the first step, not its start: that is what the HTML written at build time - * shows, readable without a script. Once running, a scene off-screen rests at 0. - */ - private readonly _step = signal(0); - private readonly _t = signal(1); - readonly step = this._step.asReadonly(); - readonly t = this._t.asReadonly(); - - private run = 0; - - rest(): void { - this.run++; - this.render(0, 0); - } - - show(step: number): void { - this.run++; - this.render(step, 1); - } - - /** Every step in turn, each over its own duration. A later call or a click stops it. */ - async play(durations: readonly number[]): Promise<void> { - const mine = ++this.run; - const alive = () => mine === this.run; - - for (const [step, duration] of durations.entries()) { - const began = performance.now(); - await new Promise<void>((done) => { - const tick = (now: number) => { - if (!alive()) return done(); - const t = Math.min(1, (now - began) / duration); - this.render(step, t); - if (t < 1) requestAnimationFrame(tick); - else done(); - }; - requestAnimationFrame(tick); - }); - if (!alive()) return; - if (step < durations.length - 1) await sleep(BETWEEN_STEPS_MS); - if (!alive()) return; - } - } - - private render(step: number, t: number): void { - this._step.set(step); - this._t.set(t); - } -} diff --git a/website/src/app/home/scenes/api-scene.html b/website/src/app/home/scenes/api-scene.html deleted file mode 100644 index 03765366b..000000000 --- a/website/src/app/home/scenes/api-scene.html +++ /dev/null @@ -1,64 +0,0 @@ -<div class="window app api"> - <div class="app-side"> - <span class="h">Collections</span> - <span class="row">{{ text().billing }}</span> - <span class="row sub http-on"><b class="m get">GET</b>{{ text().paid }}</span> - <span class="row sub"><b class="m post">POST</b>{{ text().create }}</span> - <span class="row">{{ text().realtime }}</span> - <span class="row sub ws-on"><b class="m ws">WS</b>{{ text().stream }}</span> - <span class="foot">{{ text().environments }}</span> - </div> - <div class="api-main"> - <div class="api-http"> - <div class="req"> - <span class="method">GET</span - ><span class="url"><span class="fld">{{ field('base_url') }}</span>/v1/invoices</span - ><span class="send">{{ text().send }}</span> - </div> - <div class="env-row"> - <span>{{ text().environment }}</span - ><span class="env-chip" [class.staging]="staging()">{{ staging() ? 'Staging' : 'Local' }}</span> - <span class="resolve">base_url = https://api.staging.internal</span> - </div> - <div class="req-tabs"> - <span class="t-params">{{ text().params }}</span><span>{{ text().headers }}</span - ><span>{{ text().body }}</span><span class="t-code">Code</span> - </div> - <div class="pane-params params"> - <span>status</span><span>paid</span><span>limit</span><span>20</span> - </div> - <div class="pane-code"> - <div class="targets"> - @for (each of targets; track each.name) { - <span [class.on]="$index === target()">{{ each.name }}</span> - } - </div> - <pre class="gen">{{ generated() }}</pre> - </div> - <div class="resp"> - <span class="spin">{{ text().sending }}</span> - <div class="resp-head"> - <span class="ok">200 OK</span><span>142 ms</span><span>{{ text().size }}</span - ><span class="env">Staging</span> - </div> - <app-code class="body" [lines]="answer" [shown]="lines()" /> - </div> - </div> - <div class="api-ws"> - <div class="req"> - <span class="method ws">WS</span><span class="url">wss://api.staging.internal/events</span - ><span class="send">{{ text().disconnect }}</span> - </div> - <ul class="ws-log"> - @for (message of messages; track $index) { - <li [class.on]="$index < received()"> - <span class="dir" [class.up]="message.up" [class.down]="!message.up" - >{{ message.up ? '↑' : '↓' }}</span - > - <span class="tm">{{ message.at }}</span><span class="pl">{{ message.text }}</span> - </li> - } - </ul> - </div> - </div> -</div> diff --git a/website/src/app/home/scenes/api-scene.scss b/website/src/app/home/scenes/api-scene.scss deleted file mode 100644 index 763058750..000000000 --- a/website/src/app/home/scenes/api-scene.scss +++ /dev/null @@ -1,378 +0,0 @@ -:host { - position: absolute; - inset: 0; - display: block; -} - -.api { - grid-template-columns: 184px minmax(0, 1fr); -} - -.m { - width: 30px; - flex: none; - font: 700 9.5px var(--font-mono); -} - -.m.get { - color: var(--green); -} - -.m.post { - color: var(--amber-text); -} - -.m.ws { - color: var(--purple); -} - -.row.http-on, -:host([data-step='3']) .row.ws-on { - background: rgba(var(--amber-rgb), 0.13); - color: var(--text-0); -} - -:host([data-step='3']) .row.http-on { - background: none; - color: var(--text-1); -} - -.api-main { - display: grid; - align-content: start; - gap: 10px; - min-width: 0; - padding: 12px; - overflow: hidden; - background: var(--bg-0); -} - -.api-http, -.api-ws { - display: grid; - gap: 10px; - align-content: start; - min-width: 0; -} - -.api-ws, -:host([data-step='3']) .api-http { - display: none; -} - -:host([data-step='3']) .api-ws { - display: grid; -} - -.req { - display: flex; - align-items: center; - gap: 8px; - min-width: 0; - padding: 6px; - border: 1px solid var(--line); - border-radius: 8px; - background: var(--bg-0); -} - -.method { - padding: 6px 8px; - border-radius: 5px; - background: rgba(var(--green-rgb), 0.12); - color: var(--green); - font: 700 11.5px var(--font-mono); -} - -.method.ws { - background: rgba(var(--purple-rgb), 0.12); - color: var(--purple); -} - -.url { - flex: 1; - min-width: 0; - font: 12.5px var(--font-mono); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.send { - flex: none; - padding: 7px 12px; - border-radius: 6px; - background: var(--amber-fill); - color: var(--amber-ink); - font-size: 12.5px; - font-weight: 650; -} - -:host(.sending) .send { - opacity: 0.6; -} - -.env-row { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 8px; - min-width: 0; - font-size: 12px; - color: var(--text-2); -} - -.env-chip { - padding: 3px 10px; - border-radius: 999px; - border: 1px solid var(--line); - color: var(--text-0); - font-weight: 600; - transition: - border-color var(--motion), - color var(--motion); -} - -.env-chip.staging { - border-color: var(--amber-edge); - color: var(--amber-text); -} - -.resolve { - min-width: 0; - padding: 4px 9px; - border-radius: 6px; - border: 1px solid var(--line); - background: var(--bg-2); - color: var(--text-0); - font: 11.5px var(--font-mono); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - opacity: 0; - transition: opacity var(--motion); -} - -:host(.resolving) .resolve { - opacity: 1; -} - -.req-tabs { - display: flex; - gap: 14px; - border-bottom: 1px solid var(--line-soft); - font-size: 12.5px; - color: var(--text-2); -} - -.req-tabs span { - padding-bottom: 7px; -} - -.req-tabs .t-params, -:host([data-step='2']) .req-tabs .t-code { - color: var(--text-0); - box-shadow: inset 0 -2px var(--amber-edge); -} - -:host([data-step='2']) .req-tabs .t-params { - color: var(--text-2); - box-shadow: none; -} - -.params { - display: grid; - grid-template-columns: 7rem minmax(0, 1fr); - font: 12px var(--font-mono); -} - -.params span { - padding: 6px 0; - border-bottom: 1px solid var(--line-soft); -} - -.params span:nth-child(odd) { - color: var(--text-1); -} - -.pane-code { - display: none; - gap: 8px; -} - -:host([data-step='2']) .pane-params, -:host([data-step='2']) .resp { - display: none; -} - -:host([data-step='2']) .pane-code { - display: grid; -} - -.targets { - display: flex; - flex-wrap: wrap; - gap: 6px; -} - -.targets span { - padding: 4px 9px; - border-radius: 6px; - border: 1px solid var(--line); - font-size: 12px; - color: var(--text-1); -} - -.targets span.on { - border-color: var(--amber-edge); - color: var(--amber-text); - background: rgba(var(--amber-rgb), 0.1); -} - -.gen { - margin: 0; - padding: 10px 12px; - border: 1px solid var(--line-soft); - border-radius: 8px; - background: var(--bg-1); - font: 11.5px/1.65 var(--font-mono); - white-space: pre-wrap; - overflow-wrap: anywhere; - overflow: hidden; -} - -.resp { - display: none; - gap: 8px; -} - -:host(.answered) .resp, -:host(.sending) .resp { - display: grid; -} - -:host(.sending) .resp-head, -:host(.sending) .body { - display: none; -} - -.resp-head { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 10px; - font-size: 12px; - color: var(--text-2); -} - -.resp-head .ok { - padding: 4px 7px; - border-radius: 5px; - background: rgba(var(--green-rgb), 0.12); - color: var(--green); - font: 700 11.5px var(--font-mono); -} - -.resp-head .env { - margin-left: auto; - padding: 3px 8px; - border-radius: 999px; - border: 1px solid var(--line); - color: var(--text-1); -} - -.body { - font-size: 11.5px; - padding-block: 6px; - grid-template-columns: 30px minmax(0, 1fr); - border: 1px solid var(--line-soft); - border-radius: 8px; -} - -.spin { - display: none; - align-items: center; - gap: 8px; - font-size: 12.5px; - color: var(--text-2); -} - -.spin::before { - content: ''; - width: 12px; - height: 12px; - border-radius: 50%; - border: 2px solid var(--line); - border-top-color: var(--amber-fill); - animation: turn var(--motion-turn) linear infinite; -} - -:host(.sending) .spin { - display: flex; -} - -.ws-log { - display: grid; - gap: 6px; -} - -.ws-log li { - display: grid; - grid-template-columns: 16px 56px minmax(0, 1fr); - gap: 8px; - align-items: baseline; - padding: 7px 10px; - border-radius: 7px; - background: var(--bg-1); - border: 1px solid var(--line-soft); - font: 11.5px var(--font-mono); - opacity: 0; - transform: translateY(4px); - transition: - opacity var(--motion), - transform var(--motion); -} - -.ws-log li.on { - opacity: 1; - transform: none; -} - -.dir { - font-weight: 700; -} - -.dir.up { - color: var(--amber-text); -} - -.dir.down { - color: var(--green); -} - -.tm { - color: var(--text-2); -} - -.pl { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -@container (max-width: 560px) { - .api { - grid-template-columns: minmax(0, 1fr); - } - - .gen { - font-size: 10.5px; - } - - .ws-log li { - grid-template-columns: 14px minmax(0, 1fr); - } - - .tm { - display: none; - } -} diff --git a/website/src/app/home/scenes/api-scene.ts b/website/src/app/home/scenes/api-scene.ts deleted file mode 100644 index 2040eaa13..000000000 --- a/website/src/app/home/scenes/api-scene.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core'; - -import { field, part } from '../../core/browser'; -import { Lang } from '../../core/lang'; -import { Language } from '../../core/language'; -import { CodeView, Line } from '../code-view'; -import { ScenePlayer } from '../scene-player'; - -const FR = { - billing: 'Facturation', - paid: 'Factures payées', - create: 'Créer une facture', - realtime: 'Temps réel', - stream: "Flux d'événements", - environments: 'Environnements', - send: 'Envoyer', - environment: 'Environnement', - params: 'Paramètres 2', - headers: 'En-têtes 1', - body: 'Corps', - sending: 'Envoi en cours', - size: '3,1 Ko', - disconnect: 'Déconnecter', -}; - -const EN: typeof FR = { - billing: 'Billing', - paid: 'Paid invoices', - create: 'Create an invoice', - realtime: 'Real time', - stream: 'Event stream', - environments: 'Environments', - send: 'Send', - environment: 'Environment', - params: 'Params 2', - headers: 'Headers 1', - body: 'Body', - sending: 'Sending', - size: '3.1 kB', - disconnect: 'Disconnect', -}; - -const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; - -const ENDPOINT = 'https://api.staging.internal/v1/invoices'; - -/** The same request, in four of the twenty targets the client writes code for. */ -const TARGETS = [ - { name: 'cURL', code: `curl '${ENDPOINT}?status=paid&limit=20' \\\n -H 'Accept: application/json'` }, - { - name: 'PowerShell', - code: `Invoke-RestMethod -Method Get \`\n -Uri '${ENDPOINT}?status=paid&limit=20' \`\n -Headers @{ Accept = 'application/json' }`, - }, - { - name: 'fetch', - code: `const res = await fetch(\n '${ENDPOINT}?status=paid&limit=20',\n { headers: { Accept: 'application/json' } },\n);`, - }, - { - name: 'HttpClient', - code: `this.http.get<Invoice[]>(\n '${ENDPOINT}',\n { params: { status: 'paid', limit: 20 } },\n);`, - }, -] as const; - -const ANSWER: readonly Line[] = [ - ['{'], - [' ', ['f', '"data"'], ': ['], - [' { ', ['f', '"id"'], ': ', ['s', '"in_1Q2w"'], ', ', ['f', '"total"'], ': ', ['n', '4900'], ' },'], - [' { ', ['f', '"id"'], ': ', ['s', '"in_1Q2x"'], ', ', ['f', '"total"'], ': ', ['n', '12000'], ' }'], - [' ],'], - [' ', ['f', '"has_more"'], ': ', ['k', 'true']], - ['}'], -]; - -const MESSAGES = [ - { up: true, at: '10:42:01', text: '{"type":"subscribe","channel":"invoices"}' }, - { up: false, at: '10:42:01', text: '{"type":"subscribed"}' }, - { up: false, at: '10:42:09', text: '{"type":"invoice.paid","id":"in_1Q2w"}' }, - { up: false, at: '10:42:15', text: '{"type":"invoice.paid","id":"in_1Q2x"}' }, - { up: false, at: '10:42:31', text: '{"type":"invoice.created","id":"in_1Q2y"}' }, -] as const; - -/** A variable resolved from the environment, the send and its answer, the generated code, a WebSocket. */ -@Component({ - selector: 'app-api-scene', - imports: [CodeView], - templateUrl: './api-scene.html', - styleUrl: './api-scene.scss', - changeDetection: ChangeDetectionStrategy.OnPush, - host: { - '[attr.data-step]': 'step()', - '[class.resolving]': 'resolving()', - '[class.sending]': 'sending()', - '[class.answered]': 'answered()', - }, -}) -export class ApiScene { - private readonly player = inject(ScenePlayer); - protected readonly step = this.player.step; - private readonly t = this.player.t; - protected readonly field = field; - protected readonly targets = TARGETS; - protected readonly answer = ANSWER; - protected readonly messages = MESSAGES; - private readonly lang = inject(Language).lang; - protected readonly text = computed(() => TEXT[this.lang()]); - - protected readonly staging = computed(() => this.step() > 0 || this.t() > 0.3); - protected readonly resolving = computed(() => this.step() === 0 && this.t() > 0.45); - protected readonly sending = computed(() => this.step() === 1 && this.t() > 0.08 && this.t() < 0.3); - protected readonly answered = computed(() => this.step() === 1 && this.t() >= 0.3); - protected readonly lines = computed(() => - this.step() === 1 ? Math.round(ANSWER.length * part(this.t(), 0.3, 0.8)) : ANSWER.length, - ); - protected readonly target = computed(() => - this.step() === 2 - ? Math.min(TARGETS.length - 1, Math.floor(part(this.t(), 0.05, 0.95) * TARGETS.length)) - : 0, - ); - protected readonly generated = computed(() => TARGETS[this.target()]?.code ?? ''); - protected readonly received = computed(() => - this.step() === 3 ? Math.round(MESSAGES.length * part(this.t(), 0.1, 0.9)) : 0, - ); -} diff --git a/website/src/app/home/scenes/code-scene.html b/website/src/app/home/scenes/code-scene.html deleted file mode 100644 index 569798e34..000000000 --- a/website/src/app/home/scenes/code-scene.html +++ /dev/null @@ -1,69 +0,0 @@ -<div class="window editor"> - <div class="win-head"> - <span class="win-title">{{ text().title }}</span> - <span class="lang-wrap"> - <span class="lang-btn">{{ chosen() ? 'TypeScript' : text().plain }}</span> - <span class="lang-menu"> - <span class="lang-filter"> - @if (filter()) { - <span>{{ filter() }}</span> - } @else { - <span class="ph">{{ text().filter }}</span> - } - </span> - <span class="lang-list"> - @for (language of languages(); track language) { - <span [class.on]="filter() && $first">{{ language }}</span> - } - </span> - </span> - </span> - <span class="btn-small fmt">{{ text().format }}</span> - </div> - @if (formatted()) { - <app-code [lines]="pretty" [marked]="true" /> - } @else { - <app-code [lines]="chosen() ? messy : plain" /> - } - <p class="fmt-notice"><span>{{ text().formatted }}</span><span class="undo">{{ text().undo }}</span></p> -</div> -<div class="json-pane"> - <div class="json-code"> - <app-code [lines]="json" [lit]="litLines()" /> - </div> - <div class="graph"> - <svg viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true"> - <path d="M25 47 C 28 47, 28 15, 31 15" /> - <path d="M25 47 L 31 47" /> - <path d="M53 47 C 56 47, 55 51, 58 51" /> - <path d="M78 62 L 78 72" /> - </svg> - <div class="node" style="left: 3%; top: 40%; width: 22%; height: 15%"> - <b>{{ text().root }}</b><span>{{ text().keys4 }}</span> - </div> - <div class="node" [class.sel]="selected() === 'type'" style="left: 31%; top: 8%; width: 36%; height: 15%"> - <b>type</b><span class="leaf">"invoice.paid"</span> - </div> - <div - class="node" - [class.sel]="selected() === 'data'" - style="left: 31%; top: 40%; width: 22%; height: 15%" - > - <b>data</b><span>{{ text().key1 }}</span> - </div> - <div - class="node" - [class.sel]="selected() === 'object'" - style="left: 58%; top: 40%; width: 40%; height: 22%" - > - <b>object</b><span class="leaf">amount_paid 4900</span><span class="leaf">currency "eur"</span> - </div> - <div - class="node" - [class.sel]="selected() === 'lines'" - style="left: 58%; top: 72%; width: 40%; height: 15%" - > - <b>lines</b><span>{{ text().item1 }}</span> - </div> - </div> -</div> diff --git a/website/src/app/home/scenes/code-scene.scss b/website/src/app/home/scenes/code-scene.scss deleted file mode 100644 index 0911567d3..000000000 --- a/website/src/app/home/scenes/code-scene.scss +++ /dev/null @@ -1,269 +0,0 @@ -:host { - position: absolute; - inset: 0; - display: block; -} - -.editor, -.json-pane { - transition: - opacity var(--motion-scene), - transform var(--motion-scene); -} - -.editor { - position: absolute; - inset: 0 0 auto 0; - overflow: visible; -} - -.editor .win-head { - position: relative; - z-index: 2; -} - -:host([data-step='2']) .editor { - opacity: 0; - transform: translateY(-14px) scale(0.98); -} - -.lang-wrap { - position: relative; - flex: none; -} - -.lang-btn { - display: inline-flex; - align-items: center; - gap: 6px; - padding: 5px 9px; - border: 1px solid var(--line); - border-radius: 6px; - background: var(--bg-2); - font-size: 12px; - font-weight: 600; - color: var(--text-1); -} - -.lang-btn::after { - content: ''; - width: 6px; - height: 6px; - border-right: 1.5px solid currentColor; - border-bottom: 1.5px solid currentColor; - transform: rotate(45deg) translateY(-2px); -} - -:host(.chosen) .lang-btn { - color: var(--blue); - border-color: rgba(var(--blue-rgb), 0.6); -} - -.lang-menu { - position: absolute; - top: calc(100% + 6px); - left: 0; - width: 210px; - padding: 6px; - display: grid; - gap: 4px; - background: var(--bg-2); - border: 1px solid var(--line); - border-radius: 9px; - box-shadow: var(--shadow); - opacity: 0; - transform: translateY(-4px); - transition: - opacity var(--motion), - transform var(--motion); -} - -:host(.menu) .lang-menu { - opacity: 1; - transform: none; -} - -.lang-filter { - display: flex; - gap: 4px; - padding: 7px 9px; - border: 1px solid var(--amber-edge); - border-radius: 6px; - background: var(--bg-0); - font: 12.5px var(--font-mono); -} - -.lang-filter .ph { - color: var(--text-2); - font-family: var(--font-sans); -} - -.lang-list { - display: grid; - max-height: 184px; - overflow: hidden; -} - -.lang-list span { - padding: 5px 9px; - border-radius: 5px; - font-size: 12.5px; - color: var(--text-1); -} - -.lang-list span.on { - background: rgba(var(--amber-rgb), 0.15); - color: var(--text-0); -} - -.fmt { - margin-left: auto; -} - -.editor .code { - min-height: 150px; - align-content: start; -} - -.fmt-notice { - display: flex; - justify-content: space-between; - gap: 10px; - margin: 0 16px 16px; - padding: 9px 12px; - border-radius: 8px; - border: 1px solid rgba(var(--amber-rgb), 0.5); - background: rgba(var(--amber-rgb), 0.08); - font-size: 13px; - opacity: 0; - transition: opacity var(--motion); -} - -.fmt-notice .undo { - color: var(--amber-text); - font-weight: 650; -} - -:host(.formatted[data-step='1']) .fmt-notice { - opacity: 1; -} - -// The JSON beside its graph. -.json-pane { - position: absolute; - inset: 0; - display: grid; - grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); - align-content: center; - align-items: center; - gap: 14px; - opacity: 0; - transform: translateY(14px); -} - -:host([data-step='2']) .json-pane { - opacity: 1; - transform: none; -} - -.json-code { - border: 1px solid var(--line-soft); - border-radius: 8px; - overflow: hidden; - background: var(--bg-1); -} - -.json-code .code { - font-size: 11.5px; - padding-block: 8px; - grid-template-columns: 30px minmax(0, 1fr); -} - -// Its nodes are placed in percent: the graph keeps its proportions, whatever its width. -.graph { - position: relative; - aspect-ratio: 7 / 6; - border: 1px solid var(--line-soft); - border-radius: 8px; - background-image: radial-gradient(var(--dot) 1.1px, transparent 1.4px); - background-size: 14px 14px; -} - -.graph svg { - position: absolute; - inset: 0; - width: 100%; - height: 100%; -} - -.graph path { - fill: none; - stroke: var(--line); - stroke-width: 1.5; - vector-effect: non-scaling-stroke; -} - -.node { - position: absolute; - padding: 6px 9px; - border-radius: 7px; - background: var(--card); - border: 1px solid var(--line); - font-size: 11px; - line-height: 1.35; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - transition: - border-color var(--motion), - box-shadow var(--motion); -} - -.node b { - display: block; - font: 600 11px var(--font-mono); -} - -.node span { - color: var(--text-2); - font-size: 10.5px; -} - -.node .leaf { - display: block; - font-family: var(--font-mono); - color: var(--text-1); - font-size: 10px; -} - -.node.sel { - border-color: var(--blue); - box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.2); -} - -@container (max-width: 520px) { - .json-pane { - grid-template-columns: minmax(0, 1fr); - align-content: start; - } - - .graph { - aspect-ratio: auto; - height: 220px; - } - - .node { - padding: 4px 7px; - line-height: 1.25; - font-size: 10px; - } - - .node b, - .node .leaf { - font-size: 10px; - } - - .json-code .code { - font-size: 10.5px; - } -} diff --git a/website/src/app/home/scenes/code-scene.ts b/website/src/app/home/scenes/code-scene.ts deleted file mode 100644 index e7549ae03..000000000 --- a/website/src/app/home/scenes/code-scene.ts +++ /dev/null @@ -1,165 +0,0 @@ -import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core'; - -import { part, typed } from '../../core/browser'; -import { Lang } from '../../core/lang'; -import { Language } from '../../core/language'; -import { CodeView, Line } from '../code-view'; -import { ScenePlayer } from '../scene-player'; - -const FR = { - title: 'Petit utilitaire', - plain: 'Texte brut', - filter: 'Filtrer les langages', - format: 'Formater', - formatted: 'Formaté avec Prettier · 4 lignes modifiées', - undo: 'Annuler', - root: 'racine', - keys4: '4 clés', - key1: '1 clé', - item1: '1 élément', -}; - -const EN: typeof FR = { - title: 'Small helper', - plain: 'Plain text', - filter: 'Filter languages', - format: 'Format', - formatted: 'Formatted with Prettier · 4 lines changed', - undo: 'Undo', - root: 'root', - keys4: '4 keys', - key1: '1 key', - item1: '1 item', -}; - -const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; - -/** The language menu's names after the first, the same in both languages. */ -const LANGUAGES = [ - 'Bash', - 'C#', - 'CSS', - 'Go', - 'GraphQL', - 'JSON', - 'Python', - 'Rust', - 'SQL', - 'TypeScript', - 'YAML', -]; - -const PLAIN: readonly Line[] = [['const a={b:1,c:[1,2,3]};function f(x){return x*2}']]; - -const MESSY: readonly Line[] = [ - [ - ['k', 'const'], - ' a={b:', - ['n', '1'], - ',c:[', - ['n', '1'], - ',', - ['n', '2'], - ',', - ['n', '3'], - ']};', - ['k', 'function'], - ' ', - ['f', 'f'], - '(x){', - ['k', 'return'], - ' x*', - ['n', '2'], - '}', - ], -]; - -const PRETTY: readonly Line[] = [ - [ - ['k', 'const'], - ' a = { b: ', - ['n', '1'], - ', c: [', - ['n', '1'], - ', ', - ['n', '2'], - ', ', - ['n', '3'], - '] };', - ], - [['k', 'function'], ' ', ['f', 'f'], '(x) {'], - [' ', ['k', 'return'], ' x * ', ['n', '2'], ';'], - ['}'], -]; - -const JSON_LINES: readonly Line[] = [ - ['{'], - [' ', ['f', '"id"'], ': ', ['s', '"evt_1PqX4c"'], ','], - [' ', ['f', '"type"'], ': ', ['s', '"invoice.paid"'], ','], - [' ', ['f', '"data"'], ': {'], - [' ', ['f', '"object"'], ': {'], - [' ', ['f', '"amount_paid"'], ': ', ['n', '4900'], ','], - [' ', ['f', '"currency"'], ': ', ['s', '"eur"'], ','], - [' ', ['f', '"lines"'], ': [ … ]'], - [' }'], - [' },'], - [' ', ['f', '"livemode"'], ': ', ['k', 'false']], - ['}'], -]; - -/** A node of the JSON graph. */ -type Selection = 'none' | 'type' | 'data' | 'object' | 'lines'; - -/** The lines of the code each node stands for. */ -const SPANS: Record<Selection, readonly number[]> = { - none: [], - type: [2], - data: [3, 4, 5, 6, 7, 8, 9], - object: [4, 5, 6, 7, 8], - lines: [7], -}; - -/** The language picked from a filtered menu, Prettier, then a JSON read as a graph beside its code. */ -@Component({ - selector: 'app-code-scene', - imports: [CodeView], - templateUrl: './code-scene.html', - styleUrl: './code-scene.scss', - changeDetection: ChangeDetectionStrategy.OnPush, - host: { - '[attr.data-step]': 'step()', - '[class.menu]': 'menuOpen()', - '[class.chosen]': 'chosen()', - '[class.formatted]': 'formatted()', - }, -}) -export class CodeScene { - private readonly player = inject(ScenePlayer); - protected readonly step = this.player.step; - private readonly t = this.player.t; - protected readonly plain = PLAIN; - protected readonly messy = MESSY; - protected readonly pretty = PRETTY; - protected readonly json = JSON_LINES; - private readonly lang = inject(Language).lang; - protected readonly text = computed(() => TEXT[this.lang()]); - - protected readonly menuOpen = computed(() => this.step() === 0 && this.t() > 0.12 && this.t() < 0.8); - protected readonly filter = computed(() => - this.step() === 0 ? typed('ty', part(this.t(), 0.3, 0.55)) : '', - ); - protected readonly languages = computed(() => { - const filter = this.filter().toLowerCase(); - return [this.text().plain, ...LANGUAGES].filter((name) => name.toLowerCase().includes(filter)); - }); - protected readonly chosen = computed(() => this.step() > 0 || this.t() >= 0.8); - protected readonly formatted = computed(() => this.step() > 1 || (this.step() === 1 && this.t() > 0.2)); - protected readonly selected = computed<Selection>(() => { - if (this.step() < 2) return 'none'; - const t = this.t(); - if (t < 0.25) return 'type'; - if (t < 0.5) return 'data'; - return t < 0.75 ? 'object' : 'lines'; - }); - protected readonly litLines = computed(() => SPANS[this.selected()]); -} diff --git a/website/src/app/home/scenes/organise-scene.html b/website/src/app/home/scenes/organise-scene.html deleted file mode 100644 index b8e5b8a5b..000000000 --- a/website/src/app/home/scenes/organise-scene.html +++ /dev/null @@ -1,142 +0,0 @@ -<div class="window app"> - <div class="app-side"> - <span class="h">{{ w().spaces }}</span> - <span class="row">{{ w().allSpaces }}</span> - <span class="row">{{ w().personal }}</span> - <span class="row on">{{ w().platform }}</span> - <span class="row sub"><i class="sw" style="--c: var(--blue-rgb)"></i>{{ w().deploy }}</span> - <span class="row sub"><i class="sw" style="--c: var(--amber-rgb)"></i>{{ w().db }}</span> - <span class="row sub"><i class="sw" style="--c: var(--purple-rgb)"></i>{{ w().front }}</span> - <span class="row">{{ w().project }}</span> - <span class="foot">{{ w().trash }}</span> - </div> - <div class="app-main"> - <div class="app-bar"> - <span class="mini-seg" - ><span [class.on]="listed()">{{ w().list }}</span - ><span [class.on]="!listed()">{{ w().board }}</span></span - > - <span class="app-search"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"> - <circle cx="11" cy="11" r="7" /> - <path d="m20 20-3.5-3.5" /> - </svg> - @if (search()) { - <span class="q">{{ search() }}</span> - } @else { - <span class="ph">{{ w().search }}</span> - } - </span> - </div> - <div class="view view-board"> - <div class="zone" style="--c: var(--blue-rgb)"> - <div class="zone-head"><span class="sw"></span>{{ w().deploy }} <span class="count">2</span></div> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().cargo }}</strong><span class="chip-lang l-yml">YML</span> - </div> - <pre>- <span class="f">uses</span>: <span class="s">actions/cache@v4</span> - <span class="f">with</span>:</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#ci</span></div> - </div> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().postgres }}</strong - ><span class="chip-lang l-sh">SH</span> - </div> - <pre><span class="k">docker</span> run --rm \ - -p <span class="n">5432</span>:<span class="n">5432</span></pre> - <div class="card-foot"><span>{{ w().monday }}</span><span>#docker</span></div> - </div> - </div> - <div class="zone db" style="--c: var(--amber-rgb)" [style.flex-grow]="growth()"> - <div class="zone-head"><span class="sw"></span>{{ w().db }} <span class="count">2</span></div> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().tunnel }}</strong><span class="chip-lang l-sh">SH</span> - </div> - <pre><span class="k">ssh</span> -N -L <span class="n">5433</span>: -<span class="fld">{{ field('db_host') }}</span>:<span class="n">5432</span></pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#ops</span></div> - </div> - <div class="card match"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().slow }}</strong><span class="chip-lang l-sql">SQL</span> - </div> - <pre><span class="k">SELECT</span> calls, - mean_exec_time</pre> - <p class="quote">… <span class="k">FROM </span><mark>pg_stat</mark>_statements</p> - <div class="card-foot"><span>{{ w().now }}</span><span>#sql</span></div> - </div> - </div> - <div class="zone front" style="--c: var(--purple-rgb)"> - <div class="zone-head"><span class="sw"></span>{{ w().front }} <span class="count">1</span></div> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().store }}</strong><span class="chip-lang l-ts">TS</span> - </div> - <pre><span class="k">export class</span> - <span class="f">CounterStore</span> {</pre> - <div class="card-foot"><span>{{ w().monday }}</span><span>#angular</span></div> - </div> - </div> - </div> - <div class="view view-list"> - <section class="list-section"> - <h4 class="list-title">{{ w().today }} <span class="n">· 3</span></h4> - <div class="list-grid"> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().slow }}</strong - ><span class="chip-lang l-sql">SQL</span> - </div> - <pre><span class="k">SELECT</span> calls, - mean_exec_time</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#sql</span></div> - </div> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().tunnel }}</strong - ><span class="chip-lang l-sh">SH</span> - </div> - <pre><span class="k">ssh</span> -N -L <span class="n">5433</span>: -<span class="fld">{{ field('db_host') }}</span>:<span class="n">5432</span></pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#ops</span></div> - </div> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().cargo }}</strong - ><span class="chip-lang l-yml">YML</span> - </div> - <pre>- <span class="f">uses</span>: <span class="s">actions/cache@v4</span> - <span class="f">with</span>:</pre> - <div class="card-foot"><span>{{ w().now }}</span><span>#ci</span></div> - </div> - </div> - </section> - <section class="list-section"> - <h4 class="list-title">{{ w().week }} <span class="n">· 2</span></h4> - <div class="list-grid"> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().store }}</strong><span class="chip-lang l-ts">TS</span> - </div> - <pre><span class="k">export class</span> - <span class="f">CounterStore</span> {</pre> - <div class="card-foot"><span>{{ w().monday }}</span><span>#angular</span></div> - </div> - <div class="card"> - <div class="card-top"> - <span class="tick"></span><strong>{{ w().postgres }}</strong - ><span class="chip-lang l-sh">SH</span> - </div> - <pre><span class="k">docker</span> run --rm \ - -p <span class="n">5432</span>:<span class="n">5432</span></pre> - <div class="card-foot"><span>{{ w().monday }}</span><span>#docker</span></div> - </div> - <div class="card ghost"><span class="plus">+</span>{{ w().pasteOrCreate }}</div> - </div> - </section> - </div> - </div> -</div> diff --git a/website/src/app/home/scenes/organise-scene.scss b/website/src/app/home/scenes/organise-scene.scss deleted file mode 100644 index 9665ad87e..000000000 --- a/website/src/app/home/scenes/organise-scene.scss +++ /dev/null @@ -1,230 +0,0 @@ -:host { - position: absolute; - inset: 0; - display: block; -} - -.app-main { - display: grid; - grid-template-rows: auto minmax(0, 1fr); - min-width: 0; - background: var(--bg-0); -} - -.app-bar { - display: flex; - align-items: center; - gap: 8px; - padding: 9px 12px; - border-bottom: 1px solid var(--line-soft); - min-width: 0; -} - -.mini-seg { - display: inline-flex; - flex: none; - padding: 2px; - border: 1px solid var(--line); - border-radius: 7px; - font-size: 12px; - font-weight: 600; -} - -.mini-seg span { - padding: 4px 9px; - border-radius: 5px; - color: var(--text-1); -} - -.mini-seg span.on { - background: var(--amber-fill); - color: var(--amber-ink); -} - -.app-search { - flex: 1; - min-width: 0; - min-height: 32px; - display: flex; - align-items: center; - gap: 8px; - padding: 0 10px; - border: 1px solid var(--line); - border-radius: 7px; - background: var(--bg-1); - font-size: 12.5px; - color: var(--text-2); -} - -.app-search svg { - width: 14px; - height: 14px; - flex: none; -} - -.app-search .q { - color: var(--text-0); - font-family: var(--font-mono); -} - -:host(.typing) .app-search { - border-color: var(--amber-edge); -} - -.view { - position: relative; - overflow: hidden; - padding: 12px; - background-image: radial-gradient(var(--dot) 1.1px, transparent 1.4px); - background-size: 16px 16px; -} - -.view-board { - display: flex; - gap: 10px; - align-items: flex-start; -} - -.view-board .zone { - flex: 1 1 0; - min-width: 0; - padding: 0 8px 8px; - display: grid; - gap: 8px; -} - -.view-board .zone.db { - position: relative; - transition: flex-grow var(--motion-fast); -} - -.view-board .zone.db::after { - content: ''; - position: absolute; - right: 3px; - bottom: 3px; - width: 10px; - height: 10px; - border-right: 2px solid rgb(var(--c)); - border-bottom: 2px solid rgb(var(--c)); - opacity: 0; -} - -:host(.resizing) .zone.db { - outline: 2px dashed rgba(var(--c), 0.75); - outline-offset: 2px; -} - -:host(.resizing) .zone.db::after { - opacity: 1; -} - -.view-board .card { - width: auto; - height: 112px; - transition: opacity var(--motion); -} - -.quote { - display: none; - margin: 0; - font: 9.8px/1.6 var(--font-mono); - color: var(--text-1); -} - -.quote mark { - background: rgba(var(--amber-rgb), 0.3); - color: var(--text-0); - border-radius: 2px; -} - -:host(.searching) .card:not(.match) { - opacity: 0.22; -} - -:host(.searching) .card.match { - border-color: var(--amber-edge); -} - -:host(.searching) .card.match pre { - display: none; -} - -:host(.searching) .card.match .quote { - display: block; -} - -// The list view, as the canvas draws it: the same cards, in a grid, under their date. -.view-list { - display: none; - align-content: start; - gap: 14px; -} - -:host(.listed) .view-board { - display: none; -} - -:host(.listed) .view-list { - display: grid; -} - -.list-section { - display: grid; - gap: 8px; -} - -.list-title { - font-size: 10px; - font-weight: 700; - letter-spacing: 1px; - text-transform: uppercase; - color: var(--text-2); -} - -.list-title .n { - font: 400 10px var(--font-mono); - color: var(--text-2); - letter-spacing: normal; -} - -.list-grid { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); - gap: 8px; -} - -.list-grid .card { - width: auto; - height: 104px; -} - -.card.ghost { - align-items: center; - justify-content: center; - gap: 4px; - border-style: dashed; - border-color: var(--line); - background: transparent; - color: var(--text-2); - font-size: 11px; -} - -.ghost .plus { - font-size: 18px; - line-height: 1; -} - -@container (max-width: 560px) { - .view-board .zone.front { - display: none; - } - - .view-board { - gap: 8px; - } - - .view { - padding: 10px 8px; - } -} diff --git a/website/src/app/home/scenes/organise-scene.ts b/website/src/app/home/scenes/organise-scene.ts deleted file mode 100644 index 9f764a6dd..000000000 --- a/website/src/app/home/scenes/organise-scene.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core'; - -import { field, part, typed } from '../../core/browser'; -import { Language } from '../../core/language'; -import { BOARD_WORDS } from '../board-words'; -import { ScenePlayer } from '../scene-player'; - -const SEARCH = 'pg_stat'; - -/** A space whose folders are zones on the board; a zone grows, a search, then the list by date. */ -@Component({ - selector: 'app-organise-scene', - templateUrl: './organise-scene.html', - styleUrl: './organise-scene.scss', - changeDetection: ChangeDetectionStrategy.OnPush, - host: { - '[class.resizing]': 'resizing()', - '[class.typing]': 'typing()', - '[class.searching]': 'search() === searched', - '[class.listed]': 'listed()', - }, -}) -export class OrganiseScene { - private readonly player = inject(ScenePlayer); - private readonly step = this.player.step; - private readonly t = this.player.t; - protected readonly field = field; - protected readonly searched = SEARCH; - private readonly lang = inject(Language).lang; - protected readonly w = computed(() => BOARD_WORDS[this.lang()]); - - /** How much wider the database folder is than its neighbours. */ - protected readonly growth = computed(() => { - const step = this.step(); - if (step === 0) return 1; - return step === 1 ? 1 + 0.75 * part(this.t(), 0.1, 0.8) : 1.75; - }); - protected readonly resizing = computed(() => this.step() === 1 && this.t() > 0.05 && this.t() < 0.9); - protected readonly search = computed(() => - this.step() === 2 ? typed(SEARCH, part(this.t(), 0.05, 0.5)) : '', - ); - protected readonly typing = computed(() => this.step() === 2 && this.t() < 0.55); - protected readonly listed = computed(() => this.step() === 3 && this.t() > 0.12); -} diff --git a/website/src/app/home/scenes/snippets-scene.html b/website/src/app/home/scenes/snippets-scene.html deleted file mode 100644 index 2826262af..000000000 --- a/website/src/app/home/scenes/snippets-scene.html +++ /dev/null @@ -1,64 +0,0 @@ -<div class="window snip-ed"> - <div class="win-head"> - <span class="win-title">{{ text().title }}</span><span class="chip-lang l-sh">SH</span> - <span class="btn-small copy">{{ text().copyFilled }}</span> - </div> - <div class="fields-head">{{ text().fields }} <span class="count">{{ filled() }}</span></div> - <div class="fields"> - <span class="lbl">{{ field('db_host') }}</span - ><span class="fake-in" [class.typing]="hostTyping()">{{ host() }}</span> - <span class="lbl">{{ field('user') }}</span - ><span class="fake-in" [class.typing]="userTyping()">{{ user() }}</span> - </div> - <app-code [lines]="snippet" /> - <div class="preview"> - <span class="pv-label">{{ text().goes }}</span> - <output>{{ command() }}</output> - </div> -</div> -<div class="snip-desk"> - <div class="snip-keys"> - @for (key of keys; track key) { - <kbd class="cap" [class.pressed]="pressed($index)">{{ key }}</kbd> - } - </div> - <div class="term"> - <div class="term-head"><span class="tab">~/api</span><span>bash</span></div> - <div class="term-body"> - <div><span class="ok">~/api</span> $ git pull</div> - <div class="dim">Already up to date.</div> - <div><span class="ok">~/api</span> $ {{ pasted() }}<span class="term-caret"></span></div> - </div> - </div> - <div class="palette"> - <div class="pal-search"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"> - <circle cx="11" cy="11" r="7" /> - <path d="m20 20-3.5-3.5" /> - </svg> - @if (query()) { - <span class="pal-query">{{ query() }}</span> - } @else { - <span class="pal-placeholder">{{ text().search }}</span> - } - <span class="pal-caret"></span> - <kbd class="esc">{{ text().esc }}</kbd> - </div> - <ul class="pal-results"> - @for (result of results(); track result.title; let first = $first) { - <li [class.is-sel]="first" [class.copying]="first && copying()"> - <span class="chip-lang" [class]="'l-' + result.lang">{{ result.lang.toUpperCase() }}</span> - <span class="t">{{ result.before }}<mark>{{ result.match }}</mark>{{ result.after }}</span> - <span class="where">{{ text().space }}</span> - </li> - } - </ul> - <div class="pal-foot"> - <span><kbd>↑</kbd><kbd>↓</kbd>{{ text().move }}</span> - <span><kbd>{{ text().enter }}</kbd>{{ text().open }}</span> - <span [class.lit]="copying()"><kbd>Ctrl</kbd><kbd>C</kbd>{{ text().copy }}</span> - <span><kbd>{{ text().esc }}</kbd>{{ text().close }}</span> - </div> - </div> - <div class="snip-toast">{{ text().copied }}</div> -</div> diff --git a/website/src/app/home/scenes/snippets-scene.scss b/website/src/app/home/scenes/snippets-scene.scss deleted file mode 100644 index 2c60aec5e..000000000 --- a/website/src/app/home/scenes/snippets-scene.scss +++ /dev/null @@ -1,389 +0,0 @@ -:host { - position: absolute; - inset: 0; - display: block; -} - -.snip-ed, -.snip-desk { - transition: - opacity var(--motion-scene), - transform var(--motion-scene); -} - -.snip-ed { - position: absolute; - inset: 0 0 auto 0; -} - -:host([data-step='2']) .snip-ed, -:host([data-step='3']) .snip-ed { - opacity: 0; - transform: translateY(-14px) scale(0.98); -} - -.snip-desk { - position: absolute; - inset: 0; - opacity: 0; - transform: translateY(14px); -} - -:host([data-step='2']) .snip-desk, -:host([data-step='3']) .snip-desk { - opacity: 1; - transform: none; -} - -.win-head .copy { - margin-left: auto; -} - -.fields-head { - display: flex; - align-items: center; - gap: 10px; - padding: 12px 16px 0; - font-size: 13px; - font-weight: 650; -} - -.fields-head .count { - font: 600 11px/1 var(--font-mono); - padding: 3px 7px; - border-radius: 999px; - background: var(--bg-3); - color: var(--text-1); -} - -.fields { - display: grid; - grid-template-columns: max-content minmax(0, 1fr); - gap: 8px 14px; - align-items: center; - padding: 12px 16px 14px; - border-bottom: 1px solid var(--line-soft); -} - -.lbl { - font: 500 12.5px var(--font-mono); - color: var(--amber-text); -} - -.fake-in { - position: relative; - min-height: 36px; - min-width: 0; - padding: 7px 10px; - font: 13px/1.6 var(--font-mono); - background: var(--bg-0); - border: 1px solid var(--line); - border-radius: 6px; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; -} - -.fake-in.typing { - border-color: var(--amber-edge); -} - -.fake-in.typing::after, -.pal-caret { - content: ''; - display: inline-block; - width: 2px; - height: 1.1em; - vertical-align: -0.2em; - background: var(--amber-fill); - animation: blink 900ms steps(1) infinite; -} - -.fake-in.typing::after { - margin-left: 1px; -} - -.preview { - padding: 14px 16px 16px; - border-top: 1px solid var(--line-soft); - background: rgba(var(--amber-rgb), 0.05); - display: grid; - gap: 6px; -} - -.pv-label { - font-size: 12px; - font-weight: 600; - color: var(--text-2); -} - -.preview output { - font: 13px/1.6 var(--font-mono); - overflow-wrap: anywhere; -} - -// The palette over a terminal. -.snip-keys { - position: absolute; - left: 0; - top: 0; - z-index: 3; - display: flex; - gap: 8px; -} - -.cap { - display: inline-grid; - place-items: center; - min-width: 48px; - height: 44px; - padding: 0 14px; - font: 650 14px/1 var(--font-sans); - color: var(--text-0); - background: var(--bg-2); - border: 1px solid var(--line); - border-bottom-width: 4px; - border-radius: 9px; - transition: - transform var(--motion-fast), - border-bottom-width var(--motion-fast), - background-color var(--motion-fast); -} - -.cap.pressed { - transform: translateY(2px); - border-bottom-width: 2px; - background: rgba(var(--amber-rgb), 0.16); - border-color: var(--amber-edge); -} - -.term { - position: absolute; - left: 0; - bottom: 0; - width: 88%; - background: var(--term-bg); - color: var(--term-fg); - border-radius: 10px; - border: 1px solid var(--term-edge); - box-shadow: var(--shadow); - overflow: hidden; - font: 13px/1.7 var(--font-mono); -} - -.term-head { - display: flex; - align-items: center; - gap: 8px; - padding: 8px 12px; - background: var(--term-head); - color: var(--term-dim); - font-size: 12px; -} - -.term-head .tab { - padding: 3px 10px; - border-radius: 6px; - background: var(--term-tab); - color: var(--term-fg); -} - -.term-body { - padding: 14px 16px 22px; - min-height: 200px; - overflow-wrap: anywhere; -} - -.term-body .dim { - color: var(--term-dim); -} - -.term-body .ok { - color: var(--term-green); -} - -.term-caret { - display: inline-block; - width: 8px; - height: 1.1em; - vertical-align: -0.2em; - background: var(--term-fg); - animation: blink 1s steps(1) infinite; -} - -.palette { - position: absolute; - right: 0; - top: 66px; - z-index: 2; - width: min(440px, 86%); - background: var(--bg-2); - border: 1px solid var(--line); - border-radius: 12px; - box-shadow: var(--shadow); - overflow: hidden; - opacity: 0; - transform: translateY(-6px) scale(0.985); - transition: - opacity var(--motion), - transform var(--motion); -} - -:host(.pal-open) .palette { - opacity: 1; - transform: none; -} - -.pal-search { - display: flex; - align-items: center; - gap: 10px; - padding: 14px 16px; - border-bottom: 1px solid var(--line-soft); - font-size: 15px; -} - -.pal-search svg { - width: 17px; - height: 17px; - color: var(--text-2); - flex: none; -} - -.pal-placeholder { - color: var(--text-2); -} - -.pal-caret { - margin-left: -8px; -} - -.pal-search .esc { - margin-left: auto; - font-size: 11px; -} - -.pal-results { - padding: 6px; - display: grid; - gap: 2px; - min-height: 152px; - align-content: start; -} - -.pal-results li { - display: flex; - align-items: center; - gap: 10px; - padding: 9px 10px; - border-radius: 7px; - font-size: 14px; -} - -.pal-results .t { - flex: 1; - min-width: 0; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.pal-results .where { - font-size: 12px; - color: var(--text-2); -} - -.pal-results li.is-sel { - background: rgba(var(--amber-rgb), 0.14); - box-shadow: inset 2px 0 var(--amber-edge); -} - -.pal-results li.copying { - background: rgba(var(--amber-rgb), 0.28); -} - -.pal-results mark { - background: none; - color: var(--amber-text); - font-weight: 650; -} - -.pal-foot { - display: flex; - flex-wrap: wrap; - gap: 6px 16px; - padding: 9px 16px; - border-top: 1px solid var(--line-soft); - font-size: 12px; - color: var(--text-2); -} - -.pal-foot kbd { - font-size: 11px; - margin-right: 4px; -} - -.pal-foot .lit { - color: var(--amber-text); -} - -.snip-toast { - position: absolute; - right: 4%; - bottom: 24px; - z-index: 3; - display: flex; - align-items: center; - gap: 8px; - padding: 9px 14px; - border-radius: 8px; - background: var(--bg-2); - border: 1px solid var(--line); - box-shadow: var(--shadow-soft); - font-size: 13.5px; - font-weight: 560; - opacity: 0; - transform: translateY(6px); - transition: - opacity var(--motion), - transform var(--motion); -} - -.snip-toast::before { - content: ''; - width: 8px; - height: 8px; - border-radius: 50%; - background: var(--green); -} - -:host(.copied) .snip-toast { - opacity: 1; - transform: none; -} - -@container (max-width: 520px) { - .term, - .palette { - width: 100%; - } - - .palette { - top: 56px; - } - - .cap { - height: 38px; - min-width: 42px; - font-size: 13px; - } - - .pal-results .where, - .pal-foot span:first-child { - display: none; - } - - .code { - font-size: 11.5px; - } -} diff --git a/website/src/app/home/scenes/snippets-scene.ts b/website/src/app/home/scenes/snippets-scene.ts deleted file mode 100644 index 3e3f36dc1..000000000 --- a/website/src/app/home/scenes/snippets-scene.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core'; - -import { field, part, typed } from '../../core/browser'; -import { Lang } from '../../core/lang'; -import { Language } from '../../core/language'; -import { CodeView, Line } from '../code-view'; -import { ScenePlayer } from '../scene-player'; - -const HOST = 'db-1.staging.internal'; -const USER = 'deploy'; -const QUERY = 'tunnel'; - -const FR = { - title: 'Tunnel vers la base de staging', - copyFilled: 'Copier rempli', - fields: 'Champs', - goes: 'Ce qui part dans le presse-papiers', - search: 'Rechercher un snippet…', - esc: 'Échap', - enter: 'Entrée', - move: 'choisir', - open: 'ouvrir', - copy: 'copier', - close: 'fermer', - copied: 'Copié dans le presse-papiers', - space: 'Plateforme', - /** What the palette finds: every space at once, the canvas filters ignored. */ - snippets: [ - 'Tunnel vers la base de staging', - 'Tunnel SSH vers Redis', - 'Postgres en local', - 'Quelles requêtes sont lentes', - 'Appeler une API avec un jeton', - ], -}; - -const EN: typeof FR = { - title: 'Tunnel to the staging database', - copyFilled: 'Copy filled', - fields: 'Fields', - goes: 'What goes to the clipboard', - search: 'Search a snippet…', - esc: 'Esc', - enter: 'Enter', - move: 'move', - open: 'open', - copy: 'copy', - close: 'close', - copied: 'Copied to the clipboard', - space: 'Platform', - snippets: [ - 'Tunnel to the staging database', - 'SSH tunnel to Redis', - 'Postgres on localhost', - 'Which queries are slow', - 'Call an API with a token', - ], -}; - -const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; - -const LANGUAGES = ['sh', 'sh', 'sh', 'sql', 'sh']; - -const SNIPPET: readonly Line[] = [ - [['k', 'ssh'], ' -N -L ', ['n', '5433'], ':', ['fld', field('db_host')], ':', ['n', '5432'], ' \\'], - [' ', ['fld', field('user')], '@bastion.internal'], -]; - -/** Two fields filled in, then the same snippet recalled over a terminal with Ctrl Alt P. */ -@Component({ - selector: 'app-snippets-scene', - imports: [CodeView], - templateUrl: './snippets-scene.html', - styleUrl: './snippets-scene.scss', - changeDetection: ChangeDetectionStrategy.OnPush, - host: { - '[attr.data-step]': 'step()', - '[class.pal-open]': 'paletteOpen()', - '[class.copied]': 'copied()', - }, -}) -export class SnippetsScene { - private readonly player = inject(ScenePlayer); - protected readonly step = this.player.step; - private readonly t = this.player.t; - protected readonly field = field; - protected readonly keys = ['Ctrl', 'Alt', 'P']; - protected readonly snippet = SNIPPET; - private readonly lang = inject(Language).lang; - protected readonly text = computed(() => TEXT[this.lang()]); - - protected readonly host = computed(() => this.typedIn(HOST, 0.05, 0.5)); - protected readonly user = computed(() => this.typedIn(USER, 0.55, 0.9)); - protected readonly hostTyping = computed(() => this.step() === 1 && this.t() < 0.52); - protected readonly userTyping = computed(() => this.step() === 1 && this.t() >= 0.52 && this.t() < 0.95); - protected readonly filled = computed(() => `${(this.host() ? 1 : 0) + (this.user() ? 1 : 0)}/2`); - protected readonly command = computed( - () => - `ssh -N -L 5433:${this.host() || field('db_host')}:5432 ${this.user() || field('user')}@bastion.internal`, - ); - - protected readonly paletteOpen = computed(() => this.step() === 2 && this.t() >= 0.2); - protected readonly query = computed(() => { - if (this.step() === 2) return typed(QUERY, part(this.t(), 0.3, 0.7)); - return this.step() === 3 ? QUERY : ''; - }); - protected readonly results = computed(() => { - const query = this.query().toLowerCase(); - return this.text().snippets.flatMap((title, i) => { - const lang = LANGUAGES[i] ?? 'sh'; - const at = title.toLowerCase().indexOf(query); - if (query && at < 0) return []; - const end = at + query.length; - return [ - { - title, - lang, - before: query ? title.slice(0, at) : title, - match: query ? title.slice(at, end) : '', - after: query ? title.slice(end) : '', - }, - ]; - }); - }); - /** The copy is `Ctrl C` in the palette: `Enter` opens the note instead. */ - protected readonly copying = computed(() => this.step() === 2 && this.t() > 0.88); - protected readonly copied = computed(() => this.step() === 3 && this.t() > 0.08); - protected readonly pasted = computed(() => (this.copied() ? this.command() : '')); - - protected pressed(index: number): boolean { - const t = this.t(); - return this.step() === 2 && t > 0.02 + index * 0.05 && t < 0.24; - } - - private typedIn(value: string, from: number, to: number): string { - const step = this.step(); - if (step === 0) return ''; - return step === 1 ? typed(value, part(this.t(), from, to)) : value; - } -} diff --git a/website/src/app/home/scenes/tools-scene.html b/website/src/app/home/scenes/tools-scene.html deleted file mode 100644 index b85bcf656..000000000 --- a/website/src/app/home/scenes/tools-scene.html +++ /dev/null @@ -1,123 +0,0 @@ -<div class="window app tools"> - <div class="app-side"> - <span class="areas"><span>Notes</span><span class="on">{{ text().tools }}</span><span>HTTP</span></span> - <span class="row"><span class="star">★</span>{{ text().favourites }}<b>2</b></span> - <span class="row" [class.on]="step() === 0">{{ text().all }}<b>33</b></span> - @if (family(); as open) { - <span class="h">{{ open.name }}</span> - @for (tool of open.tools; track tool) { - <span class="row" [class.on]="tool === open.open">{{ tool }}</span> - } - <span class="h">{{ text().recent }}</span> - <span class="row">{{ text().recentTool }}</span> - } - </div> - <div class="tools-main"> - @if (step() === 0) { - <div class="top"> - <span class="title">{{ text().tools }}</span> - <span class="sub">{{ text().count }}</span> - <span class="search" [class.typing]="searching()"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"> - <circle cx="11" cy="11" r="7" /> - <path d="m20 20-3.5-3.5" /> - </svg> - @if (query()) { - <span class="q" [class.caret]="searching()">{{ query() }}</span> - } @else { - <span class="ph">{{ text().search }}</span> - } - <kbd>{{ text().searchKeys }}</kbd> - </span> - </div> - <div class="body"> - <div class="panels" [class.dim]="query()"> - @for (panel of panels(); track panel.id) { - <div class="panel" [class.found]="panel.found" [style.--h]="panel.hue"> - <span class="panel-h" - ><span class="tile"></span>{{ panel.name }}<b>{{ panel.tools.length }}</b></span - > - @for (tool of panel.tools; track $index) { - <span class="tr" [class.match]="tool.match"> - <span class="tn" - ><span>{{ tool.name.before }}</span><mark>{{ tool.name.match }}</mark - ><span>{{ tool.name.after }}</span> - @if (tool.opens) { - <kbd>↵</kbd> - } - </span> - <span class="d" - ><span>{{ tool.line.before }}</span><mark>{{ tool.line.match }}</mark - ><span>{{ tool.line.after }}</span></span - > - </span> - } - </div> - } - </div> - </div> - } @else { - <div class="top"> - <span class="crumb">{{ text().tools }} ›</span> - <span class="title">{{ step() === 1 ? 'Cron' : 'JWT' }}</span> - <span class="star-off">☆</span> - <span class="spacer"></span> - <span class="act minor">{{ text().example }}</span> - <span class="act minor">{{ text().clear }}</span> - <span class="act primary">{{ text().save }}</span> - </div> - @if (step() === 1) { - <div class="body tool" [style.--h]="hues.time"> - <span class="label">{{ text().expression }}</span> - <span class="field" [class.typing]="!cronRead()">{{ cronTyped() }}</span> - @if (cronRead()) { - <div class="result"> - <span class="label">{{ text().readAloud }}</span> - <p class="said">{{ text().said }}</p> - </div> - } - <span class="label">{{ text().nextRuns }}</span> - <span class="runs"> - @for (run of text().runs; track run) { - <span [class.on]="$index < runsShown()">{{ run }}</span> - } - </span> - </div> - } @else { - <div class="body tool" [style.--h]="hues.crypto"> - <span class="label">{{ text().token }}</span> - <span class="field">{{ pasted() ? token : '' }}</span> - @if (decoded()) { - <div class="cols"> - <pre class="json">{ - <span class="f">"alg"</span>: <span class="s">"HS256"</span>, - <span class="f">"typ"</span>: <span class="s">"JWT"</span> -}</pre> - <pre class="json">{ - <span class="f">"sub"</span>: <span class="s">"42"</span>, - <span class="f">"name"</span>: <span class="s">"Ada"</span>, - <span class="f">"iat"</span>: <span class="n">1764547200</span>, - <span class="f">"exp"</span>: <span class="n">1767225600</span> -}</pre> - </div> - <div class="facts"> - <span><span>{{ text().issued }}</span><span>{{ text().issuedAt }}</span></span> - <span><span>{{ text().expires }}</span><span class="bad">{{ text().expired }}</span></span> - <span><span>{{ text().signature }}</span><span class="ok">{{ text().verified }}</span></span> - </div> - } - </div> - } } - <div class="scrim"></div> - <div class="dialog"> - <span class="dialog-h">{{ text().saveTitle }}</span> - <span class="what">{{ text().what }}</span> - <span class="line"><span>{{ text().noteTitle }}</span><span class="in">{{ noteTitle() }}</span></span> - <span class="line"><span>{{ text().space }}</span><span class="in">{{ text().platform }}</span></span> - <span class="line"><span>{{ text().folder }}</span><span class="in">{{ text().noFolder }}</span></span> - <span class="line"><span>{{ text().tags }}</span><span class="in">jwt, test</span></span> - <span class="go">{{ text().submit }}</span> - </div> - <div class="toast">{{ text().saved }}</div> - </div> -</div> diff --git a/website/src/app/home/scenes/tools-scene.scss b/website/src/app/home/scenes/tools-scene.scss deleted file mode 100644 index 675b8848b..000000000 --- a/website/src/app/home/scenes/tools-scene.scss +++ /dev/null @@ -1,489 +0,0 @@ -:host { - position: absolute; - inset: 0; - display: block; -} - -.tools { - grid-template-columns: 178px minmax(0, 1fr); -} - -.areas { - display: flex; - gap: 2px; - margin-bottom: 8px; - padding: 2px; - border: 1px solid var(--line); - border-radius: 7px; - font-size: 11.5px; -} - -.areas span { - flex: 1; - padding: 3px 0; - border-radius: 5px; - text-align: center; - color: var(--text-2); -} - -.areas .on { - background: var(--bg-3); - color: var(--text-0); - font-weight: 600; -} - -.app-side .row b { - margin-left: auto; - font-weight: 500; - color: var(--text-2); - font-variant-numeric: tabular-nums; -} - -.star { - color: var(--amber-text); -} - -.app-side .h { - padding-top: 10px; -} - -.tools-main { - position: relative; - display: grid; - grid-template-rows: auto minmax(0, 1fr); - min-width: 0; - background: var(--bg-0); -} - -.top { - display: flex; - align-items: center; - gap: 10px; - min-width: 0; - padding: 9px 14px; - border-bottom: 1px solid var(--line-soft); - font-size: 13px; - white-space: nowrap; -} - -.title { - font-size: 15px; - font-weight: 700; -} - -.sub, -.crumb { - color: var(--text-2); - font-size: 12px; -} - -.star-off { - color: var(--text-2); -} - -.spacer { - flex: 1; -} - -.search { - margin-left: auto; - flex: 0 1 230px; - min-width: 0; - min-height: 30px; - display: flex; - align-items: center; - gap: 6px; - padding: 0 8px; - border: 1px solid var(--line); - border-radius: 7px; - background: var(--bg-1); - color: var(--text-2); - font-size: 12.5px; - overflow: hidden; -} - -.search.typing { - border-color: var(--amber-edge); -} - -.search svg { - flex: none; - width: 14px; - height: 14px; -} - -.search .q { - color: var(--text-0); - font-family: var(--font-mono); -} - -.search kbd { - margin-left: auto; - font-size: 10px; -} - -.caret::after { - content: ''; - display: inline-block; - width: 2px; - height: 1.05em; - margin-left: 1px; - vertical-align: -0.18em; - background: var(--amber-fill); - animation: blink 900ms steps(1) infinite; -} - -.act { - padding: 5px 10px; - border: 1px solid var(--line); - border-radius: 6px; - font-size: 12px; - color: var(--text-1); -} - -.act.primary { - border-color: var(--amber-edge); - color: var(--amber-text); -} - -.body { - position: relative; - min-width: 0; - padding: 14px; - overflow: hidden; -} - -// The tools' home: one panel a family, in its hue. -.panels { - columns: 3 150px; - column-gap: 10px; -} - -.panel { - break-inside: avoid; - margin-bottom: 10px; - padding: 8px; - border: 1px solid var(--line-soft); - border-radius: 9px; - background: var(--bg-1); - transition: opacity var(--motion); -} - -.panel-h { - display: flex; - align-items: center; - gap: 7px; - padding: 2px 4px 6px; - font-size: 12px; - font-weight: 700; -} - -.panel-h b { - margin-left: auto; - font-size: 11px; - font-weight: 500; - color: var(--text-2); -} - -.tile { - flex: none; - width: 16px; - height: 16px; - border-radius: 4px; - background: rgba(var(--h), 0.18); - box-shadow: inset 0 0 0 1px rgba(var(--h), 0.55); -} - -.tr { - display: grid; - padding: 4px 6px; - border-radius: 6px; - font-size: 11.5px; -} - -.tn { - display: flex; - align-items: center; - gap: 6px; - font-weight: 600; -} - -.d { - color: var(--text-2); - font-size: 10.5px; - line-height: 1.35; -} - -.tr mark { - background: rgba(var(--amber-rgb), 0.3); - color: var(--text-0); - border-radius: 2px; -} - -.tr mark:empty { - display: none; -} - -.dim .panel:not(.found) { - opacity: 0.18; -} - -.dim .tr:not(.match) { - display: none; -} - -.dim .tr.match { - background: rgba(var(--amber-rgb), 0.13); -} - -// A tool open. -.tool { - display: grid; - gap: 10px; - align-content: start; -} - -.label { - font-size: 10.5px; - font-weight: 700; - letter-spacing: 0.08em; - text-transform: uppercase; - color: var(--text-2); -} - -.field { - min-height: 38px; - padding: 8px 10px; - border: 1px solid var(--line); - border-radius: 7px; - background: var(--bg-1); - font: 12.5px/1.55 var(--font-mono); - overflow-wrap: anywhere; -} - -.field.typing { - border-color: var(--amber-edge); -} - -.result { - display: grid; - gap: 4px; - padding: 10px 12px; - border-radius: 8px; - border: 1px solid rgba(var(--h), 0.4); - background: rgba(var(--h), 0.07); -} - -.said { - font-size: 14px; - font-weight: 600; -} - -.runs { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 4px 14px; - font: 12px var(--font-mono); - color: var(--text-1); -} - -.runs span { - opacity: 0; - transition: opacity var(--motion); -} - -.runs span.on { - opacity: 1; -} - -.cols { - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 10px; -} - -.json { - padding: 9px 11px; - border: 1px solid var(--line-soft); - border-radius: 8px; - background: var(--bg-1); - font: 11.5px/1.6 var(--font-mono); - white-space: pre-wrap; - overflow-wrap: anywhere; -} - -.facts { - display: grid; - gap: 4px; - font-size: 12.5px; -} - -.facts > span { - display: flex; - justify-content: space-between; - gap: 10px; - padding: 6px 10px; - border-radius: 7px; - border: 1px solid var(--line-soft); - background: var(--bg-1); -} - -.bad { - color: var(--red); - font-weight: 600; -} - -.ok { - color: var(--green); - font-weight: 600; -} - -// Keeping the result as a note. -.scrim { - position: absolute; - inset: 0; - background: rgba(var(--backdrop-rgb), 0.55); - opacity: 0; - pointer-events: none; - transition: opacity var(--motion); -} - -.dialog { - position: absolute; - left: 50%; - top: 50%; - width: min(340px, 86%); - display: grid; - gap: 9px; - padding: 16px; - border: 1px solid var(--line); - border-radius: 12px; - background: var(--bg-2); - box-shadow: var(--shadow); - font-size: 12.5px; - opacity: 0; - transform: translate(-50%, -46%); - transition: - opacity var(--motion), - transform var(--motion); -} - -.dialog-h { - font-size: 14px; - font-weight: 700; -} - -.what { - color: var(--text-2); - font-size: 11.5px; -} - -.line { - display: grid; - grid-template-columns: 62px minmax(0, 1fr); - align-items: center; - gap: 8px; -} - -.line > span:first-child { - color: var(--text-2); -} - -.in { - min-height: 28px; - padding: 5px 8px; - border: 1px solid var(--line); - border-radius: 6px; - background: var(--bg-0); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.go { - justify-self: end; - padding: 6px 12px; - border-radius: 7px; - background: var(--amber-fill); - color: var(--amber-ink); - font-weight: 650; - transition: transform var(--motion-fast); -} - -:host(.saving) .scrim { - opacity: 1; -} - -:host(.saving) .dialog { - opacity: 1; - transform: translate(-50%, -50%); -} - -:host(.pressed) .go { - transform: translateY(1px); -} - -.toast { - position: absolute; - right: 14px; - bottom: 14px; - display: flex; - align-items: center; - gap: 8px; - max-width: calc(100% - 28px); - padding: 8px 12px; - border-radius: 8px; - border: 1px solid var(--line); - background: var(--bg-2); - box-shadow: var(--shadow-soft); - font-size: 12.5px; - font-weight: 560; - opacity: 0; - transform: translateY(6px); - transition: - opacity var(--motion), - transform var(--motion); -} - -.toast::before { - content: ''; - flex: none; - width: 8px; - height: 8px; - border-radius: 50%; - background: var(--green); -} - -:host(.saved) .toast { - opacity: 1; - transform: none; -} - -@container (max-width: 600px) { - .tools { - grid-template-columns: minmax(0, 1fr); - } - - .app-side { - display: none; - } - - .panels { - columns: 2 130px; - } - - .sub, - .act.minor { - display: none; - } -} - -@container (max-width: 420px) { - .cols { - grid-template-columns: minmax(0, 1fr); - } - - .search kbd { - display: none; - } -} diff --git a/website/src/app/home/scenes/tools-scene.ts b/website/src/app/home/scenes/tools-scene.ts deleted file mode 100644 index 15087e0a2..000000000 --- a/website/src/app/home/scenes/tools-scene.ts +++ /dev/null @@ -1,370 +0,0 @@ -import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core'; - -import { part, typed } from '../../core/browser'; -import { Lang } from '../../core/lang'; -import { Language } from '../../core/language'; -import { ScenePlayer } from '../scene-player'; - -type Category = 'text' | 'crypto' | 'encode' | 'generate' | 'time' | 'calc' | 'reference'; - -/** Each family's hue, as the application's tools home draws it. */ -const HUES: Record<Category, string> = { - text: 'var(--blue-rgb)', - crypto: 'var(--purple-rgb)', - encode: 'var(--green-rgb)', - generate: 'var(--red-rgb)', - time: 'var(--teal-rgb)', - calc: 'var(--pink-rgb)', - reference: 'var(--olive-rgb)', -}; - -type Catalogue = readonly { id: Category; name: string; tools: readonly (readonly [string, string])[] }[]; - -/** The catalogue as the application lists it, a name and one line each. */ -const FR_CATALOGUE: Catalogue = [ - { - id: 'text', - name: 'Texte', - tools: [ - ['Convertisseur de casse', 'camelCase, snake_case, dot.case…'], - ['Sauts de ligne', 'CRLF ↔ LF, espaces en fin de ligne'], - ['Statistiques du texte', 'Caractères, mots, lignes, octets'], - ['Diff', 'Deux textes, ou deux documents JSON, YAML, TOML, XML'], - ], - }, - { - id: 'crypto', - name: 'Crypto', - tools: [ - ['Hash / HMAC', 'MD5, SHA-1, SHA-2, SHA-3'], - ['Mots de passe', 'Longueur, jeux de caractères, entropie'], - ['Identifiants', 'UUID, ULID, NanoID, CUID2…'], - ['JWT', 'Décodé, ses dates lues, sa signature vérifiée'], - ], - }, - { - id: 'encode', - name: 'Encodeurs', - tools: [ - ['URL', 'Encoder, décoder, analyser'], - ['Base64 et autres bases', 'Base64, Base32, hexadécimal, binaire'], - ['JSON ↔ YAML ↔ TOML ↔ XML', 'D’un format à l’autre'], - ['Couleurs', 'HEX, RGB, HSL, OKLCH, contraste'], - ], - }, - { - id: 'generate', - name: 'Générateurs', - tools: [ - ['JSON', 'À partir d’un schéma ou d’un modèle'], - ['Identité fictive', 'Une personne de test cohérente'], - ['Lorem ipsum', 'Mots, phrases, paragraphes'], - ['QR code', 'Texte, URL, Wi-Fi, contact'], - ], - }, - { - id: 'time', - name: 'Temps', - tools: [ - ['Dates et durées', 'Unix ↔ ISO 8601, écarts et durées'], - ['Fuseaux horaires', 'Une heure, dans chaque fuseau'], - ['Cron', 'Lu à voix haute, ses prochaines exécutions'], - ], - }, - { - id: 'calc', - name: 'Calcul', - tools: [ - ['Tailles et transfert', 'Ko, Mo ↔ Kio, Mio, et le temps d’un transfert'], - ['Pourcentages', 'Part, évolution, hausse et baisse'], - ['Permissions Unix', 'chmod : 755 ↔ rwxr-xr-x'], - ['Luhn et IBAN', 'Valide ou non, et la bonne clé'], - ['Sous-réseaux CIDR', 'Masques, hôtes, découpage'], - ], - }, - { - id: 'reference', - name: 'Références', - tools: [ - ['Codes de statut HTTP', '404, 429, 503'], - ['En-têtes HTTP', 'Content-Type, CORS, CSP'], - ['Types MIME', 'Le type d’une extension'], - ['Ports courants', '22, 443, 5432, 6379'], - ['Signaux Unix', 'SIGTERM, SIGKILL, SIGHUP'], - ['Table ASCII', 'Les 128 caractères'], - ['Aide-mémoire regex', 'JavaScript et PCRE'], - ['Aide-mémoire Markdown', 'CommonMark et GitHub'], - ['Aide-mémoire Mustache', 'Variables, sections, partiels'], - ], - }, -]; - -const EN_CATALOGUE: Catalogue = [ - { - id: 'text', - name: 'Text', - tools: [ - ['Case converter', 'camelCase, snake_case, dot.case…'], - ['Line breaks', 'CRLF ↔ LF, trailing spaces'], - ['Text statistics', 'Characters, words, lines, bytes'], - ['Diff', 'Two texts, or two JSON, YAML, TOML, XML documents'], - ], - }, - { - id: 'crypto', - name: 'Crypto', - tools: [ - ['Hash / HMAC', 'MD5, SHA-1, SHA-2, SHA-3'], - ['Passwords', 'Length, character sets, entropy'], - ['Identifiers', 'UUID, ULID, NanoID, CUID2…'], - ['JWT', 'Decoded, its dates read, its signature verified'], - ], - }, - { - id: 'encode', - name: 'Encoders', - tools: [ - ['URL', 'Encode, decode, take apart'], - ['Base64 and other bases', 'Base64, Base32, hexadecimal, binary'], - ['JSON ↔ YAML ↔ TOML ↔ XML', 'From one format to another'], - ['Colours', 'HEX, RGB, HSL, OKLCH, contrast'], - ], - }, - { - id: 'generate', - name: 'Generators', - tools: [ - ['JSON', 'From a schema or a template document'], - ['Fictitious identity', 'A consistent test person'], - ['Lorem ipsum', 'Words, sentences, paragraphs'], - ['QR code', 'Text, URL, Wi-Fi, contact'], - ], - }, - { - id: 'time', - name: 'Time', - tools: [ - ['Dates and durations', 'Unix ↔ ISO 8601, gaps and durations'], - ['Time zones', 'One time, in every zone chosen'], - ['Cron', 'Read aloud, its next runs'], - ], - }, - { - id: 'calc', - name: 'Calculate', - tools: [ - ['Sizes and transfer', 'kB, MB ↔ KiB, MiB, and how long a transfer takes'], - ['Percentages', 'Share, change, rise and fall'], - ['Unix permissions', 'chmod: 755 ↔ rwxr-xr-x'], - ['Luhn and IBAN', 'Valid or not, and the right check digits'], - ['CIDR subnets', 'Masks, hosts, splitting'], - ], - }, - { - id: 'reference', - name: 'References', - tools: [ - ['HTTP status codes', '404, 429, 503'], - ['HTTP headers', 'Content-Type, CORS, CSP'], - ['MIME types', 'The type of an extension'], - ['Common ports', '22, 443, 5432, 6379'], - ['Unix signals', 'SIGTERM, SIGKILL, SIGHUP'], - ['ASCII table', 'The 128 characters'], - ['Regex cheat sheet', 'JavaScript and PCRE'], - ['Markdown cheat sheet', 'CommonMark and GitHub'], - ['Mustache cheat sheet', 'Variables, sections, partials'], - ], - }, -]; - -const FR = { - catalogue: FR_CATALOGUE, - tools: 'Outils', - count: '33 utilitaires, tous hors ligne', - search: 'Rechercher un outil…', - searchKeys: 'Ctrl Maj T', - favourites: 'Favoris', - all: 'Tous les outils', - recent: 'Récents', - recentTool: 'Base64 et autres bases', - example: 'Exemple', - clear: 'Vider', - save: 'Enregistrer comme note', - expression: 'Expression', - readAloud: 'Lue à voix haute', - said: 'Toutes les 15 minutes, de 9 h à 18 h 45, du lundi au vendredi', - nextRuns: 'Prochaines exécutions', - runs: [ - 'lun. 19 oct. 09:00', - 'lun. 19 oct. 09:15', - 'lun. 19 oct. 09:30', - 'lun. 19 oct. 09:45', - 'lun. 19 oct. 10:00', - 'lun. 19 oct. 10:15', - ], - token: 'Jeton', - issued: 'Émis', - issuedAt: '1 décembre 2025, 00:00 UTC', - expires: 'Expire', - expired: '1 janvier 2026, expiré', - signature: 'Signature HS256', - verified: 'vérifiée avec le secret', - saveTitle: 'Enregistrer comme note', - what: "Un snippet JSON, avec ce que l'outil a calculé, jamais ce qui y a été tapé.", - noteTitle: 'Titre', - space: 'Espace', - folder: 'Dossier', - noFolder: 'Aucun dossier', - tags: 'Tags', - submit: 'Enregistrer', - title: 'Charge utile du jeton de test', - platform: 'Plateforme', - saved: 'Note « Charge utile du jeton de test » enregistrée dans Plateforme.', -}; - -const EN: typeof FR = { - catalogue: EN_CATALOGUE, - tools: 'Tools', - count: '33 utilities, all offline', - search: 'Search for a tool…', - searchKeys: 'Ctrl Shift T', - favourites: 'Favourites', - all: 'All tools', - recent: 'Recent', - recentTool: 'Base64 and other bases', - example: 'Example', - clear: 'Clear', - save: 'Save as note', - expression: 'Expression', - readAloud: 'Read aloud', - said: 'Every 15 minutes, from 09:00 to 18:45, Monday to Friday', - nextRuns: 'Next runs', - runs: [ - 'Mon 19 Oct 09:00', - 'Mon 19 Oct 09:15', - 'Mon 19 Oct 09:30', - 'Mon 19 Oct 09:45', - 'Mon 19 Oct 10:00', - 'Mon 19 Oct 10:15', - ], - token: 'Token', - issued: 'Issued', - issuedAt: '1 December 2025, 00:00 UTC', - expires: 'Expires', - expired: '1 January 2026, expired', - signature: 'HS256 signature', - verified: 'verified with the secret', - saveTitle: 'Save as note', - what: 'A JSON snippet, holding what the tool computed, never what was typed into it.', - noteTitle: 'Title', - space: 'Space', - folder: 'Folder', - noFolder: 'No folder', - tags: 'Tags', - submit: 'Save', - title: 'Payload of the test token', - platform: 'Platform', - saved: 'Note “Payload of the test token” saved in Platform.', -}; - -const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; - -const QUERY = 'cron'; -const CRON = '*/15 9-18 * * 1-5'; -const TOKEN = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MiIsIm5hbWUiOiJBZGEiLCJpYXQiOjE3NjQ1NDcyMDAsImV4cCI6MTc2NzIyNTYwMH0.6Zq…'; - -/** A piece of text with what the search found in it cut out. */ -interface Marked { - readonly before: string; - readonly match: string; - readonly after: string; -} - -const fold = (text: string) => text.normalize('NFD').replace(/\p{M}/gu, '').toLowerCase(); - -function mark(text: string, query: string): Marked { - const at = query ? fold(text).indexOf(fold(query)) : -1; - if (at < 0) return { before: text, match: '', after: '' }; - return { - before: text.slice(0, at), - match: text.slice(at, at + query.length), - after: text.slice(at + query.length), - }; -} - -/** Search the tools, read a cron expression, decode a JWT, keep the result as a note. */ -@Component({ - selector: 'app-tools-scene', - templateUrl: './tools-scene.html', - styleUrl: './tools-scene.scss', - changeDetection: ChangeDetectionStrategy.OnPush, - host: { - '[class.saving]': 'saving()', - '[class.pressed]': 'pressed()', - '[class.saved]': 'saved()', - }, -}) -export class ToolsScene { - private readonly player = inject(ScenePlayer); - protected readonly step = this.player.step; - private readonly t = this.player.t; - private readonly lang = inject(Language).lang; - protected readonly text = computed(() => TEXT[this.lang()]); - protected readonly hues = HUES; - protected readonly cron = CRON; - protected readonly token = TOKEN; - - protected readonly query = computed(() => - this.step() === 0 ? typed(QUERY, part(this.t(), 0.15, 0.5)) : '', - ); - protected readonly searching = computed(() => this.step() === 0 && this.t() < 0.6); - protected readonly panels = computed(() => { - const query = fold(this.query()); - let first = true; - return this.text().catalogue.map((category) => { - const tools = category.tools.map(([name, line]) => { - const match = Boolean(query) && fold(`${name} ${line}`).includes(query); - const opens = match && first; - if (match) first = false; - return { name: mark(name, this.query()), line: mark(line, this.query()), match, opens }; - }); - return { ...category, hue: HUES[category.id], tools, found: tools.some((tool) => tool.match) }; - }); - }); - - /** The open tool's family in the rail, its neighbours listed under it. */ - protected readonly family = computed(() => { - const step = this.step(); - if (step === 0) return null; - const id: Category = step === 1 ? 'time' : 'crypto'; - const category = this.text().catalogue.find((each) => each.id === id); - return category - ? { - name: category.name, - tools: category.tools.map(([name]) => name), - open: step === 1 ? 'Cron' : 'JWT', - } - : null; - }); - - protected readonly cronTyped = computed(() => - this.step() === 1 ? typed(CRON, part(this.t(), 0.02, 0.3)) : CRON, - ); - protected readonly cronRead = computed(() => this.step() > 1 || this.t() > 0.32); - protected readonly runsShown = computed(() => - this.step() === 1 - ? Math.round(this.text().runs.length * part(this.t(), 0.45, 0.85)) - : this.text().runs.length, - ); - - protected readonly pasted = computed(() => this.step() > 2 || this.t() > 0.1); - protected readonly decoded = computed(() => this.step() > 2 || this.t() > 0.3); - - protected readonly saving = computed(() => this.step() === 3 && this.t() > 0.05 && this.t() < 0.75); - protected readonly pressed = computed(() => this.step() === 3 && this.t() > 0.6 && this.t() < 0.7); - protected readonly saved = computed(() => this.step() === 3 && this.t() >= 0.72); - protected readonly noteTitle = computed(() => - this.step() === 3 ? typed(this.text().title, part(this.t(), 0.1, 0.45)) : '', - ); -} diff --git a/website/src/app/home/scenes/vault-scene.html b/website/src/app/home/scenes/vault-scene.html deleted file mode 100644 index 2e9e5f444..000000000 --- a/website/src/app/home/scenes/vault-scene.html +++ /dev/null @@ -1,32 +0,0 @@ -<div class="disk"> - <div class="disk-label"> - <span class="chip-plain">{{ text().disk }}</span><span class="algo">AES-256-GCM</span> - </div> - <div class="window note"> - <div class="win-head"> - <span class="win-title">{{ title() }}</span> - </div> - <pre>{{ body() }}</pre> - </div> -</div> -<div class="window lock"> - <app-logo /> - <p class="lib">{{ text().library }}</p> - <span class="lbl">{{ text().passphrase }}</span> - <span class="pass">{{ passphrase() }}</span> - <span class="btn-unlock">{{ text().unlock }}</span> - <p class="warn">{{ text().nowhere }}</p> -</div> -<div class="window libs"> - <div class="win-head"> - <span class="win-title">{{ text().libraries }}</span> - </div> - <ul> - @for (library of text().list; track library.name; let first = $first) { - <li> - <b>{{ library.name }}</b><span class="st" [class.open]="first">{{ library.state }}</span - ><span class="bk">{{ library.backup }}</span> - </li> - } - </ul> -</div> diff --git a/website/src/app/home/scenes/vault-scene.scss b/website/src/app/home/scenes/vault-scene.scss deleted file mode 100644 index 880ccfa56..000000000 --- a/website/src/app/home/scenes/vault-scene.scss +++ /dev/null @@ -1,188 +0,0 @@ -:host { - position: absolute; - inset: 0; - display: block; - --c: var(--pink-rgb); -} - -.disk { - position: absolute; - left: 0; - top: 0; - width: min(440px, 100%); - display: grid; - gap: 10px; - transition: opacity var(--motion-scene); -} - -:host([data-step='1']) .disk { - opacity: 0.45; -} - -.disk-label { - display: flex; - align-items: center; - gap: 10px; - font-size: 12.5px; - color: var(--text-2); -} - -.chip-plain { - padding: 3px 10px; - border-radius: 999px; - border: 1px solid var(--line); - color: var(--text-1); - font-weight: 600; -} - -.algo { - font-family: var(--font-mono); - color: var(--pink); -} - -.note .win-title { - font-family: var(--font-mono); - font-size: 13px; -} - -.note pre { - min-height: 128px; - padding: 14px 16px 18px; - font: 12.5px/1.75 var(--font-mono); - color: var(--text-1); - white-space: pre-wrap; - overflow-wrap: anywhere; -} - -.lock, -.libs { - position: absolute; - right: 0; - opacity: 0; - transform: translateY(14px); - transition: - opacity var(--motion-scene), - transform var(--motion-scene); -} - -:host([data-step='1']) .lock, -:host([data-step='2']) .libs { - opacity: 1; - transform: none; -} - -.lock { - top: 150px; - width: min(330px, 92%); - padding: 20px; - display: grid; - gap: 10px; - justify-items: start; - --logo-size: 34px; -} - -.lib { - font-weight: 680; - font-size: 15px; -} - -.lbl { - font-size: 12px; - color: var(--text-2); - font-weight: 600; -} - -.pass { - width: 100%; - min-height: 40px; - padding: 8px 12px; - border: 1px solid var(--amber-edge); - border-radius: 7px; - background: var(--bg-0); - font: 16px/1.4 var(--font-mono); - letter-spacing: 0.12em; - color: var(--text-0); - overflow: hidden; - white-space: nowrap; -} - -.btn-unlock { - display: inline-flex; - align-items: center; - min-height: 38px; - padding: 0 14px; - border-radius: 7px; - background: var(--amber-fill); - color: var(--amber-ink); - font-weight: 650; - font-size: 13.5px; - transition: transform var(--motion-fast); -} - -:host(.pressed) .btn-unlock { - transform: translateY(1px); - background: color-mix(in srgb, var(--amber-fill) 80%, #000000); -} - -.warn { - font-size: 12px; - color: var(--text-2); -} - -.libs { - top: 120px; - width: min(380px, 94%); -} - -.libs ul { - display: grid; - padding: 6px; -} - -.libs li { - display: grid; - grid-template-columns: minmax(0, 1fr) auto; - gap: 2px 10px; - padding: 10px; - border-radius: 7px; - font-size: 13px; -} - -.libs li + li { - border-top: 1px solid var(--line-soft); -} - -.libs b { - font-weight: 650; -} - -.st { - font-size: 12px; - color: var(--text-2); -} - -.st.open { - color: var(--green); -} - -.bk { - grid-column: 1 / -1; - font-size: 12px; - color: var(--text-2); -} - -@container (max-width: 520px) { - .lock { - top: 170px; - width: 100%; - } - - .libs { - top: 190px; - width: 100%; - } - - .note pre { - font-size: 11.5px; - } -} diff --git a/website/src/app/home/scenes/vault-scene.ts b/website/src/app/home/scenes/vault-scene.ts deleted file mode 100644 index 0415cd043..000000000 --- a/website/src/app/home/scenes/vault-scene.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core'; - -import { part } from '../../core/browser'; -import { Lang } from '../../core/lang'; -import { Language } from '../../core/language'; -import { Logo } from '../../shell/logo'; -import { ScenePlayer } from '../scene-player'; - -const COMMAND = 'ssh -N -L 5433:{{db_host}}:5432 \\\n {{user}}@bastion.internal\n\n'; - -const FR = { - title: 'Tunnel vers la base de staging', - body: `${COMMAND}# Ouvre la base de staging sur le port 5433`, - disk: 'Sur le disque', - library: 'Bibliothèque Travail', - passphrase: 'Phrase de passe', - unlock: 'Déverrouiller', - nowhere: "Elle n'est enregistrée nulle part.", - libraries: 'Bibliothèques', - list: [ - { name: 'Travail', state: 'ouverte', backup: 'Sauvegardée ce matin à 08:12' }, - { name: 'Personnel', state: 'verrouillée', backup: 'Sauvegardée hier à 19:40' }, - { name: 'Client Atlas', state: 'verrouillée', backup: 'Sauvegardée lundi à 09:05' }, - ], -}; - -const EN: typeof FR = { - title: 'Tunnel to the staging database', - body: `${COMMAND}# Opens the staging database on port 5433`, - disk: 'On disk', - library: 'Work library', - passphrase: 'Passphrase', - unlock: 'Unlock', - nowhere: 'It is stored nowhere.', - libraries: 'Libraries', - list: [ - { name: 'Work', state: 'open', backup: 'Backed up this morning at 08:12' }, - { name: 'Personal', state: 'locked', backup: 'Backed up yesterday at 19:40' }, - { name: 'Client Atlas', state: 'locked', backup: 'Backed up on Monday at 09:05' }, - ], -}; - -const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; - -const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -const PASSPHRASE_LENGTH = 18; - -/** A fixed hash rather than `Math.random`: the build and the browser must draw the same noise. */ -function noise(i: number): number { - let x = Math.imul(i + 1, 2654435761) >>> 0; - x ^= x >>> 13; - x = Math.imul(x, 1274126177) >>> 0; - return (x % 10007) / 10007; -} - -/** The text as it sits on disk, `ratio` of its characters sealed. */ -function seal(text: string, ratio: number, offset: number): string { - return [...text] - .map((char, i) => - char === '\n' || noise(i + offset) >= ratio - ? char - : (ALPHABET[Math.floor(noise(i * 31 + offset + 7) * 64)] ?? char), - ) - .join(''); -} - -/** The note sealed on disk, the passphrase that opens it, then the libraries and their backups. */ -@Component({ - selector: 'app-vault-scene', - imports: [Logo], - templateUrl: './vault-scene.html', - styleUrl: './vault-scene.scss', - changeDetection: ChangeDetectionStrategy.OnPush, - host: { - '[attr.data-step]': 'step()', - '[class.pressed]': 'pressed()', - }, -}) -export class VaultScene { - private readonly player = inject(ScenePlayer); - protected readonly step = this.player.step; - private readonly t = this.player.t; - private readonly lang = inject(Language).lang; - protected readonly text = computed(() => TEXT[this.lang()]); - - private readonly sealed = computed(() => { - const step = this.step(); - const ratio = step === 0 ? part(this.t(), 0.1, 0.85) : step === 1 ? 1 - part(this.t(), 0.78, 1) : 0; - return Math.round(ratio * 50) / 50; - }); - protected readonly title = computed(() => seal(this.text().title, this.sealed(), 0)); - protected readonly body = computed(() => seal(this.text().body, this.sealed(), 400)); - protected readonly passphrase = computed(() => { - const step = this.step(); - if (step === 2) return '•'.repeat(PASSPHRASE_LENGTH); - return step === 1 ? '•'.repeat(Math.round(PASSPHRASE_LENGTH * part(this.t(), 0.1, 0.65))) : ''; - }); - protected readonly pressed = computed(() => this.step() === 1 && this.t() > 0.72 && this.t() < 0.8); -} diff --git a/website/src/app/not-found/not-found-page.ts b/website/src/app/not-found/not-found-page.ts index 0ae95b8d6..2e7de7f3c 100644 --- a/website/src/app/not-found/not-found-page.ts +++ b/website/src/app/not-found/not-found-page.ts @@ -8,6 +8,7 @@ import { docPath } from '../docs/doc-index'; const FR = { title: 'Page introuvable · DevNotes', + label: 'Page introuvable', description: "Cette page n'existe pas. La documentation et le téléchargement de DevNotes sont toujours là.", heading: "Cette page n'existe pas.", lede: "L'adresse a peut-être changé. La documentation et le téléchargement sont toujours là.", @@ -17,6 +18,7 @@ const FR = { const EN: typeof FR = { title: 'Page not found · DevNotes', + label: 'Page not found', description: 'This page does not exist. The DevNotes documentation and download are still there.', heading: 'This page does not exist.', lede: 'The address may have changed. The documentation and the download are still there.', @@ -30,13 +32,17 @@ const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; selector: 'app-not-found-page', imports: [RouterLink], template: ` - <section class="wrap lost" aria-labelledby="lost-h"> - <span class="chip">404</span> - <h1 id="lost-h">{{ text().heading }}</h1> - <p class="lede">{{ text().lede }}</p> - <div class="cta-row"> - <a class="btn btn-primary" [routerLink]="home()">{{ text().home }}</a> - <a class="btn btn-ghost" [routerLink]="docs()">{{ text().docs }}</a> + <section class="sec" aria-labelledby="lost-h"> + <div class="sec-h col"> + <span><b>404</b> / {{ text().label }}</span> + </div> + <div class="lost col"> + <h1 id="lost-h">{{ text().heading }}</h1> + <p class="lede">{{ text().lede }}</p> + <div class="cta-row"> + <a class="btn btn-primary" [routerLink]="home()">{{ text().home }}</a> + <a class="btn btn-ghost" [routerLink]="docs()">{{ text().docs }}</a> + </div> </div> </section> `, @@ -45,15 +51,7 @@ const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; display: grid; gap: 22px; justify-items: start; - padding-block: clamp(64px, 12vw, 160px) 0; - } - - .chip { - padding: 4px 10px; - border-radius: 999px; - border: 1px solid var(--line); - color: var(--text-2); - font: 600 13px var(--font-mono); + padding-block: clamp(56px, 10vw, 128px); } `, changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/website/src/app/shell/site-footer.ts b/website/src/app/shell/site-footer.ts index 226ee9706..65e6b4152 100644 --- a/website/src/app/shell/site-footer.ts +++ b/website/src/app/shell/site-footer.ts @@ -3,6 +3,7 @@ import { RouterLink } from '@angular/router'; import { Lang, accessibilityPath, downloadPath } from '../core/lang'; import { Language } from '../core/language'; +import { VERSION } from '../core/release'; import { CHANGELOG, LICENSE, REPOSITORY } from '../core/site'; import { docPath } from '../docs/doc-index'; import { Logo } from './logo'; @@ -11,6 +12,9 @@ const FR = { about: 'Logiciel libre et gratuit, sous licence GPL-3.0. Aucun compte, aucune télémétrie : vos notes ne quittent pas votre machine.', nav: 'Pied de page', + site: 'Le site', + project: 'Le projet', + version: 'Version', download: 'Télécharger', docs: 'Documentation', source: 'Code source', @@ -24,6 +28,9 @@ const EN: typeof FR = { about: 'Free software, released under the GPL-3.0. No account, no telemetry: your notes never leave your machine.', nav: 'Footer', + site: 'The site', + project: 'The project', + version: 'Version', download: 'Download', docs: 'Documentation', source: 'Source code', @@ -39,42 +46,57 @@ const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; selector: 'app-site-footer', imports: [RouterLink, Logo], template: ` - <footer class="site-foot"> - <div class="wrap"> - <div class="foot-brand"> + <footer class="site-foot sec"> + <div class="cells foot-grid"> + <div class="cell foot-brand"> <span class="brand"><app-logo />DevNotes</span> <p>{{ t().about }}</p> + <p class="version">{{ t().version }} {{ version }}</p> </div> - <nav class="foot-links" [attr.aria-label]="t().nav"> - <a [routerLink]="links().download">{{ t().download }}</a> - <a [routerLink]="links().docs">{{ t().docs }}</a> - <a [href]="repository">{{ t().source }}</a> - <a [href]="changelog">{{ t().changelog }}</a> - <a [href]="license">{{ t().license }}</a> - <a [routerLink]="links().privacy">{{ t().privacy }}</a> - <a [routerLink]="links().accessibility">{{ t().accessibility }}</a> + <nav class="cell foot-links" [attr.aria-label]="t().nav"> + <div> + <p class="h">{{ t().site }}</p> + <a [routerLink]="links().download">{{ t().download }}</a> + <a [routerLink]="links().docs">{{ t().docs }}</a> + <a [routerLink]="links().privacy">{{ t().privacy }}</a> + <a [routerLink]="links().accessibility">{{ t().accessibility }}</a> + </div> + <div> + <p class="h">{{ t().project }}</p> + <a [href]="repository">{{ t().source }}</a> + <a [href]="changelog">{{ t().changelog }}</a> + <a [href]="license">{{ t().license }}</a> + </div> </nav> </div> </footer> `, styles: ` .site-foot { - border-top: 1px solid var(--line-soft); - margin-top: clamp(64px, 10vw, 128px); - padding-block: 40px 24px; color: var(--text-1); font-size: 14.5px; } - .wrap { + .foot-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); - gap: 24px 48px; + } + + .cell { + padding: 36px var(--pad) 40px; + } + + .cell + .cell { + border-left: 1px solid var(--line-soft); } .foot-brand { display: grid; - gap: 10px; + align-content: start; + gap: 12px; + } + + .foot-brand p { max-width: 34em; } @@ -87,22 +109,44 @@ const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; color: var(--text-0); } + .version { + font: 500 12.5px var(--font-mono); + color: var(--text-2); + } + .foot-links { - display: flex; - flex-wrap: wrap; - gap: 6px 22px; + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 24px; + } + + .foot-links div { + display: grid; align-content: start; + gap: 4px; + } + + .h { + margin-bottom: 6px; + font: 500 12.5px var(--font-mono); + color: var(--text-2); } .foot-links a { - text-underline-offset: 3px; + justify-self: start; padding-block: 4px; + text-underline-offset: 3px; } - @media (max-width: 700px) { - .wrap { + @media (max-width: 760px) { + .foot-grid { grid-template-columns: minmax(0, 1fr); } + + .cell + .cell { + border-left: 0; + border-top: 1px solid var(--line-soft); + } } `, changeDetection: ChangeDetectionStrategy.OnPush, @@ -112,6 +156,7 @@ export class SiteFooter { protected readonly repository = REPOSITORY; protected readonly changelog = CHANGELOG; protected readonly license = LICENSE; + protected readonly version = VERSION; protected readonly t = computed(() => TEXT[this.language.lang()]); protected readonly links = computed(() => { const lang = this.language.lang(); diff --git a/website/src/app/shell/site-header.html b/website/src/app/shell/site-header.html index e0919af08..545b69e00 100644 --- a/website/src/app/shell/site-header.html +++ b/website/src/app/shell/site-header.html @@ -1,13 +1,10 @@ <header class="site-head"> - <div class="wrap head-row"> + <div class="col head-row"> <a class="brand" [routerLink]="links().home" [attr.aria-label]="t().home" ><app-logo /><span>DevNotes</span></a > - <span class="here" [class.off]="!here()" [style.--c]="rgb(here()?.tone ?? 'grey')" aria-hidden="true"> - <span class="sw"></span>{{ here()?.name }} - </span> <nav class="site-nav" [attr.aria-label]="t().main"> - <a class="link" [routerLink]="links().home" fragment="snippets">{{ t().features }}</a> + <a class="link" [routerLink]="links().home" fragment="journee">{{ t().day }}</a> <a class="link" [routerLink]="links().docs" routerLinkActive="is-current" ariaCurrentWhenActive="page" >{{ t().docs }}</a > @@ -90,8 +87,8 @@ </svg> </button> </div> - <nav class="wrap menu-panel" id="site-menu" [attr.aria-label]="t().menu" [hidden]="!menuOpen()"> - <a [routerLink]="links().home" fragment="snippets">{{ t().features }}</a> + <nav class="col menu-panel" id="site-menu" [attr.aria-label]="t().menu" [hidden]="!menuOpen()"> + <a [routerLink]="links().home" fragment="journee">{{ t().day }}</a> <a [routerLink]="links().docs" routerLinkActive="is-current" ariaCurrentWhenActive="page" >{{ t().docs }}</a > @@ -100,13 +97,4 @@ > <a [href]="repository">GitHub</a> </nav> - @if (progress.segments().length) { - <div class="progress" aria-hidden="true"> - @for (segment of progress.segments(); track segment.anchor; let i = $index) { - <span [style.--c]="rgb(segment.tone)" [style.--w]="progress.reading().weights[i]"> - <i [style.--f]="progress.reading().fills[i]"></i> - </span> - } - </div> - } </header> diff --git a/website/src/app/shell/site-header.scss b/website/src/app/shell/site-header.scss index 05fce658c..ce4dc25fb 100644 --- a/website/src/app/shell/site-header.scss +++ b/website/src/app/shell/site-header.scss @@ -2,9 +2,7 @@ position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; - background: var(--head-bg); - backdrop-filter: blur(12px); - -webkit-backdrop-filter: blur(12px); + background: var(--bg-0); border-bottom: 1px solid var(--line-soft); } @@ -12,7 +10,7 @@ display: flex; align-items: center; gap: 12px; - min-height: 64px; + min-height: calc(var(--head-h) - 1px); } .brand { @@ -23,37 +21,7 @@ font-size: 17px; letter-spacing: -0.01em; text-decoration: none; -} - -// The section being read. Kept in the row while empty: it is what pushes the nav right. -.here { margin-right: auto; - min-width: 0; - display: inline-flex; - align-items: center; - gap: 8px; - padding: 5px 10px; - border-radius: 7px; - background: rgba(var(--c), 0.12); - border: 1px solid rgba(var(--c), 0.45); - font-size: 13px; - font-weight: 600; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - transition: opacity var(--motion); -} - -.here .sw { - width: 9px; - height: 9px; - border-radius: 3px; - background: rgb(var(--c)); - flex: none; -} - -.here.off { - opacity: 0; } .site-nav { @@ -137,28 +105,6 @@ color: var(--amber-text); } -// One segment per section, as long as the section, filled as it is read. -.progress { - display: flex; - gap: 2px; - height: 3px; -} - -.progress span { - position: relative; - flex: var(--w, 1) 1 0; - background: rgba(var(--c), 0.18); - overflow: hidden; -} - -.progress i { - position: absolute; - inset: 0; - background: rgb(var(--c)); - transform-origin: left; - transform: scaleX(var(--f, 0)); -} - @media (max-width: 820px) { .site-nav { display: none; @@ -175,16 +121,8 @@ } } -// A phone keeps the name; the section being read gives way first, then GitHub, still in the menu. +// A phone keeps the name; GitHub gives way, still in the menu. @media (max-width: 560px) { - .here { - display: none; - } - - .brand { - margin-right: auto; - } - .icon-btn.source { display: none; } diff --git a/website/src/app/shell/site-header.ts b/website/src/app/shell/site-header.ts index 3975b1518..f9916e65d 100644 --- a/website/src/app/shell/site-header.ts +++ b/website/src/app/shell/site-header.ts @@ -5,7 +5,6 @@ import { filter } from 'rxjs'; import { Lang, downloadPath, homePath } from '../core/lang'; import { Language } from '../core/language'; -import { PageProgress, Tone } from '../core/page-progress'; import { REPOSITORY } from '../core/site'; import { ThemeStore } from '../core/theme.store'; import { docPath } from '../docs/doc-index'; @@ -14,7 +13,7 @@ import { Logo } from './logo'; const FR = { home: 'DevNotes, accueil', main: 'Principale', - features: 'Fonctionnalités', + day: 'Une journée', docs: 'Documentation', download: 'Télécharger', toLight: 'Passer au thème clair', @@ -27,7 +26,7 @@ const FR = { const EN: typeof FR = { home: 'DevNotes, home', main: 'Main', - features: 'Features', + day: 'A day', docs: 'Documentation', download: 'Download', toLight: 'Switch to the light theme', @@ -48,7 +47,6 @@ const TEXT: Readonly<Record<Lang, typeof FR>> = { fr: FR, en: EN }; }) export class SiteHeader { protected readonly theme = inject(ThemeStore); - protected readonly progress = inject(PageProgress); protected readonly language = inject(Language); protected readonly repository = REPOSITORY; protected readonly menuOpen = signal(false); @@ -59,11 +57,8 @@ export class SiteHeader { return { home: homePath(lang), docs: docPath('overview', lang), download: downloadPath(lang) }; }); - /** The section the visitor is reading, named beside the logo. */ - protected readonly here = computed(() => this.progress.segments()[this.progress.reading().current] ?? null); - - /** Where the switch lands in the other language: the home page's sections share one address. */ - protected readonly section = computed(() => this.language.section() ?? this.here()?.anchor); + /** Where the switch lands in the other language: the section its page says is being read. */ + protected readonly section = computed(() => this.language.section() ?? undefined); constructor() { inject(Router) @@ -74,10 +69,6 @@ export class SiteHeader { .subscribe(() => this.menuOpen.set(false)); } - protected rgb(tone: Tone): string { - return `var(--${tone}-rgb)`; - } - protected toggleMenu(): void { this.menuOpen.update((open) => !open); } diff --git a/website/src/styles.scss b/website/src/styles.scss index a7d18570c..931fe25f4 100644 --- a/website/src/styles.scss +++ b/website/src/styles.scss @@ -3,3 +3,5 @@ @use 'styles/site-tokens'; @use 'styles/base'; @use 'styles/surfaces'; +@use 'styles/frame'; +@use 'styles/pieces'; diff --git a/website/src/styles/_base.scss b/website/src/styles/_base.scss index 6a01ca620..3a39acc56 100644 --- a/website/src/styles/_base.scss +++ b/website/src/styles/_base.scss @@ -92,26 +92,19 @@ pre { border: 0; } -// Grows with a large screen rather than leaving it empty on both sides. -.wrap { - max-width: clamp(76rem, 84vw, 120rem); - margin-inline: auto; - padding-inline: clamp(16px, 4vw, 40px); -} - h1 { - font-size: clamp(2.3rem, 4.4vw, 5.2rem); - line-height: 1.04; - letter-spacing: -0.035em; - font-weight: 760; + font-size: clamp(2.5rem, 5.4vw, 4.75rem); + line-height: 1; + letter-spacing: -0.042em; + font-weight: 650; text-wrap: balance; } h2 { - font-size: clamp(1.7rem, 2.9vw, 3.2rem); - line-height: 1.1; - letter-spacing: -0.028em; - font-weight: 720; + font-size: clamp(1.8rem, 3.4vw, 3rem); + line-height: 1.12; + letter-spacing: -0.03em; + font-weight: 620; text-wrap: balance; } diff --git a/website/src/styles/_frame.scss b/website/src/styles/_frame.scss new file mode 100644 index 000000000..7637c529d --- /dev/null +++ b/website/src/styles/_frame.scss @@ -0,0 +1,82 @@ +// The construction grid every page is drawn on: one column between two hairlines, sections +// between rules with a cross where they meet (the hairlines themselves are the root's, app.ts). +// `--gl` and `--gr` are the gutters, `--pad` the room between a hairline and what it frames: +// `.col` sets text inside the column, `.cells` lays cells edge to edge against its hairlines. +:root { + --col: min(1600px, max(1240px, 68vw)); + --gut: max(12px, (100vw - var(--col)) / 2); + --pad: clamp(14px, 2.2vw, 28px); + --gl: max(var(--gut), env(safe-area-inset-left, 0px)); + --gr: max(var(--gut), env(safe-area-inset-right, 0px)); +} + +// From here the right gutter is wide enough to hold a page's own index: the hour of the day. +@media (min-width: 1380px) { + :root { + --gut: max(184px, (100vw - var(--col)) / 2); + } +} + +.col { + padding-left: calc(var(--gl) + var(--pad)); + padding-right: calc(var(--gr) + var(--pad)); +} + +.cells { + padding-left: var(--gl); + padding-right: var(--gr); +} + +.sec { + position: relative; + border-top: 1px solid var(--line-soft); +} + +.sec:first-child { + border-top: 0; +} + +.sec::before, +.sec::after { + content: ''; + position: absolute; + top: -5px; + z-index: 2; + width: 9px; + height: 9px; + background: + linear-gradient(var(--text-2), var(--text-2)) center / 1px 100% no-repeat, + linear-gradient(var(--text-2), var(--text-2)) center / 100% 1px no-repeat; + pointer-events: none; +} + +.sec::before { + left: calc(var(--gl) - 4px); +} + +.sec::after { + right: calc(var(--gr) - 4px); +} + +// A section's number and name on the left, what it holds on the right. +.sec-h { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + gap: 4px 24px; + padding-block: 16px; + border-bottom: 1px solid var(--line-soft); + font: 500 12.5px/1.5 var(--font-mono); + color: var(--text-2); +} + +.sec-h b { + font-weight: 500; + color: var(--amber-text); +} + +// A section whose name is its heading: the outline has it, the eye reads it as the others. +.sec-h h2 { + font: inherit; + letter-spacing: normal; +} diff --git a/website/src/styles/_pieces.scss b/website/src/styles/_pieces.scss new file mode 100644 index 000000000..e56aee752 --- /dev/null +++ b/website/src/styles/_pieces.scss @@ -0,0 +1,1448 @@ +// The application's pieces drawn large for the day's scenes, and how they move. A scene shows +// where it ends: without script, under reduced motion, and to a crawler. `anim`, set by the loop +// directive, puts it back at its start; `run` plays it, each piece at its own `--d` delay. +// Every rule starts at `.scene`: the global surfaces (`.code`, `.k`…) must not reach in, nor these out. + +.scene .piece { + position: relative; + background: var(--bg-1); + border: 1px solid var(--line-soft); + border-radius: 10px; + box-shadow: var(--piece-shadow); + font: 400 14px/1.5 var(--font-sans); + color: var(--text-0); + text-align: left; +} + +.scene .piece-h { + display: flex; + align-items: center; + gap: 8px; + min-height: 42px; + padding: 0 12px; + border-bottom: 1px solid var(--line-soft); +} + +.scene .piece-h b { + min-width: 0; + font-weight: 600; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.scene .piece-b { + padding: 12px; +} + +.scene .piece-f { + display: flex; + justify-content: flex-end; + gap: 8px; + padding: 10px 12px; + border-top: 1px solid var(--line-soft); +} + +.scene .kind { + flex: none; + display: grid; + place-items: center; + width: 22px; + height: 22px; + border-radius: 6px; + color: var(--k); + background: color-mix(in srgb, var(--k) 16%, transparent); +} + +.scene .kind svg { + width: 13px; + height: 13px; + fill: none; + stroke: currentColor; + stroke-width: 2; + stroke-linecap: round; + stroke-linejoin: round; +} + +.scene .k-snip { + --k: var(--green); +} + +.scene .k-note { + --k: var(--purple); +} + +.scene .k-calc { + --k: var(--pink); +} + +.scene .k-list { + --k: var(--text-1); +} + +.scene .k-draw { + --k: var(--teal); +} + +.scene .k-http { + --k: var(--blue); +} + +.scene .k-tool { + --k: var(--amber-text); +} + +.scene .tag-r { + margin-left: auto; + font-size: 12px; + color: var(--amber-text); + white-space: nowrap; +} + +.scene .dim { + color: var(--text-2); +} + +.scene .mono { + font-family: var(--font-mono); + font-size: 12.5px; + line-height: 1.75; + white-space: pre; + color: var(--text-1); +} + +.scene .label { + margin-bottom: 6px; + font-size: 11px; + font-weight: 600; + letter-spacing: 0.05em; + color: var(--text-2); +} + +.scene .env { + margin-left: auto; + display: flex; + align-items: center; + gap: 6px; + font-size: 12px; + color: var(--text-1); +} + +.scene .env i { + width: 7px; + height: 7px; + border-radius: 50%; + background: var(--green); +} + +.scene .btn-a { + display: inline-flex; + align-items: center; + height: 30px; + padding: 0 12px; + border-radius: 7px; + background: var(--amber-fill); + color: var(--amber-ink); + font: 600 12px var(--font-sans); + white-space: nowrap; +} + +.scene .toast { + position: absolute; + right: 14px; + bottom: -18px; + display: flex; + align-items: center; + gap: 8px; + padding: 8px 12px; + border: 1px solid var(--line); + border-left: 3px solid var(--green); + border-radius: 8px; + background: var(--bg-2); + font-size: 12.5px; + font-weight: 600; + box-shadow: var(--piece-shadow); +} + +.scene .toast svg { + width: 14px; + height: 14px; + fill: none; + stroke: var(--green); + stroke-width: 2.4; + stroke-linecap: round; + stroke-linejoin: round; +} + +.scene .stack { + display: grid; +} + +.scene .stack > * { + grid-area: 1 / 1; + align-self: center; +} + +.scene .swap { + display: inline-grid; +} + +.scene .swap > * { + grid-area: 1 / 1; +} + +// What moves: typed, folded, revealed, entering, leaving, shown for a while. +.scene .ty, +.scene .ph { + display: inline-block; + vertical-align: bottom; + overflow: hidden; + white-space: pre; +} + +.scene .ty { + color: var(--text-0); +} + +.scene .ph { + display: none; + border-radius: 3px; + color: var(--amber-text); + background: rgba(var(--amber-rgb), 0.16); +} + +.scene .o, +.scene .o2, +.scene .win { + visibility: hidden; +} + +.scene .caret { + display: none; +} + +.anim .ty { + width: 0; +} + +.anim .ph { + display: inline-block; + width: calc(var(--n) * 1ch); +} + +.anim .rv { + clip-path: inset(0 100% 0 0); +} + +.anim .in, +.anim .pop, +.anim .o2, +.anim .win { + opacity: 0; +} + +.anim .o, +.anim .o2, +.anim .win { + visibility: visible; +} + +.anim .caret { + display: inline-block; + width: 1.5px; + height: 1.15em; + margin-left: 1px; + vertical-align: -3px; + background: var(--amber-fill); + animation: blink 1s steps(1) infinite; +} + +.run .ty { + animation: piece-type var(--t, 0.5s) steps(var(--n)) var(--d, 0s) forwards; +} + +.run .ph { + animation: piece-fold 0.22s ease-in var(--d, 0s) forwards; +} + +.run .rv { + animation: piece-reveal var(--t, 0.5s) steps(var(--n)) var(--d, 0s) forwards; +} + +.run .in { + animation: piece-in 0.45s var(--ease-out) var(--d, 0s) forwards; +} + +.run .pop { + animation: piece-pop 0.5s var(--ease-out) var(--d, 0s) forwards; +} + +.run .o { + animation: piece-out 0.2s ease var(--d, 0s) forwards; +} + +.run .o2 { + animation: + piece-in 0.45s var(--ease-out) var(--d, 0s) forwards, + piece-out 0.2s ease var(--d2, 0s) forwards; +} + +.run .win { + animation: piece-while var(--len) linear var(--d, 0s) both; +} + +.run .press { + animation: piece-press 0.32s ease var(--d, 0s) both; +} + +.run .flash { + animation: piece-flash 1.4s ease var(--d, 0s); +} + +@keyframes piece-type { + to { + width: calc(var(--n) * 1ch); + } +} + +@keyframes piece-fold { + to { + width: 0; + opacity: 0; + } +} + +@keyframes piece-reveal { + to { + clip-path: inset(0 0 0 0); + } +} + +@keyframes piece-in { + from { + opacity: 0; + transform: translateY(8px); + } + + to { + opacity: 1; + transform: none; + } +} + +@keyframes piece-pop { + from { + opacity: 0; + transform: scale(0.9); + } + + to { + opacity: 1; + transform: none; + } +} + +@keyframes piece-out { + to { + opacity: 0; + } +} + +@keyframes piece-while { + 0% { + opacity: 0; + transform: translateY(10px); + } + + 7%, + 91% { + opacity: 1; + transform: none; + } + + 100% { + opacity: 0; + transform: translateY(-8px); + } +} + +@keyframes piece-press { + 50% { + transform: scale(0.93); + filter: brightness(0.86); + } +} + +@keyframes piece-flash { + 20% { + background: rgba(var(--amber-rgb), 0.18); + } +} + +// A list ticking. +.scene .bar { + position: relative; + height: 4px; + margin: 2px 0 10px; + border-radius: 2px; + background: var(--bg-3); + overflow: hidden; +} + +.scene .bar i { + position: absolute; + inset: 0 auto 0 0; + width: var(--to); + background: var(--amber-fill); +} + +.scene .item { + display: flex; + align-items: center; + gap: 10px; + line-height: 2; + color: var(--text-1); +} + +.scene .tick { + position: relative; + flex: none; + width: 15px; + height: 15px; + border: 1.5px solid var(--text-2); + border-radius: 4px; +} + +.scene .tick::after { + content: ''; + position: absolute; + left: 3.5px; + top: 1px; + width: 4px; + height: 7px; + border: solid var(--amber-ink); + border-width: 0 2px 2px 0; + transform: rotate(45deg) scale(0); +} + +.scene .tick.done { + background: var(--amber-fill); + border-color: var(--amber-fill); +} + +.scene .tick.done::after { + transform: rotate(45deg) scale(1); +} + +.scene .strike { + color: var(--text-2); + text-decoration: line-through var(--text-2) 1.5px; +} + +.anim .bar i { + width: 0; +} + +.anim .tick.done { + background: transparent; + border-color: var(--text-2); +} + +.anim .tick.done::after { + transform: rotate(45deg) scale(0); +} + +.anim .strike { + color: var(--text-1); + text-decoration-color: transparent; +} + +.run .bar i { + animation: piece-grow 0.45s var(--ease-out) var(--d, 0s) forwards; +} + +.run .tick.done { + animation: piece-tick 0.25s ease var(--d, 0s) forwards; +} + +.run .tick.done::after { + animation: piece-mark 0.25s var(--ease-out) var(--d, 0s) forwards; +} + +.run .strike { + animation: piece-strike 0.3s ease var(--d, 0s) forwards; +} + +@keyframes piece-grow { + to { + width: var(--to); + } +} + +@keyframes piece-tick { + to { + background: var(--amber-fill); + border-color: var(--amber-fill); + } +} + +@keyframes piece-mark { + to { + transform: rotate(45deg) scale(1); + } +} + +@keyframes piece-strike { + to { + color: var(--text-2); + text-decoration-color: var(--text-2); + } +} + +.scene .mini { + width: 250px; + font-size: 12.5px; +} + +.scene .mini .piece-h { + min-height: 36px; +} + +.scene .mini .item { + font-size: 12px; + line-height: 1.75; +} + +.scene .mini footer { + display: flex; + justify-content: space-between; + padding: 6px 12px; + border-top: 1px solid var(--line-soft); + font-size: 11.5px; + color: var(--text-2); +} + +// A sheet counting. +.scene .calc { + display: grid; + grid-template-columns: 22px minmax(0, 1fr) auto; + gap: 3px 14px; + font: 13.5px/1.7 var(--font-mono); + color: var(--text-1); +} + +.scene .calc > *, +.scene .calc span { + white-space: nowrap; +} + +.scene .calc u { + text-decoration: none; + text-align: right; + color: var(--line-no); +} + +.scene .calc b { + font-weight: 500; + text-align: right; + color: var(--text-0); +} + +.scene .calc .sum { + font-weight: 600; + color: var(--amber-text); +} + +// A note, formatted, the Markdown it is kept as, and the slide it becomes. +.scene .md h4 { + margin: 0 0 6px; + font-size: 17px; + font-weight: 650; + letter-spacing: -0.01em; +} + +.scene .md p { + color: var(--text-1); +} + +.scene .md p b { + color: var(--text-0); +} + +.scene .md ol { + margin: 4px 0 0; + padding-left: 20px; + list-style: decimal; + color: var(--text-1); +} + +.scene .md ol li::marker { + color: var(--purple); + font-weight: 600; +} + +.scene .md code { + padding: 0 4px; + border-radius: 3px; + background: var(--bg-3); + color: var(--text-0); + font-size: 0.88em; +} + +.scene .md table { + width: 100%; + margin-top: 10px; + border-collapse: collapse; + font-size: 12.5px; +} + +.scene .md th, +.scene .md td { + padding: 5px 10px; + border: 1px solid var(--line-soft); + text-align: left; +} + +.scene .md th { + font-weight: 600; + color: var(--text-2); +} + +.scene .slide { + display: grid; + align-content: center; + gap: 12px; + aspect-ratio: 16 / 9; + padding: 7% 9%; + border: 1px solid var(--line); + border-radius: 10px; + background: var(--bg-2); + box-shadow: var(--piece-shadow); +} + +.scene .slide .label { + color: var(--amber-text); +} + +.scene .slide h4 { + margin: 0; + font-size: clamp(22px, 3vw, 32px); + letter-spacing: -0.02em; +} + +.scene .slide ol { + margin: 0; + padding-left: 22px; + list-style: decimal; + font-size: clamp(13px, 1.5vw, 16px); + line-height: 1.7; + color: var(--text-1); +} + +// A request: where its variable comes from, then its answer. +.scene .url { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px; + font: 12.5px var(--font-mono); +} + +.scene .url .verb { + padding: 4px 9px; + border: 1px solid var(--line-soft); + border-radius: 6px; + font-weight: 600; + color: var(--green); +} + +.scene .url .address { + flex: 1 1 280px; + min-width: 0; + padding: 5px 10px; + border: 1px solid var(--line); + border-radius: 7px; + white-space: nowrap; + overflow: hidden; + color: var(--text-0); +} + +.scene .chain { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px; + margin-top: 14px; + font-size: 12.5px; +} + +.scene .chain > b { + margin-right: 4px; + font: 500 12px var(--font-mono); + color: var(--amber-text); +} + +.scene .link { + padding: 3px 10px; + border: 1px dashed var(--line); + border-radius: 99px; + white-space: nowrap; +} + +.scene .link.miss { + color: var(--line-no); + text-decoration: line-through; +} + +.scene .link.hit { + border-style: solid; + border-color: var(--green); + color: var(--green); + background: rgba(var(--green-rgb), 0.12); +} + +.anim .link.miss, +.anim .link.hit { + border-style: dashed; + border-color: var(--line); + color: var(--text-2); + text-decoration: none; + background: transparent; +} + +.run .link.miss { + animation: piece-miss 0.4s ease var(--d, 0s) forwards; +} + +.run .link.hit { + animation: piece-found 0.35s ease var(--d, 0s) forwards; +} + +@keyframes piece-miss { + 40% { + border-color: var(--text-1); + color: var(--text-0); + } + + to { + color: var(--line-no); + text-decoration: line-through; + } +} + +@keyframes piece-found { + to { + border-style: solid; + border-color: var(--green); + color: var(--green); + background: rgba(var(--green-rgb), 0.12); + } +} + +.scene .answer { + display: grid; + align-content: start; + gap: 8px; + min-height: 74px; + margin-top: 14px; + padding-top: 12px; + border-top: 1px solid var(--line-soft); +} + +.scene .status { + display: flex; + gap: 14px; + font: 500 12px var(--font-mono); + color: var(--text-2); +} + +.scene .status b { + color: var(--green); +} + +.scene .body { + padding: 8px 10px; + border: 1px solid var(--line-soft); + border-radius: 7px; + color: var(--text-0); +} + +// A token taken apart. +.scene .token { + padding: 10px 12px; + border: 1px solid var(--line); + border-radius: 8px; + font: 12.5px/1.7 var(--font-mono); + word-break: break-all; +} + +.scene .token .t1 { + color: var(--red); +} + +.scene .token .t2 { + color: var(--purple); +} + +.scene .token .t3 { + color: var(--teal); +} + +.scene .parts { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); + gap: 12px; + margin-top: 14px; +} + +.scene .part { + min-width: 0; + padding: 8px 12px; + border: 1px solid var(--line-soft); + border-left: 3px solid var(--c); + border-radius: 8px; + overflow: hidden; +} + +.scene .part.head { + --c: var(--red); +} + +.scene .part.load { + --c: var(--purple); +} + +.scene .dates { + display: grid; + grid-template-columns: auto 1fr; + gap: 4px 16px; + margin-top: 14px; + font-size: 12.5px; + color: var(--text-1); +} + +.scene .dates .mono { + color: var(--text-0); +} + +.scene .state { + display: inline-flex; + margin-top: 12px; + padding: 5px 12px; + border-radius: 99px; + font-size: 13px; + font-weight: 600; + color: var(--red); + background: rgba(var(--red-rgb), 0.13); +} + +// Two files side by side. +.scene .counts { + margin-left: auto; + display: flex; + gap: 6px; + font: 500 11.5px var(--font-mono); +} + +.scene .counts span { + padding: 2px 9px; + border-radius: 99px; +} + +.scene .counts .plus { + color: var(--green); + background: rgba(var(--green-rgb), 0.14); +} + +.scene .counts .minus { + color: var(--red); + background: rgba(var(--red-rgb), 0.14); +} + +.scene .sides { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); +} + +.scene .sides > div { + min-width: 0; + padding-bottom: 8px; +} + +.scene .sides > div + div { + border-left: 1px solid var(--line-soft); +} + +.scene .side-h { + padding: 8px 12px; + border-bottom: 1px solid var(--line-soft); + font-size: 12px; + color: var(--text-1); +} + +.scene .line { + display: grid; + grid-template-columns: 30px minmax(0, 1fr); + max-height: 24px; + overflow: hidden; + font: 12px/24px var(--font-mono); + white-space: pre; +} + +.scene .line u { + padding-right: 10px; + text-decoration: none; + text-align: right; + color: var(--line-no); +} + +.scene .line s { + text-decoration: none; + overflow: hidden; + text-overflow: ellipsis; + color: var(--text-1); +} + +.scene .line em { + font-style: normal; + border-radius: 2px; +} + +.scene .was .line.ch { + background: rgba(var(--red-rgb), 0.11); +} + +.scene .now .line.ch, +.scene .now .line.add { + background: rgba(var(--green-rgb), 0.11); +} + +.scene .was .line em { + background: rgba(var(--red-rgb), 0.3); + color: var(--text-0); +} + +.scene .now .line em { + background: rgba(var(--green-rgb), 0.3); + color: var(--text-0); +} + +.scene .line.gap { + background: repeating-linear-gradient(135deg, transparent 0 5px, var(--line-soft) 5px 6px); +} + +.anim .line.ch, +.anim .line.add, +.anim .line em { + background: transparent; +} + +.anim .line em { + color: inherit; +} + +.anim .line.add, +.anim .line.gap { + opacity: 0; +} + +.run .was .line.ch, +.run .was .line em { + animation: piece-red 0.3s ease var(--d, 0s) forwards; +} + +.run .now .line.ch, +.run .now .line em { + animation: piece-green 0.3s ease var(--d, 0s) forwards; +} + +.run .line.add { + animation: + piece-green 0.3s ease var(--d, 0s) forwards, + piece-show 0.35s var(--ease-out) var(--d, 0s) forwards; +} + +.run .line.gap { + animation: piece-show 0.35s var(--ease-out) var(--d, 0s) forwards; +} + +.run .line em { + color: var(--text-0); +} + +@keyframes piece-red { + to { + background: rgba(var(--red-rgb), 0.2); + } +} + +@keyframes piece-green { + to { + background: rgba(var(--green-rgb), 0.2); + } +} + +@keyframes piece-show { + to { + opacity: 1; + } +} + +// A search narrowing. +.scene .find { + display: flex; + align-items: center; + gap: 10px; + min-height: 46px; + padding: 0 14px; + border-bottom: 1px solid var(--line-soft); +} + +.scene .find svg { + width: 15px; + height: 15px; + fill: none; + stroke: var(--text-2); + stroke-width: 2; + stroke-linecap: round; +} + +.scene .find .count { + margin-left: auto; + font-size: 12px; + color: var(--text-2); +} + +.scene .row { + display: grid; + grid-template-columns: auto minmax(0, 1fr) auto; + align-items: center; + gap: 4px 10px; + max-height: 90px; + padding: 10px 14px; + border-top: 1px solid var(--line-soft); + overflow: hidden; +} + +// The list keeps the room of the rows the search folds away: nothing under the scene moves. +.scene .rows { + min-height: 248px; +} + +.scene .rows .row:first-child { + border-top: 0; +} + +.scene .row b { + font-weight: 500; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.scene .row .where { + font-size: 12px; + color: var(--text-2); +} + +.scene .row .cite { + grid-column: 2 / -1; +} + +.scene .row.gone { + max-height: 0; + padding-block: 0; + border-top-width: 0; + opacity: 0; +} + +.scene .hit { + border-radius: 3px; + background: rgba(var(--amber-rgb), 0.16); + color: var(--amber-text); +} + +.anim .row.gone { + max-height: 90px; + padding-block: 10px; + border-top-width: 1px; + opacity: 1; +} + +.anim .rows .row.gone:first-child { + border-top-width: 0; +} + +.anim .row .cite { + opacity: 0; +} + +.anim .hit { + background: transparent; + color: inherit; +} + +.run .row.gone { + animation: piece-gone 0.4s var(--ease-out) var(--d, 0s) forwards; +} + +.run .row .cite { + animation: piece-show 0.35s var(--ease-out) var(--d, 0s) forwards; +} + +.run .hit { + animation: piece-hit 0.3s ease var(--d, 0s) forwards; +} + +@keyframes piece-gone { + to { + max-height: 0; + padding-block: 0; + border-top-width: 0; + opacity: 0; + } +} + +@keyframes piece-hit { + to { + background: rgba(var(--amber-rgb), 0.16); + color: var(--amber-text); + } +} + +// The palette, then its fields, then the terminal the command is pasted in. +.scene .pal { + padding: 12px; +} + +.scene .pal-in { + display: flex; + align-items: center; + height: 40px; + padding: 0 12px; + border: 1px solid var(--amber-edge); + border-radius: 8px; +} + +.scene .pal .label { + margin: 12px 4px 6px; +} + +.scene .found { + display: grid; + grid-template-columns: auto minmax(0, 1fr) auto; + align-items: center; + gap: 2px 10px; + padding: 9px 10px; + border-radius: 8px; + background: var(--bg-2); +} + +.scene .found .kind, +.scene .found kbd { + grid-row: span 2; +} + +.scene .found .name { + font-weight: 500; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.scene .found .name em { + margin-left: 8px; + font-size: 12px; + font-style: normal; + color: var(--amber-text); +} + +.scene .found .mono { + font-size: 11.5px; + overflow: hidden; + text-overflow: ellipsis; +} + +.scene .pal-keys { + display: flex; + flex-wrap: wrap; + gap: 4px 14px; + margin-top: 12px; + padding-top: 10px; + border-top: 1px solid var(--line-soft); + font-size: 12px; + color: var(--text-2); +} + +.scene .pal-keys kbd { + margin-right: 3px; +} + +.scene .fields { + display: grid; + gap: 12px; + padding: 18px 20px; +} + +.scene .fields h4 { + margin: 0; + font-size: 16px; +} + +.scene .fields p { + font-size: 13px; + color: var(--text-1); +} + +.scene .field { + display: grid; + grid-template-columns: 124px minmax(0, 1fr); + align-items: center; + gap: 10px; +} + +.scene .field code { + font: 500 12.5px var(--font-mono); + color: var(--amber-text); +} + +.scene .field .value { + display: flex; + align-items: center; + height: 34px; + padding: 0 10px; + border: 1px solid var(--line); + border-radius: 7px; + overflow: hidden; +} + +.scene .buttons { + display: flex; + justify-content: flex-end; + align-items: center; + gap: 12px; + padding-top: 12px; + border-top: 1px solid var(--line-soft); + font-size: 13px; + color: var(--text-1); +} + +.scene .term { + position: relative; + padding: 14px 16px 26px; + border: 1px solid var(--term-edge); + border-radius: 10px; + background: var(--term-bg); + box-shadow: var(--piece-shadow); + font: 12.5px/1.75 var(--font-mono); + white-space: pre; + color: var(--term-fg); +} + +.scene .term .label { + color: var(--term-dim); +} + +.scene .term .prompt { + color: var(--term-green); +} + +// A drawing whose arrows hold on to their shapes. +.scene .drawing { + display: block; + width: 100%; + height: auto; +} + +.scene .drawing rect, +.scene .drawing ellipse { + fill: var(--bg-2); + stroke-width: 1.5; +} + +.scene .drawing .s0 rect { + stroke: var(--text-1); +} + +.scene .drawing .s1 rect { + stroke: var(--blue); +} + +.scene .drawing .s2 rect { + stroke: var(--green); +} + +.scene .drawing .s3 ellipse { + stroke: var(--amber-fill); +} + +.scene .drawing text { + font: 500 12px var(--font-sans); + fill: var(--text-0); + text-anchor: middle; +} + +.scene .drawing .note { + font-size: 12.5px; + fill: var(--amber-text); +} + +.scene .drawing .shape { + transform-box: fill-box; + transform-origin: center; +} + +.scene .arrow { + fill: none; + stroke: var(--text-1); + stroke-width: 1.6; + stroke-dasharray: 1; + marker-end: url(#piece-head); +} + +.scene .head path { + fill: var(--text-1); +} + +.anim .arrow { + stroke-dashoffset: 1; + opacity: 0; +} + +.run .arrow { + animation: piece-draw 0.5s var(--ease-out) var(--d, 0s) forwards; +} + +@keyframes piece-draw { + from { + stroke-dashoffset: 1; + opacity: 1; + } + + to { + stroke-dashoffset: 0; + opacity: 1; + } +} + +.scene .cursor { + opacity: 0; + transition: opacity var(--motion-scene); +} + +.scene .cursor path { + fill: var(--text-0); + stroke: var(--bg-0); + stroke-width: 1.2; +} + +.scene .export { + padding: 4px 10px; + border: 1px solid var(--line-soft); + border-radius: 6px; + font-size: 12px; + white-space: nowrap; + color: var(--text-1); +} + +// A library closing: what was written is sealed, what sorts it stays readable. +.scene .lock { + display: grid; + place-items: center; + width: 28px; + height: 28px; + border-radius: 7px; + color: var(--amber-text); + background: rgba(var(--amber-rgb), 0.16); +} + +.scene .lock svg { + width: 15px; + height: 15px; + fill: none; + stroke: currentColor; + stroke-width: 2; + stroke-linecap: round; + stroke-linejoin: round; +} + +.scene .kept { + display: grid; + grid-template-columns: minmax(0, 1fr) auto auto; + align-items: center; + gap: 12px; + padding: 9px 0; + border-top: 1px solid var(--line-soft); +} + +.scene .kept:first-child { + border-top: 0; +} + +.scene .kept .tag { + font-size: 12px; + color: var(--blue); +} + +.scene .kept time { + font: 11.5px var(--font-mono); + color: var(--text-2); +} + +.scene .sealed { + justify-self: start; + max-width: 100%; + border-radius: 4px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: transparent; + background-color: var(--line-no); +} + +.anim .sealed { + color: var(--text-0); + background-color: transparent; +} + +.run .sealed { + animation: piece-seal 0.4s ease var(--d, 0s) forwards; +} + +@keyframes piece-seal { + to { + color: transparent; + background-color: var(--line-no); + } +} + +@media (max-width: 640px) { + .scene .piece { + font-size: 13px; + } + + .scene .mono, + .scene .token, + .scene .url, + .scene .calc { + font-size: 11px; + } + + .scene .parts { + grid-template-columns: minmax(0, 1fr); + } + + .scene .line { + grid-template-columns: 22px minmax(0, 1fr); + font-size: 10.5px; + } + + .scene .field { + grid-template-columns: 104px minmax(0, 1fr); + } + + .scene .mini { + width: 100%; + max-width: 300px; + } +} diff --git a/website/src/styles/_site-tokens.scss b/website/src/styles/_site-tokens.scss index fff8e0f22..18c929b9d 100644 --- a/website/src/styles/_site-tokens.scss +++ b/website/src/styles/_site-tokens.scss @@ -1,10 +1,8 @@ -// What the site draws and the application does not: the board's dotted paper, the header's -// glass, a window raised off the page, a terminal. Same shape as the shared tokens: the dark +// What the site draws and the application does not: the board's dotted paper behind a scene, a +// window or a scene's piece raised off the page, a terminal. Same shape as the shared tokens: the dark // base on `:root`, the light theme on the attribute the inline script in index.html sets. :root { - --card: var(--bg-1); --dot: rgba(var(--text-1-rgb), 0.1); - --head-bg: rgba(21, 23, 28, 0.86); // The application's stack, and Inter's stand-in (_base.scss) before the system's own faces. --font-sans: 'Inter Variable', 'Inter Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; --shadow: 0 30px 60px rgba(var(--black-rgb), 0.45); @@ -12,11 +10,12 @@ --grey-rgb: 146, 152, 172; --head-h: 68px; --motion-scene: 240ms; + // How a scene's piece enters: fast, then settling. + --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1); + --piece-shadow: 0 22px 50px -28px rgba(var(--black-rgb), 0.55); // A terminal stays dark in both themes. --term-bg: #0f1115; - --term-head: #181b21; - --term-tab: #22262e; --term-edge: #2a2e39; --term-fg: #d6d9e0; --term-dim: #8a90a0; @@ -24,10 +23,9 @@ } :root[data-theme='light'] { - --card: var(--bg-2); --dot: rgba(var(--text-1-rgb), 0.16); - --head-bg: rgba(236, 238, 242, 0.88); --shadow: 0 24px 52px rgba(26, 29, 36, 0.16); --shadow-soft: 0 10px 26px rgba(26, 29, 36, 0.12); + --piece-shadow: 0 22px 50px -28px rgba(30, 40, 70, 0.16); --grey-rgb: 99, 106, 124; } diff --git a/website/src/styles/_surfaces.scss b/website/src/styles/_surfaces.scss index b5f416a70..0e6eeb59c 100644 --- a/website/src/styles/_surfaces.scss +++ b/website/src/styles/_surfaces.scss @@ -1,5 +1,5 @@ -// The application's own surfaces, redrawn: a window, a card, a folder's zone, a code view. -// Global because the hero board, the scenes and the documentation all draw them. +// The application's window, redrawn for a block of code: its head, its title and its language. +// Global because the documentation and the download page both draw it. .window { background: var(--bg-1); @@ -51,287 +51,6 @@ color: var(--blue); } -.l-rs, -.l-js { - color: var(--amber-text); -} - -.l-css, .l-json { color: var(--purple); } - -.l-go { - color: var(--teal); -} - -// Syntax: the editor's colours, by role. -.k { - color: var(--blue); -} - -.s { - color: var(--green); -} - -.n, -.fld { - color: var(--amber-text); -} - -.f { - color: var(--purple); -} - -.c { - color: var(--text-2); - font-style: italic; -} - -.code { - display: grid; - grid-template-columns: 44px minmax(0, 1fr); - font: 13px/1.75 var(--font-mono); - padding-block: 14px; - overflow-x: auto; -} - -.code .ln { - color: var(--line-no); - text-align: right; - padding-right: 16px; - user-select: none; -} - -.code .cl { - white-space: pre; - padding-right: 16px; -} - -.btn-small { - flex: none; - display: inline-flex; - align-items: center; - min-height: 34px; - padding: 0 12px; - border-radius: 7px; - border: 1px solid var(--amber-edge); - background: transparent; - color: var(--amber-text); - font: 650 13px/1 var(--font-sans); -} - -// A note's card, as the canvas draws it. -.card { - width: 152px; - height: 128px; - padding: 10px 11px 8px; - background: var(--card); - border: 1px solid var(--line-soft); - border-radius: 8px; - display: flex; - flex-direction: column; - gap: 6px; - font-size: 11px; - overflow: hidden; -} - -.card-top { - display: flex; - gap: 7px; - align-items: flex-start; -} - -.card-top .tick { - width: 10px; - height: 10px; - margin-top: 3px; - flex: none; - border: 1px solid var(--text-2); - border-radius: 2px; - opacity: 0.7; -} - -.card-top strong { - flex: 1; - min-width: 0; - font-size: 11.5px; - line-height: 1.3; - font-weight: 650; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; -} - -.card-top .chip-lang { - font-size: 8.5px; - padding: 3px 4px; -} - -.card pre { - margin: 0; - font: 9.8px/1.6 var(--font-mono); - color: var(--text-1); - overflow: hidden; - flex: 1; - min-height: 0; -} - -.card-foot { - display: flex; - justify-content: space-between; - gap: 6px; - font-size: 9.5px; - color: var(--text-2); -} - -.card .bar { - height: 3px; - border-radius: 2px; - background: var(--bg-3); - overflow: hidden; -} - -.card .bar span { - display: block; - height: 100%; - width: 50%; - background: var(--amber-fill); -} - -.card .items { - font-size: 9.8px; - color: var(--text-1); - display: grid; - gap: 3px; -} - -.card .items span::before { - content: ''; - display: inline-block; - width: 7px; - height: 7px; - margin-right: 6px; - border: 1px solid var(--text-2); - border-radius: 2px; - vertical-align: -1px; -} - -// A folder on the board: its colour arrives as `--c`, an RGB triplet. -.zone { - border: 1px solid rgba(var(--c), 0.6); - background: rgba(var(--c), 0.05); - border-radius: 10px; -} - -.zone-head { - display: flex; - align-items: center; - gap: 8px; - height: 40px; - padding: 0 12px; - font-weight: 680; - font-size: 12.5px; -} - -.zone-head .sw, -.zone-title .sw { - width: 10px; - height: 10px; - border-radius: 3px; - background: rgb(var(--c)); - flex: none; -} - -.zone-head .count { - color: var(--text-2); - font-weight: 500; -} - -// A section's name, in its folder's colour. -.zone-title { - display: inline-flex; - align-items: center; - gap: 10px; - font-size: 15px; - font-weight: 680; - color: var(--text-1); -} - -.zone-title .sw { - width: 12px; - height: 12px; -} - -// The application's frame: a rail of spaces or collections, and the view beside it. -.app { - position: absolute; - inset: 0; - display: grid; - grid-template-columns: 168px minmax(0, 1fr); -} - -.app-side { - border-right: 1px solid var(--line-soft); - padding: 12px 8px; - font-size: 12.5px; - display: grid; - gap: 2px; - align-content: start; -} - -.app-side .h { - font-size: 11.5px; - font-weight: 650; - color: var(--text-2); - padding: 2px 8px 6px; -} - -.app-side .row { - display: flex; - align-items: center; - gap: 7px; - padding: 5px 8px; - border-radius: 6px; - color: var(--text-1); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.app-side .row.sub { - padding-left: 20px; -} - -.app-side .row.on { - background: rgba(var(--amber-rgb), 0.13); - color: var(--amber-text); - font-weight: 600; -} - -.app-side .sw { - width: 8px; - height: 8px; - border-radius: 2px; - background: rgb(var(--c)); - flex: none; -} - -.app-side .foot { - margin-top: 10px; - padding: 6px 8px; - color: var(--text-2); - font-size: 12px; - border-top: 1px solid var(--line-soft); -} - -@container (max-width: 560px) { - .app { - grid-template-columns: minmax(0, 1fr); - } - - .app-side { - display: none; - } -}